From cb4218c1848e36977e09c77f6c715bd7fe60c523 Mon Sep 17 00:00:00 2001 From: Vincent Boulanger Date: Fri, 23 Feb 2024 15:28:52 +0100 Subject: [PATCH 1/2] OX6-157: Rename Giropay and add two request parameter with config options --- application/translations/de/fcPayOne_lang.php | 2 +- application/translations/en/fcPayOne_lang.php | 2 +- application/views/admin/de/fcPayOne_lang.php | 9 +++- application/views/admin/en/fcPayOne_lang.php | 9 +++- application/views/admin/tpl/fcpayone_main.tpl | 42 +++++++++++++++++++ core/fcpayone_events.php | 10 +++-- lib/fcporequest.php | 12 +++++- out/src/js/fcpayone_main.js | 8 ++++ 8 files changed, 85 insertions(+), 9 deletions(-) diff --git a/application/translations/de/fcPayOne_lang.php b/application/translations/de/fcPayOne_lang.php index a28819dd..76b7035c 100755 --- a/application/translations/de/fcPayOne_lang.php +++ b/application/translations/de/fcPayOne_lang.php @@ -254,7 +254,7 @@ 'PAYONE Kreditkarte' => 'PAYONE Kreditkarte', 'PAYONE Lastschrift' => 'PAYONE Lastschrift', 'PAYONE Nachnahme' => 'PAYONE Nachnahme', - 'PAYONE paydirekt' => 'PAYONE paydirekt', + 'PAYONE paydirekt' => 'PAYONE Giropay', 'PAYONE PayPal Express' => 'PAYONE PayPal Express', 'PAYONE PayPal' => 'PAYONE PayPal', 'PAYONE PostFinance Card' => 'PAYONE PostFinance Card', diff --git a/application/translations/en/fcPayOne_lang.php b/application/translations/en/fcPayOne_lang.php index 05267d79..2ba7ad7a 100755 --- a/application/translations/en/fcPayOne_lang.php +++ b/application/translations/en/fcPayOne_lang.php @@ -265,7 +265,7 @@ 'PAYONE Kreditkarte' => 'PAYONE Credit Card', 'PAYONE Lastschrift' => 'PAYONE Direct Debit', 'PAYONE Nachnahme' => 'PAYONE Cash on Delivery', -'PAYONE paydirekt' => 'PAYONE paydirekt', +'PAYONE paydirekt' => 'PAYONE Giropay', 'PAYONE PayPal Express' => 'PAYONE PayPal Express', 'PAYONE PayPal' => 'PAYONE PayPal', 'PAYONE PostFinance Card' => 'PAYONE PostFinance Card', diff --git a/application/views/admin/de/fcPayOne_lang.php b/application/views/admin/de/fcPayOne_lang.php index eba32a9f..c69ad7b2 100755 --- a/application/views/admin/de/fcPayOne_lang.php +++ b/application/views/admin/de/fcPayOne_lang.php @@ -387,6 +387,13 @@ 'FCPO_BNPL_CANCELLATION_REASON_DUP' => 'Die Bestellung wurde versehentlich zweimal erstellt', 'FCPO_BNPL_CANCELLATION_REASON_FRD' => 'Der Verbraucher entpuppte sich als Betrüger', 'FCPO_BNPL_CANCELLATION_REASON_UND' => 'Der Händler kann die Bestellung nicht ausführen', + 'FCPO_CONFIG_GROUP_PAYDIREKT' => 'Giropay', + 'FCPO_PAYDIREKT_SECURED_PREORDER' => 'Secured pre-order', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER' => 'In the case of a secured pre-order, the retailer is granted a payment guarantee for the selected period (maximum 15 calendar days). Captures (partial payments) must always be executed within the guarantee period.', + 'FCPO_PAYDIREKT_SECURED_PREORDER_YES' => 'Yes', + 'FCPO_PAYDIREKT_SECURED_PREORDER_NO' => 'No', + 'FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Guarantee period', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Desired guarantee period (maximum 15 calendar days) for a secured pre-order (ORDER_SECURED).', 'FCPO_GROUP_LOGGING' => 'Protokollierung', 'FCPO_TRANSACTIONREDIRECTLOGGING_NONE' => 'Keine Protokollierung (Standard)', 'FCPO_TRANSACTIONREDIRECTLOGGING_ALL' => 'Alles protokollieren', @@ -460,7 +467,7 @@ 'PAYONE Kreditkarte' => 'PAYONE Kreditkarte', 'PAYONE Lastschrift' => 'PAYONE Lastschrift', 'PAYONE Nachnahme' => 'PAYONE Nachnahme', - 'PAYONE paydirekt' => 'PAYONE paydirekt', + 'PAYONE paydirekt' => 'PAYONE Giropay', 'PAYONE PayPal Express' => 'PAYONE PayPal Express', 'PAYONE PayPal' => 'PAYONE PayPal', 'PAYONE PostFinance Card' => 'PAYONE PostFinance Card', diff --git a/application/views/admin/en/fcPayOne_lang.php b/application/views/admin/en/fcPayOne_lang.php index 32729888..8d0a0ad0 100644 --- a/application/views/admin/en/fcPayOne_lang.php +++ b/application/views/admin/en/fcPayOne_lang.php @@ -396,6 +396,13 @@ 'FCPO_BNPL_CANCELLATION_REASON_DUP' => 'The Order was created twice accidentally', 'FCPO_BNPL_CANCELLATION_REASON_FRD' => 'Consumer turned out to be a fraudster', 'FCPO_BNPL_CANCELLATION_REASON_UND' => 'The merchant cannot fulfill the Order', + 'FCPO_CONFIG_GROUP_PAYDIREKT' => 'Giropay', + 'FCPO_PAYDIREKT_SECURED_PREORDER' => 'Secured pre-order', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER' => 'In the case of a secured pre-order, the retailer is granted a payment guarantee for the selected period (maximum 15 calendar days). Captures (partial payments) must always be executed within the guarantee period.', + 'FCPO_PAYDIREKT_SECURED_PREORDER_YES' => 'Yes', + 'FCPO_PAYDIREKT_SECURED_PREORDER_NO' => 'No', + 'FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Guarantee period', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Desired guarantee period (maximum 15 calendar days) for a secured pre-order (ORDER_SECURED).', 'FCPO_GROUP_LOGGING' => 'Logging', 'FCPO_TRANSACTIONREDIRECTLOGGING_NONE' => 'No logs (Default)', 'FCPO_TRANSACTIONREDIRECTLOGGING_ALL' => 'Log everything', @@ -469,7 +476,7 @@ 'PAYONE Kreditkarte' => 'PAYONE Credit Card', 'PAYONE Lastschrift' => 'PAYONE Direct Debit', 'PAYONE Nachnahme' => 'PAYONE Cash on Delivery', - 'PAYONE paydirekt' => 'PAYONE paydirekt', + 'PAYONE paydirekt' => 'PAYONE Giropay', 'PAYONE PayPal Express' => 'PAYONE PayPal Express', 'PAYONE PayPal' => 'PAYONE PayPal', 'PAYONE PostFinance Card' => 'PAYONE PostFinance Card', diff --git a/application/views/admin/tpl/fcpayone_main.tpl b/application/views/admin/tpl/fcpayone_main.tpl index 6c2f37a4..c4db21b0 100755 --- a/application/views/admin/tpl/fcpayone_main.tpl +++ b/application/views/admin/tpl/fcpayone_main.tpl @@ -900,6 +900,48 @@ +
+
+ [{oxmultilang ident="FCPO_CONFIG_GROUP_PAYDIREKT"}] +
+
+ + [{oxinputhelp ident="FCPO_HELP_PAYDIREKT_SECURED_PREORDER"}] +
+
+ [{oxmultilang ident="FCPO_PAYDIREKT_SECURED_PREORDER"}] +
+
+
+ +
+
+
+ + [{oxinputhelp ident="FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD"}] +
+
+ [{oxmultilang ident="FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD"}] +
+
+
+
+
+
+
[{oxmultilang ident="FCPO_FORWARD_REDIRECTS"}] diff --git a/core/fcpayone_events.php b/core/fcpayone_events.php index ac928bc5..822dc551 100755 --- a/core/fcpayone_events.php +++ b/core/fcpayone_events.php @@ -47,7 +47,8 @@ class fcpayone_events 'fcpobillsafe', 'fcpoonlineueberweisung', 'fcpoklarna', - 'fcpopaydirekt_express' + 'fcpopaydirekt_express', + 'fcpo_giropay' ); /** @@ -414,7 +415,7 @@ class fcpayone_events 'fcpoklarna_installments' => 'PAYONE Klarna Ratenkauf', 'fcpoklarna_directdebit' => 'PAYONE Klarna Sofort bezahlen', 'fcpobarzahlen' => 'PAYONE Barzahlen', - 'fcpopaydirekt' => 'PAYONE paydirekt', + 'fcpopaydirekt' => 'PAYONE Giropay', 'fcpopo_bill' => 'PAYONE Unzer Rechnungskauf', 'fcpopo_debitnote' => 'PAYONE Unzer Lastschrift', 'fcpopo_installment' => 'PAYONE Unzer Ratenkauf', @@ -422,7 +423,6 @@ class fcpayone_events 'fcpoamazonpay' => 'PAYONE Amazon Pay', 'fcpo_secinvoice' => 'PAYONE Gesicherter Rechnungskauf', 'fcpo_sofort' => 'PAYONE Sofort Überweisung', - 'fcpo_giropay' => 'PAYONE Giropay', 'fcpo_eps' => 'PAYONE eps Überweisung', 'fcpo_pf_finance' => 'PAYONE PostFinance E-Finance', 'fcpo_pf_card' => 'PAYONE PostFinance Card', @@ -1022,6 +1022,10 @@ public static function setDefaultConfigValues() if (!$oConfig->getConfigParam('sFCPOAddresscheck')) { $oConfig->saveShopConfVar('str', 'sFCPOAddresscheck', 'NO'); } + + if (is_null($oConfig->getConfigParam('blFCPOPaydirektSecuredPreorder'))) { + $oConfig->saveShopConfVar('bool', 'blFCPOPaydirektSecuredPreorder', false); + } } /** diff --git a/lib/fcporequest.php b/lib/fcporequest.php index 33583d60..1b65ca41 100755 --- a/lib/fcporequest.php +++ b/lib/fcporequest.php @@ -321,7 +321,7 @@ protected function setAuthorizationParameters($oOrder, $oUser, $aDynvalue, $sRef } } - $blPaymentTypeKnown = $this->setPaymentParameters($oOrder, $aDynvalue, $sRefNr); + $blPaymentTypeKnown = $this->setPaymentParameters($oOrder, $aDynvalue, $sRefNr, $blIsPreauthorization); $blAddProductInfo = $oOrder->isDetailedProductInfoNeeded(); @@ -465,7 +465,7 @@ protected function _fcpoGetKlarnaFinancingType($sPaymentId) * * @return bool */ - protected function setPaymentParameters($oOrder, $aDynvalue, $sRefNr) + protected function setPaymentParameters($oOrder, $aDynvalue, $sRefNr, $blIsPreauthorization = false) { $blAddRedirectUrls = false; $oConfig = $this->getConfig(); @@ -553,6 +553,14 @@ protected function setPaymentParameters($oOrder, $aDynvalue, $sRefNr) $this->addParameter('add_paydata[over_capture]','yes'); } } + $blIsSecuredPreorder = $blIsPreauthorization + && $oConfig->getConfigParam('blFCPOPaydirektSecuredPreorder'); + if ($blIsSecuredPreorder) { + $iPaydirektGuaranteePeriod = (int) $oConfig->getConfigParam('sFCPOPaydirektSecuredPreorderGuaranteePeriod'); + $this->addParameter('add_paydata[order_secured]', 'yes'); + $this->addParameter('add_paydata[preauthorization_validity]', $iPaydirektGuaranteePeriod); + } + $blAddRedirectUrls = true; break; case 'fcpopo_bill': diff --git a/out/src/js/fcpayone_main.js b/out/src/js/fcpayone_main.js index 85dca1b9..ccadb828 100644 --- a/out/src/js/fcpayone_main.js +++ b/out/src/js/fcpayone_main.js @@ -69,4 +69,12 @@ function fcpoHandleCss(oSelect, sRowName) { } else { fcpoInputDisable('input_css_' + sRowName); } +} + +function fcpoTogglePaydirektGuaranteePeriod(oSelect, sFieldId) { + if (oSelect.options[oSelect.selectedIndex].value === 'true') { + document.getElementById(sFieldId).style.display = 'block'; + } else { + document.getElementById(sFieldId).style.display = 'none'; + } } \ No newline at end of file From 709547ce47d1448eabab3bd75ceb5d5a3edfdd6e Mon Sep 17 00:00:00 2001 From: Vincent Boulanger Date: Wed, 20 Mar 2024 11:59:41 +0100 Subject: [PATCH 2/2] OX6-157: Fix translations --- application/views/admin/de/fcPayOne_lang.php | 12 ++++++------ application/views/admin/en/fcPayOne_lang.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/views/admin/de/fcPayOne_lang.php b/application/views/admin/de/fcPayOne_lang.php index c69ad7b2..0f07fabb 100755 --- a/application/views/admin/de/fcPayOne_lang.php +++ b/application/views/admin/de/fcPayOne_lang.php @@ -388,12 +388,12 @@ 'FCPO_BNPL_CANCELLATION_REASON_FRD' => 'Der Verbraucher entpuppte sich als Betrüger', 'FCPO_BNPL_CANCELLATION_REASON_UND' => 'Der Händler kann die Bestellung nicht ausführen', 'FCPO_CONFIG_GROUP_PAYDIREKT' => 'Giropay', - 'FCPO_PAYDIREKT_SECURED_PREORDER' => 'Secured pre-order', - 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER' => 'In the case of a secured pre-order, the retailer is granted a payment guarantee for the selected period (maximum 15 calendar days). Captures (partial payments) must always be executed within the guarantee period.', - 'FCPO_PAYDIREKT_SECURED_PREORDER_YES' => 'Yes', - 'FCPO_PAYDIREKT_SECURED_PREORDER_NO' => 'No', - 'FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Guarantee period', - 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Desired guarantee period (maximum 15 calendar days) for a secured pre-order (ORDER_SECURED).', + 'FCPO_PAYDIREKT_SECURED_PREORDER' => 'Gesicherte Vorbestellung', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER' => 'Bei einer gesicherten Vorbestellung wird dem Händler eine Zahlungsgarantie für den gewählten Zeitraum (maximal 15 Kalendertage) gewährt. Captures (Teilzahlungen) müssen immer innerhalb des Garantiezeitraums ausgeführt werden.', + 'FCPO_PAYDIREKT_SECURED_PREORDER_YES' => 'Ja', + 'FCPO_PAYDIREKT_SECURED_PREORDER_NO' => 'Nein', + 'FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Garantiezeitraum', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Gewünschter Garantiezeitraum (maximal 15 Kalendertage) für eine gesicherte Vorbestellung', 'FCPO_GROUP_LOGGING' => 'Protokollierung', 'FCPO_TRANSACTIONREDIRECTLOGGING_NONE' => 'Keine Protokollierung (Standard)', 'FCPO_TRANSACTIONREDIRECTLOGGING_ALL' => 'Alles protokollieren', diff --git a/application/views/admin/en/fcPayOne_lang.php b/application/views/admin/en/fcPayOne_lang.php index 8d0a0ad0..94fe6011 100644 --- a/application/views/admin/en/fcPayOne_lang.php +++ b/application/views/admin/en/fcPayOne_lang.php @@ -402,7 +402,7 @@ 'FCPO_PAYDIREKT_SECURED_PREORDER_YES' => 'Yes', 'FCPO_PAYDIREKT_SECURED_PREORDER_NO' => 'No', 'FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Guarantee period', - 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Desired guarantee period (maximum 15 calendar days) for a secured pre-order (ORDER_SECURED).', + 'FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD' => 'Desired guarantee period (maximum 15 calendar days) for a secured pre-order', 'FCPO_GROUP_LOGGING' => 'Logging', 'FCPO_TRANSACTIONREDIRECTLOGGING_NONE' => 'No logs (Default)', 'FCPO_TRANSACTIONREDIRECTLOGGING_ALL' => 'Log everything',