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

fix: TERMS_VERSION_MISMATCH error

parent a3ec6009
No related branches found
No related tags found
2 merge requests!56v1.4.0,!55fix: TERMS_VERSION_MISMATCH error
Pipeline #93846 passed
...@@ -39,7 +39,7 @@ describe('verifyUserIdentity', () => { ...@@ -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') findUserPdl.mockResolvedValueOnce('12345')
try { try {
await verifyUserIdentity( await verifyUserIdentity(
...@@ -56,7 +56,7 @@ describe('verifyUserIdentity', () => { ...@@ -56,7 +56,7 @@ describe('verifyUserIdentity', () => {
) )
expect(true).toBe(false) expect(true).toBe(false)
} catch (error) { } 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( ...@@ -67,7 +67,7 @@ async function verifyUserIdentity(
userAddress.escalierEtEtageEtAppartement userAddress.escalierEtEtageEtAppartement
? removeMultipleSpaces(userAddress.escalierEtEtageEtAppartement) ? removeMultipleSpaces(userAddress.escalierEtEtageEtAppartement)
: '' : ''
// Second try, trim whitespace
pdl = await findUserPdl( pdl = await findUserPdl(
`${baseUrl}/enedis_SDE_recherche-point/1.0`, `${baseUrl}/enedis_SDE_recherche-point/1.0`,
apiAuthKey, apiAuthKey,
...@@ -134,13 +134,15 @@ async function verifyUserIdentity( ...@@ -134,13 +134,15 @@ async function verifyUserIdentity(
log('error', 'PointId does not match') log('error', 'PointId does not match')
if (isAlternateStart) { if (isAlternateStart) {
Sentry.captureException('PointId does not match: Alternate start', { Sentry.captureException('PointId no longer match', {
tags: { section: 'verifyUserIdentity' }, tags: { section: 'verifyUserIdentity' },
extra: { foundPdl: pdl },
}) })
throw new Error(errors.TERMS_VERSION_MISMATCH) throw new Error(errors.USER_ACTION_NEEDED_PERMISSIONS_CHANGED)
} else { } else {
Sentry.captureException('PointId does not match', { Sentry.captureException('PointId does not match', {
tags: { section: 'verifyUserIdentity' }, tags: { section: 'verifyUserIdentity' },
extra: { foundPdl: pdl },
}) })
throw new Error(errors.LOGIN_FAILED) throw new Error(errors.LOGIN_FAILED)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment