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) 2012 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: }
182: