From 6793200e8200dcce9a93f7694c32a813d9064ae7 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Tue, 20 Feb 2024 13:27:59 +0100 Subject: [PATCH 1/2] use VBBA --- src/libs/actions/IOU.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 41f7e4101d2a..dfebe6848081 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3287,7 +3287,7 @@ function getPayMoneyRequestParams(chatReport: OnyxTypes.Report, iouReport: OnyxT } const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport.reportID}`] ?? null; - const optimisticNextStep = NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithWallet: paymentMethodType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY}); + const optimisticNextStep = NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithWallet: paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA}); const optimisticData: OnyxUpdate[] = [ { From 0c84753e34eae97c9701ff1d09bc7918c197840b Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Tue, 20 Feb 2024 14:11:59 +0100 Subject: [PATCH 2/2] rename a var --- src/libs/NextStepUtils.ts | 12 ++++++++---- src/libs/actions/IOU.ts | 2 +- tests/unit/NextStepUtilsTest.ts | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libs/NextStepUtils.ts b/src/libs/NextStepUtils.ts index db31ab02a3e5..8da35232112d 100644 --- a/src/libs/NextStepUtils.ts +++ b/src/libs/NextStepUtils.ts @@ -51,7 +51,7 @@ function parseMessage(messages: Message[] | undefined) { } type BuildNextStepParameters = { - isPaidWithWallet?: boolean; + isPaidWithExpensify?: boolean; }; /** @@ -59,10 +59,14 @@ type BuildNextStepParameters = { * * @param report * @param predictedNextStatus - a next expected status of the report - * @param parameters.isPaidWithWallet - Whether a report has been paid with the wallet or outside of Expensify + * @param parameters.isPaidWithExpensify - Whether a report has been paid with Expensify or outside * @returns nextStep */ -function buildNextStep(report: Report | EmptyObject, predictedNextStatus: ValueOf, {isPaidWithWallet}: BuildNextStepParameters = {}): ReportNextStep | null { +function buildNextStep( + report: Report | EmptyObject, + predictedNextStatus: ValueOf, + {isPaidWithExpensify}: BuildNextStepParameters = {}, +): ReportNextStep | null { if (!ReportUtils.isExpenseReport(report)) { return null; } @@ -317,7 +321,7 @@ function buildNextStep(report: Report | EmptyObject, predictedNextStatus: ValueO }; // Paid outside of Expensify - if (isPaidWithWallet === false) { + if (isPaidWithExpensify === false) { optimisticNextStep.message?.push({text: ' outside of Expensify'}); } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 846026e17477..fbc124735db3 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3314,7 +3314,7 @@ function getPayMoneyRequestParams(chatReport: OnyxTypes.Report, iouReport: OnyxT } const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport.reportID}`] ?? null; - const optimisticNextStep = NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithWallet: paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA}); + const optimisticNextStep = NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithExpensify: paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA}); const optimisticData: OnyxUpdate[] = [ { diff --git a/tests/unit/NextStepUtilsTest.ts b/tests/unit/NextStepUtilsTest.ts index 5f4b1a6ed96b..6cf8b37aadab 100644 --- a/tests/unit/NextStepUtilsTest.ts +++ b/tests/unit/NextStepUtilsTest.ts @@ -519,7 +519,7 @@ describe('libs/NextStepUtils', () => { }, ]; - const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithWallet: true}); + const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithExpensify: true}); expect(result).toMatchObject(optimisticNextStep); }); @@ -546,7 +546,7 @@ describe('libs/NextStepUtils', () => { }, ]; - const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithWallet: false}); + const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithExpensify: false}); expect(result).toMatchObject(optimisticNextStep); });