| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Classes; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
die(); |
| 7 |
} |
| 8 |
|
| 9 |
/** |
| 10 |
* @deprecated |
| 11 |
*/ |
| 12 |
abstract class AbstractPaymentGateways { |
| 13 |
|
| 14 |
|
| 15 |
protected static $gateways = []; |
| 16 |
|
| 17 |
|
| 18 |
protected $id; |
| 19 |
|
| 20 |
protected $title; |
| 21 |
|
| 22 |
|
| 23 |
protected $description; |
| 24 |
|
| 25 |
public function __construct( $id, $title, $description ) { |
| 26 |
$this->id = $id; |
| 27 |
$this->title = $title; |
| 28 |
$this->description = $description; |
| 29 |
self::$gateways[ $this->id ] = $this; |
| 30 |
} |
| 31 |
|
| 32 |
abstract public function process_payment( Order $order ); |
| 33 |
|
| 34 |
/** |
| 35 |
* Get payment gateway instance. |
| 36 |
* |
| 37 |
* @param string $id |
| 38 |
* |
| 39 |
* @return AbstractPaymentGateways|null |
| 40 |
*/ |
| 41 |
public static function get_gateway( $id ) { |
| 42 |
return self::$gateways[ $id ] ?? null; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
public static function get_gateways() { |
| 47 |
return self::$gateways; |
| 48 |
} |
| 49 |
} |
| 50 |
|