1 | <?php |
||
22 | abstract class AbstractGateway implements GatewayInterface, ArrayAccess, IteratorAggregate, JsonSerializable |
||
23 | { |
||
24 | use Parametrizable; |
||
25 | |||
26 | private $requestMethods = [ |
||
27 | 'authorize', |
||
28 | 'capture', |
||
29 | 'purchase', |
||
30 | 'refund', |
||
31 | 'void', |
||
32 | 'createPaymentMethod', |
||
33 | 'deletePaymentMethod', |
||
34 | 'updatePaymentMethod', |
||
35 | ]; |
||
36 | |||
37 | private $webhookMethods = [ |
||
38 | 'acceptNotification', |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * @var mixed |
||
43 | */ |
||
44 | protected $client; |
||
45 | |||
46 | /** |
||
47 | * Create a new gateway instance |
||
48 | * |
||
49 | * @param array $parameters |
||
50 | */ |
||
51 | 39 | public function __construct($parameters = []) |
|
56 | |||
57 | /** |
||
58 | * @return array |
||
59 | */ |
||
60 | 39 | public function defaultParameters() |
|
66 | |||
67 | /** |
||
68 | * @return array |
||
69 | */ |
||
70 | 27 | public function parametersValidationRules() |
|
76 | |||
77 | /** |
||
78 | * Get the short name of the Gateway |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 3 | public function shortName() |
|
86 | |||
87 | /** |
||
88 | * @return boolean |
||
89 | */ |
||
90 | 3 | public function isInTestMode() |
|
94 | |||
95 | /** |
||
96 | * @return mixed |
||
97 | */ |
||
98 | 3 | public function client() |
|
102 | |||
103 | /** |
||
104 | * Create and initialize a request object |
||
105 | * |
||
106 | * @param string $name The request name or class |
||
107 | * @param array $parameters |
||
108 | * @return \Gregoriohc\Moneta\Common\Messages\AbstractRequest |
||
109 | */ |
||
110 | 30 | protected function createRequest($name, $parameters = []) |
|
126 | |||
127 | /** |
||
128 | * @param string $name |
||
129 | * @return string |
||
130 | */ |
||
131 | 30 | private function requestClass($name) |
|
135 | |||
136 | 9 | public function supports($name) |
|
146 | |||
147 | /** |
||
148 | * @param string $name |
||
149 | * @param $arguments |
||
150 | * @return mixed |
||
151 | */ |
||
152 | 33 | public function __call($name, $arguments) |
|
166 | } |