diff --git a/__tests__/core/verifyUserIdentity.spec.js b/__tests__/core/verifyUserIdentity.spec.js index 9563578348063c07c3bd0a005ae37cf6556e2513..c1488b5fe08b23814e354ad2358fa99e901ae6f7 100644 --- a/__tests__/core/verifyUserIdentity.spec.js +++ b/__tests__/core/verifyUserIdentity.spec.js @@ -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) } }) diff --git a/src/core/verifyUserIdentity.js b/src/core/verifyUserIdentity.js index 08a7d20a9981cb853dcdb1be6c0d052e350fd0f1..d535eab691880f32b7d2401c251875f55ba9c5ce 100644 --- a/src/core/verifyUserIdentity.js +++ b/src/core/verifyUserIdentity.js @@ -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) }