From 4496898c1b9d03d0e4c90cd8b9f6ec0bd540d378 Mon Sep 17 00:00:00 2001 From: tomazpu <32056440+tomazpu@users.noreply.github.com> Date: Wed, 22 Nov 2017 16:41:33 +0100 Subject: [PATCH 1/3] #12 changing paymenttype with ajax --- wirecardceecheckout.php | 24 ++++++++++++++++++++- wirecardceecheckout/tmpl/displaypayment.php | 5 +++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/wirecardceecheckout.php b/wirecardceecheckout.php index 752e80d..190e825 100644 --- a/wirecardceecheckout.php +++ b/wirecardceecheckout.php @@ -1929,4 +1929,26 @@ function plgVmOnCheckAutomaticSelectedPayment(VirtueMartCart $cart, array $cart_ return $this->onCheckAutomaticSelected($cart, $cart_prices, $paymentCounter); } -} \ No newline at end of file + public function changePaymentTypeAjax($paymentType) + { + $session = JFactory::getSession(); + $data = $session->get('WIRECARDCEECHECKOUT', 0, 'vm'); + if (!empty($data)) { + $sessionWirecard = unserialize($data); + $sessionWirecard->paymenttype = $paymentType; + } + $session->set('WIRECARDCEECHECKOUT', serialize($sessionWirecard), 'vm'); + } + + public function plgVmOnSelfCallFE() + { + $action = vRequest::getCmd('action'); + $paymentType = vRequest::getWord('paymenttype', ''); + switch ($action) { + case "changePaymentTypeAjax": + $this->changePaymentTypeAjax($paymentType); + break; + } + } + +} diff --git a/wirecardceecheckout/tmpl/displaypayment.php b/wirecardceecheckout/tmpl/displaypayment.php index 1621e64..421501e 100644 --- a/wirecardceecheckout/tmpl/displaypayment.php +++ b/wirecardceecheckout/tmpl/displaypayment.php @@ -168,6 +168,11 @@ jQuery('.wirecard_paymenttype').each(function () { jQuery(this).change(function (evt) { jQuery('#payment_id_').prop('checked', true); + jQuery.ajax({ + type: "POST", + dataType: "json", + url: "index.php?option=com_virtuemart&view=plugin&type=vmpayment&nosef=1&name=wirecardceecheckout&loadJS=1&action=changePaymentTypeAjax&paymenttype=" + (this).value + }); }); }); jQuery('input[name=virtuemart_paymentmethod_id]').change(function (evt) { From c61da6a475c4ee96ea236bde82b02a43360552dd Mon Sep 17 00:00:00 2001 From: tomazpu <32056440+tomazpu@users.noreply.github.com> Date: Wed, 22 Nov 2017 16:58:00 +0100 Subject: [PATCH 2/3] #12 version increase --- .../plg_vmpayment_wirecardceecheckout_update.xml | 15 +++++++++++++++ wirecardceecheckout.php | 2 +- wirecardceecheckout.xml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/update/plg_vmpayment_wirecardceecheckout_update.xml b/update/plg_vmpayment_wirecardceecheckout_update.xml index 820994f..e8e9c78 100644 --- a/update/plg_vmpayment_wirecardceecheckout_update.xml +++ b/update/plg_vmpayment_wirecardceecheckout_update.xml @@ -75,4 +75,19 @@ https://www.wirecard.at/ + + Wirecard Checkout Page + Wirecard - Your Full Service Payment Provider + plugin + vmpayment + wirecardceecheckout + 1.7.4 + site + + https://github.com/wirecard/virtuemart3-wcp/archive/1.7.4.zip + + Wirecard + https://www.wirecard.at/ + + \ No newline at end of file diff --git a/wirecardceecheckout.php b/wirecardceecheckout.php index 190e825..430fc6e 100644 --- a/wirecardceecheckout.php +++ b/wirecardceecheckout.php @@ -54,7 +54,7 @@ class plgVmPaymentwirecardceecheckout extends vmPSPlugin protected static $WINDOW_NAME = 'WirecardCEECheckoutFrame'; protected static $PLUGIN_NAME = 'VirtueMart2_CheckoutPage'; - protected static $PLUGIN_VERSION = '1.7.3'; + protected static $PLUGIN_VERSION = '1.7.4'; protected $_method; protected $_order; diff --git a/wirecardceecheckout.xml b/wirecardceecheckout.xml index 328b87f..54a9671 100644 --- a/wirecardceecheckout.xml +++ b/wirecardceecheckout.xml @@ -36,7 +36,7 @@ http://www.wirecard.at/ Copyright (C) 2013 Wirecard. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.7.3 + 1.7.4 VMPAYMENT_WIRECARDCEECHECKOUT_PAYMENT_DESCRIPTION From 208752a5ae26a59557dd969598c4ee3a836e3cac Mon Sep 17 00:00:00 2001 From: tomazpu <32056440+tomazpu@users.noreply.github.com> Date: Mon, 27 Nov 2017 17:21:18 +0100 Subject: [PATCH 3/3] #12 preventing checkout issues --- wirecardceecheckout.php | 24 ++- wirecardceecheckout/tmpl/displaypayment.php | 199 +++++++++++--------- 2 files changed, 129 insertions(+), 94 deletions(-) diff --git a/wirecardceecheckout.php b/wirecardceecheckout.php index 430fc6e..f5e5742 100644 --- a/wirecardceecheckout.php +++ b/wirecardceecheckout.php @@ -961,7 +961,11 @@ protected function _initiatePayment($cart) } if ( in_array($paymentType, array(WirecardCEE_QPay_PaymentType::IDL, WirecardCEE_QPay_PaymentType::EPS ) ) ) { - $client->setFinancialInstitution($_POST['financialInstitution']); + if (isset($_POST['financialInstitution'])) { + $client->setFinancialInstitution($_POST['financialInstitution']); + } else { + $client->setFinancialInstitution($sessionWirecard->additional["financialInstitution"]); + } } if (array_key_exists('ST', $order['details'])) { $client->createConsumerMerchantCrmId($order['details']['ST']->email); @@ -1040,7 +1044,7 @@ protected function _getEnabledPaymentTypes() $paymentTypes[7]['image'] = strtolower(WirecardCEE_QPay_PaymentType::EPS); $paymentTypes[7]['title'] = $this->_getPaymentTypeName(WirecardCEE_QPay_PaymentType::EPS); $paymentTypes[7]['value'] = WirecardCEE_QPay_PaymentType::EPS; - $paymentTypes[9]['financial_inst'] = WirecardCEE_QPay_PaymentType::getFinancialInstitutions('EPS'); + $paymentTypes[7]['financial_inst'] = WirecardCEE_QPay_PaymentType::getFinancialInstitutions('EPS'); } if ((int)$this->_getMethod()->paymenttype_giropay == 1) { $paymentTypes[8]['image'] = strtolower(WirecardCEE_QPay_PaymentType::GIROPAY); @@ -1929,13 +1933,14 @@ function plgVmOnCheckAutomaticSelectedPayment(VirtueMartCart $cart, array $cart_ return $this->onCheckAutomaticSelected($cart, $cart_prices, $paymentCounter); } - public function changePaymentTypeAjax($paymentType) + public function changePaymentTypeAjax($data) { $session = JFactory::getSession(); - $data = $session->get('WIRECARDCEECHECKOUT', 0, 'vm'); - if (!empty($data)) { - $sessionWirecard = unserialize($data); - $sessionWirecard->paymenttype = $paymentType; + $sessionData = $session->get('WIRECARDCEECHECKOUT', 0, 'vm'); + if (!empty($sessionData)) { + $sessionWirecard = unserialize($sessionData); + $sessionWirecard->paymenttype = $data["wirecard_paymenttype"]; + $sessionWirecard->additional = $data["wcp_additional"]; } $session->set('WIRECARDCEECHECKOUT', serialize($sessionWirecard), 'vm'); } @@ -1943,12 +1948,11 @@ public function changePaymentTypeAjax($paymentType) public function plgVmOnSelfCallFE() { $action = vRequest::getCmd('action'); - $paymentType = vRequest::getWord('paymenttype', ''); + $data = vRequest::getPost(); switch ($action) { case "changePaymentTypeAjax": - $this->changePaymentTypeAjax($paymentType); + $this->changePaymentTypeAjax($data); break; } } - } diff --git a/wirecardceecheckout/tmpl/displaypayment.php b/wirecardceecheckout/tmpl/displaypayment.php index 421501e..09dcd75 100644 --- a/wirecardceecheckout/tmpl/displaypayment.php +++ b/wirecardceecheckout/tmpl/displaypayment.php @@ -40,12 +40,12 @@ $url = JURI::root() . 'images/stories/virtuemart/' . $this->_psType . '/'; foreach ( $viewData['paymenttypes'] as $pt ) { - ?> + ?>
/> + echo ' checked="checked"' ?> />
- -
+ +

- '; - for ( $day = 31; $day > 0; $day -- ) { - $selected = ''; - if ($viewData['birth_day'] == $day){ - $selected = 'selected'; - } - $birthday .= ''; - } + '; + for ( $day = 31; $day > 0; $day -- ) { + $selected = ''; + if ($viewData['birth_day'] == $day){ + $selected = 'selected'; + } + $birthday .= ''; + } - $birthday .= ''; + $birthday .= ''; - $birthday .= ''; + $birthday .= ''; - $birthday .= ''; - echo $birthday; - ?> + $birthday .= ''; + echo $birthday; + ?>
- + - -
+ +

- - -
+ + +

- +