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"' ?> />
-
-