From e44b5220ac5d9253716403b5d79557db7d1ffc0c Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Thu, 12 Sep 2024 10:15:05 -1000 Subject: [PATCH] Use jsonCode instead of error message --- src/CONST.ts | 1 + src/libs/actions/Card.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 0778478c2950..3488363922e4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1149,6 +1149,7 @@ const CONST = { MANY_WRITES_ERROR: 665, UNABLE_TO_RETRY: 'unableToRetry', UPDATE_REQUIRED: 426, + INCORRECT_MAGIC_CODE: 451, }, HTTP_STATUS: { // When Cloudflare throttles diff --git a/src/libs/actions/Card.ts b/src/libs/actions/Card.ts index 15d1eadb662d..e423af5bb7e7 100644 --- a/src/libs/actions/Card.ts +++ b/src/libs/actions/Card.ts @@ -202,7 +202,7 @@ function revealVirtualCardDetails(cardID: number, validateCode: string): Promise API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.REVEAL_EXPENSIFY_CARD_DETAILS, parameters) .then((response) => { if (response?.jsonCode !== CONST.JSON_CODE.SUCCESS) { - if (response?.message === 'Incorrect or invalid magic code. Please try again.') { + if (response?.jsonCode === CONST.JSON_CODE.INCORRECT_MAGIC_CODE) { // eslint-disable-next-line prefer-promise-reject-errors reject('validateCodeForm.error.incorrectMagicCode'); return;