-
Notifications
You must be signed in to change notification settings - Fork 30
/
checkout-block.php
45 lines (38 loc) · 1.12 KB
/
checkout-block.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
final class WC_Razorpay_Blocks extends AbstractPaymentMethodType
{
protected $name = 'razorpay';
public function initialize()
{
$this->settings = get_option('woocommerce_razorpay_settings', []);
}
public function get_payment_method_script_handles()
{
wp_register_script(
'razorpay-blocks-integration',
plugin_dir_url(__FILE__) . 'checkout_block.js',
[
'wc-blocks-registry',
'wc-settings',
'wp-element',
'wp-html-entities',
'wp-i18n',
],
null,
true
);
if (function_exists('wp_set_script_translations'))
{
wp_set_script_translations('razorpay-blocks-integration');
}
return ['razorpay-blocks-integration'];
}
public function get_payment_method_data()
{
return [
'title' => 'Pay by Razorpay',
'description' => $this->settings['description'],
];
}
}