Skip to content

Commit

Permalink
Merge branch 'master' into MAGE-505-Fix_Paydirekt_Shipping_VAT
Browse files Browse the repository at this point in the history
  • Loading branch information
BoulangerV committed Nov 20, 2020
2 parents 871a033 + d7c7b0d commit 34c5a44
Show file tree
Hide file tree
Showing 13 changed files with 265 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function walletTypeMapping()
Payone_Core_Model_System_Config_PaymentMethodCode::WALLETPAYDIREKT => Payone_Api_Enum_WalletType::PAYDIREKT,
Payone_Core_Model_System_Config_PaymentMethodCode::WALLETPAYDIREKTEXPRESS => Payone_Api_Enum_WalletType::PAYDIREKTEXPRESS,
Payone_Core_Model_System_Config_PaymentMethodCode::WALLETPAYPALEXPRESS => Payone_Api_Enum_WalletType::PAYPAL_EXPRESS,
Payone_Core_Model_System_Config_PaymentMethodCode::WALLETALIPAY => Payone_Api_Enum_WalletType::ALIPAY
Payone_Core_Model_System_Config_PaymentMethodCode::WALLETALIPAY => Payone_Api_Enum_WalletType::ALIPAY,
Payone_Core_Model_System_Config_PaymentMethodCode::WALLETWECHATPAY => Payone_Api_Enum_WalletType::WECHATPAY
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ class Payone_Core_Model_Config_General_StatusMapping extends Payone_Core_Model_C
* @var null
*/
protected $onlineBankTransferTrustly = null;
/**
* Payment method wallet_wechatpay
*
* @var null
*/
protected $walletWeChatPay = null;

/**
* @param array $data
Expand Down Expand Up @@ -966,4 +972,21 @@ public function getOnlineBankTransferTrustly()
{
return $this->onlineBankTransferTrustly;
}

/**
* @param $walletWeChatPay
*/
public function setWalletWeChatPay($walletWeChatPay)
{
$this->walletWeChatPay = $walletWeChatPay;
}

/**
* @return $walletWeChatPay
*/
public function getWalletWeChatPay()
{
return $this->walletWeChatPay;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ protected function updateOrder(Mage_Sales_Model_Order $order)
$this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_WalletPaydirekt ||
$this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_WalletPaydirektExpress ||
$this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_WalletPaypalExpress ||
$this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_WalletAliPay
$this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_WalletAliPay ||
$this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_WalletWeChatPay
) {
$order->setData('payone_payment_method_type', $this->getPayment()->getData('payone_wallet_type'));
} elseif (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,17 @@ protected function mapPaymentParameters()
$payment->setWallettype(Payone_Api_Enum_WalletType::ALIPAY);
$isRedirect = true;
}
//Wallet WeChatPay
elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_WalletWeChatPay) {
$payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_WalletWeChatPay();

$payment->setWallettype(Payone_Api_Enum_WalletType::WECHATPAY);

$businessRelation = !empty($this->getOrder()->getBillingAddress()->getCompany()) ? 'b2b' : 'b2c';
$payment->setBusinessrelation($businessRelation);

$isRedirect = true;
}
//Old Wallet Payment
elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Wallet) {
$payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_Wallet();
Expand Down Expand Up @@ -1186,6 +1197,8 @@ protected function mapClearingType(Payone_Core_Model_Payment_Method_Abstract $pa
$clearingType = Payone_Enum_ClearingType::KLARNADIRECTDEBIT;
} elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_OnlineBankTransferTrustly) {
$clearingType = Payone_Enum_ClearingType::ONLINEBANKTRANSFERTRUSTLY;
} elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_WalletWeChatPay) {
$clearingType = Payone_Enum_ClearingType::WALLETWECHATPAY;
}

return $clearingType;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?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 Payment
* @copyright Copyright (c) 2020 <[email protected]> - www.fatchip.de
* @author Fatchip GmbH <[email protected]>
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link https://www.fatchip.de
*/

/**
*
* @category Payone
* @package Payone_Core_Model
* @subpackage Payment
* @copyright Copyright (c) 2020 <[email protected]> - www.fatchip.de
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link https://www.fatchip.de
*/
class Payone_Core_Model_Payment_Method_WalletWeChatPay extends Payone_Core_Model_Payment_Method_Abstract
{
/**
* @var string
*/
protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::WALLETWECHATPAY;
/**
* @var string
*/
protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::WALLETWECHATPAY;
/**
* @var string
*/
protected $_formBlockType = 'payone_core/payment_method_form_wallet';
/**
* @var string
*/
protected $_infoBlockType = 'payone_core/payment_method_info_wallet';

/** @var Payone_Core_Model_Config_Payment_Method_Interface[] */
protected $matchingConfigs = array();
/**
* @var bool
*/
protected $_canUseInternal = false;

/**
* @api
*
* To be used in Form_Block, which has to display all wallet types
*
* @param Mage_Sales_Model_Quote $quote
* @return Payone_Core_Model_Config_Payment_Method_Interface
*/
public function getAllConfigsByQuote(Mage_Sales_Model_Quote $quote)
{
if (empty($this->matchingConfigs)) {
$configStore = $this->getConfigStore($quote->getStoreId());

$this->matchingConfigs = $configStore->getPayment()->getMethodsForQuote($this->methodType, $quote);
}

return $this->matchingConfigs;
}

/**
* @param $redirectUrl
*/
public function setRedirectUrl($redirectUrl)
{
$oSession = Mage::getSingleton('checkout/session');
$oSession->setPayoneExternalCheckoutActive(true);
$this->redirectUrl = $redirectUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class Payone_Core_Model_System_Config_PaymentMethodCode extends Payone_Core_Mode
const KLARNAINSTALLMENT = 'payone_klarna_installment';
const KLARNADIRECTDEBIT = 'payone_klarna_direct_debit';
const ONLINEBANKTRANSFERTRUSTLY = 'payone_online_bank_transfer_trustly';
const WALLETWECHATPAY = 'payone_wallet_wechatpay';
// const MASTERPASS = 'payone_masterpass'; // MAGE-457 : method removed

/**
Expand Down Expand Up @@ -114,6 +115,7 @@ public function toArray()
self::KLARNAINSTALLMENT => 'Klarna "Slice It" (Installments)',
self::KLARNADIRECTDEBIT => 'Klarna "Pay Now" (Direct Debit)',
self::ONLINEBANKTRANSFERTRUSTLY => 'Trustly',
self::WALLETWECHATPAY => 'WeChat Pay',
// self::MASTERPASS => 'Masterpass' // MAGE-457 : method removed
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Payone_Core_Model_System_Config_PaymentMethodType extends Payone_Core_Mode
const KLARNAINSTALLMENT = 'klarna_installment';
const KLARNADIRECTDEBIT = 'klarna_direct_debit';
const ONLINEBANKTRANSFERTRUSTLY = 'online_bank_transfer_trustly';
const WALLETWECHATPAY = 'wallet_wechatpay';
// const MASTERPASS = 'masterpass'; // MAGE-457 : method removed


Expand Down Expand Up @@ -113,6 +114,7 @@ public function toArray()
self::KLARNAINSTALLMENT => 'Klarna "Slice It" (Installments)',
self::KLARNADIRECTDEBIT => 'Klarna "Pay Now" (Direct Debit)',
self::ONLINEBANKTRANSFERTRUSTLY => 'Trustly',
self::WALLETWECHATPAY => 'WeChat Pay',
// self::MASTERPASS => 'Masterpass' // MAGE-457 : method removed
);
}
Expand Down
13 changes: 13 additions & 0 deletions app/code/community/Payone/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@
<!-- Ali Pay Type -->
<to_order_payment>*</to_order_payment>
</payone_wallet_alipay_type>
<payone_wallet_wechatpay_type>
<!-- WeChatPay Type -->
<to_order_payment>*</to_order_payment>
</payone_wallet_wechatpay_type>
<payone_ratepay_type>
<!-- Ratepay Type -->
<to_order_payment>*</to_order_payment>
Expand Down Expand Up @@ -889,6 +893,11 @@
<model>payone_core/payment_method_onlineBankTransferTrustly</model>
<group>payone</group>
</payone_online_bank_transfer_trustly>
<payone_wallet_wechatpay translate="title" module="payone_core">
<title>PAYONE - WeChatPay</title>
<model>payone_core/payment_method_walletWeChatPay</model>
<group>payone</group>
</payone_wallet_wechatpay>
</payment>
<payone_payment>
<template_amazon_pay>
Expand Down Expand Up @@ -959,6 +968,9 @@
<template_wallet_alipay>
<use_global>1</use_global>
</template_wallet_alipay>
<template_wallet_wechatpay>
<use_global>1</use_global>
</template_wallet_wechatpay>
<template_advance_payment>
<use_global>1</use_global>
</template_advance_payment>
Expand Down Expand Up @@ -1044,6 +1056,7 @@
<wallet_paydirekt_express>a:1:{s:18:"_1514988840741_742";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</wallet_paydirekt_express>
<wallet_paypal_express>a:1:{s:18:"_2177301865940_940";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</wallet_paypal_express>
<wallet_alipay>a:1:{s:18:"_2339656494812_812";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</wallet_alipay>
<wallet_wechatpay>a:1:{s:18:"_2339656494812_912";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</wallet_wechatpay>
<financing>a:1:{s:18:"_1926207461842_842";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</financing>
<amazon_pay>a:1:{s:18:"_1917707466274_274";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</amazon_pay>
<payment_guarantee_invoice>a:1:{s:18:"_2468232683254_254";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:12:"state_status";a:1:{i:0;s:21:"processing|processing";}}}</payment_guarantee_invoice>
Expand Down
18 changes: 18 additions & 0 deletions app/code/community/Payone/Core/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,15 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</online_bank_transfer_trustly>
<wallet_wechatpay translate="label">
<label>Wallet WeChatPay</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>170</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</wallet_wechatpay>
</fields>
</status_mapping>
<payment_creditcard>
Expand Down Expand Up @@ -1973,6 +1982,15 @@
</sepa_de_show_bank_data>
</fields>
</template_online_bank_transfer_trustly>
<template_wallet_wechatpay translate="label" module="payone_core">
<label>WeChatPay</label>
<frontend_type>text</frontend_type>
<sort_order>14</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields></fields>
</template_wallet_wechatpay>
</groups>
</payone_payment>

Expand Down
1 change: 1 addition & 0 deletions lib/Payone/Api/Enum/WalletType.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ class Payone_Api_Enum_WalletType
const PAYDIREKT = 'PDT';
const PAYDIREKTEXPRESS = 'PDT';
const ALIPAY = 'ALP';
const WECHATPAY = 'WCP';

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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 to newer
* versions in the future. If you wish to customize Payone for your
* needs please refer to http://www.payone.de for more information.
*
* @category Payone
* @package Payone_Api
* @subpackage Request
* @copyright Copyright (c) 2020 <[email protected]> - www.fatchip.de
* @author FATCHIP GmbH <[email protected]>
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link http://www.fatchip.de
*/

/**
*
* @category Payone
* @package Payone_Api
* @subpackage Request
* @copyright Copyright (c) 2020 <fatchip.de> - www.fatchip.de
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link http://www.fatchip.de
*/
class Payone_Api_Request_Parameter_Authorization_PaymentMethod_WalletWeChatPay
extends Payone_Api_Request_Parameter_Authorization_PaymentMethod_Wallet
{
/**
* @var string
*/
protected $businessrelation = NULL;

/**
* @return string
*/
public function getBusinessrelation()
{
return $this->businessrelation;
}

/**
* @param string $businessrelation
*/
public function setBusinessrelation($businessrelation)
{
$this->businessrelation = $businessrelation;
}

}
1 change: 1 addition & 0 deletions lib/Payone/Enum/ClearingType.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ class Payone_Enum_ClearingType
const WALLETPAYDIREKT = 'wlt';
const WALLETPAYDIREKTEXPRESS = 'wlt';
const WALLETPAYPALEXPRESS = 'wlt';
const WALLETWECHATPAY = 'wlt';
const WALLET = 'wlt'; // Default wlt mapping
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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 to newer
* versions in the future. If you wish to customize Payone for your
* needs please refer to http://www.payone.de for more information.
*
* @category Payone
* @package Payone_Settings
* @subpackage Data
* @copyright Copyright (c) 2020 <[email protected]> - www.fatchip.de
* @author Fatchip GmbH <[email protected]>
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link https://www.fatchip.de
*/

/**
*
* @category Payone
* @package Payone_Settings
* @subpackage Data
* @copyright Copyright (c) 2020 <[email protected]> - www.fatchip.de
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
* @link https://www.fatchip.de
*/
class Payone_Settings_Data_ConfigFile_PaymentMethod_Walletwechatpay
extends Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract
implements Payone_Settings_Data_ConfigFile_Interface
{
/** @var string */
protected $key = Payone_Enum_ClearingType::WALLETWECHATPAY;

public function getKey()
{
return $this->key;
}
}

0 comments on commit 34c5a44

Please sign in to comment.