Skip to content

Commit

Permalink
Merge pull request #12 from paynl/feature/PLUG-2875-v1
Browse files Browse the repository at this point in the history
 Updated routes
  • Loading branch information
woutse authored Nov 13, 2023
2 parents 7b35dc4 + f702980 commit 79d8a8b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "paynl/sdk",
"version": "1.6.6",
"require": {
"php-curl-class/php-curl-class": "^8.3||^9.0",
"ext-json": "*",
Expand Down
11 changes: 11 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ class Config
*/
private static $verifyPeer = true;

/**
* @return string[]
*/
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',
];
}

/**
* @return string
Expand Down
5 changes: 4 additions & 1 deletion src/Paymentmethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ private static function filterCountry($paymentMethods, $country)
public static function getList(array $options = array())
{
$api = new Api\GetService();

# Always use default gateway for getService
\Paynl\Config::setApiBase('https://rest-api.pay.nl');

$result = $api->doRequest();

$paymentMethods = self::reorderOutput($result);


if (isset($options['country'])) {
$paymentMethods = self::filterCountry($paymentMethods, $options['country']);
Expand Down
9 changes: 9 additions & 0 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,15 @@ public static function get($transactionId)
{
$api = new Api\Info();
$api->setTransactionId($transactionId);

$prefix = (string)substr($transactionId, 0, 2);

if ($prefix == '51') {
\Paynl\Config::setApiBase('https://rest.achterelkebetaling.nl');
} elseif ($prefix == '52') {
\Paynl\Config::setApiBase('https://rest.payments.nl');
}

$result = $api->doRequest();

$result['transactionId'] = $transactionId;
Expand Down

0 comments on commit 79d8a8b

Please sign in to comment.