-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from paynl/master
update
- Loading branch information
Showing
175 changed files
with
8,384 additions
and
1,087 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
nbproject/* | ||
index.php | ||
vendor/* | ||
composer.lock | ||
.idea/* | ||
samples/config.php | ||
.idea/* | ||
vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
language: php | ||
|
||
matrix: | ||
include: | ||
- php: 5.6 | ||
- php: 7 | ||
- php: 7.1 | ||
- php: 7.2 | ||
- php: 7.3 | ||
fast_finish: true | ||
|
||
before_install: | ||
- composer self-update | ||
|
||
before_script: | ||
- composer install | ||
|
||
script: | ||
- vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-clover build/logs/clover.xml tests/ | ||
|
||
after_success: | ||
- travis_retry php vendor/bin/coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Pay.nl | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
[](https://packagist.org/packages/paynl/sdk) [](https://packagist.org/packages/paynl/sdk) [](https://packagist.org/packages/paynl/sdk) | ||
[](https://packagist.org/packages/paynl/sdk) | ||
[](https://packagist.org/packages/paynl/sdk) | ||
[](https://packagist.org/packages/paynl/sdk) | ||
[](https://travis-ci.org/paynl/sdk) | ||
[](https://coveralls.io/github/paynl/sdk?branch=master) | ||
# Pay.nl PHP SDK | ||
|
||
--- | ||
|
@@ -35,7 +39,7 @@ You can download the zip on the projects [releases](https://github.com/paynl/sdk | |
|
||
### Requirements | ||
|
||
The Pay.nl PHP SDK works on php versions 5.3, 5.4, 5.5 and 5.6. | ||
The Pay.nl PHP SDK works on php versions 5.3, 5.4, 5.5, 5.6, 7.0 and 7.1 | ||
Also the php curl extension needs to be installed. | ||
|
||
### Quick start and examples | ||
|
@@ -44,7 +48,8 @@ Set the configuration | |
```php | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
// Replace apitoken and serviceId with your own. | ||
// Replace tokenCode apitoken and serviceId with your own. | ||
\Paynl\Config::setTokenCode('AT-1234-5678'); | ||
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab'); | ||
\Paynl\Config::setServiceId('SL-3490-4320'); | ||
``` | ||
|
@@ -53,6 +58,7 @@ Get available payment methods | |
```php | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
\Paynl\Config::setTokenCode('AT-1234-5678'); | ||
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab'); | ||
\Paynl\Config::setServiceId('SL-3490-4320'); | ||
|
||
|
@@ -64,6 +70,7 @@ Start a transaction | |
```php | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
\Paynl\Config::setTokenCode('AT-1234-5678'); | ||
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab'); | ||
\Paynl\Config::setServiceId('SL-3490-4320'); | ||
|
||
|
@@ -106,7 +113,7 @@ $result = \Paynl\Transaction::start(array( | |
'initials' => 'T', | ||
'lastName' => 'Test', | ||
'gender' => 'M', | ||
'dob' => '14-05-1999', | ||
'birthDate' => new DateTime('1990-01-10'), | ||
'phoneNumber' => '0612345678', | ||
'emailAddress' => '[email protected]', | ||
), | ||
|
@@ -139,6 +146,7 @@ On the return page, redirect the user to the thank you page or back to checkout | |
```php | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
\Paynl\Config::setTokenCode('AT-1234-5678'); | ||
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab'); | ||
|
||
$transaction = \Paynl\Transaction::getForReturn(); | ||
|
@@ -157,11 +165,12 @@ On the exchange script, process the order | |
```php | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
\Paynl\Config::setTokenCode('AT-1234-5678'); | ||
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab'); | ||
|
||
$transaction = \Paynl\Transaction::getForExchange(); | ||
|
||
if($transaction->isPaid()){ | ||
if($transaction->isPaid() || $transaction->isAuthorized()){ | ||
// process the payment | ||
} elseif($transaction->isCanceled()){ | ||
// payment canceled, restock items | ||
|
@@ -172,7 +181,10 @@ echo "TRUE| "; | |
|
||
// Optionally you can send a message after TRUE|, you can view these messages in the logs. | ||
// https://admin.pay.nl/logs/payment_state | ||
echo $transaction->isPaid()?'Paid':'Not paid'; | ||
echo ($transaction->isPaid() || $transaction->isAuthorized())?'Paid':'Not paid'; | ||
|
||
|
||
``` | ||
|
||
### Testing | ||
Please run ```vendor/bin/phpunit --bootstrap vendor/autoload.php tests/``` to test the application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
{ | ||
"name": "paynl/sdk", | ||
"require": { | ||
"php-curl-class/php-curl-class": "^4.8" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Andy Pieters", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload":{ | ||
"psr-4": { | ||
"Paynl\\": "src/" | ||
} | ||
"name": "paynl/sdk", | ||
"require": { | ||
"php-curl-class/php-curl-class": "^8.3", | ||
"ext-json": "*", | ||
"ext-curl": "*" | ||
}, | ||
"suggest": { | ||
"ext-simplexml": "*" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.8", | ||
"php-coveralls/php-coveralls": "^1.0" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Andy Pieters", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Paynl\\": "src/" | ||
} | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
require_once "../../vendor/autoload.php"; | ||
|
||
$uuid = 'b0898a33-1234-1234-0000-494e56303031'; | ||
$secret = 'abcdef1234567890abcdef1234567890abcdef12'; | ||
|
||
try { | ||
$decoded = \Paynl\DynamicUUID::decode($uuid, $secret); | ||
var_dump($decoded); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
require_once "../../vendor/autoload.php"; | ||
|
||
$UUID = \Paynl\DynamicUUID::encode( | ||
'SL-1234-1234', | ||
'abcdef1234567890abcdef1234567890abcdef12', | ||
'INV001' | ||
); | ||
|
||
$ideal = \Paynl\DynamicUUID::ideal($UUID, true); | ||
// load qr image from url | ||
echo "<img src='".$ideal['QRUrl']."'>"; | ||
// load qr image from base64 | ||
echo "<img src='data:image/png;base64,".$ideal['QRBase64']."'>"; | ||
// the url the qr-code points to | ||
echo "<br /><a href='".$ideal['url']."'>".$ideal['url']."</a><br />"; | ||
|
||
|
||
$bancontact = \Paynl\DynamicUUID::bancontact($UUID, true); | ||
// load qr image from url | ||
echo "<img src='".$bancontact['QRUrl']."'>"; | ||
// load qr image from base64 | ||
echo "<img src='data:image/png;base64,".$bancontact['QRBase64']."'>"; | ||
// the url the qr-code points to | ||
echo "<br /><a href='".$bancontact['url']."'>".$bancontact['url']."</a><br />"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
require_once "../../vendor/autoload.php"; | ||
|
||
$uuid = 'sl49b880-1234-1234-inv2-018000178532'; | ||
$secret = 'abcdef1234567890abcdef1234567890abcdef12'; | ||
|
||
$isValid = \Paynl\DynamicUUID::validate($uuid, $secret); | ||
|
||
echo $isValid?'The uuid is valid': 'The uuid is NOT valid'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
\Paynl\Config::setApiToken('bf81d83f6f8ca32bca272dfdcaf2f14902ff41'); | ||
\Paynl\Config::setServiceId('SL-3490-4320'); | ||
\Paynl\Config::setTokenCode('AT-0123-4567'); | ||
|
||
//optional: you can download it on https://curl.haxx.se/ca/cacert.pem | ||
//\Paynl\Config::setCAInfoLocation('path/to/cacert.pem'); | ||
// Or you can skip verifyPeer | ||
//\Paynl\Config::setVerifyPeer(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
require_once '../../vendor/autoload.php'; | ||
require_once '../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit::add(array( | ||
'amount' => 0.1, | ||
'bankaccountHolder' => 'N. Klant', | ||
'bankaccountNumber' => 'NL00RAB0123456789', | ||
|
||
// optional | ||
'bankaccountBic' => 'RABONL2U', | ||
// 'exchangeUrl' => 'http://path_to_your_exchange/file.php', | ||
'processDate' => new \DateTime('tomorrow'), | ||
'description' => 'De omschrijving', | ||
'ipAddress' => '192.168.20.123', | ||
'email' => '[email protected]', | ||
'promotorId' => '123456789', | ||
'tool' => 'sdk', | ||
'info' => 'info', | ||
'object' => 'object', | ||
'extra1' => 'extra1', | ||
'extra2' => 'extra2', | ||
'extra3' => 'extra3', | ||
'currency' => 'EUR', | ||
)); | ||
echo $result->getMandateId(); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
require_once '../../vendor/autoload.php'; | ||
require_once '../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit::get('IO-9350-3111-3010'); | ||
var_dump($result->getData()); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
require_once '../../../vendor/autoload.php'; | ||
require_once '../../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit\Mandate::add(array( | ||
'amount' => 0.1, | ||
'bankaccountHolder' => 'N. Klant', | ||
'bankaccountNumber' => 'NL00RABO0123456789', | ||
|
||
// optional | ||
'bankaccountBic' => 'RABONL2U', | ||
'processDate' => new \DateTime('tomorrow'), | ||
// 'exchangeUrl' => 'http://path_to_your_exchange/file.php', | ||
'description' => 'De omschrijving', | ||
'ipAddress' => '192.168.20.123', | ||
'email' => '[email protected]', | ||
'promotorId' => '123456789', | ||
'tool' => 'sdk', | ||
'info' => 'info', | ||
'object' => 'object', | ||
'extra1' => 'extra1', | ||
'extra2' => 'extra2', | ||
'extra3' => 'extra3', | ||
'currency' => 'EUR', | ||
)); | ||
echo $result->getMandateId(); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
require_once '../../../vendor/autoload.php'; | ||
require_once '../../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit\Mandate::addTransaction(array( | ||
'mandateId' => 'IO-6604-2112-1710', | ||
'amount' => 0.10, | ||
'description' => 'Handmatig herhaald', | ||
'processDate' => new \DateTime('tomorrow'), | ||
)); | ||
var_dump($result->getData()); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
require_once '../../../vendor/autoload.php'; | ||
require_once '../../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit\Mandate::get('IO-6604-2112-1710'); | ||
$data = $result->getData(); | ||
var_dump($data['result']); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
require_once '../../../vendor/autoload.php'; | ||
require_once '../../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit\Recurring::add(array( | ||
'amount' => 0.1, | ||
'bankaccountHolder' => 'N Klant', | ||
'bankaccountNumber' => 'NL00RABO0123456789', | ||
'intervalValue' => 1, | ||
'intervalPeriod' => Paynl\DirectDebit\Recurring::INTERVAL_DAY, | ||
'intervalQuantity' => 3, | ||
'bankaccountBic' => 'RABONL2U', | ||
'processDate' => '08-07-2016', | ||
|
||
// optional | ||
// 'exchangeUrl' => 'http://path_to_your_exchange/file.php', | ||
'description' => 'De omschrijving', | ||
'ipAddress' => '192.168.20.123', | ||
'email' => '[email protected]', | ||
'promotorId' => '123456789', | ||
'tool' => 'sdk', | ||
'info' => 'info', | ||
'object' => 'object', | ||
'extra1' => 'extra1', | ||
'extra2' => 'extra2', | ||
'extra3' => 'extra3', | ||
'currency' => 'EUR', | ||
)); | ||
echo $result->getMandateId(); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
require_once '../../../vendor/autoload.php'; | ||
require_once '../../config.php'; | ||
try { | ||
$result = \Paynl\DirectDebit\Recurring::get('IO-3674-2126-0710'); | ||
$data = $result->getData(); | ||
var_dump($data['result']); | ||
} catch (\Paynl\Error\Error $e) { | ||
echo "Error: ".$e->getMessage(); | ||
} |
Oops, something went wrong.