@@ -10,10 +10,289 @@ NestPay (EST) (İş Bankası, Akbank, Finansbank, Denizbank, Kuveytturk, Halkban
10
10
<a href =" https://github.com/thephpleague/omnipay " >Omnipay</a > is a framework agnostic, multi-gateway payment
11
11
processing library for PHP 7.3+. This package implements NestPay Online Payment Gateway support for Omnipay.
12
12
13
- #### Installation
13
+ * You have to contact the NestPay for the document.
14
+ * You have to take bank accounts from NestPay.
14
15
15
- Omnipay is installed via <a href =" http://getcomposer.org/ " rel =" nofollow " >Composer</a >. To install, simply require with Composer:
16
16
17
+ ## Requirement
18
+
19
+ * PHP >= 7.3.x,
20
+ * [ Omnipay V.3] ( https://github.com/thephpleague/omnipay ) repository,
21
+ * PHPUnit to run tests
22
+
23
+ ## Autoload
24
+
25
+ You have to install omnipay V.3
26
+
27
+ ``` bash
28
+ composer require league/omnipay:^3
17
29
```
30
+
31
+ Then you have to install omnipay-payu package:
32
+
33
+ ``` bash
18
34
composer require alegra/omnipay-nestpay
19
35
```
36
+
37
+ > ` payment-nestpay ` follows the PSR-4 convention names for its classes, which means you can easily integrate ` payment-nestpay ` classes loading in your own autoloader.
38
+
39
+ ## Basic Usage
40
+
41
+ - You can use /examples folder to execute examples. This folder is exists here only to show you examples, it is not for production usage.
42
+ - First in /examples folder:
43
+
44
+ ``` bash
45
+ composer install
46
+ ```
47
+
48
+ ** Authorize Example**
49
+
50
+ - You can check authorize.php file in /examples folder.
51
+
52
+ ``` php
53
+ <?php
54
+
55
+ $loader = require __DIR__ . '/vendor/autoload.php';
56
+ $loader->addPsr4('Examples\\', __DIR__);
57
+
58
+ use Omnipay\NestPay\Gateway;
59
+ use Examples\Helper;
60
+
61
+ $gateway = new Gateway();
62
+ $helper = new Helper();
63
+
64
+ try {
65
+ $params = $helper->getAuthorizeParams();
66
+ $response = $gateway->authorize($params)->send();
67
+
68
+ $result = [
69
+ 'status' => $response->isSuccessful() ?: 0,
70
+ 'redirect' => $response->isRedirect() ?: 0,
71
+ 'message' => $response->getMessage(),
72
+ 'requestParams' => $response->getServiceRequestParams(),
73
+ 'response' => $response->getData()
74
+ ];
75
+
76
+ print("<pre >" . print_r($result, true) . "</pre >");
77
+ } catch (Exception $e) {
78
+ throw new \RuntimeException($e->getMessage());
79
+ }
80
+
81
+ ```
82
+
83
+ ** Capture Example**
84
+
85
+ - You can check capture.php file in /examples folder.
86
+
87
+ ``` php
88
+ <?php
89
+
90
+ $loader = require __DIR__ . '/vendor/autoload.php';
91
+ $loader->addPsr4('Examples\\', __DIR__);
92
+
93
+ use Omnipay\NestPay\Gateway;
94
+ use Examples\Helper;
95
+
96
+ $gateway = new Gateway();
97
+ $helper = new Helper();
98
+
99
+ try {
100
+ $params = $helper->getCaptureParams();
101
+ $response = $gateway->capture($params)->send();
102
+
103
+ $result = [
104
+ 'status' => $response->isSuccessful() ?: 0,
105
+ 'redirect' => $response->isRedirect() ?: 0,
106
+ 'message' => $response->getMessage(),
107
+ 'requestParams' => $response->getServiceRequestParams(),
108
+ 'response' => $response->getData()
109
+ ];
110
+
111
+ print("<pre >" . print_r($result, true) . "</pre >");
112
+ } catch (Exception $e) {
113
+ throw new \RuntimeException($e->getMessage());
114
+ }
115
+
116
+ ```
117
+
118
+ ** Purchase Example**
119
+
120
+ - You can check purchase.php file in /examples folder.
121
+
122
+ ``` php
123
+ <?php
124
+
125
+ $loader = require __DIR__ . '/vendor/autoload.php';
126
+ $loader->addPsr4('Examples\\', __DIR__);
127
+
128
+ use Omnipay\NestPay\Gateway;
129
+ use Examples\Helper;
130
+
131
+ $gateway = new Gateway();
132
+ $helper = new Helper();
133
+
134
+ try {
135
+ $params = $helper->getPurchaseParams();
136
+ $response = $gateway->purchase($params)->send();
137
+
138
+ $result = [
139
+ 'status' => $response->isSuccessful() ?: 0,
140
+ 'redirect' => $response->isRedirect() ?: 0,
141
+ 'message' => $response->getMessage(),
142
+ 'requestParams' => $response->getServiceRequestParams(),
143
+ 'response' => $response->getData()
144
+ ];
145
+
146
+ print("<pre >" . print_r($result, true) . "</pre >");
147
+ } catch (Exception $e) {
148
+ throw new \RuntimeException($e->getMessage());
149
+ }
150
+ ```
151
+
152
+ ** Purchase 3d Example**
153
+
154
+ - You can check purchase3d.php file in /examples folder.
155
+
156
+ ``` php
157
+ <?php
158
+
159
+ $loader = require __DIR__ . '/vendor/autoload.php';
160
+ $loader->addPsr4('Examples\\', __DIR__);
161
+
162
+ use Omnipay\NestPay\Gateway;
163
+ use Examples\Helper;
164
+
165
+ $gateway = new Gateway();
166
+ $helper = new Helper();
167
+
168
+ try {
169
+ $params = $helper->getPurchase3dParams();
170
+ $response = $gateway->purchase($params)->send();
171
+
172
+ $result = [
173
+ 'status' => $response->isSuccessful() ?: 0,
174
+ 'redirect' => $response->isRedirect() ?: 0,
175
+ 'message' => $response->getMessage(),
176
+ 'requestParams' => $response->getServiceRequestParams(),
177
+ 'response' => $response->getData()
178
+ ];
179
+
180
+ print("<pre >" . print_r($result, true) . "</pre >");
181
+ } catch (Exception $e) {
182
+ throw new \RuntimeException($e->getMessage());
183
+ }
184
+ ```
185
+
186
+ ** Complete Purchase Example**
187
+
188
+ - You can check completePurchase.php file in /examples folder.
189
+ - Request parameters are created from the data you receive as a result of the 3d payment request.
190
+
191
+ ``` php
192
+ <?php
193
+
194
+ $loader = require __DIR__ . '/vendor/autoload.php';
195
+ $loader->addPsr4('Examples\\', __DIR__);
196
+
197
+ use Omnipay\NestPay\Gateway;
198
+ use Examples\Helper;
199
+
200
+ $gateway = new Gateway();
201
+ $helper = new Helper();
202
+
203
+ try {
204
+ $params = $helper->getCompletePurchaseParams();
205
+ $response = $gateway->completePurchase($params)->send();
206
+
207
+ $result = [
208
+ 'status' => $response->isSuccessful() ?: 0,
209
+ 'redirect' => $response->isRedirect() ?: 0,
210
+ 'message' => $response->getMessage(),
211
+ 'requestParams' => $response->getServiceRequestParams(),
212
+ 'response' => $response->getData()
213
+ ];
214
+
215
+ print("<pre >" . print_r($result, true) . "</pre >");
216
+ } catch (Exception $e) {
217
+ throw new \RuntimeException($e->getMessage());
218
+ }
219
+ ```
220
+
221
+ ** Refund Example**
222
+
223
+ - You can check refund.php file in /examples folder.
224
+
225
+ ``` php
226
+ <?php
227
+
228
+ $loader = require __DIR__ . '/vendor/autoload.php';
229
+ $loader->addPsr4('Examples\\', __DIR__);
230
+
231
+ use Omnipay\NestPay\Gateway;
232
+ use Examples\Helper;
233
+
234
+ $gateway = new Gateway();
235
+ $helper = new Helper();
236
+
237
+ try {
238
+ $params = $helper->getRefundParams();
239
+ $response = $gateway->refund($params)->send();
240
+
241
+ $result = [
242
+ 'status' => $response->isSuccessful() ?: 0,
243
+ 'redirect' => $response->isRedirect() ?: 0,
244
+ 'message' => $response->getMessage(),
245
+ 'requestParams' => $response->getServiceRequestParams(),
246
+ 'response' => $response->getData()
247
+ ];
248
+
249
+ print("<pre >" . print_r($result, true) . "</pre >");
250
+ } catch (Exception $e) {
251
+ throw new \RuntimeException($e->getMessage());
252
+ }
253
+ ```
254
+
255
+ ** Cancel Example**
256
+
257
+ - You can check refund.php file in /examples folder.
258
+
259
+ ``` php
260
+ <?php
261
+
262
+ $loader = require __DIR__ . '/vendor/autoload.php';
263
+ $loader->addPsr4('Examples\\', __DIR__);
264
+
265
+ use Omnipay\NestPay\Gateway;
266
+ use Examples\Helper;
267
+
268
+ $gateway = new Gateway();
269
+ $helper = new Helper();
270
+
271
+ try {
272
+ $params = $helper->getVoidParams();
273
+ $response = $gateway->void($params)->send();
274
+
275
+ $result = [
276
+ 'status' => $response->isSuccessful() ?: 0,
277
+ 'redirect' => $response->isRedirect() ?: 0,
278
+ 'message' => $response->getMessage(),
279
+ 'requestParams' => $response->getServiceRequestParams(),
280
+ 'response' => $response->getData()
281
+ ];
282
+
283
+ print("<pre >" . print_r($result, true) . "</pre >");
284
+ } catch (Exception $e) {
285
+ throw new \RuntimeException($e->getMessage());
286
+ }
287
+ ```
288
+ requestParams:
289
+
290
+ > System send request to nestPay api. It shows request information.
291
+ >
292
+
293
+ ## Licensing
294
+
295
+ [ GNU General Public Licence v3.0] ( LICENSE )
296
+
297
+ For the full copyright and license information, please view the LICENSE
298
+ file that was distributed with this source code.
0 commit comments