| 1 |
const settings_cashfree = window.wc.wcSettings.getSetting('cashfree_data', {}); |
| 2 |
const label_cashfree = window.wp.htmlEntities.decodeEntities(settings_cashfree.title) || window.wp.i18n.__('Pay with Cashfree', 'cashfree'); |
| 3 |
|
| 4 |
/** |
| 5 |
* Label component |
| 6 |
* |
| 7 |
* @param {*} props Props from payment API. |
| 8 |
*/ |
| 9 |
const LabelCashfree = (props) => { |
| 10 |
var icon = React.createElement('img', { |
| 11 |
src: 'https://cashfreelogo.cashfree.com/cashfreepayments/logopng1x/Cashfree_Payments_Logo.png', |
| 12 |
style: { |
| 13 |
display: 'inline', |
| 14 |
marginLeft: '5px', // Adjust the value as needed |
| 15 |
}, |
| 16 |
}); |
| 17 |
var span = React.createElement('span', { |
| 18 |
className: 'wc-block-components-payment-method-label wc-block-components-payment-method-label--with-icon', |
| 19 |
}, window.wp.htmlEntities.decodeEntities(settings_cashfree.title) || defaultLabel, icon); |
| 20 |
return span; |
| 21 |
}; |
| 22 |
|
| 23 |
const LabelDesc = (props) => { |
| 24 |
var span = React.createElement('span', { |
| 25 |
className: 'wc-block-components-payment-method-label wc-block-components-payment-method-label--with-icon', |
| 26 |
}, window.wp.htmlEntities.decodeEntities(settings_cashfree.description)); |
| 27 |
return span; |
| 28 |
}; |
| 29 |
|
| 30 |
const CashfreeCheckout = { |
| 31 |
name: 'cashfree', |
| 32 |
label: React.createElement(LabelCashfree, null), |
| 33 |
content: React.createElement(LabelDesc, null), |
| 34 |
edit: React.createElement(LabelCashfree, null), |
| 35 |
icons: null, |
| 36 |
canMakePayment: () => true, |
| 37 |
ariaLabel: label_cashfree, |
| 38 |
supports: { |
| 39 |
features: settings_cashfree.supports, |
| 40 |
}, |
| 41 |
}; |
| 42 |
window.wc.wcBlocksRegistry.registerPaymentMethod( CashfreeCheckout ); |