-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
30 lines (25 loc) · 836 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
import { decodeEntities } from '@wordpress/html-entities';
import { getSetting } from '@woocommerce/settings';
const settings = getSetting( 'wc-razorpay_data', {} );
const label = decodeEntities( settings.title ) || 'Razorpay Payment Gateway';
const Content = () => {
return decodeEntities( settings.description || '' );
};
const Label = ( props ) => {
const { PaymentMethodLabel } = props.components;
return <PaymentMethodLabel text={ label } />;
};
const razorpayPaymentLinks = {
name: "wc-razorpay",
label: <Label />,
content: <Content />,
edit: <Content />,
placeOrderButtonLabel: settings?.button_text,
canMakePayment: () => true,
ariaLabel: label,
supports: {
features: settings.supports,
},
};
registerPaymentMethod( razorpayPaymentLinks );