From 50e0f520a6659f3075c4007470de94e79a59e48e Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 28 Aug 2019 08:54:39 +0200 Subject: [PATCH 01/32] SHOPWARE-430_InvoicePrintingIvB2B * removed an if which causes that payolution invoice infos will be taken in case of Iv B2B --- Frontend/HeidelGateway/Bootstrap.php | 30 +++++++------------ .../Controllers/Frontend/PaymentHgw.php | 1 - 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index d8411f8..42240d0 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.08.21'; + return '19.08.23'; } /** @@ -106,7 +106,6 @@ public function install(){ throw new Enlight_Exception("This Plugin needs min shopware 4.3.7"); } - /* *************** Neuer Code ********************* */ $swVersion = Shopware()->Config()->version; /* Major check Version */ @@ -120,19 +119,6 @@ public function install(){ throw new Enlight_Exception("This plugin requires the shopware plugin payment"); } }; - /* *************** Ende neuer Code ********************* */ - /* Major check Version */ -// if ($this->assertVersionGreaterThen('5.1.6')) { -// $swVersion = Shopware()->Config()->version; -// -// } else { -// $swVersion = Shopware()->Config()->version; -// if(!$this->assertRequiredPluginsPresent(array('Payment'))){ -// $msg .= "This plugin requires the plugin payment
"; -// $this->uninstall(); -// throw new Enlight_Exception("This plugin requires the shopware plugin payment"); -// } -// } if($this->assertRequiredPluginsPresent(array('HeidelActions'))){ throw new Enlight_Exception("Please delete Heidelpay Backend Plugin (HeidelActions) from your Server"); @@ -1009,6 +995,12 @@ public function update($oldVersion){ } case '19.08.21': + case '19.08.23': + try{ + $msg .= '* update 19.08.23
'; + } catch (Exception $e) { + $this->logError($msg,$e); + } // overwrite $msg if update was successful $msg = 'Update auf Version '.$this->getVersion().' erfolgreich.'; @@ -1919,8 +1911,8 @@ public function onBeforeRenderDocument(Enlight_Hook_HookArgs $args){ $rawFooter = $this->getInvoiceContentInfo($containers, $orderData, 'SAN'); $containers['Hgw_SAN_Content_Info']['value'] = $rawFooter['value']; } elseif ( - $document->_order->payment['name'] == 'hgw_ivpd' || - $document->_order->payment['name'] == 'hgw_ivb2b' + $document->_order->payment['name'] == 'hgw_ivpd' +// || $document->_order->payment['name'] == 'hgw_ivb2b' ){ $rawFooter = $this->getInvoiceContentInfo($containers, $orderData, 'IVPD'); $containers['Hgw_IVPD_Content_Info']['value'] = $rawFooter['value']; @@ -1956,8 +1948,8 @@ public function onBeforeRenderDocument(Enlight_Hook_HookArgs $args){ $containerData['Content_Info']['value'] = $document->_template->fetch('string:' . $containerData['Content_Info']['value']); $view->assign('Containers', $containerData); } elseif( - ($document->_order->payment['name'] == 'hgw_ivpd') || - ($document->_order->payment['name'] == 'hgw_ivb2b') + ($document->_order->payment['name'] == 'hgw_ivpd') +// ||($document->_order->payment['name'] == 'hgw_ivb2b') ) { $containerData['Content_Info'] = $containerData['Hgw_IVPD_Content_Info']; $containerData['Content_Info']['value'] = $document->_template->fetch('string:' . $containerData['Content_Info']['value']); diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index 23fbbc7..c7b8777 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -4025,7 +4025,6 @@ public function afterEasyAction() { Shopware()->Session()->HPdidRequest = 'TRUE'; Shopware()->Session()->HPOrderId = $this->Request()->getParam('HpTransId'); - $this->redirect( array( 'controller' => 'checkout', From 08e57139c34730aa9e7cbabbc02d04aa5702721d Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Fri, 30 Aug 2019 14:14:08 +0200 Subject: [PATCH 02/32] SHOPWARE-429_ConverOrder_ArticleFixing * added use of Shopware/Models/Order/Order class * adapted 2 Shopware functions to set inStock for purchased articles * called convertCancelledOrderInStock() to set inStock for articles --- .../Controllers/Frontend/PaymentHgw.php | 92 ++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index c7b8777..cfc36f7 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -11,6 +11,7 @@ */ use Shopware\Components\CSRFWhitelistAware; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Shopware\Models\Order\Order; class Shopware_Controllers_Frontend_PaymentHgw extends Shopware_Controllers_Frontend_Payment implements CSRFWhitelistAware{ var $dbtable = ''; @@ -4036,7 +4037,7 @@ public function afterEasyAction() public function convertOrder($transactionData, $paymentStatus = 12) { - // Customermodel hat unter 5.1.6 noch keine Beziehung zu defaultShippingAdress oder defaultBillingAdress + // Customermodel hat unter 5.1.6 noch keine Beziehung zu defaultShippingAddress oder defaultBillingAddress // daher musste funktion angepasst werden if(version_compare(Shopware()->Config()->version,"5.2.0","<")){ @@ -4218,6 +4219,9 @@ public function convertOrder($transactionData, $paymentStatus = 12) $orderObject->setPaymentStatus($statusModelPayment); $orderObject->setClearedDate($transactionData['PROCESSING_TIMESTAMP']); + // setting Article quantity + $this->convertCancelledOrderInStock($orderObject); + // saving all generated Models and Onjects Shopware()->Models()->flush($orderObject); @@ -4430,7 +4434,6 @@ public function convertOrder($transactionData, $paymentStatus = 12) 'number' => !empty($customerDbResult[0]['customer']['number']) ? $customerDbResult[0]['customer']['number'] : '', ]; - /** * @var \Shopware\Models\Country\Country $countryModel */ @@ -4461,6 +4464,9 @@ public function convertOrder($transactionData, $paymentStatus = 12) $orderObject->setPaymentStatus($statusModelPayment); $orderObject->setClearedDate($transactionData['PROCESSING_TIMESTAMP']); + // setting Article quantity + $this->convertCancelledOrderInStock($orderObject); + // saving all generated Models and Onjects Shopware()->Models()->flush(); @@ -4554,4 +4560,86 @@ private function getSwVersion() } return $swVersion; } + + /** + * Checks if the order position is a regular product + * @param Shopware\Models\Order\Detail $orderDetailModel + * @return bool + */ + private function isProductPosition(\Shopware\Models\Order\Detail $orderDetailModel) + { + return $orderDetailModel->getMode() === 0; + } + + /** + * @param \Shopware\Models\Article\Detail $variant + * @param Order $order + * @return null|\Shopware\Models\Order\Detail + */ + private function getOrderPositionByProduct(\Shopware\Models\Article\Detail $variant, Order $order) + { + /** @var $detail \Shopware\Models\Order\Detail */ + foreach ($order->getDetails() as $detail) { + + if (!$this->isProductPosition($detail)) { + continue; + } + if ($detail->getArticleNumber() === $variant->getNumber()) { + return $detail; + } + } + + return null; + } + + /** + * Function which calculates, validates and updates the new in stock when an order without customer-session was created + * @param Shopware\Models\Order\Order $orderModel + * @return bool + */ + private function convertCancelledOrderInStock(\Shopware\Models\Order\Order $orderModel) + { + /** @var $entityManager \Shopware\Components\Model\ModelManager */ + $entityManager = $this->get('models'); + + $products = $this->getProductsOfOrder($orderModel); + + foreach ($products as $product) { + $position = $this->getOrderPositionByProduct($product, $orderModel); + if (!$position) { + continue; + } + + $product->setInStock( + $product->getInStock() - $position->getQuantity() + ); + + $entityManager->persist($product); + } + return true; + } + + /** + * @param Order $order + * + * @return \Shopware\Models\Article\Detail[] + */ + private function getProductsOfOrder(Order $order) + { + /** @var $repository \Shopware\Components\Model\ModelRepository */ + $repository = Shopware()->Models()->getRepository('Shopware\Models\Article\Detail'); + + $products = []; + foreach ($order->getDetails() as $detail) { + /** @var $detail \Shopware\Models\Order\Detail */ + if (!$this->isProductPosition($detail)) { + continue; + } + $variant = $repository->findOneBy(['number' => $detail->getArticleNumber()]); + $products[] = $variant; + } + + return $products; + } + } \ No newline at end of file From 8fd166e779f4b98e3be89294f495742e39103c92 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Fri, 30 Aug 2019 15:29:13 +0200 Subject: [PATCH 03/32] SHOPWARE-429_ConverOrder_ArticleFixing * changed versionnumber & update() * added use of Shopware/Models/Order/Order class * adapted 2 Shopware functions to set inStock for purchased articles * called convertCancelledOrderInStock() to set inStock for articles --- Frontend/HeidelGateway/Bootstrap.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index 42240d0..225762b 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.08.23'; + return '19.08.30'; } /** @@ -994,10 +994,12 @@ public function update($oldVersion){ $this->logError($msg,$e); } + // Fix for no additional E-Mail for invoice B2B is sent after an order + // Feature setting article in stock in case of an order without session case '19.08.21': - case '19.08.23': + case '19.08.30': try{ - $msg .= '* update 19.08.23
'; + $msg .= '* update 19.08.30
'; } catch (Exception $e) { $this->logError($msg,$e); } From cee89854905bbecadda28ffebfd99b6849870585 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Thu, 5 Sep 2019 09:07:43 +0200 Subject: [PATCH 04/32] SHOPWARE-429_ConverOrder_ArticleFixing * changed versionnumber & update() * changed savePaymentAction() to redirect to right site after a registration --- Frontend/HeidelGateway/Bootstrap.php | 9 +++--- .../Controllers/Frontend/PaymentHgw.php | 32 ++++++++++++++----- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index 225762b..bdb5f46 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.08.30'; + return '19.09.16'; } /** @@ -996,14 +996,13 @@ public function update($oldVersion){ // Fix for no additional E-Mail for invoice B2B is sent after an order // Feature setting article in stock in case of an order without session - case '19.08.21': - case '19.08.30': + // Fix for redirect after saving registered paymentdata in savePaymentAction + case '19.09.16': try{ - $msg .= '* update 19.08.30
'; + $msg .= '* update 19.09.16
'; } catch (Exception $e) { $this->logError($msg,$e); } - // overwrite $msg if update was successful $msg = 'Update auf Version '.$this->getVersion().' erfolgreich.'; } diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index cfc36f7..c9e4d07 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -1701,14 +1701,30 @@ public function savePaymentAction(){ { // bis SW 5.2.27 aktuell $this->forward('savePayment', 'account', '', $postparams); } else { - // funktionstüchtig für SW 5.3 - $this-> redirect(array( - 'controller' => 'checkout', - 'action' => 'confirm', - 'sTarget' => 'checkout', - 'sTargetAction' => 'confirm', - ) - ); + switch ($this->Request()->getParam('sTarget')){ + case 'checkout': + return $this-> redirect(array( + 'controller' => 'checkout', + 'action' => 'confirm', + ) + ); + break; + case 'account': + return $this-> redirect(array( + 'controller' => 'account', + 'action' => 'index', + ) + ); + break; + default: + return $this-> redirect(array( + 'controller' => 'index', + 'action' => 'index', + ) + ); + break; + } + exit(); } }catch(Exception $e){ From d1e1a4b0f76fbe1757ccaae3e1ea221b05a788f9 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Thu, 26 Sep 2019 11:30:18 +0200 Subject: [PATCH 05/32] SHOPWARE-447_PaymentMethodChangeToDD * JS for async and documentReady fixed * paymentmethod-change working checkout/shippingPayment for SW 5.5 * paymentmethod-change working account/payment for SW 5.5 --- .../frontend/_public/src/js55/hpf_script.js | 1 + .../frontend/_public/src/js55/valPayment.js | 279 ++++++++---------- .../frontend/_public/src/js55/valPaymentDr.js | 158 ++-------- 3 files changed, 161 insertions(+), 277 deletions(-) diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/hpf_script.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/hpf_script.js index 489f836..53b5448 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/hpf_script.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/hpf_script.js @@ -1,4 +1,5 @@ document.asyncReady(function() { + var hasListener = []; hasListener['dc'] = false; hasListener['cc'] = false; diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js index 2e84ff9..9e115a1 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js @@ -11,120 +11,124 @@ document.asyncReady(function () { if (orgLink == 'undefined') { var orglink = jQuery('form[name="shippingPaymentForm"]').attr('action'); } - if ( - (window.location.pathname.toLowerCase().indexOf('shippingpayment') == '-1') - ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') == '-1') - ) { - // change checked option - jQuery('.register--payment').click(function () { - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - jQuery('.hgw_dd').click(function () { - // change form action - var checkedOpt = "hgw_dd"; - changeUrl(checkedOpt, orgLink); - }); - } else { - var clicked = ''; - $(this).click(function (e) { - clicked = e.target.className; - }); - jQuery('.payment--method-list').click(function () { - // change form action - var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - // add validation for form - jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); + // paymentmethod change on checkout/shippingPayment + if( + (window.location.pathname.toLowerCase().indexOf('shippingpayment') > '0') + ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') > '0') + ){ + var clicked = ''; + $(this).click(function (e) { + clicked = e.target.className; + }); + jQuery('.payment--method-list').click(function () { + // change form action + var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); + // changeUrl(checkedOpt, orgLink); - // set original form action (before AJAX is sent) - $.ajaxSetup({ - beforeSend: function (event, xhr, settings) { - // check for right ajax request - if (xhr.data != undefined) { - // just execute if hgw pay. method is selected - if (clicked.indexOf('hgw_') != -1) { - xhr.data += '&hgw=1'; - - if (this.url != orgLink) { - this.url = orgLink; - jQuery('form.payment').attr('action', orgLink); + }); + // add validation for form + jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); + + // set original form action (before AJAX is sent) + $.ajaxSetup({ + beforeSend: function (event, xhr, settings) { + // check for right ajax request + if (xhr.data != undefined) { + // just execute if hgw pay. method is selected + if (clicked.indexOf('hgw_') != -1) { + xhr.data += '&hgw=1'; + + if (this.url != orgLink) { + this.url = orgLink; + jQuery('form.payment').attr('action', orgLink); + } } } - } - }, - }); + }, + }); - $(document).ajaxComplete(function (event, xhr, settings) { - - // function set birthdate for santander - if(jQuery('.newreg_san').is(":visible")) { - $(".hgw_required").attr("required","required"); - var birthDay = jQuery(".newreg_san [name='DateSan_Day']").val(); - var birthMonth = jQuery(".newreg_san [name = 'DateSan_Month']").val(); - var birthYear = jQuery(".newreg_san [name = 'DateSan_Year']").val(); - - jQuery('#birthdate_san').val(birthYear+'-'+birthMonth+'-'+birthDay); - } else { - $(".hgw_required").removeAttr("required"); - } + $(document).ajaxComplete(function (event, xhr, settings) { + // function set birthdate for santander + if(jQuery('.newreg_san').is(":visible")) { + $(".hgw_required").attr("required","required"); + var birthDay = jQuery(".newreg_san [name='DateSan_Day']").val(); + var birthMonth = jQuery(".newreg_san [name = 'DateSan_Month']").val(); + var birthYear = jQuery(".newreg_san [name = 'DateSan_Year']").val(); - if(jQuery('.newreg_dd').is(":visible") && jQuery(".newreg_dd [name='Date_Day']").is(":visible")) { - var birthDay = jQuery(".newreg_dd [name='DateDD_Day']").val(); - var birthMonth = jQuery(".newreg_dd [name = 'DateDD_Month']").val(); - var birthYear = jQuery(".newreg_dd [name = 'DateDD_Year']").val(); + jQuery('#birthdate_san').val(birthYear+'-'+birthMonth+'-'+birthDay); + } else { + $(".hgw_required").removeAttr("required"); + } - jQuery('#birthdate_dd').val(birthYear+'-'+birthMonth+'-'+birthDay); - } + if(jQuery('.newreg_dd').is(":visible") && jQuery(".newreg_dd [name='Date_Day']").is(":visible")) { + var birthDay = jQuery(".newreg_dd [name='DateDD_Day']").val(); + var birthMonth = jQuery(".newreg_dd [name = 'DateDD_Month']").val(); + var birthYear = jQuery(".newreg_dd [name = 'DateDD_Year']").val(); - if (((settings.data != undefined) && (settings.data.indexOf('hgw=1') != -1)) || ($('.payment--method-list input:radio:checked').attr('class').indexOf('hgw_') != -1)) { - // load fancy-js for select boxes - if (swVersion >= '5.1') { - jQuery('select:not([data-no-fancy-select="true"])').swSelectboxReplacement(); - } else { - jQuery('select:not([data-no-fancy-select="true"])').selectboxReplacement(); + jQuery('#birthdate_dd').val(birthYear+'-'+birthMonth+'-'+birthDay); } - // set width for XS-State (with SW-Statemanger) - StateManager.registerListener({ - state: 'xs', - enter: function () { - jQuery('.js--fancy-select').attr('style', 'width:100%;'); - }, - exit: function () { - jQuery('.js--fancy-select').removeAttr('style'); + if (((settings.data != undefined) && (settings.data.indexOf('hgw=1') != -1)) || ($('.payment--method-list input:radio:checked').attr('class').indexOf('hgw_') != -1)) { + // load fancy-js for select boxes + if (swVersion >= '5.1') { + jQuery('select:not([data-no-fancy-select="true"])').swSelectboxReplacement(); + } else { + jQuery('select:not([data-no-fancy-select="true"])').selectboxReplacement(); } - }); - // add validation for form - jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); - - // just call changeUrl() after all animations are done - $(document).promise().done(function () { - document.asyncReady(function () { - // $(document).reuse(); - // $(document).ibanCheck(); - var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); - $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function () { - // change form action - changeUrl(checkedOpt, orgLink); - }); - if (checkedOpt.indexOf('papg') != '-1') { - // change form action - changeUrl(checkedOpt, orgLink); - } - if (checkedOpt.indexOf('san') != '-1') { - // change form action - changeUrl(checkedOpt, orgLink); + // set width for XS-State (with SW-Statemanger) + StateManager.registerListener({ + state: 'xs', + enter: function () { + jQuery('.js--fancy-select').attr('style', 'width:100%;'); + }, + exit: function () { + jQuery('.js--fancy-select').removeAttr('style'); } }); - }); - } - }); - } + // add validation for form + jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); + + // just call changeUrl() after all animations are done + $(document).promise().done(function () { + document.asyncReady(function () { + // $(document).reuse(); + // $(document).ibanCheck(); + // var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); + // $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function () { + // // change form action + // // changeUrl(checkedOpt, orgLink); + // }); + // if (checkedOpt.indexOf('papg') != '-1') { + // // change form action + // // changeUrl(checkedOpt, orgLink); + // } + // + // if (checkedOpt.indexOf('san') != '-1') { + // // change form action + // // changeUrl(checkedOpt, orgLink); + // } + }); + }); + } + }); + } else { + // change checked option + jQuery('.register--payment').click(function () { + // change form action + var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); + // changeUrl(checkedOpt, orgLink); + }); + + // jQuery('.hgw_dd').click(function () { + // // change form action + // var checkedOpt = "hgw_dd"; + // changeUrl(checkedOpt, orgLink); + // }); + } + /* ************************************************ */ + // case to set or remove required attribute for payolution checkbos var paymentMethod = $('input:radio:checked').attr('class'); if(paymentMethod != undefined) { @@ -371,8 +375,6 @@ document.asyncReady(function () { // disable all other input fields jQuery('.payment--method input').attr('disabled', 'disabled'); jQuery('.payment--method select').attr('disabled', 'disabled'); - // jQuery(".hgw_"+pm).parents('.payment--method').find('input').removeAttr('disabled'); - // jQuery(".hgw_"+pm).parents('.payment--method').find('select').removeAttr('disabled'); jQuery("input:radio").removeAttr('disabled'); jQuery("input:radio:checked").parent().parent().find('input').removeAttr('disabled'); jQuery("input:radio:checked").parent().parent().find('select').removeAttr('disabled'); @@ -470,10 +472,8 @@ document.asyncReady(function () { var birthYear = jQuery(".newreg_dd [name = 'DateDD_Year']").val(); jQuery('#birthdate_dd').val(birthYear + '-' + birthMonth + '-' + birthDay); // change form action - changeUrl('hgw_dd', orgLink); }); - if (jQuery('.newreg_dd')) { var birthDay = jQuery(".newreg_dd [name='DateDD_Day']").val(); var birthMonth = jQuery(".newreg_dd [name = 'DateDD_Month']").val(); @@ -595,7 +595,6 @@ function changeUrl(checkedOpt, orgLink) { } else { jQuery('form.payment').attr('action', orgLink); } - } // VALIDATE FORM @@ -640,6 +639,9 @@ function valForm() { errors = valDirectDebitSecured(errors); } + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } if (pm == 'papg') { @@ -685,10 +687,6 @@ function valForm() { return false; } else { // disable all other input fields - // jQuery('.register--payment input').attr('disabled', 'disabled'); - // jQuery('.register--payment select').attr('disabled', 'disabled'); - // jQuery('.register--payment input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); - // jQuery('.register--payment input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); jQuery('.payment--method .block input').attr('disabled', 'disabled'); jQuery('.payment--method .block select').attr('disabled', 'disabled'); jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); @@ -773,46 +771,6 @@ function valGatewayForm() { } - // if (pm == 'dd') { - // var errors = new Array(); - // // direct debit - // errors = valInputDdIban(jQuery('.' + checkedOpt + ' #iban').val(), pm); - // - // // direct debit secured - // if(jQuery('#salutation').is(':visible')){ - // // getting Values from input fields - // var birthDay = jQuery('select[name=Date_Day]').val(); - // var birthMonth = jQuery('select[name=Date_Month]').val(); - // var birthYear = jQuery('select[name=Date_Year]').val(); - // - // jQuery('#birthdate_dd').val(birthYear + '-' + birthMonth + '-' + birthDay); - // - // errors = valDirectDebitSecured(errors); - // } - // } else if (pm == 'gir') { - // var errors = valInputDdIban(jQuery('.' + checkedOpt + ' #iban').val(), pm); - // } else if (pm == "papg"){ - // var errorsPapg = valInvoiceSec(); - // - // if((jQuery('.newreg_papg .has--error'))){ - // if(jQuery.isEmptyObject(errorsPapg) == false){ - // jQuery('#payment .alert .alert--content ul').append('
  • '+jQuery('.msg_fill').html()+'
  • '); - // jQuery.each(errorsPapg, function(key, value){ - // jQuery('.alert--content ul').append('
  • '+jQuery(value).html()+'
  • '); - // }); - // - // jQuery('.alert').removeClass("is--hidden"); - // jQuery('.alert').show(); - // jQuery('html, body').animate({scrollTop: 0}, 0); - // - // return false; - // } - // - // } else { - // jQuery('#payment .alert .is--error .is--rounded div').remove(); - // } - // } - if ((jQuery('.' + checkedOpt + ' .has--error').length > 0)) { jQuery('#payment .alert .alert--content ul li').remove(); jQuery('#payment .alert .alert--content ul').append('
  • ' + jQuery('.msg_fill').html() + '
  • '); @@ -835,7 +793,7 @@ function valShippingPaymentForm() { var pm = checkedOpt.substr(checkedOpt.indexOf('hgw_') + 4); if(checkedOpt.indexOf('hgw_') !== -1){ - // remove check vor cc and dc + // remove check for cc and dc if ((pm != 'cc') && (pm != 'dc')) { // check if 'newreg' is shown if (jQuery('.newreg_' + pm).is(':visible')) { @@ -851,6 +809,12 @@ function valShippingPaymentForm() { switch (pm.toLocaleLowerCase()) { case "dd": var errors = valInputDdIban(jQuery('.newreg_' + pm + ' #iban').val(), pm); + + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + }if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } break; case "papg": @@ -898,6 +862,21 @@ function valShippingPaymentForm() { jQuery('html, body').animate({scrollTop: 0}, 0); return false; + // if (jQuery('#center .panel.has--border .alert--content ul').length == 0) { + // jQuery('#center .panel.has--border .alert--content').html('
      '); + // } + // + // jQuery('#center .alert .alert--content ul li').remove(); + // jQuery('#center .alert .alert--content ul').append('
    • ' + jQuery('.msg_fill').html() + '
    • '); + // + // jQuery.each(errors, function (key, value) { + // jQuery('#center .alert .alert--content ul').append('
    • ' + jQuery(value).html() + '
    • '); + // }); + // + // jQuery('#center .alert').show(); + // jQuery('html, body').animate({scrollTop: 0}, 0); + // + // return false; } else { // disable all other input fields // jQuery('.payment--method-list input').attr('disabled', 'disabled'); diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js index 2ca6a1c..c0c5825 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js @@ -1,7 +1,7 @@ // $(document).ready(function(){ $(function() { if(swVersion.substring(0,3) >= '5.2'){ - // var token = jQuery('input[name="__csrf_token"]').val(); + var token = jQuery('input[name="__csrf_token"]').val(); // if (jQuery('input[name="__csrf_token"]').length > 0 && jQuery('input[name="__csrf_token"]').val() != 0) { var orgLink = jQuery('form.payment').attr('action'); @@ -11,24 +11,9 @@ $(function() { // save original form action var orgLink = jQuery('form.payment').attr('action'); if( - (window.location.pathname.toLowerCase().indexOf('shippingpayment') == '-1') - ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') == '-1') + (window.location.pathname.toLowerCase().indexOf('shippingpayment')> '0') + ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') > '0') ){ - $(document).reuse(); - // change checked option - jQuery('.register--payment').click(function(){ - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - - jQuery('.payment--method .hgw_dd').click(function(){ - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - - }else{ var clicked = ''; $(this).click(function(e){ clicked = e.target.className; @@ -37,7 +22,7 @@ $(function() { jQuery('.payment--method-list').click(function(){ // change form action var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); // add validation for form @@ -69,7 +54,7 @@ $(function() { $(document).ajaxComplete(function(event, xhr, settings){ // fix for missing csrf-Token if(swVersion >= '5.2'){ - if ($(" shippingPaymentForm input[name='__csrf_token']").length == 0) { + if ($("#shippingPaymentForm input[name='__csrf_token']").length == 0) { $('.shipping-payment--information').append(''); } } @@ -111,21 +96,29 @@ $(function() { var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function(){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); if(checkedOpt.indexOf('papg') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } if(checkedOpt.indexOf('san') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } }); }); } }); + } else { + $(document).reuse(); + // change checked option + jQuery('.register--payment').click(function(){ + // change form action + var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); + // changeUrl(checkedOpt, orgLink); + }); } // case to set or remove required attribute for payolution checkbox @@ -256,7 +249,7 @@ $(function() { errorsDD = valDirectDebitSecured(errorsDD); } - if((jQuery('.'+"hgw_dd"+' .has--error').length > 0)){ + if((jQuery('.'+"hgw_dd"+' .has--error').length > 0)){ jQuery('#payment .alert .alert--content ul li').remove(); jQuery('#payment .alert .alert--content ul').append('
    • '+jQuery('.msg_fill').html()+'
    • '); @@ -270,7 +263,7 @@ $(function() { return false; } // change form action - changeUrl('hgw_dd', orgLink); + // changeUrl('hgw_dd', orgLink); } if (pm.indexOf("hgw_hps") != -1){ @@ -335,11 +328,6 @@ $(function() { // to remove unused inputs for IVB2B if(pm == "ivb2b"){ - // if(jQuery('.heidelB2bRegistered').is(':visible')){ - // jQuery('.heidelB2bNotRegistered').remove(); - // } else { - // jQuery('.heidelB2bRegistered').remove(); - // } if(jQuery('.heidelB2bRegistered').is(':visible')){ // jQuery('.heidelB2bNotRegistered').remove(); jQuery('.heidelB2bNotRegistered :input').attr("disabled","disabled"); @@ -375,7 +363,6 @@ $(function() { } } } - if(typeof pm == 'undefined') { var heidelCssClasses = jQuery(".payment_method").attr('class'); @@ -492,7 +479,7 @@ $(function() { jQuery('#birthdate_dd').val(birthYear+'-'+birthMonth+'-'+birthDay); // change form action - changeUrl('hgw_dd', orgLink); + // changeUrl('hgw_dd', orgLink); }); if(jQuery('.newreg_dd')) { @@ -635,38 +622,6 @@ function hgwToggleReuse (pm) jQuery('.newreg' + pm).toggle(500); } -// CHANGE FORM URL -// function changeUrl(checkedOpt, orgLink) { -// if (checkedOpt != undefined) { -// var prefix = 'hgw_'; -// var checkedOptPos = checkedOpt.indexOf(prefix); -// -// if (checkedOptPos >= 0) { -// var pm = checkedOpt.substr(checkedOptPos + prefix.length); -// -// if (pm == 'pay') { pm = 'va';} -// -// if ((jQuery('.reues_' + pm).length > 0) && !(jQuery('.reues_' + pm).is(':checked'))) { -// var reuse = true; -// } else { -// var reuse = false; -// } -// if (formUrl != null) { -// if ((formUrl[pm] == undefined) || (formUrl[pm] == '') || (reuse) || (pm == 'cc') || (pm == 'dc')) { -// jQuery('form.payment').attr('action', orgLink); -// } else { -// jQuery('form.payment').attr('action', formUrl[pm]); -// } -// } -// } else { -// jQuery('form.payment').attr('action', orgLink); -// } -// } else { -// jQuery('form.payment').attr('action', orgLink); -// } -// -// } - // VALIDATE FORM function valForm() { if (jQuery('.register--payment input:radio:checked').length != 0) { @@ -702,8 +657,12 @@ function valForm() { jQuery('#birthdate_dd').val = birthYear + '-' + birthMonth + '-' + birthDay; - errors = valDirectDebitSecured(errors); + var errors = valDirectDebitSecured(errors); + } + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); } + } if (pm == 'papg') { @@ -749,16 +708,10 @@ function valForm() { return false; } else { // disable all other input fields - // jQuery('.register--payment input').attr('disabled', 'disabled'); - // jQuery('.register--payment select').attr('disabled', 'disabled'); - // jQuery('.register--payment input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); - // jQuery('.register--payment input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); - - jQuery('.payment--method .block input').attr('disabled', 'disabled'); - jQuery('.payment--method .block select').attr('disabled', 'disabled'); - jQuery("input:radio").removeAttr('disabled'); - jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); - jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); + jQuery('.register--payment input').attr('disabled', 'disabled'); + jQuery('.register--payment select').attr('disabled', 'disabled'); + jQuery('.register--payment input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); + jQuery('.register--payment input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); } } } @@ -778,14 +731,6 @@ function valGatewayForm() { checkedOpt = jQuery('#payment .payment_method').find('div').attr('class'); var pm = checkedOpt.substr(checkedOpt.indexOf('_') + 1); - // set 'error' to empty inputs - // jQuery('.' + checkedOpt).find('input').each(function () { - // if (jQuery(this).val() == '') { - // jQuery(this).addClass('has--error'); - // } else { - // jQuery(this).removeClass('has--error'); - // } - // }); switch (pm.toLocaleLowerCase()) { case 'dd': @@ -850,46 +795,6 @@ function valGatewayForm() { } - - - // if (pm == 'dd') { - // var errors = valInputDdIban(jQuery('.' + checkedOpt + ' #iban').val(), pm); - // - // if (jQuery('#salutation').is(':visible')) { - // // getting Values from input fields - // var salutation = jQuery('#salutation').val(); - // var birthDay = jQuery('select[name=Date_Day]').val(); - // var birthMonth = jQuery('select[name=Date_Month]').val(); - // var birthYear = jQuery('select[name=Date_Year]').val(); - // - // jQuery('#birthdate_dd').val(birthYear + '-' + birthMonth + '-' + birthDay); - // - // errors = valDirectDebitSecured(errors); - // } - // } else if (pm == 'gir') { - // var errors = valInputDdIban(jQuery('.' + checkedOpt + ' #iban').val(), pm); - // } else if (pm == "papg"){ - // var errorsPapg = valInvoiceSec(); - // - // if((jQuery('.newreg_papg .has--error'))){ - // if(jQuery.isEmptyObject(errorsPapg) == false){ - // jQuery('#payment .alert .alert--content ul').append('
    • '+jQuery('.msg_fill').html()+'
    • '); - // jQuery.each(errorsPapg, function(key, value){ - // jQuery('.alert--content ul').append('
    • '+jQuery(value).html()+'
    • '); - // }); - // - // jQuery('.alert').removeClass("is--hidden"); - // jQuery('.alert').show(); - // jQuery('html, body').animate({scrollTop: 0}, 0); - // - // return false; - // } - // - // } else { - // jQuery('#payment .alert .is--error .is--rounded div').remove(); - // } - // } - if ((jQuery('.' + checkedOpt + ' .has--error').length > 0)) { jQuery('#payment .alert .alert--content ul li').remove(); jQuery('#payment .alert .alert--content ul').append('
    • ' + jQuery('.msg_fill').html() + '
    • '); @@ -910,12 +815,8 @@ function valShippingPaymentForm() { var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); var pm = checkedOpt.substr(checkedOpt.indexOf('hgw_') + 4); // disable all other input fields - // jQuery('.payment--method .block input').attr('disabled', 'disabled'); - // jQuery('.payment--method .block select').attr('disabled', 'disabled'); jQuery('div.payment--method.block.method :input').attr('disabled', 'disabled'); jQuery("input:radio").removeAttr('disabled'); - // jQuery(".hgw_"+pm).parents('.payment--method .block').find('input').removeAttr('disabled'); - // jQuery(".hgw_"+pm).parents('.payment--method .block').find('select').removeAttr('disabled'); jQuery("input.hgw_"+pm).parent().parent('div.payment--method.block.method').find('input').removeAttr('disabled'); jQuery("input.hgw_"+pm).parent().parent('div.payment--method.block.method').find('select').removeAttr('disabled'); @@ -934,6 +835,9 @@ function valShippingPaymentForm() { if (pm == 'dd') { var errors = valInputDdIban(jQuery('.newreg_' + pm + ' #iban').val(), pm); + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } if (pm == 'papg') { From f1acf1f5b1f0b3670058837e9c205cfb82ec58fb Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Thu, 26 Sep 2019 15:50:24 +0200 Subject: [PATCH 06/32] SHOPWARE-447_PaymentMethodChangeToDD * fixed Js-files for payment-method-change for SW 5.3. until 5.6.x * changed Versionnumber & update() --- Frontend/HeidelGateway/Bootstrap.php | 11 +- .../Controllers/Frontend/PaymentHgw.php | 7 +- .../frontend/_public/src/js53/valPayment.js | 71 ++++++------ .../frontend/_public/src/js53/valPaymentDr.js | 101 +++++------------- .../frontend/_public/src/js55/valPayment.js | 3 - .../frontend/_public/src/js55/valPaymentDr.js | 1 - 6 files changed, 81 insertions(+), 113 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index bdb5f46..0cd48b3 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.09.16'; + return '19.09.26'; } /** @@ -1003,6 +1003,14 @@ public function update($oldVersion){ } catch (Exception $e) { $this->logError($msg,$e); } + // Fix for switching to paymentmethod dd with reg + case '19.09.26': + try{ + $msg .= '* update 19.09.
      '; + } catch (Exception $e) { + $this->logError($msg,$e); + } + // overwrite $msg if update was successful $msg = 'Update auf Version '.$this->getVersion().' erfolgreich.'; } @@ -3931,7 +3939,6 @@ public function getRegData($userId, $activePayment = NULL){ */ public function doRequest($params = array(), $url = NULL){ try{ - if($url == NULL){ $url = self::$requestUrl; } $client = new Zend_Http_Client($url, array( 'useragent' => 'Shopware/' . Shopware()->Config()->Version, diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index c9e4d07..83f662a 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -1247,7 +1247,6 @@ public function responseRegAction() { } else { $dataToSave = NULL; } - if (!empty($resp['ACCOUNT_IBAN'])) { $saved = $this->saveRegData($resp, $resp['ACCOUNT_IBAN'], $resp['ACCOUNT_BIC'],$dataToSave); } else { @@ -1319,8 +1318,7 @@ public function responseRegAction() { default: break; } - } - else { + } else { // Registration is NOK $token = 'X-CSRF-Token'; Shopware()->Session()->$token = $resp['__csrf_token']; @@ -1713,10 +1711,12 @@ public function savePaymentAction(){ return $this-> redirect(array( 'controller' => 'account', 'action' => 'index', + 'sTarget' => 'account' ) ); break; default: + return $this-> redirect(array( 'controller' => 'index', 'action' => 'index', @@ -3346,7 +3346,6 @@ public function prepaymentMail($order, $customer, $prepaymentData, $template = ' */ public function getFormUrl($pm, $bookingMode, $userId, $tempID, $uid=NULL, $basket=NULL, $ppd_crit=NULL, $fromBootstrap=false){ try{ - $ppd_config = Shopware()->Plugins()->Frontend()->HeidelGateway()->ppd_config($bookingMode, $pm, $uid); // $ppd_user = Shopware()->Plugins()->Frontend()->HeidelGateway()->ppd_user(NULL, $pm); if($fromBootstrap){ diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPayment.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPayment.js index 94b84b3..386afb9 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPayment.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPayment.js @@ -11,23 +11,11 @@ document.asyncReady(function () { if (orgLink == 'undefined') { var orglink = jQuery('form[name="shippingPaymentForm"]').attr('action'); } + if ( - (window.location.pathname.toLowerCase().indexOf('shippingpayment') == '-1') - ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') == '-1') + (window.location.pathname.toLowerCase().indexOf('shippingpayment') > '0') + ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') > '0') ) { - // change checked option - jQuery('.register--payment').click(function () { - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - jQuery('.hgw_dd').click(function () { - // change form action - var checkedOpt = "hgw_dd"; - changeUrl(checkedOpt, orgLink); - }); - - } else { var clicked = ''; $(this).click(function (e) { clicked = e.target.className; @@ -35,8 +23,7 @@ document.asyncReady(function () { jQuery('.payment--method-list').click(function () { // change form action var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - + // changeUrl(checkedOpt, orgLink); }); // add validation for form jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); @@ -109,22 +96,37 @@ document.asyncReady(function () { var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function () { // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); if (checkedOpt.indexOf('papg') != '-1') { // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } if (checkedOpt.indexOf('san') != '-1') { // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } }); }); } }); + + + + } else { + + // change checked option + jQuery('.register--payment').click(function () { + // change form action + var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); + // changeUrl(checkedOpt, orgLink); + }); + + // // add validation for form + // jQuery('form#shippingPaymentForm').attr('onSubmit', 'return valShippingPaymentForm();'); } + // case to set or remove required attribute for payolution checkbos var paymentMethod = $('input:radio:checked').attr('class'); if(paymentMethod != undefined) { @@ -264,18 +266,20 @@ document.asyncReady(function () { if (pm.indexOf("hgw_hps") != -1){ var errorsHps = new Array(); errorsHps = valSantanderHP(); - if(errorsHps.length > 0){ + if(errorsHps != undefined) { + if(errorsHps.length > 0){ - jQuery('#payment .alert .alert--content ul li').remove(); + jQuery('#payment .alert .alert--content ul li').remove(); - jQuery('#payment .alert .alert--content ul').append('
    • '+jQuery('.msg_fill').html()+'
    • '); - jQuery.each(errorsHps, function(key, value){ - jQuery('.alert--content ul').append('
    • '+jQuery(value).html()+'
    • '); - }); + jQuery('#payment .alert .alert--content ul').append('
    • '+jQuery('.msg_fill').html()+'
    • '); + jQuery.each(errorsHps, function(key, value){ + jQuery('.alert--content ul').append('
    • '+jQuery(value).html()+'
    • '); + }); - jQuery('.alert').removeClass("is--hidden"); - jQuery('html, body').animate({scrollTop: 0}, 0); - return false; + jQuery('.alert').removeClass("is--hidden"); + jQuery('html, body').animate({scrollTop: 0}, 0); + return false; + } } } } else { @@ -470,8 +474,6 @@ document.asyncReady(function () { var birthMonth = jQuery(".newreg_dd [name = 'DateDD_Month']").val(); var birthYear = jQuery(".newreg_dd [name = 'DateDD_Year']").val(); jQuery('#birthdate_dd').val(birthYear + '-' + birthMonth + '-' + birthDay); - // change form action - changeUrl('hgw_dd', orgLink); }); @@ -640,6 +642,10 @@ function valForm() { errors = valDirectDebitSecured(errors); } + // change Form action + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } @@ -815,6 +821,9 @@ function valShippingPaymentForm() { switch (pm.toLocaleLowerCase()) { case "dd": var errors = valInputDdIban(jQuery('.newreg_' + pm + ' #iban').val(), pm); + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } break; case "papg": diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPaymentDr.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPaymentDr.js index 12b66bd..3dc3c65 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPaymentDr.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js53/valPaymentDr.js @@ -8,24 +8,9 @@ $(document).ready(function(){ // save original form action var orgLink = jQuery('form.payment').attr('action'); if( - (window.location.pathname.toLowerCase().indexOf('shippingpayment') == '-1') - ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') == '-1') + (window.location.pathname.toLowerCase().indexOf('shippingpayment') > '0') + ||(window.location.pathname.toLowerCase().indexOf('zahlungsart-und-versand') > '0') ){ - $(document).reuse(); - // change checked option - jQuery('.register--payment').click(function(){ - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - - jQuery('.payment--method .hgw_dd').click(function(){ - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - - }else{ var clicked = ''; $(this).click(function(e){ clicked = e.target.className; @@ -34,8 +19,7 @@ $(document).ready(function(){ jQuery('.payment--method-list').click(function(){ // change form action var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - + // changeUrl(checkedOpt, orgLink); }); // add validation for form jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); @@ -66,7 +50,7 @@ $(document).ready(function(){ $(document).ajaxComplete(function(event, xhr, settings){ // fix for missing csrf-Token if(swVersion >= '5.2'){ - if ($(" shippingPaymentForm input[name='__csrf_token']").length == 0) { + if ($("#shippingPaymentForm input[name='__csrf_token']").length == 0) { $('.shipping-payment--information').append(''); } } @@ -108,21 +92,29 @@ $(document).ready(function(){ var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function(){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); if(checkedOpt.indexOf('papg') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } if(checkedOpt.indexOf('san') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } }); }); } }); + }else{ + $(document).reuse(); + // change checked option + jQuery('.register--payment').click(function(){ + // change form action + var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); + // changeUrl(checkedOpt, orgLink); + }); } // case to set or remove required attribute for payolution checkbox @@ -266,7 +258,7 @@ $(document).ready(function(){ return false; } // change form action - changeUrl('hgw_dd', orgLink); + // changeUrl('hgw_dd', orgLink); } if (pm.indexOf("hgw_hps") != -1){ @@ -486,7 +478,7 @@ $(document).ready(function(){ jQuery('#birthdate_dd').val(birthYear+'-'+birthMonth+'-'+birthDay); // change form action - changeUrl('hgw_dd', orgLink); + // changeUrl('hgw_dd', orgLink); }); if(jQuery('.newreg_dd')) { @@ -527,17 +519,11 @@ $(document).ready(function(){ jQuery('#birthdate_sanHps').val(birthYear+'-'+birthMonth+'-'+birthDay); } - jQuery('.payment--method input:radio:checked').attr('class').indexOf("hgw_") if(jQuery('.payment--method input:radio:checked').attr('class').indexOf("hgw_")){ jQuery('#shippingPaymentForm').attr('onSubmit', 'return valShippingPaymentForm();'); } - - }); - } - - } // Event before swiching payment method @@ -631,38 +617,6 @@ function hgwToggleReuse (pm) jQuery('.newreg' + pm).toggle(500); } -// CHANGE FORM URL -// function changeUrl(checkedOpt, orgLink) { -// if (checkedOpt != undefined) { -// var prefix = 'hgw_'; -// var checkedOptPos = checkedOpt.indexOf(prefix); -// -// if (checkedOptPos >= 0) { -// var pm = checkedOpt.substr(checkedOptPos + prefix.length); -// -// if (pm == 'pay') { pm = 'va';} -// -// if ((jQuery('.reues_' + pm).length > 0) && !(jQuery('.reues_' + pm).is(':checked'))) { -// var reuse = true; -// } else { -// var reuse = false; -// } -// if (formUrl != null) { -// if ((formUrl[pm] == undefined) || (formUrl[pm] == '') || (reuse) || (pm == 'cc') || (pm == 'dc')) { -// jQuery('form.payment').attr('action', orgLink); -// } else { -// jQuery('form.payment').attr('action', formUrl[pm]); -// } -// } -// } else { -// jQuery('form.payment').attr('action', orgLink); -// } -// } else { -// jQuery('form.payment').attr('action', orgLink); -// } -// -// } - // VALIDATE FORM function valForm() { if (jQuery('.register--payment input:radio:checked').length != 0) { @@ -686,6 +640,7 @@ function valForm() { jQuery(this).removeClass('has--error'); } }); + if (pm == 'dd') { var errors = valInputDdIban(jQuery('.newreg_' + pm + ' #iban').val(), pm); @@ -700,6 +655,9 @@ function valForm() { errors = valDirectDebitSecured(errors); } + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } if (pm == 'papg') { @@ -744,17 +702,13 @@ function valForm() { return false; } else { - // disable all other input fields - // jQuery('.register--payment input').attr('disabled', 'disabled'); - // jQuery('.register--payment select').attr('disabled', 'disabled'); - // jQuery('.register--payment input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); - // jQuery('.register--payment input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); - jQuery('.payment--method .block input').attr('disabled', 'disabled'); jQuery('.payment--method .block select').attr('disabled', 'disabled'); jQuery("input:radio").removeAttr('disabled'); - jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); - jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); + // jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); + // jQuery('.payment--method .block input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); + jQuery('.payment--method input:radio:checked').parents('.payment--method').find('input').removeAttr('disabled'); + jQuery('.payment--method input:radio:checked').parents('.payment--method').find('select').removeAttr('disabled'); } } } @@ -886,6 +840,9 @@ function valShippingPaymentForm() { if (pm == 'dd') { var errors = valInputDdIban(jQuery('.newreg_' + pm + ' #iban').val(), pm); + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } if (pm == 'papg') { @@ -1124,7 +1081,7 @@ function valSantander() { jQuery('.hgw_san select[name="DateSan_Month"]').parent('.js--fancy-select').removeClass('has--error'); jQuery('.hgw_san select[name="DateSan_Month"]').removeClass('has--error'); jQuery('.hgw_san select[name="DateSan_Day"]').parent('.js--fancy-select').removeClass('has--error'); - jQuery('.hgw_san select[name="DateSam_Day"]').removeClass('has--error'); + jQuery('.hgw_san select[name="DateSan_Day"]').removeClass('has--error'); } } else { //birthdate doesn't fit to formate YYYY-MM-DD diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js index 9e115a1..d978997 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPayment.js @@ -127,7 +127,6 @@ document.asyncReady(function () { // changeUrl(checkedOpt, orgLink); // }); } - /* ************************************************ */ // case to set or remove required attribute for payolution checkbos var paymentMethod = $('input:radio:checked').attr('class'); @@ -812,8 +811,6 @@ function valShippingPaymentForm() { if(errors[0] === undefined){ jQuery('form.payment').attr('action', formUrl['dd']); - }if(errors[0] === undefined){ - jQuery('form.payment').attr('action', formUrl['dd']); } break; diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js index c0c5825..c3dc698 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js55/valPaymentDr.js @@ -1,4 +1,3 @@ -// $(document).ready(function(){ $(function() { if(swVersion.substring(0,3) >= '5.2'){ var token = jQuery('input[name="__csrf_token"]').val(); From 6074d5b17016708fa2881da1f677c8dec153eceb Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Fri, 27 Sep 2019 11:25:40 +0200 Subject: [PATCH 07/32] SHOPWARE-447_PaymentMethodChangeToDD * Changed JS for Sw 5.2.x * removed use of changeUrl() * refactored basic functions --- .../frontend/_public/src/js52/valPayment.js | 138 ++++++++++-------- 1 file changed, 79 insertions(+), 59 deletions(-) diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js52/valPayment.js b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js52/valPayment.js index 226ad2d..5de6583 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js52/valPayment.js +++ b/Frontend/HeidelGateway/Views/responsive/frontend/_public/src/js52/valPayment.js @@ -1,6 +1,7 @@ $(document).ready(function(){ // fix for missing csrf-token if(swVersion.substring(0,3) >= '5.2'){ + var token = jQuery('input[name="__csrf_token"]').val(); if (jQuery('input[name="__csrf_token"]').length > 0 && jQuery('input[name="__csrf_token"]').val() != 0) { @@ -10,29 +11,17 @@ $(document).ready(function(){ if(window.location.pathname.indexOf('gateway') == '-1'){ // save original form action var orgLink = jQuery('form.payment').attr('action'); - if(window.location.pathname.toLowerCase().indexOf('shippingpayment') == '-1'){ - $(document).reuse(); - // change checked option - jQuery('.register--payment').click(function(){ - // change form action - var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); - - // add validation for form - jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); - - }else{ - var clicked = ''; + // if(window.location.pathname.toLowerCase().indexOf('shippingpayment') == '-1'){ + if(window.location.pathname.toLowerCase().indexOf('shippingpayment') > '0'){ + var clicked = ''; $(this).click(function(e){ clicked = e.target.className; }); jQuery('.payment--method-list').click(function(){ - // change form action var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); - }); + // add validation for form + jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); // set original form action (before AJAX is sent) $.ajaxSetup({ @@ -126,21 +115,33 @@ $(document).ready(function(){ var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function(){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); if(checkedOpt.indexOf('papg') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } if(checkedOpt.indexOf('san') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } }); }); } }); + }else{ + $(document).reuse(); + // change checked option + jQuery('.register--payment').click(function(){ + // change form action + var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); + // changeUrl(checkedOpt, orgLink); + }); + + // add validation for form + // jQuery('form.payment').attr('onSubmit', 'return valShippingPaymentForm();'); + jQuery('form.payment').attr('onSubmit', 'return valForm();'); } } @@ -431,7 +432,7 @@ $(document).ready(function(){ jQuery('.register--payment').click(function(){ // change form action var checkedOpt = jQuery('.register--payment input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); }else{ var clicked = ''; @@ -442,7 +443,7 @@ $(document).ready(function(){ jQuery('.payment--method-list').click(function(){ // change form action var checkedOpt = jQuery('.payment--method input:radio:checked').attr('class'); - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); @@ -489,21 +490,21 @@ $(document).ready(function(){ var checkedOpt = jQuery('.payment--method-list input:radio:checked').attr('class'); $('input[class*="reues"]:checkbox, input[name*="ACCOUNT"], select[name*="ACCOUNT"], input[name*="CONTACT"]').click(function(){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); }); if(checkedOpt.indexOf('papg') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } if(checkedOpt.indexOf('san') != '-1'){ // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } if (checkedOpt.indexOf('ivpd') != '-1') { // change form action - changeUrl(checkedOpt, orgLink); + // changeUrl(checkedOpt, orgLink); } }); }); @@ -821,38 +822,38 @@ jQuery.fn.reuse = function(){ } // CHANGE FORM URL -function changeUrl(checkedOpt, orgLink){ - if(checkedOpt != undefined){ - var prefix = 'hgw_'; - var checkedOptPos = checkedOpt.indexOf(prefix); - - if(checkedOptPos >= 0){ - var pm = checkedOpt.substr(checkedOptPos+prefix.length); - - if(pm == 'pay'){ pm = 'va'; } - if(pm == 'dd'){ - // $(document).ibanCheck(); - } - if((jQuery('.reues_'+pm).length > 0) && !(jQuery('.reues_'+pm).is(':checked'))){ - var reuse = true; - }else{ - var reuse = false; - } - if(formUrl != null){ - if((formUrl[pm] == undefined) || (formUrl[pm] == '') || (reuse) || (pm == 'cc') || (pm == 'dc')){ - jQuery('form.payment').attr('action', orgLink); - }else{ - jQuery('form.payment').attr('action', formUrl[pm]); - } - } - }else{ - jQuery('form.payment').attr('action', orgLink); - } - }else{ - jQuery('form.payment').attr('action', orgLink); - } - -} +// function changeUrl(checkedOpt, orgLink){ +// if(checkedOpt != undefined){ +// var prefix = 'hgw_'; +// var checkedOptPos = checkedOpt.indexOf(prefix); +// +// if(checkedOptPos >= 0){ +// var pm = checkedOpt.substr(checkedOptPos+prefix.length); +// +// if(pm == 'pay'){ pm = 'va'; } +// if(pm == 'dd'){ +// // $(document).ibanCheck(); +// } +// if((jQuery('.reues_'+pm).length > 0) && !(jQuery('.reues_'+pm).is(':checked'))){ +// var reuse = true; +// }else{ +// var reuse = false; +// } +// if(formUrl != null){ +// if((formUrl[pm] == undefined) || (formUrl[pm] == '') || (reuse) || (pm == 'cc') || (pm == 'dc')){ +// jQuery('form.payment').attr('action', orgLink); +// }else{ +// jQuery('form.payment').attr('action', formUrl[pm]); +// } +// } +// }else{ +// jQuery('form.payment').attr('action', orgLink); +// } +// }else{ +// jQuery('form.payment').attr('action', orgLink); +// } +// +// } // VALIDATE FORM on Responsive-Theme Account site function valForm(){ @@ -890,6 +891,11 @@ function valForm(){ errors = valDirectDebitSecured(errors); } + + // change Form action + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } if(pm == 'papg'){ @@ -1068,7 +1074,21 @@ function valShippingPaymentForm(){ if(pm == 'dd'){ var errors = valInputDdIban(jQuery('.newreg_'+pm+' #iban').val(), pm); - errors = valDirectDebitSecured(errors); + if (jQuery('.newreg_dd #salutation').is(':visible')) { + // getting Values from input fields + var birthDay = jQuery('.newreg_dd select[name=DateDD_Day]').val(); + var birthMonth = jQuery('.newreg_dd select[name=DateDD_Month]').val(); + var birthYear = jQuery('.newreg_dd select[name=DateDD_Year]').val(); + + jQuery('#birthdate_dd').val = birthYear+'-'+birthMonth+'-'+birthDay; + + errors = valDirectDebitSecured(errors); + } + + // change Form action + if(errors[0] === undefined){ + jQuery('form.payment').attr('action', formUrl['dd']); + } } if(pm == 'papg'){ var dob = new Date(jQuery('.hgw_papg select[name="Date_Year"]').val(), jQuery('.hgw_papg select[name="Date_Month"]').val()-1, jQuery('.hgw_papg select[name="Date_Day"]').val()); From e509615a59de98aae6744e6652af5a592268cf1e Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Mon, 30 Sep 2019 10:04:30 +0200 Subject: [PATCH 08/32] SHOPWARE-447_PaymentMethodChangeToDD * Changed JS for Sw 5.2.x and Sw 5.1.6 * removed use of changeUrl() * refactored basic functions --- .../_resources/javascript/valPayment.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Frontend/HeidelGateway/Views/frontend/_resources/javascript/valPayment.js b/Frontend/HeidelGateway/Views/frontend/_resources/javascript/valPayment.js index 2475679..973c019 100644 --- a/Frontend/HeidelGateway/Views/frontend/_resources/javascript/valPayment.js +++ b/Frontend/HeidelGateway/Views/frontend/_resources/javascript/valPayment.js @@ -46,15 +46,15 @@ $(document).ready(function(){ if( (typeof formUrl !== "undefined") && (formUrl != null)){ if((formUrl[pm] == undefined) || (formUrl[pm] == '') || (reuse) || (pm == 'cc') || (pm == 'dc')){ - jQuery('form.payment').attr('action', orgLink); + // jQuery('form.payment').attr('action', orgLink); }else{ - jQuery('form.payment').attr('action', formUrl[pm]); - jQuery('form.frmRegister').attr('action', formUrl[pm]); + // jQuery('form.payment').attr('action', formUrl[pm]); + // jQuery('form.frmRegister').attr('action', formUrl[pm]); } } }else{ - jQuery('form.payment').attr('action', orgLink); + // jQuery('form.payment').attr('action', orgLink); hideForm(); } } @@ -277,7 +277,7 @@ $(document).ready(function(){ jQuery('#birthdate_papg').val(birthyear+'-'+birthmonth+'-'+birthday); var formurlpapg = jQuery('.newreg_papg .formurl').val(); - jQuery('form.payment').attr('action', formurlpapg); + // jQuery('form.payment').attr('action', formurlpapg); }); jQuery('.button-right, .large, .right').click(function(e) { @@ -299,7 +299,7 @@ $(document).ready(function(){ jQuery('#birthdate_san').val(birthyear+'-'+birthmonth+'-'+birthday); var formurlsan = jQuery('.newreg_san .formurl').val(); - jQuery('form.payment').attr('action', formurlsan); + // jQuery('form.payment').attr('action', formurlsan); }); jQuery('.button-right.large.right').click(function(e) { @@ -502,8 +502,14 @@ function valForm(){ jQuery('#birthdate_dd').val = birthYear+'-'+birthMonth+'-'+birthDay; + errors = valDirectDebitSecured(errors); + } + // change Form action + if(errors[0] === undefined){ + jQuery("form.payment").attr('action', formUrl['dd']); + // jQuery(form [name="frmRegister"]).attr('action', formUrl['dd']); } } From 7c03e5465bcd75cafe11cb0bd875913b5762b4ff Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Mon, 30 Sep 2019 16:39:23 +0200 Subject: [PATCH 09/32] SHOPWARE-502_dublicateKeyIdInBillingAddressModel * removed dublicate assignment if key id and set key customerId instead --- Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index 83f662a..4e90411 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -4128,7 +4128,7 @@ public function convertOrder($transactionData, $paymentStatus = 12) // Casting null values to empty strings to fulfill the restrictions of the s_order_billingaddress table $billingAddress = [ 'id' => !empty($customerDbResult[0]['customer']['billing']['id']) ? $customerDbResult[0]['customer']['billing']['id'] : ' ', - 'id' => !empty($customerDbResult[0]['customer']['billing']['customerId']) ? $customerDbResult[0]['customer']['billing']['customerId'] : ' ', + 'customerId' => !empty($customerDbResult[0]['customer']['billing']['customerId']) ? $customerDbResult[0]['customer']['billing']['customerId'] : ' ', 'company' => !empty($customerDbResult[0]['customer']['billing']['company']) ? $customerDbResult[0]['customer']['billing']['company'] : ' ', 'department' => !empty($customerDbResult[0]['customer']['billing']['department']) ? $customerDbResult[0]['customer']['billing']['department'] : ' ', 'title' => !empty($customerDbResult[0]['customer']['billing']['title']) ? $customerDbResult[0]['customer']['billing']['title'] : ' ', From 3c6d2e51f8e5593d35a65b305dbb1585ec9e9171 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 30 Oct 2019 10:41:51 +0100 Subject: [PATCH 10/32] SHOPWARE-538_PushFailure * added a variable to recognise if a dublicate DB-entry was made instead of using exception-object to check --- Frontend/HeidelGateway/Bootstrap.php | 3 +-- Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index 0cd48b3..04da3c2 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -5093,13 +5093,12 @@ public function saveRes($data){ try { Shopware()->Db()->query($sql, $params); } catch (Exception $e) { - // if entry is in db yet do not write again + // if entry is in db yet do not write again if($e->getPrevious()->errorInfo['1'] != '1062'){ Shopware()->Plugins()->Frontend()->HeidelGateway()->Logging('saveRes | '.$e->getMessage()); } return; } - } /** diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index 83f662a..9d7d930 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -2718,10 +2718,12 @@ public function rawnotifyAction(){ $this->hgw()->createTransactionsTable(); try{ + $duplicateEntry = false; $this->hgw()->saveRes($xmlData); }catch(Exception $e){ // message 1062: Duplicate entry '%s' for key %d | https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html if($e->getPrevious()->errorInfo['1'] == '1062'){ + $duplicateEntry = true; // check if PUSH 'result', 'statuscode', 'return' or 'returncode' differ from DB entry and update, if so. $sql = ' SELECT * FROM `s_plugin_hgw_transactions` @@ -2731,7 +2733,6 @@ public function rawnotifyAction(){ $params = array($xmlData['IDENTIFICATION_TRANSACTIONID'], $xmlData['IDENTIFICATION_UNIQUEID']); $data = Shopware()->Db()->fetchRow($sql, $params); - if( ($data['result'] != $xmlData['PROCESSING_RESULT']) || ($data['statuscode'] != $xmlData['PROCESSING_STATUS_CODE']) || @@ -2773,7 +2774,7 @@ public function rawnotifyAction(){ if(!empty($url)){ $this->hgw()->doRequest($xmlData, $url); // send response to shop via POST }else{ - if($e->getPrevious()->errorInfo['1'] != '1062'){ + if(!$duplicateEntry){ $this->hgw()->Logging('rawnotifyAction | response_url missing'); } } @@ -2786,7 +2787,6 @@ public function rawnotifyAction(){ } } } - header('HTTP/1.1 200 OK'); $this->View()->MES = 'OK'; }catch(Exception $e){ From 8c12e16ef01f0d3d2812b8c3c42576539d811ed5 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 30 Oct 2019 10:54:26 +0100 Subject: [PATCH 11/32] SHOPWARE-538_PushFailure * changed Versionnumber and update() --- Frontend/HeidelGateway/Bootstrap.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index 04da3c2..021d3de 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.09.26'; + return '19.10.31'; } /** @@ -993,20 +993,17 @@ public function update($oldVersion){ } catch (Exception $e) { $this->logError($msg,$e); } - + // Compatibility for SW 5.6 + case '19.08.21': // Fix for no additional E-Mail for invoice B2B is sent after an order // Feature setting article in stock in case of an order without session // Fix for redirect after saving registered paymentdata in savePaymentAction - case '19.09.16': - try{ - $msg .= '* update 19.09.16
      '; - } catch (Exception $e) { - $this->logError($msg,$e); - } // Fix for switching to paymentmethod dd with reg - case '19.09.26': + // Fix for a php-fatal exception could be thrown in case of incoming pushes "Call to a member function getPrevious() on null" + case '19.09.16': + case '19.10.31': try{ - $msg .= '* update 19.09.
      '; + $msg .= '* update 19.10.31
      '; } catch (Exception $e) { $this->logError($msg,$e); } From 0a2af5204e2abd99ea210da396f8d018e404b0be Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 30 Oct 2019 15:18:08 +0100 Subject: [PATCH 12/32] SHOPWARE-538_PushFailure * removed typos --- Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index 9d7d930..e57a87f 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -2138,7 +2138,7 @@ public function successAction(){ Shopware()->Session()->sOrderVariables['accountBrand'] = $this->getBrandName($parameters->ACCOUNT_BRAND); break; - case 'iv'; + case 'iv': // setting Comments for frontend and Backend Shopware()->Session()->sOrderVariables['prepaymentText'] = $comment; // Santander saving birthdate @@ -2235,7 +2235,7 @@ public function successAction(){ Shopware()->Session()->sOrderVariables['prepaymentText'] = $comment; - // sendeing Prepayment Email + // sending Prepayment Email if($this->Config()->HGW_PP_MAIL > 0){ $repl = array( '{AMOUNT}' => str_replace(".",",",$parameters->PRESENTATION_AMOUNT), From 8787b5d03b149bfe40e26f787b7442d82eb15593 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Mon, 9 Dec 2019 10:34:14 +0100 Subject: [PATCH 13/32] SHOPWARE-581_BugfixForQaIssues * fixed behavior no paymentmethod was saved after registration of DD --- Frontend/HeidelGateway/Bootstrap.php | 32 ++++++++----------- .../Controllers/Frontend/PaymentHgw.php | 24 ++++++++------ .../frontend/register/hp_payment_ivb2b.tpl | 1 - .../frontend/register/hp_payment.tpl | 9 ++++-- .../frontend/register/hp_payment53_dd.tpl | 2 +- .../frontend/register/hp_payment55.tpl | 1 - .../frontend/register/hp_payment_ivb2b.tpl | 1 - 7 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index 0cd48b3..3476cc4 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.09.26'; + return '19.11.25'; } /** @@ -993,21 +993,25 @@ public function update($oldVersion){ } catch (Exception $e) { $this->logError($msg,$e); } - + // Compatibility for SW 5.6 + case '19.08.21': // Fix for no additional E-Mail for invoice B2B is sent after an order // Feature setting article in stock in case of an order without session // Fix for redirect after saving registered paymentdata in savePaymentAction + // Fix for switching to paymentmethod dd with reg + // Fix for a php-fatal exception could be thrown in case of incoming pushes "Call to a member function getPrevious() on null" case '19.09.16': + case '19.10.31': try{ - $msg .= '* update 19.09.16
      '; + $msg .= '* update 19.10.31
      '; } catch (Exception $e) { $this->logError($msg,$e); } - // Fix for switching to paymentmethod dd with reg - case '19.09.26': + + case '19.11.25': try{ - $msg .= '* update 19.09.
      '; - } catch (Exception $e) { + $msg .= '* update 19.11.25
      '; + } catch (Exception $e){ $this->logError($msg,$e); } @@ -1868,6 +1872,7 @@ public static function onGetControllerPathFrontend(Enlight_Event_EventArgs $args /** * Hook for custom code before document is renderd + * */ public function onBeforeRenderDocument(Enlight_Hook_HookArgs $args){ try{ @@ -2497,16 +2502,6 @@ public function onPostDispatch(Enlight_Event_EventArgs $args){ $view->extendsTemplate('register/hp_checkout_confirmreg.tpl'); break; } -// if( -// ($user['additional']['payment']['name'] == 'hgw_mpa') -//// || -//// ($user['additional']['payment']['name'] == 'hgw_cc') || -//// ($user['additional']['payment']['name'] == 'hgw_dc') || -//// ($user['additional']['payment']['name'] == 'hgw_dd') -// -// ){ // or every other wallet -// $view->extendsTemplate('register/hp_checkout_confirm.tpl'); -// } } if($_SESSION['Shopware']['HPWallet'] == '1'){ @@ -5093,13 +5088,12 @@ public function saveRes($data){ try { Shopware()->Db()->query($sql, $params); } catch (Exception $e) { - // if entry is in db yet do not write again + // if entry is in db yet do not write again if($e->getPrevious()->errorInfo['1'] != '1062'){ Shopware()->Plugins()->Frontend()->HeidelGateway()->Logging('saveRes | '.$e->getMessage()); } return; } - } /** diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index 83f662a..9911e5f 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -148,7 +148,11 @@ public function gatewayAction(){ $shippingHash = $this->createShippingHash($user, $activePayment); $last = mktime(23,59,00,$reg['expMonth']+1,0,$reg['expYear']); // timestamp: last day of registration month - if(!empty($reg) && ($reg['uid'] != '') && ((($reg['expMonth'] == '0') && ($reg['expYear'] == '0')) || ($last > time())) && (($reg['shippingHash'] == $shippingHash) || ($this->Config()->HGW_SHIPPINGHASH == 1))){ + if( + !empty($reg) && ($reg['uid'] != '') && ((($reg['expMonth'] == '0') && ($reg['expYear'] == '0')) || + ($last > time())) && (($reg['shippingHash'] == $shippingHash) || + ($this->Config()->HGW_SHIPPINGHASH == 1)) + ){ $ppd_config = $this->hgw()->ppd_config($this->Config()->$booking, $activePayment, $reg['uid'], true); $ppd_user = $this->hgw()->ppd_user(NULL, $activePayment); @@ -229,7 +233,6 @@ public function gatewayAction(){ $getFormUrl = $this->getFormUrl($activePayment, $this->Config()->$booking, $user['additional']['user']['id'], $tempID, $uid, $basket, $ppd_crit); unset(Shopware()->Session()->HPGateway); - $cardBrands[$activePayment] = json_decode($getFormUrl['CONFIG_BRANDS'], true); $bankCountry[$activePayment] = json_decode($getFormUrl['CONFIG_BANKCOUNTRY'], true); @@ -1297,20 +1300,24 @@ public function responseRegAction() { Shopware()->Session()->$token = $resp['__csrf_token']; $this->Request()->setPost('sTarget',$resp['var_sTarget']); - $registrierteZahlart = $resp['var_Register']; $this->Request()->setPost('register', $registrierteZahlart['payment']); //Fallback case if target is not set if(empty($resp['var_sTarget'])){$resp['var_sTarget'] = 'checkout';} +// print Shopware()->Front()->Router()->assemble(array( +// 'forceSecure' => 1, +// 'controller' => 'PaymentHgw', +// 'action' => 'savePayment', +// 'sRegister' => $registrierteZahlart['payment'], +// 'sTarget' => $resp['var_sTarget'], +// 'txnId' => $resp['IDENTIFICATION_TRANSACTIONID'], +// )); print Shopware()->Front()->Router()->assemble(array( 'forceSecure' => 1, - 'controller' => 'PaymentHgw', - 'action' => 'savePayment', - 'sRegister' => $registrierteZahlart['payment'], - 'sTarget' => $resp['var_sTarget'], - 'txnId' => $resp['IDENTIFICATION_TRANSACTIONID'], + 'controller' => 'checkout', + 'action' => 'confirm', )); return; break; @@ -1662,7 +1669,6 @@ public function savePaymentAction(){ $_SERVER['REQUEST_METHOD'] = 'GET'; $this->Request()->setPost('isPost', 'true'); $transaction = $this->getHgwTransactions($this->Request()->txnId); - $token = json_decode($transaction['jsonresponse']); $tokenNameSession = 'X-CSRF-Token'; diff --git a/Frontend/HeidelGateway/Views/frontend/register/hp_payment_ivb2b.tpl b/Frontend/HeidelGateway/Views/frontend/register/hp_payment_ivb2b.tpl index 840682f..fccf46d 100644 --- a/Frontend/HeidelGateway/Views/frontend/register/hp_payment_ivb2b.tpl +++ b/Frontend/HeidelGateway/Views/frontend/register/hp_payment_ivb2b.tpl @@ -1,5 +1,4 @@ {block name="hp_payment_papg"} - {*{debug}*}
      diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment.tpl b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment.tpl index d825a4e..ce453bf 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment.tpl +++ b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment.tpl @@ -73,7 +73,8 @@ {if $action == 'shippingPayment'} {else} - +{* *} + {/if} {/block} @@ -160,7 +161,11 @@ {if $action == 'shippingPayment'}
      {block name="hp_radio"}{/block} -
      +
      + {elseif isset($useOnePageCheckout)} +
      + {block name="hp_radio"}{/block} +
      {else} {block name="hp_radio"}{/block} {/if} diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment53_dd.tpl b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment53_dd.tpl index bd7efb0..b41b2b0 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment53_dd.tpl +++ b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment53_dd.tpl @@ -49,7 +49,7 @@ {if isset($regData)} {html_select_date|utf8_encode prefix='DateDD_' - time=$birthdateDD.birthdate.formatted + time=$birthdateDD start_year='-10' end_year='-100' reverse_years='true' diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment55.tpl b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment55.tpl index d619627..5c1b05e 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment55.tpl +++ b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment55.tpl @@ -86,7 +86,6 @@ {assign var='pm' value=$payment_mean.name|substr:($bar_at+1)} {if $pm == 'pay'}{assign var='pm' value='va'}{/if} {if $payment_mean.name == "hgw_cc" && $heidel_bm_cc && ($formUrl.$pm != '')} - {include file="{$tPath|substr:1}/Views/responsive/frontend/register/hp_payment53_cc.tpl"} {elseif $payment_mean.name == "hgw_dc" && $heidel_bm_dc && ($formUrl.$pm != '')} {include file="{$tPath|substr:1}/Views/responsive/frontend/register/hp_payment53_dc.tpl"} diff --git a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment_ivb2b.tpl b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment_ivb2b.tpl index 7eeb110..7e3c5b9 100644 --- a/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment_ivb2b.tpl +++ b/Frontend/HeidelGateway/Views/responsive/frontend/register/hp_payment_ivb2b.tpl @@ -1,5 +1,4 @@ {block name="hp_payment_papg"} - {*{debug}*}
      From 6d86ee63b62190c838775440e86f6e5f15f08f98 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Thu, 12 Dec 2019 09:45:48 +0100 Subject: [PATCH 14/32] SHOPWARE-581_BugfixForQaIssues * added a try-catch --- .../Controllers/Frontend/PaymentHgw.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index 9911e5f..f3aef18 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -2536,6 +2536,8 @@ public function getOrderBySession($sessionId){ public function addOrderInfos($transactionID, $params, $status=NULL){ try{ Shopware()->Models()->clear(); + + /** @var Shopware\Models\Order\Order $orderModel */ $orderModel = Shopware() ->Models() ->getRepository('Shopware\Models\Order\Order') @@ -2552,14 +2554,21 @@ public function addOrderInfos($transactionID, $params, $status=NULL){ { $orderModel->setClearedDate(date('d.m.Y H:i:s')); } - // if internalComment is set, read old commment and add time stamp - $alterWert = $orderModel->getInternalComment(); - if(!empty($params['internalcomment'])){ - $params['internalcomment'] = date('d.m.Y H:i:s') . "\n" . $params['internalcomment'] . "\n \n" . $alterWert; - }else{ - $params['internalcomment'] = $alterWert; + + try { + // if internalComment is set, read old commment and add time stamp + $alterWert = $orderModel->getInternalComment(); + if(!empty($params['internalcomment'])){ + $params['internalcomment'] = date('d.m.Y H:i:s') . "\n" . $params['internalcomment'] . "\n \n" . $alterWert; + }else{ + $params['internalcomment'] = $alterWert; + } + } catch (Exception $ex) { + Shopware()->Container()->get('pluginlogger')->error('addOrderInfos failed cannot write order comment | '.$ex->getMessage()); } + + // mapping database -> model $orderMappings = array( 'ordernumber' => 'number', From bfb1322b2d16f7bd7bc3591ebac9f6e20fe12443 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Tue, 17 Dec 2019 13:32:26 +0100 Subject: [PATCH 15/32] SHOPWARE-581_BugfixForQaIssues * changed Versionnumber --- Frontend/HeidelGateway/Bootstrap.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php index 3476cc4..6482109 100644 --- a/Frontend/HeidelGateway/Bootstrap.php +++ b/Frontend/HeidelGateway/Bootstrap.php @@ -28,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone * @return string version number */ public function getVersion(){ - return '19.11.25'; + return '19.12.12'; } /** @@ -1008,9 +1008,9 @@ public function update($oldVersion){ $this->logError($msg,$e); } - case '19.11.25': + case '19.12.12': try{ - $msg .= '* update 19.11.25
      '; + $msg .= '* update 19.12.12
      '; } catch (Exception $e){ $this->logError($msg,$e); } From 1ef4b1a7911114fd49bd1d54b6e5eb4e0d3faa70 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Tue, 14 Jan 2020 10:30:24 +0100 Subject: [PATCH 16/32] SHOPWARE-581_BugfixForQaIssues * activated again Refund and Reversal-Buttons for invoice-payment-method --- .../Controllers/Backend/BackendHgw.php | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php index e14c7c1..b089f9a 100644 --- a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php +++ b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php @@ -120,6 +120,7 @@ public function requestAction(){ $payName = 'ot'; break; case 'bs': + case 'iv': case 'san': case 'ivpd': case 'papg': @@ -274,7 +275,7 @@ public function requestAction(){ $data[$newKey] = $value; unset($data[$key]); } - + $resp = $this->callDoRequest($data); Shopware()->Plugins()->Frontend()->HeidelGateway()->saveRes($resp); @@ -462,6 +463,7 @@ public function getButtons($transactions, $payName, $beLocaleId){ $btns['fi']['name'] = 'Finalize'; $btns['fi']['icon'] = 'fa-truck'; $btns['fi']['active'] = 'false'; + if($this->showButtons){ foreach(array_reverse($transactions) as $key => $value){ if($payName == 'pay'){ $payName = 'va'; } @@ -470,11 +472,12 @@ public function getButtons($transactions, $payName, $beLocaleId){ if($value['TRANSACTION_CHANNEL'] != $this->FrontendConfigHGW()->$payChan){ break; } $payInfo = $this->getPayInfo($value['PAYMENT_CODE'], $beLocaleId); - + if($payName == 'papg'){ $payName = 'iv'; $papg = true; } if($payName == 'ivb2b'){ $payName = 'iv'; $ivb2b = true; } if($payName == 'san'){ $payName = 'iv'; $san = true; } if($payName == 'ivpd'){ $payName = 'iv'; $ivpd = true; } + if($payName == 'iv'){ $payName = 'iv'; $iv = true; } switch($payName){ case 'cc': @@ -520,6 +523,25 @@ public function getButtons($transactions, $payName, $beLocaleId){ break; case 'bs': case 'iv': + if($iv){ + if($payInfo['payType'] == 'pa') { + $btns['rv']['active'] = 'true'; + + $maxRv = $value['PRESENTATION_AMOUNT']; + } + if($payInfo['payType'] == 'rv') { + mail("sascha.pflueger@heidelpay.com","Transaktion",print_r($value,1)); + $btns['rv']['active'] = 'false'; + $maxRv = $value['PRESENTATION_AMOUNT']; + } + + if($payInfo['payType'] == 'rc'){ + $btns['rv']['active'] = 'false'; + $btns['rf']['active'] = 'true'; + if(!isset($maxRf)){ $maxRf = $value['PRESENTATION_AMOUNT']; } + $btns['rf']['trans'][] = $this->storeTrans($value, $payName, $payInfo); + } + } if($ivpd || $san) { if($payInfo['payType'] == 'pa'){ @@ -552,6 +574,7 @@ public function getButtons($transactions, $payName, $beLocaleId){ } } } elseif ($papg || $ivb2b){ +mail("sascha.pflueger@heidelpay.com","Ges. Rech B2C B2B",print_r("",1)); if ($payInfo['payType'] == 'pa') { $btns['rv']['active'] = $btns['fi']['active'] = 'true'; @@ -613,9 +636,10 @@ public function getButtons($transactions, $payName, $beLocaleId){ } else { - $btns['rv']['active'] = $btns['fi']['active'] = 'false'; - $btns['fi']['active'] = 'false'; - $btns['rv']['active'] = 'true'; +//mail("sascha.pflueger@heidelpay.com","ELSE",print_r("",1)); +// $btns['rv']['active'] = $btns['fi']['active'] = 'false'; +// $btns['fi']['active'] = 'false'; +// $btns['rv']['active'] = 'true'; } // if($payInfo['payType'] == 'pa'){ @@ -714,6 +738,7 @@ public function getButtons($transactions, $payName, $beLocaleId){ if($ivb2b) { $payName = 'ivb2b'; $ivb2b = false; } if($san) { $payName = 'san'; $san = false; } if($ivpd) { $payName = 'ivpd'; $ivpd = false; } + if($iv) { $payName = 'iv'; $iv = false; } } $btns['rf']['trans'][0]['maxRf'] = number_format($maxRf, 2,'.',''); From d04e38106d8126bb5ae8d9b49db2db565e602830 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Tue, 14 Jan 2020 10:53:30 +0100 Subject: [PATCH 17/32] SHOPWARE-581_BugfixForQaIssues * removed debugging --- Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php index b089f9a..141d3f7 100644 --- a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php +++ b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php @@ -574,7 +574,6 @@ public function getButtons($transactions, $payName, $beLocaleId){ } } } elseif ($papg || $ivb2b){ -mail("sascha.pflueger@heidelpay.com","Ges. Rech B2C B2B",print_r("",1)); if ($payInfo['payType'] == 'pa') { $btns['rv']['active'] = $btns['fi']['active'] = 'true'; From 66b51acd201dec03fd9cd199edb8cb7270fabc54 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Tue, 14 Jan 2020 10:58:41 +0100 Subject: [PATCH 18/32] SHOPWARE-581_BugfixForQaIssues * removed debugging --- Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php index 141d3f7..48fb25f 100644 --- a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php +++ b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php @@ -530,7 +530,6 @@ public function getButtons($transactions, $payName, $beLocaleId){ $maxRv = $value['PRESENTATION_AMOUNT']; } if($payInfo['payType'] == 'rv') { - mail("sascha.pflueger@heidelpay.com","Transaktion",print_r($value,1)); $btns['rv']['active'] = 'false'; $maxRv = $value['PRESENTATION_AMOUNT']; } From 90645c7ee7cdbd53c0982dbcbcf7ead6ec7500e1 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 15 Jan 2020 13:49:21 +0100 Subject: [PATCH 19/32] SHOPWARE-581_BugfixForQaIssues * some code cleaning --- .../Controllers/Backend/BackendHgw.php | 75 +++++-------------- 1 file changed, 18 insertions(+), 57 deletions(-) diff --git a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php index 48fb25f..baa18f4 100644 --- a/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php +++ b/Frontend/HeidelGateway/Controllers/Backend/BackendHgw.php @@ -446,7 +446,8 @@ public function getButtons($transactions, $payName, $beLocaleId){ $btns['rv']['name'] = 'Reversal'; $btns['rv']['icon'] = 'fa-reply'; $btns['rv']['active'] = 'false'; - if(in_array($payName,["papg","ivb2b"]) /*&& Factoring ist aktiv*/){ + /* && Factoring ist aktiv */ + if(in_array($payName,["papg","ivb2b"])){ $btns['rv1']['name'] = 'Reversal Storno'; $btns['rv1']['icon'] = 'fa-reply'; $btns['rv1']['active'] = 'false'; @@ -472,12 +473,12 @@ public function getButtons($transactions, $payName, $beLocaleId){ if($value['TRANSACTION_CHANNEL'] != $this->FrontendConfigHGW()->$payChan){ break; } $payInfo = $this->getPayInfo($value['PAYMENT_CODE'], $beLocaleId); - + + if($payName == 'iv'){ $payName = 'iv'; $iv = true; } if($payName == 'papg'){ $payName = 'iv'; $papg = true; } if($payName == 'ivb2b'){ $payName = 'iv'; $ivb2b = true; } if($payName == 'san'){ $payName = 'iv'; $san = true; } if($payName == 'ivpd'){ $payName = 'iv'; $ivpd = true; } - if($payName == 'iv'){ $payName = 'iv'; $iv = true; } switch($payName){ case 'cc': @@ -572,7 +573,8 @@ public function getButtons($transactions, $payName, $beLocaleId){ $btns['rv']['active'] = 'true'; } } - } elseif ($papg || $ivb2b){ + } + if ($papg || $ivb2b){ if ($payInfo['payType'] == 'pa') { $btns['rv']['active'] = $btns['fi']['active'] = 'true'; @@ -593,24 +595,28 @@ public function getButtons($transactions, $payName, $beLocaleId){ $maxRv1 = $maxRv2 = $maxRv3 = $value['PRESENTATION_AMOUNT']; unset($btns['rv']); } - } if ( ($payInfo['payType'] == 'fi') && ($value['PROCESSING_RESULT'] == "ACK") ) { - $maxRv = $maxFi = $value['PRESENTATION_AMOUNT']; - $btns['rv']['active'] = 'true'; + $maxRf = $maxFi = $value['PRESENTATION_AMOUNT']; $btns['fi']['active'] = 'false'; -// $btns['rf']['active'] = 'true'; -// if(!isset($maxRf)){ $maxRf = $value['PRESENTATION_AMOUNT']; } + $btns['rv']['active'] = 'false'; } else { $maxRv = $maxFi = $value['PRESENTATION_AMOUNT']; $btns['rv']['active'] = $btns['fi']['active'] = 'true'; } + if ($payInfo['payType'] == 'rv') { + $btns['fi']['active'] = + $btns['rv']['active'] = 'true'; +// $maxRv = $maxFi = $value['PRESENTATION_AMOUNT']; + $maxRv = $maxFi = $btns['fi']['trans']['0']['amount']; + } + if ($payInfo['payType'] == 'rc') { $btns['rv']['active'] = $btns['rv1']['active'] = @@ -625,54 +631,9 @@ public function getButtons($transactions, $payName, $beLocaleId){ $btns['rf']['trans'][] = $this->storeTrans($value, $payName, $payInfo); } - if ($payInfo['payType'] == 'rv') { - $btns['fi']['active'] = - $btns['rv']['active'] = 'true'; -// $maxRv = $maxFi = $value['PRESENTATION_AMOUNT']; - $maxRv = $maxFi = $btns['fi']['trans']['0']['amount']; - } - } - else { -//mail("sascha.pflueger@heidelpay.com","ELSE",print_r("",1)); -// $btns['rv']['active'] = $btns['fi']['active'] = 'false'; -// $btns['fi']['active'] = 'false'; -// $btns['rv']['active'] = 'true'; - } -// if($payInfo['payType'] == 'pa'){ -// $btns['rv']['active'] = $btns['fi']['active'] = 'true'; -// -// $maxRv = $maxFi = $value['PRESENTATION_AMOUNT']; -// $btns['rv']['trans'][] = $btns['fi']['trans'][] = $this->storeTrans($value, $payName, $payInfo); -// } -// if($payInfo['payType'] == 'rc'){ -// $btns['rv']['active'] = $btns['fi']['active'] = 'false'; -// $btns['rf']['active'] = 'true'; -// -// if(!isset($maxRf)){ $maxRf = $value['PRESENTATION_AMOUNT']; } -// $btns['rf']['trans'][] = $this->storeTrans($value, $payName, $payInfo); -// } -// if($payInfo['payType'] == 'fi'){ -// $maxRv = $maxFi = $value['PRESENTATION_AMOUNT']; -// -// if( -// $ivpd -//// || $san -// ){ -// $btns['fi']['active'] = $btns['rv']['active'] ='false'; -// $btns['rf']['active'] = 'true'; -// -// if(!isset($maxRf)){ $maxRf = $value['PRESENTATION_AMOUNT']; } -// $btns['rf']['trans'][] = $this->storeTrans($value, $payName, $payInfo); -// } else { -// $btns['fi']['active'] = 'false'; -// $btns['rv']['active'] = 'true'; -// } - //$btns['rv']['active'] = $btns['fi']['active'] = 'false'; -// $btns['fi']['active'] = 'false'; -// $btns['rv']['active'] = 'true'; -// } + } break; case 'pp': if($payInfo['payType'] == 'pa'){ @@ -722,10 +683,10 @@ public function getButtons($transactions, $payName, $beLocaleId){ $maxRv2 = number_format($maxRv2, 2,'.','') - $value['PRESENTATION_AMOUNT']; $maxRv3 = number_format($maxRv3, 2,'.','') - $value['PRESENTATION_AMOUNT']; } - if($maxCp <= 0){ $btns['cp']['active'] = 'false'; }else{ $btns['cp']['active'] = 'true'; } + if($maxCp <= 0){ $btns['cp']['active'] = 'false'; } //else{ $btns['cp']['active'] = 'true'; } if($maxRf <= 0){ $btns['rf']['active'] = 'false'; } if($maxRv <= 0){ $btns['rv']['active'] = 'false'; } - if($maxRv <= 0){ $btns['rv']['active'] = 'false'; } +// if($maxRv <= 0){ $btns['rv']['active'] = 'false'; } if($maxFi <= 0){ $btns['fi']['active'] = 'false'; } if($maxRv1 <= 0){ $btns['rv1']['active'] = 'false'; } if($maxRv2 <= 0){ $btns['rv2']['active'] = 'false'; } From 19871a9728b40e2c2f9b5ea464afb3387450f248 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 15 Jan 2020 13:50:13 +0100 Subject: [PATCH 20/32] SHOPWARE-581_BugfixForQaIssues * Bugfix for EPS-Connector issues --- Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php index f3aef18..3e803c3 100644 --- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php +++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php @@ -3482,6 +3482,8 @@ public function preparePostData($config = array(), $frontend = array(), $userDat $type = (!array_key_exists('PAYMENT.TYPE',$config)) ? 'PA' : $config['PAYMENT.TYPE']; $params['PAYMENT.CODE'] = "OT.".$type; $params['FRONTEND.ENABLED'] = "true"; + $params['ACCOUNT.COUNTRY'] = "AT"; + // $params['ACCOUNT.BRAND'] = "EPS"; break; /* postfinance */ From 2e4cffc9b38e1d9a7db41a454787fd7cd5a54aa9 Mon Sep 17 00:00:00 2001 From: heidelpay-sp Date: Wed, 15 Jan 2020 13:52:05 +0100 Subject: [PATCH 21/32] SHOPWARE-581_BugfixForQaIssues * added styles inline to use iFrame-For on mobile devices --- Frontend/HeidelGateway/Views/frontend/payment_hgw/gateway.tpl | 2 +- .../HeidelGateway/Views/frontend/register/hp_payment_cc.tpl | 2 +- .../HeidelGateway/Views/frontend/register/hp_payment_dc.tpl | 2 +- .../Views/responsive/frontend/payment_hgw/gateway.tpl | 2 +- .../Views/responsive/frontend/register/hp_payment53_cc.tpl | 2 +- .../Views/responsive/frontend/register/hp_payment53_dc.tpl | 2 +- .../Views/responsive/frontend/register/hp_payment_cc.tpl | 2 +- .../Views/responsive/frontend/register/hp_payment_dc.tpl | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Frontend/HeidelGateway/Views/frontend/payment_hgw/gateway.tpl b/Frontend/HeidelGateway/Views/frontend/payment_hgw/gateway.tpl index cc71f47..a444842 100644 --- a/Frontend/HeidelGateway/Views/frontend/payment_hgw/gateway.tpl +++ b/Frontend/HeidelGateway/Views/frontend/payment_hgw/gateway.tpl @@ -38,7 +38,7 @@ {assign var='formTarget' value='payment_frame'}

      {s name='PaymentHeader' namespace='frontend/payment_heidelpay/gateway'}{/s}

      - + + {/if}
      diff --git a/Frontend/HeidelGateway/Views/frontend/register/hp_payment_dc.tpl b/Frontend/HeidelGateway/Views/frontend/register/hp_payment_dc.tpl index a35d1bd..03948b6 100644 --- a/Frontend/HeidelGateway/Views/frontend/register/hp_payment_dc.tpl +++ b/Frontend/HeidelGateway/Views/frontend/register/hp_payment_dc.tpl @@ -15,7 +15,7 @@