Version Notes
1.) Added Support for Recurring Transactions
- eMerchantPay Direct Payment Method
--nitRecurringSale
--InitRecurringSale (3D-Secure)
--RecurringSale
- eMerchantPay Checkout Payment Method
--InitRecurringSale
--InitRecurringSale (3D-Secure)
--RecurringSale
2.) Additional Payment Method Settings
- Available Recurring Transactions
- Managing Initial Fee
- Managing Cron Jobs Settings - External Module is needed
3.) Added Support for Genesis v1.4.2
- Updated PBV Sale & Yeepay APIs
- Added Client Validations in Payment Method Settings
4.) A few Issues have been resolved
- Payment Gateway Request Currency - The Base Currency has been used instead of checkout currency
- An additional Web Payment Form Locale check has been implemented - there was a problem while creating a Web Payment Form if the selected locale in admin is not by our Payment Gateway
1.) Added Support for GenesisLib v1.4 - Additional Transaction Types are now available using the eMerchantPay Checkout Method
2.) A possibility has been added to use an external GenesisGateway Library (installed by composer) instead of the integrated in Module
2.) A few minor issues were resolved regarding Capture / Refund Transactions
Release Info
| Developer | eMerchantPay Ltd. |
| Extension | EMerchantPay_Genesis_Client |
| Version | 1.2.7 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.5 to 1.2.7
- app/code/community/EMerchantPay/Genesis/Block/Form/Checkout.php +13 -3
- app/code/community/EMerchantPay/Genesis/Block/Form/Direct.php +15 -5
- app/code/community/EMerchantPay/Genesis/Block/Info/Checkout.php +3 -3
- app/code/community/EMerchantPay/Genesis/Block/Info/Direct.php +3 -3
- app/code/community/EMerchantPay/Genesis/Block/Redirect/Checkout.php +3 -3
- app/code/community/EMerchantPay/Genesis/Block/Redirect/Direct.php +3 -3
- app/code/community/EMerchantPay/Genesis/Helper/Data.php +420 -31
- app/code/community/EMerchantPay/Genesis/Model/Admin/Checkout/Options/Transaction/Recurring/Type.php +74 -0
- app/code/community/EMerchantPay/Genesis/Model/Admin/Checkout/Options/Transaction/Type.php +6 -5
- app/code/community/EMerchantPay/Genesis/Model/Admin/Direct/Options/Transaction/Recurring/Type.php +74 -0
- app/code/community/EMerchantPay/Genesis/Model/Admin/Direct/Options/Transaction/Type.php +5 -5
- app/code/community/EMerchantPay/Genesis/Model/Admin/Environment.php +5 -5
- app/code/community/EMerchantPay/Genesis/Model/Checkout.php +531 -51
- app/code/community/EMerchantPay/Genesis/Model/Direct.php +501 -75
- app/code/community/EMerchantPay/Genesis/Model/Task/Recurring.php +462 -0
- app/code/community/EMerchantPay/Genesis/Observer/CheckoutSubmitAllAfter.php +52 -0
- app/code/community/EMerchantPay/Genesis/Observer/GenesisAutoLoader.php +0 -74
- app/code/community/EMerchantPay/Genesis/Observer/SalesQuoteAddressCollectTotalsBefore.php +103 -0
- app/code/community/EMerchantPay/Genesis/controllers/CheckoutController.php +7 -10
- app/code/community/EMerchantPay/Genesis/controllers/DirectController.php +7 -8
- app/code/community/EMerchantPay/Genesis/etc/config.xml +48 -9
- app/code/community/EMerchantPay/Genesis/etc/system.xml +381 -32
- app/design/frontend/base/default/template/emerchantpay/form/checkout.phtml +13 -0
- app/design/frontend/base/default/template/emerchantpay/form/direct.phtml +13 -0
- lib/Genesis/src/Genesis/API/.DS_Store +0 -0
- lib/Genesis/src/Genesis/API/Constants/Payment/Methods.php +18 -0
- lib/Genesis/src/Genesis/API/Constants/Transaction/Parameters/PayByVouchers/CardTypes.php +71 -0
- lib/Genesis/src/Genesis/API/Constants/Transaction/Parameters/PayByVouchers/RedeemTypes.php +72 -0
- lib/Genesis/src/Genesis/API/Constants/Transaction/Types.php +100 -0
- lib/Genesis/src/Genesis/API/Request/.DS_Store +0 -0
- lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/Sale.php +18 -0
- lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/oBeP.php +18 -0
- lib/Genesis/src/Genesis/API/Request/WPF/.DS_Store +0 -0
- lib/Genesis/src/Genesis/API/Request/WPF/Create.php +71 -0
- lib/Genesis/src/Genesis/Config.php +1 -1
- lib/Genesis/src/Genesis/Utils/.DS_Store +0 -0
- lib/Genesis/src/Genesis/Utils/Common.php +20 -0
- package.xml +34 -5
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -32,4 +32,14 @@ class EMerchantPay_Genesis_Block_Form_Checkout extends Mage_Payment_Block_Form
|
|
| 32 |
parent::_construct();
|
| 33 |
$this->setTemplate('emerchantpay/form/checkout.phtml');
|
| 34 |
}
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 32 |
parent::_construct();
|
| 33 |
$this->setTemplate('emerchantpay/form/checkout.phtml');
|
| 34 |
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Determines if a Nominal Items were added to the cart
|
| 38 |
+
* @return bool
|
| 39 |
+
*/
|
| 40 |
+
public function getHasNominalItems()
|
| 41 |
+
{
|
| 42 |
+
return
|
| 43 |
+
Mage::helper("emerchantpay")->getCheckoutHasRecurringItems();
|
| 44 |
+
}
|
| 45 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -55,7 +55,7 @@ class EMerchantPay_Genesis_Block_Form_Direct extends Mage_Payment_Block_Form
|
|
| 55 |
$availableTypes = $method->getConfigData('cctypes');
|
| 56 |
if ($availableTypes) {
|
| 57 |
$availableTypes = explode(',', $availableTypes);
|
| 58 |
-
foreach ($types as $code
|
| 59 |
if (!in_array($code, $availableTypes)) {
|
| 60 |
unset($types[$code]);
|
| 61 |
}
|
|
@@ -106,7 +106,7 @@ class EMerchantPay_Genesis_Block_Form_Direct extends Mage_Payment_Block_Form
|
|
| 106 |
{
|
| 107 |
if ($this->getMethod()) {
|
| 108 |
$configData = $this->getMethod()->getConfigData('useccv');
|
| 109 |
-
if(is_null($configData)){
|
| 110 |
return true;
|
| 111 |
}
|
| 112 |
return (bool) $configData;
|
|
@@ -127,4 +127,14 @@ class EMerchantPay_Genesis_Block_Form_Direct extends Mage_Payment_Block_Form
|
|
| 127 |
|
| 128 |
return parent::_toHtml();
|
| 129 |
}
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 55 |
$availableTypes = $method->getConfigData('cctypes');
|
| 56 |
if ($availableTypes) {
|
| 57 |
$availableTypes = explode(',', $availableTypes);
|
| 58 |
+
foreach ($types as $code => $name) {
|
| 59 |
if (!in_array($code, $availableTypes)) {
|
| 60 |
unset($types[$code]);
|
| 61 |
}
|
| 106 |
{
|
| 107 |
if ($this->getMethod()) {
|
| 108 |
$configData = $this->getMethod()->getConfigData('useccv');
|
| 109 |
+
if (is_null($configData)) {
|
| 110 |
return true;
|
| 111 |
}
|
| 112 |
return (bool) $configData;
|
| 127 |
|
| 128 |
return parent::_toHtml();
|
| 129 |
}
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* Determines if a Nominal Items were added to the cart
|
| 133 |
+
* @return bool
|
| 134 |
+
*/
|
| 135 |
+
public function getHasNominalItems()
|
| 136 |
+
{
|
| 137 |
+
return
|
| 138 |
+
Mage::helper("emerchantpay")->getCheckoutHasRecurringItems();
|
| 139 |
+
}
|
| 140 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -34,4 +34,4 @@ class EMerchantPay_Genesis_Block_Info_Checkout extends Mage_Payment_Block_Info
|
|
| 34 |
{
|
| 35 |
return $this->getInfo()->getMethodInstance()->getCode();
|
| 36 |
}
|
| 37 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 34 |
{
|
| 35 |
return $this->getInfo()->getMethodInstance()->getCode();
|
| 36 |
}
|
| 37 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -34,4 +34,4 @@ class EMerchantPay_Genesis_Block_Info_Direct extends Mage_Payment_Block_Info
|
|
| 34 |
{
|
| 35 |
return $this->getInfo()->getMethodInstance()->getCode();
|
| 36 |
}
|
| 37 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 34 |
{
|
| 35 |
return $this->getInfo()->getMethodInstance()->getCode();
|
| 36 |
}
|
| 37 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -98,4 +98,4 @@ class EMerchantPay_Genesis_Block_Redirect_Checkout extends Mage_Core_Block_Templ
|
|
| 98 |
{
|
| 99 |
$this->unique_id = Mage::helper('core')->uniqHash();
|
| 100 |
}
|
| 101 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 98 |
{
|
| 99 |
$this->unique_id = Mage::helper('core')->uniqHash();
|
| 100 |
}
|
| 101 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -98,4 +98,4 @@ class EMerchantPay_Genesis_Block_Redirect_Direct extends Mage_Core_Block_Templat
|
|
| 98 |
{
|
| 99 |
$this->unique_id = Mage::helper('core')->uniqHash();
|
| 100 |
}
|
| 101 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 98 |
{
|
| 99 |
$this->unique_id = Mage::helper('core')->uniqHash();
|
| 100 |
}
|
| 101 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -24,28 +24,21 @@
|
|
| 24 |
*/
|
| 25 |
class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
| 26 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
/**
|
| 28 |
* Include Genesis library
|
| 29 |
*
|
| 30 |
* @return void
|
| 31 |
*/
|
| 32 |
-
|
| 33 |
{
|
| 34 |
-
// Mitigate PHP Bug #52339, as Magento already registers their AutoLoader
|
| 35 |
if (!class_exists('\Genesis\Genesis', false)) {
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
'integrated_genesis_lib_auto_loader' => Mage::getBaseDir('lib') . DS . 'Genesis' . DS . 'vendor' . DS . 'autoload.php',
|
| 39 |
-
'genesis_composer_dir' => 'genesisgateway',
|
| 40 |
-
'check_genesis_lib_version' => '1',
|
| 41 |
-
'required_genesis_lib_version' => ">= 1.4"
|
| 42 |
-
);
|
| 43 |
-
|
| 44 |
-
$genesisAutoLoadVarienObj = new Varien_Object($genesisAutoLoadParams);
|
| 45 |
-
|
| 46 |
-
/* This Event will be handled from Observer EMerchantPay_Genesis_Observer_GenesisAutoLoader (defined in etc/config.xml) */
|
| 47 |
-
Mage::dispatchEvent('emerchantpay_genesis_init_library', array('genesis_auto_load_params' => $genesisAutoLoadVarienObj));
|
| 48 |
-
}
|
| 49 |
}
|
| 50 |
|
| 51 |
/**
|
|
@@ -59,15 +52,33 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 59 |
{
|
| 60 |
$this->initLibrary();
|
| 61 |
|
| 62 |
-
\Genesis\Config::setEndpoint(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
\Genesis\Config::
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
\Genesis\Config::setEnvironment(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
\Genesis\Config::setToken(
|
| 70 |
-
$this->getConfigData($model, 'genesis_token')
|
| 71 |
);
|
| 72 |
}
|
| 73 |
|
|
@@ -174,11 +185,29 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 174 |
*
|
| 175 |
* @return string
|
| 176 |
*/
|
| 177 |
-
public function getLocale()
|
| 178 |
{
|
| 179 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
return
|
| 182 |
}
|
| 183 |
|
| 184 |
/**
|
|
@@ -275,9 +304,14 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 275 |
$product = $item->getProduct();
|
| 276 |
|
| 277 |
$productResult[$product->getSku()] = array(
|
| 278 |
-
'sku'
|
| 279 |
-
|
| 280 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
);
|
| 282 |
}
|
| 283 |
|
|
@@ -290,6 +324,28 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 290 |
return $description;
|
| 291 |
}
|
| 292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
/**
|
| 294 |
* Restore customer Quote
|
| 295 |
*
|
|
@@ -344,6 +400,7 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 344 |
)
|
| 345 |
->save();
|
| 346 |
break;
|
|
|
|
| 347 |
case \Genesis\API\Constants\Transaction\States::PENDING:
|
| 348 |
case \Genesis\API\Constants\Transaction\States::PENDING_ASYNC:
|
| 349 |
$order
|
|
@@ -355,9 +412,9 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 355 |
)
|
| 356 |
->save();
|
| 357 |
break;
|
|
|
|
| 358 |
case \Genesis\API\Constants\Transaction\States::ERROR:
|
| 359 |
case \Genesis\API\Constants\Transaction\States::DECLINED:
|
| 360 |
-
|
| 361 |
/** @var Mage_Sales_Model_Order_Invoice $invoice */
|
| 362 |
foreach ($order->getInvoiceCollection() as $invoice) {
|
| 363 |
$invoice->cancel();
|
|
@@ -369,6 +426,7 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 369 |
->save();
|
| 370 |
|
| 371 |
break;
|
|
|
|
| 372 |
default:
|
| 373 |
$order->save();
|
| 374 |
break;
|
|
@@ -400,7 +458,7 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 400 |
);
|
| 401 |
|
| 402 |
foreach ($information as $field => $value) {
|
| 403 |
-
if ($field ==
|
| 404 |
\Genesis\Config::setToken($value);
|
| 405 |
}
|
| 406 |
}
|
|
@@ -439,4 +497,335 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 439 |
exit(0);
|
| 440 |
}
|
| 441 |
}
|
| 442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 24 |
*/
|
| 25 |
class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
| 26 |
{
|
| 27 |
+
const SECURE_TRANSCTION_TYPE_SUFFIX = "3D";
|
| 28 |
+
|
| 29 |
+
const RAW_DETAILS_TRANSACTION_TYPE = 'transaction_type';
|
| 30 |
+
const RAW_DETAILS_TERMINAL_TOKEN = 'terminal_token';
|
| 31 |
+
|
| 32 |
/**
|
| 33 |
* Include Genesis library
|
| 34 |
*
|
| 35 |
* @return void
|
| 36 |
*/
|
| 37 |
+
public function initLibrary()
|
| 38 |
{
|
|
|
|
| 39 |
if (!class_exists('\Genesis\Genesis', false)) {
|
| 40 |
+
include Mage::getBaseDir('lib') . DS . 'Genesis' . DS . 'vendor' . DS . 'autoload.php';
|
| 41 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
/**
|
| 52 |
{
|
| 53 |
$this->initLibrary();
|
| 54 |
|
| 55 |
+
\Genesis\Config::setEndpoint(
|
| 56 |
+
\Genesis\API\Constants\Endpoints::EMERCHANTPAY
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
\Genesis\Config::setUsername(
|
| 60 |
+
$this->getConfigData(
|
| 61 |
+
$model,
|
| 62 |
+
'genesis_username'
|
| 63 |
+
)
|
| 64 |
+
);
|
| 65 |
|
| 66 |
+
\Genesis\Config::setPassword(
|
| 67 |
+
$this->getConfigData(
|
| 68 |
+
$model,
|
| 69 |
+
'genesis_password'
|
| 70 |
+
)
|
| 71 |
+
);
|
| 72 |
|
| 73 |
+
\Genesis\Config::setEnvironment(
|
| 74 |
+
$this->getConfigData(
|
| 75 |
+
$model,
|
| 76 |
+
'genesis_environment'
|
| 77 |
+
)
|
| 78 |
+
);
|
| 79 |
|
| 80 |
\Genesis\Config::setToken(
|
| 81 |
+
$this->getConfigData($model, 'genesis_token') ?: ""
|
| 82 |
);
|
| 83 |
}
|
| 84 |
|
| 185 |
*
|
| 186 |
* @return string
|
| 187 |
*/
|
| 188 |
+
public function getLocale($default = 'en')
|
| 189 |
{
|
| 190 |
+
$languageCode = substr(
|
| 191 |
+
strtolower(
|
| 192 |
+
Mage::app()->getLocale()->getLocaleCode()
|
| 193 |
+
),
|
| 194 |
+
0,
|
| 195 |
+
2
|
| 196 |
+
);
|
| 197 |
+
|
| 198 |
+
if (!\Genesis\API\Constants\i18n::isValidLanguageCode($languageCode)) {
|
| 199 |
+
$languageCode = $default;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
if (!\Genesis\API\Constants\i18n::isValidLanguageCode($languageCode)) {
|
| 203 |
+
Mage::throwException(
|
| 204 |
+
$this->__('The provided argument is not a valid ISO-639-1 language code ' .
|
| 205 |
+
'or is not supported by the Payment Gateway!'
|
| 206 |
+
)
|
| 207 |
+
);
|
| 208 |
+
}
|
| 209 |
|
| 210 |
+
return $languageCode;
|
| 211 |
}
|
| 212 |
|
| 213 |
/**
|
| 304 |
$product = $item->getProduct();
|
| 305 |
|
| 306 |
$productResult[$product->getSku()] = array(
|
| 307 |
+
'sku' =>
|
| 308 |
+
$product->getSku(),
|
| 309 |
+
'name' =>
|
| 310 |
+
$product->getName(),
|
| 311 |
+
'qty' =>
|
| 312 |
+
isset($productResult[$product->getSku()]['qty'])
|
| 313 |
+
? $productResult[$product->getSku()]['qty']
|
| 314 |
+
: 1,
|
| 315 |
);
|
| 316 |
}
|
| 317 |
|
| 324 |
return $description;
|
| 325 |
}
|
| 326 |
|
| 327 |
+
/**
|
| 328 |
+
* Get list of items in the order
|
| 329 |
+
*
|
| 330 |
+
* @see API parameter "Usage" or "Description"
|
| 331 |
+
*
|
| 332 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 333 |
+
*
|
| 334 |
+
* @return string Formatted List of Items
|
| 335 |
+
*/
|
| 336 |
+
public function getRecurringProfileItemDescription($profile)
|
| 337 |
+
{
|
| 338 |
+
$product = $profile->getOrderItemInfo();
|
| 339 |
+
|
| 340 |
+
return
|
| 341 |
+
sprintf(
|
| 342 |
+
"%s (%s) x %d",
|
| 343 |
+
$product['name'],
|
| 344 |
+
$product['sku'],
|
| 345 |
+
$product['qty']
|
| 346 |
+
);
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
/**
|
| 350 |
* Restore customer Quote
|
| 351 |
*
|
| 400 |
)
|
| 401 |
->save();
|
| 402 |
break;
|
| 403 |
+
|
| 404 |
case \Genesis\API\Constants\Transaction\States::PENDING:
|
| 405 |
case \Genesis\API\Constants\Transaction\States::PENDING_ASYNC:
|
| 406 |
$order
|
| 412 |
)
|
| 413 |
->save();
|
| 414 |
break;
|
| 415 |
+
|
| 416 |
case \Genesis\API\Constants\Transaction\States::ERROR:
|
| 417 |
case \Genesis\API\Constants\Transaction\States::DECLINED:
|
|
|
|
| 418 |
/** @var Mage_Sales_Model_Order_Invoice $invoice */
|
| 419 |
foreach ($order->getInvoiceCollection() as $invoice) {
|
| 420 |
$invoice->cancel();
|
| 426 |
->save();
|
| 427 |
|
| 428 |
break;
|
| 429 |
+
|
| 430 |
default:
|
| 431 |
$order->save();
|
| 432 |
break;
|
| 458 |
);
|
| 459 |
|
| 460 |
foreach ($information as $field => $value) {
|
| 461 |
+
if ($field == self::RAW_DETAILS_TERMINAL_TOKEN) {
|
| 462 |
\Genesis\Config::setToken($value);
|
| 463 |
}
|
| 464 |
}
|
| 497 |
exit(0);
|
| 498 |
}
|
| 499 |
}
|
| 500 |
+
|
| 501 |
+
/**
|
| 502 |
+
* @param string $model
|
| 503 |
+
* @param string $key
|
| 504 |
+
* @return bool
|
| 505 |
+
*/
|
| 506 |
+
public function getConfigBoolValue($model, $key)
|
| 507 |
+
{
|
| 508 |
+
return
|
| 509 |
+
filter_var(
|
| 510 |
+
$this->getConfigData(
|
| 511 |
+
$model,
|
| 512 |
+
$key
|
| 513 |
+
),
|
| 514 |
+
FILTER_VALIDATE_BOOLEAN
|
| 515 |
+
);
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
/**
|
| 519 |
+
* @param string $method
|
| 520 |
+
* @return bool
|
| 521 |
+
*/
|
| 522 |
+
public function getIsMethodActive($method)
|
| 523 |
+
{
|
| 524 |
+
return $this->getConfigBoolValue($method, 'active');
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
/**
|
| 528 |
+
* Returns true if the WebSite is configured over Secured SSL Connection
|
| 529 |
+
* @return bool
|
| 530 |
+
*/
|
| 531 |
+
public function getIsSecureConnectionEnabled()
|
| 532 |
+
{
|
| 533 |
+
return (bool) Mage::app()->getStore()->isCurrentlySecure();
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
/**
|
| 537 |
+
* @param string $method
|
| 538 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 539 |
+
* @return bool
|
| 540 |
+
*/
|
| 541 |
+
public function validateRecurringMethodMinMaxOrderTotal($method, $quote)
|
| 542 |
+
{
|
| 543 |
+
if (!$this->getCheckoutHasRecurringItems($quote)) {
|
| 544 |
+
return false;
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
$total = $this->getRecurringQuoteBaseNominalRowTotal(
|
| 548 |
+
$quote
|
| 549 |
+
);
|
| 550 |
+
|
| 551 |
+
$minTotal = $this->getConfigData($method, 'min_order_total');
|
| 552 |
+
$maxTotal = $this->getConfigData($method, 'max_order_total');
|
| 553 |
+
if ($total == 0 || !empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) {
|
| 554 |
+
return false;
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
return true;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
/**
|
| 561 |
+
* @param string $method
|
| 562 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 563 |
+
* @param bool $requiresSecureConnection
|
| 564 |
+
* @param bool $supportsRecurring
|
| 565 |
+
* @return bool
|
| 566 |
+
*/
|
| 567 |
+
public function getIsMethodAvailable(
|
| 568 |
+
$method,
|
| 569 |
+
$quote,
|
| 570 |
+
$requiresSecureConnection = false,
|
| 571 |
+
$supportsRecurring = true
|
| 572 |
+
) {
|
| 573 |
+
return
|
| 574 |
+
$this->getIsMethodActive($method) &&
|
| 575 |
+
(!$requiresSecureConnection || $this->getIsSecureConnectionEnabled()) &&
|
| 576 |
+
(
|
| 577 |
+
($supportsRecurring &&
|
| 578 |
+
(!$quote->hasNominalItems() || $this->getConfigBoolValue($method, 'recurring_enabled'))
|
| 579 |
+
) ||
|
| 580 |
+
(!$supportsRecurring && !$quote->hasNominalItems())
|
| 581 |
+
);
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
/**
|
| 585 |
+
* @param string $transactionType
|
| 586 |
+
* @return bool
|
| 587 |
+
*/
|
| 588 |
+
public function getIsTransaction3dSecure($transactionType)
|
| 589 |
+
{
|
| 590 |
+
return
|
| 591 |
+
$this->getStringEndsWith(
|
| 592 |
+
strtoupper($transactionType),
|
| 593 |
+
self::SECURE_TRANSCTION_TYPE_SUFFIX
|
| 594 |
+
);
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
/**
|
| 598 |
+
* @param string $haystack
|
| 599 |
+
* @param string $needle
|
| 600 |
+
* @return bool
|
| 601 |
+
*/
|
| 602 |
+
public function getStringEndsWith($haystack, $needle)
|
| 603 |
+
{
|
| 604 |
+
$length = strlen($needle);
|
| 605 |
+
if ($length == 0) {
|
| 606 |
+
return true;
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
return (substr($haystack, -$length) === $needle);
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
/**
|
| 613 |
+
* Get the Remote Address of the machine
|
| 614 |
+
* @return string
|
| 615 |
+
*/
|
| 616 |
+
public function getRemoteAddress()
|
| 617 |
+
{
|
| 618 |
+
$remoteAddress = Mage::helper('core/http')->getRemoteAddr(false);
|
| 619 |
+
|
| 620 |
+
if (empty($remoteAddress) && function_exists("parse_url") && function_exists("gethostbyname")) {
|
| 621 |
+
$parsedUrl = parse_url(
|
| 622 |
+
Mage::getBaseUrl(Mage_Core_Model_store::URL_TYPE_WEB)
|
| 623 |
+
);
|
| 624 |
+
|
| 625 |
+
if (isset($parsedUrl['host'])) {
|
| 626 |
+
$remoteAddress = gethostbyname(
|
| 627 |
+
$parsedUrl['host']
|
| 628 |
+
);
|
| 629 |
+
}
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
return $remoteAddress ?: "127.0.0.1";
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
/**
|
| 636 |
+
* Builds a Genesis Transaction Class name by Genesis Transaction
|
| 637 |
+
* @param string $transactionType
|
| 638 |
+
* @return string
|
| 639 |
+
*/
|
| 640 |
+
public function getGenesisTransactionClassName($transactionType)
|
| 641 |
+
{
|
| 642 |
+
$this->initLibrary();
|
| 643 |
+
|
| 644 |
+
$className = \Genesis\Utils\Common::snakeCaseToCamelCase($transactionType);
|
| 645 |
+
|
| 646 |
+
if ($this->getIsTransaction3dSecure($transactionType)) {
|
| 647 |
+
$className =
|
| 648 |
+
substr(
|
| 649 |
+
$className,
|
| 650 |
+
0,
|
| 651 |
+
strlen($className) - strlen(self::SECURE_TRANSCTION_TYPE_SUFFIX)
|
| 652 |
+
) .
|
| 653 |
+
self::SECURE_TRANSCTION_TYPE_SUFFIX;
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
return $className;
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
/**
|
| 660 |
+
* @param string $transactionType
|
| 661 |
+
* @return bool
|
| 662 |
+
*/
|
| 663 |
+
public function getIsTransactionTypeInitRecurring($transactionType)
|
| 664 |
+
{
|
| 665 |
+
$this->initLibrary();
|
| 666 |
+
|
| 667 |
+
$initRecurringTransactionTypes = array(
|
| 668 |
+
\Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE,
|
| 669 |
+
\Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D
|
| 670 |
+
);
|
| 671 |
+
|
| 672 |
+
return !empty($transactionType) && in_array($transactionType, $initRecurringTransactionTypes);
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
/**
|
| 676 |
+
* Cancels a recurring profile when capture transaction is refunded
|
| 677 |
+
* @param Mage_Sales_Model_Order_Payment_Transaction $captureTransaction
|
| 678 |
+
* @return string|null
|
| 679 |
+
*/
|
| 680 |
+
public function checkAndCancelRecurringProfile($captureTransaction)
|
| 681 |
+
{
|
| 682 |
+
$profileReferenceId = null;
|
| 683 |
+
|
| 684 |
+
if ($captureTransaction && $captureTransaction->getId()) {
|
| 685 |
+
$captureTransactionType = $this->getGenesisPaymentTransactionType(
|
| 686 |
+
$captureTransaction
|
| 687 |
+
);
|
| 688 |
+
|
| 689 |
+
if ($captureTransactionType && $this->getIsTransactionTypeInitRecurring($captureTransactionType)) {
|
| 690 |
+
$recurringProfileReferenceId =
|
| 691 |
+
$captureTransaction->getParentTxnId()
|
| 692 |
+
?: $captureTransaction->getTxnId();
|
| 693 |
+
|
| 694 |
+
$recurringProfile = Mage::getModel("sales/recurring_profile")->load(
|
| 695 |
+
$recurringProfileReferenceId,
|
| 696 |
+
'reference_id'
|
| 697 |
+
);
|
| 698 |
+
|
| 699 |
+
if ($recurringProfile && $recurringProfile->getId()) {
|
| 700 |
+
if ($recurringProfile->getState() != Mage_Sales_Model_Recurring_Profile::STATE_CANCELED) {
|
| 701 |
+
$recurringProfile->setState(
|
| 702 |
+
Mage_Sales_Model_Recurring_Profile::STATE_CANCELED
|
| 703 |
+
);
|
| 704 |
+
|
| 705 |
+
$recurringProfile->save();
|
| 706 |
+
|
| 707 |
+
$profileReferenceId = $recurringProfile->getReferenceId();
|
| 708 |
+
}
|
| 709 |
+
}
|
| 710 |
+
}
|
| 711 |
+
}
|
| 712 |
+
|
| 713 |
+
return $profileReferenceId;
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
/**
|
| 717 |
+
* Extracts a Transaction Param Value from Transaction Additional Information
|
| 718 |
+
* @param Mage_Sales_Model_Order_Payment_Transaction $transaction
|
| 719 |
+
* @return string|null
|
| 720 |
+
*/
|
| 721 |
+
public function getGenesisPaymentTransactionParam($transaction, $paramName)
|
| 722 |
+
{
|
| 723 |
+
if (!is_object($transaction) || !$transaction->getId()) {
|
| 724 |
+
return null;
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
$transactionRawDetails = $transaction->getAdditionalInformation(
|
| 728 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
| 729 |
+
);
|
| 730 |
+
|
| 731 |
+
return
|
| 732 |
+
isset($transactionRawDetails[$paramName])
|
| 733 |
+
? $transactionRawDetails[$paramName]
|
| 734 |
+
: null;
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
/**
|
| 738 |
+
* @param Mage_Sales_Model_Order_Payment_Transaction $transaction
|
| 739 |
+
* @return string|null
|
| 740 |
+
*/
|
| 741 |
+
public function getGenesisPaymentTransactionType($transaction)
|
| 742 |
+
{
|
| 743 |
+
return $this->getGenesisPaymentTransactionParam(
|
| 744 |
+
$transaction,
|
| 745 |
+
self::RAW_DETAILS_TRANSACTION_TYPE
|
| 746 |
+
);
|
| 747 |
+
}
|
| 748 |
+
|
| 749 |
+
/**
|
| 750 |
+
* @param Mage_Sales_Model_Order_Payment_Transaction $transaction
|
| 751 |
+
* @return string|null
|
| 752 |
+
*/
|
| 753 |
+
public function getGenesisPaymentTransactionToken($transaction)
|
| 754 |
+
{
|
| 755 |
+
return $this->getGenesisPaymentTransactionParam(
|
| 756 |
+
$transaction,
|
| 757 |
+
self::RAW_DETAILS_TERMINAL_TOKEN
|
| 758 |
+
);
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
/**
|
| 762 |
+
* Get Admin Session (Used to display Success and Error Messages)
|
| 763 |
+
* @return Mage_Core_Model_Session_Abstract
|
| 764 |
+
*/
|
| 765 |
+
public function getAdminSession()
|
| 766 |
+
{
|
| 767 |
+
return Mage::getSingleton("adminhtml/session");
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
/**
|
| 771 |
+
* Get Init Recurring Fee Config Value for Method
|
| 772 |
+
* @param string $methodCode
|
| 773 |
+
* @return string
|
| 774 |
+
*/
|
| 775 |
+
public function getMethodInitRecurringFee($methodCode)
|
| 776 |
+
{
|
| 777 |
+
return str_replace(
|
| 778 |
+
',',
|
| 779 |
+
'.',
|
| 780 |
+
$this->getConfigData(
|
| 781 |
+
$methodCode,
|
| 782 |
+
'recurring_initial_fee'
|
| 783 |
+
)
|
| 784 |
+
);
|
| 785 |
+
}
|
| 786 |
+
|
| 787 |
+
/**
|
| 788 |
+
* Returns a formatted MySQL Datetime Value
|
| 789 |
+
* @param int $time
|
| 790 |
+
* @return string
|
| 791 |
+
*/
|
| 792 |
+
public function formatDateTimeToMySQLDateTime($time)
|
| 793 |
+
{
|
| 794 |
+
return
|
| 795 |
+
strftime(
|
| 796 |
+
'%Y-%m-%d %H:%M:%S',
|
| 797 |
+
$time
|
| 798 |
+
);
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
/**
|
| 802 |
+
* Detects if a Recurring Item has been added to the Cart
|
| 803 |
+
* @param Mage_Sales_Model_Quote|null $quote
|
| 804 |
+
* @return bool
|
| 805 |
+
*/
|
| 806 |
+
public function getCheckoutHasRecurringItems($quote = null)
|
| 807 |
+
{
|
| 808 |
+
$quote = $quote ?: $this->getCheckoutSession()->getQuote();
|
| 809 |
+
|
| 810 |
+
return $quote->hasRecurringItems();
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
/**
|
| 814 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 815 |
+
* @return float
|
| 816 |
+
*/
|
| 817 |
+
public function getRecurringQuoteBaseNominalRowTotal($quote)
|
| 818 |
+
{
|
| 819 |
+
$baseNominalRowTotal = 0;
|
| 820 |
+
|
| 821 |
+
foreach ($quote->getAllAddresses() as $quoteAddress) {
|
| 822 |
+
foreach ($quoteAddress->getAllNominalItems() as $nominalItem) {
|
| 823 |
+
if ($nominalItem->getIsNominal()) {
|
| 824 |
+
$baseNominalRowTotal += $nominalItem->getBaseNominalRowTotal();
|
| 825 |
+
}
|
| 826 |
+
}
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
return $baseNominalRowTotal;
|
| 830 |
+
}
|
| 831 |
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
+
*
|
| 5 |
+
* This program is free software; you can redistribute it and/or
|
| 6 |
+
* modify it under the terms of the GNU General Public License
|
| 7 |
+
* as published by the Free Software Foundation; either version 2
|
| 8 |
+
* of the License, or (at your option) any later version.
|
| 9 |
+
*
|
| 10 |
+
* This program is distributed in the hope that it will be useful,
|
| 11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
* GNU General Public License for more details.
|
| 14 |
+
*
|
| 15 |
+
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Class EMerchantPay_Genesis_Model_Admin_Transaction_Type
|
| 22 |
+
*
|
| 23 |
+
* Admin options Drop-down for Genesis Transaction Types
|
| 24 |
+
*/
|
| 25 |
+
class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Recurring_Type
|
| 26 |
+
{
|
| 27 |
+
/**
|
| 28 |
+
* Pre-load the required files
|
| 29 |
+
*/
|
| 30 |
+
public function __construct()
|
| 31 |
+
{
|
| 32 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
| 33 |
+
$helper = Mage::helper('emerchantpay');
|
| 34 |
+
|
| 35 |
+
$helper->initLibrary();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Return the transaction types for an Options field
|
| 40 |
+
*
|
| 41 |
+
* @return array
|
| 42 |
+
*/
|
| 43 |
+
public function toOptionArray()
|
| 44 |
+
{
|
| 45 |
+
$options = array();
|
| 46 |
+
|
| 47 |
+
foreach ($this->getTransactionTypes() as $code => $name) {
|
| 48 |
+
$options[] = array(
|
| 49 |
+
'value' => $code,
|
| 50 |
+
'label' => $name
|
| 51 |
+
);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return $options;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Get the transaction types as:
|
| 59 |
+
*
|
| 60 |
+
* key = Code Name
|
| 61 |
+
* value = Localized Name
|
| 62 |
+
*
|
| 63 |
+
* @return array
|
| 64 |
+
*/
|
| 65 |
+
protected function getTransactionTypes()
|
| 66 |
+
{
|
| 67 |
+
return array(
|
| 68 |
+
\Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE =>
|
| 69 |
+
Mage::helper('emerchantpay')->__('Init Recurring Sale'),
|
| 70 |
+
\Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D =>
|
| 71 |
+
Mage::helper('emerchantpay')->__('Init Recurring Sale (3D-Secure)')
|
| 72 |
+
);
|
| 73 |
+
}
|
| 74 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -34,6 +34,7 @@ class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Type
|
|
| 34 |
|
| 35 |
$helper->initLibrary();
|
| 36 |
}
|
|
|
|
| 37 |
/**
|
| 38 |
* Return the transaction types for an Options field
|
| 39 |
*
|
|
@@ -43,7 +44,7 @@ class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Type
|
|
| 43 |
{
|
| 44 |
$options = array();
|
| 45 |
|
| 46 |
-
foreach (
|
| 47 |
$options[] = array(
|
| 48 |
'value' => $code,
|
| 49 |
'label' => $name
|
|
@@ -61,7 +62,7 @@ class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Type
|
|
| 61 |
*
|
| 62 |
* @return array
|
| 63 |
*/
|
| 64 |
-
|
| 65 |
{
|
| 66 |
return array(
|
| 67 |
\Genesis\API\Constants\Transaction\Types::ABNIDEAL =>
|
|
@@ -106,4 +107,4 @@ class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Type
|
|
| 106 |
Mage::helper('emerchantpay')->__('WebMoney'),
|
| 107 |
);
|
| 108 |
}
|
| 109 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 34 |
|
| 35 |
$helper->initLibrary();
|
| 36 |
}
|
| 37 |
+
|
| 38 |
/**
|
| 39 |
* Return the transaction types for an Options field
|
| 40 |
*
|
| 44 |
{
|
| 45 |
$options = array();
|
| 46 |
|
| 47 |
+
foreach ($this->getTransactionTypes() as $code => $name) {
|
| 48 |
$options[] = array(
|
| 49 |
'value' => $code,
|
| 50 |
'label' => $name
|
| 62 |
*
|
| 63 |
* @return array
|
| 64 |
*/
|
| 65 |
+
protected function getTransactionTypes()
|
| 66 |
{
|
| 67 |
return array(
|
| 68 |
\Genesis\API\Constants\Transaction\Types::ABNIDEAL =>
|
| 107 |
Mage::helper('emerchantpay')->__('WebMoney'),
|
| 108 |
);
|
| 109 |
}
|
| 110 |
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
+
*
|
| 5 |
+
* This program is free software; you can redistribute it and/or
|
| 6 |
+
* modify it under the terms of the GNU General Public License
|
| 7 |
+
* as published by the Free Software Foundation; either version 2
|
| 8 |
+
* of the License, or (at your option) any later version.
|
| 9 |
+
*
|
| 10 |
+
* This program is distributed in the hope that it will be useful,
|
| 11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
* GNU General Public License for more details.
|
| 14 |
+
*
|
| 15 |
+
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Class EMerchantPay_Genesis_Model_Admin_Transaction_Type
|
| 22 |
+
*
|
| 23 |
+
* Admin options Drop-down for Genesis Transaction Types
|
| 24 |
+
*/
|
| 25 |
+
class EMerchantPay_Genesis_Model_Admin_Direct_Options_Transaction_Recurring_Type
|
| 26 |
+
{
|
| 27 |
+
/**
|
| 28 |
+
* Pre-load the required files
|
| 29 |
+
*/
|
| 30 |
+
public function __construct()
|
| 31 |
+
{
|
| 32 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
| 33 |
+
$helper = Mage::helper('emerchantpay');
|
| 34 |
+
|
| 35 |
+
$helper->initLibrary();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Return the transaction types for an Options field
|
| 40 |
+
*
|
| 41 |
+
* @return array
|
| 42 |
+
*/
|
| 43 |
+
public function toOptionArray()
|
| 44 |
+
{
|
| 45 |
+
$options = array();
|
| 46 |
+
|
| 47 |
+
foreach ($this->getTransactionTypes() as $code => $name) {
|
| 48 |
+
$options[] = array(
|
| 49 |
+
'value' => $code,
|
| 50 |
+
'label' => $name
|
| 51 |
+
);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return $options;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Get the transaction types as:
|
| 59 |
+
*
|
| 60 |
+
* key = Code Name
|
| 61 |
+
* value = Localized Name
|
| 62 |
+
*
|
| 63 |
+
* @return array
|
| 64 |
+
*/
|
| 65 |
+
protected function getTransactionTypes()
|
| 66 |
+
{
|
| 67 |
+
return array(
|
| 68 |
+
\Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE =>
|
| 69 |
+
Mage::helper('emerchantpay')->__('Init Recurring Sale'),
|
| 70 |
+
\Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D =>
|
| 71 |
+
Mage::helper('emerchantpay')->__('Init Recurring Sale (3D-Secure)')
|
| 72 |
+
);
|
| 73 |
+
}
|
| 74 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -43,7 +43,7 @@ class EMerchantPay_Genesis_Model_Admin_Direct_Options_Transaction_Type
|
|
| 43 |
{
|
| 44 |
$options = array();
|
| 45 |
|
| 46 |
-
foreach (
|
| 47 |
$options[] = array(
|
| 48 |
'value' => $code,
|
| 49 |
'label' => $name
|
|
@@ -61,7 +61,7 @@ class EMerchantPay_Genesis_Model_Admin_Direct_Options_Transaction_Type
|
|
| 61 |
*
|
| 62 |
* @return array
|
| 63 |
*/
|
| 64 |
-
|
| 65 |
{
|
| 66 |
return array(
|
| 67 |
\Genesis\API\Constants\Transaction\Types::AUTHORIZE =>
|
|
@@ -74,4 +74,4 @@ class EMerchantPay_Genesis_Model_Admin_Direct_Options_Transaction_Type
|
|
| 74 |
Mage::helper('emerchantpay')->__('Sale (3D-Secure)'),
|
| 75 |
);
|
| 76 |
}
|
| 77 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 43 |
{
|
| 44 |
$options = array();
|
| 45 |
|
| 46 |
+
foreach ($this->getTransactionTypes() as $code => $name) {
|
| 47 |
$options[] = array(
|
| 48 |
'value' => $code,
|
| 49 |
'label' => $name
|
| 61 |
*
|
| 62 |
* @return array
|
| 63 |
*/
|
| 64 |
+
protected function getTransactionTypes()
|
| 65 |
{
|
| 66 |
return array(
|
| 67 |
\Genesis\API\Constants\Transaction\Types::AUTHORIZE =>
|
| 74 |
Mage::helper('emerchantpay')->__('Sale (3D-Secure)'),
|
| 75 |
);
|
| 76 |
}
|
| 77 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -33,7 +33,7 @@ class EMerchantPay_Genesis_Model_Admin_Environment
|
|
| 33 |
{
|
| 34 |
$options = array();
|
| 35 |
|
| 36 |
-
foreach (
|
| 37 |
$options[] = array(
|
| 38 |
'value' => $code,
|
| 39 |
'label' => $name
|
|
@@ -48,11 +48,11 @@ class EMerchantPay_Genesis_Model_Admin_Environment
|
|
| 48 |
*
|
| 49 |
* @return array
|
| 50 |
*/
|
| 51 |
-
|
| 52 |
{
|
| 53 |
return array(
|
| 54 |
'sandbox' => Mage::helper('emerchantpay')->__('Yes'),
|
| 55 |
'production' => Mage::helper('emerchantpay')->__('No'),
|
| 56 |
);
|
| 57 |
}
|
| 58 |
-
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 33 |
{
|
| 34 |
$options = array();
|
| 35 |
|
| 36 |
+
foreach ($this->getEnvironmentOptions() as $code => $name) {
|
| 37 |
$options[] = array(
|
| 38 |
'value' => $code,
|
| 39 |
'label' => $name
|
| 48 |
*
|
| 49 |
* @return array
|
| 50 |
*/
|
| 51 |
+
protected function getEnvironmentOptions()
|
| 52 |
{
|
| 53 |
return array(
|
| 54 |
'sandbox' => Mage::helper('emerchantpay')->__('Yes'),
|
| 55 |
'production' => Mage::helper('emerchantpay')->__('No'),
|
| 56 |
);
|
| 57 |
}
|
| 58 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,14 +13,21 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
{
|
| 22 |
protected $_code = 'emerchantpay_checkout';
|
| 23 |
|
|
|
|
|
|
|
| 24 |
protected $_formBlockType = 'emerchantpay/form_checkout';
|
| 25 |
protected $_infoBlockType = 'emerchantpay/info_checkout';
|
| 26 |
|
|
@@ -34,8 +41,9 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 34 |
protected $_canUseInternal = false;
|
| 35 |
protected $_canUseCheckout = true;
|
| 36 |
|
| 37 |
-
protected $_canUseForMultishipping
|
| 38 |
-
protected $_canFetchTransactionInfo
|
|
|
|
| 39 |
|
| 40 |
/**
|
| 41 |
* WPF Create method piggyback-ing the Magento's internal Authorize method
|
|
@@ -60,6 +68,8 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 60 |
|
| 61 |
$genesis = new \Genesis\Genesis('WPF\Create');
|
| 62 |
|
|
|
|
|
|
|
| 63 |
$genesis
|
| 64 |
->request()
|
| 65 |
->setTransactionId(
|
|
@@ -67,12 +77,14 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 67 |
$order->getIncrementId()
|
| 68 |
)
|
| 69 |
)
|
| 70 |
-
->setCurrency(
|
|
|
|
|
|
|
| 71 |
->setAmount($amount)
|
| 72 |
->setUsage(
|
| 73 |
$this->getHelper()->__('Magento Payment')
|
| 74 |
)
|
| 75 |
-
->setDescription($
|
| 76 |
->setCustomerPhone($billing->getTelephone())
|
| 77 |
->setCustomerEmail($order->getCustomerEmail())
|
| 78 |
->setNotificationUrl(
|
|
@@ -109,10 +121,29 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 109 |
foreach ($this->getTransactionTypes() as $transaction_type) {
|
| 110 |
if (is_array($transaction_type)) {
|
| 111 |
$genesis->request()->addTransactionType(
|
| 112 |
-
$transaction_type['name'],
|
|
|
|
| 113 |
);
|
| 114 |
} else {
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
}
|
| 118 |
|
|
@@ -163,8 +194,13 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 163 |
|
| 164 |
/* Capture should only be possible, when Authorize Transaction Exists */
|
| 165 |
if (!isset($authorize) || $authorize === false) {
|
| 166 |
-
Mage::log(
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
}
|
| 169 |
|
| 170 |
$reference_id = $authorize->getTxnId();
|
|
@@ -185,7 +221,7 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 185 |
$reference_id
|
| 186 |
)
|
| 187 |
->setCurrency(
|
| 188 |
-
$payment->getOrder()->
|
| 189 |
)
|
| 190 |
->setAmount(
|
| 191 |
$amount
|
|
@@ -193,9 +229,11 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 193 |
|
| 194 |
$genesis->execute();
|
| 195 |
|
|
|
|
|
|
|
| 196 |
$payment
|
| 197 |
->setTransactionId(
|
| 198 |
-
$
|
| 199 |
)
|
| 200 |
->setParentTransactionId(
|
| 201 |
$reference_id
|
|
@@ -208,14 +246,25 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 208 |
)
|
| 209 |
->setTransactionAdditionalInfo(
|
| 210 |
array(
|
| 211 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 212 |
-
$
|
| 213 |
-
|
|
|
|
| 214 |
),
|
| 215 |
null
|
| 216 |
);
|
| 217 |
|
| 218 |
$payment->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
} catch (Exception $exception) {
|
| 220 |
Mage::logException($exception);
|
| 221 |
|
|
@@ -243,13 +292,20 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 243 |
$this->getHelper()->initClient($this->getCode());
|
| 244 |
|
| 245 |
$this->getHelper()->setTokenByPaymentTransaction($payment);
|
| 246 |
-
|
| 247 |
-
$capture = $payment->lookupTransaction(
|
|
|
|
|
|
|
|
|
|
| 248 |
|
| 249 |
/* Refund Transaction is only possible, when Capture Transaction Exists */
|
| 250 |
if (!isset($capture) || $capture === false) {
|
| 251 |
-
|
| 252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
|
| 255 |
$reference_id = $capture->getTxnId();
|
|
@@ -259,26 +315,28 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 259 |
$genesis
|
| 260 |
->request()
|
| 261 |
->setTransactionId(
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
)
|
| 266 |
->setRemoteIp(
|
| 267 |
-
|
| 268 |
)
|
| 269 |
->setReferenceId(
|
| 270 |
-
|
| 271 |
)
|
| 272 |
->setCurrency(
|
| 273 |
-
|
| 274 |
)
|
| 275 |
->setAmount($amount);
|
| 276 |
|
| 277 |
$genesis->execute();
|
| 278 |
|
|
|
|
|
|
|
| 279 |
$payment
|
| 280 |
->setTransactionId(
|
| 281 |
-
$
|
| 282 |
)
|
| 283 |
->setParentTransactionId(
|
| 284 |
$reference_id
|
|
@@ -291,14 +349,42 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 291 |
)
|
| 292 |
->setTransactionAdditionalInfo(
|
| 293 |
array(
|
| 294 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 295 |
-
$
|
| 296 |
-
|
|
|
|
| 297 |
),
|
| 298 |
null
|
| 299 |
);
|
| 300 |
|
| 301 |
$payment->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
} catch (Exception $exception) {
|
| 303 |
Mage::logException($exception);
|
| 304 |
|
|
@@ -351,9 +437,11 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 351 |
|
| 352 |
$genesis->execute();
|
| 353 |
|
|
|
|
|
|
|
| 354 |
$payment
|
| 355 |
->setTransactionId(
|
| 356 |
-
$
|
| 357 |
)
|
| 358 |
->setParentTransactionId(
|
| 359 |
$reference_id
|
|
@@ -366,14 +454,25 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 366 |
)
|
| 367 |
->setTransactionAdditionalInfo(
|
| 368 |
array(
|
| 369 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 370 |
-
$
|
| 371 |
-
|
|
|
|
| 372 |
),
|
| 373 |
null
|
| 374 |
);
|
| 375 |
|
| 376 |
$payment->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
} catch (Exception $exception) {
|
| 378 |
Mage::logException($exception);
|
| 379 |
|
|
@@ -424,8 +523,7 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 424 |
// Try to extract transaction details from the Gateway response
|
| 425 |
if ($reconcile->unique_id == $transactionId) {
|
| 426 |
$transaction_details = $reconcile;
|
| 427 |
-
}
|
| 428 |
-
else {
|
| 429 |
if ($reconcile->payment_transaction instanceof stdClass) {
|
| 430 |
if ($reconcile->payment_transaction->unique_id == $transactionId) {
|
| 431 |
$transaction_details = $reconcile->payment_transaction;
|
|
@@ -449,9 +547,10 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 449 |
// Set the default/updated transaction details
|
| 450 |
$payment->setAdditionalInformation(
|
| 451 |
array(
|
| 452 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 453 |
-
$
|
| 454 |
-
|
|
|
|
| 455 |
),
|
| 456 |
null
|
| 457 |
);
|
|
@@ -495,13 +594,22 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 495 |
return false;
|
| 496 |
}
|
| 497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
public function processNotification($checkout_transaction)
|
| 499 |
{
|
| 500 |
try {
|
| 501 |
$this->getHelper()->initClient($this->getCode());
|
| 502 |
|
| 503 |
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
| 504 |
-
$transaction = Mage::getModel('sales/order_payment_transaction')->load(
|
|
|
|
|
|
|
|
|
|
| 505 |
|
| 506 |
$order = $transaction->getOrder();
|
| 507 |
|
|
@@ -531,24 +639,26 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 531 |
->resetTransactionAdditionalInfo()
|
| 532 |
->setTransactionAdditionalInfo(
|
| 533 |
array(
|
| 534 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 535 |
-
$
|
| 536 |
-
|
|
|
|
| 537 |
),
|
| 538 |
null
|
| 539 |
);
|
| 540 |
|
| 541 |
if ($payment_transaction->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 542 |
$payment->setIsTransactionClosed(false);
|
| 543 |
-
}
|
| 544 |
-
else {
|
| 545 |
$payment->setIsTransactionClosed(true);
|
| 546 |
}
|
| 547 |
|
| 548 |
switch ($payment_transaction->transaction_type) {
|
| 549 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
| 550 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
| 551 |
-
$payment->registerAuthorizationNotification(
|
|
|
|
|
|
|
| 552 |
break;
|
| 553 |
case \Genesis\API\Constants\Transaction\Types::ABNIDEAL:
|
| 554 |
case \Genesis\API\Constants\Transaction\Types::CASHU:
|
|
@@ -558,19 +668,46 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 558 |
case \Genesis\API\Constants\Transaction\Types::SALE:
|
| 559 |
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
| 560 |
case \Genesis\API\Constants\Transaction\Types::SOFORT:
|
| 561 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 562 |
break;
|
| 563 |
default:
|
| 564 |
break;
|
| 565 |
}
|
| 566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
|
| 568 |
$payment->save();
|
| 569 |
}
|
| 570 |
|
| 571 |
$this->getHelper()->setOrderState(
|
| 572 |
$order,
|
| 573 |
-
isset($payment_transaction)
|
|
|
|
|
|
|
| 574 |
);
|
| 575 |
|
| 576 |
return true;
|
|
@@ -582,6 +719,21 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 582 |
return false;
|
| 583 |
}
|
| 584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
/**
|
| 586 |
* Get the selected transaction types in array
|
| 587 |
*
|
|
@@ -591,8 +743,12 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 591 |
{
|
| 592 |
$processed_list = array();
|
| 593 |
|
| 594 |
-
$selected_types =
|
| 595 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
);
|
| 597 |
|
| 598 |
$alias_map = array(
|
|
@@ -646,6 +802,13 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 646 |
return $this->getHelper()->getRedirectUrl('checkout');
|
| 647 |
}
|
| 648 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 649 |
/**
|
| 650 |
* Get the helper or return its instance
|
| 651 |
*
|
|
@@ -661,4 +824,321 @@ class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abst
|
|
| 661 |
return Mage::helper($helper);
|
| 662 |
}
|
| 663 |
}
|
| 664 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 20 |
+
/**
|
| 21 |
+
* EMerchantPay Checkout Payment Method Model
|
| 22 |
+
*
|
| 23 |
+
* Class EMerchantPay_Genesis_Model_Checkout
|
| 24 |
+
*/
|
| 25 |
+
class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abstract implements Mage_Payment_Model_Recurring_Profile_MethodInterface
|
| 26 |
{
|
| 27 |
protected $_code = 'emerchantpay_checkout';
|
| 28 |
|
| 29 |
+
const LOG_FILE_NAME = "emerchantpay_genesis.log";
|
| 30 |
+
|
| 31 |
protected $_formBlockType = 'emerchantpay/form_checkout';
|
| 32 |
protected $_infoBlockType = 'emerchantpay/info_checkout';
|
| 33 |
|
| 41 |
protected $_canUseInternal = false;
|
| 42 |
protected $_canUseCheckout = true;
|
| 43 |
|
| 44 |
+
protected $_canUseForMultishipping = false;
|
| 45 |
+
protected $_canFetchTransactionInfo = true;
|
| 46 |
+
protected $_canManageRecurringProfiles = true;
|
| 47 |
|
| 48 |
/**
|
| 49 |
* WPF Create method piggyback-ing the Magento's internal Authorize method
|
| 68 |
|
| 69 |
$genesis = new \Genesis\Genesis('WPF\Create');
|
| 70 |
|
| 71 |
+
$orderItemsList = $this->getHelper()->getItemList($order);
|
| 72 |
+
|
| 73 |
$genesis
|
| 74 |
->request()
|
| 75 |
->setTransactionId(
|
| 77 |
$order->getIncrementId()
|
| 78 |
)
|
| 79 |
)
|
| 80 |
+
->setCurrency(
|
| 81 |
+
$order->getOrderCurrencyCode()
|
| 82 |
+
)
|
| 83 |
->setAmount($amount)
|
| 84 |
->setUsage(
|
| 85 |
$this->getHelper()->__('Magento Payment')
|
| 86 |
)
|
| 87 |
+
->setDescription($orderItemsList)
|
| 88 |
->setCustomerPhone($billing->getTelephone())
|
| 89 |
->setCustomerEmail($order->getCustomerEmail())
|
| 90 |
->setNotificationUrl(
|
| 121 |
foreach ($this->getTransactionTypes() as $transaction_type) {
|
| 122 |
if (is_array($transaction_type)) {
|
| 123 |
$genesis->request()->addTransactionType(
|
| 124 |
+
$transaction_type['name'],
|
| 125 |
+
$transaction_type['parameters']
|
| 126 |
);
|
| 127 |
} else {
|
| 128 |
+
if (\Genesis\API\Constants\Transaction\Types::isPayByVoucher($transaction_type)) {
|
| 129 |
+
$parameters = [
|
| 130 |
+
'card_type' =>
|
| 131 |
+
\Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::VIRTUAL,
|
| 132 |
+
'redeem_type' =>
|
| 133 |
+
\Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::INSTANT
|
| 134 |
+
];
|
| 135 |
+
if ($transaction_type == \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY) {
|
| 136 |
+
$parameters['product_name'] = $orderItemsList;
|
| 137 |
+
$parameters['product_category'] = $orderItemsList;
|
| 138 |
+
}
|
| 139 |
+
$genesis
|
| 140 |
+
->request()
|
| 141 |
+
->addTransactionType($transaction_type, $parameters);
|
| 142 |
+
} else {
|
| 143 |
+
$genesis
|
| 144 |
+
->request()
|
| 145 |
+
->addTransactionType($transaction_type);
|
| 146 |
+
}
|
| 147 |
}
|
| 148 |
}
|
| 149 |
|
| 194 |
|
| 195 |
/* Capture should only be possible, when Authorize Transaction Exists */
|
| 196 |
if (!isset($authorize) || $authorize === false) {
|
| 197 |
+
Mage::log(
|
| 198 |
+
'Capture transaction for order #' .
|
| 199 |
+
$payment->getOrder()->getIncrementId() .
|
| 200 |
+
' cannot be finished (No Authorize Transaction exists)'
|
| 201 |
+
);
|
| 202 |
+
|
| 203 |
+
return $this;
|
| 204 |
}
|
| 205 |
|
| 206 |
$reference_id = $authorize->getTxnId();
|
| 221 |
$reference_id
|
| 222 |
)
|
| 223 |
->setCurrency(
|
| 224 |
+
$payment->getOrder()->getOrderCurrencyCode()
|
| 225 |
)
|
| 226 |
->setAmount(
|
| 227 |
$amount
|
| 229 |
|
| 230 |
$genesis->execute();
|
| 231 |
|
| 232 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 233 |
+
|
| 234 |
$payment
|
| 235 |
->setTransactionId(
|
| 236 |
+
$responseObject->unique_id
|
| 237 |
)
|
| 238 |
->setParentTransactionId(
|
| 239 |
$reference_id
|
| 246 |
)
|
| 247 |
->setTransactionAdditionalInfo(
|
| 248 |
array(
|
| 249 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 250 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 251 |
+
$responseObject
|
| 252 |
+
)
|
| 253 |
),
|
| 254 |
null
|
| 255 |
);
|
| 256 |
|
| 257 |
$payment->save();
|
| 258 |
+
|
| 259 |
+
if ($responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 260 |
+
$this->getHelper()->getAdminSession()->addSuccess(
|
| 261 |
+
$responseObject->message
|
| 262 |
+
);
|
| 263 |
+
} else {
|
| 264 |
+
$this->getHelper()->getAdminSession()->addError(
|
| 265 |
+
$responseObject->message
|
| 266 |
+
);
|
| 267 |
+
}
|
| 268 |
} catch (Exception $exception) {
|
| 269 |
Mage::logException($exception);
|
| 270 |
|
| 292 |
$this->getHelper()->initClient($this->getCode());
|
| 293 |
|
| 294 |
$this->getHelper()->setTokenByPaymentTransaction($payment);
|
| 295 |
+
|
| 296 |
+
$capture = $payment->lookupTransaction(
|
| 297 |
+
null,
|
| 298 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
|
| 299 |
+
);
|
| 300 |
|
| 301 |
/* Refund Transaction is only possible, when Capture Transaction Exists */
|
| 302 |
if (!isset($capture) || $capture === false) {
|
| 303 |
+
Mage::log(
|
| 304 |
+
'Refund transaction for order #' .
|
| 305 |
+
$payment->getOrder()->getIncrementId() .
|
| 306 |
+
' could not be completed! (No Capture Transaction Exists'
|
| 307 |
+
);
|
| 308 |
+
return $this;
|
| 309 |
}
|
| 310 |
|
| 311 |
$reference_id = $capture->getTxnId();
|
| 315 |
$genesis
|
| 316 |
->request()
|
| 317 |
->setTransactionId(
|
| 318 |
+
$this->getHelper()->genTransactionId(
|
| 319 |
+
$payment->getOrder()->getIncrementId()
|
| 320 |
+
)
|
| 321 |
)
|
| 322 |
->setRemoteIp(
|
| 323 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
| 324 |
)
|
| 325 |
->setReferenceId(
|
| 326 |
+
$reference_id
|
| 327 |
)
|
| 328 |
->setCurrency(
|
| 329 |
+
$payment->getOrder()->getOrderCurrencyCode()
|
| 330 |
)
|
| 331 |
->setAmount($amount);
|
| 332 |
|
| 333 |
$genesis->execute();
|
| 334 |
|
| 335 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 336 |
+
|
| 337 |
$payment
|
| 338 |
->setTransactionId(
|
| 339 |
+
$responseObject->unique_id
|
| 340 |
)
|
| 341 |
->setParentTransactionId(
|
| 342 |
$reference_id
|
| 349 |
)
|
| 350 |
->setTransactionAdditionalInfo(
|
| 351 |
array(
|
| 352 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 353 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 354 |
+
$responseObject
|
| 355 |
+
)
|
| 356 |
),
|
| 357 |
null
|
| 358 |
);
|
| 359 |
|
| 360 |
$payment->save();
|
| 361 |
+
|
| 362 |
+
if ($responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 363 |
+
$this->getHelper()->getAdminSession()->addSuccess(
|
| 364 |
+
$responseObject->message
|
| 365 |
+
);
|
| 366 |
+
|
| 367 |
+
if (isset($capture) && $capture !== false) {
|
| 368 |
+
$canceledProfileReferenceId = $this->getHelper()->checkAndCancelRecurringProfile(
|
| 369 |
+
$capture
|
| 370 |
+
);
|
| 371 |
+
|
| 372 |
+
if (isset($canceledProfileReferenceId)) {
|
| 373 |
+
$this->getHelper()->getAdminSession()->addNotice(
|
| 374 |
+
$this->getHelper()->__(
|
| 375 |
+
sprintf(
|
| 376 |
+
"Profile #%s has been canceled!",
|
| 377 |
+
$canceledProfileReferenceId
|
| 378 |
+
)
|
| 379 |
+
)
|
| 380 |
+
);
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
} else {
|
| 384 |
+
$this->getHelper()->getAdminSession()->addError(
|
| 385 |
+
$responseObject->message
|
| 386 |
+
);
|
| 387 |
+
}
|
| 388 |
} catch (Exception $exception) {
|
| 389 |
Mage::logException($exception);
|
| 390 |
|
| 437 |
|
| 438 |
$genesis->execute();
|
| 439 |
|
| 440 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 441 |
+
|
| 442 |
$payment
|
| 443 |
->setTransactionId(
|
| 444 |
+
$responseObject->unique_id
|
| 445 |
)
|
| 446 |
->setParentTransactionId(
|
| 447 |
$reference_id
|
| 454 |
)
|
| 455 |
->setTransactionAdditionalInfo(
|
| 456 |
array(
|
| 457 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 458 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 459 |
+
$responseObject
|
| 460 |
+
)
|
| 461 |
),
|
| 462 |
null
|
| 463 |
);
|
| 464 |
|
| 465 |
$payment->save();
|
| 466 |
+
|
| 467 |
+
if ($responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 468 |
+
$this->getHelper()->getAdminSession()->addSuccess(
|
| 469 |
+
$responseObject->message
|
| 470 |
+
);
|
| 471 |
+
} else {
|
| 472 |
+
$this->getHelper()->getAdminSession()->addError(
|
| 473 |
+
$responseObject->message
|
| 474 |
+
);
|
| 475 |
+
}
|
| 476 |
} catch (Exception $exception) {
|
| 477 |
Mage::logException($exception);
|
| 478 |
|
| 523 |
// Try to extract transaction details from the Gateway response
|
| 524 |
if ($reconcile->unique_id == $transactionId) {
|
| 525 |
$transaction_details = $reconcile;
|
| 526 |
+
} else {
|
|
|
|
| 527 |
if ($reconcile->payment_transaction instanceof stdClass) {
|
| 528 |
if ($reconcile->payment_transaction->unique_id == $transactionId) {
|
| 529 |
$transaction_details = $reconcile->payment_transaction;
|
| 547 |
// Set the default/updated transaction details
|
| 548 |
$payment->setAdditionalInformation(
|
| 549 |
array(
|
| 550 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 551 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 552 |
+
$transaction_details
|
| 553 |
+
)
|
| 554 |
),
|
| 555 |
null
|
| 556 |
);
|
| 594 |
return false;
|
| 595 |
}
|
| 596 |
|
| 597 |
+
/**
|
| 598 |
+
* Handle an incoming Genesis notification
|
| 599 |
+
*
|
| 600 |
+
* @param stdClass $reconcile
|
| 601 |
+
* @return bool
|
| 602 |
+
*/
|
| 603 |
public function processNotification($checkout_transaction)
|
| 604 |
{
|
| 605 |
try {
|
| 606 |
$this->getHelper()->initClient($this->getCode());
|
| 607 |
|
| 608 |
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
| 609 |
+
$transaction = Mage::getModel('sales/order_payment_transaction')->load(
|
| 610 |
+
$checkout_transaction->unique_id,
|
| 611 |
+
'txn_id'
|
| 612 |
+
);
|
| 613 |
|
| 614 |
$order = $transaction->getOrder();
|
| 615 |
|
| 639 |
->resetTransactionAdditionalInfo()
|
| 640 |
->setTransactionAdditionalInfo(
|
| 641 |
array(
|
| 642 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 643 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 644 |
+
$payment_transaction
|
| 645 |
+
)
|
| 646 |
),
|
| 647 |
null
|
| 648 |
);
|
| 649 |
|
| 650 |
if ($payment_transaction->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 651 |
$payment->setIsTransactionClosed(false);
|
| 652 |
+
} else {
|
|
|
|
| 653 |
$payment->setIsTransactionClosed(true);
|
| 654 |
}
|
| 655 |
|
| 656 |
switch ($payment_transaction->transaction_type) {
|
| 657 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
| 658 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
| 659 |
+
$payment->registerAuthorizationNotification(
|
| 660 |
+
$payment_transaction->amount
|
| 661 |
+
);
|
| 662 |
break;
|
| 663 |
case \Genesis\API\Constants\Transaction\Types::ABNIDEAL:
|
| 664 |
case \Genesis\API\Constants\Transaction\Types::CASHU:
|
| 668 |
case \Genesis\API\Constants\Transaction\Types::SALE:
|
| 669 |
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
| 670 |
case \Genesis\API\Constants\Transaction\Types::SOFORT:
|
| 671 |
+
case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE:
|
| 672 |
+
case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D:
|
| 673 |
+
$payment->registerCaptureNotification(
|
| 674 |
+
$payment_transaction->amount
|
| 675 |
+
);
|
| 676 |
break;
|
| 677 |
default:
|
| 678 |
break;
|
| 679 |
}
|
| 680 |
|
| 681 |
+
$isTransactionApproved =
|
| 682 |
+
($payment_transaction->status == \Genesis\API\Constants\Transaction\States::APPROVED);
|
| 683 |
+
|
| 684 |
+
if ($this->getHelper()->getIsTransactionTypeInitRecurring($payment_transaction->transaction_type)) {
|
| 685 |
+
$recurringProfile = Mage::getModel('sales/recurring_profile')->load(
|
| 686 |
+
$checkout_transaction->unique_id,
|
| 687 |
+
'reference_id'
|
| 688 |
+
);
|
| 689 |
+
|
| 690 |
+
if ($recurringProfile && $recurringProfile->getId()) {
|
| 691 |
+
if ($recurringProfile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_PENDING) {
|
| 692 |
+
$recurringProfile->setState(
|
| 693 |
+
($isTransactionApproved
|
| 694 |
+
? Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE
|
| 695 |
+
: Mage_Sales_Model_Recurring_Profile::STATE_CANCELED
|
| 696 |
+
)
|
| 697 |
+
);
|
| 698 |
+
$recurringProfile->save();
|
| 699 |
+
}
|
| 700 |
+
}
|
| 701 |
+
}
|
| 702 |
|
| 703 |
$payment->save();
|
| 704 |
}
|
| 705 |
|
| 706 |
$this->getHelper()->setOrderState(
|
| 707 |
$order,
|
| 708 |
+
isset($payment_transaction)
|
| 709 |
+
? $payment_transaction->status
|
| 710 |
+
: $checkout_transaction->status
|
| 711 |
);
|
| 712 |
|
| 713 |
return true;
|
| 719 |
return false;
|
| 720 |
}
|
| 721 |
|
| 722 |
+
/**
|
| 723 |
+
* Returns the available recurring transaction type for the Checkout PM
|
| 724 |
+
* @return array
|
| 725 |
+
*/
|
| 726 |
+
public function getRecurringTransactionTypes()
|
| 727 |
+
{
|
| 728 |
+
return array_map(
|
| 729 |
+
'trim',
|
| 730 |
+
explode(
|
| 731 |
+
',',
|
| 732 |
+
$this->getConfigData('recurring_transaction_types')
|
| 733 |
+
)
|
| 734 |
+
);
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
/**
|
| 738 |
* Get the selected transaction types in array
|
| 739 |
*
|
| 743 |
{
|
| 744 |
$processed_list = array();
|
| 745 |
|
| 746 |
+
$selected_types = array_map(
|
| 747 |
+
'trim',
|
| 748 |
+
explode(
|
| 749 |
+
',',
|
| 750 |
+
$this->getConfigData('genesis_types')
|
| 751 |
+
)
|
| 752 |
);
|
| 753 |
|
| 754 |
$alias_map = array(
|
| 802 |
return $this->getHelper()->getRedirectUrl('checkout');
|
| 803 |
}
|
| 804 |
|
| 805 |
+
/*
|
| 806 |
+
public function getCheckoutRedirectUrl()
|
| 807 |
+
{
|
| 808 |
+
return Mage::getUrl('checkout/onepage/index', array('_fragment' => 'review', '_secure' => true));
|
| 809 |
+
}*/
|
| 810 |
+
|
| 811 |
+
|
| 812 |
/**
|
| 813 |
* Get the helper or return its instance
|
| 814 |
*
|
| 824 |
return Mage::helper($helper);
|
| 825 |
}
|
| 826 |
}
|
| 827 |
+
|
| 828 |
+
/**
|
| 829 |
+
* Determines if the Payment Method should be available on the checkout page
|
| 830 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 831 |
+
* @param int|null $checksBitMask
|
| 832 |
+
* @return bool
|
| 833 |
+
*/
|
| 834 |
+
public function isApplicableToQuote($quote, $checksBitMask)
|
| 835 |
+
{
|
| 836 |
+
return
|
| 837 |
+
parent::isApplicableToQuote($quote, $checksBitMask) ||
|
| 838 |
+
(
|
| 839 |
+
($checksBitMask & self::CHECK_ORDER_TOTAL_MIN_MAX) &&
|
| 840 |
+
$this->getHelper()->validateRecurringMethodMinMaxOrderTotal(
|
| 841 |
+
$this->getCode(),
|
| 842 |
+
$quote
|
| 843 |
+
)
|
| 844 |
+
);
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
/**
|
| 848 |
+
* Determines if the Payment Method should be visible on the chechout page or not
|
| 849 |
+
* @param Mage_Sales_Model_Quote|null $quote
|
| 850 |
+
* @return bool
|
| 851 |
+
*/
|
| 852 |
+
public function isAvailable($quote = null)
|
| 853 |
+
{
|
| 854 |
+
return
|
| 855 |
+
parent::isAvailable($quote) &&
|
| 856 |
+
$this->getHelper()->getIsMethodAvailable(
|
| 857 |
+
$this->getCode(),
|
| 858 |
+
$quote,
|
| 859 |
+
false,
|
| 860 |
+
true
|
| 861 |
+
);
|
| 862 |
+
}
|
| 863 |
+
|
| 864 |
+
/**
|
| 865 |
+
* Validate RP data
|
| 866 |
+
*
|
| 867 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 868 |
+
* @return $this
|
| 869 |
+
*/
|
| 870 |
+
public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
| 871 |
+
{
|
| 872 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 873 |
+
$isLogEnabled = !empty($logFileName);
|
| 874 |
+
|
| 875 |
+
if ($isLogEnabled) {
|
| 876 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 877 |
+
}
|
| 878 |
+
|
| 879 |
+
return $this;
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
/**
|
| 883 |
+
* Submit RP to the gateway
|
| 884 |
+
*
|
| 885 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 886 |
+
* @param Mage_Payment_Model_Info $payment
|
| 887 |
+
* @return $this
|
| 888 |
+
*/
|
| 889 |
+
public function submitRecurringProfile(
|
| 890 |
+
Mage_Payment_Model_Recurring_Profile $profile,
|
| 891 |
+
Mage_Payment_Model_Info $payment
|
| 892 |
+
) {
|
| 893 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 894 |
+
$isLogEnabled = !empty($logFileName);
|
| 895 |
+
|
| 896 |
+
if ($isLogEnabled) {
|
| 897 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
$this->getHelper()->initClient($this->getCode());
|
| 901 |
+
|
| 902 |
+
$genesis = new \Genesis\Genesis("WPF\\Create");
|
| 903 |
+
|
| 904 |
+
$amount = $profile->getInitAmount() ?: 0;
|
| 905 |
+
|
| 906 |
+
if (empty($amount)) {
|
| 907 |
+
Mage::throwException(
|
| 908 |
+
$this->getHelper()->__("Unable to create Init Recurring Transaction! Initial Fee must not be empty!")
|
| 909 |
+
);
|
| 910 |
+
}
|
| 911 |
+
|
| 912 |
+
$genesis
|
| 913 |
+
->request()
|
| 914 |
+
->setTransactionId(
|
| 915 |
+
$profile->getInternalReferenceId()
|
| 916 |
+
)
|
| 917 |
+
->setCurrency(
|
| 918 |
+
$payment->getQuote()->getStoreCurrencyCode()
|
| 919 |
+
)
|
| 920 |
+
->setAmount(
|
| 921 |
+
$amount
|
| 922 |
+
)
|
| 923 |
+
->setUsage(
|
| 924 |
+
$this->getHelper()->__('Magento Init Recurring Payment')
|
| 925 |
+
)
|
| 926 |
+
->setDescription(
|
| 927 |
+
$this->getHelper()->getRecurringProfileItemDescription(
|
| 928 |
+
$profile
|
| 929 |
+
)
|
| 930 |
+
)
|
| 931 |
+
->setCustomerPhone(
|
| 932 |
+
$profile->getBillingAddressInfo()['telephone']
|
| 933 |
+
)
|
| 934 |
+
->setCustomerEmail(
|
| 935 |
+
$profile->getBillingAddressInfo()['email']
|
| 936 |
+
)
|
| 937 |
+
->setNotificationUrl(
|
| 938 |
+
$this->getHelper()->getNotifyURL('checkout')
|
| 939 |
+
)
|
| 940 |
+
->setReturnSuccessUrl(
|
| 941 |
+
$this->getHelper()->getSuccessURL('checkout')
|
| 942 |
+
)
|
| 943 |
+
->setReturnFailureUrl(
|
| 944 |
+
$this->getHelper()->getFailureURL('checkout')
|
| 945 |
+
)
|
| 946 |
+
->setReturnCancelUrl(
|
| 947 |
+
$this->getHelper()->getCancelURL('checkout')
|
| 948 |
+
)
|
| 949 |
+
//Billing
|
| 950 |
+
->setBillingFirstName(
|
| 951 |
+
$profile->getBillingAddressInfo()['firstname']
|
| 952 |
+
)
|
| 953 |
+
->setBillingLastName(
|
| 954 |
+
$profile->getBillingAddressInfo()['lastname']
|
| 955 |
+
)
|
| 956 |
+
->setBillingAddress1(
|
| 957 |
+
$profile->getBillingAddressInfo()['street']
|
| 958 |
+
)
|
| 959 |
+
->setBillingZipCode(
|
| 960 |
+
$profile->getBillingAddressInfo()['postcode']
|
| 961 |
+
)
|
| 962 |
+
->setBillingCity(
|
| 963 |
+
$profile->getBillingAddressInfo()['city']
|
| 964 |
+
)
|
| 965 |
+
->setBillingState(
|
| 966 |
+
$profile->getBillingAddressInfo()['region']
|
| 967 |
+
)
|
| 968 |
+
->setBillingCountry(
|
| 969 |
+
$profile->getBillingAddressInfo()['country_id']
|
| 970 |
+
)
|
| 971 |
+
//Shipping
|
| 972 |
+
->setShippingFirstName(
|
| 973 |
+
$profile->getShippingAddressInfo()['firstname']
|
| 974 |
+
)
|
| 975 |
+
->setShippingLastName(
|
| 976 |
+
$profile->getShippingAddressInfo()['lastname']
|
| 977 |
+
)
|
| 978 |
+
->setShippingAddress1(
|
| 979 |
+
$profile->getShippingAddressInfo()['street']
|
| 980 |
+
)
|
| 981 |
+
->setShippingZipCode(
|
| 982 |
+
$profile->getShippingAddressInfo()['postcode']
|
| 983 |
+
)
|
| 984 |
+
->setShippingCity(
|
| 985 |
+
$profile->getShippingAddressInfo()['city']
|
| 986 |
+
)
|
| 987 |
+
->setShippingState(
|
| 988 |
+
$profile->getShippingAddressInfo()['region']
|
| 989 |
+
)
|
| 990 |
+
->setShippingCountry(
|
| 991 |
+
$profile->getShippingAddressInfo()['country_id']
|
| 992 |
+
)
|
| 993 |
+
->setLanguage(
|
| 994 |
+
$this->getHelper()->getLocale()
|
| 995 |
+
);
|
| 996 |
+
|
| 997 |
+
|
| 998 |
+
foreach ($this->getRecurringTransactionTypes() as $transaction_type) {
|
| 999 |
+
$genesis->request()->addTransactionType($transaction_type);
|
| 1000 |
+
}
|
| 1001 |
+
|
| 1002 |
+
try {
|
| 1003 |
+
$genesis->execute();
|
| 1004 |
+
|
| 1005 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 1006 |
+
|
| 1007 |
+
if (isset($responseObject->redirect_url)) {
|
| 1008 |
+
$this
|
| 1009 |
+
->getHelper()
|
| 1010 |
+
->getCheckoutSession()
|
| 1011 |
+
->setEmerchantPayCheckoutRedirectUrl(
|
| 1012 |
+
$responseObject->redirect_url
|
| 1013 |
+
);
|
| 1014 |
+
}
|
| 1015 |
+
|
| 1016 |
+
$profile->setReferenceId(
|
| 1017 |
+
$responseObject->unique_id
|
| 1018 |
+
);
|
| 1019 |
+
|
| 1020 |
+
$payment->setSkipTransactionCreation(true);
|
| 1021 |
+
|
| 1022 |
+
|
| 1023 |
+
$productItemInfo = new Varien_Object;
|
| 1024 |
+
$productItemInfo->setPaymentType(
|
| 1025 |
+
Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_INITIAL
|
| 1026 |
+
);
|
| 1027 |
+
$productItemInfo->setPrice(
|
| 1028 |
+
$amount
|
| 1029 |
+
);
|
| 1030 |
+
|
| 1031 |
+
$order = $profile->createOrder($productItemInfo);
|
| 1032 |
+
|
| 1033 |
+
$order->setState(
|
| 1034 |
+
Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW
|
| 1035 |
+
);
|
| 1036 |
+
|
| 1037 |
+
$order->setStatus(
|
| 1038 |
+
Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW
|
| 1039 |
+
);
|
| 1040 |
+
|
| 1041 |
+
$payment = $order->getPayment();
|
| 1042 |
+
$payment
|
| 1043 |
+
->setTransactionId(
|
| 1044 |
+
$responseObject->unique_id
|
| 1045 |
+
);
|
| 1046 |
+
$payment
|
| 1047 |
+
->setIsTransactionPending(
|
| 1048 |
+
true
|
| 1049 |
+
);
|
| 1050 |
+
$payment
|
| 1051 |
+
->setIsTransactionClosed(
|
| 1052 |
+
false
|
| 1053 |
+
);
|
| 1054 |
+
$payment
|
| 1055 |
+
->setTransactionAdditionalInfo(
|
| 1056 |
+
array(
|
| 1057 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 1058 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 1059 |
+
$responseObject
|
| 1060 |
+
)
|
| 1061 |
+
),
|
| 1062 |
+
null
|
| 1063 |
+
);
|
| 1064 |
+
$payment
|
| 1065 |
+
->addTransaction(
|
| 1066 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER
|
| 1067 |
+
);
|
| 1068 |
+
|
| 1069 |
+
$order->save();
|
| 1070 |
+
$profile->addOrderRelation(
|
| 1071 |
+
$order->getId()
|
| 1072 |
+
);
|
| 1073 |
+
$order->save();
|
| 1074 |
+
$payment->save();
|
| 1075 |
+
|
| 1076 |
+
$profile->setState(
|
| 1077 |
+
Mage_Sales_Model_Recurring_Profile::STATE_PENDING
|
| 1078 |
+
);
|
| 1079 |
+
|
| 1080 |
+
return $this;
|
| 1081 |
+
} catch (Exception $e) {
|
| 1082 |
+
Mage::throwException(
|
| 1083 |
+
$e->getMessage()
|
| 1084 |
+
);
|
| 1085 |
+
}
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
/**
|
| 1089 |
+
* Fetch RP details
|
| 1090 |
+
*
|
| 1091 |
+
* @param string $referenceId
|
| 1092 |
+
* @param Varien_Object $result
|
| 1093 |
+
* @return $this
|
| 1094 |
+
*/
|
| 1095 |
+
public function getRecurringProfileDetails($referenceId, Varien_Object $result)
|
| 1096 |
+
{
|
| 1097 |
+
return $this;
|
| 1098 |
+
}
|
| 1099 |
+
|
| 1100 |
+
/**
|
| 1101 |
+
* Whether can get recurring profile details
|
| 1102 |
+
* @return bool
|
| 1103 |
+
*/
|
| 1104 |
+
public function canGetRecurringProfileDetails()
|
| 1105 |
+
{
|
| 1106 |
+
return false;
|
| 1107 |
+
}
|
| 1108 |
+
|
| 1109 |
+
/**
|
| 1110 |
+
* Update RP data
|
| 1111 |
+
*
|
| 1112 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 1113 |
+
* @return bool
|
| 1114 |
+
*/
|
| 1115 |
+
public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
| 1116 |
+
{
|
| 1117 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 1118 |
+
$isLogEnabled = !empty($logFileName);
|
| 1119 |
+
|
| 1120 |
+
if ($isLogEnabled) {
|
| 1121 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 1122 |
+
}
|
| 1123 |
+
|
| 1124 |
+
return $this;
|
| 1125 |
+
}
|
| 1126 |
+
|
| 1127 |
+
/**
|
| 1128 |
+
* Manage status
|
| 1129 |
+
*
|
| 1130 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 1131 |
+
* @return bool
|
| 1132 |
+
*/
|
| 1133 |
+
public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
|
| 1134 |
+
{
|
| 1135 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 1136 |
+
$isLogEnabled = !empty($logFileName);
|
| 1137 |
+
|
| 1138 |
+
if ($isLogEnabled) {
|
| 1139 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
return $this;
|
| 1143 |
+
}
|
| 1144 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -29,7 +29,7 @@
|
|
| 29 |
*
|
| 30 |
* @category
|
| 31 |
*/
|
| 32 |
-
class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
| 33 |
{
|
| 34 |
// Variables
|
| 35 |
protected $_code = 'emerchantpay_direct';
|
|
@@ -53,6 +53,25 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 53 |
protected $_canUseForMultishipping = false;
|
| 54 |
protected $_canSaveCc = false;
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
/**
|
| 57 |
* Check if we're on a secure page and run
|
| 58 |
* the parent verification
|
|
@@ -63,13 +82,14 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 63 |
*/
|
| 64 |
public function isAvailable($quote = null)
|
| 65 |
{
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
/**
|
|
@@ -186,9 +206,11 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 186 |
$genesis
|
| 187 |
->request()
|
| 188 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 189 |
-
->setRemoteIp($this->getHelper(
|
| 190 |
->setUsage($this->getHelper()->getItemList($order))
|
| 191 |
-
->setCurrency(
|
|
|
|
|
|
|
| 192 |
->setAmount($amount)
|
| 193 |
->setCardHolder($payment->getCcOwner())
|
| 194 |
->setCardNumber($payment->getCcNumber())
|
|
@@ -232,9 +254,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 232 |
)
|
| 233 |
->setTransactionAdditionalInfo(
|
| 234 |
array(
|
| 235 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 236 |
-
$this->
|
| 237 |
-
|
|
|
|
| 238 |
),
|
| 239 |
null
|
| 240 |
);
|
|
@@ -282,9 +305,11 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 282 |
$genesis
|
| 283 |
->request()
|
| 284 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 285 |
-
->setRemoteIp(
|
| 286 |
->setUsage($this->getHelper()->getItemList($order))
|
| 287 |
-
->setCurrency(
|
|
|
|
|
|
|
| 288 |
->setAmount($amount)
|
| 289 |
->setCardHolder($payment->getCcOwner())
|
| 290 |
->setCardNumber($payment->getCcNumber())
|
|
@@ -328,9 +353,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 328 |
->setPreparedMessage('3D-Secure: Redirecting customer to a verification page.')
|
| 329 |
->setTransactionAdditionalInfo(
|
| 330 |
array(
|
| 331 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 332 |
-
$this->
|
| 333 |
-
|
|
|
|
| 334 |
),
|
| 335 |
null
|
| 336 |
);
|
|
@@ -383,9 +409,11 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 383 |
$genesis
|
| 384 |
->request()
|
| 385 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 386 |
-
->setRemoteIp($this->getHelper(
|
| 387 |
->setUsage($this->getHelper()->getItemList($order))
|
| 388 |
-
->setCurrency(
|
|
|
|
|
|
|
| 389 |
->setAmount($amount)
|
| 390 |
->setCardHolder($payment->getCcOwner())
|
| 391 |
->setCardNumber($payment->getCcNumber())
|
|
@@ -428,9 +456,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 428 |
->setIsTransactionPending(false)
|
| 429 |
->setTransactionAdditionalInfo(
|
| 430 |
array(
|
| 431 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 432 |
-
$this->
|
| 433 |
-
|
|
|
|
| 434 |
),
|
| 435 |
null
|
| 436 |
);
|
|
@@ -442,7 +471,6 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 442 |
$this->getGenesisResponse()->message
|
| 443 |
);
|
| 444 |
}
|
| 445 |
-
|
| 446 |
} catch (Exception $exception) {
|
| 447 |
Mage::logException($exception);
|
| 448 |
|
|
@@ -479,9 +507,11 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 479 |
$genesis
|
| 480 |
->request()
|
| 481 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 482 |
-
->setRemoteIp($this->getHelper(
|
| 483 |
->setUsage($this->getHelper()->getItemList($order))
|
| 484 |
-
->setCurrency(
|
|
|
|
|
|
|
| 485 |
->setAmount($amount)
|
| 486 |
->setCardHolder($payment->getCcOwner())
|
| 487 |
->setCardNumber($payment->getCcNumber())
|
|
@@ -528,9 +558,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 528 |
)
|
| 529 |
->setTransactionAdditionalInfo(
|
| 530 |
array(
|
| 531 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 532 |
-
$this->
|
| 533 |
-
|
|
|
|
| 534 |
),
|
| 535 |
null
|
| 536 |
);
|
|
@@ -547,7 +578,6 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 547 |
$this->getHelper()->getCheckoutSession()->setEmerchantPayDirectRedirectUrl(
|
| 548 |
$this->getGenesisResponse()->redirect_url
|
| 549 |
);
|
| 550 |
-
|
| 551 |
} catch (Exception $exception) {
|
| 552 |
Mage::logException($exception);
|
| 553 |
|
|
@@ -590,13 +620,13 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 590 |
)
|
| 591 |
)
|
| 592 |
->setRemoteIp(
|
| 593 |
-
$this->getHelper(
|
| 594 |
)
|
| 595 |
->setReferenceId(
|
| 596 |
$reference_id
|
| 597 |
)
|
| 598 |
->setCurrency(
|
| 599 |
-
$payment->getOrder()->
|
| 600 |
)
|
| 601 |
->setAmount(
|
| 602 |
$amount
|
|
@@ -604,10 +634,12 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 604 |
|
| 605 |
$genesis->execute();
|
| 606 |
|
|
|
|
|
|
|
| 607 |
$payment
|
| 608 |
->setTransactionId(
|
| 609 |
-
|
| 610 |
-
|
| 611 |
->setParentTransactionId(
|
| 612 |
$reference_id
|
| 613 |
)
|
|
@@ -622,14 +654,25 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 622 |
)
|
| 623 |
->setTransactionAdditionalInfo(
|
| 624 |
array(
|
| 625 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 626 |
-
$
|
| 627 |
-
|
|
|
|
| 628 |
),
|
| 629 |
null
|
| 630 |
);
|
| 631 |
|
| 632 |
$payment->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 633 |
} catch (Exception $exception) {
|
| 634 |
Mage::logException($exception);
|
| 635 |
|
|
@@ -670,21 +713,23 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 670 |
)
|
| 671 |
)
|
| 672 |
->setRemoteIp(
|
| 673 |
-
$this->getHelper(
|
| 674 |
)
|
| 675 |
->setReferenceId(
|
| 676 |
$reference_id
|
| 677 |
)
|
| 678 |
->setCurrency(
|
| 679 |
-
$payment->getOrder()->
|
| 680 |
)
|
| 681 |
->setAmount($amount);
|
| 682 |
|
| 683 |
$genesis->execute();
|
| 684 |
|
|
|
|
|
|
|
| 685 |
$payment
|
| 686 |
->setTransactionId(
|
| 687 |
-
$
|
| 688 |
)
|
| 689 |
->setParentTransactionId(
|
| 690 |
$reference_id
|
|
@@ -694,14 +739,42 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 694 |
)
|
| 695 |
->setTransactionAdditionalInfo(
|
| 696 |
array(
|
| 697 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 698 |
-
$
|
| 699 |
-
|
|
|
|
| 700 |
),
|
| 701 |
null
|
| 702 |
);
|
| 703 |
|
| 704 |
$payment->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 705 |
} catch (Exception $exception) {
|
| 706 |
Mage::logException($exception);
|
| 707 |
|
|
@@ -742,7 +815,7 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 742 |
$this->getHelper()->genTransactionId($payment->getOrder()->getIncrementId())
|
| 743 |
)
|
| 744 |
->setRemoteIp(
|
| 745 |
-
$this->getHelper(
|
| 746 |
)
|
| 747 |
->setReferenceId(
|
| 748 |
$reference_id
|
|
@@ -750,9 +823,11 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 750 |
|
| 751 |
$genesis->execute();
|
| 752 |
|
|
|
|
|
|
|
| 753 |
$payment
|
| 754 |
->setTransactionId(
|
| 755 |
-
$
|
| 756 |
)
|
| 757 |
->setParentTransactionId(
|
| 758 |
$reference_id
|
|
@@ -762,14 +837,25 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 762 |
)
|
| 763 |
->setTransactionAdditionalInfo(
|
| 764 |
array(
|
| 765 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 766 |
-
$
|
| 767 |
-
|
|
|
|
| 768 |
),
|
| 769 |
null
|
| 770 |
);
|
| 771 |
|
| 772 |
$payment->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 773 |
} catch (Exception $exception) {
|
| 774 |
Mage::logException($exception);
|
| 775 |
|
|
@@ -813,9 +899,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 813 |
// Set the default/updated transaction details
|
| 814 |
$payment->setAdditionalInformation(
|
| 815 |
array(
|
| 816 |
-
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 817 |
-
$
|
| 818 |
-
|
|
|
|
| 819 |
),
|
| 820 |
null
|
| 821 |
);
|
|
@@ -870,7 +957,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 870 |
$this->getHelper()->initClient($this->getCode());
|
| 871 |
|
| 872 |
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
| 873 |
-
$transaction = Mage::getModel('sales/order_payment_transaction')->load(
|
|
|
|
|
|
|
|
|
|
| 874 |
|
| 875 |
$order = $transaction->getOrder();
|
| 876 |
|
|
@@ -890,32 +980,54 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 890 |
)
|
| 891 |
);
|
| 892 |
|
| 893 |
-
|
| 894 |
-
$
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
$transaction->setIsClosed(true);
|
| 898 |
-
}
|
| 899 |
|
| 900 |
$transaction->save();
|
| 901 |
|
| 902 |
switch ($reconcile->transaction_type) {
|
| 903 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
| 904 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
| 905 |
-
$payment->registerAuthorizationNotification($reconcile->amount
|
| 906 |
break;
|
| 907 |
case \Genesis\API\Constants\Transaction\Types::SALE:
|
| 908 |
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
|
|
|
|
|
|
| 909 |
$payment->setShouldCloseParentTransaction(true);
|
| 910 |
-
$payment->registerCaptureNotification($reconcile->amount
|
| 911 |
break;
|
| 912 |
default:
|
| 913 |
break;
|
| 914 |
}
|
| 915 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 916 |
$payment->save();
|
| 917 |
|
| 918 |
-
$this->getHelper()->setOrderState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 919 |
}
|
| 920 |
} catch (Exception $exception) {
|
| 921 |
Mage::logException($exception);
|
|
@@ -951,17 +1063,10 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 951 |
*/
|
| 952 |
private function is3dEnabled()
|
| 953 |
{
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
return false;
|
| 959 |
-
break;
|
| 960 |
-
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
| 961 |
-
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
| 962 |
-
return true;
|
| 963 |
-
break;
|
| 964 |
-
}
|
| 965 |
}
|
| 966 |
|
| 967 |
/**
|
|
@@ -979,4 +1084,325 @@ class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
|
| 979 |
return Mage::helper($helper);
|
| 980 |
}
|
| 981 |
}
|
| 982 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 29 |
*
|
| 30 |
* @category
|
| 31 |
*/
|
| 32 |
+
class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc implements Mage_Payment_Model_Recurring_Profile_MethodInterface
|
| 33 |
{
|
| 34 |
// Variables
|
| 35 |
protected $_code = 'emerchantpay_direct';
|
| 53 |
protected $_canUseForMultishipping = false;
|
| 54 |
protected $_canSaveCc = false;
|
| 55 |
|
| 56 |
+
/**
|
| 57 |
+
* Determines if the Payment Method should be available on the checkout page
|
| 58 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 59 |
+
* @param int|null $checksBitMask
|
| 60 |
+
* @return bool
|
| 61 |
+
*/
|
| 62 |
+
public function isApplicableToQuote($quote, $checksBitMask)
|
| 63 |
+
{
|
| 64 |
+
return
|
| 65 |
+
parent::isApplicableToQuote($quote, $checksBitMask) ||
|
| 66 |
+
(
|
| 67 |
+
($checksBitMask & self::CHECK_ORDER_TOTAL_MIN_MAX) &&
|
| 68 |
+
$this->getHelper()->validateRecurringMethodMinMaxOrderTotal(
|
| 69 |
+
$this->getCode(),
|
| 70 |
+
$quote
|
| 71 |
+
)
|
| 72 |
+
);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
/**
|
| 76 |
* Check if we're on a secure page and run
|
| 77 |
* the parent verification
|
| 82 |
*/
|
| 83 |
public function isAvailable($quote = null)
|
| 84 |
{
|
| 85 |
+
return
|
| 86 |
+
parent::isAvailable($quote) &&
|
| 87 |
+
$this->getHelper()->getIsMethodAvailable(
|
| 88 |
+
$this->getCode(),
|
| 89 |
+
$quote,
|
| 90 |
+
true,
|
| 91 |
+
true
|
| 92 |
+
);
|
| 93 |
}
|
| 94 |
|
| 95 |
/**
|
| 206 |
$genesis
|
| 207 |
->request()
|
| 208 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 209 |
+
->setRemoteIp($this->getHelper()->getRemoteAddress())
|
| 210 |
->setUsage($this->getHelper()->getItemList($order))
|
| 211 |
+
->setCurrency(
|
| 212 |
+
$order->getOrderCurrencyCode()
|
| 213 |
+
)
|
| 214 |
->setAmount($amount)
|
| 215 |
->setCardHolder($payment->getCcOwner())
|
| 216 |
->setCardNumber($payment->getCcNumber())
|
| 254 |
)
|
| 255 |
->setTransactionAdditionalInfo(
|
| 256 |
array(
|
| 257 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 258 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 259 |
+
$this->getGenesisResponse()
|
| 260 |
+
)
|
| 261 |
),
|
| 262 |
null
|
| 263 |
);
|
| 305 |
$genesis
|
| 306 |
->request()
|
| 307 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 308 |
+
->setRemoteIp($this->getHelper()->getRemoteAddress())
|
| 309 |
->setUsage($this->getHelper()->getItemList($order))
|
| 310 |
+
->setCurrency(
|
| 311 |
+
$order->getOrderCurrencyCode()
|
| 312 |
+
)
|
| 313 |
->setAmount($amount)
|
| 314 |
->setCardHolder($payment->getCcOwner())
|
| 315 |
->setCardNumber($payment->getCcNumber())
|
| 353 |
->setPreparedMessage('3D-Secure: Redirecting customer to a verification page.')
|
| 354 |
->setTransactionAdditionalInfo(
|
| 355 |
array(
|
| 356 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 357 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 358 |
+
$this->getGenesisResponse()
|
| 359 |
+
)
|
| 360 |
),
|
| 361 |
null
|
| 362 |
);
|
| 409 |
$genesis
|
| 410 |
->request()
|
| 411 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 412 |
+
->setRemoteIp($this->getHelper()->getRemoteAddress())
|
| 413 |
->setUsage($this->getHelper()->getItemList($order))
|
| 414 |
+
->setCurrency(
|
| 415 |
+
$order->getOrderCurrencyCode()
|
| 416 |
+
)
|
| 417 |
->setAmount($amount)
|
| 418 |
->setCardHolder($payment->getCcOwner())
|
| 419 |
->setCardNumber($payment->getCcNumber())
|
| 456 |
->setIsTransactionPending(false)
|
| 457 |
->setTransactionAdditionalInfo(
|
| 458 |
array(
|
| 459 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 460 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 461 |
+
$this->getGenesisResponse()
|
| 462 |
+
)
|
| 463 |
),
|
| 464 |
null
|
| 465 |
);
|
| 471 |
$this->getGenesisResponse()->message
|
| 472 |
);
|
| 473 |
}
|
|
|
|
| 474 |
} catch (Exception $exception) {
|
| 475 |
Mage::logException($exception);
|
| 476 |
|
| 507 |
$genesis
|
| 508 |
->request()
|
| 509 |
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
| 510 |
+
->setRemoteIp($this->getHelper()->getRemoteAddress())
|
| 511 |
->setUsage($this->getHelper()->getItemList($order))
|
| 512 |
+
->setCurrency(
|
| 513 |
+
$order->getOrderCurrencyCode()
|
| 514 |
+
)
|
| 515 |
->setAmount($amount)
|
| 516 |
->setCardHolder($payment->getCcOwner())
|
| 517 |
->setCardNumber($payment->getCcNumber())
|
| 558 |
)
|
| 559 |
->setTransactionAdditionalInfo(
|
| 560 |
array(
|
| 561 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 562 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 563 |
+
$this->getGenesisResponse()
|
| 564 |
+
)
|
| 565 |
),
|
| 566 |
null
|
| 567 |
);
|
| 578 |
$this->getHelper()->getCheckoutSession()->setEmerchantPayDirectRedirectUrl(
|
| 579 |
$this->getGenesisResponse()->redirect_url
|
| 580 |
);
|
|
|
|
| 581 |
} catch (Exception $exception) {
|
| 582 |
Mage::logException($exception);
|
| 583 |
|
| 620 |
)
|
| 621 |
)
|
| 622 |
->setRemoteIp(
|
| 623 |
+
$this->getHelper()->getRemoteAddress()
|
| 624 |
)
|
| 625 |
->setReferenceId(
|
| 626 |
$reference_id
|
| 627 |
)
|
| 628 |
->setCurrency(
|
| 629 |
+
$payment->getOrder()->getOrderCurrencyCode()
|
| 630 |
)
|
| 631 |
->setAmount(
|
| 632 |
$amount
|
| 634 |
|
| 635 |
$genesis->execute();
|
| 636 |
|
| 637 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 638 |
+
|
| 639 |
$payment
|
| 640 |
->setTransactionId(
|
| 641 |
+
$responseObject->unique_id
|
| 642 |
+
)
|
| 643 |
->setParentTransactionId(
|
| 644 |
$reference_id
|
| 645 |
)
|
| 654 |
)
|
| 655 |
->setTransactionAdditionalInfo(
|
| 656 |
array(
|
| 657 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 658 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 659 |
+
$responseObject
|
| 660 |
+
)
|
| 661 |
),
|
| 662 |
null
|
| 663 |
);
|
| 664 |
|
| 665 |
$payment->save();
|
| 666 |
+
|
| 667 |
+
if ($responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 668 |
+
$this->getHelper()->getAdminSession()->addSuccess(
|
| 669 |
+
$responseObject->message
|
| 670 |
+
);
|
| 671 |
+
} else {
|
| 672 |
+
$this->getHelper()->getAdminSession()->addError(
|
| 673 |
+
$responseObject->message
|
| 674 |
+
);
|
| 675 |
+
}
|
| 676 |
} catch (Exception $exception) {
|
| 677 |
Mage::logException($exception);
|
| 678 |
|
| 713 |
)
|
| 714 |
)
|
| 715 |
->setRemoteIp(
|
| 716 |
+
$this->getHelper()->getRemoteAddress()
|
| 717 |
)
|
| 718 |
->setReferenceId(
|
| 719 |
$reference_id
|
| 720 |
)
|
| 721 |
->setCurrency(
|
| 722 |
+
$payment->getOrder()->getOrderCurrencyCode()
|
| 723 |
)
|
| 724 |
->setAmount($amount);
|
| 725 |
|
| 726 |
$genesis->execute();
|
| 727 |
|
| 728 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 729 |
+
|
| 730 |
$payment
|
| 731 |
->setTransactionId(
|
| 732 |
+
$responseObject->unique_id
|
| 733 |
)
|
| 734 |
->setParentTransactionId(
|
| 735 |
$reference_id
|
| 739 |
)
|
| 740 |
->setTransactionAdditionalInfo(
|
| 741 |
array(
|
| 742 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 743 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 744 |
+
$responseObject
|
| 745 |
+
)
|
| 746 |
),
|
| 747 |
null
|
| 748 |
);
|
| 749 |
|
| 750 |
$payment->save();
|
| 751 |
+
|
| 752 |
+
if ($responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 753 |
+
$this->getHelper()->getAdminSession()->addSuccess(
|
| 754 |
+
$responseObject->message
|
| 755 |
+
);
|
| 756 |
+
|
| 757 |
+
if (isset($capture) && $capture !== false) {
|
| 758 |
+
$canceledProfileReferenceId = $this->getHelper()->checkAndCancelRecurringProfile(
|
| 759 |
+
$capture
|
| 760 |
+
);
|
| 761 |
+
|
| 762 |
+
if (isset($canceledProfileReferenceId)) {
|
| 763 |
+
$this->getHelper()->getAdminSession()->addNotice(
|
| 764 |
+
$this->getHelper()->__(
|
| 765 |
+
sprintf(
|
| 766 |
+
"Profile #%s has been canceled!",
|
| 767 |
+
$canceledProfileReferenceId
|
| 768 |
+
)
|
| 769 |
+
)
|
| 770 |
+
);
|
| 771 |
+
}
|
| 772 |
+
}
|
| 773 |
+
} else {
|
| 774 |
+
$this->getHelper()->getAdminSession()->addError(
|
| 775 |
+
$responseObject->message
|
| 776 |
+
);
|
| 777 |
+
}
|
| 778 |
} catch (Exception $exception) {
|
| 779 |
Mage::logException($exception);
|
| 780 |
|
| 815 |
$this->getHelper()->genTransactionId($payment->getOrder()->getIncrementId())
|
| 816 |
)
|
| 817 |
->setRemoteIp(
|
| 818 |
+
$this->getHelper()->getRemoteAddress()
|
| 819 |
)
|
| 820 |
->setReferenceId(
|
| 821 |
$reference_id
|
| 823 |
|
| 824 |
$genesis->execute();
|
| 825 |
|
| 826 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 827 |
+
|
| 828 |
$payment
|
| 829 |
->setTransactionId(
|
| 830 |
+
$responseObject->unique_id
|
| 831 |
)
|
| 832 |
->setParentTransactionId(
|
| 833 |
$reference_id
|
| 837 |
)
|
| 838 |
->setTransactionAdditionalInfo(
|
| 839 |
array(
|
| 840 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 841 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 842 |
+
$responseObject
|
| 843 |
+
)
|
| 844 |
),
|
| 845 |
null
|
| 846 |
);
|
| 847 |
|
| 848 |
$payment->save();
|
| 849 |
+
|
| 850 |
+
if ($responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
| 851 |
+
$this->getHelper()->getAdminSession()->addSuccess(
|
| 852 |
+
$responseObject->message
|
| 853 |
+
);
|
| 854 |
+
} else {
|
| 855 |
+
$this->getHelper()->getAdminSession()->addError(
|
| 856 |
+
$responseObject->message
|
| 857 |
+
);
|
| 858 |
+
}
|
| 859 |
} catch (Exception $exception) {
|
| 860 |
Mage::logException($exception);
|
| 861 |
|
| 899 |
// Set the default/updated transaction details
|
| 900 |
$payment->setAdditionalInformation(
|
| 901 |
array(
|
| 902 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 903 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 904 |
+
$reconcile
|
| 905 |
+
)
|
| 906 |
),
|
| 907 |
null
|
| 908 |
);
|
| 957 |
$this->getHelper()->initClient($this->getCode());
|
| 958 |
|
| 959 |
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
| 960 |
+
$transaction = Mage::getModel('sales/order_payment_transaction')->load(
|
| 961 |
+
$reconcile->unique_id,
|
| 962 |
+
'txn_id'
|
| 963 |
+
);
|
| 964 |
|
| 965 |
$order = $transaction->getOrder();
|
| 966 |
|
| 980 |
)
|
| 981 |
);
|
| 982 |
|
| 983 |
+
$isTransactionApproved =
|
| 984 |
+
($reconcile->status == \Genesis\API\Constants\Transaction\States::APPROVED);
|
| 985 |
+
|
| 986 |
+
$transaction->setIsClosed(!$isTransactionApproved);
|
|
|
|
|
|
|
| 987 |
|
| 988 |
$transaction->save();
|
| 989 |
|
| 990 |
switch ($reconcile->transaction_type) {
|
| 991 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
| 992 |
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
| 993 |
+
$payment->registerAuthorizationNotification($reconcile->amount);
|
| 994 |
break;
|
| 995 |
case \Genesis\API\Constants\Transaction\Types::SALE:
|
| 996 |
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
| 997 |
+
case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE:
|
| 998 |
+
case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D:
|
| 999 |
$payment->setShouldCloseParentTransaction(true);
|
| 1000 |
+
$payment->registerCaptureNotification($reconcile->amount);
|
| 1001 |
break;
|
| 1002 |
default:
|
| 1003 |
break;
|
| 1004 |
}
|
| 1005 |
|
| 1006 |
+
if ($this->getHelper()->getIsTransactionTypeInitRecurring($reconcile->transaction_type)) {
|
| 1007 |
+
$recurringProfile = Mage::getModel('sales/recurring_profile')->load(
|
| 1008 |
+
$reconcile->unique_id,
|
| 1009 |
+
'reference_id'
|
| 1010 |
+
);
|
| 1011 |
+
|
| 1012 |
+
if ($recurringProfile && $recurringProfile->getId()) {
|
| 1013 |
+
if ($recurringProfile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_PENDING) {
|
| 1014 |
+
$recurringProfile->setState(
|
| 1015 |
+
$isTransactionApproved
|
| 1016 |
+
? Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE
|
| 1017 |
+
: Mage_Sales_Model_Recurring_Profile::STATE_PENDING
|
| 1018 |
+
);
|
| 1019 |
+
$recurringProfile->save();
|
| 1020 |
+
}
|
| 1021 |
+
}
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
$payment->save();
|
| 1025 |
|
| 1026 |
+
$this->getHelper()->setOrderState(
|
| 1027 |
+
$order,
|
| 1028 |
+
$reconcile->status,
|
| 1029 |
+
$reconcile->message
|
| 1030 |
+
);
|
| 1031 |
}
|
| 1032 |
} catch (Exception $exception) {
|
| 1033 |
Mage::logException($exception);
|
| 1063 |
*/
|
| 1064 |
private function is3dEnabled()
|
| 1065 |
{
|
| 1066 |
+
return
|
| 1067 |
+
$this->getHelper()->getIsTransaction3dSecure(
|
| 1068 |
+
$this->getConfigData('genesis_type')
|
| 1069 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1070 |
}
|
| 1071 |
|
| 1072 |
/**
|
| 1084 |
return Mage::helper($helper);
|
| 1085 |
}
|
| 1086 |
}
|
| 1087 |
+
|
| 1088 |
+
/**
|
| 1089 |
+
* Validate RP data
|
| 1090 |
+
*
|
| 1091 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 1092 |
+
* @return $this
|
| 1093 |
+
*/
|
| 1094 |
+
public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
| 1095 |
+
{
|
| 1096 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 1097 |
+
$isLogEnabled = !empty($logFileName);
|
| 1098 |
+
|
| 1099 |
+
if ($isLogEnabled) {
|
| 1100 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 1101 |
+
}
|
| 1102 |
+
|
| 1103 |
+
return $this;
|
| 1104 |
+
}
|
| 1105 |
+
|
| 1106 |
+
/**
|
| 1107 |
+
* Submit RP to the gateway
|
| 1108 |
+
*
|
| 1109 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 1110 |
+
* @param Mage_Payment_Model_Info $payment
|
| 1111 |
+
* @return $this
|
| 1112 |
+
*/
|
| 1113 |
+
public function submitRecurringProfile(
|
| 1114 |
+
Mage_Payment_Model_Recurring_Profile $profile,
|
| 1115 |
+
Mage_Payment_Model_Info $payment
|
| 1116 |
+
) {
|
| 1117 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 1118 |
+
$isLogEnabled = !empty($logFileName);
|
| 1119 |
+
|
| 1120 |
+
if ($isLogEnabled) {
|
| 1121 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 1122 |
+
}
|
| 1123 |
+
|
| 1124 |
+
$this->getHelper()->initClient($this->getCode());
|
| 1125 |
+
|
| 1126 |
+
$transactionType = $this->getConfigData('recurring_transaction_type');
|
| 1127 |
+
$transactionClassName = $this->getHelper()->getGenesisTransactionClassName(
|
| 1128 |
+
$transactionType
|
| 1129 |
+
);
|
| 1130 |
+
|
| 1131 |
+
$genesis = new \Genesis\Genesis("Financial\\Cards\\Recurring\\{$transactionClassName}");
|
| 1132 |
+
|
| 1133 |
+
$amount = $profile->getInitAmount() ?: 0;
|
| 1134 |
+
|
| 1135 |
+
$genesis
|
| 1136 |
+
->request()
|
| 1137 |
+
->setTransactionId(
|
| 1138 |
+
$profile->getInternalReferenceId()
|
| 1139 |
+
)
|
| 1140 |
+
->setUsage('Magento Init Recurring Payment')
|
| 1141 |
+
->setMoto('')
|
| 1142 |
+
->setRemoteIp(
|
| 1143 |
+
$this->getHelper()->getRemoteAddress()
|
| 1144 |
+
)
|
| 1145 |
+
->setCurrency(
|
| 1146 |
+
$payment->getQuote()->getStoreCurrencyCode()
|
| 1147 |
+
)
|
| 1148 |
+
->setAmount(
|
| 1149 |
+
$amount
|
| 1150 |
+
)
|
| 1151 |
+
->setCardHolder(
|
| 1152 |
+
$payment->getCcOwner()
|
| 1153 |
+
)
|
| 1154 |
+
->setCardNumber(
|
| 1155 |
+
$payment->getCcNumber()
|
| 1156 |
+
)
|
| 1157 |
+
->setExpirationYear(
|
| 1158 |
+
$payment->getCcExpYear()
|
| 1159 |
+
)
|
| 1160 |
+
->setExpirationMonth(
|
| 1161 |
+
$payment->getCcExpMonth()
|
| 1162 |
+
)
|
| 1163 |
+
->setCvv(
|
| 1164 |
+
$payment->getCcCid()
|
| 1165 |
+
)
|
| 1166 |
+
->setCustomerEmail(
|
| 1167 |
+
$profile->getBillingAddressInfo()['email']
|
| 1168 |
+
)
|
| 1169 |
+
->setCustomerPhone(
|
| 1170 |
+
$profile->getBillingAddressInfo()['telephone']
|
| 1171 |
+
);
|
| 1172 |
+
// Billing
|
| 1173 |
+
$genesis
|
| 1174 |
+
->request()
|
| 1175 |
+
->setBillingFirstName(
|
| 1176 |
+
$profile->getBillingAddressInfo()['firstname']
|
| 1177 |
+
)
|
| 1178 |
+
->setBillingLastName(
|
| 1179 |
+
$profile->getBillingAddressInfo()['lastname']
|
| 1180 |
+
)
|
| 1181 |
+
->setBillingAddress1(
|
| 1182 |
+
$profile->getBillingAddressInfo()['street']
|
| 1183 |
+
)
|
| 1184 |
+
->setBillingZipCode(
|
| 1185 |
+
$profile->getBillingAddressInfo()['postcode']
|
| 1186 |
+
)
|
| 1187 |
+
->setBillingCity(
|
| 1188 |
+
$profile->getBillingAddressInfo()['city']
|
| 1189 |
+
)
|
| 1190 |
+
->setBillingState(
|
| 1191 |
+
$profile->getBillingAddressInfo()['region']
|
| 1192 |
+
)
|
| 1193 |
+
->setBillingCountry(
|
| 1194 |
+
$profile->getBillingAddressInfo()['country_id']
|
| 1195 |
+
);
|
| 1196 |
+
// Shipping
|
| 1197 |
+
$genesis
|
| 1198 |
+
->request()
|
| 1199 |
+
->setShippingFirstName(
|
| 1200 |
+
$profile->getShippingAddressInfo()['firstname']
|
| 1201 |
+
)
|
| 1202 |
+
->setShippingLastName(
|
| 1203 |
+
$profile->getShippingAddressInfo()['lastname']
|
| 1204 |
+
)
|
| 1205 |
+
->setShippingAddress1(
|
| 1206 |
+
$profile->getShippingAddressInfo()['street']
|
| 1207 |
+
)
|
| 1208 |
+
->setShippingZipCode(
|
| 1209 |
+
$profile->getShippingAddressInfo()['postcode']
|
| 1210 |
+
)
|
| 1211 |
+
->setShippingCity(
|
| 1212 |
+
$profile->getShippingAddressInfo()['city']
|
| 1213 |
+
)
|
| 1214 |
+
->setShippingState(
|
| 1215 |
+
$profile->getShippingAddressInfo()['region']
|
| 1216 |
+
)
|
| 1217 |
+
->setShippingCountry(
|
| 1218 |
+
$profile->getShippingAddressInfo()['country_id']
|
| 1219 |
+
);
|
| 1220 |
+
|
| 1221 |
+
if ($this->getHelper()->getIsTransaction3dSecure($transactionType)) {
|
| 1222 |
+
$genesis
|
| 1223 |
+
->request()
|
| 1224 |
+
->setNotificationUrl(
|
| 1225 |
+
$this->getHelper()->getNotifyURL('direct')
|
| 1226 |
+
)
|
| 1227 |
+
->setReturnSuccessUrl(
|
| 1228 |
+
$this->getHelper()->getSuccessURL('direct')
|
| 1229 |
+
)
|
| 1230 |
+
->setReturnFailureUrl(
|
| 1231 |
+
$this->getHelper()->getFailureURL('direct')
|
| 1232 |
+
);
|
| 1233 |
+
}
|
| 1234 |
+
|
| 1235 |
+
try {
|
| 1236 |
+
$genesis->execute();
|
| 1237 |
+
|
| 1238 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 1239 |
+
|
| 1240 |
+
if (isset($responseObject->redirect_url)) {
|
| 1241 |
+
$this->getHelper()
|
| 1242 |
+
->getCheckoutSession()
|
| 1243 |
+
->setEmerchantPayCheckoutRedirectUrl(
|
| 1244 |
+
$responseObject->redirect_url
|
| 1245 |
+
);
|
| 1246 |
+
}
|
| 1247 |
+
|
| 1248 |
+
$profile->setReferenceId(
|
| 1249 |
+
$responseObject->unique_id
|
| 1250 |
+
);
|
| 1251 |
+
|
| 1252 |
+
$payment->setSkipTransactionCreation(true);
|
| 1253 |
+
|
| 1254 |
+
$isInitRecurringApproved =
|
| 1255 |
+
$responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED;
|
| 1256 |
+
|
| 1257 |
+
switch ($responseObject->status) {
|
| 1258 |
+
case \Genesis\API\Constants\Transaction\States::PENDING:
|
| 1259 |
+
case \Genesis\API\Constants\Transaction\States::PENDING_ASYNC:
|
| 1260 |
+
case \Genesis\API\Constants\Transaction\States::APPROVED:
|
| 1261 |
+
$productItemInfo = new Varien_Object;
|
| 1262 |
+
$productItemInfo->setPaymentType(
|
| 1263 |
+
Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_INITIAL
|
| 1264 |
+
);
|
| 1265 |
+
$productItemInfo->setPrice(
|
| 1266 |
+
$amount
|
| 1267 |
+
);
|
| 1268 |
+
|
| 1269 |
+
$order = $profile->createOrder($productItemInfo);
|
| 1270 |
+
|
| 1271 |
+
$order->setState(
|
| 1272 |
+
$isInitRecurringApproved
|
| 1273 |
+
? Mage_Sales_Model_Order::STATE_PROCESSING
|
| 1274 |
+
: Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW
|
| 1275 |
+
);
|
| 1276 |
+
|
| 1277 |
+
$order->setStatus(
|
| 1278 |
+
$isInitRecurringApproved
|
| 1279 |
+
? Mage_Sales_Model_Order::STATE_PROCESSING
|
| 1280 |
+
: Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW
|
| 1281 |
+
);
|
| 1282 |
+
|
| 1283 |
+
$payment = $order->getPayment();
|
| 1284 |
+
|
| 1285 |
+
$payment
|
| 1286 |
+
->setTransactionId(
|
| 1287 |
+
$responseObject->unique_id
|
| 1288 |
+
);
|
| 1289 |
+
$payment
|
| 1290 |
+
->setIsTransactionPending(
|
| 1291 |
+
!$isInitRecurringApproved
|
| 1292 |
+
);
|
| 1293 |
+
$payment
|
| 1294 |
+
->setIsTransactionClosed(
|
| 1295 |
+
$isInitRecurringApproved
|
| 1296 |
+
);
|
| 1297 |
+
$payment
|
| 1298 |
+
->setTransactionAdditionalInfo(
|
| 1299 |
+
array(
|
| 1300 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 1301 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 1302 |
+
$responseObject
|
| 1303 |
+
)
|
| 1304 |
+
),
|
| 1305 |
+
null
|
| 1306 |
+
);
|
| 1307 |
+
$payment
|
| 1308 |
+
->addTransaction(
|
| 1309 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
|
| 1310 |
+
);
|
| 1311 |
+
|
| 1312 |
+
if ($isInitRecurringApproved &&
|
| 1313 |
+
$transactionType == \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE) {
|
| 1314 |
+
$payment->registerCaptureNotification(
|
| 1315 |
+
$responseObject->amount
|
| 1316 |
+
);
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
+
$order->save();
|
| 1320 |
+
$profile->addOrderRelation(
|
| 1321 |
+
$order->getId()
|
| 1322 |
+
);
|
| 1323 |
+
$order->save();
|
| 1324 |
+
$payment->save();
|
| 1325 |
+
|
| 1326 |
+
$profile->setState(
|
| 1327 |
+
$isInitRecurringApproved
|
| 1328 |
+
? Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE
|
| 1329 |
+
: Mage_Sales_Model_Recurring_Profile::STATE_PENDING
|
| 1330 |
+
);
|
| 1331 |
+
|
| 1332 |
+
return $this;
|
| 1333 |
+
|
| 1334 |
+
default:
|
| 1335 |
+
if (!$profile->getInitMayFail()) {
|
| 1336 |
+
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED);
|
| 1337 |
+
$profile->save();
|
| 1338 |
+
}
|
| 1339 |
+
|
| 1340 |
+
Mage::throwException(
|
| 1341 |
+
$responseObject->message
|
| 1342 |
+
);
|
| 1343 |
+
break;
|
| 1344 |
+
}
|
| 1345 |
+
} catch (Exception $e) {
|
| 1346 |
+
Mage::throwException(
|
| 1347 |
+
$e->getMessage()
|
| 1348 |
+
);
|
| 1349 |
+
}
|
| 1350 |
+
}
|
| 1351 |
+
|
| 1352 |
+
/**
|
| 1353 |
+
* Fetch RP details
|
| 1354 |
+
*
|
| 1355 |
+
* @param string $referenceId
|
| 1356 |
+
* @param Varien_Object $result
|
| 1357 |
+
* @return $this
|
| 1358 |
+
*/
|
| 1359 |
+
public function getRecurringProfileDetails($referenceId, Varien_Object $result)
|
| 1360 |
+
{
|
| 1361 |
+
return $this;
|
| 1362 |
+
}
|
| 1363 |
+
|
| 1364 |
+
/**
|
| 1365 |
+
* Whether can get recurring profile details
|
| 1366 |
+
* @return bool
|
| 1367 |
+
*/
|
| 1368 |
+
public function canGetRecurringProfileDetails()
|
| 1369 |
+
{
|
| 1370 |
+
return false;
|
| 1371 |
+
}
|
| 1372 |
+
|
| 1373 |
+
/**
|
| 1374 |
+
* Update RP data
|
| 1375 |
+
*
|
| 1376 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 1377 |
+
* @return $this
|
| 1378 |
+
*/
|
| 1379 |
+
public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
| 1380 |
+
{
|
| 1381 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 1382 |
+
$isLogEnabled = !empty($logFileName);
|
| 1383 |
+
|
| 1384 |
+
if ($isLogEnabled) {
|
| 1385 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 1386 |
+
}
|
| 1387 |
+
|
| 1388 |
+
return $this;
|
| 1389 |
+
}
|
| 1390 |
+
|
| 1391 |
+
/**
|
| 1392 |
+
* Manage status
|
| 1393 |
+
*
|
| 1394 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 1395 |
+
* @return $this
|
| 1396 |
+
*/
|
| 1397 |
+
public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
|
| 1398 |
+
{
|
| 1399 |
+
$logFileName = $this->getConfigData('cron_recurring_log_file');
|
| 1400 |
+
$isLogEnabled = !empty($logFileName);
|
| 1401 |
+
|
| 1402 |
+
if ($isLogEnabled) {
|
| 1403 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 1404 |
+
}
|
| 1405 |
+
|
| 1406 |
+
return $this;
|
| 1407 |
+
}
|
| 1408 |
+
}
|
|
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
+
*
|
| 5 |
+
* This program is free software; you can redistribute it and/or
|
| 6 |
+
* modify it under the terms of the GNU General Public License
|
| 7 |
+
* as published by the Free Software Foundation; either version 2
|
| 8 |
+
* of the License, or (at your option) any later version.
|
| 9 |
+
*
|
| 10 |
+
* This program is distributed in the hope that it will be useful,
|
| 11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
* GNU General Public License for more details.
|
| 14 |
+
*
|
| 15 |
+
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* EMerchantPay Recurring Module Observer
|
| 22 |
+
* Class EMerchantPay_Genesis_Model_Task_Recurring
|
| 23 |
+
*/
|
| 24 |
+
class EMerchantPay_Genesis_Model_Task_Recurring
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* @var EMerchantPay_Genesis_Helper_Data
|
| 28 |
+
*/
|
| 29 |
+
protected $_helper;
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Cron job Observer Method for Checkout PM
|
| 33 |
+
* @param Mage_Cron_Model_Schedule $schedule
|
| 34 |
+
* @return array
|
| 35 |
+
*/
|
| 36 |
+
public function processCheckout(Mage_Cron_Model_Schedule $schedule)
|
| 37 |
+
{
|
| 38 |
+
return $this->run($schedule, 'checkout');
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Cron job Observer Method for Direct PM
|
| 43 |
+
* @param Mage_Cron_Model_Schedule $schedule
|
| 44 |
+
* @return array
|
| 45 |
+
*/
|
| 46 |
+
public function processDirect(Mage_Cron_Model_Schedule $schedule)
|
| 47 |
+
{
|
| 48 |
+
return $this->run($schedule, 'direct');
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Cron job method to charge recurring profiles
|
| 53 |
+
*
|
| 54 |
+
* @param Mage_Cron_Model_Schedule $schedule
|
| 55 |
+
* @param string $methodCode
|
| 56 |
+
* @return array
|
| 57 |
+
*/
|
| 58 |
+
protected function run(Mage_Cron_Model_Schedule $schedule, $methodCode)
|
| 59 |
+
{
|
| 60 |
+
$result = array();
|
| 61 |
+
|
| 62 |
+
$vendorName = "emerchantpay";
|
| 63 |
+
|
| 64 |
+
$methodCode = "{$vendorName}_{$methodCode}";
|
| 65 |
+
|
| 66 |
+
$this->_helper = Mage::helper($vendorName);
|
| 67 |
+
|
| 68 |
+
if (!$this->getHelper()->getIsMethodActive($methodCode)) {
|
| 69 |
+
return false;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
if (!$this->getHelper()->getConfigBoolValue($methodCode, 'recurring_enabled')) {
|
| 73 |
+
return false;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
$logFileName = $this->getHelper()->getConfigData($methodCode, 'cron_recurring_log_file');
|
| 77 |
+
$isLogEnabled = !empty($logFileName);
|
| 78 |
+
|
| 79 |
+
$msgCheckForProfilesToCharge =
|
| 80 |
+
$this->getHelper()->__("Checking for Profiles to charge ...");
|
| 81 |
+
|
| 82 |
+
$result[] = $msgCheckForProfilesToCharge;
|
| 83 |
+
|
| 84 |
+
if ($isLogEnabled) {
|
| 85 |
+
Mage::log(__METHOD__.'; Method #' . $methodCode, null, $logFileName);
|
| 86 |
+
Mage::log($msgCheckForProfilesToCharge, null, $logFileName);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
$resource = Mage::getSingleton('core/resource');
|
| 90 |
+
$adapter = $resource->getConnection('read');
|
| 91 |
+
|
| 92 |
+
$select = $adapter->select();
|
| 93 |
+
$select
|
| 94 |
+
->from(
|
| 95 |
+
$resource->getTableName('sales_recurring_profile')
|
| 96 |
+
)
|
| 97 |
+
->where('method_code = :method_code')
|
| 98 |
+
->where('state = :state')
|
| 99 |
+
->where('updated_at <= :now')
|
| 100 |
+
->where('start_datetime <= :now')
|
| 101 |
+
->where('(
|
| 102 |
+
((start_datetime >= updated_at) and (:now >= start_datetime))
|
| 103 |
+
or
|
| 104 |
+
((start_datetime < updated_at) and :now >= CASE period_unit
|
| 105 |
+
WHEN "day" THEN DATE_ADD(updated_at, INTERVAL period_frequency DAY)
|
| 106 |
+
WHEN "week" THEN DATE_ADD(updated_at, INTERVAL period_frequency WEEK)
|
| 107 |
+
WHEN "semi_month" THEN DATE_ADD(updated_at, INTERVAL (period_frequency * 2) WEEK)
|
| 108 |
+
WHEN "month" THEN DATE_ADD(updated_at, INTERVAL period_frequency MONTH)
|
| 109 |
+
WHEN "year" THEN DATE_ADD(updated_at, INTERVAL period_frequency YEAR)
|
| 110 |
+
END))');
|
| 111 |
+
|
| 112 |
+
$binds = array(
|
| 113 |
+
'method_code' =>
|
| 114 |
+
$methodCode,
|
| 115 |
+
'state' =>
|
| 116 |
+
Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE,
|
| 117 |
+
'now' =>
|
| 118 |
+
$this->getHelper()->formatDateTimeToMySQLDateTime(
|
| 119 |
+
time()
|
| 120 |
+
)
|
| 121 |
+
);
|
| 122 |
+
|
| 123 |
+
$chargedProfiles = 0;
|
| 124 |
+
|
| 125 |
+
foreach ($adapter->fetchAll($select, $binds) as $profileArr) {
|
| 126 |
+
if (!isset($profileArr['profile_id'])) {
|
| 127 |
+
continue;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
$profile = Mage::getModel('sales/recurring_profile')->load(
|
| 131 |
+
$profileArr['profile_id']
|
| 132 |
+
);
|
| 133 |
+
|
| 134 |
+
$orders = $profile->getResource()->getChildOrderIds($profile);
|
| 135 |
+
$countBillingCycles = count($orders);
|
| 136 |
+
|
| 137 |
+
if ($profile->getInitAmount()) {
|
| 138 |
+
$countBillingCycles--;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
$msgChargingProfile =
|
| 142 |
+
$this->getHelper()->__("Charging Recurring Profile #") .
|
| 143 |
+
$profile->getReferenceId();
|
| 144 |
+
|
| 145 |
+
$result[] = $msgChargingProfile;
|
| 146 |
+
|
| 147 |
+
if ($isLogEnabled) {
|
| 148 |
+
Mage::log($msgChargingProfile, null, $logFileName);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
$mustSetUpdateDateToNextPeriod = (bool) $countBillingCycles > 0;
|
| 152 |
+
try {
|
| 153 |
+
$this->chargeRecurringProfile($methodCode, $profile, $mustSetUpdateDateToNextPeriod);
|
| 154 |
+
$chargedProfiles++;
|
| 155 |
+
$countBillingCycles++;
|
| 156 |
+
|
| 157 |
+
if ($this->doCheckAndSuspendRecurringProfile($profile, $countBillingCycles)) {
|
| 158 |
+
$msgChargingProfile =
|
| 159 |
+
$this->getHelper()->__("Billing Cycles reached. Suspending Recurring Profile #") .
|
| 160 |
+
$profile->getReferenceId();
|
| 161 |
+
|
| 162 |
+
$result[] = $msgChargingProfile;
|
| 163 |
+
|
| 164 |
+
if ($isLogEnabled) {
|
| 165 |
+
Mage::log($msgChargingProfile, null, $logFileName);
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
} catch (\Exception $e) {
|
| 169 |
+
$profile->setState(
|
| 170 |
+
Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED
|
| 171 |
+
);
|
| 172 |
+
$profile->save();
|
| 173 |
+
|
| 174 |
+
$msgProfileSuspended = $this->getHelper()->__(
|
| 175 |
+
sprintf(
|
| 176 |
+
"Recurring Profile #%s is set to suspended, because of a failed Recurring Transaction",
|
| 177 |
+
$profile->getReferenceId()
|
| 178 |
+
)
|
| 179 |
+
);
|
| 180 |
+
|
| 181 |
+
$result[] = $msgProfileSuspended;
|
| 182 |
+
|
| 183 |
+
if ($isLogEnabled) {
|
| 184 |
+
Mage::log($msgProfileSuspended, null, $logFileName);
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if ($chargedProfiles == 0) {
|
| 191 |
+
$result[] = $this->getHelper()->__("No Profiles have been charged!");
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
return $result;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
/**
|
| 198 |
+
* Check and suspend Recurring Profile if Recurring Cycles reached
|
| 199 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 200 |
+
* @param int $billingCycles
|
| 201 |
+
* @return bool (true if profile suspended)
|
| 202 |
+
*/
|
| 203 |
+
protected function doCheckAndSuspendRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, $billingCycles)
|
| 204 |
+
{
|
| 205 |
+
if (!empty($profile->getPeriodMaxCycles()) && $billingCycles >= $profile->getPeriodMaxCycles()) {
|
| 206 |
+
$profile->setState(
|
| 207 |
+
Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED
|
| 208 |
+
);
|
| 209 |
+
$profile->save();
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
return
|
| 213 |
+
$profile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
/**
|
| 217 |
+
* @return EMerchantPay_Genesis_Helper_Data
|
| 218 |
+
*/
|
| 219 |
+
protected function getHelper()
|
| 220 |
+
{
|
| 221 |
+
return $this->_helper;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* Creates a RecurringSale transaction to the Payment Gateway
|
| 226 |
+
* @param string $methodCode
|
| 227 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
| 228 |
+
* @param bool $mustSetUpdateDateToNextPeriod
|
| 229 |
+
* @throws Exception
|
| 230 |
+
* @throws Mage_Core_Exception
|
| 231 |
+
*/
|
| 232 |
+
protected function chargeRecurringProfile(
|
| 233 |
+
$methodCode,
|
| 234 |
+
Mage_Payment_Model_Recurring_Profile $profile,
|
| 235 |
+
$mustSetUpdateDateToNextPeriod
|
| 236 |
+
) {
|
| 237 |
+
$logFileName = $this->getHelper()->getConfigData(
|
| 238 |
+
$methodCode,
|
| 239 |
+
'cron_recurring_log_file'
|
| 240 |
+
);
|
| 241 |
+
$isLogEnabled = !empty($logFileName);
|
| 242 |
+
|
| 243 |
+
if ($isLogEnabled) {
|
| 244 |
+
Mage::log(__METHOD__.'; Profile #'.$profile->getId(), null, $logFileName);
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
$this->getHelper()->initClient($methodCode);
|
| 248 |
+
|
| 249 |
+
$initRecurringCaptureTransaction = $this->getProfileInitRecurringTransaction(
|
| 250 |
+
$profile
|
| 251 |
+
);
|
| 252 |
+
|
| 253 |
+
if (!is_object($initRecurringCaptureTransaction) || !$initRecurringCaptureTransaction->getId()) {
|
| 254 |
+
Mage::throwException(
|
| 255 |
+
$this->getHelper()->__("Could not find Init Recurring Capture Transaction!")
|
| 256 |
+
);
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
if (empty(\Genesis\Config::getToken())) {
|
| 260 |
+
\Genesis\Config::setToken(
|
| 261 |
+
$this->getHelper()->getGenesisPaymentTransactionToken(
|
| 262 |
+
$initRecurringCaptureTransaction
|
| 263 |
+
)
|
| 264 |
+
);
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
if (empty(\Genesis\Config::getToken())) {
|
| 268 |
+
Mage::throwException(
|
| 269 |
+
$this->getHelper()->__(
|
| 270 |
+
"Could not extract Terminal Token from Init Recurring Transaction"
|
| 271 |
+
)
|
| 272 |
+
);
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
$genesis = new \Genesis\Genesis("Financial\\Cards\\Recurring\\RecurringSale");
|
| 276 |
+
|
| 277 |
+
$genesis
|
| 278 |
+
->request()
|
| 279 |
+
->setTransactionId(
|
| 280 |
+
$this->getHelper()->genTransactionId()
|
| 281 |
+
)
|
| 282 |
+
->setReferenceId(
|
| 283 |
+
$initRecurringCaptureTransaction->getTxnId()
|
| 284 |
+
)
|
| 285 |
+
->setUsage('Magento Recurring Transaction')
|
| 286 |
+
->setRemoteIp(
|
| 287 |
+
$this->getHelper()->getRemoteAddress()
|
| 288 |
+
)
|
| 289 |
+
->setCurrency(
|
| 290 |
+
$profile->getCurrencyCode()
|
| 291 |
+
)
|
| 292 |
+
->setAmount(
|
| 293 |
+
$profile->getTaxAmount() +
|
| 294 |
+
$profile->getBillingAmount() +
|
| 295 |
+
$profile->getShippingAmount()
|
| 296 |
+
);
|
| 297 |
+
|
| 298 |
+
$genesis->execute();
|
| 299 |
+
|
| 300 |
+
$responseObject = $genesis->response()->getResponseObject();
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
$isTransactionApproved =
|
| 304 |
+
$responseObject->status == \Genesis\API\Constants\Transaction\States::APPROVED;
|
| 305 |
+
|
| 306 |
+
$productItemInfo = new Varien_Object;
|
| 307 |
+
$productItemInfo->setPaymentType(
|
| 308 |
+
Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR
|
| 309 |
+
);
|
| 310 |
+
|
| 311 |
+
$productItemInfo->setPrice(
|
| 312 |
+
$profile->getTaxAmount() +
|
| 313 |
+
$profile->getBillingAmount()
|
| 314 |
+
);
|
| 315 |
+
|
| 316 |
+
$order = $profile->createOrder($productItemInfo);
|
| 317 |
+
$order->setState(
|
| 318 |
+
$isTransactionApproved
|
| 319 |
+
? Mage_Sales_Model_Order::STATE_PROCESSING
|
| 320 |
+
: Mage_Sales_Model_Order::STATE_CANCELED
|
| 321 |
+
);
|
| 322 |
+
$order->setStatus(
|
| 323 |
+
$isTransactionApproved
|
| 324 |
+
? Mage_Sales_Model_Order::STATE_PROCESSING
|
| 325 |
+
: Mage_Sales_Model_Order::STATE_CANCELED
|
| 326 |
+
);
|
| 327 |
+
|
| 328 |
+
$trans_id = $responseObject->unique_id;
|
| 329 |
+
|
| 330 |
+
$responseObject->terminal_token = $this->getHelper()->getGenesisPaymentTransactionToken(
|
| 331 |
+
$initRecurringCaptureTransaction
|
| 332 |
+
);
|
| 333 |
+
|
| 334 |
+
$payment = $order->getPayment();
|
| 335 |
+
$payment
|
| 336 |
+
->setTransactionId(
|
| 337 |
+
$trans_id
|
| 338 |
+
)
|
| 339 |
+
->setIsTransactionClosed(
|
| 340 |
+
true
|
| 341 |
+
)
|
| 342 |
+
->setIsTransactionPending(
|
| 343 |
+
!$isTransactionApproved
|
| 344 |
+
)
|
| 345 |
+
->setTransactionAdditionalInfo(
|
| 346 |
+
array(
|
| 347 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS =>
|
| 348 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
| 349 |
+
$responseObject
|
| 350 |
+
)
|
| 351 |
+
),
|
| 352 |
+
null
|
| 353 |
+
);
|
| 354 |
+
|
| 355 |
+
if ($isTransactionApproved) {
|
| 356 |
+
$payment->registerCaptureNotification(
|
| 357 |
+
$responseObject->amount
|
| 358 |
+
);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
$order->save();
|
| 362 |
+
|
| 363 |
+
$profile->addOrderRelation(
|
| 364 |
+
$order->getId()
|
| 365 |
+
);
|
| 366 |
+
$payment->save();
|
| 367 |
+
|
| 368 |
+
if (!$isTransactionApproved) {
|
| 369 |
+
$profile->setState(
|
| 370 |
+
Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED
|
| 371 |
+
);
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
$profile->save();
|
| 375 |
+
|
| 376 |
+
$updatedAt = ($mustSetUpdateDateToNextPeriod ? null : time());
|
| 377 |
+
|
| 378 |
+
$this->updateRecurringProfileDateToNextPeriod(
|
| 379 |
+
$methodCode,
|
| 380 |
+
$profile->getId(),
|
| 381 |
+
$updatedAt
|
| 382 |
+
);
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
/**
|
| 386 |
+
* Prepares the Recurring Profile for the next recurring period
|
| 387 |
+
* @param string $methodCode
|
| 388 |
+
* @param int $profile_id
|
| 389 |
+
* @param int|null $updatedAt
|
| 390 |
+
* @return mixed
|
| 391 |
+
*/
|
| 392 |
+
protected function updateRecurringProfileDateToNextPeriod($methodCode, $profile_id, $updatedAt = null)
|
| 393 |
+
{
|
| 394 |
+
$logFileName = $this->getHelper()->getConfigData(
|
| 395 |
+
$methodCode,
|
| 396 |
+
'cron_recurring_log_file'
|
| 397 |
+
);
|
| 398 |
+
|
| 399 |
+
$isLogEnabled = !empty($logFileName);
|
| 400 |
+
|
| 401 |
+
if ($isLogEnabled) {
|
| 402 |
+
Mage::log(__METHOD__ . '; Profile #' . $profile_id, null, $logFileName);
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
$_resource = Mage::getSingleton('core/resource');
|
| 406 |
+
$sql = '
|
| 407 |
+
UPDATE '.$_resource->getTableName('sales_recurring_profile').
|
| 408 |
+
($updatedAt
|
| 409 |
+
? ' SET updated_at = :updated_at '
|
| 410 |
+
: ' SET updated_at = CASE period_unit
|
| 411 |
+
WHEN "day" THEN DATE_ADD(updated_at, INTERVAL period_frequency DAY)
|
| 412 |
+
WHEN "week" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*7) DAY)
|
| 413 |
+
WHEN "semi_month" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*14) DAY)
|
| 414 |
+
WHEN "month" THEN DATE_ADD(updated_at, INTERVAL period_frequency MONTH)
|
| 415 |
+
WHEN "year" THEN DATE_ADD(updated_at, INTERVAL period_frequency YEAR)
|
| 416 |
+
END ') . '
|
| 417 |
+
WHERE
|
| 418 |
+
(profile_id = :pid)';
|
| 419 |
+
|
| 420 |
+
$connection = $_resource->getConnection('core_write');
|
| 421 |
+
$pdoStatement = $connection->prepare($sql);
|
| 422 |
+
$pdoStatement->bindValue(':pid', $profile_id);
|
| 423 |
+
if ($updatedAt) {
|
| 424 |
+
$pdoStatement->bindValue(
|
| 425 |
+
':updated_at',
|
| 426 |
+
$this->getHelper()->formatDateTimeToMySQLDateTime(
|
| 427 |
+
$updatedAt
|
| 428 |
+
)
|
| 429 |
+
);
|
| 430 |
+
}
|
| 431 |
+
return $pdoStatement->execute();
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
/**
|
| 436 |
+
* @param Mage_Sales_Model_Recurring_Profile $profile
|
| 437 |
+
* @return Mage_Sales_Model_Order_Payment_Transaction|null
|
| 438 |
+
*/
|
| 439 |
+
protected function getProfileInitRecurringTransaction($profile)
|
| 440 |
+
{
|
| 441 |
+
foreach ($profile->getChildOrderIds() as $orderId) {
|
| 442 |
+
$order = Mage::getModel("sales/order")->load($orderId);
|
| 443 |
+
|
| 444 |
+
if (is_object($order) && $order->getId() && is_object($order->getPayment())) {
|
| 445 |
+
$captureTransaction = $order->getPayment()->lookupTransaction(
|
| 446 |
+
null,
|
| 447 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
|
| 448 |
+
);
|
| 449 |
+
|
| 450 |
+
$genesisTransactionType = $this->getHelper()->getGenesisPaymentTransactionType(
|
| 451 |
+
$captureTransaction
|
| 452 |
+
);
|
| 453 |
+
|
| 454 |
+
if ($this->getHelper()->getIsTransactionTypeInitRecurring($genesisTransactionType)) {
|
| 455 |
+
return $captureTransaction;
|
| 456 |
+
}
|
| 457 |
+
}
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
return null;
|
| 461 |
+
}
|
| 462 |
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
+
*
|
| 5 |
+
* This program is free software; you can redistribute it and/or
|
| 6 |
+
* modify it under the terms of the GNU General Public License
|
| 7 |
+
* as published by the Free Software Foundation; either version 2
|
| 8 |
+
* of the License, or (at your option) any later version.
|
| 9 |
+
*
|
| 10 |
+
* This program is distributed in the hope that it will be useful,
|
| 11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
* GNU General Public License for more details.
|
| 14 |
+
*
|
| 15 |
+
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* EMerchantPay Recurring Checkout Observer
|
| 22 |
+
* Sets the RedirectUrl for the PaymentGateway (Checkout & Direct Payment Method)
|
| 23 |
+
*
|
| 24 |
+
* Class EMerchantPay_Genesis_Observer_Checkout_Submit_All_After
|
| 25 |
+
*/
|
| 26 |
+
class EMerchantPay_Genesis_Observer_CheckoutSubmitAllAfter
|
| 27 |
+
{
|
| 28 |
+
/**
|
| 29 |
+
* Observer Event Handler
|
| 30 |
+
* @param Varien_Event_Observer $observer
|
| 31 |
+
* @return $this
|
| 32 |
+
*/
|
| 33 |
+
public function handleAction($observer)
|
| 34 |
+
{
|
| 35 |
+
$event = $observer->getEvent();
|
| 36 |
+
$recurringProfiles = $event->getRecurringProfiles();
|
| 37 |
+
|
| 38 |
+
if (is_array($recurringProfiles) && count($recurringProfiles) > 0) {
|
| 39 |
+
$checkoutSession = Mage::helper('emerchantpay')->getCheckoutSession();
|
| 40 |
+
$redirectUrl = $checkoutSession->getEmerchantPayCheckoutRedirectUrl();
|
| 41 |
+
|
| 42 |
+
if (!empty($redirectUrl)) {
|
| 43 |
+
$checkoutSession->setRedirectUrl(
|
| 44 |
+
$redirectUrl
|
| 45 |
+
);
|
| 46 |
+
$checkoutSession->setEmerchantPayCheckoutRedirectUrl(null);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
return $this;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
}
|
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/*
|
| 3 |
-
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
-
*
|
| 5 |
-
* This program is free software; you can redistribute it and/or
|
| 6 |
-
* modify it under the terms of the GNU General Public License
|
| 7 |
-
* as published by the Free Software Foundation; either version 2
|
| 8 |
-
* of the License, or (at your option) any later version.
|
| 9 |
-
*
|
| 10 |
-
* This program is distributed in the hope that it will be useful,
|
| 11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
-
* GNU General Public License for more details.
|
| 14 |
-
*
|
| 15 |
-
* @author eMerchantPay
|
| 16 |
-
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
-
*/
|
| 19 |
-
|
| 20 |
-
/**
|
| 21 |
-
* Class EMerchantPay_Genesis_Observer_GenesisAutoLoader
|
| 22 |
-
*
|
| 23 |
-
* Handler for event "emerchantpay_genesis_init_library"
|
| 24 |
-
*/
|
| 25 |
-
class EMerchantPay_Genesis_Observer_GenesisAutoLoader
|
| 26 |
-
{
|
| 27 |
-
public function addAutoLoad($observer)
|
| 28 |
-
{
|
| 29 |
-
$event = $observer->getEvent();
|
| 30 |
-
$genesisAutoLoadParams = $event->getGenesisAutoLoadParams();
|
| 31 |
-
|
| 32 |
-
$mustCheckGenesisLibVersion = $genesisAutoLoadParams->getCheckGenesisLibVersion() == '1';
|
| 33 |
-
|
| 34 |
-
// Mitigate PHP Bug #52339, as Magento already registers their AutoLoader
|
| 35 |
-
if (!class_exists('\Genesis\Genesis', false)) {
|
| 36 |
-
$vendorDir = $genesisAutoLoadParams->getMagentoRoot() . DS . 'vendor';
|
| 37 |
-
$genesisGatewayVendorDir = $vendorDir . DS . $genesisAutoLoadParams->getGenesisComposerDir();
|
| 38 |
-
$vendorAutoload = $vendorDir . DS . 'autoload.php';
|
| 39 |
-
|
| 40 |
-
if (file_exists($vendorAutoload) && file_exists($genesisGatewayVendorDir))
|
| 41 |
-
include $vendorAutoload;
|
| 42 |
-
|
| 43 |
-
if (class_exists('Genesis\Genesis') && $mustCheckGenesisLibVersion)
|
| 44 |
-
$this->checkGenesisLibVersion(
|
| 45 |
-
$genesisAutoLoadParams->getRequiredGenesisLibVersion()
|
| 46 |
-
);
|
| 47 |
-
|
| 48 |
-
if (!class_exists('Genesis\Genesis')) {
|
| 49 |
-
$integratedGenesisLibAutoLoader = $genesisAutoLoadParams->getIntegratedGenesisLibAutoLoader();
|
| 50 |
-
if (file_exists($integratedGenesisLibAutoLoader))
|
| 51 |
-
include $integratedGenesisLibAutoLoader;
|
| 52 |
-
}
|
| 53 |
-
}
|
| 54 |
-
elseif ($mustCheckGenesisLibVersion) {
|
| 55 |
-
$this->checkGenesisLibVersion(
|
| 56 |
-
$genesisAutoLoadParams->getRequiredGenesisLibVersion()
|
| 57 |
-
);
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
return $this;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
private function checkGenesisLibVersion($requiredVersion) {
|
| 64 |
-
$params = explode(' ', $requiredVersion);
|
| 65 |
-
$operator = $params[0];
|
| 66 |
-
$version = $params[1];
|
| 67 |
-
|
| 68 |
-
if (class_exists('\Genesis\Config') && !version_compare(\Genesis\Config::getVersion(), $version, $operator)) {
|
| 69 |
-
$currentGenesisVersion = \Genesis\Config::getVersion();
|
| 70 |
-
Mage::throwException(sprintf("Incompatible GenesisPHP Lib Version (Found %s; Required %s %s)", $currentGenesisVersion, $operator, $version));
|
| 71 |
-
}
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
+
*
|
| 5 |
+
* This program is free software; you can redistribute it and/or
|
| 6 |
+
* modify it under the terms of the GNU General Public License
|
| 7 |
+
* as published by the Free Software Foundation; either version 2
|
| 8 |
+
* of the License, or (at your option) any later version.
|
| 9 |
+
*
|
| 10 |
+
* This program is distributed in the hope that it will be useful,
|
| 11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
* GNU General Public License for more details.
|
| 14 |
+
*
|
| 15 |
+
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* EMerchantPay Recurring Checkout Observer
|
| 22 |
+
* Sets the Default Init Recurring Fee if not defined for product
|
| 23 |
+
*
|
| 24 |
+
* Class EMerchantPay_Genesis_Observer_SalesQuoteAddressCollectTotalsBefore
|
| 25 |
+
*/
|
| 26 |
+
class EMerchantPay_Genesis_Observer_SalesQuoteAddressCollectTotalsBefore
|
| 27 |
+
{
|
| 28 |
+
private $_methodCodes = array(
|
| 29 |
+
'emerchantpay_checkout',
|
| 30 |
+
'emerchantpay_direct'
|
| 31 |
+
);
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Observer Event Handler
|
| 35 |
+
* @param Varien_Event_Observer $observer
|
| 36 |
+
*/
|
| 37 |
+
public function handleAction($observer)
|
| 38 |
+
{
|
| 39 |
+
$event = $observer->getEvent();
|
| 40 |
+
$quoteAddress = $event->getQuoteAddress();
|
| 41 |
+
|
| 42 |
+
if (is_object($quoteAddress) && is_object($quoteAddress->getQuote()->getPayment())) {
|
| 43 |
+
$paymentMethodCode = $quoteAddress->getQuote()->getPayment()->getMethod();
|
| 44 |
+
|
| 45 |
+
if (isset($paymentMethodCode) && in_array($paymentMethodCode, $this->getMethodCodes())) {
|
| 46 |
+
|
| 47 |
+
if ($this->getHelper()->getIsMethodAvailable($paymentMethodCode, $quoteAddress->getQuote())) {
|
| 48 |
+
foreach ($quoteAddress->getAllNominalItems() as $item) {
|
| 49 |
+
$product = $item->getProduct();
|
| 50 |
+
|
| 51 |
+
if (is_object($product) && $product->getIsRecurring() && is_array($product->getRecurringProfile())) {
|
| 52 |
+
$productRecurringProfile = $product->getRecurringProfile();
|
| 53 |
+
|
| 54 |
+
if ($this->getMustOverrideProfileInitAmount($productRecurringProfile)) {
|
| 55 |
+
$productRecurringProfile['init_amount'] =
|
| 56 |
+
$this->getHelper()->getMethodInitRecurringFee(
|
| 57 |
+
$paymentMethodCode
|
| 58 |
+
);
|
| 59 |
+
$product->setRecurringProfile(
|
| 60 |
+
$productRecurringProfile
|
| 61 |
+
);
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Return the available payment methods
|
| 72 |
+
* @return array
|
| 73 |
+
*/
|
| 74 |
+
protected function getMethodCodes()
|
| 75 |
+
{
|
| 76 |
+
return $this->_methodCodes;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* @return EMerchantPay_Genesis_Helper_Data
|
| 81 |
+
*/
|
| 82 |
+
protected function getHelper()
|
| 83 |
+
{
|
| 84 |
+
return Mage::helper('emerchantpay');
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Returns true if no Initial Fee is defined for the Nominal Item
|
| 89 |
+
*
|
| 90 |
+
* @param Mage_Sales_Model_Recurring_Profile $recurringProfile
|
| 91 |
+
* @return bool
|
| 92 |
+
*/
|
| 93 |
+
protected function getMustOverrideProfileInitAmount($recurringProfile)
|
| 94 |
+
{
|
| 95 |
+
return
|
| 96 |
+
is_array($recurringProfile) &&
|
| 97 |
+
(
|
| 98 |
+
!isset($recurringProfile['init_amount']) ||
|
| 99 |
+
empty($recurringProfile['init_amount']) ||
|
| 100 |
+
($recurringProfile['init_amount'] <= 0)
|
| 101 |
+
);
|
| 102 |
+
}
|
| 103 |
+
}
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -69,11 +69,16 @@ class EMerchantPay_Genesis_CheckoutController extends Mage_Core_Controller_Front
|
|
| 69 |
if (isset($reconcile->unique_id)) {
|
| 70 |
$this->checkout->processNotification($reconcile);
|
| 71 |
|
|
|
|
|
|
|
|
|
|
| 72 |
$this->getResponse()->setHeader('Content-type', 'application/xml');
|
| 73 |
|
| 74 |
$this->getResponse()->setBody(
|
| 75 |
$notification->generateResponse()
|
| 76 |
);
|
|
|
|
|
|
|
| 77 |
}
|
| 78 |
}
|
| 79 |
} catch (Exception $exception) {
|
|
@@ -92,8 +97,6 @@ class EMerchantPay_Genesis_CheckoutController extends Mage_Core_Controller_Front
|
|
| 92 |
*/
|
| 93 |
public function redirectAction()
|
| 94 |
{
|
| 95 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 96 |
-
|
| 97 |
$this->getResponse()->setBody(
|
| 98 |
$this->getLayout()->createBlock('emerchantpay/redirect_checkout')->toHtml()
|
| 99 |
);
|
|
@@ -108,8 +111,6 @@ class EMerchantPay_Genesis_CheckoutController extends Mage_Core_Controller_Front
|
|
| 108 |
*/
|
| 109 |
public function successAction()
|
| 110 |
{
|
| 111 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 112 |
-
|
| 113 |
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
| 114 |
}
|
| 115 |
|
|
@@ -122,8 +123,6 @@ class EMerchantPay_Genesis_CheckoutController extends Mage_Core_Controller_Front
|
|
| 122 |
*/
|
| 123 |
public function failureAction()
|
| 124 |
{
|
| 125 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 126 |
-
|
| 127 |
$this->helper->restoreQuote();
|
| 128 |
|
| 129 |
$this->helper->getCheckoutSession()->addError(
|
|
@@ -140,8 +139,6 @@ class EMerchantPay_Genesis_CheckoutController extends Mage_Core_Controller_Front
|
|
| 140 |
*/
|
| 141 |
public function cancelAction()
|
| 142 |
{
|
| 143 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 144 |
-
|
| 145 |
$this->helper->restoreQuote($shouldCancel = true);
|
| 146 |
|
| 147 |
$this->helper->getCheckoutSession()->addSuccess(
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 69 |
if (isset($reconcile->unique_id)) {
|
| 70 |
$this->checkout->processNotification($reconcile);
|
| 71 |
|
| 72 |
+
$this->getResponse()->clearHeaders();
|
| 73 |
+
$this->getResponse()->clearBody();
|
| 74 |
+
|
| 75 |
$this->getResponse()->setHeader('Content-type', 'application/xml');
|
| 76 |
|
| 77 |
$this->getResponse()->setBody(
|
| 78 |
$notification->generateResponse()
|
| 79 |
);
|
| 80 |
+
|
| 81 |
+
$this->getResponse()->setHttpResponseCode(200);
|
| 82 |
}
|
| 83 |
}
|
| 84 |
} catch (Exception $exception) {
|
| 97 |
*/
|
| 98 |
public function redirectAction()
|
| 99 |
{
|
|
|
|
|
|
|
| 100 |
$this->getResponse()->setBody(
|
| 101 |
$this->getLayout()->createBlock('emerchantpay/redirect_checkout')->toHtml()
|
| 102 |
);
|
| 111 |
*/
|
| 112 |
public function successAction()
|
| 113 |
{
|
|
|
|
|
|
|
| 114 |
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
| 115 |
}
|
| 116 |
|
| 123 |
*/
|
| 124 |
public function failureAction()
|
| 125 |
{
|
|
|
|
|
|
|
| 126 |
$this->helper->restoreQuote();
|
| 127 |
|
| 128 |
$this->helper->getCheckoutSession()->addError(
|
| 139 |
*/
|
| 140 |
public function cancelAction()
|
| 141 |
{
|
|
|
|
|
|
|
| 142 |
$this->helper->restoreQuote($shouldCancel = true);
|
| 143 |
|
| 144 |
$this->helper->getCheckoutSession()->addSuccess(
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
* Copyright (C)
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
-
* @copyright
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
|
@@ -69,11 +69,16 @@ class EMerchantPay_Genesis_DirectController extends Mage_Core_Controller_Front_A
|
|
| 69 |
if (isset($reconcile->unique_id)) {
|
| 70 |
$this->direct->processNotification($reconcile);
|
| 71 |
|
|
|
|
|
|
|
|
|
|
| 72 |
$this->getResponse()->setHeader('Content-type', 'application/xml');
|
| 73 |
|
| 74 |
$this->getResponse()->setBody(
|
| 75 |
$notification->generateResponse()
|
| 76 |
);
|
|
|
|
|
|
|
| 77 |
}
|
| 78 |
}
|
| 79 |
} catch (Exception $exception) {
|
|
@@ -90,8 +95,6 @@ class EMerchantPay_Genesis_DirectController extends Mage_Core_Controller_Front_A
|
|
| 90 |
*/
|
| 91 |
public function redirectAction()
|
| 92 |
{
|
| 93 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 94 |
-
|
| 95 |
$this->getResponse()->setBody(
|
| 96 |
$this->getLayout()->createBlock('emerchantpay/redirect_direct')->toHtml()
|
| 97 |
);
|
|
@@ -106,8 +109,6 @@ class EMerchantPay_Genesis_DirectController extends Mage_Core_Controller_Front_A
|
|
| 106 |
*/
|
| 107 |
public function successAction()
|
| 108 |
{
|
| 109 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 110 |
-
|
| 111 |
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
| 112 |
}
|
| 113 |
|
|
@@ -120,8 +121,6 @@ class EMerchantPay_Genesis_DirectController extends Mage_Core_Controller_Front_A
|
|
| 120 |
*/
|
| 121 |
public function failureAction()
|
| 122 |
{
|
| 123 |
-
$this->helper->redirectIfNotLoggedIn();
|
| 124 |
-
|
| 125 |
$this->helper->restoreQuote();
|
| 126 |
|
| 127 |
$this->helper->getCheckoutSession()->addError(
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or
|
| 6 |
* modify it under the terms of the GNU General Public License
|
| 13 |
* GNU General Public License for more details.
|
| 14 |
*
|
| 15 |
* @author eMerchantPay
|
| 16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
| 17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
*/
|
| 19 |
|
| 69 |
if (isset($reconcile->unique_id)) {
|
| 70 |
$this->direct->processNotification($reconcile);
|
| 71 |
|
| 72 |
+
$this->getResponse()->clearHeaders();
|
| 73 |
+
$this->getResponse()->clearBody();
|
| 74 |
+
|
| 75 |
$this->getResponse()->setHeader('Content-type', 'application/xml');
|
| 76 |
|
| 77 |
$this->getResponse()->setBody(
|
| 78 |
$notification->generateResponse()
|
| 79 |
);
|
| 80 |
+
|
| 81 |
+
$this->getResponse()->setHttpResponseCode(200);
|
| 82 |
}
|
| 83 |
}
|
| 84 |
} catch (Exception $exception) {
|
| 95 |
*/
|
| 96 |
public function redirectAction()
|
| 97 |
{
|
|
|
|
|
|
|
| 98 |
$this->getResponse()->setBody(
|
| 99 |
$this->getLayout()->createBlock('emerchantpay/redirect_direct')->toHtml()
|
| 100 |
);
|
| 109 |
*/
|
| 110 |
public function successAction()
|
| 111 |
{
|
|
|
|
|
|
|
| 112 |
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
| 113 |
}
|
| 114 |
|
| 121 |
*/
|
| 122 |
public function failureAction()
|
| 123 |
{
|
|
|
|
|
|
|
| 124 |
$this->helper->restoreQuote();
|
| 125 |
|
| 126 |
$this->helper->getCheckoutSession()->addError(
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<!--
|
| 3 |
-
Copyright (C)
|
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or
|
| 6 |
modify it under the terms of the GNU General Public License
|
|
@@ -13,13 +13,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 13 |
GNU General Public License for more details.
|
| 14 |
|
| 15 |
@author eMerchantPay
|
| 16 |
-
@copyright
|
| 17 |
@license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
-->
|
| 19 |
<config>
|
| 20 |
<modules>
|
| 21 |
<EMerchantPay_Genesis>
|
| 22 |
-
<version>1.2.
|
| 23 |
</EMerchantPay_Genesis>
|
| 24 |
</modules>
|
| 25 |
|
|
@@ -49,14 +49,22 @@ GNU General Public License for more details.
|
|
| 49 |
</payment>
|
| 50 |
|
| 51 |
<events>
|
| 52 |
-
<
|
| 53 |
<observers>
|
| 54 |
<EMerchantPay_Genesis>
|
| 55 |
-
<class>
|
| 56 |
-
<method>
|
| 57 |
</EMerchantPay_Genesis>
|
| 58 |
</observers>
|
| 59 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
</events>
|
| 61 |
|
| 62 |
</global>
|
|
@@ -104,16 +112,47 @@ GNU General Public License for more details.
|
|
| 104 |
<order_status>pending</order_status>
|
| 105 |
<title>Credit Card (eMerchantPay Direct)</title>
|
| 106 |
<cctypes>VI,MC,SM,AE,DI,JCB,OT</cctypes>
|
| 107 |
-
<
|
|
|
|
|
|
|
|
|
|
| 108 |
<group>emerchantpay</group>
|
| 109 |
</emerchantpay_direct>
|
| 110 |
<emerchantpay_checkout>
|
| 111 |
<model>emerchantpay/checkout</model>
|
| 112 |
-
<order_status>pending</order_status>
|
| 113 |
<title>Credit Card (eMerchantPay Checkout)</title>
|
| 114 |
<payment_action>order</payment_action>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
<group>emerchantpay</group>
|
| 116 |
</emerchantpay_checkout>
|
| 117 |
</payment>
|
| 118 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
</config>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<!--
|
| 3 |
+
Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or
|
| 6 |
modify it under the terms of the GNU General Public License
|
| 13 |
GNU General Public License for more details.
|
| 14 |
|
| 15 |
@author eMerchantPay
|
| 16 |
+
@copyright 2016 eMerchantPay Ltd.
|
| 17 |
@license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
-->
|
| 19 |
<config>
|
| 20 |
<modules>
|
| 21 |
<EMerchantPay_Genesis>
|
| 22 |
+
<version>1.2.7</version>
|
| 23 |
</EMerchantPay_Genesis>
|
| 24 |
</modules>
|
| 25 |
|
| 49 |
</payment>
|
| 50 |
|
| 51 |
<events>
|
| 52 |
+
<checkout_submit_all_after>
|
| 53 |
<observers>
|
| 54 |
<EMerchantPay_Genesis>
|
| 55 |
+
<class>EMerchantPay_Genesis_Observer_CheckoutSubmitAllAfter</class>
|
| 56 |
+
<method>handleAction</method>
|
| 57 |
</EMerchantPay_Genesis>
|
| 58 |
</observers>
|
| 59 |
+
</checkout_submit_all_after>
|
| 60 |
+
<sales_quote_address_collect_totals_before>
|
| 61 |
+
<observers>
|
| 62 |
+
<EMerchantPay_Genesis>
|
| 63 |
+
<class>EMerchantPay_Genesis_Observer_SalesQuoteAddressCollectTotalsBefore</class>
|
| 64 |
+
<method>handleAction</method>
|
| 65 |
+
</EMerchantPay_Genesis>
|
| 66 |
+
</observers>
|
| 67 |
+
</sales_quote_address_collect_totals_before>
|
| 68 |
</events>
|
| 69 |
|
| 70 |
</global>
|
| 112 |
<order_status>pending</order_status>
|
| 113 |
<title>Credit Card (eMerchantPay Direct)</title>
|
| 114 |
<cctypes>VI,MC,SM,AE,DI,JCB,OT</cctypes>
|
| 115 |
+
<genesis_type>authorize</genesis_type>
|
| 116 |
+
<recurring_enabled>0</recurring_enabled>
|
| 117 |
+
<recurring_scheduler_cron_expr>*/30 * * * *</recurring_scheduler_cron_expr>
|
| 118 |
+
<cron_recurring_log_file>emerchantpay-recurring.log</cron_recurring_log_file>
|
| 119 |
<group>emerchantpay</group>
|
| 120 |
</emerchantpay_direct>
|
| 121 |
<emerchantpay_checkout>
|
| 122 |
<model>emerchantpay/checkout</model>
|
|
|
|
| 123 |
<title>Credit Card (eMerchantPay Checkout)</title>
|
| 124 |
<payment_action>order</payment_action>
|
| 125 |
+
<genesis_types>sale</genesis_types>
|
| 126 |
+
<recurring_enabled>0</recurring_enabled>
|
| 127 |
+
<recurring_scheduler_cron_expr>*/30 * * * *</recurring_scheduler_cron_expr>
|
| 128 |
+
<cron_recurring_log_file>emerchantpay-recurring.log</cron_recurring_log_file>
|
| 129 |
+
<order_status>pending</order_status>
|
| 130 |
<group>emerchantpay</group>
|
| 131 |
</emerchantpay_checkout>
|
| 132 |
</payment>
|
| 133 |
</default>
|
| 134 |
+
|
| 135 |
+
<crontab>
|
| 136 |
+
<jobs>
|
| 137 |
+
<emerchantpay_direct_charge_recurring_profile>
|
| 138 |
+
<schedule>
|
| 139 |
+
<config_path>payment/emerchantpay_direct/recurring_scheduler_cron_expr</config_path>
|
| 140 |
+
</schedule>
|
| 141 |
+
|
| 142 |
+
<run>
|
| 143 |
+
<model>emerchantpay/task_recurring::processDirect</model>
|
| 144 |
+
</run>
|
| 145 |
+
</emerchantpay_direct_charge_recurring_profile>
|
| 146 |
+
|
| 147 |
+
<emerchantpay_checkout_charge_recurring_profile>
|
| 148 |
+
<schedule>
|
| 149 |
+
<config_path>payment/emerchantpay_checkout/recurring_scheduler_cron_expr</config_path>
|
| 150 |
+
</schedule>
|
| 151 |
+
|
| 152 |
+
<run>
|
| 153 |
+
<model>emerchantpay/task_recurring::processCheckout</model>
|
| 154 |
+
</run>
|
| 155 |
+
</emerchantpay_checkout_charge_recurring_profile>
|
| 156 |
+
</jobs>
|
| 157 |
+
</crontab>
|
| 158 |
</config>
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<!--
|
| 3 |
-
Copyright (C)
|
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or
|
| 6 |
modify it under the terms of the GNU General Public License
|
|
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 13 |
GNU General Public License for more details.
|
| 14 |
|
| 15 |
@author eMerchantPay
|
| 16 |
-
@copyright
|
| 17 |
@license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
-->
|
| 19 |
<config>
|
|
@@ -22,6 +22,12 @@ GNU General Public License for more details.
|
|
| 22 |
<groups>
|
| 23 |
<emerchantpay_direct translate="label" module="emerchantpay">
|
| 24 |
<label>eMerchantPay Direct</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
<sort_order>10</sort_order>
|
| 26 |
<show_in_default>1</show_in_default>
|
| 27 |
<show_in_website>1</show_in_website>
|
|
@@ -35,6 +41,8 @@ GNU General Public License for more details.
|
|
| 35 |
<show_in_default>1</show_in_default>
|
| 36 |
<show_in_website>1</show_in_website>
|
| 37 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
| 38 |
</active>
|
| 39 |
<title translate="label">
|
| 40 |
<label>Title</label>
|
|
@@ -43,35 +51,69 @@ GNU General Public License for more details.
|
|
| 43 |
<show_in_default>1</show_in_default>
|
| 44 |
<show_in_website>1</show_in_website>
|
| 45 |
<show_in_store>1</show_in_store>
|
|
|
|
|
|
|
| 46 |
</title>
|
| 47 |
-
<
|
| 48 |
-
<label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
<frontend_type>text</frontend_type>
|
| 50 |
<sort_order>03</sort_order>
|
| 51 |
<show_in_default>1</show_in_default>
|
| 52 |
<show_in_website>1</show_in_website>
|
| 53 |
<show_in_store>0</show_in_store>
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
<frontend_type>text</frontend_type>
|
| 58 |
<sort_order>04</sort_order>
|
| 59 |
<show_in_default>1</show_in_default>
|
| 60 |
<show_in_website>1</show_in_website>
|
| 61 |
<show_in_store>0</show_in_store>
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
<frontend_type>text</frontend_type>
|
| 66 |
<sort_order>05</sort_order>
|
| 67 |
<show_in_default>1</show_in_default>
|
| 68 |
<show_in_website>1</show_in_website>
|
| 69 |
<show_in_store>0</show_in_store>
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
<genesis_environment translate="label">
|
| 72 |
<label>Test Mode</label>
|
| 73 |
<comment>
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
</comment>
|
| 76 |
<frontend_type>select</frontend_type>
|
| 77 |
<source_model>emerchantpay/admin_environment</source_model>
|
|
@@ -79,11 +121,16 @@ GNU General Public License for more details.
|
|
| 79 |
<show_in_default>1</show_in_default>
|
| 80 |
<show_in_website>1</show_in_website>
|
| 81 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
| 82 |
</genesis_environment>
|
| 83 |
<genesis_type translate="label">
|
| 84 |
<label>Transaction Type</label>
|
| 85 |
<comment>
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
</comment>
|
| 88 |
<frontend_type>select</frontend_type>
|
| 89 |
<source_model>emerchantpay/admin_direct_options_transaction_type</source_model>
|
|
@@ -91,74 +138,215 @@ GNU General Public License for more details.
|
|
| 91 |
<show_in_default>1</show_in_default>
|
| 92 |
<show_in_website>1</show_in_website>
|
| 93 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
</genesis_type>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
<order_status translate="label">
|
| 96 |
<label>New Order Status</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
<frontend_type>select</frontend_type>
|
| 98 |
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
| 99 |
-
<sort_order>
|
| 100 |
<show_in_default>1</show_in_default>
|
| 101 |
<show_in_website>1</show_in_website>
|
| 102 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
</order_status>
|
| 104 |
<allowspecific translate="label">
|
| 105 |
<label>Payment from Applicable Countries</label>
|
| 106 |
<frontend_type>allowspecific</frontend_type>
|
| 107 |
-
<sort_order>
|
| 108 |
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 109 |
<show_in_default>1</show_in_default>
|
| 110 |
<show_in_website>1</show_in_website>
|
| 111 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
</allowspecific>
|
| 113 |
<specificcountry translate="label">
|
| 114 |
<label>Payment from Specific Countries</label>
|
| 115 |
<frontend_type>multiselect</frontend_type>
|
| 116 |
-
<sort_order>
|
| 117 |
<source_model>adminhtml/system_config_source_country</source_model>
|
| 118 |
<show_in_default>1</show_in_default>
|
| 119 |
<show_in_website>1</show_in_website>
|
| 120 |
<show_in_store>0</show_in_store>
|
| 121 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
</specificcountry>
|
| 123 |
<cctypes translate="label">
|
| 124 |
<label>Credit Card Types</label>
|
| 125 |
<frontend_type>multiselect</frontend_type>
|
| 126 |
<source_model>adminhtml/system_config_source_payment_cctype</source_model>
|
| 127 |
-
<sort_order>
|
| 128 |
<show_in_default>1</show_in_default>
|
| 129 |
<show_in_website>1</show_in_website>
|
| 130 |
<show_in_store>0</show_in_store>
|
| 131 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
</cctypes>
|
| 133 |
<min_order_total translate="label">
|
| 134 |
<label>Minimum Order Total</label>
|
| 135 |
<frontend_type>text</frontend_type>
|
| 136 |
-
<sort_order>
|
| 137 |
<show_in_default>1</show_in_default>
|
| 138 |
<show_in_website>1</show_in_website>
|
| 139 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
</min_order_total>
|
| 141 |
<max_order_total translate="label">
|
| 142 |
<label>Maximum Order Total</label>
|
| 143 |
<frontend_type>text</frontend_type>
|
| 144 |
-
<sort_order>
|
| 145 |
<show_in_default>1</show_in_default>
|
| 146 |
<show_in_website>1</show_in_website>
|
| 147 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
</max_order_total>
|
| 149 |
<sort_order translate="label">
|
| 150 |
<label>Sort Order</label>
|
| 151 |
<frontend_type>text</frontend_type>
|
| 152 |
-
<sort_order>
|
| 153 |
<show_in_default>1</show_in_default>
|
| 154 |
<show_in_website>1</show_in_website>
|
| 155 |
<show_in_store>0</show_in_store>
|
| 156 |
<frontend_class>validate-number</frontend_class>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
</sort_order>
|
| 158 |
</fields>
|
| 159 |
</emerchantpay_direct>
|
| 160 |
<emerchantpay_checkout translate="label" module="emerchantpay">
|
| 161 |
<label>eMerchantPay Checkout</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
<sort_order>10</sort_order>
|
| 163 |
<show_in_default>1</show_in_default>
|
| 164 |
<show_in_website>1</show_in_website>
|
|
@@ -180,27 +368,51 @@ GNU General Public License for more details.
|
|
| 180 |
<show_in_default>1</show_in_default>
|
| 181 |
<show_in_website>1</show_in_website>
|
| 182 |
<show_in_store>1</show_in_store>
|
|
|
|
|
|
|
| 183 |
</title>
|
| 184 |
<genesis_username translate="label">
|
| 185 |
<label>Username</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
<frontend_type>text</frontend_type>
|
| 187 |
<sort_order>03</sort_order>
|
| 188 |
<show_in_default>1</show_in_default>
|
| 189 |
<show_in_website>1</show_in_website>
|
| 190 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
</genesis_username>
|
| 192 |
<genesis_password translate="label">
|
| 193 |
<label>Password</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
<frontend_type>text</frontend_type>
|
| 195 |
<sort_order>04</sort_order>
|
| 196 |
<show_in_default>1</show_in_default>
|
| 197 |
<show_in_website>1</show_in_website>
|
| 198 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
</genesis_password>
|
| 200 |
<genesis_environment translate="label">
|
| 201 |
<label>Test Mode</label>
|
| 202 |
<comment>
|
| 203 |
-
|
|
|
|
|
|
|
| 204 |
</comment>
|
| 205 |
<frontend_type>select</frontend_type>
|
| 206 |
<source_model>emerchantpay/admin_environment</source_model>
|
|
@@ -208,12 +420,17 @@ GNU General Public License for more details.
|
|
| 208 |
<show_in_default>1</show_in_default>
|
| 209 |
<show_in_website>1</show_in_website>
|
| 210 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
| 211 |
</genesis_environment>
|
| 212 |
<genesis_types translate="label">
|
| 213 |
<label>Transaction Types</label>
|
| 214 |
<comment>
|
| 215 |
-
|
| 216 |
-
|
|
|
|
|
|
|
| 217 |
</comment>
|
| 218 |
<frontend_type>multiselect</frontend_type>
|
| 219 |
<source_model>emerchantpay/admin_checkout_options_transaction_type</source_model>
|
|
@@ -222,59 +439,191 @@ GNU General Public License for more details.
|
|
| 222 |
<show_in_website>1</show_in_website>
|
| 223 |
<show_in_store>0</show_in_store>
|
| 224 |
<can_be_empty>1</can_be_empty>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
</genesis_types>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
<order_status translate="label">
|
| 227 |
<label>New Order Status</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
<frontend_type>select</frontend_type>
|
| 229 |
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
| 230 |
-
<sort_order>
|
| 231 |
<show_in_default>1</show_in_default>
|
| 232 |
<show_in_website>1</show_in_website>
|
| 233 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
</order_status>
|
| 235 |
<allowspecific translate="label">
|
| 236 |
<label>Payment from Applicable Countries</label>
|
| 237 |
<frontend_type>allowspecific</frontend_type>
|
| 238 |
-
<sort_order>
|
| 239 |
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 240 |
<show_in_default>1</show_in_default>
|
| 241 |
<show_in_website>1</show_in_website>
|
| 242 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
</allowspecific>
|
| 244 |
<specificcountry translate="label">
|
| 245 |
<label>Payment from Specific Countries</label>
|
| 246 |
<frontend_type>multiselect</frontend_type>
|
| 247 |
-
<sort_order>
|
| 248 |
<source_model>adminhtml/system_config_source_country</source_model>
|
| 249 |
<show_in_default>1</show_in_default>
|
| 250 |
<show_in_website>1</show_in_website>
|
| 251 |
<show_in_store>0</show_in_store>
|
| 252 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
</specificcountry>
|
| 254 |
<min_order_total translate="label">
|
| 255 |
<label>Minimum Order Total</label>
|
| 256 |
<frontend_type>text</frontend_type>
|
| 257 |
-
<sort_order>
|
| 258 |
<show_in_default>1</show_in_default>
|
| 259 |
<show_in_website>1</show_in_website>
|
| 260 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
</min_order_total>
|
| 262 |
<max_order_total translate="label">
|
| 263 |
<label>Maximum Order Total</label>
|
| 264 |
<frontend_type>text</frontend_type>
|
| 265 |
-
<sort_order>
|
| 266 |
<show_in_default>1</show_in_default>
|
| 267 |
<show_in_website>1</show_in_website>
|
| 268 |
<show_in_store>0</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
</max_order_total>
|
| 270 |
<sort_order translate="label">
|
| 271 |
<label>Sort Order</label>
|
| 272 |
<frontend_type>text</frontend_type>
|
| 273 |
-
<sort_order>
|
| 274 |
<show_in_default>1</show_in_default>
|
| 275 |
<show_in_website>1</show_in_website>
|
| 276 |
<show_in_store>0</show_in_store>
|
| 277 |
<frontend_class>validate-number</frontend_class>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
</sort_order>
|
| 279 |
</fields>
|
| 280 |
</emerchantpay_checkout>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<!--
|
| 3 |
+
Copyright (C) 2016 eMerchantPay Ltd.
|
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or
|
| 6 |
modify it under the terms of the GNU General Public License
|
| 13 |
GNU General Public License for more details.
|
| 14 |
|
| 15 |
@author eMerchantPay
|
| 16 |
+
@copyright 2016 eMerchantPay Ltd.
|
| 17 |
@license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
| 18 |
-->
|
| 19 |
<config>
|
| 22 |
<groups>
|
| 23 |
<emerchantpay_direct translate="label" module="emerchantpay">
|
| 24 |
<label>eMerchantPay Direct</label>
|
| 25 |
+
<comment>
|
| 26 |
+
<![CDATA[
|
| 27 |
+
Direct API - allow customers to enter their CreditCard information on your website.
|
| 28 |
+
Note: You need PCI-DSS certificate in order to enable this payment method.
|
| 29 |
+
]]>
|
| 30 |
+
</comment>
|
| 31 |
<sort_order>10</sort_order>
|
| 32 |
<show_in_default>1</show_in_default>
|
| 33 |
<show_in_website>1</show_in_website>
|
| 41 |
<show_in_default>1</show_in_default>
|
| 42 |
<show_in_website>1</show_in_website>
|
| 43 |
<show_in_store>0</show_in_store>
|
| 44 |
+
<validate>required-entry</validate>
|
| 45 |
+
<can_be_empty>0</can_be_empty>
|
| 46 |
</active>
|
| 47 |
<title translate="label">
|
| 48 |
<label>Title</label>
|
| 51 |
<show_in_default>1</show_in_default>
|
| 52 |
<show_in_website>1</show_in_website>
|
| 53 |
<show_in_store>1</show_in_store>
|
| 54 |
+
<validate>required-entry</validate>
|
| 55 |
+
<can_be_empty>0</can_be_empty>
|
| 56 |
</title>
|
| 57 |
+
<genesis_username translate="label">
|
| 58 |
+
<label>Username</label>
|
| 59 |
+
<comment>
|
| 60 |
+
<![CDATA[
|
| 61 |
+
Enter your Username, required for accessing the Genesis Gateway
|
| 62 |
+
]]>
|
| 63 |
+
</comment>
|
| 64 |
<frontend_type>text</frontend_type>
|
| 65 |
<sort_order>03</sort_order>
|
| 66 |
<show_in_default>1</show_in_default>
|
| 67 |
<show_in_website>1</show_in_website>
|
| 68 |
<show_in_store>0</show_in_store>
|
| 69 |
+
<validate>required-entry validate-alphanum</validate>
|
| 70 |
+
<can_be_empty>0</can_be_empty>
|
| 71 |
+
<depends>
|
| 72 |
+
<active>1</active>
|
| 73 |
+
</depends>
|
| 74 |
+
</genesis_username>
|
| 75 |
+
<genesis_password translate="label">
|
| 76 |
+
<label>Password</label>
|
| 77 |
+
<comment>
|
| 78 |
+
<![CDATA[
|
| 79 |
+
Enter your Password, required for accessing the Genesis Gateway
|
| 80 |
+
]]>
|
| 81 |
+
</comment>
|
| 82 |
<frontend_type>text</frontend_type>
|
| 83 |
<sort_order>04</sort_order>
|
| 84 |
<show_in_default>1</show_in_default>
|
| 85 |
<show_in_website>1</show_in_website>
|
| 86 |
<show_in_store>0</show_in_store>
|
| 87 |
+
<validate>required-entry validate-alphanum</validate>
|
| 88 |
+
<can_be_empty>0</can_be_empty>
|
| 89 |
+
<depends>
|
| 90 |
+
<active>1</active>
|
| 91 |
+
</depends>
|
| 92 |
+
</genesis_password>
|
| 93 |
+
<genesis_token translate="label">
|
| 94 |
+
<label>Token</label>
|
| 95 |
+
<comment>
|
| 96 |
+
<![CDATA[
|
| 97 |
+
Enter your Token, required for accessing the Genesis Gateway
|
| 98 |
+
]]>
|
| 99 |
+
</comment>
|
| 100 |
<frontend_type>text</frontend_type>
|
| 101 |
<sort_order>05</sort_order>
|
| 102 |
<show_in_default>1</show_in_default>
|
| 103 |
<show_in_website>1</show_in_website>
|
| 104 |
<show_in_store>0</show_in_store>
|
| 105 |
+
<validate>required-entry validate-alphanum</validate>
|
| 106 |
+
<can_be_empty>0</can_be_empty>
|
| 107 |
+
<depends>
|
| 108 |
+
<active>1</active>
|
| 109 |
+
</depends>
|
| 110 |
+
</genesis_token>
|
| 111 |
<genesis_environment translate="label">
|
| 112 |
<label>Test Mode</label>
|
| 113 |
<comment>
|
| 114 |
+
<![CDATA[
|
| 115 |
+
If enabled, your transactions are forwarded to our test (staging) environment.
|
| 116 |
+
]]>
|
| 117 |
</comment>
|
| 118 |
<frontend_type>select</frontend_type>
|
| 119 |
<source_model>emerchantpay/admin_environment</source_model>
|
| 121 |
<show_in_default>1</show_in_default>
|
| 122 |
<show_in_website>1</show_in_website>
|
| 123 |
<show_in_store>0</show_in_store>
|
| 124 |
+
<depends>
|
| 125 |
+
<active>1</active>
|
| 126 |
+
</depends>
|
| 127 |
</genesis_environment>
|
| 128 |
<genesis_type translate="label">
|
| 129 |
<label>Transaction Type</label>
|
| 130 |
<comment>
|
| 131 |
+
<![CDATA[
|
| 132 |
+
Select the transaction type for the initial transaction.
|
| 133 |
+
]]>
|
| 134 |
</comment>
|
| 135 |
<frontend_type>select</frontend_type>
|
| 136 |
<source_model>emerchantpay/admin_direct_options_transaction_type</source_model>
|
| 138 |
<show_in_default>1</show_in_default>
|
| 139 |
<show_in_website>1</show_in_website>
|
| 140 |
<show_in_store>0</show_in_store>
|
| 141 |
+
<validate>required-entry</validate>
|
| 142 |
+
<can_be_empty>0</can_be_empty>
|
| 143 |
+
<depends>
|
| 144 |
+
<active>1</active>
|
| 145 |
+
</depends>
|
| 146 |
</genesis_type>
|
| 147 |
+
<recurring_enabled translate="label">
|
| 148 |
+
<label>Enable Recurring</label>
|
| 149 |
+
<frontend_type>select</frontend_type>
|
| 150 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 151 |
+
<sort_order>08</sort_order>
|
| 152 |
+
<show_in_default>1</show_in_default>
|
| 153 |
+
<show_in_website>1</show_in_website>
|
| 154 |
+
<show_in_store>0</show_in_store>
|
| 155 |
+
<validate>required-entry</validate>
|
| 156 |
+
<can_be_empty>0</can_be_empty>
|
| 157 |
+
<depends>
|
| 158 |
+
<active>1</active>
|
| 159 |
+
</depends>
|
| 160 |
+
</recurring_enabled>
|
| 161 |
+
<recurring_transaction_type translate="label">
|
| 162 |
+
<label>Init Recurring Transaction Types</label>
|
| 163 |
+
<comment>
|
| 164 |
+
<![CDATA[
|
| 165 |
+
Select the transaction type that must be attempted during the Customers's Init Recurring Transaction session.
|
| 166 |
+
]]>
|
| 167 |
+
</comment>
|
| 168 |
+
<frontend_type>select</frontend_type>
|
| 169 |
+
<source_model>emerchantpay/admin_direct_options_transaction_recurring_type</source_model>
|
| 170 |
+
<sort_order>09</sort_order>
|
| 171 |
+
<show_in_default>1</show_in_default>
|
| 172 |
+
<show_in_website>1</show_in_website>
|
| 173 |
+
<show_in_store>0</show_in_store>
|
| 174 |
+
<validate>required-entry</validate>
|
| 175 |
+
<can_be_empty>0</can_be_empty>
|
| 176 |
+
<depends>
|
| 177 |
+
<active>1</active>
|
| 178 |
+
<recurring_enabled>1</recurring_enabled>
|
| 179 |
+
</depends>
|
| 180 |
+
</recurring_transaction_type>
|
| 181 |
+
<recurring_initial_fee>
|
| 182 |
+
<label>Initial Fee</label>
|
| 183 |
+
<comment><![CDATA[
|
| 184 |
+
Please, specify the amount for the Initial Recurring Transactions, if
|
| 185 |
+
the Product Recurring Initial Fee is not specified
|
| 186 |
+
]]>
|
| 187 |
+
</comment>
|
| 188 |
+
<frontend_type>text</frontend_type>
|
| 189 |
+
<sort_order>10</sort_order>
|
| 190 |
+
<show_in_default>1</show_in_default>
|
| 191 |
+
<show_in_website>0</show_in_website>
|
| 192 |
+
<show_in_store>0</show_in_store>
|
| 193 |
+
<validate>required-entry validate-zero-or-greater</validate>
|
| 194 |
+
<can_be_empty>0</can_be_empty>
|
| 195 |
+
<depends>
|
| 196 |
+
<active>1</active>
|
| 197 |
+
<recurring_enabled>1</recurring_enabled>
|
| 198 |
+
</depends>
|
| 199 |
+
</recurring_initial_fee>
|
| 200 |
+
<recurring_scheduler_cron_expr>
|
| 201 |
+
<label>Recurring Task Schedule (cron syntax)</label>
|
| 202 |
+
<comment><![CDATA[
|
| 203 |
+
Specify the time interval for the cron job, which will check
|
| 204 |
+
if there is a recurring profile waiting to be charged
|
| 205 |
+
(It should not be more than 1 Day.
|
| 206 |
+
Ex. "*/30 * * * *" means that the cron job will be executed every 30 minutes
|
| 207 |
+
]]>
|
| 208 |
+
</comment>
|
| 209 |
+
<frontend_type>text</frontend_type>
|
| 210 |
+
<sort_order>11</sort_order>
|
| 211 |
+
<show_in_default>1</show_in_default>
|
| 212 |
+
<show_in_website>0</show_in_website>
|
| 213 |
+
<show_in_store>0</show_in_store>
|
| 214 |
+
<validate>required-entry</validate>
|
| 215 |
+
<can_be_empty>0</can_be_empty>
|
| 216 |
+
<depends>
|
| 217 |
+
<active>1</active>
|
| 218 |
+
<recurring_enabled>1</recurring_enabled>
|
| 219 |
+
</depends>
|
| 220 |
+
</recurring_scheduler_cron_expr>
|
| 221 |
+
<cron_recurring_log_file translate="label">
|
| 222 |
+
<label>Recurring Job Log File</label>
|
| 223 |
+
<comment>
|
| 224 |
+
<![CDATA[
|
| 225 |
+
Default: "emerchantpay-recurring.log"
|
| 226 |
+
Keep empty to disable logging
|
| 227 |
+
]]>
|
| 228 |
+
</comment>
|
| 229 |
+
<frontend_type>text</frontend_type>
|
| 230 |
+
<sort_order>12</sort_order>
|
| 231 |
+
<show_in_default>1</show_in_default>
|
| 232 |
+
<can_be_empty>1</can_be_empty>
|
| 233 |
+
<depends>
|
| 234 |
+
<active>1</active>
|
| 235 |
+
<recurring_enabled>1</recurring_enabled>
|
| 236 |
+
</depends>
|
| 237 |
+
</cron_recurring_log_file>
|
| 238 |
<order_status translate="label">
|
| 239 |
<label>New Order Status</label>
|
| 240 |
+
<comment>
|
| 241 |
+
<![CDATA[
|
| 242 |
+
Select the default order status for new orders.
|
| 243 |
+
]]>
|
| 244 |
+
</comment>
|
| 245 |
<frontend_type>select</frontend_type>
|
| 246 |
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
| 247 |
+
<sort_order>13</sort_order>
|
| 248 |
<show_in_default>1</show_in_default>
|
| 249 |
<show_in_website>1</show_in_website>
|
| 250 |
<show_in_store>0</show_in_store>
|
| 251 |
+
<validate>required-entry</validate>
|
| 252 |
+
<can_be_empty>0</can_be_empty>
|
| 253 |
+
<depends>
|
| 254 |
+
<active>1</active>
|
| 255 |
+
</depends>
|
| 256 |
</order_status>
|
| 257 |
<allowspecific translate="label">
|
| 258 |
<label>Payment from Applicable Countries</label>
|
| 259 |
<frontend_type>allowspecific</frontend_type>
|
| 260 |
+
<sort_order>14</sort_order>
|
| 261 |
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 262 |
<show_in_default>1</show_in_default>
|
| 263 |
<show_in_website>1</show_in_website>
|
| 264 |
<show_in_store>0</show_in_store>
|
| 265 |
+
<validate>required-entry</validate>
|
| 266 |
+
<can_be_empty>0</can_be_empty>
|
| 267 |
+
<depends>
|
| 268 |
+
<active>1</active>
|
| 269 |
+
</depends>
|
| 270 |
</allowspecific>
|
| 271 |
<specificcountry translate="label">
|
| 272 |
<label>Payment from Specific Countries</label>
|
| 273 |
<frontend_type>multiselect</frontend_type>
|
| 274 |
+
<sort_order>15</sort_order>
|
| 275 |
<source_model>adminhtml/system_config_source_country</source_model>
|
| 276 |
<show_in_default>1</show_in_default>
|
| 277 |
<show_in_website>1</show_in_website>
|
| 278 |
<show_in_store>0</show_in_store>
|
| 279 |
+
<validate>required-entry</validate>
|
| 280 |
+
<can_be_empty>0</can_be_empty>
|
| 281 |
+
<depends>
|
| 282 |
+
<active>1</active>
|
| 283 |
+
<allowspecific>1</allowspecific>
|
| 284 |
+
</depends>
|
| 285 |
</specificcountry>
|
| 286 |
<cctypes translate="label">
|
| 287 |
<label>Credit Card Types</label>
|
| 288 |
<frontend_type>multiselect</frontend_type>
|
| 289 |
<source_model>adminhtml/system_config_source_payment_cctype</source_model>
|
| 290 |
+
<sort_order>16</sort_order>
|
| 291 |
<show_in_default>1</show_in_default>
|
| 292 |
<show_in_website>1</show_in_website>
|
| 293 |
<show_in_store>0</show_in_store>
|
| 294 |
+
<validate>required-entry</validate>
|
| 295 |
+
<can_be_empty>0</can_be_empty>
|
| 296 |
+
<depends>
|
| 297 |
+
<active>1</active>
|
| 298 |
+
</depends>
|
| 299 |
</cctypes>
|
| 300 |
<min_order_total translate="label">
|
| 301 |
<label>Minimum Order Total</label>
|
| 302 |
<frontend_type>text</frontend_type>
|
| 303 |
+
<sort_order>17</sort_order>
|
| 304 |
<show_in_default>1</show_in_default>
|
| 305 |
<show_in_website>1</show_in_website>
|
| 306 |
<show_in_store>0</show_in_store>
|
| 307 |
+
<validate>validate-zero-or-greater</validate>
|
| 308 |
+
<can_be_empty>1</can_be_empty>
|
| 309 |
+
<depends>
|
| 310 |
+
<active>1</active>
|
| 311 |
+
</depends>
|
| 312 |
</min_order_total>
|
| 313 |
<max_order_total translate="label">
|
| 314 |
<label>Maximum Order Total</label>
|
| 315 |
<frontend_type>text</frontend_type>
|
| 316 |
+
<sort_order>18</sort_order>
|
| 317 |
<show_in_default>1</show_in_default>
|
| 318 |
<show_in_website>1</show_in_website>
|
| 319 |
<show_in_store>0</show_in_store>
|
| 320 |
+
<validate>validate-zero-or-greater</validate>
|
| 321 |
+
<can_be_empty>1</can_be_empty>
|
| 322 |
+
<depends>
|
| 323 |
+
<active>1</active>
|
| 324 |
+
</depends>
|
| 325 |
</max_order_total>
|
| 326 |
<sort_order translate="label">
|
| 327 |
<label>Sort Order</label>
|
| 328 |
<frontend_type>text</frontend_type>
|
| 329 |
+
<sort_order>19</sort_order>
|
| 330 |
<show_in_default>1</show_in_default>
|
| 331 |
<show_in_website>1</show_in_website>
|
| 332 |
<show_in_store>0</show_in_store>
|
| 333 |
<frontend_class>validate-number</frontend_class>
|
| 334 |
+
<validate>validate-zero-or-greater</validate>
|
| 335 |
+
<can_be_empty>1</can_be_empty>
|
| 336 |
+
<depends>
|
| 337 |
+
<active>1</active>
|
| 338 |
+
</depends>
|
| 339 |
</sort_order>
|
| 340 |
</fields>
|
| 341 |
</emerchantpay_direct>
|
| 342 |
<emerchantpay_checkout translate="label" module="emerchantpay">
|
| 343 |
<label>eMerchantPay Checkout</label>
|
| 344 |
+
<comment>
|
| 345 |
+
<![CDATA[
|
| 346 |
+
Checkout payment method - receive credit-card payments, without the need of PCI-DSS certificate or HTTPS.
|
| 347 |
+
Note: Upon checkout, the customer will be redirected to a secure payment form, located on our servers and we will notify you, once the payment reached a final status
|
| 348 |
+
]]>
|
| 349 |
+
</comment>
|
| 350 |
<sort_order>10</sort_order>
|
| 351 |
<show_in_default>1</show_in_default>
|
| 352 |
<show_in_website>1</show_in_website>
|
| 368 |
<show_in_default>1</show_in_default>
|
| 369 |
<show_in_website>1</show_in_website>
|
| 370 |
<show_in_store>1</show_in_store>
|
| 371 |
+
<validate>required-entry</validate>
|
| 372 |
+
<can_be_empty>0</can_be_empty>
|
| 373 |
</title>
|
| 374 |
<genesis_username translate="label">
|
| 375 |
<label>Username</label>
|
| 376 |
+
<comment>
|
| 377 |
+
<![CDATA[
|
| 378 |
+
Enter your Username, required for accessing the Genesis Gateway
|
| 379 |
+
]]>
|
| 380 |
+
</comment>
|
| 381 |
<frontend_type>text</frontend_type>
|
| 382 |
<sort_order>03</sort_order>
|
| 383 |
<show_in_default>1</show_in_default>
|
| 384 |
<show_in_website>1</show_in_website>
|
| 385 |
<show_in_store>0</show_in_store>
|
| 386 |
+
<validate>required-entry validate-alphanum</validate>
|
| 387 |
+
<can_be_empty>0</can_be_empty>
|
| 388 |
+
<depends>
|
| 389 |
+
<active>1</active>
|
| 390 |
+
</depends>
|
| 391 |
</genesis_username>
|
| 392 |
<genesis_password translate="label">
|
| 393 |
<label>Password</label>
|
| 394 |
+
<comment>
|
| 395 |
+
<![CDATA[
|
| 396 |
+
Enter your Password, required for accessing the Genesis Gateway
|
| 397 |
+
]]>
|
| 398 |
+
</comment>
|
| 399 |
<frontend_type>text</frontend_type>
|
| 400 |
<sort_order>04</sort_order>
|
| 401 |
<show_in_default>1</show_in_default>
|
| 402 |
<show_in_website>1</show_in_website>
|
| 403 |
<show_in_store>0</show_in_store>
|
| 404 |
+
<validate>required-entry validate-alphanum</validate>
|
| 405 |
+
<can_be_empty>0</can_be_empty>
|
| 406 |
+
<depends>
|
| 407 |
+
<active>1</active>
|
| 408 |
+
</depends>
|
| 409 |
</genesis_password>
|
| 410 |
<genesis_environment translate="label">
|
| 411 |
<label>Test Mode</label>
|
| 412 |
<comment>
|
| 413 |
+
<![CDATA[
|
| 414 |
+
If enabled, your transactions are forwarded to our test (staging) environment.
|
| 415 |
+
]]>
|
| 416 |
</comment>
|
| 417 |
<frontend_type>select</frontend_type>
|
| 418 |
<source_model>emerchantpay/admin_environment</source_model>
|
| 420 |
<show_in_default>1</show_in_default>
|
| 421 |
<show_in_website>1</show_in_website>
|
| 422 |
<show_in_store>0</show_in_store>
|
| 423 |
+
<depends>
|
| 424 |
+
<active>1</active>
|
| 425 |
+
</depends>
|
| 426 |
</genesis_environment>
|
| 427 |
<genesis_types translate="label">
|
| 428 |
<label>Transaction Types</label>
|
| 429 |
<comment>
|
| 430 |
+
<![CDATA[
|
| 431 |
+
Select the transaction types that must be attempted during the customer's Checkout session.
|
| 432 |
+
The first transaction type that is available will be selected by the gateway.
|
| 433 |
+
]]>
|
| 434 |
</comment>
|
| 435 |
<frontend_type>multiselect</frontend_type>
|
| 436 |
<source_model>emerchantpay/admin_checkout_options_transaction_type</source_model>
|
| 439 |
<show_in_website>1</show_in_website>
|
| 440 |
<show_in_store>0</show_in_store>
|
| 441 |
<can_be_empty>1</can_be_empty>
|
| 442 |
+
<validate>required-entry</validate>
|
| 443 |
+
<can_be_empty>0</can_be_empty>
|
| 444 |
+
<depends>
|
| 445 |
+
<active>1</active>
|
| 446 |
+
</depends>
|
| 447 |
</genesis_types>
|
| 448 |
+
<recurring_enabled translate="label">
|
| 449 |
+
<label>Enable Recurring</label>
|
| 450 |
+
<frontend_type>select</frontend_type>
|
| 451 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 452 |
+
<sort_order>07</sort_order>
|
| 453 |
+
<show_in_default>1</show_in_default>
|
| 454 |
+
<show_in_website>1</show_in_website>
|
| 455 |
+
<show_in_store>0</show_in_store>
|
| 456 |
+
<validate>required-entry</validate>
|
| 457 |
+
<can_be_empty>0</can_be_empty>
|
| 458 |
+
<depends>
|
| 459 |
+
<active>1</active>
|
| 460 |
+
</depends>
|
| 461 |
+
</recurring_enabled>
|
| 462 |
+
<recurring_transaction_types translate="label">
|
| 463 |
+
<label>Init Recurring Transaction Types</label>
|
| 464 |
+
<comment>
|
| 465 |
+
<![CDATA[
|
| 466 |
+
Select the transaction types that must be attempted during the Customers's Init Recurring Transaction session.
|
| 467 |
+
The first transaction type that is available will be selected by the gateway.
|
| 468 |
+
]]>
|
| 469 |
+
</comment>
|
| 470 |
+
<frontend_type>multiselect</frontend_type>
|
| 471 |
+
<source_model>emerchantpay/admin_checkout_options_transaction_recurring_type</source_model>
|
| 472 |
+
<sort_order>08</sort_order>
|
| 473 |
+
<show_in_default>1</show_in_default>
|
| 474 |
+
<show_in_website>1</show_in_website>
|
| 475 |
+
<show_in_store>0</show_in_store>
|
| 476 |
+
<validate>required-entry</validate>
|
| 477 |
+
<can_be_empty>0</can_be_empty>
|
| 478 |
+
<depends>
|
| 479 |
+
<active>1</active>
|
| 480 |
+
<recurring_enabled>1</recurring_enabled>
|
| 481 |
+
</depends>
|
| 482 |
+
</recurring_transaction_types>
|
| 483 |
+
<recurring_initial_fee>
|
| 484 |
+
<label>Initial Fee</label>
|
| 485 |
+
<comment><![CDATA[
|
| 486 |
+
Please, specify the amount for the Initial Recurring Transactions, if
|
| 487 |
+
the Product Recurring Initial Fee is not specified
|
| 488 |
+
]]>
|
| 489 |
+
</comment>
|
| 490 |
+
<frontend_type>text</frontend_type>
|
| 491 |
+
<sort_order>09</sort_order>
|
| 492 |
+
<show_in_default>1</show_in_default>
|
| 493 |
+
<show_in_website>0</show_in_website>
|
| 494 |
+
<show_in_store>0</show_in_store>
|
| 495 |
+
<validate>required-entry validate-zero-or-greater</validate>
|
| 496 |
+
<can_be_empty>0</can_be_empty>
|
| 497 |
+
<depends>
|
| 498 |
+
<active>1</active>
|
| 499 |
+
<recurring_enabled>1</recurring_enabled>
|
| 500 |
+
</depends>
|
| 501 |
+
</recurring_initial_fee>
|
| 502 |
+
<recurring_scheduler_cron_expr>
|
| 503 |
+
<label>Recurring Task Schedule (cron syntax)</label>
|
| 504 |
+
<comment><![CDATA[
|
| 505 |
+
Specify the time interval for the cron job, which will check
|
| 506 |
+
if there is a recurring profile waiting to be charged
|
| 507 |
+
(It should not be more than 1 Day.
|
| 508 |
+
Ex. "*/30 * * * *" means that the cron job will be executed every 30 minutes
|
| 509 |
+
]]>
|
| 510 |
+
</comment>
|
| 511 |
+
<frontend_type>text</frontend_type>
|
| 512 |
+
<sort_order>10</sort_order>
|
| 513 |
+
<show_in_default>1</show_in_default>
|
| 514 |
+
<show_in_website>0</show_in_website>
|
| 515 |
+
<show_in_store>0</show_in_store>
|
| 516 |
+
<validate>required-entry</validate>
|
| 517 |
+
<can_be_empty>0</can_be_empty>
|
| 518 |
+
<depends>
|
| 519 |
+
<active>1</active>
|
| 520 |
+
<recurring_enabled>1</recurring_enabled>
|
| 521 |
+
</depends>
|
| 522 |
+
</recurring_scheduler_cron_expr>
|
| 523 |
+
<cron_recurring_log_file translate="label">
|
| 524 |
+
<label>Recurring Job Log File</label>
|
| 525 |
+
<comment>
|
| 526 |
+
<![CDATA[
|
| 527 |
+
Default: "emerchantpay-recurring.log"
|
| 528 |
+
Keep empty to disable logging
|
| 529 |
+
]]>
|
| 530 |
+
</comment>
|
| 531 |
+
<frontend_type>text</frontend_type>
|
| 532 |
+
<sort_order>11</sort_order>
|
| 533 |
+
<show_in_default>1</show_in_default>
|
| 534 |
+
<can_be_empty>1</can_be_empty>
|
| 535 |
+
<depends>
|
| 536 |
+
<active>1</active>
|
| 537 |
+
<recurring_enabled>1</recurring_enabled>
|
| 538 |
+
</depends>
|
| 539 |
+
</cron_recurring_log_file>
|
| 540 |
<order_status translate="label">
|
| 541 |
<label>New Order Status</label>
|
| 542 |
+
<comment>
|
| 543 |
+
<![CDATA[
|
| 544 |
+
Select the default order status for new orders.
|
| 545 |
+
]]>
|
| 546 |
+
</comment>
|
| 547 |
<frontend_type>select</frontend_type>
|
| 548 |
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
| 549 |
+
<sort_order>12</sort_order>
|
| 550 |
<show_in_default>1</show_in_default>
|
| 551 |
<show_in_website>1</show_in_website>
|
| 552 |
<show_in_store>0</show_in_store>
|
| 553 |
+
<validate>required-entry</validate>
|
| 554 |
+
<can_be_empty>0</can_be_empty>
|
| 555 |
+
<depends>
|
| 556 |
+
<active>1</active>
|
| 557 |
+
</depends>
|
| 558 |
</order_status>
|
| 559 |
<allowspecific translate="label">
|
| 560 |
<label>Payment from Applicable Countries</label>
|
| 561 |
<frontend_type>allowspecific</frontend_type>
|
| 562 |
+
<sort_order>13</sort_order>
|
| 563 |
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 564 |
<show_in_default>1</show_in_default>
|
| 565 |
<show_in_website>1</show_in_website>
|
| 566 |
<show_in_store>0</show_in_store>
|
| 567 |
+
<validate>required-entry</validate>
|
| 568 |
+
<can_be_empty>0</can_be_empty>
|
| 569 |
+
<depends>
|
| 570 |
+
<active>1</active>
|
| 571 |
+
</depends>
|
| 572 |
</allowspecific>
|
| 573 |
<specificcountry translate="label">
|
| 574 |
<label>Payment from Specific Countries</label>
|
| 575 |
<frontend_type>multiselect</frontend_type>
|
| 576 |
+
<sort_order>14</sort_order>
|
| 577 |
<source_model>adminhtml/system_config_source_country</source_model>
|
| 578 |
<show_in_default>1</show_in_default>
|
| 579 |
<show_in_website>1</show_in_website>
|
| 580 |
<show_in_store>0</show_in_store>
|
| 581 |
+
<validate>required-entry</validate>
|
| 582 |
+
<can_be_empty>0</can_be_empty>
|
| 583 |
+
<depends>
|
| 584 |
+
<active>1</active>
|
| 585 |
+
<allowspecific>1</allowspecific>
|
| 586 |
+
</depends>
|
| 587 |
</specificcountry>
|
| 588 |
<min_order_total translate="label">
|
| 589 |
<label>Minimum Order Total</label>
|
| 590 |
<frontend_type>text</frontend_type>
|
| 591 |
+
<sort_order>15</sort_order>
|
| 592 |
<show_in_default>1</show_in_default>
|
| 593 |
<show_in_website>1</show_in_website>
|
| 594 |
<show_in_store>0</show_in_store>
|
| 595 |
+
<validate>validate-zero-or-greater</validate>
|
| 596 |
+
<can_be_empty>1</can_be_empty>
|
| 597 |
+
<depends>
|
| 598 |
+
<active>1</active>
|
| 599 |
+
</depends>
|
| 600 |
</min_order_total>
|
| 601 |
<max_order_total translate="label">
|
| 602 |
<label>Maximum Order Total</label>
|
| 603 |
<frontend_type>text</frontend_type>
|
| 604 |
+
<sort_order>16</sort_order>
|
| 605 |
<show_in_default>1</show_in_default>
|
| 606 |
<show_in_website>1</show_in_website>
|
| 607 |
<show_in_store>0</show_in_store>
|
| 608 |
+
<validate>validate-zero-or-greater</validate>
|
| 609 |
+
<can_be_empty>1</can_be_empty>
|
| 610 |
+
<depends>
|
| 611 |
+
<active>1</active>
|
| 612 |
+
</depends>
|
| 613 |
</max_order_total>
|
| 614 |
<sort_order translate="label">
|
| 615 |
<label>Sort Order</label>
|
| 616 |
<frontend_type>text</frontend_type>
|
| 617 |
+
<sort_order>17</sort_order>
|
| 618 |
<show_in_default>1</show_in_default>
|
| 619 |
<show_in_website>1</show_in_website>
|
| 620 |
<show_in_store>0</show_in_store>
|
| 621 |
<frontend_class>validate-number</frontend_class>
|
| 622 |
+
<validate>validate-zero-or-greater</validate>
|
| 623 |
+
<can_be_empty>1</can_be_empty>
|
| 624 |
+
<depends>
|
| 625 |
+
<active>1</active>
|
| 626 |
+
</depends>
|
| 627 |
</sort_order>
|
| 628 |
</fields>
|
| 629 |
</emerchantpay_checkout>
|
|
@@ -20,6 +20,19 @@
|
|
| 20 |
<?php $_code = $this->getMethodCode() ?>
|
| 21 |
|
| 22 |
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
<li>
|
| 24 |
<p>
|
| 25 |
<?php echo $this->__("You will be redirected to our partner's website, where you can safely pay with your credit card."); ?>
|
| 20 |
<?php $_code = $this->getMethodCode() ?>
|
| 21 |
|
| 22 |
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
| 23 |
+
<?php if ($this->getHasNominalItems()) { ?>
|
| 24 |
+
<li>
|
| 25 |
+
<ul class="messages">
|
| 26 |
+
<li class="notice-msg">
|
| 27 |
+
<ul>
|
| 28 |
+
<li>
|
| 29 |
+
<span><?php echo $this->__("Please have in mind that you are processing a Recurring Transaction!");?></span>
|
| 30 |
+
</li>
|
| 31 |
+
</ul>
|
| 32 |
+
</li>
|
| 33 |
+
</ul>
|
| 34 |
+
</li>
|
| 35 |
+
<?php } ?>
|
| 36 |
<li>
|
| 37 |
<p>
|
| 38 |
<?php echo $this->__("You will be redirected to our partner's website, where you can safely pay with your credit card."); ?>
|
|
@@ -26,6 +26,19 @@
|
|
| 26 |
?>
|
| 27 |
<?php $_code=$this->getMethodCode() ?>
|
| 28 |
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
<li>
|
| 30 |
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
| 31 |
<div class="input-box">
|
| 26 |
?>
|
| 27 |
<?php $_code=$this->getMethodCode() ?>
|
| 28 |
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
| 29 |
+
<?php if ($this->getHasNominalItems()) { ?>
|
| 30 |
+
<li>
|
| 31 |
+
<ul class="messages">
|
| 32 |
+
<li class="notice-msg">
|
| 33 |
+
<ul>
|
| 34 |
+
<li>
|
| 35 |
+
<span><?php echo $this->__("Please have in mind that you are processing a Recurring Transaction!");?></span>
|
| 36 |
+
</li>
|
| 37 |
+
</ul>
|
| 38 |
+
</li>
|
| 39 |
+
</ul>
|
| 40 |
+
</li>
|
| 41 |
+
<?php } ?>
|
| 42 |
<li>
|
| 43 |
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
| 44 |
<div class="input-box">
|
|
Binary file
|
|
@@ -86,4 +86,22 @@ class Methods
|
|
| 86 |
* PPRO transaction
|
| 87 |
*/
|
| 88 |
const TRUST_PAY = 'trustpay';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
}
|
| 86 |
* PPRO transaction
|
| 87 |
*/
|
| 88 |
const TRUST_PAY = 'trustpay';
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Returns all available payment methods
|
| 92 |
+
* @return array
|
| 93 |
+
*/
|
| 94 |
+
public static function getMethods()
|
| 95 |
+
{
|
| 96 |
+
return array(
|
| 97 |
+
self::EPS,
|
| 98 |
+
self::GIRO_PAY,
|
| 99 |
+
self::IDEAL,
|
| 100 |
+
self::PRZELEWY24,
|
| 101 |
+
self::QIWI,
|
| 102 |
+
self::SAFETY_PAY,
|
| 103 |
+
self::TELEINGRESO,
|
| 104 |
+
self::TRUST_PAY
|
| 105 |
+
);
|
| 106 |
+
}
|
| 107 |
}
|
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
* in the Software without restriction, including without limitation the rights
|
| 6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
* furnished to do so, subject to the following conditions:
|
| 9 |
+
*
|
| 10 |
+
* The above copyright notice and this permission notice shall be included in
|
| 11 |
+
* all copies or substantial portions of the Software.
|
| 12 |
+
*
|
| 13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
* THE SOFTWARE.
|
| 20 |
+
*
|
| 21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
| 22 |
+
*/
|
| 23 |
+
namespace Genesis\API\Constants\Transaction\Parameters\PayByVouchers;
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Class CardTypes
|
| 27 |
+
*
|
| 28 |
+
* CardTypes of PayByVouchers Genesis Transaction
|
| 29 |
+
*
|
| 30 |
+
* @package Genesis\API\Constants\Transaction\Parameters\PayByVouchers
|
| 31 |
+
*
|
| 32 |
+
*/
|
| 33 |
+
class CardTypes
|
| 34 |
+
{
|
| 35 |
+
/**
|
| 36 |
+
* The type of the issued card will be virtual
|
| 37 |
+
*/
|
| 38 |
+
const VIRTUAL = 'virtual';
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* The type of the issued card will be physical
|
| 42 |
+
*/
|
| 43 |
+
const PHYSICAL = 'physical';
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Check if a card type is supported
|
| 47 |
+
*
|
| 48 |
+
* @param $cardType
|
| 49 |
+
* @return string
|
| 50 |
+
*/
|
| 51 |
+
public static function isValidCardType($cardType)
|
| 52 |
+
{
|
| 53 |
+
if (@constant('self::' . strtoupper($cardType))) {
|
| 54 |
+
return true;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
return false;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Returns all available Card Types
|
| 62 |
+
* @return array
|
| 63 |
+
*/
|
| 64 |
+
public static function getCardTypes()
|
| 65 |
+
{
|
| 66 |
+
return array(
|
| 67 |
+
self::VIRTUAL,
|
| 68 |
+
self::PHYSICAL
|
| 69 |
+
);
|
| 70 |
+
}
|
| 71 |
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
* in the Software without restriction, including without limitation the rights
|
| 6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
* furnished to do so, subject to the following conditions:
|
| 9 |
+
*
|
| 10 |
+
* The above copyright notice and this permission notice shall be included in
|
| 11 |
+
* all copies or substantial portions of the Software.
|
| 12 |
+
*
|
| 13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
* THE SOFTWARE.
|
| 20 |
+
*
|
| 21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
| 22 |
+
*/
|
| 23 |
+
namespace Genesis\API\Constants\Transaction\Parameters\PayByVouchers;
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Class RedeemTypes
|
| 27 |
+
*
|
| 28 |
+
* RedeemTypes of PayByVouchers Genesis Transaction
|
| 29 |
+
*
|
| 30 |
+
* @package Genesis\API\Constants\Transaction\Parameters\PayByVouchers
|
| 31 |
+
*
|
| 32 |
+
*/
|
| 33 |
+
class RedeemTypes
|
| 34 |
+
{
|
| 35 |
+
/**
|
| 36 |
+
* The amount value is stored in the voucher and can be used later on at any merchant outlet
|
| 37 |
+
* supporting the voucher card brand
|
| 38 |
+
*/
|
| 39 |
+
const STORED = 'stored';
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* The voucher is issued, the amount value is transferred into it, and then immediately redeemed to the merchant
|
| 43 |
+
*/
|
| 44 |
+
const INSTANT = 'instant';
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Check if a redeem type is supported
|
| 48 |
+
*
|
| 49 |
+
* @param $redeemType
|
| 50 |
+
* @return string
|
| 51 |
+
*/
|
| 52 |
+
public static function isValidRedeemType($redeemType)
|
| 53 |
+
{
|
| 54 |
+
if (@constant('self::' . strtoupper($redeemType))) {
|
| 55 |
+
return true;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
return false;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Returns all available Redeem Types
|
| 63 |
+
* @return array
|
| 64 |
+
*/
|
| 65 |
+
public static function getRedeemTypes()
|
| 66 |
+
{
|
| 67 |
+
return array(
|
| 68 |
+
self::STORED,
|
| 69 |
+
self::INSTANT
|
| 70 |
+
);
|
| 71 |
+
}
|
| 72 |
+
}
|
|
@@ -155,4 +155,104 @@ class Types
|
|
| 155 |
* Bank transfer payment, popular in Germany
|
| 156 |
*/
|
| 157 |
const SOFORT = 'sofort';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
}
|
| 155 |
* Bank transfer payment, popular in Germany
|
| 156 |
*/
|
| 157 |
const SOFORT = 'sofort';
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Check whether this is a valid (known) transaction type
|
| 161 |
+
*
|
| 162 |
+
* @return bool
|
| 163 |
+
*/
|
| 164 |
+
public static function isValidTransactionType($type)
|
| 165 |
+
{
|
| 166 |
+
$transactionTypesList = array(
|
| 167 |
+
self::AVS,
|
| 168 |
+
self::ACCOUNT_VERIFICATION,
|
| 169 |
+
self::AUTHORIZE,
|
| 170 |
+
self::AUTHORIZE_3D,
|
| 171 |
+
self::SALE,
|
| 172 |
+
self::SALE_3D,
|
| 173 |
+
self::CAPTURE,
|
| 174 |
+
self::REFUND,
|
| 175 |
+
self::VOID,
|
| 176 |
+
self::CREDIT,
|
| 177 |
+
self::PAYOUT,
|
| 178 |
+
self::INIT_RECURRING_SALE,
|
| 179 |
+
self::INIT_RECURRING_SALE_3D,
|
| 180 |
+
self::RECURRING_SALE,
|
| 181 |
+
self::ABNIDEAL,
|
| 182 |
+
self::CASHU,
|
| 183 |
+
self::EZEEWALLET,
|
| 184 |
+
self::NETELLER,
|
| 185 |
+
self::POLI,
|
| 186 |
+
self::WEBMONEY,
|
| 187 |
+
self::PAYBYVOUCHER_YEEPAY,
|
| 188 |
+
self::PAYBYVOUCHER_SALE,
|
| 189 |
+
self::PAYSAFECARD,
|
| 190 |
+
self::PPRO,
|
| 191 |
+
self::SOFORT
|
| 192 |
+
);
|
| 193 |
+
|
| 194 |
+
if (in_array($type, $transactionTypesList)) {
|
| 195 |
+
return true;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
return false;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* Check whether this is a valid (known) transaction type
|
| 203 |
+
*
|
| 204 |
+
* @return bool
|
| 205 |
+
*/
|
| 206 |
+
public static function isPayByVoucher($type)
|
| 207 |
+
{
|
| 208 |
+
$transactionTypesList = array(
|
| 209 |
+
self::PAYBYVOUCHER_YEEPAY,
|
| 210 |
+
self::PAYBYVOUCHER_SALE,
|
| 211 |
+
);
|
| 212 |
+
|
| 213 |
+
if (in_array($type, $transactionTypesList)) {
|
| 214 |
+
return true;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
return false;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
/**
|
| 221 |
+
* Get custom required parameters with values per transaction
|
| 222 |
+
* @param string $type
|
| 223 |
+
* @return array|bool
|
| 224 |
+
*/
|
| 225 |
+
public static function getCustomRequiredParameters($type)
|
| 226 |
+
{
|
| 227 |
+
switch ($type) {
|
| 228 |
+
case self::PPRO:
|
| 229 |
+
return array(
|
| 230 |
+
'payment_method' =>
|
| 231 |
+
\Genesis\API\Constants\Payment\Methods::getMethods()
|
| 232 |
+
);
|
| 233 |
+
break;
|
| 234 |
+
|
| 235 |
+
case self::PAYBYVOUCHER_SALE:
|
| 236 |
+
case self::PAYBYVOUCHER_YEEPAY:
|
| 237 |
+
$customParameters = array(
|
| 238 |
+
'card_type' =>
|
| 239 |
+
\Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::getCardTypes(),
|
| 240 |
+
'redeem_type' =>
|
| 241 |
+
\Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::getRedeemTypes()
|
| 242 |
+
);
|
| 243 |
+
|
| 244 |
+
if ($type == self::PAYBYVOUCHER_YEEPAY) {
|
| 245 |
+
$customParameters = array_merge($customParameters, array(
|
| 246 |
+
'product_name' => null,
|
| 247 |
+
'product_category' => null
|
| 248 |
+
));
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
return $customParameters;
|
| 252 |
+
break;
|
| 253 |
+
|
| 254 |
+
default:
|
| 255 |
+
return false;
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
}
|
|
Binary file
|
|
@@ -38,6 +38,20 @@ class Sale extends \Genesis\API\Request
|
|
| 38 |
*/
|
| 39 |
protected $transaction_id;
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
/**
|
| 42 |
* Description of the transaction for later use
|
| 43 |
*
|
|
@@ -347,6 +361,8 @@ class Sale extends \Genesis\API\Request
|
|
| 347 |
{
|
| 348 |
$requiredFields = array(
|
| 349 |
'transaction_id',
|
|
|
|
|
|
|
| 350 |
'amount',
|
| 351 |
'currency',
|
| 352 |
'card_holder',
|
|
@@ -369,6 +385,8 @@ class Sale extends \Genesis\API\Request
|
|
| 369 |
'payment_transaction' => array(
|
| 370 |
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE,
|
| 371 |
'transaction_id' => $this->transaction_id,
|
|
|
|
|
|
|
| 372 |
'usage' => $this->usage,
|
| 373 |
'remote_ip' => $this->remote_ip,
|
| 374 |
'amount' => $this->transform(
|
| 38 |
*/
|
| 39 |
protected $transaction_id;
|
| 40 |
|
| 41 |
+
/**
|
| 42 |
+
* Card type for the voucher - can be ’virtual’ or ’physical’ only
|
| 43 |
+
*
|
| 44 |
+
* @var string
|
| 45 |
+
*/
|
| 46 |
+
protected $card_type;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Redeem type for the voucher - can be ’stored’ or ’instant’ only
|
| 50 |
+
*
|
| 51 |
+
* @var string
|
| 52 |
+
*/
|
| 53 |
+
protected $redeem_type;
|
| 54 |
+
|
| 55 |
/**
|
| 56 |
* Description of the transaction for later use
|
| 57 |
*
|
| 361 |
{
|
| 362 |
$requiredFields = array(
|
| 363 |
'transaction_id',
|
| 364 |
+
'card_type',
|
| 365 |
+
'redeem_type',
|
| 366 |
'amount',
|
| 367 |
'currency',
|
| 368 |
'card_holder',
|
| 385 |
'payment_transaction' => array(
|
| 386 |
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE,
|
| 387 |
'transaction_id' => $this->transaction_id,
|
| 388 |
+
'card_type' => $this->card_type,
|
| 389 |
+
'redeem_type' => $this->redeem_type,
|
| 390 |
'usage' => $this->usage,
|
| 391 |
'remote_ip' => $this->remote_ip,
|
| 392 |
'amount' => $this->transform(
|
|
@@ -38,6 +38,20 @@ class oBeP extends \Genesis\API\Request
|
|
| 38 |
*/
|
| 39 |
protected $transaction_id;
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
/**
|
| 42 |
* IPv4 address of customer
|
| 43 |
*
|
|
@@ -160,6 +174,8 @@ class oBeP extends \Genesis\API\Request
|
|
| 160 |
{
|
| 161 |
$requiredFields = array(
|
| 162 |
'transaction_id',
|
|
|
|
|
|
|
| 163 |
'amount',
|
| 164 |
'currency',
|
| 165 |
'product_name',
|
|
@@ -186,6 +202,8 @@ class oBeP extends \Genesis\API\Request
|
|
| 186 |
'payment_transaction' => array(
|
| 187 |
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY,
|
| 188 |
'transaction_id' => $this->transaction_id,
|
|
|
|
|
|
|
| 189 |
'remote_ip' => $this->remote_ip,
|
| 190 |
'amount' => $this->transform(
|
| 191 |
'amount',
|
| 38 |
*/
|
| 39 |
protected $transaction_id;
|
| 40 |
|
| 41 |
+
/**
|
| 42 |
+
* Card type for the voucher - can be ’virtual’ or ’physical’ only
|
| 43 |
+
*
|
| 44 |
+
* @var string
|
| 45 |
+
*/
|
| 46 |
+
protected $card_type;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Redeem type for the voucher - can be ’stored’ or ’instant’ only
|
| 50 |
+
*
|
| 51 |
+
* @var string
|
| 52 |
+
*/
|
| 53 |
+
protected $redeem_type;
|
| 54 |
+
|
| 55 |
/**
|
| 56 |
* IPv4 address of customer
|
| 57 |
*
|
| 174 |
{
|
| 175 |
$requiredFields = array(
|
| 176 |
'transaction_id',
|
| 177 |
+
'card_type',
|
| 178 |
+
'redeem_type',
|
| 179 |
'amount',
|
| 180 |
'currency',
|
| 181 |
'product_name',
|
| 202 |
'payment_transaction' => array(
|
| 203 |
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY,
|
| 204 |
'transaction_id' => $this->transaction_id,
|
| 205 |
+
'card_type' => $this->card_type,
|
| 206 |
+
'redeem_type' => $this->redeem_type,
|
| 207 |
'remote_ip' => $this->remote_ip,
|
| 208 |
'amount' => $this->transform(
|
| 209 |
'amount',
|
|
Binary file
|
|
@@ -317,6 +317,8 @@ class Create extends \Genesis\API\Request
|
|
| 317 |
*/
|
| 318 |
public function addTransactionType($name, $parameters = array())
|
| 319 |
{
|
|
|
|
|
|
|
| 320 |
$structure = array(
|
| 321 |
'transaction_type' => array(
|
| 322 |
'@attributes' => array(
|
|
@@ -331,6 +333,75 @@ class Create extends \Genesis\API\Request
|
|
| 331 |
return $this;
|
| 332 |
}
|
| 333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
/**
|
| 335 |
* Add ISO 639-1 language code to the URL
|
| 336 |
*
|
| 317 |
*/
|
| 318 |
public function addTransactionType($name, $parameters = array())
|
| 319 |
{
|
| 320 |
+
$this->verifyTransactionType($name, $parameters);
|
| 321 |
+
|
| 322 |
$structure = array(
|
| 323 |
'transaction_type' => array(
|
| 324 |
'@attributes' => array(
|
| 333 |
return $this;
|
| 334 |
}
|
| 335 |
|
| 336 |
+
/**
|
| 337 |
+
* Verify that transaction type parameters are populated correctly
|
| 338 |
+
*
|
| 339 |
+
* @param string $transactionType
|
| 340 |
+
* @param array $parameters
|
| 341 |
+
* @throws \Genesis\Exceptions\ErrorParameter
|
| 342 |
+
*/
|
| 343 |
+
protected function verifyTransactionType($transactionType, $parameters = array())
|
| 344 |
+
{
|
| 345 |
+
if (!\Genesis\API\Constants\Transaction\Types::isValidTransactionType($transactionType)) {
|
| 346 |
+
throw new \Genesis\Exceptions\ErrorParameter(
|
| 347 |
+
sprintf(
|
| 348 |
+
'Transaction type (%s) is not valid',
|
| 349 |
+
$transactionType
|
| 350 |
+
)
|
| 351 |
+
);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
$transactionCustomRequiredParams = \Genesis\API\Constants\Transaction\Types::getCustomRequiredParameters(
|
| 355 |
+
$transactionType
|
| 356 |
+
);
|
| 357 |
+
|
| 358 |
+
if (\Genesis\Utils\Common::isValidArray($transactionCustomRequiredParams)) {
|
| 359 |
+
foreach ($transactionCustomRequiredParams as $customRequiredParam => $customRequiredParamValues) {
|
| 360 |
+
if (!array_key_exists($customRequiredParam, $parameters)) {
|
| 361 |
+
foreach ($parameters as $parameter) {
|
| 362 |
+
if (!\Genesis\Utils\Common::isValidArray($parameter) ||
|
| 363 |
+
!array_key_exists($customRequiredParam, $parameter)) {
|
| 364 |
+
throw new \Genesis\Exceptions\ErrorParameter(
|
| 365 |
+
sprintf(
|
| 366 |
+
'Empty (null) required parameter: %s for transaction type %s',
|
| 367 |
+
$customRequiredParam,
|
| 368 |
+
$transactionType
|
| 369 |
+
)
|
| 370 |
+
);
|
| 371 |
+
}
|
| 372 |
+
}
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
if (!empty($customRequiredParamValues) && \Genesis\Utils\Common::isValidArray($customRequiredParamValues)) {
|
| 376 |
+
if (!\Genesis\Utils\Common::arrayContainsArrayItems($parameters)) {
|
| 377 |
+
if (!in_array($parameters[$customRequiredParam], $customRequiredParamValues)) {
|
| 378 |
+
sprintf(
|
| 379 |
+
'Invalid value (%s) for required parameter: %s (Transaction type: %s)',
|
| 380 |
+
$parameters[$customRequiredParam],
|
| 381 |
+
$customRequiredParam,
|
| 382 |
+
$transactionType
|
| 383 |
+
);
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
else {
|
| 387 |
+
foreach ($parameters as $parameter) {
|
| 388 |
+
if (!in_array($parameter[$customRequiredParam], $customRequiredParamValues)) {
|
| 389 |
+
throw new \Genesis\Exceptions\ErrorParameter(
|
| 390 |
+
sprintf(
|
| 391 |
+
'Invalid value (%s) for required parameter: %s (Transaction type: %s)',
|
| 392 |
+
$parameter[$customRequiredParam],
|
| 393 |
+
$customRequiredParam,
|
| 394 |
+
$transactionType
|
| 395 |
+
)
|
| 396 |
+
);
|
| 397 |
+
}
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
}
|
| 401 |
+
}
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
/**
|
| 406 |
* Add ISO 639-1 language code to the URL
|
| 407 |
*
|
|
@@ -42,7 +42,7 @@ final class Config
|
|
| 42 |
/**
|
| 43 |
* Library Version
|
| 44 |
*/
|
| 45 |
-
const VERSION = '1.4.
|
| 46 |
|
| 47 |
/**
|
| 48 |
* Core configuration settings
|
| 42 |
/**
|
| 43 |
* Library Version
|
| 44 |
*/
|
| 45 |
+
const VERSION = '1.4.2';
|
| 46 |
|
| 47 |
/**
|
| 48 |
* Core configuration settings
|
|
Binary file
|
|
@@ -250,4 +250,24 @@ final class Common
|
|
| 250 |
|
| 251 |
return false;
|
| 252 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 250 |
|
| 251 |
return false;
|
| 252 |
}
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Check if an array has array items
|
| 256 |
+
* @param array $arr
|
| 257 |
+
* @return bool
|
| 258 |
+
*/
|
| 259 |
+
public static function arrayContainsArrayItems($arr)
|
| 260 |
+
{
|
| 261 |
+
if (!self::isValidArray($arr)) {
|
| 262 |
+
return false;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
foreach ($arr as $item) {
|
| 266 |
+
if (self::isValidArray($item)) {
|
| 267 |
+
return true;
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
return false;
|
| 272 |
+
}
|
| 273 |
}
|
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>EMerchantPay_Genesis_Client</name>
|
| 4 |
-
<version>1.2.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,15 +10,44 @@
|
|
| 10 |
<description>This is a Payment Module for Magento Community Edition, that gives you the ability to process payments through eMerchantPay's Payment Gateway - Genesis.
|
| 11 |

|
| 12 |
The Payment Gateway supports all of the major credit/debit card brands and more than 40 alternative payment methods (APMs) and e-wallets. When using the module, the merchant benefits from eMerchantPay’s vast payment industry experience and a full suite of value-added services such as sophisticated risk management and monitoring tools, with the added benefit of removing the burden of PCI DSS compliance from the merchant.</description>
|
| 13 |
-
<notes>1.) Added Support for
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |

|
| 15 |
2.) A possibility has been added to use an external GenesisGateway Library (installed by composer) instead of the integrated in Module
|
| 16 |

|
| 17 |
2.) A few minor issues were resolved regarding Capture / Refund Transactions</notes>
|
| 18 |
<authors><author><name>eMerchantPay Ltd.</name><user>chrisrive</user><email>chris@emerchantpay.com</email></author></authors>
|
| 19 |
-
<date>2016-
|
| 20 |
-
<time>
|
| 21 |
-
<contents><target name="magecommunity"><dir name="EMerchantPay"><dir name="Genesis"><dir name="Block"><dir name="Form"><file name="Checkout.php" hash="e1713fe21f92f7bb7a522b7730939c1d"/><file name="Direct.php" hash="c5f16b7b7fb6f1f07bd8089e85dc01a9"/></dir><dir name="Info"><file name="Checkout.php" hash="c2fd5ae90dcf40e6da76178060ad5bdd"/><file name="Direct.php" hash="7f4daf266862c14c2a960688bb9e7670"/></dir><dir name="Redirect"><file name="Checkout.php" hash="603172085e3048c978141cc10638eac3"/><file name="Direct.php" hash="104ba1d6e5b37d1fc2888802b1c020b9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a0117631e5acf7f94783cbdc2bd843a2"/></dir><dir name="Model"><dir name="Admin"><dir name="Checkout"><dir name="Options"><dir name="Transaction"><file name="Type.php" hash="81ae87b247bc6f64c93e813094106892"/></dir></dir></dir><dir name="Direct"><dir name="Options"><dir name="Transaction"><file name="Type.php" hash="9e3ee18be9459b20f645fb9d732f06af"/></dir></dir></dir><file name="Environment.php" hash="d49c0459884af6d14e1731c4ee9e593d"/></dir><file name="Checkout.php" hash="7dbae46ec6a6f8a8384621ed5843a9e0"/><file name="Direct.php" hash="fa4c323671fdec353449725be66635fb"/></dir><dir name="Observer"><file name="GenesisAutoLoader.php" hash="8dc769bfedd535b5f9daa530b79dd848"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="592dbcaa98e7c2c1168ce0225b9e6a8b"/><file name="DirectController.php" hash="720df84338103b873dd0ddf760202886"/></dir><dir name="etc"><file name="config.xml" hash="2c866eb5fd8d3f052c68daf07c2b6538"/><file name="system.xml" hash="6735a2d7193fccb4409697173d62996f"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="info"><file name="checkout.phtml" hash="121f777049b801219f2792ca9aaedd3e"/><file name="direct.phtml" hash="121f777049b801219f2792ca9aaedd3e"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="form"><file name="checkout.phtml" hash="ba9d29a0bbf17e2898ea1eb78b7a1ab2"/><file name="direct.phtml" hash="d632828998036b99c05efbd55e85e3fd"/></dir><dir name="info"><file name="checkout.phtml" hash="939277e4db9bda19b6932775a03fbaac"/><file name="direct.phtml" hash="939277e4db9bda19b6932775a03fbaac"/></dir><dir name="redirect"><file name="checkout.phtml" hash="caee38fbfc90ebc340730b83066486d3"/><file name="direct.phtml" hash="caee38fbfc90ebc340730b83066486d3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EMerchantPay_Genesis.xml" hash="83879cf40aba5587eecc86c162398e43"/></dir></target><target name="magelocale"><dir name="en_GB"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir><dir name="en_US"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir></target><target name="magelib"><dir name="Genesis"><dir name="src"><dir name="Genesis"><dir name="API"><dir name="Constants"><file name="Banks.php" hash="b7b1fc98be9aa2c0e2bd7c03086ca397"/><file name="Endpoints.php" hash="2036dc4c26f6e7418d5ce198170f96a1"/><file name="Environments.php" hash="4054e40a140cd9b4010a49e7928457f4"/><file name="Errors.php" hash="434b001eb137e74e654020d63b7c4f72"/><dir name="Payment"><file name="Methods.php" hash="f2c35f1c40452e1eff07182ce25c5154"/></dir><dir name="Transaction"><file name="States.php" hash="52a8c37ba2ab1597b928b5a4de89cdf3"/><file name="Types.php" hash="be445631c5502631115222549d995e97"/></dir><file name="i18n.php" hash="577058e53e7c935e3e883fd4792ee548"/></dir><file name="Notification.php" hash="dfa03ae89de997ef9ac98ec08b51a3b5"/><dir name="Request"><dir name="Financial"><dir name="Alternatives"><file name="ABNiDEAL.php" hash="9ad0d2f75fcdf5b2cb94c78b3b3d6ea3"/><file name="CashU.php" hash="f28471dfff04de6e8e0c7b47aa1c08da"/><file name="POLi.php" hash="31ef3c44fa6c367f207c0633950ec8f1"/><file name="PPRO.php" hash="48ba59d3f53d5b15720b0b4f4e5fbc26"/><file name="Paysafecard.php" hash="83a298fd99434d6c207f1e1f23905061"/><file name="Sofort.php" hash="6cf9bcb7a47eb0ea7c1fa1e97ca5887c"/></dir><file name="Capture.php" hash="4074b82a2cd3ace1e655316c4dcc8064"/><dir name="Cards"><file name="Authorize.php" hash="f8cd42657ba5655af03de32c829f65ea"/><file name="Authorize3D.php" hash="57a35302fa7e08d72ec577169b64fd3c"/><file name="Credit.php" hash="a24fb37241999072f55319baf5056415"/><file name="Payout.php" hash="dae3a6cb34dc29dc583a8958a82e3628"/><dir name="Recurring"><file name="InitRecurringSale.php" hash="5903a5d82a5eceee4ac266099b708894"/><file name="InitRecurringSale3D.php" hash="ec06f91acaf4ad5d79682ec61058eac2"/><file name="RecurringSale.php" hash="324d2bf186578303a0ad084a78013051"/></dir><file name="Sale.php" hash="84b08a879c9f10b2c766a34de9878207"/><file name="Sale3D.php" hash="f6517e874dc37d123808bfa0ee5a5a1d"/></dir><dir name="PayByVouchers"><file name="Sale.php" hash="ba15cac3f3df1d2a3a103565d653f240"/><file name="oBeP.php" hash="ca980d75f19dc97dc6943efc57607181"/></dir><file name="Refund.php" hash="399b75255fa787009e978053314a6925"/><file name="Void.php" hash="5d8d5744bb55bc4821a06f5b36ab29db"/><dir name="Wallets"><file name="Neteller.php" hash="404e7eb71cb655f9abbc0febb6783a1a"/><file name="WebMoney.php" hash="1a326d4502743c7c63c132e1911e9f78"/><file name="eZeeWallet.php" hash="6cb8d492a5ada59163f4cebad6b0d7dc"/></dir></dir><dir name="NonFinancial"><file name="AVS.php" hash="28c1506a04b88a6e0e3d19a27d00a335"/><file name="AccountVerification.php" hash="bc1e2775bef0a1f23345dac5b24b72f8"/><file name="Blacklist.php" hash="5da01bedc92c6979953d29901c3f113c"/><dir name="Fraud"><dir name="Chargeback"><file name="DateRange.php" hash="fb33c10f6375d145b5e159b883d37f3c"/><file name="Transaction.php" hash="eb8997ced7f9cc45b4df3056415dce3e"/></dir><dir name="Reports"><file name="DateRange.php" hash="53419659a6c5aff80edf0c7a31a31d31"/><file name="Transaction.php" hash="a8dd1ab07cca3537687c126572a39d25"/></dir><dir name="Retrieval"><file name="DateRange.php" hash="899f1bc77c47c6fde65451f2d2257a55"/><file name="Transaction.php" hash="73b7e9bfda8e385ea7dde1dab66bcb63"/></dir></dir><dir name="Reconcile"><file name="DateRange.php" hash="83d388eae9785c04ab2b961496faf490"/><file name="Transaction.php" hash="ed77990ff74e33faf4d26ba5e1cf7431"/></dir><dir name="Retrieve"><file name="AbniDealBanks.php" hash="0c0b187f29a20cf84550dc535e365a6b"/></dir></dir><dir name="WPF"><file name="Create.php" hash="0811c12f5d0c8e378adff45a47b4cacd"/><file name="Reconcile.php" hash="45aa4cd09b512b04a6b5a19c259d45ab"/></dir></dir><file name="Request.php" hash="590d63882937f1c558f1e31fe6add200"/><file name="Response.php" hash="59db1b505572d73f7ba5eb373eb18fde"/></dir><file name="Builder.php" hash="a1d259798cb8a118d59b2f3c5a313e3e"/><dir name="Builders"><file name="JSON.php" hash="387f44beabc6271d60cfdfa4de42b2b0"/><file name="XML.php" hash="c5dc6d4dcef1036c154e2833d21819c4"/></dir><dir name="Certificates"><file name="ca-bundle.pem" hash="1d4f036201f82a743da147db09a6d8ca"/></dir><file name="Config.php" hash="64dbe2e28f76856d2f60e3ba3f442d00"/><dir name="Exceptions"><file name="EnvironmentNotSet.php" hash="a6f425cd8922b3615fa79cc9885328e9"/><file name="ErrorAPI.php" hash="f437c2e2423397ceaee0491e5e43d136"/><file name="ErrorNetwork.php" hash="ef4686482899ebfa53a79dd470fb751c"/><file name="ErrorParameter.php" hash="c9518f203b97e168c7db12e091635946"/><file name="InvalidArgument.php" hash="6c0f4c620ec5fda8cb46e3ff9c61d07d"/><file name="InvalidMethod.php" hash="f90abed4eb6a22d6c77da9a2c60ad5c9"/><file name="InvalidResponse.php" hash="0bab84b8816d83418062dc960648ca30"/></dir><file name="Genesis.php" hash="c14b9c20cbc534f09e891332a2794ded"/><dir name="Interfaces"><file name="Builder.php" hash="ce3aaa42bf5be788488142c420e2160f"/><file name="Network.php" hash="97f13f574a31683fd25c69b930a4b39d"/><file name="Parser.php" hash="391f365d54bfd245e901f56071238c0f"/></dir><dir name="Network"><file name="Stream.php" hash="36b286e49b6b998a883511f9902f8a5a"/><file name="cURL.php" hash="e3534bf2e3254343b0cd344d9eca6b77"/></dir><file name="Network.php" hash="9a7152dd32fee74a103e08eef03c7bbf"/><file name="Parser.php" hash="b32834c751a57c9cc2e971792d125aa0"/><dir name="Parsers"><file name="XML.php" hash="7c8c64ea006668a25b0aa0cb882425d7"/></dir><dir name="Utils"><file name="Common.php" hash="93564ae823ffe4a1cc90c772484f567f"/><file name="Country.php" hash="53890c12438b00a5908d3a4f7f92c785"/><file name="Currency.php" hash="29fc4143a6ed046917fef3fd3286b811"/><file name="Requirements.php" hash="f2b8ab0a131e878ff35d30d7512dd133"/></dir></dir></dir><dir name="vendor"><file name="autoload.php" hash="59c384c9fd04a63a1609c0c507cdc384"/><dir name="composer"><file name="ClassLoader.php" hash="479613a7d15cfdf2bcdf0399a032ff9a"/><file name="LICENSE" hash="caa653f07bb161e830d67b0ab35dd642"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="af4fa780231e7182bbd1430a1973a21d"/><file name="autoload_psr4.php" hash="dd3a00f0d13eb29781edd8c77d4c5100"/><file name="autoload_real.php" hash="a80c290f6d5d3cc4b7d03108d55b36eb"/><file name="installed.json" hash="30a799458964967a17ca693a6b2d1c65"/></dir></dir></dir></target></contents>
|
| 22 |
<compatible/>
|
| 23 |
<dependencies><required><php><min>5.3.2</min><max>7.0.2</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max/></package><extension><name>bcmath</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>filter</name><min/><max/></extension><extension><name>hash</name><min/><max/></extension><extension><name>xmlreader</name><min/><max/></extension><extension><name>xmlwriter</name><min/><max/></extension></required></dependencies>
|
| 24 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>EMerchantPay_Genesis_Client</name>
|
| 4 |
+
<version>1.2.7</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>This is a Payment Module for Magento Community Edition, that gives you the ability to process payments through eMerchantPay's Payment Gateway - Genesis.
|
| 11 |

|
| 12 |
The Payment Gateway supports all of the major credit/debit card brands and more than 40 alternative payment methods (APMs) and e-wallets. When using the module, the merchant benefits from eMerchantPay’s vast payment industry experience and a full suite of value-added services such as sophisticated risk management and monitoring tools, with the added benefit of removing the burden of PCI DSS compliance from the merchant.</description>
|
| 13 |
+
<notes>1.) Added Support for Recurring Transactions
|
| 14 |
+
- eMerchantPay Direct Payment Method
|
| 15 |
+
--nitRecurringSale
|
| 16 |
+
--InitRecurringSale (3D-Secure)
|
| 17 |
+
--RecurringSale
|
| 18 |
+

|
| 19 |
+
- eMerchantPay Checkout Payment Method
|
| 20 |
+
--InitRecurringSale
|
| 21 |
+
--InitRecurringSale (3D-Secure)
|
| 22 |
+
--RecurringSale
|
| 23 |
+

|
| 24 |
+
2.) Additional Payment Method Settings
|
| 25 |
+
- Available Recurring Transactions
|
| 26 |
+
- Managing Initial Fee
|
| 27 |
+
- Managing Cron Jobs Settings - External Module is needed
|
| 28 |
+

|
| 29 |
+
3.) Added Support for Genesis v1.4.2
|
| 30 |
+
- Updated PBV Sale & Yeepay APIs
|
| 31 |
+

|
| 32 |
+
- Added Client Validations in Payment Method Settings
|
| 33 |
+

|
| 34 |
+
4.) A few Issues have been resolved
|
| 35 |
+
- Payment Gateway Request Currency - The Base Currency has been used instead of checkout currency
|
| 36 |
+
- An additional Web Payment Form Locale check has been implemented - there was a problem while creating a Web Payment Form if the selected locale in admin is not by our Payment Gateway
|
| 37 |
+

|
| 38 |
+

|
| 39 |
+

|
| 40 |
+

|
| 41 |
+

|
| 42 |
+
1.) Added Support for GenesisLib v1.4 - Additional Transaction Types are now available using the eMerchantPay Checkout Method
|
| 43 |

|
| 44 |
2.) A possibility has been added to use an external GenesisGateway Library (installed by composer) instead of the integrated in Module
|
| 45 |

|
| 46 |
2.) A few minor issues were resolved regarding Capture / Refund Transactions</notes>
|
| 47 |
<authors><author><name>eMerchantPay Ltd.</name><user>chrisrive</user><email>chris@emerchantpay.com</email></author></authors>
|
| 48 |
+
<date>2016-07-11</date>
|
| 49 |
+
<time>14:47:13</time>
|
| 50 |
+
<contents><target name="magecommunity"><dir name="EMerchantPay"><dir name="Genesis"><dir name="Block"><dir name="Form"><file name="Checkout.php" hash="abe450bd6746651abf03c32b8db17543"/><file name="Direct.php" hash="6b13a0b0bf2d26434c8e7207a9b1286b"/></dir><dir name="Info"><file name="Checkout.php" hash="3233f4ade14cee154c064f2deea1bd8f"/><file name="Direct.php" hash="76a10eddefc97b01fafb6fff0f36f837"/></dir><dir name="Redirect"><file name="Checkout.php" hash="1cf157bbc17a25e17dee10ec9ade0ab2"/><file name="Direct.php" hash="7c2aba2803e4c72ec91235f2d21905c9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3122afd4da476c3b945e432e0380550c"/></dir><dir name="Model"><dir name="Admin"><dir name="Checkout"><dir name="Options"><dir name="Transaction"><dir name="Recurring"><file name="Type.php" hash="41338f33c9f649701e5fd8a47363ffea"/></dir><file name="Type.php" hash="bbe07732d7febf995c470ab36eec2234"/></dir></dir></dir><dir name="Direct"><dir name="Options"><dir name="Transaction"><dir name="Recurring"><file name="Type.php" hash="c5bcbb4e6c62daac0ecdfe8ef0315023"/></dir><file name="Type.php" hash="a8ee95bff6d13736e1639fe4a52fb862"/></dir></dir></dir><file name="Environment.php" hash="168ae448e5478560e079be92b3810507"/></dir><file name="Checkout.php" hash="153da152f654dfa395d72bd624875ba7"/><file name="Direct.php" hash="c54fd27fa7e81574120238049dbe92f1"/><dir name="Task"><file name="Recurring.php" hash="18d459b1d2040c45b3c5c48744c5ca32"/></dir></dir><dir name="Observer"><file name="CheckoutSubmitAllAfter.php" hash="c90595c7a57f0cebe3f35cefa9d62907"/><file name="SalesQuoteAddressCollectTotalsBefore.php" hash="9f57bd3d0a244941f2d0eb3dce06c018"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="864566ef67b94e9b2bf482390a6f71f2"/><file name="DirectController.php" hash="de9c366cd07c01a74392e7704a716df2"/></dir><dir name="etc"><file name="config.xml" hash="82a758b17976e175f0f8848d416e3dba"/><file name="system.xml" hash="45d869df0fa68383fb87e759350ec768"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="info"><file name="checkout.phtml" hash="121f777049b801219f2792ca9aaedd3e"/><file name="direct.phtml" hash="121f777049b801219f2792ca9aaedd3e"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="form"><file name="checkout.phtml" hash="835a61d301f75e3d39a84ed412941ae0"/><file name="direct.phtml" hash="adbe6e9f00f15ea5db9de983cd6a7880"/></dir><dir name="info"><file name="checkout.phtml" hash="939277e4db9bda19b6932775a03fbaac"/><file name="direct.phtml" hash="939277e4db9bda19b6932775a03fbaac"/></dir><dir name="redirect"><file name="checkout.phtml" hash="caee38fbfc90ebc340730b83066486d3"/><file name="direct.phtml" hash="caee38fbfc90ebc340730b83066486d3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EMerchantPay_Genesis.xml" hash="83879cf40aba5587eecc86c162398e43"/></dir></target><target name="magelocale"><dir name="en_GB"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir><dir name="en_US"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir></target><target name="magelib"><dir name="Genesis"><dir name="src"><dir name="Genesis"><dir name="API"><dir name="Constants"><file name="Banks.php" hash="b7b1fc98be9aa2c0e2bd7c03086ca397"/><file name="Endpoints.php" hash="2036dc4c26f6e7418d5ce198170f96a1"/><file name="Environments.php" hash="4054e40a140cd9b4010a49e7928457f4"/><file name="Errors.php" hash="434b001eb137e74e654020d63b7c4f72"/><dir name="Payment"><file name="Methods.php" hash="de89e5298e49aea3f5eb8c9f89317576"/></dir><dir name="Transaction"><dir name="Parameters"><dir name="PayByVouchers"><file name="CardTypes.php" hash="d9e632a4b269948079af8f96bf3c56f1"/><file name="RedeemTypes.php" hash="ed1c30bc2b9cc435e7b66afad9ab3832"/></dir></dir><file name="States.php" hash="52a8c37ba2ab1597b928b5a4de89cdf3"/><file name="Types.php" hash="40db1b4803eb29d2987d1e7cef04230a"/></dir><file name="i18n.php" hash="577058e53e7c935e3e883fd4792ee548"/></dir><file name="Notification.php" hash="dfa03ae89de997ef9ac98ec08b51a3b5"/><dir name="Request"><dir name="Financial"><dir name="Alternatives"><file name="ABNiDEAL.php" hash="9ad0d2f75fcdf5b2cb94c78b3b3d6ea3"/><file name="CashU.php" hash="f28471dfff04de6e8e0c7b47aa1c08da"/><file name="POLi.php" hash="31ef3c44fa6c367f207c0633950ec8f1"/><file name="PPRO.php" hash="48ba59d3f53d5b15720b0b4f4e5fbc26"/><file name="Paysafecard.php" hash="83a298fd99434d6c207f1e1f23905061"/><file name="Sofort.php" hash="6cf9bcb7a47eb0ea7c1fa1e97ca5887c"/></dir><file name="Capture.php" hash="4074b82a2cd3ace1e655316c4dcc8064"/><dir name="Cards"><file name="Authorize.php" hash="f8cd42657ba5655af03de32c829f65ea"/><file name="Authorize3D.php" hash="57a35302fa7e08d72ec577169b64fd3c"/><file name="Credit.php" hash="a24fb37241999072f55319baf5056415"/><file name="Payout.php" hash="dae3a6cb34dc29dc583a8958a82e3628"/><dir name="Recurring"><file name="InitRecurringSale.php" hash="5903a5d82a5eceee4ac266099b708894"/><file name="InitRecurringSale3D.php" hash="ec06f91acaf4ad5d79682ec61058eac2"/><file name="RecurringSale.php" hash="324d2bf186578303a0ad084a78013051"/></dir><file name="Sale.php" hash="84b08a879c9f10b2c766a34de9878207"/><file name="Sale3D.php" hash="f6517e874dc37d123808bfa0ee5a5a1d"/></dir><dir name="PayByVouchers"><file name="Sale.php" hash="367c3036c60014aa0804ce22323001da"/><file name="oBeP.php" hash="af5b1586d15aed1b85defee8e6907d12"/></dir><file name="Refund.php" hash="399b75255fa787009e978053314a6925"/><file name="Void.php" hash="5d8d5744bb55bc4821a06f5b36ab29db"/><dir name="Wallets"><file name="Neteller.php" hash="404e7eb71cb655f9abbc0febb6783a1a"/><file name="WebMoney.php" hash="1a326d4502743c7c63c132e1911e9f78"/><file name="eZeeWallet.php" hash="6cb8d492a5ada59163f4cebad6b0d7dc"/></dir></dir><dir name="NonFinancial"><file name="AVS.php" hash="28c1506a04b88a6e0e3d19a27d00a335"/><file name="AccountVerification.php" hash="bc1e2775bef0a1f23345dac5b24b72f8"/><file name="Blacklist.php" hash="5da01bedc92c6979953d29901c3f113c"/><dir name="Fraud"><dir name="Chargeback"><file name="DateRange.php" hash="fb33c10f6375d145b5e159b883d37f3c"/><file name="Transaction.php" hash="eb8997ced7f9cc45b4df3056415dce3e"/></dir><dir name="Reports"><file name="DateRange.php" hash="53419659a6c5aff80edf0c7a31a31d31"/><file name="Transaction.php" hash="a8dd1ab07cca3537687c126572a39d25"/></dir><dir name="Retrieval"><file name="DateRange.php" hash="899f1bc77c47c6fde65451f2d2257a55"/><file name="Transaction.php" hash="73b7e9bfda8e385ea7dde1dab66bcb63"/></dir></dir><dir name="Reconcile"><file name="DateRange.php" hash="83d388eae9785c04ab2b961496faf490"/><file name="Transaction.php" hash="ed77990ff74e33faf4d26ba5e1cf7431"/></dir><dir name="Retrieve"><file name="AbniDealBanks.php" hash="0c0b187f29a20cf84550dc535e365a6b"/></dir></dir><dir name="WPF"><file name="Create.php" hash="169fdc03b480e6dd45ec54496c590b21"/><file name="Reconcile.php" hash="45aa4cd09b512b04a6b5a19c259d45ab"/><file name=".DS_Store" hash="79d680ef2d9c3e4a355285a412a2f3d0"/></dir><file name=".DS_Store" hash="61d1bfdf8f4d84420b28837ca4d5c17f"/></dir><file name="Request.php" hash="590d63882937f1c558f1e31fe6add200"/><file name="Response.php" hash="59db1b505572d73f7ba5eb373eb18fde"/><file name=".DS_Store" hash="49aac6b791d48c0903291b9d29ecf5a9"/></dir><file name="Builder.php" hash="a1d259798cb8a118d59b2f3c5a313e3e"/><dir name="Builders"><file name="JSON.php" hash="387f44beabc6271d60cfdfa4de42b2b0"/><file name="XML.php" hash="c5dc6d4dcef1036c154e2833d21819c4"/></dir><dir name="Certificates"><file name="ca-bundle.pem" hash="1d4f036201f82a743da147db09a6d8ca"/></dir><file name="Config.php" hash="47d41b358bc7acaeed7492896e057536"/><dir name="Exceptions"><file name="EnvironmentNotSet.php" hash="a6f425cd8922b3615fa79cc9885328e9"/><file name="ErrorAPI.php" hash="f437c2e2423397ceaee0491e5e43d136"/><file name="ErrorNetwork.php" hash="ef4686482899ebfa53a79dd470fb751c"/><file name="ErrorParameter.php" hash="c9518f203b97e168c7db12e091635946"/><file name="InvalidArgument.php" hash="6c0f4c620ec5fda8cb46e3ff9c61d07d"/><file name="InvalidMethod.php" hash="f90abed4eb6a22d6c77da9a2c60ad5c9"/><file name="InvalidResponse.php" hash="0bab84b8816d83418062dc960648ca30"/></dir><file name="Genesis.php" hash="c14b9c20cbc534f09e891332a2794ded"/><dir name="Interfaces"><file name="Builder.php" hash="ce3aaa42bf5be788488142c420e2160f"/><file name="Network.php" hash="97f13f574a31683fd25c69b930a4b39d"/><file name="Parser.php" hash="391f365d54bfd245e901f56071238c0f"/></dir><dir name="Network"><file name="Stream.php" hash="36b286e49b6b998a883511f9902f8a5a"/><file name="cURL.php" hash="e3534bf2e3254343b0cd344d9eca6b77"/></dir><file name="Network.php" hash="9a7152dd32fee74a103e08eef03c7bbf"/><file name="Parser.php" hash="b32834c751a57c9cc2e971792d125aa0"/><dir name="Parsers"><file name="XML.php" hash="7c8c64ea006668a25b0aa0cb882425d7"/></dir><dir name="Utils"><file name="Common.php" hash="f669b461894af8650fe9af3d4b7b2f81"/><file name="Country.php" hash="53890c12438b00a5908d3a4f7f92c785"/><file name="Currency.php" hash="29fc4143a6ed046917fef3fd3286b811"/><file name="Requirements.php" hash="f2b8ab0a131e878ff35d30d7512dd133"/><file name=".DS_Store" hash="3f4e64fc3ee983a0d4d219a9af0ac304"/></dir></dir></dir><dir name="vendor"><file name="autoload.php" hash="59c384c9fd04a63a1609c0c507cdc384"/><dir name="composer"><file name="ClassLoader.php" hash="479613a7d15cfdf2bcdf0399a032ff9a"/><file name="LICENSE" hash="caa653f07bb161e830d67b0ab35dd642"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="af4fa780231e7182bbd1430a1973a21d"/><file name="autoload_psr4.php" hash="dd3a00f0d13eb29781edd8c77d4c5100"/><file name="autoload_real.php" hash="a80c290f6d5d3cc4b7d03108d55b36eb"/><file name="installed.json" hash="30a799458964967a17ca693a6b2d1c65"/></dir></dir></dir></target></contents>
|
| 51 |
<compatible/>
|
| 52 |
<dependencies><required><php><min>5.3.2</min><max>7.0.2</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max/></package><extension><name>bcmath</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>filter</name><min/><max/></extension><extension><name>hash</name><min/><max/></extension><extension><name>xmlreader</name><min/><max/></extension><extension><name>xmlwriter</name><min/><max/></extension></required></dependencies>
|
| 53 |
</package>
|
