1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\ZipPay; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
6
|
|
|
use Omnipay\ZipPay\Message\RestAuthorizeRequest; |
7
|
|
|
use Omnipay\ZipPay\Message\RestCancelRequest; |
8
|
|
|
use Omnipay\ZipPay\Message\RestCaptureRequest; |
9
|
|
|
use Omnipay\ZipPay\Message\RestCompleteAuthorizeRequest; |
10
|
|
|
use Omnipay\ZipPay\Message\RestRefundRequest; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* ZipPay Gateway |
14
|
|
|
*/ |
15
|
|
|
class RestGateway extends AbstractGateway |
16
|
|
|
{ |
17
|
3 |
|
public function getName() |
18
|
|
|
{ |
19
|
3 |
|
return 'ZipPay Rest'; |
20
|
|
|
} |
21
|
|
|
|
22
|
98 |
|
public function getDefaultParameters() |
23
|
|
|
{ |
24
|
|
|
return [ |
25
|
98 |
|
'apiKey' => '', |
26
|
36 |
|
'key' => '', |
27
|
36 |
|
'testMode' => true, |
28
|
36 |
|
]; |
29
|
|
|
} |
30
|
|
|
|
31
|
3 |
|
/** |
32
|
|
|
* @return string |
33
|
3 |
|
*/ |
34
|
|
|
public function getApiKey() |
35
|
|
|
{ |
36
|
18 |
|
return $this->getParameter('apiKey'); |
37
|
|
|
} |
38
|
18 |
|
|
39
|
|
|
/** |
40
|
|
|
* @param $value |
41
|
3 |
|
* @return string |
42
|
|
|
*/ |
43
|
3 |
|
public function setApiKey($value) |
44
|
|
|
{ |
45
|
|
|
return $this->setParameter('apiKey', $value); |
46
|
18 |
|
} |
47
|
|
|
|
48
|
18 |
|
/** |
49
|
|
|
* @return string |
50
|
|
|
*/ |
51
|
|
|
public function getKey() |
52
|
|
|
{ |
53
|
|
|
return $this->getParameter('key'); |
54
|
12 |
|
} |
55
|
|
|
|
56
|
12 |
|
/** |
57
|
|
|
* @param $value |
58
|
|
|
* @return string |
59
|
12 |
|
*/ |
60
|
|
|
public function setKey($value) |
61
|
12 |
|
{ |
62
|
|
|
return $this->setParameter('key', $value); |
63
|
|
|
} |
64
|
12 |
|
|
65
|
|
|
/** |
66
|
12 |
|
* @param $value |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
12 |
|
public function setSSLCertificatePath($value) |
70
|
|
|
{ |
71
|
12 |
|
return $this->setParameter('sslCertificatePath', $value); |
72
|
|
|
} |
73
|
|
|
|
74
|
12 |
|
/** |
75
|
|
|
* @return string |
76
|
12 |
|
*/ |
77
|
|
|
public function getSSLCertificatePath() |
78
|
|
|
{ |
79
|
|
|
return $this->getParameter('sslCertificatePath'); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return Message\RestAuthorizeRequest |
84
|
|
|
*/ |
85
|
|
|
public function authorize(array $parameters = []) |
86
|
|
|
{ |
87
|
|
|
return $this->createRequest(RestAuthorizeRequest::class, $parameters); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param array $options |
92
|
|
|
* @return RestCompleteAuthorizeRequest |
93
|
|
|
*/ |
94
|
|
|
public function completeAuthorize(array $options = []) |
95
|
|
|
{ |
96
|
|
|
return $this->createRequest(RestCompleteAuthorizeRequest::class, $options); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param array $options |
101
|
|
|
* @return RestCaptureRequest |
102
|
|
|
*/ |
103
|
|
|
public function capture(array $options = []) |
104
|
|
|
{ |
105
|
|
|
return $this->createRequest(RestCaptureRequest::class, $options); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param array $options |
110
|
|
|
* @return RestCancelRequest |
111
|
|
|
*/ |
112
|
|
|
public function void(array $options = []) |
113
|
|
|
{ |
114
|
|
|
return $this->createRequest(RestCancelRequest::class, $options); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param array $options |
119
|
|
|
* @return RestRefundRequest |
120
|
|
|
*/ |
121
|
|
|
public function refund(array $options = []) |
122
|
|
|
{ |
123
|
|
|
return $this->createRequest(RestRefundRequest::class, $options); |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|