34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
const payanywaySettings = window.wc.wcSettings.getSetting('payanyway_data', {});
|
|
const payanywaySettingsLabel = window.wp.htmlEntities.decodeEntities(payanywaySettings.title) || window.wp.i18n.__('Оплата через PayAnyWay', 'payanyway')
|
|
|
|
const PayanywayContent = () => {
|
|
return window.wp.htmlEntities.decodeEntities(payanywaySettings.description || '');
|
|
};
|
|
|
|
const PayanywayLabel = () => {
|
|
return window.wp.element.createElement(
|
|
'span',
|
|
{style: {width: '100%'}},
|
|
payanywaySettingsLabel,
|
|
window.wp.element.createElement('img', {
|
|
src: payanywaySettings.icon,
|
|
style: {float: 'right', marginRight: '20px'},
|
|
alt: payanywaySettings.title,
|
|
})
|
|
);
|
|
};
|
|
|
|
const Payanyway_Block_Gateway = {
|
|
name: 'payanyway',
|
|
label: window.wp.element.createElement(PayanywayLabel),
|
|
content: window.wp.element.createElement(PayanywayContent),
|
|
edit: window.wp.element.createElement(PayanywayContent),
|
|
canMakePayment: () => true,
|
|
ariaLabel: payanywaySettingsLabel,
|
|
supports: {
|
|
features: payanywaySettings.supports,
|
|
},
|
|
};
|
|
|
|
window.wc.wcBlocksRegistry.registerPaymentMethod(Payanyway_Block_Gateway);
|