Datacash - Version 1.0.1

Version Notes

Initial version for Magento Connect based on pre-launch version 0.1.15.

Download this release

Release Info

Developer DataCash
Extension Datacash
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

Files changed (66) hide show
  1. app/code/community/DataCash/Dpg/Block/Adminhtml/System/Config/Fieldset/Hint.php +54 -0
  2. app/code/community/DataCash/Dpg/Block/Form/Api.php +56 -0
  3. app/code/community/DataCash/Dpg/Block/Form/Apiprereg.php +83 -0
  4. app/code/community/DataCash/Dpg/Block/Form/Hcc.php +15 -0
  5. app/code/community/DataCash/Dpg/Block/Form/Hps.php +9 -0
  6. app/code/community/DataCash/Dpg/Block/Form/Iframe.php +34 -0
  7. app/code/community/DataCash/Dpg/Block/Form/Placeform.php +77 -0
  8. app/code/community/DataCash/Dpg/Block/Iframe/Complete.php +75 -0
  9. app/code/community/DataCash/Dpg/Block/Iframe/Start.php +59 -0
  10. app/code/community/DataCash/Dpg/Block/Info/Api.php +42 -0
  11. app/code/community/DataCash/Dpg/Block/Info/Hcc.php +46 -0
  12. app/code/community/DataCash/Dpg/Block/Info/Hps.php +46 -0
  13. app/code/community/DataCash/Dpg/Controller/Abstract.php +50 -0
  14. app/code/community/DataCash/Dpg/Helper/Data.php +101 -0
  15. app/code/community/DataCash/Dpg/Model/Api/Abstract.php +479 -0
  16. app/code/community/DataCash/Dpg/Model/Api/Direct.php +141 -0
  17. app/code/community/DataCash/Dpg/Model/Api/Directprereg.php +87 -0
  18. app/code/community/DataCash/Dpg/Model/Api/Hcc.php +191 -0
  19. app/code/community/DataCash/Dpg/Model/Api/Hps.php +103 -0
  20. app/code/community/DataCash/Dpg/Model/Code.php +58 -0
  21. app/code/community/DataCash/Dpg/Model/Config.php +283 -0
  22. app/code/community/DataCash/Dpg/Model/Datacash/Request.php +1095 -0
  23. app/code/community/DataCash/Dpg/Model/Datacash/Response.php +135 -0
  24. app/code/community/DataCash/Dpg/Model/Dpg.php +34 -0
  25. app/code/community/DataCash/Dpg/Model/Entity/Setup.php +34 -0
  26. app/code/community/DataCash/Dpg/Model/Method/Abstract.php +497 -0
  27. app/code/community/DataCash/Dpg/Model/Method/Api.php +403 -0
  28. app/code/community/DataCash/Dpg/Model/Method/Apiprereg.php +201 -0
  29. app/code/community/DataCash/Dpg/Model/Method/Hcc.php +237 -0
  30. app/code/community/DataCash/Dpg/Model/Method/Hosted/Abstract.php +125 -0
  31. app/code/community/DataCash/Dpg/Model/Method/Hosted/Interface.php +46 -0
  32. app/code/community/DataCash/Dpg/Model/Method/Hps.php +384 -0
  33. app/code/community/DataCash/Dpg/Model/Observer.php +178 -0
  34. app/code/community/DataCash/Dpg/Model/Service.php +180 -0
  35. app/code/community/DataCash/Dpg/Model/Service/Abstract.php +243 -0
  36. app/code/community/DataCash/Dpg/Model/Service/Direct.php +68 -0
  37. app/code/community/DataCash/Dpg/Model/Service/Directprereg.php +110 -0
  38. app/code/community/DataCash/Dpg/Model/Service/Hcc.php +163 -0
  39. app/code/community/DataCash/Dpg/Model/Service/State/Datacash.php +90 -0
  40. app/code/community/DataCash/Dpg/Model/Source/Acceptreject.php +48 -0
  41. app/code/community/DataCash/Dpg/Model/Source/Authtypes.php +48 -0
  42. app/code/community/DataCash/Dpg/Model/Source/Threedstypes.php +48 -0
  43. app/code/community/DataCash/Dpg/controllers/HccController.php +127 -0
  44. app/code/community/DataCash/Dpg/controllers/HostedController.php +73 -0
  45. app/code/community/DataCash/Dpg/controllers/HpsController.php +8 -0
  46. app/code/community/DataCash/Dpg/controllers/T3mController.php +87 -0
  47. app/code/community/DataCash/Dpg/etc/config.xml +185 -0
  48. app/code/community/DataCash/Dpg/etc/system.xml +1929 -0
  49. app/code/community/DataCash/Dpg/sql/datacash_dpg_setup/mysql4-install-0.1.0.php +32 -0
  50. app/design/adminhtml/default/default/template/datacash/hcc/info.phtml +46 -0
  51. app/design/adminhtml/default/default/template/datacash/hps/info.phtml +46 -0
  52. app/design/adminhtml/default/default/template/datacash/system/config/fieldset/hint.phtml +38 -0
  53. app/design/frontend/base/default/layout/datacash.xml +25 -0
  54. app/design/frontend/base/default/template/datacash/form/cc.phtml +151 -0
  55. app/design/frontend/base/default/template/datacash/form/cc.phtml.backup +138 -0
  56. app/design/frontend/base/default/template/datacash/form/cc_prereg.phtml +77 -0
  57. app/design/frontend/base/default/template/datacash/hcc/form.phtml +4 -0
  58. app/design/frontend/base/default/template/datacash/hcc/info.phtml +48 -0
  59. app/design/frontend/base/default/template/datacash/hcc/placeform.phtml +15 -0
  60. app/design/frontend/base/default/template/datacash/hps/form.phtml +4 -0
  61. app/design/frontend/base/default/template/datacash/hps/info.phtml +48 -0
  62. app/design/frontend/base/default/template/datacash/iframe/complete.phtml +46 -0
  63. app/design/frontend/base/default/template/datacash/iframe/form.phtml +46 -0
  64. app/design/frontend/base/default/template/datacash/iframe/start.phtml +46 -0
  65. app/etc/modules/DataCash_Payment.xml +14 -0
  66. package.xml +21 -0
app/code/community/DataCash/Dpg/Block/Adminhtml/System/Config/Fieldset/Hint.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Adminhtml_System_Config_Fieldset_Hint
31
+ *
32
+ * Fieldset Hint block used to render the hint within the admin system configuration screens
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Block
36
+ * @author Alistair Stead
37
+ */
38
+ class DataCash_Dpg_Block_Adminhtml_System_Config_Fieldset_Hint
39
+ extends Mage_Adminhtml_Block_Abstract
40
+ implements Varien_Data_Form_Element_Renderer_Interface
41
+ {
42
+ protected $_template = 'datacash/system/config/fieldset/hint.phtml';
43
+
44
+ /**
45
+ * Render fieldset html
46
+ *
47
+ * @param Varien_Data_Form_Element_Abstract $element
48
+ * @return string
49
+ */
50
+ public function render(Varien_Data_Form_Element_Abstract $element)
51
+ {
52
+ return $this->toHtml();
53
+ }
54
+ }
app/code/community/DataCash/Dpg/Block/Form/Api.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Form_Api
31
+ *
32
+ * Form block that displays the credit card data entry form for Direct API payments
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Block
36
+ * @author Alistair Stead
37
+ */
38
+ class DataCash_Dpg_Block_Form_Api extends Mage_Payment_Block_Form_Cc
39
+ {
40
+ public function __construct()
41
+ {
42
+ parent::__construct();
43
+ $this->setTemplate('datacash/form/cc.phtml');
44
+ }
45
+
46
+ /**
47
+ * Return datacash config instance
48
+ *
49
+ * @return DataCash_Dpg_Model_Config
50
+ */
51
+ public function getConfig()
52
+ {
53
+ return Mage::getSingleton('dpg/config');
54
+ }
55
+ }
56
+
app/code/community/DataCash/Dpg/Block/Form/Apiprereg.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Form_Apiprereg
31
+ *
32
+ * Form block that displays the credit card data entry form for Direct API payments that
33
+ * use pre-registered cards.
34
+ *
35
+ * @package DataCash
36
+ * @subpackage Block
37
+ * @author Alistair Stead
38
+ */
39
+ class DataCash_Dpg_Block_Form_Apiprereg extends Mage_Payment_Block_Form_Cc
40
+ {
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->setTemplate('datacash/form/cc_prereg.phtml');
45
+ }
46
+
47
+ public function getExistingCardsForOrders($orders, $customerId)
48
+ {
49
+ $orders
50
+ ->addFieldToFilter('customer_id', $customerId)
51
+ ->addFieldToFilter('created_at', array('gt' => date('Y-m-d H:i:s', time() - 9450000)));
52
+ // 385 days ago. Ignore orders older than this.
53
+
54
+ $payments = array();
55
+ foreach ($orders as $o) {
56
+ $p = $o->getPayment();
57
+ if ($p->getCcTransId() && $p->getCcLast4()) {
58
+ $payments[] = $p;
59
+ }
60
+ }
61
+
62
+ return $payments;
63
+ }
64
+
65
+ public function getExistingCards()
66
+ {
67
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
68
+ $payments = $this->getExistingCardsForOrders(Mage::getResourceModel('sales/order_collection'), $customerId);
69
+
70
+ return $payments;
71
+ }
72
+
73
+ /**
74
+ * Return datacash config instance
75
+ *
76
+ * @return DataCash_Dpg_Model_Config
77
+ */
78
+ public function getConfig()
79
+ {
80
+ return Mage::getSingleton('dpg/config');
81
+ }
82
+ }
83
+
app/code/community/DataCash/Dpg/Block/Form/Hcc.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DataCash_Dpg_Block_Form_Hcc extends Mage_Payment_Block_Form
4
+ {
5
+
6
+ /**
7
+ * Varien constructor
8
+ */
9
+ protected function _construct()
10
+ {
11
+ $this->setTemplate('datacash/hcc/form.phtml');
12
+ parent::_construct();
13
+ }
14
+
15
+ }
app/code/community/DataCash/Dpg/Block/Form/Hps.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DataCash_Dpg_Block_Form_Hps extends Mage_Payment_Block_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('datacash/hps/form.phtml');
8
+ }
9
+ }
app/code/community/DataCash/Dpg/Block/Form/Iframe.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DataCash_Dpg_Block_Form_Iframe extends Mage_Payment_Block_Form
4
+ {
5
+
6
+ /**
7
+ * Varien constructor
8
+ */
9
+ protected function _construct()
10
+ {
11
+ $this->setTemplate('datacash/iframe/form.phtml');
12
+ parent::_construct();
13
+ }
14
+
15
+ public function getFrameUrl()
16
+ {
17
+ switch ($method = $this->getMethodCode()) {
18
+ case 'datacash_hcc':
19
+ $method = 'hcc';
20
+ break;
21
+ case 'datacash_hps':
22
+ $method = 'hps';
23
+ break;
24
+ default;
25
+ Mage::throwException('Method "'.$method.'" not supported by DataCash iframe');
26
+ }
27
+ return Mage::getUrl('checkout/hosted/start', array('_secure' => true, 'method' => $method));
28
+ }
29
+
30
+ public function getAuthenticationStart()
31
+ {
32
+ return true;
33
+ }
34
+ }
app/code/community/DataCash/Dpg/Block/Form/Placeform.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Datacash_Dpg_Block_Form_Placeform extends Mage_Core_Block_Template
5
+ {
6
+
7
+
8
+ /**
9
+ * Get checkout session namespace
10
+ *
11
+ * @return Mage_Checkout_Model_Session
12
+ */
13
+ public function getCheckout()
14
+ {
15
+ return Mage::getSingleton('checkout/session');
16
+ }
17
+
18
+ /**
19
+ * Datacash HCC payment APi instance
20
+ *
21
+ * @return DataCash_Dpg_Model_Api_Hcc
22
+ * @author Hilary Boyce
23
+ */
24
+ protected function _getApi()
25
+ {
26
+ $api = Mage::getSingleton('dpg/api_hcc');
27
+ var_dump("In placeform", $api);
28
+ return $api;
29
+ }
30
+
31
+ /**
32
+ * Return order instance with loaded information by increment id
33
+ *
34
+ * @return Mage_Sales_Model_Order
35
+ */
36
+ protected function _getOrder()
37
+ {
38
+ if ($this->getOrder()) {
39
+ $order = $this->getOrder();
40
+ } else if ($this->getCheckout()->getLastRealOrderId()) {
41
+ $order = Mage::getModel('sales/order')->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
42
+ } else {
43
+ return null;
44
+ }
45
+ return $order;
46
+ }
47
+
48
+ /**
49
+ * Return payment instance
50
+ * @param Mage_Sales_Model_Order
51
+ *
52
+ */
53
+ protected function _getPayment($order)
54
+ {
55
+ return $order->getPayment();
56
+ }
57
+
58
+ /**
59
+ * Get getHpsSessionId for form by using Hcc payment api
60
+ *
61
+ * @return string
62
+ */
63
+ public function getHpsSessionId()
64
+ {
65
+ return $this->_getPayment($this->_getOrder())->getMethodInstance()->getInfoInstance()->getAdditionalInformation('SessionId');
66
+ }
67
+
68
+ /**
69
+ * Getting gateway url
70
+ *
71
+ * @return string
72
+ */
73
+ public function getHpsUrl()
74
+ {
75
+ return $this->_getPayment($this->_getOrder())->getMethodInstance()->getInfoInstance()->getAdditionalInformation('HpsUrl');
76
+ }
77
+ }
app/code/community/DataCash/Dpg/Block/Iframe/Complete.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Iframe_Complete
31
+ *
32
+ * Iframe complete page Block rendered for the hosted payment types
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Block
36
+ * @author Alistair Stead
37
+ */
38
+ class DataCash_Dpg_Block_Iframe_Complete extends Mage_Core_Block_Template
39
+ {
40
+ /**
41
+ * Get the quote for the current session
42
+ *
43
+ * @return Mage_Sales_Model_Quote
44
+ */
45
+ protected function _getQuote()
46
+ {
47
+ return Mage::getSingleton('checkout/session')->getQuote();
48
+ }
49
+
50
+ public function isSuccessful()
51
+ {
52
+ $quote = $this->_getQuote();
53
+ $messages = $quote->getMessages();
54
+
55
+ return !isset($messages['error']);
56
+ }
57
+
58
+ public function getError()
59
+ {
60
+ $quote = $this->_getQuote();
61
+ $messages = $quote->getMessages();
62
+
63
+ return $messages['error'];
64
+ }
65
+
66
+ /**
67
+ * Getting gateway url
68
+ *
69
+ * @return string
70
+ */
71
+ public function getFrameUrl()
72
+ {
73
+ return Mage::getUrl('checkout/hosted/start', array('_secure' => true, 'method' => $this->getRequest()->getParam('method')));
74
+ }
75
+ }
app/code/community/DataCash/Dpg/Block/Iframe/Start.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Iframe
31
+ *
32
+ * Iframe start page Block rendered for the hosted payment types
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Block
36
+ * @author Alistair Stead
37
+ */
38
+
39
+ class Datacash_Dpg_Block_Iframe_Start extends Mage_Core_Block_Template
40
+ {
41
+ protected function _toHtml()
42
+ {
43
+ $method = $this->getRequest()->getParam('method');
44
+ if (!in_array($method, array('hcc', 'hps'))) {
45
+ Mage::throwException('Method "' . $method . '" is not supported by iframe.');
46
+ }
47
+ $session = Mage::getSingleton('checkout/session');
48
+
49
+ $methodInfo = Mage::getModel('dpg/method_' . $this->getRequest()->getParam('method'));
50
+ $methodInfo->initSession($session->getQuote());
51
+ $session->getQuote()->save();
52
+ $dataCashSession = $session->getData('datacash_' .$method . '_session');
53
+
54
+ $this->setStartUrl($dataCashSession['HpsUrl']);
55
+ $this->setSessionId($dataCashSession['SessionId']);
56
+
57
+ return parent::_toHtml();
58
+ }
59
+ }
app/code/community/DataCash/Dpg/Block/Info/Api.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Info_Api
31
+ *
32
+ * Info Block displaying information about the payment details entered during checkout
33
+ * for the direct API method integration
34
+ *
35
+ * @package DataCash
36
+ * @subpackage Block
37
+ * @author Alistair Stead
38
+ */
39
+ class DataCash_Dpg_Block_Info_Api extends Mage_Payment_Block_Info_Cc
40
+ {
41
+
42
+ }
app/code/community/DataCash/Dpg/Block/Info/Hcc.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Info_Hcc
31
+ *
32
+ * Info Block displaying information about the payment details entered during checkout
33
+ * for the HCC payment method integration
34
+ *
35
+ * @package DataCash
36
+ * @subpackage Block
37
+ * @author Alistair Stead
38
+ */
39
+ class DataCash_Dpg_Block_Info_Hcc extends Mage_Payment_Block_Info
40
+ {
41
+ protected function _construct()
42
+ {
43
+ parent::_construct();
44
+ $this->setTemplate('datacash/hcc/info.phtml');
45
+ }
46
+ }
app/code/community/DataCash/Dpg/Block/Info/Hps.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Block_Info_Hps
31
+ *
32
+ * Info Block displaying information about the payment details entered during checkout
33
+ * for the HPS method integration
34
+ *
35
+ * @package DataCash
36
+ * @subpackage Block
37
+ * @author Alistair Stead
38
+ */
39
+ class DataCash_Dpg_Block_Info_Hps extends Mage_Payment_Block_Info
40
+ {
41
+ protected function _construct()
42
+ {
43
+ parent::_construct();
44
+ $this->setTemplate('datacash/hps/info.phtml');
45
+ }
46
+ }
app/code/community/DataCash/Dpg/Controller/Abstract.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Controller_Abstract
31
+ *
32
+ * Abstract Controller that all module controllers will extend
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Controller
36
+ * @author Alistair Stead
37
+ */
38
+ abstract class DataCash_Dpg_Controller_Abstract extends Mage_Core_Controller_Front_Action
39
+ {
40
+
41
+ /**
42
+ * Return datacash config instance
43
+ *
44
+ * @return DataCash_Dpg_Model_Config
45
+ */
46
+ public function getConfig()
47
+ {
48
+ return Mage::getSingleton('dpg/config');
49
+ }
50
+ }
app/code/community/DataCash/Dpg/Helper/Data.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_Helper_Data
31
+ *
32
+ * Helper class that provides a number of transformation functions for use within the module
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Helper
36
+ * @author Alistair Stead
37
+ */
38
+ class DataCash_Dpg_Helper_Data extends Mage_Core_Helper_Abstract
39
+ {
40
+
41
+ /**
42
+ * Return a label for the supplied key
43
+ *
44
+ * Used to transpose object data keys to correct UI labels and also add
45
+ * translation functionality
46
+ *
47
+ * @return string
48
+ * @author Alistair Stead
49
+ **/
50
+ public function getLabel($key)
51
+ {
52
+ $labels = array(
53
+ 'cc_avs_status' => 'CV2 Status',
54
+ 'cc_avs_address_result' => 'CV2 Address',
55
+ 'cc_avs_postcode_result' => 'CV2 Postcode',
56
+ 'cc_avs_cv2_result' => 'CV2 Number',
57
+ 'cc_trans_id' => 'DataCash Transaction Number',
58
+ 'cc_approval' => 'Auth Code',
59
+ 'cc_status' => 'Transaction Status Code',
60
+ 'cc_status_description' => 'Transaction Status',
61
+ 'mode' => 'DataCash Mode',
62
+ 't3m_score' => 'DataCash Fraud Services Score',
63
+ 't3m_recommendation' => 'DataCash Fraud Services Recommendation',
64
+ );
65
+
66
+ return (!empty($labels[$key]))? $this->__($labels[$key]) : $key;
67
+ }
68
+
69
+ /**
70
+ * Calculate the device type being used to access the website
71
+ *
72
+ * @param string $userAgent the request user_agent string
73
+ * @return int
74
+ * @author Alistair Stead
75
+ **/
76
+ public function getDeviceType($userAgent)
77
+ {
78
+ $mobileAgents = array(
79
+ "iPhone", // Apple iPhone
80
+ "iPod", // Apple iPod touch
81
+ "Android", // 1.5+ Android
82
+ "dream", // Pre 1.5 Android
83
+ "CUPCAKE", // 1.5+ Android
84
+ "blackberry", // Blackberry
85
+ "webOS", // Palm Pre Experimental
86
+ "incognito", // Other iPhone browser
87
+ "webmate", // Other iPhone browser
88
+ "s8000", // Samsung Dolphin browser
89
+ "bada" // Samsung Dolphin browser
90
+ );
91
+
92
+ foreach ($mobileAgents as $mobileAgent) {
93
+ if (strstr($mobileAgent, $userAgent)) {
94
+ return '1';
95
+ }
96
+ }
97
+
98
+ return '0';
99
+ }
100
+ }
101
+
app/code/community/DataCash/Dpg/Model/Api/Abstract.php ADDED
@@ -0,0 +1,479 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ abstract class DataCash_Dpg_Model_Api_Abstract extends Varien_Object
30
+ {
31
+ /**
32
+ * The internal member variable that will hold the client
33
+ *
34
+ * @var Zend_Http_Client
35
+ **/
36
+ protected $_client;
37
+
38
+ /**
39
+ * Internal member varaiable that will hold the request object
40
+ *
41
+ * @var DataCash_Dpg_Model_DataCash_Response
42
+ **/
43
+ protected $_response;
44
+
45
+ /**
46
+ * Internal member varaiable that will hold the request object
47
+ *
48
+ * @var Zend_Http_Response
49
+ **/
50
+ protected $_rawResponse;
51
+
52
+ /**
53
+ * Internal member varaiable that will hold the request object
54
+ *
55
+ * @var DataCash_Dpg_Model_DataCash_Request
56
+ **/
57
+ protected $_request;
58
+
59
+ /**
60
+ * Internal member variable that will hold the module config
61
+ *
62
+ * @var DataCash_Dpg_Model_Config
63
+ **/
64
+ protected $_config;
65
+
66
+ /**
67
+ * Fields that should be replaced in debug with '***'
68
+ *
69
+ * @var array
70
+ */
71
+ protected $_debugReplacePrivateDataKeys = array(
72
+ 'client',
73
+ 'password',
74
+ 'pan'
75
+ );
76
+
77
+ /**
78
+ * API endpoint getter
79
+ *
80
+ * @return string
81
+ */
82
+ public function getApiEndpoint()
83
+ {
84
+ return $this->getConfig()->getEndpoint($this->getMethod());
85
+
86
+ }
87
+
88
+ /**
89
+ * Return the method name
90
+ *
91
+ * @return string
92
+ * @author Alistair Stead
93
+ **/
94
+ abstract function getMethod();
95
+
96
+ /**
97
+ * Call the DataCash API to make a refund request
98
+ *
99
+ * @return void
100
+ * @author Alistair Stead
101
+ **/
102
+ public function callRefund()
103
+ {
104
+ $request = $this->getRequest()
105
+ ->addTransaction()
106
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency())
107
+ ->addCardTxn('refund', $this->getAuthCode());
108
+
109
+ $this->call($request);
110
+ }
111
+
112
+ /**
113
+ * Call the DataCash API to make an ERP request
114
+ *
115
+ * @return void
116
+ * @author Alistair Stead
117
+ **/
118
+ public function callErp()
119
+ {
120
+ $request = $this->getRequest()
121
+ ->addTransaction()
122
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency())
123
+ ->addCardTxn('erp');
124
+
125
+ $this->call($request);
126
+ }
127
+
128
+ /**
129
+ * Call the DataCash API to make a Cancel request
130
+ *
131
+ * @return void
132
+ * @author Alistair Stead
133
+ **/
134
+ public function callCancel()
135
+ {
136
+ $request = $this->getRequest()
137
+ ->addTransaction()
138
+ // ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency())
139
+ ->addHistoricTxn('cancel', $this->getDataCashReference(), $this->getAuthCode());
140
+
141
+ $this->call($request);
142
+ }
143
+
144
+ /**
145
+ * Call the DataCash API to make a fulfill request
146
+ *
147
+ * @return void
148
+ * @author Alistair Stead
149
+ **/
150
+ public function callFulfill()
151
+ {
152
+ $request = $this->getRequest()
153
+ ->addTransaction()
154
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency())
155
+ ->addHistoricTxn('fulfill', $this->getDataCashReference(), $this->getAuthCode());
156
+
157
+ $this->call($request);
158
+ }
159
+
160
+ /**
161
+ * Call the DataCash API to make a TXN Refund request
162
+ *
163
+ * @return void
164
+ * @author Alistair Stead
165
+ **/
166
+ public function callTxnRefund()
167
+ {
168
+ $request = $this->getRequest()
169
+ ->addTransaction()
170
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount())
171
+ ->addHistoricTxn('txn_refund', $this->getDataCashReference(), $this->getAuthCode());
172
+
173
+ $this->call($request);
174
+ }
175
+
176
+ /**
177
+ * Call the DataCash API to make a Authorise Referral request
178
+ *
179
+ * @return void
180
+ * @author Alistair Stead
181
+ **/
182
+ public function callAuthorizeReferralRequest()
183
+ {
184
+ $request = $this->getRequest()
185
+ ->addTransaction()
186
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency())
187
+ ->addHistoricTxn('authorize_referral_request', $this->getDataCashReference(), $this->getAuthCode());
188
+
189
+ $this->call($request);
190
+ }
191
+
192
+ /**
193
+ * If configured to include the CV2 information add the data to the request
194
+ *
195
+ * @return void
196
+ * @author Alistair Stead
197
+ **/
198
+ protected function _addCv2Avs()
199
+ {
200
+ if ($this->getIsUseCcv()) {
201
+ $request = $this->getRequest();
202
+ $billingAddress = $this->getBillingAddress();
203
+ if (!$billingAddress) {
204
+ throw new Exception('Billing address must be specified to addCv2Avs');
205
+ }
206
+ $request->addCv2Avs(
207
+ $billingAddress->getStreet(1),
208
+ $billingAddress->getStreet(2),
209
+ $billingAddress->getCity(),
210
+ $billingAddress->getRegionId(),
211
+ $billingAddress->getPostcode(),
212
+ $this->getCreditCardCvv2()
213
+ );
214
+ if ($this->getIsUseExtendedCv2()) {
215
+ $request->addCv2ExtendedPolicy($this->getCv2ExtendedPolicy());
216
+ }
217
+ }
218
+ }
219
+
220
+ /**
221
+ * If configured to include line items add them to the request
222
+ *
223
+ * @return void
224
+ * @author Alistair Stead
225
+ **/
226
+ protected function _addLineItems()
227
+ {
228
+ if ((bool) $this->getIsLineItemsEnabled()) {
229
+ $request = $this->getRequest();
230
+ $request->addLineItemDetail($this->getCustomerCode(), $this->getTransactionVat());
231
+ $request->addShipping($this->getShippingAmount(), $this->getShippingVatRate());
232
+ foreach ($this->getCartItems() as $item) {
233
+ // var_dump($item->getData());
234
+ // Evaluate the QTY value
235
+ $qty = ($item->getQtyOrdered() ? $item->getQtyOrdered() : ($item->getQty() ? $item->getQty() : 1));
236
+ $request->addItem(
237
+ $item->getName(),
238
+ 'unit',
239
+ $item->getOriginalPrice(),
240
+ $item->getTaxPercent(),
241
+ $qty,
242
+ $item->getRowTotalInclTax(),
243
+ $item->getSku(),
244
+ $item->getDiscountAmount(),
245
+ $item->getCommodityCode()
246
+ );
247
+ }
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Add The Third Man information to the request
253
+ *
254
+ * @return void
255
+ * @author Alistair Stead
256
+ **/
257
+ protected function _addT3m($vars)
258
+ {
259
+ if ($this->getConfig()->getIsAllowedT3m($this->getMethod())) {
260
+ $vars['callbackUrl'] = $this->getConfig()->getT3mCallBackUrl($this->getMethod());
261
+ $this->getRequest()->addThe3rdMan($vars);
262
+ }
263
+ }
264
+
265
+ /**
266
+ * Call the DataCash API to make a 3D auth request
267
+ *
268
+ * @return void
269
+ * @author Alistair Stead
270
+ **/
271
+ public function call3DValidAuth()
272
+ {
273
+ $request = $this->getRequest()
274
+ ->addTransaction()
275
+ ->addHistoricTxn('threedsecure_validate_authentication', $this->getDataCashReference(), null, '3d', $this->getParesMessage());
276
+
277
+ $this->call($request);
278
+ }
279
+
280
+
281
+ /**
282
+ * Add the 3D Secure information to the request if enabled
283
+ *
284
+ * @param boolean $mpi Send the verify node or not. The verify node causes problem with mpi requests.
285
+ * @return void
286
+ * @author Alistair Stead, Norbert Nagy
287
+ **/
288
+ protected function _add3DSecure($mpi = true)
289
+ {
290
+ $request = $this->getRequest();
291
+ $request->addThreeDSecure(
292
+ 'yes',
293
+ $this->getBaseUrl(),
294
+ $this->getPurchaseDescription(),
295
+ $this->getPurchaseDateTime(),
296
+ $this->getBrowserData(),
297
+ $mpi
298
+ );
299
+ }
300
+
301
+ /**
302
+ * Do the API call final call method that will submit the request
303
+ * to the DataCash service
304
+ *
305
+ * @param array $request
306
+ * @return DataCash_Dpg_Model_Api_Abstract
307
+ * @throws Mage_Core_Exception
308
+ * @author Alistair Stead
309
+ */
310
+ public function call($request)
311
+ {
312
+ // Debugging calls
313
+ $this->_debug(array('request' => $request->toArray()));
314
+
315
+ try {
316
+ // Build the HTTP client and set the request data
317
+ $client = $this->getClient();
318
+ $client->setUri($this->getApiEndpoint());
319
+ $client->setMethod(Zend_Http_Client::POST);
320
+ $client->setRawData($request->toXml(), 'text/xml');
321
+
322
+ // Make the HTTP request and set the raw response
323
+ $this->setRawResponse($client->request());
324
+
325
+ } catch (Exception $e) {
326
+ $debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
327
+ $this->_debug($debugData);
328
+
329
+ throw $e;
330
+ }
331
+
332
+ // Debugging calls
333
+ $this->_debug(array('response' => $this->getResponse()));
334
+
335
+ return $this;
336
+ }
337
+
338
+ /**
339
+ * Set the internal config object
340
+ *
341
+ * @param DataCash_Dpg_Model_Config $config
342
+ * @return void
343
+ * @author Alistair Stead
344
+ **/
345
+ public function setConfig(DataCash_Dpg_Model_Config $config)
346
+ {
347
+ $this->_config = $config;
348
+ }
349
+
350
+ /**
351
+ * Retreive the internal config object
352
+ *
353
+ * @return DataCash_Dpg_Model_Config
354
+ * @author Alistair Stead
355
+ **/
356
+ public function getConfig()
357
+ {
358
+ if (is_null($this->_config)) {
359
+ $this->_config = Mage::getSingleton('dpg/config');
360
+ }
361
+ return $this->_config;
362
+ }
363
+
364
+ /**
365
+ * Return the HTTP client used to communicate with the API gateway
366
+ *
367
+ * @return Zend_Http_Client
368
+ * @author Alistair Stead
369
+ **/
370
+ public function getClient()
371
+ {
372
+ if (is_null($this->_client)) {
373
+ $config = array(
374
+ 'adapter' => 'Zend_Http_Client_Adapter_Curl',
375
+ 'curloptions' => array(CURLOPT_FOLLOWLOCATION => true),
376
+ 'timeout' => 10,
377
+ 'maxredirects' => 5
378
+ );
379
+ $this->_client = new Zend_Http_Client('http://www.datacash.com', $config);
380
+ }
381
+ return $this->_client;
382
+ }
383
+
384
+ /**
385
+ * Set the internal http client
386
+ *
387
+ * @return void
388
+ * @author Alistair Stead
389
+ **/
390
+ public function setClient(Zend_Http_Client $client)
391
+ {
392
+ $this->_client = $client;
393
+ }
394
+
395
+ /**
396
+ * Retrieve the internal request object
397
+ *
398
+ * @return DataCash_Dpg_Model_DataCash_Request
399
+ * @author Alistair Stead
400
+ **/
401
+ public function getRequest()
402
+ {
403
+ if (is_null($this->_request)) {
404
+ $this->_request = Mage::getModel('dpg/datacash_request');
405
+ $this->_request->addAuthentication($this->getMerchantId(), $this->getMerchantPassword());
406
+ }
407
+ return $this->_request;
408
+ }
409
+
410
+ /**
411
+ * Set the internal request object
412
+ *
413
+ * @return void
414
+ * @author Alistair Stead
415
+ **/
416
+ public function setRequest(DataCash_Dpg_Model_DataCash_Request $request)
417
+ {
418
+ $this->_request = $request;
419
+ }
420
+
421
+ /**
422
+ * Retrieve the internal response
423
+ *
424
+ * The HTTP response transposed into the DataCash_Response that
425
+ * extends Varien_Object and provides the getData setData interface
426
+ *
427
+ * @return DataCash_Dpg_Model_DataCash_Response
428
+ * @author Alistair Stead
429
+ */
430
+ public function getResponse()
431
+ {
432
+ if (is_null($this->_response)) {
433
+ $this->_response = Mage::getModel('dpg/datacash_response');
434
+ }
435
+ return $this->_response;
436
+ }
437
+
438
+ /**
439
+ * Retrieve the original raw HTTP response
440
+ *
441
+ * @return Zend_Http_Response
442
+ * @author Alistair Stead
443
+ **/
444
+ public function getRawResponse()
445
+ {
446
+ return $this->_rawResponse;
447
+ }
448
+
449
+ /**
450
+ * Set the internal _rawResponse property
451
+ *
452
+ * @return void
453
+ * @author Alistair Stead
454
+ **/
455
+ public function setRawResponse(Zend_Http_Response $response)
456
+ {
457
+ $this->_rawResponse = $response;
458
+ $body = new Varien_Simplexml_Element($this->_rawResponse->getBody());
459
+ $this->getResponse()->addData($body->asArray());
460
+ }
461
+
462
+ /**
463
+ * Debugging method for the payment gateway
464
+ *
465
+ * This can allow debugging in the live system as all exceptions will
466
+ * be swallowed by Magento.
467
+ *
468
+ * @return void
469
+ * @author Alistair Stead
470
+ **/
471
+ protected function _debug(array $debugData)
472
+ {
473
+ if ($this->getConfig()->isMethodDebug($this->getMethod())) {
474
+ Mage::getModel('core/log_adapter', $this->getMethod() . '.log')
475
+ ->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
476
+ ->log($debugData);
477
+ }
478
+ }
479
+ }
app/code/community/DataCash/Dpg/Model/Api/Direct.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Api_Direct extends DataCash_Dpg_Model_Api_Abstract
30
+ {
31
+ /**
32
+ * Return the name of the method
33
+ *
34
+ * @return string
35
+ * @author Alistair Stead
36
+ **/
37
+ public function getMethod()
38
+ {
39
+ return 'datacash_api';
40
+ }
41
+
42
+ /**
43
+ * Call the DataCash API to make an authroization request
44
+ *
45
+ * @return void
46
+ * @author Alistair Stead
47
+ **/
48
+ public function callAuth()
49
+ {
50
+ $this->_makeRequest('auth');
51
+ Mage::dispatchEvent('datacash_dpg_model_api_direct_auth_response', array(
52
+ 'order_id' => $this->getOrderNumber(),
53
+ 'response' => $this->getResponse()));
54
+ }
55
+
56
+ /**
57
+ * Call the DataCash API to make a pre auth request
58
+ *
59
+ * @return void
60
+ * @author Alistair Stead
61
+ **/
62
+ public function callPre()
63
+ {
64
+ $this->_makeRequest('pre');
65
+ Mage::dispatchEvent('datacash_dpg_model_api_direct_pre_response', array('response' => $this->getResponse()));
66
+ }
67
+
68
+ /**
69
+ * Call the DataCash API to make a request of given transaction type.
70
+ *
71
+ * @param string $transactionMethod Transaction method to call.
72
+ * @return void
73
+ * @author Alistair Stead
74
+ **/
75
+ protected function _makeRequest($transactionMethod)
76
+ {
77
+ if (!in_array($transactionMethod, array('auth', 'pre'))) {
78
+ throw new Exception('Card transaction type not recognised');
79
+ }
80
+
81
+ $request = $this->getRequest()
82
+ ->addTransaction()
83
+ ->addCardTxn($transactionMethod)
84
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency(), 'ecomm');
85
+
86
+ if ($this->getMpiReference()) {
87
+ $request->addCardDetails($this->getMpiReference());
88
+ } else {
89
+ $cardRef = $this->getDataCashCardReference();
90
+ $request->addCard(
91
+ $this->getCreditCardNumber(),
92
+ $this->getCreditCardExpirationDate(),
93
+ $this->getMaestroSoloIssueDate(),
94
+ $this->getMaestroSoloIssueNumber()
95
+ );
96
+ }
97
+
98
+ $this->_addLineItems();
99
+ $this->_addCv2Avs();
100
+
101
+ $this->_addT3m(array(
102
+ 'previousOrders' => $this->getPreviousOrders(),
103
+ 'orderNumber' => $this->getOrderNumber(),
104
+ 'orderItems' => $this->getOrderItems(),
105
+ 'forename' => $this->getForename(),
106
+ 'surname' => $this->getSurname(),
107
+ 'email' => $this->getCustomerEmail(),
108
+ 'remoteIp' => $this->getRemoteIp(),
109
+ 'orderItems' => $this->getOrderItems(),
110
+ 'billingAddress' => $this->getBillingAddress(),
111
+ 'shippingAddress' => $this->getShippingAddress()
112
+ ));
113
+
114
+ $this->call($request);
115
+ }
116
+
117
+ /**
118
+ * Call the DataCash API to make an 3D Secure request
119
+ *
120
+ * @return void
121
+ * @author Alistair Stead
122
+ **/
123
+ public function call3DLookup()
124
+ {
125
+ $mpiMerchantReference = $this->getOrderNumber() . '-' . time();
126
+ $request = $this->getRequest()
127
+ ->addTransaction()
128
+ ->addTxnDetails($mpiMerchantReference, $this->getAmount(), $this->getCurrency(), 'ecomm')
129
+ ->addMpiTxn()
130
+ ->addMpiCard(
131
+ $this->getCreditCardNumber(),
132
+ $this->getCreditCardExpirationDate(),
133
+ $this->getMaestroSoloIssueDate(),
134
+ $this->getMaestroSoloIssueNumber()
135
+ );
136
+
137
+ $this->_add3DSecure();
138
+
139
+ $this->call($request);
140
+ }
141
+ }
app/code/community/DataCash/Dpg/Model/Api/Directprereg.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author David Marrs
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Api_Directprereg extends DataCash_Dpg_Model_Api_Direct
30
+ {
31
+ /**
32
+ * Return the name of the method
33
+ *
34
+ * @return string
35
+ * @author Alistair Stead
36
+ **/
37
+ public function getMethod()
38
+ {
39
+ return 'datacash_apiprereg';
40
+ }
41
+
42
+ /**
43
+ * Call the DataCash API to make a request of given transaction type.
44
+ *
45
+ * @param string $transactionMethod Transaction method to call.
46
+ * @return void
47
+ * @author Alistair Stead
48
+ **/
49
+ protected function _makeRequest($transactionMethod)
50
+ {
51
+ if (!in_array($transactionMethod, array('auth', 'pre'))) {
52
+ throw new Exception('Card transaction type not recognised');
53
+ }
54
+
55
+ $request = $this->getRequest()
56
+ ->addTransaction()
57
+ ->addCardTxn($transactionMethod)
58
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency(), 'ecomm');
59
+
60
+ if ($this->getMpiReference()) {
61
+ $request->addCardDetails($this->getMpiReference());
62
+ } else {
63
+ $cardRef = $this->getDataCashCardReference();
64
+ $request->addCardDetails($cardRef, 'preregistered');
65
+ }
66
+
67
+ $this->_addLineItems();
68
+ $this->_addCv2Avs();
69
+
70
+ $this->call($request);
71
+ }
72
+
73
+
74
+ public function call3DLookup()
75
+ {
76
+ $mpiMerchantReference = $this->getOrderNumber() . '-' . time();
77
+ $request = $this->getRequest()
78
+ ->addTransaction()
79
+ ->addTxnDetails($mpiMerchantReference, $this->getAmount(), $this->getCurrency(), 'ecomm');
80
+
81
+ $this->_add3DSecure();
82
+ $request->addMpiTxn();
83
+ $request->addCardDetails($this->getDataCashCardReference(), 'preregistered', 'MpiTxn');
84
+
85
+ $this->call($request);
86
+ }
87
+ }
app/code/community/DataCash/Dpg/Model/Api/Hcc.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Api_Hcc extends DataCash_Dpg_Model_Api_Abstract
30
+ {
31
+
32
+ const ADD_THREED_SECURE_SECTION = true;
33
+
34
+ /**
35
+ * @var DataCash_Dpg_Model_DataCash_Response
36
+ */
37
+ protected $_setupResponse;
38
+
39
+ /**
40
+ * Return the name of the method
41
+ *
42
+ * @return string
43
+ * @author Alistair Stead
44
+ **/
45
+ public function getMethod()
46
+ {
47
+ return 'datacash_hcc';
48
+ }
49
+
50
+ /**
51
+ * setUpHccSession
52
+ * Prepares request for a Datacash HCC session setup request
53
+ *
54
+ * @author Hilary Boyce
55
+ */
56
+ public function setUpHccSession()
57
+ {
58
+ $request = $this->getRequest()
59
+ ->addTransaction()
60
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency())
61
+ ->addHpsTxn($this->getPageSetId(),'setup', $this->getReturnUrl(), $this->getExpiryUrl(), 'hcc');
62
+
63
+ $this->call($request);
64
+ }
65
+
66
+ /**
67
+ * requestPreAuth
68
+ *
69
+ * @param boolean $addThreeDSecureSection Adds the 3D secure section to the request. It is required if both of 3D
70
+ * secure and CCV is turned on
71
+ *
72
+ * @author Hilary Boyce, Norbert Nagy
73
+ */
74
+ public function callPre($addThreeDSecureSection = false)
75
+ {
76
+ $request = $this->getRequest()
77
+ ->addTransaction()
78
+ ->addCardTxn('pre')
79
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency(), 'ecomm');
80
+ if ($this->getMpiReference()) {
81
+ $request->addCardDetails($this->getMpiReference());
82
+ } elseif ($this->getBypass3dsecure()) {
83
+ $request->addCardDetails($this->getDataCashCardReference(), 'from_mpi');
84
+ } else {
85
+ $request->addCardDetails($this->getDataCashCardReference(), 'from_hps');
86
+ }
87
+
88
+ if ($addThreeDSecureSection) {
89
+ $this->_add3DSecure(false);
90
+ $billingAddress = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();
91
+ $this->setBillingAddress($billingAddress);
92
+ }
93
+
94
+ $this->_addLineItems();
95
+ $this->_addCv2Avs();
96
+ // $this->_addRed();
97
+
98
+ $this->call($request);
99
+ }
100
+
101
+ /**
102
+ * requestAuth
103
+ *
104
+ * @param boolean $addThreeDSecureSection Adds the 3D secure section to the request. It is required if both of 3D
105
+ * secure and CCV is turned on
106
+ *
107
+ * @author Hilary Boyce, Norbert Nagy
108
+ */
109
+ public function callAuth($addThreeDSecureSection = false)
110
+ {
111
+ $request = $this->getRequest()
112
+ ->addTransaction()
113
+ ->addCardTxn('auth')
114
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency(), 'ecomm');
115
+ if ($this->getMpiReference()) {
116
+ $request->addCardDetails($this->getMpiReference());
117
+ } elseif ($this->getBypass3dsecure()) {
118
+ $request->addCardDetails($this->getDataCashCardReference(), 'from_mpi');
119
+ } else {
120
+ $request->addCardDetails($this->getDataCashCardReference(), 'from_hps');
121
+ }
122
+
123
+ if ($addThreeDSecureSection) {
124
+ $this->_add3DSecure(false);
125
+ $billingAddress = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();
126
+ $this->setBillingAddress($billingAddress);
127
+ }
128
+
129
+ $this->_addLineItems();
130
+ $this->_addCv2Avs();
131
+ // $this->_addRed();
132
+
133
+ $this->call($request);
134
+ }
135
+
136
+ /**
137
+ * Adds the Transaction and Historic TXN sections to the 3D Secure authorization request
138
+ *
139
+ * @param Dpg_Model_Service_Hcc $validator
140
+ * @return void
141
+ * @author Norbert Nagy
142
+ */
143
+ public function call3DAuthorization($validator)
144
+ {
145
+ $session = Mage::getSingleton('checkout/session');
146
+
147
+ $state = $validator->getValidationState();
148
+
149
+ $request = $this->getRequest()
150
+ ->addTransaction()
151
+ ->addHistoricTxn(
152
+ 'threedsecure_authorization_request',
153
+ $state->getLookupTransactionId(),
154
+ null,
155
+ '3d',
156
+ $state->getAuthenticatePaResPayload()
157
+ );
158
+
159
+ $this->call($request);
160
+ }
161
+
162
+ /**
163
+ * Call the DataCash API to make an 3D Secure request
164
+ *
165
+ * @return void
166
+ * @author Alistair Stead, Norbert Nagy
167
+ **/
168
+ public function call3DLookup()
169
+ {
170
+ $mpiMerchantReference = $this->getOrderNumber() . '-' . time();
171
+
172
+ if ($this->getIsUseCcv()) {
173
+ $paymentAction = $this->getConfig()->getPaymentAction($this->getMethod());
174
+ if ($paymentAction == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) {
175
+ $this->callPre(self::ADD_THREED_SECURE_SECTION);
176
+ } elseif ($paymentAction == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
177
+ $this->callAuth(self::ADD_THREED_SECURE_SECTION);
178
+ }
179
+ } else {
180
+ $request = $this->getRequest()
181
+ ->addTransaction()
182
+ ->addTxnDetails($mpiMerchantReference, $this->getAmount(), $this->getCurrency())
183
+ ->addMpiTxn()
184
+ ->addCardDetails($this->getDataCashCardReference(), 'from_hps', 'MpiTxn');
185
+
186
+ $this->_add3DSecure();
187
+
188
+ $this->call($request);
189
+ }
190
+ }
191
+ }
app/code/community/DataCash/Dpg/Model/Api/Hps.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Api_Hps extends DataCash_Dpg_Model_Api_Abstract
30
+ {
31
+
32
+ /**
33
+ * Return the name of the method
34
+ *
35
+ * @return string
36
+ * @author Alistair Stead
37
+ **/
38
+ public function getMethod()
39
+ {
40
+ return 'datacash_hps';
41
+ }
42
+
43
+ /**
44
+ * setUpHpsSession
45
+ * Prepares request for a Datacash HPS session setup request
46
+ *
47
+ * @author Hilary Boyce
48
+ */
49
+ public function setUpHpsSession()
50
+ {
51
+ $request = $this->getRequest()
52
+ ->addTransaction()
53
+ ->addTxnDetails($this->getOrderNumber(), $this->getAmount(), $this->getCurrency());
54
+ $this->_add3DSecure();
55
+ $request->addCardTxn($this->getAuthMethod(), null, 'hps');
56
+ $this->_addCv2Avs();
57
+ $request->addHpsTxn($this->getPageSetId(),'setup_full', $this->getReturnUrl(), $this->getExpiryUrl(), 'hps');
58
+
59
+ $this->call($request);
60
+ }
61
+
62
+ /**
63
+ * callTransactionStatus
64
+ * Gets the status of the sent transaction
65
+ *
66
+ * @author Andy Thompson
67
+ */
68
+ public function callTransactionStatus()
69
+ {
70
+ $request = $this->getRequest()
71
+ ->addTransaction()
72
+ ->addHistoricTxn('query', $this->getDataCashCardReference(), null, 'hps');
73
+
74
+ $this->call($request);
75
+ }
76
+
77
+ /**
78
+ * Add the 3D Secure information to the request if enabled
79
+ *
80
+ * @param boolean $mpi Send the verify node or not. The verify node causes problem with mpi requests.
81
+ * @return void
82
+ * @author Alistair Stead/Hilary Boyce/Norbert Nagy
83
+ **/
84
+ protected function _add3DSecure($mpi = true)
85
+ {
86
+ $request = $this->getRequest();
87
+ if ($this->getIsUse3DSecure()) {
88
+ $request->addThreeDSecure(
89
+ 'yes',
90
+ $this->getBaseUrl(),
91
+ $this->getPurchaseDescription(),
92
+ $this->getPurchaseDateTime(),
93
+ $this->getBrowserData(),
94
+ false
95
+ );
96
+ } else {
97
+ $request->addThreeDSecure('no');
98
+ }
99
+
100
+ }
101
+
102
+
103
+ }
app/code/community/DataCash/Dpg/Model/Code.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Code
30
+ {
31
+ const SUCCESS = 1;
32
+ const SOCKET_WRITE_ERROR = 2;
33
+ const FRAUD = 1105;
34
+
35
+
36
+ /**
37
+ * undocumented class variable
38
+ *
39
+ * @var string
40
+ **/
41
+ protected $_errors = array(
42
+ self::SUCCESS => 'Transaction accepted and logged.',
43
+ self::SOCKET_WRITE_ERROR => 'Communication was interrupted.',
44
+ self::FRAUD => 'The transaction referenced was both referred by the acquiring bank, and challanged by the Retail Decisions (ReD) Service.'
45
+ );
46
+
47
+
48
+ /**
49
+ * undocumented function
50
+ *
51
+ * @return void
52
+ * @author Alistair Stead
53
+ **/
54
+ public static function massage($code)
55
+ {
56
+ return $this->_errors[$code];
57
+ }
58
+ }
app/code/community/DataCash/Dpg/Model/Config.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Config extends Varien_Object
30
+ {
31
+ const TRANSACTION_TYPES = 'global/datacash/transaction/types';
32
+
33
+ /**
34
+ * Return the internal storeId
35
+ *
36
+ * @return int
37
+ * @author Alistair Stead
38
+ **/
39
+ public function getStoreId()
40
+ {
41
+ if (is_null($this->getStorId())) {
42
+ $this->setStoreId(Mage::app()->getStore()->getId());
43
+ }
44
+
45
+ return $this->getStorId();
46
+ }
47
+
48
+ protected function _getStoreFlag($method, $setting)
49
+ {
50
+ return Mage::getStoreConfigFlag("payment/{$method}/{$setting}", $this->getStoreId());
51
+ }
52
+
53
+ protected function _getStoreSetting($method, $setting)
54
+ {
55
+ return Mage::getStoreConfig("payment/{$method}/{$setting}", $this->getStoreId());
56
+ }
57
+
58
+ /**
59
+ * Retrieve array of credit card types
60
+ *
61
+ * @return array
62
+ */
63
+ public function getTansactionTypes()
64
+ {
65
+ $_types = Mage::getConfig()->getNode(self::TRANSACTION_TYPES)->asArray();
66
+
67
+ $types = array();
68
+ foreach ($_types as $data) {
69
+ if (isset($data['code']) && isset($data['name'])) {
70
+ $types[$data['code']] = $data['name'];
71
+ }
72
+ }
73
+
74
+ return $types;
75
+ }
76
+
77
+ /**
78
+ * Check whether method active in configuration and supported for merchant country or not
79
+ *
80
+ * @param string $method Method code
81
+ * @author Alistair Stead
82
+ */
83
+ public function isMethodActive($method)
84
+ {
85
+ if (Mage::getStoreConfigFlag("payment/{$method}/active", $this->getStoreId()))
86
+ {
87
+ return true;
88
+ }
89
+ return false;
90
+ }
91
+
92
+ /**
93
+ * Is the payment method configured to run in sandbox mode
94
+ *
95
+ * @param string $method Method code
96
+ * @return bool
97
+ * @author Alistair Stead
98
+ **/
99
+ public function isMethodSandboxed($method)
100
+ {
101
+ if (Mage::getStoreConfigFlag("payment/{$method}/sandbox", $this->getStoreId()))
102
+ {
103
+ return true;
104
+ }
105
+ return false;
106
+ }
107
+
108
+ /**
109
+ * Is the payment method configured to run in sandbox mode
110
+ *
111
+ * @param string $method Method code
112
+ * @return bool
113
+ * @author Alistair Stead
114
+ **/
115
+ public function getEndpoint($method)
116
+ {
117
+ return $this->isMethodSandboxed($method)?
118
+ $this->_getStoreSetting($method, 'testing_endpoint'):
119
+ $this->_getStoreSetting($method, 'live_endpoint');
120
+ }
121
+
122
+ /**
123
+ * Is the debugging enabled
124
+ *
125
+ * @param string $method Method code
126
+ * @return bool
127
+ * @author Alistair Stead
128
+ **/
129
+ public function isMethodDebug($method)
130
+ {
131
+ if (Mage::getStoreConfigFlag("payment/{$method}/debug", $this->getStoreId()))
132
+ {
133
+ return true;
134
+ }
135
+ return false;
136
+ }
137
+
138
+ /**
139
+ * Should order line items be transmitted
140
+ *
141
+ * @param string $method Method code
142
+ * @return bool
143
+ * @author Alistair Stead
144
+ **/
145
+ public function isLineItemsEnabled($method)
146
+ {
147
+ if (Mage::getStoreConfigFlag("payment/{$method}/line_items_enabled", $this->getStoreId()))
148
+ {
149
+ return true;
150
+ }
151
+ return false;
152
+ }
153
+
154
+ /**
155
+ * Should CV2 information be transmitted
156
+ *
157
+ * @param string $method Method code
158
+ * @return bool
159
+ * @author Alistair Stead
160
+ **/
161
+ public function isUseCcv($method)
162
+ {
163
+ if (Mage::getStoreConfigFlag("payment/{$method}/useccv", $this->getStoreId()) == '1')
164
+ {
165
+ return true;
166
+ }
167
+ return false;
168
+ }
169
+
170
+ /**
171
+ * Should CV2 Extended Policy information be transmitted
172
+ *
173
+ * @param string $method Method code
174
+ * @return bool
175
+ * @author Alistair Stead
176
+ **/
177
+ public function isUseAdvancedCcv($method)
178
+ {
179
+ if (Mage::getStoreConfigFlag("payment/{$method}/useccv_advanced", $this->getStoreId()) == '1')
180
+ {
181
+ return true;
182
+ }
183
+ return false;
184
+ }
185
+
186
+ /**
187
+ * Should 3D Secure inormation be transmitted
188
+ *
189
+ * @param string $method Method code
190
+ * @return bool
191
+ * @author Alistair Stead
192
+ **/
193
+ public function getIsCentinelValidationEnabled($method)
194
+ {
195
+ if (Mage::getStoreConfigFlag("payment/{$method}/centinel", $this->getStoreId()) == '1')
196
+ {
197
+ return true;
198
+ }
199
+ return false;
200
+ }
201
+
202
+ /**
203
+ * Decrypt and return the Merchant password for the DataCash gateway
204
+ *
205
+ * @return string
206
+ * @author Alistair Stead
207
+ **/
208
+ public function getApiPassword($method)
209
+ {
210
+ $password = Mage::getStoreConfig("payment/{$method}/merchant_password", $this->getStoreId());
211
+ // Decrypt the marchant password in order to transmit it as part of the request
212
+ return Mage::helper('core')->decrypt($password);
213
+ }
214
+
215
+ /**
216
+ * Return the Merchant ID for the DataCash gateway
217
+ *
218
+ * @return string
219
+ * @author Alistair Stead
220
+ **/
221
+ public function getApiMerchantId($method)
222
+ {
223
+ return Mage::getStoreConfig("payment/{$method}/merchant_id", $this->getStoreId());
224
+ }
225
+
226
+ /**
227
+ * Return the configured payment action
228
+ *
229
+ * @return string
230
+ * @author Alistair Stead
231
+ **/
232
+ public function getPaymentAction($method)
233
+ {
234
+ return Mage::getStoreConfig("payment/{$method}/payment_action", $this->getStoreId());
235
+ }
236
+
237
+ /**
238
+ * Should processing continue for 3DSecure response code
239
+ *
240
+ * @param string $method Method code
241
+ * $param string $code DRG response code
242
+ * @return bool
243
+ * @author Hilary Boyce
244
+ **/
245
+ public function continueBehaviour($method, $code)
246
+ {
247
+ if (Mage::getStoreConfigFlag("payment/{$method}/threedsecure_behaviour_{$code}", $this->getStoreId()) == '1')
248
+ {
249
+ return true;
250
+ }
251
+ return false;
252
+ }
253
+
254
+ public function getIsAllowedT3m($method = 'datacash_api')
255
+ {
256
+ if (Mage::getStoreConfigFlag("payment/{$method}/allow_t3m", $this->getStoreId()))
257
+ {
258
+ return true;
259
+ }
260
+ return false;
261
+ }
262
+
263
+ public function getT3mUseSslCallback($method = 'datacash_api')
264
+ {
265
+ if (Mage::getStoreConfigFlag("payment/{$method}/t3m_use_ssl_callback", $this->getStoreId()))
266
+ {
267
+ return true;
268
+ }
269
+ return false;
270
+ }
271
+
272
+ public function getT3mCallBackUrl($method = 'datacash_api')
273
+ {
274
+ $defaultStore = Mage::getModel('core/store')->load('default', 'code');
275
+ $uri = 'index.php/datacash/t3m';
276
+
277
+ if ($this->getT3mUseSslCallback($method)) {
278
+ return Mage::getStoreConfig('web/secure/base_url', $defaultStore->getStoreId()) . $uri;
279
+ } else {
280
+ return Mage::getStoreConfig('web/unsecure/base_url', $defaultStore->getStoreId()) . $uri;
281
+ }
282
+ }
283
+ }
app/code/community/DataCash/Dpg/Model/Datacash/Request.php ADDED
@@ -0,0 +1,1095 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Datacash_Request extends Varien_Object
30
+ {
31
+ /**
32
+ * Internal member variable that will hold the XML request
33
+ *
34
+ * @var Varien_Simplexml_Element
35
+ **/
36
+ protected $_request;
37
+
38
+ /**
39
+ * Varien construct
40
+ *
41
+ * @return DataCash_Dpg_Model_DataCash_Request
42
+ * @author Alistair Stead
43
+ **/
44
+ public function _construct(Varien_Simplexml_Element $xmlElement = null)
45
+ {
46
+ if (is_null($xmlElement)) {
47
+ $xmlElement = new Varien_Simplexml_Element('<Request></Request>');
48
+ }
49
+ $this->_request = $xmlElement;
50
+
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * Add the Authentication section of the request
56
+ *
57
+ * @param string $merchantId The merchant id supplied by DataCash (Required)
58
+ * @param string $password The merchant password supplied by DataCash (Required)
59
+ * @return DataCash_Dpg_Model_DataCash_Request
60
+ * @author Alistair Stead
61
+ **/
62
+ public function addAuthentication($merchantId, $password)
63
+ {
64
+ $auth = $this->getRequest()->addChild('Authentication');
65
+ $auth->addChild('client', $merchantId);
66
+ $auth->addChild('password', $password);
67
+
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * Add the Transaction section to the request
73
+ *
74
+ * @return DataCash_Dpg_Model_DataCash_Request
75
+ * @author Alistair Stead
76
+ **/
77
+ public function addTransaction()
78
+ {
79
+ $this->getRequest()->addChild('Transaction');
80
+
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Add the CardTxn section to the request
86
+ *
87
+ * @param string $method
88
+ * @param string $authcode
89
+ * @param string $type Whether an api or hps request
90
+ * @return DataCash_Dpg_Model_DataCash_Request
91
+ * @author Alistair Stead/Hilary Boyce
92
+ **/
93
+ public function addCardTxn($method, $authcode = null, $type = 'api')
94
+ {
95
+ if (!$this->getRequest()->Transaction) {
96
+ throw new UnexpectedValueException('Parent node does not exist');
97
+ }
98
+ $this->_validateCardMethod($method, $type);
99
+ $cardTxn = $this->getRequest()->Transaction->addChild('CardTxn');
100
+ $cardTxn->addChild('method', $method);
101
+ if (!is_null($authcode)) {
102
+ $cardTxn->addChild('authcode', $authcode);
103
+ }
104
+
105
+ return $this;
106
+ }
107
+
108
+ /**
109
+ * Add the MpiTxn section to the Transaction
110
+ *
111
+ * @param string $method
112
+ * @return DataCash_Dpg_Model_DataCash_Request
113
+ * @author Alistair Stead
114
+ **/
115
+ public function addMpiTxn($method = 'mpi')
116
+ {
117
+ if (!$this->getRequest()->Transaction) {
118
+ throw new UnexpectedValueException('Parent node does not exist');
119
+ }
120
+ $cardTxn = $this->getRequest()->Transaction->addChild('MpiTxn');
121
+ $cardTxn->addChild('method', $method);
122
+
123
+ return $this;
124
+ }
125
+
126
+ /**
127
+ * Add the Card section to the MpiTxn
128
+ *
129
+ * @param string $number The card number (Required)
130
+ * @param string $expiryDate The card expiry date (Required)
131
+ * @param string $startDate The card start date (Mandatory)
132
+ * @param string $issueNumber The card issue number (Mandatory)
133
+ * @return DataCash_Dpg_Model_DataCash_Request
134
+ * @author Alistair Stead
135
+ **/
136
+ public function addMpiCard($number, $expiryDate, $startDate = null, $issueNumber = null)
137
+ {
138
+ if (!$this->getRequest()->Transaction->MpiTxn) {
139
+ throw new UnexpectedValueException('Parent node does not exist');
140
+ }
141
+ $card = $this->getRequest()->Transaction->MpiTxn->addChild('Card');
142
+ // Required values
143
+ $card->addChild('pan', $number);
144
+ $card->addChild('expirydate', $expiryDate);
145
+ // Mandatory values for some cards
146
+ if (!is_null($startDate)) {
147
+ $card->addChild('startdate', $startDate);
148
+ }
149
+ if (!is_null($issueNumber)) {
150
+ $card->addChild('issuenumber', $issueNumber);
151
+ }
152
+
153
+ return $this;
154
+ }
155
+
156
+ /**
157
+ * Add historic card details (or pre-registered card ref)
158
+ * for MPI authentication
159
+ *
160
+ * @return DataCash_Dpg_Model_DataCash_Request
161
+ * @author Alistair Stead
162
+ **/
163
+ public function addCardDetails($reference, $type = 'from_mpi', $txn = 'CardTxn')
164
+ {
165
+ if (!$this->getRequest()->Transaction->$txn) {
166
+ throw new UnexpectedValueException('Parent node does not exist');
167
+ }
168
+ $cardDetails = $this->getRequest()->Transaction->$txn->addChild('card_details', $reference);
169
+ $cardDetails->addAttribute('type', $type);
170
+
171
+ return $this;
172
+ }
173
+
174
+ /**
175
+ * Add a historic transaction node to the request
176
+ *
177
+ * @return DataCash_Dpg_Model_DataCash_Request
178
+ * @author Alistair Stead
179
+ **/
180
+ public function addHistoricTxn($method, $reference, $authcode = null, $type = 'api', $paresMessage = null)
181
+ {
182
+ if (!$this->getRequest()->Transaction) {
183
+ throw new UnexpectedValueException('Parent node does not exist');
184
+ }
185
+ $this->_validateHistoricMethod($method, $type, $type);
186
+ $historicTxn = $this->getRequest()->Transaction->addChild('HistoricTxn');
187
+ $historicTxn->addChild('method', $method);
188
+ $historicTxn->addChild('reference', $reference);
189
+ if (!is_null($authcode)) {
190
+ $historicTxn->addChild('authcode', $authcode);
191
+ }
192
+ if (!is_null($paresMessage)) {
193
+ $historicTxn->addChild('pares_message', $paresMessage);
194
+ }
195
+
196
+ return $this;
197
+ }
198
+
199
+ /**
200
+ * Add the TxnDetails section to the request
201
+ *
202
+ * @param string $orderNumber The Magento order number (Required)
203
+ * @param string $amount The value to be charged (Required)
204
+ * @param string $currency The currency code (Mandatory)
205
+ * @return DataCash_Dpg_Model_DataCash_Request
206
+ * @author Alistair Stead
207
+ **/
208
+ public function addTxnDetails($orderNumber, $amount, $currency = null, $captureMethod = null)
209
+ {
210
+ if (!$this->getRequest()->Transaction) {
211
+ throw new UnexpectedValueException('Parent node does not exist');
212
+ }
213
+ $this->_validateOrderNumber($orderNumber);
214
+ $txnDetails = $this->getRequest()->Transaction->addChild('TxnDetails');
215
+ $txnDetails->addChild('merchantreference', $orderNumber);
216
+ $amount = $txnDetails->addChild('amount', $amount);
217
+ if (!is_null($currency)) {
218
+ $this->_validateCurrency($currency);
219
+ $amount->addAttribute('currency', $currency);
220
+ }
221
+
222
+ if (!is_null($captureMethod)) {
223
+ $txnDetails->addChild('capturemethod', $captureMethod);
224
+ }
225
+
226
+ return $this;
227
+ }
228
+
229
+ /**
230
+ * Add line LineItemDetails node to the request
231
+ *
232
+ * @return DataCash_Dpg_Model_DataCash_Request
233
+ * @author Alistair Stead
234
+ **/
235
+ public function addLineItemDetail($customerCode, $transactionVat, $transactionVatStatus = 1, $merchantVatNumber = null)
236
+ {
237
+ if (!$this->getRequest()->Transaction->TxnDetails) {
238
+ throw new UnexpectedValueException('Parent node does not exist');
239
+ }
240
+ $lineItemDetail = $this->getRequest()->Transaction->TxnDetails->addChild('LineItemDetail');
241
+ $lineItemDetail->addChild('customercode', $customerCode);
242
+ $lineItemDetail->addChild('transactionVAT', $transactionVat);
243
+ $lineItemDetail->addChild('transactionVATstatus', $transactionVatStatus);
244
+ if (!is_null($merchantVatNumber)) {
245
+ $lineItemDetail->addChild('merchantVATnumber', $merchantVatNumber);
246
+ }
247
+
248
+ return $this;
249
+ }
250
+
251
+ /**
252
+ * Add backet items to the request sent to DataCash
253
+ *
254
+ * @return DataCash_Dpg_Model_DataCash_Request
255
+ * @author Alistair Stead
256
+ **/
257
+ public function addItem($description, $unitMeasure, $unitCost, $vatRate, $quantity, $totalAmount,
258
+ $productCode = null, $discountAmount = null, $commodityCode = null)
259
+ {
260
+ if (!$this->getRequest()->Transaction->TxnDetails->LineItemDetail) {
261
+ throw new UnexpectedValueException('Parent node does not exist');
262
+ }
263
+ if (!$this->getRequest()->Transaction->TxnDetails->LineItemDetail->Items) {
264
+ $items = $this->getRequest()->Transaction->TxnDetails->LineItemDetail->addChild('Items');
265
+ } else {
266
+ $items = $this->getRequest()->Transaction->TxnDetails->LineItemDetail->Items;
267
+ }
268
+ $item = $items->addChild('Item');
269
+ $item->addChild('description', $description);
270
+ $item->addChild('unitmeasure', $unitMeasure);
271
+ $item->addChild('unitcost', $unitCost);
272
+ $item->addChild('vatrate', $vatRate);
273
+ $item->addChild('quantity', $quantity);
274
+ $item->addChild('totalamount', $totalAmount);
275
+ if (!is_null($productCode)) {
276
+ $item->addChild('product_code', $productCode);
277
+ }
278
+ if (!is_null($commodityCode)) {
279
+ $item->addChild('commoditycode', $commodityCode);
280
+ }
281
+ if (!is_null($discountAmount)) {
282
+ $item->addChild('discountamount', $discountAmount);
283
+ }
284
+
285
+ return $this;
286
+ }
287
+
288
+ /**
289
+ * Add order information to the request
290
+ *
291
+ * @return void
292
+ * @author Alistair Stead
293
+ **/
294
+ public function addOrder()
295
+ {
296
+ if (!$this->getRequest()->Transaction->TxnDetails) {
297
+ throw new UnexpectedValueException('Parent node does not exist');
298
+ }
299
+ $order = $this->getRequest()->Transaction->TxnDetails->addChild('Order');
300
+
301
+ return $this;
302
+ }
303
+
304
+ /**
305
+ * Add customer information to the request
306
+ *
307
+ * @return DataCash_Dpg_Model_DataCash_Request
308
+ * @author Alistair Stead
309
+ **/
310
+ public function addCustomer($email, $forename, $surname, $ip)
311
+ {
312
+ if (!$this->getRequest()->Transaction->TxnDetails->Order) {
313
+ throw new UnexpectedValueException('Parent node does not exist');
314
+ }
315
+ $customer = $this->getRequest()->Transaction->TxnDetails->Order->addChild('Customer');
316
+ $customer->addChild('email', $email);
317
+ $customer->addChild('forename', $forename);
318
+ $customer->addChild('surname', $surname);
319
+ $customer->addChild('ip_address', $ip);
320
+
321
+ return $this;
322
+ }
323
+
324
+ /**
325
+ * Add address to the request
326
+ *
327
+ * @return DataCash_Dpg_Model_DataCash_Request
328
+ * @author Alistair Stead
329
+ **/
330
+ public function addAddress($streetAddress, $city, $country, $postcode)
331
+ {
332
+ if (!$this->getRequest()->Transaction->TxnDetails->Order->Customer) {
333
+ throw new UnexpectedValueException('Parent node does not exist');
334
+ }
335
+ $address = $this->getRequest()->Transaction->TxnDetails->Order->Customer->addChild('Address');
336
+ $address->addChild('streetaddress', $streetAddress);
337
+ $address->addChild('city', $city);
338
+ $address->addChild('city', $postcode);
339
+ $address->addChild('country', $country);
340
+
341
+ return $this;
342
+ }
343
+
344
+ /**
345
+ * Add billing address information to the request
346
+ *
347
+ * @return DataCash_Dpg_Model_DataCash_Request
348
+ * @author Alistair Stead
349
+ **/
350
+ public function addBillingAddress($streetAddress, $city, $country, $postcode)
351
+ {
352
+ if (!$this->getRequest()->Transaction->TxnDetails->Order) {
353
+ throw new UnexpectedValueException('Parent node does not exist');
354
+ }
355
+ $billingAddress = $this->getRequest()->Transaction->TxnDetails->Order->addChild('BillingAddress');
356
+ $billingAddress->addChild('streetaddress', $streetAddress);
357
+ $billingAddress->addChild('city', $city);
358
+ $billingAddress->addChild('city', $postcode);
359
+ $billingAddress->addChild('country', $country);
360
+
361
+ return $this;
362
+ }
363
+
364
+ /**
365
+ * Add Shipping information to the Request
366
+ *
367
+ * @return DataCash_Dpg_Model_DataCash_Request
368
+ * @author Alistair Stead
369
+ **/
370
+ public function addShipping($shippingAmount, $shippingVatRate)
371
+ {
372
+ if (!$this->getRequest()->Transaction->TxnDetails->LineItemDetail) {
373
+ throw new UnexpectedValueException('Parent node does not exist');
374
+ }
375
+ $shipping = $this->getRequest()->Transaction->TxnDetails->LineItemDetail->addChild('Shipping');
376
+ $shipping->addChild('shippingamount', $shippingAmount);
377
+ $shipping->addChild('shippingVATrate', $shippingVatRate);
378
+
379
+ return $this;
380
+ }
381
+
382
+ /**
383
+ * Add the Card section to the request
384
+ *
385
+ * @param string $number The card number (Required)
386
+ * @param string $expiryDate The card expiry date (Required)
387
+ * @param string $startDate The card start date (Mandatory)
388
+ * @param string $issueNumber The card issue number (Mandatory)
389
+ * @return DataCash_Dpg_Model_DataCash_Request
390
+ * @author Alistair Stead
391
+ **/
392
+ public function addCard($number, $expiryDate, $startDate = null, $issueNumber = null)
393
+ {
394
+ if (!$this->getRequest()->Transaction->CardTxn) {
395
+ throw new UnexpectedValueException('Parent node does not exist');
396
+ }
397
+ $card = $this->getRequest()->Transaction->CardTxn->addChild('Card');
398
+ // Required values
399
+ $card->addChild('pan', $number);
400
+ $card->addChild('expirydate', $expiryDate);
401
+ // Mandatory values for some cards
402
+ if (!is_null($startDate)) {
403
+ $card->addChild('startdate', $startDate);
404
+ }
405
+ if (!is_null($issueNumber)) {
406
+ $card->addChild('issuenumber', $issueNumber);
407
+ }
408
+
409
+ return $this;
410
+ }
411
+
412
+ /**
413
+ * Add HPS details to the request
414
+ *
415
+ * @param integer $pageSetId The id of the hosted page set on datacash (Required)
416
+ * @param string $method Method requested from Datacash HCC, default 'setup' (Required)
417
+ * @param string $returnUrl Full url for return page on successful completion(Optional)
418
+ * @param string $expiryUrl Full url for return on error (Optional)
419
+ * @param string $type hcc|hps
420
+ *
421
+ * @return DataCash_Dpg_Model_DataCash_Request
422
+ * @author Hilary Boyce
423
+ */
424
+ public function addHpsTxn($pageSetId, $method = 'setup', $returnUrl = '',$expiryUrl = '', $type='hcc'){
425
+ if (!$this->getRequest()->Transaction) {
426
+ throw new UnexpectedValueException('Parent node does not exist');
427
+ }
428
+ $this->_validateHPSMethod($method, $type);
429
+ if (!$pageSetId){
430
+ throw new InvalidArgumentException("Invalid page set id supplied {$pageSetId}");
431
+ }
432
+
433
+ $hpsTxn = $this->getRequest()->Transaction->addChild('HpsTxn');
434
+ $hpsTxn->addChild('method', $method);
435
+ $hpsTxn->addChild('page_set_id', $pageSetId);
436
+ if($returnUrl){
437
+ $this->_validateUrl($returnUrl);
438
+ $hpsTxn->addChild('return_url', $returnUrl);
439
+ }
440
+ if($expiryUrl){
441
+ $this->_validateUrl($expiryUrl);
442
+ $hpsTxn->addChild('expiry_url', $expiryUrl);
443
+ }
444
+
445
+ return $this;
446
+ }
447
+
448
+ /**
449
+ * Add dynamic data to the request
450
+ *
451
+ * @param array key/value pairs $dynamicData Upto 9 elements to replace dynamic data in the card capture page (Optional)
452
+ *
453
+ * @return DataCash_Dpg_Model_DataCash_Request
454
+ * @author Hilary Boyce
455
+ */
456
+ public function addHpsDynamicData($data)
457
+ {
458
+ if (!is_array($data)){
459
+ throw new InvalidArgumentException("Invalid dynamic data supplied");
460
+ }
461
+ if (!$this->getRequest()->Transaction->HpsTxn) {
462
+ throw new UnexpectedValueException('Parent node does not exist');
463
+ }
464
+ if(count($data) > 0){
465
+ $dynamicData = $this->getRequest()->Transaction->HpsTxn->addChild('DynamicData');
466
+ foreach($data as $key => $value){
467
+ $this->_validateDynamicDataItem($value);
468
+ $dynamicData->addChild($key,$value);
469
+ }
470
+ }
471
+ return $this;
472
+ }
473
+
474
+
475
+ /**
476
+ * addThreeDSecure
477
+ *
478
+ * @param string $verify (yes|no) whether the service is required. If yes other params required
479
+ * @param string $baseUrl
480
+ * @param string $purchaseDesc 1-125 character description
481
+ * @param string $purchaseDateTime format YYYY-MM-DD HH:MM:SS
482
+ * @param array $browser array of key/value pairs
483
+ * device_category 0|1
484
+ * accept_headers
485
+ * user_agent
486
+ * @param bool mpiRequest
487
+ *
488
+ * @return DataCash_Dpg_Model_DataCash_Request
489
+ * @author Hilary Boyce
490
+ */
491
+ public function addThreeDSecure($verify, $baseUrl = null, $purchaseDesc = null, $purchaseDateTime = null, $browserData = array(), $mpiRequest = true)
492
+ {
493
+ if (!$this->getRequest()->Transaction->TxnDetails) {
494
+ throw new UnexpectedValueException('Parent node does not exist');
495
+ }
496
+ $threeDSecure = $this->getRequest()->Transaction->TxnDetails->addChild('ThreeDSecure');
497
+ if($verify === 'no'){
498
+ $threeDSecure->addChild('verify', $verify);
499
+ } elseif($verify == 'yes'){
500
+ $this->_validateUrl($baseUrl);
501
+ $this->_validatePurchaseDesc($purchaseDesc);
502
+ $this->_validatePurchaseDatetime($purchaseDateTime);
503
+ $this->_validateBrowser($browserData);
504
+ //bugfix 0.1.14 verify needed for hps ThreeDSecure section in setup request but not for mpi requests
505
+ if(!$mpiRequest){
506
+ $threeDSecure->addChild('verify', $verify);
507
+ }
508
+ $threeDSecure->addChild('merchant_url', $baseUrl);
509
+ $threeDSecure->addChild('purchase_desc', $purchaseDesc);
510
+ $threeDSecure->addChild('purchase_datetime', str_replace('-','', $purchaseDateTime));
511
+ $threeDSecure->addChild('Browser');
512
+ $browser = $threeDSecure->Browser;
513
+ foreach($browserData as $key => $value){
514
+ $browser->addChild($key, $value);
515
+ }
516
+ } else {
517
+ throw new InvalidArgumentException(
518
+ "Invalid value for verify supplied {$verify}"
519
+ );
520
+ }
521
+ return $this;
522
+ }
523
+
524
+ /**
525
+ * addCv2Avs
526
+ *
527
+ * @param $streetAddress1 Optional
528
+ * @param string $streetAddress2 Optional
529
+ * @param string $streetAddress3 Optional
530
+ * @param string $streetAddress4 Optional
531
+ * @param string $postcode Optional
532
+ * @param string $cv2 3 or 4 digit code Optional
533
+ * @param string $policy Optional (1|2|3|5|6|7|
534
+ * Only one of policy or extended policy can be provided (use addCv2AvsExtendedPolicy)
535
+ *
536
+ * @return DataCash_Dpg_Model_DataCash_Request
537
+ * @author Hilary Boyce
538
+ * @author Alistair Stead
539
+ */
540
+ public function addCv2Avs($streetAddress1 = null, $streetAddress2 = null, $streetAddress3 = null, $streetAddress4 = null,
541
+ $postcode = null, $cv2 = null, $policy = null)
542
+ {
543
+ if (!$this->getRequest()->Transaction) {
544
+ throw new UnexpectedValueException('Parent Transaction node does not exist');
545
+ }
546
+ if (!$this->getRequest()->Transaction->CardTxn) {
547
+ throw new UnexpectedValueException('Parent node CardTxn does not exist');
548
+ }
549
+ // either some address information or cv2 must be provided
550
+ if (is_null($streetAddress1)&& is_null($streetAddress2)&& is_null($streetAddress3)&& is_null($streetAddress4)&&
551
+ is_null($postcode)&& is_null($cv2)){
552
+ throw new InvalidArgumentException(
553
+ "Address or cv2 must be provided"
554
+ );
555
+ }
556
+ if($postcode) {
557
+ $this->_validatePostcode($postcode);
558
+ }
559
+ if($cv2){
560
+ $this->_validateCv2($cv2);
561
+ }
562
+ if($policy){
563
+ $this->_validatePolicy($policy);
564
+ }
565
+ if (!$this->getRequest()->Transaction->CardTxn->Card) {
566
+ $this->getRequest()->Transaction->CardTxn->addChild('Card');
567
+ }
568
+ $cv2Avs = $this->getRequest()->Transaction->CardTxn->Card->addChild('Cv2Avs');
569
+ if($streetAddress1){
570
+ $cv2Avs->addChild('street_address1', $streetAddress1);
571
+ }
572
+ if($streetAddress2){
573
+ $cv2Avs->addChild('street_address2', $streetAddress2);
574
+ }
575
+ if($streetAddress3){
576
+ $cv2Avs->addChild('street_address3', $streetAddress3);
577
+ }
578
+ if($streetAddress4){
579
+ $cv2Avs->addChild('street_address4', $streetAddress4);
580
+ }
581
+ if($postcode){
582
+ $cv2Avs->addChild('postcode', $postcode);
583
+ }
584
+ if($cv2){
585
+ $cv2Avs->addChild('cv2', $cv2);
586
+ $cv2Avs->addChild('cv2_present', '1');
587
+ }
588
+ if($policy){
589
+ $cv2Avs->addChild('policy', $policy);
590
+ }
591
+ return $this;
592
+ }
593
+
594
+ /**
595
+ * addCv2ExtendedPolicy
596
+ *
597
+ * @param array $policy with keys of cv2_policy, postcode_policy, address_policy and for each an array of required attributes
598
+ * eg. array('cv2_policy' => array('notprovided' => 'accept|reject',
599
+ * 'notchecked' => 'accept|reject',
600
+ * 'matched' => 'accept|reject',
601
+ * 'notmatched' => 'accept|reject',
602
+ * 'partialmatch' => 'accept|reject'
603
+ * ),
604
+ * 'postcode_policy' => array( etc...
605
+ *
606
+ * @return DataCash_Dpg_Model_DataCash_Request
607
+ * @author Hilary Boyce
608
+ */
609
+ public function addCv2ExtendedPolicy(array $policy)
610
+ {
611
+ if (!isset($this->getRequest()->Transaction->CardTxn->Card->Cv2Avs)) {
612
+ throw new UnexpectedValueException('Parent node does not exist');
613
+ }
614
+
615
+ // make sure there isn't already a policy element as there can't be both policy and extended policy
616
+ if ($this->getRequest()->Transaction->CardTxn->Cv2Avs->policy) {
617
+ throw new UnexpectedValueException('There is already a policy element');
618
+ }
619
+ $this->_validateExtendedPolicy($policy);
620
+ $cv2Avs = $this->getRequest()->Transaction->CardTxn->Card->Cv2Avs;
621
+ $extendedPolicy = $cv2Avs->addChild('ExtendedPolicy');
622
+ foreach($policy as $elementName => $elementAttribute){
623
+ $element = $extendedPolicy->addChild($elementName);
624
+ foreach($elementAttribute as $attributeName => $attributeValue){
625
+ $element->addAttribute($attributeName, $attributeValue);
626
+ }
627
+ }
628
+ return $this;
629
+ }
630
+
631
+ /**
632
+ * Add the TxnDetails section to the request for HCC
633
+ *
634
+ * @param string $orderNumber The Magento order number (Required)
635
+ * @param string $amount The value to be charged (Required)
636
+ * @return DataCash_Dpg_Model_DataCash_Request
637
+ * @author Hilary Boyce
638
+ **/
639
+ public function addHccTxnDetails($orderNumber, $amount)
640
+ {
641
+ if (!$this->getRequest()->Transaction) {
642
+ throw new UnexpectedValueException('Parent node does not exist');
643
+ }
644
+ $this->_validateOrderNumber($orderNumber);
645
+ $txnDetails = $this->getRequest()->Transaction->addChild('TxnDetails');
646
+ $txnDetails->addChild('merchantreference', $orderNumber);
647
+ $txnDetails->addChild('amount', $amount);
648
+ $txnDetails->addChild('capturemethod', 'ecomm');
649
+ return $this;
650
+ }
651
+
652
+ /**
653
+ * addHccCardTxn
654
+ * @return DataCash_Dpg_Model_DataCash_Request
655
+ * @author Hilary Boyce
656
+ */
657
+ public function addHccCardTxn($reference, $method = 'auth')
658
+ {
659
+ if (!$this->getRequest()->Transaction) {
660
+ throw new UnexpectedValueException('Parent node does not exist');
661
+ }
662
+ $this->_validateCardMethod($method, 'hcc');
663
+ if (!is_numeric($reference) || (strlen($reference)!== 16)) {
664
+ throw new InvalidArgumentException(
665
+ "Invalid datacash reference"
666
+ );
667
+ }
668
+ $cardTxn = $this->getRequest()->Transaction->addChild('CardTxn');
669
+ $cardTxn->addChild('method', $method);
670
+ $cardDetails = $cardTxn->addChild('card_details', $reference);
671
+ $cardDetails->addAttribute('type', 'from_hps');
672
+
673
+ return $this;
674
+ }
675
+
676
+ /**
677
+ * addThe3rdMan
678
+ * @author David Marrs
679
+ **/
680
+ public function addThe3rdMan($vars)
681
+ {
682
+ extract($vars);
683
+ $txn = $this->getRequest()->Transaction->TxnDetails;
684
+ if ( ! $txn ) {
685
+ throw new Exception('Parent node (Transaction->TxnDetails) does not exist');
686
+ }
687
+
688
+ $t3m = $txn->addChild('The3rdMan');
689
+ $t3m->addAttribute('type', 'realtime');
690
+ $customer = $t3m->addChild('CustomerInformation');
691
+ $customer->addChild('customer_reference', NULL);
692
+ $customer->addChild('order_number', $orderNumber);
693
+ $customer->addChild('forename', $billingAddress->getFirstname());
694
+ $customer->addChild('surname', $billingAddress->getLastname());
695
+ $phone = $billingAddress->getTelephone();
696
+ $customer->addChild('telephone', preg_match('/^[\(\)\-0-9 ]+$/', $phone)? $phone: '');
697
+ $fax = $billingAddress->getFax();
698
+ $customer->addChild('alt_telephone', preg_match('/^[\(\)\-0-9 ]+$/', $fax)? $fax: '');
699
+ $customer->addChild('email', $billingAddress->getEmail());
700
+ $customer->addChild('customer_dob', NULL);
701
+ $customer->addChild('first_purchase_date', $previousOrders['first']);
702
+ $customer->addChild('ip_address', $remoteIp);
703
+ $prevPurchases = $customer->addChild('previous_purchases');
704
+ $prevPurchases->addAttribute('count', $previousOrders['count']);
705
+ $prevPurchases->addAttribute('value', $previousOrders['total']);
706
+
707
+ if ($shippingAddress) {
708
+ $this->addT3mAddress($t3m, 'DeliveryAddress', $shippingAddress);
709
+ }
710
+ $this->addT3mAddress($t3m, 'BillingAddress', $billingAddress);
711
+
712
+ $order = $t3m->addChild('OrderInformation');
713
+ $rt = $t3m->addChild('Realtime');
714
+ $rt->addChild('real_time_callback', $callbackUrl);
715
+ $rt->addChild('real_time_callback_format', 'HTTP');
716
+ // XXX Field 'distribution_channel' is not specified as required so I'm
717
+ // leaving it out.
718
+ $order->addChild('distribution_channel', NULL); // XXX Where is this set in mage?
719
+ $products = $order->addChild('Products');
720
+ $products->addAttribute('count', count($orderItems));
721
+ foreach ($orderItems as $item) {
722
+ $product = $products->addChild('Product');
723
+ $product->addChild('code', $item->getSku());
724
+ $product->addChild('quantity', $item->getQtyOrdered());
725
+ $product->addChild('price', $item->getPrice());
726
+ }
727
+ }
728
+
729
+ private function addT3mAddress($node, $nodeName, $data) {
730
+ $addr = $node->addChild($nodeName);
731
+ $street = $data->getStreet();
732
+ $street = array_shift($street);
733
+ $addr->addChild('street_address_1', $street);
734
+ $street = $data->getStreet();
735
+ $street = array_shift($street);
736
+ $addr->addChild('street_address_2', $street);
737
+ $addr->addChild('city', $data->getCity());
738
+ $addr->addChild('county', $data->getRegion());
739
+ $addr->addChild('postcode', $data->getPostcode());
740
+ // XXX Field 'country' needs to be numeric country code which isn't
741
+ // in magento. The docs don't specify if this field is required or
742
+ // not, so I'm leaving it out.
743
+ // $addr->addChild('country', $data->getCountryId());
744
+ }
745
+
746
+ /**
747
+ * Return the internal $_request object as an xml document
748
+ *
749
+ * @return string
750
+ * @author Alistair Stead
751
+ **/
752
+ public function toXml(array $arrAttributes = array(), $rootName = 'item', $addOpenTag=false, $addCdata=true)
753
+ {
754
+ return $this->getRequest()->asXml();
755
+ }
756
+
757
+ /**
758
+ * Return the internal $_request object as an associative array
759
+ *
760
+ * @return array
761
+ * @author Alistair Stead
762
+ **/
763
+ public function toArray(array $arrAttributes = array())
764
+ {
765
+ return $this->getRequest()->asArray();
766
+ }
767
+
768
+ /**
769
+ * Public getter for the internal $_request variable
770
+ *
771
+ * @return Varien_Simplexml_Element
772
+ * @author Alistair Stead
773
+ **/
774
+ public function getRequest()
775
+ {
776
+ return $this->_request;
777
+ }
778
+
779
+ /**
780
+ * Internal method to validate the currency value to be sent by the request
781
+ *
782
+ * @return void
783
+ * @author Alistair Stead
784
+ **/
785
+ protected function _validateCurrency($currency)
786
+ {
787
+ if (strlen($currency) != 3) {
788
+ throw new InvalidArgumentException(
789
+ "Currency should be passed in the 3 character ISO 4217 Alphabetic format {$currency} geven"
790
+ );
791
+ }
792
+ }
793
+
794
+ /**
795
+ * Internal method to validate the order number to be sent by the request
796
+ *
797
+ * @return void
798
+ * @author Alistair Stead
799
+ **/
800
+ protected function _validateOrderNumber($number)
801
+ {
802
+ if ($number) {
803
+ if (strpos($number, '-') !== false) {
804
+ $parts = explode('-', $number);
805
+ $number = $parts[0];
806
+ }
807
+ $length = strlen($number);
808
+ if ( $length > 30 || $length < 6) {
809
+ throw new InvalidArgumentException(
810
+ "Order number must be min 6, max 30 alphanumeric characters. {$number}"
811
+ );
812
+ }
813
+ }
814
+ }
815
+
816
+ /**
817
+ * Internal method to validate the method value to be sent in the API request
818
+ *
819
+ * @return void
820
+ * @author Alistair Stead
821
+ **/
822
+ protected function _validateCardMethod($method, $type)
823
+ {
824
+ switch(strtolower($type)){
825
+ case 'api':
826
+ $transactionTypes = array('auth', 'pre', 'refund', 'erp');
827
+ break;
828
+ case 'hcc':
829
+ $transactionTypes = array('auth', 'pre');
830
+ break;
831
+ case 'hps':
832
+ $transactionTypes = array('auth', 'pre');
833
+ break;
834
+ default:
835
+ throw new InvalidArgumentException(
836
+ "Invalid transaction type supplied {$type}"
837
+ );
838
+ }
839
+ if (!in_array($method, $transactionTypes)) {
840
+ throw new InvalidArgumentException(
841
+ "Invalid transaction method supplied {$method}"
842
+ );
843
+ }
844
+ }
845
+
846
+ /**
847
+ * Internal method to validate the method value to be sent in the API request
848
+ *
849
+ * @return void
850
+ * @author Alistair Stead
851
+ **/
852
+ protected function _validateHistoricMethod($method, $type)
853
+ {
854
+ switch(strtolower($type)){
855
+ case 'api':
856
+ $transactionTypes = array('fulfill', 'txn_refund', 'cancel', 'authorize_referr', 'al_request');
857
+ break;
858
+ case '3d':
859
+ $transactionTypes = array('threedsecure_validate_authentication', 'threedsecure_authorization_request');
860
+ break;
861
+ case 'hps':
862
+ $transactionTypes = array('query');
863
+ break;
864
+ default:
865
+ throw new InvalidArgumentException(
866
+ "Invalid transaction type supplied {$type}"
867
+ );
868
+ }
869
+ if (!in_array($method, $transactionTypes)) {
870
+ throw new InvalidArgumentException(
871
+ "Invalid transaction method supplied {$method}"
872
+ );
873
+ }
874
+ }
875
+
876
+ /**
877
+ * Internal method to validate the method value to be sent in the HCC request
878
+ *
879
+ * @return void
880
+ * @throws InvalidArgumentException
881
+ * @author Hilary Boyce
882
+ **/
883
+ protected function _validateHPSMethod($method, $type)
884
+ {
885
+ $expectedMethods = array(
886
+ 'hcc' => 'setup',
887
+ 'hps' => 'setup_full'
888
+ );
889
+
890
+ if (!isset($expectedMethods[$type])){
891
+ throw new InvalidArgumentException(
892
+ "Invalid type supplied {$type}"
893
+ );
894
+ }
895
+ if($expectedMethods[$type] !== $method) {
896
+ throw new InvalidArgumentException(
897
+ "Invalid method supplied {$method}"
898
+ );
899
+ }
900
+ }
901
+
902
+ /**
903
+ * Internal method to validate urls
904
+ *
905
+ * @return void
906
+ * @throws InvalidArgumentException
907
+ * @author Hilary Boyce
908
+ **/
909
+ protected function _validateUrl($url)
910
+ {
911
+ if (!Zend_Uri::check($url)){
912
+ throw new InvalidArgumentException(
913
+ "Invalid url supplied {$url}"
914
+ );
915
+ }
916
+ }
917
+
918
+ /**
919
+ * Internal method to validate dynamic data
920
+ *
921
+ * @return void
922
+ * @throws InvalidArgumentException
923
+ * @author Hilary Boyce
924
+ **/
925
+ protected function _validateDynamicDataItem($entry)
926
+ {
927
+ if (strlen($entry) > 2048){
928
+ throw new InvalidArgumentException(
929
+ "Invalid dynamic data entry supplied"
930
+ );
931
+ }
932
+ }
933
+
934
+ /**
935
+ * Internal method to validate purchase description
936
+ *
937
+ * @return void
938
+ * @throws InvalidArgumentException
939
+ * @author Hilary Boyce
940
+ **/
941
+ protected function _validatePurchaseDesc($desc)
942
+ {
943
+ $length = strlen($desc);
944
+ if ($length < 1 || $length > 125){
945
+ throw new InvalidArgumentException(
946
+ "Invalid purchase description entry supplied"
947
+ );
948
+ }
949
+ }
950
+
951
+ /**
952
+ * Internal method to validate purchase date
953
+ *
954
+ * @return void
955
+ * @throws InvalidArgumentException
956
+ * @author Hilary Boyce
957
+ **/
958
+ protected function _validatePurchaseDatetime($datetime)
959
+ {
960
+ ;
961
+ if(Zend_Date::isDate(trim($datetime))){
962
+ throw new InvalidArgumentException("Invalid date entry supplied {$datetime}");
963
+ }
964
+ }
965
+
966
+ /**
967
+ * Internal method to validate browser parameters
968
+ *
969
+ * @return void
970
+ * @throws InvalidArgumentException
971
+ * @author Hilary Boyce
972
+ */
973
+ protected function _validateBrowser($browser)
974
+ {
975
+ if(!is_array($browser) || count($browser)!= 3){
976
+ throw new InvalidArgumentException(
977
+ "Invalid number of browser parameters supplied"
978
+ );
979
+ }
980
+ if(!isset($browser['device_category'])|| ($browser['device_category'] < 0 || $browser['device_category'] > 1)){
981
+ throw new InvalidArgumentException(
982
+ "Invalid/missing browser device category"
983
+ );
984
+ }
985
+ if(!isset($browser['accept_headers']) || strlen($browser['accept_headers']) == 0){
986
+ throw new InvalidArgumentException(
987
+ "Invalid/missing browser device accept headers"
988
+ );
989
+ }
990
+ if(!isset($browser['user_agent']) || strlen($browser['user_agent']) == 0){
991
+ throw new InvalidArgumentException(
992
+ "Invalid/missing browser device user agent"
993
+ );
994
+ }
995
+ }
996
+
997
+ /**
998
+ * Internal method to validate postcode length
999
+ *
1000
+ * @return void
1001
+ * @throws InvalidArgementExeption
1002
+ * @author Hilary Boyce
1003
+ */
1004
+ protected function _validatePostcode($postcode)
1005
+ {
1006
+ if(strlen($postcode) > 9){
1007
+ throw new InvalidArgumentException(
1008
+ "Invalid postcode {$postcode}"
1009
+ );
1010
+ }
1011
+ }
1012
+
1013
+ /**
1014
+ * Internal method to validate cv2 number
1015
+ *
1016
+ * @return void
1017
+ * @throws InvalidArgementExeption
1018
+ * @author Hilary Boyce
1019
+ */
1020
+ protected function _validateCv2($cv2)
1021
+ {
1022
+ if(!preg_match('/^[0-9]{3,4}$/', $cv2)){
1023
+ throw new InvalidArgumentException(
1024
+ "Invalid Cv2 number {$cv2}"
1025
+ );
1026
+ }
1027
+ }
1028
+
1029
+ /**
1030
+ * Internal method to validate policy
1031
+ *
1032
+ * @param string $policy
1033
+ * @return void
1034
+ * @throws InvalidArgementExeption
1035
+ * @author Hilary Boyce
1036
+ */
1037
+ protected function _validatePolicy($policy)
1038
+ {
1039
+ $validPolicies = array('1', '2', '3', '5', '6', '7');
1040
+ if(!in_array($policy, $validPolicies)){
1041
+ throw new InvalidArgumentException(
1042
+ "Invalid policy {$policy}"
1043
+ );
1044
+ }
1045
+ }
1046
+
1047
+ /**
1048
+ * Internal method to validate extended policy
1049
+ *
1050
+ * @param string $policy
1051
+ * @return void
1052
+ * @throws InvalidArgementExeption
1053
+ * @author Hilary Boyce
1054
+ */
1055
+ protected function _validateExtendedPolicy($policy)
1056
+ {
1057
+ $expectedElements = array('cv2_policy', 'postcode_policy', 'address_policy');
1058
+ $expectedAttributes = array('notprovided', 'notchecked','matched', 'notmatched', 'partialmatch');
1059
+ $expectedValues = array('accept', 'reject');
1060
+
1061
+ //check they are the expected elements
1062
+ $actualElements = array_keys($policy);
1063
+ foreach($expectedElements as $element){
1064
+ if(!in_array($element,$actualElements)){
1065
+ throw new InvalidArgumentException(
1066
+ "Invalid extended policy elements"
1067
+ );
1068
+ }
1069
+ }
1070
+ foreach($policy as $key => $element){
1071
+ if(!is_array($element)){
1072
+ throw new InvalidArgumentException(
1073
+ "Invalid extended policy attributes"
1074
+ );
1075
+ }
1076
+ $actualAttributes = array_keys($element);
1077
+ foreach($expectedAttributes as $attribute){
1078
+ if(!in_array($attribute, $actualAttributes)){
1079
+ throw new InvalidArgumentException(
1080
+ "Invalid extended policy attributes"
1081
+ );
1082
+ }
1083
+ }
1084
+ foreach($element as $name => $value){
1085
+ if(!in_array($value, $expectedValues)){
1086
+ throw new InvalidArgumentException(
1087
+ "Invalid policy attribute"
1088
+ );
1089
+ }
1090
+ }
1091
+
1092
+
1093
+ }
1094
+ }
1095
+ }
app/code/community/DataCash/Dpg/Model/Datacash/Response.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Datacash_Response extends Varien_Object
30
+ {
31
+ /**
32
+ * Was the transaction successfully transmitted to DataCash
33
+ * for processing
34
+ *
35
+ * @return bool
36
+ * @author Alistair Stead
37
+ **/
38
+ public function isSuccessful()
39
+ {
40
+ if ($this->getStatus() == DataCash_Dpg_Model_Code::SUCCESS) {
41
+ return true;
42
+ }
43
+ return false;
44
+ }
45
+
46
+ /**
47
+ * Was the transaction judged to be fraudulent
48
+ *
49
+ * @return bool
50
+ * @author Alistair Stead
51
+ **/
52
+ public function isFraud()
53
+ {
54
+ if ($this->getStatus() == DataCash_Dpg_Model_Code::FRAUD) {
55
+ return true;
56
+ }
57
+ return false;
58
+ }
59
+
60
+ /**
61
+ * Does the payment transaction require review
62
+ *
63
+ * @return bool
64
+ * @author Alistair Stead
65
+ **/
66
+ public function isReviewRequired()
67
+ {
68
+ // This should be implemented in phase 2 when ReD is implemented
69
+ return false;
70
+ }
71
+
72
+ /**
73
+ * Proxy method to obtain the requently required response authcode
74
+ * from the complex data structure
75
+ *
76
+ * @return string
77
+ * @author Alistair Stead
78
+ **/
79
+ public function getAuthCode()
80
+ {
81
+ $cardTxn = $this->getData('CardTxn');
82
+
83
+ return (isset($cardTxn['authcode']))? $cardTxn['authcode'] : '';
84
+ }
85
+
86
+ /**
87
+ * Proxy method to obtain the frequently required CV2 response message
88
+ * from the complex data structure
89
+ *
90
+ * @return string
91
+ * @author Alistair Stead
92
+ **/
93
+ public function getCv2AvsStatus()
94
+ {
95
+ $cardTxn = $this->getData('CardTxn');
96
+
97
+ $response = (isset($cardTxn['Cv2Avs']['cv2avs_status']))? $cardTxn['Cv2Avs']['cv2avs_status'] : '';
98
+
99
+ return (is_array($response))? $response[0] : $response;
100
+ }
101
+
102
+ /**
103
+ * Proxy method to obtain the frequently required CV2 response message
104
+ * from the complex data structure
105
+ *
106
+ * @return array
107
+ * @author Alistair Stead
108
+ **/
109
+ public function getCv2Avs()
110
+ {
111
+ $cardTxn = $this->getData('CardTxn');
112
+
113
+ return (isset($cardTxn['Cv2Avs']))? $cardTxn['Cv2Avs'] : array();
114
+ }
115
+
116
+ /**
117
+ * Internal method to validate extended policy
118
+ * @return array
119
+ */
120
+ public function t3mToMappedArray($mapping)
121
+ {
122
+ $data = $this->getData();
123
+ if (!isset($data['The3rdManRealtime'])) {
124
+ return array();
125
+ }
126
+ $data = $data['The3rdManRealtime'];
127
+ $t3m = array();
128
+ foreach ($mapping as $i => $j) {
129
+ if (isset($data[$j])) {
130
+ $t3m[$i] = $data[$j];
131
+ }
132
+ }
133
+ return $t3m;
134
+ }
135
+ }
app/code/community/DataCash/Dpg/Model/Dpg.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Dpg extends Mage_Core_Model_Abstract
30
+ {
31
+
32
+
33
+ }
34
+
app/code/community/DataCash/Dpg/Model/Entity/Setup.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup
30
+ {
31
+
32
+
33
+ }
34
+
app/code/community/DataCash/Dpg/Model/Method/Abstract.php ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ abstract class DataCash_Dpg_Model_Method_Abstract extends Mage_Payment_Model_Method_Cc
30
+ {
31
+ /**
32
+ * Member variable that will hold reference to the API broker.
33
+ *
34
+ * The broker class will handle all the external calls
35
+ *
36
+ * @var string
37
+ **/
38
+ protected $_api;
39
+
40
+ protected $_config;
41
+
42
+ /**
43
+ *
44
+ * @return DataCash_Dpg_Model_Method_Hcc
45
+ */
46
+ public function __construct($params = array())
47
+ {
48
+ parent::__construct($params);
49
+
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * getMethodAuthoriseStartUrl
55
+ * @return string url for placeform action for redirection to Datacash
56
+ */
57
+ public function getMethodAuthoriseStartUrl()
58
+ {
59
+ return Mage::getUrl('checkout/hosted/start', array('_secure' => true));
60
+ }
61
+
62
+ /**
63
+ * Check if current quote is multishipping
64
+ */
65
+ protected function _isMultishippingCheckout() {
66
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
67
+ return false;
68
+ }
69
+
70
+ return (bool) Mage::getSingleton('checkout/session')->getQuote()->getIsMultiShipping();
71
+ }
72
+
73
+ public function hasAdvancedVerification()
74
+ {
75
+ $configData = $this->getConfigData('useccv_advanced');
76
+ if(is_null($configData)){
77
+ return false;
78
+ }
79
+ return (bool) $configData;
80
+ }
81
+
82
+ /**
83
+ *
84
+ * Gets Extended policy from config.
85
+ * @returns array $extendedPolicy
86
+ * @author Hilary Boyce
87
+ */
88
+ protected function _extendedPolicy()
89
+ {
90
+ $extendedPolicy = array(
91
+ 'cv2_policy' => array(
92
+ 'notprovided' => $this->getConfigData('extpol_cv2policy_notprovided'),
93
+ 'notchecked' => $this->getConfigData('extpol_cv2policy_notchecked'),
94
+ 'matched' => $this->getConfigData('extpol_cv2policy_matched'),
95
+ 'notmatched' => $this->getConfigData('extpol_cv2policy_notmatched'),
96
+ 'partialmatch' => $this->getConfigData('extpol_cv2policy_partialmatch')
97
+ ),
98
+ 'postcode_policy' => array(
99
+ 'notprovided' => $this->getConfigData('extpol_postcode_notprovided'),
100
+ 'notchecked' => $this->getConfigData('extpol_postcode_notchecked'),
101
+ 'matched' => $this->getConfigData('extpol_postcode_matched'),
102
+ 'notmatched' => $this->getConfigData('extpol_postcode_notmatched'),
103
+ 'partialmatch' => $this->getConfigData('extpol_postcode_partialmatch')
104
+ ),
105
+ 'address_policy' => array(
106
+ 'notprovided' => $this->getConfigData('extpol_address_notprovided'),
107
+ 'notchecked' => $this->getConfigData('extpol_address_notchecked'),
108
+ 'matched' => $this->getConfigData('extpol_address_matched'),
109
+ 'notmatched' => $this->getConfigData('extpol_address_notmatched'),
110
+ 'partialmatch' => $this->getConfigData('extpol_address_partialmatch')
111
+ )
112
+ );
113
+ return $extendedPolicy;
114
+ }
115
+
116
+ public function setApi($value)
117
+ {
118
+ $this->_api = $value;
119
+ }
120
+
121
+ /**
122
+ * Void the payment
123
+ *
124
+ * @param Varien_Object $payment
125
+ * @return DataCash_Dpg_Model_Method_Api
126
+ * @author Alistair Stead
127
+ */
128
+ public function void(Varien_Object $payment)
129
+ {
130
+ parent::void($payment);
131
+ $this->cancel($payment);
132
+
133
+ return $this;
134
+ }
135
+
136
+ /**
137
+ * Refund the payment
138
+ *
139
+ * @param Varien_Object $payment
140
+ * @param string $amount
141
+ * @return void
142
+ * @author Alistair Stead
143
+ */
144
+ public function refund(Varien_Object $payment, $amount)
145
+ {
146
+ parent::refund($payment, $amount);
147
+ $this->_initApi();
148
+ $this->_mapRequestDataToApi($payment, $amount);
149
+ try {
150
+ $this->_api->callTxnRefund();
151
+ } catch (Exception $e) {
152
+ Mage::throwException($e->getMessage());
153
+ }
154
+ // Process the response
155
+ $response = $this->_api->getResponse();
156
+ if ($response->isSuccessful()) {
157
+ $payment->setTransactionId($response->getDatacashReference())
158
+ ->setShouldCloseParentTransaction(false)
159
+ ->setIsTransactionClosed(false);
160
+ } else {
161
+ Mage::throwException($response->getReason());
162
+ }
163
+
164
+ return $this;
165
+ }
166
+
167
+ /**
168
+ * Cancel payment
169
+ *
170
+ * @param Mage_Sales_Model_Order_Payment $payment
171
+ * @return Mage_Paypal_Model_Direct
172
+ * @author Alistair Stead
173
+ */
174
+ public function cancel(Varien_Object $payment)
175
+ {
176
+ parent::cancel($payment);
177
+ $this->_initApi();
178
+ $this->_mapRequestDataToApi($payment, null);
179
+ try {
180
+ $this->_api->callCancel();
181
+ } catch (Exception $e) {
182
+ Mage::throwException($e->getMessage());
183
+ }
184
+ // Process the response
185
+ $response = $this->_api->getResponse();
186
+ if ($response->isSuccessful()) {
187
+ $payment->setTransactionId($response->getDatacashReference())
188
+ ->setShouldCloseParentTransaction(true)
189
+ ->setIsTransactionClosed(true);
190
+ } else {
191
+ Mage::throwException($response->getReason());
192
+ }
193
+
194
+ return $this;
195
+ }
196
+
197
+ /**
198
+ * Attempt to accept a pending payment
199
+ *
200
+ * @param Mage_Sales_Model_Order_Payment $payment
201
+ * @return bool
202
+ * @author Alistair Stead
203
+ */
204
+ public function acceptPayment(Mage_Payment_Model_Info $payment)
205
+ {
206
+ // Add method body (Phase 2 requirement)
207
+ parent::acceptPayment($payment);
208
+
209
+ return $this;
210
+ }
211
+
212
+ /**
213
+ * Attempt to deny a pending payment
214
+ *
215
+ * @param Mage_Sales_Model_Order_Payment $payment
216
+ * @return bool
217
+ * @author Alistair Stead
218
+ */
219
+ public function denyPayment(Mage_Payment_Model_Info $payment)
220
+ {
221
+ // Add method body (Phase 2 requirement)
222
+ parent::denyPayment($payment);
223
+
224
+ return $this;
225
+ }
226
+
227
+ /**
228
+ * Fetch transaction details info
229
+ *
230
+ * @param Mage_Payment_Model_Info $payment
231
+ * @param string $transactionId
232
+ * @return array
233
+ * @author Alistair Stead
234
+ */
235
+ public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
236
+ {
237
+ // Add method body (Phase 2 requirement)
238
+ parent::fetchTransactionInfo($payment, $transactionId);
239
+
240
+ return $this;
241
+ }
242
+
243
+ /**
244
+ * Return datacash config instance
245
+ *
246
+ * @return DataCash_Dpg_Model_Config
247
+ */
248
+ public function getConfig()
249
+ {
250
+ return Mage::getSingleton('dpg/config');
251
+ }
252
+
253
+ /**
254
+ * Decrypt and return the Merchant password for the DataCash gateway
255
+ *
256
+ * @return string
257
+ * @author Alistair Stead
258
+ **/
259
+ protected function _getApiPassword()
260
+ {
261
+ // Decrypt the marchant password in order to transmit it as part of the request
262
+ return Mage::helper('core')->decrypt($this->getConfigData('merchant_password'));
263
+ }
264
+
265
+ /**
266
+ * Return the Merchant ID for the DataCash gateway
267
+ *
268
+ * @return string
269
+ * @author Alistair Stead
270
+ **/
271
+ protected function _getApiMerchantId()
272
+ {
273
+ return $this->getConfigData('merchant_id');
274
+ }
275
+
276
+ /**
277
+ * Initialize the data required be the API across all methods
278
+ *
279
+ * @return void
280
+ * @author Alistair Stead
281
+ **/
282
+ protected function _initApi()
283
+ {
284
+ if (is_null($this->_api)) {
285
+ $this->_api = Mage::getModel('dpg/api_direct');
286
+ }
287
+ $this->_api->setMerchantId($this->_getApiMerchantId());
288
+ $this->_api->setMerchantPassword($this->_getApiPassword());
289
+ }
290
+
291
+ /**
292
+ * Get an order number within different cart contexts
293
+ *
294
+ * @return int
295
+ * @author Alistair Stead
296
+ **/
297
+ protected function _getOrderNumber($object = null)
298
+ {
299
+ if ($this->_isPlaceOrder($object)) {
300
+ if ($object === NULL) {
301
+ $object = $this->getInfoInstance()->getOrder();
302
+ }
303
+ return $object->getIncrementId();
304
+ } else {
305
+ if ($object === NULL) {
306
+ $object = $this->getInfoInstance()->getQuote();
307
+ }
308
+ if (!$object->getReservedOrderId()) {
309
+ $object->reserveOrderId();
310
+ }
311
+ return $object->getReservedOrderId();
312
+ }
313
+ }
314
+
315
+ /**
316
+ * Grand total getter
317
+ *
318
+ * @return string
319
+ */
320
+ protected function _getAmount()
321
+ {
322
+ $info = $this->getInfoInstance();
323
+ if ($this->_isPlaceOrder()) {
324
+ return (double)$info->getOrder()->getQuoteBaseGrandTotal();
325
+ } else {
326
+ return (double)$info->getQuote()->getBaseGrandTotal();
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Currency code getter
332
+ *
333
+ * @return string
334
+ */
335
+ protected function _getCurrencyCode()
336
+ {
337
+ $info = $this->getInfoInstance();
338
+
339
+ if ($this->_isPlaceOrder()) {
340
+ return $info->getOrder()->getBaseCurrencyCode();
341
+ } else {
342
+ return $info->getQuote()->getBaseCurrencyCode();
343
+ }
344
+ }
345
+
346
+ /**
347
+ * Whether current operation is order placement
348
+ *
349
+ * @return bool
350
+ */
351
+ protected function _isPlaceOrder($object = null)
352
+ {
353
+ if ($object !== null) {
354
+ if ($object instanceof Mage_Sales_Model_Quote) {
355
+ return false;
356
+ } elseif ($object instanceof Mage_Sales_Model_Order) {
357
+ return true;
358
+ }
359
+ } else {
360
+ $info = $this->getInfoInstance();
361
+ if ($info instanceof Mage_Sales_Model_Quote_Payment) {
362
+ return false;
363
+ } elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
364
+ return true;
365
+ }
366
+ }
367
+ }
368
+
369
+ /**
370
+ * Map data supplied by the request to the API
371
+ *
372
+ * This method will set all possible data no exceptions will be thrown even if data is missing
373
+ * If the data is not supplied the error will be thrown by the API
374
+ *
375
+ * @return void
376
+ * @author Alistair Stead
377
+ **/
378
+ protected function _mapRequestDataToApi($payment, $amount)
379
+ {
380
+ $order = $payment->getOrder();
381
+ $orderId = $this->_getOrderNumber();
382
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
383
+
384
+ $this->_api->setCustomerForename($customer->getFirstname());
385
+ $this->_api->setCustomerSurname($customer->getLastname());
386
+ $this->_api->setCustomerEmail($customer->getEmail());
387
+ // Set the object properties required to make the API call
388
+ $this->_api->setOrderNumber($orderId);
389
+ $this->_api->setAmount($amount);
390
+ $this->_api->setCurrency($order->getBaseCurrencyCode());
391
+ $this->_api->setAddress($order->getShippingAddress());
392
+ $this->_api->setBillingAddress($order->getBillingAddress());
393
+ $this->_api->setShippingAddress($order->getShippingAddress());
394
+ $this->_api->setShippingAmount($order->getShippingAmount());
395
+ $this->_api->setShippingVatRate($order->getShippingVatPercent());
396
+ if ($order->getCustomerIsGuest()) {
397
+ $customerId = 'guest';
398
+ } else {
399
+ $customerId = $order->getCustomerId();
400
+ }
401
+ $this->_api->setCustomerCode($customerId);
402
+ // add order line items
403
+ $this->_api->setCartItems($order->getAllVisibleItems());
404
+ // Add historic details
405
+ $this->_api->setDataCashReference($payment->getCcTransId());
406
+ $this->_api->setAuthCode($payment->getCcApproval());
407
+ $centinel = $this->getCentinelValidator();
408
+ if ($centinel) {
409
+ $state = $centinel->getValidationState();
410
+ if ($state) {
411
+ $bypass3DSecure = $state->getLookupBypass3dsecure();
412
+ $this->_api->setBypass3dsecure($bypass3DSecure);
413
+ if (!$bypass3DSecure) {
414
+ $this->_api->setMpiReference($state->getAuthenticateTransactionId());
415
+ }
416
+ }
417
+ }
418
+
419
+ }
420
+
421
+ /**
422
+ * Protected method that will manage the transfer of data between the to objects
423
+ *
424
+ * @return void
425
+ * @author Alistair Stead
426
+ **/
427
+ protected function _mapResponseToPayment($response, $payment)
428
+ {
429
+ $additionalInformationMap = array(
430
+ 'cc_avs_address_result' => 'CardTxn/Cv2Avs/address_result/0',
431
+ 'cc_avs_cv2_result' => 'CardTxn/Cv2Avs/cv2_result/0',
432
+ 'cc_avs_postcode_result' => 'CardTxn/Cv2Avs/postcode_result/0',
433
+ 'acs_url' => 'CardTxn/ThreeDSecure/acs_url',
434
+ 'pareq_message' => 'CardTxn/ThreeDSecure/pareq_message',
435
+ 'mode' => 'mode'
436
+ );
437
+ foreach ($additionalInformationMap as $paymentKey => $responseKey) {
438
+ if ($value = $response->getData($responseKey)) {
439
+ $payment->setAdditionalInformation($paymentKey, $value);
440
+ }
441
+ }
442
+ $responseMap = array(
443
+ 'cc_avs_status' => 'CardTxn/Cv2Avs/cv2avs_status',
444
+ 'cc_approval' => 'CardTxn/authcode',
445
+ 'cc_trans_id' => 'datacash_reference',
446
+ 'cc_status' => 'status',
447
+ 'cc_status_description' => 'reason',
448
+ );
449
+ foreach ($responseMap as $paymentKey => $responseKey) {
450
+ if ($value = $response->getData($responseKey)) {
451
+ $payment->setData($paymentKey, $value);
452
+ }
453
+ }
454
+ $responseTransactionInfoMap = array(
455
+ 'CardTxn' => 'CardTxn',
456
+ 'datacash_reference' => 'datacash_refrence',
457
+ 'mode' => 'mode',
458
+ 'reason' => 'reason',
459
+ 'status' => 'status',
460
+ 'time' => 'time',
461
+ 'authcode' => 'CardTxn/authcode',
462
+ );
463
+ foreach ($responseTransactionInfoMap as $paymentKey => $responseKey) {
464
+ if ($value = $response->getData($responseKey)) {
465
+ $payment->setTransactionAdditionalInfo($paymentKey, $value);
466
+ }
467
+ }
468
+ if ($response->isFraud()) {
469
+ $payment->setIsFraudDetected();
470
+ }
471
+ $datacashReferenceMap = array(
472
+ 'datacash_reference',
473
+ 'QueryTxnResult/datacash_reference'
474
+ );
475
+ foreach ($datacashReferenceMap as $responseKey) {
476
+ if ($value = $response->getData($responseKey)) {
477
+ $payment->setTransactionId($value)
478
+ ->setShouldCloseParentTransaction(false)
479
+ ->setIsTransactionClosed(false);
480
+ }
481
+ }
482
+
483
+ }
484
+
485
+ protected function _getCentinelValidator($service)
486
+ {
487
+ $validator = Mage::getSingleton($service);
488
+ $validator
489
+ ->setIsModeStrict($this->getConfigData('centinel_is_mode_strict'))
490
+ ->setCustomApiEndpointUrl($this->getConfigData('centinel_api_url'))
491
+ ->setCode($this->getCode())
492
+ ->setStore($this->getStore())
493
+ ->setIsPlaceOrder($this->_isPlaceOrder());
494
+
495
+ return $validator;
496
+ }
497
+ }
app/code/community/DataCash/Dpg/Model/Method/Api.php ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Method_Api extends DataCash_Dpg_Model_Method_Abstract
30
+ {
31
+ protected $_code = 'datacash_api';
32
+ protected $_formBlockType = 'dpg/form_api';
33
+ protected $_infoBlockType = 'payment/info_cc';
34
+
35
+ /**
36
+ * Payment Method features
37
+ * @var bool
38
+ */
39
+ protected $_isGateway = true;
40
+ protected $_canOrder = true;
41
+ protected $_canAuthorize = true;
42
+ protected $_canCapture = true;
43
+ protected $_canCapturePartial = true;
44
+ protected $_canRefund = true;
45
+ protected $_canRefundInvoicePartial = true;
46
+ protected $_canVoid = true;
47
+ protected $_canUseInternal = true;
48
+ protected $_canUseCheckout = true;
49
+ protected $_canUseForMultishipping = true;
50
+ protected $_isInitializeNeeded = false;
51
+ protected $_canFetchTransactionInfo = true;
52
+ protected $_canReviewPayment = true;
53
+ protected $_canCreateBillingAgreement = true;
54
+ protected $_canManageRecurringProfiles = true;
55
+ protected $_canCancelInvoice = false;
56
+
57
+ public function assignData($data)
58
+ {
59
+ parent::assignData($data);
60
+ $info = $this->getInfoInstance();
61
+ $info->setAdditionalData($data->getCcTransId());
62
+ $info->setCcTransId($data->getCcTransId());
63
+ return $this;
64
+ }
65
+
66
+ public function reviewPayment($payment)
67
+ {
68
+ }
69
+
70
+ protected $_t3mRecommendation = null;
71
+
72
+ /**
73
+ * Authorise the payment
74
+ *
75
+ * @param Varien_Object $payment
76
+ * @param string $amount
77
+ * @return DataCash_Dpg_Model_Method_Api
78
+ * @author Alistair Stead
79
+ */
80
+ public function authorize(Varien_Object $payment, $amount)
81
+ {
82
+ parent::authorize($payment, $amount);
83
+ $this->_initApi();
84
+ $this->_mapRequestDataToApi($payment, $amount);
85
+ $order = $payment->getOrder();
86
+ try {
87
+ $this->_api->callPre();
88
+ $t3mResponse = $this->_api->getResponse()->t3MToMappedArray(array(
89
+ 't3m_score' => 'score',
90
+ 't3m_recommendation' => 'recommendation'));
91
+ Mage::dispatchEvent('datacash_dpg_t3m_response', $t3mResponse);
92
+ } catch (Exception $e) {
93
+ Mage::throwException($e->getMessage());
94
+ }
95
+
96
+ // Process the response
97
+ $response = $this->_api->getResponse();
98
+ if ($response->isSuccessful()) {
99
+ // Map data to the payment
100
+ $this->_mapResponseToPayment($response, $payment);
101
+ } else {
102
+ Mage::throwException($response->getReason());
103
+ }
104
+
105
+ if ($this->getConfig()->getIsAllowedT3m()) {
106
+ $t3mPaymentInfo = array('Release', 'Hold', 'Reject', 9 => 'Under Investigation');
107
+ $t3mPaymentResponse = $t3mResponse;
108
+ $t3mPaymentResponse['t3m_recommendation'] = $t3mPaymentInfo[$t3mResponse['t3m_recommendation']];
109
+ $this->_t3mRecommendation = $t3mPaymentResponse['t3m_recommendation'];
110
+ $oldInfo = $payment->getAdditionalInformation();
111
+ $newInfo = array_merge($oldInfo, $t3mPaymentResponse);
112
+ $payment->setAdditionalInformation($newInfo);
113
+
114
+ if ($this->_t3mRecommendation != 'Release') {
115
+ $payment->setIsTransactionPending(true);
116
+ if ('Reject' == $this->_t3mRecommendation) {
117
+ $payment->setIsFraudDetected(true);
118
+ }
119
+ }
120
+ }
121
+
122
+
123
+ return $this;
124
+ }
125
+
126
+ /**
127
+ * Capture the payment
128
+ *
129
+ * @param Varien_Object $payment
130
+ * @param string $amount
131
+ * @return DataCash_Dpg_Model_Method_Api
132
+ * @author Alistair Stead
133
+ */
134
+ public function capture(Varien_Object $payment, $amount)
135
+ {
136
+ $authTransaction = $payment->getAuthorizationTransaction();
137
+ $fulfill = (bool) $authTransaction;
138
+ if (!$fulfill && $payment->getId()) {
139
+ $collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
140
+ ->setOrderFilter($payment->getOrder())
141
+ ->addPaymentIdFilter($payment->getId())
142
+ ->addTxnTypeFilter(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
143
+ $fulfill = $collection->count();
144
+ }
145
+
146
+ if ($this->getConfig()->getIsAllowedT3m()) {
147
+ // Must preauth card first (if not already done so) to make third
148
+ // man realtime check.
149
+ if (!array_intersect_key($payment->getAdditionalInformation(), array('t3m_score'=>1, 't3m_recommendation'=>1))) {
150
+ $this->authorize($payment, $amount);
151
+
152
+ if ($this->_t3mRecommendation != 'Release') {
153
+ return $this;
154
+ }
155
+
156
+ $fulfill = true;
157
+ }
158
+ if ($this->_t3mRecommendation == 'Release') {
159
+ $this->_api->setRequest(Mage::getModel('dpg/datacash_request'));
160
+ $this->_api->getRequest()->addAuthentication($this->_api->getMerchantId(), $this->_api->getMerchantPassword());
161
+
162
+ $payment->setAmountAuthorized($amount);
163
+ }
164
+ }
165
+ parent::capture($payment, $amount);
166
+ $this->_initApi();
167
+ $this->_mapRequestDataToApi($payment, $amount);
168
+
169
+ // If the payment has already been authorized we need to only call fulfill
170
+ if ($fulfill && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() >= $amount) {
171
+ try {
172
+ $this->_api->callFulfill();
173
+ } catch (Exception $e) {
174
+ Mage::throwException($e->getMessage());
175
+ }
176
+ } else if ($fulfill && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() < $amount) {
177
+ throw new Exception('This card has not been authorized for this amount');
178
+ } else {
179
+ try {
180
+ $this->_api->callAuth();
181
+ } catch (Exception $e) {
182
+ Mage::throwException($e->getMessage());
183
+ }
184
+ }
185
+
186
+ // Process the response
187
+ $response = $this->_api->getResponse();
188
+ if ($response->isSuccessful()) {
189
+ $this->_mapResponseToPayment($response, $payment);
190
+ } else {
191
+ Mage::throwException($response->getReason());
192
+ }
193
+
194
+ return $this;
195
+ }
196
+
197
+ /**
198
+ * Attempt to accept a pending payment
199
+ *
200
+ * @param Mage_Sales_Model_Order_Payment $payment
201
+ * @return bool
202
+ */
203
+ public function acceptPayment(Mage_Payment_Model_Info $payment)
204
+ {
205
+ $tid = $payment->getLastTransId();
206
+ $inv;
207
+ foreach ($payment->getOrder()->getInvoiceCollection() as $invoice) {
208
+ if ($invoice->getTransactionId() == $tid) {
209
+ $invoice->load($invoice->getId()); // to make sure all data will properly load (maybe not required)
210
+ $inv = $invoice;
211
+ break;
212
+ }
213
+ }
214
+ if ($this->getConfig()->getIsAllowedT3m()) {
215
+ $this->_t3mRecommendation = 'Release';
216
+ }
217
+ $this->_initApi();
218
+ //$payment->capture($inv);
219
+ $inv->capture();
220
+ $inv->save();
221
+ $payment->getOrder()->save();
222
+ //$this->capture($payment, $inv->getBaseGrandTotal());
223
+ parent::acceptPayment($payment, $payment->getGrandTotal());
224
+ }
225
+
226
+ /**
227
+ * Overload the parent validation method
228
+ *
229
+ * This method is overloaded to allow the validation to be turned
230
+ * off during testing as the DataCash magic numbers do not pass the validation
231
+ *
232
+ * @return Mage_Payment_Model_Abstract
233
+ **/
234
+ public function validate()
235
+ {
236
+ // Mage-Test is being used to test this module. It is not required in the production
237
+ // environment. This variable is only set during testing
238
+ if (isset($_SERVER['MAGE_TEST'])) {
239
+ return $this;
240
+ }
241
+
242
+ parent::validate();
243
+ return $this;
244
+ }
245
+
246
+ /**
247
+ * Overload the parent method getCanCapturePartial
248
+ *
249
+ * If the basket items have been sent you must capture the full amount
250
+ *
251
+ * @return bool
252
+ * @author Alistair Stead
253
+ **/
254
+ public function getCanCapturePartial()
255
+ {
256
+ if (parent::getCanCapturePartial() && !$this->getConfigData('line_items_enabled')) {
257
+ return true;
258
+ }
259
+
260
+ return false;
261
+ }
262
+
263
+ /**
264
+ * Overload the parent method getCanRefundInvoicePartial
265
+ *
266
+ * If the basket items have been sent you must refund the full amount
267
+ *
268
+ * @return bool
269
+ * @author Alistair Stead
270
+ **/
271
+ public function getCanRefundInvoicePartial()
272
+ {
273
+ return true;
274
+ if (parent::getCanRefundInvoicePartial() && !$this->getConfigData('line_items_enabled')) {
275
+ return true;
276
+ }
277
+
278
+ return false;
279
+ }
280
+
281
+
282
+ /**
283
+ * Format the supplied dates to be sent to the API
284
+ *
285
+ * @return string 00/00
286
+ * @author Alistair Stead
287
+ **/
288
+ protected function _formatDate($month, $year)
289
+ {
290
+ return sprintf(
291
+ '%02d/%02d',
292
+ substr($month, -2, 2),
293
+ substr($year, -2, 2)
294
+ );
295
+ }
296
+
297
+ /**
298
+ * undocumented function
299
+ *
300
+ * @return void
301
+ * @author Alistair Stead
302
+ **/
303
+ protected function _initApi()
304
+ {
305
+ parent::_initApi();
306
+ // Set the sandboxed state
307
+ $this->_api->setIsSandboxed($this->getConfig()->isMethodSandboxed($this->getCode()));
308
+ $this->_api->setEndpoint($this->getConfig()->getEndpoint($this->getCode()));
309
+
310
+ // Set if CV2 data should be transmitted
311
+ $this->_api->setIsUseCcv($this->getConfig()->isUseCcv($this->getCode()));
312
+ // If extended policy required, set it up.
313
+ if ($this->getConfig()->isUseAdvancedCcv($this->getCode())){
314
+ $this->_api->setIsUseExtendedCv2(true);
315
+ $this->_api->setCv2ExtendedPolicy($this->_extendedPolicy());
316
+ }
317
+ $this->_api->setIsUse3d($this->getIsCentinelValidationEnabled());
318
+ // Set if line items should be transmitted
319
+ $this->_api->setIsLineItemsEnabled($this->getConfig()->isLineItemsEnabled($this->getCode()));
320
+ }
321
+
322
+ /**
323
+ * Map data supplied by the request to the API
324
+ *
325
+ * This method will set all possible data no exceptions will be thrown even if data is missing
326
+ * If the data is not supplied the error will be thrown by the API
327
+ *
328
+ * @return void
329
+ * @author Alistair Stead
330
+ **/
331
+ protected function _mapRequestDataToApi($payment, $amount)
332
+ {
333
+ parent::_mapRequestDataToApi($payment, $amount);
334
+ $order = $payment->getOrder();
335
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
336
+ // Set the object properties required to make the API call
337
+ $this->_api
338
+ ->setCreditCardNumber($payment->getCcNumber())
339
+ ->setCreditCardExpirationDate(
340
+ $this->_formatDate(
341
+ $payment->getCcExpMonth(),
342
+ $payment->getCcExpYear()
343
+ )
344
+ )
345
+ ->setCreditCardCvv2($payment->getCcCid())
346
+ ->setMaestroSoloIssueNumber($payment->getCcSsIssue());
347
+ // Add the additional SM card details
348
+ if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) {
349
+ $this->_api->setMaestroSoloIssueDate(
350
+ $this->_formatDate(
351
+ $payment->getCcSsStartMonth(),
352
+ $payment->getCcSsStartYear()
353
+ )
354
+ );
355
+ }
356
+
357
+ if ($this->getConfig()->getIsAllowedT3m()) {
358
+ $this->_api->setForename($customer->getFirstName());
359
+ $this->_api->setSurname($customer->getLastName());
360
+ $this->_api->setCustomerEmail($customer->getEmail());
361
+ $remoteIp = $order->getRemoteIp()? $order->getRemoteIp(): $order->getQuote()->getRemoteIp();
362
+ $this->_api->setRemoteIp($remoteIp);
363
+ $this->_api->setOrderItems($order->getAllItems());
364
+
365
+ $orders = Mage::getModel('sales/order')
366
+ ->getCollection()
367
+ ->addAttributeToSelect('*')
368
+ ->addFieldToFilter('customer_id', $customer->getId())
369
+ ->setOrder('created_at', 'asc');
370
+ $previousOrderTotal = 0;
371
+ foreach ($orders as $order) {
372
+ $previousOrderTotal += $order->getData('grand_total');
373
+ }
374
+
375
+ $this->_api->setPreviousOrders(array(
376
+ 'count' => count($orders->getData()),
377
+ 'total' => $previousOrderTotal,
378
+ 'first' => $orders->getSize() > 0?
379
+ substr($orders->getFirstItem()->getCreatedAt(), 0, 10) : NULL
380
+ ));
381
+ }
382
+ }
383
+
384
+ /**
385
+ * Instantiate centinel validator model
386
+ *
387
+ * @return Mage_Centinel_Model_Service
388
+ */
389
+ public function getCentinelValidator()
390
+ {
391
+ return $this->_getCentinelValidator('dpg/service_direct');
392
+ }
393
+
394
+ /**
395
+ * Whether centinel service is enabled
396
+ *
397
+ * @return bool
398
+ */
399
+ public function getIsCentinelValidationEnabled()
400
+ {
401
+ return false !== Mage::getConfig()->getNode('modules/Mage_Centinel') && 1 == $this->getConfigData('centinel');
402
+ }
403
+ }
app/code/community/DataCash/Dpg/Model/Method/Apiprereg.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+ class DataCash_Dpg_Model_Method_Apiprereg extends DataCash_Dpg_Model_Method_Abstract
29
+ {
30
+ protected $_code = 'datacash_apiprereg';
31
+ protected $_formBlockType = 'dpg/form_apiprereg';
32
+ protected $_infoBlockType = 'payment/info_cc';
33
+
34
+ /**
35
+ * Payment Method features
36
+ * @var bool
37
+ */
38
+ protected $_isGateway = true;
39
+ protected $_canOrder = true;
40
+ protected $_canAuthorize = true;
41
+ protected $_canCapture = true;
42
+ protected $_canCapturePartial = true;
43
+ protected $_canRefund = true;
44
+ protected $_canRefundInvoicePartial = true;
45
+ protected $_canVoid = true;
46
+ protected $_canUseInternal = true;
47
+ protected $_canUseCheckout = true;
48
+ protected $_canUseForMultishipping = true;
49
+ protected $_isInitializeNeeded = false;
50
+ protected $_canFetchTransactionInfo = true;
51
+ protected $_canReviewPayment = true;
52
+ protected $_canCreateBillingAgreement = true;
53
+ protected $_canManageRecurringProfiles = true;
54
+ protected $_canCancelInvoice = false;
55
+
56
+ public function assignData($data)
57
+ {
58
+ parent::assignData($data);
59
+ $info = $this->getInfoInstance();
60
+ $info->setAdditionalData($data->getCcTransId());
61
+ $info->setCcTransId($data->getCcTransId());
62
+ return $this;
63
+ }
64
+ /**
65
+ * Initialize the data required be the API across all methods
66
+ *
67
+ * @return void
68
+ * @author Alistair Stead
69
+ **/
70
+ protected function _initApi()
71
+ {
72
+ if (is_null($this->_api)) {
73
+ $this->_api = Mage::getModel('dpg/api_directprereg');
74
+ }
75
+ $this->_api->setMerchantId($this->_getApiMerchantId());
76
+ $this->_api->setMerchantPassword($this->_getApiPassword());
77
+
78
+ $this->_api->setIsSandboxed($this->getConfig()->isMethodSandboxed($this->getCode()));
79
+ }
80
+
81
+ /**
82
+ * Authorise the payment
83
+ *
84
+ * @param Varien_Object $payment
85
+ * @param string $amount
86
+ * @return DataCash_Dpg_Model_Method_Api
87
+ * @author Alistair Stead
88
+ */
89
+ public function authorize(Varien_Object $payment, $amount)
90
+ {
91
+ parent::authorize($payment, $amount);
92
+ $this->_initApi();
93
+ $this->_mapRequestDataToApi($payment, $amount);
94
+ try {
95
+ $this->_api->callPre();
96
+ } catch (Exception $e) {
97
+ Mage::throwException($e->getMessage());
98
+ }
99
+ // Process the response
100
+ $response = $this->_api->getResponse();
101
+ if ($response->isSuccessful()) {
102
+ // Map data to the payment
103
+ $this->_mapResponseToPayment($response, $payment);
104
+ } else {
105
+ Mage::throwException($response->getReason());
106
+ }
107
+
108
+ return $this;
109
+ }
110
+
111
+ public function getCentinelValidator()
112
+ {
113
+ return $this->_getCentinelValidator('dpg/service_directprereg');
114
+ }
115
+
116
+ public function getCentinelValidationData()
117
+ {
118
+ // Transaction ID returned from service is stored in cc_trans_id property.
119
+ // Transaction ID submitted in form is stored in additional_data property.
120
+ $data = parent::getCentinelValidationData();
121
+ $transid = $this->getInfoInstance()->getAdditionalData();
122
+ if (!is_numeric($transid)) {
123
+ Mage::throwException('DataCash Transaction ID not a numeric string');
124
+ }
125
+ $data->setDataCashCardReference($transid);
126
+ return $data;
127
+ }
128
+
129
+ protected function _mapRequestDataToApi($payment, $amount)
130
+ {
131
+ parent::_mapRequestDataToApi($payment, $amount);
132
+ // Set the object properties required to make the API call
133
+ $transid = $payment->getAdditionalData();
134
+ $this->_api->setDataCashCardReference($transid);
135
+ }
136
+
137
+ /**
138
+ * Capture the payment
139
+ *
140
+ * @param Varien_Object $payment
141
+ * @param string $amount
142
+ * @return DataCash_Dpg_Model_Method_Api
143
+ * @author Alistair Stead
144
+ */
145
+ public function capture(Varien_Object $payment, $amount)
146
+ {
147
+ parent::capture($payment, $amount);
148
+ $order = $payment->getOrder();
149
+ $authTransaction = $payment->getAuthorizationTransaction();
150
+ $this->_initApi();
151
+ $this->_mapRequestDataToApi($payment, $amount);
152
+ // If the payment has already been authorized we need to only call fullfill
153
+ if ($authTransaction && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() >= $amount) {
154
+ try {
155
+ $this->_api->callFulfill();
156
+ } catch (Exception $e) {
157
+ Mage::throwException($e->getMessage());
158
+ }
159
+ } else if ($authTransaction && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() < $amount) {
160
+ throw new Exception('This card has not been authorized for this amount');
161
+ } else {
162
+ try {
163
+ $this->_api->callAuth();
164
+ } catch (Exception $e) {
165
+ Mage::throwException($e->getMessage());
166
+ }
167
+ }
168
+
169
+ // Process the response
170
+ $response = $this->_api->getResponse();
171
+ if ($response->isSuccessful()) {
172
+ $this->_mapResponseToPayment($response, $payment);
173
+ } else {
174
+ Mage::throwException($response->getReason());
175
+ }
176
+
177
+ return $this;
178
+ }
179
+ /**
180
+ * Overload the parent validation method
181
+ *
182
+ * This method is overloaded to allow the validation to be turned
183
+ * off during testing as the DataCash magic numbers do not pass the validation
184
+ *
185
+ * @return Mage_Payment_Model_Abstract
186
+ **/
187
+ public function validate()
188
+ {
189
+ // Mage-Test is being used to test this module. It is not required in the production
190
+ // environment. This variable is only set during testing
191
+ if (isset($_SERVER['MAGE_TEST'])) {
192
+ return $this;
193
+ }
194
+
195
+ if ($this->getIsCentinelValidationEnabled()) {
196
+ $this->getCentinelValidator()->validate($this->getCentinelValidationData());
197
+ }
198
+
199
+ return $this;
200
+ }
201
+ }
app/code/community/DataCash/Dpg/Model/Method/Hcc.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Method_Hcc
30
+ extends DataCash_Dpg_Model_Method_Hosted_Abstract
31
+ {
32
+ protected $_code = 'datacash_hcc';
33
+ protected $_formBlockType = 'dpg/form_iframe';
34
+ protected $_infoBlockType = 'dpg/info_hcc';
35
+ protected $_config = null;
36
+ protected $_api = null;
37
+
38
+ /**
39
+ * Payment Method features
40
+ * @var bool
41
+ */
42
+ protected $_isGateway = true;
43
+ protected $_canOrder = true;
44
+ protected $_canAuthorize = true;
45
+ protected $_canCapture = true;
46
+ protected $_canCapturePartial = true;
47
+ protected $_canRefund = true;
48
+ protected $_canRefundInvoicePartial = true;
49
+ protected $_canVoid = true;
50
+ protected $_canUseInternal = true;
51
+ protected $_canUseCheckout = true;
52
+ protected $_canUseForMultishipping = true;
53
+ protected $_isInitializeNeeded = false;
54
+ protected $_canFetchTransactionInfo = true;
55
+ protected $_canReviewPayment = true;
56
+ protected $_canCreateBillingAgreement = true;
57
+ protected $_canManageRecurringProfiles = true;
58
+
59
+ /**
60
+ * Initialize the data required by the API
61
+ *
62
+ * @return void
63
+ * @author Hilary Boyce
64
+ **/
65
+ protected function _initApi()
66
+ {
67
+ if (is_null($this->_api)) {
68
+ $this->_api = Mage::getModel('dpg/api_hcc');
69
+ }
70
+ $this->_api->setMerchantId($this->_getApiMerchantId());
71
+ $this->_api->setMerchantPassword($this->_getApiPassword());
72
+
73
+ $this->_api->setIsSandboxed($this->getConfig()->isMethodSandboxed($this->getCode()));
74
+ // Set if CV2 data should be transmitted
75
+ $this->_api->setIsUseCcv($this->hasVerification());
76
+ if ($this->hasAdvancedVerification()) {
77
+ $this->_api->setIsUseExtendedCv2(true);
78
+ $this->_api->setCv2ExtendedPolicy($this->_extendedPolicy());
79
+ }
80
+ $this->_api->setIsUse3d($this->getIsCentinelValidationEnabled());
81
+ // Set if line items should be transmitted
82
+ $this->_api->setIsLineItemsEnabled($this->getConfig()->isLineItemsEnabled($this->getCode()));
83
+ }
84
+
85
+ /**
86
+ * initSession
87
+ * Initialise session with DataCash for HCC
88
+ *
89
+ * @param Mage_Sales_Model_Quote $quote
90
+ * @author Hilary Boyce
91
+ */
92
+ public function initSession(Mage_Sales_Model_Quote $quote)
93
+ {
94
+ $quote->setReservedOrderId(null);
95
+ $orderId = $this->_getOrderNumber($quote);
96
+ $returnUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'checkout/hosted/complete/';
97
+
98
+ $this->_initApi();
99
+ // Set the object properties required to make the API call
100
+ $this->_api->setOrderNumber($orderId)
101
+ ->setAmount($quote->getBaseGrandTotal())
102
+ ->setCurrency($quote->getBaseCurrencyCode())
103
+ ->setReturnUrl($returnUrl)
104
+ ->setExpiryUrl($returnUrl)
105
+ ->setPageSetId($this->getConfigData('page_set_id'));
106
+ // Make the API call
107
+ try {
108
+ $this->_api->setUpHccSession();
109
+ } catch (Exception $e) {
110
+ Mage::throwException($e->getMessage());
111
+ }
112
+
113
+ // Process the response
114
+ $response = $this->_api->getResponse();
115
+ if ($response->isSuccessful()) {
116
+ // Set the data returned from the response for later use
117
+ $datacashSession = array(
118
+ 'HpsUrl' => $response->getData('HpsTxn/hps_url'),
119
+ 'SessionId' => $response->getData('HpsTxn/session_id'),
120
+ 'DatacashReference' => $response->getDatacashReference(),
121
+ );
122
+ $session = $this->_getDataCashSession();
123
+ $session->setData($this->_code . '_session', $datacashSession);
124
+ } else {
125
+ Mage::throwException($response->getReason());
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Authorise the payment
131
+ *
132
+ * @param Varien_Object $payment
133
+ * @param string $amount
134
+ * @return DataCash_Dpg_Model_Method_Api
135
+ * @author Alistair Stead, Norbert Nagy
136
+ */
137
+ public function authorize(Varien_Object $payment, $amount)
138
+ {
139
+ parent::authorize($payment, $amount);
140
+ $this->_initApi();
141
+ $this->_mapRequestDataToApi($payment, $amount);
142
+ try {
143
+ if ($this->hasVerification() && $this->getIsCentinelValidationEnabled()) {
144
+ //if both CCV verification and 3D secure check is turned on, we just have to authorize the previous calls
145
+ $validator = $this->getCentinelValidator();
146
+ $this->_api->call3DAuthorization($validator);
147
+ } else {
148
+ $this->_api->callPre();
149
+ }
150
+ } catch (Exception $e) {
151
+ Mage::throwException($e->getMessage());
152
+ }
153
+ // Process the response
154
+ $response = $this->_api->getResponse();
155
+ if ($response->isSuccessful()) {
156
+ // Map data to the payment
157
+ $this->_mapResponseToPayment($response, $payment);
158
+ } else {
159
+ Mage::throwException($response->getReason());
160
+ }
161
+
162
+ return $this;
163
+ }
164
+
165
+ /**
166
+ * Capture the payment
167
+ *
168
+ * @param Varien_Object $payment
169
+ * @param string $amount
170
+ * @return DataCash_Dpg_Model_Method_Api
171
+ * @author Alistair Stead, Norbert Nagy
172
+ */
173
+ public function capture(Varien_Object $payment, $amount)
174
+ {
175
+ parent::capture($payment, $amount);
176
+ $order = $payment->getOrder();
177
+ $authTransaction = $payment->getAuthorizationTransaction();
178
+ $this->_initApi();
179
+ $this->_mapRequestDataToApi($payment, $amount);
180
+
181
+ // If the payment has already been authorized we need to only call fullfill
182
+ if ($authTransaction && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() >= $amount) {
183
+ try {
184
+ $this->_api->callFulfill();
185
+ } catch (Exception $e) {
186
+ Mage::throwException($e->getMessage());
187
+ }
188
+ } else if ($authTransaction && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() < $amount) {
189
+ throw new Exception('This card has not been authorized for this amount');
190
+ } else {
191
+ try {
192
+ if ($this->hasVerification() && $this->getIsCentinelValidationEnabled()) {
193
+ //if both CCV verification and 3D secure check is turned on, we just have to authorize the previous calls
194
+ $validator = $this->getCentinelValidator();
195
+ $this->_api->call3DAuthorization($validator);
196
+ } else {
197
+ $this->_api->callAuth();
198
+ }
199
+ } catch (Exception $e) {
200
+ Mage::throwException($e->getMessage());
201
+ }
202
+ }
203
+
204
+ // Process the response
205
+ $response = $this->_api->getResponse();
206
+ if ($response->isSuccessful()) {
207
+ $this->_mapResponseToPayment($response, $payment);
208
+ } else {
209
+ Mage::throwException($response->getReason());
210
+ }
211
+
212
+ return $this;
213
+ }
214
+
215
+ /**
216
+ * Instantiate centinel validator model
217
+ *
218
+ * @return Mage_Centinel_Model_Service
219
+ */
220
+ public function getCentinelValidator()
221
+ {
222
+ $validator = Mage::getSingleton('dpg/service_hcc');
223
+ $validator
224
+ ->setIsModeStrict($this->getConfigData('centinel_is_mode_strict'))
225
+ ->setCustomApiEndpointUrl($this->getConfigData('centinel_api_url'))
226
+ ->setCode($this->getCode())
227
+ ->setStore($this->getStore())
228
+ ->setIsPlaceOrder($this->_isPlaceOrder())
229
+ ->setIsUseCcv($this->hasVerification());
230
+
231
+ if ($this->hasAdvancedVerification()) {
232
+ $validator->setIsUseExtendedCv2(true)
233
+ ->setCv2ExtendedPolicy($this->_extendedPolicy());
234
+ }
235
+ return $validator;
236
+ }
237
+ }
app/code/community/DataCash/Dpg/Model/Method/Hosted/Abstract.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ abstract class DataCash_Dpg_Model_Method_Hosted_Abstract
30
+ extends DataCash_Dpg_Model_Method_Abstract
31
+ implements DataCash_Dpg_Model_Method_Hosted_Interface
32
+ {
33
+ /**
34
+ * @var Varien_Object
35
+ */
36
+ protected $_dataCashSession = null;
37
+
38
+ /**
39
+ * Overload the parent validation method
40
+ * This method is overloaded to allow the validation to be turned off
41
+ * as card validation not required in magento for HCC
42
+ *
43
+ * @return DataCash_Dpg_Model_Method_Abstract
44
+ * @author Hilary Boyce
45
+ **/
46
+ public function validate()
47
+ {
48
+ //This must be after all validation conditions
49
+ if ($this->getIsCentinelValidationEnabled()) {
50
+ $this->getCentinelValidator()->validate($this->getCentinelValidationData());
51
+ }
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * Set the data cash session storage
57
+ *
58
+ * @param Varien_Object $value
59
+ */
60
+ public function setDataCashSession($value)
61
+ {
62
+ $this->_dataCashSession = $value;
63
+
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Get the DataCash session storage.
69
+ *
70
+ * @return Varien_Object
71
+ */
72
+ protected function _getDataCashSession()
73
+ {
74
+ if ($this->_dataCashSession === null) {
75
+ $this->_dataCashSession = Mage::getSingleton('checkout/session');
76
+ }
77
+ return $this->_dataCashSession;
78
+ }
79
+
80
+ /**
81
+ * Map data supplied by the request to the API
82
+ *
83
+ * This method will set all possible data no exceptions will be thrown even if data is missing
84
+ * If the data is not supplied the error will be thrown by the API
85
+ *
86
+ * @return void
87
+ * @author Andy Thompson
88
+ **/
89
+ protected function _mapRequestDataToApi($payment, $amount)
90
+ {
91
+ parent::_mapRequestDataToApi($payment, $amount);
92
+
93
+ $session = $this->_getDataCashSession();
94
+ $datacashSession = $session->getData($this->_code . '_session');
95
+
96
+ $reference = $datacashSession['DatacashReference'];
97
+ $this->_api->setDataCashCardReference($reference);
98
+ }
99
+
100
+ /**
101
+ * Return data for Centinel validation
102
+ *
103
+ * @return Varien_Object
104
+ */
105
+ public function getCentinelValidationData()
106
+ {
107
+ $session = $this->_getDataCashSession();
108
+ $datacashSession = $session->getData('datacash_hcc_session');
109
+ $info = $this->getInfoInstance();
110
+ $params = new Varien_Object();
111
+ $params
112
+ ->setPaymentMethodCode($this->getCode())
113
+ ->setAmount($this->_getAmount())
114
+ ->setCurrencyCode($this->_getCurrencyCode())
115
+ ->setDataCashCardReference($datacashSession['DatacashReference'])
116
+ ->setOrderNumber($this->_getOrderNumber())
117
+ ->setIsUseCcv($this->hasVerification());
118
+
119
+ if ($this->hasAdvancedVerification()) {
120
+ $params->setIsUseExtendedCv2(true)
121
+ ->setCv2ExtendedPolicy($this->_extendedPolicy());
122
+ }
123
+ return $params;
124
+ }
125
+ }
app/code/community/DataCash/Dpg/Model/Method/Hosted/Interface.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ interface DataCash_Dpg_Model_Method_Hosted_Interface
30
+ {
31
+ /**
32
+ * getMethodAuthoriseStartUrl
33
+ * @return string url for placeform action for redirection to Datacash
34
+ */
35
+ public function getMethodAuthoriseStartUrl();
36
+
37
+ /**
38
+ * _initSession init an API request to DataCash
39
+ * To create a unique session key for the iframe integration
40
+ *
41
+ * @param Mage_Sales_Model_Quote $payment
42
+ * @param float $amount
43
+ * @return void
44
+ */
45
+ public function initSession(Mage_Sales_Model_Quote $payment);
46
+ }
app/code/community/DataCash/Dpg/Model/Method/Hps.php ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Method_Hps
30
+ extends DataCash_Dpg_Model_Method_Hosted_Abstract
31
+ {
32
+ protected $_code = 'datacash_hps';
33
+ protected $_formBlockType = 'dpg/form_iframe';
34
+ protected $_infoBlockType = 'dpg/info_hps';
35
+ protected $_config = null;
36
+ protected $_api = null;
37
+
38
+ /**
39
+ * Payment Method features
40
+ * @var bool
41
+ */
42
+ protected $_isGateway = true;
43
+ protected $_canOrder = true;
44
+ protected $_canAuthorize = true;
45
+ protected $_canCapture = true;
46
+ protected $_canCapturePartial = true;
47
+ protected $_canRefund = true;
48
+ protected $_canRefundInvoicePartial = true;
49
+ protected $_canVoid = true;
50
+ protected $_canUseInternal = true;
51
+ protected $_canUseCheckout = true;
52
+ protected $_canUseForMultishipping = false;
53
+ protected $_isInitializeNeeded = false;
54
+ protected $_canFetchTransactionInfo = false;
55
+ protected $_canReviewPayment = false;
56
+ protected $_canCreateBillingAgreement = false;
57
+ protected $_canManageRecurringProfiles = false;
58
+ protected $_canCancelInvoice = false;
59
+
60
+ /**
61
+ * Initialize the data required by the API
62
+ * @return void
63
+ * @author Hilary Boyce
64
+ **/
65
+ protected function _initApi()
66
+ {
67
+ if (is_null($this->_api)) {
68
+ $this->_api = Mage::getModel('dpg/api_hps');
69
+ }
70
+ $this->_api->setIsSandboxed($this->getConfig()->isMethodSandboxed($this->getCode()));
71
+ $this->_api->setMerchantId($this->_getApiMerchantId());
72
+ $this->_api->setMerchantPassword($this->_getApiPassword());
73
+ }
74
+
75
+ /**
76
+ * initSession init an API request to DataCash
77
+ * To create a unique session key for the iframe integration
78
+ *
79
+ * @param Mage_Sales_Model_Quote $payment
80
+ * @param float $amount
81
+ * @return void
82
+ * @author Hilary Boyce
83
+ * @author Alistair Stead
84
+ */
85
+ public function initSession(Mage_Sales_Model_Quote $quote)
86
+ {
87
+ $helper = Mage::helper('dpg');
88
+ $quote->setReservedOrderId(null);
89
+ $orderId = $this->_getOrderNumber($quote);
90
+ $paymentAction = $this->getConfig()->getPaymentAction('datacash_hps');
91
+
92
+ // The HPS method is using a two-step process, so only authorise the
93
+ // transaction at the payment save step.
94
+ $authMethod = 'pre';
95
+ $returnUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'checkout/hosted/complete/';
96
+ $request = Mage::app()->getRequest();
97
+ $this->_initApi();
98
+ $this->_api->setBaseUrl(Mage::getBaseUrl());
99
+ // Set if CV2 data should be transmitted
100
+ $this->_api->setIsUseCcv($this->getConfigData('useccv'));
101
+ if($this->getConfigData('useccv_advanced')) {
102
+ $this->_api->setIsUseExtendedCv2(true);
103
+ $this->_api->setCv2ExtendedPolicy($this->_extendedPolicy());
104
+ } else {
105
+ $this->_api->setIsUseExtendedCv2(false);
106
+ }
107
+ $this->_api->setIsUse3DSecure($this->getConfigData('use3DSecure'));
108
+ $this->_api->setAmount($quote->getBaseGrandTotal());
109
+ $this->_api->setCurrency($quote->getBaseCurrencyCode());
110
+ $this->_api->setAddress($quote->getShippingAddress());
111
+ $this->_api->setBillingAddress($quote->getBillingAddress());
112
+ $this->_api->setShippingAmount($quote->getShippingAmount());
113
+ $this->_api->setShippingVatRate($quote->getShippingVatPercent());
114
+ if ($quote->getCustomerIsGuest()) {
115
+ $customerId = 'guest';
116
+ } else {
117
+ $customerId = $quote->getCustomer()->getIncrementId();
118
+ }
119
+ $this->_api->setCustomerCode($customerId);
120
+ // Set the object properties required to make the API call
121
+ $this->_api->setOrderNumber($orderId)
122
+ ->setAuthMethod($authMethod)
123
+ ->setReturnUrl($returnUrl)
124
+ ->setExpiryUrl($returnUrl)
125
+ ->setPurchaseDescription('Purchase from ' . Mage::app()->getStore()->getGroup()->getName())
126
+ ->setPurchaseDateTime(date('Ymd H:i:s'))
127
+ ->setBrowserData(
128
+ array(
129
+ 'device_category' => $helper->getDeviceType($request->getHeader('USER_AGENT')),
130
+ 'accept_headers' => $request->getHeader('ACCEPT'),
131
+ 'user_agent' => $request->getHeader('USER_AGENT')
132
+ )
133
+ )
134
+ ->setPageSetId($this->getConfigData('page_set_id'));
135
+ // Make the API call
136
+ try {
137
+ $this->_api->setUpHpsSession();
138
+ } catch (Exception $e) {
139
+ Mage::throwException($e->getMessage());
140
+ }
141
+
142
+ // Process the response
143
+ $response = $this->_api->getResponse();
144
+ if ($response->isSuccessful()) {
145
+ // Set the data returned from the response for later use
146
+ $datacashSession = array(
147
+ 'HpsUrl' => $response->getData('HpsTxn/hps_url'),
148
+ 'SessionId' => $response->getData('HpsTxn/session_id'),
149
+ 'DatacashReference' => $response->getDatacashReference(),
150
+ );
151
+ $session = $this->_getDataCashSession();;
152
+ $session->setData($this->_code . '_session', $datacashSession);
153
+ } else {
154
+ Mage::throwException($response->getReason());
155
+ }
156
+ }
157
+
158
+ /**
159
+ * requestAuthorisation
160
+ * This does the equivalent of the payment authorize method
161
+ * It is called by the HccController after the user has entered card details
162
+ * on the datacash site
163
+ * @param Mage_Sales_Model_Order_Payment $payment
164
+ * @author hilary boyce
165
+ */
166
+ protected function _checkAuthorisation($payment)
167
+ {
168
+ $this->_initApi();
169
+
170
+ $session = $this->_getDataCashSession();
171
+ $datacashSession = $session->getData($this->_code . '_session');
172
+
173
+ $reference = $datacashSession['DatacashReference'];
174
+ // Set the object properties required to make the API call
175
+ $this->_api->setDataCashCardReference($reference);
176
+
177
+ try{
178
+ $this->_api->callTransactionStatus();
179
+ // Find the auth attempts array and make a second call for transaction status
180
+ $authAttempts = $this->_api->getResponse()->getData('HpsTxn/AuthAttempts');
181
+ if (is_array($authAttempts)) {
182
+ foreach ($authAttempts as $attempt) {
183
+ if ($attempt['dc_response'] == 1) {
184
+ unset($this->_api);
185
+ $this->_initApi();
186
+ $this->_api->setDataCashCardReference($attempt['datacash_reference']);
187
+ $this->_api->callTransactionStatus();
188
+ continue;
189
+ }
190
+ }
191
+ }
192
+
193
+ } catch (Exception $e) {
194
+ Mage::throwException($e->getMessage());
195
+ }
196
+ // Process the response
197
+ $response = $this->_api->getResponse();
198
+ if ($response->isSuccessful()) {
199
+ $this->_mapResponseToPayment($response, $payment);
200
+ } else {
201
+ $message = sprintf('Datacash Authorisation Transaction: %s failed: %s ', $reference, $response->getReason());
202
+ Mage::throwException($response->getReason());
203
+ }
204
+ } //requestAuthorisation
205
+
206
+ /**
207
+ * Authorise the payment
208
+ *
209
+ * @param Varien_Object $payment
210
+ * @param string $amount
211
+ * @return DataCash_Dpg_Model_Method_Api
212
+ * @author Andy Thompson
213
+ */
214
+ public function authorize(Varien_Object $payment, $amount)
215
+ {
216
+ $this->_checkAuthorisation($payment);
217
+ parent::authorize($payment, $amount);
218
+
219
+ return $this;
220
+ }
221
+
222
+ /**
223
+ * Capture the payment
224
+ *
225
+ * @param Varien_Object $payment
226
+ * @param string $amount
227
+ * @return DataCash_Dpg_Model_Method_Api
228
+ * @author Andy Thompson
229
+ */
230
+ public function capture(Varien_Object $payment, $amount)
231
+ {
232
+ parent::capture($payment, $amount);
233
+
234
+ $order = $payment->getOrder();
235
+ $authTransaction = $payment->getAuthorizationTransaction();
236
+ $this->_initApi();
237
+ $this->_mapRequestDataToApi($payment, $amount);
238
+
239
+ // If the payment has already been authorized we need to only call fullfill
240
+ if ($authTransaction && $payment->getAmountAuthorized() > 0 && $payment->getAmountAuthorized() < $amount) {
241
+ throw new Exception('This card has not been authorized for this amount');
242
+ } else {
243
+ // if there was no previous Magento authorisation (i.e. capture not
244
+ // at point-of-sale), check the state of the Hps authorisation
245
+ if (!$authTransaction || $payment->getAmountAuthorized() == 0) {
246
+ $this->_checkAuthorisation($payment);
247
+ // reset api and data
248
+ $this->_api = null;
249
+ $this->_initApi();
250
+ $this->_mapRequestDataToApi($payment, $amount);
251
+ }
252
+
253
+ try {
254
+ $this->_api->callFulfill();
255
+ } catch (Exception $e) {
256
+ Mage::throwException($e->getMessage());
257
+ }
258
+ }
259
+
260
+ // Process the response
261
+ $response = $this->_api->getResponse();
262
+ if ($response->isSuccessful()) {
263
+ // Map data to the payment
264
+ $this->_mapResponseToPayment($response, $payment);
265
+ } else {
266
+ Mage::throwException($response->getReason());
267
+ }
268
+
269
+ return $this;
270
+ }
271
+
272
+ /**
273
+ * Protected method that will manage the transfer of data between the to objects
274
+ *
275
+ * @return void
276
+ * @author Alistair Stead
277
+ **/
278
+ protected function _mapResponseToPayment($response, $payment)
279
+ {
280
+ $additionalInformationMap = array(
281
+ 'cc_avs_address_result' => 'QueryTxnResult/Cv2Avs/address_result/0',
282
+ 'cc_avs_cv2_result' => 'QueryTxnResult/Cv2Avs/cv2_result/0',
283
+ 'cc_avs_postcode_result' => 'QueryTxnResult/Cv2Avs/postcode_result/0',
284
+ 'acs_url' => 'QueryTxnResult/ThreeDSecure/acs_url',
285
+ 'pareq_message' => 'QueryTxnResult/ThreeDSecure/pareq_message',
286
+ 'mode' => 'mode',
287
+ Mage_Centinel_Model_Service::CMPI_ECI => 'QueryTxnResult/ThreeDSecure/eci',
288
+ Mage_Centinel_Model_Service::CMPI_CAVV => 'QueryTxnResult/ThreeDSecure/CAVV',
289
+ Mage_Centinel_Model_Service::CMPI_XID => 'QueryTxnResult/ThreeDSecure/XID',
290
+ );
291
+ foreach ($additionalInformationMap as $paymentKey => $responseKey) {
292
+ if ($value = $response->getData($responseKey)) {
293
+ $payment->setAdditionalInformation($paymentKey, $value);
294
+ }
295
+ }
296
+
297
+
298
+ //Determines the Enrolled status and adds it to the additional information object
299
+ if ($cardholderRegistered = $response->getData('QueryTxnResult/ThreeDSecure/cardholder_registered')) {
300
+ $this->_addEnrolledAndParesResult($cardholderRegistered, $payment);
301
+ }
302
+
303
+ $responseMap = array(
304
+ // Hosted payment query
305
+ 'cc_avs_status' => 'QueryTxnResult/Cv2Avs/cv2avs_status',
306
+ 'cc_approval' => 'QueryTxnResult/authcode',
307
+ 'cc_trans_id' => 'QueryTxnResult/datacash_reference',
308
+ 'cc_status' => 'QueryTxnResult/status',
309
+ 'cc_status_description' => 'QueryTxnResult/reason'
310
+ );
311
+ foreach ($responseMap as $paymentKey => $responseKey) {
312
+ if ($value = $response->getData($responseKey)) {
313
+ $payment->setData($paymentKey, $value);
314
+ }
315
+ }
316
+ $responseTransactionInfoMap = array(
317
+ // Hosted payment query
318
+ 'datacash_reference' => 'QueryTxnResult/datacash_refrence',
319
+ 'reason' => 'QueryTxnResult/reason',
320
+ 'status' => 'QueryTxnResult/status',
321
+ 'authcode' => 'CardTxn/authcode'
322
+ );
323
+ foreach ($responseTransactionInfoMap as $paymentKey => $responseKey) {
324
+ if ($value = $response->getData($responseKey)) {
325
+ $payment->setTransactionAdditionalInfo($paymentKey, $value);
326
+ }
327
+ }
328
+ if ($response->isFraud()) {
329
+ $payment->setIsFraudDetected();
330
+ }
331
+ $datacashReferenceMap = array(
332
+ 'datacash_reference',
333
+ 'QueryTxnResult/datacash_reference'
334
+ );
335
+ foreach ($datacashReferenceMap as $responseKey) {
336
+ if ($value = $response->getData($responseKey)) {
337
+ $payment->setTransactionId($value)
338
+ ->setShouldCloseParentTransaction(false)
339
+ ->setIsTransactionClosed(false);
340
+ }
341
+ }
342
+
343
+ }
344
+
345
+ /**
346
+ * Determines the Enrolled status and adds it to the additional information object
347
+ *
348
+ * @param type $cardholderRegistered The value of the QueryTxnResult/ThreeDSecure/cardholder_registered node in the
349
+ * response object
350
+ *
351
+ * @param type $payment
352
+ * @return DataCash_Dpg_Model_Method_Hps
353
+ * @author Norbert Nagy <norbert.nagy@sessiondigital.com>
354
+ */
355
+ private function _addEnrolledAndParesResult($cardholderRegistered, $payment)
356
+ {
357
+ switch ($cardholderRegistered) {
358
+ case 'yes':
359
+ $enrolled = 'Y';
360
+ $pares = 'Y';
361
+ break;
362
+ case 'attempted':
363
+ $enrolled = 'Y';
364
+ $pares = 'A';
365
+ break;
366
+ case 'no':
367
+ $enrolled = 'N';
368
+ $pares = 'N';
369
+ break;
370
+ case 'tx_status_u':
371
+ $enrolled = 'U';
372
+ $pares = 'U';
373
+ break;
374
+ default:
375
+ $enrolled = $value;
376
+ $pares = $value;
377
+ }
378
+
379
+ $payment->setAdditionalInformation(Mage_Centinel_Model_Service::CMPI_ENROLLED, $enrolled);
380
+ $payment->setAdditionalInformation(Mage_Centinel_Model_Service::CMPI_PARES, $pares);
381
+
382
+ return $this;
383
+ }
384
+ }
app/code/community/DataCash/Dpg/Model/Observer.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Observer
30
+ {
31
+
32
+ /**
33
+ * Add DataCash data to info block
34
+ *
35
+ * Add 3D Secure, CV2 amd ReD information so that it can be seen in the admin view
36
+ *
37
+ * @param Varien_Object $observer
38
+ * @return DataCash_Dpg_Model_Observer
39
+ */
40
+ public function paymentInfoBlockPrepareSpecificInformation($observer)
41
+ {
42
+ if ($observer->getEvent()->getBlock()->getIsSecureMode()) {
43
+ return;
44
+ }
45
+
46
+ $payment = $observer->getEvent()->getPayment();
47
+ $transport = $observer->getEvent()->getTransport();
48
+ // var_dump($payment);
49
+ $helper = Mage::helper('dpg');
50
+ $data = array(
51
+ 'cc_trans_id',
52
+ 'cc_approval',
53
+ 'cc_status',
54
+ 'cc_status_description',
55
+ 'cc_avs_status',
56
+ );
57
+ foreach ($data as $key) {
58
+ if ($value = $payment->getData($key)) {
59
+ $transport->setData($helper->getLabel($key), $value);
60
+ }
61
+ }
62
+ $info = array(
63
+ 'cc_avs_address_result',
64
+ 'cc_avs_postcode_result',
65
+ 'cc_avs_cv2_result',
66
+ 'mode',
67
+ 't3m_score',
68
+ 't3m_recommendation'
69
+ );
70
+ foreach ($info as $key) {
71
+ if ($value = $payment->getAdditionalInformation($key)) {
72
+ $transport->setData($helper->getLabel($key), $value);
73
+ }
74
+ }
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * Validate that all the keys of $arr are present in $list.
80
+ * @param array $arr
81
+ * @param array $list
82
+ * @return bool
83
+ */
84
+ private function _arrayKeysInList($arr, $list)
85
+ {
86
+ if (!is_array($arr)) {
87
+ $id = __METHOD__;
88
+ Mage::throwException("$id was expecting an array.");
89
+ }
90
+ return count($arr) === count(array_intersect_key($arr, array_flip($list)));
91
+ }
92
+
93
+ public function saveT3mRecommendationToOrder($data)
94
+ {
95
+ $t3mKeys = array('merchant_identifier', 'order_id', 't3m_id', 't3m_score', 't3m_recommendation');
96
+ $t3mPaymentInfo = array('Release', 'Hold', 'Reject', 9 => 'Under Investigation');
97
+ if ( ! $this->_arrayKeysInList((array)$data['response'], $t3mKeys)) {
98
+ Mage::throwException('Observer' . __METHOD__ . ' was expecting different data.');
99
+ }
100
+ $rsp = (array)$data['response'];
101
+ $orders = Mage::getModel('sales/order')->getCollection();
102
+ $orders->addFieldToFilter('increment_id', $rsp['order_id']);
103
+ $order = $orders->getFirstItem();
104
+ if (!$order->getId()) {
105
+ Mage::throwException(__METHOD__ . ' could not find order ' . $rsp['order_id']);
106
+ }
107
+
108
+ if (Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW != $order->getState()) {
109
+ throw new Exception(
110
+ 'order state was not expected (while expecting it to be payment_review), order id: '
111
+ .$rsp['order_id'].'; '
112
+ .'suggested new recommendation: '.$t3mPaymentInfo[$rsp['t3m_recommendation']]
113
+ );
114
+ }
115
+
116
+ $payment = $order->getPayment();
117
+
118
+ $oldInfo = $payment->getAdditionalInformation();
119
+ $newInfo = array_merge($oldInfo, array(
120
+ 't3m_id' => $rsp['t3m_id'],
121
+ 't3m_score' => $rsp['t3m_score'],
122
+ 't3m_recommendation' => $t3mPaymentInfo[$rsp['t3m_recommendation']],
123
+ ));
124
+ $payment->setAdditionalInformation($newInfo);
125
+
126
+ $order->save();
127
+
128
+ switch($newInfo['t3m_recommendation']) {
129
+ case 'Release':
130
+ $payment->accept();
131
+ $order->save();
132
+ break;
133
+ case 'Reject':
134
+ $payment->setIsFraudDetected(true);
135
+ $payment->deny();
136
+ $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, Mage_Sales_Model_Order::STATUS_FRAUD);
137
+ $order->save();
138
+ break;
139
+ case 'Hold':
140
+ $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true);
141
+ $order->save();
142
+ break;
143
+ default:
144
+ throw new Exception('Unknown response recommendation: '.$rsp['t3m_recommendation']);
145
+ }
146
+ }
147
+
148
+ /**
149
+ * event observer for quote submission, checks for third man response and automatically cancels the payment
150
+ * if the recommendation is reject
151
+ *
152
+ * @param Varien_Event_Observer $observer
153
+ *
154
+ * @return null
155
+ */
156
+ public function afterOrderSubmit(Varien_Event_Observer $observer)
157
+ {
158
+ if (!Mage::getSingleton('dpg/config')->getIsAllowedT3m()) {
159
+ return;
160
+ }
161
+
162
+ $order = $observer->getEvent()->getOrder();
163
+ $payment = $order->getPayment();
164
+
165
+ if (Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW == $order->getState() && $payment->getIsTransactionPending()) {
166
+ $info = $payment->getAdditionalInformation();
167
+ if (isset($info['t3m_recommendation']) && ('Reject' == $info['t3m_recommendation'])) {
168
+ // load new payment to avoid payment::$_transactionsLookup caching of value 'false'
169
+ $loadedPayment = Mage::getModel('sales/order_payment')->load($payment->getId());
170
+ if ($loadedPayment->getId()) {
171
+ $loadedPayment->setOrder($order);
172
+ $loadedPayment->deny();
173
+ $order->save();
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
app/code/community/DataCash/Dpg/Model/Service.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 3D Secure Validation Model
4
+ */
5
+ class DataCash_Dpg_Model_Service extends Mage_Centinel_Model_Service
6
+ {
7
+ /**
8
+ * Return validation api model
9
+ *
10
+ * @return Mage_Centinel_Model_Api
11
+ */
12
+ protected function _getApi()
13
+ {
14
+ if (!is_null($this->_api)) {
15
+ return $this->_api;
16
+ }
17
+
18
+ // Chnage to using the DataCash Direct Api
19
+ $this->_api = Mage::getSingleton('dpg/api_direct');
20
+ $config = $this->_getDpgConfig();
21
+ $this->_api->setMerchantId($config->getApiMerchantId($this->getCode()));
22
+ $this->_api->setMerchantPassword($config->getApiPassword($this->getCode()));
23
+ // Set the sandboxed state
24
+ $this->_api->setIsSandboxed($config->isMethodSandboxed($this->getCode()));
25
+
26
+ $request = Mage::app()->getRequest();
27
+ $this->_api->setBaseUrl(Mage::getBaseUrl())
28
+ ->setPurchaseDescription('Purchase from ' . Mage::app()->getStore()->getGroup()->getName())
29
+ ->setPurchaseDateTime(date('Y-m-d H:i:s'))
30
+ ->setBrowserData(
31
+ array(
32
+ 'device_category' => '0', // TODO set the device category dynamically
33
+ 'accept_headers' => $request->getHeader('ACCEPT'),
34
+ 'user_agent' => $request->getHeader('USER_AGENT')
35
+ )
36
+ );
37
+
38
+ return $this->_api;
39
+ }
40
+
41
+ /**
42
+ * Public accessor for the 3D secure validation state
43
+ *
44
+ * @return Mage_Centinel_Model_StateAbstract
45
+ * @author Alistair Stead
46
+ **/
47
+ public function getValidationState()
48
+ {
49
+ return $this->_validationState;
50
+ }
51
+
52
+ /**
53
+ * Process authenticate validation
54
+ *
55
+ * @param Varien_Object $data
56
+ */
57
+ public function authenticate($data)
58
+ {
59
+ $validationState = $this->_getValidationState();
60
+ if (!$validationState || $data->getTransactionId() != $validationState->getLookupTransactionId()) {
61
+ throw new Exception('Authentication impossible: transaction id or validation state is wrong.');
62
+ }
63
+ $api = $this->_getApi();
64
+ $api->setDataCashReference($data->getTransactionId());
65
+ $api->setParesMessage($data->getPaResPayload());
66
+ try {
67
+ $api->call3DValidAuth();
68
+ } catch (Exception $e) {
69
+ Mage::throwException($e->getMessage());
70
+ }
71
+
72
+ $response = $api->getResponse();
73
+ $result = new Varien_Object();
74
+ // Map the response to the result
75
+ $paResStatus = ($response->getData('CardTxn/ThreeDSecure/cardholder_registered') == 'yes')? 'Y' : 'N';
76
+ $errorNumber = ($response->getStatus() == '1')? '0' : $response->getStatus();
77
+ $result->setPaResStatus($paResStatus);
78
+ $result->setEciFlag($response->getData('CardTxn/ThreeDSecure/eci'));
79
+ $result->setXid($response->getData('CardTxn/ThreeDSecure/xid'));
80
+ $result->setCavv($response->getData('CardTxn/ThreeDSecure/security_code'));
81
+ $result->setErrorNo($errorNumber);
82
+ $result->setSignatureVerification('Y');
83
+ $result->setTransactionId($response->getDatacashReference());
84
+ $result->setReason($response->getReason());
85
+
86
+ $validationState->setAuthenticateResult($result);
87
+ if (!$validationState->isAuthenticateSuccessful()) {
88
+ $this->reset();
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Process lookup validation and init new validation state model
94
+ *
95
+ * @param Varien_Object $data
96
+ */
97
+ public function lookup($data)
98
+ {
99
+ $newChecksum = $this->_generateChecksum(
100
+ $data->getPaymentMethodCode(),
101
+ $data->getCardType(),
102
+ $data->getCardNumber(),
103
+ $data->getCardExpMonth(),
104
+ $data->getCardExpYear(),
105
+ $data->getAmount(),
106
+ $data->getCurrencyCode()
107
+ );
108
+
109
+ $validationState = $this->_initValidationState($data->getCardType(), $newChecksum);
110
+
111
+ $api = $this->_getApi();
112
+ // Map the data onto the API object
113
+ $api->setOrderNumber($data->getOrderNumber())
114
+ ->setAmount($data->getAmount())
115
+ ->setCreditCardNumber($data->getCardNumber())
116
+ ->setCreditCardExpirationDate($this->_formatDate($data->getCardExpMonth(), $data->getCardExpYear()))
117
+ ->setCurrency($data->getCurrencyCode());
118
+ try {
119
+ $api->call3DLookup();
120
+ } catch (Exception $e) {
121
+ Mage::throwException($e->getMessage());
122
+ }
123
+ // Map the response data to the result for the centinel state objects
124
+ $response = $api->getResponse();
125
+ $enrolled = 'U';
126
+ switch ($response->getStatus()) {
127
+ case '150':
128
+ $enrolled = 'Y';
129
+ break;
130
+
131
+ case '162':
132
+ $enrolled = 'N';
133
+ break;
134
+
135
+ default:
136
+ break;
137
+ }
138
+
139
+ $errorNo = ($response->getStatus() == '150')? '0' : $response->getStatus();
140
+ $result = new Varien_Object();
141
+ $result->setAcsUrl($response->getData('CardTxn/ThreeDSecure/acs_url'));
142
+ $result->setPayload($response->getData('CardTxn/ThreeDSecure/pareq_message'));
143
+ $result->setErrorNo($errorNo);
144
+ $result->setErrorDesc($response->getReason());
145
+ $result->setReason($response->getReason());
146
+ $result->setMode($response->getMode());
147
+ $result->setTransactionId($response->getDatacashReference());
148
+ $result->setEnrolled($enrolled);
149
+
150
+ $validationState->setLookupResult($result);
151
+ }
152
+
153
+ /**
154
+ * Return value from section of centinel config
155
+ *
156
+ * @param string $path
157
+ * @return string
158
+ */
159
+ protected function _getDpgConfig()
160
+ {
161
+ $config = Mage::getSingleton('dpg/config');
162
+ return $config->setStore($this->getStore());
163
+ }
164
+
165
+ /**
166
+ * Format the supplied dates to be sent to the API
167
+ *
168
+ * @return string 00/00
169
+ * @author Alistair Stead
170
+ **/
171
+ protected function _formatDate($month, $year)
172
+ {
173
+ return sprintf(
174
+ '%02d/%02d',
175
+ substr($month, -2, 2),
176
+ substr($year, -2, 2)
177
+ );
178
+ }
179
+ }
180
+
app/code/community/DataCash/Dpg/Model/Service/Abstract.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class DataCash_Dpg_Model_Service_Abstract extends Mage_Centinel_Model_Service
3
+ {
4
+ /**
5
+ * The API class to use
6
+ *
7
+ * @var string
8
+ */
9
+ protected $_apiType = 'dpg/api_direct';
10
+
11
+ /**
12
+ * Public accessor for the 3D secure validation state
13
+ *
14
+ * @return Mage_Centinel_Model_StateAbstract
15
+ * @author Alistair Stead
16
+ **/
17
+ public function getValidationState($cardType = null)
18
+ {
19
+ return $this->_validationState;
20
+ }
21
+
22
+ /**
23
+ * Validate payment data
24
+ *
25
+ * This check is performed on payment information submission, as well as on placing order.
26
+ * Workflow state is stored validation state model
27
+ *
28
+ * @param Varien_Object $data
29
+ * @throws Mage_Core_Exception
30
+ */
31
+ public function validate($data)
32
+ {
33
+ $newChecksum = $this->_generateChecksum(
34
+ $data->getPaymentMethodCode(),
35
+ $data->getCardType(),
36
+ $data->getCardNumber(),
37
+ $data->getCardExpMonth(),
38
+ $data->getCardExpYear(),
39
+ $data->getAmount(),
40
+ $data->getCurrencyCode()
41
+ );
42
+
43
+ // $validationState = $this->_getValidationState($data->getCardType());
44
+ $validationState = $this->_getValidationState('datacash');
45
+ if (!$validationState) {
46
+ $this->_resetValidationState();
47
+ return;
48
+ }
49
+
50
+ // check whether is authenticated before placing order
51
+ if ($this->getIsPlaceOrder()) {
52
+ if ($validationState->getChecksum() != $newChecksum) {
53
+ Mage::throwException(Mage::helper('centinel')->__('Payment information error. Please start over.'));
54
+ }
55
+ if ($validationState->isAuthenticateSuccessful()|| $validationState->getLookupBypass3dsecure()) {
56
+ return;
57
+ }
58
+ Mage::throwException(Mage::helper('centinel')->__('Please verify the card with the issuer bank before placing the order.'));
59
+ } else {
60
+ if ($validationState->getChecksum() != $newChecksum || !$validationState->isLookupSuccessful()) {
61
+ $this->lookup($data);
62
+ $validationState = $this->_getValidationState();
63
+ }
64
+ if ($validationState->isLookupSuccessful() || $validationState->getLookupBypass3dsecure()) {
65
+ return;
66
+ }
67
+ Mage::throwException(Mage::helper('centinel')->__('This card has failed validation and cannot be used.'));
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Process authenticate validation
73
+ *
74
+ * @param Varien_Object $data
75
+ */
76
+ public function authenticate($data)
77
+ {
78
+ $validationState = $this->_getValidationState();
79
+ if (!$validationState || $data->getTransactionId() != $validationState->getLookupTransactionId()) {
80
+ throw new Exception('Authentication impossible: transaction id or validation state is wrong.');
81
+ }
82
+ $api = $this->_getApi();
83
+ $api->setDataCashReference($data->getTransactionId());
84
+ $api->setParesMessage($data->getPaResPayload());
85
+ try {
86
+ $api->call3DValidAuth();
87
+ } catch (Exception $e) {
88
+ Mage::throwException($e->getMessage());
89
+ }
90
+
91
+ $response = $api->getResponse();
92
+ if (!$response->isSuccessful()) {
93
+ Mage::throwException($response->getReason());
94
+ }
95
+ $result = new Varien_Object();
96
+ // Map the response to the result
97
+ $paResStatus = ($response->getData('CardTxn/ThreeDSecure/cardholder_registered') == 'yes')? 'Y' : 'N';
98
+ $errorNumber = ($response->getStatus() == '1')? '0' : $response->getStatus();
99
+ $result->setPaResStatus($paResStatus);
100
+ $result->setEciFlag($response->getData('CardTxn/ThreeDSecure/eci'));
101
+ $result->setXid($response->getData('CardTxn/ThreeDSecure/xid'));
102
+ $result->setCavv($response->getData('CardTxn/ThreeDSecure/security_code'));
103
+ $result->setErrorNo($errorNumber);
104
+ $result->setSignatureVerification('Y');
105
+ $result->setTransactionId($response->getDatacashReference());
106
+ $result->setReason($response->getReason());
107
+
108
+ $validationState->setAuthenticateResult($result);
109
+ if (!$validationState->isAuthenticateSuccessful()) {
110
+ $this->reset();
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Return validation api model
116
+ *
117
+ * @return DataCash_Dpg_Model_Api_Abstract
118
+ */
119
+ protected function _getApi()
120
+ {
121
+ if (!is_null($this->_api)) {
122
+ return $this->_api;
123
+ }
124
+ $helper = Mage::helper('dpg');
125
+ // Change to using the DataCash Direct Api
126
+ $this->_api = Mage::getSingleton($this->_apiType);
127
+ $config = $this->_getDpgConfig();
128
+ $this->_api->setMerchantId($config->getApiMerchantId($this->getCode()));
129
+ $this->_api->setMerchantPassword($config->getApiPassword($this->getCode()));
130
+ // Set the sandboxed state
131
+ $this->_api->setIsSandboxed($config->isMethodSandboxed($this->getCode()));
132
+
133
+ $request = Mage::app()->getRequest();
134
+ $this->_api->setBaseUrl(Mage::getBaseUrl())
135
+ ->setPurchaseDescription('Purchase from ' . Mage::app()->getStore()->getGroup()->getName())
136
+ ->setPurchaseDateTime(date('Y-m-d H:i:s'))
137
+ ->setBrowserData(
138
+ array(
139
+ 'device_category' => $helper->getDeviceType($request->getHeader('USER_AGENT')),
140
+ 'accept_headers' => $request->getHeader('ACCEPT'),
141
+ 'user_agent' => $request->getHeader('USER_AGENT')
142
+ )
143
+ );
144
+
145
+ return $this->_api;
146
+ }
147
+
148
+ /**
149
+ * Calls 3-D Secure MPI call and interrogates response.
150
+ * Action depends on configuration for some response values.
151
+ *
152
+ * @param DataCash_Dpg_Model_Api_Abstract $api
153
+ * @param Mage_Centinel_Model_StateAbstract $validationState
154
+ */
155
+ protected function _doLookup($api, $validationState)
156
+ {
157
+ try {
158
+ $api->call3DLookup();
159
+ } catch (Exception $e) {
160
+ Mage::throwException($e->getMessage());
161
+ }
162
+ // Map the response data to the result for the centinel state objects
163
+ $response = $api->getResponse();
164
+
165
+ $enrolled = 'U';
166
+ $continue = false;
167
+ switch ($response->getStatus()) {
168
+ case '150':
169
+ $enrolled = 'Y';
170
+ $continue = true;
171
+ break;
172
+
173
+ case '162':
174
+ $enrolled = 'N';
175
+ break;
176
+ case '159':
177
+ case '160':
178
+ case '173':
179
+ case '187':
180
+ // check if config set to allow processing to continue
181
+ $config = $this->_getDpgConfig();
182
+ $method = $api->getMethod();
183
+ if ($config->continueBehaviour($method, $response->getStatus())){
184
+ $continue = true;
185
+ } else {
186
+ Mage::throwException(sprintf("Unable to authenticate transaction - (%s) %s", $response->getStatus(), $response->getReason()));
187
+ }
188
+ break;
189
+ case '161':
190
+ case '186':
191
+ Mage::throwException(sprintf("Unable to authenticate transaction - (%s) %s", $response->getStatus(), $response->getReason()));
192
+ break;
193
+ default:
194
+ break;
195
+ }
196
+
197
+ $errorNo = ($continue) ? '0' : $response->getStatus();
198
+ $result = new Varien_Object();
199
+
200
+ $result->setAcsUrl($response->getData('CardTxn/ThreeDSecure/acs_url'));
201
+ $result->setPayload($response->getData('CardTxn/ThreeDSecure/pareq_message'));
202
+ $result->setErrorNo($errorNo);
203
+ $result->setErrorDesc($response->getReason());
204
+ $result->setReason($response->getReason());
205
+ $result->setMode($response->getMode());
206
+ $result->setTransactionId($response->getDatacashReference());
207
+ $result->setEnrolled($enrolled);
208
+
209
+ if ($continue && $response->getStatus()!== '150'){
210
+ $result->setBypass3dsecure(true);
211
+ } else {
212
+ $result->setBypass3dsecure(false);
213
+ }
214
+ $validationState->setLookupResult($result);
215
+ }
216
+
217
+ /**
218
+ * Return value from section of centinel config
219
+ *
220
+ * @param string $path
221
+ * @return string
222
+ */
223
+ protected function _getDpgConfig()
224
+ {
225
+ $config = Mage::getSingleton('dpg/config');
226
+ return $config->setStore($this->getStore());
227
+ }
228
+
229
+ /**
230
+ * Format the supplied dates to be sent to the API
231
+ *
232
+ * @return string 00/00
233
+ * @author Alistair Stead
234
+ **/
235
+ protected function _formatDate($month, $year)
236
+ {
237
+ return sprintf(
238
+ '%02d/%02d',
239
+ substr($month, -2, 2),
240
+ substr($year, -2, 2)
241
+ );
242
+ }
243
+ }
app/code/community/DataCash/Dpg/Model/Service/Direct.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Service_Direct extends DataCash_Dpg_Model_Service_Abstract
30
+ {
31
+
32
+ protected function _getValidationStateModel($cardType)
33
+ {
34
+ return Mage::getModel('dpg/service_state_datacash');
35
+ }
36
+
37
+ /**
38
+ * Process lookup validation and init new validation state model
39
+ *
40
+ * @param Varien_Object $data
41
+ */
42
+ public function lookup($data)
43
+ {
44
+ $newChecksum = $this->_generateChecksum(
45
+ $data->getPaymentMethodCode(),
46
+ $data->getCardType(),
47
+ $data->getCardNumber(),
48
+ $data->getCardExpMonth(),
49
+ $data->getCardExpYear(),
50
+ $data->getAmount(),
51
+ $data->getCurrencyCode()
52
+ );
53
+
54
+ $validationState = $this->_initValidationState('datacash', $newChecksum);
55
+
56
+ $api = $this->_getApi();
57
+ // Map the data onto the API object
58
+ $api->setOrderNumber($data->getOrderNumber())
59
+ ->setAmount($data->getAmount())
60
+ ->setCreditCardNumber($data->getCardNumber())
61
+ ->setCreditCardExpirationDate($this->_formatDate($data->getCardExpMonth(), $data->getCardExpYear()))
62
+ ->setDataCashCardReference($data->getDataCashCardReference())
63
+ ->setCurrency($data->getCurrencyCode());
64
+
65
+ $this->_doLookup($api, $validationState);
66
+ }
67
+ }
68
+
app/code/community/DataCash/Dpg/Model/Service/Directprereg.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Service_Directprereg extends DataCash_Dpg_Model_Service_Direct
30
+ {
31
+
32
+ public function __construct()
33
+ {
34
+ $this->_apiType = 'dpg/api_directprereg';
35
+ }
36
+
37
+ /**
38
+ * Validate payment data
39
+ *
40
+ * This check is performed on payment information submission, as well as on placing order.
41
+ * Workflow state is stored validation state model
42
+ *
43
+ * @param Varien_Object $data
44
+ * @throws Mage_Core_Exception
45
+ */
46
+ public function validate($data)
47
+ {
48
+ $newChecksum = $this->_generateChecksum(
49
+ $data->getDataCashCardReference(),
50
+ $data->getAmount(),
51
+ $data->getCurrencyCode(),
52
+ '','','',''
53
+ );
54
+
55
+ $validationState = $this->_getValidationState('datacash');
56
+ if (!$validationState) {
57
+ $this->_resetValidationState();
58
+ return;
59
+ }
60
+
61
+ // check whether is authenticated before placing order
62
+ if ($this->getIsPlaceOrder()) {
63
+ if ($validationState->getChecksum() != $newChecksum) {
64
+ Mage::throwException(Mage::helper('centinel')->__('Payment information error. Please start over.'));
65
+ }
66
+ if ($validationState->isAuthenticateSuccessful() || $validationState->getLookupBypass3dsecure()) {
67
+ return;
68
+ }
69
+ Mage::throwException(Mage::helper('centinel')->__('Please verify the card with the issuer bank before placing the order.'));
70
+ } else {
71
+ if ($validationState->getChecksum() != $newChecksum || !$validationState->isLookupSuccessful()) {
72
+ $this->lookup($data);
73
+ $validationState = $this->_getValidationState();
74
+ }
75
+ if ($validationState->isLookupSuccessful()|| $validationState->getLookupBypass3dsecure()) {
76
+ return;
77
+ }
78
+ Mage::throwException(Mage::helper('centinel')->__('This card has failed validation and cannot be used.'));
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Process lookup validation and init new validation state model
84
+ *
85
+ * @param Varien_Object $data
86
+ */
87
+ public function lookup($data)
88
+ {
89
+ $newChecksum = $this->_generateChecksum(
90
+ $data->getDataCashCardReference(),
91
+ $data->getAmount(),
92
+ $data->getCurrencyCode(),
93
+ '','','',''
94
+ );
95
+
96
+ $validationState = $this->_initValidationState('datacash', $newChecksum);
97
+
98
+ $api = $this->_getApi();
99
+ // Map the data onto the API object
100
+ $api->setOrderNumber($data->getOrderNumber())
101
+ ->setAmount($data->getAmount())
102
+ ->setCreditCardNumber($data->getCardNumber())
103
+ ->setCreditCardExpirationDate($this->_formatDate($data->getCardExpMonth(), $data->getCardExpYear()))
104
+ ->setDataCashCardReference($data->getDataCashCardReference())
105
+ ->setCurrency($data->getCurrencyCode());
106
+
107
+ $this->_doLookup($api, $validationState);
108
+ }
109
+ }
110
+
app/code/community/DataCash/Dpg/Model/Service/Hcc.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Service_Hcc extends DataCash_Dpg_Model_Service_Abstract
30
+ {
31
+ /**
32
+ * The API class to use
33
+ *
34
+ * @var string
35
+ */
36
+ protected $_apiType = 'dpg/api_hcc';
37
+
38
+ /**
39
+ * Create and return validation state model for card type
40
+ *
41
+ * @param string $cardType
42
+ * @return Mage_Centinel_Model_StateAbstract
43
+ */
44
+ protected function _getValidationStateModel($cardType)
45
+ {
46
+ return Mage::getModel('dpg/service_state_datacash');
47
+ }
48
+
49
+ /**
50
+ * Return validation state model
51
+ *
52
+ * @param string $cardType
53
+ * @return Mage_Centinel_Model_StateAbstract
54
+ */
55
+ protected function _getValidationState($cardType = null)
56
+ {
57
+ $model = $this->_getValidationStateModel('datacash');
58
+ $model->setDataStorage($this->_getSession());
59
+ $this->_validationState = $model;
60
+ return $this->_validationState;
61
+ }
62
+
63
+ /**
64
+ * Process authenticate validation
65
+ *
66
+ * @param Varien_Object $data
67
+ * @author Norbert Nagy
68
+ */
69
+ public function authenticate($data)
70
+ {
71
+ if (!$this->getIsUseCcv()) {
72
+ parent::authenticate($data);
73
+ } else {
74
+ $validationState = $this->_getValidationState();
75
+ if (!$validationState || $data->getTransactionId() != $validationState->getLookupTransactionId()) {
76
+ throw new Exception('Authentication impossible: transaction id or validation state is wrong.');
77
+ }
78
+
79
+ $result = new Varien_Object();
80
+ $result->setPaResPayload($data->getPaResPayload());
81
+
82
+ $validationState->setAuthenticateResult($result);
83
+ if (!$validationState->isAuthenticateSuccessful()) {
84
+ $this->reset();
85
+ }
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Validate payment data
91
+ *
92
+ * This check is performed on payment information submission, as well as on placing order.
93
+ * Workflow state is stored validation state model
94
+ *
95
+ * @param Varien_Object $data
96
+ * @throws Mage_Core_Exception
97
+ */
98
+ public function validate($data)
99
+ {
100
+ $newChecksum = $this->_generateChecksum(
101
+ $data->getPaymentMethodCode(),
102
+ $data->getAmount(),
103
+ $data->getDataCashCardReference(),
104
+ null,
105
+ null,
106
+ null,
107
+ null
108
+ );
109
+
110
+ $validationState = $this->_getValidationStateModel('datacash');
111
+ $validationState->setDataStorage($this->_getSession());
112
+ if (!$validationState) {
113
+ $this->_resetValidationState();
114
+ return;
115
+ }
116
+
117
+ // check whether is authenticated before placing order
118
+ if ($this->getIsPlaceOrder()) {
119
+ if ($validationState->getChecksum() != $newChecksum) {
120
+ Mage::throwException(Mage::helper('centinel')->__('Payment information error. Please start over.'));
121
+ }
122
+ } else {
123
+ if ($validationState->getChecksum() != $newChecksum) {
124
+ $this->lookup($data);
125
+ }
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Process lookup validation and init new validation state model
131
+ *
132
+ * @param Varien_Object $data
133
+ */
134
+ public function lookup($data)
135
+ {
136
+ $newChecksum = $this->_generateChecksum(
137
+ $data->getPaymentMethodCode(),
138
+ $data->getAmount(),
139
+ $data->getDataCashCardReference(),
140
+ null,
141
+ null,
142
+ null,
143
+ null
144
+ );
145
+
146
+ $validationState = $this->_initValidationState('datacash', $newChecksum);
147
+
148
+ $api = $this->_getApi();
149
+ // Map the data onto the API object
150
+ $api->setOrderNumber($data->getOrderNumber())
151
+ ->setAmount($data->getAmount())
152
+ ->setDataCashCardReference($data->getDataCashCardReference())
153
+ ->setCurrency($data->getCurrencyCode())
154
+ ->setIsUseCcv($this->getIsUseCcv());
155
+
156
+ if ($data->getIsUseExtendedCv2()) {
157
+ $api->setIsUseExtendedCv2(true)
158
+ ->setCv2ExtendedPolicy($data->getCv2ExtendedPolicy());
159
+ }
160
+
161
+ $this->_doLookup($api, $validationState);
162
+ }
163
+ }
app/code/community/DataCash/Dpg/Model/Service/State/Datacash.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Service_State_Datacash extends Mage_Centinel_Model_StateAbstract
30
+ {
31
+ /**
32
+ * Analyse lookup`s results. If it has require params for authenticate, return true
33
+ *
34
+ * @return bool
35
+ */
36
+ public function isAuthenticateAllowed()
37
+ {
38
+ return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag());
39
+ }
40
+
41
+ /**
42
+ * Analyse lookup`s results. If lookup is strict successful return true
43
+ *
44
+ * @return bool
45
+ */
46
+ protected function _isLookupStrictSuccessful()
47
+ {
48
+ //Test cases 1-5, 11
49
+ if ($this->getLookupEnrolled() == 'Y' &&
50
+ $this->getLookupAcsUrl() != '' &&
51
+ $this->getLookupPayload() != '' &&
52
+ $this->getLookupErrorNo() == '0') {
53
+ return true;
54
+ }
55
+ return false;
56
+ }
57
+
58
+ /**
59
+ * Analyse lookup`s results. If lookup is soft successful return true
60
+ *
61
+ * @return bool
62
+ */
63
+ protected function _isLookupSoftSuccessful()
64
+ {
65
+ $acsUrl = $this->getLookupAcsUrl();
66
+ $payload = $this->getLookupPayload();
67
+ $errorNo = $this->getLookupErrorNo();
68
+ $enrolled = $this->getLookupEnrolled();
69
+
70
+ if ($acsUrl == '' && $payload == '' && $errorNo == '0' && $enrolled == 'N') {
71
+ return true;
72
+ }
73
+
74
+ return false;
75
+ }
76
+
77
+ /**
78
+ * Analyse authenticate`s results. If authenticate is successful return true and false if it failure
79
+ * Result depends from flag self::getIsModeStrict()
80
+ *
81
+ * @return bool
82
+ */
83
+ public function isAuthenticateSuccessful()
84
+ {
85
+ if ($this->_isLookupStrictSuccessful()) {
86
+ return true;
87
+ }
88
+ return false;
89
+ }
90
+ }
app/code/community/DataCash/Dpg/Model/Source/Acceptreject.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Hilary Boyce
23
+ * @version $Id$
24
+ * @copyright DataCash, 30th August, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Source_Acceptreject
30
+ {
31
+ /**
32
+ * Return a list of available options to accept or reject
33
+ *
34
+ * @return array
35
+ * @author Hilary Boyce
36
+ **/
37
+ public function toOptionArray()
38
+ {
39
+ $options = array(array('value' => 'reject',
40
+ 'label' => 'Reject'),
41
+ array('value' => 'accept',
42
+ 'label' => 'Accept')
43
+ );
44
+
45
+
46
+ return $options;
47
+ }
48
+ }
app/code/community/DataCash/Dpg/Model/Source/Authtypes.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Source_Authtypes
30
+ {
31
+ /**
32
+ * Return a list of available authentication types
33
+ *
34
+ * @return array
35
+ * @author Alistair Stead
36
+ **/
37
+ public function toOptionArray()
38
+ {
39
+ foreach (Mage::getSingleton('dpg/config')->getTansactionTypes() as $code => $name) {
40
+ $options[] = array(
41
+ 'value' => $code,
42
+ 'label' => $name
43
+ );
44
+ }
45
+
46
+ return $options;
47
+ }
48
+ }
app/code/community/DataCash/Dpg/Model/Source/Threedstypes.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Hilary Boyce
23
+ * @version $Id$
24
+ * @copyright DataCash, 30th August, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ class DataCash_Dpg_Model_Source_Threedstypes
30
+ {
31
+ /**
32
+ * Return a list of available options for 3DS behaviours
33
+ *
34
+ * @return array
35
+ * @author Hilary Boyce
36
+ **/
37
+ public function toOptionArray()
38
+ {
39
+ $options = array(array('value' => 1,
40
+ 'label' => 'Continue Payment Attempt'),
41
+ array('value' => 0,
42
+ 'label' => 'Fail Payment Attempt')
43
+ );
44
+
45
+
46
+ return $options;
47
+ }
48
+ }
app/code/community/DataCash/Dpg/controllers/HccController.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Stub controller that will handle the Hosted Card Capture return messages
4
+ */
5
+ class DataCash_Dpg_HccController extends DataCash_Dpg_Controller_Abstract
6
+ {
7
+
8
+ /**
9
+ * Get singleton of Checkout Session Model
10
+ *
11
+ * @return Mage_Checkout_Model_Session
12
+ */
13
+ protected function _getCheckout()
14
+ {
15
+ return Mage::getSingleton('checkout/session');
16
+ }
17
+
18
+ /**
19
+ * placeformAction
20
+ * Set up and display forwarding form, takes users to datacash card entry form
21
+ *
22
+ * @author Hilary Boyce
23
+ */
24
+ public function placeformAction()
25
+ {
26
+ $lastIncrementId = $this->_getCheckout()->getLastRealOrderId();
27
+ if ($lastIncrementId) {
28
+ $order = Mage::getModel('sales/order');
29
+ $order->loadByIncrementId($lastIncrementId);
30
+ if ($order->getId()) {
31
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
32
+ Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
33
+ 'The customer was redirected to Datacash HCC.');
34
+ $order->save();
35
+ }
36
+ }
37
+
38
+ $this->_getCheckout()->getQuote()->setIsActive(false)->save();
39
+
40
+ $this->_getCheckout()->setDatacashQuoteId($this->_getCheckout()->getQuoteId());
41
+ $this->_getCheckout()->setDatacashLastSuccessQuoteId($this->_getCheckout()->getLastSuccessQuoteId());
42
+ $this->_getCheckout()->clear();
43
+
44
+ $this->loadLayout();
45
+ $this->renderLayout();
46
+ }
47
+
48
+ /**
49
+ * processAction
50
+ * Called on return from datacash card collection screen. Need to authorise or authorise/capture next
51
+ */
52
+ public function processAction()
53
+ {
54
+ $orderId = $this->getRequest()->getParam('ref');
55
+ $order = Mage::getModel('sales/order');
56
+ $order->loadByIncrementId($orderId);
57
+ $payment = $order->getPayment();
58
+ $method = $payment->getMethodInstance();
59
+ $paymentAction = $this->getConfig()->getPaymentAction('datacash_hcc');
60
+
61
+ try{
62
+ switch(trim($paymentAction)){
63
+ case "authorize":
64
+ $method->requestAuthorisation($payment);
65
+ break;
66
+ case "authorize_capture":
67
+ $method->requestCapture($payment);
68
+ break;
69
+ default:
70
+ Mage::throwException("Invalid payment type: ".$paymentAction);
71
+ }
72
+ $session = $this->_getCheckout();
73
+ $quoteId = $order->getQuoteId();
74
+ $session->setLastSuccessQuoteId($quoteId);
75
+ $this->_redirect('checkout/onepage/success');
76
+ // return;
77
+ } catch (Mage_Core_Exception $e) {
78
+ Mage::log("DataCash_Dpg_HccController::exception ". $e->getMessage());
79
+ $this->_getCheckout()->addError($e->getMessage());
80
+ $order->cancel();
81
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, false, "Failed Datacash HccPayment ". $e->getMessage());
82
+ $order->save();
83
+ $this->_redirect('checkout/cart');
84
+ }
85
+
86
+ }
87
+
88
+ /**
89
+ * expiredAction
90
+ * called from Datacash card collection screen if card collection expired
91
+ *
92
+ * @author Hilary Boyce
93
+ */
94
+ public function expiredAction()
95
+ {
96
+ Mage::log("DataCash_Dpg_HccController::expired ");
97
+ $session = $this->_getCheckout();
98
+ $orderId = $this->getRequest()->getParam('ref');
99
+ $order = Mage::getModel('sales/order');
100
+ $order->loadByIncrementId($orderId);
101
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, 'Datacash Session expired');
102
+
103
+ $quoteId = $order->getQuoteId();
104
+ // set quote active so basket items visible
105
+ if ($quoteId) {
106
+ $quote = Mage::getModel('sales/quote')->load($quoteId);
107
+ if ($quote->getId()) {
108
+ $quote->setIsActive(true)->save();
109
+ $session->setQuoteId($quoteId);
110
+ }
111
+ }
112
+ $session->addError("The Datacash Payment Gateway session has expired, please try again");
113
+ $this->_redirect('checkout/cart');
114
+
115
+ }
116
+
117
+ /**
118
+ * Return payment instance
119
+ * @param Mage_Sales_Model_Order
120
+ *
121
+ */
122
+ protected function _getPayment($order)
123
+ {
124
+ return $order->getPayment();
125
+ }
126
+
127
+ }
app/code/community/DataCash/Dpg/controllers/HostedController.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_HostedController
31
+ *
32
+ * Controller that handles all of the hosted payment processes
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Controller
36
+ * @author Alistair Stead
37
+ */
38
+ class DataCash_Dpg_HostedController extends DataCash_Dpg_Controller_Abstract
39
+ {
40
+
41
+ /**
42
+ * Get singleton of Checkout Session Model
43
+ *
44
+ * @return Mage_Checkout_Model_Session
45
+ */
46
+ protected function _getCheckout()
47
+ {
48
+ return Mage::getSingleton('checkout/session');
49
+ }
50
+
51
+
52
+ /**
53
+ * Action that starts the interation between the DataCash gateway
54
+ *
55
+ * @return void
56
+ * @author Alistair Stead
57
+ **/
58
+ public function startAction()
59
+ {
60
+ $this->loadLayout()->renderLayout();
61
+ }
62
+
63
+ /**
64
+ * completeAction
65
+ * Check the state of the transaction after being called-back from the gateway
66
+ *
67
+ * @author Andy Thompson
68
+ */
69
+ public function completeAction()
70
+ {
71
+ $this->loadLayout()->renderLayout();
72
+ }
73
+ }
app/code/community/DataCash/Dpg/controllers/HpsController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Stub controller that will hande the Hosted Page Service return messages
4
+ */
5
+ class DataCash_Dpg_controllers_HpsController extends DataCash_Dpg_Controller_Abstract
6
+ {
7
+
8
+ }
app/code/community/DataCash/Dpg/controllers/T3mController.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * DataCash_Dpg_T3mController
31
+ *
32
+ * Controller that handles all of the hosted payment processes
33
+ *
34
+ * @package DataCash
35
+ * @subpackage Controller
36
+ * @author David Marrs
37
+ */
38
+ class DataCash_Dpg_T3mController extends DataCash_Dpg_Controller_Abstract
39
+ {
40
+
41
+ public function indexAction()
42
+ {
43
+ $request = $this->getRequest();
44
+ if ($request->isPost()) {
45
+ $config = Mage::getSingleton('dpg/config');
46
+ $response = $this->_map(
47
+ $request,
48
+ array(
49
+ 'merchant_identifier' => 'merchant_identifier',
50
+ 'order_id' => 'merchant_order_ref',
51
+ 't3m_id' => 't3m_id',
52
+ 't3m_score' => 'score',
53
+ 't3m_recommendation' => 'recommendation',
54
+ )
55
+ );
56
+
57
+ if ($config->isMethodDebug('datacash_api')) {
58
+ Mage::getModel('core/log_adapter', 'datacash_api.log')
59
+ ->log($response);
60
+ }
61
+
62
+ try {
63
+ Mage::dispatchEvent(
64
+ 'datacash_dpg_t3m_callback',
65
+ array(
66
+ 'response' => $response
67
+ )
68
+ );
69
+ die('ok');
70
+ } catch (Exception $e) {
71
+ Mage::logException($e);
72
+ }
73
+ }
74
+ die('FAIL');
75
+ }
76
+
77
+ private function _map($request, $indices)
78
+ {
79
+ $t3m = array();
80
+ foreach ($indices as $i => $j) {
81
+ if ($request->getPost($j) !== null) {
82
+ $t3m[$i] = $request->getPost($j);
83
+ }
84
+ }
85
+ return $t3m;
86
+ }
87
+ }
app/code/community/DataCash/Dpg/etc/config.xml ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <DataCash_Dpg>
5
+ <version>1.0.1</version>
6
+ </DataCash_Dpg>
7
+ </modules>
8
+ <global>
9
+ <events>
10
+ <datacash_dpg_t3m_callback>
11
+ <observers>
12
+ <Datacash_dpg_model_api_observer>
13
+ <type>singleton</type>
14
+ <class>DataCash_Dpg_Model_Observer</class>
15
+ <method>saveT3mRecommendationToOrder</method>
16
+ </Datacash_dpg_model_api_observer>
17
+ </observers>
18
+ </datacash_dpg_t3m_callback>
19
+ <checkout_submit_all_after>
20
+ <observers>
21
+ <Datacash_dpg_after_order_submit>
22
+ <type>singleton</type>
23
+ <class>DataCash_Dpg_Model_Observer</class>
24
+ <method>afterOrderSubmit</method>
25
+ </Datacash_dpg_after_order_submit>
26
+ </observers>
27
+ </checkout_submit_all_after>
28
+
29
+ </events>
30
+ <models>
31
+ <dpg>
32
+ <class>DataCash_Dpg_Model</class>
33
+ </dpg>
34
+ </models>
35
+ <blocks>
36
+ <dpg>
37
+ <class>DataCash_Dpg_Block</class>
38
+ </dpg>
39
+ </blocks>
40
+ <helpers>
41
+ <dpg>
42
+ <class>DataCash_Dpg_Helper</class>
43
+ </dpg>
44
+ </helpers>
45
+ <resources>
46
+ <datacash_dpg_setup>
47
+ <setup>
48
+ <module>DataCash_Dpg</module>
49
+ <class>DataCash_Dpg_Model_Entity_Setup</class>
50
+ <connection>
51
+ <use>core_setup</use>
52
+ </connection>
53
+ </setup>
54
+ </datacash_dpg_setup>
55
+ <dpg_write>
56
+ <connection>
57
+ <use>core_write</use>
58
+ </connection>
59
+ </dpg_write>
60
+ <dpg_read>
61
+ <connection>
62
+ <use>core_read</use>
63
+ </connection>
64
+ </dpg_read>
65
+ </resources>
66
+ <datacash>
67
+ <transaction>
68
+ <types>
69
+ <auth>
70
+ <code>authorize</code>
71
+ <name>Authorise</name>
72
+ <order>0</order>
73
+ </auth>
74
+ <pre>
75
+ <code>authorize_capture</code>
76
+ <name>Authorise and Capture</name>
77
+ <order>10</order>
78
+ </pre>
79
+ </types>
80
+ </transaction>
81
+ </datacash>
82
+ </global>
83
+ <frontend>
84
+ <routers>
85
+ <checkout>
86
+ <args>
87
+ <modules>
88
+ <dpg before="Mage_Checkout">DataCash_Dpg</dpg>
89
+ </modules>
90
+ </args>
91
+ </checkout>
92
+ <datacash>
93
+ <use>standard</use>
94
+ <args>
95
+ <module>DataCash_Dpg</module>
96
+ <frontName>datacash</frontName>
97
+ </args>
98
+ </datacash>
99
+ </routers>
100
+ <translate>
101
+ <modules>
102
+ <DataCash_Dpg>
103
+ <files>
104
+ <default>DataCash_Dpg.csv</default>
105
+ </files>
106
+ </DataCash_Dpg>
107
+ </modules>
108
+ </translate>
109
+ <layout>
110
+ <updates>
111
+ <dpg>
112
+ <file>datacash.xml</file>
113
+ </dpg>
114
+ </updates>
115
+ </layout>
116
+ </frontend>
117
+ <adminhtml>
118
+ <events>
119
+ <payment_info_block_prepare_specific_information>
120
+ <observers>
121
+ <dpg>
122
+ <type>model</type>
123
+ <class>dpg/observer</class>
124
+ <method>paymentInfoBlockPrepareSpecificInformation</method>
125
+ </dpg>
126
+ </observers>
127
+ </payment_info_block_prepare_specific_information>
128
+ </events>
129
+ </adminhtml>
130
+ <default>
131
+ <payment>
132
+ <datacash_hcc>
133
+ <title>DataCash :: Hosted Card Capture</title>
134
+ <testing_endpoint>https://testserver.datacash.com/Transaction</testing_endpoint>
135
+ <live_endpoint>https://mars.transaction.datacash.com/Transaction</live_endpoint>
136
+ <active>0</active>
137
+ <cctypes>AE,VI,MC,SM</cctypes>
138
+ <order_status>pending</order_status>
139
+ <payment_action>auth</payment_action>
140
+ <model>dpg/method_hcc</model>
141
+ <debug>0</debug>
142
+ <sandbox>0</sandbox>
143
+ </datacash_hcc>
144
+ <datacash_hps>
145
+ <title>DataCash :: Hosted Payment Service</title>
146
+ <testing_endpoint>https://testserver.datacash.com/Transaction</testing_endpoint>
147
+ <live_endpoint>https://mars.transaction.datacash.com/Transaction</live_endpoint>
148
+ <active>0</active>
149
+ <cctypes>AE,VI,MC,SM</cctypes>
150
+ <order_status>pending</order_status>
151
+ <payment_action>auth</payment_action>
152
+ <model>dpg/method_hps</model>
153
+ <debug>0</debug>
154
+ <sandbox>0</sandbox>
155
+ </datacash_hps>
156
+ <datacash_api>
157
+ <title>DataCash :: API</title>
158
+ <testing_endpoint>https://testserver.datacash.com/Transaction</testing_endpoint>
159
+ <live_endpoint>https://mars.transaction.datacash.com/Transaction</live_endpoint>
160
+ <active>0</active>
161
+ <cctypes>AE,VI,MC,SM</cctypes>
162
+ <order_status>pending</order_status>
163
+ <payment_action>auth</payment_action>
164
+ <model>dpg/method_api</model>
165
+ <line_items_enabled>0</line_items_enabled>
166
+ <debug>0</debug>
167
+ <sandbox>0</sandbox>
168
+ <t3m_use_ssl_callback>1</t3m_use_ssl_callback>
169
+ </datacash_api>
170
+ <datacash_apiprereg>
171
+ <title>DataCash :: API (with Pre-Registered Cards)</title>
172
+ <testing_endpoint>https://testserver.datacash.com/Transaction</testing_endpoint>
173
+ <live_endpoint>https://mars.transaction.datacash.com/Transaction</live_endpoint>
174
+ <active>0</active>
175
+ <cctypes>AE,VI,MC,SM</cctypes>
176
+ <order_status>pending</order_status>
177
+ <payment_action>auth</payment_action>
178
+ <model>dpg/method_apiprereg</model>
179
+ <line_items_enabled>0</line_items_enabled>
180
+ <debug>0</debug>
181
+ <sandbox>0</sandbox>
182
+ </datacash_apiprereg>
183
+ </payment>
184
+ </default>
185
+ </config>
app/code/community/DataCash/Dpg/etc/system.xml ADDED
@@ -0,0 +1,1929 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <datacash_hint>
7
+ <frontend_model>dpg/adminhtml_system_config_fieldset_hint</frontend_model>
8
+ <sort_order>999</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ </datacash_hint>
13
+ <datacash_hps translate="label,comment" module="dpg">
14
+ <label>DataCash :: Hosted Payment Service</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>1000</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <active translate="label">
22
+ <label>Enabled</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>0</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </active>
30
+ <title translate="label">
31
+ <label>Title</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>10</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </title>
38
+ <order_status translate="label">
39
+ <label>New order status</label>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>adminhtml/system_config_source_order_status</source_model>
42
+ <sort_order>20</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </order_status>
47
+ <payment_action>
48
+ <label>Payment Action</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>dpg/source_authtypes</source_model>
51
+ <sort_order>30</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </payment_action>
56
+ <allowspecific translate="label">
57
+ <label>Payment Applicable From</label>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
60
+ <sort_order>40</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </allowspecific>
65
+ <sort_order translate="label">
66
+ <label>Sort Order</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>45</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>0</show_in_store>
72
+ </sort_order>
73
+ <specificcountry translate="label">
74
+ <label>Countries Payment Applicable From</label>
75
+ <frontend_type>multiselect</frontend_type>
76
+ <source_model>adminhtml/system_config_source_country</source_model>
77
+ <sort_order>50</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <depends>
82
+ <allowspecific>1</allowspecific>
83
+ </depends>
84
+ </specificcountry>
85
+ <heading_merchant translate="label">
86
+ <label>DataCash Integration</label>
87
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
88
+ <sort_order>60</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </heading_merchant>
93
+ <merchant_id>
94
+ <label>Merchant ID</label>
95
+ <comment><![CDATA[
96
+ Used when posting data from Magento to DataCash. <br/>
97
+ Supplied by DataCash when you setup your account.
98
+ ]]></comment>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>70</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </merchant_id>
105
+ <merchant_password translate="label">
106
+ <label>Merchant Password</label>
107
+ <comment><![CDATA[
108
+ Used when posting data from Magento to DataCash. <br/>
109
+ Supplied by DataCash when you setup your account. <br/>
110
+ This will be reset every 12 months and will need to be updated.
111
+ ]]></comment>
112
+ <frontend_type>obscure</frontend_type>
113
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
114
+ <sort_order>80</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </merchant_password>
119
+ <page_set_id>
120
+ <label>Page Set ID</label>
121
+ <comment><![CDATA[
122
+ Defines the design of the hosted form. <br/>
123
+ Supplied by DataCash when you setup your account.
124
+ ]]></comment>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>90</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ </page_set_id>
131
+ <debug translate="label">
132
+ <label>Debug</label>
133
+ <comment><![CDATA[
134
+ Enable additional log output for payment processes.
135
+ ]]></comment>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>100</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>0</show_in_store>
142
+ </debug>
143
+ <sandbox translate="label">
144
+ <label>Test Mode</label>
145
+ <comment><![CDATA[
146
+ Use the DataCash test server.
147
+ ]]></comment>
148
+ <frontend_type>select</frontend_type>
149
+ <source_model>adminhtml/system_config_source_yesno</source_model>
150
+ <sort_order>110</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>0</show_in_store>
154
+ </sandbox>
155
+ <heading_card_settings translate="label">
156
+ <label>Credit Card Settings</label>
157
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
158
+ <sort_order>120</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </heading_card_settings>
163
+ <useccv translate="label">
164
+ <label>Request CV2 Card Security Code</label>
165
+ <frontend_type>select</frontend_type>
166
+ <source_model>adminhtml/system_config_source_yesno</source_model>
167
+ <sort_order>140</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>0</show_in_store>
171
+ </useccv>
172
+ <useccv_advanced translate="label">
173
+ <label>Use Extended CV2 Policy</label>
174
+ <frontend_type>select</frontend_type>
175
+ <source_model>adminhtml/system_config_source_yesno</source_model>
176
+ <sort_order>150</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>0</show_in_store>
180
+ <depends>
181
+ <useccv>1</useccv>
182
+ </depends>
183
+ </useccv_advanced>
184
+ <heading_extpol_cv2policy translate="label">
185
+ <label>Extended Policy - CV2</label>
186
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
187
+ <sort_order>160</sort_order>
188
+ <show_in_default>1</show_in_default>
189
+ <show_in_website>1</show_in_website>
190
+ <show_in_store>0</show_in_store>
191
+ <depends>
192
+ <useccv_advanced>1</useccv_advanced>
193
+ </depends>
194
+ </heading_extpol_cv2policy>
195
+ <extpol_cv2policy_notprovided translate="label">
196
+ <label>Not provided</label>
197
+ <frontend_type>select</frontend_type>
198
+ <source_model>dpg/source_acceptreject</source_model>
199
+ <sort_order>170</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>0</show_in_store>
203
+ <depends>
204
+ <useccv_advanced>1</useccv_advanced>
205
+ </depends>
206
+ </extpol_cv2policy_notprovided>
207
+ <extpol_cv2policy_notchecked translate="label">
208
+ <label>Not checked</label>
209
+ <frontend_type>select</frontend_type>
210
+ <source_model>dpg/source_acceptreject</source_model>
211
+ <sort_order>180</sort_order>
212
+ <show_in_default>1</show_in_default>
213
+ <show_in_website>1</show_in_website>
214
+ <show_in_store>0</show_in_store>
215
+ <depends>
216
+ <useccv_advanced>1</useccv_advanced>
217
+ </depends>
218
+ </extpol_cv2policy_notchecked>
219
+ <extpol_cv2policy_matched translate="label">
220
+ <label>Matched</label>
221
+ <frontend_type>select</frontend_type>
222
+ <source_model>dpg/source_acceptreject</source_model>
223
+ <sort_order>190</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>0</show_in_store>
227
+ <depends>
228
+ <useccv_advanced>1</useccv_advanced>
229
+ </depends>
230
+ </extpol_cv2policy_matched>
231
+ <extpol_cv2policy_notmatched translate="label">
232
+ <label>Not matched</label>
233
+ <frontend_type>select</frontend_type>
234
+ <source_model>dpg/source_acceptreject</source_model>
235
+ <sort_order>200</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>0</show_in_store>
239
+ <depends>
240
+ <useccv_advanced>1</useccv_advanced>
241
+ </depends>
242
+ </extpol_cv2policy_notmatched>
243
+ <extpol_cv2policy_partialmatch translate="label">
244
+ <label>Partial match</label>
245
+ <frontend_type>select</frontend_type>
246
+ <source_model>dpg/source_acceptreject</source_model>
247
+ <sort_order>210</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>0</show_in_store>
251
+ <depends>
252
+ <useccv_advanced>1</useccv_advanced>
253
+ </depends>
254
+ </extpol_cv2policy_partialmatch>
255
+ <heading_extpol_postcode translate="label">
256
+ <label>Extended Policy - Postcode</label>
257
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
258
+ <sort_order>230</sort_order>
259
+ <show_in_default>1</show_in_default>
260
+ <show_in_website>1</show_in_website>
261
+ <show_in_store>0</show_in_store>
262
+ <depends>
263
+ <useccv_advanced>1</useccv_advanced>
264
+ </depends>
265
+ </heading_extpol_postcode>
266
+ <extpol_postcode_notprovided translate="label">
267
+ <label>Not provided</label>
268
+ <frontend_type>select</frontend_type>
269
+ <source_model>dpg/source_acceptreject</source_model>
270
+ <sort_order>240</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>0</show_in_store>
274
+ <depends>
275
+ <useccv_advanced>1</useccv_advanced>
276
+ </depends>
277
+ </extpol_postcode_notprovided>
278
+ <extpol_postcode_notchecked translate="label">
279
+ <label>Not checked</label>
280
+ <frontend_type>select</frontend_type>
281
+ <source_model>dpg/source_acceptreject</source_model>
282
+ <sort_order>250</sort_order>
283
+ <show_in_default>1</show_in_default>
284
+ <show_in_website>1</show_in_website>
285
+ <show_in_store>0</show_in_store>
286
+ <depends>
287
+ <useccv_advanced>1</useccv_advanced>
288
+ </depends>
289
+ </extpol_postcode_notchecked>
290
+ <extpol_postcode_matched translate="label">
291
+ <label>Matched</label>
292
+ <frontend_type>select</frontend_type>
293
+ <source_model>dpg/source_acceptreject</source_model>
294
+ <sort_order>260</sort_order>
295
+ <show_in_default>1</show_in_default>
296
+ <show_in_website>1</show_in_website>
297
+ <show_in_store>0</show_in_store>
298
+ <depends>
299
+ <useccv_advanced>1</useccv_advanced>
300
+ </depends>
301
+ </extpol_postcode_matched>
302
+ <extpol_postcode_notmatched translate="label">
303
+ <label>Not matched</label>
304
+ <frontend_type>select</frontend_type>
305
+ <source_model>dpg/source_acceptreject</source_model>
306
+ <sort_order>270</sort_order>
307
+ <show_in_default>1</show_in_default>
308
+ <show_in_website>1</show_in_website>
309
+ <show_in_store>0</show_in_store>
310
+ <depends>
311
+ <useccv_advanced>1</useccv_advanced>
312
+ </depends>
313
+ </extpol_postcode_notmatched>
314
+ <extpol_postcode_partialmatch translate="label">
315
+ <label>Partial match</label>
316
+ <frontend_type>select</frontend_type>
317
+ <source_model>dpg/source_acceptreject</source_model>
318
+ <sort_order>280</sort_order>
319
+ <show_in_default>1</show_in_default>
320
+ <show_in_website>1</show_in_website>
321
+ <show_in_store>0</show_in_store>
322
+ <depends>
323
+ <useccv_advanced>1</useccv_advanced>
324
+ </depends>
325
+ </extpol_postcode_partialmatch>
326
+ <heading_extpol_address translate="label">
327
+ <label>Extended Policy - Address</label>
328
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
329
+ <sort_order>300</sort_order>
330
+ <show_in_default>1</show_in_default>
331
+ <show_in_website>1</show_in_website>
332
+ <show_in_store>0</show_in_store>
333
+ <depends>
334
+ <useccv_advanced>1</useccv_advanced>
335
+ </depends>
336
+ </heading_extpol_address>
337
+ <extpol_address_notprovided translate="label">
338
+ <label>Not provided</label>
339
+ <frontend_type>select</frontend_type>
340
+ <source_model>dpg/source_acceptreject</source_model>
341
+ <sort_order>310</sort_order>
342
+ <show_in_default>1</show_in_default>
343
+ <show_in_website>1</show_in_website>
344
+ <show_in_store>0</show_in_store>
345
+ <depends>
346
+ <useccv_advanced>1</useccv_advanced>
347
+ </depends>
348
+ </extpol_address_notprovided>
349
+ <extpol_address_notchecked translate="label">
350
+ <label>Not checked</label>
351
+ <frontend_type>select</frontend_type>
352
+ <source_model>dpg/source_acceptreject</source_model>
353
+ <sort_order>320</sort_order>
354
+ <show_in_default>1</show_in_default>
355
+ <show_in_website>1</show_in_website>
356
+ <show_in_store>0</show_in_store>
357
+ <depends>
358
+ <useccv_advanced>1</useccv_advanced>
359
+ </depends>
360
+ </extpol_address_notchecked>
361
+ <extpol_address_matched translate="label">
362
+ <label>Matched</label>
363
+ <frontend_type>select</frontend_type>
364
+ <source_model>dpg/source_acceptreject</source_model>
365
+ <sort_order>330</sort_order>
366
+ <show_in_default>1</show_in_default>
367
+ <show_in_website>1</show_in_website>
368
+ <show_in_store>0</show_in_store>
369
+ <depends>
370
+ <useccv_advanced>1</useccv_advanced>
371
+ </depends>
372
+ </extpol_address_matched>
373
+ <extpol_address_notmatched translate="label">
374
+ <label>Not matched</label>
375
+ <frontend_type>select</frontend_type>
376
+ <source_model>dpg/source_acceptreject</source_model>
377
+ <sort_order>340</sort_order>
378
+ <show_in_default>1</show_in_default>
379
+ <show_in_website>1</show_in_website>
380
+ <show_in_store>0</show_in_store>
381
+ <depends>
382
+ <useccv_advanced>1</useccv_advanced>
383
+ </depends>
384
+ </extpol_address_notmatched>
385
+ <extpol_address_partialmatch translate="label">
386
+ <label>Partial match</label>
387
+ <frontend_type>select</frontend_type>
388
+ <source_model>dpg/source_acceptreject</source_model>
389
+ <sort_order>350</sort_order>
390
+ <show_in_default>1</show_in_default>
391
+ <show_in_website>1</show_in_website>
392
+ <show_in_store>0</show_in_store>
393
+ <depends>
394
+ <useccv_advanced>1</useccv_advanced>
395
+ </depends>
396
+ </extpol_address_partialmatch>
397
+ <heading_3dsecure translate="label">
398
+ <label>3D Secure</label>
399
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
400
+ <sort_order>400</sort_order>
401
+ <show_in_default>1</show_in_default>
402
+ <show_in_website>1</show_in_website>
403
+ <show_in_store>1</show_in_store>
404
+ </heading_3dsecure>
405
+ <use3DSecure translate="label">
406
+ <label>3D Secure Card Validation</label>
407
+ <frontend_type>select</frontend_type>
408
+ <source_model>adminhtml/system_config_source_yesno</source_model>
409
+ <sort_order>420</sort_order>
410
+ <show_in_default>1</show_in_default>
411
+ <show_in_website>1</show_in_website>
412
+ <show_in_store>1</show_in_store>
413
+ </use3DSecure>
414
+ </fields>
415
+ </datacash_hps>
416
+ <datacash_hcc translate="label,comment" module="dpg">
417
+ <label>DataCash :: Hosted Card Capture</label>
418
+ <frontend_type>text</frontend_type>
419
+ <sort_order>2000</sort_order>
420
+ <show_in_default>1</show_in_default>
421
+ <show_in_website>1</show_in_website>
422
+ <show_in_store>1</show_in_store>
423
+ <fields>
424
+ <active translate="label">
425
+ <label>Enabled</label>
426
+ <frontend_type>select</frontend_type>
427
+ <source_model>adminhtml/system_config_source_yesno</source_model>
428
+ <sort_order>0</sort_order>
429
+ <show_in_default>1</show_in_default>
430
+ <show_in_website>1</show_in_website>
431
+ <show_in_store>1</show_in_store>
432
+ </active>
433
+ <title translate="label">
434
+ <label>Title</label>
435
+ <frontend_type>text</frontend_type>
436
+ <sort_order>10</sort_order>
437
+ <show_in_default>1</show_in_default>
438
+ <show_in_website>1</show_in_website>
439
+ <show_in_store>1</show_in_store>
440
+ </title>
441
+ <order_status translate="label">
442
+ <label>New order status</label>
443
+ <frontend_type>select</frontend_type>
444
+ <source_model>adminhtml/system_config_source_order_status</source_model>
445
+ <sort_order>20</sort_order>
446
+ <show_in_default>1</show_in_default>
447
+ <show_in_website>1</show_in_website>
448
+ <show_in_store>1</show_in_store>
449
+ </order_status>
450
+ <payment_action>
451
+ <label>Payment Action</label>
452
+ <frontend_type>select</frontend_type>
453
+ <source_model>dpg/source_authtypes</source_model>
454
+ <sort_order>30</sort_order>
455
+ <show_in_default>1</show_in_default>
456
+ <show_in_website>1</show_in_website>
457
+ <show_in_store>0</show_in_store>
458
+ </payment_action>
459
+ <allowspecific translate="label">
460
+ <label>Payment Applicable From</label>
461
+ <frontend_type>select</frontend_type>
462
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
463
+ <sort_order>40</sort_order>
464
+ <show_in_default>1</show_in_default>
465
+ <show_in_website>1</show_in_website>
466
+ <show_in_store>1</show_in_store>
467
+ </allowspecific>
468
+ <sort_order translate="label">
469
+ <label>Sort Order</label>
470
+ <frontend_type>text</frontend_type>
471
+ <sort_order>45</sort_order>
472
+ <show_in_default>1</show_in_default>
473
+ <show_in_website>1</show_in_website>
474
+ <show_in_store>0</show_in_store>
475
+ </sort_order>
476
+ <specificcountry translate="label">
477
+ <label>Countries Payment Applicable From</label>
478
+ <frontend_type>multiselect</frontend_type>
479
+ <source_model>adminhtml/system_config_source_country</source_model>
480
+ <sort_order>50</sort_order>
481
+ <show_in_default>1</show_in_default>
482
+ <show_in_website>1</show_in_website>
483
+ <show_in_store>1</show_in_store>
484
+ <depends>
485
+ <allowspecific>1</allowspecific>
486
+ </depends>
487
+ </specificcountry>
488
+ <heading_merchant translate="label">
489
+ <label>DataCash Integration</label>
490
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
491
+ <sort_order>60</sort_order>
492
+ <show_in_default>1</show_in_default>
493
+ <show_in_website>1</show_in_website>
494
+ <show_in_store>1</show_in_store>
495
+ </heading_merchant>
496
+ <merchant_id>
497
+ <label>Merchant ID</label>
498
+ <comment><![CDATA[
499
+ Used when posting data from Magento to DataCash. <br/>
500
+ Supplied by DataCash when you setup your account.
501
+ ]]></comment>
502
+ <frontend_type>text</frontend_type>
503
+ <sort_order>70</sort_order>
504
+ <show_in_default>1</show_in_default>
505
+ <show_in_website>1</show_in_website>
506
+ <show_in_store>1</show_in_store>
507
+ </merchant_id>
508
+ <merchant_password translate="label">
509
+ <label>Merchant Key</label>
510
+ <comment><![CDATA[
511
+ Used when posting data from Magento to DataCash. <br/>
512
+ Supplied by DataCash when you setup your account. <br/>
513
+ This will be reset every 12 months and will need to be updated.
514
+ ]]></comment>
515
+ <frontend_type>obscure</frontend_type>
516
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
517
+ <sort_order>80</sort_order>
518
+ <show_in_default>1</show_in_default>
519
+ <show_in_website>1</show_in_website>
520
+ <show_in_store>1</show_in_store>
521
+ </merchant_password>
522
+ <page_set_id>
523
+ <label>Page Set ID</label>
524
+ <comment><![CDATA[
525
+ Defines the design of the hosted form. <br/>
526
+ Supplied by DataCash when you setup your account.
527
+ ]]></comment>
528
+ <frontend_type>text</frontend_type>
529
+ <sort_order>90</sort_order>
530
+ <show_in_default>1</show_in_default>
531
+ <show_in_website>1</show_in_website>
532
+ <show_in_store>1</show_in_store>
533
+ </page_set_id>
534
+ <debug translate="label">
535
+ <label>Debug</label>
536
+ <comment><![CDATA[
537
+ Enable additional log output for payment processes
538
+ ]]></comment>
539
+ <frontend_type>select</frontend_type>
540
+ <source_model>adminhtml/system_config_source_yesno</source_model>
541
+ <sort_order>100</sort_order>
542
+ <show_in_default>1</show_in_default>
543
+ <show_in_website>1</show_in_website>
544
+ <show_in_store>1</show_in_store>
545
+ </debug>
546
+ <sandbox translate="label">
547
+ <label>Test Mode</label>
548
+ <comment><![CDATA[
549
+ Use the DataCash test server.
550
+ ]]></comment>
551
+ <frontend_type>select</frontend_type>
552
+ <source_model>adminhtml/system_config_source_yesno</source_model>
553
+ <sort_order>110</sort_order>
554
+ <show_in_default>1</show_in_default>
555
+ <show_in_website>1</show_in_website>
556
+ <show_in_store>0</show_in_store>
557
+ </sandbox>
558
+ <heading_card_settings translate="label">
559
+ <label>Credit Card Settings</label>
560
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
561
+ <sort_order>120</sort_order>
562
+ <show_in_default>1</show_in_default>
563
+ <show_in_website>1</show_in_website>
564
+ <show_in_store>1</show_in_store>
565
+ </heading_card_settings>
566
+ <useccv translate="label">
567
+ <label>Request CV2 Card Security Code</label>
568
+ <frontend_type>select</frontend_type>
569
+ <source_model>adminhtml/system_config_source_yesno</source_model>
570
+ <sort_order>140</sort_order>
571
+ <show_in_default>1</show_in_default>
572
+ <show_in_website>1</show_in_website>
573
+ <show_in_store>0</show_in_store>
574
+ </useccv>
575
+ <useccv_advanced translate="label">
576
+ <label>Use Extended CV2 Policy</label>
577
+ <frontend_type>select</frontend_type>
578
+ <source_model>adminhtml/system_config_source_yesno</source_model>
579
+ <sort_order>150</sort_order>
580
+ <show_in_default>1</show_in_default>
581
+ <show_in_website>1</show_in_website>
582
+ <show_in_store>0</show_in_store>
583
+ <depends>
584
+ <useccv>1</useccv>
585
+ </depends>
586
+ </useccv_advanced>
587
+ <heading_extpol_cv2policy translate="label">
588
+ <label>Extended Policy - CV2</label>
589
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
590
+ <sort_order>160</sort_order>
591
+ <show_in_default>1</show_in_default>
592
+ <show_in_website>1</show_in_website>
593
+ <show_in_store>0</show_in_store>
594
+ <depends>
595
+ <useccv_advanced>1</useccv_advanced>
596
+ </depends>
597
+ </heading_extpol_cv2policy>
598
+ <extpol_cv2policy_notprovided translate="label">
599
+ <label>Not provided</label>
600
+ <frontend_type>select</frontend_type>
601
+ <source_model>dpg/source_acceptreject</source_model>
602
+ <sort_order>170</sort_order>
603
+ <show_in_default>1</show_in_default>
604
+ <show_in_website>1</show_in_website>
605
+ <show_in_store>0</show_in_store>
606
+ <depends>
607
+ <useccv_advanced>1</useccv_advanced>
608
+ </depends>
609
+ </extpol_cv2policy_notprovided>
610
+ <extpol_cv2policy_notchecked translate="label">
611
+ <label>Not checked</label>
612
+ <frontend_type>select</frontend_type>
613
+ <source_model>dpg/source_acceptreject</source_model>
614
+ <sort_order>180</sort_order>
615
+ <show_in_default>1</show_in_default>
616
+ <show_in_website>1</show_in_website>
617
+ <show_in_store>0</show_in_store>
618
+ <depends>
619
+ <useccv_advanced>1</useccv_advanced>
620
+ </depends>
621
+ </extpol_cv2policy_notchecked>
622
+ <extpol_cv2policy_matched translate="label">
623
+ <label>Matched</label>
624
+ <frontend_type>select</frontend_type>
625
+ <source_model>dpg/source_acceptreject</source_model>
626
+ <sort_order>190</sort_order>
627
+ <show_in_default>1</show_in_default>
628
+ <show_in_website>1</show_in_website>
629
+ <show_in_store>0</show_in_store>
630
+ <depends>
631
+ <useccv_advanced>1</useccv_advanced>
632
+ </depends>
633
+ </extpol_cv2policy_matched>
634
+ <extpol_cv2policy_notmatched translate="label">
635
+ <label>Not matched</label>
636
+ <frontend_type>select</frontend_type>
637
+ <source_model>dpg/source_acceptreject</source_model>
638
+ <sort_order>200</sort_order>
639
+ <show_in_default>1</show_in_default>
640
+ <show_in_website>1</show_in_website>
641
+ <show_in_store>0</show_in_store>
642
+ <depends>
643
+ <useccv_advanced>1</useccv_advanced>
644
+ </depends>
645
+ </extpol_cv2policy_notmatched>
646
+ <extpol_cv2policy_partialmatch translate="label">
647
+ <label>Partial match</label>
648
+ <frontend_type>select</frontend_type>
649
+ <source_model>dpg/source_acceptreject</source_model>
650
+ <sort_order>210</sort_order>
651
+ <show_in_default>1</show_in_default>
652
+ <show_in_website>1</show_in_website>
653
+ <show_in_store>0</show_in_store>
654
+ <depends>
655
+ <useccv_advanced>1</useccv_advanced>
656
+ </depends>
657
+ </extpol_cv2policy_partialmatch>
658
+ <heading_extpol_postcode translate="label">
659
+ <label>Extended Policy - Postcode</label>
660
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
661
+ <sort_order>230</sort_order>
662
+ <show_in_default>1</show_in_default>
663
+ <show_in_website>1</show_in_website>
664
+ <show_in_store>0</show_in_store>
665
+ <depends>
666
+ <useccv_advanced>1</useccv_advanced>
667
+ </depends>
668
+ </heading_extpol_postcode>
669
+ <extpol_postcode_notprovided translate="label">
670
+ <label>Not provided</label>
671
+ <frontend_type>select</frontend_type>
672
+ <source_model>dpg/source_acceptreject</source_model>
673
+ <sort_order>240</sort_order>
674
+ <show_in_default>1</show_in_default>
675
+ <show_in_website>1</show_in_website>
676
+ <show_in_store>0</show_in_store>
677
+ <depends>
678
+ <useccv_advanced>1</useccv_advanced>
679
+ </depends>
680
+ </extpol_postcode_notprovided>
681
+ <extpol_postcode_notchecked translate="label">
682
+ <label>Not checked</label>
683
+ <frontend_type>select</frontend_type>
684
+ <source_model>dpg/source_acceptreject</source_model>
685
+ <sort_order>250</sort_order>
686
+ <show_in_default>1</show_in_default>
687
+ <show_in_website>1</show_in_website>
688
+ <show_in_store>0</show_in_store>
689
+ <depends>
690
+ <useccv_advanced>1</useccv_advanced>
691
+ </depends>
692
+ </extpol_postcode_notchecked>
693
+ <extpol_postcode_matched translate="label">
694
+ <label>Matched</label>
695
+ <frontend_type>select</frontend_type>
696
+ <source_model>dpg/source_acceptreject</source_model>
697
+ <sort_order>260</sort_order>
698
+ <show_in_default>1</show_in_default>
699
+ <show_in_website>1</show_in_website>
700
+ <show_in_store>0</show_in_store>
701
+ <depends>
702
+ <useccv_advanced>1</useccv_advanced>
703
+ </depends>
704
+ </extpol_postcode_matched>
705
+ <extpol_postcode_notmatched translate="label">
706
+ <label>Not matched</label>
707
+ <frontend_type>select</frontend_type>
708
+ <source_model>dpg/source_acceptreject</source_model>
709
+ <sort_order>270</sort_order>
710
+ <show_in_default>1</show_in_default>
711
+ <show_in_website>1</show_in_website>
712
+ <show_in_store>0</show_in_store>
713
+ <depends>
714
+ <useccv_advanced>1</useccv_advanced>
715
+ </depends>
716
+ </extpol_postcode_notmatched>
717
+ <extpol_postcode_partialmatch translate="label">
718
+ <label>Partial match</label>
719
+ <frontend_type>select</frontend_type>
720
+ <source_model>dpg/source_acceptreject</source_model>
721
+ <sort_order>280</sort_order>
722
+ <show_in_default>1</show_in_default>
723
+ <show_in_website>1</show_in_website>
724
+ <show_in_store>0</show_in_store>
725
+ <depends>
726
+ <useccv_advanced>1</useccv_advanced>
727
+ </depends>
728
+ </extpol_postcode_partialmatch>
729
+ <heading_extpol_address translate="label">
730
+ <label>Extended Policy - Address</label>
731
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
732
+ <sort_order>300</sort_order>
733
+ <show_in_default>1</show_in_default>
734
+ <show_in_website>1</show_in_website>
735
+ <show_in_store>0</show_in_store>
736
+ <depends>
737
+ <useccv_advanced>1</useccv_advanced>
738
+ </depends>
739
+ </heading_extpol_address>
740
+ <extpol_address_notprovided translate="label">
741
+ <label>Not provided</label>
742
+ <frontend_type>select</frontend_type>
743
+ <source_model>dpg/source_acceptreject</source_model>
744
+ <sort_order>310</sort_order>
745
+ <show_in_default>1</show_in_default>
746
+ <show_in_website>1</show_in_website>
747
+ <show_in_store>0</show_in_store>
748
+ <depends>
749
+ <useccv_advanced>1</useccv_advanced>
750
+ </depends>
751
+ </extpol_address_notprovided>
752
+ <extpol_address_notchecked translate="label">
753
+ <label>Not checked</label>
754
+ <frontend_type>select</frontend_type>
755
+ <source_model>dpg/source_acceptreject</source_model>
756
+ <sort_order>320</sort_order>
757
+ <show_in_default>1</show_in_default>
758
+ <show_in_website>1</show_in_website>
759
+ <show_in_store>0</show_in_store>
760
+ <depends>
761
+ <useccv_advanced>1</useccv_advanced>
762
+ </depends>
763
+ </extpol_address_notchecked>
764
+ <extpol_address_matched translate="label">
765
+ <label>Matched</label>
766
+ <frontend_type>select</frontend_type>
767
+ <source_model>dpg/source_acceptreject</source_model>
768
+ <sort_order>330</sort_order>
769
+ <show_in_default>1</show_in_default>
770
+ <show_in_website>1</show_in_website>
771
+ <show_in_store>0</show_in_store>
772
+ <depends>
773
+ <useccv_advanced>1</useccv_advanced>
774
+ </depends>
775
+ </extpol_address_matched>
776
+ <extpol_address_notmatched translate="label">
777
+ <label>Not matched</label>
778
+ <frontend_type>select</frontend_type>
779
+ <source_model>dpg/source_acceptreject</source_model>
780
+ <sort_order>340</sort_order>
781
+ <show_in_default>1</show_in_default>
782
+ <show_in_website>1</show_in_website>
783
+ <show_in_store>0</show_in_store>
784
+ <depends>
785
+ <useccv_advanced>1</useccv_advanced>
786
+ </depends>
787
+ </extpol_address_notmatched>
788
+ <extpol_address_partialmatch translate="label">
789
+ <label>Partial match</label>
790
+ <frontend_type>select</frontend_type>
791
+ <source_model>dpg/source_acceptreject</source_model>
792
+ <sort_order>350</sort_order>
793
+ <show_in_default>1</show_in_default>
794
+ <show_in_website>1</show_in_website>
795
+ <show_in_store>0</show_in_store>
796
+ <depends>
797
+ <useccv_advanced>1</useccv_advanced>
798
+ </depends>
799
+ </extpol_address_partialmatch>
800
+ <heading_3dsecure translate="label">
801
+ <label>3D Secure</label>
802
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
803
+ <sort_order>400</sort_order>
804
+ <show_in_default>1</show_in_default>
805
+ <show_in_website>1</show_in_website>
806
+ <show_in_store>1</show_in_store>
807
+ </heading_3dsecure>
808
+ <centinel translate="label">
809
+ <label>3D Secure Card Validation</label>
810
+ <frontend_type>select</frontend_type>
811
+ <source_model>adminhtml/system_config_source_yesno</source_model>
812
+ <sort_order>410</sort_order>
813
+ <show_in_default>1</show_in_default>
814
+ <show_in_website>1</show_in_website>
815
+ <show_in_store>1</show_in_store>
816
+ </centinel>
817
+ <heading_3dsecure_behaviours translate="label">
818
+ <label>3-D Secure Behaviours</label>
819
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
820
+ <sort_order>420</sort_order>
821
+ <show_in_default>1</show_in_default>
822
+ <show_in_website>1</show_in_website>
823
+ <show_in_store>1</show_in_store>
824
+ <depends>
825
+ <centinel>1</centinel>
826
+ </depends>
827
+ </heading_3dsecure_behaviours>
828
+ <threedsecure_behaviour_159 translate="label">
829
+ <label>DPG Response 159 - No VERes from DS</label>
830
+ <comment><![CDATA[
831
+ If DataCash does not receive a response from the <br />
832
+ Directory Service, the card cannot be validated as <br />
833
+ participating in 3-D Secure. In these circumstances <br />
834
+ please choose how you would like to continue.
835
+ ]]></comment>
836
+ <frontend_type>select</frontend_type>
837
+ <source_model>dpg/source_threedstypes</source_model>
838
+ <sort_order>430</sort_order>
839
+ <show_in_default>1</show_in_default>
840
+ <show_in_website>1</show_in_website>
841
+ <show_in_store>1</show_in_store>
842
+ <depends>
843
+ <centinel>1</centinel>
844
+ </depends>
845
+ </threedsecure_behaviour_159>
846
+ <threedsecure_behaviour_160 translate="label">
847
+ <label>DPG Response 160 - Invalid VERes from DS</label>
848
+ <comment><![CDATA[
849
+ If DataCash does receive a response from the Directory Service <br />
850
+ but it is invalid, it is not possible to ascertain if the <br />
851
+ card is participating in 3-D Secure. In these circumstances <br />
852
+ please choose how you would like to continue.
853
+ ]]></comment>
854
+ <frontend_type>select</frontend_type>
855
+ <source_model>dpg/source_threedstypes</source_model>
856
+ <sort_order>440</sort_order>
857
+ <show_in_default>1</show_in_default>
858
+ <show_in_website>1</show_in_website>
859
+ <show_in_store>1</show_in_store>
860
+ <depends>
861
+ <centinel>1</centinel>
862
+ </depends>
863
+ </threedsecure_behaviour_160>
864
+ <threedsecure_behaviour_173 translate="label">
865
+ <label>DPG Response 173 - Card not Enrolled in Cache</label>
866
+ <comment><![CDATA[
867
+ Card is not in cache so no 3-D Secure Enrollment Check Request is submitted. <br />
868
+ In these circumstances please choose how you would like to continue.
869
+ ]]></comment>
870
+ <frontend_type>select</frontend_type>
871
+ <source_model>dpg/source_threedstypes</source_model>
872
+ <sort_order>450</sort_order>
873
+ <show_in_default>1</show_in_default>
874
+ <show_in_website>1</show_in_website>
875
+ <show_in_store>1</show_in_store>
876
+ <depends>
877
+ <centinel>1</centinel>
878
+ </depends>
879
+ </threedsecure_behaviour_173>
880
+ <threedsecure_behaviour_187 translate="label">
881
+ <label>DPG Response 187 - Unable to Verify</label>
882
+ <comment><![CDATA[
883
+ If DataCash is not able to communicate with the Directory Service <br />
884
+ there is no way of establishing if the card is participating in 3-D Secure. <br />
885
+ In these circumstances please choose how you would like to continue.
886
+ ]]></comment>
887
+ <frontend_type>select</frontend_type>
888
+ <source_model>dpg/source_threedstypes</source_model>
889
+ <sort_order>460</sort_order>
890
+ <show_in_default>1</show_in_default>
891
+ <show_in_website>1</show_in_website>
892
+ <show_in_store>1</show_in_store>
893
+ <depends>
894
+ <centinel>1</centinel>
895
+ </depends>
896
+ </threedsecure_behaviour_187>
897
+ </fields>
898
+ </datacash_hcc>
899
+ <datacash_api translate="label,comment" module="dpg">
900
+ <label>DataCash :: API</label>
901
+ <frontend_type>text</frontend_type>
902
+ <sort_order>3000</sort_order>
903
+ <show_in_default>1</show_in_default>
904
+ <show_in_website>1</show_in_website>
905
+ <show_in_store>1</show_in_store>
906
+ <fields>
907
+ <active translate="label">
908
+ <label>Enabled</label>
909
+ <frontend_type>select</frontend_type>
910
+ <source_model>adminhtml/system_config_source_yesno</source_model>
911
+ <sort_order>0</sort_order>
912
+ <show_in_default>1</show_in_default>
913
+ <show_in_website>1</show_in_website>
914
+ <show_in_store>1</show_in_store>
915
+ </active>
916
+ <title translate="label">
917
+ <label>Title</label>
918
+ <frontend_type>text</frontend_type>
919
+ <sort_order>10</sort_order>
920
+ <show_in_default>1</show_in_default>
921
+ <show_in_website>1</show_in_website>
922
+ <show_in_store>1</show_in_store>
923
+ </title>
924
+ <order_status translate="label">
925
+ <label>New Order Status</label>
926
+ <frontend_type>select</frontend_type>
927
+ <source_model>adminhtml/system_config_source_order_status</source_model>
928
+ <sort_order>20</sort_order>
929
+ <show_in_default>1</show_in_default>
930
+ <show_in_website>1</show_in_website>
931
+ <show_in_store>1</show_in_store>
932
+ </order_status>
933
+ <payment_action>
934
+ <label>Payment Action</label>
935
+ <frontend_type>select</frontend_type>
936
+ <source_model>dpg/source_authtypes</source_model>
937
+ <sort_order>30</sort_order>
938
+ <show_in_default>1</show_in_default>
939
+ <show_in_website>1</show_in_website>
940
+ <show_in_store>0</show_in_store>
941
+ </payment_action>
942
+ <allowspecific translate="label">
943
+ <label>Payment Applicable From</label>
944
+ <frontend_type>select</frontend_type>
945
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
946
+ <sort_order>40</sort_order>
947
+ <show_in_default>1</show_in_default>
948
+ <show_in_website>1</show_in_website>
949
+ <show_in_store>1</show_in_store>
950
+ </allowspecific>
951
+ <sort_order translate="label">
952
+ <label>Sort Order</label>
953
+ <frontend_type>text</frontend_type>
954
+ <sort_order>45</sort_order>
955
+ <show_in_default>1</show_in_default>
956
+ <show_in_website>1</show_in_website>
957
+ <show_in_store>0</show_in_store>
958
+ </sort_order>
959
+ <specificcountry translate="label">
960
+ <label>Countries Payment Applicable From</label>
961
+ <frontend_type>multiselect</frontend_type>
962
+ <source_model>adminhtml/system_config_source_country</source_model>
963
+ <sort_order>50</sort_order>
964
+ <show_in_default>1</show_in_default>
965
+ <show_in_website>1</show_in_website>
966
+ <show_in_store>1</show_in_store>
967
+ <depends>
968
+ <allowspecific>1</allowspecific>
969
+ </depends>
970
+ </specificcountry>
971
+ <heading_merchant translate="label">
972
+ <label>DataCash Integration</label>
973
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
974
+ <sort_order>60</sort_order>
975
+ <show_in_default>1</show_in_default>
976
+ <show_in_website>1</show_in_website>
977
+ <show_in_store>1</show_in_store>
978
+ </heading_merchant>
979
+ <merchant_id>
980
+ <label>Merchant ID</label>
981
+ <comment><![CDATA[
982
+ Used when posting data from Magento to DataCash. <br/>
983
+ Supplied by DataCash when you setup your account.
984
+ ]]></comment>
985
+ <frontend_type>text</frontend_type>
986
+ <sort_order>70</sort_order>
987
+ <show_in_default>1</show_in_default>
988
+ <show_in_website>1</show_in_website>
989
+ <show_in_store>1</show_in_store>
990
+ </merchant_id>
991
+ <merchant_password translate="label">
992
+ <label>Merchant Key</label>
993
+ <comment><![CDATA[
994
+ Used when posting data from Magento to DataCash. <br/>
995
+ Supplied by DataCash when you setup your account. <br/>
996
+ This will be reset every 12 months and will need to be updated.
997
+ ]]></comment>
998
+ <frontend_type>obscure</frontend_type>
999
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
1000
+ <sort_order>80</sort_order>
1001
+ <show_in_default>1</show_in_default>
1002
+ <show_in_website>1</show_in_website>
1003
+ <show_in_store>1</show_in_store>
1004
+ </merchant_password>
1005
+ <allow_t3m>
1006
+ <label>Enable DataCash Fraud Services</label>
1007
+ <frontend_type>select</frontend_type>
1008
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1009
+ <sort_order>95</sort_order>
1010
+ <show_in_default>1</show_in_default>
1011
+ <show_in_website>1</show_in_website>
1012
+ <show_in_store>0</show_in_store>
1013
+ </allow_t3m>
1014
+ <t3m_use_ssl_callback translate="label">
1015
+ <label>Use SSL for DataCash Fraud Services callback</label>
1016
+ <comment><![CDATA[
1017
+ DataCash Fraud Services will respond to a secure url if this option is checked.
1018
+ ]]>
1019
+ </comment>
1020
+ <frontend_type>select</frontend_type>
1021
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1022
+ <sort_order>96</sort_order>
1023
+ <show_in_default>1</show_in_default>
1024
+ <show_in_website>1</show_in_website>
1025
+ <show_in_store>0</show_in_store>
1026
+ <depends>
1027
+ <allow_t3m>1</allow_t3m>
1028
+ </depends>
1029
+ </t3m_use_ssl_callback>
1030
+ <line_items_enabled translate="label">
1031
+ <label>Send Line Items</label>
1032
+ <comment><![CDATA[
1033
+ Enabling this will send line item data to DataCash<br/>
1034
+ <strong>Will impose limitations for partial fulfilment and refunds</strong>
1035
+ ]]></comment>
1036
+ <frontend_type>select</frontend_type>
1037
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1038
+ <sort_order>90</sort_order>
1039
+ <show_in_default>1</show_in_default>
1040
+ <show_in_website>1</show_in_website>
1041
+ <show_in_store>0</show_in_store>
1042
+ </line_items_enabled>
1043
+ <debug translate="label">
1044
+ <label>Debug</label>
1045
+ <comment><![CDATA[
1046
+ Enable additional log output for payment processes
1047
+ ]]></comment>
1048
+ <frontend_type>select</frontend_type>
1049
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1050
+ <sort_order>100</sort_order>
1051
+ <show_in_default>1</show_in_default>
1052
+ <show_in_website>1</show_in_website>
1053
+ <show_in_store>0</show_in_store>
1054
+ </debug>
1055
+ <sandbox translate="label">
1056
+ <label>Test Mode</label>
1057
+ <comment><![CDATA[
1058
+ Use the DataCash test server.
1059
+ ]]></comment>
1060
+ <frontend_type>select</frontend_type>
1061
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1062
+ <sort_order>110</sort_order>
1063
+ <show_in_default>1</show_in_default>
1064
+ <show_in_website>1</show_in_website>
1065
+ <show_in_store>0</show_in_store>
1066
+ </sandbox>
1067
+ <heading_card_settings translate="label">
1068
+ <label>Credit Card Settings</label>
1069
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1070
+ <sort_order>120</sort_order>
1071
+ <show_in_default>1</show_in_default>
1072
+ <show_in_website>1</show_in_website>
1073
+ <show_in_store>1</show_in_store>
1074
+ </heading_card_settings>
1075
+ <cctypes translate="label">
1076
+ <label>Credit Card Types</label>
1077
+ <frontend_type>multiselect</frontend_type>
1078
+ <source_model>adminhtml/system_config_source_payment_cctype</source_model>
1079
+ <sort_order>130</sort_order>
1080
+ <show_in_default>1</show_in_default>
1081
+ <show_in_website>1</show_in_website>
1082
+ <show_in_store>1</show_in_store>
1083
+ </cctypes>
1084
+ <heading_useccv translate="label">
1085
+ <label>CV2</label>
1086
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1087
+ <sort_order>135</sort_order>
1088
+ <show_in_default>1</show_in_default>
1089
+ <show_in_website>1</show_in_website>
1090
+ <show_in_store>0</show_in_store>
1091
+ </heading_useccv>
1092
+ <useccv translate="label">
1093
+ <label>Request CV2 Card Security Code</label>
1094
+ <frontend_type>select</frontend_type>
1095
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1096
+ <sort_order>140</sort_order>
1097
+ <show_in_default>1</show_in_default>
1098
+ <show_in_website>1</show_in_website>
1099
+ <show_in_store>0</show_in_store>
1100
+ </useccv>
1101
+ <useccv_advanced translate="label">
1102
+ <label>Use Extended CV2 Policy</label>
1103
+ <frontend_type>select</frontend_type>
1104
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1105
+ <sort_order>150</sort_order>
1106
+ <show_in_default>1</show_in_default>
1107
+ <show_in_website>1</show_in_website>
1108
+ <show_in_store>0</show_in_store>
1109
+ <depends>
1110
+ <useccv>1</useccv>
1111
+ </depends>
1112
+ </useccv_advanced>
1113
+ <heading_extpol_cv2policy translate="label">
1114
+ <label>Extended Policy - CV2</label>
1115
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1116
+ <sort_order>160</sort_order>
1117
+ <show_in_default>1</show_in_default>
1118
+ <show_in_website>1</show_in_website>
1119
+ <show_in_store>0</show_in_store>
1120
+ <depends>
1121
+ <useccv_advanced>1</useccv_advanced>
1122
+ </depends>
1123
+ </heading_extpol_cv2policy>
1124
+ <extpol_cv2policy_notprovided translate="label">
1125
+ <label>Not provided</label>
1126
+ <frontend_type>select</frontend_type>
1127
+ <source_model>dpg/source_acceptreject</source_model>
1128
+ <sort_order>170</sort_order>
1129
+ <show_in_default>1</show_in_default>
1130
+ <show_in_website>1</show_in_website>
1131
+ <show_in_store>0</show_in_store>
1132
+ <depends>
1133
+ <useccv_advanced>1</useccv_advanced>
1134
+ </depends>
1135
+ </extpol_cv2policy_notprovided>
1136
+ <extpol_cv2policy_notchecked translate="label">
1137
+ <label>Not checked</label>
1138
+ <frontend_type>select</frontend_type>
1139
+ <source_model>dpg/source_acceptreject</source_model>
1140
+ <sort_order>180</sort_order>
1141
+ <show_in_default>1</show_in_default>
1142
+ <show_in_website>1</show_in_website>
1143
+ <show_in_store>0</show_in_store>
1144
+ <depends>
1145
+ <useccv_advanced>1</useccv_advanced>
1146
+ </depends>
1147
+ </extpol_cv2policy_notchecked>
1148
+ <extpol_cv2policy_matched translate="label">
1149
+ <label>Matched</label>
1150
+ <frontend_type>select</frontend_type>
1151
+ <source_model>dpg/source_acceptreject</source_model>
1152
+ <sort_order>190</sort_order>
1153
+ <show_in_default>1</show_in_default>
1154
+ <show_in_website>1</show_in_website>
1155
+ <show_in_store>0</show_in_store>
1156
+ <depends>
1157
+ <useccv_advanced>1</useccv_advanced>
1158
+ </depends>
1159
+ </extpol_cv2policy_matched>
1160
+ <extpol_cv2policy_notmatched translate="label">
1161
+ <label>Not matched</label>
1162
+ <frontend_type>select</frontend_type>
1163
+ <source_model>dpg/source_acceptreject</source_model>
1164
+ <sort_order>200</sort_order>
1165
+ <show_in_default>1</show_in_default>
1166
+ <show_in_website>1</show_in_website>
1167
+ <show_in_store>0</show_in_store>
1168
+ <depends>
1169
+ <useccv_advanced>1</useccv_advanced>
1170
+ </depends>
1171
+ </extpol_cv2policy_notmatched>
1172
+ <extpol_cv2policy_partialmatch translate="label">
1173
+ <label>Partial match</label>
1174
+ <frontend_type>select</frontend_type>
1175
+ <source_model>dpg/source_acceptreject</source_model>
1176
+ <sort_order>210</sort_order>
1177
+ <show_in_default>1</show_in_default>
1178
+ <show_in_website>1</show_in_website>
1179
+ <show_in_store>0</show_in_store>
1180
+ <depends>
1181
+ <useccv_advanced>1</useccv_advanced>
1182
+ </depends>
1183
+ </extpol_cv2policy_partialmatch>
1184
+ <heading_extpol_postcode translate="label">
1185
+ <label>Extended Policy - Postcode</label>
1186
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1187
+ <sort_order>230</sort_order>
1188
+ <show_in_default>1</show_in_default>
1189
+ <show_in_website>1</show_in_website>
1190
+ <show_in_store>0</show_in_store>
1191
+ <depends>
1192
+ <useccv_advanced>1</useccv_advanced>
1193
+ </depends>
1194
+ </heading_extpol_postcode>
1195
+ <extpol_postcode_notprovided translate="label">
1196
+ <label>Not provided</label>
1197
+ <frontend_type>select</frontend_type>
1198
+ <source_model>dpg/source_acceptreject</source_model>
1199
+ <sort_order>240</sort_order>
1200
+ <show_in_default>1</show_in_default>
1201
+ <show_in_website>1</show_in_website>
1202
+ <show_in_store>0</show_in_store>
1203
+ <depends>
1204
+ <useccv_advanced>1</useccv_advanced>
1205
+ </depends>
1206
+ </extpol_postcode_notprovided>
1207
+ <extpol_postcode_notchecked translate="label">
1208
+ <label>Not checked</label>
1209
+ <frontend_type>select</frontend_type>
1210
+ <source_model>dpg/source_acceptreject</source_model>
1211
+ <sort_order>250</sort_order>
1212
+ <show_in_default>1</show_in_default>
1213
+ <show_in_website>1</show_in_website>
1214
+ <show_in_store>0</show_in_store>
1215
+ <depends>
1216
+ <useccv_advanced>1</useccv_advanced>
1217
+ </depends>
1218
+ </extpol_postcode_notchecked>
1219
+ <extpol_postcode_matched translate="label">
1220
+ <label>Matched</label>
1221
+ <frontend_type>select</frontend_type>
1222
+ <source_model>dpg/source_acceptreject</source_model>
1223
+ <sort_order>260</sort_order>
1224
+ <show_in_default>1</show_in_default>
1225
+ <show_in_website>1</show_in_website>
1226
+ <show_in_store>0</show_in_store>
1227
+ <depends>
1228
+ <useccv_advanced>1</useccv_advanced>
1229
+ </depends>
1230
+ </extpol_postcode_matched>
1231
+ <extpol_postcode_notmatched translate="label">
1232
+ <label>Not matched</label>
1233
+ <frontend_type>select</frontend_type>
1234
+ <source_model>dpg/source_acceptreject</source_model>
1235
+ <sort_order>270</sort_order>
1236
+ <show_in_default>1</show_in_default>
1237
+ <show_in_website>1</show_in_website>
1238
+ <show_in_store>0</show_in_store>
1239
+ <depends>
1240
+ <useccv_advanced>1</useccv_advanced>
1241
+ </depends>
1242
+ </extpol_postcode_notmatched>
1243
+ <extpol_postcode_partialmatch translate="label">
1244
+ <label>Partial match</label>
1245
+ <frontend_type>select</frontend_type>
1246
+ <source_model>dpg/source_acceptreject</source_model>
1247
+ <sort_order>280</sort_order>
1248
+ <show_in_default>1</show_in_default>
1249
+ <show_in_website>1</show_in_website>
1250
+ <show_in_store>0</show_in_store>
1251
+ <depends>
1252
+ <useccv_advanced>1</useccv_advanced>
1253
+ </depends>
1254
+ </extpol_postcode_partialmatch>
1255
+ <heading_extpol_address translate="label">
1256
+ <label>Extended Policy - Address</label>
1257
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1258
+ <sort_order>300</sort_order>
1259
+ <show_in_default>1</show_in_default>
1260
+ <show_in_website>1</show_in_website>
1261
+ <show_in_store>0</show_in_store>
1262
+ <depends>
1263
+ <useccv_advanced>1</useccv_advanced>
1264
+ </depends>
1265
+ </heading_extpol_address>
1266
+ <extpol_address_notprovided translate="label">
1267
+ <label>Not provided</label>
1268
+ <frontend_type>select</frontend_type>
1269
+ <source_model>dpg/source_acceptreject</source_model>
1270
+ <sort_order>310</sort_order>
1271
+ <show_in_default>1</show_in_default>
1272
+ <show_in_website>1</show_in_website>
1273
+ <show_in_store>0</show_in_store>
1274
+ <depends>
1275
+ <useccv_advanced>1</useccv_advanced>
1276
+ </depends>
1277
+ </extpol_address_notprovided>
1278
+ <extpol_address_notchecked translate="label">
1279
+ <label>Not checked</label>
1280
+ <frontend_type>select</frontend_type>
1281
+ <source_model>dpg/source_acceptreject</source_model>
1282
+ <sort_order>320</sort_order>
1283
+ <show_in_default>1</show_in_default>
1284
+ <show_in_website>1</show_in_website>
1285
+ <show_in_store>0</show_in_store>
1286
+ <depends>
1287
+ <useccv_advanced>1</useccv_advanced>
1288
+ </depends>
1289
+ </extpol_address_notchecked>
1290
+ <extpol_address_matched translate="label">
1291
+ <label>Matched</label>
1292
+ <frontend_type>select</frontend_type>
1293
+ <source_model>dpg/source_acceptreject</source_model>
1294
+ <sort_order>330</sort_order>
1295
+ <show_in_default>1</show_in_default>
1296
+ <show_in_website>1</show_in_website>
1297
+ <show_in_store>0</show_in_store>
1298
+ <depends>
1299
+ <useccv_advanced>1</useccv_advanced>
1300
+ </depends>
1301
+ </extpol_address_matched>
1302
+ <extpol_address_notmatched translate="label">
1303
+ <label>Not matched</label>
1304
+ <frontend_type>select</frontend_type>
1305
+ <source_model>dpg/source_acceptreject</source_model>
1306
+ <sort_order>340</sort_order>
1307
+ <show_in_default>1</show_in_default>
1308
+ <show_in_website>1</show_in_website>
1309
+ <show_in_store>0</show_in_store>
1310
+ <depends>
1311
+ <useccv_advanced>1</useccv_advanced>
1312
+ </depends>
1313
+ </extpol_address_notmatched>
1314
+ <extpol_address_partialmatch translate="label">
1315
+ <label>Partial match</label>
1316
+ <frontend_type>select</frontend_type>
1317
+ <source_model>dpg/source_acceptreject</source_model>
1318
+ <sort_order>350</sort_order>
1319
+ <show_in_default>1</show_in_default>
1320
+ <show_in_website>1</show_in_website>
1321
+ <show_in_store>0</show_in_store>
1322
+ <depends>
1323
+ <useccv_advanced>1</useccv_advanced>
1324
+ </depends>
1325
+ </extpol_address_partialmatch>
1326
+ <heading_3dsecure translate="label">
1327
+ <label>3D Secure</label>
1328
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1329
+ <sort_order>400</sort_order>
1330
+ <show_in_default>1</show_in_default>
1331
+ <show_in_website>1</show_in_website>
1332
+ <show_in_store>1</show_in_store>
1333
+ </heading_3dsecure>
1334
+ <centinel translate="label">
1335
+ <label>3D Secure Card Validation</label>
1336
+ <frontend_type>select</frontend_type>
1337
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1338
+ <sort_order>410</sort_order>
1339
+ <show_in_default>1</show_in_default>
1340
+ <show_in_website>1</show_in_website>
1341
+ <show_in_store>1</show_in_store>
1342
+ </centinel>
1343
+ <heading_3dsecure_behaviours translate="label">
1344
+ <label>3-D Secure Behaviours</label>
1345
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1346
+ <sort_order>420</sort_order>
1347
+ <show_in_default>1</show_in_default>
1348
+ <show_in_website>1</show_in_website>
1349
+ <show_in_store>1</show_in_store>
1350
+ <depends>
1351
+ <centinel>1</centinel>
1352
+ </depends>
1353
+ </heading_3dsecure_behaviours>
1354
+ <threedsecure_behaviour_159 translate="label">
1355
+ <label>DPG Response 159 - No VERes from DS</label>
1356
+ <comment><![CDATA[
1357
+ If DataCash does not receive a response from the <br />
1358
+ Directory Service, the card cannot be validated as <br />
1359
+ participating in 3-D Secure. In these circumstances <br />
1360
+ please choose how you would like to continue.
1361
+ ]]></comment>
1362
+ <frontend_type>select</frontend_type>
1363
+ <source_model>dpg/source_threedstypes</source_model>
1364
+ <sort_order>430</sort_order>
1365
+ <show_in_default>1</show_in_default>
1366
+ <show_in_website>1</show_in_website>
1367
+ <show_in_store>1</show_in_store>
1368
+ <depends>
1369
+ <centinel>1</centinel>
1370
+ </depends>
1371
+ </threedsecure_behaviour_159>
1372
+ <threedsecure_behaviour_160 translate="label">
1373
+ <label>DPG Response 160 - Invalid VERes from DS</label>
1374
+ <comment><![CDATA[
1375
+ If DataCash does receive a response from the Directory Service <br />
1376
+ but it is invalid, it is not possible to ascertain if the <br />
1377
+ card is participating in 3-D Secure. In these circumstances <br />
1378
+ please choose how you would like to continue.
1379
+ ]]></comment>
1380
+ <frontend_type>select</frontend_type>
1381
+ <source_model>dpg/source_threedstypes</source_model>
1382
+ <sort_order>440</sort_order>
1383
+ <show_in_default>1</show_in_default>
1384
+ <show_in_website>1</show_in_website>
1385
+ <show_in_store>1</show_in_store>
1386
+ <depends>
1387
+ <centinel>1</centinel>
1388
+ </depends>
1389
+ </threedsecure_behaviour_160>
1390
+ <threedsecure_behaviour_173 translate="label">
1391
+ <label>DPG Response 173 - Card not Enrolled in Cache</label>
1392
+ <comment><![CDATA[
1393
+ Card is not in cache so no 3-D Secure Enrollment Check Request is submitted. <br />
1394
+ In these circumstances please choose how you would like to continue.
1395
+ ]]></comment>
1396
+ <frontend_type>select</frontend_type>
1397
+ <source_model>dpg/source_threedstypes</source_model>
1398
+ <sort_order>450</sort_order>
1399
+ <show_in_default>1</show_in_default>
1400
+ <show_in_website>1</show_in_website>
1401
+ <show_in_store>1</show_in_store>
1402
+ <depends>
1403
+ <centinel>1</centinel>
1404
+ </depends>
1405
+ </threedsecure_behaviour_173>
1406
+ <threedsecure_behaviour_187 translate="label">
1407
+ <label>DPG Response 187 - Unable to Verify</label>
1408
+ <comment><![CDATA[
1409
+ If DataCash is not able to communicate with the Directory Service <br />
1410
+ there is no way of establishing if the card is participating in 3-D Secure. <br />
1411
+ In these circumstances please choose how you would like to continue.
1412
+ ]]></comment>
1413
+ <frontend_type>select</frontend_type>
1414
+ <source_model>dpg/source_threedstypes</source_model>
1415
+ <sort_order>460</sort_order>
1416
+ <show_in_default>1</show_in_default>
1417
+ <show_in_website>1</show_in_website>
1418
+ <show_in_store>1</show_in_store>
1419
+ <depends>
1420
+ <centinel>1</centinel>
1421
+ </depends>
1422
+ </threedsecure_behaviour_187>
1423
+ </fields>
1424
+ </datacash_api>
1425
+ <datacash_apiprereg translate="label,comment" module="dpg">
1426
+ <label>DataCash :: API (with pre-registered cards)</label>
1427
+ <frontend_type>text</frontend_type>
1428
+ <sort_order>4000</sort_order>
1429
+ <show_in_default>1</show_in_default>
1430
+ <show_in_website>1</show_in_website>
1431
+ <show_in_store>1</show_in_store>
1432
+ <fields>
1433
+ <active translate="label">
1434
+ <label>Enabled</label>
1435
+ <frontend_type>select</frontend_type>
1436
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1437
+ <sort_order>0</sort_order>
1438
+ <show_in_default>1</show_in_default>
1439
+ <show_in_website>1</show_in_website>
1440
+ <show_in_store>1</show_in_store>
1441
+ </active>
1442
+ <title translate="label">
1443
+ <label>Title</label>
1444
+ <frontend_type>text</frontend_type>
1445
+ <sort_order>10</sort_order>
1446
+ <show_in_default>1</show_in_default>
1447
+ <show_in_website>1</show_in_website>
1448
+ <show_in_store>1</show_in_store>
1449
+ </title>
1450
+ <order_status translate="label">
1451
+ <label>New Order Status</label>
1452
+ <frontend_type>select</frontend_type>
1453
+ <source_model>adminhtml/system_config_source_order_status</source_model>
1454
+ <sort_order>20</sort_order>
1455
+ <show_in_default>1</show_in_default>
1456
+ <show_in_website>1</show_in_website>
1457
+ <show_in_store>1</show_in_store>
1458
+ </order_status>
1459
+ <payment_action>
1460
+ <label>Payment Action</label>
1461
+ <frontend_type>select</frontend_type>
1462
+ <source_model>dpg/source_authtypes</source_model>
1463
+ <sort_order>30</sort_order>
1464
+ <show_in_default>1</show_in_default>
1465
+ <show_in_website>1</show_in_website>
1466
+ <show_in_store>0</show_in_store>
1467
+ </payment_action>
1468
+ <allowspecific translate="label">
1469
+ <label>Payment Applicable From</label>
1470
+ <frontend_type>select</frontend_type>
1471
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1472
+ <sort_order>40</sort_order>
1473
+ <show_in_default>1</show_in_default>
1474
+ <show_in_website>1</show_in_website>
1475
+ <show_in_store>1</show_in_store>
1476
+ </allowspecific>
1477
+ <sort_order translate="label">
1478
+ <label>Sort Order</label>
1479
+ <frontend_type>text</frontend_type>
1480
+ <sort_order>45</sort_order>
1481
+ <show_in_default>1</show_in_default>
1482
+ <show_in_website>1</show_in_website>
1483
+ <show_in_store>0</show_in_store>
1484
+ </sort_order>
1485
+ <specificcountry translate="label">
1486
+ <label>Countries Payment Applicable From</label>
1487
+ <frontend_type>multiselect</frontend_type>
1488
+ <source_model>adminhtml/system_config_source_country</source_model>
1489
+ <sort_order>50</sort_order>
1490
+ <show_in_default>1</show_in_default>
1491
+ <show_in_website>1</show_in_website>
1492
+ <show_in_store>1</show_in_store>
1493
+ <depends>
1494
+ <allowspecific>1</allowspecific>
1495
+ </depends>
1496
+ </specificcountry>
1497
+ <heading_merchant translate="label">
1498
+ <label>DataCash Integration</label>
1499
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1500
+ <sort_order>60</sort_order>
1501
+ <show_in_default>1</show_in_default>
1502
+ <show_in_website>1</show_in_website>
1503
+ <show_in_store>1</show_in_store>
1504
+ </heading_merchant>
1505
+ <merchant_id>
1506
+ <label>Merchant ID</label>
1507
+ <comment><![CDATA[
1508
+ Used when posting data from Magento to DataCash. <br/>
1509
+ Supplied by DataCash when you setup your account.
1510
+ ]]></comment>
1511
+ <frontend_type>text</frontend_type>
1512
+ <sort_order>70</sort_order>
1513
+ <show_in_default>1</show_in_default>
1514
+ <show_in_website>1</show_in_website>
1515
+ <show_in_store>1</show_in_store>
1516
+ </merchant_id>
1517
+ <merchant_password translate="label">
1518
+ <label>Merchant Key</label>
1519
+ <comment><![CDATA[
1520
+ Used when posting data from Magento to DataCash. <br/>
1521
+ Supplied by DataCash when you setup your account. <br/>
1522
+ This will be reset every 12 months and will need to be updated.
1523
+ ]]></comment>
1524
+ <frontend_type>obscure</frontend_type>
1525
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
1526
+ <sort_order>80</sort_order>
1527
+ <show_in_default>1</show_in_default>
1528
+ <show_in_website>1</show_in_website>
1529
+ <show_in_store>1</show_in_store>
1530
+ </merchant_password>
1531
+ <line_items_enabled translate="label">
1532
+ <label>Send Line Items</label>
1533
+ <comment><![CDATA[
1534
+ Enabling this will send line item data to DataCash<br/>
1535
+ <strong>Will impose limitations for partial fulfilment and refunds</strong>
1536
+ ]]></comment>
1537
+ <frontend_type>select</frontend_type>
1538
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1539
+ <sort_order>90</sort_order>
1540
+ <show_in_default>1</show_in_default>
1541
+ <show_in_website>1</show_in_website>
1542
+ <show_in_store>0</show_in_store>
1543
+ </line_items_enabled>
1544
+ <debug translate="label">
1545
+ <label>Debug</label>
1546
+ <comment><![CDATA[
1547
+ Enable additional log output for payment processes
1548
+ ]]></comment>
1549
+ <frontend_type>select</frontend_type>
1550
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1551
+ <sort_order>100</sort_order>
1552
+ <show_in_default>1</show_in_default>
1553
+ <show_in_website>1</show_in_website>
1554
+ <show_in_store>0</show_in_store>
1555
+ </debug>
1556
+ <sandbox translate="label">
1557
+ <label>Test Mode</label>
1558
+ <comment><![CDATA[
1559
+ Use the DataCash test server.
1560
+ ]]></comment>
1561
+ <frontend_type>select</frontend_type>
1562
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1563
+ <sort_order>110</sort_order>
1564
+ <show_in_default>1</show_in_default>
1565
+ <show_in_website>1</show_in_website>
1566
+ <show_in_store>0</show_in_store>
1567
+ </sandbox>
1568
+ <heading_card_settings translate="label">
1569
+ <label>Credit Card Settings</label>
1570
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1571
+ <sort_order>120</sort_order>
1572
+ <show_in_default>1</show_in_default>
1573
+ <show_in_website>1</show_in_website>
1574
+ <show_in_store>1</show_in_store>
1575
+ </heading_card_settings>
1576
+ <cctypes translate="label">
1577
+ <label>Credit Card Types</label>
1578
+ <frontend_type>multiselect</frontend_type>
1579
+ <source_model>adminhtml/system_config_source_payment_cctype</source_model>
1580
+ <sort_order>130</sort_order>
1581
+ <show_in_default>1</show_in_default>
1582
+ <show_in_website>1</show_in_website>
1583
+ <show_in_store>1</show_in_store>
1584
+ </cctypes>
1585
+ <heading_useccv translate="label">
1586
+ <label>CV2</label>
1587
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1588
+ <sort_order>135</sort_order>
1589
+ <show_in_default>1</show_in_default>
1590
+ <show_in_website>1</show_in_website>
1591
+ <show_in_store>0</show_in_store>
1592
+ </heading_useccv>
1593
+ <useccv translate="label">
1594
+ <label>Request CV2 Card Security Code</label>
1595
+ <frontend_type>select</frontend_type>
1596
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1597
+ <sort_order>140</sort_order>
1598
+ <show_in_default>1</show_in_default>
1599
+ <show_in_website>1</show_in_website>
1600
+ <show_in_store>0</show_in_store>
1601
+ </useccv>
1602
+ <useccv_advanced translate="label">
1603
+ <label>Use Extended CV2 Policy</label>
1604
+ <frontend_type>select</frontend_type>
1605
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1606
+ <sort_order>150</sort_order>
1607
+ <show_in_default>1</show_in_default>
1608
+ <show_in_website>1</show_in_website>
1609
+ <show_in_store>0</show_in_store>
1610
+ <depends>
1611
+ <useccv>1</useccv>
1612
+ </depends>
1613
+ </useccv_advanced>
1614
+ <heading_extpol_cv2policy translate="label">
1615
+ <label>Extended Policy - CV2</label>
1616
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1617
+ <sort_order>160</sort_order>
1618
+ <show_in_default>1</show_in_default>
1619
+ <show_in_website>1</show_in_website>
1620
+ <show_in_store>0</show_in_store>
1621
+ <depends>
1622
+ <useccv_advanced>1</useccv_advanced>
1623
+ </depends>
1624
+ </heading_extpol_cv2policy>
1625
+ <extpol_cv2policy_notprovided translate="label">
1626
+ <label>Not provided</label>
1627
+ <frontend_type>select</frontend_type>
1628
+ <source_model>dpg/source_acceptreject</source_model>
1629
+ <sort_order>170</sort_order>
1630
+ <show_in_default>1</show_in_default>
1631
+ <show_in_website>1</show_in_website>
1632
+ <show_in_store>0</show_in_store>
1633
+ <depends>
1634
+ <useccv_advanced>1</useccv_advanced>
1635
+ </depends>
1636
+ </extpol_cv2policy_notprovided>
1637
+ <extpol_cv2policy_notchecked translate="label">
1638
+ <label>Not checked</label>
1639
+ <frontend_type>select</frontend_type>
1640
+ <source_model>dpg/source_acceptreject</source_model>
1641
+ <sort_order>180</sort_order>
1642
+ <show_in_default>1</show_in_default>
1643
+ <show_in_website>1</show_in_website>
1644
+ <show_in_store>0</show_in_store>
1645
+ <depends>
1646
+ <useccv_advanced>1</useccv_advanced>
1647
+ </depends>
1648
+ </extpol_cv2policy_notchecked>
1649
+ <extpol_cv2policy_matched translate="label">
1650
+ <label>Matched</label>
1651
+ <frontend_type>select</frontend_type>
1652
+ <source_model>dpg/source_acceptreject</source_model>
1653
+ <sort_order>190</sort_order>
1654
+ <show_in_default>1</show_in_default>
1655
+ <show_in_website>1</show_in_website>
1656
+ <show_in_store>0</show_in_store>
1657
+ <depends>
1658
+ <useccv_advanced>1</useccv_advanced>
1659
+ </depends>
1660
+ </extpol_cv2policy_matched>
1661
+ <extpol_cv2policy_notmatched translate="label">
1662
+ <label>Not matched</label>
1663
+ <frontend_type>select</frontend_type>
1664
+ <source_model>dpg/source_acceptreject</source_model>
1665
+ <sort_order>200</sort_order>
1666
+ <show_in_default>1</show_in_default>
1667
+ <show_in_website>1</show_in_website>
1668
+ <show_in_store>0</show_in_store>
1669
+ <depends>
1670
+ <useccv_advanced>1</useccv_advanced>
1671
+ </depends>
1672
+ </extpol_cv2policy_notmatched>
1673
+ <extpol_cv2policy_partialmatch translate="label">
1674
+ <label>Partial match</label>
1675
+ <frontend_type>select</frontend_type>
1676
+ <source_model>dpg/source_acceptreject</source_model>
1677
+ <sort_order>210</sort_order>
1678
+ <show_in_default>1</show_in_default>
1679
+ <show_in_website>1</show_in_website>
1680
+ <show_in_store>0</show_in_store>
1681
+ <depends>
1682
+ <useccv_advanced>1</useccv_advanced>
1683
+ </depends>
1684
+ </extpol_cv2policy_partialmatch>
1685
+ <heading_extpol_postcode translate="label">
1686
+ <label>Extended Policy - Postcode</label>
1687
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1688
+ <sort_order>230</sort_order>
1689
+ <show_in_default>1</show_in_default>
1690
+ <show_in_website>1</show_in_website>
1691
+ <show_in_store>0</show_in_store>
1692
+ <depends>
1693
+ <useccv_advanced>1</useccv_advanced>
1694
+ </depends>
1695
+ </heading_extpol_postcode>
1696
+ <extpol_postcode_notprovided translate="label">
1697
+ <label>Not provided</label>
1698
+ <frontend_type>select</frontend_type>
1699
+ <source_model>dpg/source_acceptreject</source_model>
1700
+ <sort_order>240</sort_order>
1701
+ <show_in_default>1</show_in_default>
1702
+ <show_in_website>1</show_in_website>
1703
+ <show_in_store>0</show_in_store>
1704
+ <depends>
1705
+ <useccv_advanced>1</useccv_advanced>
1706
+ </depends>
1707
+ </extpol_postcode_notprovided>
1708
+ <extpol_postcode_notchecked translate="label">
1709
+ <label>Not checked</label>
1710
+ <frontend_type>select</frontend_type>
1711
+ <source_model>dpg/source_acceptreject</source_model>
1712
+ <sort_order>250</sort_order>
1713
+ <show_in_default>1</show_in_default>
1714
+ <show_in_website>1</show_in_website>
1715
+ <show_in_store>0</show_in_store>
1716
+ <depends>
1717
+ <useccv_advanced>1</useccv_advanced>
1718
+ </depends>
1719
+ </extpol_postcode_notchecked>
1720
+ <extpol_postcode_matched translate="label">
1721
+ <label>Matched</label>
1722
+ <frontend_type>select</frontend_type>
1723
+ <source_model>dpg/source_acceptreject</source_model>
1724
+ <sort_order>260</sort_order>
1725
+ <show_in_default>1</show_in_default>
1726
+ <show_in_website>1</show_in_website>
1727
+ <show_in_store>0</show_in_store>
1728
+ <depends>
1729
+ <useccv_advanced>1</useccv_advanced>
1730
+ </depends>
1731
+ </extpol_postcode_matched>
1732
+ <extpol_postcode_notmatched translate="label">
1733
+ <label>Not matched</label>
1734
+ <frontend_type>select</frontend_type>
1735
+ <source_model>dpg/source_acceptreject</source_model>
1736
+ <sort_order>270</sort_order>
1737
+ <show_in_default>1</show_in_default>
1738
+ <show_in_website>1</show_in_website>
1739
+ <show_in_store>0</show_in_store>
1740
+ <depends>
1741
+ <useccv_advanced>1</useccv_advanced>
1742
+ </depends>
1743
+ </extpol_postcode_notmatched>
1744
+ <extpol_postcode_partialmatch translate="label">
1745
+ <label>Partial match</label>
1746
+ <frontend_type>select</frontend_type>
1747
+ <source_model>dpg/source_acceptreject</source_model>
1748
+ <sort_order>280</sort_order>
1749
+ <show_in_default>1</show_in_default>
1750
+ <show_in_website>1</show_in_website>
1751
+ <show_in_store>0</show_in_store>
1752
+ <depends>
1753
+ <useccv_advanced>1</useccv_advanced>
1754
+ </depends>
1755
+ </extpol_postcode_partialmatch>
1756
+ <heading_extpol_address translate="label">
1757
+ <label>Extended Policy - Address</label>
1758
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1759
+ <sort_order>300</sort_order>
1760
+ <show_in_default>1</show_in_default>
1761
+ <show_in_website>1</show_in_website>
1762
+ <show_in_store>0</show_in_store>
1763
+ <depends>
1764
+ <useccv_advanced>1</useccv_advanced>
1765
+ </depends>
1766
+ </heading_extpol_address>
1767
+ <extpol_address_notprovided translate="label">
1768
+ <label>Not provided</label>
1769
+ <frontend_type>select</frontend_type>
1770
+ <source_model>dpg/source_acceptreject</source_model>
1771
+ <sort_order>310</sort_order>
1772
+ <show_in_default>1</show_in_default>
1773
+ <show_in_website>1</show_in_website>
1774
+ <show_in_store>0</show_in_store>
1775
+ <depends>
1776
+ <useccv_advanced>1</useccv_advanced>
1777
+ </depends>
1778
+ </extpol_address_notprovided>
1779
+ <extpol_address_notchecked translate="label">
1780
+ <label>Not checked</label>
1781
+ <frontend_type>select</frontend_type>
1782
+ <source_model>dpg/source_acceptreject</source_model>
1783
+ <sort_order>320</sort_order>
1784
+ <show_in_default>1</show_in_default>
1785
+ <show_in_website>1</show_in_website>
1786
+ <show_in_store>0</show_in_store>
1787
+ <depends>
1788
+ <useccv_advanced>1</useccv_advanced>
1789
+ </depends>
1790
+ </extpol_address_notchecked>
1791
+ <extpol_address_matched translate="label">
1792
+ <label>Matched</label>
1793
+ <frontend_type>select</frontend_type>
1794
+ <source_model>dpg/source_acceptreject</source_model>
1795
+ <sort_order>330</sort_order>
1796
+ <show_in_default>1</show_in_default>
1797
+ <show_in_website>1</show_in_website>
1798
+ <show_in_store>0</show_in_store>
1799
+ <depends>
1800
+ <useccv_advanced>1</useccv_advanced>
1801
+ </depends>
1802
+ </extpol_address_matched>
1803
+ <extpol_address_notmatched translate="label">
1804
+ <label>Not matched</label>
1805
+ <frontend_type>select</frontend_type>
1806
+ <source_model>dpg/source_acceptreject</source_model>
1807
+ <sort_order>340</sort_order>
1808
+ <show_in_default>1</show_in_default>
1809
+ <show_in_website>1</show_in_website>
1810
+ <show_in_store>0</show_in_store>
1811
+ <depends>
1812
+ <useccv_advanced>1</useccv_advanced>
1813
+ </depends>
1814
+ </extpol_address_notmatched>
1815
+ <extpol_address_partialmatch translate="label">
1816
+ <label>Partial match</label>
1817
+ <frontend_type>select</frontend_type>
1818
+ <source_model>dpg/source_acceptreject</source_model>
1819
+ <sort_order>350</sort_order>
1820
+ <show_in_default>1</show_in_default>
1821
+ <show_in_website>1</show_in_website>
1822
+ <show_in_store>0</show_in_store>
1823
+ <depends>
1824
+ <useccv_advanced>1</useccv_advanced>
1825
+ </depends>
1826
+ </extpol_address_partialmatch>
1827
+ <heading_3dsecure translate="label">
1828
+ <label>3D Secure</label>
1829
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1830
+ <sort_order>400</sort_order>
1831
+ <show_in_default>1</show_in_default>
1832
+ <show_in_website>1</show_in_website>
1833
+ <show_in_store>1</show_in_store>
1834
+ </heading_3dsecure>
1835
+ <centinel translate="label">
1836
+ <label>3D Secure Card Validation</label>
1837
+ <frontend_type>select</frontend_type>
1838
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1839
+ <sort_order>410</sort_order>
1840
+ <show_in_default>1</show_in_default>
1841
+ <show_in_website>1</show_in_website>
1842
+ <show_in_store>1</show_in_store>
1843
+ </centinel>
1844
+ <heading_3dsecure_behaviours translate="label">
1845
+ <label>3-D Secure Behaviours</label>
1846
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1847
+ <sort_order>420</sort_order>
1848
+ <show_in_default>1</show_in_default>
1849
+ <show_in_website>1</show_in_website>
1850
+ <show_in_store>1</show_in_store>
1851
+ <depends>
1852
+ <centinel>1</centinel>
1853
+ </depends>
1854
+ </heading_3dsecure_behaviours>
1855
+ <threedsecure_behaviour_159 translate="label">
1856
+ <label>DPG Response 159 - No VERes from DS</label>
1857
+ <comment><![CDATA[
1858
+ If DataCash does not receive a response from the <br />
1859
+ Directory Service, the card cannot be validated as <br />
1860
+ participating in 3-D Secure. In these circumstances <br />
1861
+ please choose how you would like to continue.
1862
+ ]]></comment>
1863
+ <frontend_type>select</frontend_type>
1864
+ <source_model>dpg/source_threedstypes</source_model>
1865
+ <sort_order>430</sort_order>
1866
+ <show_in_default>1</show_in_default>
1867
+ <show_in_website>1</show_in_website>
1868
+ <show_in_store>1</show_in_store>
1869
+ <depends>
1870
+ <centinel>1</centinel>
1871
+ </depends>
1872
+ </threedsecure_behaviour_159>
1873
+ <threedsecure_behaviour_160 translate="label">
1874
+ <label>DPG Response 160 - Invalid VERes from DS</label>
1875
+ <comment><![CDATA[
1876
+ If DataCash does receive a response from the Directory Service <br />
1877
+ but it is invalid, it is not possible to ascertain if the <br />
1878
+ card is participating in 3-D Secure. In these circumstances <br />
1879
+ please choose how you would like to continue.
1880
+ ]]></comment>
1881
+ <frontend_type>select</frontend_type>
1882
+ <source_model>dpg/source_threedstypes</source_model>
1883
+ <sort_order>440</sort_order>
1884
+ <show_in_default>1</show_in_default>
1885
+ <show_in_website>1</show_in_website>
1886
+ <show_in_store>1</show_in_store>
1887
+ <depends>
1888
+ <centinel>1</centinel>
1889
+ </depends>
1890
+ </threedsecure_behaviour_160>
1891
+ <threedsecure_behaviour_173 translate="label">
1892
+ <label>DPG Response 173 - Card not Enrolled in Cache</label>
1893
+ <comment><![CDATA[
1894
+ Card is not in cache so no 3-D Secure Enrollment Check Request is submitted. <br />
1895
+ In these circumstances please choose how you would like to continue.
1896
+ ]]></comment>
1897
+ <frontend_type>select</frontend_type>
1898
+ <source_model>dpg/source_threedstypes</source_model>
1899
+ <sort_order>450</sort_order>
1900
+ <show_in_default>1</show_in_default>
1901
+ <show_in_website>1</show_in_website>
1902
+ <show_in_store>1</show_in_store>
1903
+ <depends>
1904
+ <centinel>1</centinel>
1905
+ </depends>
1906
+ </threedsecure_behaviour_173>
1907
+ <threedsecure_behaviour_187 translate="label">
1908
+ <label>DPG Response 187 - Unable to Verify</label>
1909
+ <comment><![CDATA[
1910
+ If DataCash is not able to communicate with the Directory Service <br />
1911
+ there is no way of establishing if the card is participating in 3-D Secure. <br />
1912
+ In these circumstances please choose how you would like to continue.
1913
+ ]]></comment>
1914
+ <frontend_type>select</frontend_type>
1915
+ <source_model>dpg/source_threedstypes</source_model>
1916
+ <sort_order>460</sort_order>
1917
+ <show_in_default>1</show_in_default>
1918
+ <show_in_website>1</show_in_website>
1919
+ <show_in_store>1</show_in_store>
1920
+ <depends>
1921
+ <centinel>1</centinel>
1922
+ </depends>
1923
+ </threedsecure_behaviour_187>
1924
+ </fields>
1925
+ </datacash_apiprereg>
1926
+ </groups>
1927
+ </payment>
1928
+ </sections>
1929
+ </config>
app/code/community/DataCash/Dpg/sql/datacash_dpg_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ $installer = $this;
30
+ $installer->startSetup();
31
+
32
+ $installer->endSetup();
app/design/adminhtml/default/default/template/datacash/hcc/info.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_Info_Hcc
31
+ */
32
+ ?>
33
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
34
+
35
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
36
+ <table>
37
+ <?php foreach ($_specificInfo as $_label => $_value):?>
38
+ <tr>
39
+ <td><?php echo $this->escapeHtml($_label)?>:</td>
40
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
41
+ </tr>
42
+ <?php endforeach; ?>
43
+ </table>
44
+ <?php endif;?>
45
+
46
+ <?php echo $this->getChildHtml()?>
app/design/adminhtml/default/default/template/datacash/hps/info.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_Info_Hps
31
+ */
32
+ ?>
33
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
34
+
35
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
36
+ <table>
37
+ <?php foreach ($_specificInfo as $_label => $_value):?>
38
+ <tr>
39
+ <td><?php echo $this->escapeHtml($_label)?>:</td>
40
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
41
+ </tr>
42
+ <?php endforeach; ?>
43
+ </table>
44
+ <?php endif;?>
45
+
46
+ <?php echo $this->getChildHtml()?>
app/design/adminhtml/default/default/template/datacash/system/config/fieldset/hint.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_System_Config_Fieldset_Hint
31
+ */
32
+ ?>
33
+ <div class="payment-notice">
34
+ <br/>
35
+ <h4>DataCash Payment Processing</h4>
36
+ <p>DataCash has a single interface that allows organisations to process secure, multi-channel payments anywhere in the world.</p>
37
+ <p><a traget="blank" href="<?php echo $this->escapeHtml("http://www.datacash.com/") ?>"><?php echo Mage::helper('dpg')->__('View DataCash solutions.')?></a></p>
38
+ </div>
app/design/frontend/base/default/layout/datacash.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_hosted_start>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
6
+ </reference>
7
+ <reference name="content">
8
+ <block type="dpg/iframe_start" name="datacash_dpg_iframe" template="datacash/iframe/start.phtml" />
9
+ </reference>
10
+ </checkout_hosted_start>
11
+ <checkout_hosted_complete>
12
+ <reference name="root">
13
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
14
+ </reference>
15
+ <reference name="content">
16
+ <block type="dpg/iframe_complete" name="datacash_dpg_iframe_complete" template="datacash/iframe/complete.phtml" />
17
+ </reference>
18
+ </checkout_hosted_complete>
19
+ <checkout_onepage_paymentmethod>
20
+ <reference name="checkout.onepage.billing">
21
+ <block type="dpg/form_api" name="payment.method.datacash_api" />
22
+ <block type="dpg/form_apiprereg" name="payment.method.datacash_api_prereg" />
23
+ </reference>
24
+ </checkout_onepage_paymentmethod>
25
+ </layout>
app/design/frontend/base/default/template/datacash/form/cc.phtml ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+ <?php $_code=$this->getMethodCode() ?>
28
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
29
+ <?php /*
30
+ <li>
31
+ <div class="input-box">
32
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
33
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" />
34
+ </div>
35
+ </li>
36
+ */ ?>
37
+
38
+ <?php if($this->getConfig()->getIsAllowedStoredCards()): ?>
39
+ <li>
40
+ <label for="<?php echo $_code ?>_cc_trans_id" class="required"><em>*</em><?php echo $this->__('Stored Credit Card') ?></label>
41
+ <select id="<?php echo $_code ?>_cc_trans_id" name="payment[cc_trans_id]" class="required-entry validate-cc-trans-id-select">
42
+ <option value="new">Use New Card</option>
43
+ <?php $existing_cards = $this->getExistingCards(); ?>
44
+ <?php foreach ($existing_cards as $c) : ?>
45
+ <option value="<?php echo $c->getCcTransId() ?>">**** **** **** <?php echo $c->getCcLast4() ?></option>
46
+ <?php endforeach ?>
47
+ </select>
48
+ </li>
49
+ <?php endif; ?>
50
+ <li>
51
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
52
+ <div class="input-box">
53
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
54
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
55
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
56
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
57
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
58
+ <?php endforeach ?>
59
+ </select>
60
+ </div>
61
+ </li>
62
+ <li>
63
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
66
+ </div>
67
+ </li>
68
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
69
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
70
+ <div class="input-box">
71
+ <div class="v-fix">
72
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
73
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
74
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
75
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
76
+ <?php endforeach ?>
77
+ </select>
78
+ </div>
79
+ <div class="v-fix">
80
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
81
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
82
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
83
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
84
+ <?php endforeach ?>
85
+ </select>
86
+ </div>
87
+ </div>
88
+ </li>
89
+ <?php echo $this->getChildHtml() ?>
90
+ <?php if($this->hasVerification()): ?>
91
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
92
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
93
+ <div class="input-box">
94
+ <div class="v-fix">
95
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
96
+ </div>
97
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
98
+ </div>
99
+ </li>
100
+ <?php endif; ?>
101
+
102
+ <?php if ($this->hasSsCardType()): ?>
103
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
104
+ <ul class="inner-form">
105
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
106
+ <li>
107
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
108
+ <span class="input-box">
109
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
110
+ </span>
111
+ </li>
112
+
113
+ <li>
114
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
115
+ <div class="input-box">
116
+ <div class="v-fix">
117
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
118
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
119
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
120
+ <?php endforeach ?>
121
+ </select>
122
+ </div>
123
+ <div class="v-fix">
124
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
125
+ <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
126
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
127
+ <?php endforeach ?>
128
+ </select>
129
+ </div>
130
+ </div>
131
+ </li>
132
+ <li class="adv-container">&nbsp;</li>
133
+ </ul>
134
+ <script type="text/javascript">
135
+ //<![CDATA[
136
+ var SSChecked<?php echo $_code ?> = function() {
137
+ var elm = $('<?php echo $_code ?>_cc_type');
138
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
139
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
140
+ } else {
141
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
142
+ }
143
+ };
144
+
145
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
146
+ SSChecked<?php echo $_code ?>();
147
+ //]]>
148
+ </script>
149
+ </li>
150
+ <?php endif; ?>
151
+ </ul>
app/design/frontend/base/default/template/datacash/form/cc.phtml.backup ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+ <?php $_code=$this->getMethodCode() ?>
28
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
29
+ <?php /*
30
+ <li>
31
+ <div class="input-box">
32
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
33
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" />
34
+ </div>
35
+ </li>
36
+ */ ?>
37
+ <li>
38
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
39
+ <div class="input-box">
40
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
41
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
42
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
43
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
44
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
45
+ <?php endforeach ?>
46
+ </select>
47
+ </div>
48
+ </li>
49
+ <li>
50
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
51
+ <div class="input-box">
52
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
53
+ </div>
54
+ </li>
55
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
56
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
57
+ <div class="input-box">
58
+ <div class="v-fix">
59
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
60
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
61
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
62
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
63
+ <?php endforeach ?>
64
+ </select>
65
+ </div>
66
+ <div class="v-fix">
67
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
68
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
69
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
70
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
71
+ <?php endforeach ?>
72
+ </select>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php echo $this->getChildHtml() ?>
77
+ <?php if($this->hasVerification()): ?>
78
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
79
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
80
+ <div class="input-box">
81
+ <div class="v-fix">
82
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
83
+ </div>
84
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
85
+ </div>
86
+ </li>
87
+ <?php endif; ?>
88
+
89
+ <?php if ($this->hasSsCardType()): ?>
90
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
91
+ <ul class="inner-form">
92
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
93
+ <li>
94
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
95
+ <span class="input-box">
96
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
97
+ </span>
98
+ </li>
99
+
100
+ <li>
101
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
102
+ <div class="input-box">
103
+ <div class="v-fix">
104
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
105
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
106
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
107
+ <?php endforeach ?>
108
+ </select>
109
+ </div>
110
+ <div class="v-fix">
111
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
112
+ <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
113
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
114
+ <?php endforeach ?>
115
+ </select>
116
+ </div>
117
+ </div>
118
+ </li>
119
+ <li class="adv-container">&nbsp;</li>
120
+ </ul>
121
+ <script type="text/javascript">
122
+ //<![CDATA[
123
+ var SSChecked<?php echo $_code ?> = function() {
124
+ var elm = $('<?php echo $_code ?>_cc_type');
125
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
126
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
127
+ } else {
128
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
129
+ }
130
+ };
131
+
132
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
133
+ SSChecked<?php echo $_code ?>();
134
+ //]]>
135
+ </script>
136
+ </li>
137
+ <?php endif; ?>
138
+ </ul>
app/design/frontend/base/default/template/datacash/form/cc_prereg.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+ <?php
28
+ $_code = $this->getMethodCode();
29
+ $existing_cards = $this->getExistingCards();
30
+ $existing_cards_filtered = array();
31
+ foreach ($existing_cards as $c) {
32
+ if (isset($existing_cards_filtered[$c->getCcLast4()])) {
33
+ $lastcc = $existing_cards_filtered[$c->getCcLast4()];
34
+ if ($lastcc->getId() < $c->getId()) {
35
+ $existing_cards_filtered[$c->getCcLast4()] = $c;
36
+ }
37
+ } else {
38
+ $existing_cards_filtered[$c->getCcLast4()] = $c;
39
+ }
40
+ }
41
+ ?>
42
+
43
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
44
+ <?php /*
45
+ <li>
46
+ <div class="input-box">
47
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
48
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" />
49
+ </div>
50
+ </li>
51
+ */ ?>
52
+
53
+ <li>
54
+ <?php if ($existing_cards) : ?>
55
+ <label for="<?php echo $_code ?>_cc_trans_id" class="required"><em>*</em><?php echo $this->__('Stored Credit Card') ?></label>
56
+ <select id="<?php echo $_code ?>_cc_trans_id" name="payment[cc_trans_id]" class="required-entry validate-cc-trans-id-select">
57
+ <?php foreach ($existing_cards_filtered as $c) : ?>
58
+ <option value="<?php echo $c->getCcTransId() ?>">**** **** **** <?php echo $c->getCcLast4() ?></option>
59
+ <?php endforeach ?>
60
+ </select>
61
+ <?php else: ?>
62
+ <p>No pre-exising cards.</p>
63
+ <?php endif ?>
64
+ </li>
65
+ <?php echo $this->getChildHtml() ?>
66
+ <?php if($this->hasVerification()): ?>
67
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
68
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
69
+ <div class="input-box">
70
+ <div class="v-fix">
71
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
72
+ </div>
73
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
74
+ </div>
75
+ </li>
76
+ <?php endif; ?>
77
+ </ul>
app/design/frontend/base/default/template/datacash/hcc/form.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php $_code = $this->getMethodCode() ?>
2
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li><?php echo $this->__('You will be redirected to the DataCash website when you place an order.') ?></li>
4
+ </ul>
app/design/frontend/base/default/template/datacash/hcc/info.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_Info_Hcc
31
+ */
32
+ ?>
33
+ <p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
34
+
35
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
36
+ <table>
37
+ <tbody>
38
+ <?php foreach ($_specificInfo as $_label => $_value):?>
39
+ <tr>
40
+ <th><?php echo $this->escapeHtml($_label)?>:</th>
41
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
42
+ </tr>
43
+ <?php endforeach; ?>
44
+ </tbody>
45
+ </table>
46
+ <?php endif;?>
47
+
48
+ <?php echo $this->getChildHtml()?>
app/design/frontend/base/default/template/datacash/hcc/placeform.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p><strong>Please, wait a moment. This page will transfer your data to the Datacash payment gateway in a few seconds.</strong></p>
2
+ <form name="datacash_hcc" id="datacash_hcc_form" action="<?php echo $this->getHpsUrl();?>" method="get" accept-charset="ISO-8859-1">
3
+ <fieldset>
4
+ <input type="hidden" name="HPS_SessionID" value="<?php echo($this->getHpsSessionId()); ?>" />
5
+ </fieldset>
6
+ </form>
7
+ <script type="text/javascript">
8
+ //<![CDATA[
9
+ var review = new VarienForm('datacash_hcc_form', '');
10
+ Event.observe(window, 'load', function() {
11
+ review.submit();
12
+ });
13
+ //]]>
14
+ </script>
15
+
app/design/frontend/base/default/template/datacash/hps/form.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php $_code = $this->getMethodCode() ?>
2
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li><?php echo $this->__('You will be redirected to the DataCash website when you place an order.') ?></li>
4
+ </ul>
app/design/frontend/base/default/template/datacash/hps/info.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_Info_Hps
31
+ */
32
+ ?>
33
+ <p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
34
+
35
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
36
+ <table>
37
+ <tbody>
38
+ <?php foreach ($_specificInfo as $_label => $_value):?>
39
+ <tr>
40
+ <th><?php echo $this->escapeHtml($_label)?>:</th>
41
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
42
+ </tr>
43
+ <?php endforeach; ?>
44
+ </tbody>
45
+ </table>
46
+ <?php endif;?>
47
+
48
+ <?php echo $this->getChildHtml()?>
app/design/frontend/base/default/template/datacash/iframe/complete.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_Iframw_Complete
31
+ */
32
+ ?>
33
+ <?php if ($this->isSuccessful()): ?>
34
+ <script type="text/javascript">
35
+ //<![CDATA[
36
+ window.parent.payment.save()
37
+ //]]>
38
+ </script>
39
+ <?php else: ?>
40
+ <script type="text/javascript">
41
+ //<![CDATA[
42
+ alert(<?php echo Mage::helper('core')->jsonEncode($this->getError()->getText()); ?>)
43
+ window.parent.DataCashController.start('<?php echo $this->getFrameUrl() ?>');
44
+ //]]>
45
+ </script>
46
+ <?php endif;?>
app/design/frontend/base/default/template/datacash/iframe/form.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code = $this->getMethodCode() ?>
2
+ <ul class="form-list centinel" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li>
4
+ <div id="<?php echo $_code ?>_iframe_block">
5
+ <div class="authentication">
6
+ <iframe id="<?php echo $_code ?>_iframe" frameborder="0" border="0" src="" style="height: 456px;"></iframe>
7
+ </div>
8
+ </div>
9
+ <script type="text/javascript">
10
+ //<![CDATA[
11
+ Event.observe(window, 'load', function() {
12
+ var iframeId = '<?php echo $_code ?>_iframe';
13
+ var iframeTarget = '<?php echo $this->getFrameUrl() ?>';
14
+
15
+ // if Accordion is in use, listen for the payment step and load the
16
+ // iframe
17
+ if (typeof(Accordion) != 'undefined') {
18
+ var dcOpenSection = Accordion.prototype.openSection;
19
+ Accordion.prototype.openSection = function (section) {
20
+ dcOpenSection.call(this, section);
21
+
22
+ if (section.id == 'opc-payment') {
23
+ if ($('p_method_<?php echo $_code ?>').checked) {
24
+ $(iframeId).src = iframeTarget;
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ var onMethodSwitch = function (evt) {
31
+ if (evt.target.id == 'payment_form_<?php echo $_code ?>'
32
+ || evt.target.id == 'p_method_<?php echo $_code ?>') {
33
+ if ($(iframeId).src != iframeTarget) {
34
+ $(iframeId).src = iframeTarget;
35
+ }
36
+ }
37
+ }
38
+ // multishipping doesn't use the custom event interface
39
+ $('p_method_<?php echo $_code ?>').observe('change', onMethodSwitch);
40
+ // whereas onepage cancels the event so use the custom event
41
+ document.observe('payment-method:switched', onMethodSwitch);
42
+ });
43
+ //]]>
44
+ </script>
45
+ </li>
46
+ </ul>
app/design/frontend/base/default/template/datacash/iframe/start.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DataCash
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.
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 info@datacash.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 this module to newer
18
+ * versions in the future. If you wish to customize this module for your
19
+ * needs please refer to http://testserver.datacash.com/software/download.cgi
20
+ * for more information.
21
+ *
22
+ * @author Alistair Stead
23
+ * @version $Id$
24
+ * @copyright DataCash, 11 April, 2011
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ * @package DataCash
27
+ **/
28
+
29
+ /**
30
+ * @see DataCash_Dpg_Block_Iframe_Start
31
+ */
32
+ ?>
33
+ <p><strong>Please, wait a moment. This page will transfer your data to the DataCash payment gateway in a few seconds.</strong></p>
34
+ <form name="datacash_hosted" id="datacash_hosted_form" action="<?php echo $this->getStartUrl();?>" method="post">
35
+ <fieldset>
36
+ <input type="hidden" name="HPS_SessionID" value="<?php echo($this->getSessionId()); ?>" />
37
+ </fieldset>
38
+ </form>
39
+ <script type="text/javascript">
40
+ //<![CDATA[
41
+ var review = new VarienForm('datacash_hosted_form', '');
42
+ Event.observe(window, 'load', function() {
43
+ review.submit();
44
+ });
45
+ //]]>
46
+ </script>
app/etc/modules/DataCash_Payment.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <DataCash_Dpg>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Core />
9
+ <Mage_Payment />
10
+ <Mage_Centinel />
11
+ </depends>
12
+ </DataCash_Dpg>
13
+ </modules>
14
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Datacash</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>DataCash payment gateway integration</summary>
10
+ <description>DataCash payment gateway integration.&#xD;
11
+ &#xD;
12
+ System requirements as for Magento http://www.magentocommerce.com/system-requirements. &#xD;
13
+ cURL with the FOLLOWLOCATION option is used for service calls to DataCash. FOLLOWLOCATION requires safe_mode to be off and open_basedir to be disabled in the php.ini</description>
14
+ <notes>Initial version for Magento Connect based on pre-launch version 0.1.15.</notes>
15
+ <authors><author><name>DataCash</name><user>datacash</user><email>support@datacash.com</email></author></authors>
16
+ <date>2012-11-14</date>
17
+ <time>2012-11-14</time>
18
+ <contents><target name="magecommunity"><dir name="DataCash"><dir name="Dpg"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="c65030837e1ce97a063b9146f3bb983d"/></dir></dir></dir></dir><dir name="Form"><file name="Api.php" hash="7c04a67710e184da4f46b1f653273a44"/><file name="Apiprereg.php" hash="bf28b55b476562ff459012c9fc21bc6d"/><file name="Hcc.php" hash="b3406a87a800b9182a0e4e259cf75754"/><file name="Hps.php" hash="47a732ebb397a14a145851cdb00ceb0b"/><file name="Iframe.php" hash="178bc848a81c42fac0f341690d6df597"/><file name="Placeform.php" hash="19bafec3229f6f35382d9b725d41f620"/></dir><dir name="Iframe"><file name="Complete.php" hash="adbf0cb0a89aee5704cebf62dd63b4a9"/><file name="Start.php" hash="4fb94606c1aad2a4593169e3b8526152"/></dir><dir name="Info"><file name="Api.php" hash="a2893e155ba8c92776e12ed7d4472284"/><file name="Hcc.php" hash="7a2c713640e7fcee5d5c2150d1baff40"/><file name="Hps.php" hash="8b06d32980842db5274897d3bfba9df1"/></dir></dir><dir name="Controller"><file name="Abstract.php" hash="3082d6a39d67762df16eed690823aab3"/></dir><dir name="Helper"><file name="Data.php" hash="51d987249387daa39805ae8e29a0b7ac"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="070cec036514a25c63c290d0b1353aba"/><file name="Direct.php" hash="1a3a44f83e90d73ea076d3d0da78d308"/><file name="Directprereg.php" hash="1ba0633478037b367bf3f15f091dcdb4"/><file name="Hcc.php" hash="1b3eb2e1828e8336c447ad8bfcb75825"/><file name="Hps.php" hash="40616c129c29acb6978b4bf543b4187c"/></dir><file name="Code.php" hash="996b864fc427386854c3fb1d318e9231"/><file name="Config.php" hash="345d3d29181bd0ce9999f010bff59728"/><dir name="Datacash"><file name="Request.php" hash="d5ed936db2c3833cad68dcf72c877bff"/><file name="Response.php" hash="d40e4e87478b5c6718c2d1024760b974"/></dir><file name="Dpg.php" hash="5ded0f39a06d12f538fbdf8fe7553c7c"/><dir name="Entity"><file name="Setup.php" hash="d74a82e89fe2213034f6558956ad9633"/></dir><dir name="Method"><file name="Abstract.php" hash="bc13264d4c9877b66807531e01d31d89"/><file name="Api.php" hash="04fe70e7c76d8030e1f360f3c3d25bc9"/><file name="Apiprereg.php" hash="d4657215a54cf54f81efcf5bd579287e"/><file name="Hcc.php" hash="c48c2f2e433eb48378b7192cbaf7218b"/><dir name="Hosted"><file name="Abstract.php" hash="db47ba86ca37ddc5c7d85ef49e94dff4"/><file name="Interface.php" hash="926072fcd7d864e1f98da8b59b164eb7"/></dir><file name="Hps.php" hash="8cc5bb756e37457e20a6c457a7dbb7d8"/></dir><file name="Observer.php" hash="8b1bb83efec831a079d8a248a5aa1f9c"/><dir name="Service"><file name="Abstract.php" hash="ddc7dffebdbde49baf3e976828de15f9"/><file name="Direct.php" hash="2dc35bf8f06de86cbdcb2975ea08ef9d"/><file name="Directprereg.php" hash="342849147fb97872192d800a2457c917"/><file name="Hcc.php" hash="ef97de32a2d6f854f1df6d0a5b9f7a95"/><dir name="State"><file name="Datacash.php" hash="79df9d849f4d23e154c1075b776ca888"/></dir></dir><file name="Service.php" hash="3c5374cf5d2f3d802fe032dce47c1c64"/><dir name="Source"><file name="Acceptreject.php" hash="a3142c294701177d85aab3a6f214e9b2"/><file name="Authtypes.php" hash="a7923edddb42f8ea86b2abb07546d62a"/><file name="Threedstypes.php" hash="5f404d5d676a3baf0e0e71f1331decc2"/></dir></dir><dir name="controllers"><file name="HccController.php" hash="4257caa14117e23565568855abe307a9"/><file name="HostedController.php" hash="d08cef939ce21212e30150354f86f6fc"/><file name="HpsController.php" hash="7c94d6d858f20f810cfd6df61a3238f3"/><file name="T3mController.php" hash="bf54d16c48e5fc9fec96dad1e6e0f0fc"/></dir><dir name="etc"><file name="config.xml" hash="a7d95f96aaabce86e671eed47c933d05"/><file name="system.xml" hash="3cf66601f38555bf5b709dd7b62b9865"/></dir><dir name="sql"><dir name="datacash_dpg_setup"><file name="mysql4-install-0.1.0.php" hash="00a5d0be2b14d26ed85ed891b811abfc"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DataCash_Payment.xml" hash="7f1d393c458e2287f492fc01dd2f1265"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="datacash"><dir name="hcc"><file name="info.phtml" hash="02f4c24746861b51bf7b1cc71ad56bbe"/></dir><dir name="hps"><file name="info.phtml" hash="6ab593be19fc60bff92b5370b7f8809f"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="a411204abaf9b4a31806354189896553"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="datacash.xml" hash="5f2531bbff2d8a5d2a20ea3ec91ea91e"/></dir><dir name="template"><dir name="datacash"><dir name="form"><file name="cc.phtml" hash="7309b291dc636b43cbbcbdda8440016f"/><file name="cc.phtml.backup" hash="4930cc189ac48efe55694e5aec89939f"/><file name="cc_prereg.phtml" hash="5b33eaca19e25153a7bcedee02a6f0a6"/></dir><dir name="hcc"><file name="form.phtml" hash="81ed0746ffbd96d8000b95db7c281d03"/><file name="info.phtml" hash="eb512a6dab0d1396742cddf5c5db1598"/><file name="placeform.phtml" hash="b79869ff4346c230c6214b2bffdbc46c"/></dir><dir name="hps"><file name="form.phtml" hash="81ed0746ffbd96d8000b95db7c281d03"/><file name="info.phtml" hash="4bd99be8a9e08b77618fc2f596d2856a"/></dir><dir name="iframe"><file name="complete.phtml" hash="9190056410f552cb802a85b582127065"/><file name="form.phtml" hash="e4ffeaecf5117a0b473fd238364f11a5"/><file name="start.phtml" hash="3493cd85bf3b3ca604990bd3d810d14d"/></dir></dir></dir></dir></dir></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
+ </package>