Mage_Centinel - Version 1.6.0.0

Version Notes

1.6.0.0

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Centinel
Version 1.6.0.0
Comparing to
See all releases


Version 1.6.0.0

Files changed (39) hide show
  1. app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php +75 -0
  2. app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php +55 -0
  3. app/code/core/Mage/Centinel/Block/Authentication.php +87 -0
  4. app/code/core/Mage/Centinel/Block/Authentication/Complete.php +48 -0
  5. app/code/core/Mage/Centinel/Block/Authentication/Start.php +48 -0
  6. app/code/core/Mage/Centinel/Block/Logo.php +47 -0
  7. app/code/core/Mage/Centinel/Helper/Data.php +181 -0
  8. app/code/core/Mage/Centinel/Model/Api.php +267 -0
  9. app/code/core/Mage/Centinel/Model/Config.php +150 -0
  10. app/code/core/Mage/Centinel/Model/Observer.php +141 -0
  11. app/code/core/Mage/Centinel/Model/Service.php +398 -0
  12. app/code/core/Mage/Centinel/Model/Session.php +42 -0
  13. app/code/core/Mage/Centinel/Model/State/Jcb.php +164 -0
  14. app/code/core/Mage/Centinel/Model/State/Mastercard.php +156 -0
  15. app/code/core/Mage/Centinel/Model/State/Visa.php +169 -0
  16. app/code/core/Mage/Centinel/Model/StateAbstract.php +169 -0
  17. app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php +120 -0
  18. app/code/core/Mage/Centinel/controllers/IndexController.php +91 -0
  19. app/code/core/Mage/Centinel/etc/config.xml +171 -0
  20. app/code/core/Mage/Centinel/etc/system.xml +96 -0
  21. app/design/adminhtml/default/default/layout/centinel.xml +70 -0
  22. app/design/adminhtml/default/default/template/centinel/authentication/complete.phtml +38 -0
  23. app/design/adminhtml/default/default/template/centinel/authentication/start.phtml +38 -0
  24. app/design/adminhtml/default/default/template/centinel/validation/form.phtml +37 -0
  25. app/design/frontend/base/default/layout/centinel.xml +65 -0
  26. app/design/frontend/base/default/template/centinel/authentication.phtml +56 -0
  27. app/design/frontend/base/default/template/centinel/authentication/complete.phtml +41 -0
  28. app/design/frontend/base/default/template/centinel/authentication/start.phtml +40 -0
  29. app/design/frontend/base/default/template/centinel/logo.phtml +33 -0
  30. app/etc/modules/Mage_Centinel.xml +39 -0
  31. app/locale/en_US/Mage_Centinel.csv +34 -0
  32. js/mage/adminhtml/sales/centinel.js +71 -0
  33. lib/3Dsecure/CentinelClient.php +161 -0
  34. lib/3Dsecure/CentinelErrors.php +20 -0
  35. lib/3Dsecure/XMLParser.php +88 -0
  36. package.xml +18 -0
  37. skin/frontend/base/default/images/centinel/sc_learn_62x34.gif +0 -0
  38. skin/frontend/base/default/images/centinel/v_activate_steps.gif +0 -0
  39. skin/frontend/base/default/images/centinel/vbv_ltbg_71x57.gif +0 -0
app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php ADDED
@@ -0,0 +1,75 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml sales order create validation card block
29
+ */
30
+ class Mage_Centinel_Block_Adminhtml_Validation extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
31
+ {
32
+ /**
33
+ * construct
34
+ */
35
+ public function __construct()
36
+ {
37
+ parent::__construct();
38
+ $this->setId('sales_order_create_validation_card');
39
+ }
40
+
41
+ /**
42
+ * Return text for block`s header
43
+ *
44
+ * @return string
45
+ */
46
+ public function getHeaderText()
47
+ {
48
+ return Mage::helper('centinel')->__('3D Secure Card Validation');
49
+ }
50
+
51
+ /**
52
+ * Return css class name for header block
53
+ *
54
+ * @return string
55
+ */
56
+ public function getHeaderCssClass()
57
+ {
58
+ return 'head-payment-method';
59
+ }
60
+
61
+ /**
62
+ * Prepare html output
63
+ *
64
+ * @return string
65
+ */
66
+ protected function _toHtml()
67
+ {
68
+ $payment = $this->getQuote()->getPayment();
69
+ if (!$payment->getMethod() || !$payment->getMethodInstance() || !$payment->getMethodInstance()->getIsCentinelValidationEnabled()) {
70
+ return '';
71
+ }
72
+ return parent::_toHtml();
73
+ }
74
+ }
75
+
app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php ADDED
@@ -0,0 +1,55 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml sales order create validation card block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Centinel
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Mage_Centinel_Block_Adminhtml_Validation_Form extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
36
+ {
37
+ /**
38
+ * Prepare validation and template parameters
39
+ */
40
+ protected function _toHtml()
41
+ {
42
+ $payment = $this->getQuote()->getPayment();
43
+ if ($payment && $method = $payment->getMethodInstance()) {
44
+ if ($method->getIsCentinelValidationEnabled() && $centinel = $method->getCentinelValidator()) {
45
+ $this->setFrameUrl($centinel->getValidatePaymentDataUrl())
46
+ ->setContainerId('centinel_authenticate_iframe')
47
+ ->setMethodCode($method->getCode())
48
+ ;
49
+ return parent::_toHtml();
50
+ }
51
+ }
52
+ return '';
53
+ }
54
+ }
55
+
app/code/core/Mage/Centinel/Block/Authentication.php ADDED
@@ -0,0 +1,87 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Centinel validation frame
29
+ */
30
+ class Mage_Centinel_Block_Authentication extends Mage_Core_Block_Template
31
+ {
32
+ /**
33
+ * Strage for identifiers of related blocks
34
+ *
35
+ * @var array
36
+ */
37
+ protected $_relatedBlocks = array();
38
+
39
+ /**
40
+ * Flag - authentication start mode
41
+ * @see self::setAuthenticationStartMode
42
+ *
43
+ * @var bool
44
+ */
45
+ protected $_authenticationStartMode = false;
46
+
47
+ /**
48
+ * Add identifier of related block
49
+ *
50
+ * @param string $blockId
51
+ * @return Mage_Centinel_Block_Authentication
52
+ */
53
+ public function addRelatedBlock($blockId)
54
+ {
55
+ $this->_relatedBlocks[] = $blockId;
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Return identifiers of related blocks
61
+ *
62
+ * @return array
63
+ */
64
+ public function getRelatedBlocks()
65
+ {
66
+ return $this->_relatedBlocks;
67
+ }
68
+
69
+ /**
70
+ * Check whether authentication is required and prepare some template data
71
+ *
72
+ * @return string
73
+ */
74
+ protected function _toHtml()
75
+ {
76
+ $method = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance();
77
+ if ($method->getIsCentinelValidationEnabled()) {
78
+ $centinel = $method->getCentinelValidator();
79
+ if ($centinel && $centinel->shouldAuthenticate()) {
80
+ $this->setAuthenticationStart(true);
81
+ $this->setFrameUrl($centinel->getAuthenticationStartUrl());
82
+ return parent::_toHtml();
83
+ }
84
+ }
85
+ return parent::_toHtml();
86
+ }
87
+ }
app/code/core/Mage/Centinel/Block/Authentication/Complete.php ADDED
@@ -0,0 +1,48 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Centinel validation form lookup
30
+ */
31
+ class Mage_Centinel_Block_Authentication_Complete extends Mage_Core_Block_Template
32
+ {
33
+ /**
34
+ * Prepare authentication result params and render
35
+ *
36
+ * @return string
37
+ */
38
+ protected function _toHtml()
39
+ {
40
+ $validator = Mage::registry('current_centinel_validator');
41
+ if ($validator) {
42
+ $this->setIsProcessed(true);
43
+ $this->setIsSuccess($validator->isAuthenticateSuccessful());
44
+ }
45
+ return parent::_toHtml();
46
+ }
47
+ }
48
+
app/code/core/Mage/Centinel/Block/Authentication/Start.php ADDED
@@ -0,0 +1,48 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Authentication start/redirect form
30
+ */
31
+ class Mage_Centinel_Block_Authentication_Start extends Mage_Core_Block_Template
32
+ {
33
+ /**
34
+ * Prepare form parameters and render
35
+ *
36
+ * @return string
37
+ */
38
+ protected function _toHtml()
39
+ {
40
+ $validator = Mage::registry('current_centinel_validator');
41
+ if ($validator && $validator->shouldAuthenticate()) {
42
+ $this->addData($validator->getAuthenticateStartData());
43
+ return parent::_toHtml();
44
+ }
45
+ return '';
46
+ }
47
+ }
48
+
app/code/core/Mage/Centinel/Block/Logo.php ADDED
@@ -0,0 +1,47 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Centinel payment form logo block
29
+ */
30
+ class Mage_Centinel_Block_Logo extends Mage_Core_Block_Template
31
+ {
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+ $this->setTemplate('centinel/logo.phtml');
36
+ }
37
+
38
+ /**
39
+ * Return code of payment method
40
+ *
41
+ * @return string
42
+ */
43
+ public function getCode()
44
+ {
45
+ return $this->getMethod()->getCode();
46
+ }
47
+ }
app/code/core/Mage/Centinel/Helper/Data.php ADDED
@@ -0,0 +1,181 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Centinel module base helper
29
+ *
30
+ * @author Magento Core Team <core@magentocommerce.com>
31
+ */
32
+ class Mage_Centinel_Helper_Data extends Mage_Core_Helper_Abstract
33
+ {
34
+ /**
35
+ * Return label for cmpi field
36
+ *
37
+ * @param string $fieldName
38
+ * @return string
39
+ */
40
+ public function getCmpiLabel($fieldName)
41
+ {
42
+ switch ($fieldName) {
43
+ case Mage_Centinel_Model_Service::CMPI_PARES:
44
+ return $this->__('3D Secure Verification Result');
45
+ case Mage_Centinel_Model_Service::CMPI_ENROLLED:
46
+ return $this->__('3D Secure Cardholder Validation');
47
+ case Mage_Centinel_Model_Service::CMPI_ECI:
48
+ return $this->__('3D Secure Electronic Commerce Indicator');
49
+ case Mage_Centinel_Model_Service::CMPI_CAVV:
50
+ return $this->__('3D Secure CAVV');
51
+ case Mage_Centinel_Model_Service::CMPI_XID:
52
+ return $this->__('3D Secure XID');
53
+ }
54
+ return '';
55
+ }
56
+
57
+ /**
58
+ * Return value for cmpi field
59
+ *
60
+ * @param string $fieldName
61
+ * @param string $value
62
+ * @return string
63
+ */
64
+ public function getCmpiValue($fieldName, $value)
65
+ {
66
+ switch ($fieldName) {
67
+ case Mage_Centinel_Model_Service::CMPI_PARES:
68
+ return $this->_getCmpiParesValue($value);
69
+ case Mage_Centinel_Model_Service::CMPI_ENROLLED:
70
+ return $this->_getCmpiEnrolledValue($value);
71
+ case Mage_Centinel_Model_Service::CMPI_ECI:
72
+ return $this->_getCmpiEciValue($value);
73
+ case Mage_Centinel_Model_Service::CMPI_CAVV: // break intentionally omitted
74
+ case Mage_Centinel_Model_Service::CMPI_XID:
75
+ return $value;
76
+ }
77
+ return '';
78
+ }
79
+
80
+ /**
81
+ * Return text value for cmpi eci flag field
82
+ *
83
+ * @param string $value
84
+ * @return string
85
+ */
86
+ private function _getCmpiEciValue($value)
87
+ {
88
+ switch ($value) {
89
+ case '01':
90
+ case '07':
91
+ return $this->__('Merchant Liability');
92
+ case '02':
93
+ case '05':
94
+ case '06':
95
+ return $this->__('Card Issuer Liability');
96
+ default:
97
+ return $value;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Return text value for cmpi enrolled field
103
+ *
104
+ * @param string $value
105
+ * @return string
106
+ */
107
+ private function _getCmpiEnrolledValue($value)
108
+ {
109
+ switch ($value) {
110
+ case 'Y':
111
+ return $this->__('Enrolled');
112
+ case 'U':
113
+ return $this->__('Enrolled but Authentication Unavailable');
114
+ case 'N': // break intentionally omitted
115
+ default:
116
+ return $this->__('Not Enrolled');
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Return text value for cmpi pares field
122
+ *
123
+ * @param string $value
124
+ * @return string
125
+ */
126
+ private function _getCmpiParesValue($value)
127
+ {
128
+ switch ($value) {
129
+ case 'Y':
130
+ return $this->__('Successful');
131
+ case 'N':
132
+ return $this->__('Failed');
133
+ case 'U':
134
+ return $this->__('Unable to complete');
135
+ case 'A':
136
+ return $this->__('Successful attempt');
137
+ default:
138
+ return $value;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Return centinel block for payment form with logos
144
+ *
145
+ * @param Mage_Payment_Model_Method_Abstract $method
146
+ * @return Mage_Centinel_Block_Logo
147
+ */
148
+ public function getMethodFormBlock($method)
149
+ {
150
+ $blockType = 'centinel/logo';
151
+ if ($this->getLayout()) {
152
+ $block = $this->getLayout()->createBlock($blockType);
153
+ }
154
+ else {
155
+ $className = Mage::getConfig()->getBlockClassName($blockType);
156
+ $block = new $className;
157
+ }
158
+ $block->setMethod($method);
159
+ return $block;
160
+ }
161
+
162
+ /**
163
+ * Return url of page about visa verification
164
+ *
165
+ * @return string
166
+ */
167
+ public function getVisaLearnMorePageUrl()
168
+ {
169
+ return 'https://usa.visa.com/personal/security/vbv/index.html?ep=v_sym_verifiedbyvisa';
170
+ }
171
+
172
+ /**
173
+ * Return url of page about mastercard verification
174
+ *
175
+ * @return string
176
+ */
177
+ public function getMastercardLearnMorePageUrl()
178
+ {
179
+ return 'http://www.mastercardbusiness.com/mcbiz/index.jsp?template=/orphans&amp;content=securecodepopup';
180
+ }
181
+ }
app/code/core/Mage/Centinel/Model/Api.php ADDED
@@ -0,0 +1,267 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * 3D Secure Validation Library for Payment
29
+ */
30
+ include_once '3Dsecure/CentinelClient.php';
31
+
32
+ /**
33
+ * 3D Secure Validation Api
34
+ */
35
+ class Mage_Centinel_Model_Api extends Varien_Object
36
+ {
37
+ /**
38
+ * Fields that should be replaced in debug with '***'
39
+ *
40
+ * @var array
41
+ */
42
+ protected $_debugReplacePrivateDataKeys = array('TransactionPwd', 'CardNumber', 'CardExpMonth', 'CardExpYear');
43
+
44
+ protected static $_iso4217Currencies = array(
45
+ 'AED' => '784', 'AFN' => '971',
46
+ 'ALL' => '008', 'AMD' => '051', 'ANG' => '532', 'AOA' => '973', 'ARS' => '032', 'AUD' => '036', 'AWG' => '533',
47
+ 'AZN' => '944', 'BAM' => '977', 'BBD' => '052', 'BDT' => '050', 'BGN' => '975', 'BHD' => '048', 'BIF' => '108',
48
+ 'BMD' => '060', 'BND' => '096', 'BOB' => '068', 'BOV' => '984', 'BRL' => '986', 'BSD' => '044', 'BTN' => '064',
49
+ 'BWP' => '072', 'BYR' => '974', 'BZD' => '084', 'CAD' => '124', 'CDF' => '976', 'CHE' => '947', 'CHF' => '756',
50
+ 'CHW' => '948', 'CLF' => '990', 'CLP' => '152', 'CNY' => '156', 'COP' => '170', 'COU' => '970', 'CRC' => '188',
51
+ 'CUC' => '931', 'CUP' => '192', 'CVE' => '132', 'CZK' => '203', 'DJF' => '262', 'DKK' => '208', 'DOP' => '214',
52
+ 'DZD' => '012', 'EEK' => '233', 'EGP' => '818', 'ERN' => '232', 'ETB' => '230', 'EUR' => '978', 'FJD' => '242',
53
+ 'FKP' => '238', 'GBP' => '826', 'GEL' => '981', 'GHS' => '936', 'GIP' => '292', 'GMD' => '270', 'GNF' => '324',
54
+ 'GTQ' => '320', 'GYD' => '328', 'HKD' => '344', 'HNL' => '340', 'HRK' => '191', 'HTG' => '332', 'HUF' => '348',
55
+ 'IDR' => '360', 'ILS' => '376', 'INR' => '356', 'IQD' => '368', 'IRR' => '364', 'ISK' => '352', 'JMD' => '388',
56
+ 'JOD' => '400', 'JPY' => '392', 'KES' => '404', 'KGS' => '417', 'KHR' => '116', 'KMF' => '174', 'KPW' => '408',
57
+ 'KRW' => '410', 'KWD' => '414', 'KYD' => '136', 'KZT' => '398', 'LAK' => '418', 'LBP' => '422', 'LKR' => '144',
58
+ 'LRD' => '430', 'LSL' => '426', 'LTL' => '440', 'LVL' => '428', 'LYD' => '434', 'MAD' => '504', 'MDL' => '498',
59
+ 'MGA' => '969', 'MKD' => '807', 'MMK' => '104', 'MNT' => '496', 'MOP' => '446', 'MRO' => '478', 'MUR' => '480',
60
+ 'MVR' => '462', 'MWK' => '454', 'MXN' => '484', 'MXV' => '979', 'MYR' => '458', 'MZN' => '943', 'NAD' => '516',
61
+ 'NGN' => '566', 'NIO' => '558', 'NOK' => '578', 'NPR' => '524', 'NZD' => '554', 'OMR' => '512', 'PAB' => '590',
62
+ 'PEN' => '604', 'PGK' => '598', 'PHP' => '608', 'PKR' => '586', 'PLN' => '985', 'PYG' => '600', 'QAR' => '634',
63
+ 'RON' => '946', 'RSD' => '941', 'RUB' => '643', 'RWF' => '646', 'SAR' => '682', 'SBD' => '090', 'SCR' => '690',
64
+ 'SDG' => '938', 'SEK' => '752', 'SGD' => '702', 'SHP' => '654', 'SLL' => '694', 'SOS' => '706', 'SRD' => '968',
65
+ 'STD' => '678', 'SYP' => '760', 'SZL' => '748', 'THB' => '764', 'TJS' => '972', 'TMT' => '934', 'TND' => '788',
66
+ 'TOP' => '776', 'TRY' => '949', 'TTD' => '780', 'TWD' => '901', 'TZS' => '834', 'UAH' => '980', 'UGX' => '800',
67
+ 'USD' => '840', 'USN' => '997', 'USS' => '998', 'UYU' => '858', 'UZS' => '860', 'VEF' => '937', 'VND' => '704',
68
+ 'VUV' => '548', 'WST' => '882', 'XAF' => '950', 'XAG' => '961', 'XAU' => '959', 'XBA' => '955', 'XBB' => '956',
69
+ 'XBC' => '957', 'XBD' => '958', 'XCD' => '951', 'XDR' => '960', 'XOF' => '952', 'XPD' => '964', 'XPF' => '953',
70
+ 'XPT' => '962', 'XTS' => '963', 'XXX' => '999', 'YER' => '886', 'ZAR' => '710', 'ZMK' => '894', 'ZWL' => '932',
71
+ );
72
+
73
+ /**
74
+ * Centinel validation client
75
+ *
76
+ * @var CentinelClient
77
+ */
78
+ protected $_clientInstance = null;
79
+
80
+ /**
81
+ * Return Centinel thin client object
82
+ *
83
+ * @return CentinelClient
84
+ */
85
+ protected function _getClientInstance()
86
+ {
87
+ if (empty($this->_clientInstance)) {
88
+ $this->_clientInstance = new CentinelClient();
89
+ }
90
+ return $this->_clientInstance;
91
+ }
92
+
93
+ /**
94
+ * Return Centinel Api version
95
+ *
96
+ * @return string
97
+ */
98
+ protected function _getVersion()
99
+ {
100
+ return '1.7';
101
+ }
102
+
103
+ /**
104
+ * Return transaction type. according centinel documetation it should be "C"
105
+ *
106
+ * @return "C"
107
+ */
108
+ protected function _getTransactionType()
109
+ {
110
+ return 'C';
111
+ }
112
+
113
+ /**
114
+ * Return Timeout Connect
115
+ *
116
+ * @return int
117
+ */
118
+ protected function _getTimeoutConnect()
119
+ {
120
+ return 100;
121
+ }
122
+
123
+ /**
124
+ * Return Timeout Read
125
+ *
126
+ * @return int
127
+ */
128
+ protected function _getTimeoutRead()
129
+ {
130
+ return 100;
131
+ }
132
+
133
+ /**
134
+ * Call centinel api methods by given method name and data
135
+ *
136
+ * @param $method string
137
+ * @param $data array
138
+ *
139
+ * @return CentinelClient
140
+ */
141
+ protected function _call($method, $data)
142
+ {
143
+ $client = $this->_getClientInstance();
144
+ $request = array_merge(array(
145
+ 'MsgType' => $method,
146
+ 'Version' => $this->_getVersion(),
147
+ 'ProcessorId' => $this->getProcessorId(),
148
+ 'MerchantId' => $this->getMerchantId(),
149
+ 'TransactionPwd' => $this->getTransactionPwd(),
150
+ 'TransactionType' => $this->_getTransactionType(),
151
+ ), $data);
152
+
153
+ $debugData = array('request' => $request);
154
+
155
+ try {
156
+ foreach($request as $key => $val) {
157
+ $client->add($key, $val);
158
+ }
159
+ $client->sendHttp($this->_getApiEndpointUrl(), $this->_getTimeoutConnect(), $this->_getTimeoutRead());
160
+ } catch (Exception $e) {
161
+ $debugData['response'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
162
+ $this->_debug($debugData);
163
+ throw $e;
164
+ }
165
+
166
+ $debugData['response'] = $client->response;
167
+ $this->_debug($debugData);
168
+
169
+ return $client;
170
+ }
171
+
172
+ /**
173
+ * Getter for API call URL
174
+ *
175
+ * @return string
176
+ * @throws Exception
177
+ */
178
+ protected function _getApiEndpointUrl()
179
+ {
180
+ if ($this->getIsTestMode()) {
181
+ return 'https://centineltest.cardinalcommerce.com/maps/txns.asp';
182
+ }
183
+ $url = $this->getApiEndpointUrl();
184
+ if (!$url) {
185
+ throw new Exception('Centinel API endpoint URL is not configured properly.');
186
+ }
187
+ return $url;
188
+ }
189
+
190
+ /**
191
+ * Call centinel api lookup method
192
+ *
193
+ * @return Mage_Centinel_Model_Api
194
+ */
195
+ public function callLookup($data)
196
+ {
197
+ $result = new Varien_Object();
198
+
199
+ $month = strlen($data->getCardExpMonth()) == 1 ? '0' . $data->getCardExpMonth() : $data->getCardExpMonth();
200
+ $currencyCode = $data->getCurrencyCode();
201
+ $currencyNumber = isset(self::$_iso4217Currencies[$currencyCode]) ? self::$_iso4217Currencies[$currencyCode] : '';
202
+ if (!$currencyNumber) {
203
+ return $result->setErrorNo(1)->setErrorDesc(
204
+ Mage::helper('payment')->__('Unsupported currency code: %s.', $currencyCode)
205
+ );
206
+ }
207
+
208
+ $clientResponse = $this->_call('cmpi_lookup', array(
209
+ 'Amount' => round($data->getAmount() * 100),
210
+ 'CurrencyCode' => $currencyNumber,
211
+ 'CardNumber' => $data->getCardNumber(),
212
+ 'CardExpMonth'=> $month,
213
+ 'CardExpYear' => $data->getCardExpYear(),
214
+ 'OrderNumber' => $data->getOrderNumber()
215
+ ));
216
+
217
+ $result->setErrorNo($clientResponse->getValue('ErrorNo'));
218
+ $result->setErrorDesc($clientResponse->getValue('ErrorDesc'));
219
+ $result->setTransactionId($clientResponse->getValue('TransactionId'));
220
+ $result->setEnrolled($clientResponse->getValue('Enrolled'));
221
+ $result->setAcsUrl($clientResponse->getValue('ACSUrl'));
222
+ $result->setPayload($clientResponse->getValue('Payload'));
223
+ $result->setEciFlag($clientResponse->getValue('EciFlag'));
224
+
225
+ return $result;
226
+ }
227
+
228
+ /**
229
+ * Call centinel api authentication method
230
+ *
231
+ * @return Mage_Centinel_Model_Api
232
+ */
233
+ public function callAuthentication($data)
234
+ {
235
+ $result = new Varien_Object();
236
+
237
+ $clientResponse = $this->_call('cmpi_authenticate', array(
238
+ 'TransactionId' => $data->getTransactionId(),
239
+ 'PAResPayload' => $data->getPaResPayload(),
240
+ ));
241
+
242
+ $result->setErrorNo($clientResponse->getValue('ErrorNo'));
243
+ $result->setErrorDesc($clientResponse->getValue('ErrorDesc'));
244
+ $result->setPaResStatus($clientResponse->getValue('PAResStatus'));
245
+ $result->setSignatureVerification($clientResponse->getValue('SignatureVerification'));
246
+ $result->setCavv($clientResponse->getValue('Cavv'));
247
+ $result->setEciFlag($clientResponse->getValue('EciFlag'));
248
+ $result->setXid($clientResponse->getValue('Xid'));
249
+
250
+ return $result;
251
+ }
252
+
253
+ /**
254
+ * Log debug data to file
255
+ *
256
+ * @param mixed $debugData
257
+ */
258
+ protected function _debug($debugData)
259
+ {
260
+ if ($this->getDebugFlag()) {
261
+ Mage::getModel('core/log_adapter', 'card_validation_3d_secure.log')
262
+ ->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
263
+ ->log($debugData);
264
+ }
265
+ }
266
+ }
267
+
app/code/core/Mage/Centinel/Model/Config.php ADDED
@@ -0,0 +1,150 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Config centinel model
29
+ */
30
+ class Mage_Centinel_Model_Config
31
+ {
32
+ /**
33
+ * Store id or store model
34
+ *
35
+ * @var int|Mage_Core_Model_Store
36
+ */
37
+ protected $_store = false;
38
+
39
+ /**
40
+ * Path of centinel config
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_serviceConfigPath = 'payment_services/centinel';
45
+
46
+ /**
47
+ * Path of cards config
48
+ *
49
+ * @var string
50
+ */
51
+ protected $_cardTypesConfigPath = 'global/payment/cc/types';
52
+
53
+ /**
54
+ * Set store to congif model
55
+ *
56
+ * @param int|Mage_Core_Model_Store $store
57
+ * @return Mage_Centinel_Model_Config
58
+ */
59
+ public function setStore($store)
60
+ {
61
+ $this->_store = $store;
62
+ return $this;
63
+ }
64
+
65
+ /**
66
+ * Return store
67
+ *
68
+ * @return int|Mage_Core_Model_Store
69
+ */
70
+ public function getStore()
71
+ {
72
+ return $this->_store;
73
+ }
74
+
75
+ /**
76
+ * Return validation state class for card with type $cardType
77
+ *
78
+ * @param string $cardType
79
+ * @return string
80
+ */
81
+ public function getStateModelClass($cardType)
82
+ {
83
+ $node = Mage::getConfig()->getNode($this->_cardTypesConfigPath . '/' . $cardType . '/validator/centinel/state');
84
+ if (!$node) {
85
+ return false;
86
+ }
87
+ return $node->asArray();
88
+ }
89
+
90
+ /**
91
+ * Return centinel processorId
92
+ *
93
+ * @return string
94
+ */
95
+ public function getProcessorId()
96
+ {
97
+ return $this->_getServiceConfigValue('processor_id');
98
+ }
99
+
100
+ /**
101
+ * Return centinel merchantId
102
+ *
103
+ * @return string
104
+ */
105
+ public function getMerchantId()
106
+ {
107
+ return $this->_getServiceConfigValue('merchant_id');
108
+ }
109
+
110
+ /**
111
+ * Return centinel transactionPwd
112
+ *
113
+ * @return string
114
+ */
115
+ public function getTransactionPwd()
116
+ {
117
+ return Mage::helper('core')->decrypt($this->_getServiceConfigValue('password'));
118
+ }
119
+
120
+ /**
121
+ * Return flag - is centinel mode test
122
+ *
123
+ * @return bool
124
+ */
125
+ public function getIsTestMode()
126
+ {
127
+ return (bool)(int)$this->_getServiceConfigValue('test_mode');
128
+ }
129
+
130
+ /**
131
+ * Return value of node of centinel config section
132
+ *
133
+ * @param string $key
134
+ * @return string
135
+ */
136
+ private function _getServiceConfigValue($key)
137
+ {
138
+ return Mage::getStoreConfig($this->_serviceConfigPath . '/' . $key, $this->getStore());
139
+ }
140
+
141
+ /**
142
+ * Define if debugging is enabled
143
+ *
144
+ * @return bool
145
+ */
146
+ public function getDebugFlag()
147
+ {
148
+ return $this->_getServiceConfigValue('debug');
149
+ }
150
+ }
app/code/core/Mage/Centinel/Model/Observer.php ADDED
@@ -0,0 +1,141 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * 3D Secure Validation Model
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Centinel
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Mage_Centinel_Model_Observer extends Varien_Object
36
+ {
37
+ /**
38
+ * Set cmpi data to payment
39
+ *
40
+ * @param Varien_Object $observer
41
+ * @return Mage_Centinel_Model_Observer
42
+ */
43
+ public function salesEventConvertQuoteToOrder($observer)
44
+ {
45
+ $payment = $observer->getEvent()->getQuote()->getPayment();
46
+
47
+ if ($payment->getMethodInstance()->getIsCentinelValidationEnabled()) {
48
+ $to = array($payment, 'setAdditionalInformation');
49
+ $payment->getMethodInstance()->getCentinelValidator()->exportCmpiData($to);
50
+ }
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * Add cmpi data to info block
56
+ *
57
+ * @param Varien_Object $observer
58
+ * @return Mage_Centinel_Model_Observer
59
+ */
60
+ public function paymentInfoBlockPrepareSpecificInformation($observer)
61
+ {
62
+ if ($observer->getEvent()->getBlock()->getIsSecureMode()) {
63
+ return;
64
+ }
65
+
66
+ $payment = $observer->getEvent()->getPayment();
67
+ $transport = $observer->getEvent()->getTransport();
68
+ $helper = Mage::helper('centinel');
69
+
70
+ $info = array(
71
+ Mage_Centinel_Model_Service::CMPI_PARES,
72
+ Mage_Centinel_Model_Service::CMPI_ENROLLED,
73
+ Mage_Centinel_Model_Service::CMPI_ECI,
74
+ Mage_Centinel_Model_Service::CMPI_CAVV,
75
+ Mage_Centinel_Model_Service::CMPI_XID
76
+ );
77
+ foreach ($info as $key) {
78
+ if ($value = $payment->getAdditionalInformation($key)) {
79
+ $transport->setData($helper->getCmpiLabel($key), $helper->getCmpiValue($key, $value));
80
+ }
81
+ }
82
+ return $this;
83
+ }
84
+
85
+ /**
86
+ * Add centinel logo block into payment form
87
+ *
88
+ * @param Varien_Object $observer
89
+ * @return Mage_Centinel_Model_Observer
90
+ */
91
+ public function paymentFormBlockToHtmlBefore($observer)
92
+ {
93
+ $paymentFormBlock = $observer->getEvent()->getBlock();
94
+ $method = $paymentFormBlock->getMethod();
95
+
96
+ if ($method && $method->getIsCentinelValidationEnabled()) {
97
+ $paymentFormBlock->setChild(
98
+ 'payment.method.' . $method->getCode() . 'centinel.logo',
99
+ Mage::helper('centinel')->getMethodFormBlock($method)
100
+ );
101
+ }
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * Reset validation data
107
+ *
108
+ * @param Varien_Object $observer
109
+ * @return Mage_Centinel_Model_Observer
110
+ */
111
+ public function checkoutSubmitAllAfter($observer)
112
+ {
113
+ $method = false;
114
+
115
+ if ($order = $observer->getEvent()->getOrder()) {
116
+ $method = $order->getPayment()->getMethodInstance();
117
+ } elseif ($orders = $observer->getEvent()->getOrders()) {
118
+ if ($order = array_shift($orders)) {
119
+ $method = $order->getPayment()->getMethodInstance();
120
+ }
121
+ }
122
+
123
+ if ($method && $method->getIsCentinelValidationEnabled()) {
124
+ $method->getCentinelValidator()->reset();
125
+ }
126
+ return $this;
127
+ }
128
+
129
+ /**
130
+ * Reset validation data
131
+ * @deprecated back compatibility alias for checkoutSubmitAllAfter
132
+ *
133
+ * @param Varien_Object $observer
134
+ * @return Mage_Centinel_Model_Observer
135
+ */
136
+ public function salesOrderPaymentPlaceEnd($observer)
137
+ {
138
+ $this->checkoutSubmitAllAfter($observer);
139
+ return $this;
140
+ }
141
+ }
app/code/core/Mage/Centinel/Model/Service.php ADDED
@@ -0,0 +1,398 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * 3D Secure Validation Model
29
+ */
30
+ class Mage_Centinel_Model_Service extends Varien_Object
31
+ {
32
+ /**
33
+ * Cmpi public keys
34
+ */
35
+ const CMPI_PARES = 'centinel_authstatus';
36
+ const CMPI_ENROLLED = 'centinel_mpivendor';
37
+ const CMPI_CAVV = 'centinel_cavv';
38
+ const CMPI_ECI = 'centinel_eci';
39
+ const CMPI_XID = 'centinel_xid';
40
+
41
+ /**
42
+ * State cmpi results to public map
43
+ *
44
+ * @var array
45
+ */
46
+ protected $_cmpiMap = array(
47
+ 'lookup_enrolled' => self::CMPI_ENROLLED,
48
+ 'lookup_eci_flag' => self::CMPI_ECI,
49
+ 'authenticate_pa_res_status' => self::CMPI_PARES,
50
+ 'authenticate_cavv' => self::CMPI_CAVV,
51
+ 'authenticate_eci_flag' => self::CMPI_ECI,
52
+ 'authenticate_xid' => self::CMPI_XID,
53
+ );
54
+
55
+ /**
56
+ * Validation api model
57
+ *
58
+ * @var Mage_Centinel_Model_Api
59
+ */
60
+ protected $_api;
61
+
62
+ /**
63
+ * Validation state model
64
+ *
65
+ * @var Mage_Centinel_Model_StateAbstract
66
+ */
67
+ protected $_validationState;
68
+
69
+ /**
70
+ * Return validation session object
71
+ *
72
+ * @return Mage_Centinel_Model_Session
73
+ */
74
+ protected function _getSession()
75
+ {
76
+ return Mage::getSingleton('centinel/session');
77
+ }
78
+
79
+ /**
80
+ * Return value from section of centinel config
81
+ *
82
+ * @param string $path
83
+ * @return string
84
+ */
85
+ protected function _getConfig()
86
+ {
87
+ $config = Mage::getSingleton('centinel/config');
88
+ return $config->setStore($this->getStore());
89
+ }
90
+
91
+ /**
92
+ * Generate checksum from all passed parameters
93
+ *
94
+ * @param string $cardType
95
+ * @param string $cardNumber
96
+ * @param string $cardExpMonth
97
+ * @param string $cardExpYear
98
+ * @param double $amount
99
+ * @param string $currencyCode
100
+ * @return string
101
+ */
102
+ protected function _generateChecksum($paymentMethodCode, $cardType, $cardNumber, $cardExpMonth, $cardExpYear, $amount, $currencyCode)
103
+ {
104
+ return md5(implode(func_get_args(), '_'));
105
+ }
106
+
107
+ /**
108
+ * Unified validation/authentication URL getter
109
+ *
110
+ * @param string $suffix
111
+ * @param bool $current
112
+ * @return string
113
+ */
114
+ private function _getUrl($suffix, $current = false)
115
+ {
116
+ $params = array(
117
+ '_secure' => true,
118
+ '_current' => $current,
119
+ 'form_key' => Mage::getSingleton('core/session')->getFormKey(),
120
+ 'isIframe' => true
121
+ );
122
+ if (Mage::app()->getStore()->isAdmin()) {
123
+ return Mage::getSingleton('adminhtml/url')->getUrl('*/centinel_index/' . $suffix, $params);
124
+ } else {
125
+ return Mage::getUrl('centinel/index/' . $suffix, $params);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Return validation api model
131
+ *
132
+ * @return Mage_Centinel_Model_Api
133
+ */
134
+ protected function _getApi()
135
+ {
136
+ if (!is_null($this->_api)) {
137
+ return $this->_api;
138
+ }
139
+
140
+ $this->_api = Mage::getSingleton('centinel/api');
141
+ $config = $this->_getConfig();
142
+ $this->_api
143
+ ->setProcessorId($config->getProcessorId())
144
+ ->setMerchantId($config->getMerchantId())
145
+ ->setTransactionPwd($config->getTransactionPwd())
146
+ ->setIsTestMode($config->getIsTestMode())
147
+ ->setDebugFlag($config->getDebugFlag())
148
+ ->setApiEndpointUrl($this->getCustomApiEndpointUrl());
149
+ return $this->_api;
150
+ }
151
+
152
+ /**
153
+ * Create and return validation state model for card type
154
+ *
155
+ * @param string $cardType
156
+ * @return Mage_Centinel_Model_StateAbstract
157
+ */
158
+ protected function _getValidationStateModel($cardType)
159
+ {
160
+ if ($modelClass = $this->_getConfig()->getStateModelClass($cardType)) {
161
+ return Mage::getModel($modelClass);
162
+ }
163
+ return false;
164
+ }
165
+
166
+ /**
167
+ * Return validation state model
168
+ *
169
+ * @param string $cardType
170
+ * @return Mage_Centinel_Model_StateAbstract
171
+ */
172
+ protected function _getValidationState($cardType = null)
173
+ {
174
+ $type = $cardType ? $cardType : $this->_getSession()->getData('card_type');
175
+ if (!$this->_validationState && $type) {
176
+ $model = $this->_getValidationStateModel($type);
177
+ if (!$model) {
178
+ return false;
179
+ }
180
+ $model->setDataStorage($this->_getSession());
181
+ $this->_validationState = $model;
182
+ }
183
+ return $this->_validationState;
184
+ }
185
+
186
+ /**
187
+ * Drop validation state model
188
+ *
189
+ */
190
+ protected function _resetValidationState()
191
+ {
192
+ $this->_getSession()->setData(array());
193
+ $this->_validationState = false;
194
+ }
195
+
196
+ /**
197
+ * Drop old and init new validation state model
198
+ *
199
+ * @param string $cardType
200
+ * @param string $dataChecksum
201
+ * @return Mage_Centinel_Model_StateAbstract
202
+ */
203
+ protected function _initValidationState($cardType, $dataChecksum)
204
+ {
205
+ $this->_resetValidationState();
206
+ $state = $this->_getValidationStateModel($cardType);
207
+ $state->setDataStorage($this->_getSession())
208
+ ->setCardType($cardType)
209
+ ->setChecksum($dataChecksum)
210
+ ->setIsModeStrict($this->getIsModeStrict());
211
+ return $this->_getValidationState();
212
+ }
213
+
214
+ /**
215
+ * Process lookup validation and init new validation state model
216
+ *
217
+ * @param Varien_Object $data
218
+ */
219
+ public function lookup($data)
220
+ {
221
+ $newChecksum = $this->_generateChecksum(
222
+ $data->getPaymentMethodCode(),
223
+ $data->getCardType(),
224
+ $data->getCardNumber(),
225
+ $data->getCardExpMonth(),
226
+ $data->getCardExpYear(),
227
+ $data->getAmount(),
228
+ $data->getCurrencyCode()
229
+ );
230
+
231
+ $validationState = $this->_initValidationState($data->getCardType(), $newChecksum);
232
+
233
+ $api = $this->_getApi();
234
+ $result = $api->callLookup($data);
235
+ $validationState->setLookupResult($result);
236
+ }
237
+
238
+ /**
239
+ * Process authenticate validation
240
+ *
241
+ * @param Varien_Object $data
242
+ */
243
+ public function authenticate($data)
244
+ {
245
+ $validationState = $this->_getValidationState();
246
+ if (!$validationState || $data->getTransactionId() != $validationState->getLookupTransactionId()) {
247
+ throw new Exception('Authentication impossible: transaction id or validation state is wrong.');
248
+ }
249
+
250
+ $api = $this->_getApi();
251
+ $result = $api->callAuthentication($data);
252
+ $validationState->setAuthenticateResult($result);
253
+ if (!$validationState->isAuthenticateSuccessful()) {
254
+ $this->reset();
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Validate payment data
260
+ *
261
+ * This check is performed on payment information submission, as well as on placing order.
262
+ * Workflow state is stored validation state model
263
+ *
264
+ * @param Varien_Object $data
265
+ * @throws Mage_Core_Exception
266
+ */
267
+ public function validate($data)
268
+ {
269
+ $newChecksum = $this->_generateChecksum(
270
+ $data->getPaymentMethodCode(),
271
+ $data->getCardType(),
272
+ $data->getCardNumber(),
273
+ $data->getCardExpMonth(),
274
+ $data->getCardExpYear(),
275
+ $data->getAmount(),
276
+ $data->getCurrencyCode()
277
+ );
278
+
279
+ $validationState = $this->_getValidationState($data->getCardType());
280
+ if (!$validationState) {
281
+ $this->_resetValidationState();
282
+ return;
283
+ }
284
+
285
+ // check whether is authenticated before placing order
286
+ if ($this->getIsPlaceOrder()) {
287
+ if ($validationState->getChecksum() != $newChecksum) {
288
+ Mage::throwException(Mage::helper('centinel')->__('Payment information error. Please start over.'));
289
+ }
290
+ if ($validationState->isAuthenticateSuccessful()) {
291
+ return;
292
+ }
293
+ Mage::throwException(Mage::helper('centinel')->__('Please verify the card with the issuer bank before placing the order.'));
294
+ } else {
295
+ if ($validationState->getChecksum() != $newChecksum || !$validationState->isLookupSuccessful()) {
296
+ $this->lookup($data);
297
+ $validationState = $this->_getValidationState();
298
+ }
299
+ if ($validationState->isLookupSuccessful()) {
300
+ return;
301
+ }
302
+ Mage::throwException(Mage::helper('centinel')->__('This card has failed validation and cannot be used.'));
303
+ }
304
+ }
305
+
306
+ /**
307
+ * Reset validation state and drop api object
308
+ *
309
+ * @return Mage_Centinel_Model_Service
310
+ */
311
+ public function reset()
312
+ {
313
+ $this->_resetValidationState();
314
+ $this->_api = null;
315
+ return $this;
316
+ }
317
+
318
+ /**
319
+ * Return URL for authentication
320
+ *
321
+ * @return string
322
+ */
323
+ public function getAuthenticationStartUrl()
324
+ {
325
+ return $this->_getUrl('authenticationstart');
326
+ }
327
+
328
+ /**
329
+ * Return URL for validation
330
+ *
331
+ * @return string
332
+ */
333
+ public function getValidatePaymentDataUrl()
334
+ {
335
+ return $this->_getUrl('validatepaymentdata');
336
+ }
337
+
338
+ /**
339
+ * If authenticate is should return true
340
+ *
341
+ * @return bool
342
+ */
343
+ public function shouldAuthenticate()
344
+ {
345
+ $validationState = $this->_getValidationState();
346
+ return $validationState && $validationState->isAuthenticateAllowed();
347
+ }
348
+
349
+ /**
350
+ * Return data for start authentication (redirect customer to bank page)
351
+ *
352
+ * @return array
353
+ */
354
+ public function getAuthenticateStartData()
355
+ {
356
+ $validationState = $this->_getValidationState();
357
+ if (!$validationState && $this->shouldAuthenticate()) {
358
+ throw new Exception('Authentication impossible: validation state is wrong.');
359
+ }
360
+ $data = array(
361
+ 'acs_url' => $validationState->getLookupAcsUrl(),
362
+ 'pa_req' => $validationState->getLookupPayload(),
363
+ 'term_url' => $this->_getUrl('authenticationcomplete', true),
364
+ 'md' => $validationState->getLookupTransactionId()
365
+ );
366
+ return $data;
367
+ }
368
+
369
+ /**
370
+ * If authenticate is successful return true
371
+ *
372
+ * @return bool
373
+ */
374
+ public function isAuthenticateSuccessful()
375
+ {
376
+ $validationState = $this->_getValidationState();
377
+ return $validationState && $validationState->isAuthenticateSuccessful();
378
+ }
379
+
380
+ /**
381
+ * Export cmpi lookups and authentication information stored in session into array
382
+ *
383
+ * @param mixed $to
384
+ * @param array $map
385
+ * @return mixed $to
386
+ */
387
+ public function exportCmpiData($to, $map = false)
388
+ {
389
+ if (!$map) {
390
+ $map = $this->_cmpiMap;
391
+ }
392
+ if ($validationState = $this->_getValidationState()) {
393
+ $to = Varien_Object_Mapper::accumulateByMap($validationState, $to, $map);
394
+ }
395
+ return $to;
396
+ }
397
+ }
398
+
app/code/core/Mage/Centinel/Model/Session.php ADDED
@@ -0,0 +1,42 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ * Payment centinel session model
30
+ *
31
+ * @author Magento Core Team <core@magentocommerce.com>
32
+ */
33
+ class Mage_Centinel_Model_Session extends Mage_Core_Model_Session_Abstract
34
+ {
35
+ /**
36
+ * constructor
37
+ */
38
+ public function __construct()
39
+ {
40
+ $this->init('centinel_validator');
41
+ }
42
+ }
app/code/core/Mage/Centinel/Model/State/Jcb.php ADDED
@@ -0,0 +1,164 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Abstract Validation State Model for JCB
29
+ */
30
+ class Mage_Centinel_Model_State_Jcb extends Mage_Centinel_Model_StateAbstract
31
+ {
32
+ /**
33
+ * Analyse lookup`s results. If it has require params for authenticate, return true
34
+ *
35
+ * @return bool
36
+ */
37
+ public function isAuthenticateAllowed()
38
+ {
39
+ return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag());
40
+ }
41
+
42
+ /**
43
+ * Analyse authenticate`s results. If authenticate is successful return true and false if it failure
44
+ * Result depends from flag self::getIsModeStrict()
45
+ *
46
+ * @return bool
47
+ */
48
+ public function isAuthenticateSuccessful()
49
+ {
50
+ //Test cases 5-9
51
+ if (!$this->getIsModeStrict() && $this->_isLookupSoftSuccessful()) {
52
+ return true;
53
+ }
54
+
55
+ $paResStatus = $this->getAuthenticatePaResStatus();
56
+ $eciFlag = $this->getAuthenticateEciFlag();
57
+ $xid = $this->getAuthenticateXid();
58
+ $cavv = $this->getAuthenticateCavv();
59
+ $errorNo = $this->getAuthenticateErrorNo();
60
+ $signatureVerification = $this->getAuthenticateSignatureVerification();
61
+
62
+ //Test cases 1-4, 10-11
63
+ if ($this->_isLookupStrictSuccessful()) {
64
+
65
+ if ($paResStatus == 'Y' && $eciFlag == '05' && $xid != '' && $cavv != '' && $errorNo == '0') {
66
+ //Test case 1
67
+ if ($signatureVerification == 'Y') {
68
+ return true;
69
+ }
70
+ //Test case 2
71
+ if ($signatureVerification == 'N') {
72
+ return false;
73
+ }
74
+ }
75
+
76
+ //Test case 3
77
+ if ($paResStatus == 'N' && $signatureVerification == 'Y' && $eciFlag == '07' &&
78
+ $xid != '' && $cavv == '' && $errorNo == '0') {
79
+ return false;
80
+ }
81
+
82
+ //Test case 4
83
+ if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '07' &&
84
+ $xid != '' && $cavv == '' && $errorNo == '0') {
85
+ if ($this->getIsModeStrict()) {
86
+ return false;
87
+ } else {
88
+ return true;
89
+ }
90
+ }
91
+
92
+ //Test case 5
93
+ if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '07' &&
94
+ $xid != '' && $cavv == '' && $errorNo == '0') {
95
+ if ($this->getIsModeStrict()) {
96
+ return false;
97
+ } else {
98
+ return true;
99
+ }
100
+ }
101
+
102
+ //Test case 10
103
+ if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '07' &&
104
+ $xid == '' && $cavv == '' && $errorNo != '0') {
105
+ return false;
106
+ }
107
+
108
+ //Test case 11
109
+ if ($paResStatus == 'A' && $signatureVerification == 'Y' && $eciFlag == '06' &&
110
+ $xid != '' && $cavv != '' && $errorNo == '0') {
111
+ return true;
112
+ }
113
+ }
114
+
115
+ return false;
116
+ }
117
+
118
+ /**
119
+ * Analyse lookup`s results. If lookup is strict successful return true
120
+ *
121
+ * @return bool
122
+ */
123
+ protected function _isLookupStrictSuccessful()
124
+ {
125
+ //Test cases 1-4, 6, 10-11
126
+ if ($this->getLookupEnrolled() == 'Y' &&
127
+ $this->getLookupAcsUrl() != '' &&
128
+ $this->getLookupPayload() != '' &&
129
+ $this->getLookupErrorNo() == '0') {
130
+ return true;
131
+ }
132
+ return false;
133
+ }
134
+
135
+ /**
136
+ * Analyse lookup`s results. If lookup is soft successful return true
137
+ *
138
+ * @return bool
139
+ */
140
+ protected function _isLookupSoftSuccessful()
141
+ {
142
+ $acsUrl = $this->getLookupAcsUrl();
143
+ $payload = $this->getLookupPayload();
144
+ $errorNo = $this->getLookupErrorNo();
145
+ $enrolled = $this->getLookupEnrolled();
146
+
147
+ //Test cases 5
148
+ if ($enrolled == '' && $acsUrl == '' && $payload == '' && $errorNo == '0') {
149
+ return true;
150
+ }
151
+
152
+ //Test case 7
153
+ if ($enrolled == 'U' && $acsUrl == '' && $payload == '' && $errorNo == '0') {
154
+ return true;
155
+ }
156
+
157
+ //Test cases 8,9
158
+ if ($enrolled == 'U' && $acsUrl == '' && $payload == '' && $errorNo != '0') {
159
+ return true;
160
+ }
161
+
162
+ return false;
163
+ }
164
+ }
app/code/core/Mage/Centinel/Model/State/Mastercard.php ADDED
@@ -0,0 +1,156 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Centinel
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Abstract Validation State Model for Mastercard
29
+ */
30
+ class Mage_Centinel_Model_State_Mastercard extends Mage_Centinel_Model_StateAbstract
31
+ {
32
+ /**
33
+ * Analyse lookup`s results. If it has require params for authenticate, return true
34
+ *
35
+ * @return bool
36
+ */
37
+ public function isAuthenticateAllowed()
38
+ {
39
+ return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag());
40
+ }
41
+
42
+ /**
43
+ * Analyse authenticate`s results. If authenticate is successful return true and false if it failure
44
+ * Result depends from flag self::getIsModeStrict()
45
+ *
46
+ * @return bool
47
+ */
48
+ public function isAuthenticateSuccessful()
49
+ {
50
+ $paResStatus = $this->getAuthenticatePaResStatus();
51
+ $eciFlag = $this->getAuthenticateEciFlag();
52
+ $xid = $this->getAuthenticateXid();
53
+ $cavv = $this->getAuthenticateCavv();
54
+ $errorNo = $this->getAuthenticateErrorNo();
55
+ $signatureVerification = $this->getAuthenticateSignatureVerification();
56
+
57
+ //Test cases 1-4, 10
58
+ if ($this->_isLookupStrictSuccessful()) {
59
+
60
+ if ($paResStatus == 'Y' && $eciFlag == '02' && $xid != '' && $cavv != '' && $errorNo == '0') {
61
+ //Test case 1
62
+ if ($signatureVerification == 'Y') {
63
+ return true;
64
+ }
65
+ //Test case 2
66
+ if ($signatureVerification == 'N') {
67
+ return false;
68
+ }
69
+ }
70
+
71
+ //Test case 3
72
+ if ($paResStatus == 'N' && $signatureVerification == 'Y' && $eciFlag == '01' &&
73
+ $xid != '' && $cavv == '' && $errorNo == '0') {
74
+ return false;
75
+ }
76
+
77
+ //Test case 4
78
+ if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '01' &&
79
+ $xid != '' && $cavv == '' && $errorNo == '0') {
80
+ if ($this->getIsModeStrict()) {
81
+ return false;
82
+ } else {
83
+ return true;
84
+ }
85
+ }
86
+
87
+ //Test case 10
88
+ if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '01' &&
89
+ $xid == '' && $cavv == '' && $errorNo == '1050'
90
+ ) {
91
+ return false;
92
+ }
93
+
94
+ }
95
+
96
+ //Test cases 5-9
97
+ if (!$this->getIsModeStrict() && $this->_isLookupSoftSuccessful()) {
98
+ if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '' &&
99
+ $xid == '' && $cavv == '' && $errorNo == '0') {
100
+ return true;
101
+ } elseif ($paResStatus == false && $signatureVerification == false && $eciFlag == false &&
102
+ $xid == false && $cavv == false && $errorNo == false) {
103
+ return true;
104
+ }
105
+ }
106
+
107
+ return false;
108
+ }
109
+
110
+ /**
111
+ * Analyse lookup`s results. If lookup is strict successful return true
112
+ *
113
+ * @return bool
114
+ */
115
+ protected function _isLookupStrictSuccessful()
116
+ {
117
+ //Test cases 1-4, 10
118
+ if ($this->getLookupEnrolled() == 'Y' &&
119
+ $this->getLookupAcsUrl() != '' &&
120
+ $this->getLookupPayload() != '' &&
121
+ $this->getLookupErrorNo() == '0') {
122
+ return true;
123
+ }
124
+ return false;
125
+ }
126
+
127
+ /**
128
+ * Analyse lookup`s results. If lookup is soft successful return true
129
+ *
130
+ * @return bool
131
+ */
132
+ protected function _isLookupSoftSuccessful()
133
+ {
134
+ $acsUrl = $this->getLookupAcsUrl();
135
+ $payload = $this->getLookupPayload();
136
+ $errorNo = $this->getLookupErrorNo();
137
+ $enrolled = $this->getLookupEnrolled();
138
+
139
+ //Test cases 6,7
140
+ if ($acsUrl == '' && $payload == '' && $errorNo == '0' && ($enrolled == 'N' || $enrolled == 'U')) {
141
+ return true;
142
+ }
143
+
144
+ //Test case 5
145
+ if ($enrolled == '' && $acsUrl == '' && $payload == '' && $errorNo == 'Timeout number') {
146
+ return true;
147
+ }
148
+
149
+ //Test cases 8,9
150
+ if ($enrolled == 'U' && $acsUrl == '' && $payload == '' && $errorNo == '1001') {
151
+ return true;
152
+ }
153
+
154
+ return false;
155
+ }
156
+ }
app/code/core/Mage/Centinel/Model/State/Visa.php ADDED
@@ -0,0 +1,169 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.