42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
|
|
|
|
final class WC_Payanyway_Blocks extends AbstractPaymentMethodType {
|
|
|
|
protected $name = 'payanyway';
|
|
protected $settings;
|
|
|
|
public function initialize() {
|
|
$this->settings = get_option('woocommerce_payanyway_settings', []);
|
|
}
|
|
|
|
public function get_payment_method_script_handles() {
|
|
wp_register_script(
|
|
'payanyway-blocks-integration',
|
|
plugin_dir_url(__FILE__) . 'blocks.js',
|
|
[
|
|
'wc-blocks-registry',
|
|
'wc-settings',
|
|
'wp-element',
|
|
'wp-html-entities',
|
|
'wp-i18n',
|
|
],
|
|
null,
|
|
true
|
|
);
|
|
|
|
return ['payanyway-blocks-integration'];
|
|
}
|
|
|
|
public function get_payment_method_data() {
|
|
$gateway = WC()->payment_gateways()->payment_gateways()['payanyway'];
|
|
|
|
return [
|
|
'title' => $gateway->settings['title'],
|
|
'description' => $gateway->settings['description'],
|
|
'icon' => $gateway->icon
|
|
];
|
|
}
|
|
}
|