2024-10-10 07:22:22 +02:00
|
|
|
import {registerPaymentMethod} from '@woocommerce/blocks-registry';
|
|
|
|
import {CardFields} from './Components/card-fields';
|
2024-04-16 12:05:06 +02:00
|
|
|
|
2024-10-10 07:22:22 +02:00
|
|
|
const config = wc.wcSettings.getSetting('ppcp-credit-card-gateway_data');
|
2024-04-16 12:05:06 +02:00
|
|
|
|
2024-10-10 07:22:22 +02:00
|
|
|
const Label = ({components, config}) => {
|
|
|
|
const {PaymentMethodIcons} = components;
|
|
|
|
return <>
|
|
|
|
<span dangerouslySetInnerHTML={{__html: config.title}}/>
|
|
|
|
<PaymentMethodIcons
|
|
|
|
icons={ config.card_icons }
|
|
|
|
align="right"
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
|
|
|
|
registerPaymentMethod({
|
|
|
|
name: config.id,
|
|
|
|
label: <Label config={config}/>,
|
|
|
|
content: <CardFields config={config}/>,
|
|
|
|
edit: <CardFields config={config}/>,
|
|
|
|
ariaLabel: config.title,
|
|
|
|
canMakePayment: () => {
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
supports: {
|
|
|
|
showSavedCards: true,
|
|
|
|
features: config.supports,
|
|
|
|
},
|
|
|
|
});
|