Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAGE-539: Rename Paydirekt #497

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/code/community/Payone/Core/Helper/Payment/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ 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)'
);

/**
* @var array
*/
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)
Expand Down
43 changes: 43 additions & 0 deletions app/code/community/Payone/Core/Model/Config/Payment/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
*
* NOTICE OF LICENSE
*
* This source file is subject to the GNU General Public License (GPL 3)
* that is bundled with this package in the file LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
* versions in the future. If you wish to customize Payone_Core for your
* needs please refer to http://www.payone.de for more information.
*
* @category Payone
* @package Payone_Core_Model
* @subpackage System
* @copyright Copyright (c) 2012 <info@votum.com> - www.noovias.com
* @author Edward Mateja <edward.mateja@votum.com>
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link http://www.votum.com
*/

/**
*
* @category Payone
* @package Payone_Core_Model
* @subpackage System
* @copyright Copyright (c) 2012 <info@votum.com> - www.noovias.com
* @license <http://www.gnu.org/licenses/> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Payone/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<config>
<modules>
<Payone_Core>
<version>5.3.2</version>
<version>5.3.3</version>
</Payone_Core>
</modules>

Expand Down
35 changes: 23 additions & 12 deletions app/code/community/Payone/Core/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,6 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</online_bank_transfer_sofortueberweisung>
<online_bank_transfer_giropay translate="label">
<label>Giropay</label>
<frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
<backend_model>payone_core/system_config_backend_serialized_array</backend_model>
<sort_order>50</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</online_bank_transfer_giropay>
<online_bank_transfer_eps translate="label">
<label>eps Online Ueberweisung</label>
<frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
Expand Down Expand Up @@ -405,7 +396,7 @@
<show_in_store>1</show_in_store>
</wallet>
<wallet_paydirekt translate="label">
<label>Wallet Paydirekt</label>
<label>Giropay</label>
<frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
<backend_model>payone_core/system_config_backend_serialized_array</backend_model>
<sort_order>70</sort_order>
Expand Down Expand Up @@ -1516,7 +1507,7 @@
</fields>
</template_wallet>
<template_wallet_paydirekt translate="label" module="payone_core">
<label>Paydirekt</label>
<label>Giropay</label>
<frontend_type>text</frontend_type>
<sort_order>5</sort_order>
<show_in_default>1</show_in_default>
Expand All @@ -1525,14 +1516,34 @@
<fields>
<wallet_paydirekt_enable_overcapture translate="label,comment">
<label>Activate Overcapture</label>
<comment>This option can only be used after consulting Paydirekt.</comment>
<comment>This option can only be used after consulting Giropay.</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>300</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</wallet_paydirekt_enable_overcapture>
<wallet_paydirekt_enable_secured_preorder translate="label,comment">
<label>FCPO_PAYDIREKT_SECURED_PREORDER</label>
<comment>FCPO_HELP_PAYDIREKT_SECURED_PREORDER</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>305</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</wallet_paydirekt_enable_secured_preorder>
<wallet_paydirekt_secured_preorder_guarantee_period translate="label,comment">
<label>FCPO_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD</label>
<comment>FCPO_HELP_PAYDIREKT_SECURED_PREORDER_GUARANTEE_PERIOD</comment>
<frontend_type>select</frontend_type>
<source_model>payone_core/system_config_paydirektSecuredPreorderGuaranteePeriod</source_model>
<sort_order>310</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</wallet_paydirekt_secured_preorder_guarantee_period>
</fields>
</template_wallet_paydirekt>
<template_wallet_paypal_express translate="label" module="payone_core">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
*
* NOTICE OF LICENSE
*
* This source file is subject to the GNU General Public License (GPL 3)
* that is bundled with this package in the file LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
* versions in the future. If you wish to customize Payone_Core for your
* needs please refer to http://www.payone.de for more information.
*
* @category Payone
* @package Payone_Core
* @subpackage sql
* @copyright Copyright (c) 2013 <info@votum.de> - www.votum.de
* @author Edward Mateja <edward.mateja@votum.de>
* @license <http://www.gnu.org/licenses/> 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();
Original file line number Diff line number Diff line change
@@ -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';
Loading
Loading