| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Elementor\Modules\Checkout\Integrations; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die(); |
| 6 |
|
| 7 |
/** |
| 8 |
* Integration class to integrate gateways with sellkit checkout widget. |
| 9 |
* |
| 10 |
* @since 1.1.0 |
| 11 |
*/ |
| 12 |
abstract class Integration { |
| 13 |
/** |
| 14 |
* Active available wooCommerce gateways. |
| 15 |
* |
| 16 |
* @since 1.1.0 |
| 17 |
* @var array |
| 18 |
*/ |
| 19 |
protected $gateways; |
| 20 |
|
| 21 |
/** |
| 22 |
* Run this class content if requirements are met. |
| 23 |
* |
| 24 |
* @since 1.1.0 |
| 25 |
* @return void |
| 26 |
*/ |
| 27 |
public function run() { |
| 28 |
$this->gateways = WC()->payment_gateways->get_available_payment_gateways(); |
| 29 |
|
| 30 |
if ( false === $this->requirements() ) { |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
$this->hooks(); |
| 35 |
add_action( 'sellkit-checkout-widget-express-methods', [ $this, 'content' ] ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Check requirement to enable gateway in sellkit checkout widget. |
| 40 |
* |
| 41 |
* @return bool |
| 42 |
* @since 1.1.0 |
| 43 |
*/ |
| 44 |
abstract protected function requirements(); |
| 45 |
|
| 46 |
/** |
| 47 |
* Content of express checkout methods. |
| 48 |
* |
| 49 |
* @return void |
| 50 |
* @since 1.1.0 |
| 51 |
*/ |
| 52 |
abstract protected function content(); |
| 53 |
|
| 54 |
/** |
| 55 |
* Hooks to integrate current gateway with sellkit checkout widget. |
| 56 |
* |
| 57 |
* @return void |
| 58 |
* @since 1.1.0 |
| 59 |
*/ |
| 60 |
abstract protected function hooks(); |
| 61 |
} |
| 62 |
|