@@ -23,6 +23,7 @@ import type {Route} from '@src/ROUTES';
2323import ROUTES from '@src/ROUTES' ;
2424import type {
2525 Beta ,
26+ BillingGraceEndPeriod ,
2627 IntroSelected ,
2728 LastSelectedDistanceRates ,
2829 PersonalDetailsList ,
@@ -127,6 +128,7 @@ type MoneyRequestStepScanParticipantsFlowParams = {
127128 participants : Participant [ ] ;
128129 participantsPolicyTags : Record < string , PolicyTagLists > ;
129130 amountOwed : OnyxEntry < number > ;
131+ userBillingGraceEndPeriods : OnyxCollection < BillingGraceEndPeriod > ;
130132 ownerBillingGraceEndPeriod ?: OnyxEntry < number > ;
131133} ;
132134
@@ -174,6 +176,7 @@ type MoneyRequestStepDistanceNavigationParams = {
174176 personalOutputCurrency ?: string ;
175177 isSelfTourViewed : boolean ;
176178 amountOwed : OnyxEntry < number > ;
179+ userBillingGraceEndPeriods : OnyxCollection < BillingGraceEndPeriod > ;
177180 ownerBillingGraceEndPeriod ?: OnyxEntry < number > ;
178181} ;
179182
@@ -336,6 +339,7 @@ function handleMoneyRequestStepScanParticipants({
336339 participants,
337340 participantsPolicyTags,
338341 amountOwed,
342+ userBillingGraceEndPeriods,
339343 ownerBillingGraceEndPeriod,
340344} : MoneyRequestStepScanParticipantsFlowParams ) {
341345 if ( backTo ) {
@@ -514,7 +518,7 @@ function handleMoneyRequestStepScanParticipants({
514518
515519 // If there was no reportID, then that means the user started this flow from the global + menu
516520 // and an optimistic reportID was generated. In that case, the next step is to select the participants for this expense.
517- if ( shouldUseDefaultExpensePolicy ( iouType , defaultExpensePolicy , amountOwed , ownerBillingGraceEndPeriod ) ) {
521+ if ( shouldUseDefaultExpensePolicy ( iouType , defaultExpensePolicy , amountOwed , userBillingGraceEndPeriods , ownerBillingGraceEndPeriod ) ) {
518522 const shouldAutoReport = ! ! defaultExpensePolicy ?. autoReporting || isAutoReporting ;
519523 const targetReport = shouldAutoReport ? getPolicyExpenseChat ( currentUserAccountID , defaultExpensePolicy ?. id ) : selfDMReport ;
520524 const transactionReportID = isSelfDM ( targetReport ) ? CONST . REPORT . UNREPORTED_REPORT_ID : targetReport ?. reportID ;
@@ -593,6 +597,7 @@ function handleMoneyRequestStepDistanceNavigation({
593597 personalOutputCurrency,
594598 isSelfTourViewed,
595599 amountOwed,
600+ userBillingGraceEndPeriods,
596601 ownerBillingGraceEndPeriod,
597602} : MoneyRequestStepDistanceNavigationParams ) {
598603 const isManualDistance = manualDistance !== undefined ;
@@ -743,7 +748,7 @@ function handleMoneyRequestStepDistanceNavigation({
743748
744749 // If there was no reportID, then that means the user started this flow from the global menu
745750 // and an optimistic reportID was generated. In that case, the next step is to select the participants for this expense.
746- if ( defaultExpensePolicy && shouldUseDefaultExpensePolicy ( iouType , defaultExpensePolicy , amountOwed , ownerBillingGraceEndPeriod ) ) {
751+ if ( defaultExpensePolicy && shouldUseDefaultExpensePolicy ( iouType , defaultExpensePolicy , amountOwed , userBillingGraceEndPeriods , ownerBillingGraceEndPeriod ) ) {
747752 const shouldAutoReport = ! ! defaultExpensePolicy ?. autoReporting || isAutoReporting ;
748753 const targetReport = shouldAutoReport ? getPolicyExpenseChat ( currentUserAccountID , defaultExpensePolicy ?. id ) : selfDMReport ;
749754 const isSelfDMReport = isSelfDM ( targetReport ) ;
0 commit comments