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
- app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php +75 -0
- app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php +55 -0
- app/code/core/Mage/Centinel/Block/Authentication.php +87 -0
- app/code/core/Mage/Centinel/Block/Authentication/Complete.php +48 -0
- app/code/core/Mage/Centinel/Block/Authentication/Start.php +48 -0
- app/code/core/Mage/Centinel/Block/Logo.php +47 -0
- app/code/core/Mage/Centinel/Helper/Data.php +181 -0
- app/code/core/Mage/Centinel/Model/Api.php +267 -0
- app/code/core/Mage/Centinel/Model/Config.php +150 -0
- app/code/core/Mage/Centinel/Model/Observer.php +141 -0
- app/code/core/Mage/Centinel/Model/Service.php +398 -0
- app/code/core/Mage/Centinel/Model/Session.php +42 -0
- app/code/core/Mage/Centinel/Model/State/Jcb.php +164 -0
- app/code/core/Mage/Centinel/Model/State/Mastercard.php +156 -0
- app/code/core/Mage/Centinel/Model/State/Visa.php +169 -0
- app/code/core/Mage/Centinel/Model/StateAbstract.php +169 -0
- app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php +120 -0
- app/code/core/Mage/Centinel/controllers/IndexController.php +91 -0
- app/code/core/Mage/Centinel/etc/config.xml +171 -0
- app/code/core/Mage/Centinel/etc/system.xml +96 -0
- app/design/adminhtml/default/default/layout/centinel.xml +70 -0
- app/design/adminhtml/default/default/template/centinel/authentication/complete.phtml +38 -0
- app/design/adminhtml/default/default/template/centinel/authentication/start.phtml +38 -0
- app/design/adminhtml/default/default/template/centinel/validation/form.phtml +37 -0
- app/design/frontend/base/default/layout/centinel.xml +65 -0
- app/design/frontend/base/default/template/centinel/authentication.phtml +56 -0
- app/design/frontend/base/default/template/centinel/authentication/complete.phtml +41 -0
- app/design/frontend/base/default/template/centinel/authentication/start.phtml +40 -0
- app/design/frontend/base/default/template/centinel/logo.phtml +33 -0
- app/etc/modules/Mage_Centinel.xml +39 -0
- app/locale/en_US/Mage_Centinel.csv +34 -0
- js/mage/adminhtml/sales/centinel.js +71 -0
- lib/3Dsecure/CentinelClient.php +161 -0
- lib/3Dsecure/CentinelErrors.php +20 -0
- lib/3Dsecure/XMLParser.php +88 -0
- package.xml +18 -0
- skin/frontend/base/default/images/centinel/sc_learn_62x34.gif +0 -0
- skin/frontend/base/default/images/centinel/v_activate_steps.gif +0 -0
- 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&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.
|
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 Visa
|
29 |
+
*/
|
30 |
+
class Mage_Centinel_Model_State_Visa 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-5, 11
|
58 |
+
if ($this->_isLookupStrictSuccessful()) {
|
59 |
+
|
60 |
+
if ($paResStatus == 'Y' && $eciFlag == '05' && $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 == '07' &&
|
73 |
+
$xid != '' && $cavv == '' && $errorNo == '0') {
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
//Test case 4
|
78 |
+
if ($paResStatus == 'A' && $signatureVerification == 'Y' && $eciFlag == '06' &&
|
79 |
+
$xid != '' && $cavv != '' && $errorNo == '0') {
|
80 |
+
if ($this->getIsModeStrict()) {
|
81 |
+
return false;
|
82 |
+
} else {
|
83 |
+
return true;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
//Test case 5
|
88 |
+
if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '07' &&
|
89 |
+
$xid != '' && $cavv == '' && $errorNo == '0') {
|
90 |
+
if ($this->getIsModeStrict()) {
|
91 |
+
return false;
|
92 |
+
} else {
|
93 |
+
return true;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
//Test case 11
|
98 |
+
if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '07' &&
|
99 |
+
$xid == '' && $cavv == '' && $errorNo == '1050') {
|
100 |
+
if ($this->getIsModeStrict()) {
|
101 |
+
return false;
|
102 |
+
} else {
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
//Test cases 6-10
|
110 |
+
if (!$this->getIsModeStrict() && $this->_isLookupSoftSuccessful()) {
|
111 |
+
if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '' &&
|
112 |
+
$xid == '' && $cavv == '' && $errorNo == '0') {
|
113 |
+
return true;
|
114 |
+
} elseif ($paResStatus == false && $signatureVerification == false && $eciFlag == false &&
|
115 |
+
$xid == false && $cavv == false && $errorNo == false) {
|
116 |
+
return true;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
return false;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Analyse lookup`s results. If lookup is strict successful return true
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
protected function _isLookupStrictSuccessful()
|
129 |
+
{
|
130 |
+
//Test cases 1-5, 11
|
131 |
+
if ($this->getLookupEnrolled() == 'Y' &&
|
132 |
+
$this->getLookupAcsUrl() != '' &&
|
133 |
+
$this->getLookupPayload() != '' &&
|
134 |
+
$this->getLookupErrorNo() == '0') {
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Analyse lookup`s results. If lookup is soft successful return true
|
142 |
+
*
|
143 |
+
* @return bool
|
144 |
+
*/
|
145 |
+
protected function _isLookupSoftSuccessful()
|
146 |
+
{
|
147 |
+
$acsUrl = $this->getLookupAcsUrl();
|
148 |
+
$payload = $this->getLookupPayload();
|
149 |
+
$errorNo = $this->getLookupErrorNo();
|
150 |
+
$enrolled = $this->getLookupEnrolled();
|
151 |
+
|
152 |
+
//Test cases 7,8
|
153 |
+
if ($acsUrl == '' && $payload == '' && $errorNo == '0' && ($enrolled == 'N' || $enrolled == 'U')) {
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
|
157 |
+
//Test case 6
|
158 |
+
if ($enrolled == '' && $acsUrl == '' && $payload == '' && $errorNo == 'Timeout number') {
|
159 |
+
return true;
|
160 |
+
}
|
161 |
+
|
162 |
+
//Test cases 9,10
|
163 |
+
if ($enrolled == 'U' && $acsUrl == '' && $payload == '' && $errorNo == '1001') {
|
164 |
+
return true;
|
165 |
+
}
|
166 |
+
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
}
|
app/code/core/Mage/Centinel/Model/StateAbstract.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.
|
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
|
29 |
+
*/
|
30 |
+
abstract class Mage_Centinel_Model_StateAbstract extends Varien_Object
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Storage data model
|
34 |
+
*
|
35 |
+
* @var Varien_Object
|
36 |
+
*/
|
37 |
+
private $_dataStorage = false;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Setter for storage data model
|
41 |
+
*
|
42 |
+
* @param Varien_Object $dataStorageModel
|
43 |
+
* @return Mage_Centinel_Model_StateAbstract
|
44 |
+
*/
|
45 |
+
public function setDataStorage($dataStorageModel)
|
46 |
+
{
|
47 |
+
$this->_dataStorage = $dataStorageModel;
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Getter for storage data model
|
53 |
+
*
|
54 |
+
* @return Varien_Object
|
55 |
+
*/
|
56 |
+
public function getDataStorage()
|
57 |
+
{
|
58 |
+
return $this->_dataStorage;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieves data from the object
|
63 |
+
*
|
64 |
+
* If $key is empty will return all the data as an array
|
65 |
+
* Otherwise it will return value of the attribute specified by $key
|
66 |
+
*
|
67 |
+
* $index parameter is ignored
|
68 |
+
* @see Mage_Core_Model_Session_Abstract::getData()
|
69 |
+
*
|
70 |
+
* @param string $key
|
71 |
+
* @param string|int $index
|
72 |
+
* @return mixed
|
73 |
+
*/
|
74 |
+
public function getData($key='', $index=null)
|
75 |
+
{
|
76 |
+
return $this->getDataStorage()->getData($key);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Overwrite data in the object.
|
81 |
+
*
|
82 |
+
* $key can be string or array.
|
83 |
+
* If $key is string, the attribute value will be overwritten by $value
|
84 |
+
*
|
85 |
+
* If $key is an array, it will overwrite all the data in the object.
|
86 |
+
*
|
87 |
+
* @param string|array $key
|
88 |
+
* @param mixed $value
|
89 |
+
* @return Mage_Centinel_Model_StateAbstract
|
90 |
+
*/
|
91 |
+
public function setData($key, $value=null)
|
92 |
+
{
|
93 |
+
$this->getDataStorage()->setData($key, $value);
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Save lookup result in state model
|
99 |
+
*
|
100 |
+
* @param Varien_Object $result
|
101 |
+
* @return Mage_Centinel_Model_StateAbstract
|
102 |
+
*/
|
103 |
+
public function setLookupResult($result)
|
104 |
+
{
|
105 |
+
foreach ($result->getData() as $key => $value) {
|
106 |
+
$this->setData('lookup_' . $key, $value);
|
107 |
+
}
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Save authenticate result in state model
|
113 |
+
*
|
114 |
+
* @param Varien_Object $result
|
115 |
+
* @return Mage_Centinel_Model_StateAbstract
|
116 |
+
*/
|
117 |
+
public function setAuthenticateResult($result)
|
118 |
+
{
|
119 |
+
foreach ($result->getData() as $key => $value) {
|
120 |
+
$this->setData('authenticate_' . $key, $value);
|
121 |
+
}
|
122 |
+
return $this;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Analyse lookup`s results. If lookup is successful return true and false if it failure
|
127 |
+
* Result depends from flag self::getIsModeStrict()
|
128 |
+
*
|
129 |
+
* @return bool
|
130 |
+
*/
|
131 |
+
final public function isLookupSuccessful()
|
132 |
+
{
|
133 |
+
if ($this->_isLookupStrictSuccessful()) {
|
134 |
+
return true;
|
135 |
+
} elseif (!$this->getIsModeStrict() && $this->_isLookupSoftSuccessful()) {
|
136 |
+
return true;
|
137 |
+
}
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Analyse lookup`s results. If lookup is strict successful return true
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
abstract protected function _isLookupStrictSuccessful();
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Analyse lookup`s results. If lookup is soft successful return true
|
150 |
+
*
|
151 |
+
* @return bool
|
152 |
+
*/
|
153 |
+
abstract protected function _isLookupSoftSuccessful();
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Analyse lookup`s results. If it has require params for authenticate, return true
|
157 |
+
*
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
abstract public function isAuthenticateAllowed();
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Analyse authenticate`s results. If authenticate is successful return true and false if it failure
|
164 |
+
* Result depends from flag self::getIsModeStrict()
|
165 |
+
*
|
166 |
+
* @return bool
|
167 |
+
*/
|
168 |
+
abstract public function isAuthenticateSuccessful();
|
169 |
+
}
|
app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 Index Controller
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_Centinel_Adminhtml_Centinel_IndexController extends Mage_Adminhtml_Controller_Action
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Process validate payment data action
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
public function validatePaymentDataAction()
|
38 |
+
{
|
39 |
+
$result = array();
|
40 |
+
try {
|
41 |
+
$paymentData = $this->getRequest()->getParam('payment');
|
42 |
+
$validator = $this->_getValidator();
|
43 |
+
if (!$validator) {
|
44 |
+
throw new Exception('This payment method does not have centinel validation.');
|
45 |
+
}
|
46 |
+
$this->_getPayment()->importData($paymentData);
|
47 |
+
if ($validator->shouldAuthenticate()) {
|
48 |
+
$result['authenticationUrl'] = $validator->getAuthenticationStartUrl();
|
49 |
+
} else {
|
50 |
+
Mage::throwException(Mage::helper('centinel')->__('This card has failed validation, but it is possible to place the order.'));
|
51 |
+
}
|
52 |
+
} catch (Mage_Core_Exception $e) {
|
53 |
+
$result['message'] = $e->getMessage();
|
54 |
+
} catch (Exception $e) {
|
55 |
+
Mage::logException($e);
|
56 |
+
$result['message'] = Mage::helper('centinel')->__('Validation failed.');
|
57 |
+
}
|
58 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Process autentication start action
|
63 |
+
*
|
64 |
+
*/
|
65 |
+
public function authenticationStartAction()
|
66 |
+
{
|
67 |
+
if ($validator = $this->_getValidator()) {
|
68 |
+
Mage::register('current_centinel_validator', $validator);
|
69 |
+
}
|
70 |
+
$this->loadLayout()->renderLayout();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Process autentication complete action
|
75 |
+
*
|
76 |
+
*/
|
77 |
+
public function authenticationCompleteAction()
|
78 |
+
{
|
79 |
+
try {
|
80 |
+
if ($validator = $this->_getValidator()) {
|
81 |
+
$request = $this->getRequest();
|
82 |
+
|
83 |
+
$data = new Varien_Object();
|
84 |
+
$data->setTransactionId($request->getParam('MD'));
|
85 |
+
$data->setPaResPayload($request->getParam('PaRes'));
|
86 |
+
|
87 |
+
$validator->authenticate($data);
|
88 |
+
Mage::register('current_centinel_validator', $validator);
|
89 |
+
}
|
90 |
+
} catch (Exception $e) {
|
91 |
+
Mage::register('current_centinel_validator', false);
|
92 |
+
}
|
93 |
+
$this->loadLayout()->renderLayout();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Return payment model
|
98 |
+
*
|
99 |
+
* @return Mage_Sales_Model_Quote_Payment
|
100 |
+
*/
|
101 |
+
private function _getPayment()
|
102 |
+
{
|
103 |
+
$model = Mage::getSingleton('adminhtml/sales_order_create');
|
104 |
+
return $model->getQuote()->getPayment();
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Return Centinel validation model
|
109 |
+
*
|
110 |
+
* @return Mage_Centinel_Model_Service
|
111 |
+
*/
|
112 |
+
private function _getValidator()
|
113 |
+
{
|
114 |
+
if ($this->_getPayment()->getMethodInstance()->getIsCentinelValidationEnabled()) {
|
115 |
+
return $this->_getPayment()->getMethodInstance()->getCentinelValidator();
|
116 |
+
}
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
app/code/core/Mage/Centinel/controllers/IndexController.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 Authenticate Controller
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_Centinel_IndexController extends Mage_Core_Controller_Front_Action
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Process autentication start action
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
public function authenticationStartAction()
|
38 |
+
{
|
39 |
+
if ($validator = $this->_getValidator()) {
|
40 |
+
Mage::register('current_centinel_validator', $validator);
|
41 |
+
}
|
42 |
+
$this->loadLayout()->renderLayout();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Process autentication complete action
|
47 |
+
*
|
48 |
+
*/
|
49 |
+
public function authenticationCompleteAction()
|
50 |
+
{
|
51 |
+
try {
|
52 |
+
if ($validator = $this->_getValidator()) {
|
53 |
+
$request = $this->getRequest();
|
54 |
+
|
55 |
+
$data = new Varien_Object();
|
56 |
+
$data->setTransactionId($request->getParam('MD'));
|
57 |
+
$data->setPaResPayload($request->getParam('PaRes'));
|
58 |
+
|
59 |
+
$validator->authenticate($data);
|
60 |
+
Mage::register('current_centinel_validator', $validator);
|
61 |
+
}
|
62 |
+
} catch (Exception $e) {
|
63 |
+
Mage::register('current_centinel_validator', false);
|
64 |
+
}
|
65 |
+
$this->loadLayout()->renderLayout();
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Return payment model
|
70 |
+
*
|
71 |
+
* @return Mage_Sales_Model_Quote_Payment
|
72 |
+
*/
|
73 |
+
private function _getPayment()
|
74 |
+
{
|
75 |
+
return Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Return Centinel validation model
|
80 |
+
*
|
81 |
+
* @return Mage_Centinel_Model_Service
|
82 |
+
*/
|
83 |
+
private function _getValidator()
|
84 |
+
{
|
85 |
+
if ($this->_getPayment()->getMethodInstance()->getIsCentinelValidationEnabled()) {
|
86 |
+
return $this->_getPayment()->getMethodInstance()->getCentinelValidator();
|
87 |
+
}
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
app/code/core/Mage/Centinel/etc/config.xml
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Centinel
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Mage_Centinel>
|
31 |
+
<version>1.6.0.0</version>
|
32 |
+
</Mage_Centinel>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<events>
|
36 |
+
<sales_convert_quote_to_order>
|
37 |
+
<observers>
|
38 |
+
<centinel>
|
39 |
+
<class>centinel/observer</class>
|
40 |
+
<method>salesEventConvertQuoteToOrder</method>
|
41 |
+
</centinel>
|
42 |
+
</observers>
|
43 |
+
</sales_convert_quote_to_order>
|
44 |
+
<checkout_submit_all_after>
|
45 |
+
<observers>
|
46 |
+
<centinel>
|
47 |
+
<class>centinel/observer</class>
|
48 |
+
<method>checkoutSubmitAllAfter</method>
|
49 |
+
</centinel>
|
50 |
+
</observers>
|
51 |
+
</checkout_submit_all_after>
|
52 |
+
</events>
|
53 |
+
</global>
|
54 |
+
<frontend>
|
55 |
+
<translate>
|
56 |
+
<modules>
|
57 |
+
<Mage_Centinel>
|
58 |
+
<files>
|
59 |
+
<default>Mage_Centinel.csv</default>
|
60 |
+
</files>
|
61 |
+
</Mage_Centinel>
|
62 |
+
</modules>
|
63 |
+
</translate>
|
64 |
+
<events>
|
65 |
+
<payment_form_block_to_html_before>
|
66 |
+
<observers>
|
67 |
+
<centinel>
|
68 |
+
<type>model</type>
|
69 |
+
<class>centinel/observer</class>
|
70 |
+
<method>paymentFormBlockToHtmlBefore</method>
|
71 |
+
</centinel>
|
72 |
+
</observers>
|
73 |
+
</payment_form_block_to_html_before>
|
74 |
+
</events>
|
75 |
+
<routers>
|
76 |
+
<centinel>
|
77 |
+
<use>standard</use>
|
78 |
+
<args>
|
79 |
+
<module>Mage_Centinel</module>
|
80 |
+
<frontName>centinel</frontName>
|
81 |
+
</args>
|
82 |
+
</centinel>
|
83 |
+
</routers>
|
84 |
+
<layout>
|
85 |
+
<updates>
|
86 |
+
<centinel>
|
87 |
+
<file>centinel.xml</file>
|
88 |
+
</centinel>
|
89 |
+
</updates>
|
90 |
+
</layout>
|
91 |
+
<secure_url>
|
92 |
+
<centinel>/centinel/</centinel>
|
93 |
+
</secure_url>
|
94 |
+
</frontend>
|
95 |
+
<adminhtml>
|
96 |
+
<events>
|
97 |
+
<payment_info_block_prepare_specific_information>
|
98 |
+
<observers>
|
99 |
+
<centinel>
|
100 |
+
<type>model</type>
|
101 |
+
<class>centinel/observer</class>
|
102 |
+
<method>paymentInfoBlockPrepareSpecificInformation</method>
|
103 |
+
</centinel>
|
104 |
+
</observers>
|
105 |
+
</payment_info_block_prepare_specific_information>
|
106 |
+
</events>
|
107 |
+
<translate>
|
108 |
+
<modules>
|
109 |
+
<Mage_Centinel>
|
110 |
+
<files>
|
111 |
+
<default>Mage_Centinel.csv</default>
|
112 |
+
</files>
|
113 |
+
</Mage_Centinel>
|
114 |
+
</modules>
|
115 |
+
</translate>
|
116 |
+
<layout>
|
117 |
+
<updates>
|
118 |
+
<centinel>
|
119 |
+
<file>centinel.xml</file>
|
120 |
+
</centinel>
|
121 |
+
</updates>
|
122 |
+
</layout>
|
123 |
+
</adminhtml>
|
124 |
+
<admin>
|
125 |
+
<routers>
|
126 |
+
<adminhtml>
|
127 |
+
<args>
|
128 |
+
<modules>
|
129 |
+
<Mage_Centinel before="Mage_Adminhtml">Mage_Centinel_Adminhtml</Mage_Centinel>
|
130 |
+
</modules>
|
131 |
+
</args>
|
132 |
+
</adminhtml>
|
133 |
+
</routers>
|
134 |
+
</admin>
|
135 |
+
<global>
|
136 |
+
<payment>
|
137 |
+
<cc>
|
138 |
+
<types>
|
139 |
+
<VI>
|
140 |
+
<validator>
|
141 |
+
<centinel>
|
142 |
+
<state>centinel/state_visa</state>
|
143 |
+
</centinel>
|
144 |
+
</validator>
|
145 |
+
</VI>
|
146 |
+
<MC>
|
147 |
+
<validator>
|
148 |
+
<centinel>
|
149 |
+
<state>centinel/state_mastercard</state>
|
150 |
+
</centinel>
|
151 |
+
</validator>
|
152 |
+
</MC>
|
153 |
+
<JCB>
|
154 |
+
<validator>
|
155 |
+
<centinel>
|
156 |
+
<state>centinel/state_jcb</state>
|
157 |
+
</centinel>
|
158 |
+
</validator>
|
159 |
+
</JCB>
|
160 |
+
<SM>
|
161 |
+
<validator>
|
162 |
+
<centinel>
|
163 |
+
<state>centinel/state_mastercard</state>
|
164 |
+
</centinel>
|
165 |
+
</validator>
|
166 |
+
</SM>
|
167 |
+
</types>
|
168 |
+
</cc>
|
169 |
+
</payment>
|
170 |
+
</global>
|
171 |
+
</config>
|
app/code/core/Mage/Centinel/etc/system.xml
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Centinel
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<payment_services translate="label" module="payment">
|
31 |
+
<label>Payment Services</label>
|
32 |
+
<tab>sales</tab>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>450</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
<groups>
|
39 |
+
<centinel translate="label">
|
40 |
+
<label>3D Secure Credit Card Validation</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>1</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<processor_id translate="label">
|
48 |
+
<label>Processor ID</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>10</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
</processor_id>
|
55 |
+
<merchant_id translate="label">
|
56 |
+
<label>Merchant ID</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>20</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>0</show_in_store>
|
62 |
+
</merchant_id>
|
63 |
+
<password translate="label">
|
64 |
+
<label>Password</label>
|
65 |
+
<frontend_type>obscure</frontend_type>
|
66 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
67 |
+
<sort_order>30</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>0</show_in_store>
|
71 |
+
</password>
|
72 |
+
<test_mode translate="label comment">
|
73 |
+
<label>Test Mode</label>
|
74 |
+
<comment>Overrides API URL that may be specified by a payment method.</comment>
|
75 |
+
<frontend_type>select</frontend_type>
|
76 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
77 |
+
<sort_order>40</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>0</show_in_store>
|
81 |
+
</test_mode>
|
82 |
+
<debug translate="label">
|
83 |
+
<label>Debug Mode</label>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
86 |
+
<sort_order>50</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>0</show_in_store>
|
90 |
+
</debug>
|
91 |
+
</fields>
|
92 |
+
</centinel>
|
93 |
+
</groups>
|
94 |
+
</payment_services>
|
95 |
+
</sections>
|
96 |
+
</config>
|
app/design/adminhtml/default/default/layout/centinel.xml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package default_default
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
-->
|
29 |
+
<layout version="0.1.0">
|
30 |
+
|
31 |
+
<adminhtml_centinel_index_authenticationstart>
|
32 |
+
<block type="centinel/authentication_start" name="root" output="toHtml" template="centinel/authentication/start.phtml"/>
|
33 |
+
</adminhtml_centinel_index_authenticationstart>
|
34 |
+
|
35 |
+
<adminhtml_centinel_index_authenticationcomplete>
|
36 |
+
<block type="centinel/authentication_complete" name="root" output="toHtml" template="centinel/authentication/complete.phtml"/>
|
37 |
+
</adminhtml_centinel_index_authenticationcomplete>
|
38 |
+
|
39 |
+
<adminhtml_sales_order_create_index>
|
40 |
+
<reference name="head">
|
41 |
+
<action method="addJs"><script>mage/adminhtml/sales/centinel.js</script></action>
|
42 |
+
</reference>
|
43 |
+
<reference name="data">
|
44 |
+
<block type="centinel/adminhtml_validation" as="card_validation" name="card_validation" template="sales/order/create/abstract.phtml">
|
45 |
+
<block type="centinel/adminhtml_validation_form" template="centinel/validation/form.phtml" name="form" />
|
46 |
+
</block>
|
47 |
+
</reference>
|
48 |
+
</adminhtml_sales_order_create_index>
|
49 |
+
|
50 |
+
<adminhtml_sales_order_create_start>
|
51 |
+
<update handle="adminhtml_sales_order_create_index"/>
|
52 |
+
</adminhtml_sales_order_create_start>
|
53 |
+
|
54 |
+
<adminhtml_sales_order_create_load_block_data>
|
55 |
+
<reference name="data">
|
56 |
+
<block type="centinel/adminhtml_validation" as="card_validation" name="card_validation" template="sales/order/create/abstract.phtml">
|
57 |
+
<block type="centinel/adminhtml_validation_form" template="centinel/validation/form.phtml" name="form" />
|
58 |
+
</block>
|
59 |
+
</reference>
|
60 |
+
</adminhtml_sales_order_create_load_block_data>
|
61 |
+
|
62 |
+
<adminhtml_sales_order_create_load_block_card_validation>
|
63 |
+
<reference name="content">
|
64 |
+
<block type="centinel/adminhtml_validation" as="card_validation" name="card_validation" template="sales/order/create/abstract.phtml">
|
65 |
+
<block type="centinel/adminhtml_validation_form" template="centinel/validation/form.phtml" name="form" />
|
66 |
+
</block>
|
67 |
+
</reference>
|
68 |
+
</adminhtml_sales_order_create_load_block_card_validation>
|
69 |
+
|
70 |
+
</layout>
|
app/design/adminhtml/default/default/template/centinel/authentication/complete.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php if ($this->getIsProcessed()):?>
|
28 |
+
<?php if ($this->getIsSuccess()):?>
|
29 |
+
<h1><?php echo $this->__('Verification Successful');?></h1>
|
30 |
+
<p><?php echo $this->__('Please continue with placing order.')?></p>
|
31 |
+
<?php else:?>
|
32 |
+
<h4><?php echo $this->__('Verification Failed');?></h4>
|
33 |
+
<p><?php echo $this->__('The card has failed verification with the issuer bank.')?> <strong><?php echo $this->__('Order cannot be placed.')?></strong></p>
|
34 |
+
<?php endif;?>
|
35 |
+
<?php else:?>
|
36 |
+
<h4><?php echo $this->__('Verification cannot be processed');?></h4>
|
37 |
+
<p><?php echo $this->__('There has been wrong payment information submitted or time limit has expired. Please, try again.')?> <strong><?php echo $this->__('Order cannot be placed.')?></strong></p>
|
38 |
+
<?php endif;?>
|
app/design/adminhtml/default/default/template/centinel/authentication/start.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<form name="validation_form" id="validation_form" action="<?php echo $this->getAcsUrl();?>" method="post">
|
28 |
+
<input type="hidden" name="PaReq" value="<?php echo $this->getPaReq()?>" />
|
29 |
+
<input type="hidden" name="TermUrl" value="<?php echo $this->getTermUrl()?>" />
|
30 |
+
<input type="hidden" name="MD" value="<?php echo $this->getMd()?>" />
|
31 |
+
</form>
|
32 |
+
<script type="text/javascript">
|
33 |
+
//<![CDATA[
|
34 |
+
window.onload = function(){
|
35 |
+
document.getElementById('validation_form').submit();
|
36 |
+
};
|
37 |
+
//]]>
|
38 |
+
</script>
|
app/design/adminhtml/default/default/template/centinel/validation/form.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="centinel">
|
28 |
+
<div class="authentication">
|
29 |
+
<iframe frameborder="0" border="0" id="<?php echo $this->getContainerId() ?>" src="" style="display:none;"></iframe>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
<button onclick="cardValidator.validate()" class="scalable" type="button"><span><?php echo $this->__('Start/Reset Validation...')?></span></button>
|
33 |
+
<script type="text/javascript">
|
34 |
+
//<![CDATA[
|
35 |
+
cardValidator = new centinelValidator('<?php echo $this->getMethodCode() ?>', '<?php echo $this->getFrameUrl() ?>', '<?php echo $this->getContainerId() ?>');
|
36 |
+
//]]>
|
37 |
+
</script>
|
app/design/frontend/base/default/layout/centinel.xml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package base_default
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
-->
|
29 |
+
<layout version="0.1.0">
|
30 |
+
<centinel_index_authenticationstart>
|
31 |
+
<block type="centinel/authentication_start" name="root" output="toHtml" template="centinel/authentication/start.phtml"/>
|
32 |
+
</centinel_index_authenticationstart>
|
33 |
+
|
34 |
+
<centinel_index_authenticationcomplete>
|
35 |
+
<block type="centinel/authentication_complete" name="root" output="toHtml" template="centinel/authentication/complete.phtml"/>
|
36 |
+
</centinel_index_authenticationcomplete>
|
37 |
+
|
38 |
+
<checkout_multishipping_overview>
|
39 |
+
<reference name="head">
|
40 |
+
<action method="addJs"><script>mage/centinel.js</script></action>
|
41 |
+
</reference>
|
42 |
+
<reference name="checkout.multishipping.overview.items.after">
|
43 |
+
<block type="centinel/authentication" name="centinel.frame" template="centinel/authentication.phtml">
|
44 |
+
<action method="addRelatedBlock"><blockId>checkout-review-submit</blockId></action>
|
45 |
+
<action method="setAuthenticationStartMode"><mode>window</mode></action>
|
46 |
+
</block>
|
47 |
+
</reference>
|
48 |
+
</checkout_multishipping_overview>
|
49 |
+
|
50 |
+
<checkout_onepage_savepayment>
|
51 |
+
<reference name="checkout.onepage.review.info.items.before">
|
52 |
+
<block type="centinel/authentication" name="centinel.frame" template="centinel/authentication.phtml">
|
53 |
+
<action method="addRelatedBlock"><blockId>checkout-review-submit</blockId></action>
|
54 |
+
<action method="addRelatedBlock"><blockId>checkout-review-table-wrapper</blockId></action>
|
55 |
+
<action method="setAuthenticationStartMode"><mode>instant</mode></action>
|
56 |
+
</block>
|
57 |
+
</reference>
|
58 |
+
</checkout_onepage_savepayment>
|
59 |
+
|
60 |
+
<checkout_onepage_index>
|
61 |
+
<reference name="head">
|
62 |
+
<action method="addJs"><script>mage/centinel.js</script></action>
|
63 |
+
</reference>
|
64 |
+
</checkout_onepage_index>
|
65 |
+
</layout>
|
app/design/frontend/base/default/template/centinel/authentication.phtml
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php if ($this->getAuthenticationStart()):?>
|
28 |
+
<div class="centinel" id="centinel_authenticate_block">
|
29 |
+
<h3><?php echo $this->__('Card Verification')?></h3>
|
30 |
+
<p><?php echo $this->__('Please verify the card with the issuer bank:') ?></p>
|
31 |
+
<div class="authentication">
|
32 |
+
<iframe id="centinel_authenticate_iframe" frameborder="0" border="0" src=""></iframe>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
<script type="text/javascript">
|
36 |
+
//<![CDATA[
|
37 |
+
CentinelAuthenticateController = new CentinelAuthenticate('centinel_authenticate_block', 'centinel_authenticate_iframe');
|
38 |
+
<?php foreach ($this->getRelatedBlocks() as $relatedBlockId):?>
|
39 |
+
CentinelAuthenticateController.addRelatedBlock('<?php echo $relatedBlockId ?>');
|
40 |
+
<?php endforeach;?>
|
41 |
+
<?php if ($this->getAuthenticationStartMode() == 'instant'): ?>
|
42 |
+
CentinelAuthenticateController.start('<?php echo $this->getFrameUrl() ?>');
|
43 |
+
<?php elseif ($this->getAuthenticationStartMode() == 'window'):?>
|
44 |
+
Event.observe(window, 'load', function(){CentinelAuthenticateController.start('<?php echo $this->getFrameUrl() ?>');});
|
45 |
+
<?php endif;?>
|
46 |
+
//]]>
|
47 |
+
</script>
|
48 |
+
<?php else:?>
|
49 |
+
<script type="text/javascript">
|
50 |
+
//<![CDATA[
|
51 |
+
if (typeof CentinelAuthenticateController != 'undefined') {
|
52 |
+
CentinelAuthenticateController.cancel();
|
53 |
+
}
|
54 |
+
//]]>
|
55 |
+
</script>
|
56 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/centinel/authentication/complete.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php if ($this->getIsProcessed()):?>
|
28 |
+
<?php if ($this->getIsSuccess()):?>
|
29 |
+
<script type="text/javascript">
|
30 |
+
//<![CDATA[
|
31 |
+
window.parent.CentinelAuthenticateController.success();
|
32 |
+
//]]>
|
33 |
+
</script>
|
34 |
+
<?php else:?>
|
35 |
+
<h4><?php echo $this->__('Verification Failed');?></h4>
|
36 |
+
<p><?php echo $this->__('The card has failed verification with the issuer bank.')?> <strong><?php echo $this->__('Order cannot be placed.')?></strong></p>
|
37 |
+
<?php endif;?>
|
38 |
+
<?php else:?>
|
39 |
+
<h4><?php echo $this->__('Verification cannot be processed');?></h4>
|
40 |
+
<p><?php echo $this->__('There has been wrong payment information submitted or the time limit has expired. Please, try again.')?> <strong><?php echo $this->__('Order cannot be placed.')?></strong></p>
|
41 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/centinel/authentication/start.phtml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<form name="validation_form" id="validation_form" action="<?php echo $this->getAcsUrl();?>" method="post">
|
28 |
+
<fieldset>
|
29 |
+
<input type="hidden" name="PaReq" value="<?php echo $this->getPaReq()?>" />
|
30 |
+
<input type="hidden" name="TermUrl" value="<?php echo $this->getTermUrl()?>" />
|
31 |
+
<input type="hidden" name="MD" value="<?php echo $this->getMd()?>" />
|
32 |
+
</fieldset>
|
33 |
+
</form>
|
34 |
+
<script type="text/javascript">
|
35 |
+
//<![CDATA[
|
36 |
+
window.onload = function(){
|
37 |
+
document.getElementById('validation_form').submit();
|
38 |
+
};
|
39 |
+
//]]>
|
40 |
+
</script>
|
app/design/frontend/base/default/template/centinel/logo.phtml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<li class="centinel-logos" id="<?php echo $this->getCode() ?>_centinel_logo">
|
28 |
+
<label><?php echo $this->__('To ensure the security of your transactions') ?></label>
|
29 |
+
<div class="input-box">
|
30 |
+
<a href="#" title="<?php echo $this->__('Verified by Visa') ?> "onclick="popWin('<?php echo $this->helper('centinel')->getVisaLearnMorePageUrl()?>', 'verifiedByVisa', 'width=815,height=600,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;"><img src="<?php echo $this->getSkinUrl('images/centinel/vbv_ltbg_71x57.gif'); ?>" alt="<?php echo $this->__('Verified by Visa') ?>" /></a>
|
31 |
+
<a href="#" title="<?php echo $this->__('MasterCard SecureCode'); ?>" onclick="popWin('<?php echo $this->helper('centinel')->getMastercardLearnMorePageUrl()?>', 'secureCode', 'width=600,height=403,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;"><img src="<?php echo $this->getSkinUrl('images/centinel/sc_learn_62x34.gif'); ?>" alt="<?php echo $this->__('MasterCard SecureCode') ?>" /></a>
|
32 |
+
</div>
|
33 |
+
</li>
|
app/etc/modules/Mage_Centinel.xml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Centinel
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Mage_Centinel>
|
31 |
+
<active>true</active>
|
32 |
+
<codePool>core</codePool>
|
33 |
+
<depends>
|
34 |
+
<Mage_Payment/>
|
35 |
+
<Mage_Checkout/>
|
36 |
+
</depends>
|
37 |
+
</Mage_Centinel>
|
38 |
+
</modules>
|
39 |
+
</config>
|
app/locale/en_US/Mage_Centinel.csv
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"3D Secure CAVV","3D Secure CAVV"
|
2 |
+
"3D Secure Card Validation","3D Secure Card Validation"
|
3 |
+
"3D Secure Cardholder Validation","3D Secure Cardholder Validation"
|
4 |
+
"3D Secure Electronic Commerce Indicator","3D Secure Electronic Commerce Indicator"
|
5 |
+
"3D Secure Verification Result","3D Secure Verification Result"
|
6 |
+
"3D Secure XID","3D Secure XID"
|
7 |
+
"Card Issuer Liability","Card Issuer Liability"
|
8 |
+
"Card Verification","Card Verification"
|
9 |
+
"Enrolled","Enrolled"
|
10 |
+
"Enrolled but Authentication Unavailable","Enrolled but Authentication Unavailable"
|
11 |
+
"Failed","Failed"
|
12 |
+
"MasterCard SecureCode","MasterCard SecureCode"
|
13 |
+
"Merchant Liability","Merchant Liability"
|
14 |
+
"Not Enrolled","Not Enrolled"
|
15 |
+
"Order cannot be placed.","Order cannot be placed."
|
16 |
+
"Payment information error. Please start over.","Payment information error. Please start over."
|
17 |
+
"Please continue with placing order.","Please continue with placing order."
|
18 |
+
"Please verify the card with the issuer bank before placing the order.","Please verify the card with the issuer bank before placing the order."
|
19 |
+
"Please verify the card with the issuer bank:","Please verify the card with the issuer bank:"
|
20 |
+
"Start/Reset Validation...","Start/Reset Validation..."
|
21 |
+
"Successful","Successful"
|
22 |
+
"Successful attempt","Successful attempt"
|
23 |
+
"The card has failed verification with the issuer bank.","The card has failed verification with the issuer bank."
|
24 |
+
"There has been wrong payment information submitted or the time limit has expired. Please, try again.","There has been wrong payment information submitted or the time limit has expired. Please, try again."
|
25 |
+
"There has been wrong payment information submitted or time limit has expired. Please, try again.","There has been wrong payment information submitted or time limit has expired. Please, try again."
|
26 |
+
"This card has failed validation and cannot be used.","This card has failed validation and cannot be used."
|
27 |
+
"This card has failed validation, but it is possible to place the order.","This card has failed validation, but it is possible to place the order."
|
28 |
+
"To ensure the security of your transactions","To ensure the security of your transactions"
|
29 |
+
"Unable to complete","Unable to complete"
|
30 |
+
"Validation failed.","Validation failed."
|
31 |
+
"Verification Failed","Verification Failed"
|
32 |
+
"Verification Successful","Verification Successful"
|
33 |
+
"Verification cannot be processed","Verification cannot be processed"
|
34 |
+
"Verified by Visa","Verified by Visa"
|
js/mage/adminhtml/sales/centinel.js
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Magento
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/afl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
+
*
|
20 |
+
* @category Mage
|
21 |
+
* @package Mage_Adminhtml
|
22 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
var centinelValidator = new Class.create();
|
26 |
+
centinelValidator.prototype = {
|
27 |
+
|
28 |
+
initialize : function(method, validationUrl, containerId){
|
29 |
+
this.method = method;
|
30 |
+
this.validationUrl = validationUrl;
|
31 |
+
this.containerId = containerId;
|
32 |
+
},
|
33 |
+
|
34 |
+
validate : function(){
|
35 |
+
if (order.paymentMethod != this.method) {
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
var params = order.getPaymentData();
|
39 |
+
params = order.prepareParams(params);
|
40 |
+
params.json = true;
|
41 |
+
|
42 |
+
new Ajax.Request(this.validationUrl, {
|
43 |
+
parameters:params,
|
44 |
+
method:'post',
|
45 |
+
onSuccess: function(transport) {
|
46 |
+
var response = transport.responseText.evalJSON();
|
47 |
+
if (response.authenticationUrl) {
|
48 |
+
this.autenticationStart(response.authenticationUrl);
|
49 |
+
}
|
50 |
+
if (response.message) {
|
51 |
+
this.autenticationFinish(response.message);
|
52 |
+
}
|
53 |
+
}.bind(this)
|
54 |
+
});
|
55 |
+
},
|
56 |
+
|
57 |
+
autenticationStart : function(url) {
|
58 |
+
this.getContainer().src = url;
|
59 |
+
this.getContainer().style.display = 'block';
|
60 |
+
},
|
61 |
+
|
62 |
+
autenticationFinish : function(message) {
|
63 |
+
alert(message);
|
64 |
+
this.getContainer().style.display = 'none';
|
65 |
+
},
|
66 |
+
|
67 |
+
getContainer : function() {
|
68 |
+
return $(this.containerId);
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
lib/3Dsecure/CentinelClient.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Distributed by license from CardinalCommerce Corporation
|
3 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
4 |
+
// CardinalCommerce (http://www.cardinalcommerce.com)
|
5 |
+
// CentinelClient.php
|
6 |
+
// Version 1.2 02/17/2005
|
7 |
+
//
|
8 |
+
// Usage
|
9 |
+
// The CentinelClient class is defined to assist integration efforts with the Centinel
|
10 |
+
// XML message integration. The class implements helper methods to construct, send, and
|
11 |
+
// receive XML messages with respect to the Centinel XML Message APIs.
|
12 |
+
//
|
13 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
14 |
+
|
15 |
+
require("XMLParser.php");
|
16 |
+
include "CentinelErrors.php";
|
17 |
+
|
18 |
+
class CentinelClient {
|
19 |
+
|
20 |
+
var $request ;
|
21 |
+
var $response ;
|
22 |
+
var $parser;
|
23 |
+
|
24 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
25 |
+
// Function Add(name, value)
|
26 |
+
//
|
27 |
+
// Add name/value pairs to the Centinel request collection.
|
28 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
29 |
+
|
30 |
+
|
31 |
+
function add($name, $value) {
|
32 |
+
$this->request[$name] = $this->escapeXML($value);
|
33 |
+
}
|
34 |
+
|
35 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
36 |
+
// Function getValue(name)
|
37 |
+
//
|
38 |
+
// Retrieve a specific value for the give name within the Centinel response collection.
|
39 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
40 |
+
|
41 |
+
|
42 |
+
function getValue($name) {
|
43 |
+
if (isset($this->response[$name])) {
|
44 |
+
return $this->response[$name];
|
45 |
+
}else{
|
46 |
+
return "";
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
52 |
+
// Function getRequestXml(name)
|
53 |
+
//
|
54 |
+
// Serialize all elements of the request collection into a XML message, and format the required
|
55 |
+
// form payload according to the Centinel XML Message APIs. The form payload is returned from
|
56 |
+
// the function.
|
57 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
+
|
59 |
+
|
60 |
+
function getRequestXml(){
|
61 |
+
$queryString = "<CardinalMPI>";
|
62 |
+
foreach ($this->request as $name => $value) {
|
63 |
+
$queryString = $queryString."<".($name).">".($value)."</".($name).">" ;
|
64 |
+
}
|
65 |
+
$queryString = $queryString."</CardinalMPI>";
|
66 |
+
return "cmpi_msg=".urlencode($queryString);
|
67 |
+
}
|
68 |
+
|
69 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
70 |
+
// Function sendHttp(url, "", $timeout)
|
71 |
+
//
|
72 |
+
// HTTP POST the form payload to the url using cURL.
|
73 |
+
// form payload according to the Centinel XML Message APIs. The form payload is returned from
|
74 |
+
// the function.
|
75 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
76 |
+
|
77 |
+
function sendHttp($url, $connectTimeout="", $timeout) {
|
78 |
+
|
79 |
+
// verify that the URL uses a supported protocol.
|
80 |
+
|
81 |
+
if( (strpos($url, "http://")=== 0) || (strpos($url, "https://")=== 0) ) {
|
82 |
+
|
83 |
+
//Construct the payload to POST to the url.
|
84 |
+
|
85 |
+
$data = $this->getRequestXml();
|
86 |
+
// create a new cURL resource
|
87 |
+
|
88 |
+
$ch = curl_init($url);
|
89 |
+
|
90 |
+
// set URL and other appropriate options
|
91 |
+
curl_setopt($ch, CURLOPT_POST,1);
|
92 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
93 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
94 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
95 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
96 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
97 |
+
|
98 |
+
// Execute the request.
|
99 |
+
|
100 |
+
$result = curl_exec($ch);
|
101 |
+
$succeeded = curl_errno($ch) == 0 ? true : false;
|
102 |
+
|
103 |
+
// close cURL resource, and free up system resources
|
104 |
+
|
105 |
+
curl_close($ch);
|
106 |
+
|
107 |
+
// If Communication was not successful set error result, otherwise
|
108 |
+
|
109 |
+
if(!$succeeded) {
|
110 |
+
|
111 |
+
$result = $this->setErrorResponse(CENTINEL_ERROR_CODE_8030, CENTINEL_ERROR_CODE_8030_DESC);
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
// Assert that we received an expected Centinel Message in reponse.
|
116 |
+
|
117 |
+
if (strpos($result, "<CardinalMPI>") === false) {
|
118 |
+
$result = $this->setErrorResponse(CENTINEL_ERROR_CODE_8010, CENTINEL_ERROR_CODE_8010_DESC);
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
} else {
|
123 |
+
$result = $this->setErrorResponse(CENTINEL_ERROR_CODE_8000, CENTINEL_ERROR_CODE_8000_DESC);
|
124 |
+
}
|
125 |
+
$parser = new XMLParser;
|
126 |
+
$parser->deserializeXml($result);
|
127 |
+
$this->response = $parser->deserializedResponse;
|
128 |
+
}
|
129 |
+
|
130 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
131 |
+
// Function setErrorResponse(errorNo, errorDesc)
|
132 |
+
//
|
133 |
+
// Initialize an Error response to ensure that parsing will be handled properly.
|
134 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
135 |
+
|
136 |
+
function setErrorResponse($errorNo, $errorDesc) {
|
137 |
+
|
138 |
+
$resultText = "<CardinalMPI>";
|
139 |
+
$resultText = $resultText."<ErrorNo>".($errorNo)."</ErrorNo>" ;
|
140 |
+
$resultText = $resultText."<ErrorDesc>".($errorDesc)."</ErrorDesc>" ;
|
141 |
+
$resultText = $resultText."</CardinalMPI>";
|
142 |
+
|
143 |
+
return $resultText;
|
144 |
+
}
|
145 |
+
|
146 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
147 |
+
// Function escapeXML(value)
|
148 |
+
//
|
149 |
+
// Escaped string converting all '&' to '&' and all '<' to '<'. Return the escaped value.
|
150 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
151 |
+
|
152 |
+
function escapeXML($elementValue){
|
153 |
+
|
154 |
+
$escapedValue = str_replace("&", "&", $elementValue);
|
155 |
+
$escapedValue = str_replace("<", "<", $escapedValue);
|
156 |
+
|
157 |
+
return $escapedValue;
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
}
|
lib/3Dsecure/CentinelErrors.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Distributed by license from CardinalCommerce Corporation
|
3 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
4 |
+
// CardinalCommerce (http://www.cardinalcommerce.com)
|
5 |
+
// CentinelErrors.php
|
6 |
+
// Version 1.2 02/17/2005
|
7 |
+
//
|
8 |
+
// Usage
|
9 |
+
// The Error Numbers and Descriptions are centralized and referenced by the CentinelClient.php.
|
10 |
+
//
|
11 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
12 |
+
|
13 |
+
define("CENTINEL_ERROR_CODE_8000", "8000");
|
14 |
+
define("CENTINEL_ERROR_CODE_8000_DESC", "Protocol Not Recogonized, must be http:// or https://");
|
15 |
+
define("CENTINEL_ERROR_CODE_8010", "8010");
|
16 |
+
define("CENTINEL_ERROR_CODE_8010_DESC", "Unable to Communicate with MAPS Server");
|
17 |
+
define("CENTINEL_ERROR_CODE_8020", "8020");
|
18 |
+
define("CENTINEL_ERROR_CODE_8020_DESC", "Error Parsing XML Response");
|
19 |
+
define("CENTINEL_ERROR_CODE_8030", "8030");
|
20 |
+
define("CENTINEL_ERROR_CODE_8030_DESC", "Communication Timeout Encountered");
|
lib/3Dsecure/XMLParser.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Distributed by license from CardinalCommerce Corporation
|
3 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
4 |
+
// CardinalCommerce (http://www.cardinalcommerce.com)
|
5 |
+
// XMLParser.php
|
6 |
+
// Version 1.2 02/17/2005
|
7 |
+
//
|
8 |
+
// Usage
|
9 |
+
// XML Parser class to assist with the parsing of the XML messages received from the MAPS
|
10 |
+
// Server. Wraps core PHP XML functions.
|
11 |
+
//
|
12 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
13 |
+
|
14 |
+
class XMLParser{
|
15 |
+
|
16 |
+
var $xml_parser;
|
17 |
+
var $deseralizedResponse;
|
18 |
+
var $elementName;
|
19 |
+
var $elementValue;
|
20 |
+
|
21 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
22 |
+
// Function XMLParser()
|
23 |
+
//
|
24 |
+
// Initialize the XML parser.
|
25 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
26 |
+
|
27 |
+
function XMLParser() {
|
28 |
+
$this->xml_parser = xml_parser_create();
|
29 |
+
}
|
30 |
+
|
31 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
32 |
+
// Function startElement(parser, name, attribute)
|
33 |
+
//
|
34 |
+
// Start Tag Element Handler
|
35 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
36 |
+
|
37 |
+
function startElement($parser, $name, $attrs='') {
|
38 |
+
$this->elementName= $name;
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
43 |
+
// Function elementData(parser, data)
|
44 |
+
//
|
45 |
+
// Element Data Handler
|
46 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
47 |
+
|
48 |
+
function elementData($parser, $data) {
|
49 |
+
$this->elementValue .= $data;
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
54 |
+
// Function endElement(name, value)
|
55 |
+
//
|
56 |
+
// End Tag Element Handler
|
57 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
+
|
59 |
+
function endElement($parser, $name) {
|
60 |
+
|
61 |
+
$this->deserializedResponse[$this->elementName]= $this->elementValue;
|
62 |
+
$this->elementName = "";
|
63 |
+
$this->elementValue = "";
|
64 |
+
}
|
65 |
+
|
66 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
67 |
+
// Function deserialize(xmlString)
|
68 |
+
//
|
69 |
+
// Deserilize the XML reponse message and add each element to the deseralizedResponse collection.
|
70 |
+
// Once complete, then each element reference will be available using the getValue function.
|
71 |
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
72 |
+
|
73 |
+
function deserializeXml($responseString) {
|
74 |
+
|
75 |
+
xml_set_object($this->xml_parser, $this);
|
76 |
+
xml_parser_set_option($this->xml_parser,XML_OPTION_CASE_FOLDING,FALSE);
|
77 |
+
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
|
78 |
+
xml_set_character_data_handler($this->xml_parser, "elementData");
|
79 |
+
|
80 |
+
if (!xml_parse($this->xml_parser, $responseString)) {
|
81 |
+
|
82 |
+
$this->deserializedResponse["ErrorNo"]= CENTINEL_ERROR_CODE_8020;
|
83 |
+
$this->deserializedResponse["ErrorDesc"]= CENTINEL_ERROR_CODE_8020_DESC;
|
84 |
+
}
|
85 |
+
|
86 |
+
xml_parser_free($this->xml_parser);
|
87 |
+
}
|
88 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Mage_Centinel</name>
|
4 |
+
<version>1.6.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>mixed</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>3D Secure Card Validation</summary>
|
10 |
+
<description>An integration with Cardinalcommerce Centinel service. Provides option to validate Visa and Mastercard cards for eliminating possible fraudlent order placement attempts. Adds information about Electronic Commerce Identifier, that designates liability for chargeback.</description>
|
11 |
+
<notes>1.6.0.0</notes>
|
12 |
+
<authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
|
13 |
+
<date>2011-08-18</date>
|
14 |
+
<time>08:29:38</time>
|
15 |
+
<contents><target name="magecore"><dir name="Mage"><dir name="Centinel"><dir name="Block"><dir name="Adminhtml"><dir name="Validation"><file name="Form.php" hash="5969cfba349777b9253bfecae3370113"/></dir><file name="Validation.php" hash="04e4120589eccbfbb09f5b5023bd8e74"/></dir><dir name="Authentication"><file name="Complete.php" hash="adb566e73f99faf64a44562b0f5e0919"/><file name="Start.php" hash="3364a5dd778b075e39ef12a7cd23ed9e"/></dir><file name="Authentication.php" hash="c81396472a61161c2b0acbcf8ad5a278"/><file name="Logo.php" hash="d768e0dc91ca5c295ffe6eabcf642b6b"/></dir><dir name="Helper"><file name="Data.php" hash="414eef6e6794ac0ceb6670d60358f35e"/></dir><dir name="Model"><file name="Api.php" hash="774ee515cc3096099116e27037810a36"/><file name="Config.php" hash="0473452d844e7aa3daf080eae0dec48a"/><file name="Observer.php" hash="a0a55f4a506585e8c403a20eb80d7241"/><file name="Service.php" hash="0518bf6e10f2d1e301d3834f754a4e31"/><file name="Session.php" hash="5d3f1243bc95cb06ae91d0d83ef62694"/><dir name="State"><file name="Jcb.php" hash="eb0a68d30393c785732bdcb3e0ea33c5"/><file name="Mastercard.php" hash="4593196699a773f59c7822bab66af15c"/><file name="Visa.php" hash="b93afe18519025391136a01c9c3fedd0"/></dir><file name="StateAbstract.php" hash="daf4415d9ede3620d909fcae0bdb0922"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Centinel"><file name="IndexController.php" hash="47c5e51e789b8feca1f25afabd265962"/></dir></dir><file name="IndexController.php" hash="202488d8f1d9dede4ca512e8265ecfd2"/></dir><dir name="etc"><file name="config.xml" hash="12da2b0693ce9163fba8180fd247f036"/><file name="system.xml" hash="6017f211b38e8fed567b22b4c48926a6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Centinel.xml" hash="22655563fa113c4348a4b67184d32b28"/></dir></target><target name="mageweb"><dir name="js"><dir name="mage"><dir name="adminhtml"><dir name="sales"><file name="centinel.js" hash="daa341d3d631c79d613a31b0802230ff"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="centinel"><dir name="authentication"><file name="complete.phtml" hash="bbb3e0db33b0037cdfba441d6125de10"/><file name="start.phtml" hash="8b4c2412604921d1e2df76ef539b5254"/></dir><dir name="validation"><file name="form.phtml" hash="f88bbe9992f8a73b9736ef68adce1b51"/></dir></dir></dir><dir name="layout"><file name="centinel.xml" hash="f2635bda3aae3dd8ff53dfa7e2eec31f"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="centinel"><dir name="authentication"><file name="complete.phtml" hash="9abcd3882f259af826ad9597c02851ad"/><file name="start.phtml" hash="353971733cab13381cee156335e17fd1"/></dir><file name="authentication.phtml" hash="5533fadcf12d7729a1e20216a99eb276"/><file name="logo.phtml" hash="73595732172cdd045184471bc814bdfe"/></dir></dir><dir name="layout"><file name="centinel.xml" hash="14fa87992f1ee60266125230f75a5c3e"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_Centinel.csv" hash="638d517f5f2f2e5801b07a45fab9130b"/></dir></target><target name="magelib"><dir name="3Dsecure"><file name="CentinelClient.php" hash="e8459bd7d542e38058529e9bbb27ca25"/><file name="CentinelErrors.php" hash="e99aa9e865cc56beb2cf99d616ff0ceb"/><file name="XMLParser.php" hash="d089f3a81ac81378c889eee73a52f413"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="centinel"><file name="sc_learn_62x34.gif" hash="059ec6c3eecea97b3f70a2e2d6ceb911"/><file name="v_activate_steps.gif" hash="005312b14c6aed41e8a47c4acaac7c1a"/><file name="vbv_ltbg_71x57.gif" hash="2b0bcd07251fcaafd46e7ce77ba821a9"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.6.1.0</max></package></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/base/default/images/centinel/sc_learn_62x34.gif
ADDED
Binary file
|
skin/frontend/base/default/images/centinel/v_activate_steps.gif
ADDED
Binary file
|
skin/frontend/base/default/images/centinel/vbv_ltbg_71x57.gif
ADDED
Binary file
|