Version Notes
What's new?
- Re-factored code that implements Magento communication with X-Payments, namely: changed order placing procedure, fixed "The txnId field is missing or incorrect" and other errors.
- Support of X-Payments v3.0 API 1.6: new templates, improved operating of recurring charges.
- Improved look and feel of X-Payments credit card form. Credit card form displaying is now allowed before entering the address details.
- Improved errors processing (from X-Payments, from payment gateways etc).
- Integrated with One Step Checkout (http://www.onestepcheckout.com)
- Integrated with Firecheckout (http://www.firecheckout.com)
- Export to Stone Edge order manager
Download this release
Release Info
Developer | Alexander Mulin |
Extension | CDev_XPaymentsConnector |
Version | 1.7.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.14 to 1.7.0
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Cardnumber.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Cardtype.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Txnid.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Tab/Usercards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Sales/Order/View.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Sales/Order/View/Tab/Xporderstate.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/System/Config/Form/Subselect.php +56 -30
- app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Usercards/Grid.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Beforesuccess.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Cancel.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Orderdetail.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Settings.php +24 -15
- app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Success.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Control.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Customer/Account/Navigation.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Customer/Cardadd.php +3 -3
- app/code/community/Cdev/XPaymentsConnector/Block/Customer/Success.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Customer/Usercards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Failure.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Form/Cc.php +17 -35
- app/code/community/Cdev/XPaymentsConnector/Block/Form/Container.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Form/Prepaidpayments.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Form/Savedcards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Info/Cc.php +13 -5
- app/code/community/Cdev/XPaymentsConnector/Block/Info/Prepaidpayments.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Info/Savedcards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Recurring/Profile/View.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Block/Redirect.php +28 -18
- app/code/community/Cdev/XPaymentsConnector/Block/Return.php +47 -0
- app/code/community/Cdev/XPaymentsConnector/Block/Success.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Helper/Data.php +1088 -80
- app/code/community/Cdev/XPaymentsConnector/Model/Adminhtml/System/Config/Source/Placedisplay.php +1 -1
- app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Paymentconfiguration.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Paymentconfiguration/Collection.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Usercards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Usercards/Collection.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Observer.php +639 -666
- app/code/community/Cdev/XPaymentsConnector/Model/Payment/Cc.php +191 -427
- app/code/community/Cdev/XPaymentsConnector/Model/Payment/Prepaidpayments.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Payment/Recurring/Profile.php +1 -1
- app/code/community/Cdev/XPaymentsConnector/Model/Payment/Savedcards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Paymentconfiguration.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Quote.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal/Recurring/Discount.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal/Recurring/Initialfee/Tax.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Sales/Recurring/Profile.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Source/Paymentconfiguration.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/Model/Usercards.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/CustomerController.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/Sales/Order/FraudController.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/controllers/ControlController.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/controllers/CustomerController.php +46 -30
- app/code/community/Cdev/XPaymentsConnector/controllers/ProcessingController.php +626 -288
- app/code/community/Cdev/XPaymentsConnector/etc/adminhtml.xml +2 -2
- app/code/community/Cdev/XPaymentsConnector/etc/config.xml +3 -2
- app/code/community/Cdev/XPaymentsConnector/etc/system.xml +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-install-1.0.0.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.0-1.0.1.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.1-1.0.2.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.2-1.0.3.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.3-1.0.4.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.4-1.0.5.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.5-1.0.6.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.6-1.0.7.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.7-1.0.8.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.8-1.0.9.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.9-1.1.0.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.0-1.1.1.php +2 -2
- app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.1-1.1.2.php +2 -2
- app/design/adminhtml/default/default/layout/xpaymentsconnector.xml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/control.phtml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/form/prepaidpayments.phtml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/form/savedcards.phtml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/info.phtml +1 -1
- app/design/adminhtml/default/default/template/xpaymentsconnector/info/cc.phtml +22 -15
- app/design/adminhtml/default/default/template/xpaymentsconnector/info/prepaidpayments.phtml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/info/savedcards.phtml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/order/view/tab/xporderstate.phtml +6 -3
- app/design/adminhtml/default/default/template/xpaymentsconnector/pdf/info.phtml +2 -2
- app/design/adminhtml/default/default/template/xpaymentsconnector/usercards/tab/js.phtml +2 -2
- app/design/frontend/base/default/layout/xpaymentsconnector.xml +65 -22
- app/design/frontend/base/default/template/xpaymentsconnector/blank.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/cancel.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/beforesuccess.phtml +8 -6
- app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/order-detail.phtml +10 -4
- app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/review/button.phtml +8 -56
- app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/xpayment-iframe.phtml +10 -49
- app/design/frontend/base/default/template/xpaymentsconnector/checkout/success.phtml +1 -1
- app/design/frontend/base/default/template/xpaymentsconnector/customer/cardaddsuccess.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/customer/usercards/cardadd.phtml +14 -4
- app/design/frontend/base/default/template/xpaymentsconnector/customer/usercards/list.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/failure.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/form/cc.phtml +18 -91
- app/design/frontend/base/default/template/xpaymentsconnector/form/savedcards.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/info/cc.phtml +14 -18
- app/design/frontend/base/default/template/xpaymentsconnector/info/prepaidpayments.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/info/savedcards.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/redirect.phtml +2 -2
- app/design/frontend/base/default/template/xpaymentsconnector/redirectiframe.phtml +65 -0
- app/design/frontend/base/default/template/xpaymentsconnector/return.phtml +37 -0
- app/design/frontend/base/default/template/xpaymentsconnector/xpc_data.phtml +31 -0
- app/etc/modules/Cdev_XPaymentsConnector.xml +1 -1
- js/xpayment/backend-xpayment.js +2 -2
- js/xpayment/checkout-submit.js +504 -76
- js/xpayment/settings.css +13 -19
- package.xml +23 -10
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Cardnumber.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Cardtype.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Txnid.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Tab/Usercards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Sales/Order/View.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Sales/Order/View/Tab/Xporderstate.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/System/Config/Form/Subselect.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,64 +13,89 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
|
23 |
class Cdev_XPaymentsConnector_Block_Adminhtml_System_Config_Form_Subselect extends Mage_Adminhtml_Block_System_Config_Form_Field
|
24 |
{
|
25 |
-
|
26 |
/**
|
27 |
* Get the button and scripts contents
|
28 |
*
|
29 |
* @param Varien_Data_Form_Element_Abstract $element
|
|
|
30 |
* @return string
|
31 |
*/
|
32 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
33 |
{
|
|
|
|
|
|
|
|
|
34 |
$html = parent::_getElementHtml($element);
|
35 |
-
$js = $this->getElementJsEvents();
|
36 |
$html = $html.$js;
|
37 |
|
38 |
return $html;
|
39 |
}
|
40 |
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
47 |
{
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
placeDisplaySelect.hide();
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
EndHTML;
|
70 |
|
|
|
|
|
71 |
return $js;
|
72 |
}
|
73 |
-
|
74 |
-
|
75 |
-
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
23 |
|
24 |
class Cdev_XPaymentsConnector_Block_Adminhtml_System_Config_Form_Subselect extends Mage_Adminhtml_Block_System_Config_Form_Field
|
25 |
{
|
|
|
26 |
/**
|
27 |
* Get the button and scripts contents
|
28 |
*
|
29 |
* @param Varien_Data_Form_Element_Abstract $element
|
30 |
+
*
|
31 |
* @return string
|
32 |
*/
|
33 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
34 |
{
|
35 |
+
// Check if Onestep Checkout or Firecheckout module is enabed
|
36 |
+
$checkoutModuleEnabled = Mage::helper('xpaymentsconnector')->checkOscModuleEnabled()
|
37 |
+
|| Mage::helper('xpaymentsconnector')->checkFirecheckoutModuleEnabled();
|
38 |
+
|
39 |
$html = parent::_getElementHtml($element);
|
40 |
+
$js = $this->getElementJsEvents($checkoutModuleEnabled);
|
41 |
$html = $html.$js;
|
42 |
|
43 |
return $html;
|
44 |
}
|
45 |
|
46 |
|
47 |
+
/**
|
48 |
+
* Get Events for settings select boxes
|
49 |
+
*
|
50 |
+
* @param bool $hidden If the payment form place selector should always be hidden
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function getElementJsEvents($hidden = false)
|
55 |
{
|
56 |
+
if ($hidden) {
|
57 |
+
|
58 |
+
$js = <<<EndHTML
|
59 |
+
<script type="text/javascript">
|
60 |
+
document.observe("dom:loaded", function() {
|
61 |
+
|
62 |
+
$('row_payment_xpayments_placedisplay').hide();
|
63 |
+
$('payment_xpayments_placedisplay').value = "payment";
|
64 |
+
|
65 |
+
$('row_payment_xpayments_use_iframe').hide();
|
66 |
+
$('payment_xpayments_use_iframe').value = "1";
|
67 |
+
});
|
68 |
+
</script>
|
69 |
+
EndHTML;
|
70 |
+
|
71 |
+
|
72 |
+
} else {
|
73 |
+
|
74 |
+
$js = <<<EndHTML
|
75 |
+
<script type="text/javascript">
|
76 |
+
document.observe("dom:loaded", function() {
|
77 |
+
var useIframe = $('payment_xpayments_use_iframe');
|
78 |
+
var placeDisplaySelect = $('row_payment_xpayments_placedisplay');
|
79 |
+
if(useIframe.value == 0){
|
80 |
placeDisplaySelect.hide();
|
81 |
}
|
82 |
+
Event.observe(useIframe, 'change', checkPlaceDisplayAccess.bind(this));
|
83 |
+
function checkPlaceDisplayAccess(event)
|
84 |
+
{
|
85 |
+
var conditionNameElement = Event.element(event);
|
86 |
+
if(conditionNameElement.value == 1){
|
87 |
+
placeDisplaySelect.show();
|
88 |
+
}else{
|
89 |
+
placeDisplaySelect.hide();
|
90 |
+
}
|
91 |
|
92 |
+
}
|
93 |
+
});
|
94 |
+
</script>
|
95 |
EndHTML;
|
96 |
|
97 |
+
}
|
98 |
+
|
99 |
return $js;
|
100 |
}
|
101 |
+
}
|
|
|
|
app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Usercards/Grid.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Beforesuccess.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Cancel.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Orderdetail.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Settings.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,32 +13,40 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
/**
|
23 |
* Additional settings for "IFrame" variant of payment method (frontend)
|
24 |
*/
|
25 |
-
|
26 |
class Cdev_XPaymentsConnector_Block_Checkout_Onepage_Settings extends Mage_Core_Block_Template
|
27 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
$paymentCode = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getCode();
|
32 |
-
$xpaymentPaymentCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
33 |
-
|
34 |
-
if($paymentCode == $xpaymentPaymentCode){
|
35 |
-
return true;
|
36 |
-
}
|
37 |
-
else{
|
38 |
-
return false;
|
39 |
-
}
|
40 |
}
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
23 |
/**
|
24 |
* Additional settings for "IFrame" variant of payment method (frontend)
|
25 |
*/
|
|
|
26 |
class Cdev_XPaymentsConnector_Block_Checkout_Onepage_Settings extends Mage_Core_Block_Template
|
27 |
{
|
28 |
+
/**
|
29 |
+
* Check if X-Payments payment method was selected on the payment step
|
30 |
+
*
|
31 |
+
* @return bool
|
32 |
+
*/
|
33 |
+
private function isXpcMethod()
|
34 |
+
{
|
35 |
+
$code = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getCode();
|
36 |
+
$xpcCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
37 |
|
38 |
+
return $code == $xpcCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
+
/**
|
42 |
+
* Display iframe on the review step (after payment) or not
|
43 |
+
*
|
44 |
+
* @return bool
|
45 |
+
*/
|
46 |
+
protected function isVisible()
|
47 |
+
{
|
48 |
+
return $this->isXpcMethod()
|
49 |
+
&& Mage::helper('xpaymentsconnector')->isUseIframe()
|
50 |
+
&& 'review' == Mage::helper('xpaymentsconnector')->getIframePlaceDisplay();
|
51 |
+
}
|
52 |
}
|
app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Success.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Control.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Customer/Account/Navigation.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Customer/Cardadd.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -78,7 +78,7 @@ class Cdev_XPaymentsConnector_Block_Customer_Cardadd extends Mage_Core_Block_Tem
|
|
78 |
$xpaymentFormUrl = Mage::helper('payment')->getMethodInstance('xpayments')->getUrl();
|
79 |
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
80 |
|
81 |
-
$result = $api->sendIframeHandshakeRequest(
|
82 |
if($result['success']){
|
83 |
$iframeUrlDataArray = array('target' => $xpaymentFormData['target'], 'token' => $result['response']['token']);
|
84 |
$iframeUrl = $xpaymentFormUrl . '?' . http_build_query($iframeUrlDataArray);
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
78 |
$xpaymentFormUrl = Mage::helper('payment')->getMethodInstance('xpayments')->getUrl();
|
79 |
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
80 |
|
81 |
+
$result = $api->sendIframeHandshakeRequest(true);
|
82 |
if($result['success']){
|
83 |
$iframeUrlDataArray = array('target' => $xpaymentFormData['target'], 'token' => $result['response']['token']);
|
84 |
$iframeUrl = $xpaymentFormUrl . '?' . http_build_query($iframeUrlDataArray);
|
app/code/community/Cdev/XPaymentsConnector/Block/Customer/Success.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Customer/Usercards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Failure.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Form/Cc.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +14,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -25,45 +27,25 @@
|
|
25 |
|
26 |
class Cdev_XPaymentsConnector_Block_Form_Cc extends Mage_Payment_Block_Form
|
27 |
{
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
protected function _construct()
|
30 |
{
|
31 |
parent::_construct();
|
32 |
$this->setTemplate('xpaymentsconnector/form/cc.phtml');
|
33 |
}
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
36 |
{
|
37 |
-
|
38 |
-
|
39 |
-
$isPaymentPlaceDisplayFlag = Mage::helper('xpaymentsconnector')->isIframePaymentPlaceDisplay();
|
40 |
-
$methods = Mage::helper('xpaymentsconnector')->getAllowedPaymentsMethods();
|
41 |
-
if ($quotePayment->getMethod()) {
|
42 |
-
$currentPaymentMethodCode = $quotePayment->getMethodInstance()->getCode();
|
43 |
-
$xpaymentPaymentCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
44 |
-
if ($isPaymentPlaceDisplayFlag) {
|
45 |
-
if ($currentPaymentMethodCode == $xpaymentPaymentCode) {
|
46 |
-
$unsetParams = array('token');
|
47 |
-
Mage::helper('xpaymentsconnector')->unsetXpaymentPrepareOrder($unsetParams);
|
48 |
-
return Mage::helper('xpaymentsconnector')->getIframeUrl();
|
49 |
-
}
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
if($methods && $isPaymentPlaceDisplayFlag){
|
54 |
-
if(count($methods) == 1){
|
55 |
-
$currentMethod = current($methods);
|
56 |
-
$xpaymentPaymentCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
57 |
-
if($currentMethod['method_code'] == $xpaymentPaymentCode){
|
58 |
-
$unsetParams = array('token');
|
59 |
-
Mage::helper('xpaymentsconnector')->unsetXpaymentPrepareOrder($unsetParams);
|
60 |
-
return Mage::helper('xpaymentsconnector')->getIframeUrl();
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
return '#';
|
67 |
}
|
68 |
-
|
69 |
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
|
27 |
|
28 |
class Cdev_XPaymentsConnector_Block_Form_Cc extends Mage_Payment_Block_Form
|
29 |
{
|
30 |
+
/**
|
31 |
+
* Constructor
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
protected function _construct()
|
36 |
{
|
37 |
parent::_construct();
|
38 |
$this->setTemplate('xpaymentsconnector/form/cc.phtml');
|
39 |
}
|
40 |
|
41 |
+
/**
|
42 |
+
* Display iframe on the paymment step (before review) or not
|
43 |
+
*
|
44 |
+
* @return bool
|
45 |
+
*/
|
46 |
+
protected function isVisible()
|
47 |
{
|
48 |
+
return Mage::helper('xpaymentsconnector')->isUseIframe()
|
49 |
+
&& 'payment' == Mage::helper('xpaymentsconnector')->getIframePlaceDisplay();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
|
|
51 |
}
|
app/code/community/Cdev/XPaymentsConnector/Block/Form/Container.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Form/Prepaidpayments.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Form/Savedcards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Info/Cc.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -84,13 +85,20 @@ class Cdev_XPaymentsConnector_Block_Info_Cc extends Mage_Payment_Block_Info
|
|
84 |
. '/admin.php?target=payment&txnid=' . $this->getInfo()->getLastTransId();
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
87 |
public function getCardData()
|
88 |
{
|
89 |
$order = $this->getInfo()->getMethodInstance()->getOrder();
|
90 |
-
$xpCardData = unserialize($order->getXpCardData());
|
91 |
-
$xpCardDataStr = Mage::helper('xpaymentsconnector')->prepareCardDataString($xpCardData);
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
85 |
. '/admin.php?target=payment&txnid=' . $this->getInfo()->getLastTransId();
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* Get masked card data as a string
|
90 |
+
*
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
public function getCardData()
|
94 |
{
|
95 |
$order = $this->getInfo()->getMethodInstance()->getOrder();
|
|
|
|
|
96 |
|
97 |
+
$data = unserialize($order->getXpCardData());
|
98 |
+
|
99 |
+
$result = Mage::helper('xpaymentsconnector')->prepareCardDataString($data, true);
|
100 |
+
|
101 |
+
return $result;
|
102 |
}
|
103 |
|
104 |
}
|
app/code/community/Cdev/XPaymentsConnector/Block/Info/Prepaidpayments.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Info/Savedcards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Recurring/Profile/View.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Block/Redirect.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -68,38 +69,47 @@ class Cdev_XPaymentsConnector_Block_Redirect extends Mage_Core_Block_Template
|
|
68 |
return $order;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* Get form action (URL)
|
73 |
*
|
74 |
* @return string
|
75 |
-
* @access public
|
76 |
-
* @see ____func_see____
|
77 |
-
* @since 1.0.0
|
78 |
*/
|
79 |
public function getFormAction()
|
80 |
{
|
81 |
-
|
82 |
-
$this->paymentMethod = Mage::getModel('xpaymentsconnector/payment_cc');
|
83 |
-
}
|
84 |
-
|
85 |
-
return $this->paymentMethod->getUrl();
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* Get form data
|
90 |
*
|
91 |
* @return array
|
92 |
-
* @access public
|
93 |
-
* @see ____func_see____
|
94 |
-
* @since 1.0.0
|
95 |
*/
|
96 |
public function getFormData()
|
97 |
{
|
98 |
-
|
99 |
-
$this->paymentMethod = Mage::getModel('xpaymentsconnector/payment_cc');
|
100 |
-
}
|
101 |
-
return $this->paymentMethod->getFormFields();
|
102 |
}
|
103 |
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
69 |
return $order;
|
70 |
}
|
71 |
|
72 |
+
/**
|
73 |
+
* Get payment method model
|
74 |
+
*
|
75 |
+
* @return
|
76 |
+
*/
|
77 |
+
protected function getPaymentMethod()
|
78 |
+
{
|
79 |
+
if (is_null($this->paymentMethod)) {
|
80 |
+
$this->paymentMethod = Mage::getModel('xpaymentsconnector/payment_cc');
|
81 |
+
}
|
82 |
+
|
83 |
+
return $this->paymentMethod;
|
84 |
+
}
|
85 |
+
|
86 |
/**
|
87 |
* Get form action (URL)
|
88 |
*
|
89 |
* @return string
|
|
|
|
|
|
|
90 |
*/
|
91 |
public function getFormAction()
|
92 |
{
|
93 |
+
return $this->getPaymentMethod()->getUrl();
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
* Get form data
|
98 |
*
|
99 |
* @return array
|
|
|
|
|
|
|
100 |
*/
|
101 |
public function getFormData()
|
102 |
{
|
103 |
+
return $this->getPaymentMethod()->getFormFields();
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
+
/**
|
107 |
+
* Check if payment token is valid
|
108 |
+
*
|
109 |
+
* @return bool
|
110 |
+
*/
|
111 |
+
public function checkToken()
|
112 |
+
{
|
113 |
+
return $this->getPaymentMethod()->checkToken();
|
114 |
+
}
|
115 |
}
|
app/code/community/Cdev/XPaymentsConnector/Block/Return.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
+
* @category Cdev
|
18 |
+
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Return from X-Payments block
|
25 |
+
*
|
26 |
+
* @package Cdev_XPaymentsConnector
|
27 |
+
* @see ____class_see____
|
28 |
+
* @since 1.0.0
|
29 |
+
*/
|
30 |
+
class Cdev_XPaymentsConnector_Block_Return extends Mage_Core_Block_Template
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Get succcess URL
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function getRedirectUrl()
|
38 |
+
{
|
39 |
+
$url = Mage::getSingleton('checkout/type_onepage')->getCheckout()->getXpcRedirectUrl();
|
40 |
+
|
41 |
+
if (!$url) {
|
42 |
+
$url = Mage::getUrl('checkout/cart');
|
43 |
+
}
|
44 |
+
|
45 |
+
return $url;
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Cdev/XPaymentsConnector/Block/Success.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Helper/Data.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -33,12 +34,40 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
33 |
const WEEK_TIME_STAMP = 604800;
|
34 |
const SEMI_MONTH_TIME_STAMP = 1209600;
|
35 |
|
36 |
-
const
|
37 |
|
38 |
const XPAYMENTS_LOG_FILE = 'xpayments.log';
|
39 |
const RECURRING_ORDER_TYPE = 'recurring';
|
40 |
const SIMPLE_ORDER_TYPE = 'simple';
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* save/update qty for createOrder function.
|
44 |
* @var int
|
@@ -122,6 +151,100 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
122 |
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
/**
|
127 |
* This function set 'place_display' flag for feature x-payment form.
|
@@ -135,10 +258,9 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
135 |
*/
|
136 |
public function setIframePlaceDisplaySettings()
|
137 |
{
|
138 |
-
|
139 |
-
if ($useIframe) {
|
140 |
$xpaymentPrepareOrder = Mage::getSingleton('checkout/session')->getData('xpayment_prepare_order');
|
141 |
-
$xpaymentPrepareOrder['place_display'] =
|
142 |
Mage::getSingleton('checkout/session')->setData('xpayment_prepare_order', $xpaymentPrepareOrder);
|
143 |
}
|
144 |
}
|
@@ -176,47 +298,19 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
-
*
|
180 |
-
*
|
181 |
-
* @param
|
182 |
-
*
|
183 |
-
|
184 |
-
|
185 |
-
public function saveXpCardData($quoteId = null,$cardData = array())
|
186 |
-
{
|
187 |
-
if (is_null($quoteId)) {
|
188 |
-
$currentCart = Mage::getModel('checkout/cart')->getQuote();
|
189 |
-
$quoteId = $currentCart->getEntityId();
|
190 |
-
}
|
191 |
-
$cartModel = Mage::getModel('sales/quote')->load($quoteId);
|
192 |
-
$cardData = serialize($cardData);
|
193 |
-
$cartModel->setXpCardData($cardData);
|
194 |
-
|
195 |
-
$cartModel->save();
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* This function return 'token' for X-Payments i-frame Url.
|
200 |
-
* Xpayment Prepare Order Mas(xpayment_prepare_order):
|
201 |
-
* - prepare_order_id (int)
|
202 |
-
* - xpayment_response
|
203 |
-
* - token
|
204 |
-
* return
|
205 |
-
* @return bool or int
|
206 |
*/
|
207 |
-
public function
|
208 |
{
|
209 |
-
$
|
210 |
-
if ($xpaymentPrepareOrder && isset($xpaymentPrepareOrder['token']) && !empty($xpaymentPrepareOrder['token'])) {
|
211 |
-
return $xpaymentPrepareOrder['token'];
|
212 |
-
} else {
|
213 |
-
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
214 |
-
$result = $api->sendIframeHandshakeRequest();
|
215 |
-
$xpaymentPrepareOrder['token'] = $result['response']['token'];
|
216 |
-
Mage::getSingleton('checkout/session')->setData('xpayment_prepare_order', $xpaymentPrepareOrder);
|
217 |
-
return $xpaymentPrepareOrder['token'];
|
218 |
-
}
|
219 |
|
|
|
|
|
|
|
220 |
}
|
221 |
|
222 |
/**
|
@@ -330,7 +424,7 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
330 |
public function getReviewButtonTemplate($name, $block)
|
331 |
{
|
332 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
333 |
-
$useIframe =
|
334 |
$xpCcMethodCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
335 |
if ($quote) {
|
336 |
$payment = $quote->getPayment();
|
@@ -360,18 +454,25 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
360 |
}
|
361 |
|
362 |
/**
|
|
|
|
|
363 |
* @return bool
|
364 |
*/
|
365 |
public function isRegisteredUser()
|
366 |
{
|
367 |
-
$
|
368 |
-
|
369 |
-
$
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
374 |
}
|
|
|
|
|
375 |
}
|
376 |
|
377 |
/**
|
@@ -876,22 +977,6 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
876 |
}
|
877 |
}
|
878 |
|
879 |
-
/**
|
880 |
-
* @return string
|
881 |
-
*/
|
882 |
-
public function getIframeUrl()
|
883 |
-
{
|
884 |
-
|
885 |
-
$xpaymentFormData = Mage::helper('payment')->getMethodInstance('xpayments')->getFormFields();
|
886 |
-
$xpaymentFormUrl = Mage::helper('payment')->getMethodInstance('xpayments')->getUrl();
|
887 |
-
|
888 |
-
$this->prepareOrderKey();
|
889 |
-
$token = $this->getIframeToken();
|
890 |
-
$iframeUrlDataArray = array('target' => $xpaymentFormData['target'], 'token' => $token);
|
891 |
-
$iframeUrl = $xpaymentFormUrl . "?" . http_build_query($iframeUrlDataArray);
|
892 |
-
return $iframeUrl;
|
893 |
-
}
|
894 |
-
|
895 |
/**
|
896 |
* This function fixed magento bug. Magento can't create user
|
897 |
* during checkout with recurring products.
|
@@ -1066,25 +1151,51 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
1066 |
}
|
1067 |
|
1068 |
/**
|
1069 |
-
*
|
|
|
|
|
|
|
|
|
1070 |
* @return string
|
1071 |
*/
|
1072 |
-
public function prepareCardDataString($
|
1073 |
{
|
1074 |
-
$
|
1075 |
-
if (!empty($xpCardData)) {
|
1076 |
-
$last4 = (isset($xpCardData['last4'])) ? $xpCardData['last4'] : $xpCardData['last_4_cc_num'];
|
1077 |
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1084 |
}
|
1085 |
}
|
1086 |
|
1087 |
-
return $
|
1088 |
}
|
1089 |
|
1090 |
/**
|
@@ -1103,4 +1214,901 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
|
|
1103 |
}
|
1104 |
}
|
1105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1106 |
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
34 |
const WEEK_TIME_STAMP = 604800;
|
35 |
const SEMI_MONTH_TIME_STAMP = 1209600;
|
36 |
|
37 |
+
const STATE_XPAYMENTS_PENDING_PAYMENT = 'xp_pending_payment';
|
38 |
|
39 |
const XPAYMENTS_LOG_FILE = 'xpayments.log';
|
40 |
const RECURRING_ORDER_TYPE = 'recurring';
|
41 |
const SIMPLE_ORDER_TYPE = 'simple';
|
42 |
|
43 |
+
// TODO: change both names in the database!!!!!!!!
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Attribute name to store temporary X-Payments data in Quote model
|
47 |
+
*/
|
48 |
+
const XPC_DATA = 'xp_card_data';
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Attribute name to store checkout data in Quote model
|
52 |
+
*/
|
53 |
+
const CHECKOUT_DATA = 'xp_callback_approve';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Placeholder for empty email (something which will pass X-Payments validation)
|
57 |
+
*/
|
58 |
+
const EMPTY_USER_EMAIL = 'user@example.com';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Placeholder for not available cart data
|
62 |
+
*/
|
63 |
+
const NOT_AVAILABLE = 'N/A';
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Checkout methods
|
67 |
+
*/
|
68 |
+
const METHOD_LOGIN_IN = 'login_in';
|
69 |
+
const METHOD_REGISTER = 'register';
|
70 |
+
|
71 |
/**
|
72 |
* save/update qty for createOrder function.
|
73 |
* @var int
|
151 |
|
152 |
}
|
153 |
|
154 |
+
/**
|
155 |
+
* Check if Idev OneStepCheckout module is enablled and activated
|
156 |
+
*
|
157 |
+
* @return bool
|
158 |
+
*/
|
159 |
+
public function checkOscModuleEnabled()
|
160 |
+
{
|
161 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
162 |
+
$modules = (array)$modules;
|
163 |
+
|
164 |
+
$result = false;
|
165 |
+
|
166 |
+
if (isset($modules['Idev_OneStepCheckout'])) {
|
167 |
+
|
168 |
+
$module = $modules['Idev_OneStepCheckout'];
|
169 |
+
|
170 |
+
if ($module->active) {
|
171 |
+
|
172 |
+
$result = (bool)Mage::getStoreConfig(
|
173 |
+
'onestepcheckout/general/rewrite_checkout_links',
|
174 |
+
Mage::app()->getStore()
|
175 |
+
);
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
return $result;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Check if Firecheckout module is enablled and activated
|
185 |
+
*
|
186 |
+
* @return bool
|
187 |
+
*/
|
188 |
+
public function checkFirecheckoutModuleEnabled()
|
189 |
+
{
|
190 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
191 |
+
$modules = (array)$modules;
|
192 |
+
|
193 |
+
$result = false;
|
194 |
+
|
195 |
+
if (isset($modules['TM_FireCheckout'])) {
|
196 |
+
|
197 |
+
$module = $modules['TM_FireCheckout'];
|
198 |
+
|
199 |
+
if ($module->active) {
|
200 |
+
|
201 |
+
$result = (bool)Mage::getStoreConfig(
|
202 |
+
'firecheckout/general/enabled',
|
203 |
+
Mage::app()->getStore()
|
204 |
+
);
|
205 |
+
}
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
return $result;
|
210 |
+
}
|
211 |
+
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Get place to display iframe. Review or payment step of checkout
|
215 |
+
*
|
216 |
+
* @return string "payment" or "review"
|
217 |
+
*/
|
218 |
+
public function getIframePlaceDisplay()
|
219 |
+
{
|
220 |
+
$place = Mage::getStoreConfig('payment/xpayments/placedisplay');
|
221 |
+
|
222 |
+
if (
|
223 |
+
$this->checkOscModuleEnabled()
|
224 |
+
|| $this->checkFirecheckoutModuleEnabled()
|
225 |
+
) {
|
226 |
+
$place = 'payment';
|
227 |
+
} elseif (
|
228 |
+
$place != 'payment'
|
229 |
+
&& $place != 'review'
|
230 |
+
) {
|
231 |
+
$place = 'payment';
|
232 |
+
}
|
233 |
+
|
234 |
+
return $place;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Check if iframe should be used or not
|
239 |
+
*
|
240 |
+
* @return bool
|
241 |
+
*/
|
242 |
+
public function isUseIframe()
|
243 |
+
{
|
244 |
+
return $this->checkOscModuleEnabled()
|
245 |
+
|| $this->checkFirecheckoutModuleEnabled()
|
246 |
+
|| Mage::getStoreConfig('payment/xpayments/use_iframe');
|
247 |
+
}
|
248 |
|
249 |
/**
|
250 |
* This function set 'place_display' flag for feature x-payment form.
|
258 |
*/
|
259 |
public function setIframePlaceDisplaySettings()
|
260 |
{
|
261 |
+
if ($this->isUseIframe()) {
|
|
|
262 |
$xpaymentPrepareOrder = Mage::getSingleton('checkout/session')->getData('xpayment_prepare_order');
|
263 |
+
$xpaymentPrepareOrder['place_display'] = $this->getIframePlaceDisplay();
|
264 |
Mage::getSingleton('checkout/session')->setData('xpayment_prepare_order', $xpaymentPrepareOrder);
|
265 |
}
|
266 |
}
|
298 |
}
|
299 |
|
300 |
/**
|
301 |
+
* Save masked CC details to the order model
|
302 |
+
*
|
303 |
+
* @param Mage_Sales_Model_Order $order
|
304 |
+
*
|
305 |
+
* @return void
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
*/
|
307 |
+
public function saveMaskedCardToOrder(Mage_Sales_Model_Order $order, $data)
|
308 |
{
|
309 |
+
$data = serialize($data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
+
$order->setData(self::XPC_DATA, $data);
|
312 |
+
|
313 |
+
$order->save();
|
314 |
}
|
315 |
|
316 |
/**
|
424 |
public function getReviewButtonTemplate($name, $block)
|
425 |
{
|
426 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
427 |
+
$useIframe = $this->isUseIframe();
|
428 |
$xpCcMethodCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
429 |
if ($quote) {
|
430 |
$payment = $quote->getPayment();
|
454 |
}
|
455 |
|
456 |
/**
|
457 |
+
* Check if user is registered, or registers at checkout
|
458 |
+
*
|
459 |
* @return bool
|
460 |
*/
|
461 |
public function isRegisteredUser()
|
462 |
{
|
463 |
+
$result = false;
|
464 |
+
|
465 |
+
$checkoutMethod = Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod();
|
466 |
+
|
467 |
+
if (
|
468 |
+
Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER == $checkoutMethod
|
469 |
+
|| Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER == $checkoutMethod
|
470 |
+
|| 'register' == Mage::getSingleton('checkout/session')->getData('xpc_checkout_method')
|
471 |
+
) {
|
472 |
+
$result = true;
|
473 |
}
|
474 |
+
|
475 |
+
return $result;
|
476 |
}
|
477 |
|
478 |
/**
|
977 |
}
|
978 |
}
|
979 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
980 |
/**
|
981 |
* This function fixed magento bug. Magento can't create user
|
982 |
* during checkout with recurring products.
|
1151 |
}
|
1152 |
|
1153 |
/**
|
1154 |
+
* Prepare masked card data as a string
|
1155 |
+
*
|
1156 |
+
* @param array $data Masked card data
|
1157 |
+
* @param bool $withType Include card type or not
|
1158 |
+
*
|
1159 |
* @return string
|
1160 |
*/
|
1161 |
+
public function prepareCardDataString($data, $withType = false)
|
1162 |
{
|
1163 |
+
$result = '';
|
|
|
|
|
1164 |
|
1165 |
+
if (!empty($data)) {
|
1166 |
+
|
1167 |
+
if (isset($data['last4'])) {
|
1168 |
+
$last4 = $data['last4'];
|
1169 |
+
} elseif (isset($data['last_4_cc_num'])) {
|
1170 |
+
$last4 = $data['last_4_cc_num'];
|
1171 |
+
} else {
|
1172 |
+
$last4 = '****';
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
if (isset($data['first6'])) {
|
1176 |
+
$first6 = $data['first6'];
|
1177 |
+
} else {
|
1178 |
+
$first6 = '******';
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
$result = $first6 . '******' . $last4;
|
1182 |
+
|
1183 |
+
if (
|
1184 |
+
!empty($data['expire_month'])
|
1185 |
+
&& !empty($data['expire_year'])
|
1186 |
+
) {
|
1187 |
+
$result .= ' (' . $data['expire_month'] . '/' . $data['expire_year'] . ')';
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
if (
|
1191 |
+
$withType
|
1192 |
+
&& !empty($data['type'])
|
1193 |
+
) {
|
1194 |
+
$result = strtoupper($data['type']) . ' ' . $result;
|
1195 |
}
|
1196 |
}
|
1197 |
|
1198 |
+
return $result;
|
1199 |
}
|
1200 |
|
1201 |
/**
|
1214 |
}
|
1215 |
}
|
1216 |
|
1217 |
+
/**
|
1218 |
+
* Prepare state
|
1219 |
+
*
|
1220 |
+
* @param array $data Address data
|
1221 |
+
*
|
1222 |
+
* @return string
|
1223 |
+
*/
|
1224 |
+
protected function prepareState($data)
|
1225 |
+
{
|
1226 |
+
$state = self::NOT_AVAILABLE;
|
1227 |
+
|
1228 |
+
if (!empty($data['region_id'])) {
|
1229 |
+
|
1230 |
+
$region = Mage::getModel('directory/region')->load($data['region_id']);
|
1231 |
+
|
1232 |
+
if (
|
1233 |
+
$region
|
1234 |
+
&& $region->getCode()
|
1235 |
+
) {
|
1236 |
+
$state = $region->getCode();
|
1237 |
+
}
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
return $state;
|
1241 |
+
}
|
1242 |
+
|
1243 |
+
/**
|
1244 |
+
* Prepare street (Address lines 1 and 2)
|
1245 |
+
*
|
1246 |
+
* @param array $data Address data
|
1247 |
+
*
|
1248 |
+
* @return string
|
1249 |
+
*/
|
1250 |
+
protected function prepareStreet($data)
|
1251 |
+
{
|
1252 |
+
$street = self::NOT_AVAILABLE;
|
1253 |
+
|
1254 |
+
if (!empty($data['street'])) {
|
1255 |
+
|
1256 |
+
$street = $data['street'];
|
1257 |
+
|
1258 |
+
if (is_array($street)) {
|
1259 |
+
$street = array_filter($street);
|
1260 |
+
$street = implode("\n", $street);
|
1261 |
+
}
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
return $street;
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
/**
|
1268 |
+
* Prepare address for initial payment request
|
1269 |
+
*
|
1270 |
+
* @param Mage_Sales_Model_Quote $quote Quote
|
1271 |
+
* @param Mage_Customer_Model_Customer $customer Customer
|
1272 |
+
* @param $type Address type, Billing or Shipping
|
1273 |
+
*
|
1274 |
+
* @return array
|
1275 |
+
*/
|
1276 |
+
protected function prepareAddress(Mage_Sales_Model_Quote $quote = null, Mage_Customer_Model_Customer $customer = null, $type = 'Billing')
|
1277 |
+
{
|
1278 |
+
$getAddress = 'get' . $type . 'Address';
|
1279 |
+
$getDefaultAddress = 'getDefault' . $type . 'Address';
|
1280 |
+
|
1281 |
+
$customerAddress = $customerDefaultAddress = $quoteAddress = array();
|
1282 |
+
|
1283 |
+
if ($quote) {
|
1284 |
+
|
1285 |
+
$customer = $quote->getCustomer();
|
1286 |
+
|
1287 |
+
if ($quote->$getAddress()) {
|
1288 |
+
$quoteAddress = $quote->$getAddress()->getData();
|
1289 |
+
}
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
if ($customer) {
|
1293 |
+
|
1294 |
+
$customerAddress = $customer->getData();
|
1295 |
+
|
1296 |
+
if ($customer->$getDefaultAddress()) {
|
1297 |
+
$customerDefaultAddress = $customer->$getDefaultAddress()->getData();
|
1298 |
+
}
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
$data = array_merge(
|
1302 |
+
array_filter($customerAddress),
|
1303 |
+
array_filter($customerDefaultAddress),
|
1304 |
+
array_filter($quoteAddress)
|
1305 |
+
);
|
1306 |
+
|
1307 |
+
$result = array(
|
1308 |
+
'firstname' => !empty($data['firstname']) ? $data['firstname'] : self::NOT_AVAILABLE,
|
1309 |
+
'lastname' => !empty($data['lastname']) ? $data['lastname'] : self::NOT_AVAILABLE,
|
1310 |
+
'address' => $this->prepareStreet($data),
|
1311 |
+
'city' => !empty($data['city']) ? $data['city'] : self::NOT_AVAILABLE,
|
1312 |
+
'state' => $this->prepareState($data),
|
1313 |
+
'country' => !empty($data['country_id']) ? $data['country_id'] : 'XX', // WA fix for MySQL 5.7 with strict mode
|
1314 |
+
'zipcode' => !empty($data['postcode']) ? $data['postcode'] : self::NOT_AVAILABLE,
|
1315 |
+
'phone' => !empty($data['telephone']) ? $data['telephone'] : '',
|
1316 |
+
'fax' => '',
|
1317 |
+
'company' => '',
|
1318 |
+
'email' => !empty($data['email']) ? $data['email'] : self::EMPTY_USER_EMAIL,
|
1319 |
+
);
|
1320 |
+
|
1321 |
+
return $result;
|
1322 |
+
}
|
1323 |
+
|
1324 |
+
/**
|
1325 |
+
* Format price in 1234.56 format
|
1326 |
+
*
|
1327 |
+
* @param mixed $price
|
1328 |
+
*
|
1329 |
+
* @return string
|
1330 |
+
*/
|
1331 |
+
protected function preparePrice($price)
|
1332 |
+
{
|
1333 |
+
return number_format($price, 2, '.', '');
|
1334 |
+
}
|
1335 |
+
|
1336 |
+
/**
|
1337 |
+
* Prepare totals item: shipping, tax, discount
|
1338 |
+
*
|
1339 |
+
* @param array $totals Cart totals
|
1340 |
+
* @param string $key Totals item key
|
1341 |
+
*
|
1342 |
+
* @return string
|
1343 |
+
*/
|
1344 |
+
protected function prepareTotalsItem($totals, $key)
|
1345 |
+
{
|
1346 |
+
$value = 0;
|
1347 |
+
|
1348 |
+
if (
|
1349 |
+
isset($totals[$key])
|
1350 |
+
&& is_object($totals[$key])
|
1351 |
+
&& method_exists($totals[$key], 'getValue')
|
1352 |
+
) {
|
1353 |
+
$value = abs($totals[$key]->getValue());
|
1354 |
+
}
|
1355 |
+
|
1356 |
+
return $this->preparePrice($value);
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
|
1360 |
+
/**
|
1361 |
+
* Prepare simple items for initial payment request
|
1362 |
+
*
|
1363 |
+
* @param Mage_Sales_Model_Quote $quote
|
1364 |
+
* @param array &$result
|
1365 |
+
*
|
1366 |
+
* @return void
|
1367 |
+
*/
|
1368 |
+
protected function prepareSimpleItems(Mage_Sales_Model_Quote $quote, &$result)
|
1369 |
+
{
|
1370 |
+
$quote->collectTotals();
|
1371 |
+
$totals = $quote->getTotals();
|
1372 |
+
|
1373 |
+
$result['totalCost'] = $this->preparePrice($quote->getGrandTotal());
|
1374 |
+
$result['shippingCost'] = $this->prepareTotalsItem($totals, 'shipping');
|
1375 |
+
$result['taxCost'] = $this->prepareTotalsItem($totals, 'tax');
|
1376 |
+
$result['discount'] = $this->prepareTotalsItem($totals, 'discount');
|
1377 |
+
|
1378 |
+
$cartItems = $quote->getAllVisibleItems();
|
1379 |
+
|
1380 |
+
foreach ($cartItems as $item) {
|
1381 |
+
|
1382 |
+
if ($item->getIsNominal()) {
|
1383 |
+
continue;
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
$productId = $item->getProductId();
|
1387 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
1388 |
+
|
1389 |
+
$result['items'][] = array(
|
1390 |
+
'sku' => $product->getData('sku'),
|
1391 |
+
'name' => $product->getData('name'),
|
1392 |
+
'price' => $this->preparePrice($product->getPrice()),
|
1393 |
+
'quantity' => intval($item->getQty()),
|
1394 |
+
);
|
1395 |
+
}
|
1396 |
+
}
|
1397 |
+
|
1398 |
+
/**
|
1399 |
+
* Prepare recurring items for initial payment request
|
1400 |
+
*
|
1401 |
+
* @param Mage_Sales_Model_Quote $quote
|
1402 |
+
* @param array &$result
|
1403 |
+
*
|
1404 |
+
* @return void
|
1405 |
+
*/
|
1406 |
+
protected function prepareRequringItems(Mage_Sales_Model_Quote $quote, &$result)
|
1407 |
+
{
|
1408 |
+
$issetRecurringProduct = $this->checkIssetRecurringOrder();
|
1409 |
+
|
1410 |
+
$quoteItem = $issetRecurringProduct['quote_item'];
|
1411 |
+
$product = $quoteItem->getProduct();
|
1412 |
+
|
1413 |
+
$item = $quote->getItemByProduct($product);
|
1414 |
+
|
1415 |
+
$recurringProfile = $product->getRecurringProfile();
|
1416 |
+
|
1417 |
+
$startDateParams = $this->checkStartDateDataByProduct($product, $item);
|
1418 |
+
$startDateParams = $startDateParams[$product->getId()];
|
1419 |
+
|
1420 |
+
$shipping = $issetRecurringProduct['quote_item']->getData('shipping_amount');
|
1421 |
+
$discount = abs($issetRecurringProduct['quote_item']->getData('discount_amount'));
|
1422 |
+
|
1423 |
+
$quantity = $quoteItem->getQty();
|
1424 |
+
|
1425 |
+
if ($startDateParams['success']) {
|
1426 |
+
|
1427 |
+
$minimalPayment = $startDateParams['minimal_payment_amount'];
|
1428 |
+
|
1429 |
+
$tax = !empty($recurringProfile['init_amount'])
|
1430 |
+
? $quoteItem->getData('initialfee_tax_amount')
|
1431 |
+
: 0;
|
1432 |
+
|
1433 |
+
$totalCost = $minimalPayment + $tax + $shipping - $discount;
|
1434 |
+
|
1435 |
+
} else {
|
1436 |
+
|
1437 |
+
$minimalPayment = 0;
|
1438 |
+
|
1439 |
+
$tax = $quoteItem->getData('initialfee_tax_amount') + $quoteItem->getData('tax_amount');
|
1440 |
+
|
1441 |
+
$totalCost = $quoteItem->getData('nominal_row_total');
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
$recurringPrice = $product->getPrice();
|
1445 |
+
|
1446 |
+
if (!empty($recurringProfile['init_amount'])) {
|
1447 |
+
$recurringPrice += $quoteItem->getXpRecurringInitialFee() / $quantity;
|
1448 |
+
}
|
1449 |
+
|
1450 |
+
$price = $minimalPayment
|
1451 |
+
? $minimalPayment / $quantity
|
1452 |
+
: $recurringPrice;
|
1453 |
+
|
1454 |
+
$result['items'][] = array(
|
1455 |
+
'sku' => $product->getData('sku'),
|
1456 |
+
'name' => $product->getData('name'),
|
1457 |
+
'price' => $this->preparePrice($price),
|
1458 |
+
'quantity' => intval($quantity),
|
1459 |
+
);
|
1460 |
+
|
1461 |
+
$result['totalCost'] = $this->preparePrice($totalCost);
|
1462 |
+
$result['shippingCost'] = $this->preparePrice($shipping);
|
1463 |
+
$result['taxCost'] = $this->preparePrice($tax);
|
1464 |
+
$result['discount'] = $this->preparePrice($discount);
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
/**
|
1468 |
+
* Prepare items for initial payment request
|
1469 |
+
*
|
1470 |
+
* @param Mage_Sales_Model_Quote $quote
|
1471 |
+
* @param array &$result
|
1472 |
+
*
|
1473 |
+
* @return void
|
1474 |
+
*/
|
1475 |
+
protected function prepareItems(Mage_Sales_Model_Quote $quote, &$result)
|
1476 |
+
{
|
1477 |
+
$issetSimpleProducts = $this->checkIssetSimpleOrder();
|
1478 |
+
$issetRecurringProduct = $this->checkIssetRecurringOrder();
|
1479 |
+
|
1480 |
+
if ($issetRecurringProduct['isset'] && !$issetSimpleProducts) {
|
1481 |
+
$this->prepareRequringItems($quote, $result);
|
1482 |
+
} else {
|
1483 |
+
$this->prepareSimpleItems($quote, $result);
|
1484 |
+
}
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
/**
|
1488 |
+
* Prepare cart for initial payment request
|
1489 |
+
*
|
1490 |
+
* @param Mage_Sales_Model_Quote $quote
|
1491 |
+
* @param string $refId Reference to the order
|
1492 |
+
*
|
1493 |
+
* @return array
|
1494 |
+
*/
|
1495 |
+
public function prepareCart(Mage_Sales_Model_Quote $quote, $refId = false)
|
1496 |
+
{
|
1497 |
+
$customer = $quote->getCustomer();
|
1498 |
+
|
1499 |
+
if (
|
1500 |
+
!$customer->getData('email')
|
1501 |
+
|| !$customer->getData('entity_id')
|
1502 |
+
) {
|
1503 |
+
$login = 'Anonymous customer (Quote ID #' . $quote->getId() . ')';
|
1504 |
+
} else {
|
1505 |
+
$login = $customer->getData('email') . ' (User ID #' . $customer->getData('entity_id') . ')';
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
if ($refId) {
|
1509 |
+
$description = 'Order #' . $refId;
|
1510 |
+
} else {
|
1511 |
+
$description = 'Quote #' . $quote->getId();
|
1512 |
+
}
|
1513 |
+
|
1514 |
+
$result = array(
|
1515 |
+
'login' => $login,
|
1516 |
+
'billingAddress' => $this->prepareAddress($quote, null, 'Billing'),
|
1517 |
+
'shippingAddress' => $this->prepareAddress($quote, null, 'Shipping'),
|
1518 |
+
'items' => array(),
|
1519 |
+
'currency' => $quote->getData('quote_currency_code'),
|
1520 |
+
'shippingCost' => 0.00,
|
1521 |
+
'taxCost' => 0.00,
|
1522 |
+
'discount' => 0.00,
|
1523 |
+
'totalCost' => 0.00,
|
1524 |
+
'description' => $description,
|
1525 |
+
'merchantEmail' => Mage::getStoreConfig('trans_email/ident_sales/email'),
|
1526 |
+
'forceTransactionType' => '',
|
1527 |
+
);
|
1528 |
+
|
1529 |
+
$this->prepareItems($quote, $result);
|
1530 |
+
|
1531 |
+
return $result;
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
/**
|
1535 |
+
* Prepare cart for initial payment request
|
1536 |
+
*
|
1537 |
+
* Mage_Customer_Model_Customer $customer Customer
|
1538 |
+
*
|
1539 |
+
* @return array
|
1540 |
+
*/
|
1541 |
+
public function prepareFakeCart(Mage_Customer_Model_Customer $customer)
|
1542 |
+
{
|
1543 |
+
$refId = 'authorization';
|
1544 |
+
|
1545 |
+
$description = 'Authorization'; // TODO: add reference to customer?
|
1546 |
+
|
1547 |
+
$price = $this->preparePrice(Mage::getStoreConfig('xpaymentsconnector/settings/xpay_minimum_payment_recurring_amount'));
|
1548 |
+
|
1549 |
+
$result = array(
|
1550 |
+
'login' => $customer->getData('email') . ' (User ID #' . $customer->getData('entity_id') . ')',
|
1551 |
+
'billingAddress' => $this->prepareAddress(null, $customer, 'Billing'),
|
1552 |
+
'shippingAddress' => $this->prepareAddress(null, $customer, 'Shipping'),
|
1553 |
+
'items' => array(
|
1554 |
+
array(
|
1555 |
+
'sku' => 'CardSetup',
|
1556 |
+
'name' => 'CardSetup',
|
1557 |
+
'price' => $price,
|
1558 |
+
'quantity' => '1',
|
1559 |
+
),
|
1560 |
+
),
|
1561 |
+
'currency' => Mage::getModel('xpaymentsconnector/payment_cc')->getCurrency(),
|
1562 |
+
'shippingCost' => 0.00,
|
1563 |
+
'taxCost' => 0.00,
|
1564 |
+
'discount' => 0.00,
|
1565 |
+
'totalCost' => $price,
|
1566 |
+
'description' => $description,
|
1567 |
+
'merchantEmail' => Mage::getStoreConfig('trans_email/ident_sales/email'),
|
1568 |
+
'forceTransactionType' => '',
|
1569 |
+
);
|
1570 |
+
|
1571 |
+
return $result;
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
/**
|
1575 |
+
* Get callback URL for initial payment request
|
1576 |
+
*
|
1577 |
+
* @param string $refId Reference ID
|
1578 |
+
* @param string $entityId Quote ID or Cutomer ID
|
1579 |
+
* @param bool $zeroAuth Is it zero auth request
|
1580 |
+
*
|
1581 |
+
* @return array
|
1582 |
+
*/
|
1583 |
+
public function getCallbackUrl($refId, $entityId, $zeroAuth = false)
|
1584 |
+
{
|
1585 |
+
$params = array(
|
1586 |
+
'_secure' => true,
|
1587 |
+
'_nosid' => true,
|
1588 |
+
);
|
1589 |
+
|
1590 |
+
if ($zeroAuth) {
|
1591 |
+
|
1592 |
+
$params['customer_id'] = $entityId;
|
1593 |
+
|
1594 |
+
} else {
|
1595 |
+
|
1596 |
+
$params['quote_id'] = $entityId;
|
1597 |
+
}
|
1598 |
+
|
1599 |
+
$url = Mage::getUrl('xpaymentsconnector/processing/callback', $params);
|
1600 |
+
|
1601 |
+
return $url;
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
/**
|
1605 |
+
* Get return URL for initial payment request
|
1606 |
+
*
|
1607 |
+
* @param string $refId Reference ID
|
1608 |
+
* @param string $entityId Quote ID or Cutomer ID
|
1609 |
+
* @param bool $zeroAuth Is it zero auth request
|
1610 |
+
*
|
1611 |
+
* @return array
|
1612 |
+
*/
|
1613 |
+
public function getReturnUrl($refId, $entityId, $zeroAuth = false)
|
1614 |
+
{
|
1615 |
+
$params = array(
|
1616 |
+
'_secure' => true,
|
1617 |
+
'_nosid' => true,
|
1618 |
+
);
|
1619 |
+
|
1620 |
+
if ($zeroAuth) {
|
1621 |
+
|
1622 |
+
$params['customer_id'] = $entityId;
|
1623 |
+
|
1624 |
+
$url = Mage::getUrl('xpaymentsconnector/customer/cardadd', $params);
|
1625 |
+
|
1626 |
+
} else {
|
1627 |
+
|
1628 |
+
$params['quote_id'] = $entityId;
|
1629 |
+
|
1630 |
+
$url = Mage::getUrl('xpaymentsconnector/processing/return', $params);
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
return $url;
|
1634 |
+
}
|
1635 |
+
|
1636 |
+
/**
|
1637 |
+
* Get address data saved at checkout
|
1638 |
+
*
|
1639 |
+
* @param array $data Checkout data
|
1640 |
+
* @param string $type Address type 'billing' or 'shipping'
|
1641 |
+
*
|
1642 |
+
* @return array
|
1643 |
+
*/
|
1644 |
+
protected function getCheckoutAddressData($data, $type)
|
1645 |
+
{
|
1646 |
+
$result = array();
|
1647 |
+
|
1648 |
+
$key = $type . '_address_id';
|
1649 |
+
|
1650 |
+
if (isset($data[$key])) {
|
1651 |
+
|
1652 |
+
// Address data from the address book
|
1653 |
+
$address = Mage::getModel('customer/address')->load($data[$key]);
|
1654 |
+
$result += array_filter($address->getData());
|
1655 |
+
}
|
1656 |
+
|
1657 |
+
if (isset($data[$type])) {
|
1658 |
+
|
1659 |
+
// Addrress data from checkout
|
1660 |
+
$result += array_filter($data[$type]);
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
return $result;
|
1664 |
+
}
|
1665 |
+
|
1666 |
+
/**
|
1667 |
+
* Save checkout data
|
1668 |
+
*
|
1669 |
+
* @param Mage_Sales_Model_Quote $quote
|
1670 |
+
* @param array $data Some checkout data
|
1671 |
+
*
|
1672 |
+
* @return void
|
1673 |
+
*/
|
1674 |
+
public function saveCheckoutData($quote, $data)
|
1675 |
+
{
|
1676 |
+
$this->writeLog('Save checkout data for Quote #' . $quote->getEntityId(), $data);
|
1677 |
+
|
1678 |
+
$data = serialize($data);
|
1679 |
+
$quote->setData(self::CHECKOUT_DATA, $data);
|
1680 |
+
$quote->save();
|
1681 |
+
}
|
1682 |
+
|
1683 |
+
/**
|
1684 |
+
* Load data saved at checkou
|
1685 |
+
*
|
1686 |
+
* @param Mage_Sales_Model_Quote $quote
|
1687 |
+
*
|
1688 |
+
* @return array
|
1689 |
+
*/
|
1690 |
+
public function loadCheckoutData(Mage_Sales_Model_Quote $quote)
|
1691 |
+
{
|
1692 |
+
return unserialize($quote->getData(self::CHECKOUT_DATA));
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
/**
|
1696 |
+
* Save some temporary X-Payments data to Quote
|
1697 |
+
*
|
1698 |
+
* @param Mage_Sales_Model_Quote $quote
|
1699 |
+
* @param array $data Some data
|
1700 |
+
*
|
1701 |
+
* @return void
|
1702 |
+
*/
|
1703 |
+
public function saveQuoteXpcData(Mage_Sales_Model_Quote $quote, $data = array())
|
1704 |
+
{
|
1705 |
+
$data = serialize($data);
|
1706 |
+
$quote->setData(self::XPC_DATA, $data);
|
1707 |
+
$quote->save();
|
1708 |
+
}
|
1709 |
+
|
1710 |
+
/**
|
1711 |
+
* Clear temporary X-Payments data from Quote (just a wrapper)
|
1712 |
+
*
|
1713 |
+
* @param Mage_Sales_Model_Quote $quote
|
1714 |
+
*
|
1715 |
+
* @return void
|
1716 |
+
*/
|
1717 |
+
public function clearQuoteXpcData(Mage_Sales_Model_Quote $quote)
|
1718 |
+
{
|
1719 |
+
return $this->saveQuoteXpcData($quote);
|
1720 |
+
}
|
1721 |
+
|
1722 |
+
/**
|
1723 |
+
* Append some temporary X-Payments data to Quote
|
1724 |
+
*
|
1725 |
+
* @param Mage_Sales_Model_Quote $quote
|
1726 |
+
* @param array $appendData Some data to append
|
1727 |
+
*
|
1728 |
+
* @return void
|
1729 |
+
*/
|
1730 |
+
public function appendQuoteXpcData(Mage_Sales_Model_Quote $quote, $appendData = array())
|
1731 |
+
{
|
1732 |
+
$data = $this->loadQuoteXpcData($quote);
|
1733 |
+
|
1734 |
+
$data += $appendData;
|
1735 |
+
|
1736 |
+
$this->saveQuoteXpcData($quote, $data);
|
1737 |
+
}
|
1738 |
+
|
1739 |
+
/**
|
1740 |
+
* Load temporary X-Payments data from Quote
|
1741 |
+
*
|
1742 |
+
* @param Mage_Sales_Model_Quote $quote
|
1743 |
+
*
|
1744 |
+
* @return array
|
1745 |
+
*/
|
1746 |
+
public function loadQuoteXpcData(Mage_Sales_Model_Quote $quote)
|
1747 |
+
{
|
1748 |
+
$data = unserialize($quote->getData(self::XPC_DATA));
|
1749 |
+
|
1750 |
+
if (!is_array($data)) {
|
1751 |
+
$data = array();
|
1752 |
+
}
|
1753 |
+
|
1754 |
+
return $data;
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
/**
|
1758 |
+
* Get token from quote
|
1759 |
+
*
|
1760 |
+
* @param Mage_Sales_Model_Quote $quote
|
1761 |
+
*
|
1762 |
+
* @return string or false
|
1763 |
+
*/
|
1764 |
+
public function getQuoteXpcDataToken(Mage_Sales_Model_Quote $quote)
|
1765 |
+
{
|
1766 |
+
$data = $this->loadQuoteXpcData($quote);
|
1767 |
+
|
1768 |
+
return !empty($data['token'])
|
1769 |
+
? $data['token']
|
1770 |
+
: false;
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
/**
|
1774 |
+
* Process data saved at checkout
|
1775 |
+
*
|
1776 |
+
* @param Mage_Sales_Model_Quote $quote
|
1777 |
+
*
|
1778 |
+
* @return void
|
1779 |
+
*/
|
1780 |
+
protected function processCheckoutData(Mage_Sales_Model_Quote $quote)
|
1781 |
+
{
|
1782 |
+
// Grab data saved at checkout
|
1783 |
+
$data = $this->loadCheckoutData($quote);
|
1784 |
+
|
1785 |
+
// Add billing address data from checkout
|
1786 |
+
$quote->getBillingAddress()->addData($this->getCheckoutAddressData($data, 'billing'));
|
1787 |
+
|
1788 |
+
if (
|
1789 |
+
isset($data['billing']['use_for_shipping'])
|
1790 |
+
&& (bool)$data['billing']['use_for_shipping']
|
1791 |
+
) {
|
1792 |
+
|
1793 |
+
// Overwrite shipping address data with billing one
|
1794 |
+
$data['shipping'] = $data['billing'];
|
1795 |
+
|
1796 |
+
if (
|
1797 |
+
$this->checkOscModuleEnabled()
|
1798 |
+
&& !empty($data['billing_address_id'])
|
1799 |
+
) {
|
1800 |
+
$shippingAddress = Mage::getModel('customer/address')->load($data['billing_address_id']);
|
1801 |
+
$data['shipping'] = $shippingAddress->getData();
|
1802 |
+
}
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
if (
|
1806 |
+
!empty($data['billing']['telephone'])
|
1807 |
+
&& empty($data['shipping']['telephone'])
|
1808 |
+
) {
|
1809 |
+
// WA fix for Firecheckout which doesn't fill shipping phone
|
1810 |
+
$data['shipping']['telephone'] = $data['billing']['telephone'];
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
// Add shipping address data from checkout
|
1814 |
+
$quote->getShippingAddress()->addData($this->getCheckoutAddressData($data, 'shipping'));
|
1815 |
+
|
1816 |
+
if (!$this->checkOscModuleEnabled()) {
|
1817 |
+
|
1818 |
+
// TODO: Understand what's wrong with it for OSC.
|
1819 |
+
|
1820 |
+
// Save shipping method
|
1821 |
+
if (!empty($data['shipping_method'])) {
|
1822 |
+
$quote->getShippingAddress()->setCollectShippingRates(true)->collectShippingRates();
|
1823 |
+
$quote->setShippingMethod($data['shipping_method']);
|
1824 |
+
}
|
1825 |
+
}
|
1826 |
+
|
1827 |
+
$copyFields = array(
|
1828 |
+
'email',
|
1829 |
+
'firstname',
|
1830 |
+
'lastname',
|
1831 |
+
);
|
1832 |
+
|
1833 |
+
foreach ($copyFields as $field) {
|
1834 |
+
|
1835 |
+
if (
|
1836 |
+
!$quote->getData('customer_' . $field)
|
1837 |
+
&& !empty($data['billing'][$field])
|
1838 |
+
) {
|
1839 |
+
$quote->setData('customer_' . $field, $data['billing'][$field]);
|
1840 |
+
}
|
1841 |
+
}
|
1842 |
+
}
|
1843 |
+
|
1844 |
+
/**
|
1845 |
+
* Prepare quote for customer registration and customer order submit
|
1846 |
+
*
|
1847 |
+
* @return Mage_Checkout_Model_Type_Onepage
|
1848 |
+
*/
|
1849 |
+
protected function createNewCustomer(Mage_Sales_Model_Quote $quote)
|
1850 |
+
{
|
1851 |
+
$billing = $quote->getBillingAddress();
|
1852 |
+
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
|
1853 |
+
|
1854 |
+
//$customer = Mage::getModel('customer/customer');
|
1855 |
+
$customer = $quote->getCustomer();
|
1856 |
+
/* @var $customer Mage_Customer_Model_Customer */
|
1857 |
+
$customerBilling = $billing->exportCustomerAddress();
|
1858 |
+
$customer->addAddress($customerBilling);
|
1859 |
+
$billing->setCustomerAddress($customerBilling);
|
1860 |
+
$customerBilling->setIsDefaultBilling(true);
|
1861 |
+
if ($shipping && !$shipping->getSameAsBilling()) {
|
1862 |
+
$customerShipping = $shipping->exportCustomerAddress();
|
1863 |
+
$customer->addAddress($customerShipping);
|
1864 |
+
$shipping->setCustomerAddress($customerShipping);
|
1865 |
+
$customerShipping->setIsDefaultShipping(true);
|
1866 |
+
} else {
|
1867 |
+
$customerBilling->setIsDefaultShipping(true);
|
1868 |
+
}
|
1869 |
+
|
1870 |
+
Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);
|
1871 |
+
$customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));
|
1872 |
+
$quote->setCustomer($customer)
|
1873 |
+
->setCustomerId(true);
|
1874 |
+
|
1875 |
+
return $customer;
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
/**
|
1879 |
+
* Check if new customer profile should be created
|
1880 |
+
*
|
1881 |
+
* @param Mage_Sales_Model_Quote $quote
|
1882 |
+
* @param $includeLoginMethod Consider login_in method or not
|
1883 |
+
*
|
1884 |
+
* @return bool
|
1885 |
+
*/
|
1886 |
+
public function isCreateNewCustomer(Mage_Sales_Model_Quote $quote, $includeLoginMethod = false)
|
1887 |
+
{
|
1888 |
+
$result = false;
|
1889 |
+
|
1890 |
+
if ($this->checkOscModuleEnabled()) {
|
1891 |
+
|
1892 |
+
// For One Step Checkout module
|
1893 |
+
$data = $this->loadCheckoutData($quote);
|
1894 |
+
|
1895 |
+
$result = isset($data['create_account'])
|
1896 |
+
&& (bool)$data['create_account'];
|
1897 |
+
|
1898 |
+
} elseif ($this->checkFirecheckoutModuleEnabled()) {
|
1899 |
+
|
1900 |
+
// For Firecheckout module
|
1901 |
+
$data = $this->loadCheckoutData($quote);
|
1902 |
+
|
1903 |
+
$result = isset($data['billing']['register_account'])
|
1904 |
+
&& (bool)$data['billing']['register_account'];
|
1905 |
+
|
1906 |
+
} else {
|
1907 |
+
|
1908 |
+
// For default one page checkout
|
1909 |
+
$checkoutMethod = $quote->getCheckoutMethod();
|
1910 |
+
|
1911 |
+
$result = self::METHOD_REGISTER == $checkoutMethod
|
1912 |
+
|| $includeLoginMethod && self::METHOD_LOGIN_IN == $checkoutMethod;
|
1913 |
+
}
|
1914 |
+
|
1915 |
+
return $result;
|
1916 |
+
}
|
1917 |
+
|
1918 |
+
/**
|
1919 |
+
* Convert quote to order
|
1920 |
+
*
|
1921 |
+
* @param Mage_Sales_Model_Quote $quote
|
1922 |
+
*
|
1923 |
+
* @return string
|
1924 |
+
*/
|
1925 |
+
public function funcPlaceOrder(Mage_Sales_Model_Quote $quote)
|
1926 |
+
{
|
1927 |
+
$refId = false;
|
1928 |
+
|
1929 |
+
try {
|
1930 |
+
|
1931 |
+
// Process data saved at checkout
|
1932 |
+
$this->processCheckoutData($quote);
|
1933 |
+
|
1934 |
+
if ($this->isCreateNewCustomer($quote)) {
|
1935 |
+
|
1936 |
+
// Prepare data for customer who's registered at checkout
|
1937 |
+
$customer = $this->createNewCustomer($quote);
|
1938 |
+
$customer->save();
|
1939 |
+
|
1940 |
+
$this->appendQuoteXpcData($quote, array('address_saved' => true));
|
1941 |
+
}
|
1942 |
+
|
1943 |
+
// Set payment method (maybe not necessary. Just in case)
|
1944 |
+
$quote->collectTotals()->getPayment()->setMethod('xpayments');
|
1945 |
+
|
1946 |
+
// Place order
|
1947 |
+
$service = Mage::getModel('sales/service_quote', $quote);
|
1948 |
+
$service->submitAll();
|
1949 |
+
|
1950 |
+
$order = $service->getOrder();
|
1951 |
+
|
1952 |
+
$quote->setIsActive(false)->save();
|
1953 |
+
|
1954 |
+
$cardData = $quote->getData(self::XPC_DATA);
|
1955 |
+
$order->setData(self::XPC_DATA, $cardData);
|
1956 |
+
|
1957 |
+
$cardData = unserialize($cardData);
|
1958 |
+
|
1959 |
+
$order->setData('xpc_txnid', $cardData['txnId']);
|
1960 |
+
|
1961 |
+
$order->save();
|
1962 |
+
|
1963 |
+
$refId = $order->getIncrementId();
|
1964 |
+
|
1965 |
+
$this->writeLog('Placed order #' . $refId, $cardData);
|
1966 |
+
|
1967 |
+
} catch (Exception $e) {
|
1968 |
+
|
1969 |
+
$this->writeLog('Unable to create order: ' . $e->getMessage(), $e->getTraceAsString());
|
1970 |
+
|
1971 |
+
// Save error message in quote
|
1972 |
+
$this->appendQuoteXpcData(
|
1973 |
+
$quote,
|
1974 |
+
array(
|
1975 |
+
'xpc_message' => $e->getMessage(),
|
1976 |
+
)
|
1977 |
+
);
|
1978 |
+
}
|
1979 |
+
|
1980 |
+
return $refId;
|
1981 |
+
}
|
1982 |
+
|
1983 |
+
/**
|
1984 |
+
* Just a wrapper to omit sid and secure params
|
1985 |
+
*
|
1986 |
+
* @param $path URL path
|
1987 |
+
*
|
1988 |
+
* @return string
|
1989 |
+
*/
|
1990 |
+
protected function getXpcCheckoutUrl($path, $params = array())
|
1991 |
+
{
|
1992 |
+
$params += array(
|
1993 |
+
'_nosid' => true,
|
1994 |
+
'_secure' => true
|
1995 |
+
);
|
1996 |
+
|
1997 |
+
return Mage::getUrl($path, $params);
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
/**
|
2001 |
+
* Get some JSON data for javascript at checkout
|
2002 |
+
*
|
2003 |
+
* @return string
|
2004 |
+
*/
|
2005 |
+
public function getXpcJsonData()
|
2006 |
+
{
|
2007 |
+
// Display iframe on the review step (after payment step) or not
|
2008 |
+
$isDisplayOnReviewStep = 'review' == Mage::helper('xpaymentsconnector')->getIframePlaceDisplay();
|
2009 |
+
|
2010 |
+
$xpOrigin = parse_url(Mage::getModel('xpaymentsconnector/payment_cc')->getConfig('xpay_url'));
|
2011 |
+
$xpOrigin = $xpOrigin['scheme'] . '://' . $xpOrigin['host'];
|
2012 |
+
|
2013 |
+
$data = array(
|
2014 |
+
'url' => array(
|
2015 |
+
|
2016 |
+
'redirectIframe' => $this->getXpcCheckoutUrl('xpaymentsconnector/processing/redirectiframe'),
|
2017 |
+
|
2018 |
+
'redirectIframeUnsetOrder' => $this->getXpcCheckoutUrl(
|
2019 |
+
'xpaymentsconnector/processing/redirectiframe',
|
2020 |
+
array(
|
2021 |
+
'unset_xp_prepare_order' => 1
|
2022 |
+
)
|
2023 |
+
),
|
2024 |
+
|
2025 |
+
'setMethodRegister' => $this->getXpcCheckoutUrl(
|
2026 |
+
'xpaymentsconnector/processing/redirectiframe',
|
2027 |
+
array(
|
2028 |
+
'unset_xp_prepare_order' => 1,
|
2029 |
+
'checkout_method' => 'register'
|
2030 |
+
)
|
2031 |
+
),
|
2032 |
+
|
2033 |
+
'setMethodGuest' => $this->getXpcCheckoutUrl(
|
2034 |
+
'xpaymentsconnector/processing/redirectiframe',
|
2035 |
+
array(
|
2036 |
+
'unset_xp_prepare_order' => 1,
|
2037 |
+
'checkout_method' => 'guest'
|
2038 |
+
)
|
2039 |
+
),
|
2040 |
+
|
2041 |
+
'saveCheckoutData' => $this->getXpcCheckoutUrl('xpaymentsconnector/processing/save_checkout_data'),
|
2042 |
+
|
2043 |
+
'changeMethod' => $this->getXpcCheckoutUrl('checkout/cart/'),
|
2044 |
+
|
2045 |
+
'checkAgreements' => $this->getXpcCheckoutUrl('xpaymentsconnector/processing/check_agreements'),
|
2046 |
+
),
|
2047 |
+
'xpOrigin' => $xpOrigin,
|
2048 |
+
'displayOnReviewStep' => $isDisplayOnReviewStep,
|
2049 |
+
'useIframe' => $this->isUseIframe(),
|
2050 |
+
'isOneStepCheckout' => $this->checkOscModuleEnabled(),
|
2051 |
+
'isFirecheckout' => $this->checkFirecheckoutModuleEnabled(),
|
2052 |
+
'height' => 0,
|
2053 |
+
);
|
2054 |
+
|
2055 |
+
return json_encode($data, JSON_FORCE_OBJECT);
|
2056 |
+
}
|
2057 |
+
|
2058 |
+
/**
|
2059 |
+
* Clear init data and something about "unset prepared order"
|
2060 |
+
*
|
2061 |
+
* @return void
|
2062 |
+
*/
|
2063 |
+
public function resetInitData($quote = null)
|
2064 |
+
{
|
2065 |
+
$unsetParams = array('token');
|
2066 |
+
$this->unsetXpaymentPrepareOrder($unsetParams);
|
2067 |
+
|
2068 |
+
if (!$quote) {
|
2069 |
+
// Get quote from session
|
2070 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
2071 |
+
}
|
2072 |
+
|
2073 |
+
$this->clearQuoteXpcData($quote);
|
2074 |
+
}
|
2075 |
+
|
2076 |
+
/**
|
2077 |
+
* Find last order by X-Payments transaction ID
|
2078 |
+
*
|
2079 |
+
* @param string $txnId
|
2080 |
+
*
|
2081 |
+
* @return Mage_Sales_Model_Order
|
2082 |
+
*/
|
2083 |
+
public function getOrderByTxnId($txnId)
|
2084 |
+
{
|
2085 |
+
return Mage::getModel('sales/order')->getCollection()
|
2086 |
+
->addAttributeToSelect('*')
|
2087 |
+
->addFieldToFilter('xpc_txnid', $txnId)
|
2088 |
+
->getLastItem();
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
/**
|
2092 |
+
* Write log
|
2093 |
+
*
|
2094 |
+
* @param string $title Log title
|
2095 |
+
* @param mixed $data Data to log
|
2096 |
+
*
|
2097 |
+
* @return void
|
2098 |
+
*/
|
2099 |
+
public function writeLog($title, $data = '')
|
2100 |
+
{
|
2101 |
+
if (!is_string($data)) {
|
2102 |
+
$data = var_export($data, true);
|
2103 |
+
}
|
2104 |
+
|
2105 |
+
$message = PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL
|
2106 |
+
. $title . PHP_EOL
|
2107 |
+
. $data . PHP_EOL
|
2108 |
+
. Mage::helper('core/url')->getCurrentUrl() . PHP_EOL
|
2109 |
+
. '--------------------------' . PHP_EOL
|
2110 |
+
. PHP_EOL;
|
2111 |
+
|
2112 |
+
Mage::log($message, null, self::XPAYMENTS_LOG_FILE, true);
|
2113 |
+
}
|
2114 |
}
|
app/code/community/Cdev/XPaymentsConnector/Model/Adminhtml/System/Config/Source/Placedisplay.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
* @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
* @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
|
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Paymentconfiguration.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Paymentconfiguration/Collection.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Usercards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Usercards/Collection.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Observer.php
CHANGED
@@ -1,666 +1,639 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @author
|
16 |
-
* @category Cdev
|
17 |
-
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
-
*/
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Class Cdev_XPaymentsConnector_Model_Observer
|
24 |
-
*/
|
25 |
-
|
26 |
-
class Cdev_XPaymentsConnector_Model_Observer extends Mage_CatalogInventory_Model_Observer
|
27 |
-
{
|
28 |
-
protected $_current_customer_id = null;
|
29 |
-
|
30 |
-
public function preDispatchCheckout($observer)
|
31 |
-
{
|
32 |
-
|
33 |
-
Mage::getSingleton('checkout/session')->unsetData('user_card_save');
|
34 |
-
|
35 |
-
//unset x-payment form place settings
|
36 |
-
$unsetParams = array('place_display');
|
37 |
-
$xpHelper = Mage::helper('xpaymentsconnector');
|
38 |
-
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
39 |
-
|
40 |
-
//set recurring product discount
|
41 |
-
$issetRecurrnigProduct = $xpHelper->checkIssetRecurringOrder();
|
42 |
-
if ($issetRecurrnigProduct['isset']) {
|
43 |
-
$xpHelper->setRecurringProductDiscount();
|
44 |
-
}
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
public function paymentMethodIsActive($observer)
|
49 |
-
{
|
50 |
-
$event = $observer->getEvent();
|
51 |
-
$method = $event->getMethodInstance();
|
52 |
-
$result = $event->getResult();
|
53 |
-
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
54 |
-
$prepaidpayments = Mage::getModel('xpaymentsconnector/payment_prepaidpayments')->getCode();
|
55 |
-
|
56 |
-
if (($method->getCode() == $saveCardsPaymentCode) || ($method->getCode() == $prepaidpayments)) {
|
57 |
-
$quote = $event->getQuote();
|
58 |
-
if ($quote) {
|
59 |
-
$customerId = $quote->getData('customer_id');
|
60 |
-
$isBalanceCard = Cdev_XPaymentsConnector_Model_Usercards::SIMPLE_CARD;
|
61 |
-
if ($method->getCode() == $prepaidpayments) {
|
62 |
-
$isBalanceCard = Cdev_XPaymentsConnector_Model_Usercards::BALANCE_CARD;
|
63 |
-
}
|
64 |
-
if ($customerId) {
|
65 |
-
$cardsCount = Mage::getModel('xpaymentsconnector/usercards')
|
66 |
-
->getCollection()
|
67 |
-
->addFieldToFilter('user_id', $customerId)
|
68 |
-
->addFieldToFilter('usage_type', $isBalanceCard)
|
69 |
-
->count();
|
70 |
-
if ($cardsCount == 0) {
|
71 |
-
$result->isAvailable = false;
|
72 |
-
}
|
73 |
-
} else {
|
74 |
-
$result->isAvailable = false;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Dispatch: checkout_type_onepage_save_order_after
|
83 |
-
* @param $observer
|
84 |
-
*/
|
85 |
-
|
86 |
-
public function updateOrder($observer)
|
87 |
-
{
|
88 |
-
$xpHelper = Mage::helper('xpaymentsconnector');
|
89 |
-
$event = $observer->getEvent();
|
90 |
-
$order = $event->getOrder();
|
91 |
-
|
92 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
93 |
-
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
|
94 |
-
$paymentCcModel = Mage::getModel('xpaymentsconnector/payment_cc');
|
95 |
-
$xpaymentPaymentCode = $paymentCcModel->getCode();
|
96 |
-
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
97 |
-
$useIframe = Mage::
|
98 |
-
$quote = $observer->getQuote();
|
99 |
-
|
100 |
-
$noticeHelper = $xpHelper->getFailureCheckoutNoticeHelper();
|
101 |
-
|
102 |
-
if ($paymentMethod == $
|
103 |
-
|
104 |
-
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
$
|
117 |
-
$
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
$order
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
if ($
|
283 |
-
$
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
$
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
$
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
$
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
*
|
460 |
-
* @param $observer
|
461 |
-
*/
|
462 |
-
public function
|
463 |
-
{
|
464 |
-
$
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
->
|
502 |
-
->
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
/**
|
536 |
-
*
|
537 |
-
*
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
$result = array();
|
641 |
-
switch ($xpTransactionData['xpaction']) {
|
642 |
-
case 'refund':
|
643 |
-
$result = $xpaymentModel->authorizedTransactionRequest('refund', $data);
|
644 |
-
break;
|
645 |
-
case 'capture':
|
646 |
-
$result = $xpaymentModel->authorizedTransactionRequest('capture', $data);
|
647 |
-
break;
|
648 |
-
case 'void':
|
649 |
-
$result = $xpaymentModel->authorizedTransactionRequest('void', $data);
|
650 |
-
break;
|
651 |
-
}
|
652 |
-
|
653 |
-
if(empty($result['error_message'])){
|
654 |
-
$message = Mage::helper('xpaymentsconnector')->__("Transaction '%s' to order (%s) was successful!",
|
655 |
-
$xpTransactionData['xpaction'],
|
656 |
-
$xpTransactionData['orderid']);
|
657 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
658 |
-
} else{
|
659 |
-
Mage::getSingleton('adminhtml/session')->addError($result['error_message']);
|
660 |
-
}
|
661 |
-
|
662 |
-
}
|
663 |
-
}
|
664 |
-
}
|
665 |
-
|
666 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
+
* @category Cdev
|
17 |
+
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Class Cdev_XPaymentsConnector_Model_Observer
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Cdev_XPaymentsConnector_Model_Observer extends Mage_CatalogInventory_Model_Observer
|
27 |
+
{
|
28 |
+
protected $_current_customer_id = null;
|
29 |
+
|
30 |
+
public function preDispatchCheckout($observer)
|
31 |
+
{
|
32 |
+
|
33 |
+
Mage::getSingleton('checkout/session')->unsetData('user_card_save');
|
34 |
+
|
35 |
+
//unset x-payment form place settings
|
36 |
+
$unsetParams = array('place_display');
|
37 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
38 |
+
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
39 |
+
|
40 |
+
//set recurring product discount
|
41 |
+
$issetRecurrnigProduct = $xpHelper->checkIssetRecurringOrder();
|
42 |
+
if ($issetRecurrnigProduct['isset']) {
|
43 |
+
$xpHelper->setRecurringProductDiscount();
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
public function paymentMethodIsActive($observer)
|
49 |
+
{
|
50 |
+
$event = $observer->getEvent();
|
51 |
+
$method = $event->getMethodInstance();
|
52 |
+
$result = $event->getResult();
|
53 |
+
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
54 |
+
$prepaidpayments = Mage::getModel('xpaymentsconnector/payment_prepaidpayments')->getCode();
|
55 |
+
|
56 |
+
if (($method->getCode() == $saveCardsPaymentCode) || ($method->getCode() == $prepaidpayments)) {
|
57 |
+
$quote = $event->getQuote();
|
58 |
+
if ($quote) {
|
59 |
+
$customerId = $quote->getData('customer_id');
|
60 |
+
$isBalanceCard = Cdev_XPaymentsConnector_Model_Usercards::SIMPLE_CARD;
|
61 |
+
if ($method->getCode() == $prepaidpayments) {
|
62 |
+
$isBalanceCard = Cdev_XPaymentsConnector_Model_Usercards::BALANCE_CARD;
|
63 |
+
}
|
64 |
+
if ($customerId) {
|
65 |
+
$cardsCount = Mage::getModel('xpaymentsconnector/usercards')
|
66 |
+
->getCollection()
|
67 |
+
->addFieldToFilter('user_id', $customerId)
|
68 |
+
->addFieldToFilter('usage_type', $isBalanceCard)
|
69 |
+
->count();
|
70 |
+
if ($cardsCount == 0) {
|
71 |
+
$result->isAvailable = false;
|
72 |
+
}
|
73 |
+
} else {
|
74 |
+
$result->isAvailable = false;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Dispatch: checkout_type_onepage_save_order_after
|
83 |
+
* @param $observer
|
84 |
+
*/
|
85 |
+
|
86 |
+
public function updateOrder($observer)
|
87 |
+
{
|
88 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
89 |
+
$event = $observer->getEvent();
|
90 |
+
$order = $event->getOrder();
|
91 |
+
|
92 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
93 |
+
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
|
94 |
+
$paymentCcModel = Mage::getModel('xpaymentsconnector/payment_cc');
|
95 |
+
$xpaymentPaymentCode = $paymentCcModel->getCode();
|
96 |
+
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
97 |
+
$useIframe = Mage::helper('xpaymentsconnector')->isUseIframe();
|
98 |
+
$quote = $observer->getQuote();
|
99 |
+
|
100 |
+
$noticeHelper = $xpHelper->getFailureCheckoutNoticeHelper();
|
101 |
+
|
102 |
+
if ($paymentMethod == $saveCardsPaymentCode) {
|
103 |
+
|
104 |
+
$order->setCanSendNewEmailFlag(false);
|
105 |
+
$paymentCardNumber = NULL;
|
106 |
+
$grandTotal = NULL;
|
107 |
+
$cardData = NULL;
|
108 |
+
$paymentCardNumber = $quote->getPayment()->getData('xp_payment_card');
|
109 |
+
$cardData = Mage::getModel('xpaymentsconnector/usercards')->load($paymentCardNumber);
|
110 |
+
|
111 |
+
$response = $paymentCcModel->sendAgainTransactionRequest($order->getId(),$paymentCardNumber,$grandTotal,$cardData);
|
112 |
+
|
113 |
+
if ($response['success']) {
|
114 |
+
$result = $paymentCcModel->updateOrderByXpaymentResponse($order->getId(), $response['response']['transaction_id']);
|
115 |
+
if (!$result['success']) {
|
116 |
+
$checkoutSession->addError($result['error_message']);
|
117 |
+
$checkoutSession->addNotice($noticeHelper);
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
$checkoutSession->addError($response['error_message']);
|
121 |
+
$checkoutSession->addNotice($noticeHelper);
|
122 |
+
}
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param Varien_Event_Observer $observer
|
132 |
+
*/
|
133 |
+
public function orderSuccessAction($observer)
|
134 |
+
{
|
135 |
+
Mage::helper('xpaymentsconnector')->unsetXpaymentPrepareOrder();
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
/**
|
140 |
+
* @param Varien_Event_Observer $observer
|
141 |
+
*/
|
142 |
+
public function postdispatchAdminhtmlSalesOrderCreateSave($observer)
|
143 |
+
{
|
144 |
+
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
|
145 |
+
$incrementId = $quote->getData('reserved_order_id');
|
146 |
+
$order = Mage::getModel('sales/order')->load($incrementId, 'increment_id');
|
147 |
+
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
|
148 |
+
$admSession = Mage::getSingleton('adminhtml/session');
|
149 |
+
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
150 |
+
$prepaidpayments = Mage::getModel('xpaymentsconnector/payment_prepaidpayments')->getCode();
|
151 |
+
|
152 |
+
if ($paymentMethod == $saveCardsPaymentCode) {
|
153 |
+
$orderId = $order->getId();
|
154 |
+
$grandTotal = $quote->getData('grand_total');
|
155 |
+
$this->adminhtmlSendSaveCardsPaymentTransaction($orderId,$grandTotal);
|
156 |
+
} elseif ($paymentMethod == $prepaidpayments) {
|
157 |
+
$xpPrepaidPaymentsCard = $admSession->getData('xp_prepaid_payments');
|
158 |
+
$currentUserCard = Mage::getModel('xpaymentsconnector/usercards')->load($xpPrepaidPaymentsCard);
|
159 |
+
$txnid = $currentUserCard->getData('txnId');
|
160 |
+
$lastTransId = $txnid;
|
161 |
+
|
162 |
+
$order->setData('xpc_txnid',$txnid);
|
163 |
+
$order->getPayment()->setTransactionId($txnid);
|
164 |
+
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
165 |
+
list($status, $response) = $api->requestPaymentInfo($txnid,false,true);
|
166 |
+
|
167 |
+
if($status){
|
168 |
+
$currentTransaction = end($response['transactions']);
|
169 |
+
$lastTransId = $currentTransaction['txnid'];
|
170 |
+
}
|
171 |
+
|
172 |
+
$order->getPayment()->setLastTransId($lastTransId);
|
173 |
+
$order->setData('xp_card_data',serialize($currentUserCard->getData()));
|
174 |
+
$order->setState(
|
175 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
176 |
+
(bool)Mage_Sales_Model_Order::STATE_PROCESSING,
|
177 |
+
Mage::helper('xpaymentsconnector')->__('Customer has been redirected to X-Payments.')
|
178 |
+
);
|
179 |
+
$order->save();
|
180 |
+
}
|
181 |
+
$admSession->unsetData('xp_payment_card');
|
182 |
+
$admSession->unsetData('xp_prepaid_payments');
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Send transaction to X-Payment for 'order edit' event
|
189 |
+
* @param Varien_Event_Observer $observer
|
190 |
+
*/
|
191 |
+
public function postdispatchAdminhtmlSalesOrderEditSave($observer)
|
192 |
+
{
|
193 |
+
$adminhtmlSessionQuote = Mage::getSingleton('adminhtml/session_quote');
|
194 |
+
$parentOrder = $adminhtmlSessionQuote->getOrder();
|
195 |
+
$incrementId = $parentOrder->getRelationChildRealId();
|
196 |
+
|
197 |
+
if($incrementId){
|
198 |
+
$order = Mage::getModel('sales/order')->load($incrementId, 'increment_id');
|
199 |
+
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
|
200 |
+
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
201 |
+
|
202 |
+
if ($paymentMethod == $saveCardsPaymentCode && $order) {
|
203 |
+
$orderId = $order->getId();
|
204 |
+
$grandTotal = $order->getGrandTotal();
|
205 |
+
$parentOrderGrandTotal = $parentOrder->getGrandTotal();
|
206 |
+
|
207 |
+
if($grandTotal > $parentOrderGrandTotal){
|
208 |
+
$checkOrderAmount = false;
|
209 |
+
$recalculcateGrandTotal = $grandTotal-$parentOrderGrandTotal;
|
210 |
+
$this->adminhtmlSendSaveCardsPaymentTransaction($orderId,$recalculcateGrandTotal,$checkOrderAmount);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Send transaction from the admin panel
|
218 |
+
* @param int $orderId
|
219 |
+
* @param float $grandTotal
|
220 |
+
* @param bool $checkOrderAmount
|
221 |
+
*/
|
222 |
+
protected function adminhtmlSendSaveCardsPaymentTransaction($orderId,$grandTotal,$checkOrderAmount = true)
|
223 |
+
{
|
224 |
+
$admSession = Mage::getSingleton('adminhtml/session');
|
225 |
+
$xpCreditCards = $admSession->getData('xp_payment_card');
|
226 |
+
|
227 |
+
$response = Mage::getModel('xpaymentsconnector/payment_cc')->sendAgainTransactionRequest($orderId, $xpCreditCards, $grandTotal);
|
228 |
+
if ($response['success']) {
|
229 |
+
Mage::getModel('xpaymentsconnector/payment_cc')->updateOrderByXpaymentResponse($orderId, $response['response']['transaction_id'],$checkOrderAmount);
|
230 |
+
} else {
|
231 |
+
Mage::getSingleton('adminhtml/session')->addError($response['error_message']);
|
232 |
+
}
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
public function predispatchAdminhtmlSalesOrderCreateSave($observer)
|
237 |
+
{
|
238 |
+
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
|
239 |
+
$paymentMethod = $quote->getPayment()->getMethodInstance()->getCode();
|
240 |
+
$prepaidpayments = Mage::getModel('xpaymentsconnector/payment_prepaidpayments')->getCode();
|
241 |
+
if ($paymentMethod == $prepaidpayments) {
|
242 |
+
$admSession = Mage::getSingleton('adminhtml/session');
|
243 |
+
$xpPrepaidPaymentsCard = $admSession->getData('xp_prepaid_payments');
|
244 |
+
$currentUserCard = Mage::getModel('xpaymentsconnector/usercards')->load($xpPrepaidPaymentsCard);
|
245 |
+
$grandTotal = $quote->getData('grand_total');
|
246 |
+
$cardAmount = $currentUserCard->getAmount();
|
247 |
+
if ($cardAmount < $grandTotal) {
|
248 |
+
$errorMessage = Mage::helper('xpaymentsconnector')
|
249 |
+
->__("You can't make an order using card (**%s) worth over %s",
|
250 |
+
$currentUserCard->getData('last_4_cc_num'),
|
251 |
+
Mage::helper('core')->currency($cardAmount));
|
252 |
+
$admSession->addError($errorMessage);
|
253 |
+
/*redirect to last page*/
|
254 |
+
Mage::app()->getResponse()->setRedirect($_SERVER['HTTP_REFERER']);
|
255 |
+
Mage::app()->getResponse()->sendResponse();
|
256 |
+
exit;
|
257 |
+
} else {
|
258 |
+
$cardBalance = $cardAmount - $grandTotal;
|
259 |
+
if ($cardBalance == 0) {
|
260 |
+
$currentUserCard->delete();
|
261 |
+
} else {
|
262 |
+
$currentUserCard->setAmount($cardBalance)->save();
|
263 |
+
}
|
264 |
+
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
public function adminhtmlSavePaymentCard()
|
270 |
+
{
|
271 |
+
$payment = Mage::app()->getRequest()->getPost('payment');
|
272 |
+
$saveCardsPaymentCode = Mage::getModel('xpaymentsconnector/payment_savedcards')->getCode();
|
273 |
+
$prepaidpayments = Mage::getModel('xpaymentsconnector/payment_prepaidpayments')->getCode();
|
274 |
+
|
275 |
+
if ($payment) {
|
276 |
+
if ($payment['method'] == $saveCardsPaymentCode) {
|
277 |
+
if ($payment['xp_payment_card']) {
|
278 |
+
$admSession = Mage::getSingleton('adminhtml/session');
|
279 |
+
$admSession->setData('xp_payment_card', $payment['xp_payment_card']);
|
280 |
+
}
|
281 |
+
} elseif ($payment['method'] == $prepaidpayments) {
|
282 |
+
if ($payment['xp_prepaid_payments']) {
|
283 |
+
$admSession = Mage::getSingleton('adminhtml/session');
|
284 |
+
$admSession->setData('xp_prepaid_payments', $payment['xp_prepaid_payments']);
|
285 |
+
}
|
286 |
+
}
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
public function unsetXpaymentSelectedCard()
|
291 |
+
{
|
292 |
+
$admSession = Mage::getSingleton('adminhtml/session');
|
293 |
+
$admSession->unsetData('xp_payment_card');
|
294 |
+
$admSession->unsetData('xp_prepaid_payments');
|
295 |
+
}
|
296 |
+
|
297 |
+
public function orderInvoiceSaveBefore($observer)
|
298 |
+
{
|
299 |
+
$invoice = $observer->getEvent()->getInvoice();
|
300 |
+
$order = $invoice->getOrder();
|
301 |
+
$paymentCode = $order->getPayment()->getMethodInstance()->getCode();
|
302 |
+
if (Mage::helper('xpaymentsconnector')->isXpaymentsMethod($paymentCode)) {
|
303 |
+
$txnid = $order->getData('xpc_txnid');
|
304 |
+
$invoice->setTransactionId($txnid);
|
305 |
+
}
|
306 |
+
}
|
307 |
+
|
308 |
+
public function invoiceVoid($observer)
|
309 |
+
{
|
310 |
+
$invoice = $observer->getInvoice();
|
311 |
+
$order = $invoice->getOrder();
|
312 |
+
$paymentCode = $order->getPayment()->getMethodInstance()->getCode();
|
313 |
+
if (Mage::helper('xpaymentsconnector')->isXpaymentsMethod($paymentCode)) {
|
314 |
+
$data = array(
|
315 |
+
'txnId' => $order->getData('xpc_txnid'),
|
316 |
+
'amount' => number_format($invoice->getGrandTotal(), 2, '.', ''),
|
317 |
+
);
|
318 |
+
Mage::getModel('xpaymentsconnector/payment_cc')->authorizedTransactionRequest('void', $data);
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
public function createOrdersByCustomerSubscriptions($observer)
|
323 |
+
{
|
324 |
+
$xpaymentsHelper = Mage::helper('xpaymentsconnector');
|
325 |
+
$recurringProfileList = Mage::getModel('sales/recurring_profile')
|
326 |
+
->getCollection()
|
327 |
+
->addFieldToFilter('state', array('neq' => Mage_Sales_Model_Recurring_Profile::STATE_CANCELED));
|
328 |
+
|
329 |
+
$userTransactionHasBeenSend = false;
|
330 |
+
if ($recurringProfileList->getSize() > 0) {
|
331 |
+
foreach ($recurringProfileList as $profile) {
|
332 |
+
$customerId = $profile->getCustomerId();
|
333 |
+
if($this->_current_customer_id != $customerId){
|
334 |
+
$this->_current_customer_id = $customerId;
|
335 |
+
$userTransactionHasBeenSend = false;
|
336 |
+
}
|
337 |
+
|
338 |
+
if(!$userTransactionHasBeenSend){
|
339 |
+
if ($profile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_PENDING) {
|
340 |
+
$cardData = $xpaymentsHelper->getProfileOrderCardData($profile);
|
341 |
+
$orderAmountData = $xpaymentsHelper->preparePayDeferredOrderAmountData($profile);
|
342 |
+
if(!empty($orderAmountData)){
|
343 |
+
$xpaymentsHelper->resendPayDeferredRecurringTransaction($profile, $orderAmountData, $cardData);
|
344 |
+
$userTransactionHasBeenSend = true;
|
345 |
+
continue;
|
346 |
+
}else{
|
347 |
+
$profile->activate();
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
if ($profile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE) {
|
352 |
+
$startDateTime = strtotime($profile->getStartDatetime());
|
353 |
+
$lastSuccessTransactionDate = strtotime($profile->getXpSuccessTransactionDate());
|
354 |
+
$lastActionDate = ($startDateTime > $lastSuccessTransactionDate) ? $startDateTime : $lastSuccessTransactionDate;
|
355 |
+
|
356 |
+
$profilePeriodValue = $xpaymentsHelper->getCurrentBillingPeriodTimeStamp($profile);
|
357 |
+
$newTransactionDate = $lastActionDate + $profilePeriodValue;
|
358 |
+
|
359 |
+
$currentDateObj = new Zend_Date(time());
|
360 |
+
$currentDateStamp = $currentDateObj->getTimestamp();
|
361 |
+
|
362 |
+
/*
|
363 |
+
var_dump('period_stamp ='.$profilePeriodValue / 3600 ."(h)",
|
364 |
+
"current = ".date("Y-m-d H:m:s",$currentDateStamp),
|
365 |
+
"start = ".date("Y-m-d H:m:s",$startDateTime),
|
366 |
+
"last = ".date("Y-m-d H:m:s",$lastActionDate),
|
367 |
+
"new = ".date("Y-m-d H:m:s",$newTransactionDate),
|
368 |
+
"profile_id = ".$profile->getProfileId());die;
|
369 |
+
*/
|
370 |
+
|
371 |
+
$timePassed = $currentDateStamp - $lastActionDate;
|
372 |
+
$currentSuccessCycles = $profile->getXpCountSuccessTransaction();
|
373 |
+
|
374 |
+
$isFirstRecurringProfileProcess = (($currentSuccessCycles == 0) && ($startDateTime < $currentDateStamp))
|
375 |
+
? true : false;
|
376 |
+
|
377 |
+
if (($timePassed >= $profilePeriodValue) || $isFirstRecurringProfileProcess) {
|
378 |
+
// check by count of success transaction
|
379 |
+
$periodMaxCycles = $profile->getPeriodMaxCycles();
|
380 |
+
|
381 |
+
if (($periodMaxCycles > $currentSuccessCycles) || is_null($periodMaxCycles)) {
|
382 |
+
$orderItemInfo = $profile->getData('order_item_info');
|
383 |
+
if (!is_array($orderItemInfo)) {
|
384 |
+
$orderItemInfo = unserialize($orderItemInfo);
|
385 |
+
}
|
386 |
+
|
387 |
+
$initialFeeAmount = $orderItemInfo['recurring_initial_fee'];
|
388 |
+
|
389 |
+
$isFirstRecurringOrder = false;
|
390 |
+
|
391 |
+
//calculate grand total
|
392 |
+
$billingAmount = $profile->getBillingAmount();
|
393 |
+
$shippingAmount = $profile->getShippingAmount();
|
394 |
+
$taxAmount = $profile->getTaxAmount();
|
395 |
+
|
396 |
+
$initialFeeTax = ($profile->getInitiaFeePaid()) ? 0 : 123;
|
397 |
+
// add discount for transaction amount
|
398 |
+
$useDiscount = ($profile->getXpCountSuccessTransaction() > 0) ? false : true;
|
399 |
+
$discountAmount = ($useDiscount) ? $orderItemInfo['discount_amount'] : 0;
|
400 |
+
|
401 |
+
$transactionAmount = $billingAmount + $shippingAmount + $taxAmount - $discountAmount ;
|
402 |
+
|
403 |
+
$orderId = $xpaymentsHelper->createOrder($profile,$isFirstRecurringOrder);
|
404 |
+
$cardData = $xpaymentsHelper->getProfileOrderCardData($profile);
|
405 |
+
|
406 |
+
$response = Mage::getModel('xpaymentsconnector/payment_cc')->sendAgainTransactionRequest($orderId, NULL, $transactionAmount , $cardData);
|
407 |
+
$userTransactionHasBeenSend = true;
|
408 |
+
if ($response['success']) {
|
409 |
+
$result = Mage::getModel('xpaymentsconnector/payment_cc')->updateOrderByXpaymentResponse($orderId, $response['response']['transaction_id']);
|
410 |
+
$xpaymentsHelper->updateCurrentBillingPeriodTimeStamp($profile, $result['success'], $newTransactionDate);
|
411 |
+
if (!$result['success']) {
|
412 |
+
Mage::log($result['error_message'], null, $xpaymentsHelper::XPAYMENTS_LOG_FILE, true);
|
413 |
+
}
|
414 |
+
|
415 |
+
} else {
|
416 |
+
$xpaymentsHelper->updateCurrentBillingPeriodTimeStamp($profile, $response['success'], $newTransactionDate);
|
417 |
+
Mage::log($response['error_message'], null, $xpaymentsHelper::XPAYMENTS_LOG_FILE, true);
|
418 |
+
}
|
419 |
+
|
420 |
+
} else {
|
421 |
+
// Subscription is completed
|
422 |
+
$profile->finished();
|
423 |
+
|
424 |
+
}
|
425 |
+
}
|
426 |
+
}
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Add redirect for buying recurring product by xpayments method(without iframe)
|
437 |
+
* @param $observer
|
438 |
+
*/
|
439 |
+
public function addRedirectForXpaymentMethod($observer)
|
440 |
+
{
|
441 |
+
$profiles = $observer->getData('recurring_profiles');
|
442 |
+
if (!empty($profiles)) {
|
443 |
+
$profile = current($profiles);
|
444 |
+
$currentPaymentMethodCode = $profile->getData('method_code');
|
445 |
+
$xpaymentPaymentCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
446 |
+
$useIframe = Mage::helper('xpaymentsconnector')->isUseIframe();
|
447 |
+
if (($currentPaymentMethodCode == $xpaymentPaymentCode) && !$useIframe) {
|
448 |
+
$redirectUrl = Mage::getUrl('xpaymentsconnector/processing/redirect', array('_secure' => true));
|
449 |
+
Mage::getSingleton('checkout/session')->setRedirectUrl($redirectUrl);
|
450 |
+
}
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Set discount for recurring product(for ajax cart item quantity update)
|
458 |
+
* Remove X-Payments token
|
459 |
+
* Update initial Fee for recurring product;
|
460 |
+
* @param $observer
|
461 |
+
*/
|
462 |
+
public function updateCartItem($observer)
|
463 |
+
{
|
464 |
+
$unsetParams = array('token');
|
465 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
466 |
+
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
467 |
+
|
468 |
+
//set recurring product discount
|
469 |
+
Mage::helper('xpaymentsconnector')->setRecurringProductDiscount();
|
470 |
+
|
471 |
+
// update InitAmount for recurring products
|
472 |
+
$cart = $observer->getCart('quote');
|
473 |
+
foreach ($cart->getAllVisibleItems() as $item){
|
474 |
+
$product = $item->getProduct();
|
475 |
+
if ((bool)$product->getIsRecurring()) {
|
476 |
+
$profile = Mage::getModel('payment/recurring_profile')
|
477 |
+
->setLocale(Mage::app()->getLocale())
|
478 |
+
->setStore(Mage::app()->getStore())
|
479 |
+
->importProduct($product);
|
480 |
+
if($profile->getInitAmount()){
|
481 |
+
// duplicate as 'additional_options' to render with the product statically
|
482 |
+
$infoOptions = array(array(
|
483 |
+
'label' => $profile->getFieldLabel('start_datetime'),
|
484 |
+
'value' => $profile->exportStartDatetime(true),
|
485 |
+
));
|
486 |
+
|
487 |
+
foreach ($profile->exportScheduleInfo($item) as $info) {
|
488 |
+
$infoOptions[] = array(
|
489 |
+
'label' => $info->getTitle(),
|
490 |
+
'value' => $info->getSchedule(),
|
491 |
+
);
|
492 |
+
}
|
493 |
+
|
494 |
+
$itemOptionModel = Mage::getModel('sales/quote_item_option')
|
495 |
+
->getCollection()
|
496 |
+
->addItemFilter($item->getId())
|
497 |
+
->addFieldToFilter('code','additional_options')
|
498 |
+
->addFieldToFilter('product_id',$product->getId())
|
499 |
+
->getFirstItem();
|
500 |
+
|
501 |
+
$itemOptionModel->setValue(serialize($infoOptions));
|
502 |
+
$itemOptionModel->save();
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
|
507 |
+
}
|
508 |
+
//
|
509 |
+
|
510 |
+
}
|
511 |
+
|
512 |
+
/**
|
513 |
+
* Remove X-Payments token;
|
514 |
+
* Update initial Fee for recurring product;
|
515 |
+
* @param $observer
|
516 |
+
*/
|
517 |
+
public function checkoutCartAdd($observer)
|
518 |
+
{
|
519 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
520 |
+
$unsetParams = array('token');
|
521 |
+
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* Remove X-Payments token and prepare order number.
|
526 |
+
* @param $observer
|
527 |
+
*/
|
528 |
+
public function postdispatchCartDelete($observer)
|
529 |
+
{
|
530 |
+
$unsetParams = array('token', 'prepare_order_id');
|
531 |
+
Mage::helper('xpaymentsconnector')->unsetXpaymentPrepareOrder($unsetParams);
|
532 |
+
}
|
533 |
+
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Set 'place_display' flag for feature x-payment form.
|
537 |
+
* @param $observer
|
538 |
+
*/
|
539 |
+
public function predispatchSaveShippingMethod()
|
540 |
+
{
|
541 |
+
Mage::helper('xpaymentsconnector')->setIframePlaceDisplaySettings();
|
542 |
+
}
|
543 |
+
|
544 |
+
/**
|
545 |
+
* Remove X-Payments token after update shipping method
|
546 |
+
* @param $observer
|
547 |
+
*/
|
548 |
+
public function postdispatchSaveShippingMethod($observer)
|
549 |
+
{
|
550 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
551 |
+
$isPaymentPlaceDisplayFlag = $xpHelper->isIframePaymentPlaceDisplay();
|
552 |
+
if (!$isPaymentPlaceDisplayFlag) {
|
553 |
+
$unsetParams = array('token');
|
554 |
+
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
public function postDispatchSavePayment($observer)
|
559 |
+
{
|
560 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
561 |
+
$paymentMethodCode = $quote->getPayment()->getMethodInstance()->getCode();
|
562 |
+
$xpaymentPaymentCode = Mage::getModel('xpaymentsconnector/payment_cc')->getCode();
|
563 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
564 |
+
|
565 |
+
if ($paymentMethodCode == $xpaymentPaymentCode) {
|
566 |
+
$saveCard = Mage::app()->getRequest()->getPost('savecard');
|
567 |
+
if ($saveCard) {
|
568 |
+
Mage::getSingleton('checkout/session')->setData('user_card_save', $saveCard);
|
569 |
+
}
|
570 |
+
} else {
|
571 |
+
Mage::getSingleton('checkout/session')->unsetData('user_card_save');
|
572 |
+
}
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Set discount for recurring product
|
577 |
+
* @param $observer
|
578 |
+
*/
|
579 |
+
public function preDispatchCartIndex($observer)
|
580 |
+
{
|
581 |
+
$unsetXpPrepareOrder = Mage::app()->getRequest()->getParam('unset_xp_prepare_order');
|
582 |
+
$xpHelper = Mage::helper('xpaymentsconnector');
|
583 |
+
if (isset($unsetXpPrepareOrder)) {
|
584 |
+
$unsetParams = array('token');
|
585 |
+
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
586 |
+
}
|
587 |
+
|
588 |
+
//set recurring product discount
|
589 |
+
$xpHelper->setRecurringProductDiscount();
|
590 |
+
|
591 |
+
}
|
592 |
+
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Send xp transaction from 'XP Order State tab'
|
596 |
+
* @param $observer
|
597 |
+
*/
|
598 |
+
public function adminhtmlSalesOrderView($observer){
|
599 |
+
$xpTransactionData = Mage::app()->getRequest()->getPost();
|
600 |
+
if(!empty($xpTransactionData)){
|
601 |
+
|
602 |
+
if(!empty($xpTransactionData)
|
603 |
+
&& isset($xpTransactionData['xpaction'])
|
604 |
+
&& isset($xpTransactionData['xpc_txnid'])
|
605 |
+
&& isset($xpTransactionData['transaction_amount'])
|
606 |
+
){
|
607 |
+
|
608 |
+
$xpaymentModel = Mage::getModel('xpaymentsconnector/payment_cc');
|
609 |
+
$data = array(
|
610 |
+
'txnId' => $xpTransactionData['xpc_txnid'],
|
611 |
+
'amount' => number_format($xpTransactionData['transaction_amount'], 2, '.', ''),
|
612 |
+
);
|
613 |
+
$result = array();
|
614 |
+
switch ($xpTransactionData['xpaction']) {
|
615 |
+
case 'refund':
|
616 |
+
$result = $xpaymentModel->authorizedTransactionRequest('refund', $data);
|
617 |
+
break;
|
618 |
+
case 'capture':
|
619 |
+
$result = $xpaymentModel->authorizedTransactionRequest('capture', $data);
|
620 |
+
break;
|
621 |
+
case 'void':
|
622 |
+
$result = $xpaymentModel->authorizedTransactionRequest('void', $data);
|
623 |
+
break;
|
624 |
+
}
|
625 |
+
|
626 |
+
if(empty($result['error_message'])){
|
627 |
+
$message = Mage::helper('xpaymentsconnector')->__("Transaction '%s' to order (%s) was successful!",
|
628 |
+
$xpTransactionData['xpaction'],
|
629 |
+
$xpTransactionData['orderid']);
|
630 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
631 |
+
} else{
|
632 |
+
Mage::getSingleton('adminhtml/session')->addError($result['error_message']);
|
633 |
+
}
|
634 |
+
|
635 |
+
}
|
636 |
+
}
|
637 |
+
}
|
638 |
+
|
639 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Cdev/XPaymentsConnector/Model/Payment/Cc.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -121,7 +122,14 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
121 |
const TRAN_TYPE_GET_INFO = 'getInfo';
|
122 |
const TRAN_TYPE_ACCEPT = 'accept';
|
123 |
const TRAN_TYPE_DECLINE = 'decline';
|
124 |
-
const XP_API = '1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
/**
|
127 |
* unique internal payment method identifier
|
@@ -201,19 +209,16 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
201 |
* Get redirect URL for order placing procedure
|
202 |
*
|
203 |
* @return string
|
204 |
-
* @access public
|
205 |
-
* @see ____func_see____
|
206 |
-
* @since 1.0.0
|
207 |
*/
|
208 |
-
public function getOrderPlaceRedirectUrl()
|
|
|
|
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
return Mage::getUrl('xpaymentsconnector/processing/redirect', array('_secure' => true));
|
213 |
-
}else{
|
214 |
-
return false;
|
215 |
}
|
216 |
|
|
|
217 |
}
|
218 |
|
219 |
|
@@ -322,23 +327,6 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
322 |
. '/payment.php';
|
323 |
}
|
324 |
|
325 |
-
/**
|
326 |
-
* Get redirect form fields list
|
327 |
-
*
|
328 |
-
* @return array
|
329 |
-
* @access public
|
330 |
-
* @see ____func_see____
|
331 |
-
* @since 1.0.0
|
332 |
-
*/
|
333 |
-
public function getFormFields()
|
334 |
-
{
|
335 |
-
return array(
|
336 |
-
'target' => 'main',
|
337 |
-
'action' => 'start',
|
338 |
-
'token' => Mage::getSingleton('checkout/session')->getData('xpayments_token'),
|
339 |
-
);
|
340 |
-
}
|
341 |
-
|
342 |
/**
|
343 |
* Get module configuration setting value
|
344 |
*
|
@@ -496,16 +484,14 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
496 |
{
|
497 |
$refId = $order->getIncrementId();
|
498 |
|
499 |
-
// Prepare cart
|
500 |
-
$cart = $this->prepareCart($order, $refId);
|
501 |
-
|
502 |
-
// save card data for x-payment 'callback approve' response
|
503 |
$quoteId = $order->getQuoteId();
|
504 |
$cartModel = Mage::getModel('sales/quote')->load($quoteId);
|
505 |
-
$cartModel->setData('xp_callback_approve',serialize($cart))->save();
|
506 |
|
507 |
$xpHelper = Mage::helper('xpaymentsconnector');
|
508 |
|
|
|
|
|
|
|
509 |
// Data to send to X-Payments
|
510 |
$data = array(
|
511 |
'confId' => intval($this->getPaymentConfiguration()->getData('confid')),
|
@@ -576,7 +562,19 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
576 |
}
|
577 |
|
578 |
list($status, $response) = $this->request('payment', $infoClass, $data);
|
579 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
|
581 |
if ($status) {
|
582 |
if (!is_array($response) || !isset($checkResponse['status'])) {
|
@@ -934,133 +932,12 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
934 |
}
|
935 |
}
|
936 |
|
937 |
-
/**
|
938 |
-
* Prepare cart for Handshake request
|
939 |
-
*
|
940 |
-
* @param Mage_Sales_Model_Order $order Order
|
941 |
-
* @param mixed $refId Unique reference id
|
942 |
-
*
|
943 |
-
* @return array
|
944 |
-
* @access protected
|
945 |
-
* @see ____func_see____
|
946 |
-
* @since 1.0.0
|
947 |
-
*/
|
948 |
-
protected function prepareCart(Mage_Sales_Model_Order $order, $refId)
|
949 |
-
{
|
950 |
-
$memail = explode(',', Mage::getStoreConfig($order::XML_PATH_EMAIL_COPY_TO, $this->getStoreId()));
|
951 |
-
$memail = array_shift($memail);
|
952 |
-
|
953 |
-
if (!$memail) {
|
954 |
-
$users = Mage::getModel('admin/user')->getCollection();
|
955 |
-
foreach ($users as $user) {
|
956 |
-
$memail = $user->getData('email');
|
957 |
-
break;
|
958 |
-
}
|
959 |
-
unset($users, $user);
|
960 |
-
}
|
961 |
-
|
962 |
-
$result = array(
|
963 |
-
'billingAddress' => array(
|
964 |
-
'email' => $order->getCustomerEmail(),
|
965 |
-
),
|
966 |
-
'shippingAddress' => array(
|
967 |
-
'email' => $order->getCustomerEmail(),
|
968 |
-
),
|
969 |
-
'items' => array(),
|
970 |
-
'currency' => $this->getCurrency($refId),
|
971 |
-
'shippingCost' => 0.00,
|
972 |
-
'taxCost' => 0.00,
|
973 |
-
'discount' => 0.00,
|
974 |
-
'totalCost' => 0.00,
|
975 |
-
'description' => 'Order #' . $refId,
|
976 |
-
'merchantEmail' => $memail,
|
977 |
-
'login' => $order->getCustomerEmail(),
|
978 |
-
);
|
979 |
-
|
980 |
-
if ($this->isForceAuth()) {
|
981 |
-
$result['forceTransactionType'] = 'A';
|
982 |
-
}
|
983 |
-
|
984 |
-
$namePrefixes = array(
|
985 |
-
'billing' => 'getBillingAddress',
|
986 |
-
'shipping' => 'getShippingAddress',
|
987 |
-
);
|
988 |
-
|
989 |
-
$addressFields = array(
|
990 |
-
'firstname' => 'firstname',
|
991 |
-
'lastname' => 'lastname',
|
992 |
-
'address' => 'street',
|
993 |
-
'city' => 'city',
|
994 |
-
'state' => 'region_id',
|
995 |
-
'country' => 'country_id',
|
996 |
-
'zipcode' => 'postcode',
|
997 |
-
'phone' => 'telephone',
|
998 |
-
'fax' => 'telephone',
|
999 |
-
);
|
1000 |
-
|
1001 |
-
// Prepare shipping and billing address
|
1002 |
-
foreach ($namePrefixes as $prefix => $mn) {
|
1003 |
-
|
1004 |
-
$addressIndex = $prefix . 'Address';
|
1005 |
-
$getter = $order->$mn();
|
1006 |
-
|
1007 |
-
if (!$getter && $prefix == 'shipping') {
|
1008 |
-
|
1009 |
-
// If shipping address is forbidden
|
1010 |
-
$getter = $order->getBillingAddress();
|
1011 |
-
}
|
1012 |
-
|
1013 |
-
foreach ($addressFields as $field => $fn) {
|
1014 |
-
$result[$addressIndex][$field] = $getter->getData($fn);
|
1015 |
-
|
1016 |
-
if ('region_id' == $fn) {
|
1017 |
-
$result[$addressIndex][$field] = Mage::getModel('directory/region')->load($result[$addressIndex][$field])->getCode();
|
1018 |
-
}
|
1019 |
-
|
1020 |
-
if (
|
1021 |
-
!$result[$addressIndex][$field]
|
1022 |
-
&& in_array($field, array('state', 'address', 'city','zipcode'))
|
1023 |
-
) {
|
1024 |
-
$result[$addressIndex][$field] = 'n/a';
|
1025 |
-
}
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
$result[$addressIndex]['name'] = trim(
|
1029 |
-
$getter->getData('firstname') . ' ' . $getter->getData('lastname')
|
1030 |
-
);
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
// Set products
|
1034 |
-
foreach ($order->getItemsCollection() as $product) {
|
1035 |
-
$result['items'][] = array(
|
1036 |
-
'sku' => $product->getData('sku'),
|
1037 |
-
'name' => $product->getData('name'),
|
1038 |
-
'price' => number_format($product->getPrice(), 2, '.',''),
|
1039 |
-
'quantity' => intval($product->getData('qty_ordered')),
|
1040 |
-
);
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
// Set costs
|
1044 |
-
$result['taxCost'] = number_format($order->getData('tax_amount'), 2, '.','');
|
1045 |
-
$result['discount'] = number_format(abs($order->getDiscountAmount()), 2, '.','');
|
1046 |
-
$result['shippingCost'] = number_format($order->getData('shipping_amount'), 2, '.','');
|
1047 |
-
$result['totalCost'] = number_format($order->getGrandTotal(), 2, '.','');
|
1048 |
-
|
1049 |
-
return $result;
|
1050 |
-
}
|
1051 |
-
|
1052 |
-
|
1053 |
/**
|
1054 |
* Get currency code
|
1055 |
*
|
1056 |
-
* @param mixed $refId Order increment id
|
1057 |
-
*
|
1058 |
* @return string
|
1059 |
-
* @access public
|
1060 |
-
* @see ____func_see____
|
1061 |
-
* @since 1.0.0
|
1062 |
*/
|
1063 |
-
public function getCurrency(
|
1064 |
{
|
1065 |
return strtoupper($this->getConfig('xpay_currency'));
|
1066 |
}
|
@@ -1338,7 +1215,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
1338 |
protected function getPaymentConfiguration()
|
1339 |
{
|
1340 |
return Mage::getModel('xpaymentsconnector/paymentconfiguration')
|
1341 |
-
|
1342 |
}
|
1343 |
|
1344 |
/**
|
@@ -1359,6 +1236,22 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
1359 |
&& parent::isAvailable($quote);
|
1360 |
}
|
1361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1362 |
/**
|
1363 |
* Send Handshake request
|
1364 |
*
|
@@ -1375,88 +1268,176 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
1375 |
*
|
1376 |
* @return array
|
1377 |
*/
|
1378 |
-
public function sendIframeHandshakeRequest($
|
1379 |
{
|
1380 |
-
$
|
1381 |
-
$xPaymentDataResponse['success'] = true;
|
1382 |
|
1383 |
-
|
1384 |
|
|
|
1385 |
|
1386 |
-
|
1387 |
-
|
1388 |
|
1389 |
-
|
1390 |
-
$result = array();
|
1391 |
-
$cart = array();
|
1392 |
|
1393 |
-
if(Mage::getSingleton('customer/session')->isLoggedIn()){
|
1394 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
1395 |
-
$cart = $this->iframePrepareCart($checkoutData, $customer,$isCardAuthorizePayment);
|
1396 |
-
}else {
|
1397 |
-
$cart = $this->iframePrepareCart($checkoutData, false, $isCardAuthorizePayment);
|
1398 |
-
}
|
1399 |
-
|
1400 |
-
$currentCart = Mage::getModel('checkout/cart')->getQuote();
|
1401 |
-
$quoteId = $currentCart->getEntityId();
|
1402 |
-
if ($isCardAuthorizePayment) {
|
1403 |
-
$customerSession = Mage::getSingleton('customer/session')->getCustomer();
|
1404 |
-
$customerSession->setData("xp_buffer",serialize($cart))->save();
|
1405 |
} else {
|
1406 |
-
|
1407 |
-
$
|
1408 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1409 |
}
|
1410 |
|
1411 |
// Data to send to X-Payments
|
1412 |
-
$
|
1413 |
'confId' => intval($this->getPaymentConfiguration()->getData('confid')),
|
1414 |
'refId' => $refId,
|
1415 |
-
'cart' => $
|
1416 |
-
'returnUrl' =>
|
1417 |
-
|
1418 |
-
'callbackUrl' => Mage::getUrl('xpaymentsconnector/processing/callback',
|
1419 |
-
array('order_refid' => $refId,'quote_id' => $quoteId,'_secure' => true)),
|
1420 |
);
|
1421 |
|
1422 |
-
|
1423 |
-
$sendData[$sendDataKey] = $updateSendData[$sendDataKey];
|
1424 |
-
}
|
1425 |
-
|
1426 |
-
list($status, $response) = $this->request('payment', 'init', $sendData);
|
1427 |
|
|
|
|
|
1428 |
|
1429 |
-
|
1430 |
-
$
|
|
|
|
|
|
|
|
|
1431 |
|
|
|
|
|
|
|
|
|
|
|
1432 |
|
1433 |
-
|
1434 |
|
|
|
|
|
|
|
1435 |
|
1436 |
-
|
1437 |
-
|
1438 |
-
$errorMessage = $xpHelper->__('Transaction token can not be found or has wrong type. ');
|
1439 |
-
if (isset($response['error_message']) && !empty($response['error_message'])) {
|
1440 |
-
$errorMessage .= $xpHelper->__('X-Payments response was - %s. ', $response['error_message']);
|
1441 |
}
|
1442 |
|
1443 |
-
if (
|
1444 |
-
$
|
1445 |
}
|
|
|
|
|
|
|
1446 |
$this->getAPIError($errorMessage);
|
1447 |
|
1448 |
$result['error_message'] = $errorMessage;
|
1449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1450 |
}
|
1451 |
|
|
|
|
|
1452 |
|
1453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
|
1455 |
-
if
|
1456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1457 |
}
|
1458 |
|
1459 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1460 |
}
|
1461 |
|
1462 |
public function sendAgainTransactionRequest($order_id = NULL,$paymentCardNumber = NULL,$grandTotal = NULL, $cardData = NULL){
|
@@ -1542,223 +1523,6 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
1542 |
|
1543 |
}
|
1544 |
|
1545 |
-
/**
|
1546 |
-
* Prepare cart for Handshake request
|
1547 |
-
*
|
1548 |
-
* @param Mage_Sales_Model_Order $order Order
|
1549 |
-
* @param mixed $refId Unique reference id
|
1550 |
-
*
|
1551 |
-
* @return array
|
1552 |
-
* @access protected
|
1553 |
-
* @see ____func_see____
|
1554 |
-
* @since 1.0.0
|
1555 |
-
*/
|
1556 |
-
protected function iframePrepareCart($checkoutData,$customer,$isCardAuthorizePayment = false)
|
1557 |
-
{
|
1558 |
-
$xpHelper = Mage::helper('xpaymentsconnector');
|
1559 |
-
$refId = $xpHelper->getOrderKey();
|
1560 |
-
$customerEmail = '';
|
1561 |
-
|
1562 |
-
$billingAddress = ($isCardAuthorizePayment) ? $customer->getDefaultBillingAddress()
|
1563 |
-
: $checkoutData->getQuote()->getBillingAddress();
|
1564 |
-
$shippingAddress = ($isCardAuthorizePayment) ? $customer->getDefaultShippingAddress()
|
1565 |
-
: $checkoutData->getQuote()->getShippingAddress();
|
1566 |
-
$quote = $checkoutData->getQuote();
|
1567 |
-
$result = array();
|
1568 |
-
/*initial fee check*/
|
1569 |
-
$issetRecurringProduct = $xpHelper->checkIssetRecurringOrder();
|
1570 |
-
|
1571 |
-
$minimalPayment = false;
|
1572 |
-
|
1573 |
-
$quote->collectTotals();
|
1574 |
-
$totals = $quote->getTotals(); //Total object
|
1575 |
-
|
1576 |
-
$totalCost = 0;
|
1577 |
-
$discount = 0;
|
1578 |
-
$tax = 0;
|
1579 |
-
$shipping = 0;
|
1580 |
-
$description = 'Order(i-frame) #' . $refId;
|
1581 |
-
$currentProduct = false;
|
1582 |
-
$recurringProfile = false;
|
1583 |
-
$issetSimpleProducts = $xpHelper->checkIssetSimpleOrder();
|
1584 |
-
|
1585 |
-
if ($issetRecurringProduct['isset'] && !$issetSimpleProducts) {
|
1586 |
-
$currentProduct = $issetRecurringProduct['quote_item']->getProduct();
|
1587 |
-
$quoteItem = $quote->getItemByProduct($currentProduct);
|
1588 |
-
$useStartDateParams = $xpHelper->checkStartDateDataByProduct($currentProduct,$quoteItem);
|
1589 |
-
$recurringProfile = $currentProduct->getRecurringProfile();
|
1590 |
-
if ($useStartDateParams[$currentProduct->getId()]['success']) {
|
1591 |
-
$minimalPayment = $useStartDateParams[$currentProduct->getId()]['minimal_payment_amount'];
|
1592 |
-
$tax = 0;
|
1593 |
-
if(!empty($recurringProfile['init_amount'])){
|
1594 |
-
$tax = $issetRecurringProduct['quote_item']->getData('initialfee_tax_amount');
|
1595 |
-
}
|
1596 |
-
|
1597 |
-
$totalCost = $minimalPayment + $tax;
|
1598 |
-
} else {
|
1599 |
-
$initialFeeAmount = $issetRecurringProduct['quote_item']->getData('initialfee_tax_amount');
|
1600 |
-
$mainTax = $issetRecurringProduct['quote_item']->getData('tax_amount');
|
1601 |
-
$tax = $mainTax + $initialFeeAmount;
|
1602 |
-
|
1603 |
-
$shipping = $issetRecurringProduct['quote_item']->getData('shipping_amount');
|
1604 |
-
$totalCost = $issetRecurringProduct['quote_item']->getData('nominal_row_total');
|
1605 |
-
$discount = abs($issetRecurringProduct['quote_item']->getData('discount_amount'));
|
1606 |
-
|
1607 |
-
}
|
1608 |
-
|
1609 |
-
} elseif ($isCardAuthorizePayment) {
|
1610 |
-
|
1611 |
-
$totalCost = floatval(Mage::getStoreConfig('xpaymentsconnector/settings/xpay_minimum_payment_recurring_amount'));
|
1612 |
-
|
1613 |
-
} else {
|
1614 |
-
|
1615 |
-
if (isset($totals['discount']) && $totals['discount']->getValue()) {
|
1616 |
-
$discount = abs($totals['discount']->getValue());
|
1617 |
-
}
|
1618 |
-
if(isset($totals['tax']) && $totals['tax']->getValue()) {
|
1619 |
-
$tax = $totals['tax']->getValue();
|
1620 |
-
}
|
1621 |
-
if(isset($totals['shipping']) && $totals['shipping']->getValue()) {
|
1622 |
-
$shipping = $totals['shipping']->getValue();
|
1623 |
-
}
|
1624 |
-
|
1625 |
-
// Set costs
|
1626 |
-
$totalCost = $quote->getGrandTotal();
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
if(!$customer){
|
1630 |
-
$customerEmail = $billingAddress->getEmail();
|
1631 |
-
} else{
|
1632 |
-
$customerEmail = $customer->getEmail();
|
1633 |
-
}
|
1634 |
-
|
1635 |
-
$result['billingAddress'] = array(
|
1636 |
-
'email' => $customerEmail,
|
1637 |
-
);
|
1638 |
-
$result['shippingAddress'] = array(
|
1639 |
-
'email' => $customerEmail,
|
1640 |
-
);
|
1641 |
-
$result['items'] = array();
|
1642 |
-
$result['currency'] = $this->getCurrency();
|
1643 |
-
$result['description'] = $description;
|
1644 |
-
|
1645 |
-
$result['totalCost'] = number_format($totalCost, 2, '.', '');
|
1646 |
-
$result['shippingCost'] = number_format($shipping, 2, '.', '');
|
1647 |
-
$result['taxCost'] = number_format($tax, 2, '.', '');
|
1648 |
-
$result['discount'] = number_format($discount, 2, '.', '');
|
1649 |
-
|
1650 |
-
$result['merchantEmail'] = $customerEmail;
|
1651 |
-
|
1652 |
-
if ($this->isForceAuth()) {
|
1653 |
-
$result['forceTransactionType'] = 'A';
|
1654 |
-
}
|
1655 |
-
|
1656 |
-
$result['login'] = $customerEmail;
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
$namePrefixes = array(
|
1661 |
-
'billing' => $billingAddress,
|
1662 |
-
'shipping' => $shippingAddress,
|
1663 |
-
);
|
1664 |
-
|
1665 |
-
$addressFields = array(
|
1666 |
-
'firstname' => 'firstname',
|
1667 |
-
'lastname' => 'lastname',
|
1668 |
-
'address' => 'street',
|
1669 |
-
'city' => 'city',
|
1670 |
-
'state' => 'region_id',
|
1671 |
-
'country' => 'country_id',
|
1672 |
-
'zipcode' => 'postcode',
|
1673 |
-
'phone' => 'telephone',
|
1674 |
-
'fax' => 'telephone',
|
1675 |
-
);
|
1676 |
-
|
1677 |
-
|
1678 |
-
// Prepare shipping and billing address
|
1679 |
-
$shippingIsEmpty = true;
|
1680 |
-
foreach ($namePrefixes as $prefix => $data) {
|
1681 |
-
|
1682 |
-
$addressIndex = $prefix . 'Address';
|
1683 |
-
foreach ($addressFields as $field => $fn) {
|
1684 |
-
$result[$addressIndex][$field] = ($data) ? $data->getData($fn) : $data;
|
1685 |
-
if(($field == 'firstname' || $field == 'lastname') && $isCardAuthorizePayment){
|
1686 |
-
$result[$addressIndex][$field] = $customer->getData($field);
|
1687 |
-
}
|
1688 |
-
if(($prefix == 'shipping') && $result[$addressIndex][$field]){
|
1689 |
-
$shippingIsEmpty = false;
|
1690 |
-
}
|
1691 |
-
|
1692 |
-
if ('region_id' == $fn) {
|
1693 |
-
$result[$addressIndex][$field] = Mage::getModel('directory/region')->load($result[$addressIndex][$field])->getCode();
|
1694 |
-
}
|
1695 |
-
|
1696 |
-
if (!$result[$addressIndex][$field] /*&& in_array($field, array('state', 'address', 'city','zipcode'))*/)
|
1697 |
-
{
|
1698 |
-
$result[$addressIndex][$field] = 'n/a';
|
1699 |
-
}
|
1700 |
-
}
|
1701 |
-
if($data){
|
1702 |
-
$result[$addressIndex]['name'] = trim(
|
1703 |
-
$data->getData('firstname') . ' ' . $data->getData('lastname')
|
1704 |
-
);
|
1705 |
-
}
|
1706 |
-
}
|
1707 |
-
|
1708 |
-
if($shippingIsEmpty){
|
1709 |
-
$result['shippingAddress'] = $result['billingAddress'];
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
$cartItems = $quote->getAllVisibleItems();
|
1713 |
-
|
1714 |
-
// Set products
|
1715 |
-
if ($issetRecurringProduct['isset'] && !$issetSimpleProducts) {
|
1716 |
-
if($currentProduct){
|
1717 |
-
$quantity = $issetRecurringProduct['quote_item']->getQty();
|
1718 |
-
$recurringPrice = $currentProduct->getPrice();
|
1719 |
-
if(!empty($recurringProfile['init_amount'])){
|
1720 |
-
$xpRecurringInitialFee = $issetRecurringProduct['quote_item']->getXpRecurringInitialFee();
|
1721 |
-
$recurringPrice += $xpRecurringInitialFee/$quantity;
|
1722 |
-
}
|
1723 |
-
|
1724 |
-
$price = ($minimalPayment) ? $minimalPayment/$quantity : $recurringPrice;
|
1725 |
-
$result['items'][] = array(
|
1726 |
-
'sku' => $currentProduct->getData('sku'),
|
1727 |
-
'name' => $currentProduct->getData('name'),
|
1728 |
-
'price' => number_format($price, 2, '.',''),
|
1729 |
-
'quantity' => intval($quantity),
|
1730 |
-
);
|
1731 |
-
}
|
1732 |
-
}else{
|
1733 |
-
foreach ($cartItems as $item) {
|
1734 |
-
if(!$item->getIsNominal()){
|
1735 |
-
$productId = $item->getProductId();
|
1736 |
-
$product = Mage::getModel('catalog/product')->load($productId);
|
1737 |
-
$price = $product->getPrice();
|
1738 |
-
$quantity = $item->getQty();
|
1739 |
-
|
1740 |
-
$result['items'][] = array(
|
1741 |
-
'sku' => $product->getData('sku'),
|
1742 |
-
'name' => $product->getData('name'),
|
1743 |
-
'price' => number_format($price, 2, '.',''),
|
1744 |
-
'quantity' => intval($quantity),
|
1745 |
-
);
|
1746 |
-
}
|
1747 |
-
}
|
1748 |
-
}
|
1749 |
-
|
1750 |
-
if($isCardAuthorizePayment){
|
1751 |
-
$result['items'][] = array(
|
1752 |
-
'sku' => '000000',
|
1753 |
-
'name' => 'Card Authorize',
|
1754 |
-
'price' => number_format($totalCost, 2, '.',''),
|
1755 |
-
'quantity' => intval(1),
|
1756 |
-
);
|
1757 |
-
}
|
1758 |
-
|
1759 |
-
return $result;
|
1760 |
-
}
|
1761 |
-
|
1762 |
/**
|
1763 |
* Update order data by xpayment response data
|
1764 |
* @param int $orderId
|
@@ -1824,7 +1588,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
1824 |
(bool)$order->getPayment()->getMethodInstance()->getConfigData('order_status'),
|
1825 |
$xpaymentsHelper->__('preauthorize: Customer returned successfully')
|
1826 |
);
|
1827 |
-
$order->setStatus(Cdev_XPaymentsConnector_Helper_Data::
|
1828 |
}else{
|
1829 |
$order->setState(
|
1830 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
@@ -2020,7 +1784,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
|
|
2020 |
//add txnid for all subscriptions
|
2021 |
$cardData = $xpHelper->getXpCardData();
|
2022 |
|
2023 |
-
$useIframe = Mage::
|
2024 |
|
2025 |
if (!$xpHelper->checkIssetSimpleOrder()) {
|
2026 |
if ($useIframe) {
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
122 |
const TRAN_TYPE_GET_INFO = 'getInfo';
|
123 |
const TRAN_TYPE_ACCEPT = 'accept';
|
124 |
const TRAN_TYPE_DECLINE = 'decline';
|
125 |
+
const XP_API = '1.6';
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Show or not save card checkbox statuses
|
129 |
+
*/
|
130 |
+
const SAVE_CARD_DISABLED = 'N';
|
131 |
+
const SAVE_CARD_REQUIRED = 'Y';
|
132 |
+
const SAVE_CARD_OPTIONAL = 'O';
|
133 |
|
134 |
/**
|
135 |
* unique internal payment method identifier
|
209 |
* Get redirect URL for order placing procedure
|
210 |
*
|
211 |
* @return string
|
|
|
|
|
|
|
212 |
*/
|
213 |
+
public function getOrderPlaceRedirectUrl()
|
214 |
+
{
|
215 |
+
$result = false;
|
216 |
|
217 |
+
if (!Mage::helper('xpaymentsconnector')->isUseIframe()) {
|
218 |
+
$result = Mage::getUrl('xpaymentsconnector/processing/redirect', array('_secure' => true));
|
|
|
|
|
|
|
219 |
}
|
220 |
|
221 |
+
return $result;
|
222 |
}
|
223 |
|
224 |
|
327 |
. '/payment.php';
|
328 |
}
|
329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
/**
|
331 |
* Get module configuration setting value
|
332 |
*
|
484 |
{
|
485 |
$refId = $order->getIncrementId();
|
486 |
|
|
|
|
|
|
|
|
|
487 |
$quoteId = $order->getQuoteId();
|
488 |
$cartModel = Mage::getModel('sales/quote')->load($quoteId);
|
|
|
489 |
|
490 |
$xpHelper = Mage::helper('xpaymentsconnector');
|
491 |
|
492 |
+
// Prepare cart
|
493 |
+
$cart = $xpHelper->prepareCart($cartModel);
|
494 |
+
|
495 |
// Data to send to X-Payments
|
496 |
$data = array(
|
497 |
'confId' => intval($this->getPaymentConfiguration()->getData('confid')),
|
562 |
}
|
563 |
|
564 |
list($status, $response) = $this->request('payment', $infoClass, $data);
|
565 |
+
|
566 |
+
if (!$withAdditionalInfo) {
|
567 |
+
|
568 |
+
$checkResponse = $response;
|
569 |
+
|
570 |
+
} elseif (!empty($response['payment'])) {
|
571 |
+
|
572 |
+
$checkResponse = $response['payment'];
|
573 |
+
|
574 |
+
} else {
|
575 |
+
|
576 |
+
$checkResponse = array();
|
577 |
+
}
|
578 |
|
579 |
if ($status) {
|
580 |
if (!is_array($response) || !isset($checkResponse['status'])) {
|
932 |
}
|
933 |
}
|
934 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
935 |
/**
|
936 |
* Get currency code
|
937 |
*
|
|
|
|
|
938 |
* @return string
|
|
|
|
|
|
|
939 |
*/
|
940 |
+
public function getCurrency()
|
941 |
{
|
942 |
return strtoupper($this->getConfig('xpay_currency'));
|
943 |
}
|
1215 |
protected function getPaymentConfiguration()
|
1216 |
{
|
1217 |
return Mage::getModel('xpaymentsconnector/paymentconfiguration')
|
1218 |
+
->load($this->getConfigData('confid'));
|
1219 |
}
|
1220 |
|
1221 |
/**
|
1236 |
&& parent::isAvailable($quote);
|
1237 |
}
|
1238 |
|
1239 |
+
/**
|
1240 |
+
* Get temporary reference ID
|
1241 |
+
*
|
1242 |
+
* @param mixed $entity Quote or customer
|
1243 |
+
*
|
1244 |
+
* @return string
|
1245 |
+
*/
|
1246 |
+
protected function getTmpRefId($entity)
|
1247 |
+
{
|
1248 |
+
$ref = $entity->getId() . Mage::getModel('core/date')->date('U');
|
1249 |
+
$ref = substr(md5($ref), 0, 8);
|
1250 |
+
$ref = $entity->getId() . '_' . $ref;
|
1251 |
+
|
1252 |
+
return $ref;
|
1253 |
+
}
|
1254 |
+
|
1255 |
/**
|
1256 |
* Send Handshake request
|
1257 |
*
|
1268 |
*
|
1269 |
* @return array
|
1270 |
*/
|
1271 |
+
public function sendIframeHandshakeRequest($zeroAuth = false)
|
1272 |
{
|
1273 |
+
$helper = Mage::helper('xpaymentsconnector');
|
|
|
1274 |
|
1275 |
+
if ($zeroAuth) {
|
1276 |
|
1277 |
+
$refId = 'authorization';
|
1278 |
|
1279 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
1280 |
+
$entityId = $customer->getId();
|
1281 |
|
1282 |
+
$preparedCart = $helper->prepareFakeCart($customer);
|
|
|
|
|
1283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1284 |
} else {
|
1285 |
+
|
1286 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
1287 |
+
$quote = $checkoutSession->getQuote();
|
1288 |
+
$entityId = $quote->getEntityId();
|
1289 |
+
|
1290 |
+
$preparedCart = $helper->prepareCart($quote);
|
1291 |
+
|
1292 |
+
$refId = $this->getTmpRefId($quote);
|
1293 |
}
|
1294 |
|
1295 |
// Data to send to X-Payments
|
1296 |
+
$data = array(
|
1297 |
'confId' => intval($this->getPaymentConfiguration()->getData('confid')),
|
1298 |
'refId' => $refId,
|
1299 |
+
'cart' => $preparedCart,
|
1300 |
+
'returnUrl' => $helper->getReturnUrl($refId, $entityId, $zeroAuth),
|
1301 |
+
'callbackUrl' => $helper->getCallbackUrl($refId, $entityId, $zeroAuth),
|
|
|
|
|
1302 |
);
|
1303 |
|
1304 |
+
list($status, $response) = $this->request('payment', 'init', $data);
|
|
|
|
|
|
|
|
|
1305 |
|
1306 |
+
$helper->writeLog('Payment initialization request', $data);
|
1307 |
+
$helper->writeLog('Payment initialization response', $response);
|
1308 |
|
1309 |
+
// Result transport array
|
1310 |
+
$result = array(
|
1311 |
+
'order_refid' => $refId,
|
1312 |
+
'status' => $status,
|
1313 |
+
'response' => $response,
|
1314 |
+
);
|
1315 |
|
1316 |
+
if (
|
1317 |
+
!$status
|
1318 |
+
|| empty($response['token'])
|
1319 |
+
|| !is_string($response['token'])
|
1320 |
+
) {
|
1321 |
|
1322 |
+
$result['success'] = false;
|
1323 |
|
1324 |
+
$error = array(
|
1325 |
+
$helper->__('Transaction token can not be found or has wrong type.')
|
1326 |
+
);
|
1327 |
|
1328 |
+
if (!empty($response['error_message'])) {
|
1329 |
+
$error[] = $helper->__('X-Payments response was - %s.', $response['error_message']);
|
|
|
|
|
|
|
1330 |
}
|
1331 |
|
1332 |
+
if (!empty($response['error'])) {
|
1333 |
+
$error[] = $helper->__('(error: %s)', $response['error']);
|
1334 |
}
|
1335 |
+
|
1336 |
+
$errorMessage = implode(' ', $error);
|
1337 |
+
|
1338 |
$this->getAPIError($errorMessage);
|
1339 |
|
1340 |
$result['error_message'] = $errorMessage;
|
1341 |
+
|
1342 |
+
} else {
|
1343 |
+
|
1344 |
+
$result['success'] = true;
|
1345 |
+
|
1346 |
+
if (!$zeroAuth) {
|
1347 |
+
|
1348 |
+
$xpcData = array(
|
1349 |
+
'txnId' => $response['txnId'],
|
1350 |
+
'token' => $response['token'],
|
1351 |
+
);
|
1352 |
+
|
1353 |
+
$helper->saveQuoteXpcData($quote, $xpcData);
|
1354 |
+
}
|
1355 |
}
|
1356 |
|
1357 |
+
return $result;
|
1358 |
+
}
|
1359 |
|
1360 |
+
/**
|
1361 |
+
* Checks if Save Card checkbox must be forced to be Required
|
1362 |
+
*
|
1363 |
+
* @return string
|
1364 |
+
*/
|
1365 |
+
protected function getAllowSaveCard()
|
1366 |
+
{
|
1367 |
+
// Check if save card feature is available for customer
|
1368 |
+
$showToUser = Mage::helper('xpaymentsconnector')->isRegisteredUser()
|
1369 |
+
&& Mage::getStoreConfig('payment/savedcards/active');
|
1370 |
|
1371 |
+
// Check if recurring product is purchased
|
1372 |
+
$isRecuringProduct = Mage::helper('xpaymentsconnector')->checkIssetRecurringOrder();
|
1373 |
+
$isRecuringProduct = (bool)$isRecuringProduct['isset'];
|
1374 |
+
|
1375 |
+
if ($showToUser) {
|
1376 |
+
|
1377 |
+
$allowSaveCard = $isRecuringProduct
|
1378 |
+
? static::SAVE_CARD_REQUIRED
|
1379 |
+
: static::SAVE_CARD_OPTIONAL;
|
1380 |
+
|
1381 |
+
} else {
|
1382 |
+
|
1383 |
+
$allowSaveCard = static::SAVE_CARD_DISABLED;
|
1384 |
}
|
1385 |
|
1386 |
+
return $allowSaveCard;
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
/**
|
1390 |
+
* Prepare payment initialization token. From session, or from X-Payments
|
1391 |
+
*
|
1392 |
+
* @return void
|
1393 |
+
*/
|
1394 |
+
protected function prepareToken($zeroAuth = false)
|
1395 |
+
{
|
1396 |
+
$helper = Mage::helper('xpaymentsconnector');
|
1397 |
+
|
1398 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
1399 |
+
|
1400 |
+
if (!$helper->getQuoteXpcDataToken($quote)) {
|
1401 |
+
// This saves token in the quote model
|
1402 |
+
$data = $this->sendIframeHandshakeRequest();
|
1403 |
+
}
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
/**
|
1407 |
+
* Check if payment initialization token is valid.
|
1408 |
+
*
|
1409 |
+
* @return bool
|
1410 |
+
*/
|
1411 |
+
public function checkToken()
|
1412 |
+
{
|
1413 |
+
$this->prepareToken();
|
1414 |
+
|
1415 |
+
$helper = Mage::helper('xpaymentsconnector');
|
1416 |
+
|
1417 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
1418 |
+
|
1419 |
+
return (bool)$helper->getQuoteXpcDataToken($quote);
|
1420 |
+
}
|
1421 |
+
|
1422 |
+
/**
|
1423 |
+
* Fields for form redirecting to the payment page
|
1424 |
+
*
|
1425 |
+
* @return array
|
1426 |
+
*/
|
1427 |
+
public function getFormFields()
|
1428 |
+
{
|
1429 |
+
$helper = Mage::helper('xpaymentsconnector');
|
1430 |
+
|
1431 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
1432 |
+
|
1433 |
+
$token = $helper->getQuoteXpcDataToken($quote);
|
1434 |
+
|
1435 |
+
return array(
|
1436 |
+
'target' => 'main',
|
1437 |
+
'action' => 'start',
|
1438 |
+
'token' => $token,
|
1439 |
+
'allow_save_card' => $this->getAllowSaveCard(),
|
1440 |
+
);
|
1441 |
}
|
1442 |
|
1443 |
public function sendAgainTransactionRequest($order_id = NULL,$paymentCardNumber = NULL,$grandTotal = NULL, $cardData = NULL){
|
1523 |
|
1524 |
}
|
1525 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1526 |
/**
|
1527 |
* Update order data by xpayment response data
|
1528 |
* @param int $orderId
|
1588 |
(bool)$order->getPayment()->getMethodInstance()->getConfigData('order_status'),
|
1589 |
$xpaymentsHelper->__('preauthorize: Customer returned successfully')
|
1590 |
);
|
1591 |
+
$order->setStatus(Cdev_XPaymentsConnector_Helper_Data::STATE_XPAYMENTS_PENDING_PAYMENT);
|
1592 |
}else{
|
1593 |
$order->setState(
|
1594 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
1784 |
//add txnid for all subscriptions
|
1785 |
$cardData = $xpHelper->getXpCardData();
|
1786 |
|
1787 |
+
$useIframe = Mage::helper('xpaymentsconnector')->isUseIframe();
|
1788 |
|
1789 |
if (!$xpHelper->checkIssetSimpleOrder()) {
|
1790 |
if ($useIframe) {
|
app/code/community/Cdev/XPaymentsConnector/Model/Payment/Prepaidpayments.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Payment/Recurring/Profile.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
*
|
21 |
* @category Mage
|
22 |
* @package Mage_Payment
|
23 |
-
* @copyright
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
20 |
*
|
21 |
* @category Mage
|
22 |
* @package Mage_Payment
|
23 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Payment/Savedcards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Paymentconfiguration.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Quote.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal/Recurring/Discount.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal/Recurring/Initialfee/Tax.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Sales/Recurring/Profile.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Source/Paymentconfiguration.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/Model/Usercards.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/CustomerController.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/Sales/Order/FraudController.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/controllers/ControlController.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/controllers/CustomerController.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -47,31 +48,50 @@ class Cdev_XPaymentsConnector_CustomerController extends Mage_Core_Controller_Fr
|
|
47 |
public function usercardsAction()
|
48 |
{
|
49 |
$request = $this->getRequest()->getPost();
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
-
|
68 |
-
|
69 |
-
$
|
70 |
-
Mage::getSingleton("customer/session")->addSuccess($message);
|
71 |
-
} else {
|
72 |
-
$message = $this->__('You have not selected any credit card.');
|
73 |
-
Mage::getSingleton("customer/session")->addError($message);
|
74 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
}
|
77 |
|
@@ -133,13 +153,9 @@ class Cdev_XPaymentsConnector_CustomerController extends Mage_Core_Controller_Fr
|
|
133 |
Mage::getSingleton('customer/session')->addError($errorMessage);
|
134 |
$resultMessage = 'Card authorization has been cancelled.';
|
135 |
}else{
|
136 |
-
$cardData = unserialize($customer->getData('xp_buffer'));
|
137 |
-
// save user card
|
138 |
-
Mage::getSingleton('checkout/session')->setData('user_card_save',true);
|
139 |
-
$newCardData = $CCPaymentModel->saveUserCard($cardData);
|
140 |
$resultMessage = $this->__('Payment card has been added successfully!');
|
141 |
|
142 |
-
Mage::getSingleton('customer/session')->addSuccess( $this->__("You created card
|
143 |
}
|
144 |
|
145 |
$this->getResponse()->setBody(
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
48 |
public function usercardsAction()
|
49 |
{
|
50 |
$request = $this->getRequest()->getPost();
|
51 |
+
|
52 |
+
if (
|
53 |
+
!empty($request)
|
54 |
+
&& !empty($request['action'])
|
55 |
+
&& 'remove' == $request['action']
|
56 |
+
) {
|
57 |
+
if (
|
58 |
+
isset($request['card'])
|
59 |
+
&& count($request['card']) > 0
|
60 |
+
) {
|
61 |
+
|
62 |
+
$itemCollection = Mage::getModel('xpaymentsconnector/usercards')
|
63 |
+
->getCollection()
|
64 |
+
->addFieldToFilter('xp_card_id', array('in' => $request['card']));
|
65 |
+
|
66 |
+
foreach ($itemCollection as $item) {
|
67 |
+
|
68 |
+
if ($item->getUsageType() == Cdev_XPaymentsConnector_Model_Usercards::RECURRING_CARD) {
|
69 |
+
|
70 |
+
$recurringProfile = Mage::getModel('sales/recurring_profile')->load($item->getData('txnId'), 'reference_id');
|
71 |
+
|
72 |
+
if ($recurringProfile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE) {
|
73 |
+
|
74 |
+
$errorMessage = Mage::helper('xpaymentsconnector')->__(
|
75 |
+
'You can\'t delete %s card. Because this is recurring card and this recurring(s) is still active.',
|
76 |
+
$item->getXpCardId()
|
77 |
+
);
|
78 |
+
|
79 |
+
Mage::getSingleton('customer/session')->addError($errorMessage);
|
80 |
+
|
81 |
+
continue;
|
82 |
}
|
83 |
+
}
|
84 |
+
|
85 |
+
$item->delete();
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
+
|
88 |
+
$message = $this->__('Credit cards have been removed successfully.');
|
89 |
+
Mage::getSingleton('customer/session')->addSuccess($message);
|
90 |
+
|
91 |
+
} else {
|
92 |
+
|
93 |
+
$message = $this->__('You have not selected any credit card.');
|
94 |
+
Mage::getSingleton('customer/session')->addError($message);
|
95 |
}
|
96 |
}
|
97 |
|
153 |
Mage::getSingleton('customer/session')->addError($errorMessage);
|
154 |
$resultMessage = 'Card authorization has been cancelled.';
|
155 |
}else{
|
|
|
|
|
|
|
|
|
156 |
$resultMessage = $this->__('Payment card has been added successfully!');
|
157 |
|
158 |
+
Mage::getSingleton('customer/session')->addSuccess( $this->__("You created new card. Transaction status is '%s'.", $transactionStatusLabel[$response['status']]));
|
159 |
}
|
160 |
|
161 |
$this->getResponse()->setBody(
|
app/code/community/Cdev/XPaymentsConnector/controllers/ProcessingController.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +14,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
@@ -46,154 +48,379 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
|
|
46 |
return Mage::getSingleton('checkout/type_onepage');
|
47 |
}
|
48 |
|
49 |
-
|
50 |
/**
|
51 |
-
*
|
52 |
*
|
53 |
-
* @return
|
54 |
-
* @access public
|
55 |
-
* @see ____func_see____
|
56 |
-
* @since 1.0.0
|
57 |
*/
|
58 |
-
|
59 |
{
|
|
|
60 |
|
61 |
-
// Check request type
|
62 |
-
if (!$this->getRequest()->isPost()) {
|
63 |
-
Mage::throwException('Wrong request type.');
|
64 |
-
}
|
65 |
-
|
66 |
-
// Check IP addresses
|
67 |
$ips = preg_grep(
|
68 |
'/^.+$/Ss',
|
69 |
explode(',', Mage::getStoreConfig('xpaymentsconnector/settings/xpay_allowed_ip_addresses'))
|
70 |
);
|
71 |
|
72 |
-
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
73 |
-
|
74 |
-
|
75 |
if ($ips) {
|
|
|
76 |
$helper = Mage::helper('core/http');
|
|
|
77 |
if (method_exists($helper, 'getRemoteAddr')) {
|
|
|
78 |
$remoteAddr = $helper->getRemoteAddr();
|
79 |
|
80 |
} else {
|
|
|
81 |
$request = $this->getRequest()->getServer();
|
82 |
$remoteAddr = $request['REMOTE_ADDR'];
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
}
|
89 |
|
90 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
// Check request data
|
93 |
$request = $this->getRequest()->getPost();
|
94 |
|
95 |
-
if (
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
-
|
100 |
-
if (empty($request['txnId'])) {
|
101 |
-
Mage::throwException('Missing or invalid transaction ID');
|
102 |
-
}
|
103 |
|
104 |
-
//
|
105 |
-
if (
|
106 |
-
$
|
|
|
107 |
}
|
108 |
|
109 |
-
Mage::
|
110 |
-
null,
|
111 |
-
$xpaymentsHelper::XPAYMENTS_LOG_FILE,
|
112 |
-
true);
|
113 |
|
114 |
$quoteId = Mage::app()->getRequest()->getParam('quote_id');
|
115 |
$customerId = Mage::app()->getRequest()->getParam('customer_id');
|
116 |
|
117 |
-
if (
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
$xpCallbackApprove = $customer->getData('xp_buffer');
|
127 |
-
}
|
128 |
|
129 |
-
|
130 |
-
if (!empty($xpCallbackApprove)) {
|
131 |
-
$cartData = unserialize($xpCallbackApprove);
|
132 |
-
}
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$xpaymentsHelper::XPAYMENTS_LOG_FILE,
|
138 |
-
true);
|
139 |
-
|
140 |
-
$xmlCallbackApprove = $api->convertHash2XML($cartData);
|
141 |
-
// Encrypt
|
142 |
-
$xmlEncrypt = $api->encrypt($xmlCallbackApprove);
|
143 |
-
echo $xmlEncrypt;
|
144 |
-
|
145 |
-
break;
|
146 |
-
|
147 |
-
case 'callback':
|
148 |
-
if (isset($request['updateData']) && isset($request['updateData']['maskedCardData'])) {
|
149 |
-
$cardData = $request['updateData']['maskedCardData'];
|
150 |
-
$cardData['txnId'] = $request['txnId'];
|
151 |
-
|
152 |
-
if ($quoteId) {
|
153 |
-
$xpaymentsHelper->saveXpCardData($quoteId,$cardData);
|
154 |
-
} elseif ($customerId) {
|
155 |
-
$customer = Mage::getModel('customer/customer')->load($customerId);
|
156 |
-
$customer->setData('xp_buffer', serialize($cardData));
|
157 |
-
$customer->save();
|
158 |
-
}
|
159 |
-
}
|
160 |
|
161 |
-
|
162 |
-
}
|
163 |
|
164 |
-
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
)
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
break;
|
183 |
-
|
184 |
-
case $api::CHARGED_STATUS:
|
185 |
-
$order->addStatusToHistory(
|
186 |
-
$order::STATE_COMPLETE,
|
187 |
-
$xpaymentsHelper->__('charge: Callback request')
|
188 |
-
);
|
189 |
-
break;
|
190 |
-
}
|
191 |
-
$order->save();
|
192 |
-
}
|
193 |
|
|
|
|
|
|
|
194 |
}
|
195 |
|
196 |
-
exit(0);
|
197 |
}
|
198 |
|
199 |
/**
|
@@ -231,72 +458,28 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
|
|
231 |
/**
|
232 |
* Process cancel by customer (from X-Payments interface)
|
233 |
*
|
234 |
-
* @return
|
235 |
-
* @access protected
|
236 |
-
* @see ____func_see____
|
237 |
-
* @since 1.0.0
|
238 |
*/
|
239 |
protected function processCancel()
|
240 |
{
|
241 |
-
$
|
242 |
-
if ($query && isset($query['action']) && $query['action'] == 'cancel') {
|
243 |
-
|
244 |
-
// Check order id
|
245 |
-
if (empty($query['refId'])) {
|
246 |
-
Mage::throwException('Missing or invalid order ID');
|
247 |
-
}
|
248 |
-
|
249 |
-
// Check order
|
250 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId(intval($query['refId']));
|
251 |
-
$profileIds = Mage::getSingleton('checkout/session')->getLastRecurringProfileIds();
|
252 |
|
253 |
-
|
254 |
-
Mage::throwException('Order not found');
|
255 |
-
}
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$profile = Mage::getModel('sales/recurring_profile')->load($profileId);
|
262 |
-
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED);
|
263 |
-
$profile->save();
|
264 |
-
}
|
265 |
|
266 |
-
|
267 |
-
$this->getLayout()
|
268 |
-
->createBlock('xpaymentsconnector/cancel')
|
269 |
-
->setOrder($order)
|
270 |
-
->toHtml()
|
271 |
-
);
|
272 |
-
return true;
|
273 |
-
}
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
$this->restoreCart($order);
|
278 |
-
|
279 |
-
$order->cancel();
|
280 |
-
$order->addStatusToHistory(
|
281 |
-
Mage_Sales_Model_Order::STATE_CANCELED,
|
282 |
-
Mage::helper('xpaymentsconnector')->__('The payment has been canceled')
|
283 |
-
);
|
284 |
-
$order->save();
|
285 |
-
}
|
286 |
-
|
287 |
-
$this->getResponse()->setBody(
|
288 |
-
$this->getLayout()
|
289 |
-
->createBlock('xpaymentsconnector/cancel')
|
290 |
-
->setOrder($order)
|
291 |
-
->toHtml()
|
292 |
-
);
|
293 |
-
|
294 |
-
return true;
|
295 |
-
}
|
296 |
|
|
|
297 |
}
|
298 |
|
299 |
-
return
|
300 |
}
|
301 |
|
302 |
/**
|
@@ -324,16 +507,6 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
|
|
324 |
|
325 |
}
|
326 |
|
327 |
-
public function getPaymentIframeAction(){
|
328 |
-
|
329 |
-
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
330 |
-
$result = $api->sendIframeHandshakeRequest();
|
331 |
-
|
332 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
333 |
-
return;
|
334 |
-
}
|
335 |
-
|
336 |
-
|
337 |
/**
|
338 |
* Start payment (handshake + redirect to X-Payments)
|
339 |
*
|
@@ -405,140 +578,250 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
|
|
405 |
$this->_redirect('checkout/cart');
|
406 |
}
|
407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
|
409 |
/**
|
410 |
-
*
|
|
|
|
|
411 |
*
|
412 |
* @return void
|
413 |
-
* @access public
|
414 |
-
* @see ____func_see____
|
415 |
-
* @since 1.0.0
|
416 |
*/
|
417 |
-
|
418 |
{
|
419 |
-
|
|
|
|
|
|
|
420 |
return;
|
421 |
}
|
422 |
|
423 |
-
|
424 |
-
|
425 |
-
Mage::throwException('Wrong request type.');
|
426 |
}
|
427 |
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
|
|
432 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
|
434 |
-
|
|
|
|
|
|
|
435 |
|
436 |
-
|
437 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
}
|
439 |
|
440 |
-
//
|
441 |
-
|
442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
}
|
444 |
|
445 |
-
|
446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
}
|
448 |
|
449 |
-
|
450 |
-
$
|
451 |
-
|
452 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
$quoteId = Mage::app()->getRequest()->getParam('quote_id');
|
454 |
-
$
|
455 |
-
|
456 |
-
$profileIds = $checkoutSession->getLastRecurringProfileIds();
|
457 |
-
$paymentCcModel = Mage::getModel('xpaymentsconnector/payment_cc');
|
458 |
-
|
459 |
-
if ($orderIncrementId) {
|
460 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
461 |
-
$quoteId = $order->getQuoteId();
|
462 |
-
$cardData = $xpHelper->getXpCardData($quoteId);
|
463 |
-
|
464 |
-
$orderId = $order->getId();
|
465 |
-
$refId = $request['refId'];
|
466 |
-
|
467 |
-
// save card data to order from quote
|
468 |
-
$order->setData('xp_card_data', serialize($cardData));
|
469 |
-
$order->save();
|
470 |
-
|
471 |
-
$result = $paymentCcModel->updateOrderByXpaymentResponse($orderId,$cardData['txnId'],$refId);
|
472 |
-
if (!$result['success']) {
|
473 |
-
$checkoutSession->addError($result['error_message']);
|
474 |
-
$checkoutSession->addNotice($xpHelper->getFailureCheckoutNoticeHelper());
|
475 |
-
}else{
|
476 |
-
if (is_null($profileIds)) {
|
477 |
-
$paymentCcModel->saveUserCard($cardData);
|
478 |
-
}
|
479 |
-
}
|
480 |
|
481 |
-
|
482 |
|
483 |
-
|
484 |
-
|
485 |
-
$cardData = $xpHelper->getXpCardData($quoteId);
|
486 |
-
}
|
487 |
|
488 |
-
|
489 |
-
$profile = Mage::getModel('sales/recurring_profile')->load($profileId);
|
490 |
-
|
491 |
-
if (isset($cardData['txnId'])) {
|
492 |
-
$profile->setReferenceId($cardData['txnId']);
|
493 |
-
if (is_null($paymentCcModel->_currentProfileId)) {
|
494 |
-
//save user card
|
495 |
-
$checkoutSession->setData('user_card_save', true);
|
496 |
-
$paymentCcModel->saveUserCard($cardData, $usageType = Cdev_XPaymentsConnector_Model_Usercards::RECURRING_CARD);
|
497 |
-
}
|
498 |
-
} else {
|
499 |
-
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED);
|
500 |
-
}
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
$unsetParams = array('prepare_order_id');
|
505 |
-
$xpHelper->unsetXpaymentPrepareOrder($unsetParams);
|
506 |
-
$xpHelper->prepareOrderKey();
|
507 |
-
$xpHelper->updateRecurringMasKeys($profile);
|
508 |
-
}
|
509 |
-
$payDeferredSubscription = $xpHelper->payDeferredSubscription($profile);
|
510 |
-
|
511 |
-
if (!$payDeferredSubscription) {
|
512 |
-
$updateProfile = $paymentCcModel->createFirstRecurringOrder($profile);
|
513 |
-
$updateProfile->save();
|
514 |
-
}
|
515 |
-
}
|
516 |
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED);
|
522 |
-
}
|
523 |
-
};
|
524 |
-
$profile->save();
|
525 |
-
$paymentCcModel->_currentProfileId = $profile->getProfileId();
|
526 |
-
}
|
527 |
}
|
528 |
|
529 |
-
|
530 |
-
|
531 |
-
}
|
532 |
|
|
|
533 |
|
|
|
|
|
|
|
|
|
|
|
534 |
|
535 |
-
$
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
|
|
|
|
|
|
540 |
|
541 |
-
|
542 |
}
|
543 |
|
544 |
|
@@ -551,29 +834,84 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
|
|
551 |
}
|
552 |
}
|
553 |
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
}
|
563 |
|
564 |
-
if(
|
565 |
-
|
566 |
-
|
567 |
-
|
|
|
568 |
}
|
|
|
569 |
|
570 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
}
|
573 |
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
}
|
579 |
}
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
|
48 |
return Mage::getSingleton('checkout/type_onepage');
|
49 |
}
|
50 |
|
|
|
51 |
/**
|
52 |
+
* Check IP address of callback request
|
53 |
*
|
54 |
+
* @return bool
|
|
|
|
|
|
|
55 |
*/
|
56 |
+
protected function checkIpAdress()
|
57 |
{
|
58 |
+
$result = true;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$ips = preg_grep(
|
61 |
'/^.+$/Ss',
|
62 |
explode(',', Mage::getStoreConfig('xpaymentsconnector/settings/xpay_allowed_ip_addresses'))
|
63 |
);
|
64 |
|
|
|
|
|
|
|
65 |
if ($ips) {
|
66 |
+
|
67 |
$helper = Mage::helper('core/http');
|
68 |
+
|
69 |
if (method_exists($helper, 'getRemoteAddr')) {
|
70 |
+
|
71 |
$remoteAddr = $helper->getRemoteAddr();
|
72 |
|
73 |
} else {
|
74 |
+
|
75 |
$request = $this->getRequest()->getServer();
|
76 |
$remoteAddr = $request['REMOTE_ADDR'];
|
77 |
}
|
78 |
|
79 |
+
$result = in_array($remoteAddr, $ips);
|
80 |
+
}
|
81 |
+
|
82 |
+
return $result;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Process masked card data from the callback request
|
87 |
+
*
|
88 |
+
* @param array $cardData Card data
|
89 |
+
* @param int $customerId Customer ID
|
90 |
+
*
|
91 |
+
* @return void
|
92 |
+
*/
|
93 |
+
protected function saveUserCard($cardData, $customerId)
|
94 |
+
{
|
95 |
+
$usercards = Mage::getModel('xpaymentsconnector/usercards');
|
96 |
+
|
97 |
+
$data = array(
|
98 |
+
'user_id' => $customerId,
|
99 |
+
'txnId' => $cardData['txnId'],
|
100 |
+
'last_4_cc_num' => $cardData['last4'],
|
101 |
+
'first6' => $cardData['first6'],
|
102 |
+
'card_type' => $cardData['type'],
|
103 |
+
'expire_month' => $cardData['expire_month'],
|
104 |
+
'expire_year' => $cardData['expire_year'],
|
105 |
+
'usage_type' => Cdev_XPaymentsConnector_Model_Usercards::SIMPLE_CARD,
|
106 |
+
);
|
107 |
+
|
108 |
+
$usercards->setData($data);
|
109 |
+
|
110 |
+
$usercards->save();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Process masked card data from the callback request
|
115 |
+
*
|
116 |
+
* @param array $data Update data
|
117 |
+
* @param string $txnId Payment reference
|
118 |
+
*
|
119 |
+
* @return void
|
120 |
+
*/
|
121 |
+
protected function processMaskedCardData($data, $txnId)
|
122 |
+
{
|
123 |
+
if (!empty($data['maskedCardData'])) {
|
124 |
+
|
125 |
+
$helper = Mage::helper('xpaymentsconnector');
|
126 |
+
|
127 |
+
$order = $helper->getOrderByTxnId($txnId);
|
128 |
+
$customerId = Mage::app()->getRequest()->getParam('customer_id');
|
129 |
+
|
130 |
+
$cardData = $data['maskedCardData'];
|
131 |
+
$cardData['txnId'] = $txnId;
|
132 |
+
|
133 |
+
if (!empty($data['advinfo'])) {
|
134 |
+
$cardData['advinfo'] = $data['advinfo'];
|
135 |
+
}
|
136 |
+
|
137 |
+
if ($order->getId()) {
|
138 |
+
|
139 |
+
$helper->saveMaskedCardToOrder($order, $cardData);
|
140 |
+
|
141 |
+
$customerId = $order->getData('customer_id');
|
142 |
+
}
|
143 |
+
|
144 |
+
$successStatus = Cdev_XPaymentsConnector_Model_Payment_Cc::AUTH_STATUS == $data['status']
|
145 |
+
|| Cdev_XPaymentsConnector_Model_Payment_Cc::CHARGED_STATUS == $data['status'];
|
146 |
+
|
147 |
+
if (
|
148 |
+
$successStatus
|
149 |
+
&& isset($data['saveCard'])
|
150 |
+
&& 'Y' == $data['saveCard']
|
151 |
+
) {
|
152 |
+
$this->saveUserCard($cardData, $customerId);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Get error message from X-Payments callback data
|
159 |
+
*
|
160 |
+
* @param array $data Callback data
|
161 |
+
*
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
protected function getResultMessage($data)
|
165 |
+
{
|
166 |
+
$message = array();
|
167 |
+
|
168 |
+
// Regular message from X-Payments
|
169 |
+
if (!empty($data['message'])) {
|
170 |
+
$message[] = $data['message'];
|
171 |
+
}
|
172 |
+
|
173 |
+
if (isset($data['advinfo'])) {
|
174 |
+
|
175 |
+
// Message from payment gateway
|
176 |
+
if (isset($data['advinfo']['message'])) {
|
177 |
+
$message[] = $data['advinfo']['message'];
|
178 |
+
}
|
179 |
+
|
180 |
+
// Message from 3-D Secure
|
181 |
+
if (isset($data['advinfo']['s3d_message'])) {
|
182 |
+
$message[] = $data['advinfo']['s3d_message'];
|
183 |
}
|
184 |
}
|
185 |
|
186 |
+
$message = array_unique($message);
|
187 |
+
|
188 |
+
return implode("\n", $message);
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Process payment status from the callback request. Chhange order status.
|
193 |
+
*
|
194 |
+
* @param array $data Update data
|
195 |
+
* @param string $txnId Payment reference
|
196 |
+
*
|
197 |
+
* @return void
|
198 |
+
*/
|
199 |
+
protected function processPaymentStatus($data, $txnId)
|
200 |
+
{
|
201 |
+
$helper = Mage::helper('xpaymentsconnector');
|
202 |
+
|
203 |
+
$order = $helper->getOrderByTxnId($txnId);
|
204 |
+
|
205 |
+
if (
|
206 |
+
!$order->getId()
|
207 |
+
|| empty($data['status'])
|
208 |
+
) {
|
209 |
+
return;
|
210 |
+
}
|
211 |
+
|
212 |
+
$status = $state = false;
|
213 |
+
|
214 |
+
$quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
|
215 |
+
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
216 |
+
|
217 |
+
$message = $this->getResultMessage($data);
|
218 |
+
|
219 |
+
if (
|
220 |
+
$api::AUTH_STATUS == $data['status']
|
221 |
+
|| $api::CHARGED_STATUS == $data['status']
|
222 |
+
) {
|
223 |
+
|
224 |
+
// Success
|
225 |
+
|
226 |
+
// Set X-Payments payment reference
|
227 |
+
$order->getPayment()->setTransactionId($txnId);
|
228 |
+
|
229 |
+
// Set AVS. Something wrong actually. Need to add cardValidation
|
230 |
+
if (
|
231 |
+
isset($data['advinfo'])
|
232 |
+
&& isset($data['advinfo']['AVS'])
|
233 |
+
) {
|
234 |
+
$order->getPayment()->setCcAvsStatus($data['advinfo']['AVS']);
|
235 |
+
}
|
236 |
+
|
237 |
+
// Set status
|
238 |
+
$status = $api::AUTH_STATUS == $data['status']
|
239 |
+
? Cdev_XPaymentsConnector_Helper_Data::STATE_XPAYMENTS_PENDING_PAYMENT
|
240 |
+
: Mage_Sales_Model_Order::STATE_PROCESSING;
|
241 |
+
|
242 |
+
|
243 |
+
// Set state
|
244 |
+
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
245 |
+
|
246 |
+
} elseif ($api::DECLINED_STATUS == $data['status']) {
|
247 |
+
|
248 |
+
// Failure
|
249 |
+
|
250 |
+
$order->cancel();
|
251 |
+
|
252 |
+
$state = $status = $order::STATE_CANCELED;
|
253 |
+
|
254 |
+
// Save error message in quote
|
255 |
+
$helper->appendQuoteXpcData(
|
256 |
+
$quote,
|
257 |
+
array(
|
258 |
+
'xpc_message' => $message,
|
259 |
+
)
|
260 |
+
);
|
261 |
+
|
262 |
+
$quote->setIsActive(true)->save();
|
263 |
+
}
|
264 |
+
|
265 |
+
if ($status) {
|
266 |
+
|
267 |
+
// Message for log
|
268 |
+
$logMessage = 'Order #' . $order->getIncrementId() . PHP_EOL
|
269 |
+
. 'Entity ID: ' . $order->getEntityId() . PHP_EOL
|
270 |
+
. 'X-Payments message: ' . $message . PHP_EOL
|
271 |
+
. 'New order status: ' . $status . PHP_EOL
|
272 |
+
. 'New order state: ' . $state;
|
273 |
+
|
274 |
+
// Message for status change
|
275 |
+
$statusMessage = 'Callback request. ' . $message;
|
276 |
+
|
277 |
+
$order->setState($state, $status, $statusMessage, false);
|
278 |
+
|
279 |
+
$order->save();
|
280 |
+
|
281 |
+
$helper->writeLog('Order status changed by callback request.', $logMessage);
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Get check cart response for checkout
|
287 |
+
*
|
288 |
+
* @param string $quoteId
|
289 |
+
*
|
290 |
+
* @return array
|
291 |
+
*/
|
292 |
+
protected function getQuoteCheckCartResponse($quoteId)
|
293 |
+
{
|
294 |
+
$helper = Mage::helper('xpaymentsconnector');
|
295 |
+
|
296 |
+
$response = array(
|
297 |
+
'status' => 'cart-changed',
|
298 |
+
);
|
299 |
+
|
300 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
301 |
+
|
302 |
+
// Place order
|
303 |
+
$refId = $helper->funcPlaceOrder($quote);
|
304 |
+
|
305 |
+
if ($refId) {
|
306 |
+
|
307 |
+
// Cart data to update payment
|
308 |
+
$preparedCart = $helper->prepareCart($quote, $refId);
|
309 |
+
|
310 |
+
$response += array(
|
311 |
+
'ref_id' => $refId,
|
312 |
+
'cart' => $preparedCart,
|
313 |
+
);
|
314 |
+
|
315 |
+
}
|
316 |
+
|
317 |
+
return $response;
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Get check cart response for zero auth
|
322 |
+
*
|
323 |
+
* @param string $customerId
|
324 |
+
*
|
325 |
+
* @return array
|
326 |
+
*/
|
327 |
+
protected function getCustomerCheckCartResponse($customerId)
|
328 |
+
{
|
329 |
+
$helper = Mage::helper('xpaymentsconnector');
|
330 |
+
|
331 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
332 |
+
$preparedCart = $helper->prepareFakeCart($customer);
|
333 |
+
|
334 |
+
$data = array(
|
335 |
+
'status' => 'cart-changed',
|
336 |
+
'ref_id' => 'Authorization',
|
337 |
+
'cart' => $preparedCart,
|
338 |
+
);
|
339 |
+
|
340 |
+
return $data;
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Process callback request
|
345 |
+
*
|
346 |
+
* @return void
|
347 |
+
*/
|
348 |
+
public function callbackAction()
|
349 |
+
{
|
350 |
+
ini_set('html_errors', false);
|
351 |
|
352 |
// Check request data
|
353 |
$request = $this->getRequest()->getPost();
|
354 |
|
355 |
+
if (
|
356 |
+
!$this->getRequest()->isPost()
|
357 |
+
|| empty($request)
|
358 |
+
|| empty($request['txnId'])
|
359 |
+
|| empty($request['action'])
|
360 |
+
) {
|
361 |
+
Mage::throwException('Invalid request');
|
362 |
}
|
363 |
|
364 |
+
$api = Mage::getModel('xpaymentsconnector/payment_cc');
|
|
|
|
|
|
|
365 |
|
366 |
+
// Check IP addresses
|
367 |
+
if (!$this->checkIpAdress()) {
|
368 |
+
$api->getApiError('IP can\'t be validated as X-Payments server IP.');
|
369 |
+
return;
|
370 |
}
|
371 |
|
372 |
+
$helper = Mage::helper('xpaymentsconnector');
|
|
|
|
|
|
|
373 |
|
374 |
$quoteId = Mage::app()->getRequest()->getParam('quote_id');
|
375 |
$customerId = Mage::app()->getRequest()->getParam('customer_id');
|
376 |
|
377 |
+
if (
|
378 |
+
'check_cart' == $request['action']
|
379 |
+
&& (
|
380 |
+
!empty($quoteId)
|
381 |
+
|| !empty($customerId)
|
382 |
+
)
|
383 |
+
) {
|
384 |
|
385 |
+
// Process check-cart callback request
|
386 |
+
|
387 |
+
$data = $quoteId
|
388 |
+
? $this->getQuoteCheckCartResponse($quoteId)
|
389 |
+
: $this->getCustomerCheckCartResponse($customerId, $request['txnId']);
|
|
|
|
|
390 |
|
391 |
+
$helper->writeLog('Response for check-cart request', $data);
|
|
|
|
|
|
|
392 |
|
393 |
+
// Convert to XML and encrypt
|
394 |
+
$xml = $api->convertHash2XML($data);
|
395 |
+
$xml = $api->encrypt($xml);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
|
397 |
+
echo $xml;
|
|
|
398 |
|
399 |
+
exit;
|
400 |
|
401 |
+
} elseif (
|
402 |
+
'callback' == $request['action']
|
403 |
+
&& !empty($request['updateData'])
|
404 |
+
) {
|
405 |
|
406 |
+
// Process callback request
|
407 |
+
|
408 |
+
// Decrypt data
|
409 |
+
$data = $api->decryptXML($request['updateData']);
|
410 |
|
411 |
+
$helper->writeLog('Callback request received', $data);
|
412 |
+
|
413 |
+
// Save used credit card
|
414 |
+
$this->processMaskedCardData($data, $request['txnId']);
|
415 |
+
|
416 |
+
// Change order status according to the X-Payments payment status
|
417 |
+
$this->processPaymentStatus($data, $request['txnId']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
|
419 |
+
} else {
|
420 |
+
|
421 |
+
$helper->writeLog('Invalid callback request', $request);
|
422 |
}
|
423 |
|
|
|
424 |
}
|
425 |
|
426 |
/**
|
458 |
/**
|
459 |
* Process cancel by customer (from X-Payments interface)
|
460 |
*
|
461 |
+
* @return bool
|
|
|
|
|
|
|
462 |
*/
|
463 |
protected function processCancel()
|
464 |
{
|
465 |
+
$result = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
+
$query = $this->getRequest()->getQuery();
|
|
|
|
|
468 |
|
469 |
+
if (
|
470 |
+
isset($query['action'])
|
471 |
+
&& 'cancel' == $query['action']
|
472 |
+
) {
|
|
|
|
|
|
|
|
|
473 |
|
474 |
+
Mage::getSingleton('core/session')->addError('Payment canceled');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
+
$url = Mage::getUrl('checkout/cart');
|
477 |
+
$this->_redirectUrl($url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
|
479 |
+
$result = true;
|
480 |
}
|
481 |
|
482 |
+
return $result;
|
483 |
}
|
484 |
|
485 |
/**
|
507 |
|
508 |
}
|
509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
/**
|
511 |
* Start payment (handshake + redirect to X-Payments)
|
512 |
*
|
578 |
$this->_redirect('checkout/cart');
|
579 |
}
|
580 |
|
581 |
+
/**
|
582 |
+
* Save address in the address book
|
583 |
+
*
|
584 |
+
* @param array $data Address data to save
|
585 |
+
*
|
586 |
+
* @return void
|
587 |
+
*/
|
588 |
+
private function saveAddress($data)
|
589 |
+
{
|
590 |
+
if (empty($data['customer_id'])) {
|
591 |
+
return;
|
592 |
+
}
|
593 |
+
|
594 |
+
$newAddress = Mage::getModel('customer/address');
|
595 |
+
|
596 |
+
$newAddress->setData($data)
|
597 |
+
->setCustomerId($data['customer_id'])
|
598 |
+
->setSaveInAddressBook('1');
|
599 |
+
|
600 |
+
$newAddress->save();
|
601 |
+
}
|
602 |
|
603 |
/**
|
604 |
+
* Save addresses in address book (if necessary)
|
605 |
+
*
|
606 |
+
* @param Mage_Sales_Model_Quote $quote
|
607 |
*
|
608 |
* @return void
|
|
|
|
|
|
|
609 |
*/
|
610 |
+
private function processSaveAddresses(Mage_Sales_Model_Quote $quote)
|
611 |
{
|
612 |
+
$data = Mage::helper('xpaymentsconnector')->loadQuoteXpcData($quote);
|
613 |
+
|
614 |
+
if (!empty($data['address_saved'])) {
|
615 |
+
// Address already saved during customer registration
|
616 |
return;
|
617 |
}
|
618 |
|
619 |
+
if ($quote->getBillingAddress()->getData('save_in_address_book')) {
|
620 |
+
$this->saveAddress($quote->getBillingAddress()->getData());
|
|
|
621 |
}
|
622 |
|
623 |
+
if (
|
624 |
+
$quote->getShippingAddress()->getData('save_in_address_book')
|
625 |
+
&& !$quote->getShippingAddress()->getData('same_as_billing')
|
626 |
+
) {
|
627 |
+
$this->saveAddress($quote->getShippingAddress()->getData());
|
628 |
}
|
629 |
+
}
|
630 |
+
|
631 |
+
/**
|
632 |
+
* Process return after successful payment
|
633 |
+
*
|
634 |
+
* @param Mage_Sales_Model_Quote $quote
|
635 |
+
* @param Mage_Sales_Model_Order $order
|
636 |
+
*
|
637 |
+
* @return void
|
638 |
+
*/
|
639 |
+
private function processReturnSuccess(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order)
|
640 |
+
{
|
641 |
+
$quoteId = $quote->getId();
|
642 |
+
|
643 |
+
$session = $this->getOnePage()->getCheckout();
|
644 |
+
|
645 |
+
$session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId);
|
646 |
+
$session->setLastOrderId($order->getId())->setLastRealOrderId($order->getIncrementId());
|
647 |
|
648 |
+
if (
|
649 |
+
$order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING
|
650 |
+
&& $order->canInvoice()
|
651 |
+
) {
|
652 |
|
653 |
+
// Auto create invoice for the charged payment
|
654 |
+
|
655 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
656 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
657 |
+
|
658 |
+
$invoice->register();
|
659 |
+
|
660 |
+
$transaction = Mage::getModel('core/resource_transaction')
|
661 |
+
->addObject($invoice)
|
662 |
+
->addObject($invoice->getOrder());
|
663 |
+
|
664 |
+
$transaction->save();
|
665 |
}
|
666 |
|
667 |
+
// Save addresses in the adress book if necessary
|
668 |
+
$this->processSaveAddresses($quote);
|
669 |
+
|
670 |
+
$session->setXpcRedirectUrl(Mage::getUrl('checkout/onepage/success'));
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* Process return after declined payment
|
675 |
+
*
|
676 |
+
* @param Mage_Sales_Model_Quote $quote
|
677 |
+
* @param Mage_Sales_Model_Order $order
|
678 |
+
*
|
679 |
+
* @return void
|
680 |
+
*/
|
681 |
+
private function processReturnDecline(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order)
|
682 |
+
{
|
683 |
+
$session = $this->getOnePage()->getCheckout();
|
684 |
+
$helper = Mage::helper('xpaymentsconnector');
|
685 |
+
|
686 |
+
$data = $helper->loadQuoteXpcData($quote);
|
687 |
+
|
688 |
+
$message = !empty($data['xpc_message'])
|
689 |
+
? $data['xpc_message']
|
690 |
+
: 'Order declined. Try again';
|
691 |
+
|
692 |
+
$session->clearHelperData();
|
693 |
+
|
694 |
+
$quote->setAsActive(true);
|
695 |
+
|
696 |
+
$helper->resetInitData();
|
697 |
+
|
698 |
+
Mage::getSingleton('core/session')->addError($message);
|
699 |
+
$this->_getCheckout()->addError($message);
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Process return when order is lost
|
704 |
+
*
|
705 |
+
* @param Mage_Sales_Model_Quote $quote
|
706 |
+
*
|
707 |
+
* @return void
|
708 |
+
*/
|
709 |
+
private function processReturnLostOrder(Mage_Sales_Model_Quote $quote)
|
710 |
+
{
|
711 |
+
$helper = Mage::helper('xpaymentsconnector');
|
712 |
+
|
713 |
+
$data = $helper->loadQuoteXpcData($quote);
|
714 |
+
|
715 |
+
if (!empty($data['xpc_message'])) {
|
716 |
+
$message = $data['xpc_message'];
|
717 |
+
} else {
|
718 |
+
$message = 'Order was lost';
|
719 |
}
|
720 |
|
721 |
+
$helper->resetInitData();
|
722 |
+
|
723 |
+
Mage::throwException($message);
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Send confirmation email
|
728 |
+
*
|
729 |
+
* @param Mage_Sales_Model_Quote $quote
|
730 |
+
*
|
731 |
+
* @return void
|
732 |
+
*/
|
733 |
+
private function processConfirmationEmail(Mage_Sales_Model_Order $order)
|
734 |
+
{
|
735 |
+
$notified = false;
|
736 |
+
|
737 |
+
try {
|
738 |
+
|
739 |
+
// Send confirmation email
|
740 |
+
$order->getSendConfirmation(null);
|
741 |
+
$order->sendNewOrderEmail();
|
742 |
+
|
743 |
+
$notified = true;
|
744 |
+
|
745 |
+
} catch (Exception $e) {
|
746 |
+
|
747 |
+
// Do not cancel order if we couldn't send email
|
748 |
+
Mage::helper('xpaymentsconnector')->writeLog('Error sending email', $e->getMessage());
|
749 |
+
}
|
750 |
+
|
751 |
+
$order->addStatusToHistory($order->getStatus(), 'Customer returned to the store', $notified);
|
752 |
+
}
|
753 |
+
|
754 |
+
/**
|
755 |
+
* Return customer from X-Payments
|
756 |
+
*
|
757 |
+
* @return void
|
758 |
+
*/
|
759 |
+
public function returnAction()
|
760 |
+
{
|
761 |
+
if ($this->processCancel()) {
|
762 |
+
return;
|
763 |
}
|
764 |
|
765 |
+
// Check request data
|
766 |
+
$request = $this->getRequest()->getPost();
|
767 |
+
|
768 |
+
if (
|
769 |
+
!$this->getRequest()->isPost()
|
770 |
+
|| empty($request)
|
771 |
+
|| empty($request['refId'])
|
772 |
+
|| empty($request['txnId'])
|
773 |
+
) {
|
774 |
+
Mage::throwException('Invalid request');
|
775 |
+
}
|
776 |
+
|
777 |
+
$session = $this->getOnePage()->getCheckout();
|
778 |
+
|
779 |
+
$helper = Mage::helper('xpaymentsconnector');
|
780 |
+
$helper->writeLog('Customer returned from X-Payments', $request);
|
781 |
+
|
782 |
+
try {
|
783 |
+
|
784 |
$quoteId = Mage::app()->getRequest()->getParam('quote_id');
|
785 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
786 |
+
$order = $helper->getOrderByTxnId($request['txnId']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
|
788 |
+
if (!$order->getId()) {
|
789 |
|
790 |
+
// Process return when order is lost
|
791 |
+
$this->processReturnLostOrder($quote);
|
|
|
|
|
792 |
|
793 |
+
} elseif ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
794 |
|
795 |
+
// Process return after successful payment
|
796 |
+
$this->processReturnSuccess($quote, $order);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
797 |
|
798 |
+
} else {
|
799 |
+
|
800 |
+
// Process return after declined payment
|
801 |
+
$this->processReturnDecline($quote, $order);
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
}
|
803 |
|
804 |
+
// Send confirmation email
|
805 |
+
$this->processConfirmationEmail($order);
|
|
|
806 |
|
807 |
+
$order->save();
|
808 |
|
809 |
+
// Login customer who's registered at checkout
|
810 |
+
if ($helper->isCreateNewCustomer($quote, true)) {
|
811 |
+
$customerId = $quote->getCustomer()->getId();
|
812 |
+
Mage::getSingleton('customer/session')->loginById($customerId);
|
813 |
+
}
|
814 |
|
815 |
+
} catch (Mage_Core_Exception $e) {
|
816 |
+
|
817 |
+
$this->_getCheckout()->addError($e->getMessage());
|
818 |
+
|
819 |
+
$session->setXpcRedirectUrl(Mage::getUrl('checkout/onepage/failure'));
|
820 |
+
}
|
821 |
+
|
822 |
+
$this->loadLayout();
|
823 |
|
824 |
+
$this->renderLayout();
|
825 |
}
|
826 |
|
827 |
|
834 |
}
|
835 |
}
|
836 |
|
837 |
+
/**
|
838 |
+
* Redirect iframe to the X-Payments URL
|
839 |
+
*
|
840 |
+
* @return void
|
841 |
+
*/
|
842 |
+
public function redirectiframeAction()
|
843 |
+
{
|
844 |
+
if (Mage::app()->getRequest()->getParam('checkout_method')) {
|
845 |
+
|
846 |
+
Mage::getSingleton('checkout/session')->setData('xpc_checkout_method', Mage::app()->getRequest()->getParam('checkout_method'));
|
847 |
+
}
|
848 |
+
|
849 |
+
if (Mage::app()->getRequest()->getParam('unset_xp_prepare_order')) {
|
850 |
+
|
851 |
+
$helper = Mage::helper('xpaymentsconnector');
|
852 |
+
$helper->resetInitData();
|
853 |
}
|
854 |
|
855 |
+
if (!Mage::app()->getRequest()->isXmlHttpRequest()) {
|
856 |
+
|
857 |
+
$this->loadLayout();
|
858 |
+
|
859 |
+
$this->renderLayout();
|
860 |
}
|
861 |
+
}
|
862 |
|
863 |
+
/**
|
864 |
+
* Save checkout data before submitting the order
|
865 |
+
*
|
866 |
+
* @return void
|
867 |
+
*/
|
868 |
+
public function save_checkout_dataAction()
|
869 |
+
{
|
870 |
+
$request = $this->getRequest();
|
871 |
+
|
872 |
+
if (
|
873 |
+
!$request->isPost()
|
874 |
+
|| !$request->isXmlHttpRequest()
|
875 |
+
) {
|
876 |
+
Mage::throwException('Invalid request');
|
877 |
+
}
|
878 |
+
|
879 |
+
$helper = Mage::helper('xpaymentsconnector');
|
880 |
|
881 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
882 |
+
$helper->saveCheckoutData($quote, $request->getPost());
|
883 |
+
$quote->save();
|
884 |
+
|
885 |
+
if ($helper->checkFirecheckoutModuleEnabled()) {
|
886 |
+
// return properly formatted {} for Firecheckout
|
887 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array()));
|
888 |
+
}
|
889 |
}
|
890 |
|
891 |
+
/**
|
892 |
+
* Check agreements
|
893 |
+
*
|
894 |
+
* @return void
|
895 |
+
*/
|
896 |
+
public function check_agreementsAction()
|
897 |
+
{
|
898 |
+
$result = array(
|
899 |
+
'success' => true,
|
900 |
+
'error' => false,
|
901 |
+
);
|
902 |
+
|
903 |
+
$requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
|
904 |
+
if ($requiredAgreements) {
|
905 |
+
|
906 |
+
$postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
|
907 |
+
|
908 |
+
if (array_diff($requiredAgreements, $postedAgreements)) {
|
909 |
+
$result['success'] = false;
|
910 |
+
$result['error'] = true;
|
911 |
+
$result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
|
912 |
+
}
|
913 |
+
}
|
914 |
+
|
915 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
916 |
}
|
917 |
}
|
app/code/community/Cdev/XPaymentsConnector/etc/adminhtml.xml
CHANGED
@@ -13,10 +13,10 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @author
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
-
* @copyright (c) Qualiteam
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
app/code/community/Cdev/XPaymentsConnector/etc/config.xml
CHANGED
@@ -13,10 +13,10 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @author
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
-
* @copyright (c) Qualiteam
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
@@ -393,6 +393,7 @@
|
|
393 |
<order_status>1</order_status>
|
394 |
<allowspecific>0</allowspecific>
|
395 |
<title>Credit Card (X-Payments)</title>
|
|
|
396 |
</xpayments>
|
397 |
<savedcards>
|
398 |
<active>0</active>
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
393 |
<order_status>1</order_status>
|
394 |
<allowspecific>0</allowspecific>
|
395 |
<title>Credit Card (X-Payments)</title>
|
396 |
+
<use_iframe>1</use_iframe>
|
397 |
</xpayments>
|
398 |
<savedcards>
|
399 |
<active>0</active>
|
app/code/community/Cdev/XPaymentsConnector/etc/system.xml
CHANGED
@@ -13,10 +13,10 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @author
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
-
* @copyright (c) Qualiteam
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-install-1.0.0.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.0-1.0.1.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.1-1.0.2.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.2-1.0.3.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.3-1.0.4.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.4-1.0.5.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.5-1.0.6.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.6-1.0.7.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.7-1.0.8.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.8-1.0.9.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.9-1.1.0.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.0-1.1.1.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.1-1.1.2.php
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
app/design/adminhtml/default/default/layout/xpaymentsconnector.xml
CHANGED
@@ -13,10 +13,10 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @author
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
-
* @copyright (c) Qualiteam
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
app/design/adminhtml/default/default/template/xpaymentsconnector/control.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/form/prepaidpayments.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/form/savedcards.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/info.phtml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Cdev
|
16 |
* @package Cdev_XPaymentsConnector
|
17 |
-
* @copyright
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
* @version SVN: $Id: info.phtml 3624 2010-07-28 05:45:05Z max $
|
20 |
*/
|
14 |
*
|
15 |
* @category Cdev
|
16 |
* @package Cdev_XPaymentsConnector
|
17 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
* @version SVN: $Id: info.phtml 3624 2010-07-28 05:45:05Z max $
|
20 |
*/
|
app/design/adminhtml/default/default/template/xpaymentsconnector/info/cc.phtml
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -25,23 +26,29 @@
|
|
25 |
*/
|
26 |
?>
|
27 |
<?php
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
?>
|
30 |
|
31 |
<?php echo $this->getMethod()->getTitle(); ?>
|
|
|
32 |
<br />
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
<?php else: ?>
|
38 |
-
<?php
|
39 |
-
echo $this->__('X-Payments Transaction ID: %s', $this->htmlEscape($this->getInfo()->getLastTransId()));
|
40 |
-
?>
|
41 |
-
<br/>
|
42 |
<?php endif; ?>
|
43 |
-
|
|
|
44 |
<span id="x-payment-prepaid-card-info">
|
45 |
-
|
46 |
</span>
|
47 |
-
<?php endif
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
?>
|
26 |
*/
|
27 |
?>
|
28 |
<?php
|
29 |
+
|
30 |
+
$order = $this->getInfo()->getMethodInstance()->getOrder();
|
31 |
+
|
32 |
+
$txnId = $cardData = '';
|
33 |
+
|
34 |
+
if ($order) {
|
35 |
+
$cardData = $this->getCardData();
|
36 |
+
$txnId = $order->getData('xpc_txnid');
|
37 |
+
}
|
38 |
+
|
39 |
?>
|
40 |
|
41 |
<?php echo $this->getMethod()->getTitle(); ?>
|
42 |
+
|
43 |
<br />
|
44 |
+
|
45 |
+
<?php if ($txnId): ?>
|
46 |
+
<?php echo $this->__('X-Payments Transaction ID: %s', $this->htmlEscape($txnId)); ?>
|
47 |
+
<br />
|
|
|
|
|
|
|
|
|
|
|
48 |
<?php endif; ?>
|
49 |
+
|
50 |
+
<?php if ($cardData): ?>
|
51 |
<span id="x-payment-prepaid-card-info">
|
52 |
+
<?php echo $this->__('Credit card used for this order: %s', $cardData); ?>
|
53 |
</span>
|
54 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/info/prepaidpayments.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/info/savedcards.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/order/view/tab/xporderstate.phtml
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -74,6 +75,7 @@
|
|
74 |
<tr class="border pointer <?php echo $rowClass?>">
|
75 |
<td>
|
76 |
<div class="item-container" >
|
|
|
77 |
<table cellspacing="0" class="form-list">
|
78 |
<tbody>
|
79 |
<?php foreach($transaction["fields"] as $field): ?>
|
@@ -84,6 +86,7 @@
|
|
84 |
<?php endforeach; ?>
|
85 |
</tbody>
|
86 |
</table>
|
|
|
87 |
</div>
|
88 |
</td>
|
89 |
<td>
|
@@ -270,4 +273,4 @@
|
|
270 |
|
271 |
<?php else: ?>
|
272 |
<?php echo $xpaymentsOrderInfo["error_message"];?>
|
273 |
-
<?php endif;?>
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
?>
|
75 |
<tr class="border pointer <?php echo $rowClass?>">
|
76 |
<td>
|
77 |
<div class="item-container" >
|
78 |
+
<?php if (!empty($transaction["fields"])): ?>
|
79 |
<table cellspacing="0" class="form-list">
|
80 |
<tbody>
|
81 |
<?php foreach($transaction["fields"] as $field): ?>
|
86 |
<?php endforeach; ?>
|
87 |
</tbody>
|
88 |
</table>
|
89 |
+
<?php endif; ?>
|
90 |
</div>
|
91 |
</td>
|
92 |
<td>
|
273 |
|
274 |
<?php else: ?>
|
275 |
<?php echo $xpaymentsOrderInfo["error_message"];?>
|
276 |
+
<?php endif;?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/pdf/info.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/adminhtml/default/default/template/xpaymentsconnector/usercards/tab/js.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/layout/xpaymentsconnector.xml
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
|
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
@@ -13,10 +14,10 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @author
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
-
* @copyright (c) Qualiteam
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-->
|
@@ -34,17 +35,6 @@
|
|
34 |
|
35 |
<checkout_onepage_index translate="label">
|
36 |
<reference name="head">
|
37 |
-
<block type="core/text" name="google.jquery">
|
38 |
-
<action method="setText">
|
39 |
-
<text>
|
40 |
-
<![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>]]></text>
|
41 |
-
</action>
|
42 |
-
</block>
|
43 |
-
<block type="core/text" name="google.jquery.noconflict" after="google.jquery">
|
44 |
-
<action method="setText">
|
45 |
-
<text><![CDATA[<script type="text/javascript">jQuery.noConflict(); </script>]]></text>
|
46 |
-
</action>
|
47 |
-
</block>
|
48 |
<action method="addItem">
|
49 |
<type>js_css</type>
|
50 |
<name>xpayment/settings.css</name>
|
@@ -55,24 +45,53 @@
|
|
55 |
<name>xpayment/checkout-submit.js</name>
|
56 |
<params/>
|
57 |
</action>
|
|
|
58 |
</reference>
|
59 |
</checkout_onepage_index>
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<checkout_onepage_review translate="label">
|
62 |
<reference name="checkout.onepage.review.info.items.after">
|
63 |
<block type="xpaymentsconnector/checkout_onepage_settings" name="xpayment_settings" output="toHtml"
|
64 |
template="xpaymentsconnector/checkout/onepage/xpayment-iframe.phtml"/>
|
65 |
-
<block type="xpaymentsconnector/checkout_onepage_orderdetail" name="xpayment_recurring_detail" output="toHtml"
|
66 |
template="xpaymentsconnector/checkout/onepage/order-detail.phtml"/>
|
67 |
</reference>
|
68 |
-
<reference name="checkout.onepage.review.button">
|
69 |
-
<action method="setTemplate">
|
70 |
-
<template helper="xpaymentsconnector/data/getReviewButtonTemplate">
|
71 |
-
<name>xpaymentsconnector/checkout/onepage/review/button.phtml</name>
|
72 |
-
<block>checkout.onepage.review.button</block>
|
73 |
-
</template>
|
74 |
-
</action>
|
75 |
-
</reference>
|
76 |
</checkout_onepage_review>
|
77 |
|
78 |
<checkout_onepage_success>
|
@@ -100,6 +119,30 @@
|
|
100 |
</reference>
|
101 |
</xpaymentsconnector_processing_redirect>
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
<customer_account>
|
105 |
<reference name="head">
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
+
vim: set ts=4 sw=4 sts=4 et:
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
-->
|
35 |
|
36 |
<checkout_onepage_index translate="label">
|
37 |
<reference name="head">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<action method="addItem">
|
39 |
<type>js_css</type>
|
40 |
<name>xpayment/settings.css</name>
|
45 |
<name>xpayment/checkout-submit.js</name>
|
46 |
<params/>
|
47 |
</action>
|
48 |
+
<block type="core/template" name="xpc_data" template="xpaymentsconnector/xpc_data.phtml" />
|
49 |
</reference>
|
50 |
</checkout_onepage_index>
|
51 |
|
52 |
+
<onestepcheckout_index_index>
|
53 |
+
<reference name="head">
|
54 |
+
<action method="addItem">
|
55 |
+
<type>js_css</type>
|
56 |
+
<name>xpayment/settings.css</name>
|
57 |
+
<params/>
|
58 |
+
</action>
|
59 |
+
<action method="addItem">
|
60 |
+
<type>js</type>
|
61 |
+
<name>xpayment/checkout-submit.js</name>
|
62 |
+
<params/>
|
63 |
+
</action>
|
64 |
+
<block type="core/template" name="xpc_data" template="xpaymentsconnector/xpc_data.phtml" />
|
65 |
+
</reference>
|
66 |
+
</onestepcheckout_index_index>
|
67 |
+
|
68 |
+
<firecheckout_index_index>
|
69 |
+
<reference name="head">
|
70 |
+
<action method="addItem">
|
71 |
+
<type>js_css</type>
|
72 |
+
<name>xpayment/settings.css</name>
|
73 |
+
<params/>
|
74 |
+
</action>
|
75 |
+
<action method="addItem">
|
76 |
+
<type>js</type>
|
77 |
+
<name>xpayment/checkout-submit.js</name>
|
78 |
+
<params/>
|
79 |
+
</action>
|
80 |
+
<block type="core/template" name="xpc_data" template="xpaymentsconnector/xpc_data.phtml" />
|
81 |
+
</reference>
|
82 |
+
<reference name="checkout.onepage.review.info.items.after">
|
83 |
+
<block type="xpaymentsconnector/checkout_onepage_orderdetail" name="xpayment_recurring_detail" output="toHtml" after="checkout.onepage.review.button"
|
84 |
+
template="xpaymentsconnector/checkout/onepage/order-detail.phtml"/>
|
85 |
+
</reference>
|
86 |
+
</firecheckout_index_index>
|
87 |
+
|
88 |
<checkout_onepage_review translate="label">
|
89 |
<reference name="checkout.onepage.review.info.items.after">
|
90 |
<block type="xpaymentsconnector/checkout_onepage_settings" name="xpayment_settings" output="toHtml"
|
91 |
template="xpaymentsconnector/checkout/onepage/xpayment-iframe.phtml"/>
|
92 |
+
<block type="xpaymentsconnector/checkout_onepage_orderdetail" name="xpayment_recurring_detail" output="toHtml" after="checkout.onepage.review.button"
|
93 |
template="xpaymentsconnector/checkout/onepage/order-detail.phtml"/>
|
94 |
</reference>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
</checkout_onepage_review>
|
96 |
|
97 |
<checkout_onepage_success>
|
119 |
</reference>
|
120 |
</xpaymentsconnector_processing_redirect>
|
121 |
|
122 |
+
<xpaymentsconnector_processing_redirectiframe>
|
123 |
+
<reference name="root">
|
124 |
+
<action method="setTemplate">
|
125 |
+
<template>xpaymentsconnector/blank.phtml</template>
|
126 |
+
</action>
|
127 |
+
</reference>
|
128 |
+
<reference name="content">
|
129 |
+
<block type="xpaymentsconnector/redirect" name="xpaymentsconnector_redirect"
|
130 |
+
template="xpaymentsconnector/redirectiframe.phtml"/>
|
131 |
+
</reference>
|
132 |
+
</xpaymentsconnector_processing_redirectiframe>
|
133 |
+
|
134 |
+
<xpaymentsconnector_processing_return>
|
135 |
+
<reference name="root">
|
136 |
+
<action method="setTemplate">
|
137 |
+
<template>xpaymentsconnector/blank.phtml</template>
|
138 |
+
</action>
|
139 |
+
</reference>
|
140 |
+
<reference name="content">
|
141 |
+
<block type="xpaymentsconnector/return" name="xpaymentsconnector_return"
|
142 |
+
template="xpaymentsconnector/return.phtml"/>
|
143 |
+
</reference>
|
144 |
+
</xpaymentsconnector_processing_return>
|
145 |
+
|
146 |
|
147 |
<customer_account>
|
148 |
<reference name="head">
|
app/design/frontend/base/default/template/xpaymentsconnector/blank.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/cancel.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/beforesuccess.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
/**
|
@@ -48,7 +48,7 @@
|
|
48 |
<script type="text/javascript">
|
49 |
jQuery(document).ready(function () {
|
50 |
var dataObj = {};
|
51 |
-
if (jQuery("#checkout-agreements", window.parent.document).length) {
|
52 |
jQuery("#checkout-agreements input", window.parent.document).each(function (obj, item) {
|
53 |
dataObj[item.name] = item.value;
|
54 |
});
|
@@ -59,18 +59,20 @@
|
|
59 |
<?php endforeach;?>
|
60 |
<?php endif; ?>
|
61 |
}
|
|
|
|
|
62 |
|
63 |
dataObj["payment[method]"] = "<?php echo $this->getXpaymentsCode();?>";
|
64 |
dataObj["form_key"] = "<?php echo $formKey;?>";
|
65 |
|
66 |
jQuery.ajax({
|
67 |
-
url: "<?php echo
|
68 |
type: "post",
|
69 |
data: jQuery.param(dataObj),
|
70 |
success: function (data) {
|
71 |
var response = jQuery.parseJSON(data);
|
72 |
if (response.success == true) {
|
73 |
-
window.
|
74 |
} else if (response.success == false) {
|
75 |
if (response['error_messages']) {
|
76 |
alert(response['error_messages']);
|
@@ -89,4 +91,4 @@
|
|
89 |
</script>
|
90 |
</body>
|
91 |
|
92 |
-
</html>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
/**
|
48 |
<script type="text/javascript">
|
49 |
jQuery(document).ready(function () {
|
50 |
var dataObj = {};
|
51 |
+
/* if (jQuery("#checkout-agreements", window.parent.document).length) {
|
52 |
jQuery("#checkout-agreements input", window.parent.document).each(function (obj, item) {
|
53 |
dataObj[item.name] = item.value;
|
54 |
});
|
59 |
<?php endforeach;?>
|
60 |
<?php endif; ?>
|
61 |
}
|
62 |
+
*/
|
63 |
+
// window.location = "<?php echo $this->getCheckoutSuccessUrl();?>";
|
64 |
|
65 |
dataObj["payment[method]"] = "<?php echo $this->getXpaymentsCode();?>";
|
66 |
dataObj["form_key"] = "<?php echo $formKey;?>";
|
67 |
|
68 |
jQuery.ajax({
|
69 |
+
url: "<?php echo Mage::getUrl('checkout/onepage/saveorder'); ?>",
|
70 |
type: "post",
|
71 |
data: jQuery.param(dataObj),
|
72 |
success: function (data) {
|
73 |
var response = jQuery.parseJSON(data);
|
74 |
if (response.success == true) {
|
75 |
+
window.location = "<?php echo $this->getCheckoutSuccessUrl();?>";
|
76 |
} else if (response.success == false) {
|
77 |
if (response['error_messages']) {
|
78 |
alert(response['error_messages']);
|
91 |
</script>
|
92 |
</body>
|
93 |
|
94 |
+
</html>
|
app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/order-detail.phtml
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +14,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -35,7 +37,7 @@ $recurringQuoteItems = $this->getRecurringQuoteItems();
|
|
35 |
<div id="recurring-detail-block">
|
36 |
<strong><?php echo $this->__('ATTENTION:');?></strong>
|
37 |
</br>
|
38 |
-
<?php echo $this->__('Since this
|
39 |
</br>
|
40 |
<ul>
|
41 |
<?php $simpleQuoteItemMessage = $this->getSimpleQuoteItemMessage(); ?>
|
@@ -56,4 +58,8 @@ $recurringQuoteItems = $this->getRecurringQuoteItems();
|
|
56 |
</div>
|
57 |
<?php endif;?>
|
58 |
|
59 |
-
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
?>
|
37 |
<div id="recurring-detail-block">
|
38 |
<strong><?php echo $this->__('ATTENTION:');?></strong>
|
39 |
</br>
|
40 |
+
<?php echo $this->__('Since this order contains recurring products we charge your credit card several times:');?>
|
41 |
</br>
|
42 |
<ul>
|
43 |
<?php $simpleQuoteItemMessage = $this->getSimpleQuoteItemMessage(); ?>
|
58 |
</div>
|
59 |
<?php endif;?>
|
60 |
|
61 |
+
<script type="text/javascript">
|
62 |
+
//<![CDATA[
|
63 |
+
document.fire('xpc:reviewBlockLoaded');
|
64 |
+
//]]>
|
65 |
+
</script>
|
app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/review/button.phtml
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,69 +14,19 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
22 |
-
<?php
|
23 |
-
$xpayUrlMas = parse_url(Mage::getModel('xpaymentsconnector/payment_cc')->getConfig('xpay_url'));
|
24 |
-
$xpayUrl = $xpayUrlMas["scheme"]."://".$xpayUrlMas["host"];
|
25 |
-
$updateCartUrl = Mage::getUrl("checkout/cart",array("unset_xp_prepare_order"=>1));
|
26 |
-
$checkIframeUrl = Mage::getUrl('xpaymentsconnector/processing/istokenactual', array('_nosid' => true,'_secure'=>true));
|
27 |
-
?>
|
28 |
|
29 |
-
<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="
|
|
|
30 |
|
31 |
<script type="text/javascript">
|
32 |
-
|
33 |
-
|
34 |
-
var eventUrlPath = '<?php echo $xpayUrl; ?>';
|
35 |
-
Event.observe(window, 'message', function (event) {
|
36 |
-
var eventUrl = event.origin;
|
37 |
-
if (eventUrl == eventUrlPath) {
|
38 |
-
var jsonEventData = JSON.parse(event.data)
|
39 |
-
if (jsonEventData.message = "paymentFormSubmitError") {
|
40 |
-
if (jsonEventData.params.type != undefined && jsonEventData.params.type == "2") {
|
41 |
-
Foobar = function () {
|
42 |
-
this.callBack = function () {
|
43 |
-
window.location.replace(redirectUrl);
|
44 |
-
};
|
45 |
-
}
|
46 |
-
Foobar.prototype = {
|
47 |
-
Init: function () {
|
48 |
-
var self = this;
|
49 |
-
var errorMessage = jsonEventData.params.error+ " (X-Payments)";
|
50 |
-
alert(errorMessage);
|
51 |
-
self.callBack.call();
|
52 |
-
|
53 |
-
}
|
54 |
-
};
|
55 |
-
var foobar = new Foobar();
|
56 |
-
foobar.Init();
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
});
|
61 |
-
|
62 |
-
//add 'validate-agreement' class into 'terms and conditions' form
|
63 |
-
if ($("checkout-agreements") != null) {
|
64 |
-
$$("#checkout-agreements input").each(function (obj, item) {
|
65 |
-
if (!$(obj).hasClassName("validate-agreement")) {
|
66 |
-
$(obj).addClassName('validate-agreement');
|
67 |
-
}
|
68 |
-
});
|
69 |
-
}
|
70 |
-
|
71 |
-
Validation.add('validate-agreement',
|
72 |
-
'<?php echo $this->__('Please agree to all the terms and conditions before placing the order.'); ?>',
|
73 |
-
function (v) {
|
74 |
-
return !Validation.get('IsEmpty').test(v);
|
75 |
-
});
|
76 |
</script>
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="javascript: review.save();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
|
26 |
+
<div id="xpayment-review-block"></div>
|
27 |
|
28 |
<script type="text/javascript">
|
29 |
+
jQuery('#xpayment-review-block').ready( function() {
|
30 |
+
jQuery(document).trigger('xpc:reviewBlockLoaded', {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
</script>
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/xpayment-iframe.phtml
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +14,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -26,54 +28,13 @@
|
|
26 |
* @see Cdev_XPaymentsConnector_Block_Checkout_Onepage_Settings
|
27 |
*/
|
28 |
?>
|
|
|
29 |
|
30 |
-
|
31 |
-
$xpHelper = Mage::helper("xpaymentsconnector");
|
32 |
-
$useIframe = Mage::getStoreConfig('payment/xpayments/use_iframe');
|
33 |
-
$isRecuringProduct = $xpHelper->checkIssetRecurringOrder();
|
34 |
-
$IsSaveCardsPaymentActive = (bool)Mage::getStoreConfig('payment/savedcards/active');
|
35 |
-
$displayOnPaymentStep = (bool)(Mage::getStoreConfig('payment/xpayments/placedisplay') == "review");
|
36 |
-
?>
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
$iFrameUrl = $xpHelper->getIframeUrl();
|
41 |
-
$isNeedToSaveUserCard = $xpHelper->isNeedToSaveUserCard();
|
42 |
-
$customerRegistered = $xpHelper->isRegisteredUser();
|
43 |
-
?>
|
44 |
-
<div id="xpayment-iframe-block">
|
45 |
-
<iframe id="xp-iframe" class="xp-iframe" data-src="<?php echo $iFrameUrl;?>" src="<?php echo $iFrameUrl;?>" name="xp-iframe">
|
46 |
-
</iframe>
|
47 |
-
<?php if($customerRegistered):?>
|
48 |
-
<?php if(!$isRecuringProduct["isset"]): ?>
|
49 |
-
<?php if ($IsSaveCardsPaymentActive): ?>
|
50 |
-
<span id="iframe-save-card-switcher" >
|
51 |
-
<input type="checkbox" <?php echo ($isNeedToSaveUserCard)?"checked":"";?> title="<?php echo $this->__("Use this credit card"); ?>" class="checkbox x-payment-card " id="iframe_savecard" name="iframe_savecard" value="1" />
|
52 |
-
<label for="iframe_savecard"><?php echo $this->__("I want to use this credit card for my future orders in this shop."); ?></label>
|
53 |
-
</span>
|
54 |
-
<script type="text/javascript">
|
55 |
-
var url = "<?php echo Mage::getUrl("xpaymentsconnector/processing/saveusercard");?>";
|
56 |
-
$('iframe_savecard').observe('change',
|
57 |
-
function() {
|
58 |
-
if($('iframe_savecard').checked === true) {
|
59 |
-
new Ajax.Request(url, {
|
60 |
-
parameters: "user_card_save=1"
|
61 |
-
});
|
62 |
-
}else{
|
63 |
-
new Ajax.Request(url, {
|
64 |
-
parameters: "user_card_save=0"
|
65 |
-
});
|
66 |
-
}
|
67 |
-
});
|
68 |
-
</script>
|
69 |
-
<?php endif; ?>
|
70 |
-
<?php else: ?>
|
71 |
-
<span id="iframe-save-card-switcher" >
|
72 |
-
<?php echo $this->__("Your credit card will be saved for this subscription."); ?>
|
73 |
-
</span>
|
74 |
-
<?php endif;?>
|
75 |
-
<?php endif;?>
|
76 |
-
</div>
|
77 |
-
<?php endif;?>
|
78 |
|
|
|
79 |
|
|
1 |
<?php
|
2 |
+
// vim: set ts=2 sw=2 sts=2 et:
|
3 |
+
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
?>
|
28 |
* @see Cdev_XPaymentsConnector_Block_Checkout_Onepage_Settings
|
29 |
*/
|
30 |
?>
|
31 |
+
<?php if ($this->isVisible()): ?>
|
32 |
|
33 |
+
<div id="xpayment-iframe-block">
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
<iframe id="xp-iframe" class="xp-iframe" src="" name="xp-iframe"></iframe>
|
36 |
+
<div id="paymentstep-ajax-loader"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
</div>
|
39 |
|
40 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/xpaymentsconnector/checkout/success.phtml
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
*
|
21 |
* @category design
|
22 |
* @package base_default
|
23 |
-
* @copyright
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
20 |
*
|
21 |
* @category design
|
22 |
* @package base_default
|
23 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/customer/cardaddsuccess.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
/**
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
/**
|
app/design/frontend/base/default/template/xpaymentsconnector/customer/usercards/cardadd.phtml
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -79,7 +80,12 @@ $xpayUrl = $this->getXpayUrl();
|
|
79 |
Event.observe(window, 'message', function (event) {
|
80 |
var eventUrl = event.origin;
|
81 |
if (eventUrl == eventUrlPath) {
|
82 |
-
var jsonEventData = JSON.parse(event.data)
|
|
|
|
|
|
|
|
|
|
|
83 |
if (jsonEventData.message = "paymentFormSubmitError") {
|
84 |
if (jsonEventData.params.type != undefined && jsonEventData.params.type == "2") {
|
85 |
Foobar = function () {
|
@@ -100,6 +106,10 @@ $xpayUrl = $this->getXpayUrl();
|
|
100 |
var foobar = new Foobar();
|
101 |
foobar.Init();
|
102 |
}
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
}
|
105 |
});
|
@@ -126,4 +136,4 @@ $xpayUrl = $this->getXpayUrl();
|
|
126 |
$("create-card-button").show();
|
127 |
$("card-add-please-wait").hide()
|
128 |
}
|
129 |
-
</script>
|
1 |
<?php
|
2 |
+
// vim: set ts=2 sw=2 sts=2 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
?>
|
80 |
Event.observe(window, 'message', function (event) {
|
81 |
var eventUrl = event.origin;
|
82 |
if (eventUrl == eventUrlPath) {
|
83 |
+
var jsonEventData = JSON.parse(event.data);
|
84 |
+
|
85 |
+
if (jsonEventData.params.height) {
|
86 |
+
$('xp-iframe').setStyle({'height': jsonEventData.params.height +'px'});
|
87 |
+
}
|
88 |
+
|
89 |
if (jsonEventData.message = "paymentFormSubmitError") {
|
90 |
if (jsonEventData.params.type != undefined && jsonEventData.params.type == "2") {
|
91 |
Foobar = function () {
|
106 |
var foobar = new Foobar();
|
107 |
foobar.Init();
|
108 |
}
|
109 |
+
if (jsonEventData.params.type != undefined && jsonEventData.params.type == "4") {
|
110 |
+
var errorMessage = jsonEventData.params.error + " (X-Payments)";
|
111 |
+
alert(errorMessage);
|
112 |
+
}
|
113 |
}
|
114 |
}
|
115 |
});
|
136 |
$("create-card-button").show();
|
137 |
$("card-add-please-wait").hide()
|
138 |
}
|
139 |
+
</script>
|
app/design/frontend/base/default/template/xpaymentsconnector/customer/usercards/list.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/failure.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/form/cc.phtml
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +14,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -24,98 +26,23 @@
|
|
24 |
* @see Cdev_XPaymentsConnector_Block_Form_Cc
|
25 |
*/
|
26 |
?>
|
27 |
-
<?php
|
28 |
-
$_code=$this->getMethodCode();
|
29 |
-
$useIframe = Mage::getStoreConfig('payment/xpayments/use_iframe');
|
30 |
-
$isRecuringProduct = Mage::helper("xpaymentsconnector")->checkIssetRecurringOrder();
|
31 |
-
$IsSaveCardsPaymentActive = (bool)Mage::getStoreConfig('payment/savedcards/active');
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
$isNeedToSaveUserCard = Mage::helper("xpaymentsconnector")->isNeedToSaveUserCard();
|
37 |
-
$customerRegistered = Mage::helper("xpaymentsconnector")->isRegisteredUser();
|
38 |
-
?>
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
<?php if ($IsSaveCardsPaymentActive): ?>
|
43 |
-
<ul id="payment_form_<?php echo $_code ?>" style="display:none;">
|
44 |
-
<li>
|
45 |
-
<span class="input-box">
|
46 |
-
<input type="checkbox"
|
47 |
-
title="<?php echo $this->__("I want to save a credit card for my future orders in this shop"); ?>"
|
48 |
-
class="checkbox x-payment-card " id="<?php echo $_code . "_" . "save_card" ?>"
|
49 |
-
name="savecard" value="1"/>
|
50 |
-
<label
|
51 |
-
for="<?php echo $_code . "_" . "save_card" ?>"><?php echo $this->__("I want to save a credit card for my future orders in this shop"); ?></label>
|
52 |
-
</span>
|
53 |
-
</li>
|
54 |
-
</ul>
|
55 |
-
<?php endif; ?>
|
56 |
-
<?php else: ?>
|
57 |
-
<ul id="payment_form_<?php echo $_code ?>" style="display:none;">
|
58 |
-
<li>
|
59 |
-
<span class="input-box">
|
60 |
-
<?php echo $this->__("Your credit card will be saved for this subscription."); ?>
|
61 |
-
</span>
|
62 |
-
</li>
|
63 |
-
</ul>
|
64 |
-
<?php endif; ?>
|
65 |
-
<?php elseif($displayOnPaymentStep): ?>
|
66 |
-
<?php $iframeUrl = $this->getIframeUrl();?>
|
67 |
-
<ul id="payment_form_<?php echo $_code ?>" style="display:none;">
|
68 |
-
<li>
|
69 |
-
<div id="xpayment-iframe-block">
|
70 |
-
<iframe id="xp-iframe" class="xp-iframe" data-src="<?php echo $iframeUrl; ?>" src="<?php echo $iframeUrl;?>" name="xp-iframe" style="display: none">
|
71 |
-
</iframe>
|
72 |
-
<div id="paymentstep-ajax-loader"></div>
|
73 |
-
<?php if($customerRegistered):?>
|
74 |
-
<?php if(!$isRecuringProduct["isset"]): ?>
|
75 |
-
<?php if ($IsSaveCardsPaymentActive): ?>
|
76 |
-
<span id="iframe-save-card-switcher" >
|
77 |
-
<input type="checkbox" <?php echo ($isNeedToSaveUserCard)?"checked":"";?> title="<?php echo $this->__("Use this credit card"); ?>" class="checkbox x-payment-card " id="iframe_savecard" name="iframe_savecard" value="1" />
|
78 |
-
<label for="iframe_savecard"><?php echo $this->__("I want to use this credit card for my future orders in this shop."); ?></label>
|
79 |
-
</span>
|
80 |
-
<script type="text/javascript">
|
81 |
-
var url = "<?php echo Mage::getUrl("xpaymentsconnector/processing/saveusercard");?>";
|
82 |
-
$('iframe_savecard').observe('change',
|
83 |
-
function() {
|
84 |
-
if($('iframe_savecard').checked === true) {
|
85 |
-
new Ajax.Request(url, {
|
86 |
-
parameters: "user_card_save=1"
|
87 |
-
});
|
88 |
-
}else{
|
89 |
-
new Ajax.Request(url, {
|
90 |
-
parameters: "user_card_save=0"
|
91 |
-
});
|
92 |
-
}
|
93 |
-
});
|
94 |
-
</script>
|
95 |
-
<?php endif; ?>
|
96 |
-
<?php else: ?>
|
97 |
-
<span id="iframe-save-card-switcher" >
|
98 |
-
<?php echo $this->__("Your credit card will be saved for this subscription."); ?>
|
99 |
-
</span>
|
100 |
-
<?php endif;?>
|
101 |
-
<?php endif;?>
|
102 |
-
</div>
|
103 |
-
</li>
|
104 |
-
</ul>
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
displayIframeOnPaymentStep = '<?php echo $displayOnPaymentStep ?>';
|
110 |
-
iframe = $('xp-iframe');
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
|
118 |
<?php endif; ?>
|
119 |
-
|
120 |
-
|
121 |
-
|
1 |
<?php
|
2 |
+
// vim: set ts=2 sw=2 sts=2 et:
|
3 |
+
|
4 |
/**
|
5 |
* Magento
|
6 |
*
|
14 |
* obtain it through the world-wide-web, please send an email
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
+
* @author Qualiteam Software info@qtmsoft.com
|
18 |
* @category Cdev
|
19 |
* @package Cdev_XPaymentsConnector
|
20 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
?>
|
26 |
* @see Cdev_XPaymentsConnector_Block_Form_Cc
|
27 |
*/
|
28 |
?>
|
29 |
+
<?php if ($this->isVisible()): ?>
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
<ul id="payment_form_xpayments">
|
32 |
+
<li>
|
33 |
+
<div id="xpayment-iframe-block">
|
|
|
|
|
|
|
34 |
|
35 |
+
<iframe id="xp-iframe" class="xp-iframe" src="" name="xp-iframe"></iframe>
|
36 |
+
<div id="paymentstep-ajax-loader"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
</div>
|
39 |
+
</li>
|
40 |
+
</ul>
|
|
|
|
|
41 |
|
42 |
+
<script type="text/javascript">
|
43 |
+
//<![CDATA[
|
44 |
+
document.fire('xpc:iframeBlockLoaded');
|
45 |
+
//]]>
|
46 |
+
</script>
|
47 |
|
48 |
<?php endif; ?>
|
|
|
|
|
|
app/design/frontend/base/default/template/xpaymentsconnector/form/savedcards.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/info/cc.phtml
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Magento
|
4 |
*
|
@@ -12,10 +13,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
@@ -27,26 +28,21 @@
|
|
27 |
<?php
|
28 |
|
29 |
$order = $this->getInfo()->getMethodInstance()->getOrder();
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
}
|
|
|
34 |
?>
|
35 |
|
36 |
<?php echo $this->getMethod()->getTitle(); ?>
|
|
|
37 |
<br />
|
38 |
-
|
39 |
-
|
40 |
-
echo $this->__('You will be redirected to X-Payments website when you place an order.');
|
41 |
-
?>
|
42 |
-
<?php else: ?>
|
43 |
-
<?php
|
44 |
-
echo $this->__('X-Payments Transaction ID: %s', $this->htmlEscape($this->getInfo()->getLastTransId()));
|
45 |
-
?>
|
46 |
-
<br/>
|
47 |
-
<?php endif; ?>
|
48 |
-
<?php if(!empty($orderCardData)): ?>
|
49 |
<span id="x-payment-prepaid-card-info">
|
50 |
-
|
51 |
</span>
|
52 |
-
<?php endif
|
1 |
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
?>
|
28 |
<?php
|
29 |
|
30 |
$order = $this->getInfo()->getMethodInstance()->getOrder();
|
31 |
+
|
32 |
+
$cardData = '';
|
33 |
+
|
34 |
+
if ($order) {
|
35 |
+
$cardData = $this->getCardData();
|
36 |
}
|
37 |
+
|
38 |
?>
|
39 |
|
40 |
<?php echo $this->getMethod()->getTitle(); ?>
|
41 |
+
|
42 |
<br />
|
43 |
+
|
44 |
+
<?php if ($cardData): ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<span id="x-payment-prepaid-card-info">
|
46 |
+
<?php echo $this->__('Credit card used for this order: %s', $cardData); ?>
|
47 |
</span>
|
48 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/xpaymentsconnector/info/prepaidpayments.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/info/savedcards.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/redirect.phtml
CHANGED
@@ -12,10 +12,10 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @author
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright (c) Qualiteam
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
?>
|
app/design/frontend/base/default/template/xpaymentsconnector/redirectiframe.phtml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
+
* @category Cdev
|
18 |
+
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
?>
|
23 |
+
<?php
|
24 |
+
/**
|
25 |
+
* @see Cdev_XPaymentsConnector_Block_Redirect
|
26 |
+
*/
|
27 |
+
?>
|
28 |
+
|
29 |
+
<?php if ($this->checkToken()): ?>
|
30 |
+
|
31 |
+
<form id="xpc-iframe-redirect" action="<?php echo $this->getFormAction(); ?>" method="post">
|
32 |
+
<?php foreach ($this->getFormData() as $name => $value): ?>
|
33 |
+
<input type="hidden" name="<?php echo $name; ?>" value="<?php echo $value; ?>" />
|
34 |
+
<?php endforeach; ?>
|
35 |
+
</form>
|
36 |
+
|
37 |
+
<script type="text/javascript">
|
38 |
+
//<![CDATA[
|
39 |
+
var paymentform = document.getElementById('xpc-iframe-redirect');
|
40 |
+
if (paymentform) {
|
41 |
+
window.onload = function() {
|
42 |
+
paymentform.submit();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
//]]>
|
46 |
+
</script>
|
47 |
+
|
48 |
+
<?php else: ?>
|
49 |
+
|
50 |
+
<script type="text/javascript">
|
51 |
+
//<![CDATA[
|
52 |
+
var msg = {
|
53 |
+
message: 'paymentFormSubmitError',
|
54 |
+
params: {
|
55 |
+
height: 0,
|
56 |
+
error: 'Oops... Something wrong has happened. Please restart checkout.',
|
57 |
+
type: 1
|
58 |
+
}
|
59 |
+
};
|
60 |
+
|
61 |
+
window.parent.postMessage(JSON.stringify(msg), '*');
|
62 |
+
//]]>
|
63 |
+
</script>
|
64 |
+
|
65 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/xpaymentsconnector/return.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
+
* @category Cdev
|
17 |
+
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
/**
|
22 |
+
* @see Cdev_XPaymentsConnector_Block_Return
|
23 |
+
*/
|
24 |
+
?>
|
25 |
+
|
26 |
+
<script type="text/javascript">
|
27 |
+
|
28 |
+
window.onload = function() {
|
29 |
+
|
30 |
+
if (window.parent !== window) {
|
31 |
+
window.parent.location = '<?php echo $this->getRedirectUrl(); ?>';
|
32 |
+
} else {
|
33 |
+
window.location = '<?php echo $this->getRedirectUrl(); ?>';
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
</script>
|
app/design/frontend/base/default/template/xpaymentsconnector/xpc_data.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// vim: set ts=4 sw=4 sts=4 et:
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
+
* @category Cdev
|
18 |
+
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
/**
|
24 |
+
* X-Payments Connector data via JSON
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<script type="text/javascript">
|
28 |
+
//<![CDATA[
|
29 |
+
xpcData = <?php echo Mage::helper('xpaymentsconnector')->getXpcJsonData(); ?>;
|
30 |
+
//]]>
|
31 |
+
</script>
|
app/etc/modules/Cdev_XPaymentsConnector.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
-
* @copyright
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
* @version SVN: $Id: Cdev_XPaymentsConnector.xml 3624 2010-07-28 05:45:05Z max $
|
21 |
*/
|
15 |
*
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
* @version SVN: $Id: Cdev_XPaymentsConnector.xml 3624 2010-07-28 05:45:05Z max $
|
21 |
*/
|
js/xpayment/backend-xpayment.js
CHANGED
@@ -11,10 +11,10 @@
|
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
-
* @author
|
15 |
* @category Cdev
|
16 |
* @package Cdev_XPaymentsConnector
|
17 |
-
* @copyright (c) Qualiteam
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
+
* @author Qualiteam Software info@qtmsoft.com
|
15 |
* @category Cdev
|
16 |
* @package Cdev_XPaymentsConnector
|
17 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
js/xpayment/checkout-submit.js
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
/**
|
2 |
* Magento
|
3 |
*
|
@@ -11,108 +13,534 @@
|
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
-
* @author
|
15 |
* @category Cdev
|
16 |
* @package Cdev_XPaymentsConnector
|
17 |
-
* @copyright (c) Qualiteam
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
return false;
|
31 |
}
|
32 |
-
}
|
33 |
-
var currentIframeUrl = jQuery("#xp-iframe").attr("src");
|
34 |
-
var currentToken = getUrlParameterByName("token", currentIframeUrl);
|
35 |
-
var postData = {"token": currentToken};
|
36 |
-
jQuery("#review-buttons-container .btn-checkout").hide();
|
37 |
-
jQuery("#review-please-wait").show();
|
38 |
-
|
39 |
-
jQuery.ajax({
|
40 |
-
url: iframeCheckUrl,
|
41 |
-
type: 'post',
|
42 |
-
data: postData,
|
43 |
-
success: function (data) {
|
44 |
-
var respnse = jQuery.parseJSON(data);
|
45 |
-
if (respnse.is_actual == false) {
|
46 |
-
alert(respnse.error_message)
|
47 |
-
window.location.replace(respnse.redirect);
|
48 |
-
return false;
|
49 |
-
}
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
}
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
});
|
69 |
|
70 |
-
|
|
|
|
|
|
|
71 |
|
|
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
-
jQuery("#review-buttons-container .btn-checkout").show();
|
79 |
-
jQuery("#review-please-wait").hide();
|
80 |
-
}
|
81 |
|
|
|
|
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
86 |
-
results = regex.exec(url);
|
87 |
-
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
88 |
-
}
|
89 |
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
});
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
});
|
117 |
|
118 |
|
1 |
+
// vim: set ts=2 sw=2 sts=2 et:
|
2 |
+
|
3 |
/**
|
4 |
* Magento
|
5 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @author Qualiteam Software info@qtmsoft.com
|
17 |
* @category Cdev
|
18 |
* @package Cdev_XPaymentsConnector
|
19 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
|
23 |
+
/**
|
24 |
+
* IFRAME actions
|
25 |
+
*/
|
26 |
+
var XPC_IFRAME_DO_NOTHING = 0;
|
27 |
+
var XPC_IFRAME_CHANGE_METHOD = 1;
|
28 |
+
var XPC_IFRAME_CLEAR_INIT_DATA = 2;
|
29 |
+
var XPC_IFRAME_ALERT = 3;
|
30 |
+
var XPC_IFRAME_TOP_MESSAGE = 4;
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Submit payment in X-Payments
|
35 |
+
*/
|
36 |
+
function sendSubmitMessage()
|
37 |
+
{
|
38 |
+
var message = {
|
39 |
+
message: 'submitPaymentForm',
|
40 |
+
params: {}
|
41 |
+
};
|
42 |
+
|
43 |
+
message = JSON.stringify(message);
|
44 |
+
|
45 |
+
$('xp-iframe').contentWindow.postMessage(message, '*');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Check if X-Payments method is currently selected at checkout
|
50 |
+
*/
|
51 |
+
function isXpcMethod()
|
52 |
+
{
|
53 |
+
var block = $$('input:checked[type=radio][name=payment[method]][value=xpayments]');
|
54 |
+
|
55 |
+
return Boolean(block.length);
|
56 |
+
}
|
57 |
+
|
58 |
+
document.observe('dom:loaded', function () {
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Redirect or reload iframe
|
62 |
+
*/
|
63 |
+
document.observe('xpc:redirectIframe', function (event) {
|
64 |
+
|
65 |
+
console.log('xpc:redirectIframe', event.memo);
|
66 |
+
|
67 |
+
var iframe = $('xp-iframe');
|
68 |
+
|
69 |
+
if (typeof event.memo == 'string') {
|
70 |
+
|
71 |
+
// Use passed src
|
72 |
+
var src = event.memo;
|
73 |
+
|
74 |
+
} else if ('' != iframe.getAttribute('src')) {
|
75 |
+
|
76 |
+
|
77 |
+
// Reload iframe
|
78 |
+
var src = iframe.getAttribute('src');
|
79 |
|
80 |
+
} else {
|
81 |
+
|
82 |
+
// Redirect iframe to the payment page
|
83 |
+
var src = xpcData.url.redirectIframe;
|
|
|
84 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
iframe.setStyle( {'height' : '0px'} );
|
87 |
+
$('paymentstep-ajax-loader').setStyle({'display' : 'block'});
|
88 |
+
|
89 |
+
if (!xpcData.displayOnReviewStep) {
|
90 |
+
$('payment_form_xpayments').setStyle( {'height' : 'auto'} );
|
91 |
+
}
|
92 |
+
|
93 |
+
iframe.setAttribute('src', src);
|
94 |
+
});
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Block with X-Payments iframe is loaded.
|
98 |
+
*/
|
99 |
+
document.observe('xpc:iframeBlockLoaded', function (event) {
|
100 |
+
|
101 |
+
console.log('xpc:iframeBlockLoaded', event.memo);
|
102 |
+
|
103 |
+
if (isXpcMethod()) {
|
104 |
+
document.fire('xpc:redirectIframe');
|
105 |
+
}
|
106 |
+
});
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Checkout is changed. Probably we should do something with X-Payments iframe
|
110 |
+
*/
|
111 |
+
document.observe('xpc:checkoutChanged', function (event) {
|
112 |
+
|
113 |
+
console.log('xpc:checkoutChanged', event.memo);
|
114 |
+
|
115 |
+
if (
|
116 |
+
$('xpayment-iframe-block')
|
117 |
+
&& typeof xpcData != 'undefined'
|
118 |
+
) {
|
119 |
+
document.fire('xpc:iframeBlockLoaded');
|
120 |
+
}
|
121 |
+
});
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Review is loaded somewhere. Somehow. It contsins the place order button.
|
125 |
+
*/
|
126 |
+
document.observe('xpc:reviewBlockLoaded', function (event) {
|
127 |
+
|
128 |
+
console.log('xpc:reviewBlockLoaded', event.memo);
|
129 |
+
|
130 |
+
Review.prototype.save = Review.prototype.save.wrap(
|
131 |
+
function(parentMethod) {
|
132 |
+
|
133 |
+
if (isXpcMethod()) {
|
134 |
+
|
135 |
+
if (checkout.loadWaiting != false) {
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
|
139 |
+
checkout.setLoadWaiting('review');
|
140 |
|
141 |
+
if (this.agreementsForm) {
|
142 |
+
params = Form.serialize(this.agreementsForm);
|
143 |
+
} else {
|
144 |
+
params = '';
|
145 |
+
}
|
146 |
+
|
147 |
+
new Ajax.Request(
|
148 |
+
xpcData.url.checkAgreements,
|
149 |
+
{
|
150 |
+
method: 'Post',
|
151 |
+
parameters: params,
|
152 |
+
onComplete: function (response) {
|
153 |
+
|
154 |
+
response = JSON.parse(response.responseText);
|
155 |
+
|
156 |
+
if (response.error_messages) {
|
157 |
+
|
158 |
+
alert(response.error_messages);
|
159 |
+
checkout.setLoadWaiting(false);
|
160 |
+
|
161 |
+
} else {
|
162 |
+
|
163 |
+
if (xpcData.useIframe) {
|
164 |
+
sendSubmitMessage();
|
165 |
+
} else {
|
166 |
+
window.location.href = xpcData.url.redirectIframeUnsetOrder;
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
);
|
173 |
+
|
174 |
+
} else {
|
175 |
+
return parentMethod();
|
176 |
}
|
177 |
}
|
178 |
+
);
|
179 |
+
|
180 |
+
if (
|
181 |
+
typeof xpcData != 'undefined'
|
182 |
+
&& xpcData.displayOnReviewStep
|
183 |
+
) {
|
184 |
+
document.fire('xpc:checkoutChanged');
|
185 |
}
|
186 |
});
|
187 |
|
188 |
+
/**
|
189 |
+
* Place order via One Step Checkout.
|
190 |
+
*/
|
191 |
+
document.observe('xpc:oneStepCheckoutPlaceOrder', function (event) {
|
192 |
|
193 |
+
console.log('xpc:oneStepCheckoutPlaceOrder', event.memo);
|
194 |
|
195 |
+
var data = $('onestepcheckout-form').serialize(true);
|
196 |
+
|
197 |
+
// Save checkout data
|
198 |
+
new Ajax.Request(
|
199 |
+
xpcData.url.saveCheckoutData,
|
200 |
+
{
|
201 |
+
method: 'Post',
|
202 |
+
parameters: data,
|
203 |
+
onComplete: function(response) {
|
204 |
+
if (200 == response.status) {
|
205 |
+
sendSubmitMessage();
|
206 |
+
} else {
|
207 |
+
document.fire('xpc:showMessage', {text: 'Error processing request'});
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
);
|
212 |
+
});
|
213 |
+
|
214 |
+
/**
|
215 |
+
* X-Payments iframe is ready.
|
216 |
+
*/
|
217 |
+
document.observe('xpc:ready', function (event) {
|
218 |
+
|
219 |
+
console.log('xpc:ready', event.memo);
|
220 |
+
|
221 |
+
$('paymentstep-ajax-loader').hide();
|
222 |
+
|
223 |
+
var iframe = $('xp-iframe');
|
224 |
+
|
225 |
+
if (
|
226 |
+
event.memo.height
|
227 |
+
&& (
|
228 |
+
xpcData.displayOnReviewStep
|
229 |
+
|| !xpcData.isOneStepCheckout && !xpcData.height
|
230 |
+
|| xpcData.isOneStepCheckout
|
231 |
+
|| xpcData.isFirecheckout
|
232 |
+
)
|
233 |
+
) {
|
234 |
+
|
235 |
+
// Height is sent correctly only if iframe is visible.
|
236 |
+
// For default onepage checkout if iframe is displayed on the payment step
|
237 |
+
// the iframe is hidden and shown in case of the error
|
238 |
+
var height = event.memo.height;
|
239 |
+
|
240 |
+
// Save height for future
|
241 |
+
xpcData.height = height;
|
242 |
+
|
243 |
+
} else {
|
244 |
+
|
245 |
+
// Use previously saved value
|
246 |
+
var height = xpcData.height;
|
247 |
+
}
|
248 |
+
|
249 |
+
iframe.setStyle( {'height': height + 'px'} );
|
250 |
+
});
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Notify store about customer's choice to register.
|
254 |
+
*/
|
255 |
+
document.observe('xpc:setCheckoutMethod', function (event) {
|
256 |
+
|
257 |
+
console.log('xpc:setCheckoutMethod', event.memo);
|
258 |
+
|
259 |
+
if (typeof event.memo == 'boolean' && event.memo) {
|
260 |
+
var src = xpcData.url.setMethodRegister;
|
261 |
+
} else {
|
262 |
+
var src = xpcData.url.setMethodGuest;
|
263 |
+
}
|
264 |
+
|
265 |
+
if (isXpcMethod()) {
|
266 |
+
|
267 |
+
// Reload iframe
|
268 |
+
document.fire('xpc:redirectIframe', src);
|
269 |
+
|
270 |
+
} else {
|
271 |
+
|
272 |
+
// Set checkout method in backgraud
|
273 |
+
new Ajax.Request(src);
|
274 |
+
|
275 |
+
// Remove iframe srs, so it's reloaded when shown
|
276 |
+
$('xp-iframe').setAttribute('src', '');
|
277 |
+
}
|
278 |
+
});
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Payment form is submitted from X-Payments.
|
282 |
+
*/
|
283 |
+
document.observe('xpc:showMessage', function (event) {
|
284 |
+
|
285 |
+
console.log('xpc:showMessage', event.memo);
|
286 |
+
|
287 |
+
// TODO: This is better via some jQuery popup widget
|
288 |
+
alert(event.memo.text);
|
289 |
+
});
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Payment form is submitted from X-Payments.
|
293 |
+
*/
|
294 |
+
document.observe('xpc:paymentFormSubmit', function (event) {
|
295 |
+
|
296 |
+
console.log('xpc:paymentFormSubmit', event.memo);
|
297 |
+
|
298 |
+
jQuery('.button.btn-checkout').click();
|
299 |
+
});
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Error in submitting payment form from X-Payments.
|
303 |
+
*/
|
304 |
+
document.observe('xpc:paymentFormSubmitError', function (event) {
|
305 |
+
|
306 |
+
console.log('xpc:paymentFormSubmitError', event.memo);
|
307 |
+
|
308 |
+
if (event.memo.message) {
|
309 |
+
document.fire('xpc:showMessage', {text: event.memo.message});
|
310 |
+
} else if (event.memo.error) {
|
311 |
+
document.fire('xpc:showMessage', {text: event.memo.error});
|
312 |
+
}
|
313 |
+
|
314 |
+
if (event.memo.height) {
|
315 |
+
$('xp-iframe').setStyle( {'height': event.memo.height + 'px'} );
|
316 |
+
}
|
317 |
+
|
318 |
+
type = parseInt(event.memo.type);
|
319 |
+
|
320 |
+
if (XPC_IFRAME_CLEAR_INIT_DATA == type) {
|
321 |
+
|
322 |
+
document.fire('xpc:clearInitData');
|
323 |
+
document.fire('xpc:goToPaymentSection');
|
324 |
+
document.fire('xpc:enableCheckout');
|
325 |
+
|
326 |
+
} else if (XPC_IFRAME_CHANGE_METHOD == type) {
|
327 |
+
|
328 |
+
document.fire('xpc:clearInitData');
|
329 |
+
document.fire('xpc:goToPaymentSection');
|
330 |
+
document.fire('xpc:changeMethod');
|
331 |
+
document.fire('xpc:enableCheckout');
|
332 |
+
|
333 |
+
} else {
|
334 |
+
|
335 |
+
// Alert or show message action
|
336 |
+
|
337 |
+
document.fire('xpc:goToPaymentSection');
|
338 |
+
document.fire('xpc:enableCheckout');
|
339 |
+
}
|
340 |
+
});
|
341 |
+
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Clear init data and reload iframe.
|
345 |
+
*/
|
346 |
+
document.observe('xpc:clearInitData', function (event) {
|
347 |
+
|
348 |
+
console.log('xpc:clearInitData', event.memo);
|
349 |
+
|
350 |
+
document.fire('xpc:redirectIframe', xpcData.url.redirectIframeUnsetOrder);
|
351 |
+
});
|
352 |
+
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Return customer to the payment section/step of checkout
|
356 |
+
*/
|
357 |
+
document.observe('xpc:goToPaymentSection', function (event) {
|
358 |
+
|
359 |
+
console.log('xpc:goToPaymentSection', event.memo);
|
360 |
+
|
361 |
+
if (
|
362 |
+
typeof checkout != 'undefined'
|
363 |
+
&& checkout.gotoSection
|
364 |
+
&& !xpcData.displayOnReviewStep
|
365 |
+
) {
|
366 |
+
|
367 |
+
checkout.gotoSection('payment', false);
|
368 |
+
}
|
369 |
+
});
|
370 |
+
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Re-enable checkout to allow place order.
|
374 |
+
*/
|
375 |
+
document.observe('xpc:enableCheckout', function (event) {
|
376 |
+
|
377 |
+
console.log('xpc:enableCheckout', event.memo);
|
378 |
+
|
379 |
+
// This is for One Step Checkout
|
380 |
+
if ($('onestepcheckout-form')) {
|
381 |
+
|
382 |
+
var submitelement = $('onestepcheckout-place-order');
|
383 |
+
|
384 |
+
if (submitelement) {
|
385 |
+
submitelement.removeClassName('grey');
|
386 |
+
submitelement.addClassName('orange');
|
387 |
+
submitelement.disabled = false;
|
388 |
+
}
|
389 |
+
|
390 |
+
var loaderelement = $$('span.onestepcheckout-place-order-loading')[0];
|
391 |
+
|
392 |
+
if (loaderelement) {
|
393 |
+
loaderelement.remove();
|
394 |
+
}
|
395 |
+
|
396 |
+
already_placing_order = false;
|
397 |
+
}
|
398 |
+
|
399 |
+
// This is for Firecheckout
|
400 |
+
if ($('firecheckout-form')) {
|
401 |
+
|
402 |
+
checkout.setLoadWaiting(false);
|
403 |
+
$('review-please-wait').hide();
|
404 |
+
}
|
405 |
+
|
406 |
+
// This is for default onepage checkout
|
407 |
+
if ($('co-payment-form')) {
|
408 |
+
checkout.setLoadWaiting(false);
|
409 |
+
}
|
410 |
+
});
|
411 |
+
|
412 |
+
|
413 |
+
/**
|
414 |
+
* Change payment method.
|
415 |
+
*/
|
416 |
+
document.observe('xpc:changeMethod', function (event) {
|
417 |
+
|
418 |
+
console.log('xpc:changeMethod', event.memo);
|
419 |
+
|
420 |
+
window.location.href = xpcData.url.changeMethod;
|
421 |
+
|
422 |
+
});
|
423 |
+
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Check and re-trigger event from X-Payments iframe
|
427 |
+
*/
|
428 |
+
Event.observe(window, 'message', function (event) {
|
429 |
+
|
430 |
+
if (event.origin == xpcData.xpOrigin) {
|
431 |
+
var data = JSON.parse(event.data)
|
432 |
+
|
433 |
+
document.fire('xpc:' + data.message, data.params);
|
434 |
+
}
|
435 |
+
});
|
436 |
+
|
437 |
+
|
438 |
+
// This is for One Step Checkout
|
439 |
+
if ($('onestepcheckout-form')) {
|
440 |
+
|
441 |
+
// Checkout is loaded
|
442 |
+
document.fire('xpc:checkoutChanged', 'loaded');
|
443 |
+
|
444 |
+
get_separate_save_methods_function = get_separate_save_methods_function.wrap(
|
445 |
+
function (originalMethod, url, update_payments) {
|
446 |
+
|
447 |
+
var result = originalMethod(url, update_payments);
|
448 |
+
|
449 |
+
// Shipping method changed
|
450 |
+
document.fire('xpc:checkoutChanged', 'shipping');
|
451 |
+
|
452 |
+
$('onestepcheckout-form').on('change', '.radio', function() {
|
453 |
+
// Payment method changed
|
454 |
+
document.fire('xpc:checkoutChanged', 'payment');
|
455 |
+
});
|
456 |
+
|
457 |
+
return result;
|
458 |
+
}
|
459 |
+
);
|
460 |
+
|
461 |
+
if ($('id_create_account')) {
|
462 |
+
$('id_create_account').on('change', function(event, elm) {
|
463 |
+
document.fire('xpc:setCheckoutMethod', elm.checked);
|
464 |
+
});
|
465 |
+
}
|
466 |
}
|
|
|
|
|
|
|
467 |
|
468 |
+
// This is for Firecheckout
|
469 |
+
if ($('firecheckout-form')) {
|
470 |
|
471 |
+
// Checkout is loaded
|
472 |
+
document.fire('xpc:checkoutChanged', 'loaded');
|
|
|
|
|
|
|
|
|
473 |
|
474 |
+
$('firecheckout-form').on('change', '.radio', function() {
|
475 |
|
476 |
+
// Shipping or payment method changed
|
477 |
+
document.fire('xpc:checkoutChanged', 'paymentOrShipping');
|
478 |
+
});
|
479 |
+
|
480 |
+
if ($('billing:register_account')) {
|
481 |
+
$('billing:register_account').on('change', function(event, elm) {
|
482 |
+
document.fire('xpc:setCheckoutMethod', elm.checked);
|
483 |
+
});
|
484 |
+
}
|
485 |
+
|
486 |
+
FireCheckout.prototype.save = FireCheckout.prototype.save.wrap(
|
487 |
+
function(parentMethod, urlSuffix, forceSave) {
|
488 |
+
|
489 |
+
if (isXpcMethod()) {
|
490 |
+
|
491 |
+
if (this.loadWaiting != false) {
|
492 |
+
return;
|
493 |
+
}
|
494 |
+
|
495 |
+
// Save original "save" URL
|
496 |
+
this.urls.savedSave = this.urls.save;
|
497 |
+
|
498 |
+
this.urls.save = xpcData.url.saveCheckoutData;
|
499 |
+
|
500 |
+
parentMethod(urlSuffix, forceSave);
|
501 |
+
|
502 |
+
checkout.setLoadWaiting(true);
|
503 |
+
$('review-please-wait').show();
|
504 |
+
|
505 |
+
this.urls.save = this.urls.savedSave;
|
506 |
+
|
507 |
+
if (xpcData.useIframe) {
|
508 |
+
sendSubmitMessage();
|
509 |
+
} else {
|
510 |
+
window.location.href = xpcData.url.redirectIframeUnsetOrder;
|
511 |
}
|
512 |
+
|
513 |
+
} else {
|
514 |
+
|
515 |
+
return parentMethod(urlSuffix, forceSave);
|
516 |
}
|
517 |
}
|
518 |
+
);
|
519 |
+
|
520 |
+
}
|
521 |
+
|
522 |
+
|
523 |
+
// This is for default onepage checkout
|
524 |
+
if ($('co-payment-form')) {
|
525 |
+
|
526 |
+
// Checkout is loaded
|
527 |
+
document.fire('xpc:checkoutChanged', 'loaded');
|
528 |
+
|
529 |
+
$('co-payment-form').on('change', '.radio', function() {
|
530 |
+
|
531 |
+
// Payment method changed
|
532 |
+
document.fire('xpc:checkoutChanged', 'payment');
|
533 |
});
|
534 |
|
535 |
+
ShippingMethod.prototype.save = ShippingMethod.prototype.save.wrap(
|
536 |
+
function(parentMethod) {
|
537 |
+
parentMethod();
|
538 |
+
|
539 |
+
// Shipping method changed
|
540 |
+
document.fire('xpc:checkoutChanged', 'shipping');
|
541 |
+
}
|
542 |
+
);
|
543 |
+
}
|
544 |
});
|
545 |
|
546 |
|
js/xpayment/settings.css
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
/**
|
|
|
2 |
* Magento
|
3 |
*
|
4 |
* NOTICE OF LICENSE
|
@@ -11,23 +12,20 @@
|
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
-
* @author
|
15 |
* @category Cdev
|
16 |
* @package Cdev_XPaymentsConnector
|
17 |
-
* @copyright (c) Qualiteam
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
-
|
22 |
text-align: center;
|
23 |
-
height:
|
24 |
-
overflow
|
25 |
-
overflow-y: hidden;
|
26 |
border: 0px;
|
27 |
-
width:
|
28 |
margin: 0 auto;
|
29 |
-
clear: both;
|
30 |
-
margin-left: 13%;
|
31 |
}
|
32 |
|
33 |
#xpayment-iframe-block {
|
@@ -41,15 +39,6 @@
|
|
41 |
border: 0px;
|
42 |
}
|
43 |
|
44 |
-
#checkout-payment-method-load #xpayment-iframe-block iframe{
|
45 |
-
border: 1px solid #d9dde3;
|
46 |
-
margin-left: 0%;
|
47 |
-
}
|
48 |
-
|
49 |
-
iframe .buttonRow {
|
50 |
-
display: none;
|
51 |
-
}
|
52 |
-
|
53 |
* {
|
54 |
margin: 0;
|
55 |
padding: 0;
|
@@ -78,11 +67,16 @@ iframe .buttonRow {
|
|
78 |
|
79 |
#paymentstep-ajax-loader {
|
80 |
background: url("images/loader.gif") 50% 50% no-repeat;
|
81 |
-
height:
|
82 |
margin-bottom: 0;
|
83 |
margin-right: 0;
|
84 |
text-align: center;
|
85 |
z-index: 100000;
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
#payment_form_xpayments > li {
|
1 |
/**
|
2 |
+
vim: set ts=4 sw=4 sts=4 et:
|
3 |
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @author Qualiteam Software info@qtmsoft.com
|
16 |
* @category Cdev
|
17 |
* @package Cdev_XPaymentsConnector
|
18 |
+
* @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
+
iframe.xp-iframe {
|
23 |
text-align: center;
|
24 |
+
height: 0px;
|
25 |
+
overflow: hidden;
|
|
|
26 |
border: 0px;
|
27 |
+
width: 100%;
|
28 |
margin: 0 auto;
|
|
|
|
|
29 |
}
|
30 |
|
31 |
#xpayment-iframe-block {
|
39 |
border: 0px;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
* {
|
43 |
margin: 0;
|
44 |
padding: 0;
|
67 |
|
68 |
#paymentstep-ajax-loader {
|
69 |
background: url("images/loader.gif") 50% 50% no-repeat;
|
70 |
+
height: 55px;
|
71 |
margin-bottom: 0;
|
72 |
margin-right: 0;
|
73 |
text-align: center;
|
74 |
z-index: 100000;
|
75 |
+
display: none;
|
76 |
+
}
|
77 |
+
|
78 |
+
#payment_form_xpayments {
|
79 |
+
height: 0px;
|
80 |
}
|
81 |
|
82 |
#payment_form_xpayments > li {
|
package.xml
CHANGED
@@ -1,20 +1,33 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CDev_XPaymentsConnector</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Connector to integrate Magento CE with X-Payments PA-DSS certified solution for PCI compliant CC processing</summary>
|
10 |
<description>X-Payments connector
|
11 |
-
This extension integrates Magento with X-Payments - a PA-DSS certified payment module
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
<contents><target name="magecommunity"><dir name="Cdev"><dir name="XPaymentsConnector"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Renderer"><file name="Cardnumber.php" hash="dabd9b1044add431fe4f838b6e3881bc"/><file name="Cardtype.php" hash="62499b375fa9c7ba091ff7763d54a95d"/><file name="Txnid.php" hash="993e4c40a3bb3b55f5b1a5a99adffd78"/></dir><dir name="Tab"><file name="Usercards.php" hash="248e454bc1c43d41013fd5d077b39961"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Xporderstate.php" hash="939602c0f0a5caf9217673c9ebcc7c7f"/></dir></dir><file name="View.php" hash="ba604dc5e8e58b047e7f95bde35eb934"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Subselect.php" hash="c989f9ce4b9af2885c6d28e874825eab"/></dir></dir></dir><dir name="Usercards"><file name="Grid.php" hash="f9dc7cb51008ff14eb82e8dcb6bb0d3f"/></dir></dir><file name="Beforesuccess.php" hash="2a14d9bd2e65f12aee4f77a0f906e320"/><file name="Cancel.php" hash="3283657e21047278d81ac4478ac81de6"/><dir name="Checkout"><dir name="Onepage"><file name="Orderdetail.php" hash="5a62c069916dca4cb809adb476a230dc"/><file name="Settings.php" hash="2422adb2924c023d9829f376a893d553"/><file name="Success.php" hash="14196839f8daecb7d9f2276043769d5a"/></dir></dir><file name="Control.php" hash="7cd0b98c2eacb4bccf0267b8ac37a2cb"/><dir name="Customer"><dir name="Account"><file name="Navigation.php" hash="53fbec326cc5c61b929414df6f71e804"/></dir><file name="Cardadd.php" hash="ddc81440f5490be324d174311ed6b05a"/><file name="Success.php" hash="54f243e60b735cdd5cd879be65838fee"/><file name="Usercards.php" hash="76de3856ad42383c008400245a3135ae"/></dir><file name="Failure.php" hash="537aec3d3ee63ff1ac2d2300c2ca259e"/><dir name="Form"><file name="Cc.php" hash="2f4fbca4ddc11b541d4a2781aae7350e"/><file name="Container.php" hash="0494ad27c46dc3f7f89342188a5448ce"/><file name="Prepaidpayments.php" hash="9a11a9423b4dfc37d607425be54c9a4a"/><file name="Savedcards.php" hash="6e7a8bbfd18a8635d31e659772e2b5ed"/></dir><dir name="Info"><file name="Cc.php" hash="9b9dbaa783301e93ba1dc15cbf9bc3bb"/><file name="Prepaidpayments.php" hash="e72742bba292982787de587f9a53ce60"/><file name="Savedcards.php" hash="94b1a8ea03c07dbcfaef9cebb552ce29"/></dir><dir name="Recurring"><dir name="Profile"><file name="View.php" hash="5e71720c6b6817972b4970df2fd646d2"/></dir></dir><file name="Redirect.php" hash="380f772b003ba0b02e275bd44c67e751"/><file name="Success.php" hash="d2f023bc2206cbb33997b791a57b1b4e"/></dir><dir name="Helper"><file name="Data.php" hash="f77db5406d5790753cd9fb597a1adc81"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Placedisplay.php" hash="a42a68646dc2e1aa77502ec1be0dbaf7"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="Paymentconfiguration"><file name="Collection.php" hash="98760f276af5182d42801865cb116db4"/></dir><file name="Paymentconfiguration.php" hash="ca045f953ec018c583279340c137ff71"/><dir name="Usercards"><file name="Collection.php" hash="6df6d26bef085e86c6db625487006086"/></dir><file name="Usercards.php" hash="ffb98ad5a0c252bbbf14adb086cf0d3c"/></dir><file name="Observer.php" hash="1ffdb21f996044b7698b25e02a152b10"/><dir name="Payment"><file name="Cc.php" hash="45bc368bcac7ccd851282b576cc51ffa"/><file name="Prepaidpayments.php" hash="9bbab2a26748c59609d6c81d8fc37c41"/><dir name="Recurring"><file name="Profile.php" hash="1d0a2ac393a55f586a1cc8016538e5df"/></dir><file name="Savedcards.php" hash="ca1a15b746d0a7d32bb53b3bea19c5be"/></dir><file name="Paymentconfiguration.php" hash="c0a6c5b610e42037f9904247e657a0e6"/><dir name="Quote"><dir name="Address"><dir name="Total"><dir name="Nominal"><dir name="Recurring"><file name="Discount.php" hash="17d12a5ac2ad95a7882ab651502ce98a"/><dir name="Initialfee"><file name="Tax.php" hash="892804e777f2e1bba1e57cd03d96e5b2"/></dir></dir></dir><file name="Nominal.php" hash="091dd174cb2b571a6739b34071fbc9a6"/></dir></dir></dir><file name="Quote.php" hash="9ddf19dfd97cbbe6423e80207f81a42f"/><dir name="Sales"><dir name="Recurring"><file name="Profile.php" hash="f2bdc6e081443ab538cb99e1f5fbe77c"/></dir></dir><dir name="Source"><file name="Paymentconfiguration.php" hash="eb9b8e1187a4a4f4614582d5f7932c37"/></dir><file name="Usercards.php" hash="049b38f03920a17d5dbd0ba5e3a834cc"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="8f2bc887259b9d5ae6f3a731e7a2eb6a"/><dir name="Sales"><dir name="Order"><file name="FraudController.php" hash="eb934598d3f116bd1f5c12744915edce"/></dir></dir></dir><file name="ControlController.php" hash="f0c1d327f7c31e6783e7a50b63bcee99"/><file name="CustomerController.php" hash="59f55a9bea7fc9172759079e7be17446"/><file name="ProcessingController.php" hash="a347a45dc822f9ba08aaab932691dafc"/></dir><dir name="etc"><file name="adminhtml.xml" hash="fe7b088bf7146cc7c5df22816de0e55a"/><file name="config.xml" hash="c5ff259b42d98302cf8b192471962e40"/><file name="system.xml" hash="4424c2216dbd0522eb1dd25b58097890"/></dir><dir name="sql"><dir name="xpaymentsconnector_setup"><file name="mysql4-install-1.0.0.php" hash="5b6ed901a54700d986dd81029104ed72"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="5e2da32a0f87b747a5e9f3d9095e962a"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="566cd8aa894ff488f60bd718ad8b2772"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="0f44cf02457c2b6a887b399e94b89e57"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="f353d20a6d6ac827be5cd581cc988660"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="9b71385496b9b42e5a79b0cbbc557dff"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="fa79555b4802a96579f314a670ab8ed3"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="b9708303f3160fc0c9347f4600e27aba"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="2d07945a0438bf29f1386e47b2b5498b"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="83a4aace7f0e389c5caaaf97675f6c24"/><file name="mysql4-upgrade-1.0.9-1.1.0.php" hash="57f95a027f6f0b4871f883e370dd1f51"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="61c4abd29823a909e14a9653ddd41825"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="684c48c888faef382060798b1198dea9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="xpaymentsconnector.xml" hash="d63db6edd451323006f5f4a03a4a7ef4"/></dir><dir name="template"><dir name="xpaymentsconnector"><file name="control.phtml" hash="455345e2cccf3627b69affee92be766f"/><dir name="form"><file name="prepaidpayments.phtml" hash="bfe70a3c62187bcd9915fb621eda58b9"/><file name="savedcards.phtml" hash="3a13d7c828f488795e99941334860596"/></dir><dir name="info"><file name="cc.phtml" hash="870cfba200e46f8c46a759e72f73de7e"/><file name="prepaidpayments.phtml" hash="f4bd2aa628257cb1f3450a1632a0b771"/><file name="savedcards.phtml" hash="4951f551284289728feb57ff3eef86e9"/></dir><file name="info.phtml" hash="ab312e6f206c51ff3134b9a3ce5b5440"/><dir name="order"><dir name="view"><dir name="tab"><file name="xporderstate.phtml" hash="17b3304885b4715e26aed1d4bd6c7746"/></dir></dir></dir><dir name="pdf"><file name="info.phtml" hash="9603c212b8efd1247ce36239d7365a73"/></dir><dir name="usercards"><dir name="tab"><file name="js.phtml" hash="ae8189ee0b9f0bd09d61692403527331"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="xpaymentsconnector.xml" hash="325c8f7d3d81ddbffde60a415625c269"/></dir><dir name="template"><dir name="xpaymentsconnector"><file name="blank.phtml" hash="a22778db8681a9aaee22eb2d8f8c6533"/><file name="cancel.phtml" hash="3ba9764fcbf85a3504664b342450ec2b"/><dir name="checkout"><dir name="onepage"><file name="beforesuccess.phtml" hash="62e3eff8d87e8e91bca406a0a1a10b2b"/><file name="order-detail.phtml" hash="ccd3d6d0dd774f939b66f602098331e5"/><dir name="review"><file name="button.phtml" hash="90cde882d6c333b22ee971fcd31871b4"/></dir><file name="xpayment-iframe.phtml" hash="a3916b5115beff8b9a8f3338c85cdf24"/></dir><file name="success.phtml" hash="a6b5926f1675b4dcec5867bd40f3ac86"/></dir><dir name="customer"><file name="cardaddsuccess.phtml" hash="6771721173b99c0cf70391c22d878276"/><dir name="usercards"><file name="cardadd.phtml" hash="6599c3b6a31979a05f355229308ebaf2"/><file name="list.phtml" hash="e79d4126ad2e585816bb8f5eed444e59"/></dir></dir><file name="failure.phtml" hash="3d0691440fda2d1f3a314cd151d6ea90"/><dir name="form"><file name="cc.phtml" hash="9d6f013e0b935168865364aa99f23df4"/><file name="savedcards.phtml" hash="6ffc897b61368538d7d89f5e781bb055"/></dir><dir name="info"><file name="cc.phtml" hash="5ff15d39d4063751fdefa5a50bf1ec47"/><file name="prepaidpayments.phtml" hash="9dfb23cb730781e45847a1422947bc9c"/><file name="savedcards.phtml" hash="0af3d140b3c407e4748a0514533c49af"/></dir><file name="redirect.phtml" hash="4c9c74e94c9a3015dee181a0ef978550"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cdev_XPaymentsConnector.xml" hash="3b87bc5a9c17519d38e7de93b5ad13b9"/></dir></target><target name="mage"><dir name="js"><dir name="xpayment"><file name="backend-xpayment.js" hash="adb23ae4c5a320318d9e3cf26558fffd"/><file name="checkout-submit.js" hash="bf58442eac8a19b3e8a33b4e6cdb528c"/><dir name="images"><file name="arrow-down.png" hash="a0beb6cd0ca4dd686ee5bf772432176e"/><file name="arrow-up.png" hash="df40115c816a7e08016c04120ac22e53"/><file name="atep-arrow.png" hash="99b20583434330394fb2302b9b9f7331"/><file name="btn_bg_fraud.png" hash="028ca5db7bdc7a5327e5cafa8747e079"/><file name="card_types.png" hash="d35ba97c55e2cc1273a0dd1d7862d84c"/><file name="loader.gif" hash="e67d85a8d2d4021514815d0ff4d65173"/><file name="xpayment-logo.png" hash="a46be1bc2589a988172a104c11bed332"/></dir><file name="settings.css" hash="170610855317be54d5f21f83c75ef509"/><file name="xp-contorl.css" hash="1c59c23f49000d35ba43149500b97682"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Cdev_XPaymentsConnector.csv" hash="38e98f8fd9a7ce64b0dd18ae6c00a481"/></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<compatible/>
|
19 |
-
<dependencies><required><php><min>5.
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CDev_XPaymentsConnector</name>
|
4 |
+
<version>1.7.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Connector to integrate Magento CE & EE with X-Payments PA-DSS certified solution for PCI compliant CC processing</summary>
|
10 |
<description>X-Payments connector
|
11 |
+
This extension integrates Magento with X-Payments - a PA-DSS certified payment module.</description>
|
12 |
+
<notes>What's new?
|
13 |
+

|
14 |
+
- Re-factored code that implements Magento communication with X-Payments, namely: changed order placing procedure, fixed "The txnId field is missing or incorrect" and other errors.
|
15 |
+

|
16 |
+
- Support of X-Payments v3.0 API 1.6: new templates, improved operating of recurring charges.
|
17 |
+

|
18 |
+
- Improved look and feel of X-Payments credit card form. Credit card form displaying is now allowed before entering the address details.
|
19 |
+

|
20 |
+
- Improved errors processing (from X-Payments, from payment gateways etc).
|
21 |
+

|
22 |
+
- Integrated with One Step Checkout (http://www.onestepcheckout.com)
|
23 |
+

|
24 |
+
- Integrated with Firecheckout (http://www.firecheckout.com)
|
25 |
+

|
26 |
+
- Export to Stone Edge order manager</notes>
|
27 |
+
<authors><author><name>Alexander Mulin</name><user>xpayments</user><email>alex.mulin@x-payments.com</email></author></authors>
|
28 |
+
<date>2016-07-22</date>
|
29 |
+
<time>17:58:44</time>
|
30 |
+
<contents><target name="magecommunity"><dir name="Cdev"><dir name="XPaymentsConnector"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Renderer"><file name="Cardnumber.php" hash="208d21b744e56583b868038a0410b4f7"/><file name="Cardtype.php" hash="a2428e2e572e4d4a8cec6fd4b9519807"/><file name="Txnid.php" hash="27ef7dcdcb042b270758dbed42888e93"/></dir><dir name="Tab"><file name="Usercards.php" hash="958a1e10005ee9109e85d7e9ca448251"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Xporderstate.php" hash="bf18faf8efa855d23a098c0a79d3da43"/></dir></dir><file name="View.php" hash="8e26bb4e8c69e388aaec6a5b3709ca9c"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Subselect.php" hash="4386558bb6ea49f56fb72e04cb1ed7a1"/></dir></dir></dir><dir name="Usercards"><file name="Grid.php" hash="98675f504e5ad16f25fa56b1222fb233"/></dir></dir><file name="Beforesuccess.php" hash="6a2d9e8742024b527efa9b64bb8c2d1d"/><file name="Cancel.php" hash="a119a76eb7b3d829df844a1450ebbf4d"/><dir name="Checkout"><dir name="Onepage"><file name="Orderdetail.php" hash="87bd0df83e6f5599d722ddc5e634db5a"/><file name="Settings.php" hash="366aa9c1ecb505be9b141c33e4f48983"/><file name="Success.php" hash="1a088733576ad7b07f5c9b42a9b073e3"/></dir></dir><file name="Control.php" hash="4ca05330579dd64dc492ef071b9fa820"/><dir name="Customer"><dir name="Account"><file name="Navigation.php" hash="e09c51996c7e0430d32f8a34479853da"/></dir><file name="Cardadd.php" hash="4fbb08e3a63034d4f4e3132f6a462902"/><file name="Success.php" hash="626854ad5b66983245ca05fec3139d10"/><file name="Usercards.php" hash="dacb606ccd0fe69666db059189406242"/></dir><file name="Failure.php" hash="4bc8bca872e68e55995c8996704a684d"/><dir name="Form"><file name="Cc.php" hash="4098182e7fcd53c3393736ca8a3b952e"/><file name="Container.php" hash="135a20a2537d890a7f304c09d28a3fa2"/><file name="Prepaidpayments.php" hash="6d24537b07085cf3cd497838be5ae641"/><file name="Savedcards.php" hash="fef05cb7cb4968a7a1f25adacbfa291d"/></dir><dir name="Info"><file name="Cc.php" hash="535973175a08d886d887743841c2259f"/><file name="Prepaidpayments.php" hash="27e8370e77323ef3d4509883317da43e"/><file name="Savedcards.php" hash="0ecab8333c35cc2c23c7460cd182f3f8"/></dir><dir name="Recurring"><dir name="Profile"><file name="View.php" hash="dd064d6997e107a12bd67666358961c1"/></dir></dir><file name="Redirect.php" hash="d06d3d1971637ec51f1663a0e5d06249"/><file name="Return.php" hash="7e69b6d4db495181f130874e3955d4ba"/><file name="Success.php" hash="557dcdaf4997f652c7949846bfe75f43"/></dir><dir name="Helper"><file name="Data.php" hash="0f029a1c927deea7495dd2e27d5af4f9"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Placedisplay.php" hash="ce97cc70fad01ae856186ed84f96a091"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="Paymentconfiguration"><file name="Collection.php" hash="e639637d93fced47e15feff45dde7040"/></dir><file name="Paymentconfiguration.php" hash="27933b2a1a1b48f79c086fa2a1a055dc"/><dir name="Usercards"><file name="Collection.php" hash="6181af181afe7ca149a4f4def81ab2c3"/></dir><file name="Usercards.php" hash="6987664f7d934a01a20cd4b2360410ec"/></dir><file name="Observer.php" hash="bd91ad52f90f01643866e6e3a90793a6"/><dir name="Payment"><file name="Cc.php" hash="bdae2cee2cec0fe417a08c7393262c4a"/><file name="Prepaidpayments.php" hash="d95213d1d1a1ca0a75f21331e20c6112"/><dir name="Recurring"><file name="Profile.php" hash="81d78bf46f16921f315d25a1882f689c"/></dir><file name="Savedcards.php" hash="177be52129ddd5a85cc267e4798f439c"/></dir><file name="Paymentconfiguration.php" hash="8f59c00bb689cba01419643291f84c5a"/><dir name="Quote"><dir name="Address"><dir name="Total"><dir name="Nominal"><dir name="Recurring"><file name="Discount.php" hash="de7bad92f97b7ae18c0ea14553b20b6e"/><dir name="Initialfee"><file name="Tax.php" hash="c34e0dfc1cda64509c20095d48280d30"/></dir></dir></dir><file name="Nominal.php" hash="151e80f6a973925ba5e75d53185b9a17"/></dir></dir></dir><file name="Quote.php" hash="f9ce2d25eac3ffe894586370f2b7e875"/><dir name="Sales"><dir name="Recurring"><file name="Profile.php" hash="ab2f07180d0f9e6b07739dcd9a72aaaf"/></dir></dir><dir name="Source"><file name="Paymentconfiguration.php" hash="e43240d7f8c5ce6c79a11cd22fdf1654"/></dir><file name="Usercards.php" hash="d60af463fad1d64a44e3132e6dd8145d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="2afbf9ce68581c095b1c0908c338bf8b"/><dir name="Sales"><dir name="Order"><file name="FraudController.php" hash="2e0a090bb9be675825c745749d8f6326"/></dir></dir></dir><file name="ControlController.php" hash="a8b443665c0e0d6545ea53e9e16c84f4"/><file name="CustomerController.php" hash="826b6c20bac3e7cda40d777f299185a0"/><file name="ProcessingController.php" hash="b8172d20445ca4ae8e4ecd96201da64a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="78e39e2b965ba1f3b42dc15165e5980d"/><file name="config.xml" hash="4d5380472a56701c514904baa1fbb649"/><file name="system.xml" hash="92af8118851818b7aa03a04621f30098"/></dir><dir name="sql"><dir name="xpaymentsconnector_setup"><file name="mysql4-install-1.0.0.php" hash="54fd2b472da6f22807d7ce9d55f76f68"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="ecfbe69f2a44d954419a5ba8e6a33601"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="38f97b9ad495e37cd5616b63244003d8"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="52b4b083d68c400a2d15b7ab24432d31"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="9f504310fbd5760dbc4121575d58c1ff"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="bc258c44475f4820820b34e25a692e11"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="673e6984f3629a287cf750c62ad409d3"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="adde05f2858ab60250b0d66d88f7ccf1"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="ded44ef94cce61a6bbe76e97190e0508"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="e4ff2a01393423ea4a82226c1c160e83"/><file name="mysql4-upgrade-1.0.9-1.1.0.php" hash="f8332f7edb571e682dca101fb0a5f0d8"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="ff155b7f421d73c4962c373c88bc3ca0"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="07611a099e3057b57ec75d30e1b3cf17"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="xpayment"><file name="backend-xpayment.js" hash="0a21df00e9499cbdbf1f83866d5da7f7"/><file name="checkout-submit.js" hash="5b993541002979e0e050bff8688e6e42"/><dir name="images"><file name="arrow-down.png" hash="a0beb6cd0ca4dd686ee5bf772432176e"/><file name="arrow-up.png" hash="df40115c816a7e08016c04120ac22e53"/><file name="atep-arrow.png" hash="99b20583434330394fb2302b9b9f7331"/><file name="btn_bg_fraud.png" hash="028ca5db7bdc7a5327e5cafa8747e079"/><file name="card_types.png" hash="d35ba97c55e2cc1273a0dd1d7862d84c"/><file name="loader.gif" hash="e67d85a8d2d4021514815d0ff4d65173"/><file name="xpayment-logo.png" hash="a46be1bc2589a988172a104c11bed332"/></dir><file name="settings.css" hash="75fd8264d825def2a1c8538d052b9b25"/><file name="xp-contorl.css" hash="1c59c23f49000d35ba43149500b97682"/></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Cdev_XPaymentsConnector.csv" hash="38e98f8fd9a7ce64b0dd18ae6c00a481"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cdev_XPaymentsConnector.xml" hash="d45ede4b1566ecf143546c1c9b2330c7"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="xpaymentsconnector"><file name="control.phtml" hash="76989067ba4a38dab48e15ea784ddbf4"/><dir><dir name="form"><file name="prepaidpayments.phtml" hash="4dbfedd5c45d0238a77e2856d151165d"/><file name="savedcards.phtml" hash="2657b09d08dda25c96f787edf00dcb21"/></dir><dir name="info"><file name="cc.phtml" hash="87b0d497ce0c26cc7f9508da5d392d27"/><file name="prepaidpayments.phtml" hash="46668fa9790f7567512a320ca6192846"/><file name="savedcards.phtml" hash="e947d6efe2602959be9a9723a1f5a470"/></dir><dir name="order"><dir name="view"><dir name="tab"><file name="xporderstate.phtml" hash="f74738e126f5b5a377f6b6dd231e2bb2"/></dir></dir></dir><dir name="pdf"><file name="info.phtml" hash="ff4c8de6adb0c26a14bdb67b84002591"/></dir><dir name="usercards"><dir name="tab"><file name="js.phtml" hash="066a4fbebce98147eb69e37a37797187"/></dir></dir></dir><file name="info.phtml" hash="18765aeb9490d25c6cb72d90355815c1"/></dir></dir><dir name="layout"><file name="xpaymentsconnector.xml" hash="d6a3c4f69e4d02070d139f1c1f6b9da5"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="xpaymentsconnector"><file name="blank.phtml" hash="a1d80c783123430a9821084154e74d3a"/><file name="cancel.phtml" hash="b7b95521b4bce46fa00a7d48799d2159"/><dir name="checkout"><dir name="onepage"><file name="beforesuccess.phtml" hash="e93a3c562ffa3bb11e1ccc85c60e9305"/><file name="order-detail.phtml" hash="d0f638fba56e1a38bf47060e540034c0"/><dir name="review"><file name="button.phtml" hash="e2b28eda13695bff1107e32382f1d944"/></dir><file name="xpayment-iframe.phtml" hash="01d055a10a706e16dcd6cb1cc3e162c3"/></dir><file name="success.phtml" hash="5a8796782f54d41e6065144aa1adbf68"/></dir><dir name="customer"><file name="cardaddsuccess.phtml" hash="ed7746e9d604ffb8d047fd8086c12531"/><dir name="usercards"><file name="cardadd.phtml" hash="d57f1f395a42ce0adb7f531b0f01c246"/><file name="list.phtml" hash="18e4d3d87d1ad121392deaeff263194b"/></dir></dir><file name="failure.phtml" hash="ff9a3cab106068011e2fc5617bb5c9db"/><dir name="form"><file name="cc.phtml" hash="5aa9052f7b789c20b9a5ba5d424d636b"/><file name="savedcards.phtml" hash="40815a71bfbcb61bb6975042159da4d3"/></dir><dir name="info"><file name="cc.phtml" hash="dff25040debc42f3bf08fdb7829e2fa8"/><file name="prepaidpayments.phtml" hash="4e8fec0502e991c6634233e3ba15202d"/><file name="savedcards.phtml" hash="e97d1c1356bf89eff3a969d430872136"/></dir><file name="redirect.phtml" hash="295b92ed99297c0349225e97b895110d"/><file name="redirectiframe.phtml" hash="8e9b635f16fbe7deb271759714eb856d"/><file name="return.phtml" hash="ae55cad4282970013ab72f746002fded"/><file name="xpc_data.phtml" hash="e1d2b67adc37e07bce05d2f2ef8f610f"/></dir></dir><dir name="layout"><file name="xpaymentsconnector.xml" hash="e818bab9188628976a0fa782e1bea371"/></dir></dir></dir></dir></target></contents>
|
31 |
<compatible/>
|
32 |
+
<dependencies><required><php><min>5.3.0</min><max>7.0.9</max></php></required></dependencies>
|
33 |
</package>
|