From 42850001e5542fd1b90ea404741b51d35d54c74f Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Wed, 7 Jan 2026 00:02:03 +0530 Subject: [PATCH 1/2] Remove next step from pay functions --- src/components/MoneyReportHeader.tsx | 3 ++- src/components/ProcessMoneyReportHoldMenu.tsx | 2 +- .../MoneyRequestReportPreviewContent.tsx | 3 ++- src/libs/actions/IOU/index.ts | 9 ++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 6f4941ce60ec..31d35f57e3b1 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -513,6 +513,7 @@ function MoneyReportHeader({ paymentMethodType: type, chatReport, invoiceReport: moneyRequestReport, + invoiceReportCurrentNextStepDeprecated: nextStep, introSelected, currentUserAccountIDParam: accountID, currentUserEmailParam: email ?? '', @@ -524,7 +525,7 @@ function MoneyReportHeader({ }); } else { startAnimation(); - payMoneyRequest(type, chatReport, moneyRequestReport, introSelected, undefined, true, activePolicy, policy); + payMoneyRequest(type, chatReport, moneyRequestReport, introSelected, nextStep, undefined, true, activePolicy, policy); if (currentSearchQueryJSON && !isOffline) { search({ searchKey: currentSearchKey, diff --git a/src/components/ProcessMoneyReportHoldMenu.tsx b/src/components/ProcessMoneyReportHoldMenu.tsx index 9bcad3c354d5..c34f11928ddc 100644 --- a/src/components/ProcessMoneyReportHoldMenu.tsx +++ b/src/components/ProcessMoneyReportHoldMenu.tsx @@ -96,7 +96,7 @@ function ProcessMoneyReportHoldMenu({ if (startAnimation) { startAnimation(); } - payMoneyRequest(paymentType, chatReport, moneyRequestReport, introSelected, undefined, full, activePolicy, policy); + payMoneyRequest(paymentType, chatReport, moneyRequestReport, introSelected, moneyRequestReportNextStep, undefined, full, activePolicy, policy); } onClose(); }; diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 295ea5550ade..321a88aa5774 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -254,6 +254,7 @@ function MoneyRequestReportPreviewContent({ paymentMethodType: type, chatReport, invoiceReport: iouReport, + invoiceReportCurrentNextStepDeprecated: iouReportNextStep, introSelected, currentUserAccountIDParam: currentUserAccountID, currentUserEmailParam: currentUserEmail, @@ -264,7 +265,7 @@ function MoneyRequestReportPreviewContent({ activePolicy, }); } else { - payMoneyRequest(type, chatReport, iouReport, introSelected, undefined, true, activePolicy, policy); + payMoneyRequest(type, chatReport, iouReport, introSelected, iouReportNextStep, undefined, true, activePolicy, policy); } } }, diff --git a/src/libs/actions/IOU/index.ts b/src/libs/actions/IOU/index.ts index ee0fdfb0bbd5..e97b641f2a27 100644 --- a/src/libs/actions/IOU/index.ts +++ b/src/libs/actions/IOU/index.ts @@ -318,6 +318,7 @@ type PayInvoiceArgs = { chatReport: OnyxTypes.Report; invoiceReport: OnyxEntry; introSelected: OnyxEntry; + invoiceReportCurrentNextStepDeprecated: OnyxEntry; currentUserAccountIDParam: number; currentUserEmailParam: string; payAsBusiness?: boolean; @@ -9372,6 +9373,7 @@ function getPayMoneyRequestParams({ lastUsedPaymentMethod, existingB2BInvoiceReport, activePolicy, + iouReportCurrentNextStepDeprecated, }: { initialChatReport: OnyxTypes.Report; iouReport: OnyxEntry; @@ -9388,6 +9390,7 @@ function getPayMoneyRequestParams({ currentUserAccountIDParam?: number; currentUserEmailParam?: string; introSelected?: OnyxEntry; + iouReportCurrentNextStepDeprecated: OnyxEntry; }): PayMoneyRequestData { const isInvoiceReport = isInvoiceReportReportUtils(iouReport); let payerPolicyID = activePolicy?.id; @@ -9467,7 +9470,7 @@ function getPayMoneyRequestParams({ let optimisticNextStepDeprecated = null; let optimisticNextStep = null; if (!isInvoiceReport) { - currentNextStepDeprecated = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport?.reportID}`] ?? null; + currentNextStepDeprecated = iouReportCurrentNextStepDeprecated ?? null; // buildOptimisticNextStep is used in parallel // eslint-disable-next-line @typescript-eslint/no-deprecated optimisticNextStepDeprecated = buildNextStepNew({report: iouReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.REIMBURSED}); @@ -11048,6 +11051,7 @@ function payMoneyRequest( chatReport: OnyxTypes.Report, iouReport: OnyxEntry, introSelected: OnyxEntry, + iouReportCurrentNextStepDeprecated: OnyxEntry, paymentPolicyID?: string, full = true, activePolicy?: OnyxEntry, @@ -11071,6 +11075,7 @@ function payMoneyRequest( paymentPolicyID, activePolicy, reportPolicy: policy, + iouReportCurrentNextStepDeprecated, }); // For now, we need to call the PayMoneyRequestWithWallet API since PayMoneyRequest was not updated to work with @@ -11095,6 +11100,7 @@ function payInvoice({ methodID, paymentMethod, activePolicy, + invoiceReportCurrentNextStepDeprecated, }: PayInvoiceArgs) { const recipient = {accountID: invoiceReport?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID}; const { @@ -11116,6 +11122,7 @@ function payInvoice({ } = getPayMoneyRequestParams({ initialChatReport: chatReport, iouReport: invoiceReport, + iouReportCurrentNextStepDeprecated: invoiceReportCurrentNextStepDeprecated, recipient, paymentMethodType, full: true, From 9f53cbbd831a082ab6c426703d5c65d3960e49cc Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Wed, 7 Jan 2026 00:19:38 +0530 Subject: [PATCH 2/2] Fixes --- src/components/MoneyReportHeader.tsx | 9 +++++---- .../MoneyRequestReportPreviewContent.tsx | 5 +++-- tests/actions/IOUTest.ts | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 31d35f57e3b1..a2f8ae761799 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -546,17 +546,18 @@ function MoneyReportHeader({ showDelegateNoAccessModal, startAnimation, moneyRequestReport, + nextStep, introSelected, + accountID, + email, existingB2BInvoiceReport, - shouldCalculateTotals, activePolicy, policy, currentSearchQueryJSON, - currentSearchKey, isOffline, + currentSearchKey, + shouldCalculateTotals, currentSearchResults?.search?.isLoading, - accountID, - email, ], ); diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 321a88aa5774..f2b98bb93117 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -275,11 +275,12 @@ function MoneyRequestReportPreviewContent({ chatReport, showDelegateNoAccessModal, startAnimation, + iouReportNextStep, introSelected, - existingB2BInvoiceReport, - activePolicy, currentUserAccountID, currentUserEmail, + existingB2BInvoiceReport, + activePolicy, policy, ], ); diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index e3c31104fcef..5680c8c7d598 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -3928,7 +3928,7 @@ describe('actions/IOU', () => { .then(() => { mockFetch?.pause?.(); if (chatReport && iouReport) { - payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, iouReport, undefined); + payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, iouReport, undefined, undefined); } return waitForBatchedUpdates(); }) @@ -4299,7 +4299,7 @@ describe('actions/IOU', () => { jest.advanceTimersByTime(10); // When paying the IOU report - payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, iouReport, undefined); + payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, iouReport, undefined, undefined); await waitForBatchedUpdates(); @@ -4401,7 +4401,7 @@ describe('actions/IOU', () => { }) .then(() => { // When partially paying an iou report from the chat report via the report preview - payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, {reportID: topMostReportID}, iouReport, undefined, undefined, false); + payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, {reportID: topMostReportID}, iouReport, undefined, undefined, undefined, false); return waitForBatchedUpdates(); }) .then(() => { @@ -4483,7 +4483,7 @@ describe('actions/IOU', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, expenseReport); await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, chatReport); - const newExpenseReportID = payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, expenseReport, undefined, undefined, false, undefined, policy); + const newExpenseReportID = payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, expenseReport, undefined, undefined, undefined, false, undefined, policy); await waitForBatchedUpdates(); const newExpenseReport = await getOnyxValue(`${ONYXKEYS.COLLECTION.REPORT}${newExpenseReportID}`); expect(newExpenseReport?.stateNum).toBe(CONST.REPORT.STATE_NUM.OPEN); @@ -4569,7 +4569,7 @@ describe('actions/IOU', () => { .then(() => { // When the expense report is paid elsewhere (but really, any payment option would work) if (chatReport && expenseReport) { - payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, expenseReport, undefined); + payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, expenseReport, undefined, undefined); } return waitForBatchedUpdates(); }) @@ -8122,7 +8122,7 @@ describe('actions/IOU', () => { // When the expense report is paid elsewhere (but really, any payment option would work) if (chatReport && expenseReport) { mockFetch?.pause?.(); - payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, expenseReport, undefined); + payMoneyRequest(CONST.IOU.PAYMENT_TYPE.ELSEWHERE, chatReport, expenseReport, undefined, undefined); } await waitForBatchedUpdates();