1 | <?php |
||
2 | |||
3 | namespace Omnipay\WindcaveHpp; |
||
4 | |||
5 | use Omnipay\Common\AbstractGateway; |
||
6 | use Omnipay\WindcaveHpp\Message\AcceptNotification; |
||
7 | use Omnipay\WindcaveHpp\Message\CompletePurchaseRequest; |
||
8 | use Omnipay\WindcaveHpp\Message\PurchaseRequest; |
||
9 | use Omnipay\WindcaveHpp\Message\RefundRequest; |
||
10 | |||
11 | /** |
||
12 | * Windcave HPP Payment Gateway |
||
13 | */ |
||
14 | class Gateway extends AbstractGateway |
||
15 | { |
||
16 | /** |
||
17 | * Get name |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | public function getName() |
||
22 | { |
||
23 | return 'Windcave Hpp'; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Get default parameters |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | public function getDefaultParameters() |
||
32 | { |
||
33 | return []; |
||
34 | } |
||
35 | |||
36 | public function setApiUsername($value) |
||
37 | { |
||
38 | return $this->setParameter('apiUsername', $value); |
||
39 | } |
||
40 | |||
41 | public function getApiUsername() |
||
42 | { |
||
43 | return $this->getParameter('apiUsername'); |
||
44 | } |
||
45 | |||
46 | public function setApiKey($value) |
||
47 | { |
||
48 | return $this->setParameter('apiKey', $value); |
||
49 | } |
||
50 | |||
51 | public function getApiKey() |
||
52 | { |
||
53 | return $this->getParameter('apiKey'); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Purchase |
||
58 | * |
||
59 | * @param array $parameters Parameters |
||
60 | * |
||
61 | * @return Omnipay\WindcaveHpp\Message\PurchaseRequest |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
62 | */ |
||
63 | public function purchase(array $parameters = []) |
||
64 | { |
||
65 | return $this->createRequest( |
||
0 ignored issues
–
show
|
|||
66 | PurchaseRequest::class, |
||
67 | $parameters |
||
68 | ); |
||
69 | } |
||
70 | |||
71 | public function createCard(array $parameters = []) |
||
72 | { |
||
73 | return $this->createRequest( |
||
74 | PurchaseRequest::class, |
||
75 | $parameters + ['store_card' => true] |
||
76 | ); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Complete a purchase process |
||
81 | * |
||
82 | * @param array $parameters |
||
83 | * |
||
84 | * @return Omnipay\WindcaveHpp\Message\CompletePurchaseRequest |
||
0 ignored issues
–
show
|
|||
85 | */ |
||
86 | public function completePurchase(array $parameters = []) |
||
87 | { |
||
88 | return $this->createRequest( |
||
0 ignored issues
–
show
|
|||
89 | CompletePurchaseRequest::class, |
||
90 | $parameters |
||
91 | ); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Complete a purchase process and save card |
||
96 | * |
||
97 | * @param array $parameters |
||
98 | * |
||
99 | * @return Omnipay\WindcaveHpp\Message\CompletePurchaseRequest |
||
100 | */ |
||
101 | public function completeCreateCard(array $parameters = []) |
||
102 | { |
||
103 | return $this->createRequest( |
||
104 | CompletePurchaseRequest::class, |
||
105 | $parameters |
||
106 | ); |
||
107 | } |
||
108 | |||
109 | public function acceptNotification(array $parameters = []) |
||
110 | { |
||
111 | return $this->createRequest( |
||
112 | AcceptNotification::class, |
||
113 | $parameters |
||
114 | )->send(); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Refund |
||
119 | * |
||
120 | * @param array $parameters Parameters |
||
121 | * |
||
122 | * @return Omnipay\WindcaveHpp\Message\RefundRequest |
||
123 | */ |
||
124 | public function refund(array $parameters = []) |
||
125 | { |
||
126 | return $this->createRequest( |
||
127 | RefundRequest::class, |
||
128 | $parameters |
||
129 | ); |
||
130 | } |
||
131 | } |
||
132 |