From 88686a2204d2793762f641882a038f0001bfe907 Mon Sep 17 00:00:00 2001 From: Zhivko Kabaivanov Date: Thu, 19 Nov 2020 23:02:08 +0200 Subject: [PATCH] Add isSandbox boolean adding a parameter to the function to enable Sandbox URL --- src/Configuration.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Configuration.php b/src/Configuration.php index da956d7..7d85558 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -19,20 +19,28 @@ class Configuration * @param string $apiKey An API key * @param string $apiSecret An API secret * @param string $apiPassphrase An API passphrase + * @param bool $isSandbox is API working in sandbox mode * * @return Configuration A new configuration instance */ - public static function apiKey($apiKey, $apiSecret, $apiPassphrase) - { + public static function apiKey($apiKey, $apiSecret, $apiPassphrase, $isSandbox) + { return new static( - new Authentication($apiKey, $apiSecret, $apiPassphrase) + new Authentication($apiKey, $apiSecret, $apiPassphrase), + $isSandbox ); } - public function __construct(Authentication $authentication) - { + public function __construct(Authentication $authentication, $isSandbox) + { $this->authentication = $authentication; - $this->apiUrl = self::DEFAULT_API_URL; + + if ($isSandbox) { + $this->apiUrl = self::SANDBOX_API_URL; + } + else { + $this->apiUrl = self::DEFAULT_API_URL; + } } /**