Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ function MoneyReportHeader({
paymentMethodType: type,
chatReport,
invoiceReport: moneyRequestReport,
invoiceReportCurrentNextStepDeprecated: nextStep,
introSelected,
currentUserAccountIDParam: accountID,
currentUserEmailParam: email ?? '',
Expand All @@ -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,
Expand All @@ -545,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,
],
);

Expand Down
2 changes: 1 addition & 1 deletion src/components/ProcessMoneyReportHoldMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ function MoneyRequestReportPreviewContent({
paymentMethodType: type,
chatReport,
invoiceReport: iouReport,
invoiceReportCurrentNextStepDeprecated: iouReportNextStep,
introSelected,
currentUserAccountIDParam: currentUserAccountID,
currentUserEmailParam: currentUserEmail,
Expand All @@ -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);
}
}
},
Expand All @@ -274,11 +275,12 @@ function MoneyRequestReportPreviewContent({
chatReport,
showDelegateNoAccessModal,
startAnimation,
iouReportNextStep,
introSelected,
existingB2BInvoiceReport,
activePolicy,
currentUserAccountID,
currentUserEmail,
existingB2BInvoiceReport,
activePolicy,
policy,
],
);
Expand Down
9 changes: 8 additions & 1 deletion src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
chatReport: OnyxTypes.Report;
invoiceReport: OnyxEntry<OnyxTypes.Report>;
introSelected: OnyxEntry<OnyxTypes.IntroSelected>;
invoiceReportCurrentNextStepDeprecated: OnyxEntry<OnyxTypes.ReportNextStepDeprecated>;
currentUserAccountIDParam: number;
currentUserEmailParam: string;
payAsBusiness?: boolean;
Expand Down Expand Up @@ -715,7 +716,7 @@
quickAction: OnyxEntry<OnyxTypes.QuickAction>;
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};

Check warning on line 719 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
Expand Down Expand Up @@ -817,7 +818,7 @@
hash?: number;
};

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};

Check warning on line 821 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
Expand All @@ -831,7 +832,7 @@
},
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};

Check warning on line 835 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
Expand All @@ -840,7 +841,7 @@
},
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};

Check warning on line 844 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
Expand All @@ -854,7 +855,7 @@
},
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStepDeprecated>> = {};

Check warning on line 858 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
Expand All @@ -863,7 +864,7 @@
},
});

let allReports: OnyxCollection<OnyxTypes.Report>;

Check warning on line 867 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
Expand All @@ -872,7 +873,7 @@
},
});

let allReportNameValuePairs: OnyxCollection<OnyxTypes.ReportNameValuePairs>;

Check warning on line 876 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
Expand All @@ -882,7 +883,7 @@
});

let userAccountID = -1;
let currentUserEmail = '';

Check warning on line 886 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (value) => {
Expand All @@ -891,7 +892,7 @@
},
});

let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>;

Check warning on line 895 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
Expand All @@ -900,7 +901,7 @@
});

let deprecatedQuickAction: OnyxEntry<OnyxTypes.QuickAction> = {};
// eslint-disable-next-line @typescript-eslint/no-deprecated

Check warning on line 904 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
callback: (value) => {
Expand Down Expand Up @@ -9372,6 +9373,7 @@
lastUsedPaymentMethod,
existingB2BInvoiceReport,
activePolicy,
iouReportCurrentNextStepDeprecated,
}: {
initialChatReport: OnyxTypes.Report;
iouReport: OnyxEntry<OnyxTypes.Report>;
Expand All @@ -9388,6 +9390,7 @@
currentUserAccountIDParam?: number;
currentUserEmailParam?: string;
introSelected?: OnyxEntry<OnyxTypes.IntroSelected>;
iouReportCurrentNextStepDeprecated: OnyxEntry<OnyxTypes.ReportNextStepDeprecated>;
}): PayMoneyRequestData {
const isInvoiceReport = isInvoiceReportReportUtils(iouReport);
let payerPolicyID = activePolicy?.id;
Expand Down Expand Up @@ -9467,7 +9470,7 @@
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});
Expand Down Expand Up @@ -11048,6 +11051,7 @@
chatReport: OnyxTypes.Report,
iouReport: OnyxEntry<OnyxTypes.Report>,
introSelected: OnyxEntry<OnyxTypes.IntroSelected>,
iouReportCurrentNextStepDeprecated: OnyxEntry<OnyxTypes.ReportNextStepDeprecated>,
paymentPolicyID?: string,
full = true,
activePolicy?: OnyxEntry<OnyxTypes.Policy>,
Expand All @@ -11071,6 +11075,7 @@
paymentPolicyID,
activePolicy,
reportPolicy: policy,
iouReportCurrentNextStepDeprecated,
});

// For now, we need to call the PayMoneyRequestWithWallet API since PayMoneyRequest was not updated to work with
Expand All @@ -11095,6 +11100,7 @@
methodID,
paymentMethod,
activePolicy,
invoiceReportCurrentNextStepDeprecated,
}: PayInvoiceArgs) {
const recipient = {accountID: invoiceReport?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID};
const {
Expand All @@ -11116,6 +11122,7 @@
} = getPayMoneyRequestParams({
initialChatReport: chatReport,
iouReport: invoiceReport,
iouReportCurrentNextStepDeprecated: invoiceReportCurrentNextStepDeprecated,
recipient,
paymentMethodType,
full: true,
Expand Down
12 changes: 6 additions & 6 deletions tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
})
Expand Down Expand Up @@ -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();

Expand Down
Loading