Skip to content

Commit

Permalink
Updated readme and core function
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse committed Nov 13, 2023
1 parent 79d8a8b commit a6924fa
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,29 @@ echo ($transaction->isPaid() || $transaction->isAuthorized())?'Paid':'Not paid';

```

### Failover gateway
In the event of an outage, set the failover gateway like this:

```
use Paynl\Config;
use Paynl\Transaction;
require __DIR__ . '/vendor/autoload.php';
Config::setTokenCode('AT-####-####');
Config::setApiToken('****************************************');
Config::setServiceId('SL-####-####');
# Setting Failover gateway (for available cores, call Config::getCores())
Config::setCore( Config::CORE2 );
# Or for SDK versions lower then 1.6.7, use:
Config::setApiBase('https://rest.achterelkebetaling.nl');
$requiredArguments = []; // See: Start a transaction example
$result = Transaction::start($requiredArguments);
```


### Testing
Please run ```vendor/bin/phpunit --bootstrap vendor/autoload.php tests/``` to test the application
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paynl/sdk",
"version": "1.6.6",
"version": "1.6.7",
"require": {
"php-curl-class/php-curl-class": "^8.3||^9.0",
"ext-json": "*",
Expand Down
21 changes: 18 additions & 3 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
*/
class Config
{
const CORE1 = 'https://rest-api.pay.nl';
const CORE1_TEXT = 'Pay.nl (Default)';
const CORE2 = 'https://rest.achterelkebetaling.nl';
const CORE2_TEXT = 'Achterelkebetaling.';
const CORE3 = 'https://rest.payments.nl';
const CORE3_TEXT = 'Payments.nl';

/**
* @var string The token code (AT-xxxx-xxxx)
Expand Down Expand Up @@ -70,9 +76,9 @@ class Config
public static function getCores()
{
return [
'https://rest-api.pay.nl' => 'Pay.nl (Default)',
'https://rest.achterelkebetaling.nl' => 'Achterelkebetaling.nl',
'https://rest.payments.nl' => 'Payments.nl',
self::CORE1 => self::CORE1_TEXT,
self::CORE2 => self::CORE2_TEXT,
self::CORE3 => self::CORE3_TEXT,
];
}

Expand Down Expand Up @@ -132,6 +138,15 @@ public static function setApiBase($apiBase)
self::$apiBase = $apiBase;
}

/**
* @param $core
* @return void
*/
public static function setCore($core)
{
self::setApiBase($core);
}

/**
* @param string $paymentApiBase
*/
Expand Down

0 comments on commit a6924fa

Please sign in to comment.