@@ -143,6 +143,8 @@ function MoneyRequestReportPreviewContent({
143143 const { isOffline} = useNetwork ( ) ;
144144 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
145145 const currentUserDetails = useCurrentUserPersonalDetails ( ) ;
146+ const currentUserAccountID = currentUserDetails . accountID ;
147+ const currentUserEmail = currentUserDetails . email ?? '' ;
146148 const expensifyIcons = useMemoizedLazyExpensifyIcons ( [ 'ArrowRight' , 'BackArrow' , 'Location' , 'ReceiptPlus' ] ) ;
147149
148150 const { areAllRequestsBeingSmartScanned, hasNonReimbursableTransactions} = useMemo (
@@ -168,7 +170,7 @@ function MoneyRequestReportPreviewContent({
168170 const { isBetaEnabled} = usePermissions ( ) ;
169171 const [ transactionViolations ] = useOnyx ( ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS , { canBeMissing : true } ) ;
170172 const isASAPSubmitBetaEnabled = isBetaEnabled ( CONST . BETAS . ASAP_SUBMIT ) ;
171- const hasViolations = hasViolationsReportUtils ( iouReport ?. reportID , transactionViolations , currentUserDetails . accountID , currentUserDetails . email ?? '' ) ;
173+ const hasViolations = hasViolationsReportUtils ( iouReport ?. reportID , transactionViolations , currentUserAccountID , currentUserEmail ) ;
172174
173175 const getCanIOUBePaid = useCallback (
174176 ( shouldShowOnlyPayElsewhere = false ) => canIOUBePaidIOUActions ( iouReport , chatReport , policy , transactions , shouldShowOnlyPayElsewhere ) ,
@@ -248,13 +250,36 @@ function MoneyRequestReportPreviewContent({
248250 } else if ( chatReport && iouReport ) {
249251 startAnimation ( ) ;
250252 if ( isInvoiceReportUtils ( iouReport ) ) {
251- payInvoice ( type , chatReport , iouReport , introSelected , payAsBusiness , existingB2BInvoiceReport , methodID , paymentMethod , activePolicy ) ;
253+ payInvoice ( {
254+ paymentMethodType : type ,
255+ chatReport,
256+ invoiceReport : iouReport ,
257+ introSelected,
258+ currentUserAccountIDParam : currentUserAccountID ,
259+ currentUserEmailParam : currentUserEmail ,
260+ payAsBusiness,
261+ existingB2BInvoiceReport,
262+ methodID,
263+ paymentMethod,
264+ activePolicy,
265+ } ) ;
252266 } else {
253267 payMoneyRequest ( type , chatReport , iouReport , introSelected , undefined , true , activePolicy ) ;
254268 }
255269 }
256270 } ,
257- [ isDelegateAccessRestricted , iouReport , chatReport , showDelegateNoAccessModal , startAnimation , introSelected , existingB2BInvoiceReport , activePolicy ] ,
271+ [
272+ isDelegateAccessRestricted ,
273+ iouReport ,
274+ chatReport ,
275+ showDelegateNoAccessModal ,
276+ startAnimation ,
277+ introSelected ,
278+ existingB2BInvoiceReport ,
279+ activePolicy ,
280+ currentUserAccountID ,
281+ currentUserEmail ,
282+ ] ,
258283 ) ;
259284
260285 const confirmApproval = ( ) => {
@@ -269,7 +294,7 @@ function MoneyRequestReportPreviewContent({
269294 setIsHoldMenuVisible ( true ) ;
270295 } else {
271296 startApprovedAnimation ( ) ;
272- approveMoneyRequest ( iouReport , activePolicy , currentUserDetails . accountID , currentUserDetails . email ?? '' , hasViolations , isASAPSubmitBetaEnabled , iouReportNextStep , true ) ;
297+ approveMoneyRequest ( iouReport , activePolicy , currentUserAccountID , currentUserEmail , hasViolations , isASAPSubmitBetaEnabled , iouReportNextStep , true ) ;
273298 }
274299 } ;
275300
@@ -493,15 +518,15 @@ function MoneyRequestReportPreviewContent({
493518 const reportPreviewAction = useMemo ( ( ) => {
494519 return getReportPreviewAction (
495520 isIouReportArchived || isChatReportArchived ,
496- currentUserDetails . accountID ,
521+ currentUserAccountID ,
497522 iouReport ,
498523 policy ,
499524 transactions ,
500525 invoiceReceiverPolicy ,
501526 isPaidAnimationRunning ,
502527 isApprovedAnimationRunning ,
503528 isSubmittingAnimationRunning ,
504- { currentUserEmail : currentUserDetails . email ?? '' , violations : transactionViolations } ,
529+ { currentUserEmail, violations : transactionViolations } ,
505530 ) ;
506531 } , [
507532 isPaidAnimationRunning ,
@@ -513,8 +538,8 @@ function MoneyRequestReportPreviewContent({
513538 isIouReportArchived ,
514539 invoiceReceiverPolicy ,
515540 isChatReportArchived ,
516- currentUserDetails . accountID ,
517- currentUserDetails . email ,
541+ currentUserEmail ,
542+ currentUserAccountID ,
518543 transactionViolations ,
519544 ] ) ;
520545
@@ -537,7 +562,7 @@ function MoneyRequestReportPreviewContent({
537562 return ;
538563 }
539564 startSubmittingAnimation ( ) ;
540- submitReport ( iouReport , policy , currentUserDetails . accountID , currentUserDetails . email ?? '' , hasViolations , isASAPSubmitBetaEnabled , iouReportNextStep ) ;
565+ submitReport ( iouReport , policy , currentUserAccountID , currentUserEmail , hasViolations , isASAPSubmitBetaEnabled , iouReportNextStep ) ;
541566 } }
542567 isSubmittingAnimationRunning = { isSubmittingAnimationRunning }
543568 onAnimationFinish = { stopAnimation }
0 commit comments