-
Notifications
You must be signed in to change notification settings - Fork 9
/
TinkoffPay.php
188 lines (169 loc) · 3.96 KB
/
TinkoffPay.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
namespace chumakovanton\tinkoffPay;
use chumakovanton\tinkoffPay\request\RequestInit;
use yii\base\BaseObject;
/**
* Class TinkoffPay
*
* @author Chumakov Anton <[email protected]>
*
* @package chumakovanton\tinkoffPay
*
* @property string $terminalKey
* @property string $secretKey
* @property string $apiUrl
*/
class TinkoffPay extends BaseObject
{
/**
* @var string
*/
private $_apiUrl;
/**
* @var string
*/
private $_terminalKey;
/**
* @var string
*/
private $_secretKey;
/**
* Initialize the payment
*
* @param string $orderId
* @param int $amount
* @return RequestInit
*/
public function initPay(string $orderId, int $amount): RequestInit
{
$request = new RequestInit($orderId, $amount);
$request->setCredentials($this->_apiUrl, $this->_terminalKey, $this->_secretKey);
return $request;
}
/**
* Get state of payment
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function getState($args)
{
return ;//todo $this->buildQuery('GetState', $args);
}
/**
* Confirm 2-staged payment
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function confirm($args)
{
return ;//todo $this->buildQuery('Confirm', $args);
}
/**
* Performs recursive (re) payment - direct debiting of funds from the
* account of the Buyer's credit card.
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function charge($args)
{
return ;//todo $this->buildQuery('Charge', $args);
}
/**
* Registers in the terminal buyer Seller. (Init do it automatically)
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function addCustomer($args)
{
return ;//todo $this->buildQuery('AddCustomer', $args);
}
/**
* Returns the data stored for the terminal buyer Seller.
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function getCustomer($args)
{
return ;//todo $this->buildQuery('GetCustomer', $args);
}
/**
* Deletes the data of the buyer.
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function removeCustomer($args)
{
return ;//todo $this->buildQuery('RemoveCustomer', $args);
}
/**
* Returns a list of bounded card from the buyer.
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function getCardList($args)
{
return ;//todo $this->buildQuery('GetCardList', $args);
}
/**
* Removes the customer's bounded card.
*
* @param mixed $args Can be associative array or string
*
* @return mixed
*/
public function removeCard($args)
{
return ;//todo $this->buildQuery('RemoveCard', $args);
}
/**
* The method is designed to send all unsent notification
*
* @return mixed
* @throws \yii\web\HttpException
*/
public function resend()
{
return ;//todo $this->buildQuery('Resend', null);
}
/**
* @param string $apiUrl
* @return TinkoffPay
*/
public function setApiUrl($apiUrl): TinkoffPay
{
$this->_apiUrl = $apiUrl;
return $this;
}
/**
* @param string $terminalKey
* @return TinkoffPay
*/
public function setTerminalKey($terminalKey): TinkoffPay
{
$this->_terminalKey = $terminalKey;
return $this;
}
/**
* @param string $secretKey
* @return TinkoffPay
*/
public function setSecretKey($secretKey): TinkoffPay
{
$this->_secretKey = $secretKey;
return $this;
}
}