Skip to content

Commit 9ef5a3d

Browse files
author
nabi-ebrahimi
committed
Update markReportPaymentReceived function to accept accountID and email parameters
1 parent f39904b commit 9ef5a3d

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/hooks/useLifecycleActions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,15 @@ function useLifecycleActions({reportID, startApprovedAnimation, startAnimation,
291291
CONST.IOU.REPORT_ACTION_TYPE.PAY,
292292
() => {
293293
startAnimation();
294-
markReportPaymentReceived(chatReport, moneyRequestReport, nextStep);
294+
markReportPaymentReceived(chatReport, moneyRequestReport, nextStep, accountID, email ?? '');
295295
},
296296
CONST.IOU.PAYMENT_TYPE.ELSEWHERE,
297297
);
298298
return;
299299
}
300300

301301
startAnimation();
302-
markReportPaymentReceived(chatReport, moneyRequestReport, nextStep);
302+
markReportPaymentReceived(chatReport, moneyRequestReport, nextStep, accountID, email ?? '');
303303
},
304304
},
305305
[CONST.REPORT.SECONDARY_ACTIONS.UNAPPROVE]: {

src/libs/actions/IOU/PayMoneyRequest.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type {PaymentMethod} from '@components/KYCWall/types';
55
import * as API from '@libs/API';
66
import type {MarkReportPaymentReceivedParams, PayInvoiceParams, PayMoneyRequestParams} from '@libs/API/parameters';
77
import {WRITE_COMMANDS} from '@libs/API/types';
8-
import {getCurrentUserEmail} from '@libs/CurrentUserStore';
98
import DateUtils from '@libs/DateUtils';
109
import {getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils';
1110
import Navigation from '@libs/Navigation/Navigation';
@@ -812,14 +811,14 @@ function markReportPaymentReceived(
812811
chatReport: OnyxEntry<OnyxTypes.Report>,
813812
iouReport: OnyxEntry<OnyxTypes.Report>,
814813
iouReportCurrentNextStepDeprecated: OnyxEntry<OnyxTypes.ReportNextStepDeprecated>,
814+
currentUserAccountID: number,
815+
currentUserEmail: string,
815816
) {
816817
if (!chatReport || !iouReport) {
817818
return;
818819
}
819820

820821
const allTransactionViolations = getAllTransactionViolations();
821-
const currentUserAccountID = getUserAccountID();
822-
const currentUserEmail = getCurrentUserEmail();
823822
const recipient = {accountID: iouReport.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID};
824823
const total = (iouReport.total ?? 0) - (iouReport.nonReimbursableTotal ?? 0);
825824
const optimisticIOUReportAction = buildOptimisticIOUReportAction({

tests/actions/IOUTest/PayMoneyRequestTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ describe('actions/IOU/PayMoneyRequest', () => {
10951095

10961096
mockFetch?.pause?.();
10971097

1098-
markReportPaymentReceived(chatReport, reimbursedReport, undefined);
1098+
markReportPaymentReceived(chatReport, reimbursedReport, undefined, currentUserAccountID, currentUserEmail);
10991099
await waitForBatchedUpdates();
11001100

11011101
const updatedChatReport = await new Promise<OnyxEntry<Report>>((resolve) => {

0 commit comments

Comments
 (0)