-
-
Notifications
You must be signed in to change notification settings - Fork 159
/
BasePaymentHandler.php
94 lines (82 loc) · 1.82 KB
/
BasePaymentHandler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
*
* Class to handle authorizenet payment transaction
*
* @property AConfig $config
* @property ALoader $load
* @property ALanguage $language
* @property ACart $cart
* @property ACurrency $currency
* @property ModelExtensionAuthorizeNet $model_extension_authorizenet
*/
class BasePaymentHandler implements PaymentHandlerInterface
{
/**
* @var Registry
*/
public $registry;
/**
* @var string
*/
protected $id;
/**
* @var bool
*/
protected $recurring_billing;
/**
* BasePaymentHandler constructor.
*
* @param Registry $registry
*/
public function __construct( Registry $registry)
{
$this->registry = $registry;
}
public function __get($key)
{
return $this->registry->get($key);
}
public function __set($key, $value)
{
$this->registry->set($key, $value);
}
public function recurring_billing()
{
return $this->recurring_billing;
}
/**
* @return string
*/
public function id():string
{
return (string)$this->id;
}
public function is_available($payment_address):bool
{
$this->load->model('extension/'.$this->id());
$details = $this->{'model_extension_'.$this->id()}->getMethod($payment_address);
if ($details) {
return true;
} else {
return false;
}
}
public function details():array
{
}
public function validatePaymentDetails(array $data = array()):array
{
}
public function processPayment(int $order_id, array $data = array()):array
{
}
public function getErrors()
{
// TODO: Implement getErrors() method.
}
public function callback(array $data = [])
{
// TODO: Implement callback() method.
}
}