From a650f43cf1e2862bd3c1bece0a8b649adda8bc96 Mon Sep 17 00:00:00 2001 From: woutse Date: Tue, 10 Aug 2021 10:48:06 +0200 Subject: [PATCH] Updated api --- upload/Pay/Api.php | 29 ++++++++++++------- upload/Pay/Controller/Payment.php | 2 +- .../en-gb/extension/payment/paynl3.php | 2 +- .../nl-nl/extension/payment/paynl3.php | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/upload/Pay/Api.php b/upload/Pay/Api.php index c4a5f44..7f3c8a7 100755 --- a/upload/Pay/Api.php +++ b/upload/Pay/Api.php @@ -33,24 +33,33 @@ public function setServiceId($serviceId) { * * @param string $apiToken */ - public function setApiToken($apiToken) { + public function setApiToken($apiToken) + { $this->_apiToken = $apiToken; } - public function setApiBase($gateway){ - $this->_gateway = $gateway; + public function setApiBase($gateway) + { + $this->_gateway = trim($gateway); } - protected function _getPostData() { + protected function _getPostData() + { return $this->_postData; } - protected function _processResult($data) { + protected function _processResult($data) + { return $data; } - private function _getApiUrl() { + /** + * @return string + * @throws Pay_Exception + */ + private function _getApiUrl() + { if ($this->_version == '') { throw new Pay_Exception('version not set', 1); } @@ -61,11 +70,9 @@ private function _getApiUrl() { throw new Pay_Exception('action not set', 1); } - if (!empty(trim($this->_gateway))){ - return $this->_apiUrl = trim($this->_gateway) . '/' . $this->_version . '/' . $this->_controller . '/' . $this->_action . '/json/'; - } else{ - return $this->_apiUrl . '/' . $this->_version . '/' . $this->_controller . '/' . $this->_action . '/json/'; - } + $host = (!empty($this->_gateway) && substr($this->_gateway, 0, 4) === 'http') ? $this->_gateway : $this->_apiUrl; + + return $host . '/' . $this->_version . '/' . $this->_controller . '/' . $this->_action . '/json/'; } public function getPostData(){ diff --git a/upload/Pay/Controller/Payment.php b/upload/Pay/Controller/Payment.php index 1c6fbae..f481134 100755 --- a/upload/Pay/Controller/Payment.php +++ b/upload/Pay/Controller/Payment.php @@ -84,7 +84,7 @@ public function startTransaction() } $apiStart->setDescription($order_info['order_id']); $apiStart->setExtra1($order_info['order_id']); - $apiStart->setObject('opencart3 1.2.8'); + $apiStart->setObject('opencart3 1.3.0'); // Klantdata verzamelen en meesturen diff --git a/upload/admin/language/en-gb/extension/payment/paynl3.php b/upload/admin/language/en-gb/extension/payment/paynl3.php index 9c4a1af..30e6232 100755 --- a/upload/admin/language/en-gb/extension/payment/paynl3.php +++ b/upload/admin/language/en-gb/extension/payment/paynl3.php @@ -52,7 +52,7 @@ $_['text_extension'] = 'PAY.'; -$version = '1.2.8'; +$version = '1.3.0'; $css = 'position: relative;top:0px;display: inline;left: 10px;'; $paynl_logo = 'PAY.' . '
Version: ' . $version . '
';; diff --git a/upload/admin/language/nl-nl/extension/payment/paynl3.php b/upload/admin/language/nl-nl/extension/payment/paynl3.php index 8c47de4..0652136 100755 --- a/upload/admin/language/nl-nl/extension/payment/paynl3.php +++ b/upload/admin/language/nl-nl/extension/payment/paynl3.php @@ -52,7 +52,7 @@ $_['text_extension'] = 'PAY.'; -$version = '1.2.8'; +$version = '1.3.0'; $css = 'position: relative;top:0px;display: inline;left: 10px;'; $paynl_logo = 'PAY.' . '
Version: ' . $version . '
';;