-
Notifications
You must be signed in to change notification settings - Fork 2
/
class-block.php
49 lines (39 loc) · 1.32 KB
/
class-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
46
47
48
49
<?php
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
final class Payping_Gateway_Blocks extends AbstractPaymentMethodType {
private $gateway;
protected $name = 'WC_payping';
public function initialize() {
$this->settings = get_option( 'woocommerce_payping_gateway_settings', [] );
$this->gateway = new WC_payping();
}
public function is_active() {
return $this->gateway->is_available();
}
public function get_payment_method_script_handles() {
wp_register_script(
'payping_gateway-blocks-integration',
plugin_dir_url(__FILE__) . '/assets/js/checkout.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( 'payping_gateway-blocks-integration');
}
return [ 'payping_gateway-blocks-integration' ];
}
public function get_payment_method_data() {
return [
'title' => $this->gateway->title,
'description' => $this->gateway->description,
];
}
}
?>