@@ -5,7 +5,6 @@ import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
5
5
import type { PaymentType } from '@components/ButtonWithDropdownMenu/types' ;
6
6
import * as Expensicons from '@components/Icon/Expensicons' ;
7
7
import KYCWall from '@components/KYCWall' ;
8
- import { useSession } from '@components/OnyxProvider' ;
9
8
import useLocalize from '@hooks/useLocalize' ;
10
9
import useNetwork from '@hooks/useNetwork' ;
11
10
import Navigation from '@libs/Navigation/Navigation' ;
@@ -61,17 +60,13 @@ function SettlementButton({
61
60
} : SettlementButtonProps ) {
62
61
const { translate} = useLocalize ( ) ;
63
62
const { isOffline} = useNetwork ( ) ;
64
- const session = useSession ( ) ;
65
63
// The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here.
66
64
const [ chatReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReportID || - 1 } ` ) ;
67
65
const [ lastPaymentMethod = '-1' ] = useOnyx ( ONYXKEYS . NVP_LAST_PAYMENT_METHOD , { selector : ( paymentMethod ) => paymentMethod ?. [ policyID ] } ) ;
68
66
const [ policy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ) ;
69
67
const isInvoiceReport = ( ! isEmptyObject ( iouReport ) && ReportUtils . isInvoiceReport ( iouReport ) ) || false ;
70
- const isPaidGroupPolicy = ReportUtils . isPaidGroupPolicyExpenseChat ( chatReport ) ;
71
- const shouldShowPaywithExpensifyOption =
72
- ! isPaidGroupPolicy ||
73
- ( ! shouldHidePaymentOptions && ReportUtils . isPayer ( session , iouReport ) && policy ?. reimbursementChoice !== CONST . POLICY . REIMBURSEMENT_CHOICES . REIMBURSEMENT_MANUAL ) ;
74
- const shouldShowPayElsewhereOption = ( ! isPaidGroupPolicy || policy ?. reimbursementChoice === CONST . POLICY . REIMBURSEMENT_CHOICES . REIMBURSEMENT_MANUAL ) && ! isInvoiceReport ;
68
+ const shouldShowPaywithExpensifyOption = ! shouldHidePaymentOptions && policy ?. reimbursementChoice !== CONST . POLICY . REIMBURSEMENT_CHOICES . REIMBURSEMENT_MANUAL ;
69
+ const shouldShowPayElsewhereOption = ! shouldHidePaymentOptions && ! isInvoiceReport ;
75
70
const paymentButtonOptions = useMemo ( ( ) => {
76
71
const buttonOptions = [ ] ;
77
72
const isExpenseReport = ReportUtils . isExpenseReport ( iouReport ) ;
0 commit comments