From 96eda66aa63117f7ea12a9d6649cc54495706a5f Mon Sep 17 00:00:00 2001 From: Vincent Boulanger Date: Thu, 30 May 2024 19:21:15 +0200 Subject: [PATCH] MAGE-539: Rename Paydirekt Add two request parameter and config settings --- .../Payone/Core/Helper/Payment/Data.php | 6 ++- .../Core/Model/Config/Payment/Method.php | 43 ++++++++++++++++ .../Model/Config/Payment/Method/Interface.php | 20 ++++++++ .../ApiRequest/Payment/Authorize/Abstract.php | 22 +++++++- ...aydirektSecuredPreorderGuaranteePeriod.php | 50 ++++++++++++++++++ .../Model/System/Config/PaymentMethodCode.php | 4 +- .../Model/System/Config/PaymentMethodType.php | 4 +- app/code/community/Payone/Core/etc/config.xml | 2 +- app/code/community/Payone/Core/etc/system.xml | 35 ++++++++----- .../mysql4-upgrade-5.3.2-5.3.3.php | 51 +++++++++++++++++++ .../payone_core_setup/upgrade-5.3.2-5.3.3.sql | 8 +++ app/locale/de_DE/Payone_Core.csv | 21 +++++--- app/locale/en_US/Payone_Core.csv | 13 ++++- 13 files changed, 249 insertions(+), 30 deletions(-) create mode 100644 app/code/community/Payone/Core/Model/System/Config/PaydirektSecuredPreorderGuaranteePeriod.php create mode 100644 app/code/community/Payone/Core/sql/payone_core_setup/mysql4-upgrade-5.3.2-5.3.3.php create mode 100644 app/code/community/Payone/Core/sql/payone_core_setup/upgrade-5.3.2-5.3.3.sql diff --git a/app/code/community/Payone/Core/Helper/Payment/Data.php b/app/code/community/Payone/Core/Helper/Payment/Data.php index 5c29a3df..d17d6fae 100644 --- a/app/code/community/Payone/Core/Helper/Payment/Data.php +++ b/app/code/community/Payone/Core/Helper/Payment/Data.php @@ -37,7 +37,8 @@ class Payone_Core_Helper_Payment_Data extends Mage_Payment_Helper_Data */ protected $deletedMethodTitles = array( 'payone_masterpass' => 'Masterpass', - 'payone_wallet_paydirekt_express' => 'Paydirekt Express' + 'payone_wallet_paydirekt_express' => 'Paydirekt Express', + 'payone_online_bank_transfer_giropay' => 'Giropay (old)' ); /** @@ -45,7 +46,8 @@ class Payone_Core_Helper_Payment_Data extends Mage_Payment_Helper_Data */ protected $deletedMethodClearingTypes = array( 'masterpass' => 'wlt', - 'wallet_paydirekt_express' => 'Paydirekt Express' + 'wallet_paydirekt_express' => 'Paydirekt Express', + 'online_bank_transfer_giropay' => 'Giropay (old)' ); public function getMethodInstance($code) diff --git a/app/code/community/Payone/Core/Model/Config/Payment/Method.php b/app/code/community/Payone/Core/Model/Config/Payment/Method.php index 43d5353b..5d121e2f 100644 --- a/app/code/community/Payone/Core/Model/Config/Payment/Method.php +++ b/app/code/community/Payone/Core/Model/Config/Payment/Method.php @@ -297,6 +297,17 @@ class Payone_Core_Model_Config_Payment_Method */ protected $wallet_paydirekt_enable_overcapture = 0; + /** + * @var int + * + */ + protected $wallet_paydirekt_enable_secured_preorder = 0; + + /** + * @var int + */ + protected $wallet_paydirekt_secured_preorder_guarantee_period = 0; + /** * @var string */ @@ -1458,6 +1469,38 @@ public function getWalletPaydirektEnableOvercapture() return $this->wallet_paydirekt_enable_overcapture; } + /** + * @param int $wallet_paydirekt_enable_secured_preorder + */ + public function setWalletPaydirektEnableSecuredPreorder($wallet_paydirekt_enable_secured_preorder) + { + $this->wallet_paydirekt_enable_secured_preorder = $wallet_paydirekt_enable_secured_preorder; + } + + /** + * @return int + */ + public function getWalletPaydirektEnableSecuredPreorder() + { + return $this->wallet_paydirekt_enable_secured_preorder; + } + + /** + * @param int $wallet_paydirekt_secured_preorder_guarantee_period + */ + public function setWalletPaydirektSecuredPreorderGuaranteePeriod($wallet_paydirekt_secured_preorder_guarantee_period) + { + $this->wallet_paydirekt_secured_preorder_guarantee_period = $wallet_paydirekt_secured_preorder_guarantee_period; + } + + /** + * @return int + */ + public function getWalletPaydirektEnableSecuredPreorderGuaranteePeriod() + { + return $this->wallet_paydirekt_secured_preorder_guarantee_period; + } + /** * @param string $ratepay_debit_type */ diff --git a/app/code/community/Payone/Core/Model/Config/Payment/Method/Interface.php b/app/code/community/Payone/Core/Model/Config/Payment/Method/Interface.php index dc972c77..94471ae4 100644 --- a/app/code/community/Payone/Core/Model/Config/Payment/Method/Interface.php +++ b/app/code/community/Payone/Core/Model/Config/Payment/Method/Interface.php @@ -575,5 +575,25 @@ public function setCurrencyConvert($currency_convert); * @return bool */ public function getCurrencyConvert(); + + /** + * @param int $wallet_paydirekt_enable_secured_preorder + */ + public function setWalletPaydirektEnableSecuredPreorder($wallet_paydirekt_enable_secured_preorder); + + /** + * @return int + */ + public function getWalletPaydirektEnableSecuredPreorder(); + + /** + * @param int $wallet_paydirekt_secured_preorder_guarantee_period + */ + public function setWalletPaydirektSecuredPreorderGuaranteePeriod($wallet_paydirekt_secured_preorder_guarantee_period); + + /** + * @return int + */ + public function getWalletPaydirektEnableSecuredPreorderGuaranteePeriod(); } diff --git a/app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php b/app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php index deccfa0e..ebdeab49 100644 --- a/app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php +++ b/app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php @@ -90,7 +90,7 @@ public function mapFromPayment(Mage_Sales_Model_Order_Payment $payment) } } - $payment = $this->mapPaymentParameters(); + $payment = $this->mapPaymentParameters($request->getRequest()); // Not every Paymentmethod has an extra Parameter Set if ($payment !== null) { @@ -490,9 +490,10 @@ protected function map3dSecureParameters() } /** + * @param string $requestType * @return Payone_Api_Request_Parameter_Authorization_PaymentMethod_Abstract */ - protected function mapPaymentParameters() + protected function mapPaymentParameters($requestType) { $payment = null; $paymentMethod = $this->getPaymentMethod(); @@ -594,6 +595,23 @@ protected function mapPaymentParameters() ); } + if ($requestType == Payone_Api_Enum_RequestType::PREAUTHORIZATION) { + if ($paymentMethod->getConfig()->getWalletPaydirektEnableSecuredPreorder()) { + $payData->addItem( + new Payone_Api_Request_Parameter_Paydata_DataItem( + array('key' => 'order_secured', 'data' => 'yes') + ) + ); + + $guaranteePeriod = $paymentMethod->getConfig()->getWalletPaydirektEnableSecuredPreorderGuaranteePeriod(); + $payData->addItem( + new Payone_Api_Request_Parameter_Paydata_DataItem( + array('key' => 'preauthorization_validity', 'data' => $guaranteePeriod) + ) + ); + } + } + $payment->setWallettype(Payone_Api_Enum_WalletType::PAYDIREKT); $isRedirect = true; diff --git a/app/code/community/Payone/Core/Model/System/Config/PaydirektSecuredPreorderGuaranteePeriod.php b/app/code/community/Payone/Core/Model/System/Config/PaydirektSecuredPreorderGuaranteePeriod.php new file mode 100644 index 00000000..3648a79c --- /dev/null +++ b/app/code/community/Payone/Core/Model/System/Config/PaydirektSecuredPreorderGuaranteePeriod.php @@ -0,0 +1,50 @@ + - www.noovias.com + * @author Edward Mateja + * @license GNU General Public License (GPL 3) + * @link http://www.votum.com + */ + +/** + * + * @category Payone + * @package Payone_Core_Model + * @subpackage System + * @copyright Copyright (c) 2012 - www.noovias.com + * @license GNU General Public License (GPL 3) + * @link http://www.votum.com + */ +class Payone_Core_Model_System_Config_PaydirektSecuredPreorderGuaranteePeriod extends Payone_Core_Model_System_Config_Abstract +{ + const MIN_DAYS = 1; + const MAX_DAYS = 15; + + /** + * @return array + */ + public function toArray() + { + $options = array(); + for ($d = self::MIN_DAYS ; $d <= self::MAX_DAYS ; $d++) { + $options[$d] = $d; + } + + return $options; + } +} \ No newline at end of file diff --git a/app/code/community/Payone/Core/Model/System/Config/PaymentMethodCode.php b/app/code/community/Payone/Core/Model/System/Config/PaymentMethodCode.php index fe3f7081..3b2ea705 100644 --- a/app/code/community/Payone/Core/Model/System/Config/PaymentMethodCode.php +++ b/app/code/community/Payone/Core/Model/System/Config/PaymentMethodCode.php @@ -100,12 +100,12 @@ public function toArray() self::PAYOLUTIONDEBIT => 'Unzer Lastschrift', self::PAYOLUTIONINSTALLMENT => 'Unzer Ratenkauf', self::PAYMENTGUARANTEEINVOICE => 'Invoice with Payment Guarantee', - self::WALLETPAYDIREKT => 'Paydirekt', + self::WALLETPAYDIREKT => 'Giropay', // self::WALLETPAYDIREKTEXPRESS => 'Paydirekt Express', // MAGE-529 : method removed self::WALLETPAYPALEXPRESS => 'Paypal Express', self::WALLETALIPAY => 'AliPay', self::ONLINEBANKTRANSFERSOFORT => 'Sofortueberweisung', - self::ONLINEBANKTRANSFERGIROPAY => 'Giropay', +// self::ONLINEBANKTRANSFERGIROPAY => 'Giropay', // MAGE-539 : method removed self::ONLINEBANKTRANSFEREPS => 'eps Online Ueberweisung', self::ONLINEBANKTRANSFERIDL => 'Ideal', self::ONLINEBANKTRANSFERPFF => 'PostFinance E-Finance', diff --git a/app/code/community/Payone/Core/Model/System/Config/PaymentMethodType.php b/app/code/community/Payone/Core/Model/System/Config/PaymentMethodType.php index e74dd866..0ad66026 100644 --- a/app/code/community/Payone/Core/Model/System/Config/PaymentMethodType.php +++ b/app/code/community/Payone/Core/Model/System/Config/PaymentMethodType.php @@ -99,12 +99,12 @@ public function toArray() self::PAYOLUTIONDEBIT => 'Unzer Lastschrift', self::PAYOLUTIONINSTALLMENT => 'Unzer Ratenkauf', self::PAYMENTGUARANTEEINVOICE => 'Invoice with Payment Guarantee', - self::WALLETPAYDIREKT => 'Paydirekt', + self::WALLETPAYDIREKT => 'Giropay', // self::WALLETPAYDIREKTEXPRESS => 'Paydirekt Express', // MAGE-529 : method removed self::WALLETPAYPALEXPRESS => 'Paypal Express', self::WALLETALIPAY => 'AliPay', self::ONLINEBANKTRANSFERSOFORT => 'Sofortueberweisung', - self::ONLINEBANKTRANSFERGIROPAY => 'Giropay', +// self::ONLINEBANKTRANSFERGIROPAY => 'Giropay', // MAGE-539 : method removed self::ONLINEBANKTRANSFEREPS => 'eps Online Ueberweisung', self::ONLINEBANKTRANSFERIDL => 'Ideal', self::ONLINEBANKTRANSFERPFF => 'PostFinance E-Finance', diff --git a/app/code/community/Payone/Core/etc/config.xml b/app/code/community/Payone/Core/etc/config.xml index 9519c23d..8ba8e245 100644 --- a/app/code/community/Payone/Core/etc/config.xml +++ b/app/code/community/Payone/Core/etc/config.xml @@ -29,7 +29,7 @@ - 5.3.2 + 5.3.3 diff --git a/app/code/community/Payone/Core/etc/system.xml b/app/code/community/Payone/Core/etc/system.xml index ce6a4d4d..e3243a4a 100644 --- a/app/code/community/Payone/Core/etc/system.xml +++ b/app/code/community/Payone/Core/etc/system.xml @@ -323,15 +323,6 @@ 1 1 - - - payone_core/adminhtml_system_config_form_field_statusMapping - payone_core/system_config_backend_serialized_array - 50 - 1 - 1 - 1 - payone_core/adminhtml_system_config_form_field_statusMapping @@ -405,7 +396,7 @@ 1 - + payone_core/adminhtml_system_config_form_field_statusMapping payone_core/system_config_backend_serialized_array 70 @@ -1516,7 +1507,7 @@ - + text 5 1 @@ -1525,7 +1516,7 @@ - This option can only be used after consulting Paydirekt. + This option can only be used after consulting Giropay. select adminhtml/system_config_source_yesno 300 @@ -1533,6 +1524,26 @@ 1 1 + + + FCPO_HELP_PAYDIREKT_SECURED_PREORDER + select + adminhtml/system_config_source_yesno + 305 + 1 + 1 + 1 + + + + FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD + select + payone_core/system_config_paydirektSecuredPreorderGuaranteePeriod + 310 + 1 + 1 + 1 + diff --git a/app/code/community/Payone/Core/sql/payone_core_setup/mysql4-upgrade-5.3.2-5.3.3.php b/app/code/community/Payone/Core/sql/payone_core_setup/mysql4-upgrade-5.3.2-5.3.3.php new file mode 100644 index 00000000..27ebdfed --- /dev/null +++ b/app/code/community/Payone/Core/sql/payone_core_setup/mysql4-upgrade-5.3.2-5.3.3.php @@ -0,0 +1,51 @@ + - www.votum.de + * @author Edward Mateja + * @license GNU General Public License (GPL 3) + * @link http://www.votum.de + */ +/** @var $this Mage_Core_Model_Resource_Setup */ +/** @var $installer Mage_Core_Model_Resource_Setup */ +$installer = $this; +$installer->startSetup(); +$tablePaymentMethod = $this->getTable('payone_core/config_payment_method'); +/** @var $helper Payone_Core_Helper_Data */ +$helper = Mage::helper('payone_core'); +$useSqlInstaller = $helper->mustUseSqlInstaller(); +if ($useSqlInstaller) { + $sql = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'upgrade-5.3.2-5.3.3.sql'); + $installSqlConfig = array( + '{{payone_config_payment_method}}' => $tablePaymentMethod + ); + $installSql = str_replace(array_keys($installSqlConfig), array_values($installSqlConfig), $sql); + $installer->run($installSql); +} else { + $connection = $installer->getConnection(); + /** Alter table 'payone_config_payment_method' */ + // Update table payone_config_payment_method + $connection->addColumn( + $tablePaymentMethod, 'wallet_paydirekt_enable_secured_preorder', + 'INT(1) COMMENT \'Secured pre-order enabled\'' + ); + $connection->addColumn( + $tablePaymentMethod, 'wallet_paydirekt_secured_preorder_guarantee_period', + 'INT(5) COMMENT \'Guarantee period for secured pre-order\'' + ); +} +$installer->endSetup(); \ No newline at end of file diff --git a/app/code/community/Payone/Core/sql/payone_core_setup/upgrade-5.3.2-5.3.3.sql b/app/code/community/Payone/Core/sql/payone_core_setup/upgrade-5.3.2-5.3.3.sql new file mode 100644 index 00000000..3563511b --- /dev/null +++ b/app/code/community/Payone/Core/sql/payone_core_setup/upgrade-5.3.2-5.3.3.sql @@ -0,0 +1,8 @@ +#----------------------------------------------------------------- +#-- Alter Table payone_config_payment_method +#----------------------------------------------------------------- +ALTER TABLE `{{payone_config_payment_method}}` + ADD `wallet_paydirekt_enable_secured_preorder` INT(1) COMMENT 'Secured pre-order enabled'; + +ALTER TABLE `{{payone_config_payment_method}}` + ADD `wallet_paydirekt_secured_preorder_guarantee_period` INT(5) COMMENT 'Guarantee period for secured pre-order'; \ No newline at end of file diff --git a/app/locale/de_DE/Payone_Core.csv b/app/locale/de_DE/Payone_Core.csv index 0578d416..f9cc6a06 100644 --- a/app/locale/de_DE/Payone_Core.csv +++ b/app/locale/de_DE/Payone_Core.csv @@ -123,11 +123,11 @@ "New Wallet","Wallet" "Add Wallet","Wallet hinzufügen" "Edit Wallet","Wallet bearbeiten" -"New Paydirekt","Wallet Paydirekt" +"New Wallet Paydirekt","Giropay" "New Paydirekt Express","Wallet Paydirekt Express" -"Add Paydirekt","Wallet Paydirekt hinzufügen" +"Add Wallet Paydirekt","Giropay hinzufügen" "Add Paydirekt Express","Wallet Paydirekt Express hinzufügen" -"Edit Paydirekt","Wallet Paydirekt bearbeiten" +"Edit Wallet Paydirekt","Giropay bearbeiten" "Edit Paydirekt Express","Wallet Paydirekt Express bearbeiten" "New Paypal Express","Wallet Paypal Express" "Add Paypal Express","Wallet Paypal Express hinzufügen" @@ -435,7 +435,7 @@ CREDITCARD_INVALID_OWNER_ERROR_MESSAGE, "Der Name des Kreditkarteninhabers ist u ">>>SDK TRANSLATIONS<<<",">>>SDK TRANSLATIONS<<<" "PAYPAL_EXPRESS","Paypal Express" -"PAYDIREKT","Paydirekt" +"PAYDIREKT","Giropay" "PAYDIREKT_EXPRESS","Paydirekt Express" "YES","Ja" @@ -551,7 +551,7 @@ DIRECT_DEBIT,Lastschrift "ONLINEBANKTRANSFERGIROPAY","Giropay" "CASHONDELIVERY","Nachnahme" "WALLET","Wallet" -"WALLETPAYDIREKT", "Paydirekt" +"WALLETPAYDIREKT", "Giropay" "WALLETPAYDIREKTEXPRESS","Paydirekt Express" "WALLETPAYPALEXPRESS", "Paypal Express" "WALLETALIPAY", "AliPay" @@ -860,8 +860,8 @@ DIRECT_DEBIT,Lastschrift "Activate Overcapture","Overcapture zulassen" "When set to yes, this option allows the overcapture mechanism.","Wenn sie auf Ja gesetzt ist, erlaubt diese Option den Overcapture Mechanismus." -"This option can only be used after consulting Paydirekt.","Diese Option kann nur nach Rücksprache mit Paydirekt verwendet werden." -"Warning: This option can only be used after consulting Paydirekt.","Warning: Diese Option kann nur nach Rücksprache mit Paydirekt verwendet werden." +"This option can only be used after consulting Giropay.","Diese Option kann nur nach Rücksprache mit Giropay verwendet werden." +"Warning: This option can only be used after consulting Giropay.","Warning: Diese Option kann nur nach Rücksprache mit Giropay verwendet werden." "TEMPLATE","/app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/protect/addresscheck.phtml" "Here you can activate address validation with the following configuration options.","Hier aktivieren Sie die Prüfung der Adresse mit allen folgenden Konfigurationsmöglichkeiten." @@ -1334,4 +1334,9 @@ Das kleinere Textfeld wird verwendet, um die Zieldatei oder den Pfad zu einer vo "APPLEPAY_CREATE_SESSION_ERROR", "Fehler beim Herstellen der Verbindung zum Apple Pay Service." "APPLEPAY_MAKE_PAYMENT_ERROR", "Fehler beim Ausführen der Zahlungstransaktion." -"APPLEPAY_CREATE_SESSION_ERROR_CARDS", "In der Konfiguration ist kein gültiger Kreditkartentyp zulässig. Die Apple Pay-Sitzung kann nicht initialisiert werden." \ No newline at end of file +"APPLEPAY_CREATE_SESSION_ERROR_CARDS", "In der Konfiguration ist kein gültiger Kreditkartentyp zulässig. Die Apple Pay-Sitzung kann nicht initialisiert werden." + +"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_GUARANTEE_PERIOD", "Garantiezeitraum" +"FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD", "Gewünschter Garantiezeitraum (maximal 15 Kalendertage) für eine gesicherte Vorbestellung" \ No newline at end of file diff --git a/app/locale/en_US/Payone_Core.csv b/app/locale/en_US/Payone_Core.csv index 12851d7e..50c3013c 100644 --- a/app/locale/en_US/Payone_Core.csv +++ b/app/locale/en_US/Payone_Core.csv @@ -101,4 +101,15 @@ The smaller text field is used to name the destination file, or path to an exist "APPLEPAY_CREATE_SESSION_ERROR", "Error while establishing connection to Apple Pay service." "APPLEPAY_MAKE_PAYMENT_ERROR", "Error while operating the payment transaction." -"APPLEPAY_CREATE_SESSION_ERROR_CARDS", "No valid credit cards type is allowed in the configuration. Apple Pay session cannot be initialized." \ No newline at end of file +"APPLEPAY_CREATE_SESSION_ERROR_CARDS", "No valid credit cards type is allowed in the configuration. Apple Pay session cannot be initialized." + +"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_GUARANTEE_PERIOD", "Guarantee period" +"FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD", "Desired guarantee period (maximum 15 calendar days) for a secured pre-order" + +"PAYDIREKT", "Giropay" +"WALLETPAYDIREKT", "Giropay" +"New Wallet Paydirekt","Giropay" +"Add Wallet Paydirekt","Add Giropay" +"Edit Wallet Paydirekt","Edit Giropay" \ No newline at end of file