diff --git a/README.md b/README.md index 8f0a0af..2cc62c4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Wirecard Checkout Seamless plugin for Gambio GX3 [![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/gambio-wcs/master/LICENSE) -[![Gambio GX3](https://img.shields.io/badge/Gambio_GX3-v3.10.0.1-green.svg)](https://www.gambio.de/) +[![Gambio GX3](https://img.shields.io/badge/Gambio_GX3-v3.12.0.3-green.svg)](https://www.gambio.de/) [![PHP v5.6](https://img.shields.io/badge/php-v5.6-yellow.svg)](http://www.php.net) [![PHP v7.0](https://img.shields.io/badge/php-v7.0-yellow.svg)](http://www.php.net) [![PHP v7.1](https://img.shields.io/badge/php-v7.1-yellow.svg)](http://www.php.net) +[![PHP v7.2](https://img.shields.io/badge/php-v7.2-yellow.svg)](http://www.php.net) Wirecard Checkout Seamless plugin for Gambio GX3. diff --git a/callback/wirecard/checkout_seamless_confirm.php b/callback/wirecard/checkout_seamless_confirm.php index 8ed8bea..7b1a668 100644 --- a/callback/wirecard/checkout_seamless_confirm.php +++ b/callback/wirecard/checkout_seamless_confirm.php @@ -23,7 +23,11 @@ */ chdir('../../'); + +require_once('includes/modules/payment/wcs_top.php'); +wcs_preserve_postparams(); require_once('includes/application_top.php'); +wcs_preserve_postparams(true); require_once DIR_FS_DOCUMENT_ROOT . 'includes/classes/WirecardCheckoutSeamless.php'; $seamless = new GMWirecardCheckoutSeamless_ORIGIN(); diff --git a/checkout_wirecard_checkout_seamless.php b/checkout_wirecard_checkout_seamless.php index 2b15cb5..a89a9f0 100644 --- a/checkout_wirecard_checkout_seamless.php +++ b/checkout_wirecard_checkout_seamless.php @@ -91,7 +91,7 @@ } else { - $iFrame = ''; $smarty->assign('FORM_ACTION', $iFrame); $smarty->assign('CHECKOUT_TITLE', $seamless->getText('confirm_title')); diff --git a/includes/classes/WirecardCheckoutSeamless.php b/includes/classes/WirecardCheckoutSeamless.php index 86ad2aa..c4133cf 100644 --- a/includes/classes/WirecardCheckoutSeamless.php +++ b/includes/classes/WirecardCheckoutSeamless.php @@ -26,6 +26,9 @@ require_once DIR_FS_DOCUMENT_ROOT . '/gm/classes/GMWirecardCheckoutSeamless.php'; +defined('GM_HTTP_SERVER') or define('GM_HTTP_SERVER', HTTP_SERVER); +define('MODULE_PAYMENT_WCS_WINDOW_NAME', 'wirecardCheckoutSeamlessIFrame'); + class WirecardCheckoutSeamless_ORIGIN { public $code; @@ -64,6 +67,13 @@ class WirecardCheckoutSeamless_ORIGIN */ static protected $dataStore = null; + /** + * caches contents returned from selection() method + * the selection methode may be called twice, for some reasons + * @var + */ + static protected $_selectionCache; + /** * whether datastorage init failed * @var bool @@ -103,10 +113,12 @@ public function __construct() $this->info = $this->constant("MODULE_PAYMENT_{$c}_TEXT_INFO"); // displayed in checkout $this->description = $this->constant("MODULE_PAYMENT_{$c}_TEXT_DESC"); // displayed in admin area $this->sort_order = $this->constant("MODULE_PAYMENT_{$c}_SORT_ORDER"); - $this->description .= '

' . $this->_seamless->getText('configure') . ''; - + } $this->enabled = self::constant("MODULE_PAYMENT_{$c}_STATUS") == 'True'; define("MODULE_PAYMENT_{$c}_STATUS_TITLE", $this->_seamless->getText('active')); define("MODULE_PAYMENT_{$c}_STATUS_DESC", ''); @@ -286,6 +298,12 @@ public function selection() } $paymentType = $this->_paymenttype; + + // avoid duplicate invocation + if (isset(self::$_selectionCache[$paymentType])) { + return self::$_selectionCache[$paymentType]; + } + if($paymentType == WirecardCEE_Stdlib_PaymentTypeAbstract::MAESTRO || $paymentType == WirecardCEE_Stdlib_PaymentTypeAbstract::CCARD_MOTO ) @@ -319,7 +337,10 @@ public function selection() } } - return array('id' => $this->code, 'module' => $this->title, 'description' => $this->info, 'fields' => $fields); + $content = array('id' => $this->code, 'module' => $this->title, 'description' => $this->info, 'fields' => $fields); + self::$_selectionCache[$this->_paymenttype] = $content; + + return $content; } diff --git a/includes/modules/payment/wcs_top.php b/includes/modules/payment/wcs_top.php new file mode 100644 index 0000000..de058b5 --- /dev/null +++ b/includes/modules/payment/wcs_top.php @@ -0,0 +1,80 @@ + $v) { + $_POST[$p] = $v; + } + + return; + } + + foreach ($params as $p) { + if (isset($_POST[$p])) { + $preserved[$p] = $_POST[$p]; + unset($_POST[$p]); + } + } +} diff --git a/templates/Honeygrid/usermod/javascript/Checkout/WirecardCheckoutSeamless.js b/templates/Honeygrid/usermod/javascript/Checkout/WirecardCheckoutSeamless.js index 2d8c85b..ebfec42 100644 --- a/templates/Honeygrid/usermod/javascript/Checkout/WirecardCheckoutSeamless.js +++ b/templates/Honeygrid/usermod/javascript/Checkout/WirecardCheckoutSeamless.js @@ -47,6 +47,10 @@ $(document).ready(function () { checkoutPaymentArea.find('.continue_button').on('click', function (e) { var code = checkoutPaymentArea.find("input[name='payment']:radio:checked").val(); + if (typeof code == "undefined") { + code = checkoutPaymentArea.find("input[name='payment']").val(); + } + // not a wirecard payment if (!code.match(/^wcs_/)) return true;