Skip to content

Commit

Permalink
Load ACH conditionally in the payment methods map
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelzaleski committed Jan 22, 2025
1 parent cb681c0 commit 167cec8
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions client/payment-methods-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import icons from './payment-method-icons';

const accountCountry =
window.wc_stripe_settings_params?.account_country || 'US';
const isAchEnabled = window.wc_stripe_settings_params?.is_ach_enabled === '1';

export default {
const paymentMethods = {
card: {
id: 'card',
label: __( 'Credit card / debit card', 'woocommerce-gateway-stripe' ),
Expand All @@ -16,16 +17,6 @@ export default {
currencies: [],
allows_manual_capture: true,
},
us_bank_account: {
id: 'us_bank_account',
label: __( 'ACH Direct Debit', 'woocommerce-gateway-stripe' ),
description: __(
'ACH lets you accept payments from customers with a US bank account.',
'woocommerce-gateway-stripe'
),
Icon: icons.us_bank_account,
currencies: [ 'USD' ],
},
giropay: {
id: 'giropay',
label: __( 'giropay', 'woocommerce-gateway-stripe' ),
Expand Down Expand Up @@ -250,3 +241,18 @@ export default {
capability: 'cashapp_payments',
},
};

if ( isAchEnabled ) {
paymentMethods.us_bank_account = {
id: 'us_bank_account',
label: __( 'ACH Direct Debit', 'woocommerce-gateway-stripe' ),
description: __(
'ACH lets you accept payments from customers with a US bank account.',
'woocommerce-gateway-stripe'
),
Icon: icons.us_bank_account,
currencies: [ 'USD' ],
};
}

export default paymentMethods;

0 comments on commit 167cec8

Please sign in to comment.