| 1 |
<?php |
| 2 |
|
| 3 |
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; |
| 4 |
|
| 5 |
final class Paykeeper_Blocks extends AbstractPaymentMethodType { |
| 6 |
|
| 7 |
private $gateway; |
| 8 |
protected $name = 'paykeeper';// your payment gateway name |
| 9 |
|
| 10 |
public function initialize() { |
| 11 |
$this->settings = get_option( 'woocommerce_paykeeper_settings', [] ); |
| 12 |
$this->gateway = new WC_PK_Gateway(); |
| 13 |
} |
| 14 |
|
| 15 |
public function is_active() { |
| 16 |
return $this->gateway->is_available(); |
| 17 |
} |
| 18 |
|
| 19 |
public function get_payment_method_script_handles() { |
| 20 |
|
| 21 |
wp_register_script( |
| 22 |
'paykeeper-blocks-integration', |
| 23 |
plugin_dir_url(__FILE__) . 'checkout.js', |
| 24 |
[ |
| 25 |
'wc-blocks-registry', |
| 26 |
'wc-settings', |
| 27 |
'wp-element', |
| 28 |
'wp-html-entities', |
| 29 |
'wp-i18n', |
| 30 |
], |
| 31 |
null, |
| 32 |
true |
| 33 |
); |
| 34 |
if( function_exists( 'wp_set_script_translations' ) ) { |
| 35 |
wp_set_script_translations( 'paykeeper-blocks-integration'); |
| 36 |
|
| 37 |
} |
| 38 |
return [ 'paykeeper-blocks-integration' ]; |
| 39 |
} |
| 40 |
|
| 41 |
public function get_payment_method_data() { |
| 42 |
return [ |
| 43 |
'title' => $this->gateway->title, |
| 44 |
//'description' => $this->gateway->description, |
| 45 |
]; |
| 46 |
} |
| 47 |
|
| 48 |
} |
| 49 |
?> |