From 54e998b1d8f922caf98028a1fdcdb8e26cdd8bfe Mon Sep 17 00:00:00 2001 From: Anne Date: Tue, 20 Jul 2021 09:43:56 +0200 Subject: [PATCH 1/2] added testmode --- upload/Pay/Api/Start.php | 11 ++++++++++ upload/Pay/Controller/Admin.php | 6 +++++- upload/Pay/Controller/Payment.php | 1 + .../en-gb/extension/payment/paynl3.php | 3 +++ .../nl-nl/extension/payment/paynl3.php | 3 +++ .../template/extension/payment/paynl3.twig | 20 ++++++++++++++++++- 6 files changed, 42 insertions(+), 2 deletions(-) diff --git a/upload/Pay/Api/Start.php b/upload/Pay/Api/Start.php index 71cfcbf..93abe4e 100755 --- a/upload/Pay/Api/Start.php +++ b/upload/Pay/Api/Start.php @@ -24,6 +24,8 @@ class Pay_Api_Start extends Pay_Api { private $_object; private $_domainId; private $_transferData; + + private $_testmode; private $_products = array(); @@ -46,6 +48,11 @@ public function setObject($object){ public function setTransferData($transferData){ $this->_transferData = $transferData; } + + public function setTestmode($testmode){ + $this->_testmode = $testmode; + } + /** * Add a product to an order * Attention! This is purely an adminstrative option, the amount of the order is not modified. @@ -236,6 +243,10 @@ protected function _getPostData() { $data['transaction']['currency'] = $this->_currency; } + if (!empty($this->_testmode)){ + $data['testMode'] = $this->_testmode; + } + if (!empty($this->_paymentOptionSubId)) { diff --git a/upload/Pay/Controller/Admin.php b/upload/Pay/Controller/Admin.php index b53d771..c85e15f 100755 --- a/upload/Pay/Controller/Admin.php +++ b/upload/Pay/Controller/Admin.php @@ -42,7 +42,8 @@ public function index() if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) { $settingsGeneral = array( 'payment_paynl_general_apitoken' => $settings['payment_'.$this->_paymentMethodName.'_apitoken'], - 'payment_paynl_general_serviceid' => $settings['payment_'.$this->_paymentMethodName.'_serviceid'] + 'payment_paynl_general_serviceid' => $settings['payment_'.$this->_paymentMethodName.'_serviceid'], + 'payment_paynl_general_testmode' => $settings['payment_'.$this->_paymentMethodName.'_testmode'] ); $this->model_setting_setting->editSetting('payment_paynl_general', $settingsGeneral); @@ -65,6 +66,9 @@ public function index() if(!isset($data['serviceid']) || empty($data['serviceid'])){ $data['serviceid'] = $this->config->get('payment_paynl_general_serviceid'); } + if(!isset($data['testmode']) || empty($data['testmode'])){ + $data['testmode'] = $this->config->get('payment_paynl_general_testmode'); + } $data['text_edit'] = 'PAY. - ' . $this->_defaultLabel; diff --git a/upload/Pay/Controller/Payment.php b/upload/Pay/Controller/Payment.php index b1dc0fa..973a085 100755 --- a/upload/Pay/Controller/Payment.php +++ b/upload/Pay/Controller/Payment.php @@ -58,6 +58,7 @@ public function startTransaction() $apiStart = new Pay_Api_Start(); $apiStart->setApiToken($this->config->get('payment_' . $this->_paymentMethodName . '_apitoken')); $apiStart->setServiceId($this->config->get('payment_' . $this->_paymentMethodName . '_serviceid')); + $apiStart->setTestmode($this->config->get('payment_paynl_general_testmode')); $returnUrl = $this->url->link('extension/payment/' . $this->_paymentMethodName . '/finish'); $exchangeUrl = $this->url->link('extension/payment/' . $this->_paymentMethodName . '/exchange'); diff --git a/upload/admin/language/en-gb/extension/payment/paynl3.php b/upload/admin/language/en-gb/extension/payment/paynl3.php index f9e1187..7ee9361 100755 --- a/upload/admin/language/en-gb/extension/payment/paynl3.php +++ b/upload/admin/language/en-gb/extension/payment/paynl3.php @@ -23,6 +23,9 @@ $_['text_display_icon'] = 'Display icon'; $_['text_display_icon_tooltip'] = 'Select if you want to display an icon and the size'; +$_['text_testmode'] = 'Testmode'; +$_['text_testmode_tooltip'] = 'Enable or disable test mode to test the exchanges between PAY. and your webshop'; + $_['text_status_pending']='Order status pending payment'; $_['text_status_pending_tooltip']='The status of the order when the payment is started, but not yet completed'; $_['text_status_complete']='Order status payment successful'; diff --git a/upload/admin/language/nl-nl/extension/payment/paynl3.php b/upload/admin/language/nl-nl/extension/payment/paynl3.php index 1924c07..4e352ae 100755 --- a/upload/admin/language/nl-nl/extension/payment/paynl3.php +++ b/upload/admin/language/nl-nl/extension/payment/paynl3.php @@ -23,6 +23,9 @@ $_['text_display_icon'] = 'Icoon weergeven'; $_['text_display_icon_tooltip'] = 'Selecteer hier of je een icoon wilt weergeven en welke grootte.'; +$_['text_testmode'] = 'Testmode'; +$_['text_testmode_tooltip'] = 'Zet de testmode aan of uit om de exchanges te testen tussen PAY. en uw webshop'; + $_['text_status_pending']='Order status wacht op betaling'; $_['text_status_pending_tooltip']='De status van de order wanneer de betaling is gestart, maar nog niet afgerond'; $_['text_status_complete']='Order status betaling voltooid'; diff --git a/upload/admin/view/template/extension/payment/paynl3.twig b/upload/admin/view/template/extension/payment/paynl3.twig index 8c463ab..d3d756c 100755 --- a/upload/admin/view/template/extension/payment/paynl3.twig +++ b/upload/admin/view/template/extension/payment/paynl3.twig @@ -66,7 +66,25 @@ {% endif %} - +
+ +
+ +
+