Skip to content
Snippets Groups Projects
Commit 4c16f16e authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

Merge branch 'fix/terms_version_mismatch_error' into 'dev'

fix: TERMS_VERSION_MISMATCH error

See merge request !55
parents a3ec6009 5fdbe11a
No related branches found
No related tags found
2 merge requests!56v1.4.0,!55fix: TERMS_VERSION_MISMATCH error
Pipeline #93848 passed
......@@ -39,7 +39,7 @@ describe('verifyUserIdentity', () => {
}
})
it('should throw TERMS_VERSION_MISMATCH when pdl give and received are NOT matching on alternate start 🚫', async () => {
it('should throw USER_ACTION_NEEDED_PERMISSIONS_CHANGED when pdl give and received are NOT matching on alternate start 🚫', async () => {
findUserPdl.mockResolvedValueOnce('12345')
try {
await verifyUserIdentity(
......@@ -56,7 +56,7 @@ describe('verifyUserIdentity', () => {
)
expect(true).toBe(false)
} catch (error) {
expect(error.message).toBe(errors.TERMS_VERSION_MISMATCH)
expect(error.message).toBe(errors.USER_ACTION_NEEDED_PERMISSIONS_CHANGED)
}
})
......
......@@ -67,7 +67,7 @@ async function verifyUserIdentity(
userAddress.escalierEtEtageEtAppartement
? removeMultipleSpaces(userAddress.escalierEtEtageEtAppartement)
: ''
// Second try, trim whitespace
pdl = await findUserPdl(
`${baseUrl}/enedis_SDE_recherche-point/1.0`,
apiAuthKey,
......@@ -134,13 +134,15 @@ async function verifyUserIdentity(
log('error', 'PointId does not match')
if (isAlternateStart) {
Sentry.captureException('PointId does not match: Alternate start', {
Sentry.captureException('PointId no longer match', {
tags: { section: 'verifyUserIdentity' },
extra: { foundPdl: pdl },
})
throw new Error(errors.TERMS_VERSION_MISMATCH)
throw new Error(errors.USER_ACTION_NEEDED_PERMISSIONS_CHANGED)
} else {
Sentry.captureException('PointId does not match', {
tags: { section: 'verifyUserIdentity' },
extra: { foundPdl: pdl },
})
throw new Error(errors.LOGIN_FAILED)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment