From df238a3ee8b5625c84f2e177975244b57b685fef Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 11 Dec 2025 17:10:04 +0700 Subject: [PATCH 1/6] remove connect method --- src/components/MoneyReportHeader.tsx | 2 +- .../MoneyRequestReportPreviewContent.tsx | 14 +++++++++++++- src/libs/actions/IOU.ts | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 1c218c31436..3cd9f06f4c3 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -500,7 +500,7 @@ function MoneyReportHeader({ } } else if (isInvoiceReport) { startAnimation(); - payInvoice(type, chatReport, moneyRequestReport, introSelected, payAsBusiness, existingB2BInvoiceReport, methodID, paymentMethod, activePolicy); + payInvoice(type, chatReport, moneyRequestReport, introSelected, accountID, email ?? '', payAsBusiness, existingB2BInvoiceReport, methodID, paymentMethod, activePolicy); } else { startAnimation(); payMoneyRequest(type, chatReport, moneyRequestReport, introSelected, undefined, true, activePolicy); diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 776fb12468a..d1914f2a728 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -248,7 +248,19 @@ function MoneyRequestReportPreviewContent({ } else if (chatReport && iouReport) { startAnimation(); if (isInvoiceReportUtils(iouReport)) { - payInvoice(type, chatReport, iouReport, introSelected, payAsBusiness, existingB2BInvoiceReport, methodID, paymentMethod, activePolicy); + payInvoice( + type, + chatReport, + iouReport, + introSelected, + currentUserDetails.accountID, + currentUserDetails.email ?? '', + payAsBusiness, + existingB2BInvoiceReport, + methodID, + paymentMethod, + activePolicy, + ); } else { payMoneyRequest(type, chatReport, iouReport, introSelected, undefined, true, activePolicy); } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 0f95c838d52..8297c134ab4 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -10162,6 +10162,9 @@ function getPayMoneyRequestParams({ full, payAsBusiness, bankAccountID, + currentUserAccountIDParam, + currentUserEmailParam, + introSelectedParam, paymentPolicyID, lastUsedPaymentMethod, existingB2BInvoiceReport, @@ -10178,6 +10181,9 @@ function getPayMoneyRequestParams({ lastUsedPaymentMethod?: OnyxTypes.LastPaymentMethodType; existingB2BInvoiceReport?: OnyxEntry; activePolicy?: OnyxEntry; + currentUserAccountIDParam: number; + currentUserEmailParam: string; + introSelectedParam: OnyxEntry; }): PayMoneyRequestData { const isInvoiceReport = isInvoiceReportReportUtils(iouReport); let payerPolicyID = activePolicy?.id; @@ -10199,6 +10205,10 @@ function getPayMoneyRequestParams({ policyOwnerEmail: currentUserEmail, makeMeAdmin: true, policyID: payerPolicyID, + currentUserAccountIDParam, + currentUserEmailParam, + introSelectedParam, + activePolicyIDParam: activePolicy?.id, }); const {adminsChatReportID, adminsCreatedReportActionID, expenseChatReportID, expenseCreatedReportActionID, customUnitRateID, customUnitID, ownerEmail, policyName} = params; @@ -11903,6 +11913,9 @@ function payMoneyRequest( full, paymentPolicyID, activePolicy, + currentUserAccountIDParam: CONST.DEFAULT_NUMBER_ID, + currentUserEmailParam: '', + introSelectedParam: undefined, }); // For now, we need to call the PayMoneyRequestWithWallet API since PayMoneyRequest was not updated to work with @@ -11919,6 +11932,8 @@ function payInvoice( chatReport: OnyxTypes.Report, invoiceReport: OnyxEntry, introSelected: OnyxEntry, + currentUserAccountIDParam: number, + currentUserEmailParam: string, payAsBusiness = false, existingB2BInvoiceReport?: OnyxEntry, methodID?: number, @@ -11952,6 +11967,9 @@ function payInvoice( bankAccountID: methodID, existingB2BInvoiceReport, activePolicy, + currentUserAccountIDParam, + currentUserEmailParam, + introSelectedParam: introSelected, }); const paymentSelected = paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; From 143d0a4286c172012c4686a166f8b49fefdb95ff Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 11 Dec 2025 17:40:17 +0700 Subject: [PATCH 2/6] eslint check --- src/components/MoneyReportHeader.tsx | 16 ++++++- .../MoneyRequestReportPreviewContent.tsx | 14 +++---- src/libs/actions/IOU.ts | 42 ++++++++++++------- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 3cd9f06f4c3..c9696f7c04c 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -500,7 +500,19 @@ function MoneyReportHeader({ } } else if (isInvoiceReport) { startAnimation(); - payInvoice(type, chatReport, moneyRequestReport, introSelected, accountID, email ?? '', payAsBusiness, existingB2BInvoiceReport, methodID, paymentMethod, activePolicy); + payInvoice({ + paymentMethodType: type, + chatReport, + invoiceReport: moneyRequestReport, + introSelected, + currentUserAccountID: accountID, + currentUserEmail: email ?? '', + payAsBusiness, + existingB2BInvoiceReport, + methodID, + paymentMethod, + activePolicy, + }); } else { startAnimation(); payMoneyRequest(type, chatReport, moneyRequestReport, introSelected, undefined, true, activePolicy); @@ -532,6 +544,8 @@ function MoneyReportHeader({ currentSearchKey, isOffline, currentSearchResults?.search?.isLoading, + accountID, + email, ], ); diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index d1914f2a728..9065e8727bc 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -248,25 +248,25 @@ function MoneyRequestReportPreviewContent({ } else if (chatReport && iouReport) { startAnimation(); if (isInvoiceReportUtils(iouReport)) { - payInvoice( - type, + payInvoice({ + paymentMethodType: type, chatReport, - iouReport, + invoiceReport: iouReport, introSelected, - currentUserDetails.accountID, - currentUserDetails.email ?? '', + currentUserAccountID: currentUserDetails.accountID, + currentUserEmail: currentUserDetails.email ?? '', payAsBusiness, existingB2BInvoiceReport, methodID, paymentMethod, activePolicy, - ); + }); } else { payMoneyRequest(type, chatReport, iouReport, introSelected, undefined, true, activePolicy); } } }, - [isDelegateAccessRestricted, iouReport, chatReport, showDelegateNoAccessModal, startAnimation, introSelected, existingB2BInvoiceReport, activePolicy], + [isDelegateAccessRestricted, iouReport, chatReport, showDelegateNoAccessModal, startAnimation, introSelected, existingB2BInvoiceReport, activePolicy, currentUserDetails], ); const confirmApproval = () => { diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 8297c134ab4..53a67cf82ce 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -319,6 +319,20 @@ type MoneyRequestInformation = { reimbursable?: boolean; }; +type PayInvoiceArgs = { + paymentMethodType: PaymentMethodType; + chatReport: OnyxTypes.Report; + invoiceReport: OnyxEntry; + introSelected: OnyxEntry; + currentUserAccountID: number; + currentUserEmail: string; + payAsBusiness?: boolean; + existingB2BInvoiceReport?: OnyxEntry; + methodID?: number; + paymentMethod?: PaymentMethod; + activePolicy?: OnyxTypes.Policy; +}; + type RejectMoneyRequestData = { optimisticData: OnyxUpdate[]; successData: OnyxUpdate[]; @@ -11927,19 +11941,19 @@ function payMoneyRequest( notifyNewAction(!full ? (Navigation.getTopmostReportId() ?? iouReport?.reportID) : iouReport?.reportID, userAccountID); } -function payInvoice( - paymentMethodType: PaymentMethodType, - chatReport: OnyxTypes.Report, - invoiceReport: OnyxEntry, - introSelected: OnyxEntry, - currentUserAccountIDParam: number, - currentUserEmailParam: string, +function payInvoice({ + paymentMethodType, + chatReport, + invoiceReport, + introSelected, + currentUserAccountID, + currentUserEmail, payAsBusiness = false, - existingB2BInvoiceReport?: OnyxEntry, - methodID?: number, - paymentMethod?: PaymentMethod, - activePolicy?: OnyxTypes.Policy, -) { + existingB2BInvoiceReport, + methodID, + paymentMethod, + activePolicy, +}: PayInvoiceArgs) { const recipient = {accountID: invoiceReport?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID}; const { optimisticData, @@ -11967,8 +11981,8 @@ function payInvoice( bankAccountID: methodID, existingB2BInvoiceReport, activePolicy, - currentUserAccountIDParam, - currentUserEmailParam, + currentUserAccountIDParam: currentUserAccountID, + currentUserEmailParam: currentUserEmail, introSelectedParam: introSelected, }); From 11a8acd0447997591a57c417260670d616aafd65 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 11 Dec 2025 18:00:51 +0700 Subject: [PATCH 3/6] chore --- .../MoneyRequestReportPreviewContent.tsx | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 9065e8727bc..39c33af8822 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -143,6 +143,8 @@ function MoneyRequestReportPreviewContent({ const {isOffline} = useNetwork(); const {shouldUseNarrowLayout} = useResponsiveLayout(); const currentUserDetails = useCurrentUserPersonalDetails(); + const currentUserAccountID = currentUserDetails.accountID; + const currentUserEmail = currentUserDetails.email ?? ''; const expensifyIcons = useMemoizedLazyExpensifyIcons(['ArrowRight', 'BackArrow', 'Location'] as const); const {areAllRequestsBeingSmartScanned, hasNonReimbursableTransactions} = useMemo( @@ -168,7 +170,7 @@ function MoneyRequestReportPreviewContent({ const {isBetaEnabled} = usePermissions(); const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true}); const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT); - const hasViolations = hasViolationsReportUtils(iouReport?.reportID, transactionViolations, currentUserDetails.accountID, currentUserDetails.email ?? ''); + const hasViolations = hasViolationsReportUtils(iouReport?.reportID, transactionViolations, currentUserAccountID, currentUserEmail); const getCanIOUBePaid = useCallback( (shouldShowOnlyPayElsewhere = false) => canIOUBePaidIOUActions(iouReport, chatReport, policy, transactions, shouldShowOnlyPayElsewhere), @@ -253,8 +255,8 @@ function MoneyRequestReportPreviewContent({ chatReport, invoiceReport: iouReport, introSelected, - currentUserAccountID: currentUserDetails.accountID, - currentUserEmail: currentUserDetails.email ?? '', + currentUserAccountID, + currentUserEmail, payAsBusiness, existingB2BInvoiceReport, methodID, @@ -266,7 +268,18 @@ function MoneyRequestReportPreviewContent({ } } }, - [isDelegateAccessRestricted, iouReport, chatReport, showDelegateNoAccessModal, startAnimation, introSelected, existingB2BInvoiceReport, activePolicy, currentUserDetails], + [ + isDelegateAccessRestricted, + iouReport, + chatReport, + showDelegateNoAccessModal, + startAnimation, + introSelected, + existingB2BInvoiceReport, + activePolicy, + currentUserAccountID, + currentUserEmail, + ], ); const confirmApproval = () => { @@ -281,7 +294,7 @@ function MoneyRequestReportPreviewContent({ setIsHoldMenuVisible(true); } else { startApprovedAnimation(); - approveMoneyRequest(iouReport, activePolicy, currentUserDetails.accountID, currentUserDetails.email ?? '', hasViolations, isASAPSubmitBetaEnabled, iouReportNextStep, true); + approveMoneyRequest(iouReport, activePolicy, currentUserAccountID, currentUserEmail, hasViolations, isASAPSubmitBetaEnabled, iouReportNextStep, true); } }; @@ -505,7 +518,7 @@ function MoneyRequestReportPreviewContent({ const reportPreviewAction = useMemo(() => { return getReportPreviewAction( isIouReportArchived || isChatReportArchived, - currentUserDetails.accountID, + currentUserAccountID, iouReport, policy, transactions, @@ -524,7 +537,7 @@ function MoneyRequestReportPreviewContent({ isIouReportArchived, invoiceReceiverPolicy, isChatReportArchived, - currentUserDetails.accountID, + currentUserAccountID, ]); const addExpenseDropdownOptions = useMemo( @@ -546,7 +559,7 @@ function MoneyRequestReportPreviewContent({ return; } startSubmittingAnimation(); - submitReport(iouReport, policy, currentUserDetails.accountID, currentUserDetails.email ?? '', hasViolations, isASAPSubmitBetaEnabled, iouReportNextStep); + submitReport(iouReport, policy, currentUserAccountID, currentUserEmail, hasViolations, isASAPSubmitBetaEnabled, iouReportNextStep); }} isSubmittingAnimationRunning={isSubmittingAnimationRunning} onAnimationFinish={stopAnimation} From d39de188f8ce87069fed2d6eb304b4378777c1c4 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 11 Dec 2025 18:38:12 +0700 Subject: [PATCH 4/6] chore --- src/libs/actions/IOU.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 53a67cf82ce..80b89a2c428 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -324,8 +324,8 @@ type PayInvoiceArgs = { chatReport: OnyxTypes.Report; invoiceReport: OnyxEntry; introSelected: OnyxEntry; - currentUserAccountID: number; - currentUserEmail: string; + currentUserAccountIDParam: number; + currentUserEmailParam: string; payAsBusiness?: boolean; existingB2BInvoiceReport?: OnyxEntry; methodID?: number; @@ -11946,8 +11946,8 @@ function payInvoice({ chatReport, invoiceReport, introSelected, - currentUserAccountID, - currentUserEmail, + currentUserAccountIDParam, + currentUserEmailParam, payAsBusiness = false, existingB2BInvoiceReport, methodID, @@ -11981,8 +11981,8 @@ function payInvoice({ bankAccountID: methodID, existingB2BInvoiceReport, activePolicy, - currentUserAccountIDParam: currentUserAccountID, - currentUserEmailParam: currentUserEmail, + currentUserAccountIDParam, + currentUserEmailParam, introSelectedParam: introSelected, }); From 54ce6f76715111e9adf1e684c8f4ddc0bac1496b Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 11 Dec 2025 18:53:15 +0700 Subject: [PATCH 5/6] chore --- src/components/MoneyReportHeader.tsx | 4 ++-- .../MoneyRequestReportPreviewContent.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index c9696f7c04c..f7a5a239d07 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -505,8 +505,8 @@ function MoneyReportHeader({ chatReport, invoiceReport: moneyRequestReport, introSelected, - currentUserAccountID: accountID, - currentUserEmail: email ?? '', + currentUserAccountIDParam: accountID, + currentUserEmailParam: email ?? '', payAsBusiness, existingB2BInvoiceReport, methodID, diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 39c33af8822..a2ec0394ea3 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -255,8 +255,8 @@ function MoneyRequestReportPreviewContent({ chatReport, invoiceReport: iouReport, introSelected, - currentUserAccountID, - currentUserEmail, + currentUserAccountIDParam: currentUserAccountID, + currentUserEmailParam: currentUserEmail, payAsBusiness, existingB2BInvoiceReport, methodID, From 1a9ea4c65b40ab100777cd899b1990a3c5fdd2b6 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Sat, 20 Dec 2025 22:23:39 +0700 Subject: [PATCH 6/6] update to optional param --- src/libs/actions/IOU.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 358ebdca887..b7b974784d3 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -10359,9 +10359,9 @@ function getPayMoneyRequestParams({ lastUsedPaymentMethod?: OnyxTypes.LastPaymentMethodType; existingB2BInvoiceReport?: OnyxEntry; activePolicy?: OnyxEntry; - currentUserAccountIDParam: number; - currentUserEmailParam: string; - introSelectedParam: OnyxEntry; + currentUserAccountIDParam?: number; + currentUserEmailParam?: string; + introSelectedParam?: OnyxEntry; }): PayMoneyRequestData { const isInvoiceReport = isInvoiceReportReportUtils(iouReport); let payerPolicyID = activePolicy?.id; @@ -12103,9 +12103,6 @@ function payMoneyRequest( full, paymentPolicyID, activePolicy, - currentUserAccountIDParam: CONST.DEFAULT_NUMBER_ID, - currentUserEmailParam: '', - introSelectedParam: undefined, }); // For now, we need to call the PayMoneyRequestWithWallet API since PayMoneyRequest was not updated to work with