| 1 |
<?php |
| 2 |
namespace WPFunnels\Gateway; |
| 3 |
|
| 4 |
/** |
| 5 |
* @author [Getwpfunnels Team] |
| 6 |
* @email [[email protected]] |
| 7 |
* @create date 2022-06-09 16:28:09 |
| 8 |
* @modify date 2022-06-09 16:28:09 |
| 9 |
* @desc [Supporting Cheque payment with WPFunnels one-click offer] |
| 10 |
*/ |
| 11 |
|
| 12 |
class Wpfnl_Gateway_Cheque { |
| 13 |
|
| 14 |
/** |
| 15 |
* @var string |
| 16 |
* @since 1.6.7 |
| 17 |
*/ |
| 18 |
public $key = 'cheque'; |
| 19 |
|
| 20 |
/** |
| 21 |
* @var bool |
| 22 |
* @since 1.6.7 |
| 23 |
*/ |
| 24 |
public $refund_support; |
| 25 |
|
| 26 |
/** |
| 27 |
* @var bool |
| 28 |
* @since 1.6.7 |
| 29 |
*/ |
| 30 |
private $token = false; |
| 31 |
|
| 32 |
|
| 33 |
function __construct() |
| 34 |
{ |
| 35 |
$this->token = true; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
/** |
| 40 |
* Try and get the payment token saved by the gateway |
| 41 |
* |
| 42 |
* @param WC_Order $order |
| 43 |
* |
| 44 |
* @return true |
| 45 |
* @since 1.6.7 |
| 46 |
*/ |
| 47 |
public function has_token( $order ) { |
| 48 |
|
| 49 |
return $this->token; |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
/** |
| 55 |
* Process payment for one-click offer product |
| 56 |
* |
| 57 |
* @param mixed $order |
| 58 |
* |
| 59 |
* @return array |
| 60 |
* @since 1.6.7 |
| 61 |
*/ |
| 62 |
public function process_payment( $order ) { |
| 63 |
|
| 64 |
if($this->key === $order->get_payment_method() && $this->has_token($order)){ |
| 65 |
return array( |
| 66 |
'is_success' => true, |
| 67 |
'message' => 'Success' |
| 68 |
); |
| 69 |
} |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
} |