Skip to content

Commit

Permalink
Conditionally show payment methods based on currency support
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Mar 7, 2025
1 parent c4edf8b commit 5f094bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/SettlementButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import KYCWall from '@components/KYCWall';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import {isCurrencySupportedForDirectReimbursement} from '@libs/actions/Policy/Policy';
import Navigation from '@libs/Navigation/Navigation';
import {formatPaymentMethods} from '@libs/PaymentUtils';
import getPolicyEmployeeAccountIDs from '@libs/PolicyEmployeeListUtils';
Expand Down Expand Up @@ -145,6 +146,7 @@ function SettlementButton({

if (isInvoiceReport) {
const formattedPaymentMethods = formatPaymentMethods(bankAccountList, fundList, styles);
const isCurrencySupported = isCurrencySupportedForDirectReimbursement(currency);
const getPaymentSubitems = (payAsBusiness: boolean) =>
formattedPaymentMethods.map((formattedPaymentMethod) => ({
text: formattedPaymentMethod?.title ?? '',
Expand All @@ -160,7 +162,7 @@ function SettlementButton({
value: CONST.IOU.PAYMENT_TYPE.ELSEWHERE,
backButtonText: translate('iou.individual'),
subMenuItems: [
...getPaymentSubitems(false),
...(isCurrencySupported ? getPaymentSubitems(false) : []),
{
text: translate('workspace.invoices.paymentMethods.addBankAccount'),
icon: Expensicons.Bank,
Expand All @@ -187,7 +189,7 @@ function SettlementButton({
value: CONST.IOU.PAYMENT_TYPE.ELSEWHERE,
backButtonText: translate('iou.business'),
subMenuItems: [
...getPaymentSubitems(true),
...(isCurrencySupported ? getPaymentSubitems(true) : []),
{
text: translate('workspace.invoices.paymentMethods.addBankAccount'),
icon: Expensicons.Bank,
Expand Down

0 comments on commit 5f094bc

Please sign in to comment.