@@ -13,6 +13,7 @@ Pay. driver for the Omnipay payment processing library
13
13
- [ Installation] ( #installation )
14
14
- [ Update instructions] ( #update-instructions )
15
15
- [ Usage] ( #usage )
16
+ - [ Tests] ( #test )
16
17
- [ Support] ( #support )
17
18
18
19
@@ -34,7 +35,10 @@ Bank Transfer | Cartasi | GivaCard | SprayPay | Przelewy24 |
34
35
35
36
# Requirements
36
37
37
- PHP 5.6 or higher
38
+ Before running the tests, make sure you have:
39
+ - PHP installed (7.4 or higher recommended)
40
+ - Composer installed
41
+ - A Pay.nl account with API credentials
38
42
39
43
40
44
# Installation
@@ -66,10 +70,11 @@ use Omnipay\Omnipay;
66
70
$gateway = Omnipay::create('PaynlV3');
67
71
68
72
$gateway->setApiSecret('****************************************');
69
- $gateway->setTokenCode('SL-####-####');
73
+ $gateway->setTokenCode('AT-####-####');
74
+ $gateway->setServiceId('SL-####-####');
70
75
```
71
76
72
- 3 . Enter the TokenCode, API token (these can be found in the Pay. My Pay Panel --> https://my.pay.nl/
77
+ 3 . Enter the TokenCode, API token, ServiceId (these can be found in the Pay. My Pay Panel --> https://my.pay.nl/
73
78
74
79
Go to the * Settings* / * Sales locations* tab in the Pay. Scroll down to the sales location and there copy the SL code and the secret.
75
80
@@ -90,9 +95,7 @@ The plugin has now been updated
90
95
# Usage
91
96
### Get payment methods
92
97
``` php
93
- $response = $gateway->fetchPaymentMethods([
94
- 'serviceId' => "SL-####-####",
95
- ])->send();
98
+ $response = $gateway->fetchPaymentMethods()->send();
96
99
97
100
$response->getPaymentMethods();
98
101
@@ -107,9 +110,7 @@ foreach ($response->getPaymentMethods() as $paymentMethod) {
107
110
108
111
### Get Issuers (Ideal)
109
112
``` php
110
- $response = $gateway->fetchIssuers([
111
- 'serviceId' => "SL-####-####",
112
- ])->send();
113
+ $response = $gateway->fetchIssuers()->send();
113
114
114
115
$response->getIssuers();
115
116
@@ -205,26 +206,76 @@ if ($response->isSuccessful()) {
205
206
$statusUrl = $response->getStatusUrl();
206
207
$voidUrl = $response->getVoidUrl();
207
208
$redirectUrl = $response->getRedirectUrl();
209
+ $givenCaptureUrl = $response->getCaptureUrl();
210
+ $givenCaptureAmountUrl = $response->getCaptureAmountUrl();
211
+ $givenCaptureProductsUrl = $response->getCaptureProductsUrl();
212
+ $abortUrl = $response->getAbortUrl();
213
+ $approveUrl = $response->getApproveUrl();
214
+ $declineUrl = $response->getDeclineUrl();
215
+ $debugUrl = $response->getDebugUrl();
216
+ $checkoutUrl = $response->getCheckoutUrl();
217
+ }
208
218
209
219
# Payment was successful
210
220
var_dump($response);
211
221
212
222
} elseif ($response->isRedirect()) {
213
223
# Get the url for fetching the Transaction
214
- get
215
-
224
+ $redirectUrl = $response->getRedirectUrl();
216
225
} else {
217
-
218
226
# Payment failed
219
227
echo $response->getMessage();
220
228
}
221
229
```
222
230
### Get a transaction (Order: status )
223
231
224
232
``` php
225
- $response = $gateway->fetchTransaction([
226
- 'transactionReference' => "##########",
227
- ])->send();
233
+ $response = $gateway->fetchTransaction(['stateUrl' => $statusUrl])->send();
234
+
235
+ if ($response->isSuccessful()) {
236
+ # Get was successful
237
+ print_r($response);
238
+
239
+ } else {
240
+ # Get failed
241
+ echo $response->getMessage();
242
+ }
243
+ ```
244
+
245
+ ### Approve order (Order: approve )
246
+
247
+ ``` php
248
+ $response = $gateway->approve(['approveUrl' => $approveUrl])->send();
249
+
250
+ if ($response->isSuccessful()) {
251
+ # Get was successful
252
+ print_r($response);
253
+
254
+ } else {
255
+ # Get failed
256
+ echo $response->getMessage();
257
+ }
258
+ ```
259
+
260
+ ### Approve order (Order: Decline )
261
+
262
+ ``` php
263
+ $response = $gateway->decline(['declineUrl' => $declineUrl])->send();
264
+
265
+ if ($response->isSuccessful()) {
266
+ # Get was successful
267
+ print_r($response);
268
+
269
+ } else {
270
+ # Get failed
271
+ echo $response->getMessage();
272
+ }
273
+ ```
274
+
275
+ ### Capture order (Order: Capture )
276
+
277
+ ``` php
278
+ $response = $gateway->capture(['captureUrl' => $captureUrl])->send();
228
279
229
280
if ($response->isSuccessful()) {
230
281
# Get was successful
@@ -236,19 +287,41 @@ if ($response->isSuccessful()) {
236
287
}
237
288
```
238
289
239
- ### Refund a transaction
290
+ ### Capture amount order (Order: CaptureAmount )
291
+
240
292
``` php
241
- $response = $gateway->refund([
242
- 'transactionReference' => '##########'
243
- ])->send();```
293
+ $response = $gateway->captureAmount([
294
+ 'captureAmountUrl' => $captureAmountUrl,
295
+ 'amount' => '14.00'
296
+ ])->send();
297
+
298
+ if ($response->isSuccessful()) {
299
+ # Get was successful
300
+ print_r($response);
301
+
302
+ } else {
303
+ # Get failed
304
+ echo $response->getMessage();
305
+ }
306
+ ```
307
+
308
+ ### Capture products order (Order: CaptureProducts )
244
309
245
- ### Capture a transaction
246
310
``` php
311
+ $arrItems = array();
312
+ $item = new Item();
313
+ $item->setProductId('SKU01')
314
+ ->setProductType('ARTICLE')
315
+ ->setVatPercentage(21)
316
+ ->setDescription('Description')
317
+ ->setPrice('10')
318
+ ->setQuantity(4);
319
+
320
+ $arrItems[] = $item;
247
321
248
- $response = $gateway->capture([
249
- 'transactionReference' => '##########',
250
- 'amount' => '23.32',
251
- 'items' => array(),
322
+ $response = $gateway->captureProducts([
323
+ 'captureAmountUrl' => $captureProductsUrl,
324
+ 'items' => $arrItems
252
325
])->send();
253
326
254
327
if ($response->isSuccessful()) {
@@ -259,15 +332,29 @@ if ($response->isSuccessful()) {
259
332
# Get failed
260
333
echo $response->getMessage();
261
334
}
335
+ ```
336
+
337
+ ### Capture products order (Order: Abort )
338
+
339
+ ``` php
340
+ $response = $gateway->abort([
341
+ 'abortUrl' => $abortUrl
342
+ ])->send();
262
343
344
+ if ($response->isSuccessful()) {
345
+ # Get was successful
346
+ print_r($response);
347
+
348
+ } else {
349
+ # Get failed
350
+ echo $response->getMessage();
351
+ }
263
352
```
264
353
265
354
### Void a transaction
266
355
267
356
``` php
268
- $response = $gateway->void([
269
- 'transactionReference' => "##########",
270
- ])->send();
357
+ $response = $gateway->void(['voidUrl' => $voidUrl])->send();
271
358
272
359
if ($response->isSuccessful()) {
273
360
# Get was successful
@@ -279,6 +366,45 @@ if ($response->isSuccessful()) {
279
366
}
280
367
```
281
368
369
+ # Test
370
+
371
+ Before running the tests, make sure you have:
372
+ - PHP installed (7.4 or higher recommended)
373
+ - Composer installed
374
+ - A Pay.nl account with API credentials
375
+
376
+ ## Setup
377
+
378
+ 1 . Install dependencies:
379
+ ``` bash
380
+ composer install
381
+ ```
382
+
383
+ 2 . Create a copy of the phpunit configuration file:
384
+ ``` bash
385
+ cp phpunit.xml.dist phpunit.xml
386
+ ```
387
+
388
+ 3 . Configure environment variables in your ` phpunit.xml ` :
389
+
390
+ Replace the empty values with your Pay.nl credentials:
391
+
392
+ > ** Note** : Never commit your actual API credentials to version control. The ` phpunit.xml ` file should be in your ` .gitignore ` .
393
+
394
+ ## Running Tests
395
+
396
+ To run all tests:
397
+ ``` bash
398
+ ./vendor/bin/phpunit --testsuite " Omni pay v3 tests"
399
+ ```
400
+
401
+ ## Environment Variables
402
+
403
+ | Variable | Description |
404
+ | ----------| --------------------------------------------------|
405
+ | ` PAYNL_SERVICE_CODE ` | Your Pay.nl service location code (SL-xxxx-xxxx) |
406
+ | ` PAYNL_API_SECRET ` | Your Pay.nl API token |
407
+
282
408
# Support
283
409
https://www.pay.nl
284
410
0 commit comments