| 1 |
<?php |
| 2 |
|
| 3 |
namespace Hyperpay\Gateways\Traits; |
| 4 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 5 |
|
| 6 |
|
| 7 |
trait HyperpayBlocks |
| 8 |
{ |
| 9 |
public $isExpress = false; |
| 10 |
public $isDynamicCheck = false; |
| 11 |
public $supports = ["products"]; |
| 12 |
public $action_button = ''; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public function canMakePayment() |
| 17 |
{ |
| 18 |
return wp_send_json(["canMakePayment" => true]); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Initializes the payment method type. |
| 23 |
*/ |
| 24 |
|
| 25 |
public function initialize() |
| 26 |
{ |
| 27 |
} |
| 28 |
|
| 29 |
public function extraScriptData() |
| 30 |
{ |
| 31 |
return []; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Check if the store uses blocks on the cart or checkout page. |
| 36 |
* |
| 37 |
* @return boolean |
| 38 |
*/ |
| 39 |
public static function has_checkout_block() |
| 40 |
{ |
| 41 |
$checkout_id = wc_get_page_id('checkout'); |
| 42 |
$has_classic_checkout = $checkout_id && has_block('woocommerce/classic-shortcode', $checkout_id); |
| 43 |
|
| 44 |
return !$has_classic_checkout; |
| 45 |
} |
| 46 |
} |
| 47 |
|