Skip to content

Commit 0c618ac

Browse files
authored
Merge pull request #48863 from shubham1206agra/settlement-button-fix
Fix settlement button
2 parents 51a64cf + 6fdfb3c commit 0c618ac

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Diff for: src/components/SettlementButton/index.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
55
import type {PaymentType} from '@components/ButtonWithDropdownMenu/types';
66
import * as Expensicons from '@components/Icon/Expensicons';
77
import KYCWall from '@components/KYCWall';
8-
import {useSession} from '@components/OnyxProvider';
98
import useLocalize from '@hooks/useLocalize';
109
import useNetwork from '@hooks/useNetwork';
1110
import Navigation from '@libs/Navigation/Navigation';
@@ -61,17 +60,13 @@ function SettlementButton({
6160
}: SettlementButtonProps) {
6261
const {translate} = useLocalize();
6362
const {isOffline} = useNetwork();
64-
const session = useSession();
6563
// 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.
6664
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || -1}`);
6765
const [lastPaymentMethod = '-1'] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD, {selector: (paymentMethod) => paymentMethod?.[policyID]});
6866
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
6967
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;
7570
const paymentButtonOptions = useMemo(() => {
7671
const buttonOptions = [];
7772
const isExpenseReport = ReportUtils.isExpenseReport(iouReport);

0 commit comments

Comments
 (0)