|
2 | 2 | /* |
3 | 3 | * Plugin Name: Aplazame |
4 | 4 | * Plugin URI: https://github.com/aplazame/woocommerce |
5 | | - * Version: 4.0.1 |
| 5 | + * Version: 4.0.2 |
6 | 6 | * Description: Aplazame offers a payment method to receive funding for the purchases. |
7 | 7 | * Author: Aplazame |
8 | 8 | * Author URI: https://aplazame.com |
|
11 | 11 | * Domain Path: /i18n/languages/ |
12 | 12 | * |
13 | 13 | * WC requires at least: 3.0.0 |
14 | | - * WC tested up to: 8.6.1 |
| 14 | + * WC tested up to: 8.9.1 |
15 | 15 | * |
16 | 16 | * License: GNU General Public License v3.0 |
17 | 17 | * License URI: http://www.gnu.org/licenses/gpl-3.0.html |
|
25 | 25 | require_once 'lib/Aplazame/Aplazame/autoload.php'; |
26 | 26 |
|
27 | 27 | class WC_Aplazame { |
28 | | - const VERSION = '4.0.1'; |
| 28 | + const VERSION = '4.0.2'; |
29 | 29 | const METHOD_ID = 'aplazame'; |
30 | 30 | const METHOD_TITLE = 'Aplazame'; |
31 | 31 |
|
@@ -164,11 +164,22 @@ public function __construct( $apiBaseUri ) { |
164 | 164 |
|
165 | 165 | add_action( 'woocommerce_api_aplazame', array( $this, 'api_router' ) ); |
166 | 166 |
|
| 167 | + // Cart and Checkout Blocks |
| 168 | + add_action( 'woocommerce_blocks_loaded', array( $this, 'add_gateway_block' ) ); |
| 169 | + add_action( |
| 170 | + 'before_woocommerce_init', |
| 171 | + function () { |
| 172 | + if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { |
| 173 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true ); |
| 174 | + } |
| 175 | + } |
| 176 | + ); |
| 177 | + |
167 | 178 | // Declare HPOS compatibility |
168 | 179 | add_action( |
169 | 180 | 'before_woocommerce_init', |
170 | 181 | function () { |
171 | | - if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
| 182 | + if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { |
172 | 183 | \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); |
173 | 184 | } |
174 | 185 | } |
@@ -276,6 +287,20 @@ public function add_gateway( $methods ) { |
276 | 287 | return $methods; |
277 | 288 | } |
278 | 289 |
|
| 290 | + public function add_gateway_block() { |
| 291 | + if ( ! class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) { |
| 292 | + return; |
| 293 | + } |
| 294 | + |
| 295 | + include_once 'classes/wc-aplazame-gateway-block.php'; |
| 296 | + add_action( |
| 297 | + 'woocommerce_blocks_payment_method_type_registration', |
| 298 | + function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) { |
| 299 | + $payment_method_registry->register( new WC_Aplazame_Gateway_Blocks_Support() ); |
| 300 | + } |
| 301 | + ); |
| 302 | + } |
| 303 | + |
279 | 304 | public function aplazameJs() { |
280 | 305 |
|
281 | 306 | Aplazame_Helpers::render_to_template( 'layout/header.php' ); |
|
0 commit comments