From b8a0c1e7971bd8bf5ed6948e4e3b787c67c91026 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 6 Nov 2018 15:24:09 +0100 Subject: [PATCH] Added transaction description prefix --- paynlpaymentmethods/nl.php | 8 +++++++- paynlpaymentmethods/paynlpaymentmethods.php | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/paynlpaymentmethods/nl.php b/paynlpaymentmethods/nl.php index fbbb2a5..de82ab6 100644 --- a/paynlpaymentmethods/nl.php +++ b/paynlpaymentmethods/nl.php @@ -6,7 +6,7 @@ $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_464911b85907011709769c8123b32437'] = 'Voeg vele betaalmethoden toe aan uw webshop'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_a02758d758e8bec77a33d7f392eb3f8a'] = 'Er is voor deze module geen valuta ingesteld'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_020c2091aec3019d02193cef080bcf97'] = 'Betaalmethode toeslag'; -$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_c888438d14855d7d96a2724ee9c306bd'] = 'Instellingen opgeslagen'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_9f06b28a40790c4c4df5739bce3c1eb0'] = 'Verzendkosten'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_68bf367e228f45ba83cb8831a5ee6447'] = 'Nederlands'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_78463a384a5aa4fad5fa73e2f506ecfc'] = 'Engels'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_cb5480c32e71778852b08ae1e8712775'] = 'Spaans'; @@ -14,11 +14,17 @@ $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_ad225f707802ba118c22987186dd38e8'] = 'Frans'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_86bc3115eb4e9873ac96904a4a68e19e'] = 'Duits'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_086247a9b57fde6eefee2a0c4752242d'] = 'Automatisch'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_1fc245c1ed6edf855733678e8da9cf6b'] = 'KAn de Pay.nl SDK niet vinden, heb je de source geinstalleerd in plaats van het pakketbestand?'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_d262bca42a884db060f5a6667b21205d'] = 'APItoken is verplicht'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_eca1973b20e3b246847fd7f1648c2599'] = 'ServiceId is verplicht'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_c888438d14855d7d96a2724ee9c306bd'] = 'Instellingen opgeslagen'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_cf36c09602888e0a3ea8b0e160e40ad7'] = 'Pay.nl account gegevens'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_0a0d3d18ca5a07d08e62a1c962f91946'] = 'APItoken'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_04542edeb8b2c5b3922716ca8ddd0032'] = 'Je kunt je APItoken vinden onderaan op https://admin.pay.nl/my_merchant'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_b1b404a85c213977a7cabb82b730639c'] = 'ServiceId'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_7a78c463c901a677dc7c205fb2542f9d'] = 'De SL-code van je dienst op https://admin.pay.nl/programs/programs'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_adc1e83ea8057c3b182f292b223612da'] = 'Transactieomschrijving voorvoegsel'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_2ab45b27dbaf728ece860448598238ae'] = 'Een tekst die voor de transactieomschrijving wordt gezet'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_4245499695408b974322be6f01b0d17a'] = 'Test modus'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_61142607f22ea506073bcb1c1c74133e'] = 'Start de transacties in sandbox modus om te testen'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Ingeschakeld'; diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index 33e71bb..eb18e5d 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -51,7 +51,7 @@ public function __construct() { $this->name = 'paynlpaymentmethods'; $this->tab = 'payments_gateways'; - $this->version = '4.2.1'; + $this->version = '4.2.2'; $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); $this->author = 'Pay.nl'; $this->controllers = array('startPayment', 'finish', 'exchange'); @@ -462,13 +462,19 @@ public function startPayment(Cart $cart, $payment_option_id, $extra_data = array $products = $this->_getProductData($cart); + $description = $cart->id; + + if(Configuration::get('PAYNL_DESCRIPTION_PREFIX')){ + $description = Configuration::get('PAYNL_DESCRIPTION_PREFIX').$description; + } + $startData = array( 'amount' => $cart->getOrderTotal(true, Cart::BOTH, null, null, false), 'currency' => $currency->iso_code, 'returnUrl' => $this->context->link->getModuleLink($this->name, 'finish', array(), true), 'exchangeUrl' => $this->context->link->getModuleLink($this->name, 'exchange', array(), true), 'paymentMethod' => $payment_option_id, - 'description' => $cart->id, + 'description' => $description, 'testmode' => Configuration::get('PAYNL_TEST_MODE'), 'extra1' => $cart->id, 'language' => Language::getIsoById($cart->id_lang), @@ -831,6 +837,7 @@ protected function _postProcess() Configuration::updateValue('PAYNL_API_TOKEN', Tools::getValue('PAYNL_API_TOKEN')); Configuration::updateValue('PAYNL_SERVICE_ID', Tools::getValue('PAYNL_SERVICE_ID')); Configuration::updateValue('PAYNL_TEST_MODE', Tools::getValue('PAYNL_TEST_MODE')); + Configuration::updateValue('PAYNL_DESCRIPTION_PREFIX', Tools::getValue('PAYNL_DESCRIPTION_PREFIX')); Configuration::updateValue('PAYNL_PAYMENTMETHODS', Tools::getValue('PAYNL_PAYMENTMETHODS')); Configuration::updateValue('PAYNL_LANGUAGE', Tools::getValue('PAYNL_LANGUAGE')); } @@ -860,6 +867,13 @@ public function renderAccountSettingsForm() 'desc' => $this->l('The SL-code of your service on https://admin.pay.nl/programs/programs'), 'required' => true ), + array( + 'type' => 'text', + 'label' => $this->l('Transaction description prefix'), + 'name' => 'PAYNL_DESCRIPTION_PREFIX', + 'desc' => $this->l('A prefix added to the transaction description'), + 'required' => false + ), array( 'type' => 'switch', 'label' => $this->l('Test mode'), @@ -938,6 +952,7 @@ public function getConfigFieldsValues() 'PAYNL_API_TOKEN' => Tools::getValue('PAYNL_API_TOKEN', Configuration::get('PAYNL_API_TOKEN')), 'PAYNL_SERVICE_ID' => Tools::getValue('PAYNL_SERVICE_ID', Configuration::get('PAYNL_SERVICE_ID')), 'PAYNL_TEST_MODE' => Tools::getValue('PAYNL_TEST_MODE', Configuration::get('PAYNL_TEST_MODE')), + 'PAYNL_DESCRIPTION_PREFIX' => Tools::getValue('PAYNL_DESCRIPTION_PREFIX', Configuration::get('PAYNL_DESCRIPTION_PREFIX')), 'PAYNL_LANGUAGE' => Tools::getValue('PAYNL_LANGUAGE', Configuration::get('PAYNL_LANGUAGE')), 'PAYNL_PAYMENTMETHODS' => $paymentMethods