mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
♻️ Reuse existing gateway-IDs for styling tab
This commit is contained in:
parent
f7b2f97b89
commit
30ff337c06
2 changed files with 11 additions and 21 deletions
|
@ -7,16 +7,11 @@ const SectionPaymentMethods = ( { location } ) => {
|
||||||
const { paymentMethods, setPaymentMethods, choices } =
|
const { paymentMethods, setPaymentMethods, choices } =
|
||||||
StylingHooks.usePaymentMethodProps( location );
|
StylingHooks.usePaymentMethodProps( location );
|
||||||
|
|
||||||
const methods = PaymentHooks.usePaymentMethods();
|
const { all: allMethods } = PaymentHooks.usePaymentMethods();
|
||||||
const methodIds = [];
|
|
||||||
methods.all.forEach( ( method ) => {
|
|
||||||
if ( method.enabled === true ) {
|
|
||||||
methodIds.push( method.id );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
const filteredChoices = choices.filter( ( choice ) => {
|
const filteredChoices = choices.filter( ( choice ) => {
|
||||||
return methodIds.includes( choice.paymentMethod );
|
const methodConfig = allMethods.find( ( i ) => i.id === choice.value );
|
||||||
|
return methodConfig?.enabled;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -104,33 +104,28 @@ export const STYLING_SHAPES = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const STYLING_PAYMENT_METHODS = {
|
export const STYLING_PAYMENT_METHODS = {
|
||||||
paypal: {
|
'ppcp-gateway': {
|
||||||
value: '',
|
value: 'ppcp-gateway',
|
||||||
label: __( 'PayPal', 'woocommerce-paypal-payments' ),
|
label: __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||||
checked: true,
|
checked: true,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
paymentMethod: 'ppcp-gateway',
|
|
||||||
},
|
},
|
||||||
venmo: {
|
venmo: {
|
||||||
value: 'venmo',
|
value: 'venmo',
|
||||||
label: __( 'Venmo', 'woocommerce-paypal-payments' ),
|
label: __( 'Venmo', 'woocommerce-paypal-payments' ),
|
||||||
isFunding: true,
|
isFunding: true,
|
||||||
paymentMethod: 'venmo',
|
|
||||||
},
|
},
|
||||||
paylater: {
|
'pay-later': {
|
||||||
value: 'paylater',
|
value: 'pay-later',
|
||||||
label: __( 'Pay Later', 'woocommerce-paypal-payments' ),
|
label: __( 'Pay Later', 'woocommerce-paypal-payments' ),
|
||||||
isFunding: true,
|
isFunding: true,
|
||||||
paymentMethod: 'pay-later',
|
|
||||||
},
|
},
|
||||||
googlepay: {
|
'ppcp-googlepay': {
|
||||||
value: 'googlepay',
|
value: 'ppcp-googlepay',
|
||||||
label: __( 'Google Pay', 'woocommerce-paypal-payments' ),
|
label: __( 'Google Pay', 'woocommerce-paypal-payments' ),
|
||||||
paymentMethod: 'ppcp-googlepay',
|
|
||||||
},
|
},
|
||||||
applepay: {
|
'ppcp-applepay': {
|
||||||
value: 'applepay',
|
value: 'ppcp-applepay',
|
||||||
label: __( 'Apple Pay', 'woocommerce-paypal-payments' ),
|
label: __( 'Apple Pay', 'woocommerce-paypal-payments' ),
|
||||||
paymentMethod: 'ppcp-applepay',
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue