|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Yandex.Money driver for Omnipay PHP payment library |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://github.com/hiqdev/omnipay-yandexmoney |
|
6
|
|
|
* @package omnipay-yandexmoney |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
* @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/) |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Omnipay\Yoomoney; |
|
12
|
|
|
|
|
13
|
|
|
use Omnipay\Common\AbstractGateway; |
|
14
|
|
|
use Omnipay\Yoomoney\Message\CompletePurchaseRequest; |
|
15
|
|
|
use Omnipay\Yoomoney\Message\PurchaseRequest; |
|
16
|
|
|
use Omnipay\Yoomoney\Message\ServerNotifyRequest; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @method \Omnipay\Common\Message\RequestInterface authorize(array $options = []) |
|
20
|
|
|
* @method \Omnipay\Common\Message\RequestInterface completeAuthorize(array $options = []) |
|
21
|
|
|
* @method \Omnipay\Common\Message\RequestInterface capture(array $options = []) |
|
22
|
|
|
* @method \Omnipay\Common\Message\RequestInterface refund(array $options = []) |
|
23
|
|
|
* @method \Omnipay\Common\Message\RequestInterface fetchTransaction(array $options = []) |
|
24
|
|
|
* @method \Omnipay\Common\Message\RequestInterface void(array $options = []) |
|
25
|
|
|
* @method \Omnipay\Common\Message\RequestInterface createCard(array $options = []) |
|
26
|
|
|
* @method \Omnipay\Common\Message\RequestInterface updateCard(array $options = []) |
|
27
|
|
|
* @method \Omnipay\Common\Message\RequestInterface deleteCard(array $options = []) |
|
28
|
|
|
*/ |
|
29
|
|
|
class Gateway extends AbstractGateway |
|
30
|
|
|
{ |
|
31
|
3 |
|
public function getName() |
|
32
|
|
|
{ |
|
33
|
3 |
|
return 'Yoomoney'; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
60 |
|
public function getDefaultParameters() |
|
37
|
|
|
{ |
|
38
|
|
|
return [ |
|
39
|
60 |
|
'secret' => '', |
|
40
|
|
|
'receiver' => '', |
|
41
|
|
|
'quickpay_form' => 'shop', |
|
42
|
|
|
'payment_type' => 'PC', |
|
43
|
|
|
'success_url' => null, |
|
44
|
|
|
'targets' => null, |
|
45
|
|
|
'need_fio' => false, |
|
46
|
|
|
'need_email' => false, |
|
47
|
|
|
'need_phone' => false, |
|
48
|
|
|
'need_address' => false, |
|
49
|
|
|
'testMode' => false, |
|
50
|
|
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
9 |
|
public function setSecret($value) |
|
54
|
|
|
{ |
|
55
|
9 |
|
return $this->setParameter('secret', $value); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
3 |
|
public function getSecret() |
|
59
|
|
|
{ |
|
60
|
3 |
|
return $this->getParameter('secret'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
9 |
|
public function setReceiver($value) |
|
64
|
|
|
{ |
|
65
|
9 |
|
return $this->setParameter('receiver', $value); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
3 |
|
public function getReceiver() |
|
69
|
|
|
{ |
|
70
|
3 |
|
return $this->getParameter('receiver'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param string $value shop — для универсальной формы, small — для кнопки, donate — для «благотворительной» формы |
|
75
|
|
|
* |
|
76
|
|
|
* @return Gateway |
|
77
|
|
|
*/ |
|
78
|
9 |
|
public function setQuickpayForm($value) |
|
79
|
|
|
{ |
|
80
|
9 |
|
return $this->setParameter('quickpay_form', $value); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
3 |
|
public function getQuickpayForm() |
|
84
|
|
|
{ |
|
85
|
3 |
|
return $this->getParameter('quickpay_form'); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @param string $value PC - оплата из кошелька ЮMoney, AC - с банковской карты, MC - с баланса мобильного |
|
90
|
|
|
* |
|
91
|
|
|
* @return Gateway |
|
92
|
|
|
*/ |
|
93
|
9 |
|
public function setPaymentType($value) |
|
94
|
|
|
{ |
|
95
|
9 |
|
return $this->setParameter('payment_type', $value); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
3 |
|
public function getPaymentType() |
|
99
|
|
|
{ |
|
100
|
3 |
|
return $this->getParameter('payment_type'); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
9 |
|
public function setSuccessUrl($value) |
|
104
|
|
|
{ |
|
105
|
9 |
|
return $this->setParameter('success_url', $value); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
3 |
|
public function getSuccessUrl() |
|
109
|
|
|
{ |
|
110
|
3 |
|
return $this->getParameter('success_url'); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
9 |
|
public function setNeedFio($value) |
|
114
|
|
|
{ |
|
115
|
9 |
|
return $this->setParameter('need_fio', $value); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
3 |
|
public function getNeedFio() |
|
119
|
|
|
{ |
|
120
|
3 |
|
return $this->getParameter('need_fio'); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
9 |
|
public function setNeedEmail($value) |
|
124
|
|
|
{ |
|
125
|
9 |
|
return $this->setParameter('need_email', $value); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
3 |
|
public function getNeedEmail() |
|
129
|
|
|
{ |
|
130
|
3 |
|
return $this->getParameter('need_email'); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
9 |
|
public function setNeedPhone($value) |
|
134
|
|
|
{ |
|
135
|
9 |
|
return $this->setParameter('need_phone', $value); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
3 |
|
public function getNeedPhone() |
|
139
|
|
|
{ |
|
140
|
3 |
|
return $this->getParameter('need_phone'); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
9 |
|
public function setNeedAddress($value) |
|
144
|
|
|
{ |
|
145
|
9 |
|
return $this->setParameter('need_address', $value); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
3 |
|
public function getNeedAddress() |
|
149
|
|
|
{ |
|
150
|
3 |
|
return $this->getParameter('need_address'); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @param string $value Необязательный параметр (название магазина) |
|
155
|
|
|
* |
|
156
|
|
|
* @return Gateway |
|
157
|
|
|
*/ |
|
158
|
9 |
|
public function setTargets($value) |
|
159
|
|
|
{ |
|
160
|
9 |
|
return $this->setParameter('targets', $value); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
3 |
|
public function getTargets() |
|
164
|
|
|
{ |
|
165
|
3 |
|
return $this->getParameter('targets'); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param array $parameters |
|
170
|
|
|
* |
|
171
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest |
|
172
|
|
|
*/ |
|
173
|
9 |
|
public function purchase(array $parameters = []) |
|
174
|
|
|
{ |
|
175
|
9 |
|
return $this->createRequest(PurchaseRequest::class, $parameters); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Use acceptNotifications |
|
180
|
|
|
* @param array $parameters |
|
181
|
|
|
* |
|
182
|
|
|
* @return \Omnipay\Common\Message\RequestInterface |
|
183
|
|
|
* @deprecated |
|
184
|
|
|
*/ |
|
185
|
9 |
|
public function completePurchase(array $parameters = []) |
|
186
|
|
|
{ |
|
187
|
9 |
|
return $this->createRequest(CompletePurchaseRequest::class, $parameters); |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* Handle notification callback. |
|
192
|
|
|
* Replaces completeAuthorize() and completePurchase() |
|
193
|
|
|
* |
|
194
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest|ServerNotifyRequest |
|
195
|
|
|
*/ |
|
196
|
|
|
public function acceptNotification(array $parameters = array()) |
|
197
|
|
|
{ |
|
198
|
|
|
return $this->createRequest(ServerNotifyRequest::class, $parameters); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
|
|
202
|
|
|
public function __call1($name, $arguments) |
|
|
|
|
|
|
203
|
|
|
{ |
|
204
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface authorize(array $options = array()) |
|
205
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface completeAuthorize(array $options = array()) |
|
206
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface capture(array $options = array()) |
|
207
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface refund(array $options = array()) |
|
208
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface fetchTransaction(array $options = []) |
|
209
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface void(array $options = array()) |
|
210
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface createCard(array $options = array()) |
|
211
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface updateCard(array $options = array()) |
|
212
|
|
|
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface deleteCard(array $options = array()) |
|
213
|
|
|
} |
|
214
|
|
|
} |
|
215
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.