@@ -184,74 +184,77 @@ function SettlementButton({
184184 return formattedPaymentMethods . filter ( ( ba ) => ( ba . accountData as AccountData ) ?. type === CONST . BANK_ACCOUNT . TYPE . PERSONAL ) ;
185185 }
186186
187- const checkForNecessaryAction = useCallback ( ( ) => {
188- if ( isDelegateAccessRestricted ) {
189- showDelegateNoAccessModal ( ) ;
190- return true ;
191- }
187+ const checkForNecessaryAction = useCallback (
188+ ( paymentMethodType ?: PaymentMethodType ) => {
189+ if ( isDelegateAccessRestricted ) {
190+ showDelegateNoAccessModal ( ) ;
191+ return true ;
192+ }
192193
193- if ( isAccountLocked ) {
194- showLockedAccountModal ( ) ;
195- return true ;
196- }
194+ if ( isAccountLocked ) {
195+ showLockedAccountModal ( ) ;
196+ return true ;
197+ }
197198
198- if ( ! isUserValidated ) {
199- handleUnvalidatedUserNavigation ( chatReportID , reportID ) ;
200- return true ;
201- }
199+ if ( ! isUserValidated && paymentMethodType !== CONST . IOU . PAYMENT_TYPE . ELSEWHERE ) {
200+ handleUnvalidatedUserNavigation ( chatReportID , reportID ) ;
201+ return true ;
202+ }
202203
203- if ( isBankAccountLocked ) {
204- showConfirmModal ( {
205- title : translate ( 'bankAccount.lockedBankAccount' ) ,
206- prompt : (
207- < View style = { [ styles . renderHTML , styles . flexRow ] } >
208- < RenderHTML html = { translate ( 'bankAccount.youCantPayThis' ) } />
209- </ View >
210- ) ,
211- confirmText : translate ( 'bankAccount.unlockBankAccount' ) ,
212- cancelText : translate ( 'common.cancel' ) ,
213- } ) . then ( ( { action} ) => {
214- if ( action !== ModalActions . CONFIRM ) {
215- return ;
216- }
217- if ( policy ?. achAccount ?. bankAccountID === undefined ) {
218- return ;
219- }
220- pressLockedBankAccount ( policy ?. achAccount ?. bankAccountID , translate , conciergeReportID ) ;
221- navigateToConciergeChat ( conciergeReportID , introSelected , currentUserAccountID , isSelfTourViewed , betas ) ;
222- } ) ;
223- return true ;
224- }
204+ if ( isBankAccountLocked ) {
205+ showConfirmModal ( {
206+ title : translate ( 'bankAccount.lockedBankAccount' ) ,
207+ prompt : (
208+ < View style = { [ styles . renderHTML , styles . flexRow ] } >
209+ < RenderHTML html = { translate ( 'bankAccount.youCantPayThis' ) } />
210+ </ View >
211+ ) ,
212+ confirmText : translate ( 'bankAccount.unlockBankAccount' ) ,
213+ cancelText : translate ( 'common.cancel' ) ,
214+ } ) . then ( ( { action} ) => {
215+ if ( action !== ModalActions . CONFIRM ) {
216+ return ;
217+ }
218+ if ( policy ?. achAccount ?. bankAccountID === undefined ) {
219+ return ;
220+ }
221+ pressLockedBankAccount ( policy ?. achAccount ?. bankAccountID , translate , conciergeReportID ) ;
222+ navigateToConciergeChat ( conciergeReportID , introSelected , currentUserAccountID , isSelfTourViewed , betas ) ;
223+ } ) ;
224+ return true ;
225+ }
225226
226- if ( policy && shouldRestrictUserBillableActions ( policy . id , ownerBillingGracePeriodEnd , userBillingGracePeriodEnds , amountOwed , policy ) ) {
227- Navigation . navigate ( ROUTES . RESTRICTED_ACTION . getRoute ( policy . id ) ) ;
228- return true ;
229- }
227+ if ( policy && shouldRestrictUserBillableActions ( policy . id , ownerBillingGracePeriodEnd , userBillingGracePeriodEnds , amountOwed , policy ) ) {
228+ Navigation . navigate ( ROUTES . RESTRICTED_ACTION . getRoute ( policy . id ) ) ;
229+ return true ;
230+ }
230231
231- return false ;
232- } , [
233- isDelegateAccessRestricted ,
234- isAccountLocked ,
235- isUserValidated ,
236- isBankAccountLocked ,
237- policy ,
238- userBillingGracePeriodEnds ,
239- ownerBillingGracePeriodEnd ,
240- showDelegateNoAccessModal ,
241- showLockedAccountModal ,
242- chatReportID ,
243- reportID ,
244- showConfirmModal ,
245- translate ,
246- styles . renderHTML ,
247- styles . flexRow ,
248- conciergeReportID ,
249- introSelected ,
250- currentUserAccountID ,
251- isSelfTourViewed ,
252- betas ,
253- amountOwed ,
254- ] ) ;
232+ return false ;
233+ } ,
234+ [
235+ isDelegateAccessRestricted ,
236+ isAccountLocked ,
237+ isUserValidated ,
238+ isBankAccountLocked ,
239+ policy ,
240+ userBillingGracePeriodEnds ,
241+ ownerBillingGracePeriodEnd ,
242+ showDelegateNoAccessModal ,
243+ showLockedAccountModal ,
244+ chatReportID ,
245+ reportID ,
246+ showConfirmModal ,
247+ translate ,
248+ styles . renderHTML ,
249+ styles . flexRow ,
250+ conciergeReportID ,
251+ introSelected ,
252+ currentUserAccountID ,
253+ isSelfTourViewed ,
254+ betas ,
255+ amountOwed ,
256+ ] ,
257+ ) ;
255258
256259 const shortFormPayElsewhereButton = {
257260 text : translate ( 'iou.pay' ) ,
@@ -322,7 +325,7 @@ function SettlementButton({
322325 value : CONST . PAYMENT_METHODS . BUSINESS_BANK_ACCOUNT ,
323326 description : account . description ,
324327 onSelected : ( ) => {
325- if ( checkForNecessaryAction ( ) ) {
328+ if ( checkForNecessaryAction ( CONST . IOU . PAYMENT_TYPE . VBBA ) ) {
326329 return ;
327330 }
328331 onPress ( {
@@ -385,7 +388,7 @@ function SettlementButton({
385388 icon : formattedPaymentMethod ?. icon ,
386389 shouldUpdateSelectedIndex : true ,
387390 onSelected : ( ) => {
388- if ( checkForNecessaryAction ( ) ) {
391+ if ( checkForNecessaryAction ( CONST . IOU . PAYMENT_TYPE . EXPENSIFY ) ) {
389392 return ;
390393 }
391394 onPress ( {
@@ -444,7 +447,7 @@ function SettlementButton({
444447 value : CONST . IOU . PAYMENT_TYPE . ELSEWHERE ,
445448 shouldUpdateSelectedIndex : true ,
446449 onSelected : ( ) => {
447- if ( checkForNecessaryAction ( ) ) {
450+ if ( checkForNecessaryAction ( CONST . IOU . PAYMENT_TYPE . ELSEWHERE ) ) {
448451 return ;
449452 }
450453 onPress ( { paymentType : CONST . IOU . PAYMENT_TYPE . ELSEWHERE , payAsBusiness} ) ;
@@ -554,16 +557,16 @@ function SettlementButton({
554557 } ;
555558
556559 const handlePaymentSelection = ( event : GestureResponderEvent | KeyboardEvent | undefined , selectedOption : string , triggerKYCFlow : ( params : ContinueActionParams ) => void ) => {
557- if ( checkForNecessaryAction ( ) ) {
558- return ;
559- }
560-
561560 const { paymentType, policyFromPaymentMethod, policyFromContext, shouldSelectPaymentMethod} = getActivePaymentType (
562561 selectedOption ,
563562 activeAdminPolicies ,
564563 businessBankAccountOptions ,
565564 policyIDKey ,
566565 ) ;
566+
567+ if ( checkForNecessaryAction ( paymentType ) ) {
568+ return ;
569+ }
567570 const isPayingWithMethod = paymentType !== CONST . IOU . PAYMENT_TYPE . ELSEWHERE ;
568571
569572 if ( ( ! ! policyFromPaymentMethod || shouldSelectPaymentMethod ) && ( isPayingWithMethod || ! ! policyFromPaymentMethod ) ) {
0 commit comments