mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
♻️ Remove empty payment methods in JS hook
This commit is contained in:
parent
faf0450b23
commit
9dc1bf7d7b
1 changed files with 14 additions and 20 deletions
|
@ -83,34 +83,22 @@ export const usePaymentMethods = () => {
|
||||||
const [ pui ] = usePersistent( 'ppcp-pay-upon-invoice-gateway' );
|
const [ pui ] = usePersistent( 'ppcp-pay-upon-invoice-gateway' );
|
||||||
const [ oxxo ] = usePersistent( 'ppcp-oxxo-gateway' );
|
const [ oxxo ] = usePersistent( 'ppcp-oxxo-gateway' );
|
||||||
|
|
||||||
const payPalCheckout = [ paypal, venmo, payLater, creditCard ];
|
const removeEmpty = ( list ) =>
|
||||||
const onlineCardPayments = [
|
list.filter( ( item ) => item && item.id?.length );
|
||||||
advancedCreditCard,
|
|
||||||
fastlane,
|
const payPalCheckout = removeEmpty( [
|
||||||
applePay,
|
|
||||||
googlePay,
|
|
||||||
];
|
|
||||||
const alternative = [
|
|
||||||
bancontact,
|
|
||||||
blik,
|
|
||||||
eps,
|
|
||||||
ideal,
|
|
||||||
mybank,
|
|
||||||
p24,
|
|
||||||
trustly,
|
|
||||||
multibanco,
|
|
||||||
pui,
|
|
||||||
oxxo,
|
|
||||||
];
|
|
||||||
const paymentMethods = [
|
|
||||||
paypal,
|
paypal,
|
||||||
venmo,
|
venmo,
|
||||||
payLater,
|
payLater,
|
||||||
creditCard,
|
creditCard,
|
||||||
|
] );
|
||||||
|
const onlineCardPayments = removeEmpty( [
|
||||||
advancedCreditCard,
|
advancedCreditCard,
|
||||||
fastlane,
|
fastlane,
|
||||||
applePay,
|
applePay,
|
||||||
googlePay,
|
googlePay,
|
||||||
|
] );
|
||||||
|
const alternative = removeEmpty( [
|
||||||
bancontact,
|
bancontact,
|
||||||
blik,
|
blik,
|
||||||
eps,
|
eps,
|
||||||
|
@ -121,6 +109,12 @@ export const usePaymentMethods = () => {
|
||||||
multibanco,
|
multibanco,
|
||||||
pui,
|
pui,
|
||||||
oxxo,
|
oxxo,
|
||||||
|
] );
|
||||||
|
|
||||||
|
const paymentMethods = [
|
||||||
|
...payPalCheckout,
|
||||||
|
...onlineCardPayments,
|
||||||
|
...alternative,
|
||||||
];
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue