| 1 |
<?php |
| 2 |
|
| 3 |
namespace Hyperpay\Gateways\Brands; |
| 4 |
|
| 5 |
use Hyperpay\Gateways\App\DefaultGateway; |
| 6 |
use WC_Order; |
| 7 |
|
| 8 |
|
| 9 |
class Hypercash extends DefaultGateway |
| 10 |
{ |
| 11 |
|
| 12 |
public $trans_mode = 'EXTERNAL'; |
| 13 |
|
| 14 |
/** |
| 15 |
* should be lower case and uniqe |
| 16 |
* @var string $id |
| 17 |
*/ |
| 18 |
public $id = "hyperpay_hypercash"; |
| 19 |
|
| 20 |
/** |
| 21 |
* The title which appear next to gateway on setting page |
| 22 |
* @var string $method_title |
| 23 |
*/ |
| 24 |
public $method_title = "Hyperpay Hypercash Gateway"; |
| 25 |
|
| 26 |
/** |
| 27 |
* Describtion of gateways which will appear next to title |
| 28 |
* @var string $method_description |
| 29 |
*/ |
| 30 |
public $method_description = "Hypercash Plugin for Woocommerce"; |
| 31 |
|
| 32 |
|
| 33 |
/** |
| 34 |
* you can overwrite styles options by |
| 35 |
* uncomment array below |
| 36 |
* |
| 37 |
* @var array $hyperpay_payment_style |
| 38 |
*/ |
| 39 |
|
| 40 |
// protected $hyperpay_payment_style = [ |
| 41 |
// "card" => "Card", |
| 42 |
// "plain" => "Plain" |
| 43 |
// ]; |
| 44 |
|
| 45 |
public $successManualReviewCodePattern = '/^(000\.400\.0|000\.400\.100)/'; |
| 46 |
public $successCodePattern = '/^(800\.400\.5|100\.400\.500)/'; |
| 47 |
|
| 48 |
/** |
| 49 |
* |
| 50 |
* the Brands supported by the gateway |
| 51 |
* @var array $supported_brands |
| 52 |
*/ |
| 53 |
protected $supported_brands = [ |
| 54 |
"HYPERCASH" => "Hypercash", |
| 55 |
]; |
| 56 |
|
| 57 |
protected $order_id; |
| 58 |
|
| 59 |
public function boot() |
| 60 |
{ |
| 61 |
|
| 62 |
$this->order_status = 'on-hold'; |
| 63 |
|
| 64 |
if (!is_order_received_page()) |
| 65 |
add_action('woocommerce_order_details_before_order_table', [$this, 'print_invoice_id']); |
| 66 |
} |
| 67 |
|
| 68 |
public function order_received_text($thanks_text, $order) |
| 69 |
{ |
| 70 |
echo "<p> ". esc_html($thanks_text) ." </p>"; |
| 71 |
$this->print_invoice_id($order); |
| 72 |
} |
| 73 |
|
| 74 |
public function print_invoice_id($order) |
| 75 |
{ |
| 76 |
$invoice_id = $order->get_meta('invoice_id'); |
| 77 |
if ($invoice_id) { |
| 78 |
?> |
| 79 |
<div class="woocommerce-message"><?php echo esc_html__("Invoice ID: ", "hyperpay-gateways") . number_format($invoice_id, 0, '.', ' ') ?> </div> |
| 80 |
<?php |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
} |
| 86 |
|