CDev_XPaymentsConnector - Version 1.7.0

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

Files changed (107) hide show
  1. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Cardnumber.php +2 -2
  2. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Cardtype.php +2 -2
  3. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Renderer/Txnid.php +2 -2
  4. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Customer/Edit/Tab/Usercards.php +2 -2
  5. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Sales/Order/View.php +2 -2
  6. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Sales/Order/View/Tab/Xporderstate.php +2 -2
  7. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/System/Config/Form/Subselect.php +56 -30
  8. app/code/community/Cdev/XPaymentsConnector/Block/Adminhtml/Usercards/Grid.php +2 -2
  9. app/code/community/Cdev/XPaymentsConnector/Block/Beforesuccess.php +2 -2
  10. app/code/community/Cdev/XPaymentsConnector/Block/Cancel.php +2 -2
  11. app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Orderdetail.php +2 -2
  12. app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Settings.php +24 -15
  13. app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Success.php +2 -2
  14. app/code/community/Cdev/XPaymentsConnector/Block/Control.php +2 -2
  15. app/code/community/Cdev/XPaymentsConnector/Block/Customer/Account/Navigation.php +2 -2
  16. app/code/community/Cdev/XPaymentsConnector/Block/Customer/Cardadd.php +3 -3
  17. app/code/community/Cdev/XPaymentsConnector/Block/Customer/Success.php +2 -2
  18. app/code/community/Cdev/XPaymentsConnector/Block/Customer/Usercards.php +2 -2
  19. app/code/community/Cdev/XPaymentsConnector/Block/Failure.php +2 -2
  20. app/code/community/Cdev/XPaymentsConnector/Block/Form/Cc.php +17 -35
  21. app/code/community/Cdev/XPaymentsConnector/Block/Form/Container.php +2 -2
  22. app/code/community/Cdev/XPaymentsConnector/Block/Form/Prepaidpayments.php +2 -2
  23. app/code/community/Cdev/XPaymentsConnector/Block/Form/Savedcards.php +2 -2
  24. app/code/community/Cdev/XPaymentsConnector/Block/Info/Cc.php +13 -5
  25. app/code/community/Cdev/XPaymentsConnector/Block/Info/Prepaidpayments.php +2 -2
  26. app/code/community/Cdev/XPaymentsConnector/Block/Info/Savedcards.php +2 -2
  27. app/code/community/Cdev/XPaymentsConnector/Block/Recurring/Profile/View.php +2 -2
  28. app/code/community/Cdev/XPaymentsConnector/Block/Redirect.php +28 -18
  29. app/code/community/Cdev/XPaymentsConnector/Block/Return.php +47 -0
  30. app/code/community/Cdev/XPaymentsConnector/Block/Success.php +2 -2
  31. app/code/community/Cdev/XPaymentsConnector/Helper/Data.php +1088 -80
  32. app/code/community/Cdev/XPaymentsConnector/Model/Adminhtml/System/Config/Source/Placedisplay.php +1 -1
  33. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Paymentconfiguration.php +2 -2
  34. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Paymentconfiguration/Collection.php +2 -2
  35. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Usercards.php +2 -2
  36. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Usercards/Collection.php +2 -2
  37. app/code/community/Cdev/XPaymentsConnector/Model/Observer.php +639 -666
  38. app/code/community/Cdev/XPaymentsConnector/Model/Payment/Cc.php +191 -427
  39. app/code/community/Cdev/XPaymentsConnector/Model/Payment/Prepaidpayments.php +2 -2
  40. app/code/community/Cdev/XPaymentsConnector/Model/Payment/Recurring/Profile.php +1 -1
  41. app/code/community/Cdev/XPaymentsConnector/Model/Payment/Savedcards.php +2 -2
  42. app/code/community/Cdev/XPaymentsConnector/Model/Paymentconfiguration.php +2 -2
  43. app/code/community/Cdev/XPaymentsConnector/Model/Quote.php +2 -2
  44. app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal.php +2 -2
  45. app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal/Recurring/Discount.php +2 -2
  46. app/code/community/Cdev/XPaymentsConnector/Model/Quote/Address/Total/Nominal/Recurring/Initialfee/Tax.php +2 -2
  47. app/code/community/Cdev/XPaymentsConnector/Model/Sales/Recurring/Profile.php +2 -2
  48. app/code/community/Cdev/XPaymentsConnector/Model/Source/Paymentconfiguration.php +2 -2
  49. app/code/community/Cdev/XPaymentsConnector/Model/Usercards.php +2 -2
  50. app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/CustomerController.php +2 -2
  51. app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/Sales/Order/FraudController.php +2 -2
  52. app/code/community/Cdev/XPaymentsConnector/controllers/ControlController.php +2 -2
  53. app/code/community/Cdev/XPaymentsConnector/controllers/CustomerController.php +46 -30
  54. app/code/community/Cdev/XPaymentsConnector/controllers/ProcessingController.php +626 -288
  55. app/code/community/Cdev/XPaymentsConnector/etc/adminhtml.xml +2 -2
  56. app/code/community/Cdev/XPaymentsConnector/etc/config.xml +3 -2
  57. app/code/community/Cdev/XPaymentsConnector/etc/system.xml +2 -2
  58. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-install-1.0.0.php +2 -2
  59. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.0-1.0.1.php +2 -2
  60. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.1-1.0.2.php +2 -2
  61. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.2-1.0.3.php +2 -2
  62. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.3-1.0.4.php +2 -2
  63. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.4-1.0.5.php +2 -2
  64. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.5-1.0.6.php +2 -2
  65. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.6-1.0.7.php +2 -2
  66. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.7-1.0.8.php +2 -2
  67. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.8-1.0.9.php +2 -2
  68. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.0.9-1.1.0.php +2 -2
  69. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.0-1.1.1.php +2 -2
  70. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.1-1.1.2.php +2 -2
  71. app/design/adminhtml/default/default/layout/xpaymentsconnector.xml +2 -2
  72. app/design/adminhtml/default/default/template/xpaymentsconnector/control.phtml +2 -2
  73. app/design/adminhtml/default/default/template/xpaymentsconnector/form/prepaidpayments.phtml +2 -2
  74. app/design/adminhtml/default/default/template/xpaymentsconnector/form/savedcards.phtml +2 -2
  75. app/design/adminhtml/default/default/template/xpaymentsconnector/info.phtml +1 -1
  76. app/design/adminhtml/default/default/template/xpaymentsconnector/info/cc.phtml +22 -15
  77. app/design/adminhtml/default/default/template/xpaymentsconnector/info/prepaidpayments.phtml +2 -2
  78. app/design/adminhtml/default/default/template/xpaymentsconnector/info/savedcards.phtml +2 -2
  79. app/design/adminhtml/default/default/template/xpaymentsconnector/order/view/tab/xporderstate.phtml +6 -3
  80. app/design/adminhtml/default/default/template/xpaymentsconnector/pdf/info.phtml +2 -2
  81. app/design/adminhtml/default/default/template/xpaymentsconnector/usercards/tab/js.phtml +2 -2
  82. app/design/frontend/base/default/layout/xpaymentsconnector.xml +65 -22
  83. app/design/frontend/base/default/template/xpaymentsconnector/blank.phtml +2 -2
  84. app/design/frontend/base/default/template/xpaymentsconnector/cancel.phtml +2 -2
  85. app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/beforesuccess.phtml +8 -6
  86. app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/order-detail.phtml +10 -4
  87. app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/review/button.phtml +8 -56
  88. app/design/frontend/base/default/template/xpaymentsconnector/checkout/onepage/xpayment-iframe.phtml +10 -49
  89. app/design/frontend/base/default/template/xpaymentsconnector/checkout/success.phtml +1 -1
  90. app/design/frontend/base/default/template/xpaymentsconnector/customer/cardaddsuccess.phtml +2 -2
  91. app/design/frontend/base/default/template/xpaymentsconnector/customer/usercards/cardadd.phtml +14 -4
  92. app/design/frontend/base/default/template/xpaymentsconnector/customer/usercards/list.phtml +2 -2
  93. app/design/frontend/base/default/template/xpaymentsconnector/failure.phtml +2 -2
  94. app/design/frontend/base/default/template/xpaymentsconnector/form/cc.phtml +18 -91
  95. app/design/frontend/base/default/template/xpaymentsconnector/form/savedcards.phtml +2 -2
  96. app/design/frontend/base/default/template/xpaymentsconnector/info/cc.phtml +14 -18
  97. app/design/frontend/base/default/template/xpaymentsconnector/info/prepaidpayments.phtml +2 -2
  98. app/design/frontend/base/default/template/xpaymentsconnector/info/savedcards.phtml +2 -2
  99. app/design/frontend/base/default/template/xpaymentsconnector/redirect.phtml +2 -2
  100. app/design/frontend/base/default/template/xpaymentsconnector/redirectiframe.phtml +65 -0
  101. app/design/frontend/base/default/template/xpaymentsconnector/return.phtml +37 -0
  102. app/design/frontend/base/default/template/xpaymentsconnector/xpc_data.phtml +31 -0
  103. app/etc/modules/Cdev_XPaymentsConnector.xml +1 -1
  104. js/xpayment/backend-xpayment.js +2 -2
  105. js/xpayment/checkout-submit.js +504 -76
  106. js/xpayment/settings.css +13 -19
  107. 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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.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_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
- /* Enter description here...
43
- *
44
- * @return string
45
- */
46
- public function getElementJsEvents()
47
{
48
- $js = <<<EndHTML
49
- <script type="text/javascript">
50
- document.observe("dom:loaded", function() {
51
- var useIframe = $('payment_xpayments_use_iframe');
52
- var placeDisplaySelect = $('row_payment_xpayments_placedisplay');
53
- if(useIframe.value == 0){
54
- placeDisplaySelect.hide();
55
- }
56
- Event.observe(useIframe, 'change', checkPlaceDisplayAccess.bind(this));
57
- function checkPlaceDisplayAccess(event)
58
- {
59
- var conditionNameElement = Event.element(event);
60
- if(conditionNameElement.value == 1){
61
- placeDisplaySelect.show();
62
- }else{
63
placeDisplaySelect.hide();
64
}
65
66
- }
67
- });
68
- </script>
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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
- public function isXpaymentMethod(){
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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($updateSendData,$isCardAuthorizePayment = true);
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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
- public function getIframeUrl()
36
{
37
-
38
- $quotePayment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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&amp;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
- return $xpCardDataStr;
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&amp;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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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
- if(is_null($this->paymentMethod)){
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
- if(is_null($this->paymentMethod)){
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 Valerii Demidov
16
* @category Cdev
17
* @package Cdev_XPaymentsConnector
18
- * @copyright (c) Qualiteam Software Ltd. <info@qtmsoft.com>. All rights reserved.
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 STATE_XPAYMENT_PENDING_PAYMENT = 'xp_pending_payment';
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
- $useIframe = Mage::getStoreConfig('payment/xpayments/use_iframe');
139
- if ($useIframe) {
140
$xpaymentPrepareOrder = Mage::getSingleton('checkout/session')->getData('xpayment_prepare_order');
141
- $xpaymentPrepareOrder['place_display'] = Mage::getStoreConfig('payment/xpayments/placedisplay');
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
- * This function save user card data to Quote
180
- * @param null $quoteId
181
- * @param array $cardData
182
- * @return array|bool|mixed
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 getIframeToken()
208
{
209
- $xpaymentPrepareOrder = Mage::getSingleton('checkout/session')->getData('xpayment_prepare_order');
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 = Mage::getStoreConfig('payment/xpayments/use_iframe');
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
- $currentCustomerState = Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod();
368
- $registerMethod = Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER;
369
- $customerMethod = Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER;
370
- if (($currentCustomerState == $registerMethod) || ($currentCustomerState == $customerMethod)) {
371
- return true;
372
- } else {
373
- return false;
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
- * @param array $xpCardData
1070
* @return string
1071
*/
1072
- public function prepareCardDataString($xpCardData)
1073
{
1074
- $xpCardDataStr = '';
1075
- if (!empty($xpCardData)) {
1076
- $last4 = (isset($xpCardData['last4'])) ? $xpCardData['last4'] : $xpCardData['last_4_cc_num'];
1077
1078
- $xpCardDataStr = $this->__('%s******%s',
1079
- $xpCardData['first6'],
1080
- $last4
1081
- );
1082
- if (!empty($xpCardData['expire_month']) && !empty($xpCardData['expire_year'])) {
1083
- $xpCardDataStr .= $this->__(' ( %s/%s )', $xpCardData['expire_month'], $xpCardData['expire_year']);
1084
}
1085
}
1086
1087
- return $xpCardDataStr;
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
172