From dddf14b541e79f2d64d0243b3ffa2fd67bdf4359 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Wed, 4 Jan 2017 14:32:36 +0100 Subject: [PATCH 1/3] #4 add compatibility with 1.7 - DOESN'T WORK WITH PRESTASHOP VERSIONS 1.6 AND BELOW --- wirecardceecheckoutpage/config.xml | 2 +- .../controllers/front/paymentIFrame.php | 3 +- wirecardceecheckoutpage/css/style.css | 141 ++-------- .../views/templates/front/payment_iframe.tpl | 20 +- .../views/templates/hook/payment.tpl | 54 ---- .../views/templates/hook/payment1.5.tpl | 48 ---- .../wirecardceecheckoutpage.php | 259 +++++++++++++----- 7 files changed, 232 insertions(+), 295 deletions(-) delete mode 100644 wirecardceecheckoutpage/views/templates/hook/payment.tpl delete mode 100644 wirecardceecheckoutpage/views/templates/hook/payment1.5.tpl diff --git a/wirecardceecheckoutpage/config.xml b/wirecardceecheckoutpage/config.xml index d86ced9..9873a11 100644 --- a/wirecardceecheckoutpage/config.xml +++ b/wirecardceecheckoutpage/config.xml @@ -2,7 +2,7 @@ wirecardceecheckoutpage - + diff --git a/wirecardceecheckoutpage/controllers/front/paymentIFrame.php b/wirecardceecheckoutpage/controllers/front/paymentIFrame.php index 19d04b4..3cf3fc5 100644 --- a/wirecardceecheckoutpage/controllers/front/paymentIFrame.php +++ b/wirecardceecheckoutpage/controllers/front/paymentIFrame.php @@ -51,8 +51,7 @@ public function initContent() 'windowName' => $this->module->getWindowName() )); + $this->setTemplate('module:wirecardceecheckoutpage/views/templates/front/payment_iframe.tpl'); unset($this->context->cookie->qpayRedirectUrl); - - $this->setTemplate('payment_iframe.tpl'); } } diff --git a/wirecardceecheckoutpage/css/style.css b/wirecardceecheckoutpage/css/style.css index 63c0976..cfcf40f 100644 --- a/wirecardceecheckoutpage/css/style.css +++ b/wirecardceecheckoutpage/css/style.css @@ -1,3 +1,30 @@ +.payment-option.clearfix { + position:relative; + padding-bottom:7px; + border-bottom:1px dotted #d3d3d3; +} + +.payment-option label { + position:absolute; + display: block !important; + top:0; + left:40px; + right:0; + bottom:-8px; +} + +.payment-option label span { + float: left; +} + +.payment-option label img { + float: right; + height: 20px; +} + +#payment_form .alert span { + clear:both; +} p.payment_module a.pt_wirecard:after { display: block; @@ -11,116 +38,4 @@ p.payment_module a.pt_wirecard:after { height: 22px; width: 14px; color: #777; -} - -a.pt_checkoutpage { - background: url(../img/payment_types/checkoutpage.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_ccard { - background: url(../img/payment_types/ccard.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_ccard-moto { - background: url(../img/payment_types/ccard-moto.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_maestro { - background: url(../img/payment_types/maestro.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_eps { - background: url(../img/payment_types/eps.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_idl { - background: url(../img/payment_types/idl.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_giropay { - background: url(../img/payment_types/giropay.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_tatrapay { - background: url(../img/payment_types/tatrapay.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_sofortueberweisung { - background: url(../img/payment_types/sofortueberweisung.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_pbx { - background: url(../img/payment_types/pbx.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_psc { - background: url(../img/payment_types/psc.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_quick { - background: url(../img/payment_types/quick.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_paypal { - background: url(../img/payment_types/paypal.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_epay_bg { - background: url(../img/payment_types/epay-bg.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_sepa-dd { - background: url(../img/payment_types/sepa-dd.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_trustpay { - background: url(../img/payment_types/trustpay.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_invoice { - background: url(../img/payment_types/invoice.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_installment { - background: url(../img/payment_types/installment.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_bancontact_mistercash { - background: url(../img/payment_types/bancontact_mistercash.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_przelewy24 { - background: url(../img/payment_types/przelewy24.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_moneta { - background: url(../img/payment_types/moneta.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_poli { - background: url(../img/payment_types/poli.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_ekonto { - background: url(../img/payment_types/ekonto.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_trustly { - background: url(../img/payment_types/trustly.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_mpass { - background: url(../img/payment_types/mpass.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_skrilldirect { - background: url(../img/payment_types/skrilldirect.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_skrillwallet { - background: url(../img/payment_types/skrillwallet.png) 15px 15px no-repeat #fbfbfb; -} - -a.pt_voucher { - background: url(../img/payment_types/voucher.png) 15px 15px no-repeat #fbfbfb; -} +} \ No newline at end of file diff --git a/wirecardceecheckoutpage/views/templates/front/payment_iframe.tpl b/wirecardceecheckoutpage/views/templates/front/payment_iframe.tpl index 31d0ce0..8e1e98a 100644 --- a/wirecardceecheckoutpage/views/templates/front/payment_iframe.tpl +++ b/wirecardceecheckoutpage/views/templates/front/payment_iframe.tpl @@ -28,8 +28,20 @@ * By installing the plugin into the shop system the customer agrees to these terms of use. * Please do not use the plugin if you do not agree to these terms of use! *} +{extends file='page.tpl'} +{block name='content'} +
+
+
+
-{capture name=path} - {l s='Pay with Wirecard Checkout Page' mod='wirecardceecheckoutpage'} -{/capture} - \ No newline at end of file + {if isset($nbProducts) && $nbProducts <= 0} +

{l s='Your shopping cart is empty.' mod='wirecardceecheckoutseamless'}

+ {else} + + {/if} +
+
+
+
+{/block} \ No newline at end of file diff --git a/wirecardceecheckoutpage/views/templates/hook/payment.tpl b/wirecardceecheckoutpage/views/templates/hook/payment.tpl deleted file mode 100644 index 44fcc73..0000000 --- a/wirecardceecheckoutpage/views/templates/hook/payment.tpl +++ /dev/null @@ -1,54 +0,0 @@ -{* - * Shop System Plugins - Terms of Use - * - * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of - * products and services. - * - * They have been tested and approved for full functionality in the standard configuration - * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under - * the same terms. - * - * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors - * occurring when used in an enhanced, customized shop system configuration. - * - * Operation in an enhanced, customized configuration is at your own risk and requires a - * comprehensive test phase by the user of the plugin. - * - * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full - * functionality neither does Wirecard CEE assume liability for any disadvantages related to - * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality - * for customized shop systems or installed plugins of other vendors of plugins within the same - * shop system. - * - * Customers are responsible for testing the plugin's functionality before starting productive - * operation. - * - * By installing the plugin into the shop system the customer agrees to these terms of use. - * Please do not use the plugin if you do not agree to these terms of use! - *} - -{if $paymentTypes|@count gt 0} -{foreach from=$paymentTypes item=current} - -{/foreach} -{else} - -{/if} diff --git a/wirecardceecheckoutpage/views/templates/hook/payment1.5.tpl b/wirecardceecheckoutpage/views/templates/hook/payment1.5.tpl deleted file mode 100644 index a5ff856..0000000 --- a/wirecardceecheckoutpage/views/templates/hook/payment1.5.tpl +++ /dev/null @@ -1,48 +0,0 @@ -{* - * Shop System Plugins - Terms of Use - * - * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of - * products and services. - * - * They have been tested and approved for full functionality in the standard configuration - * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under - * the same terms. - * - * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors - * occurring when used in an enhanced, customized shop system configuration. - * - * Operation in an enhanced, customized configuration is at your own risk and requires a - * comprehensive test phase by the user of the plugin. - * - * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full - * functionality neither does Wirecard CEE assume liability for any disadvantages related to - * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality - * for customized shop systems or installed plugins of other vendors of plugins within the same - * shop system. - * - * Customers are responsible for testing the plugin's functionality before starting productive - * operation. - * - * By installing the plugin into the shop system the customer agrees to these terms of use. - * Please do not use the plugin if you do not agree to these terms of use! - *} - -{if $paymentTypes|@count gt 0} -{foreach from=$paymentTypes item=current} -

- - {$current.title} - {$current.title} - -

-{/foreach} -{else} -

- - {l s='Pay with Wirecard CEE Checkout Page' mod='wirecardceecheckoutpage'} - {l s='Pay with Wirecard CEE Checkout Page' mod='wirecardceecheckoutpage'} - -

-{/if} diff --git a/wirecardceecheckoutpage/wirecardceecheckoutpage.php b/wirecardceecheckoutpage/wirecardceecheckoutpage.php index c9da2b9..b5ade36 100644 --- a/wirecardceecheckoutpage/wirecardceecheckoutpage.php +++ b/wirecardceecheckoutpage/wirecardceecheckoutpage.php @@ -30,6 +30,8 @@ * Please do not use the plugin if you do not agree to these terms of use! */ +use PrestaShop\PrestaShop\Core\Payment\PaymentOption; + if (!defined('_PS_VERSION_')) { exit; } @@ -108,6 +110,7 @@ class WirecardCEECheckoutPage extends PaymentModule private $myOrder; private $myCart; private $postErrors = array(); + private $config = array(); public function log($text) { @@ -120,9 +123,10 @@ public function log($text) public function __construct() { + $this->config = $this->config(); $this->name = 'wirecardceecheckoutpage'; $this->tab = 'payments_gateways'; - $this->version = '1.5.0'; + $this->version = '2.0.0'; $this->author = 'Wirecard'; $this->controllers = array('breakoutIFrame', 'confirm', 'payment', 'paymentExecution', 'paymentIFrame'); $this->is_eu_compatible = 1; @@ -141,9 +145,9 @@ public function __construct() public function install() { if (!parent::install() - || !$this->registerHook('payment') - || !$this->registerHook('displayPaymentEU') + || !$this->registerHook('paymentOptions') || !$this->registerHook('paymentReturn') + || !$this->registerHook('actionFrontControllerSetMedia') || !Configuration::updateValue(self::WCP_CONFIGURATION_MODE, self::WCP_CONFIGURATION_MODE_DEFAULT) || !Configuration::updateValue(self::WCP_CUSTOMER_ID, self::WCP_CUSTOMER_ID_DEMO) || !Configuration::updateValue(self::WCP_SHOP_ID, self::WCP_SHOP_ID_DEMO) @@ -195,6 +199,21 @@ public function install() return true; } + public function hookActionFrontControllerSetMedia($params){ + + $controllerArray = array('order'); + if (in_array($this->context->controller->php_self, $controllerArray)) { + $this->context->controller->registerStylesheet( + 'module-' . $this->name . '-style', + 'modules/' . $this->name . '/css/style.css', + [ + 'media' => 'all', + 'priority' => 200, + ] + ); + } + } + private function installPaymentTypes() { $result = true; @@ -274,12 +293,9 @@ public function getContent() return $this->html; } - private function renderForm() + private function config() { - $radio_type = 'radio'; - if ($this->getMinorPrestaVersion() > 5) { - $radio_type = 'switch'; - } + $radio_type = 'onoff'; $radio_options = array( array( 'id' => 'active_on', @@ -294,21 +310,15 @@ private function renderForm() ); $fields_form_settings = array( - 'form' => array( - 'legend' => array( - 'title' => $this->l('Settings'), - 'icon' => 'icon-cogs' - ), - 'input' => array( + 'settings' => array( + 'tab' => $this->l('Settings'), + 'fields' => array( array( 'type' => 'select', 'label' => $this->l('Configuration'), + 'default' => 'production', 'name' => self::WCP_CONFIGURATION_MODE, - 'options' => array( - 'query' => $this->getConfigurationModes(), - 'id' => 'key', - 'name' => 'value' - ) + 'options' => 'getConfigurationModes' ), array( 'type' => 'text', @@ -316,6 +326,7 @@ private function renderForm() 'name' => self::WCP_CUSTOMER_ID, 'required' => true, 'class' => 'fixed-width-xl', + 'maxchar' => 7, 'desc' => $this->l('Customer number you received from Wirecard (customerId, i.e. D2#####).').' '.$this->l('More information').' ', ), array( @@ -323,6 +334,7 @@ private function renderForm() 'label' => $this->l('Shop ID'), 'name' => self::WCP_SHOP_ID, 'class' => 'fixed-width-xl', + 'maxchar' => 16, 'desc' => $this->l('Shop identifier in case of more than one shop.').' '.$this->l('More information').' ' ), array( @@ -414,9 +426,6 @@ private function renderForm() 'class' => 't', 'values' => $radio_options ) - ), - 'submit' => array( - 'title' => $this->l('Save') ) ), ); @@ -435,36 +444,175 @@ private function renderForm() } $fields_form_payment = array( + 'paymentmethods' => array( + 'tab' => $this->l('Payment methods'), + 'fields' => $paymentTypeSwitches + ), + ); + + $settings = array_merge($fields_form_settings,$fields_form_payment); + + return $settings; + } + + private function renderForm() + { + $radio_type = 'switch'; + + $radio_options = array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ) + ); + + $input_fields = array(); + $tabs = array(); + foreach ($this->config as $groupKey => $group) { + $tabs[$groupKey] = $this->l($group['tab']); + foreach ($group['fields'] as $f) { + $configGroup = isset($f['group']) ? $f['group'] : $groupKey; + if (isset($f['class'])) { + $configGroup = 'pt'; + } + + $elem = array( + 'name' => $f['name'], + 'label' => $this->l($f['label']), + 'tab' => $groupKey, + 'type' => $f['type'], + 'required' => isset($f['required']) && $f['required'] + ); + + if (isset($f['cssclass'])) { + $elem['class'] = $f['cssclass']; + } + + if (isset($f['doc'])) { + if (is_array($f['doc'])) { + $elem['desc'] = ''; + foreach ($f['doc'] as $d) { + if (Tools::strlen($elem['desc'])) { + $elem['desc'] .= '
'; + } + + $elem['desc'] .= $d; + } + } else { + $elem['desc'] = $this->l($f['doc']); + } + } + + if (isset($f['docref'])) { + $elem['desc'] = isset($elem['desc']) ? $elem['desc'] . ' ' : ''; + $elem['desc'] .= sprintf( + '%s ', + $f['docref'], + $this->l('More information') + ); + } + + switch ($f['type']) { + case 'text': + if (!isset($elem['class'])) { + $elem['class'] = 'fixed-width-xl'; + } + + if (isset($f['maxchar'])) { + $elem['maxlength'] = $elem['maxchar'] = $f['maxchar']; + } + break; + + case 'onoff': + $elem['type'] = $radio_type; + $elem['class'] = 't'; + $elem['is_bool'] = true; + $elem['values'] = $radio_options; + break; + + case 'select': + if (isset($f['multiple'])) { + $elem['multiple'] = $f['multiple']; + } + + if (isset($f['size'])) { + $elem['size'] = $f['size']; + } + + if (isset($f['options'])) { + $optfunc = $f['options']; + $options = array(); + if (is_array($optfunc)) { + $options = $optfunc; + } + + if (method_exists($this, $optfunc)) { + $options = $this->$optfunc(); + } + + $elem['options'] = array( + 'query' => $options, + 'id' => 'key', + 'name' => 'value' + ); + } + break; + + default: + break; + } + + $input_fields[] = $elem; + } + } + + $fields_form_settings = array( 'form' => array( + 'tabs' => $tabs, 'legend' => array( - 'title' => $this->l('Payment methods'), - 'icon' => 'icon-list' + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs' ), - 'input' => $paymentTypeSwitches, + 'input' => $input_fields, 'submit' => array( 'title' => $this->l('Save') ) ), ); + + /** @var HelperFormCore $helper */ $helper = new HelperForm(); $helper->show_toolbar = false; + /** @var LanguageCore $lang */ $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; - $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get( + 'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' + ) : 0; $helper->id = (int)Tools::getValue('id_carrier'); $helper->identifier = $this->identifier; $helper->submit_action = 'btnSubmit'; - $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) + . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), - 'id_language' => $this->context->language->id + 'id_language' => $this->context->language->id, + 'ajax_configtest_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=' . $this->name + . '&tab_module=' . $this->tab . '&module_name=' . $this->name ); - return $helper->generateForm(array($fields_form_settings, $fields_form_payment)); + return $helper->generateForm(array($fields_form_settings)); } private function getTransactionIdOptions() @@ -484,59 +632,24 @@ public function getConfigFieldsValues() return $values; } - public function hookPayment($params) + public function hookPaymentOptions($params) { if (!$this->active) { return; } + $result = array(); + unset($this->context->cookie->qpayRedirectUrl); $paymentTypes = $this->getEnabledPaymentTypes($params['cart']); - $this->smarty->assign(array( - 'paymentTypes' => $paymentTypes, - 'this_path' => $this->_path - )); - - if ($this->getMinorPrestaVersion() > 5) { - $this->context->controller->addCSS($this->_path . 'css/style.css', 'all'); - return $this->display(__FILE__, 'payment.tpl'); - } else { - return $this->display(__FILE__, 'payment1.5.tpl'); - } - } + foreach ($paymentTypes as $paymentType) { + $payment = new PaymentOption(); + $payment->setLogo(Media::getMediaPath(dirname(__FILE__) . '/img/payment_types/' . strtolower($paymentType['value']) . '.png')) + ->setCallToActionText($this->l('Pay using') . ' ' . $this->l($paymentType['title'])) + ->setAction($this->context->link->getModuleLink($this->name, 'payment', array('paymentType' => $paymentType['value']), true)); - public function hookDisplayPaymentEU($params) - { - $this->log("hookDisplayPaymentEU"); - if (!$this->active) { - return; - } - - unset($this->context->cookie->qpayRedirectUrl); - - $paymentTypes = $this->getEnabledPaymentTypes($params['cart']); - $result = array(); - if (count($paymentTypes)) { - foreach ($paymentTypes as $paymentType) { - array_push( - $result, - array( - 'cta_text' => $this->l('Pay using') . ' ' . $paymentType['title'], - 'logo' => Media::getMediaPath(dirname(__FILE__) . '/img/payment_types/' . strtolower($paymentType['value']) . '.png'), - 'action' => $this->context->link->getModuleLink($this->name, 'payment', array('paymentType' => $paymentType['value']), true) - ) - ); - } - } else { - array_push( - $result, - array( - 'cta_text' => $this->l('Pay with Wirecard Checkout Page'), - 'logo' => Media::getMediaPath(dirname(__FILE__) . '/img/payment_types/checkoutpage.png'), - 'action' => $this->context->link->getModuleLink($this->name, 'payment', array('paymentType' => 'SELECT'), true) - ) - ); + $result[] = $payment; } return count($result) ? $result : false; From cd291084fbcaee905865066331ff4a72b885e418 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Thu, 5 Jan 2017 10:50:36 +0100 Subject: [PATCH 2/3] #5 enable transaction id select options --- wirecardceecheckoutpage/wirecardceecheckoutpage.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/wirecardceecheckoutpage/wirecardceecheckoutpage.php b/wirecardceecheckoutpage/wirecardceecheckoutpage.php index b5ade36..2ce8b75 100644 --- a/wirecardceecheckoutpage/wirecardceecheckoutpage.php +++ b/wirecardceecheckoutpage/wirecardceecheckoutpage.php @@ -393,11 +393,7 @@ private function config() 'type' => 'select', 'label' => $this->l('Transaction ID'), 'name' => self::WCP_TRANSACTION_ID, - 'options' => array( - 'query' => $this->getTransactionIdOptions(), - 'id' => 'key', - 'name' => 'value' - ), + 'options' => 'getTransactionIdOptions', 'desc' => $this->l('Wirecard order number: Unique number defined by Wirecard identifying the payment.') . '
' . $this->l('Gateway reference number: Reference number defined by the processor or acquirer.') ), array( From 6a2d8c4b1a42aa748b7417c6ea53f0f35db63334 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Mon, 9 Jan 2017 11:56:26 +0100 Subject: [PATCH 3/3] #5 redirect to order with full basket after cancel + update readme --- README.md | 5 +- .../controllers/front/paymentExecution.php | 62 ----------------- .../templates/front/payment_execution.tpl | 66 ------------------- .../templates/front/payment_execution1.5.tpl | 58 ---------------- .../wirecardceecheckoutpage.php | 28 +++++--- 5 files changed, 21 insertions(+), 198 deletions(-) delete mode 100644 wirecardceecheckoutpage/controllers/front/paymentExecution.php delete mode 100644 wirecardceecheckoutpage/views/templates/front/payment_execution.tpl delete mode 100644 wirecardceecheckoutpage/views/templates/front/payment_execution1.5.tpl diff --git a/README.md b/README.md index dda4004..202ef37 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # Wirecard Checkout Page plugin for PrestaShop [![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/prestashop-wcp/master/LICENSE) -[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.5.6.2-green.svg)](https://www.prestashop.com/) -[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.6.1.2-green.svg)](https://www.prestashop.com/) -[![PHP v5.3](https://img.shields.io/badge/php-v5.3-yellow.svg)](http://www.php.net) +[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.7.0.3-green.svg)](https://www.prestashop.com/) +[![PHP v5.6](https://img.shields.io/badge/php-v5.3-yellow.svg)](http://www.php.net) Wirecard Checkout Page plugin for PrestaShop. diff --git a/wirecardceecheckoutpage/controllers/front/paymentExecution.php b/wirecardceecheckoutpage/controllers/front/paymentExecution.php deleted file mode 100644 index 5736dbb..0000000 --- a/wirecardceecheckoutpage/controllers/front/paymentExecution.php +++ /dev/null @@ -1,62 +0,0 @@ -ssl = true; - $this->display_column_left = false; - parent::initContent(); - - $cart = $this->context->cart; - - $this->context->smarty->assign(array( - 'nbProducts' => $cart->nbProducts(), - 'total' => $cart->getOrderTotal(true, Cart::BOTH), - 'paymentName' => Tools::getValue('paymentName'), - 'paymentType' => Tools::getValue('paymentType') - )); - - if ($this->module->getMinorPrestaVersion() > 5) { - $this->setTemplate('payment_execution.tpl'); - } else { - $this->setTemplate('payment_execution1.5.tpl'); - } - } -} diff --git a/wirecardceecheckoutpage/views/templates/front/payment_execution.tpl b/wirecardceecheckoutpage/views/templates/front/payment_execution.tpl deleted file mode 100644 index f8c5e83..0000000 --- a/wirecardceecheckoutpage/views/templates/front/payment_execution.tpl +++ /dev/null @@ -1,66 +0,0 @@ -{* - * Shop System Plugins - Terms of Use - * - * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of - * products and services. - * - * They have been tested and approved for full functionality in the standard configuration - * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under - * the same terms. - * - * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors - * occurring when used in an enhanced, customized shop system configuration. - * - * Operation in an enhanced, customized configuration is at your own risk and requires a - * comprehensive test phase by the user of the plugin. - * - * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full - * functionality neither does Wirecard CEE assume liability for any disadvantages related to - * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality - * for customized shop systems or installed plugins of other vendors of plugins within the same - * shop system. - * - * Customers are responsible for testing the plugin's functionality before starting productive - * operation. - * - * By installing the plugin into the shop system the customer agrees to these terms of use. - * Please do not use the plugin if you do not agree to these terms of use! - *} -{capture name=path} - {l s='Checkout' mod='wirecardceecheckoutpage'}{$navigationPipe}{l s='Wirecard Checkout Page' mod='wirecardceecheckoutpage'} -{/capture} - -

{l s='Order summary' mod='wirecardceecheckoutpage'}

- -{assign var='current_step' value='payment'} -{include file="$tpl_dir./order-steps.tpl"} - -{if isset($nbProducts) && $nbProducts <= 0} -

{l s='Your shopping cart is empty.' mod='wirecardceecheckoutpage'}

-{else} -
-
-

{l s='Wirecard Checkout Page payment' mod='wirecardceecheckoutpage'}

-

- - {l s='You have chosen to pay with ' mod='wirecardceecheckoutpage'}{$paymentName}. - -

-

- - {l s='Total amount of your order:' mod='wirecardceecheckoutpage'} - {displayPrice price=$total} -

-

- {l s='Please confirm your order by clicking "I confirm my order".' mod='wirecardceecheckoutpage'}

-
-

- - {l s='Other payment methods' mod='wirecardceecheckoutpage'} - - -

-
-{/if} diff --git a/wirecardceecheckoutpage/views/templates/front/payment_execution1.5.tpl b/wirecardceecheckoutpage/views/templates/front/payment_execution1.5.tpl deleted file mode 100644 index 2a55c08..0000000 --- a/wirecardceecheckoutpage/views/templates/front/payment_execution1.5.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{* - * Shop System Plugins - Terms of Use - * - * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of - * products and services. - * - * They have been tested and approved for full functionality in the standard configuration - * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under - * the same terms. - * - * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors - * occurring when used in an enhanced, customized shop system configuration. - * - * Operation in an enhanced, customized configuration is at your own risk and requires a - * comprehensive test phase by the user of the plugin. - * - * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full - * functionality neither does Wirecard CEE assume liability for any disadvantages related to - * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality - * for customized shop systems or installed plugins of other vendors of plugins within the same - * shop system. - * - * Customers are responsible for testing the plugin's functionality before starting productive - * operation. - * - * By installing the plugin into the shop system the customer agrees to these terms of use. - * Please do not use the plugin if you do not agree to these terms of use! - *} - -{capture name=path}{l s='Wirecard Checkout Page' mod='wirecardceecheckoutpage'}{/capture} -{include file="$tpl_dir./breadcrumb.tpl"} - -

{l s='Order summary' mod='wirecardceecheckoutpage'}

- -{assign var='current_step' value='payment'} -{include file="$tpl_dir./order-steps.tpl"} - -{if isset($nbProducts) && $nbProducts <= 0} -

{l s='Your shopping cart is empty.' mod='wirecardceecheckoutpage'}

-{else} -

{l s='Wirecard Checkout Page payment' mod='wirecardceecheckoutpage'}

-
-

- {l s='You have chosen to pay with ' mod='wirecardceecheckoutpage'}{$paymentName}. -

-

- - {l s='Total amount of your order:' mod='wirecardceecheckoutpage'} - {displayPrice price=$total} -

-

- {l s='Please confirm your order by clicking "I confirm my order".' mod='wirecardceecheckoutpage'}

-

- - {l s='Other payment methods' mod='wirecardceecheckoutpage'} -

-
-{/if} \ No newline at end of file diff --git a/wirecardceecheckoutpage/wirecardceecheckoutpage.php b/wirecardceecheckoutpage/wirecardceecheckoutpage.php index 2ce8b75..f3c7035 100644 --- a/wirecardceecheckoutpage/wirecardceecheckoutpage.php +++ b/wirecardceecheckoutpage/wirecardceecheckoutpage.php @@ -128,7 +128,7 @@ public function __construct() $this->tab = 'payments_gateways'; $this->version = '2.0.0'; $this->author = 'Wirecard'; - $this->controllers = array('breakoutIFrame', 'confirm', 'payment', 'paymentExecution', 'paymentIFrame'); + $this->controllers = array('breakoutIFrame', 'confirm', 'payment', 'paymentIFrame'); $this->is_eu_compatible = 1; $this->currencies = true; @@ -677,15 +677,25 @@ public function hookDisplayPaymentReturn($params) return $this->display(__FILE__, 'pending.tpl'); } - $params = array( - 'submitReorder' => true, - 'id_order' => (int)$params['objOrder']->id - ); - - if (Configuration::get('PS_ORDER_PROCESS_TYPE')) { - Tools::redirect($this->context->link->getPageLink('order-opc', true, $this->getOrder()->id_lang, $params)); + // rebuild cart + $oldCart = new Cart((int)$params["order"]->id_cart); + $duplication = $oldCart->duplicate(); + if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) { + $this->errors[] = Tools::displayError('Sorry. We cannot renew your order.'); + } elseif (!$duplication['success']) { + $this->errors[] = Tools::displayError('Some items are no longer available, and we are unable to renew your order.'); + } else { + $this->context->cookie->id_cart = $duplication['cart']->id; + $context = $this->context; + $context->cart = $duplication['cart']; + CartRule::autoAddToCart($context); + $this->context->cookie->write(); + + if (Configuration::get('PS_ORDER_PROCESS_TYPE')) { + Tools::redirect($this->context->link->getPageLink('order-opc', true, $this->getOrder()->id_lang, null)); + } + Tools::redirect($this->context->link->getPageLink('order', true, $this->getOrder()->id_lang, null)); } - Tools::redirect($this->context->link->getPageLink('order', true, $this->getOrder()->id_lang, $params)); } public function hookDisplayPDFInvoice($params)