From da3c4683dd0cb913f29590b9b2da6140015106f7 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 22 May 2024 10:05:21 +0700 Subject: [PATCH 1/4] fix: Error message only changes after clicking Split expense button for the second time --- .../MoneyRequestConfirmationList.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 33f1258e60c7..f40998410962 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -708,16 +708,7 @@ function MoneyRequestConfirmationList({ return; } - if (iouType === CONST.IOU.TYPE.PAY) { - if (!paymentMethod) { - return; - } - - setDidConfirm(true); - - Log.info(`[IOU] Sending money via: ${paymentMethod}`); - onSendMoney?.(paymentMethod); - } else { + if (iouType !== CONST.IOU.TYPE.PAY) { // validate the amount for distance expenses const decimals = CurrencyUtils.getCurrencyDecimals(iouCurrencyCode); if (isDistanceRequest && !isDistanceRequestWithPendingRoute && !MoneyRequestUtils.validateAmount(String(iouAmount), decimals)) { @@ -730,7 +721,18 @@ function MoneyRequestConfirmationList({ setFormError('iou.error.genericSmartscanFailureMessage'); return; } + } + if (iouType === CONST.IOU.TYPE.PAY) { + if (!paymentMethod) { + return; + } + + setDidConfirm(true); + + Log.info(`[IOU] Sending money via: ${paymentMethod}`); + onSendMoney?.(paymentMethod); + } else { playSound(SOUNDS.DONE); setDidConfirm(true); onConfirm?.(selectedParticipants); From 556066827a66f0149d37e6f098d23eafeb81d2d2 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 22 May 2024 10:35:01 +0700 Subject: [PATCH 2/4] fix logic show money request form error --- .../MoneyRequestConfirmationList.tsx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index f40998410962..0c5eb26c48e7 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -346,14 +346,15 @@ function MoneyRequestConfirmationList({ const isCategoryRequired = !!policy?.requiresCategory; useEffect(() => { - if (shouldDisplayFieldError && hasSmartScanFailed) { - setFormError('iou.receiptScanningFailed'); - return; - } if (shouldDisplayFieldError && didConfirmSplit) { setFormError('iou.error.genericSmartscanFailureMessage'); return; } + + if (shouldDisplayFieldError && hasSmartScanFailed) { + setFormError('iou.receiptScanningFailed'); + return; + } // reset the form error whenever the screen gains or loses focus setFormError(''); @@ -703,11 +704,6 @@ function MoneyRequestConfirmationList({ setFormError('iou.error.invalidCategoryLength'); return; } - - if (formError) { - return; - } - if (iouType !== CONST.IOU.TYPE.PAY) { // validate the amount for distance expenses const decimals = CurrencyUtils.getCurrencyDecimals(iouCurrencyCode); @@ -721,6 +717,14 @@ function MoneyRequestConfirmationList({ setFormError('iou.error.genericSmartscanFailureMessage'); return; } + + playSound(SOUNDS.DONE); + setDidConfirm(true); + onConfirm?.(selectedParticipants); + } + + if (formError) { + return; } if (iouType === CONST.IOU.TYPE.PAY) { @@ -732,10 +736,6 @@ function MoneyRequestConfirmationList({ Log.info(`[IOU] Sending money via: ${paymentMethod}`); onSendMoney?.(paymentMethod); - } else { - playSound(SOUNDS.DONE); - setDidConfirm(true); - onConfirm?.(selectedParticipants); } }, [ From 11a896d09e4c234f1a8ac60402ecfd57d85951a9 Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Thu, 30 May 2024 18:52:34 +0700 Subject: [PATCH 3/4] Update src/components/MoneyRequestConfirmationList.tsx Co-authored-by: Aldo Canepa Garay <87341702+aldo-expensify@users.noreply.github.com> --- src/components/MoneyRequestConfirmationList.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 0c5eb26c48e7..8439dbb2cde7 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -723,11 +723,10 @@ function MoneyRequestConfirmationList({ onConfirm?.(selectedParticipants); } - if (formError) { - return; - } - - if (iouType === CONST.IOU.TYPE.PAY) { + else { + if (formError) { + return; + } if (!paymentMethod) { return; } From 4eaa6c32b210207f329ecdc0c9611072ed05a7a1 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 30 May 2024 18:54:53 +0700 Subject: [PATCH 4/4] fix lint --- src/components/MoneyRequestConfirmationList.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 242dedfeec77..34926c84eb39 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -723,9 +723,7 @@ function MoneyRequestConfirmationList({ playSound(SOUNDS.DONE); setDidConfirm(true); onConfirm?.(selectedParticipants); - } - - else { + } else { if (formError) { return; }