Allopass_Hipay - Version 1.0.0

Version Notes

-New iframe templates

Download this release

Release Info

Developer Kassim_Profileo
Extension Allopass_Hipay
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (104) hide show
  1. app/code/community/Allopass/Hipay/.DS_Store +0 -0
  2. app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/3dsRule.php +44 -0
  3. app/code/community/Allopass/Hipay/Block/Checkout/Pending.php +30 -0
  4. app/code/community/Allopass/Hipay/Block/Form/Abstract.php +74 -0
  5. app/code/community/Allopass/Hipay/Block/Form/Cc.php +113 -0
  6. app/code/community/Allopass/Hipay/Block/Form/Hosted.php +10 -0
  7. app/code/community/Allopass/Hipay/Block/Info/Cc.php +103 -0
  8. app/code/community/Allopass/Hipay/Block/Info/Hosted.php +9 -0
  9. app/code/community/Allopass/Hipay/Controller/Payment.php +271 -0
  10. app/code/community/Allopass/Hipay/Helper/Data.php +203 -0
  11. app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Curl.php +483 -0
  12. app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Stream.php +20 -0
  13. app/code/community/Allopass/Hipay/Model/Api/Request.php +219 -0
  14. app/code/community/Allopass/Hipay/Model/Api/Response/Abstract.php +17 -0
  15. app/code/community/Allopass/Hipay/Model/Api/Response/Error.php +12 -0
  16. app/code/community/Allopass/Hipay/Model/Api/Response/Gateway.php +114 -0
  17. app/code/community/Allopass/Hipay/Model/Api/Response/Notification.php +33 -0
  18. app/code/community/Allopass/Hipay/Model/Api/Response/Vault.php +9 -0
  19. app/code/community/Allopass/Hipay/Model/Config.php +234 -0
  20. app/code/community/Allopass/Hipay/Model/Log/Adapter.php +118 -0
  21. app/code/community/Allopass/Hipay/Model/Method/Abstract.php +1003 -0
  22. app/code/community/Allopass/Hipay/Model/Method/Cbc.php +5 -0
  23. app/code/community/Allopass/Hipay/Model/Method/Cc.php +517 -0
  24. app/code/community/Allopass/Hipay/Model/Method/Dexia.php +5 -0
  25. app/code/community/Allopass/Hipay/Model/Method/Giropay.php +5 -0
  26. app/code/community/Allopass/Hipay/Model/Method/Hosted.php +118 -0
  27. app/code/community/Allopass/Hipay/Model/Method/Ideal.php +5 -0
  28. app/code/community/Allopass/Hipay/Model/Method/Ing.php +5 -0
  29. app/code/community/Allopass/Hipay/Model/Method/Kbc.php +5 -0
  30. app/code/community/Allopass/Hipay/Model/Method/Przelewy24.php +5 -0
  31. app/code/community/Allopass/Hipay/Model/Method/Przelewy24Api.php +83 -0
  32. app/code/community/Allopass/Hipay/Model/Method/Qiwi.php +5 -0
  33. app/code/community/Allopass/Hipay/Model/Method/Sisal.php +5 -0
  34. app/code/community/Allopass/Hipay/Model/Method/SisalApi.php +83 -0
  35. app/code/community/Allopass/Hipay/Model/Method/Sofort.php +5 -0
  36. app/code/community/Allopass/Hipay/Model/Method/SofortApi.php +83 -0
  37. app/code/community/Allopass/Hipay/Model/Method/Webmoney.php +5 -0
  38. app/code/community/Allopass/Hipay/Model/Method/WebmoneyApi.php +83 -0
  39. app/code/community/Allopass/Hipay/Model/Method/Yandex.php +5 -0
  40. app/code/community/Allopass/Hipay/Model/Method/YandexApi.php +83 -0
  41. app/code/community/Allopass/Hipay/Model/Observer.php +96 -0
  42. app/code/community/Allopass/Hipay/Model/Resource/Rule.php +19 -0
  43. app/code/community/Allopass/Hipay/Model/Resource/Rule/Collection.php +20 -0
  44. app/code/community/Allopass/Hipay/Model/Rule.php +44 -0
  45. app/code/community/Allopass/Hipay/Model/Rule/Condition/Address.php +231 -0
  46. app/code/community/Allopass/Hipay/Model/Rule/Condition/Combine.php +183 -0
  47. app/code/community/Allopass/Hipay/Model/Rule/Condition/Customer.php +186 -0
  48. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product.php +128 -0
  49. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Combine.php +172 -0
  50. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Found.php +70 -0
  51. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Subselect.php +102 -0
  52. app/code/community/Allopass/Hipay/Model/Rule/Config.php +93 -0
  53. app/code/community/Allopass/Hipay/Model/Source/3ds.php +39 -0
  54. app/code/community/Allopass/Hipay/Model/Source/CcType.php +24 -0
  55. app/code/community/Allopass/Hipay/Model/Source/CcTypeHosted.php +24 -0
  56. app/code/community/Allopass/Hipay/Model/Source/Order/HipayStatusValidate.php +20 -0
  57. app/code/community/Allopass/Hipay/Model/Source/Order/Status.php +28 -0
  58. app/code/community/Allopass/Hipay/Model/Source/Order/Status/Accepted.php +12 -0
  59. app/code/community/Allopass/Hipay/Model/Source/Order/Status/Canceled.php +11 -0
  60. app/code/community/Allopass/Hipay/Model/Source/Order/Status/New.php +11 -0
  61. app/code/community/Allopass/Hipay/Model/Source/Order/Status/Refused.php +12 -0
  62. app/code/community/Allopass/Hipay/Model/Source/PaymentAction.php +17 -0
  63. app/code/community/Allopass/Hipay/Model/Source/Pendingredirect.php +19 -0
  64. app/code/community/Allopass/Hipay/Model/Source/Template.php +35 -0
  65. app/code/community/Allopass/Hipay/controllers/Adminhtml/RuleController.php +37 -0
  66. app/code/community/Allopass/Hipay/controllers/CbcController.php +8 -0
  67. app/code/community/Allopass/Hipay/controllers/CcController.php +15 -0
  68. app/code/community/Allopass/Hipay/controllers/CheckoutController.php +40 -0
  69. app/code/community/Allopass/Hipay/controllers/DexiaController.php +8 -0
  70. app/code/community/Allopass/Hipay/controllers/GiropayController.php +8 -0
  71. app/code/community/Allopass/Hipay/controllers/HostedController.php +12 -0
  72. app/code/community/Allopass/Hipay/controllers/IdealController.php +8 -0
  73. app/code/community/Allopass/Hipay/controllers/IngController.php +8 -0
  74. app/code/community/Allopass/Hipay/controllers/KbcController.php +8 -0
  75. app/code/community/Allopass/Hipay/controllers/NotifyController.php +193 -0
  76. app/code/community/Allopass/Hipay/controllers/Przelewy24Controller.php +8 -0
  77. app/code/community/Allopass/Hipay/controllers/Przelewy24apiController.php +8 -0
  78. app/code/community/Allopass/Hipay/controllers/QiwiController.php +8 -0
  79. app/code/community/Allopass/Hipay/controllers/SisalController.php +8 -0
  80. app/code/community/Allopass/Hipay/controllers/SisalapiController.php +8 -0
  81. app/code/community/Allopass/Hipay/controllers/SofortController.php +8 -0
  82. app/code/community/Allopass/Hipay/controllers/SofortapiController.php +8 -0
  83. app/code/community/Allopass/Hipay/controllers/WebmoneyController.php +8 -0
  84. app/code/community/Allopass/Hipay/controllers/WebmoneyapiController.php +8 -0
  85. app/code/community/Allopass/Hipay/controllers/YandexController.php +8 -0
  86. app/code/community/Allopass/Hipay/controllers/YandexapiController.php +8 -0
  87. app/code/community/Allopass/Hipay/etc/config.xml +637 -0
  88. app/code/community/Allopass/Hipay/etc/system.xml +2586 -0
  89. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-install-0.1.0.php +45 -0
  90. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.0-0.1.1.php +123 -0
  91. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.1-0.1.2.php +38 -0
  92. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.2-0.1.3.php +72 -0
  93. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.4-0.1.5.php +24 -0
  94. app/design/adminhtml/default/default/layout/hipay.xml +12 -0
  95. app/design/adminhtml/default/default/template/hipay/system/config/form/field/rules.phtml +17 -0
  96. app/design/frontend/default/default/layout/hipay.xml +12 -0
  97. app/design/frontend/default/default/template/hipay/checkout/pending.phtml +8 -0
  98. app/design/frontend/default/default/template/hipay/form/cc.phtml +144 -0
  99. app/design/frontend/default/default/template/hipay/form/hosted.phtml +134 -0
  100. app/etc/modules/Allopass_Hipay.xml +9 -0
  101. app/locale/en_US/Allopass_Hipay.csv +107 -0
  102. app/locale/fr_FR/Allopass_Hipay.csv +107 -0
  103. package.xml +18 -0
  104. skin/adminhtml/default/default/hipay/js/rules.js +386 -0
app/code/community/Allopass/Hipay/.DS_Store ADDED
Binary file
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/3dsRule.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Block_Adminhtml_System_Config_Form_Field_3dsRule extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+
5
+ /**
6
+ * Check if columns are defined, set template
7
+ *
8
+ */
9
+ public function __construct()
10
+ {
11
+ if (!$this->_addButtonLabel) {
12
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add');
13
+ }
14
+ parent::__construct();
15
+ if (!$this->getTemplate()) {
16
+ $this->setTemplate('hipay/system/config/form/field/rules.phtml');
17
+ }
18
+ }
19
+
20
+ public function getNewChildUrl(){
21
+ return Mage::getUrl('hipay/adminhtml_rule/newConditionHtml/form/rule_conditions_fieldset');
22
+ }
23
+
24
+ /**
25
+ * Enter description here...
26
+ *
27
+ * @param Varien_Data_Form_Element_Abstract $element
28
+ * @return string
29
+ */
30
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
31
+ {
32
+ $partsId = explode("_", $element->getId());
33
+ $method_code = $partsId[1]. "_" . $partsId[2];
34
+ $rule = Mage::getModel('hipay/rule');
35
+ $rule->setMethodCode($method_code);
36
+ if($element->getValue())
37
+ $rule->load($element->getValue());
38
+
39
+ $element->setRule($rule);
40
+
41
+ $this->setElement($element);
42
+ return $this->_toHtml();
43
+ }
44
+ }
app/code/community/Allopass/Hipay/Block/Checkout/Pending.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Block_Checkout_Pending extends Mage_Core_Block_Template
3
+ {
4
+ public function getRealOrderId()
5
+ {
6
+ return Mage::getSingleton('checkout/session')->getLastRealOrderId();
7
+ }
8
+
9
+ /**
10
+ * Payment custom error message
11
+ *
12
+ * @return string
13
+ */
14
+ public function getErrorMessage ()
15
+ {
16
+ $error = Mage::getSingleton('checkout/session')->getErrorMessage();
17
+ // Mage::getSingleton('checkout/session')->unsErrorMessage();
18
+ return $error;
19
+ }
20
+
21
+ /**
22
+ * Continue shopping URL
23
+ *
24
+ * @return string
25
+ */
26
+ public function getContinueShoppingUrl()
27
+ {
28
+ return Mage::getUrl('checkout/cart');
29
+ }
30
+ }
app/code/community/Allopass/Hipay/Block/Form/Abstract.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_Form
3
+ {
4
+
5
+ /**
6
+ * Retrieve payment configuration object
7
+ *
8
+ * @return Allopass_Hipay_Model_Config
9
+ */
10
+ protected function _getConfig()
11
+ {
12
+ return Mage::getSingleton('hipay/config');
13
+ }
14
+
15
+
16
+ public function getCustomerHasAlias()
17
+ {
18
+ return $this->getCustomer()->getHipayAliasOneclick() != "";
19
+
20
+ }
21
+
22
+ public function getCustomer()
23
+ {
24
+ return Mage::getSingleton('customer/session')->getCustomer();
25
+ }
26
+
27
+ public function ccExpDateIsValid()
28
+ {
29
+ return $this->helper('hipay')->checkIfCcExpDateIsValid((int)Mage::getSingleton('customer/session')->getCustomerId());
30
+ }
31
+
32
+ public function oneClickIsAllowed()
33
+ {
34
+ $checkoutMethod = Mage::getSingleton('checkout/session')->getQuote()->getCheckoutMethod();
35
+
36
+ if($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST || !$this->allowUseOneClick())
37
+ return false;
38
+
39
+ return true;
40
+
41
+ }
42
+
43
+ public function getQuote()
44
+ {
45
+ return Mage::getSingleton('checkout/session')->getQuote();
46
+ }
47
+
48
+
49
+ public function allowUseOneClick()
50
+ {
51
+ return $this->getMethod()->getConfigData('allow_use_oneclick');
52
+ }
53
+
54
+ public function getIframeConfig()
55
+ {
56
+ $iframe['iframe_width'] = $this->getMethod()->getConfigData('iframe_width');
57
+ $iframe['iframe_height'] = $this->getMethod()->getConfigData('iframe_height');
58
+ $iframe['iframe_style'] = $this->getMethod()->getConfigData('iframe_style');
59
+ return $iframe;
60
+ }
61
+
62
+ /**
63
+ * Render block HTML
64
+ *
65
+ * @return string
66
+ */
67
+ protected function _toHtml()
68
+ {
69
+ Mage::dispatchEvent('payment_form_block_to_html_before', array(
70
+ 'block' => $this
71
+ ));
72
+ return parent::_toHtml();
73
+ }
74
+ }
app/code/community/Allopass/Hipay/Block/Form/Cc.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Block_Form_Cc extends Allopass_Hipay_Block_Form_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('hipay/form/cc.phtml');
8
+ }
9
+
10
+
11
+ /**
12
+ * Retrieve availables credit card types
13
+ *
14
+ * @return array
15
+ */
16
+ public function getCcAvailableTypes()
17
+ {
18
+ $types =$this->_getConfig()->getCcTypes();
19
+ if ($method = $this->getMethod()) {
20
+ $availableTypes = $method->getConfigData('cctypes');
21
+ if ($availableTypes) {
22
+ $availableTypes = explode(',', $availableTypes);
23
+ foreach ($types as $code=>$name) {
24
+ if (!in_array($code, $availableTypes)) {
25
+ unset($types[$code]);
26
+ }
27
+ }
28
+ }
29
+ }
30
+ return $types;
31
+ }
32
+
33
+ /**
34
+ * Retrieve credit card expire months
35
+ *
36
+ * @return array
37
+ */
38
+ public function getCcMonths()
39
+ {
40
+ $months = $this->getData('cc_months');
41
+ if (is_null($months)) {
42
+ $months["0"] = $this->__('Month');
43
+ $months = array_merge($months, $this->_getConfig()->getMonths());
44
+ $this->setData('cc_months', $months);
45
+ }
46
+ return $months;
47
+ }
48
+
49
+ /**
50
+ * Retrieve credit card expire years
51
+ *
52
+ * @return array
53
+ */
54
+ public function getCcYears()
55
+ {
56
+ $years = $this->getData('cc_years');
57
+ if (is_null($years)) {
58
+ $years = $this->_getConfig()->getYears();
59
+ $years = array(0=>$this->__('Year'))+$years;
60
+ $this->setData('cc_years', $years);
61
+ }
62
+ return $years;
63
+ }
64
+
65
+ /**
66
+ * Retrive has verification configuration
67
+ *
68
+ * @return boolean
69
+ */
70
+ public function hasVerification()
71
+ {
72
+ if ($this->getMethod()) {
73
+ $configData = $this->getMethod()->getConfigData('useccv');
74
+ if(is_null($configData)){
75
+ return true;
76
+ }
77
+ return (bool) $configData;
78
+ }
79
+ return true;
80
+ }
81
+
82
+ /*
83
+ * Whether switch/solo card type available
84
+ */
85
+ public function hasSsCardType()
86
+ {
87
+ $availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes'));
88
+ $ssPresenations = array_intersect(array('SS', 'SM', 'SO'), $availableTypes);
89
+ if ($availableTypes && count($ssPresenations) > 0) {
90
+ return true;
91
+ }
92
+ return false;
93
+ }
94
+
95
+ /*
96
+ * solo/switch card start year
97
+ * @return array
98
+ */
99
+ public function getSsStartYears()
100
+ {
101
+ $years = array();
102
+ $first = date("Y");
103
+
104
+ for ($index=5; $index>=0; $index--) {
105
+ $year = $first - $index;
106
+ $years[$year] = $year;
107
+ }
108
+ $years = array(0=>$this->__('Year'))+$years;
109
+ return $years;
110
+ }
111
+
112
+
113
+ }
app/code/community/Allopass/Hipay/Block/Form/Hosted.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Block_Form_Hosted extends Allopass_Hipay_Block_Form_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('hipay/form/hosted.phtml');
8
+ }
9
+
10
+ }
app/code/community/Allopass/Hipay/Block/Info/Cc.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Credit card hipay payment info
5
+ */
6
+ class Allopass_Hipay_Block_Info_Cc extends Mage_Payment_Block_Info
7
+ {
8
+ /**
9
+ * Retrieve credit card type name
10
+ *
11
+ * @return string
12
+ */
13
+ public function getCcTypeName()
14
+ {
15
+ $types = Mage::getSingleton('payment/config')->getCcTypes();
16
+ $ccType = $this->getInfo()->getCcType();
17
+ if (isset($types[$ccType])) {
18
+ return $types[$ccType];
19
+ }
20
+ return (empty($ccType)) ? Mage::helper('payment')->__('N/A') : $ccType;
21
+ }
22
+
23
+ /**
24
+ * Whether current payment method has credit card expiration info
25
+ *
26
+ * @return bool
27
+ */
28
+ public function hasCcExpDate()
29
+ {
30
+ return (int)$this->getInfo()->getCcExpMonth() || (int)$this->getInfo()->getCcExpYear();
31
+ }
32
+
33
+ /**
34
+ * Retrieve CC expiration month
35
+ *
36
+ * @return string
37
+ */
38
+ public function getCcExpMonth()
39
+ {
40
+ $month = $this->getInfo()->getCcExpMonth();
41
+ if ($month<10) {
42
+ $month = '0'.$month;
43
+ }
44
+ return $month;
45
+ }
46
+
47
+ /**
48
+ * Retrieve CC expiration date
49
+ *
50
+ * @return Zend_Date
51
+ */
52
+ public function getCcExpDate()
53
+ {
54
+ $date = Mage::app()->getLocale()->date(0);
55
+ $date->setYear($this->getInfo()->getCcExpYear());
56
+ $date->setMonth($this->getInfo()->getCcExpMonth());
57
+ return $date;
58
+ }
59
+
60
+ /**
61
+ * Prepare credit card related payment info
62
+ *
63
+ * @param Varien_Object|array $transport
64
+ * @return Varien_Object
65
+ */
66
+ protected function _prepareSpecificInformation($transport = null)
67
+ {
68
+ if (null !== $this->_paymentSpecificInformation) {
69
+ return $this->_paymentSpecificInformation;
70
+ }
71
+ $transport = parent::_prepareSpecificInformation($transport);
72
+ $data = array();
73
+ if ($ccType = $this->getCcTypeName()) {
74
+ $data[Mage::helper('payment')->__('Credit Card Type')] = $ccType;
75
+ }
76
+ if ($this->getInfo()->getCcLast4()) {
77
+ $data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
78
+ }
79
+ if (!$this->getIsSecureMode()) {
80
+ if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
81
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
82
+ }
83
+ $year = $this->getInfo()->getCcSsStartYear();
84
+ $month = $this->getInfo()->getCcSsStartMonth();
85
+ if ($year && $month) {
86
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Start Date')] = $this->_formatCardDate($year, $month);
87
+ }
88
+ }
89
+ return $transport->setData(array_merge($data, $transport->getData()));
90
+ }
91
+
92
+ /**
93
+ * Format year/month on the credit card
94
+ *
95
+ * @param string $year
96
+ * @param string $month
97
+ * @return string
98
+ */
99
+ protected function _formatCardDate($year, $month)
100
+ {
101
+ return sprintf('%s/%s', sprintf('%02d', $month), $year);
102
+ }
103
+ }
app/code/community/Allopass/Hipay/Block/Info/Hosted.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * hosted hipay payment info
5
+ */
6
+ class Allopass_Hipay_Block_Info_Hosted extends Mage_Payment_Block_Info
7
+ {
8
+
9
+ }
app/code/community/Allopass/Hipay/Controller/Payment.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Action
3
+ {
4
+ /**
5
+ *
6
+ * @var Mage_Sales_Model_Order $order
7
+ */
8
+ protected $_order = null;
9
+
10
+
11
+ /**
12
+ * @return Mage_Core_Controller_Front_Action
13
+ */
14
+ public function preDispatch() {
15
+ parent::preDispatch();
16
+
17
+ if (!$this->_validateSignature()) {
18
+ $this->getResponse()->setBody("NOK. Wrong Signature!");
19
+ $this->setFlag('', 'no-dispatch', true);
20
+ }
21
+ }
22
+
23
+
24
+ protected function _validateSignature()
25
+ {
26
+ /* @var $_helper Allopass_Hipay_Helper_Data */
27
+ $_helper = Mage::helper('hipay');
28
+ $signature = $this->getRequest()->getParam('hash');
29
+ return $_helper->checkSignature($signature);
30
+ }
31
+
32
+ /**
33
+ *
34
+ * @return Allopass_Hipay_Model_Method_Abstract $methodInstance
35
+ */
36
+ protected function _getMethodInstance()
37
+ {
38
+ Mage::throwException("Method: '" . __METHOD__ . "' must be implemented!");
39
+ }
40
+
41
+ public function sendRequestAction()
42
+ {
43
+ $order = $this->getOrder();
44
+ $payment = $order->getPayment();
45
+ $methodInstance = $this->_getMethodInstance();
46
+
47
+ try
48
+ {
49
+ $redirectUrl = $methodInstance->place($payment,$order->getBaseTotalDue());
50
+ }
51
+ catch (Exception $e)
52
+ {
53
+ Mage::logException($e);
54
+ $this->getCheckout()->addError($e->getMessage());
55
+ $this->_redirect('checkout/cart');
56
+ return $this;
57
+ }
58
+
59
+
60
+ $this->_redirectUrl($redirectUrl);
61
+
62
+ return $this;
63
+
64
+ }
65
+
66
+
67
+ public function acceptAction()
68
+ {
69
+ if(($profileIds = Mage::getSingleton('checkout/session')->getLastRecurringProfileIds()))
70
+ {
71
+ if(is_array($profileIds))
72
+ {
73
+ /* @var $gatewayResponse Allopass_Hipay_Model_Api_Response_Gateway */
74
+ $gatewayResponse = Mage::getSingleton('hipay/api_response_gateway',$this->getRequest()->getParams());
75
+ $collection = Mage::getModel('sales/recurring_profile')->getCollection()
76
+ ->addFieldToFilter('profile_id', array('in' => $profileIds))
77
+ ;
78
+ $profiles = array();
79
+ foreach ($collection as $profile) {
80
+ //$referenceId = $gatewayResponse->getToken()."-".$profile->getId();
81
+ $additionalInfo = array();
82
+ $additionalInfo['ccType'] = $gatewayResponse->getBrand();
83
+ $additionalInfo['ccExpMonth'] = $gatewayResponse->getCardExpiryMonth() ;
84
+ $additionalInfo['ccExpYear'] = $gatewayResponse->getCardExpiryYear();
85
+ $additionalInfo['token'] = $gatewayResponse->getToken();
86
+ $additionalInfo['transaction_id'] = $gatewayResponse->getTransactionReference();
87
+ $profile->setAdditionalInfo($additionalInfo);
88
+ //$profile->setReferenceId($referenceId);
89
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
90
+
91
+ $profile->save();
92
+ }
93
+ }
94
+ }
95
+ /*else
96
+ {
97
+ $this->processResponse();
98
+ }*/
99
+ $this->processResponse();
100
+ $this->_redirect('checkout/onepage/success');
101
+
102
+ return $this;
103
+ }
104
+
105
+ public function pendingAction()
106
+ {
107
+ $this->processResponse();
108
+ $this->_redirect($this->_getMethodInstance()->getConfigData('pending_redirect_page'));
109
+
110
+ return $this;
111
+ }
112
+
113
+ public function declineAction()
114
+ {
115
+ $this->processResponse();
116
+ $this->_redirect('checkout/onepage/failure');
117
+ return $this;
118
+ }
119
+
120
+
121
+ public function exceptionAction()
122
+ {
123
+ $this->_redirect('checkout/onepage/failure');
124
+ return $this;
125
+ }
126
+
127
+
128
+ public function cancelAction()
129
+ {
130
+ $this->processResponse();
131
+ $this->_redirect('checkout/cart');
132
+ return $this;
133
+ }
134
+
135
+ protected function processResponse()
136
+ {
137
+ $order = $this->getOrder();
138
+ $payment = $order->getPayment();
139
+
140
+ /* @var $gatewayResponse Allopass_Hipay_Model_Api_Response_Gateway */
141
+ $gatewayResponse = Mage::getSingleton('hipay/api_response_gateway',$this->getRequest()->getParams());
142
+
143
+ $this->_getMethodInstance()->processResponseToRedirect($gatewayResponse, $payment, $order->getBaseTotalDue());
144
+ }
145
+
146
+
147
+
148
+ /**
149
+ *
150
+ * @return Mage_Sales_Model_Order
151
+ */
152
+ protected function getOrder()
153
+ {
154
+ if(is_null($this->_order))
155
+ {
156
+
157
+ if(($profileIds = $this->getCheckout()->getLastRecurringProfileIds()))
158
+ {
159
+
160
+ if (is_array($profileIds)) {
161
+
162
+ foreach ($profileIds as $profileId)
163
+ {
164
+ /* @var $profile Mage_Sales_Model_Recurring_Profile */
165
+ $profile = Mage::getModel('sales/recurring_profile')->load($profileId);
166
+ /* @var $_helperRecurring Allopass_Hipayrecurring_Helper_Data */
167
+ $_helperRecurring = Mage::helper('hipayrecurring');
168
+
169
+ if($_helperRecurring->isInitialProfileOrder($profile))
170
+ $this->_order = $_helperRecurring->createOrderFromProfile($profile);
171
+ else
172
+ {
173
+ $orderId = current($profile->getChildOrderIds());
174
+ $this->_order = Mage::getModel('sales/order')->load($orderId);
175
+
176
+ $additionalInfo = $profile->getAdditionalInfo();
177
+
178
+ $this->_order->getPayment()->setCcType(isset($additionalInfo['ccType']) ? $additionalInfo['ccType'] : "");
179
+ $this->_order->getPayment()->setCcExpMonth(isset($additionalInfo['ccExpMonth']) ? $additionalInfo['ccExpMonth'] : "");
180
+ $this->_order->getPayment()->setCcExpYear(isset($additionalInfo['ccExpYear']) ? $additionalInfo['ccExpYear'] : "");
181
+ $this->_order->getPayment()->setAdditionalInformation('token',isset($additionalInfo['token']) ? $additionalInfo['token'] : "");
182
+ $this->_order->getPayment()->setAdditionalInformation('create_oneclick',isset($additionalInfo['create_oneclick']) ? $additionalInfo['create_oneclick'] : 1);
183
+ $this->_order->getPayment()->setAdditionalInformation('use_oneclick',isset($additionalInfo['use_oneclick']) ? $additionalInfo['use_oneclick'] : 0);
184
+ }
185
+
186
+
187
+
188
+ return $this->_order; //because only one nominal item in cart is authorized and Hipay not manage many profiles
189
+
190
+ //$amount = $this->getAmountFromProfile($profile);
191
+
192
+ /*$productItemInfo = new Varien_Object;
193
+ $type = "Regular";
194
+ if ($type == 'Trial') {
195
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL);
196
+ } elseif ($type == 'Regular') {
197
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
198
+ }
199
+
200
+
201
+ if($this->isInitialProfileOrder($profile))// because is not additonned in prodile obj
202
+ $productItemInfo->setPrice($profile->getBillingAmount() + $profile->getInitAmount());
203
+
204
+ $this->_order = $profile->createOrder($productItemInfo);
205
+
206
+ $additionalInfo = $profile->getAdditionalInfo();
207
+
208
+ $this->_order->getPayment()->setCcType($additionalInfo['ccType']);
209
+ $this->_order->getPayment()->setCcExpMonth($additionalInfo['ccExpMonth']);
210
+ $this->_order->getPayment()->setCcExpYear($additionalInfo['ccExpYear']);
211
+ $this->_order->getPayment()->setAdditionalInformation('token',$additionalInfo['token']);
212
+ $this->_order->getPayment()->setAdditionalInformation('create_oneclick',$additionalInfo['create_oneclick']);
213
+ $this->_order->getPayment()->setAdditionalInformation('use_oneclick',$additionalInfo['use_oneclick']);
214
+
215
+ $orderId = 'create-recurring';
216
+ $orderId .= "-".$profileId;
217
+ //$this->_order->setIncrementId($orderId);
218
+ $this->_order->save();
219
+ $profile->addOrderRelation($this->_order->getId());
220
+ $profile->save();*/
221
+ return $this->_order; //because only one nominal item in cart is authorized and Hipay not manage many profiles
222
+ //break;
223
+ }
224
+
225
+
226
+ }
227
+
228
+ Mage::throwException("An error occured. Profile Ids not present!");
229
+
230
+
231
+
232
+ }
233
+ else
234
+ $this->_order = Mage::getModel('sales/order')->load($this->getCheckout()->getLastOrderId());
235
+ }
236
+
237
+ return $this->_order;
238
+ }
239
+
240
+ /**
241
+ * Add method to calculate amount from recurring profile
242
+ * @param Mage_Sales_Model_Recurring_Profile $profile
243
+ * @return int $amount
244
+ **/
245
+ public function getAmountFromProfile(Mage_Sales_Model_Recurring_Profile $profile) {
246
+ $amount = $profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount();
247
+
248
+ if($this->isInitialProfileOrder($profile))
249
+ $amount += $profile->getInitAmount() ;
250
+
251
+ return $amount;
252
+ }
253
+
254
+ protected function isInitialProfileOrder(Mage_Sales_Model_Recurring_Profile $profile)
255
+ {
256
+ if(count($profile->getChildOrderIds()) && current($profile->getChildOrderIds()) == "-1")
257
+ return true;
258
+
259
+ return false;
260
+ }
261
+
262
+
263
+ /**
264
+ *
265
+ * @return Mage_Checkout_Model_Session
266
+ */
267
+ protected function getCheckout()
268
+ {
269
+ return Mage::getSingleton('checkout/session');
270
+ }
271
+ }
app/code/community/Allopass/Hipay/Helper/Data.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+
6
+ public function checkSignature($signature,$fromNotification = false)
7
+ {
8
+ $passphrase = Mage::getStoreConfig('hipay/hipay_api/secret_passphrase');
9
+ if(empty($passphrase) || empty($signature))
10
+ return true;
11
+
12
+ if($fromNotification)
13
+ {
14
+ $rawPostData = file_get_contents("php://input");
15
+ if($signature == sha1($rawPostData . $passphrase));
16
+ return true;
17
+
18
+ return false;
19
+ }
20
+
21
+
22
+ $parameters = $this->_getRequest()->getParams();
23
+ $string2compute = "";
24
+ unset($parameters['hash']);
25
+ ksort($parameters);
26
+ foreach ($parameters as $name => $value) {
27
+ if (!empty($value)) {
28
+ $string2compute .= $name . $value . $passphrase;
29
+ }
30
+ }
31
+
32
+ if(sha1($string2compute) == $signature)
33
+ return true;
34
+
35
+ return false;
36
+ }
37
+
38
+ public function checkIfCcExpDateIsValid($customer)
39
+ {
40
+ if(is_int($customer))
41
+ $customer = Mage::getModel('customer/customer')->load($customer);
42
+
43
+ $expDate = $customer->getHipayCcExpDate();
44
+ $alias = $customer->getHipayAliasOneclick();
45
+ if(!empty($expDate) && !empty($alias))
46
+ {
47
+ list($expMonth,$expYear) = explode("-", $expDate);
48
+ $today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
49
+
50
+ $currentYear = (int)$today->getYear()->toString("YY");
51
+ $currentMonth = (int)$today->getMonth()->toString("MM");
52
+
53
+ if($currentYear > (int)$expYear)
54
+ return false;
55
+
56
+ if($currentYear == (int)$expYear && $currentMonth > (int)$expMonth)
57
+ return false;
58
+
59
+ return true;
60
+
61
+ }
62
+
63
+ return false;
64
+ }
65
+
66
+ /**
67
+ *
68
+ * @param Mage_Customer_Model_Customer $customer
69
+ * @param Allopass_Hipay_Model_Api_Response_Gateway $response
70
+ */
71
+ public function responseToCustomer($customer,$response,$isRecurring = false)
72
+ {
73
+
74
+ $paymentMethod = $response->getPaymentMethod();
75
+ $token = isset($paymentMethod['token']) ? $paymentMethod['token'] : $response->getData('cardtoken');
76
+
77
+ if($isRecurring)
78
+ $customer->setHipayAliasRecurring($token);
79
+ else
80
+ $customer->setHipayAliasOneclick($token );
81
+
82
+ if(isset($paymentMethod['card_expiry_month']) && $paymentMethod['card_expiry_year'])
83
+ $customer->setHipayCcExpDate($paymentMethod['card_expiry_month'] . "-" . $paymentMethod['card_expiry_year'] );
84
+ else
85
+ $customer->setHipayCcExpDate(substr($response->getData('cardexpiry'), 4,2) . "-" . substr($response->getData('cardexpiry'), 0,4) );
86
+ $customer->setHipayCcNumberEnc(isset($paymentMethod['pan']) ? $paymentMethod['pan'] : $response->getData('cardpan'));
87
+ $customer->setHipayCcType(isset($paymentMethod['brand']) ? strtolower($paymentMethod['brand']) : strtolower($response->getData('cardbrand')));
88
+
89
+
90
+ $customer->getResource()->saveAttribute($customer, 'hipay_alias_oneclick');
91
+ $customer->getResource()->saveAttribute($customer, 'hipay_cc_exp_date');
92
+ $customer->getResource()->saveAttribute($customer, 'hipay_cc_number_enc');
93
+ $customer->getResource()->saveAttribute($customer, 'hipay_cc_type');
94
+
95
+ return $this;
96
+ }
97
+
98
+ public function reAddToCart($incrementId) {
99
+
100
+ $cart = Mage::getSingleton('checkout/cart');
101
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
102
+
103
+ if ($order->getId()) {
104
+ $items = $order->getItemsCollection();
105
+ foreach ($items as $item) {
106
+ try {
107
+ $cart->addOrderItem($item);
108
+ } catch (Mage_Core_Exception $e) {
109
+ if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
110
+ Mage::getSingleton('checkout/session')->addNotice($e->getMessage());
111
+ } else {
112
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
113
+ }
114
+ } catch (Exception $e) {
115
+ Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Cannot add the item to shopping cart.')
116
+ );
117
+ }
118
+ }
119
+ }
120
+
121
+ $cart->save();
122
+ }
123
+
124
+
125
+ /**
126
+ * Return message for gateway transaction request
127
+ *
128
+ * @param Mage_Payment_Model_Info $payment
129
+ * @param string $requestType
130
+ * @param string $lastTransactionId
131
+ * @param float $amount
132
+ * @param string $exception
133
+ * @return bool|string
134
+ */
135
+ public function getTransactionMessage($payment, $requestType, $lastTransactionId, $amount = false,
136
+ $exception = false,$additionalMessage = false
137
+ ) {
138
+ return $this->getExtendedTransactionMessage(
139
+ $payment, $requestType, $lastTransactionId, $amount, $exception,$additionalMessage
140
+ );
141
+ }
142
+
143
+ /**
144
+ * Return message for gateway transaction request
145
+ *
146
+ * @param Mage_Payment_Model_Info $payment
147
+ * @param string $requestType
148
+ * @param string $lastTransactionId
149
+ * @param float $amount
150
+ * @param string $exception
151
+ * @param string $additionalMessage Custom message, which will be added to the end of generated message
152
+ * @return bool|string
153
+ */
154
+ public function getExtendedTransactionMessage($payment, $requestType, $lastTransactionId, $amount = false,
155
+ $exception = false, $additionalMessage = false
156
+ ) {
157
+ $operation = 'Operation: ' . $requestType;// $this->_getOperation($requestType);
158
+
159
+ if (!$operation) {
160
+ return false;
161
+ }
162
+
163
+ if ($amount) {
164
+ $amount = $this->__('amount: %s', $this->_formatPrice($payment, $amount));
165
+ }
166
+
167
+ if ($exception) {
168
+ $result = $this->__('failed');
169
+ } else {
170
+ $result = $this->__('successful');
171
+ }
172
+
173
+ $card = $this->__('Credit Card: xxxx-%s', $payment->getCcLast4());
174
+
175
+ $pattern = '%s - %s. %s %s.';
176
+ $texts = array($operation,$result,$card, $amount);
177
+
178
+ if (!is_null($lastTransactionId)) {
179
+ $pattern .= ' %s.';
180
+ $texts[] = $this->__('Hipay Transaction ID %s', $lastTransactionId);
181
+ }
182
+
183
+ if ($additionalMessage) {
184
+ $pattern .= ' %s.';
185
+ $texts[] = $additionalMessage;
186
+ }
187
+ $pattern .= ' %s';
188
+ $texts[] = $exception;
189
+
190
+ return call_user_func_array(array($this, '__'), array_merge(array($pattern), $texts));
191
+ }
192
+
193
+ /**
194
+ * Format price with currency sign
195
+ * @param Mage_Payment_Model_Info $payment
196
+ * @param float $amount
197
+ * @return string
198
+ */
199
+ protected function _formatPrice($payment, $amount)
200
+ {
201
+ return $payment->getOrder()->getBaseCurrency()->formatTxt($amount);
202
+ }
203
+ }
app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Curl.php ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ /**
6
+ * @see Zend_Uri_Http
7
+ */
8
+ #require_once 'Zend/Uri/Http.php';
9
+
10
+ /**
11
+ * @see Zend_Http_Client_Adapter_Interface
12
+ */
13
+ #require_once 'Zend/Http/Client/Adapter/Interface.php';
14
+ /**
15
+ * @see Zend_Http_Client_Adapter_Stream
16
+ */
17
+ #require_once 'Zend/Http/Client/Adapter/Stream.php';
18
+
19
+ /**
20
+ * An adapter class for Zend_Http_Client based on the curl extension.
21
+ * Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl
22
+ *
23
+ */
24
+ class Allopass_Hipay_Model_Api_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interface, Allopass_Hipay_Model_Api_Http_Client_Adapter_Stream
25
+ {
26
+ /**
27
+ * Parameters array
28
+ *
29
+ * @var array
30
+ */
31
+ protected $_config = array();
32
+
33
+ /**
34
+ * What host/port are we connected to?
35
+ *
36
+ * @var array
37
+ */
38
+ protected $_connected_to = array(null, null);
39
+
40
+ /**
41
+ * The curl session handle
42
+ *
43
+ * @var resource|null
44
+ */
45
+ protected $_curl = null;
46
+
47
+ /**
48
+ * List of cURL options that should never be overwritten
49
+ *
50
+ * @var array
51
+ */
52
+ protected $_invalidOverwritableCurlOptions;
53
+
54
+ /**
55
+ * Response gotten from server
56
+ *
57
+ * @var string
58
+ */
59
+ protected $_response = null;
60
+
61
+ /**
62
+ * Stream for storing output
63
+ *
64
+ * @var resource
65
+ */
66
+ protected $out_stream;
67
+
68
+ /**
69
+ * Adapter constructor
70
+ *
71
+ * Config is set using setConfig()
72
+ *
73
+ * @return void
74
+ * @throws Zend_Http_Client_Adapter_Exception
75
+ */
76
+ public function __construct()
77
+ {
78
+ if (!extension_loaded('curl')) {
79
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
80
+ throw new Zend_Http_Client_Adapter_Exception('cURL extension has to be loaded to use this Zend_Http_Client adapter.');
81
+ }
82
+ $this->_invalidOverwritableCurlOptions = array(
83
+ CURLOPT_HTTPGET,
84
+ CURLOPT_POST,
85
+ CURLOPT_PUT,
86
+ CURLOPT_CUSTOMREQUEST,
87
+ CURLOPT_HEADER,
88
+ CURLOPT_RETURNTRANSFER,
89
+ CURLOPT_HTTPHEADER,
90
+ CURLOPT_POSTFIELDS,
91
+ CURLOPT_INFILE,
92
+ CURLOPT_INFILESIZE,
93
+ CURLOPT_PORT,
94
+ CURLOPT_MAXREDIRS,
95
+ CURLOPT_CONNECTTIMEOUT,
96
+ CURL_HTTP_VERSION_1_1,
97
+ CURL_HTTP_VERSION_1_0,
98
+ );
99
+ }
100
+
101
+ /**
102
+ * Set the configuration array for the adapter
103
+ *
104
+ * @throws Zend_Http_Client_Adapter_Exception
105
+ * @param Zend_Config | array $config
106
+ * @return Zend_Http_Client_Adapter_Curl
107
+ */
108
+ public function setConfig($config = array())
109
+ {
110
+ if ($config instanceof Zend_Config) {
111
+ $config = $config->toArray();
112
+
113
+ } elseif (! is_array($config)) {
114
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
115
+ throw new Zend_Http_Client_Adapter_Exception(
116
+ 'Array or Zend_Config object expected, got ' . gettype($config)
117
+ );
118
+ }
119
+
120
+ if(isset($config['proxy_user']) && isset($config['proxy_pass'])) {
121
+ $this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'].":".$config['proxy_pass']);
122
+ unset($config['proxy_user'], $config['proxy_pass']);
123
+ }
124
+
125
+ foreach ($config as $k => $v) {
126
+ $option = strtolower($k);
127
+ switch($option) {
128
+ case 'proxy_host':
129
+ $this->setCurlOption(CURLOPT_PROXY, $v);
130
+ break;
131
+ case 'proxy_port':
132
+ $this->setCurlOption(CURLOPT_PROXYPORT, $v);
133
+ break;
134
+ default:
135
+ $this->_config[$option] = $v;
136
+ break;
137
+ }
138
+ }
139
+
140
+ return $this;
141
+ }
142
+
143
+ /**
144
+ * Retrieve the array of all configuration options
145
+ *
146
+ * @return array
147
+ */
148
+ public function getConfig()
149
+ {
150
+ return $this->_config;
151
+ }
152
+
153
+ /**
154
+ * Direct setter for cURL adapter related options.
155
+ *
156
+ * @param string|int $option
157
+ * @param mixed $value
158
+ * @return Zend_Http_Adapter_Curl
159
+ */
160
+ public function setCurlOption($option, $value)
161
+ {
162
+ if (!isset($this->_config['curloptions'])) {
163
+ $this->_config['curloptions'] = array();
164
+ }
165
+ $this->_config['curloptions'][$option] = $value;
166
+ return $this;
167
+ }
168
+
169
+ /**
170
+ * Initialize curl
171
+ *
172
+ * @param string $host
173
+ * @param int $port
174
+ * @param boolean $secure
175
+ * @return void
176
+ * @throws Zend_Http_Client_Adapter_Exception if unable to connect
177
+ */
178
+ public function connect($host, $port = 80, $secure = false)
179
+ {
180
+ // If we're already connected, disconnect first
181
+ if ($this->_curl) {
182
+ $this->close();
183
+ }
184
+
185
+ // If we are connected to a different server or port, disconnect first
186
+ if ($this->_curl
187
+ && is_array($this->_connected_to)
188
+ && ($this->_connected_to[0] != $host
189
+ || $this->_connected_to[1] != $port)
190
+ ) {
191
+ $this->close();
192
+ }
193
+
194
+ // Do the actual connection
195
+ $this->_curl = curl_init();
196
+ if ($port != 80) {
197
+ curl_setopt($this->_curl, CURLOPT_PORT, intval($port));
198
+ }
199
+
200
+ // Set timeout
201
+ curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
202
+
203
+ // Set Max redirects
204
+ curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']);
205
+
206
+ if (!$this->_curl) {
207
+ $this->close();
208
+
209
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
210
+ throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port);
211
+ }
212
+
213
+ if ($secure !== false) {
214
+ // Behave the same like Zend_Http_Adapter_Socket on SSL options.
215
+ if (isset($this->_config['sslcert'])) {
216
+ curl_setopt($this->_curl, CURLOPT_SSLCERT, $this->_config['sslcert']);
217
+ }
218
+ if (isset($this->_config['sslpassphrase'])) {
219
+ curl_setopt($this->_curl, CURLOPT_SSLCERTPASSWD, $this->_config['sslpassphrase']);
220
+ }
221
+ }
222
+
223
+ // Update connected_to
224
+ $this->_connected_to = array($host, $port);
225
+ }
226
+
227
+ /**
228
+ * Send request to the remote server
229
+ *
230
+ * @param string $method
231
+ * @param Zend_Uri_Http $uri
232
+ * @param float $http_ver
233
+ * @param array $headers
234
+ * @param string $body
235
+ * @return string $request
236
+ * @throws Zend_Http_Client_Adapter_Exception If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option
237
+ */
238
+ public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $body = '')
239
+ {
240
+ // Make sure we're properly connected
241
+ if (!$this->_curl) {
242
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
243
+ throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are not connected");
244
+ }
245
+
246
+ if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) {
247
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
248
+ throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are connected to the wrong host");
249
+ }
250
+
251
+ // set URL
252
+ curl_setopt($this->_curl, CURLOPT_URL, $uri->__toString());
253
+
254
+ // ensure correct curl call
255
+ $curlValue = true;
256
+ switch ($method) {
257
+ case Zend_Http_Client::GET:
258
+ $curlMethod = CURLOPT_HTTPGET;
259
+ break;
260
+
261
+ case Zend_Http_Client::POST:
262
+ $curlMethod = CURLOPT_POST;
263
+ break;
264
+
265
+ case Zend_Http_Client::PUT:
266
+ // There are two different types of PUT request, either a Raw Data string has been set
267
+ // or CURLOPT_INFILE and CURLOPT_INFILESIZE are used.
268
+ if(is_resource($body)) {
269
+ $this->_config['curloptions'][CURLOPT_INFILE] = $body;
270
+ }
271
+ if (isset($this->_config['curloptions'][CURLOPT_INFILE])) {
272
+ // Now we will probably already have Content-Length set, so that we have to delete it
273
+ // from $headers at this point:
274
+ foreach ($headers AS $k => $header) {
275
+ if (preg_match('/Content-Length:\s*(\d+)/i', $header, $m)) {
276
+ if(is_resource($body)) {
277
+ $this->_config['curloptions'][CURLOPT_INFILESIZE] = (int)$m[1];
278
+ }
279
+ unset($headers[$k]);
280
+ }
281
+ }
282
+
283
+ if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) {
284
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
285
+ throw new Zend_Http_Client_Adapter_Exception("Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.");
286
+ }
287
+
288
+ if(is_resource($body)) {
289
+ $body = '';
290
+ }
291
+
292
+ $curlMethod = CURLOPT_PUT;
293
+ } else {
294
+ $curlMethod = CURLOPT_CUSTOMREQUEST;
295
+ $curlValue = "PUT";
296
+ }
297
+ break;
298
+
299
+ case Zend_Http_Client::DELETE:
300
+ $curlMethod = CURLOPT_CUSTOMREQUEST;
301
+ $curlValue = "DELETE";
302
+ break;
303
+
304
+ case Zend_Http_Client::OPTIONS:
305
+ $curlMethod = CURLOPT_CUSTOMREQUEST;
306
+ $curlValue = "OPTIONS";
307
+ break;
308
+
309
+ case Zend_Http_Client::TRACE:
310
+ $curlMethod = CURLOPT_CUSTOMREQUEST;
311
+ $curlValue = "TRACE";
312
+ break;
313
+
314
+ case Zend_Http_Client::HEAD:
315
+ $curlMethod = CURLOPT_CUSTOMREQUEST;
316
+ $curlValue = "HEAD";
317
+ break;
318
+
319
+ default:
320
+ // For now, through an exception for unsupported request methods
321
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
322
+ throw new Zend_Http_Client_Adapter_Exception("Method currently not supported");
323
+ }
324
+
325
+ if(is_resource($body) && $curlMethod != CURLOPT_PUT) {
326
+ #require_once 'Zend/Http/Client/Adapter/Exception.php';
327
+ throw new Zend_Http_Client_Adapter_Exception("Streaming requests are allowed only with PUT");
328
+ }
329
+
330
+ // get http version to use
331
+ $curlHttp = ($httpVersion == 1.1) ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_1_0;
332
+
333
+ // mark as HTTP request and set HTTP method
334
+ curl_setopt($this->_curl, $curlHttp, true);
335
+ curl_setopt($this->_curl, $curlMethod, $curlValue);
336
+
337
+ if($this->out_stream) {
338
+ // headers will be read into the response
339
+ curl_setopt($this->_curl, CURLOPT_HEADER, false);
340
+ curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, array($this, "readHeader"));
341
+ // and data will be written into the file
342
+ curl_setopt($this->_curl, CURLOPT_FILE, $this->out_stream);
343
+ } else {
344
+ // ensure headers are also returned
345
+ curl_setopt($this->_curl, CURLOPT_HEADER, true);
346
+
347
+ // ensure actual response is returned
348
+ curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true);
349
+ }
350
+
351
+ // set additional headers
352
+ $headers['Accept'] = '';
353
+ curl_setopt($this->_curl, CURLOPT_HTTPHEADER, $headers);
354
+
355
+ /**
356
+ * Make sure POSTFIELDS is set after $curlMethod is set:
357
+ * @link http://de2.php.net/manual/en/function.curl-setopt.php#81161
358
+ */
359
+ if ($method == Zend_Http_Client::POST) {
360
+ curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
361
+ } elseif ($curlMethod == CURLOPT_PUT) {
362
+ // this covers a PUT by file-handle:
363
+ // Make the setting of this options explicit (rather than setting it through the loop following a bit lower)
364
+ // to group common functionality together.
365
+ curl_setopt($this->_curl, CURLOPT_INFILE, $this->_config['curloptions'][CURLOPT_INFILE]);
366
+ curl_setopt($this->_curl, CURLOPT_INFILESIZE, $this->_config['curloptions'][CURLOPT_INFILESIZE]);
367
+ unset($this->_config['curloptions'][CURLOPT_INFILE]);
368
+ unset($this->_config['curloptions'][CURLOPT_INFILESIZE]);
369
+ } elseif ($method == Zend_Http_Client::PUT) {
370
+ // This is a PUT by a setRawData string, not by file-handle
371
+ curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
372
+ }
373
+
374
+ // set additional curl options
375
+ if (isset($this->_config['curloptions'])) {
376
+ foreach ((array)$this->_config['curloptions'] as $k => $v) {
377
+ if (!in_array($k, $this->_invalidOverwritableCurlOptions)) {
378
+ if (curl_setopt($this->_curl, $k, $v) == false) {
379
+ #require_once 'Zend/Http/Client/Exception.php';
380
+ throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k));
381
+ }
382
+ }
383
+ }
384
+ }
385
+
386
+ // send the request
387
+ $response = curl_exec($this->_curl);
388
+
389
+ // if we used streaming, headers are already there
390
+ if(!is_resource($this->out_stream)) {
391
+ $this->_response = $response;
392
+ }
393
+
394
+ $request = curl_getinfo($this->_curl, CURLINFO_HEADER_OUT);
395
+ $request .= $body;
396
+
397
+ if (empty($this->_response)) {
398
+ #require_once 'Zend/Http/Client/Exception.php';
399
+ throw new Zend_Http_Client_Exception("Error in cURL request: " . curl_error($this->_curl));
400
+ }
401
+
402
+ // cURL automatically decodes chunked-messages, this means we have to disallow the Zend_Http_Response to do it again
403
+ if (stripos($this->_response, "Transfer-Encoding: chunked\r\n")) {
404
+ $this->_response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $this->_response);
405
+ }
406
+
407
+ // Eliminate multiple HTTP responses.
408
+ do {
409
+ $parts = preg_split('|(?:\r?\n){2}|m', $this->_response, 2);
410
+ $again = false;
411
+
412
+ if (isset($parts[1]) && preg_match("|^HTTP/1\.[01](.*?)\r\n|mi", $parts[1])) {
413
+ $this->_response = $parts[1];
414
+ $again = true;
415
+ }
416
+ } while ($again);
417
+
418
+ // cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string:
419
+ if (stripos($this->_response, "HTTP/1.0 200 Connection established\r\n\r\n") !== false) {
420
+ $this->_response = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $this->_response);
421
+ }
422
+
423
+ return $request;
424
+ }
425
+
426
+ /**
427
+ * Return read response from server
428
+ *
429
+ * @return string
430
+ */
431
+ public function read()
432
+ {
433
+ return $this->_response;
434
+ }
435
+
436
+ /**
437
+ * Close the connection to the server
438
+ *
439
+ */
440
+ public function close()
441
+ {
442
+ if(is_resource($this->_curl)) {
443
+ curl_close($this->_curl);
444
+ }
445
+ $this->_curl = null;
446
+ $this->_connected_to = array(null, null);
447
+ }
448
+
449
+ /**
450
+ * Get cUrl Handle
451
+ *
452
+ * @return resource
453
+ */
454
+ public function getHandle()
455
+ {
456
+ return $this->_curl;
457
+ }
458
+
459
+ /**
460
+ * Set output stream for the response
461
+ *
462
+ * @param resource $stream
463
+ * @return Zend_Http_Client_Adapter_Socket
464
+ */
465
+ public function setOutputStream($stream)
466
+ {
467
+ $this->out_stream = $stream;
468
+ return $this;
469
+ }
470
+
471
+ /**
472
+ * Header reader function for CURL
473
+ *
474
+ * @param resource $curl
475
+ * @param string $header
476
+ * @return int
477
+ */
478
+ public function readHeader($curl, $header)
479
+ {
480
+ $this->_response .= $header;
481
+ return strlen($header);
482
+ }
483
+ }
app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Stream.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * An interface description for Zend_Http_Client_Adapter_Stream classes.
5
+ *
6
+ * This interface decribes Zend_Http_Client_Adapter which supports streaming.
7
+
8
+ */
9
+ interface Allopass_Hipay_Model_Api_Http_Client_Adapter_Stream
10
+ {
11
+ /**
12
+ * Set output stream
13
+ *
14
+ * This function sets output stream where the result will be stored.
15
+ *
16
+ * @param resource $stream Stream to write the output to
17
+ *
18
+ */
19
+ function setOutputStream($stream);
20
+ }
app/code/community/Allopass/Hipay/Model/Api/Request.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Api_Request
3
+ {
4
+
5
+ const VAULT_ACTION_CREATE = 'create';
6
+
7
+ const VAULT_ACTION_UPDATE = 'update';
8
+
9
+ const VAULT_ACTION_LOOKUP = '';
10
+
11
+ const GATEWAY_ACTION_ORDER = 'order';
12
+
13
+ const GATEWAY_ACTION_MAINTENANCE = 'maintenance/transaction/';
14
+
15
+ const GATEWAY_ACTION_HOSTED = "hpayment";
16
+
17
+ /**
18
+ *
19
+ * @var Zend_Http_Client
20
+ */
21
+ protected $_client = null;
22
+
23
+ protected $_methodInstance = null;
24
+
25
+ public function __construct( $methodInstance)
26
+ {
27
+ $this->_methodInstance = $methodInstance[0];
28
+ }
29
+
30
+ protected function getMethodInstance()
31
+ {
32
+ if(!$this->_methodInstance instanceof Mage_Payment_Model_Method_Abstract)
33
+ Mage::throwException("Method instance must be setted or must be type of Mage_Payment_Model_Method_Abstract");
34
+
35
+ return $this->_methodInstance;
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @param Mage_Payment_Model_Method_Abstract $methodInstance
41
+ */
42
+ protected function setMethodInstance($methodInstance)
43
+ {
44
+ $this->_methodInstance = $methodInstance;
45
+ }
46
+
47
+
48
+ protected function getApiUsername($storeId=null)
49
+ {
50
+ if($this->isTestMode())
51
+ return $this->getConfig()->getApiUsernameTest($storeId);
52
+
53
+ return $this->getConfig()->getApiUsername($storeId);
54
+ }
55
+
56
+ protected function getApiPassword($storeId=null)
57
+ {
58
+ if($this->isTestMode())
59
+ return $this->getConfig()->getApiPasswordTest($storeId);
60
+
61
+ return $this->getConfig()->getApiPassword($storeId);
62
+ }
63
+
64
+ protected function isTestMode()
65
+ {
66
+ return (bool)$this->getMethodInstance()->getConfigData('is_test_mode');
67
+ }
68
+
69
+
70
+
71
+ /**
72
+ *
73
+ * @return Allopass_Hipay_Model_Config $config
74
+ */
75
+ protected function getConfig()
76
+ {
77
+ return Mage::getSingleton('hipay/config');
78
+ }
79
+
80
+ /**
81
+ * Get client HTTP
82
+ * @return Zend_Http_Client
83
+ */
84
+ public function getClient($storeId=null)
85
+ {
86
+ if(is_null($this->_client))
87
+ {
88
+ //$credentials = $this->getApiUsername($storeId) . ':' . $this->getApiPassword($storeId);
89
+
90
+ //adapter options
91
+ $config = array('curloptions' => array(
92
+ //CURLOPT_USERPWD=>$credentials,
93
+ //CURLOPT_HTTPHEADER => array('Accept: application/json'),
94
+ CURLOPT_FAILONERROR => false,
95
+ CURLOPT_HEADER=>false,
96
+ CURLOPT_RETURNTRANSFER=>true),
97
+ );
98
+ try {
99
+
100
+ //innitialize http client and adapter curl
101
+ $adapter = Mage::getSingleton('hipay/api_http_client_adapter_curl');
102
+
103
+ $this->_client = new Zend_Http_Client();
104
+ //$adapter->setConfig($config);
105
+ $this->_client->setConfig($config);
106
+ $this->_client->setHeaders(array('Content-Type'=>'application/xml',
107
+ 'Accept'=>'application/json'));
108
+ $this->_client->setAuth($this->getApiUsername($storeId),
109
+ $this->getApiPassword($storeId),
110
+ Zend_Http_Client::AUTH_BASIC);
111
+ $this->_client->setAdapter($adapter);
112
+
113
+
114
+ } catch (Exception $e) {
115
+ Mage::throwException($e);
116
+ }
117
+ }
118
+
119
+ return $this->_client;
120
+ }
121
+
122
+ protected function _request($uri,$params=array(),$method=Zend_Http_Client::POST,$storeId=null)
123
+ {
124
+
125
+ if($method == Zend_Http_Client::POST)
126
+ $this->getClient()->setParameterPost($params);
127
+ else
128
+ $this->getClient()->setParameterGet($params);
129
+
130
+ $this->getClient()->setUri($uri);
131
+
132
+ /* @var $response Zend_Http_Response */
133
+ $response = $this->getClient()->request($method);
134
+
135
+ if($response->isSuccessful())
136
+ {
137
+ //$this->getClient()->getAdapter()->close();
138
+ return json_decode($response->getBody(),true);
139
+ }
140
+ else
141
+ {
142
+ /* @var $error Allopass_Hipay_Model_Api_Response_Error */
143
+ $error = Mage::getSingleton('hipay/api_response_error');
144
+ $error->setData(json_decode($response->getBody(),true));
145
+ $messageError = "Code: " . $error->getCode() . ". Message: " . $error->getMessage();
146
+ if($error->getDescription() != "")
147
+ $messageError .= ". Details: " . $error->getDescription();
148
+
149
+ Mage::throwException($messageError);
150
+ }
151
+
152
+
153
+ }
154
+
155
+ public function getMethodHttp($action)
156
+ {
157
+ if($action == self::VAULT_ACTION_LOOKUP)
158
+ return Zend_Http_Client::GET;
159
+
160
+ return Zend_Http_Client::POST;
161
+ }
162
+
163
+ /**
164
+ *
165
+ */
166
+ protected function getVaultApiEndpoint($storeId=null) {
167
+ if($this->isTestMode())
168
+ return $this->getConfig()->getVaultEndpointTest($storeId);
169
+
170
+ return $this->getConfig()->getVaultEndpoint($storeId);
171
+
172
+ }
173
+
174
+ /**
175
+ *
176
+ */
177
+ protected function getGatewayApiEndpoint($storeId=null) {
178
+ if($this->isTestMode())
179
+ return $this->getConfig()->getGatewayEndpointTest($storeId);
180
+
181
+ return $this->getConfig()->getGatewayEndpoint($storeId);
182
+
183
+ }
184
+
185
+
186
+ /**
187
+ *
188
+ * @param string $action
189
+ * @param array $params
190
+ * @param int $storeId
191
+ * @return Allopass_Hipay_Model_Response_Vault
192
+ */
193
+ public function vaultRequest($action,$params,$storeId=null)
194
+ {
195
+ $uri = $this->getVaultApiEndpoint($storeId) . $action . "/";
196
+
197
+ /* @var $response Allopass_Hipay_Model_Api_Response_Vault */
198
+ $response = Mage::getSingleton('hipay/api_response_vault', $this->_request($uri,$params,$this->getMethodHttp($action),$storeId));
199
+
200
+ return $response;
201
+ }
202
+
203
+ /**
204
+ *
205
+ * @param string $action
206
+ * @param array $params
207
+ * @param int $storeId
208
+ * @return Allopass_Hipay_Model_Response_Abstract
209
+ */
210
+ public function gatewayRequest($action,$params,$storeId=null)
211
+ {
212
+ $uri = $this->getGatewayApiEndpoint($storeId) . $action;
213
+
214
+ /* @var $response Allopass_Hipay_Model_Api_Response_Gateway */
215
+ $response = Mage::getSingleton('hipay/api_response_gateway',$this->_request($uri,$params,$this->getMethodHttp($action),$storeId));
216
+ return $response;
217
+ }
218
+
219
+ }
app/code/community/Allopass/Hipay/Model/Api/Response/Abstract.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @method string getToken() card token
5
+ * @method string getBrand() card type
6
+ * @method string getPan() card number masked
7
+ * @method string getCardHolder() Cardholder name
8
+ * @method int getCardExpiryMonth() card expiry month (2 digits)
9
+ * @method int getCardExpiryYear() card expiry year (4 digits)
10
+ * @method string getIssuer() card issuing bank name
11
+ * @method string getCountry() bank country code (ISO 3166-1, 2 letters)
12
+ *
13
+ */
14
+ abstract class Allopass_Hipay_Model_Api_Response_Abstract extends Varien_Object
15
+ {
16
+
17
+ }
app/code/community/Allopass/Hipay/Model/Api/Response/Error.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @method string getCode()
5
+ * @method string getMessage()
6
+ * @method string getDescription()
7
+ *
8
+ */
9
+ class Allopass_Hipay_Model_Api_Response_Error extends Varien_Object
10
+ {
11
+
12
+ }
app/code/community/Allopass/Hipay/Model/Api/Response/Gateway.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @method string getState() transaction state. completed,forwarding, pending, declined, error
5
+ * @method array getReason() optional element. Reason why transaction was declined.
6
+ * @method string getForwardUrl() optional element. Merchant must redirect the customer's browser to this URL.
7
+ * @method bool getTest() true if the transaction is a testing transaction, otherwise false
8
+ * @method int getMid() your merchant account number (issued to you by Allopass).
9
+ * @method int getAttemptId() attempt id of the payment.
10
+ * @method string getAuthorizationCode() an authorization code (up to 35 characters) generated for each approved or pending transaction by the acquiring provider.
11
+ * @method string getTransactionReference() the unique identifier of the transaction.
12
+ * @method DateTime getDateCreated() time when transaction was created.
13
+ * @method DateTime getDateUpdated() time when transaction was last updated.
14
+ * @method DateTime getDateAuthorized() time when transaction was authorized.
15
+ * @method string getStatus() transaction status.
16
+ * @method string getMessage() transaction message.
17
+ * @method string getAuthorizedAmount() the transaction amount.
18
+ * @method string getCapturedAmount() captured amount.
19
+ * @method string getRefundedAmount() refunded amount.
20
+ * @method string getDecimals() decimal precision of transaction amount..
21
+ * @method string getCurrency() base currency for this transaction.
22
+ * @method string getIpAddress() the IP address of the customer making the purchase.
23
+ * @method string getIpCountry() country code associated to the customer's IP address.
24
+ * @method string getEci() Electronic Commerce Indicator (ECI).
25
+ * @method string getPaymentProduct() payment product used to complete the transaction.
26
+ * @method string getPaymentMethod() base currency for this transaction.
27
+ * @method array getFraudScreening() Result of the fraud screening.
28
+ *
29
+ */
30
+ class Allopass_Hipay_Model_Api_Response_Gateway extends Allopass_Hipay_Model_Api_Response_Abstract
31
+ {
32
+ public function getForwardUrl()
33
+ {
34
+ return $this->getData('forwardUrl');
35
+ }
36
+
37
+ public function getAttemptId()
38
+ {
39
+ return $this->getData('attemptId');
40
+ }
41
+
42
+ public function getAuthorizationCode()
43
+ {
44
+ return $this->getData('authorizationCode');
45
+ }
46
+
47
+
48
+ public function getTransactionReference()
49
+ {
50
+ if($this->getData('transactionReference') == '')
51
+ return $this->getData('reference');
52
+
53
+ return $this->getData('transactionReference');
54
+ }
55
+
56
+
57
+ public function getDateCreated()
58
+ {
59
+ return $this->getData('dateCreated');
60
+ }
61
+
62
+
63
+ public function getDateUpdated()
64
+ {
65
+ return $this->getData('dateUpdated');
66
+ }
67
+
68
+
69
+ public function getDateAuthorized()
70
+ {
71
+ return $this->getData('dateAuthorized');
72
+ }
73
+
74
+ public function getAuthorizedAmount()
75
+ {
76
+ return $this->getData('authorizedAmount');
77
+ }
78
+
79
+ public function getCapturedAmount()
80
+ {
81
+ return $this->getData('capturedAmount');
82
+ }
83
+
84
+ public function getRefundedAmount()
85
+ {
86
+ return $this->getData('refundedAmount');
87
+ }
88
+
89
+ public function getIpAddress()
90
+ {
91
+ return $this->getData('ipAddress');
92
+ }
93
+
94
+ public function getIpCountry()
95
+ {
96
+ return $this->getData('ipCountry');
97
+ }
98
+
99
+ public function getPaymentProduct()
100
+ {
101
+ return $this->getData('paymentProduct');
102
+ }
103
+
104
+ public function getPaymentMethod()
105
+ {
106
+ return $this->getData('paymentMethod');
107
+ }
108
+
109
+ public function getFraudScreening()
110
+ {
111
+ return $this->getData('fraudScreening');
112
+ }
113
+
114
+ }
app/code/community/Allopass/Hipay/Model/Api/Response/Notification.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @method string getState() transaction state. completed,forwarding, pending, declined, error
5
+ * @method array getReason() optional element. Reason why transaction was declined.
6
+ * @method bool getTest() true if the transaction is a testing transaction, otherwise false
7
+ * @method int getMid() your merchant account number (issued to you by Allopass).
8
+ * @method int getAttemptId() attempt id of the payment.
9
+ * @method string getAuthorizationCode() an authorization code (up to 35 characters) generated for each approved or pending transaction by the acquiring provider.
10
+ * @method string getTransactionReference() the unique identifier of the transaction.
11
+ * @method DateTime getDateCreated() time when transaction was created.
12
+ * @method DateTime getDateUpdated() time when transaction was last updated.
13
+ * @method DateTime getDateAuthorized() time when transaction was authorized.
14
+ * @method string getStatus() transaction status.
15
+ * @method string getMessage() transaction message.
16
+ * @method string getAuthorizedAmount() the transaction amount.
17
+ * @method string getCapturedAmount() captured amount.
18
+ * @method string getRefundedAmount() refunded amount.
19
+ * @method string getDecimals() decimal precision of transaction amount..
20
+ * @method string getCurrency() base currency for this transaction.
21
+ * @method string getIpAddress() the IP address of the customer making the purchase.
22
+ * @method string getIpCountry() country code associated to the customer's IP address.
23
+ * @method string getEci() Electronic Commerce Indicator (ECI).
24
+ * @method string getPaymentProduct() payment product used to complete the transaction.
25
+ * @method string getPaymentMethod() base currency for this transaction.
26
+ * @method array getFraudScreening() Result of the fraud screening.
27
+ *
28
+ */
29
+ class Allopass_Hipay_Model_Api_Response_Notification extends Allopass_Hipay_Model_Api_Response_Abstract
30
+ {
31
+
32
+
33
+ }
app/code/community/Allopass/Hipay/Model/Api/Response/Vault.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @method string getRequestId() ...
4
+ *
5
+ */
6
+ class Allopass_Hipay_Model_Api_Response_Vault extends Allopass_Hipay_Model_Api_Response_Abstract
7
+ {
8
+
9
+ }
app/code/community/Allopass/Hipay/Model/Config.php ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Config extends Varien_Object
3
+ {
4
+ const API_USERNAME = 'api_username';
5
+
6
+ const API_PASSWORD = 'api_password';
7
+
8
+ const API_USERNAME_TEST = "api_username_test";
9
+
10
+ const API_PASSWORD_TEST = 'api_password_test';
11
+
12
+ const SECRET_PASSPHRASE = 'secret_passphrase';
13
+
14
+ const VAULT_ENDPOINT_TEST = 'vault_endpoint_stage';
15
+
16
+ const VAULT_ENDPOINT = 'vault_endpoint_production';
17
+
18
+ const GATEWAY_ENDPOINT_TEST = 'gateway_endpoint_stage';
19
+
20
+ const GATEWAY_ENDPOINT = 'gateway_endpoint_production';
21
+
22
+
23
+ /**
24
+ * Return config var
25
+ *
26
+ * @param string $key Var path key
27
+ * @param int $storeId Store View Id
28
+ * @return mixed
29
+ */
30
+ public function getConfigData($key, $storeId = null)
31
+ {
32
+
33
+ if (!$this->hasData($key)) {
34
+ $value = Mage::getStoreConfig('hipay/hipay_api/' . $key, $storeId);
35
+ $this->setData($key, $value);
36
+ }
37
+ return $this->getData($key);
38
+ }
39
+
40
+ /**
41
+ * Return config var
42
+ *
43
+ * @param string $key Var path key
44
+ * @param int $storeId Store View Id
45
+ * @return mixed
46
+ */
47
+ public function getConfigFlag($key, $storeId = null)
48
+ {
49
+
50
+ if (!$this->hasData($key)) {
51
+ $value = Mage::getStoreConfigFlag('hipay/hipay_api/' . $key, $storeId);
52
+ $this->setData($key, $value);
53
+ }
54
+ return $this->getData($key);
55
+ }
56
+
57
+ public function getSecretPassphrase($storeId =null)
58
+ {
59
+ return $this->getConfigData(self::SECRET_PASSPHRASE,$storeId);
60
+ }
61
+
62
+ public function getApiUsername($storeId =null)
63
+ {
64
+ return $this->getConfigData(self::API_USERNAME,$storeId);
65
+ }
66
+
67
+ public function getApiPassword($storeId=null)
68
+ {
69
+ return $this->getConfigData(self::API_PASSWORD,$storeId);
70
+ }
71
+
72
+ public function getApiUsernameTest($storeId =null)
73
+ {
74
+ return $this->getConfigData(self::API_USERNAME_TEST,$storeId);
75
+ }
76
+
77
+ public function getApiPasswordTest($storeId=null)
78
+ {
79
+ return $this->getConfigData(self::API_PASSWORD_TEST,$storeId);
80
+ }
81
+
82
+ public function getVaultEndpoint($storeId=null)
83
+ {
84
+ return $this->getConfigData(self::VAULT_ENDPOINT,$storeId);
85
+ }
86
+
87
+ public function getVaultEndpointTest($storeId=null)
88
+ {
89
+ return $this->getConfigData(self::VAULT_ENDPOINT_TEST,$storeId);
90
+ }
91
+
92
+ public function getGatewayEndpoint($storeId=null)
93
+ {
94
+ return $this->getConfigData(self::GATEWAY_ENDPOINT,$storeId);
95
+ }
96
+
97
+ public function getGatewayEndpointTest($storeId=null)
98
+ {
99
+ return $this->getConfigData(self::GATEWAY_ENDPOINT_TEST,$storeId);
100
+ }
101
+
102
+ /**
103
+ * Retrieve array of credit card types
104
+ *
105
+ * @return array
106
+ */
107
+ public function getCcTypes()
108
+ {
109
+ $_types = Mage::getConfig()->getNode('global/payment_hipay/cc/types')->asArray();
110
+
111
+ uasort($_types, array('Allopass_Hipay_Model_Config', 'compareCcTypes'));
112
+
113
+ $types = array();
114
+ foreach ($_types as $data) {
115
+ if (isset($data['code']) && isset($data['name'])) {
116
+ $types[$data['code']] = $data['name'];
117
+ }
118
+ }
119
+ return $types;
120
+ }
121
+
122
+ /**
123
+ * Retrieve array of credit card types to get code hipay equals to code Magento
124
+ *
125
+ * @return array
126
+ */
127
+ public function getCcTypesHipay()
128
+ {
129
+ $_types = Mage::getConfig()->getNode('global/payment_hipay/hosted/types')->asArray();
130
+
131
+ $types = array();
132
+ foreach ($_types as $data) {
133
+ if (isset($data['code']) && isset($data['code_hipay'])) {
134
+ $types[$data['code']] = $data['code_hipay'];
135
+ }
136
+ }
137
+ return $types;
138
+ }
139
+
140
+ /**
141
+ * Retrieve array of template types to display in hosted page
142
+ *
143
+ * @return array
144
+ */
145
+ public function getTemplateHosted()
146
+ {
147
+ $_templates = Mage::getConfig()->getNode('global/template_hipay/hosted')->asArray();
148
+
149
+ $templates = array();
150
+ foreach ($_templates as $data) {
151
+ if (isset($data['value']) && isset($data['label'])) {
152
+ $templates[$data['value']] = $data['label'];
153
+ }
154
+ }
155
+ return $templates;
156
+ }
157
+
158
+ /**
159
+ * Retrieve array of credit card types to get code hipay
160
+ *
161
+ * @return array
162
+ */
163
+ public function getCcTypesCodeHipay()
164
+ {
165
+ $_types = Mage::getConfig()->getNode('global/payment_hipay/hosted/types')->asArray();
166
+
167
+ $types = array();
168
+ foreach ($_types as $data) {
169
+ if (isset($data['code_hipay']) && isset($data['name'])) {
170
+ $types[$data['code_hipay']] = $data['name'];
171
+ }
172
+ }
173
+ return $types;
174
+ }
175
+
176
+ /**
177
+ * Retrieve list of months translation
178
+ *
179
+ * @return array
180
+ */
181
+ public function getMonths()
182
+ {
183
+ $data = Mage::app()->getLocale()->getTranslationList('month');
184
+ foreach ($data as $key => $value) {
185
+ $monthNum = ($key < 10) ? '0'.$key : $key;
186
+ $data[$key] = $monthNum . ' - ' . $value;
187
+ }
188
+ return $data;
189
+ }
190
+
191
+ /**
192
+ * Retrieve array of available years
193
+ *
194
+ * @return array
195
+ */
196
+ public function getYears()
197
+ {
198
+ $years = array();
199
+ $first = date("Y");
200
+
201
+ for ($index=0; $index <= 10; $index++) {
202
+ $year = $first + $index;
203
+ $years[$year] = $year;
204
+ }
205
+ return $years;
206
+ }
207
+
208
+ /**
209
+ * Statis Method for compare sort order of CC Types
210
+ *
211
+ * @param array $a
212
+ * @param array $b
213
+ * @return int
214
+ */
215
+ static function compareCcTypes($a, $b)
216
+ {
217
+ if (!isset($a['order'])) {
218
+ $a['order'] = 0;
219
+ }
220
+
221
+ if (!isset($b['order'])) {
222
+ $b['order'] = 0;
223
+ }
224
+
225
+ if ($a['order'] == $b['order']) {
226
+ return 0;
227
+ } else if ($a['order'] > $b['order']) {
228
+ return 1;
229
+ } else {
230
+ return -1;
231
+ }
232
+
233
+ }
234
+ }
app/code/community/Allopass/Hipay/Model/Log/Adapter.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Log Adapter
5
+ */
6
+ class Allopass_Hipay_Model_Log_Adapter
7
+ {
8
+
9
+ /**
10
+ * Store log file name
11
+ *
12
+ * @var string
13
+ */
14
+ protected $_logFileName = '';
15
+
16
+ /**
17
+ * Data to log
18
+ *
19
+ * @var array
20
+ */
21
+ protected $_data = array();
22
+
23
+ /**
24
+ * Fields that should be replaced in debug data with '***'
25
+ *
26
+ * @var array
27
+ */
28
+ protected $_debugReplacePrivateDataKeys = array();
29
+
30
+ /**
31
+ * Set log file name
32
+ *
33
+ * @param string $fileName
34
+ */
35
+ public function __construct($fileName)
36
+ {
37
+ $this->_logFileName = $fileName;
38
+ }
39
+
40
+ /**
41
+ * Perform forced log data to file
42
+ *
43
+ * @param mixed $data
44
+ * @return Mage_Core_Model_Log_Adapter
45
+ */
46
+ public function log($data = null)
47
+ {
48
+ if ($data === null) {
49
+ $data = $this->_data;
50
+ }
51
+ else {
52
+ if (!is_array($data)) {
53
+ $data = array($data);
54
+ }
55
+ }
56
+ $data = $this->_filterDebugData($data);
57
+ $data['__pid'] = getmypid();
58
+ Mage::log($data, null, $this->_logFileName, true);
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * Log data setter
64
+ *
65
+ * @param string|array $key
66
+ * @param mixed $value
67
+ * @return Mage_Core_Model_Log_Adapter
68
+ * @todo replace whole data
69
+ */
70
+ public function setData($key, $value = null)
71
+ {
72
+ if(is_array($key)) {
73
+ $this->_data = $key;
74
+ }
75
+ else {
76
+ $this->_data[$key] = $value;
77
+ }
78
+ return $this;
79
+ }
80
+
81
+ /**
82
+ * Setter for private data keys, that should be replaced in debug data with '***'
83
+ *
84
+ * @param array $keys
85
+ * @return Mage_Core_Model_Log_Adapter
86
+ */
87
+ public function setFilterDataKeys($keys)
88
+ {
89
+ if (!is_array($keys)) {
90
+ $keys = array($keys);
91
+ }
92
+ $this->_debugReplacePrivateDataKeys = $keys;
93
+ return $this;
94
+ }
95
+
96
+ /**
97
+ * Recursive filter data by private conventions
98
+ *
99
+ * @param mixed $debugData
100
+ * @return mixed
101
+ */
102
+ protected function _filterDebugData($debugData)
103
+ {
104
+ if (is_array($debugData) && is_array($this->_debugReplacePrivateDataKeys)) {
105
+ foreach ($debugData as $key => $value) {
106
+ if (in_array($key, $this->_debugReplacePrivateDataKeys)) {
107
+ $debugData[$key] = '****';
108
+ }
109
+ else {
110
+ if (is_array($debugData[$key])) {
111
+ $debugData[$key] = $this->_filterDebugData($debugData[$key]);
112
+ }
113
+ }
114
+ }
115
+ }
116
+ return $debugData;
117
+ }
118
+ }
app/code/community/Allopass/Hipay/Model/Method/Abstract.php ADDED
@@ -0,0 +1,1003 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const OPERATION_SALE = "Sale";
5
+ const OPERATION_AUTHORIZATION = "Authorization";
6
+ const OPERATION_MAINTENANCE_CAPTURE = "Capture";
7
+ const OPERATION_MAINTENANCE_REFUND = "Refund";
8
+
9
+
10
+ const STATE_COMPLETED = "completed";
11
+ const STATE_FORWARDING = "forwarding";
12
+ const STATE_PENDING = "pending";
13
+ const STATE_DECLINED = "declined";
14
+ const STATE_ERROR = "error";
15
+
16
+ //const STATUS_PENDING_CAPTURE = 'pending_capture';
17
+
18
+ /**
19
+ * Availability options
20
+ */
21
+ protected $_isGateway = true;
22
+ protected $_canAuthorize = true;
23
+ protected $_canCapture = true;
24
+ protected $_canCapturePartial = true;
25
+ protected $_canRefund = true;
26
+ protected $_canRefundInvoicePartial = true;
27
+ protected $_canVoid = true;
28
+ protected $_canUseInternal = false;
29
+ protected $_canUseCheckout = true;
30
+ protected $_canUseForMultishipping = false;
31
+ protected $_canSaveCc = false;
32
+ protected $_canReviewPayment = false;
33
+
34
+ //protected $_allowCurrencyCode = array('EUR');
35
+
36
+ /**
37
+ * Fields that should be replaced in debug with '***'
38
+ *
39
+ * @var array
40
+ */
41
+ protected $_debugReplacePrivateDataKeys = array('token','cardtoken','card_number','cvc');
42
+
43
+
44
+ public function isInitializeNeeded()
45
+ {
46
+ return true;
47
+ }
48
+
49
+
50
+ protected function getOperation()
51
+ {
52
+ switch ($this->getConfigPaymentAction())
53
+ {
54
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
55
+ return self::OPERATION_AUTHORIZATION;
56
+ default:
57
+ return self::OPERATION_SALE;
58
+ }
59
+
60
+ return '';
61
+ }
62
+
63
+
64
+ public function authorize(Varien_Object $payment, $amount)
65
+ {
66
+ parent::authorize($payment, $amount);
67
+
68
+ $payment->setSkipTransactionCreation(true);
69
+ return $this;
70
+ }
71
+
72
+
73
+
74
+
75
+ /**
76
+ *
77
+ * @param Allopass_Hipay_Model_Api_Response_Gateway $gatewayResponse
78
+ * @param Mage_Sales_Model_Order_Payment $payment
79
+ * @param float $amount
80
+ */
81
+ public function processResponse($gatewayResponse,$payment,$amount)
82
+ {
83
+
84
+ $order = $payment->getOrder();
85
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
86
+
87
+ //$defaultExceptionMessage = Mage::helper('hipay')->__('Error in process response!');
88
+
89
+ switch ($this->getConfigPaymentAction()) {
90
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
91
+ $requestType = self::OPERATION_AUTHORIZATION;
92
+ $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH;
93
+ $defaultExceptionMessage = Mage::helper('hipay')->__('Payment authorization error.');
94
+ break;
95
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
96
+ $requestType = self::OPERATION_SALE;
97
+ $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
98
+ $defaultExceptionMessage = Mage::helper('hipay')->__('Payment capturing error.');
99
+ break;
100
+ }
101
+
102
+ switch ($gatewayResponse->getState())
103
+ {
104
+ case self::STATE_COMPLETED:
105
+ case self::STATE_PENDING:
106
+ switch ((int)$gatewayResponse->getStatus())
107
+ {
108
+ case 111: //denied
109
+
110
+ $this->addTransaction(
111
+ $payment,
112
+ $gatewayResponse->getTransactionReference(),
113
+ $newTransactionType,
114
+ array('is_transaction_closed' => 0),
115
+ array(),
116
+ Mage::helper('hipay')->getTransactionMessage(
117
+ $payment, $requestType, /*$gatewayResponse->getTransactionReference()*/null, $amount
118
+ )
119
+ );
120
+
121
+
122
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
123
+ $order->unhold();
124
+ }
125
+
126
+ if (!$status = $this->getConfigData('order_status_payment_refused')) {
127
+ $status = $order->getStatus();
128
+ }
129
+
130
+
131
+ if ($status == Mage_Sales_Model_Order::STATE_HOLDED && $order->canHold()) {
132
+ $order->hold();
133
+ } elseif ($status == Mage_Sales_Model_Order::STATE_CANCELED && $order->canCancel()) {
134
+ $order->cancel();
135
+ }
136
+
137
+ $order->addStatusToHistory($status, Mage::helper('hipay')->getTransactionMessage(
138
+ $payment, self::OPERATION_AUTHORIZATION, null, $amount,true,$gatewayResponse->getMessage()
139
+ ));
140
+
141
+ $order->save();
142
+
143
+
144
+ break;
145
+ case 112: //Authorized and pending
146
+
147
+
148
+ $this->addTransaction(
149
+ $payment,
150
+ $gatewayResponse->getTransactionReference(),
151
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
152
+ array('is_transaction_closed' => 0),
153
+ array(
154
+ $this->_realTransactionIdKey => $gatewayResponse->getTransactionReference(),
155
+ ),
156
+ Mage::helper('hipay')->getTransactionMessage(
157
+ $payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount,true
158
+ )
159
+ );
160
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
161
+ if(defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW'))
162
+ $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
163
+ $status = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
164
+
165
+ if($fraudScreening = $gatewayResponse->getFraudScreening())
166
+ {
167
+
168
+ if(isset($fraudScreening['result'])
169
+ && ($fraudScreening['result'] == 'pending' || $fraudScreening['result'] == 'challenged') )
170
+ {
171
+ if(defined('Mage_Sales_Model_Order::STATUS_FRAUD'))
172
+ $status = Mage_Sales_Model_Order::STATUS_FRAUD;
173
+
174
+ }
175
+
176
+ }
177
+
178
+ $order->setState($state,$status,$gatewayResponse->getMessage());
179
+
180
+ $order->save();
181
+ break;
182
+
183
+ case 116: //Authorized
184
+
185
+ if($order->getStatus() == 'capture_requested' || $order->getStatus() == 'processing' )// for logic process
186
+ break;
187
+ if(!$this->isPreauthorizeCapture($payment))
188
+ $this->addTransaction(
189
+ $payment,
190
+ $gatewayResponse->getTransactionReference(),
191
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
192
+ array('is_transaction_closed' => 0),
193
+ array(),
194
+ Mage::helper('hipay')->getTransactionMessage(
195
+ $payment, self::OPERATION_AUTHORIZATION, /*$gatewayResponse->getTransactionReference()*/null, $amount
196
+ )
197
+ );
198
+
199
+ $order->setState(
200
+ Mage_Sales_Model_Order::STATE_PROCESSING,
201
+ 'pending_capture',
202
+ Mage::helper('hipay')
203
+ ->__("Waiting for capture transaction ID '%s' of amount %s",
204
+ $gatewayResponse->getTransactionReference(),
205
+ $order->getBaseCurrency()->formatTxt($order->getBaseTotalDue())),
206
+ $notified = true);
207
+
208
+ $order->save();
209
+ if (!$order->getEmailSent()) {
210
+ $order->sendNewOrderEmail();
211
+ }
212
+
213
+
214
+
215
+ break;
216
+ case 117: //Capture Requested
217
+
218
+ $this->addTransaction(
219
+ $payment,
220
+ $gatewayResponse->getTransactionReference(),
221
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE,
222
+ array('is_transaction_closed' => 0),
223
+ array(),
224
+ Mage::helper('hipay')->getTransactionMessage(
225
+ $payment, self::OPERATION_SALE, /*$gatewayResponse->getTransactionReference()*/null, $amount
226
+ )
227
+ );
228
+
229
+ $message = Mage::helper("hipay")->__('Capture Requested by Hipay.');
230
+
231
+ $order->setState(
232
+ Mage_Sales_Model_Order::STATE_PROCESSING, 'capture_requested', $message, null, false
233
+ );
234
+
235
+ if(((int)$this->getConfigData('hipay_status_validate_order') == 117) === false )
236
+ break;
237
+ else {
238
+ $order->save();
239
+ }
240
+
241
+ case 118: //Capture
242
+
243
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
244
+ $order->unhold();
245
+ }
246
+
247
+
248
+ if (!$status = $this->getConfigData('order_status_payment_accepted')) {
249
+ $status = $order->getStatus();
250
+ }
251
+
252
+ $message = Mage::helper("hipay")->__('Payment accepted by Hipay.');
253
+
254
+ if ($status == Mage_Sales_Model_Order::STATE_PROCESSING) {
255
+ $order->setState(
256
+ Mage_Sales_Model_Order::STATE_PROCESSING, $status, $message
257
+ );
258
+ } else if ($status == Mage_Sales_Model_Order::STATE_COMPLETE) {
259
+ $order->setState(
260
+ Mage_Sales_Model_Order::STATE_COMPLETE, $status, $message, null, false
261
+ );
262
+ } else {
263
+ $order->addStatusToHistory($status, $message, true);
264
+ }
265
+
266
+
267
+
268
+ // Create invoice
269
+ if ($this->getConfigData('invoice_create',$order->getStoreId()) && !$order->hasInvoices()) {
270
+
271
+ $invoice = $order->prepareInvoice();
272
+ $invoice->setTransactionId($gatewayResponse->getTransactionReference());
273
+ $invoice->register()->capture();
274
+ $invoice->setIsPaid(1);
275
+ Mage::getModel('core/resource_transaction')
276
+ ->addObject($invoice)->addObject($invoice->getOrder())
277
+ ->save();
278
+
279
+ }
280
+ elseif($order->hasInvoices())
281
+ {
282
+ foreach ($order->getInvoiceCollection() as $invoice)
283
+ {
284
+ if($invoice->getState() == Mage_Sales_Model_Order_Invoice::STATE_OPEN && $invoice->getBaseGrandTotal() == $gatewayResponse->getCapturedAmount())
285
+ {
286
+ $invoice->pay();
287
+ Mage::getModel('core/resource_transaction')
288
+ ->addObject($invoice)->addObject($invoice->getOrder())
289
+ ->save();
290
+
291
+ }
292
+ }
293
+ }
294
+
295
+ if (!$order->getEmailSent()) {
296
+ $order->sendNewOrderEmail();
297
+ }
298
+
299
+ break;
300
+
301
+ case 124: //Refund Requested
302
+
303
+ $message = Mage::helper("hipay")->__('Refund Requested by Hipay.');
304
+
305
+ $order->setState(
306
+ Mage_Sales_Model_Order::STATE_PROCESSING, 'refund_requested', $message, null, false
307
+ );
308
+
309
+ break;
310
+ case 125: //Refund
311
+
312
+ if($order->hasCreditmemos())
313
+ {
314
+ /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
315
+ foreach ($order->getCreditmemosCollection() as $creditmemo)
316
+ {
317
+ if($creditmemo->getState() == Mage_Sales_Model_Order_Creditmemo::STATE_OPEN
318
+ && $creditmemo->getGrandTotal() == $gatewayResponse->getRefundedAmount())
319
+ {
320
+ $creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_REFUNDED);
321
+
322
+ $message = Mage::helper("hipay")->__('Refund accepted by Hipay.');
323
+
324
+ $order->addStatusToHistory($order->getStatus(), $message);
325
+
326
+ Mage::getModel('core/resource_transaction')
327
+ ->addObject($creditmemo)->addObject($creditmemo->getOrder())
328
+ ->save();
329
+
330
+ }
331
+ }
332
+ }
333
+ elseif($order->canCreditmemo())
334
+ {
335
+ $service = Mage::getModel('sales/service_order', $order);
336
+ $creditmemo = $service->prepareInvoiceCreditmemo($order->getInvoiceCollection()->getFirstItem());
337
+ foreach ($creditmemo->getAllItems() as $creditmemoItem) {
338
+ $creditmemoItem->setBackToStock(Mage::helper('cataloginventory')->isAutoReturnEnabled());
339
+ }
340
+ $creditmemo->setOfflineRequested(true);
341
+ $transactionSave = Mage::getModel('core/resource_transaction')
342
+ ->addObject($creditmemo)
343
+ ->addObject($creditmemo->getOrder());
344
+ if ($creditmemo->getInvoice()) {
345
+ $transactionSave->addObject($creditmemo->getInvoice());
346
+ }
347
+ $transactionSave->save();
348
+ }
349
+
350
+ break;
351
+ }
352
+
353
+
354
+ if(in_array($gatewayResponse->getPaymentProduct(), array('visa','american-express','mastercard','cb'))
355
+ && ((int)$gatewayResponse->getEci() == 9 || $payment->getAdditionalInformation('create_oneclick'))
356
+ && !$order->isNominal()) //Recurring E-commerce
357
+ {
358
+
359
+ if($customer->getId())
360
+ {
361
+ $this->responseToCustomer($customer,$gatewayResponse);
362
+
363
+ }
364
+ }
365
+ $order->save();
366
+ break;
367
+
368
+ case self::STATE_FORWARDING:
369
+ $this->addTransaction(
370
+ $payment,
371
+ $gatewayResponse->getTransactionReference(),
372
+ $newTransactionType,
373
+ array('is_transaction_closed' => 0),
374
+ array(),
375
+ Mage::helper('hipay')->getTransactionMessage(
376
+ $payment, $requestType, $gatewayResponse->getTransactionReference(), $amount
377
+ )
378
+ );
379
+
380
+ $payment->setIsTransactionPending(1);
381
+ $order->save();
382
+ break;
383
+
384
+ case self::STATE_DECLINED:
385
+
386
+ $reason = $gatewayResponse->getReason();
387
+ $this->addTransaction(
388
+ $payment,
389
+ $gatewayResponse->getTransactionReference(),
390
+ $newTransactionType,
391
+ array('is_transaction_closed' => 0),
392
+ array(
393
+ $this->_realTransactionIdKey => $gatewayResponse->getTransactionReference(),
394
+ $this->_isTransactionFraud => true
395
+ ),
396
+ Mage::helper('hipay')->getTransactionMessage(
397
+ $payment, $requestType, null, $amount,true,"Code: ".$reason['code']." " . Mage::helper('hipay')->__("Reason") . " : ".$reason['message']
398
+ )
399
+ );
400
+
401
+
402
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
403
+ $order->unhold();
404
+ }
405
+
406
+ if (!$status = $this->getConfigData('order_status_payment_refused')) {
407
+ $status = $order->getStatus();
408
+ }
409
+
410
+ if($fraudScreening = $gatewayResponse->getFraudScreening())
411
+ {
412
+
413
+ if(isset($fraudScreening['result']) && $fraudScreening['result'] == 'blocked' )
414
+ {
415
+ $payment->setIsFraudDetected(true);
416
+
417
+ if(defined('Mage_Sales_Model_Order::STATUS_FRAUD'))
418
+ $status = Mage_Sales_Model_Order::STATUS_FRAUD;
419
+
420
+ $order->addStatusToHistory($status, Mage::helper('hipay')->getTransactionMessage(
421
+ $payment, $this->getOperation(), null, $amount,true,$gatewayResponse->getMessage()
422
+ ));
423
+ }
424
+
425
+ }
426
+
427
+
428
+
429
+ if ($status == Mage_Sales_Model_Order::STATE_HOLDED && $order->canHold()) {
430
+ $order->hold();
431
+ } elseif ($status == Mage_Sales_Model_Order::STATE_CANCELED && $order->canCancel()) {
432
+ $order->cancel();
433
+ }
434
+
435
+
436
+ $order->addStatusToHistory($status, Mage::helper('hipay')->getTransactionMessage(
437
+ $payment, $this->getOperation(), null, $amount,true,$gatewayResponse->getMessage()
438
+ ));
439
+
440
+ $order->save();
441
+
442
+ break;
443
+
444
+ case self::STATE_ERROR:
445
+ default:
446
+ Mage::throwException($defaultExceptionMessage);
447
+ break;
448
+
449
+ }
450
+ }
451
+
452
+ /**
453
+ *
454
+ * @param Allopass_Hipay_Model_Api_Response_Gateway $gatewayResponse
455
+ * @param Mage_Sales_Model_Order_Payment $payment
456
+ * @param float $amount
457
+ */
458
+ public function processResponseToRedirect($gatewayResponse,$payment,$amount)
459
+ {
460
+
461
+ $order = $payment->getOrder();
462
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
463
+
464
+ switch ($this->getConfigPaymentAction()) {
465
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
466
+ $requestType = self::OPERATION_AUTHORIZATION;
467
+ $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH;
468
+ $defaultExceptionMessage = Mage::helper('hipay')->__('Payment authorization error.');
469
+ break;
470
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
471
+ $requestType = self::OPERATION_SALE;
472
+ $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
473
+ $defaultExceptionMessage = Mage::helper('hipay')->__('Payment capturing error.');
474
+ break;
475
+ }
476
+
477
+ switch ($gatewayResponse->getState())
478
+ {
479
+ case self::STATE_COMPLETED:
480
+ return Mage::getUrl('checkout/onepage/success');
481
+
482
+ case self::STATE_FORWARDING:
483
+ $payment->setIsTransactionPending(1);
484
+ $order->save();
485
+ return $gatewayResponse->getForwardUrl();
486
+
487
+ case self::STATE_PENDING:
488
+ if($this->getConfigData('re_add_to_cart'))
489
+ $this->getHelper()->reAddToCart($order->getIncrementId());
490
+
491
+ return Mage::getUrl($this->getConfigData('pending_redirect_page'));
492
+
493
+ case self::STATE_DECLINED:
494
+
495
+ if($this->getConfigData('re_add_to_cart'))
496
+ $this->getHelper()->reAddToCart($order->getIncrementId());
497
+
498
+ return Mage::getUrl('checkout/onepage/failure');
499
+
500
+ case self::STATE_ERROR:
501
+ default:
502
+
503
+ if($this->getConfigData('re_add_to_cart'))
504
+ $this->getHelper()->reAddToCart($order->getIncrementId());
505
+
506
+ $this->_getCheckout()->setErrorMessage($defaultExceptionMessage);
507
+ return Mage::getUrl('checkout/onepage/failure');
508
+
509
+ }
510
+ }
511
+
512
+ /**
513
+ *
514
+ * @return Allopass_Hipay_Helper_Data $helper
515
+ */
516
+ protected function getHelper()
517
+ {
518
+ return Mage::helper('hipay');
519
+ }
520
+
521
+
522
+ /**
523
+ *
524
+ * @param Mage_Customer_Model_Customer $customer
525
+ * @param Allopass_Hipay_Model_Api_Response_Gateway $response
526
+ */
527
+ protected function responseToCustomer($customer,$response)
528
+ {
529
+ $this->getHelper()->responseToCustomer($customer,$response);
530
+ return $this;
531
+ }
532
+
533
+ /**
534
+ *
535
+ * @param Mage_Sales_Model_Order_Payment $payment
536
+ * @param float $amount
537
+ * @return @return Mage_Payment_Model_Abstract
538
+ */
539
+ public function refund(Varien_Object $payment, $amount)
540
+ {
541
+ parent::refund($payment, $amount);
542
+
543
+ $transactionId = $payment->getLastTransId();
544
+
545
+ $gatewayParams = array('operation'=>'refund','amount'=>$amount);
546
+ /* @var $request Allopass_Hipay_Model_Api_Request */
547
+ $request = Mage::getModel('hipay/api_request',array($this));
548
+ $action = Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_MAINTENANCE . $transactionId;
549
+
550
+
551
+ $this->_debug($gatewayParams);
552
+
553
+ $gatewayResponse = $request->gatewayRequest($action,$gatewayParams);
554
+
555
+ $this->_debug($gatewayResponse->debug());
556
+
557
+
558
+ switch ($gatewayResponse->getStatus())
559
+ {
560
+ case "124":
561
+ case "125":
562
+
563
+ /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
564
+ $creditmemo = $payment->getCreditmemo();
565
+ $creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_OPEN);
566
+
567
+ break;
568
+ default:
569
+ Mage::throwException( $gatewayResponse->getStatus() . " ==> " .$gatewayResponse->getMessage());
570
+ break;
571
+ }
572
+
573
+ return $this;
574
+ }
575
+
576
+ /**
577
+ *
578
+ * @param Mage_Sales_Model_Order_Payment $payment
579
+ * @param float $amount
580
+ * @param string|null $token
581
+ * @return multitype:
582
+ */
583
+ public function getGatewayParams($payment,$amount,$token=null)
584
+ {
585
+
586
+ $params = array();
587
+
588
+ $params['orderid'] = $payment->getOrder()->getIncrementId();
589
+
590
+ $paymentProduct = null;
591
+
592
+ $params['description'] = Mage::helper('hipay')->__("Order %s by %s",$payment->getOrder()->getIncrementId(),$payment->getOrder()->getCustomerEmail());//MANDATORY
593
+ $params['long_description'] = "";// optional
594
+ $params['currency'] = $payment->getOrder()->getOrderCurrencyCode();
595
+ $params['amount'] = $amount;
596
+ $params['shipping'] = $payment->getOrder()->getShippingAmount();
597
+ $params['tax'] = $payment->getOrder()->getTaxAmount();
598
+ $params['cid'] = $payment->getOrder()->getCustomerId();//CUSTOMER ID
599
+ $params['ipaddr'] = $payment->getOrder()->getRemoteIp();
600
+
601
+ $params['http_accept'] = "*/*";
602
+ $params['http_user_agent'] = Mage::helper('core/http')->getHttpUserAgent();
603
+ $params['language'] = Mage::app()->getLocale()->getLocaleCode();//strpos(Mage::app()->getLocale()->getLocaleCode(), "fr") !== false ? "fr_FR" : 'en';
604
+
605
+ /**
606
+ * Parameters specific to the payment product
607
+ */
608
+ if(!is_null($token))
609
+ $params['cardtoken'] = $token;
610
+
611
+ $params['authentication_indicator'] = 0;
612
+
613
+ switch ((int)$this->getConfigData('use_3d_secure')) {
614
+ case 1:
615
+ $params['authentication_indicator'] = 1;
616
+ break;
617
+ case 2:
618
+ /* @var $rule Allopass_Hipay_Model_Rule */
619
+ $rule = Mage::getModel('hipay/rule')->load($this->getConfigData('config_3ds_rules'));
620
+ if($rule->getId())
621
+ $params['authentication_indicator'] = (int)$rule->validate($payment->getOrder());
622
+ break;
623
+ }
624
+
625
+
626
+ /**
627
+ * Electronic Commerce Indicator
628
+ */
629
+ if($payment->getAdditionalInformation('use_oneclick'))
630
+ $params['eci'] = 9; //Recurring E-commerce
631
+
632
+ /**
633
+ * Redirect urls
634
+ */
635
+ $params['accept_url'] = Mage::getUrl($this->getConfigData('accept_url'));
636
+ $params['decline_url'] = Mage::getUrl($this->getConfigData('decline_url'));
637
+ $params['pending_url'] = Mage::getUrl($this->getConfigData('pending_url'));
638
+ $params['exception_url'] = Mage::getUrl($this->getConfigData('exception_url'));
639
+ $params['cancel_url'] = Mage::getUrl($this->getConfigData('cancel_url'));
640
+
641
+ $params = $this->getCustomerParams($payment,$params);
642
+ $params = $this->getShippingParams($payment,$params);
643
+
644
+
645
+ return $params;
646
+ }
647
+
648
+ /**
649
+ *
650
+ * @param Mage_Sales_Model_Order_Payment $payment
651
+ * @param array $params
652
+ * @return array $params
653
+ */
654
+ protected function getCustomerParams($payment,$params=array())
655
+ {
656
+ $order = $payment->getOrder();
657
+ $params['email'] = $order->getCustomerEmail();
658
+ $params['phone'] = $order->getBillingAddress()->getTelephone();
659
+ if(($dob = $order->getCustomerDob()) != "")
660
+ {
661
+ $dob = new Zend_Date($dob);
662
+ $params['birthdate'] = $dob->toString('YYYYMMdd');
663
+ }
664
+
665
+ $gender = $order->getCustomerGender();
666
+
667
+ $customer = Mage::getModel('customer/customer');
668
+ $customer->setData('gender',$gender);
669
+ $attribute = $customer->getResource()->getAttribute('gender');
670
+ if($attribute)
671
+ {
672
+ $gender = $attribute->getFrontend()->getValue($customer);
673
+ $gender = strtoupper(substr($gender, 0,1));
674
+ }
675
+
676
+ if($gender != "M" && $gender != "F")
677
+ $gender = "U";
678
+
679
+
680
+ $params['gender'] =$gender ;
681
+ $params['firstname'] = $order->getCustomerFirstname();
682
+ $params['lastname'] = $order->getCustomerLastname();
683
+ $params['recipientinfo'] = $order->getBillingAddress()->getCompany();
684
+ $params['streetaddress'] = $order->getBillingAddress()->getStreet1();
685
+ $params['streetaddress2'] = $order->getBillingAddress()->getStreet2();
686
+ $params['city'] = $order->getBillingAddress()->getCity();
687
+ //$params['state'] = $order->getBillingAddress(); //TODO checck if country is US or Canada
688
+ $params['zipcode'] = $order->getBillingAddress()->getPostcode();
689
+ $params['country'] = $order->getBillingAddress()->getCountry();
690
+
691
+ return $params;
692
+ }
693
+
694
+ /**
695
+ *
696
+ * @param Mage_Sales_Model_Order_Payment $payment
697
+ * @param array $params
698
+ * @return array $params
699
+ */
700
+ protected function getShippingParams($payment,$params =array())
701
+ {
702
+ if($payment->getOrder()->getIsVirtual())
703
+ return $params;
704
+
705
+ $shippingAddress = $payment->getOrder()->getShippingAddress();
706
+ $params['shipto_firstname'] = $shippingAddress->getFirstname();
707
+ $params['shipto_lastname'] = $shippingAddress->getLastname();
708
+ $params['shipto_recipientinfo'] = $shippingAddress->getCompany();
709
+ $params['shipto_streetaddress'] = $shippingAddress->getStreet1();
710
+ $params['shipto_streetaddress2'] = $shippingAddress->getStreet2();
711
+ $params['shipto_city'] = $shippingAddress->getCity();
712
+ //$params['shipto_state'] = $shippingAddress; //TODO check if country is US or Canada
713
+ $params['shipto_zipcode'] = $shippingAddress->getPostcode();
714
+ $params['shipto_country'] = $shippingAddress->getCountry();
715
+
716
+ return $params;
717
+ }
718
+
719
+ /**
720
+ * Return true if there are authorized transactions
721
+ *
722
+ * @param Mage_Sales_Model_Order_Payment $payment
723
+ * @return bool
724
+ */
725
+ static function isPreauthorizeCapture($payment)
726
+ {
727
+ $lastTransaction = $payment->getTransaction($payment->getLastTransId());
728
+ if (!$lastTransaction
729
+ || $lastTransaction->getTxnType() != Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH
730
+ ) {
731
+ return false;
732
+ }
733
+
734
+ return true;
735
+ }
736
+
737
+ /**
738
+ *
739
+ * @param Mage_Sales_Model_Order_Payment $payment
740
+ * @param float $amount
741
+ */
742
+ protected function _preauthorizeCapture($payment,$amount)
743
+ {
744
+ $transactionId = $payment->getLastTransId();
745
+
746
+ $gatewayParams = array('operation'=>'capture','amount'=>$amount);
747
+ $this->_debug($gatewayParams);
748
+ /* @var $request Allopass_Hipay_Model_Api_Request */
749
+ $request = Mage::getModel('hipay/api_request',array($this));
750
+ $uri = Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_MAINTENANCE . $transactionId;
751
+
752
+ $gatewayResponse = $request->gatewayRequest($uri,$gatewayParams);
753
+
754
+ $this->_debug($gatewayResponse->debug());
755
+
756
+ switch ($gatewayResponse->getStatus())
757
+ {
758
+ case "117": //Capture requested
759
+ case "118": //Capture
760
+ case "119": //Partially Capture
761
+ $this->addTransaction(
762
+ $payment,
763
+ $gatewayResponse->getTransactionReference(),
764
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE,
765
+ array('is_transaction_closed' => 0),
766
+ array(),
767
+ Mage::helper('hipay')->getTransactionMessage(
768
+ $payment, self::OPERATION_MAINTENANCE_CAPTURE, $gatewayResponse->getTransactionReference(), $amount
769
+ )
770
+ );
771
+
772
+ $payment->setIsTransactionPending(true);
773
+ break;
774
+ default:
775
+ Mage::throwException( $gatewayResponse->getStatus() . " ==> " .$gatewayResponse->getMessage());
776
+ break;
777
+ }
778
+
779
+ return $this;
780
+ }
781
+
782
+
783
+ /**
784
+ * Add payment transaction
785
+ *
786
+ * @param Mage_Sales_Model_Order_Payment $payment
787
+ * @param string $transactionId
788
+ * @param string $transactionType
789
+ * @param array $transactionDetails
790
+ * @param array $transactionAdditionalInfo
791
+ * @return null|Mage_Sales_Model_Order_Payment_Transaction
792
+ */
793
+ public function addTransaction(Mage_Sales_Model_Order_Payment $payment, $transactionId, $transactionType,
794
+ array $transactionDetails = array(), array $transactionAdditionalInfo = array(), $message = false
795
+ ) {
796
+ $payment->setTransactionId($transactionId);
797
+ if(method_exists($payment, "resetTransactionAdditionalInfo"))
798
+ $payment->resetTransactionAdditionalInfo();
799
+ foreach ($transactionDetails as $key => $value) {
800
+ $payment->setData($key, $value);
801
+ }
802
+ foreach ($transactionAdditionalInfo as $key => $value) {
803
+ $payment->setTransactionAdditionalInfo($key, $value);
804
+ }
805
+
806
+ if(!class_exists("Mage_Sales_Model_Order_Payment_Transaction"))
807
+ return null;
808
+
809
+ if(method_exists($payment, "addTransaction"))
810
+ $transaction = $payment->addTransaction($transactionType, null, false , $message);
811
+ else
812
+ $transaction = $this->_addTransaction($payment, $transactionType,null,false);
813
+
814
+ /**
815
+ * It for self using
816
+ */
817
+ $transaction->setMessage($message);
818
+
819
+ return $transaction;
820
+ }
821
+
822
+ /**
823
+ * Create transaction, prepare its insertion into hierarchy and add its information to payment and comments
824
+ *
825
+ * To add transactions and related information, the following information should be set to payment before processing:
826
+ * - transaction_id
827
+ * - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
828
+ * - parent_transaction_id (optional)
829
+ * - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
830
+ *
831
+ * If the sales document is specified, it will be linked to the transaction as related for future usage.
832
+ * Currently transaction ID is set into the sales object
833
+ * This method writes the added transaction ID into last_trans_id field of the payment object
834
+ *
835
+ * To make sure transaction object won't cause trouble before saving, use $failsafe = true
836
+ *
837
+ * @param Mage_Sales_Model_Order_Payment
838
+ * @param string $type
839
+ * @param Mage_Sales_Model_Abstract $salesDocument
840
+ * @param bool $failsafe
841
+ * @return null|Mage_Sales_Model_Order_Payment_Transaction
842
+ */
843
+ protected function _addTransaction($payment,$type, $salesDocument = null, $failsafe = false)
844
+ {
845
+ // look for set transaction ids
846
+ $transactionId = $payment->getTransactionId();
847
+ if (null !== $transactionId) {
848
+ // set transaction parameters
849
+ /*$transaction = Mage::getModel('sales/order_payment_transaction')
850
+ ->setOrderPaymentObject($payment)
851
+ ->setTxnType($type)
852
+ ->setTxnId($transactionId)
853
+ ->isFailsafe($failsafe)
854
+ ;*/
855
+
856
+ // set transaction parameters
857
+ //$transaction = false;
858
+ $transaction = $this->_lookupTransaction($payment,$transactionId);
859
+
860
+ if (!$transaction) {
861
+ $transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
862
+ }
863
+
864
+ $transaction
865
+ ->setOrderPaymentObject($payment)
866
+ ->setTxnType($type)
867
+ ->isFailsafe($failsafe);
868
+
869
+ if ($payment->hasIsTransactionClosed()) {
870
+ $transaction->setIsClosed((int)$payment->getIsTransactionClosed());
871
+ }
872
+
873
+ //set transaction addition information
874
+ /*if ($payment->_transactionAdditionalInfo) {
875
+ foreach ($payment->_transactionAdditionalInfo as $key => $value) {
876
+ $transaction->setAdditionalInformation($key, $value);
877
+ }
878
+ }*/
879
+
880
+ // link with sales entities
881
+ $payment->setLastTransId($transactionId);
882
+ $payment->setCreatedTransaction($transaction);
883
+ $payment->getOrder()->addRelatedObject($transaction);
884
+ if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
885
+ $salesDocument->setTransactionId($transactionId);
886
+ // TODO: linking transaction with the sales document
887
+ }
888
+
889
+ // link with parent transaction Not used because transaction Id is the same
890
+ $parentTransactionId = $payment->getParentTransactionId();
891
+
892
+ if ($parentTransactionId) {
893
+ $transaction->setParentTxnId($parentTransactionId);
894
+ if ($payment->getShouldCloseParentTransaction()) {
895
+ $parentTransaction = $this->_lookupTransaction($payment,$parentTransactionId);//
896
+ if ($parentTransaction) {
897
+ $parentTransaction->isFailsafe($failsafe)->close(false);
898
+ $payment->getOrder()->addRelatedObject($parentTransaction);
899
+ }
900
+ }
901
+ }
902
+ return $transaction;
903
+ }
904
+ }
905
+
906
+ /**
907
+ * Find one transaction by ID or type
908
+ * @param Mage_Sales_Model_Order_Payment
909
+ * @param string $txnId
910
+ * @param string $txnType
911
+ * @return Mage_Sales_Model_Order_Payment_Transaction|false
912
+ */
913
+ protected function _lookupTransaction($payment,$txnId, $txnType = false)
914
+ {
915
+ $_transactionsLookup = array();
916
+ if (!$txnId) {
917
+ if ($txnType && $payment->getId()) {
918
+ $collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
919
+ ->addPaymentIdFilter($payment->getId())
920
+ ->addTxnTypeFilter($txnType);
921
+ foreach ($collection as $txn) {
922
+ $txn->setOrderPaymentObject($payment);
923
+ $_transactionsLookup[$txn->getTxnId()] = $txn;
924
+ return $txn;
925
+ }
926
+ }
927
+ return false;
928
+ }
929
+ if (isset($_transactionsLookup[$txnId])) {
930
+ return $_transactionsLookup[$txnId];
931
+ }
932
+ $txn = Mage::getModel('sales/order_payment_transaction')
933
+ ->setOrderPaymentObject($payment)
934
+ ->loadByTxnId($txnId);
935
+ if ($txn->getId()) {
936
+ $_transactionsLookup[$txnId] = $txn;
937
+ } else {
938
+ $_transactionsLookup[$txnId] = false;
939
+ }
940
+ return $_transactionsLookup[$txnId];
941
+ }
942
+
943
+ /**
944
+ * Check method for processing with base currency
945
+ *
946
+ * @param string $currencyCode
947
+ * @return boolean
948
+ */
949
+ public function canUseForCurrency($currencyCode)
950
+ {
951
+ /* if (!in_array($currencyCode, $this->_allowCurrencyCode)) {
952
+ return false;
953
+ }*/
954
+ return true;
955
+ }
956
+
957
+
958
+ /**
959
+ *
960
+ * @return Mage_Checkout_Model_Session $checkout
961
+ */
962
+ protected function _getCheckout()
963
+ {
964
+ return Mage::getSingleton('checkout/session');
965
+ }
966
+
967
+ /**
968
+ * Log debug data to file
969
+ *
970
+ * @param mixed $debugData
971
+ */
972
+ protected function _debug($debugData)
973
+ {
974
+ if ($this->getDebugFlag()) {
975
+ Mage::getModel('hipay/log_adapter', 'payment_' . $this->getCode() . '.log')
976
+ ->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
977
+ ->log($debugData);
978
+ }
979
+ }
980
+
981
+ /**
982
+ * Define if debugging is enabled
983
+ *
984
+ * @return bool
985
+ */
986
+ public function getDebugFlag()
987
+ {
988
+ return $this->getConfigData('debug');
989
+ }
990
+
991
+ /**
992
+ * Used to call debug method from not Payment Method context
993
+ *
994
+ * @param mixed $debugData
995
+ */
996
+ public function debugData($debugData)
997
+ {
998
+ $this->_debug($debugData);
999
+ }
1000
+
1001
+
1002
+
1003
+ }
app/code/community/Allopass/Hipay/Model/Method/Cbc.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Cbc extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_cbc';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Cc.php ADDED
@@ -0,0 +1,517 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Cc extends Allopass_Hipay_Model_Method_Abstract
3
+ {
4
+
5
+ const STATUS_PENDING_CAPTURE = 'pending_capture';
6
+
7
+ protected $_code = 'hipay_cc';
8
+
9
+ protected $_formBlockType = 'hipay/form_cc';
10
+ protected $_infoBlockType = 'hipay/info_cc';
11
+
12
+
13
+ /**
14
+ * Assign data to info model instance
15
+ *
16
+ * @param mixed $data
17
+ * @return Mage_Payment_Model_Info
18
+ */
19
+ public function assignData($data)
20
+ {
21
+ if (!($data instanceof Varien_Object)) {
22
+ $data = new Varien_Object($data);
23
+ }
24
+ $info = $this->getInfoInstance();
25
+ $info->setCcType($data->getCcType())
26
+ ->setCcOwner($data->getCcOwner())
27
+ ->setCcLast4(substr($data->getCcNumber(), -4))
28
+ ->setCcNumber($data->getCcNumber())
29
+ ->setCcCid($data->getCcCid())
30
+ ->setCcExpMonth($data->getCcExpMonth())
31
+ ->setCcExpYear($data->getCcExpYear())
32
+ ->setCcSsIssue($data->getCcSsIssue())
33
+ ->setCcSsStartMonth($data->getCcSsStartMonth())
34
+ ->setCcSsStartYear($data->getCcSsStartYear())
35
+ ->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
36
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
37
+ ;
38
+
39
+ return $this;
40
+ }
41
+
42
+ /**
43
+ * Prepare info instance for save
44
+ *
45
+ * @return Mage_Payment_Model_Abstract
46
+ */
47
+ public function prepareSave()
48
+ {
49
+ $info = $this->getInfoInstance();
50
+ if ($this->_canSaveCc) {
51
+ $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
52
+ }
53
+ //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
54
+ $info->setCcNumber(null)
55
+ ->setCcCid(null);
56
+ return $this;
57
+ }
58
+
59
+
60
+ /**
61
+ * Retrieve payment iformation model object
62
+ *
63
+ * @return Mage_Payment_Model_Info
64
+ */
65
+ public function getInfoInstance()
66
+ {
67
+ $instance = $this->getData('info_instance');
68
+ if (!($instance instanceof Mage_Payment_Model_Info)) {
69
+ Mage::throwException(Mage::helper('payment')->__('Cannot retrieve the payment information object instance.'));
70
+ }
71
+ return $instance;
72
+ }
73
+
74
+
75
+ protected function getVaultParams($payment)
76
+ {
77
+ $params = array();
78
+ $params['card_number'] = $payment->getCcNumber();
79
+ $params['card_expiry_month'] = ($payment->getCcExpMonth() < 10) ? '0'.$payment->getCcExpMonth() : $payment->getCcExpMonth();
80
+ $params['card_expiry_year'] = $payment->getCcExpYear();
81
+ $params['cvc'] = $payment->getCcCid();
82
+ $params['multi_use'] = 1;
83
+
84
+ $this->_debug($params);
85
+
86
+ return $params;
87
+ }
88
+
89
+
90
+ public function getOrderPlaceRedirectUrl()
91
+ {
92
+
93
+ return Mage::getUrl('hipay/cc/sendRequest',array('_secure' => true));
94
+
95
+ }
96
+
97
+
98
+ public function initialize($paymentAction, $stateObject)
99
+ {
100
+ /* @var $payment Mage_Sales_Model_Order_Payment */
101
+ $payment = $this->getInfoInstance();
102
+ $order = $payment->getOrder();
103
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
104
+
105
+
106
+ if($payment->getAdditionalInformation('use_oneclick') && $customer->getId())
107
+ {
108
+ $token = $customer->getHipayAliasOneclick();
109
+ }
110
+ else
111
+ {
112
+ $request = Mage::getModel('hipay/api_request',array($this));
113
+ /* @var $request Allopass_Hipay_Model_Api_Request */
114
+ $vaultResponse = $request->vaultRequest(Allopass_Hipay_Model_Api_Request::VAULT_ACTION_CREATE, $this->getVaultParams($payment));
115
+ $this->_debug($vaultResponse->debug());
116
+ $token = $vaultResponse->getToken();
117
+ }
118
+ $payment->setAdditionalInformation('token',$token);
119
+
120
+ return $this;
121
+
122
+ }
123
+
124
+
125
+ /**
126
+ * (non-PHPdoc)
127
+ * @see Mage_Payment_Model_Method_Abstract::capture()
128
+ */
129
+ public function capture(Varien_Object $payment, $amount)
130
+ {
131
+ parent::capture($payment, $amount);
132
+
133
+ if (self::isPreauthorizeCapture($payment))
134
+ $this->_preauthorizeCapture($payment, $amount);
135
+
136
+ $payment->setSkipTransactionCreation(true);
137
+ return $this;
138
+ }
139
+
140
+
141
+
142
+
143
+ public function place($payment, $amount)
144
+ {
145
+
146
+ $order = $payment->getOrder();
147
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
148
+
149
+ $request = Mage::getModel('hipay/api_request',array($this));
150
+
151
+
152
+ $payment->setAmount($amount);
153
+
154
+ $token = $payment->getAdditionalInformation('token');
155
+ $gatewayParams = $this->getGatewayParams($payment, $amount,$token);
156
+
157
+ $gatewayParams['operation'] =$this->getOperation();
158
+
159
+ $paymentProduct = null;
160
+ if($payment->getAdditionalInformation('use_oneclick'))
161
+ $paymentProduct = Mage::getSingleton('customer/session')->getCustomer()->getHipayCcType();
162
+ else
163
+ $paymentProduct = $this->getCcTypeHipay($payment->getCcType());
164
+
165
+ $gatewayParams['payment_product'] = $paymentProduct ;
166
+ $this->_debug($gatewayParams);
167
+
168
+
169
+ $gatewayResponse = $request->gatewayRequest(Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_ORDER,$gatewayParams);
170
+
171
+ $this->_debug($gatewayResponse->debug());
172
+
173
+ $redirectUrl = $this->processResponseToRedirect($gatewayResponse, $payment, $amount);
174
+
175
+ return $redirectUrl;
176
+
177
+ }
178
+
179
+ protected function getCcTypeHipay($ccTypeMagento)
180
+ {
181
+ $ccTypes = Mage::getSingleton('hipay/config')->getCcTypesHipay();
182
+
183
+ if(isset($ccTypes[$ccTypeMagento]))
184
+ return $ccTypes[$ccTypeMagento];
185
+
186
+ Mage::throwException(Mage::helper('hipay')->__("Code Credit Card Type Hipay not found!"));
187
+ }
188
+
189
+
190
+
191
+ /**
192
+ * Validate payment method information object
193
+ *
194
+ * @param Mage_Payment_Model_Info $info
195
+ * @return Mage_Payment_Model_Abstract
196
+ */
197
+ public function validate()
198
+ {
199
+ /*
200
+ * calling parent validate function
201
+ */
202
+ parent::validate();
203
+
204
+ $info = $this->getInfoInstance();
205
+
206
+ if($info->getAdditionalInformation('use_oneclick'))
207
+ {
208
+ return $this;
209
+ }
210
+
211
+ $errorMsg = false;
212
+ $availableTypes = explode(',',$this->getConfigData('cctypes'));
213
+
214
+ $ccNumber = $info->getCcNumber();
215
+
216
+ // remove credit card number delimiters such as "-" and space
217
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
218
+ $info->setCcNumber($ccNumber);
219
+
220
+ $ccType = '';
221
+
222
+ if (in_array($info->getCcType(), $availableTypes)){
223
+ if ($this->validateCcNum($ccNumber)
224
+ // Other credit card type number validation
225
+ || ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) {
226
+
227
+ $ccType = 'OT';
228
+ $ccTypeRegExpList = array(
229
+ //Solo, Switch or Maestro. International safe
230
+ /*
231
+ // Maestro / Solo
232
+ 'SS' => '/^((6759[0-9]{12})|(6334|6767[0-9]{12})|(6334|6767[0-9]{14,15})'
233
+ . '|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})'
234
+ . '|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/',
235
+ */
236
+ // Solo only
237
+ 'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
238
+ //Bancontact / mister cash
239
+ 'BCMC' => '/^[0-9]{17}$/',
240
+ 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)'
241
+ . '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)'
242
+ . '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))'
243
+ . '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))'
244
+ . '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
245
+ // Visa
246
+ 'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
247
+ // Master Card
248
+ 'MC' => '/^5[1-5][0-9]{14}$/',
249
+ // American Express
250
+ 'AE' => '/^3[47][0-9]{13}$/',
251
+ // Discovery
252
+ 'DI' => '/^6011[0-9]{12}$/',
253
+ // JCB
254
+ 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/',
255
+ );
256
+
257
+ foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) {
258
+ if (preg_match($ccTypeRegExp, $ccNumber)) {
259
+ $ccType = $ccTypeMatch;
260
+ break;
261
+ }
262
+ }
263
+ if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) {
264
+ $errorMsg = Mage::helper('payment')->__('Credit card number mismatch with credit card type.');
265
+ }
266
+ }
267
+ else {
268
+ $errorMsg = Mage::helper('payment')->__('Invalid Credit Card Number');
269
+ }
270
+
271
+ }
272
+ else {
273
+ $errorMsg = Mage::helper('payment')->__('Credit card type is not allowed for this payment method.');
274
+ }
275
+
276
+ //validate credit card verification number
277
+ if ($errorMsg === false && $this->hasVerification() && $info->getCcType() != 'BCMC') {
278
+ $verifcationRegEx = $this->getVerificationRegEx();
279
+ $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
280
+ if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){
281
+ $errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
282
+ }
283
+ }
284
+
285
+ if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
286
+ $errorMsg = Mage::helper('payment')->__('Incorrect credit card expiration date.');
287
+ }
288
+
289
+ if($errorMsg){
290
+ Mage::throwException($errorMsg);
291
+ }
292
+
293
+ //This must be after all validation conditions
294
+ if ($this->getIsCentinelValidationEnabled()) {
295
+ $this->getCentinelValidator()->validate($this->getCentinelValidationData());
296
+ }
297
+
298
+ return $this;
299
+ }
300
+
301
+ public function hasVerification()
302
+ {
303
+ $configData = $this->getConfigData('useccv');
304
+ if(is_null($configData)){
305
+ return true;
306
+ }
307
+ return (bool) $configData;
308
+ }
309
+
310
+ public function getVerificationRegEx()
311
+ {
312
+ $verificationExpList = array(
313
+ 'VI' => '/^[0-9]{3}$/', // Visa
314
+ 'MC' => '/^[0-9]{3}$/', // Master Card
315
+ 'AE' => '/^[0-9]{4}$/', // American Express
316
+ 'DI' => '/^[0-9]{3}$/', // Discovery
317
+ 'SS' => '/^[0-9]{3,4}$/',
318
+ 'SM' => '/^[0-9]{3,4}$/', // Switch or Maestro
319
+ 'SO' => '/^[0-9]{3,4}$/', // Solo
320
+ 'OT' => '/^[0-9]{3,4}$/',
321
+ 'JCB' => '/^[0-9]{3,4}$/' //JCB
322
+ );
323
+ return $verificationExpList;
324
+ }
325
+
326
+ protected function _validateExpDate($expYear, $expMonth)
327
+ {
328
+ $date = Mage::app()->getLocale()->date();
329
+ if (!$expYear || !$expMonth || ($date->compareYear($expYear) == 1)
330
+ || ($date->compareYear($expYear) == 0 && ($date->compareMonth($expMonth) == 1))
331
+ ) {
332
+ return false;
333
+ }
334
+ return true;
335
+ }
336
+
337
+ public function OtherCcType($type)
338
+ {
339
+ return $type=='OT';
340
+ }
341
+
342
+ /**
343
+ * Validate credit card number
344
+ *
345
+ * @param string $cc_number
346
+ * @return bool
347
+ */
348
+ public function validateCcNum($ccNumber)
349
+ {
350
+ $cardNumber = strrev($ccNumber);
351
+ $numSum = 0;
352
+
353
+ for ($i=0; $i<strlen($cardNumber); $i++) {
354
+ $currentNum = substr($cardNumber, $i, 1);
355
+
356
+ /**
357
+ * Double every second digit
358
+ */
359
+ if ($i % 2 == 1) {
360
+ $currentNum *= 2;
361
+ }
362
+
363
+ /**
364
+ * Add digits of 2-digit numbers together
365
+ */
366
+ if ($currentNum > 9) {
367
+ $firstNum = $currentNum % 10;
368
+ $secondNum = ($currentNum - $firstNum) / 10;
369
+ $currentNum = $firstNum + $secondNum;
370
+ }
371
+
372
+ $numSum += $currentNum;
373
+ }
374
+
375
+ /**
376
+ * If the total has no remainder it's OK
377
+ */
378
+ return ($numSum % 10 == 0);
379
+ }
380
+
381
+ /**
382
+ * Other credit cart type number validation
383
+ *
384
+ * @param string $ccNumber
385
+ * @return boolean
386
+ */
387
+ public function validateCcNumOther($ccNumber)
388
+ {
389
+ return preg_match('/^\\d+$/', $ccNumber);
390
+ }
391
+
392
+ /**
393
+ * Check whether there are CC types set in configuration
394
+ *
395
+ * @param Mage_Sales_Model_Quote|null $quote
396
+ * @return bool
397
+ */
398
+ public function isAvailable($quote = null)
399
+ {
400
+ return $this->getConfigData('cctypes', ($quote ? $quote->getStoreId() : null))
401
+ && parent::isAvailable($quote);
402
+ }
403
+
404
+ /**
405
+ * Whether centinel service is enabled
406
+ *
407
+ * @return bool
408
+ */
409
+ public function getIsCentinelValidationEnabled()
410
+ {
411
+ return false !== Mage::getConfig()->getNode('modules/Mage_Centinel') && 1 == $this->getConfigData('centinel');
412
+ }
413
+
414
+ /**
415
+ * Instantiate centinel validator model
416
+ *
417
+ * @return Mage_Centinel_Model_Service
418
+ */
419
+ public function getCentinelValidator()
420
+ {
421
+ $validator = Mage::getSingleton('centinel/service');
422
+ $validator
423
+ ->setIsModeStrict($this->getConfigData('centinel_is_mode_strict'))
424
+ ->setCustomApiEndpointUrl($this->getConfigData('centinel_api_url'))
425
+ ->setStore($this->getStore())
426
+ ->setIsPlaceOrder($this->_isPlaceOrder());
427
+ return $validator;
428
+ }
429
+
430
+ /**
431
+ * Return data for Centinel validation
432
+ *
433
+ * @return Varien_Object
434
+ */
435
+ public function getCentinelValidationData()
436
+ {
437
+ $info = $this->getInfoInstance();
438
+ $params = new Varien_Object();
439
+ $params
440
+ ->setPaymentMethodCode($this->getCode())
441
+ ->setCardType($info->getCcType())
442
+ ->setCardNumber($info->getCcNumber())
443
+ ->setCardExpMonth($info->getCcExpMonth())
444
+ ->setCardExpYear($info->getCcExpYear())
445
+ ->setAmount($this->_getAmount())
446
+ ->setCurrencyCode($this->_getCurrencyCode())
447
+ ->setOrderNumber($this->_getOrderId());
448
+ return $params;
449
+ }
450
+
451
+ /**
452
+ * Order increment ID getter (either real from order or a reserved from quote)
453
+ *
454
+ * @return string
455
+ */
456
+ private function _getOrderId()
457
+ {
458
+ $info = $this->getInfoInstance();
459
+
460
+ if ($this->_isPlaceOrder()) {
461
+ return $info->getOrder()->getIncrementId();
462
+ } else {
463
+ if (!$info->getQuote()->getReservedOrderId()) {
464
+ $info->getQuote()->reserveOrderId();
465
+ }
466
+ return $info->getQuote()->getReservedOrderId();
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Grand total getter
472
+ *
473
+ * @return string
474
+ */
475
+ private function _getAmount()
476
+ {
477
+ $info = $this->getInfoInstance();
478
+ if ($this->_isPlaceOrder()) {
479
+ return (double)$info->getOrder()->getQuoteBaseGrandTotal();
480
+ } else {
481
+ return (double)$info->getQuote()->getBaseGrandTotal();
482
+ }
483
+ }
484
+
485
+ /**
486
+ * Currency code getter
487
+ *
488
+ * @return string
489
+ */
490
+ private function _getCurrencyCode()
491
+ {
492
+ $info = $this->getInfoInstance();
493
+
494
+ if ($this->_isPlaceOrder()) {
495
+ return $info->getOrder()->getBaseCurrencyCode();
496
+ } else {
497
+ return $info->getQuote()->getBaseCurrencyCode();
498
+ }
499
+ }
500
+
501
+ /**
502
+ * Whether current operation is order placement
503
+ *
504
+ * @return bool
505
+ */
506
+ private function _isPlaceOrder()
507
+ {
508
+ $info = $this->getInfoInstance();
509
+ if ($info instanceof Mage_Sales_Model_Quote_Payment) {
510
+ return false;
511
+ } elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
512
+ return true;
513
+ }
514
+ }
515
+
516
+
517
+ }
app/code/community/Allopass/Hipay/Model/Method/Dexia.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Dexia extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_dexia';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Giropay.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Giropay extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_giropay';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Hosted.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Hosted extends Allopass_Hipay_Model_Method_Abstract
3
+ {
4
+
5
+ protected $_code = 'hipay_hosted';
6
+
7
+ protected $_formBlockType = 'hipay/form_hosted';
8
+ protected $_infoBlockType = 'hipay/info_hosted';
9
+
10
+
11
+ public function getOrderPlaceRedirectUrl()
12
+ {
13
+
14
+ return Mage::getUrl(str_replace("_", "/", $this->getCode()).'/sendRequest',array('_secure' => true));
15
+ }
16
+
17
+ /**
18
+ * Assign data to info model instance
19
+ *
20
+ * @param mixed $data
21
+ * @return Mage_Payment_Model_Info
22
+ */
23
+ public function assignData($data)
24
+ {
25
+ if (!($data instanceof Varien_Object)) {
26
+ $data = new Varien_Object($data);
27
+ }
28
+ $info = $this->getInfoInstance();
29
+ $info->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
30
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
31
+ ;
32
+
33
+ return $this;
34
+ }
35
+
36
+
37
+
38
+ /**
39
+ * (non-PHPdoc)
40
+ * @see Mage_Payment_Model_Method_Abstract::capture()
41
+ */
42
+ public function capture(Varien_Object $payment, $amount)
43
+ {
44
+ parent::capture($payment, $amount);
45
+
46
+ if (self::isPreauthorizeCapture($payment))
47
+ $this->_preauthorizeCapture($payment, $amount);
48
+
49
+ $payment->setSkipTransactionCreation(true);
50
+ return $this;
51
+ }
52
+
53
+
54
+ public function place($payment, $amount)
55
+ {
56
+ $order = $payment->getOrder();
57
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
58
+
59
+ $request = Mage::getModel('hipay/api_request',array($this));
60
+
61
+ $payment->setAmount($amount);
62
+
63
+ $token = null;
64
+ if($payment->getAdditionalInformation('use_oneclick'))
65
+ {
66
+ $token = Mage::getSingleton('customer/session')->getCustomer()->getHipayAliasOneclick();
67
+ }
68
+
69
+ $gatewayParams = $this->getGatewayParams($payment, $amount,$token);
70
+
71
+ if(is_null($token))
72
+ {
73
+
74
+ $gatewayParams['payment_product'] = 'cb' ;
75
+ $gatewayParams['operation'] = $this->getOperation();
76
+ $gatewayParams['css'] = $this->getConfigData('css_url');
77
+ $gatewayParams['template'] = $this->getConfigData('display_iframe') ? 'iframe' : $this->getConfigData('template');
78
+ if ($this->getConfigData('template') == 'basic-js' && $gatewayParams['template'] == 'iframe') $gatewayParams['template'] .= '-js';
79
+ $gatewayParams['display_selector'] = $this->getConfigData('display_selector');
80
+ //$gatewayParams['payment_product_list'] = $this->getConfigData('cctypes');
81
+
82
+ if ($gatewayParams['country'] == 'BE')
83
+ $gatewayParams['payment_product_list'] = $this->getConfigData('cctypes');
84
+ else
85
+ $gatewayParams['payment_product_list'] = str_replace('bcmc', '', $this->getConfigData('cctypes'));
86
+
87
+
88
+ $gatewayParams['payment_product_category_list'] = "credit-card";
89
+
90
+ if(Mage::getStoreConfig('general/store_information/name') != "")
91
+ $gatewayParams['merchant_display_name'] = Mage::getStoreConfig('general/store_information/name');
92
+
93
+ $this->_debug($gatewayParams);
94
+
95
+ $gatewayResponse = $request->gatewayRequest(Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_HOSTED,$gatewayParams);
96
+
97
+ $this->_debug($gatewayResponse->debug());
98
+
99
+ return $gatewayResponse->getForwardUrl();
100
+ }
101
+ else
102
+ {
103
+ $gatewayParams['operation'] = $this->getOperation();
104
+ $gatewayParams['payment_product'] = Mage::getSingleton('customer/session')->getCustomer()->getHipayCcType();
105
+
106
+ $this->_debug($gatewayParams);
107
+
108
+ $gatewayResponse = $request->gatewayRequest(Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_ORDER,$gatewayParams);
109
+
110
+ $this->_debug($gatewayResponse->debug());
111
+
112
+ $redirectUrl = $this->processResponseToRedirect($gatewayResponse, $payment, $amount);
113
+
114
+ return $redirectUrl;
115
+ }
116
+
117
+ }
118
+ }
app/code/community/Allopass/Hipay/Model/Method/Ideal.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Ideal extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_ideal';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Ing.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Ing extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_ing';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Kbc.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Kbc extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_kbc';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Przelewy24.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Przelewy24 extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_przelewy24';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Przelewy24Api.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Przelewy24Api extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_code = 'hipay_przelewy24api';
5
+
6
+ protected $_formBlockType = 'hipay/form_hosted';
7
+ protected $_infoBlockType = 'hipay/info_hosted';
8
+
9
+
10
+ public function getOrderPlaceRedirectUrl()
11
+ {
12
+ return Mage::getUrl(str_replace("_", "/", $this->getCode()).'/sendRequest',array('_secure' => true));
13
+ }
14
+
15
+
16
+ /**
17
+ * Assign data to info model instance
18
+ *
19
+ * @param mixed $data
20
+ * @return Mage_Payment_Model_Info
21
+ */
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $info->setCcType($this->getConfigData('cctypes'))
29
+ ->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
30
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
31
+ ;
32
+
33
+ return $this;
34
+ }
35
+
36
+ public function initialize($paymentAction, $stateObject)
37
+ {
38
+ /* @var $payment Mage_Sales_Model_Order_Payment */
39
+ $payment = $this->getInfoInstance();
40
+ $order = $payment->getOrder();
41
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
42
+
43
+
44
+ if($payment->getAdditionalInformation('use_oneclick') && $customer->getId())
45
+ {
46
+ $token = $customer->getHipayAliasOneclick();
47
+ $payment->setAdditionalInformation('token',$token);
48
+ }
49
+
50
+ return $this;
51
+
52
+ }
53
+
54
+
55
+ protected function getCcTypeHipay($ccTypeMagento)
56
+ {
57
+ return $ccTypeMagento;
58
+ }
59
+
60
+ /**
61
+ * Validate payment method information object
62
+ *
63
+ * @param Mage_Payment_Model_Info $info
64
+ * @return Mage_Payment_Model_Abstract
65
+ */
66
+ public function validate()
67
+ {
68
+ /**
69
+ * to validate payment method is allowed for billing country or not
70
+ */
71
+ $paymentInfo = $this->getInfoInstance();
72
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
73
+ $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
74
+ } else {
75
+ $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
76
+ }
77
+ if (!$this->canUseForCountry($billingCountry)) {
78
+ Mage::throwException(Mage::helper('payment')->__('Selected payment type is not allowed for billing country.'));
79
+ }
80
+ return $this;
81
+ }
82
+
83
+ }
app/code/community/Allopass/Hipay/Model/Method/Qiwi.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Qiwi extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_qiwi';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/Sisal.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Sisal extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_sisal';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/SisalApi.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_SisalApi extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_code = 'hipay_sisalapi';
5
+
6
+ protected $_formBlockType = 'hipay/form_hosted';
7
+ protected $_infoBlockType = 'hipay/info_hosted';
8
+
9
+
10
+ public function getOrderPlaceRedirectUrl()
11
+ {
12
+ return Mage::getUrl(str_replace("_", "/", $this->getCode()).'/sendRequest',array('_secure' => true));
13
+ }
14
+
15
+
16
+ /**
17
+ * Assign data to info model instance
18
+ *
19
+ * @param mixed $data
20
+ * @return Mage_Payment_Model_Info
21
+ */
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $info->setCcType($this->getConfigData('cctypes'))
29
+ ->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
30
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
31
+ ;
32
+
33
+ return $this;
34
+ }
35
+
36
+ public function initialize($paymentAction, $stateObject)
37
+ {
38
+ /* @var $payment Mage_Sales_Model_Order_Payment */
39
+ $payment = $this->getInfoInstance();
40
+ $order = $payment->getOrder();
41
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
42
+
43
+
44
+ if($payment->getAdditionalInformation('use_oneclick') && $customer->getId())
45
+ {
46
+ $token = $customer->getHipayAliasOneclick();
47
+ $payment->setAdditionalInformation('token',$token);
48
+ }
49
+
50
+ return $this;
51
+
52
+ }
53
+
54
+
55
+ protected function getCcTypeHipay($ccTypeMagento)
56
+ {
57
+ return $ccTypeMagento;
58
+ }
59
+
60
+ /**
61
+ * Validate payment method information object
62
+ *
63
+ * @param Mage_Payment_Model_Info $info
64
+ * @return Mage_Payment_Model_Abstract
65
+ */
66
+ public function validate()
67
+ {
68
+ /**
69
+ * to validate payment method is allowed for billing country or not
70
+ */
71
+ $paymentInfo = $this->getInfoInstance();
72
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
73
+ $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
74
+ } else {
75
+ $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
76
+ }
77
+ if (!$this->canUseForCountry($billingCountry)) {
78
+ Mage::throwException(Mage::helper('payment')->__('Selected payment type is not allowed for billing country.'));
79
+ }
80
+ return $this;
81
+ }
82
+
83
+ }
app/code/community/Allopass/Hipay/Model/Method/Sofort.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Sofort extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_sofort';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/SofortApi.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_SofortApi extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_code = 'hipay_sofortapi';
5
+
6
+ protected $_formBlockType = 'hipay/form_hosted';
7
+ protected $_infoBlockType = 'hipay/info_hosted';
8
+
9
+
10
+ public function getOrderPlaceRedirectUrl()
11
+ {
12
+ return Mage::getUrl(str_replace("_", "/", $this->getCode()).'/sendRequest',array('_secure' => true));
13
+ }
14
+
15
+
16
+ /**
17
+ * Assign data to info model instance
18
+ *
19
+ * @param mixed $data
20
+ * @return Mage_Payment_Model_Info
21
+ */
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $info->setCcType($this->getConfigData('cctypes'))
29
+ ->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
30
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
31
+ ;
32
+
33
+ return $this;
34
+ }
35
+
36
+ public function initialize($paymentAction, $stateObject)
37
+ {
38
+ /* @var $payment Mage_Sales_Model_Order_Payment */
39
+ $payment = $this->getInfoInstance();
40
+ $order = $payment->getOrder();
41
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
42
+
43
+
44
+ if($payment->getAdditionalInformation('use_oneclick') && $customer->getId())
45
+ {
46
+ $token = $customer->getHipayAliasOneclick();
47
+ $payment->setAdditionalInformation('token',$token);
48
+ }
49
+
50
+ return $this;
51
+
52
+ }
53
+
54
+
55
+ protected function getCcTypeHipay($ccTypeMagento)
56
+ {
57
+ return $ccTypeMagento;
58
+ }
59
+
60
+ /**
61
+ * Validate payment method information object
62
+ *
63
+ * @param Mage_Payment_Model_Info $info
64
+ * @return Mage_Payment_Model_Abstract
65
+ */
66
+ public function validate()
67
+ {
68
+ /**
69
+ * to validate payment method is allowed for billing country or not
70
+ */
71
+ $paymentInfo = $this->getInfoInstance();
72
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
73
+ $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
74
+ } else {
75
+ $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
76
+ }
77
+ if (!$this->canUseForCountry($billingCountry)) {
78
+ Mage::throwException(Mage::helper('payment')->__('Selected payment type is not allowed for billing country.'));
79
+ }
80
+ return $this;
81
+ }
82
+
83
+ }
app/code/community/Allopass/Hipay/Model/Method/Webmoney.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Webmoney extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_webmoney';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/WebmoneyApi.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_WebmoneyApi extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_code = 'hipay_webmoneyapi';
5
+
6
+ protected $_formBlockType = 'hipay/form_hosted';
7
+ protected $_infoBlockType = 'hipay/info_hosted';
8
+
9
+
10
+ public function getOrderPlaceRedirectUrl()
11
+ {
12
+ return Mage::getUrl(str_replace("_", "/", $this->getCode()).'/sendRequest',array('_secure' => true));
13
+ }
14
+
15
+
16
+ /**
17
+ * Assign data to info model instance
18
+ *
19
+ * @param mixed $data
20
+ * @return Mage_Payment_Model_Info
21
+ */
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $info->setCcType($this->getConfigData('cctypes'))
29
+ ->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
30
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
31
+ ;
32
+
33
+ return $this;
34
+ }
35
+
36
+ public function initialize($paymentAction, $stateObject)
37
+ {
38
+ /* @var $payment Mage_Sales_Model_Order_Payment */
39
+ $payment = $this->getInfoInstance();
40
+ $order = $payment->getOrder();
41
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
42
+
43
+
44
+ if($payment->getAdditionalInformation('use_oneclick') && $customer->getId())
45
+ {
46
+ $token = $customer->getHipayAliasOneclick();
47
+ $payment->setAdditionalInformation('token',$token);
48
+ }
49
+
50
+ return $this;
51
+
52
+ }
53
+
54
+
55
+ protected function getCcTypeHipay($ccTypeMagento)
56
+ {
57
+ return $ccTypeMagento;
58
+ }
59
+
60
+ /**
61
+ * Validate payment method information object
62
+ *
63
+ * @param Mage_Payment_Model_Info $info
64
+ * @return Mage_Payment_Model_Abstract
65
+ */
66
+ public function validate()
67
+ {
68
+ /**
69
+ * to validate payment method is allowed for billing country or not
70
+ */
71
+ $paymentInfo = $this->getInfoInstance();
72
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
73
+ $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
74
+ } else {
75
+ $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
76
+ }
77
+ if (!$this->canUseForCountry($billingCountry)) {
78
+ Mage::throwException(Mage::helper('payment')->__('Selected payment type is not allowed for billing country.'));
79
+ }
80
+ return $this;
81
+ }
82
+
83
+ }
app/code/community/Allopass/Hipay/Model/Method/Yandex.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Yandex extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_code = 'hipay_yandex';
5
+ }
app/code/community/Allopass/Hipay/Model/Method/YandexApi.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_YandexApi extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_code = 'hipay_yandexapi';
5
+
6
+ protected $_formBlockType = 'hipay/form_hosted';
7
+ protected $_infoBlockType = 'hipay/info_hosted';
8
+
9
+
10
+ public function getOrderPlaceRedirectUrl()
11
+ {
12
+ return Mage::getUrl(str_replace("_", "/", $this->getCode()).'/sendRequest',array('_secure' => true));
13
+ }
14
+
15
+
16
+ /**
17
+ * Assign data to info model instance
18
+ *
19
+ * @param mixed $data
20
+ * @return Mage_Payment_Model_Info
21
+ */
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $info->setCcType($this->getConfigData('cctypes'))
29
+ ->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
30
+ ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
31
+ ;
32
+
33
+ return $this;
34
+ }
35
+
36
+ public function initialize($paymentAction, $stateObject)
37
+ {
38
+ /* @var $payment Mage_Sales_Model_Order_Payment */
39
+ $payment = $this->getInfoInstance();
40
+ $order = $payment->getOrder();
41
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
42
+
43
+
44
+ if($payment->getAdditionalInformation('use_oneclick') && $customer->getId())
45
+ {
46
+ $token = $customer->getHipayAliasOneclick();
47
+ $payment->setAdditionalInformation('token',$token);
48
+ }
49
+
50
+ return $this;
51
+
52
+ }
53
+
54
+
55
+ protected function getCcTypeHipay($ccTypeMagento)
56
+ {
57
+ return $ccTypeMagento;
58
+ }
59
+
60
+ /**
61
+ * Validate payment method information object
62
+ *
63
+ * @param Mage_Payment_Model_Info $info
64
+ * @return Mage_Payment_Model_Abstract
65
+ */
66
+ public function validate()
67
+ {
68
+ /**
69
+ * to validate payment method is allowed for billing country or not
70
+ */
71
+ $paymentInfo = $this->getInfoInstance();
72
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
73
+ $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
74
+ } else {
75
+ $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
76
+ }
77
+ if (!$this->canUseForCountry($billingCountry)) {
78
+ Mage::throwException(Mage::helper('payment')->__('Selected payment type is not allowed for billing country.'));
79
+ }
80
+ return $this;
81
+ }
82
+
83
+ }
app/code/community/Allopass/Hipay/Model/Observer.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Observer
3
+ {
4
+ /**
5
+ * Cancel orders stayed in pending because customer not validated payment form
6
+ */
7
+ public function cancelOrdersInPending()
8
+ {
9
+
10
+ $methodCodes = array('hipay_cc'=>'hipay/method_cc','hipay_hosted'=>'hipay/method_hosted');
11
+ foreach ($methodCodes as $methodCode=>$model)
12
+ {
13
+ if(!Mage::getStoreConfig('payment/'.$methodCode."/cancel_pending_order"))
14
+ continue;
15
+
16
+ $limitedTime = 30;
17
+
18
+ $date = new Zend_Date();//Mage::app()->getLocale()->date();
19
+
20
+ /* @var $collection Mage_Sales_Model_Resource_Order_Collection */
21
+ $collection = Mage::getResourceModel('sales/order_collection');
22
+ $collection->addFieldToSelect(array('entity_id','state'))
23
+
24
+ ->addAttributeToFilter('created_at', array('to' => ($date->subMinute($limitedTime)->toString('Y-MM-dd HH:mm:ss'))))
25
+ ;
26
+
27
+
28
+ /* @var $order Mage_Sales_Model_Order */
29
+ foreach ($collection as $order)
30
+ {
31
+
32
+ if($order->getPayment()->getMethod() == $methodCode)
33
+ {
34
+ if($order->canCancel() && $order->getState() == Mage_Sales_Model_Order::STATE_NEW)
35
+ {
36
+ try {
37
+ $order->cancel();
38
+ $order
39
+ ->addStatusToHistory($order->getStatus(),
40
+ // keep order status/state
41
+ Mage::helper('hipay')->__("Order canceled automatically by cron because order is pending since %d minutes",$limitedTime));
42
+
43
+ $order->save();
44
+ } catch (Exception $e) {
45
+ Mage::logException($e);
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ return $this;
52
+ }
53
+
54
+ public function manageOrdersInPendingCapture()
55
+ {
56
+ $methods = array('hipay_cc','hipay_hosted');
57
+ /* @var $collection Mage_Sales_Model_Resource_Order_Collection */
58
+ $collection = Mage::getResourceModel('sales/order_collection');
59
+ $collection->addFieldToFilter('status','pending_capture');
60
+
61
+ /* @var $order Mage_Sales_Model_Order */
62
+ foreach ($collection as $order)
63
+ {
64
+ if(!in_array($order->getPayment()->getMethod(), $methods))
65
+ continue;
66
+
67
+ $orderDate = "";
68
+ }
69
+
70
+ }
71
+
72
+ public function displaySectionCheckoutIframe($observer)
73
+ {
74
+ $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
75
+ if($payment->getAdditionalInformation('use_oneclick'))
76
+ return $this;
77
+ /* @var $controller Mage_Checkout_OnepageController */
78
+ $controller = $observer->getControllerAction();
79
+
80
+ $result = Mage::helper('core')->jsonDecode($controller->getResponse()->getBody());
81
+
82
+ //TODO check if payment method is hosted and iframe active and is success
83
+ $methodInstance = $payment->getMethodInstance();
84
+ if($result['success']
85
+ && $methodInstance->getCode() == 'hipay_hosted'
86
+ && $methodInstance->getConfigData('display_iframe'))
87
+ {
88
+ $result['iframeUrl'] = $result['redirect'];
89
+ }
90
+
91
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
92
+
93
+ return $this;
94
+
95
+ }
96
+ }
app/code/community/Allopass/Hipay/Model/Resource/Rule.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ /**
6
+ * Hipay Rule resource model
7
+ */
8
+ class Allopass_Hipay_Model_Resource_Rule extends Mage_Rule_Model_Mysql4_Rule
9
+ {
10
+
11
+ /**
12
+ * Initialize main table and table id field
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('hipay/rule', 'rule_id');
17
+ }
18
+
19
+ }
app/code/community/Allopass/Hipay/Model/Resource/Rule/Collection.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Hipay resource collection model
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Resource_Rule_Collection extends Mage_Rule_Model_Mysql4_Rule_Collection
9
+ {
10
+
11
+ /**
12
+ * Set resource model and determine field mapping
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('hipay/rule');
17
+ $this->_map['fields']['rule_id'] = 'main_table.rule_id';
18
+ }
19
+
20
+ }
app/code/community/Allopass/Hipay/Model/Rule.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Rule extends Mage_Rule_Model_Rule
3
+ {
4
+
5
+ /**
6
+ * Init resource model and id field
7
+ */
8
+ protected function _construct()
9
+ {
10
+ parent::_construct();
11
+ $this->_init('hipay/rule');
12
+ $this->setIdFieldName('rule_id');
13
+ }
14
+
15
+ /**
16
+ * Getter for rule conditions collection
17
+ *
18
+ * @return Mage_CatalogRule_Model_Rule_Condition_Combine
19
+ */
20
+ public function getConditionsInstance()
21
+ {
22
+ return Mage::getModel('hipay/rule_condition_combine')->setPaymentMethodCode($this->getMethodCode());
23
+ }
24
+
25
+ /**
26
+ * Get rule condition product combine model instance
27
+ *
28
+ * @return Mage_SalesRule_Model_Rule_Condition_Product_Combine
29
+ */
30
+ public function getActionsInstance()
31
+ {
32
+ return Mage::getModel('hipay/rule_condition_product_combine');
33
+ }
34
+
35
+ public function getConditions()
36
+ {
37
+ parent::getConditions();
38
+
39
+ $this->_conditions->setPaymentMethodCode($this->getMethodCode());
40
+
41
+ return $this->_conditions;
42
+ }
43
+
44
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Address.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Allopass_Hipay_Model_Rule_Condition_Address extends Mage_Rule_Model_Condition_Abstract
5
+ {
6
+ public function loadAttributeOptions()
7
+ {
8
+ $attributes = array(
9
+ 'base_subtotal' => Mage::helper('sales')->__('Subtotal'),
10
+ 'base_grand_total' => Mage::helper('sales')->__('Grand Total'),
11
+ 'base_currency_code' => Mage::helper('adminhtml')->__('Currency'),
12
+ 'items_qty' => Mage::helper('salesrule')->__('Total Items Quantity'),
13
+ 'weight' => Mage::helper('salesrule')->__('Total Weight'),
14
+ 'created_at' => Mage::helper('hipay')->__("Order's time"),
15
+ 'shipping_method' => Mage::helper('salesrule')->__('Shipping Method'),
16
+ 'billing_postcode' => Mage::helper('hipay')->__('Billing Postcode'),
17
+ 'billing_region' => Mage::helper('hipay')->__('Billing Region'),
18
+ 'billing_region_id' => Mage::helper('hipay')->__('Billing State/Province'),
19
+ 'billing_country_id' => Mage::helper('hipay')->__('Billing Country'),
20
+ );
21
+
22
+ $this->setAttributeOption($attributes);
23
+
24
+ return $this;
25
+ }
26
+
27
+ public function getInputType()
28
+ {
29
+ switch ($this->getAttribute()) {
30
+ case 'base_subtotal': case 'weight': case 'total_qty': case 'base_grandtotal':
31
+ return 'numeric';
32
+ case 'shipping_method': case 'billing_country_id': case 'billing_region_id': case 'base_currency_code':
33
+ return 'select';
34
+ case 'created_at':
35
+ return 'boolean' ;
36
+ }
37
+ return 'string';
38
+ }
39
+
40
+ public function getValueElementType()
41
+ {
42
+ switch ($this->getAttribute()) {
43
+ case 'shipping_method': case 'billing_country_id': case 'billing_region_id': case 'base_currency_code': case 'created_at':
44
+ return 'select';
45
+ }
46
+ return 'text';
47
+ }
48
+
49
+
50
+
51
+
52
+ public function getValueSelectOptions()
53
+ {
54
+ if (!$this->hasData('value_select_options')) {
55
+ switch ($this->getAttribute()) {
56
+ case 'billing_country_id':
57
+ $options = Mage::getModel('adminhtml/system_config_source_country')
58
+ ->toOptionArray();
59
+ break;
60
+
61
+ case 'billing_region_id':
62
+ $options = Mage::getModel('adminhtml/system_config_source_allregion')
63
+ ->toOptionArray();
64
+ break;
65
+
66
+ case 'shipping_method':
67
+ $options = Mage::getModel('adminhtml/system_config_source_shipping_allmethods')
68
+ ->toOptionArray();
69
+ break;
70
+
71
+ case 'base_currency_code':
72
+ $options = Mage::getModel('adminhtml/system_config_source_currency')
73
+ ->toOptionArray(false);
74
+ break;
75
+ case 'created_at':
76
+ $options = array(
77
+ array("value"=>"00::8","label"=>Mage::helper('hipay')->__("Midnight - 8:00 a.m.")),
78
+ array("value"=>"8::15","label"=>Mage::helper('hipay')->__("8:00 a.m. - 3:00 p.m.")),
79
+ array("value"=>"15::20","label"=>Mage::helper('hipay')->__("3:00 pm. - 8:00 p.m.")),
80
+ array("value"=>"20::23","label"=>Mage::helper('hipay')->__("8:00 p.m. - 11:59 p.m.")),
81
+ );
82
+ break;
83
+
84
+ default:
85
+ $options = array();
86
+ }
87
+ $this->setData('value_select_options', $options);
88
+ }
89
+ return $this->getData('value_select_options');
90
+ }
91
+
92
+ /**
93
+ * Validate Address Rule Condition
94
+ *
95
+ * @param Varien_Object $object
96
+ * @return bool
97
+ */
98
+ public function validate(Varien_Object $object)
99
+ {
100
+ $quote = Mage::getModel('sales/quote')->load($object->getQuoteId());
101
+ $address = $quote->getBillingAddress();
102
+
103
+ //Get infos from billing address
104
+ $toValidate = new Varien_Object();
105
+ $toValidate->setBillingPostcode($address->getPostcode());
106
+ $toValidate->setBillingRegion($address->getRegion());
107
+ $toValidate->setBillingRegionId($address->getRegionId());
108
+ $toValidate->setBillingCountryId($address->getCountryId());
109
+
110
+ if(!$quote->isVirtual()){//Get infos from shipping address
111
+ $address = $quote->getShippingAddress();
112
+ }
113
+
114
+ $toValidate->setBaseSubtotal($address->getBaseSubtotal());
115
+ $toValidate->setBaseGrandTotal($address->getBaseGrandTotal());
116
+ $toValidate->setWeight($address->getWeight());
117
+ $toValidate->setShippingMethod($address->getShippingMethod());
118
+
119
+ $toValidate->setTotalQty($quote->getItemsQty());
120
+ $toValidate->setBaseCurrencyCode($quote->getBaseCurrencyCode());
121
+
122
+ $toValidate->setCreatedAt($this->_getFormatCreatedAt($object));
123
+
124
+ return parent::validate($toValidate);
125
+
126
+ }
127
+
128
+ protected function _getFormatCreatedAt($object)
129
+ {
130
+ $created_at = $object->getCreatedAt();
131
+
132
+ if(!$created_at instanceof Zend_Date)
133
+ $created_at = Mage::app()->getLocale()->storeDate($object->getStoreId(),$created_at,true);
134
+
135
+ $hour = (int)$created_at->toString("H");
136
+
137
+ switch (true) {
138
+ case ($hour >= 0 && $hour <= 8):
139
+ return '00::8';
140
+ case ($hour > 8 && $hour <= 15):
141
+ return '8::15';
142
+ case ($hour > 15 && $hour <= 20):
143
+ return '15::20';
144
+ case ($hour > 20 && $hour <= 23):
145
+ return '20::23';
146
+
147
+ }
148
+
149
+ return '';
150
+ }
151
+
152
+ public function getTypeElement()
153
+ {
154
+ return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() .'_'. $this->getPaymentMethodCode() . '__type', 'hidden', array(
155
+ //'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId().'_'. $this->getPaymentMethodCode() . '][type]',
156
+ 'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId() . '][type]',
157
+ 'value' => $this->getType(),
158
+ 'no_span' => true,
159
+ 'class' => 'hidden',
160
+ ));
161
+ }
162
+
163
+ public function getAttributeElement()
164
+ {
165
+ if (is_null($this->getAttribute())) {
166
+ foreach ($this->getAttributeOption() as $k => $v) {
167
+ $this->setAttribute($k);
168
+ break;
169
+ }
170
+ }
171
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__attribute', 'select', array(
172
+ //'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][attribute]',
173
+ 'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'][attribute]',
174
+ 'values'=>$this->getAttributeSelectOptions(),
175
+ 'value'=>$this->getAttribute(),
176
+ 'value_name'=>$this->getAttributeName(),
177
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
178
+ }
179
+
180
+ /**
181
+ * Retrieve Condition Operator element Instance
182
+ * If the operator value is empty - define first available operator value as default
183
+ *
184
+ * @return Varien_Data_Form_Element_Select
185
+ */
186
+ public function getOperatorElement()
187
+ {
188
+ $options = $this->getOperatorSelectOptions();
189
+ if (is_null($this->getOperator())) {
190
+ foreach ($options as $option) {
191
+ $this->setOperator($option['value']);
192
+ break;
193
+ }
194
+ }
195
+
196
+ $elementId = sprintf('%s__%s__operator', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
197
+ //$elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
198
+ $elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId());
199
+ $element = $this->getForm()->addField($elementId, 'select', array(
200
+ 'name' => $elementName,
201
+ 'values' => $options,
202
+ 'value' => $this->getOperator(),
203
+ 'value_name' => $this->getOperatorName(),
204
+ ));
205
+ $element->setRenderer(Mage::getBlockSingleton('rule/editable'));
206
+
207
+ return $element;
208
+ }
209
+
210
+ public function getValueElement()
211
+ {
212
+ $elementParams = array(
213
+ //'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][value]',
214
+ 'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][value]',
215
+ 'value' => $this->getValue(),
216
+ 'values' => $this->getValueSelectOptions(),
217
+ 'value_name' => $this->getValueName(),
218
+ 'after_element_html' => $this->getValueAfterElementHtml(),
219
+ 'explicit_apply' => $this->getExplicitApply(),
220
+ );
221
+ if ($this->getInputType()=='date') {
222
+ // date format intentionally hard-coded
223
+ $elementParams['input_format'] = Varien_Date::DATE_INTERNAL_FORMAT;
224
+ $elementParams['format'] = Varien_Date::DATE_INTERNAL_FORMAT;
225
+ }
226
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__value',
227
+ $this->getValueElementType(),
228
+ $elementParams
229
+ )->setRenderer($this->getValueElementRenderer());
230
+ }
231
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Combine.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Hipay Rule Combine Condition data model
5
+ */
6
+ class Allopass_Hipay_Model_Rule_Condition_Combine extends Mage_Rule_Model_Condition_Combine
7
+ {
8
+ protected $_paymentMethodCode = null;
9
+
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setType('hipay/rule_condition_combine');
14
+ }
15
+
16
+
17
+
18
+ public function getNewChildSelectOptions()
19
+ {
20
+ $addressCondition = Mage::getModel('hipay/rule_condition_address');
21
+ $addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
22
+ $attributes = array();
23
+ foreach ($addressAttributes as $code=>$label) {
24
+ $attributes[] = array('value'=>'hipay/rule_condition_address|'.$code.'|'.$this->getPaymentMethodCode(), 'label'=>$label);
25
+ }
26
+
27
+ $customerCondition = Mage::getModel('hipay/rule_condition_customer');
28
+ $customerAttributes = $customerCondition->loadAttributeOptions()->getAttributeOption();
29
+ $cAttributes = array();
30
+ foreach ($customerAttributes as $code=>$label) {
31
+ $cAttributes[] = array('value'=>'hipay/rule_condition_customer|'.$code.'|'.$this->getPaymentMethodCode(), 'label'=>$label);
32
+ }
33
+
34
+ $conditions = parent::getNewChildSelectOptions();
35
+ $conditions = array_merge_recursive($conditions, array(
36
+ array('value'=>'hipay/rule_condition_product_found||'.$this->getPaymentMethodCode(), 'label'=>Mage::helper('salesrule')->__('Product attribute combination')),
37
+ array('value'=>'hipay/rule_condition_product_subselect||'.$this->getPaymentMethodCode(), 'label'=>Mage::helper('salesrule')->__('Products subselection')),
38
+ array('value'=>'hipay/rule_condition_combine||'.$this->getPaymentMethodCode(), 'label'=>Mage::helper('salesrule')->__('Conditions combination')),
39
+ array('label'=>Mage::helper('hipay')->__('Order Attribute'), 'value'=>$attributes),
40
+ array('label'=>Mage::helper('hipay')->__('Customer Attribute'), 'value'=>$cAttributes),
41
+ ));
42
+
43
+ $additional = new Varien_Object();
44
+ Mage::dispatchEvent('hipay_rule_condition_combine', array('additional' => $additional));
45
+ if ($additionalConditions = $additional->getConditions()) {
46
+ $conditions = array_merge_recursive($conditions, $additionalConditions);
47
+ }
48
+
49
+ return $conditions;
50
+ }
51
+
52
+ public function getTypeElement()
53
+ {
54
+ return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() .'_'. $this->getPaymentMethodCode() . '__type', 'hidden', array(
55
+ //'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId().'_'. $this->getPaymentMethodCode() . '][type]',
56
+ 'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId() . '][type]',
57
+ 'value' => $this->getType(),
58
+ 'no_span' => true,
59
+ 'class' => 'hidden',
60
+ ));
61
+ }
62
+
63
+ public function getAttributeElement()
64
+ {
65
+ if (is_null($this->getAttribute())) {
66
+ foreach ($this->getAttributeOption() as $k => $v) {
67
+ $this->setAttribute($k);
68
+ break;
69
+ }
70
+ }
71
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__attribute', 'select', array(
72
+ //'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][attribute]',
73
+ 'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'][attribute]',
74
+ 'values'=>$this->getAttributeSelectOptions(),
75
+ 'value'=>$this->getAttribute(),
76
+ 'value_name'=>$this->getAttributeName(),
77
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
78
+ }
79
+
80
+ /**
81
+ * Retrieve Condition Operator element Instance
82
+ * If the operator value is empty - define first available operator value as default
83
+ *
84
+ * @return Varien_Data_Form_Element_Select
85
+ */
86
+ public function getOperatorElement()
87
+ {
88
+ $options = $this->getOperatorSelectOptions();
89
+ if (is_null($this->getOperator())) {
90
+ foreach ($options as $option) {
91
+ $this->setOperator($option['value']);
92
+ break;
93
+ }
94
+ }
95
+
96
+ $elementId = sprintf('%s__%s__operator', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
97
+ //$elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
98
+ $elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId());
99
+ $element = $this->getForm()->addField($elementId, 'select', array(
100
+ 'name' => $elementName,
101
+ 'values' => $options,
102
+ 'value' => $this->getOperator(),
103
+ 'value_name' => $this->getOperatorName(),
104
+ ));
105
+ $element->setRenderer(Mage::getBlockSingleton('rule/editable'));
106
+
107
+ return $element;
108
+ }
109
+
110
+ public function getValueElement()
111
+ {
112
+ $elementParams = array(
113
+ //'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][value]',
114
+ 'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][value]',
115
+ 'value' => $this->getValue(),
116
+ 'values' => $this->getValueSelectOptions(),
117
+ 'value_name' => $this->getValueName(),
118
+ 'after_element_html' => $this->getValueAfterElementHtml(),
119
+ 'explicit_apply' => $this->getExplicitApply(),
120
+ );
121
+ if ($this->getInputType()=='date') {
122
+ // date format intentionally hard-coded
123
+ $elementParams['input_format'] = Varien_Date::DATE_INTERNAL_FORMAT;
124
+ $elementParams['format'] = Varien_Date::DATE_INTERNAL_FORMAT;
125
+ }
126
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__value',
127
+ $this->getValueElementType(),
128
+ $elementParams
129
+ )->setRenderer($this->getValueElementRenderer());
130
+ }
131
+
132
+ public function getNewChildElement()
133
+ {
134
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__new_child', 'select', array(
135
+ //'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][new_child]',
136
+ 'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][new_child]',
137
+ 'values'=>$this->getNewChildSelectOptions(),
138
+ 'value_name'=>$this->getNewChildName(),
139
+ ))->setRenderer(Mage::getBlockSingleton('rule/newchild'));
140
+ }
141
+
142
+ public function getAggregatorElement()
143
+ {
144
+ if (is_null($this->getAggregator())) {
145
+ foreach ($this->getAggregatorOption() as $k=>$v) {
146
+ $this->setAggregator($k);
147
+ break;
148
+ }
149
+ }
150
+
151
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__aggregator', 'select', array(
152
+ // 'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][aggregator]',
153
+ 'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][aggregator]',
154
+ 'values'=>$this->getAggregatorSelectOptions(),
155
+ 'value'=>$this->getAggregator(),
156
+ 'value_name'=>$this->getAggregatorName(),
157
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
158
+ }
159
+
160
+ public function asHtmlRecursive()
161
+ {
162
+ $html = $this->asHtml().'<ul id="'.$this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__children" class="rule-param-children">';
163
+ foreach ($this->getConditions() as $cond) {
164
+ $cond->setPaymentMethodCode($this->getPaymentMethodCode());
165
+ $html .= '<li>'.$cond->asHtmlRecursive().'</li>';
166
+ }
167
+ $html .= '<li>'.$this->getNewChildElement()->getHtml().'</li></ul>';
168
+ return $html;
169
+ }
170
+
171
+
172
+ public function getPaymentMethodCode()
173
+ {
174
+
175
+ return $this->_paymentMethodCode;
176
+ }
177
+
178
+ public function setPaymentMethodCode($methodCode)
179
+ {
180
+ $this->_paymentMethodCode = $methodCode;
181
+ return $this;
182
+ }
183
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Customer.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Rule_Condition_Customer extends Mage_Rule_Model_Condition_Abstract
3
+ {
4
+ public function loadAttributeOptions()
5
+ {
6
+ $attributes = array(
7
+ 'orders_count' => Mage::helper('hipay')->__('Orders count'),
8
+ 'customer_is_guest' => Mage::helper('sales')->__('Customer is guest'),
9
+ 'diff_addresses' => Mage::helper('hipay')->__('Billing and shipping addresses are differents'),
10
+ );
11
+
12
+ $this->setAttributeOption($attributes);
13
+
14
+ return $this;
15
+ }
16
+
17
+ public function getInputType()
18
+ {
19
+ switch ($this->getAttribute()) {
20
+ case 'orders_count':
21
+ return 'numeric';
22
+ case 'customer_is_guest': case 'diff_addresses':
23
+ return 'boolean';
24
+ }
25
+ return 'string';
26
+ }
27
+
28
+ public function getValueElementType()
29
+ {
30
+ switch ($this->getAttribute()) {
31
+ case 'customer_is_guest': case 'diff_addresses':
32
+ return 'select';
33
+ }
34
+ return 'text';
35
+ }
36
+
37
+ public function getValueSelectOptions()
38
+ {
39
+ if (!$this->hasData('value_select_options')) {
40
+ switch ($this->getAttribute()) {
41
+ case 'customer_is_guest':
42
+ case 'diff_addresses':
43
+ $options = Mage::getModel('adminhtml/system_config_source_yesno')
44
+ ->toOptionArray();
45
+ break;
46
+ default:
47
+ $options = array();
48
+ }
49
+ $this->setData('value_select_options', $options);
50
+ }
51
+ return $this->getData('value_select_options');
52
+ }
53
+
54
+ /**
55
+ * Validate Address Rule Condition
56
+ *
57
+ * @param Varien_Object $object
58
+ * @return bool
59
+ */
60
+ public function validate(Varien_Object $object)
61
+ {
62
+ /* @var $order Mage_Sales_Model_Order */
63
+ $order = $object;
64
+
65
+ //Get infos from billing address
66
+ $toValidate = new Varien_Object();
67
+
68
+ $customer_id = $object->getCustomerId();
69
+ $orders_count = $order->getCollection()->addAttributeToFilter('customer_id',$customer_id)->count();
70
+ $toValidate->setOrdersCount($orders_count);
71
+ $toValidate->setCustomerIsGuest(is_null($order->getCustomerIsGuest()) ? 0 : $order->getCustomerIsGuest());
72
+ $toValidate->setDiffAddresses($this->_addressesesAreDifferent($order));
73
+
74
+ return parent::validate($toValidate);
75
+
76
+ }
77
+
78
+ /**
79
+ * @param Mage_Sales_Model_Order $order
80
+ * @return boolean $isDifferent
81
+ */
82
+ protected function _addressesesAreDifferent($order)
83
+ {
84
+ $isDifferent = false;
85
+ if($order->getIsVirtual())
86
+ return $isDifferent;
87
+
88
+
89
+ $billingAddress = $order->getBillingAddress();
90
+ $shippingAddress = $order->getShippingAddress();
91
+ $methods = array('getStreetFull','getCity','getCountryId','getPostcode','getRegionId');
92
+
93
+ foreach($methods as $method_name)
94
+ {
95
+ $billingValue = call_user_func(array($billingAddress, $method_name));
96
+ $shippingValue = call_user_func(array($shippingAddress,$method_name));
97
+ if($billingValue != $shippingValue)
98
+ {
99
+ $isDifferent = true;
100
+ break;
101
+ }
102
+ }
103
+
104
+ return $isDifferent;
105
+ }
106
+
107
+ public function getTypeElement()
108
+ {
109
+ return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() .'_'. $this->getPaymentMethodCode() . '__type', 'hidden', array(
110
+ //'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId().'_'. $this->getPaymentMethodCode() . '][type]',
111
+ 'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId() . '][type]',
112
+ 'value' => $this->getType(),
113
+ 'no_span' => true,
114
+ 'class' => 'hidden',
115
+ ));
116
+ }
117
+
118
+ public function getAttributeElement()
119
+ {
120
+ if (is_null($this->getAttribute())) {
121
+ foreach ($this->getAttributeOption() as $k => $v) {
122
+ $this->setAttribute($k);
123
+ break;
124
+ }
125
+ }
126
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__attribute', 'select', array(
127
+ //'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][attribute]',
128
+ 'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'][attribute]',
129
+ 'values'=>$this->getAttributeSelectOptions(),
130
+ 'value'=>$this->getAttribute(),
131
+ 'value_name'=>$this->getAttributeName(),
132
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
133
+ }
134
+
135
+ /**
136
+ * Retrieve Condition Operator element Instance
137
+ * If the operator value is empty - define first available operator value as default
138
+ *
139
+ * @return Varien_Data_Form_Element_Select
140
+ */
141
+ public function getOperatorElement()
142
+ {
143
+ $options = $this->getOperatorSelectOptions();
144
+ if (is_null($this->getOperator())) {
145
+ foreach ($options as $option) {
146
+ $this->setOperator($option['value']);
147
+ break;
148
+ }
149
+ }
150
+
151
+ $elementId = sprintf('%s__%s__operator', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
152
+ //$elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
153
+ $elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId());
154
+ $element = $this->getForm()->addField($elementId, 'select', array(
155
+ 'name' => $elementName,
156
+ 'values' => $options,
157
+ 'value' => $this->getOperator(),
158
+ 'value_name' => $this->getOperatorName(),
159
+ ));
160
+ $element->setRenderer(Mage::getBlockSingleton('rule/editable'));
161
+
162
+ return $element;
163
+ }
164
+
165
+ public function getValueElement()
166
+ {
167
+ $elementParams = array(
168
+ //'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][value]',
169
+ 'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][value]',
170
+ 'value' => $this->getValue(),
171
+ 'values' => $this->getValueSelectOptions(),
172
+ 'value_name' => $this->getValueName(),
173
+ 'after_element_html' => $this->getValueAfterElementHtml(),
174
+ 'explicit_apply' => $this->getExplicitApply(),
175
+ );
176
+ if ($this->getInputType()=='date') {
177
+ // date format intentionally hard-coded
178
+ $elementParams['input_format'] = Varien_Date::DATE_INTERNAL_FORMAT;
179
+ $elementParams['format'] = Varien_Date::DATE_INTERNAL_FORMAT;
180
+ }
181
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__value',
182
+ $this->getValueElementType(),
183
+ $elementParams
184
+ )->setRenderer($this->getValueElementRenderer());
185
+ }
186
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * 3ds Rule Product Condition data model
5
+ */
6
+ class Allopass_Hipay_Model_Rule_Condition_Product extends Mage_CatalogRule_Model_Rule_Condition_Product
7
+ {
8
+
9
+
10
+ /**
11
+ * Add special attributes
12
+ *
13
+ * @param array $attributes
14
+ */
15
+ protected function _addSpecialAttributes(array &$attributes)
16
+ {
17
+ parent::_addSpecialAttributes($attributes);
18
+ $attributes['order_item_qty'] = Mage::helper('salesrule')->__('Quantity in order');
19
+ $attributes['order_item_price'] = Mage::helper('salesrule')->__('Price in order');
20
+ $attributes['order_item_row_total'] = Mage::helper('salesrule')->__('Row total in order');
21
+ }
22
+
23
+ /**
24
+ * Validate Product Rule Condition
25
+ *
26
+ * @param Varien_Object $object
27
+ *
28
+ * @return bool
29
+ */
30
+ public function validate(Varien_Object $object)
31
+ {
32
+ $product = false;
33
+ if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
34
+ $product = $object->getProduct();
35
+ } else {
36
+ $product = Mage::getModel('catalog/product')
37
+ ->load($object->getProductId());
38
+ }
39
+
40
+ $product
41
+ ->setOrderItemQty($object->getQtyOrdered())
42
+ ->setOrderItemPrice($object->getPrice()) // possible bug: need to use $object->getBasePrice()
43
+ ->setOrderItemRowTotal($object->getBaseRowTotal());
44
+
45
+ return parent::validate($product);
46
+ }
47
+
48
+ public function getTypeElement()
49
+ {
50
+ return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() .'_'. $this->getPaymentMethodCode() . '__type', 'hidden', array(
51
+ //'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId().'_'. $this->getPaymentMethodCode() . '][type]',
52
+ 'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId() . '][type]',
53
+ 'value' => $this->getType(),
54
+ 'no_span' => true,
55
+ 'class' => 'hidden',
56
+ ));
57
+ }
58
+
59
+ public function getAttributeElement()
60
+ {
61
+ if (is_null($this->getAttribute())) {
62
+ foreach ($this->getAttributeOption() as $k => $v) {
63
+ $this->setAttribute($k);
64
+ break;
65
+ }
66
+ }
67
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__attribute', 'select', array(
68
+ //'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][attribute]',
69
+ 'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'][attribute]',
70
+ 'values'=>$this->getAttributeSelectOptions(),
71
+ 'value'=>$this->getAttribute(),
72
+ 'value_name'=>$this->getAttributeName(),
73
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
74
+ }
75
+
76
+ /**
77
+ * Retrieve Condition Operator element Instance
78
+ * If the operator value is empty - define first available operator value as default
79
+ *
80
+ * @return Varien_Data_Form_Element_Select
81
+ */
82
+ public function getOperatorElement()
83
+ {
84
+ $options = $this->getOperatorSelectOptions();
85
+ if (is_null($this->getOperator())) {
86
+ foreach ($options as $option) {
87
+ $this->setOperator($option['value']);
88
+ break;
89
+ }
90
+ }
91
+
92
+ $elementId = sprintf('%s__%s__operator', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
93
+ //$elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
94
+ $elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId());
95
+ $element = $this->getForm()->addField($elementId, 'select', array(
96
+ 'name' => $elementName,
97
+ 'values' => $options,
98
+ 'value' => $this->getOperator(),
99
+ 'value_name' => $this->getOperatorName(),
100
+ ));
101
+ $element->setRenderer(Mage::getBlockSingleton('rule/editable'));
102
+
103
+ return $element;
104
+ }
105
+
106
+ public function getValueElement()
107
+ {
108
+ $elementParams = array(
109
+ //'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][value]',
110
+ 'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][value]',
111
+ 'value' => $this->getValue(),
112
+ 'values' => $this->getValueSelectOptions(),
113
+ 'value_name' => $this->getValueName(),
114
+ 'after_element_html' => $this->getValueAfterElementHtml(),
115
+ 'explicit_apply' => $this->getExplicitApply(),
116
+ );
117
+ if ($this->getInputType()=='date') {
118
+ // date format intentionally hard-coded
119
+ $elementParams['input_format'] = Varien_Date::DATE_INTERNAL_FORMAT;
120
+ $elementParams['format'] = Varien_Date::DATE_INTERNAL_FORMAT;
121
+ }
122
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__value',
123
+ $this->getValueElementType(),
124
+ $elementParams
125
+ )->setRenderer($this->getValueElementRenderer());
126
+ }
127
+
128
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Combine.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Rule_Condition_Product_Combine extends Mage_Rule_Model_Condition_Combine
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setType('hipay/rule_condition_product_combine');
9
+ }
10
+
11
+ public function getNewChildSelectOptions()
12
+ {
13
+ $productCondition = Mage::getModel('hipay/rule_condition_product');
14
+ $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
15
+ $pAttributes = array();
16
+ $iAttributes = array();
17
+ foreach ($productAttributes as $code=>$label) {
18
+ if (strpos($code, 'order_item_')===0) {
19
+ $iAttributes[] = array('value'=>'hipay/rule_condition_product|'.$code.'|'.$this->getPaymentMethodCode(), 'label'=>$label);
20
+ } else {
21
+ $pAttributes[] = array('value'=>'hipay/rule_condition_product|'.$code.'|'.$this->getPaymentMethodCode(), 'label'=>$label);
22
+ }
23
+ }
24
+
25
+ $conditions = parent::getNewChildSelectOptions();
26
+ $conditions = array_merge_recursive($conditions, array(
27
+ array('value'=>'hipay/rule_condition_product_combine||'.$this->getPaymentMethodCode(), 'label'=>Mage::helper('catalog')->__('Conditions Combination')),
28
+ array('label'=>Mage::helper('hipay')->__('Order Attribute'), 'value'=>$iAttributes),
29
+ array('label'=>Mage::helper('catalog')->__('Product Attribute'), 'value'=>$pAttributes),
30
+ ));
31
+ return $conditions;
32
+ }
33
+
34
+ public function collectValidatedAttributes($productCollection)
35
+ {
36
+ foreach ($this->getConditions() as $condition) {
37
+ $condition->collectValidatedAttributes($productCollection);
38
+ }
39
+ return $this;
40
+ }
41
+
42
+ public function getTypeElement()
43
+ {
44
+ return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() .'_'. $this->getPaymentMethodCode() . '__type', 'hidden', array(
45
+ //'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId().'_'. $this->getPaymentMethodCode() . '][type]',
46
+ 'name' => 'rule_' . $this->getPaymentMethodCode() . '[' . $this->getPrefix() . '][' . $this->getId() . '][type]',
47
+ 'value' => $this->getType(),
48
+ 'no_span' => true,
49
+ 'class' => 'hidden',
50
+ ));
51
+ }
52
+
53
+ public function getAttributeElement()
54
+ {
55
+ if (is_null($this->getAttribute())) {
56
+ foreach ($this->getAttributeOption() as $k => $v) {
57
+ $this->setAttribute($k);
58
+ break;
59
+ }
60
+ }
61
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__attribute', 'select', array(
62
+ //'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][attribute]',
63
+ 'name'=>'rule_' . $this->getPaymentMethodCode() . '['.$this->getPrefix().']['.$this->getId().'][attribute]',
64
+ 'values'=>$this->getAttributeSelectOptions(),
65
+ 'value'=>$this->getAttribute(),
66
+ 'value_name'=>$this->getAttributeName(),
67
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
68
+ }
69
+
70
+ /**
71
+ * Retrieve Condition Operator element Instance
72
+ * If the operator value is empty - define first available operator value as default
73
+ *
74
+ * @return Varien_Data_Form_Element_Select
75
+ */
76
+ public function getOperatorElement()
77
+ {
78
+ $options = $this->getOperatorSelectOptions();
79
+ if (is_null($this->getOperator())) {
80
+ foreach ($options as $option) {
81
+ $this->setOperator($option['value']);
82
+ break;
83
+ }
84
+ }
85
+
86
+ $elementId = sprintf('%s__%s__operator', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
87
+ //$elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId().'_'. $this->getPaymentMethodCode());
88
+ $elementName = sprintf('rule_'.$this->getPaymentMethodCode().'[%s][%s][operator]', $this->getPrefix(), $this->getId());
89
+ $element = $this->getForm()->addField($elementId, 'select', array(
90
+ 'name' => $elementName,
91
+ 'values' => $options,
92
+ 'value' => $this->getOperator(),
93
+ 'value_name' => $this->getOperatorName(),
94
+ ));
95
+ $element->setRenderer(Mage::getBlockSingleton('rule/editable'));
96
+
97
+ return $element;
98
+ }
99
+
100
+ public function getValueElement()
101
+ {
102
+ $elementParams = array(
103
+ //'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][value]',
104
+ 'name' => 'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][value]',
105
+ 'value' => $this->getValue(),
106
+ 'values' => $this->getValueSelectOptions(),
107
+ 'value_name' => $this->getValueName(),
108
+ 'after_element_html' => $this->getValueAfterElementHtml(),
109
+ 'explicit_apply' => $this->getExplicitApply(),
110
+ );
111
+ if ($this->getInputType()=='date') {
112
+ // date format intentionally hard-coded
113
+ $elementParams['input_format'] = Varien_Date::DATE_INTERNAL_FORMAT;
114
+ $elementParams['format'] = Varien_Date::DATE_INTERNAL_FORMAT;
115
+ }
116
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__value',
117
+ $this->getValueElementType(),
118
+ $elementParams
119
+ )->setRenderer($this->getValueElementRenderer());
120
+ }
121
+
122
+ public function getNewChildElement()
123
+ {
124
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__new_child', 'select', array(
125
+ //'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][new_child]',
126
+ 'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][new_child]',
127
+ 'values'=>$this->getNewChildSelectOptions(),
128
+ 'value_name'=>$this->getNewChildName(),
129
+ ))->setRenderer(Mage::getBlockSingleton('rule/newchild'));
130
+ }
131
+
132
+ public function getAggregatorElement()
133
+ {
134
+ if (is_null($this->getAggregator())) {
135
+ foreach ($this->getAggregatorOption() as $k=>$v) {
136
+ $this->setAggregator($k);
137
+ break;
138
+ }
139
+ }
140
+
141
+ return $this->getForm()->addField($this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__aggregator', 'select', array(
142
+ // 'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'_'. $this->getPaymentMethodCode().'][aggregator]',
143
+ 'name'=>'rule_'.$this->getPaymentMethodCode().'['.$this->getPrefix().']['.$this->getId().'][aggregator]',
144
+ 'values'=>$this->getAggregatorSelectOptions(),
145
+ 'value'=>$this->getAggregator(),
146
+ 'value_name'=>$this->getAggregatorName(),
147
+ ))->setRenderer(Mage::getBlockSingleton('rule/editable'));
148
+ }
149
+
150
+ public function asHtmlRecursive()
151
+ {
152
+ $html = $this->asHtml().'<ul id="'.$this->getPrefix().'__'.$this->getId().'_'. $this->getPaymentMethodCode().'__children" class="rule-param-children">';
153
+ foreach ($this->getConditions() as $cond) {
154
+ $cond->setPaymentMethodCode($this->getPaymentMethodCode());
155
+ $html .= '<li>'.$cond->asHtmlRecursive().'</li>';
156
+ }
157
+ $html .= '<li>'.$this->getNewChildElement()->getHtml().'</li></ul>';
158
+ return $html;
159
+ }
160
+
161
+
162
+ public function getPaymentMethodCode()
163
+ {
164
+ return $this->_paymentMethodCode;
165
+ }
166
+
167
+ public function setPaymentMethodCode($methodCode)
168
+ {
169
+ $this->_paymentMethodCode = $methodCode;
170
+ return $this;
171
+ }
172
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Found.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Allopass_Hipay_Model_Rule_Condition_Product_Found
5
+ extends Allopass_Hipay_Model_Rule_Condition_Product_Combine
6
+ {
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setType('hipay/rule_condition_product_found');
11
+ }
12
+
13
+ /**
14
+ * Load value options
15
+ *
16
+ * @return Mage_SalesRule_Model_Rule_Condition_Product_Found
17
+ */
18
+ public function loadValueOptions()
19
+ {
20
+ $this->setValueOption(array(
21
+ 1 => Mage::helper('salesrule')->__('FOUND'),
22
+ 0 => Mage::helper('salesrule')->__('NOT FOUND')
23
+ ));
24
+ return $this;
25
+ }
26
+
27
+ public function asHtml()
28
+ {
29
+ $html = $this->getTypeElement()->getHtml() . Mage::helper('salesrule')->__("If an item is %s in the cart with %s of these conditions true:", $this->getValueElement()->getHtml(), $this->getAggregatorElement()->getHtml());
30
+ if ($this->getId() != '1') {
31
+ $html.= $this->getRemoveLinkHtml();
32
+ }
33
+ return $html;
34
+ }
35
+
36
+ /**
37
+ * validate
38
+ *
39
+ * @param Varien_Object $object Quote
40
+ * @return boolean
41
+ */
42
+ public function validate(Varien_Object $object)
43
+ {
44
+ $all = $this->getAggregator()==='all';
45
+ $true = (bool)$this->getValue();
46
+ $found = false;
47
+ foreach ($object->getAllItems() as $item) {
48
+ $found = $all;
49
+ foreach ($this->getConditions() as $cond) {
50
+ $validated = $cond->validate($item);
51
+ if (($all && !$validated) || (!$all && $validated)) {
52
+ $found = $validated;
53
+ break;
54
+ }
55
+ }
56
+ if (($found && $true) || (!$true && $found)) {
57
+ break;
58
+ }
59
+ }
60
+ // found an item and we're looking for existing one
61
+ if ($found && $true) {
62
+ return true;
63
+ }
64
+ // not found and we're making sure it doesn't exist
65
+ elseif (!$found && !$true) {
66
+ return true;
67
+ }
68
+ return false;
69
+ }
70
+ }
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Subselect.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Allopass_Hipay_Model_Rule_Condition_Product_Subselect
5
+ extends Allopass_Hipay_Model_Rule_Condition_Product_Combine
6
+ {
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setType('hipay/rule_condition_product_subselect')
11
+ ->setValue(null);
12
+ }
13
+
14
+ public function loadArray($arr, $key='conditions')
15
+ {
16
+ $this->setAttribute($arr['attribute']);
17
+ $this->setOperator($arr['operator']);
18
+ parent::loadArray($arr, $key);
19
+ return $this;
20
+ }
21
+
22
+ public function asXml($containerKey='conditions', $itemKey='condition')
23
+ {
24
+ $xml = '<attribute>'.$this->getAttribute().'</attribute>'
25
+ . '<operator>'.$this->getOperator().'</operator>'
26
+ . parent::asXml($containerKey, $itemKey);
27
+ return $xml;
28
+ }
29
+
30
+ public function loadAttributeOptions()
31
+ {
32
+ $this->setAttributeOption(array(
33
+ 'qty' => Mage::helper('salesrule')->__('total quantity'),
34
+ 'base_row_total' => Mage::helper('salesrule')->__('total amount'),
35
+ ));
36
+ return $this;
37
+ }
38
+
39
+ public function loadValueOptions()
40
+ {
41
+ return $this;
42
+ }
43
+
44
+ public function loadOperatorOptions()
45
+ {
46
+ $this->setOperatorOption(array(
47
+ '==' => Mage::helper('rule')->__('is'),
48
+ '!=' => Mage::helper('rule')->__('is not'),
49
+ '>=' => Mage::helper('rule')->__('equals or greater than'),
50
+ '<=' => Mage::helper('rule')->__('equals or less than'),
51
+ '>' => Mage::helper('rule')->__('greater than'),
52
+ '<' => Mage::helper('rule')->__('less than'),
53
+ '()' => Mage::helper('rule')->__('is one of'),
54
+ '!()' => Mage::helper('rule')->__('is not one of'),
55
+ ));
56
+ return $this;
57
+ }
58
+
59
+ public function getValueElementType()
60
+ {
61
+ return 'text';
62
+ }
63
+
64
+ public function asHtml()
65
+ {
66
+ $html = $this->getTypeElement()->getHtml().
67
+ Mage::helper('salesrule')->__("If %s %s %s for a subselection of items in cart matching %s of these conditions:", $this->getAttributeElement()->getHtml(), $this->getOperatorElement()->getHtml(), $this->getValueElement()->getHtml(), $this->getAggregatorElement()->getHtml());
68
+ if ($this->getId() != '1') {
69
+ $html .= $this->getRemoveLinkHtml();
70
+ }
71
+ return $html;
72
+ }
73
+
74
+ /**
75
+ * validate
76
+ *
77
+ * @param Varien_Object $object Quote
78
+ * @return boolean
79
+ */
80
+ public function validate(Varien_Object $object)
81
+ {
82
+ if (!$this->getConditions()) {
83
+ return false;
84
+ }
85
+
86
+
87
+ // $value = $this->getValue();
88
+ // $aggregatorArr = explode('/', $this->getAggregator());
89
+ // $this->setValue((int)$aggregatorArr[0])->setAggregator($aggregatorArr[1]);
90
+
91
+ $attr = $this->getAttribute();
92
+ $total = 0;
93
+ foreach ($object->getQuote()->getAllItems() as $item) {
94
+ if (parent::validate($item)) {
95
+ $total += $item->getData($attr);
96
+ }
97
+ }
98
+ // $this->setAggregator(join('/', $aggregatorArr))->setValue($value);
99
+
100
+ return $this->validateAttribute($total);
101
+ }
102
+ }
app/code/community/Allopass/Hipay/Model/Rule/Config.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Rule_Config extends Mage_Core_Model_Config_Data
3
+ {
4
+
5
+ protected $_rule = null;
6
+ protected $_ruleData = null;
7
+
8
+ /**
9
+ * @return Allopass_Hipay_Model_Rule
10
+ */
11
+ public function getRule()
12
+ {
13
+ if(is_null($this->_rule))
14
+ {
15
+ $this->_rule = Mage::getModel('hipay/rule');
16
+ }
17
+
18
+ return $this->_rule;
19
+ }
20
+
21
+ public function setRule($rule)
22
+ {
23
+ $this->_rule = $rule;
24
+ }
25
+
26
+ protected function _afterload()
27
+ {
28
+
29
+ parent::_afterload();
30
+ $rule = Mage::getModel('hipay/rule');
31
+ $rule->setMethodCode($this->_getMethodCode());
32
+
33
+ if($this->getValue())
34
+ $rule->load($this->getValue());
35
+
36
+ $this->setRule($rule);
37
+
38
+ return $this;
39
+
40
+ }
41
+
42
+ protected function _beforeSave()
43
+ {
44
+ $rule = Mage::getModel('hipay/rule')->load($this->getValue());
45
+
46
+ $validateResult = $rule->validateData(new Varien_Object($this->_getRuleData()));
47
+ if ($validateResult !== true) {
48
+ $errors = array();
49
+ foreach($validateResult as $errorMessage) {
50
+ $errors[] = $errorMessage;
51
+ }
52
+ Mage::throwException(new Exception(print_r($errors,true)));
53
+
54
+ }
55
+
56
+ $rule->setMethodCode($this->_getMethodCode());
57
+ $rule->loadPost($this->_getRuleData());
58
+
59
+ try{
60
+
61
+ $rule->save();
62
+ }
63
+ catch (Exception $e)
64
+ {
65
+ Mage::logException($e);
66
+ }
67
+ $this->setRule($rule);
68
+
69
+ $this->setValue($rule->getId());
70
+
71
+ parent::_beforeSave();
72
+ return $this;
73
+ }
74
+
75
+ protected function _getMethodCode()
76
+ {
77
+ list($section,$group,$field) = explode("/", $this->getData('path'));
78
+ return $group;
79
+ }
80
+
81
+ protected function _getRuleData()
82
+ {
83
+ if(is_null($this->_ruleData))
84
+ {
85
+ $post = Mage::app()->getRequest()->getPost();
86
+ $this->_ruleData = array();
87
+ if(isset($post['rule_' . $this->_getMethodCode()]['conditions']))
88
+ $this->_ruleData['conditions'] = $post['rule_' . $this->_getMethodCode()]['conditions'];
89
+ }
90
+
91
+ return $this->_ruleData;
92
+ }
93
+ }
app/code/community/Allopass/Hipay/Model/Source/3ds.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Allopass Hipay Activate 3DS
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Source_3ds
9
+ {
10
+ /**
11
+ * Options getter
12
+ *
13
+ * @return array
14
+ */
15
+ public function toOptionArray()
16
+ {
17
+ return array(
18
+ array('value' => 1, 'label'=>Mage::helper('hipay')->__('Enable for all transactions')),
19
+ array('value' => 2, 'label'=>Mage::helper('hipay')->__('Enable for configured 3ds rules')),
20
+ array('value' => 0, 'label'=>Mage::helper('hipay')->__('Disabled')),
21
+
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Get options in "key-value" format
27
+ *
28
+ * @return array
29
+ */
30
+ public function toArray()
31
+ {
32
+ return array(
33
+ 0 => Mage::helper('hipay')->__('Disabled'),
34
+ 1 => Mage::helper('hipay')->__('Enable for all transactions'),
35
+ 2 => Mage::helper('hipay')->__('Enable for configured 3ds rules'),
36
+ );
37
+ }
38
+
39
+ }
app/code/community/Allopass/Hipay/Model/Source/CcType.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Allopass Hipay Credit cards types
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Source_CcType
9
+ {
10
+ public function toOptionArray()
11
+ {
12
+
13
+ $options = array();
14
+
15
+ foreach (Mage::getSingleton('hipay/config')->getCcTypes() as $code => $name) {
16
+ $options[] = array(
17
+ 'value' => $code,
18
+ 'label' => $name
19
+ );
20
+ }
21
+
22
+ return $options;
23
+ }
24
+ }
app/code/community/Allopass/Hipay/Model/Source/CcTypeHosted.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Allopass Hipay Credit cards types
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Source_CcTypeHosted
9
+ {
10
+ public function toOptionArray()
11
+ {
12
+
13
+ $options = array();
14
+
15
+ foreach (Mage::getSingleton('hipay/config')->getCcTypesCodeHipay() as $code => $name) {
16
+ $options[] = array(
17
+ 'value' => $code,
18
+ 'label' => $name
19
+ );
20
+ }
21
+
22
+ return $options;
23
+ }
24
+ }
app/code/community/Allopass/Hipay/Model/Source/Order/HipayStatusValidate.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Source_Order_HipayStatusValidate
4
+ {
5
+ public function toOptionArray() {
6
+ $options = array();
7
+
8
+ $options[] = array(
9
+ 'value' => 117,
10
+ 'label' => Mage::helper('hipay')->__('Capture Requested')
11
+ );
12
+
13
+ $options[] = array(
14
+ 'value' => 118,
15
+ 'label' => Mage::helper('hipay')->__('Capture')
16
+ );
17
+
18
+ return $options;
19
+ }
20
+ }
app/code/community/Allopass/Hipay/Model/Source/Order/Status.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Source_Order_Status {
4
+
5
+ // set null to enable all possible
6
+ protected $_stateStatuses = array();
7
+
8
+ public function toOptionArray() {
9
+ if ($this->_stateStatuses) {
10
+ $statuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->_stateStatuses);
11
+ } else {
12
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
13
+ }
14
+ $options = array();
15
+ $options[] = array(
16
+ 'value' => '',
17
+ 'label' => Mage::helper('adminhtml')->__('-- Please Select --')
18
+ );
19
+ foreach ($statuses as $code => $label) {
20
+ $options[] = array(
21
+ 'value' => $code,
22
+ 'label' => $label
23
+ );
24
+ }
25
+ return $options;
26
+ }
27
+
28
+ }
app/code/community/Allopass/Hipay/Model/Source/Order/Status/Accepted.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Source_Order_Status_Accepted extends Allopass_Hipay_Model_Source_Order_Status {
4
+
5
+ // set null to enable all possible
6
+ protected $_stateStatuses = array(
7
+ Mage_Sales_Model_Order::STATE_NEW,
8
+ Mage_Sales_Model_Order::STATE_PROCESSING,
9
+ Mage_Sales_Model_Order::STATE_COMPLETE
10
+ );
11
+
12
+ }
app/code/community/Allopass/Hipay/Model/Source/Order/Status/Canceled.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Source_Order_Status_Canceled extends Allopass_Hipay_Model_Source_Order_Status {
4
+
5
+ // set null to enable all possible
6
+ protected $_stateStatuses = array(
7
+ Mage_Sales_Model_Order::STATE_HOLDED,
8
+ Mage_Sales_Model_Order::STATE_CANCELED
9
+ );
10
+
11
+ }
app/code/community/Allopass/Hipay/Model/Source/Order/Status/New.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Source_Order_Status_New extends Allopass_Hipay_Model_Source_Order_Status {
4
+
5
+ // set null to enable all possible
6
+ protected $_stateStatuses = array(
7
+ Mage_Sales_Model_Order::STATE_NEW,
8
+ Mage_Sales_Model_Order::STATE_PROCESSING
9
+ );
10
+
11
+ }
app/code/community/Allopass/Hipay/Model/Source/Order/Status/Refused.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Model_Source_Order_Status_Refused extends Allopass_Hipay_Model_Source_Order_Status {
4
+
5
+ // set null to enable all possible
6
+ protected $_stateStatuses = array(
7
+ Mage_Sales_Model_Order::STATE_HOLDED,
8
+ Mage_Sales_Model_Order::STATE_CANCELED,
9
+ Mage_Sales_Model_Order::STATE_CLOSED
10
+ );
11
+
12
+ }
app/code/community/Allopass/Hipay/Model/Source/PaymentAction.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Allopass Hipay Payment Action Dropdown source
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Source_PaymentAction
9
+ {
10
+ public function toOptionArray()
11
+ {
12
+ return array(
13
+ array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, 'label' => Mage::helper('hipay')->__('Authorization')),
14
+ array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, 'label' => Mage::helper('hipay')->__('Sale')),
15
+ );
16
+ }
17
+ }
app/code/community/Allopass/Hipay/Model/Source/Pendingredirect.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Allopass Hipay redirect url for pending
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Source_Pendingredirect
9
+ {
10
+ public function toOptionArray()
11
+ {
12
+
13
+ return array(
14
+ array('value' => 'hipay/checkout/pending', 'label' => Mage::helper('hipay')->__('Pending page')),
15
+ array('value' => 'checkout/onepage/success', 'label' => Mage::helper('hipay')->__('Success page')),
16
+ array('value' => 'checkout/onepage/failure', 'label' => Mage::helper('hipay')->__('Failure page')),
17
+ );
18
+ }
19
+ }
app/code/community/Allopass/Hipay/Model/Source/Template.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Allopass Hipay templates types
6
+ *
7
+ */
8
+ class Allopass_Hipay_Model_Source_Template
9
+ {
10
+ /*public function toOptionArray()
11
+ {
12
+
13
+ return array(
14
+ array('value' => 'basic', 'label' => Mage::helper('hipay')->__('basic')),
15
+ array('value' => 'basic2', 'label' => Mage::helper('hipay')->__('basic2')),
16
+ array('value' => 'basic3', 'label' => Mage::helper('hipay')->__('basic3')),
17
+ array('value' => 'basic4', 'label' => Mage::helper('hipay')->__('basic4')),
18
+ );
19
+ }*/
20
+
21
+ public function toOptionArray()
22
+ {
23
+
24
+ $options = array();
25
+
26
+ foreach (Mage::getSingleton('hipay/config')->getTemplateHosted() as $value => $label) {
27
+ $options[] = array(
28
+ 'value' => $value,
29
+ 'label' => $label
30
+ );
31
+ }
32
+
33
+ return $options;
34
+ }
35
+ }
app/code/community/Allopass/Hipay/controllers/Adminhtml/RuleController.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Allopass_Hipay_Adminhtml_RuleController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+
7
+ public function newConditionHtmlAction()
8
+ {
9
+ $id = $this->getRequest()->getParam('id');
10
+ $typeArr = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
11
+ $type = $typeArr[0];
12
+ $method_code = $typeArr[2];
13
+ $id = str_replace("_".$method_code, "", $id);
14
+ $model = Mage::getModel($type)
15
+ ->setId($id)
16
+ ->setType($type)
17
+ ->setRule(Mage::getModel('hipay/rule'))
18
+ ->setPrefix('conditions')
19
+ ->setPaymentMethodCode($method_code);
20
+ if (!empty($typeArr[1])) {
21
+ $model->setAttribute($typeArr[1]);
22
+ }
23
+
24
+ if ($model instanceof Mage_Rule_Model_Condition_Abstract) {
25
+ $model->setJsFormObject($this->getRequest()->getParam('form'));
26
+ $html = $model->asHtmlRecursive();
27
+ } else {
28
+ $html = '';
29
+ }
30
+ $this->getResponse()->setBody($html);
31
+ }
32
+
33
+
34
+
35
+
36
+
37
+ }
app/code/community/Allopass/Hipay/controllers/CbcController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_CbcController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_cbc');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/CcController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_CcController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+
5
+
6
+ /**
7
+ *
8
+ * @return Allopass_Hipay_Model_Method_Cc $methodInstance
9
+ */
10
+ protected function _getMethodInstance()
11
+ {
12
+ return Mage::getSingleton('hipay/method_cc'); ;
13
+ }
14
+
15
+ }
app/code/community/Allopass/Hipay/controllers/CheckoutController.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_CheckoutController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+
6
+
7
+ /**
8
+ * @return Mage_Core_Controller_Front_Action
9
+ */
10
+ public function preDispatch() {
11
+ parent::preDispatch();
12
+ //Mage::log($this->getRequest()->getParams(),null,$this->getRequest()->getActionName() . ".log");
13
+ }
14
+
15
+
16
+ public function pendingAction()
17
+ {
18
+
19
+ $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
20
+ $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
21
+ $this->getOnepage()->getCheckout()->setErrorMessage("");
22
+ if (!$lastQuoteId || !$lastOrderId) {
23
+ $this->_redirect('checkout/cart');
24
+ return;
25
+ }
26
+
27
+ $this->loadLayout();
28
+ $this->renderLayout();
29
+ }
30
+
31
+ /**
32
+ * Get one page checkout model
33
+ *
34
+ * @return Mage_Checkout_Model_Type_Onepage
35
+ */
36
+ public function getOnepage()
37
+ {
38
+ return Mage::getSingleton('checkout/type_onepage');
39
+ }
40
+ }
app/code/community/Allopass/Hipay/controllers/DexiaController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_DexiaController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_dexia');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/GiropayController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_GiropayController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_giropay');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/HostedController.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_HostedController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+
5
+
6
+ protected function _getMethodInstance()
7
+ {
8
+ return Mage::getSingleton('hipay/method_hosted'); ;
9
+ }
10
+
11
+
12
+ }
app/code/community/Allopass/Hipay/controllers/IdealController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_IdealController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_ideal');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/IngController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_IngController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_ing');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/KbcController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_KbcController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_kbc');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/NotifyController.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_NotifyController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ /**
5
+ *
6
+ * @var Mage_Sales_Model_Order $order
7
+ */
8
+ protected $_order = null;
9
+
10
+
11
+ /**
12
+ * @return Mage_Core_Controller_Front_Action
13
+ */
14
+ public function preDispatch() {
15
+ parent::preDispatch();
16
+
17
+ //Mage::log($this->getRequest()->getParams(),null,$this->getRequest()->getActionName() . ".log");
18
+ if (!$this->_validateSignature()) {
19
+ $this->getResponse()->setBody("NOK. Wrong Signature!");
20
+ $this->setFlag('', 'no-dispatch', true);
21
+ }
22
+ }
23
+
24
+ protected function _validateSignature()
25
+ {
26
+ /* @var $_helper Allopass_Hipay_Helper_Data */
27
+ $_helper = Mage::helper('hipay');
28
+
29
+
30
+ $signature = $this->getRequest()->getServer('HTTP_X_ALLOPASS_SIGNATURE');
31
+ return $_helper->checkSignature($signature,true);
32
+ }
33
+
34
+
35
+
36
+ public function indexAction()
37
+ {
38
+ /* @var $response Allopass_Hipay_Model_Api_Response_Notification */
39
+ $response = Mage::getSingleton('hipay/api_response_notification',$this->getRequest()->getParams());
40
+ $orderArr = $response->getOrder();
41
+
42
+ /* @var $order Mage_Sales_Model_Order */
43
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderArr['id']);
44
+
45
+ if(!$order->getId() && strpos($orderArr['id'], 'recurring') === false)
46
+ Mage::throwException("Order not found in notification");
47
+
48
+ if(strpos($orderArr['id'], 'recurring') !== false)
49
+ {
50
+ //return $this;
51
+
52
+ list($action,$type,$profileId) = explode("-", $orderArr['id']);
53
+
54
+ if($profileId)
55
+ {
56
+ /* @var $profile Mage_Sales_Model_Recurring_Profile */
57
+ $profile = Mage::getModel('sales/recurring_profile')->load($profileId);
58
+ if($profile->getId())
59
+ {
60
+
61
+
62
+ if($action == 'create' || $action == "payment")
63
+ {
64
+ //$order = $this->createProfileOrder($profile, $response);
65
+ }
66
+
67
+ //return $this;
68
+
69
+ }
70
+ else
71
+ Mage::throwException(Mage::helper('hipay')->__("Profile for ID: %d doesn't exists (Recurring).",$profileId));
72
+ }
73
+ else
74
+ Mage::throwException(Mage::helper('hipay')->__("Order Id not present (Recurring)."));
75
+
76
+ }
77
+
78
+ $payment = $order->getPayment();
79
+ /* @var $methodInstance Allopass_Hipay_Model_Method_Abstract */
80
+ $methodInstance = $payment->getMethodInstance();
81
+ $methodInstance->debugData($response->debug());
82
+ $amount = 0;
83
+ if((int)$response->getRefundedAmount() == 0 && (int)$response->getCapturedAmount() == 0)
84
+ $amount = $response->getAuthorizedAmount();
85
+ elseif((int)$response->getRefundedAmount() == 0 && (int)$response->getCapturedAmount() > 0 )
86
+ $amount = $response->getCapturedAmount();
87
+ else
88
+ $amount = $response->getRefundedAmount();
89
+
90
+ $transactionId = $response->getTransactionReference();
91
+
92
+
93
+ $methodInstance->processResponse($response, $payment, $amount);
94
+
95
+
96
+ $message = Mage::helper('hipay')->__("Notification from Hipay:") . " " . Mage::helper('hipay')->__("status") . ": ". $response->getStatus(). " Message: " .$response->getMessage()." ".Mage::helper('hipay')->__('amount: %s',(string)$amount);
97
+ //
98
+ $order->addStatusToHistory($order->getStatus(), $message);
99
+ $order->save();
100
+
101
+ return $this;
102
+
103
+
104
+ }
105
+
106
+ /**
107
+ *
108
+ * @param Mage_Sales_Model_Recurring_Profile $profile
109
+ * @param Allopass_Hipay_Model_Api_Response_Notification $response
110
+ * @return Mage_Sales_Model_Order
111
+ */
112
+ protected function createProfileOrder(Mage_Sales_Model_Recurring_Profile $profile,Allopass_Hipay_Model_Api_Response_Notification $response)
113
+ {
114
+
115
+ $amount = $this->getAmountFromProfile($profile);
116
+
117
+ $productItemInfo = new Varien_Object;
118
+ $type = "Regular";
119
+ if ($type == 'Trial') {
120
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL);
121
+ } elseif ($type == 'Regular') {
122
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
123
+ }
124
+
125
+ if($this->isInitialProfileOrder($profile))// because is not additonned in prodile obj
126
+ $productItemInfo->setPrice($profile->getBillingAmount() + $profile->getInitAmount());
127
+
128
+ /* @var $order Mage_Sales_Model_Order */
129
+ $order = $profile->createOrder($productItemInfo);
130
+
131
+ //$this->responseToPayment($order->getPayment(),$response);
132
+ $additionalInfo = $profile->getAdditionalInfo();
133
+
134
+ $order->getPayment()->setCcType($additionalInfo['ccType']);
135
+ $order->getPayment()->setCcExpMonth($additionalInfo['ccExpMonth']);
136
+ $order->getPayment()->setCcExpYear($additionalInfo['ccExpYear']);
137
+ $order->getPayment()->setAdditionalInformation('token',$additionalInfo['token']);
138
+ $order->getPayment()->setAdditionalInformation('create_oneclick',$additionalInfo['create_oneclick']);
139
+ $order->getPayment()->setAdditionalInformation('use_oneclick',$additionalInfo['use_oneclick']);
140
+
141
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW,'pending',Mage::helper('hipay')->__("New Order Recurring!"));
142
+
143
+ $order->save();
144
+
145
+ $profile->addOrderRelation($order->getId());
146
+ $profile->save();
147
+
148
+ return $order;
149
+
150
+
151
+ $order->getPayment()->registerCaptureNotification($amount);
152
+ $order->save();
153
+
154
+ // notify customer
155
+ if ($invoice = $order->getPayment()->getCreatedInvoice()) {
156
+ $message = Mage::helper('hipay')->__('Notified customer about invoice #%s.', $invoice->getIncrementId());
157
+ $comment = $order->sendNewOrderEmail()->addStatusHistoryComment($message)
158
+ ->setIsCustomerNotified(true)
159
+ ->save();
160
+
161
+ /* Add this to send invoice to customer */
162
+ $invoice->setEmailSent(true);
163
+ $invoice->save();
164
+ $invoice->sendEmail();
165
+ }
166
+
167
+ return $order;
168
+
169
+ }
170
+
171
+ /**
172
+ * Add method to calculate amount from recurring profile
173
+ * @param Mage_Sales_Model_Recurring_Profile $profile
174
+ * @return int $amount
175
+ **/
176
+ public function getAmountFromProfile(Mage_Sales_Model_Recurring_Profile $profile) {
177
+ $amount = $profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount();
178
+
179
+ if($this->isInitialProfileOrder($profile))
180
+ $amount += $profile->getInitAmount() ;
181
+
182
+ return $amount;
183
+ }
184
+
185
+ protected function isInitialProfileOrder(Mage_Sales_Model_Recurring_Profile $profile)
186
+ {
187
+ if(count($profile->getChildOrderIds()) && current($profile->getChildOrderIds()) == "-1")
188
+ return true;
189
+
190
+ return false;
191
+ }
192
+
193
+ }
app/code/community/Allopass/Hipay/controllers/Przelewy24Controller.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Przelewy24Controller extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_przelewy24');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/Przelewy24apiController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Przelewy24apiController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_przelewy24Api');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/QiwiController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_QiwiController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_qiwi');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/SisalController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_SisalController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_sisal');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/SisalapiController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_SisalapiController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_sisalApi');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/SofortController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_SofortController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_sofort');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/SofortapiController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_SofortapiController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_sofortApi');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/WebmoneyController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_WebmoneyController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_webmoney');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/WebmoneyapiController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_WebmoneyapiController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_webmoneyApi');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/YandexController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_YandexController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_yandex');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/YandexapiController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_YandexapiController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_yandexApi');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/etc/config.xml ADDED
@@ -0,0 +1,637 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Allopass_Hipay>
5
+ <version>1.0.0</version>
6
+ </Allopass_Hipay>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <hipay>
11
+ <class>Allopass_Hipay_Block</class>
12
+ </hipay>
13
+ </blocks>
14
+ <helpers>
15
+ <hipay>
16
+ <class>Allopass_Hipay_Helper</class>
17
+ </hipay>
18
+ </helpers>
19
+ <models>
20
+ <hipay>
21
+ <class>Allopass_Hipay_Model</class>
22
+ <resourceModel>hipay_resource</resourceModel>
23
+ </hipay>
24
+ <hipay_resource>
25
+ <class>Allopass_Hipay_Model_Resource</class>
26
+ <!-- <deprecatedNode>hipay_mysql4</deprecatedNode> -->
27
+ <entities>
28
+ <rule>
29
+ <table>hipay_rule</table>
30
+ </rule>
31
+ </entities>
32
+ </hipay_resource>
33
+ </models>
34
+ <resources>
35
+ <allopass_hipay_setup>
36
+ <setup>
37
+ <module>Allopass_Hipay</module>
38
+ </setup>
39
+ </allopass_hipay_setup>
40
+ </resources>
41
+ <template_hipay>
42
+ <hosted>
43
+ <basic>
44
+ <label>Basic</label>
45
+ <value>basic</value>
46
+ </basic>
47
+ <basicjs>
48
+ <label>Basic-js</label>
49
+ <value>basic-js</value>
50
+ </basicjs>
51
+ </hosted>
52
+ </template_hipay>
53
+ <payment_hipay>
54
+ <cc>
55
+ <types>
56
+ <AE>
57
+ <code>AE</code>
58
+ <code_hipay>american-express</code_hipay>
59
+ <name>American Express</name>
60
+ <order>0</order>
61
+ </AE>
62
+ <VI>
63
+ <code>VI</code>
64
+ <code_hipay>visa</code_hipay>
65
+ <name>Visa</name>
66
+ <order>10</order>
67
+ </VI>
68
+ <MC>
69
+ <code>MC</code>
70
+ <code_hipay>mastercard</code_hipay>
71
+ <name>MasterCard</name>
72
+ <order>20</order>
73
+ </MC>
74
+ <SM>
75
+ <code>SM</code>
76
+ <code_hipay>maestro</code_hipay>
77
+ <name>Maestro</name>
78
+ <order>40</order>
79
+ </SM>
80
+ <BCMC>
81
+ <code>BCMC</code>
82
+ <code_hipay>bcmc</code_hipay>
83
+ <name>Bancontact / Mister Cash</name>
84
+ <order>60</order>
85
+ </BCMC>
86
+ </types>
87
+ </cc>
88
+ <hosted>
89
+ <types>
90
+ <AE>
91
+ <code>AE</code>
92
+ <code_hipay>american-express</code_hipay>
93
+ <name>American Express</name>
94
+ <order>0</order>
95
+ </AE>
96
+ <VI>
97
+ <code>VI</code>
98
+ <code_hipay>visa</code_hipay>
99
+ <name>Visa</name>
100
+ <order>10</order>
101
+ </VI>
102
+ <MC>
103
+ <code>MC</code>
104
+ <code_hipay>mastercard</code_hipay>
105
+ <name>MasterCard</name>
106
+ <order>20</order>
107
+ </MC>
108
+ <SM>
109
+ <code>SM</code>
110
+ <code_hipay>maestro</code_hipay>
111
+ <name>Maestro</name>
112
+ <order>30</order>
113
+ </SM>
114
+ <BCMC>
115
+ <code>BCMC</code>
116
+ <code_hipay>bcmc</code_hipay>
117
+ <name>Bancontact / Mister Cash</name>
118
+ <order>60</order>
119
+ </BCMC>
120
+ </types>
121
+ </hosted>
122
+ </payment_hipay>
123
+ <sales>
124
+ <order>
125
+ <statuses>
126
+ <!-- retained for backwards compatibility, not used after version 1.4.2 -->
127
+ <pending_capture translate="label"><label>Pending Capture</label></pending_capture>
128
+ <capture_requested translate="label"><label>Capture Requested</label></capture_requested>
129
+ <refund_requested translate="label"><label>Refund Requested</label></refund_requested>
130
+ </statuses>
131
+ </order>
132
+ </sales>
133
+ </global>
134
+ <frontend>
135
+ <secure_url>
136
+ <hipay_payment>/hipay/payment</hipay_payment>
137
+ </secure_url>
138
+ <routers>
139
+ <hipay>
140
+ <use>standard</use>
141
+ <args>
142
+ <module>Allopass_Hipay</module>
143
+ <frontName>hipay</frontName>
144
+ </args>
145
+ </hipay>
146
+ </routers>
147
+ <translate>
148
+ <modules>
149
+ <Allopass_Hipay>
150
+ <files>
151
+ <default>Allopass_Hipay.csv</default>
152
+ </files>
153
+ </Allopass_Hipay>
154
+ </modules>
155
+ </translate>
156
+ <layout>
157
+ <updates>
158
+ <hipay>
159
+ <file>hipay.xml</file>
160
+ </hipay>
161
+ </updates>
162
+ </layout>
163
+ <events>
164
+ <controller_action_postdispatch_checkout_onepage_saveOrder>
165
+ <observers>
166
+ <displaySectionCheckoutIframe>
167
+ <class>hipay/observer</class>
168
+ <method>displaySectionCheckoutIframe</method>
169
+ </displaySectionCheckoutIframe>
170
+ </observers>
171
+ </controller_action_postdispatch_checkout_onepage_saveOrder>
172
+ </events>
173
+ </frontend>
174
+ <adminhtml>
175
+ <routers>
176
+ <hipay>
177
+ <use>admin</use>
178
+ <args>
179
+ <module>Allopass_Hipay</module>
180
+ <frontName>hipay</frontName>
181
+ </args>
182
+ </hipay>
183
+ </routers>
184
+ <translate>
185
+ <modules>
186
+ <Allopass_Hipay>
187
+ <files>
188
+ <default>Allopass_Hipay.csv</default>
189
+ </files>
190
+ </Allopass_Hipay>
191
+ </modules>
192
+ </translate>
193
+ <acl>
194
+ <resources>
195
+ <admin>
196
+ <children>
197
+ <system>
198
+ <children>
199
+ <config>
200
+ <children>
201
+ <hipay>
202
+ <title>Hipay API Configuration</title>
203
+ </hipay>
204
+ <payment>
205
+ <children>
206
+ <hipay_cc translate="title">
207
+ <title>Hipay Credit Card</title>
208
+ </hipay_cc>
209
+ </children>
210
+ </payment>
211
+ </children>
212
+ </config>
213
+ </children>
214
+ </system>
215
+ </children>
216
+ </admin>
217
+ </resources>
218
+ </acl>
219
+ <layout>
220
+ <updates>
221
+ <hipay>
222
+ <file>hipay.xml</file>
223
+ </hipay>
224
+ </updates>
225
+ </layout>
226
+ </adminhtml>
227
+ <default>
228
+ <hipay>
229
+ <hipay_api>
230
+ <api_password backend_model="adminhtml/system_config_backend_encrypted"/>
231
+ <api_password_test backend_model="adminhtml/system_config_backend_encrypted"/>
232
+ <secret_passphrase backend_model="adminhtml/system_config_backend_encrypted"/>
233
+ <vault_endpoint_stage>https://stage-secure-vault.allopass.com/rest/v1/token/</vault_endpoint_stage>
234
+ <vault_endpoint_production>https://secure-vault.allopass.com/rest/v1/token/</vault_endpoint_production>
235
+ <gateway_endpoint_stage>https://stage-secure-gateway.allopass.com/rest/v1/</gateway_endpoint_stage>
236
+ <gateway_endpoint_production>https://secure-gateway.allopass.com/rest/v1/</gateway_endpoint_production>
237
+ </hipay_api>
238
+ </hipay>
239
+ <payment>
240
+ <hipay_cc>
241
+ <active>0</active>
242
+ <title>HiPay Credit Card</title>
243
+ <payment_action>authorize_capture</payment_action>
244
+ <cctypes>AE,VI,MC</cctypes>
245
+ <useccv>1</useccv>
246
+ <order_status_payment_accepted>processing</order_status_payment_accepted>
247
+ <order_status_payment_refused>canceled</order_status_payment_refused>
248
+ <order_status_payment_canceled>canceled</order_status_payment_canceled>
249
+ <hipay_status_validate_order>118</hipay_status_validate_order>
250
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page>
251
+ <allow_use_oneclick>0</allow_use_oneclick>
252
+ <invoice_create>1</invoice_create>
253
+ <re_add_to_cart>0</re_add_to_cart>
254
+ <cancel_pending_order>1</cancel_pending_order>
255
+ <is_test_mode>0</is_test_mode>
256
+ <debug>0</debug>
257
+ <model>hipay/method_cc</model>
258
+ <accept_url>hipay/cc/accept</accept_url>
259
+ <pending_url>hipay/cc/pending</pending_url>
260
+ <decline_url>hipay/cc/decline</decline_url>
261
+ <exception_url>hipay/cc/exception</exception_url>
262
+ <cancel_url>hipay/cc/cancel</cancel_url>
263
+ <use_3d_secure>1</use_3d_secure>
264
+ </hipay_cc>
265
+ <hipay_hosted>
266
+ <active>0</active>
267
+ <title>HiPay Hosted</title>
268
+ <payment_action>authorize_capture</payment_action>
269
+ <cctypes>american-express,visa,mastercard</cctypes>
270
+ <order_status_payment_accepted>processing</order_status_payment_accepted>
271
+ <order_status_payment_refused>canceled</order_status_payment_refused>
272
+ <order_status_payment_canceled>canceled</order_status_payment_canceled>
273
+ <hipay_status_validate_order>118</hipay_status_validate_order>
274
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page>
275
+ <display_selector>1</display_selector>
276
+ <template>basic</template>
277
+ <allow_use_oneclick>0</allow_use_oneclick>
278
+ <invoice_create>1</invoice_create>
279
+ <re_add_to_cart>0</re_add_to_cart>
280
+ <cancel_pending_order>1</cancel_pending_order>
281
+ <display_iframe>0</display_iframe>
282
+ <iframe_width>450</iframe_width>
283
+ <iframe_height>670</iframe_height>
284
+ <iframe_style>border:1px solid #CCC;border-radius:15px;padding:10px;max-width:500px;</iframe_style>
285
+ <is_test_mode>0</is_test_mode>
286
+ <debug>0</debug>
287
+ <model>hipay/method_hosted</model>
288
+ <accept_url>hipay/hosted/accept</accept_url>
289
+ <pending_url>hipay/hosted/pending</pending_url>
290
+ <decline_url>hipay/hosted/decline</decline_url>
291
+ <exception_url>hipay/hosted/exception</exception_url>
292
+ <cancel_url>hipay/hosted/cancel</cancel_url>
293
+ <use_3d_secure>1</use_3d_secure>
294
+ </hipay_hosted>
295
+ <hipay_sofortapi>
296
+ <active>0</active> <!-- Activé ou non -->
297
+ <title>HiPay Sofort</title> <!-- Titre par défaut modifiable en admin -->
298
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
299
+ <cctypes>sofort-uberweisung</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
300
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
301
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
302
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
303
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
304
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
305
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
306
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
307
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
308
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
309
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
310
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
311
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
312
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
313
+ <model>hipay/method_sofortApi</model><!-- Classe model de la méthode -->
314
+ <accept_url>hipay/sofortapi/accept</accept_url><!-- Url accept de la méthode -->
315
+ <pending_url>hipay/sofortapi/pending</pending_url><!-- Url pending de la méthode -->
316
+ <decline_url>hipay/sofortapi/decline</decline_url><!-- Url decline de la méthode -->
317
+ <exception_url>hipay/sofortapi/exception</exception_url><!-- Url execption de la méthode -->
318
+ <cancel_url>hipay/sofortapi/cancel</cancel_url><!-- Url cancel de la méthode -->
319
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
320
+ </hipay_sofortapi>
321
+ <hipay_ideal>
322
+ <active>0</active> <!-- Activé ou non -->
323
+ <title>HiPay iDeal</title> <!-- Titre par défaut modifiable en admin -->
324
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
325
+ <cctypes>ideal</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
326
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
327
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
328
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
329
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
330
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
331
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
332
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
333
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
334
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
335
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
336
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
337
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
338
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
339
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
340
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
341
+ <model>hipay/method_ideal</model><!-- Classe model de la méthode -->
342
+ <accept_url>hipay/ideal/accept</accept_url><!-- Url accept de la méthode -->
343
+ <pending_url>hipay/ideal/pending</pending_url><!-- Url pending de la méthode -->
344
+ <decline_url>hipay/ideal/decline</decline_url><!-- Url decline de la méthode -->
345
+ <exception_url>hipay/ideal/exception</exception_url><!-- Url execption de la méthode -->
346
+ <cancel_url>hipay/ideal/cancel</cancel_url><!-- Url cancel de la méthode -->
347
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
348
+ </hipay_ideal>
349
+ <hipay_ing>
350
+ <active>0</active> <!-- Activé ou non -->
351
+ <title>HiPay ING Home'Pay</title> <!-- Titre par défaut modifiable en admin -->
352
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
353
+ <cctypes>ing-homepay</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
354
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
355
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
356
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
357
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
358
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
359
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
360
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
361
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
362
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
363
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
364
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
365
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
366
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
367
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
368
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
369
+ <model>hipay/method_ing</model><!-- Classe model de la méthode -->
370
+ <accept_url>hipay/ing/accept</accept_url><!-- Url accept de la méthode -->
371
+ <pending_url>hipay/ing/pending</pending_url><!-- Url pending de la méthode -->
372
+ <decline_url>hipay/ing/decline</decline_url><!-- Url decline de la méthode -->
373
+ <exception_url>hipay/ing/exception</exception_url><!-- Url execption de la méthode -->
374
+ <cancel_url>hipay/ing/cancel</cancel_url><!-- Url cancel de la méthode -->
375
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
376
+ </hipay_ing>
377
+ <hipay_dexia>
378
+ <active>0</active> <!-- Activé ou non -->
379
+ <title>HiPay Belfius / Dexia Direct Net</title> <!-- Titre par défaut modifiable en admin -->
380
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
381
+ <cctypes>dexia-directnet</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
382
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
383
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
384
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
385
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
386
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
387
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
388
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
389
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
390
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
391
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
392
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
393
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
394
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
395
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
396
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
397
+ <model>hipay/method_dexia</model><!-- Classe model de la méthode -->
398
+ <accept_url>hipay/dexia/accept</accept_url><!-- Url accept de la méthode -->
399
+ <pending_url>hipay/dexia/pending</pending_url><!-- Url pending de la méthode -->
400
+ <decline_url>hipay/dexia/decline</decline_url><!-- Url decline de la méthode -->
401
+ <exception_url>hipay/dexia/exception</exception_url><!-- Url execption de la méthode -->
402
+ <cancel_url>hipay/dexia/cancel</cancel_url><!-- Url cancel de la méthode -->
403
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
404
+ </hipay_dexia>
405
+ <hipay_cbc>
406
+ <active>0</active> <!-- Activé ou non -->
407
+ <title>HiPay CBC Online</title> <!-- Titre par défaut modifiable en admin -->
408
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
409
+ <cctypes>cbc-online</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
410
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
411
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
412
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
413
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
414
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
415
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
416
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
417
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
418
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
419
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
420
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
421
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
422
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
423
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
424
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
425
+ <model>hipay/method_cbc</model><!-- Classe model de la méthode -->
426
+ <accept_url>hipay/cbc/accept</accept_url><!-- Url accept de la méthode -->
427
+ <pending_url>hipay/cbc/pending</pending_url><!-- Url pending de la méthode -->
428
+ <decline_url>hipay/cbc/decline</decline_url><!-- Url decline de la méthode -->
429
+ <exception_url>hipay/cbc/exception</exception_url><!-- Url execption de la méthode -->
430
+ <cancel_url>hipay/cbc/cancel</cancel_url><!-- Url cancel de la méthode -->
431
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
432
+ </hipay_cbc>
433
+ <hipay_kbc>
434
+ <active>0</active> <!-- Activé ou non -->
435
+ <title>HiPay KBC Online</title> <!-- Titre par défaut modifiable en admin -->
436
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
437
+ <cctypes>kbc-online</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
438
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
439
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
440
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
441
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
442
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
443
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
444
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
445
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
446
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
447
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
448
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
449
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
450
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
451
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
452
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
453
+ <model>hipay/method_kbc</model><!-- Classe model de la méthode -->
454
+ <accept_url>hipay/kbc/accept</accept_url><!-- Url accept de la méthode -->
455
+ <pending_url>hipay/kbc/pending</pending_url><!-- Url pending de la méthode -->
456
+ <decline_url>hipay/kbc/decline</decline_url><!-- Url decline de la méthode -->
457
+ <exception_url>hipay/kbc/exception</exception_url><!-- Url execption de la méthode -->
458
+ <cancel_url>hipay/kbc/cancel</cancel_url><!-- Url cancel de la méthode -->
459
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
460
+ </hipay_kbc>
461
+ <hipay_giropay>
462
+ <active>0</active> <!-- Activé ou non -->
463
+ <title>HiPay Giropay</title> <!-- Titre par défaut modifiable en admin -->
464
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
465
+ <cctypes>giropay</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
466
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
467
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
468
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
469
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
470
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
471
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
472
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
473
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
474
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
475
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
476
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
477
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
478
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
479
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
480
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
481
+ <model>hipay/method_giropay</model><!-- Classe model de la méthode -->
482
+ <accept_url>hipay/giropay/accept</accept_url><!-- Url accept de la méthode -->
483
+ <pending_url>hipay/giropay/pending</pending_url><!-- Url pending de la méthode -->
484
+ <decline_url>hipay/giropay/decline</decline_url><!-- Url decline de la méthode -->
485
+ <exception_url>hipay/giropay/exception</exception_url><!-- Url execption de la méthode -->
486
+ <cancel_url>hipay/giropay/cancel</cancel_url><!-- Url cancel de la méthode -->
487
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
488
+ </hipay_giropay>
489
+ <hipay_przelewy24api>
490
+ <active>0</active> <!-- Activé ou non -->
491
+ <title>HiPay Przelewy24</title> <!-- Titre par défaut modifiable en admin -->
492
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
493
+ <cctypes>przelewy24</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
494
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
495
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
496
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
497
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
498
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
499
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
500
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
501
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
502
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
503
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
504
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
505
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
506
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
507
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
508
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
509
+ <model>hipay/method_przelewy24Api</model><!-- Classe model de la méthode -->
510
+ <accept_url>hipay/przelewy24api/accept</accept_url><!-- Url accept de la méthode -->
511
+ <pending_url>hipay/przelewy24api/pending</pending_url><!-- Url pending de la méthode -->
512
+ <decline_url>hipay/przelewy24api/decline</decline_url><!-- Url decline de la méthode -->
513
+ <exception_url>hipay/przelewy24api/exception</exception_url><!-- Url execption de la méthode -->
514
+ <cancel_url>hipay/przelewy24api/cancel</cancel_url><!-- Url cancel de la méthode -->
515
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
516
+ </hipay_przelewy24api>
517
+ <hipay_sisalapi>
518
+ <active>0</active> <!-- Activé ou non -->
519
+ <title>HiPay Sisal</title> <!-- Titre par défaut modifiable en admin -->
520
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
521
+ <cctypes>sisal</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
522
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
523
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
524
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
525
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
526
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
527
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
528
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
529
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
530
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
531
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
532
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
533
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
534
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
535
+ <model>hipay/method_sisalApi</model><!-- Classe model de la méthode -->
536
+ <accept_url>hipay/sisalapi/accept</accept_url><!-- Url accept de la méthode -->
537
+ <pending_url>hipay/sisalapi/pending</pending_url><!-- Url pending de la méthode -->
538
+ <decline_url>hipay/sisalapi/decline</decline_url><!-- Url decline de la méthode -->
539
+ <exception_url>hipay/sisalapi/exception</exception_url><!-- Url execption de la méthode -->
540
+ <cancel_url>hipay/sisalapi/cancel</cancel_url><!-- Url cancel de la méthode -->
541
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
542
+ </hipay_sisalapi>
543
+ <hipay_qiwi>
544
+ <active>0</active> <!-- Activé ou non -->
545
+ <title>HiPay Visa Qiwi Wallet</title> <!-- Titre par défaut modifiable en admin -->
546
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
547
+ <cctypes>qiwi-wallet</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
548
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
549
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
550
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
551
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
552
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
553
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
554
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
555
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
556
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
557
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
558
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
559
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
560
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
561
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
562
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
563
+ <model>hipay/method_qiwi</model><!-- Classe model de la méthode -->
564
+ <accept_url>hipay/qiwi/accept</accept_url><!-- Url accept de la méthode -->
565
+ <pending_url>hipay/qiwi/pending</pending_url><!-- Url pending de la méthode -->
566
+ <decline_url>hipay/qiwi/decline</decline_url><!-- Url decline de la méthode -->
567
+ <exception_url>hipay/qiwi/exception</exception_url><!-- Url execption de la méthode -->
568
+ <cancel_url>hipay/qiwi/cancel</cancel_url><!-- Url cancel de la méthode -->
569
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
570
+ </hipay_qiwi>
571
+ <hipay_webmoneyapi>
572
+ <active>0</active> <!-- Activé ou non -->
573
+ <title>HiPay WebMoney Transfer</title> <!-- Titre par défaut modifiable en admin -->
574
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
575
+ <cctypes>webmoney-transfer</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
576
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
577
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
578
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
579
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
580
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
581
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
582
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
583
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
584
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
585
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
586
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
587
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
588
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
589
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
590
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
591
+ <model>hipay/method_webmoneyApi</model><!-- Classe model de la méthode -->
592
+ <accept_url>hipay/webmoneyapi/accept</accept_url><!-- Url accept de la méthode -->
593
+ <pending_url>hipay/webmoneyapi/pending</pending_url><!-- Url pending de la méthode -->
594
+ <decline_url>hipay/webmoneyapi/decline</decline_url><!-- Url decline de la méthode -->
595
+ <exception_url>hipay/webmoneyapi/exception</exception_url><!-- Url execption de la méthode -->
596
+ <cancel_url>hipay/webmoneyapi/cancel</cancel_url><!-- Url cancel de la méthode -->
597
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
598
+ </hipay_webmoneyapi>
599
+ <hipay_yandexapi>
600
+ <active>0</active> <!-- Activé ou non -->
601
+ <title>HiPay Yandex.Money</title> <!-- Titre par défaut modifiable en admin -->
602
+ <payment_action>authorize_capture</payment_action> <!-- Type d'action de paiement (authorize_capture ou authorize) -->
603
+ <cctypes>yandex</cctypes> <!-- Types de carte disponibles (valeur Hipay pour le mode hosted, valeur Magento pour le mode API) -->
604
+ <!-- <useccv>1</useccv> --> <!-- permet de rendre obligatoire la saisie du CCV (uniquement en mode API) -->
605
+ <order_status_payment_accepted>processing</order_status_payment_accepted><!-- valeur par défaut du statut quand le paiement est accepté -->
606
+ <order_status_payment_refused>canceled</order_status_payment_refused><!-- valeur par défaut du statut quand le paiement est refusé -->
607
+ <order_status_payment_canceled>canceled</order_status_payment_canceled><!-- valeur par défaut du statut quand le paiement est annulé -->
608
+ <hipay_status_validate_order>118</hipay_status_validate_order><!-- valeur par défaut du statut hipay qui valide la commande (118 ou 117)-->
609
+ <pending_redirect_page>hipay/checkout/pending</pending_redirect_page><!-- valeur par défaut pour la page de redirection en cas de state "pending"-->
610
+ <display_selector>0</display_selector><!-- valeur par défaut l'affichage du selecteur de carte (uniquement en mode Hosted)-->
611
+ <template>basic</template><!-- valeur par défaut du template de la page hénergé (uniquement en mode Hosted)-->
612
+ <allow_use_oneclick>0</allow_use_oneclick><!-- valeur par défaut de l'utilisation du oneclick -->
613
+ <invoice_create>1</invoice_create><!-- valeur par défaut de la création de la facture -->
614
+ <re_add_to_cart>0</re_add_to_cart><!-- valeur par défaut du re-remplissage du panier -->
615
+ <cancel_pending_order>1</cancel_pending_order><!-- valeur par défaut des annulation de commande "en attente" depuis 30 minutes -->
616
+ <display_iframe>0</display_iframe><!-- valeur par défaut mode Iframe (uniquement en mode Hosted)-->
617
+ <is_test_mode>0</is_test_mode><!-- valeur par défaut du mode test -->
618
+ <debug>0</debug><!-- valeur par défaut du mode debug -->
619
+ <model>hipay/method_yandexApi</model><!-- Classe model de la méthode -->
620
+ <accept_url>hipay/yandexapi/accept</accept_url><!-- Url accept de la méthode -->
621
+ <pending_url>hipay/yandexapi/pending</pending_url><!-- Url pending de la méthode -->
622
+ <decline_url>hipay/yandexapi/decline</decline_url><!-- Url decline de la méthode -->
623
+ <exception_url>hipay/yandexapi/exception</exception_url><!-- Url execption de la méthode -->
624
+ <cancel_url>hipay/yandexapi/cancel</cancel_url><!-- Url cancel de la méthode -->
625
+ <use_3d_secure>0</use_3d_secure><!-- valeur par défaut pour activer le 3ds -->
626
+ </hipay_yandexapi>
627
+ </payment>
628
+ </default>
629
+ <crontab>
630
+ <jobs>
631
+ <clean_orders_hipay_in_pending>
632
+ <schedule><cron_expr>*/15 * * * *</cron_expr></schedule>
633
+ <run><model>hipay/observer::cancelOrdersInPending</model></run>
634
+ </clean_orders_hipay_in_pending>
635
+ </jobs>
636
+ </crontab>
637
+ </config>
app/code/community/Allopass/Hipay/etc/system.xml ADDED
@@ -0,0 +1,2586 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <hipay translate="label" module="hipay">
5
+ <label>HiPay Fullservice</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>398</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
+ <groups>
13
+ <hipay_api>
14
+ <label>HiPay Fullservice credentials configuration</label>
15
+ <frontend_type>text</frontend_type>
16
+ <comment></comment>
17
+ <sort_order>10</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ <fields>
22
+ <api_username translate="label">
23
+ <label>Api username (production account)</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>10</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>0</show_in_store>
29
+ </api_username>
30
+ <api_password translate="label">
31
+ <label>Api password (production account)</label>
32
+ <frontend_type>obscure</frontend_type>
33
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
34
+ <sort_order>20</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </api_password>
39
+ <secret_passphrase translate="label comment">
40
+ <label>Secret passphrase (production account)</label>
41
+ <comment>The same of your HiPay Fullservice production account</comment>
42
+ <frontend_type>obscure</frontend_type>
43
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
44
+ <sort_order>25</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>0</show_in_store>
48
+ </secret_passphrase>
49
+ <api_username_test translate="label">
50
+ <label>Api username (test account)</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>30</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </api_username_test>
57
+ <api_password_test translate="label">
58
+ <label>Api password (test account)</label>
59
+ <frontend_type>obscure</frontend_type>
60
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
61
+ <sort_order>40</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </api_password_test>
66
+ </fields>
67
+ </hipay_api>
68
+ </groups>
69
+ </hipay>
70
+ <payment>
71
+ <groups>
72
+ <hipay_cc translate="label" module="hipay">
73
+ <label>HiPay Fullservice Credit Card</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>200</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ <fields>
80
+ <active translate="label">
81
+ <label>Enabled</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>10</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </active>
89
+ <title translate="label">
90
+ <label>Title</label>
91
+ <frontend_type>text</frontend_type>
92
+ <sort_order>20</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </title>
97
+ <order_status_payment_accepted translate="label">
98
+ <label>Order status when payment accepted</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>hipay/source_order_status_accepted</source_model>
101
+ <sort_order>23</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>0</show_in_store>
105
+ </order_status_payment_accepted>
106
+ <order_status_payment_refused translate="label">
107
+ <label>Order status when payment refused</label>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>hipay/source_order_status_refused</source_model>
110
+ <sort_order>24</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>0</show_in_store>
114
+ </order_status_payment_refused>
115
+ <order_status_payment_canceled translate="label">
116
+ <label>Order status when payment canceled by customer</label>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>hipay/source_order_status_canceled</source_model>
119
+ <sort_order>25</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>0</show_in_store>
123
+ </order_status_payment_canceled>
124
+ <hipay_status_validate_order translate="label">
125
+ <label>Hipay status to validate order</label>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
128
+ <sort_order>26</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>0</show_in_store>
132
+ </hipay_status_validate_order>
133
+ <pending_redirect_page translate="label">
134
+ <label>Redirect page pending status</label>
135
+ <comment>Page to redirect when transaction is in pending status</comment>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>hipay/source_pendingredirect</source_model>
138
+ <sort_order>27</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
+ </pending_redirect_page>
143
+ <payment_action translate="label">
144
+ <label>Payment Action</label>
145
+ <frontend_type>select</frontend_type>
146
+ <source_model>hipay/source_paymentAction</source_model>
147
+ <sort_order>30</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>0</show_in_store>
151
+ </payment_action>
152
+ <cctypes translate="label">
153
+ <label>Credit Card Types</label>
154
+ <frontend_type>multiselect</frontend_type>
155
+ <source_model>hipay/source_ccType</source_model>
156
+ <sort_order>40</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>0</show_in_store>
160
+ </cctypes>
161
+ <useccv translate="label">
162
+ <label>Credit Card Verification</label>
163
+ <frontend_type>select</frontend_type>
164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
165
+ <sort_order>50</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>0</show_in_store>
169
+ </useccv>
170
+ <use_3d_secure translate="label">
171
+ <label>Use 3D Secure</label>
172
+ <frontend_type>select</frontend_type>
173
+ <source_model>hipay/source_3ds</source_model>
174
+ <sort_order>60</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>0</show_in_store>
178
+ </use_3d_secure>
179
+ <config_3ds_rules translate="label comment">
180
+ <label>Rules 3D Secure</label>
181
+ <comment>Configure Rules to activate 3D Secure</comment>
182
+ <frontend_model>hipay/adminhtml_system_config_form_field_3dsRule</frontend_model>
183
+ <backend_model>hipay/rule_config</backend_model>
184
+ <sort_order>61</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>0</show_in_store>
188
+ </config_3ds_rules>
189
+ <allow_use_oneclick translate="label">
190
+ <label>Use Oneclick</label>
191
+ <frontend_type>select</frontend_type>
192
+ <source_model>adminhtml/system_config_source_yesno</source_model>
193
+ <sort_order>70</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>0</show_in_store>
197
+ </allow_use_oneclick>
198
+ <re_add_to_cart translate="label comment">
199
+ <label>Add product to cart</label>
200
+ <comment>Fill cart when payment canceled or refused</comment>
201
+ <frontend_type>select</frontend_type>
202
+ <source_model>adminhtml/system_config_source_yesno</source_model>
203
+ <sort_order>95</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>0</show_in_store>
207
+ </re_add_to_cart>
208
+ <cancel_pending_order translate="label comment">
209
+ <label>Cancel pending order</label>
210
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
211
+ <frontend_type>select</frontend_type>
212
+ <source_model>adminhtml/system_config_source_yesno</source_model>
213
+ <sort_order>97</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>1</show_in_website>
216
+ <show_in_store>0</show_in_store>
217
+ </cancel_pending_order>
218
+ <allowspecific translate="label">
219
+ <label>Payment from applicable countries</label>
220
+ <frontend_type>allowspecific</frontend_type>
221
+ <sort_order>100</sort_order>
222
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>1</show_in_store>
226
+ </allowspecific>
227
+ <specificcountry translate="label">
228
+ <label>Payment from Specific countries</label>
229
+ <frontend_type>multiselect</frontend_type>
230
+ <sort_order>110</sort_order>
231
+ <source_model>adminhtml/system_config_source_country</source_model>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ </specificcountry>
236
+ <min_order_total translate="label">
237
+ <label>Minimum Order Total</label>
238
+ <frontend_type>text</frontend_type>
239
+ <sort_order>120</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>1</show_in_store>
243
+ </min_order_total>
244
+ <max_order_total translate="label">
245
+ <label>Maximum Order Total</label>
246
+ <frontend_type>text</frontend_type>
247
+ <sort_order>121</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ </max_order_total>
252
+ <sort_order translate="label">
253
+ <label>Sort Order</label>
254
+ <frontend_type>text</frontend_type>
255
+ <sort_order>130</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ </sort_order>
260
+ <debug>
261
+ <label>Enable debug log</label>
262
+ <comment></comment>
263
+ <frontend_type>select</frontend_type>
264
+ <source_model>adminhtml/system_config_source_yesno</source_model>
265
+ <sort_order>150</sort_order>
266
+ <show_in_default>1</show_in_default>
267
+ <show_in_website>1</show_in_website>
268
+ <show_in_store>0</show_in_store>
269
+ </debug>
270
+ <is_test_mode translate="label comment">
271
+ <label>Enable test mode</label>
272
+ <comment></comment>
273
+ <frontend_type>select</frontend_type>
274
+ <source_model>adminhtml/system_config_source_yesno</source_model>
275
+ <sort_order>200</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>1</show_in_website>
278
+ <show_in_store>1</show_in_store>
279
+ </is_test_mode>
280
+ </fields>
281
+ </hipay_cc>
282
+ <hipay_hosted translate="label" module="hipay">
283
+ <label>HiPay Fullservice Hosted Page</label>
284
+ <frontend_type>text</frontend_type>
285
+ <sort_order>210</sort_order>
286
+ <show_in_default>1</show_in_default>
287
+ <show_in_website>1</show_in_website>
288
+ <show_in_store>1</show_in_store>
289
+ <fields>
290
+ <active translate="label">
291
+ <label>Enabled</label>
292
+ <frontend_type>select</frontend_type>
293
+ <source_model>adminhtml/system_config_source_yesno</source_model>
294
+ <sort_order>10</sort_order>
295
+ <show_in_default>1</show_in_default>
296
+ <show_in_website>1</show_in_website>
297
+ <show_in_store>1</show_in_store>
298
+ </active>
299
+ <title translate="label">
300
+ <label>Title</label>
301
+ <frontend_type>text</frontend_type>
302
+ <sort_order>20</sort_order>
303
+ <show_in_default>1</show_in_default>
304
+ <show_in_website>1</show_in_website>
305
+ <show_in_store>1</show_in_store>
306
+ </title>
307
+ <order_status_payment_accepted translate="label">
308
+ <label>Order status when payment accepted</label>
309
+ <frontend_type>select</frontend_type>
310
+ <source_model>hipay/source_order_status_accepted</source_model>
311
+ <sort_order>23</sort_order>
312
+ <show_in_default>1</show_in_default>
313
+ <show_in_website>1</show_in_website>
314
+ <show_in_store>0</show_in_store>
315
+ </order_status_payment_accepted>
316
+ <order_status_payment_refused translate="label">
317
+ <label>Order status when payment refused</label>
318
+ <frontend_type>select</frontend_type>
319
+ <source_model>hipay/source_order_status_refused</source_model>
320
+ <sort_order>24</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <show_in_store>0</show_in_store>
324
+ </order_status_payment_refused>
325
+ <order_status_payment_canceled translate="label">
326
+ <label>Order status when payment canceled by customer</label>
327
+ <frontend_type>select</frontend_type>
328
+ <source_model>hipay/source_order_status_canceled</source_model>
329
+ <sort_order>25</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
+ </order_status_payment_canceled>
334
+ <hipay_status_validate_order translate="label">
335
+ <label>Hipay status to validate order</label>
336
+ <frontend_type>select</frontend_type>
337
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
338
+ <sort_order>26</sort_order>
339
+ <show_in_default>1</show_in_default>
340
+ <show_in_website>1</show_in_website>
341
+ <show_in_store>0</show_in_store>
342
+ </hipay_status_validate_order>
343
+ <pending_redirect_page translate="label">
344
+ <label>Redirect page pending status</label>
345
+ <comment>Page to redirect when transaction is in pending status</comment>
346
+ <frontend_type>select</frontend_type>
347
+ <source_model>hipay/source_pendingredirect</source_model>
348
+ <sort_order>27</sort_order>
349
+ <show_in_default>1</show_in_default>
350
+ <show_in_website>1</show_in_website>
351
+ <show_in_store>0</show_in_store>
352
+ </pending_redirect_page>
353
+ <payment_action translate="label">
354
+ <label>Payment Action</label>
355
+ <frontend_type>select</frontend_type>
356
+ <source_model>hipay/source_paymentAction</source_model>
357
+ <sort_order>28</sort_order>
358
+ <show_in_default>1</show_in_default>
359
+ <show_in_website>1</show_in_website>
360
+ <show_in_store>0</show_in_store>
361
+ </payment_action>
362
+ <cctypes translate="label">
363
+ <label>Credit Card Types</label>
364
+ <frontend_type>multiselect</frontend_type>
365
+ <source_model>hipay/source_ccTypeHosted</source_model>
366
+ <sort_order>29</sort_order>
367
+ <show_in_default>1</show_in_default>
368
+ <show_in_website>1</show_in_website>
369
+ <show_in_store>0</show_in_store>
370
+ </cctypes>
371
+ <css_url translate="label coment">
372
+ <label>Css Url</label>
373
+ <comment>Important, HTTPS protocol is required</comment>
374
+ <frontend_type>text</frontend_type>
375
+ <sort_order>30</sort_order>
376
+ <show_in_default>1</show_in_default>
377
+ <show_in_website>1</show_in_website>
378
+ <show_in_store>1</show_in_store>
379
+ </css_url>
380
+ <template translate="label">
381
+ <label>Page payment template</label>
382
+ <frontend_type>select</frontend_type>
383
+ <source_model>hipay/source_template</source_model>
384
+ <sort_order>35</sort_order>
385
+ <show_in_default>1</show_in_default>
386
+ <show_in_website>1</show_in_website>
387
+ <show_in_store>0</show_in_store>
388
+ </template>
389
+ <display_iframe translate="label">
390
+ <label>Display hosted page in Iframe</label>
391
+ <frontend_type>select</frontend_type>
392
+ <source_model>adminhtml/system_config_source_yesno</source_model>
393
+ <sort_order>36</sort_order>
394
+ <show_in_default>1</show_in_default>
395
+ <show_in_website>1</show_in_website>
396
+ <show_in_store>0</show_in_store>
397
+ </display_iframe>
398
+ <iframe_width translate="label">
399
+ <label>iFrame Width</label>
400
+ <frontend_type>text</frontend_type>
401
+ <sort_order>37</sort_order>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>1</show_in_website>
404
+ <show_in_store>1</show_in_store>
405
+ </iframe_width>
406
+ <iframe_height translate="label">
407
+ <label>iFrame Height</label>
408
+ <frontend_type>text</frontend_type>
409
+ <sort_order>38</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
+ </iframe_height>
414
+ <iframe_style translate="label">
415
+ <label>iFrame Style</label>
416
+ <frontend_type>text</frontend_type>
417
+ <sort_order>39</sort_order>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ <show_in_store>1</show_in_store>
421
+ </iframe_style>
422
+ <display_selector translate="label">
423
+ <label>Display card selector</label>
424
+ <frontend_type>select</frontend_type>
425
+ <source_model>adminhtml/system_config_source_yesno</source_model>
426
+ <sort_order>40</sort_order>
427
+ <show_in_default>1</show_in_default>
428
+ <show_in_website>1</show_in_website>
429
+ <show_in_store>0</show_in_store>
430
+ </display_selector>
431
+ <use_3d_secure translate="label">
432
+ <label>Use 3D Secure</label>
433
+ <frontend_type>select</frontend_type>
434
+ <source_model>hipay/source_3ds</source_model>
435
+ <sort_order>60</sort_order>
436
+ <show_in_default>1</show_in_default>
437
+ <show_in_website>1</show_in_website>
438
+ <show_in_store>0</show_in_store>
439
+ </use_3d_secure>
440
+ <config_3ds_rules translate="label comment">
441
+ <label>Rules 3D Secure</label>
442
+ <comment>Configure Rules to activate 3D Secure</comment>
443
+ <frontend_model>hipay/adminhtml_system_config_form_field_3dsRule</frontend_model>
444
+ <backend_model>hipay/rule_config</backend_model>
445
+ <sort_order>61</sort_order>
446
+ <show_in_default>1</show_in_default>
447
+ <show_in_website>1</show_in_website>
448
+ <show_in_store>0</show_in_store>
449
+ </config_3ds_rules>
450
+ <allow_use_oneclick translate="label">
451
+ <label>Use Oneclick</label>
452
+ <frontend_type>select</frontend_type>
453
+ <source_model>adminhtml/system_config_source_yesno</source_model>
454
+ <sort_order>70</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
+ </allow_use_oneclick>
459
+ <re_add_to_cart translate="label comment">
460
+ <label>Add product to cart</label>
461
+ <comment>Fill cart when payment canceled or refused</comment>
462
+ <frontend_type>select</frontend_type>
463
+ <source_model>adminhtml/system_config_source_yesno</source_model>
464
+ <sort_order>95</sort_order>
465
+ <show_in_default>1</show_in_default>
466
+ <show_in_website>1</show_in_website>
467
+ <show_in_store>0</show_in_store>
468
+ </re_add_to_cart>
469
+ <cancel_pending_order translate="label comment">
470
+ <label>Cancel pending order</label>
471
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
472
+ <frontend_type>select</frontend_type>
473
+ <source_model>adminhtml/system_config_source_yesno</source_model>
474
+ <sort_order>97</sort_order>
475
+ <show_in_default>1</show_in_default>
476
+ <show_in_website>1</show_in_website>
477
+ <show_in_store>0</show_in_store>
478
+ </cancel_pending_order>
479
+ <allowspecific translate="label">
480
+ <label>Payment from applicable countries</label>
481
+ <frontend_type>allowspecific</frontend_type>
482
+ <sort_order>100</sort_order>
483
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
484
+ <show_in_default>1</show_in_default>
485
+ <show_in_website>1</show_in_website>
486
+ <show_in_store>1</show_in_store>
487
+ </allowspecific>
488
+ <specificcountry translate="label">
489
+ <label>Payment from Specific countries</label>
490
+ <frontend_type>multiselect</frontend_type>
491
+ <sort_order>110</sort_order>
492
+ <source_model>adminhtml/system_config_source_country</source_model>
493
+ <show_in_default>1</show_in_default>
494
+ <show_in_website>1</show_in_website>
495
+ <show_in_store>1</show_in_store>
496
+ </specificcountry>
497
+ <min_order_total translate="label">
498
+ <label>Minimum Order Total</label>
499
+ <frontend_type>text</frontend_type>
500
+ <sort_order>120</sort_order>
501
+ <show_in_default>1</show_in_default>
502
+ <show_in_website>1</show_in_website>
503
+ <show_in_store>1</show_in_store>
504
+ </min_order_total>
505
+ <max_order_total translate="label">
506
+ <label>Maximum Order Total</label>
507
+ <frontend_type>text</frontend_type>
508
+ <sort_order>121</sort_order>
509
+ <show_in_default>1</show_in_default>
510
+ <show_in_website>1</show_in_website>
511
+ <show_in_store>1</show_in_store>
512
+ </max_order_total>
513
+ <sort_order translate="label">
514
+ <label>Sort Order</label>
515
+ <frontend_type>text</frontend_type>
516
+ <sort_order>130</sort_order>
517
+ <show_in_default>1</show_in_default>
518
+ <show_in_website>1</show_in_website>
519
+ <show_in_store>1</show_in_store>
520
+ </sort_order>
521
+ <debug translate="label">
522
+ <label>Enable debug log</label>
523
+ <comment></comment>
524
+ <frontend_type>select</frontend_type>
525
+ <source_model>adminhtml/system_config_source_yesno</source_model>
526
+ <sort_order>150</sort_order>
527
+ <show_in_default>1</show_in_default>
528
+ <show_in_website>1</show_in_website>
529
+ <show_in_store>0</show_in_store>
530
+ </debug>
531
+ <is_test_mode translate="label comment">
532
+ <label>Enable test mode</label>
533
+ <comment></comment>
534
+ <frontend_type>select</frontend_type>
535
+ <source_model>adminhtml/system_config_source_yesno</source_model>
536
+ <sort_order>200</sort_order>
537
+ <show_in_default>1</show_in_default>
538
+ <show_in_website>1</show_in_website>
539
+ <show_in_store>1</show_in_store>
540
+ </is_test_mode>
541
+ </fields>
542
+ </hipay_hosted>
543
+ <hipay_ideal translate="label" module="hipay">
544
+ <label>HiPay Fullservice iDeal</label>
545
+ <frontend_type>text</frontend_type>
546
+ <sort_order>220</sort_order>
547
+ <show_in_default>1</show_in_default>
548
+ <show_in_website>1</show_in_website>
549
+ <show_in_store>1</show_in_store>
550
+ <fields>
551
+ <active translate="label">
552
+ <label>Enabled</label>
553
+ <frontend_type>select</frontend_type>
554
+ <source_model>adminhtml/system_config_source_yesno</source_model>
555
+ <sort_order>10</sort_order>
556
+ <show_in_default>1</show_in_default>
557
+ <show_in_website>1</show_in_website>
558
+ <show_in_store>1</show_in_store>
559
+ </active>
560
+ <title translate="label">
561
+ <label>Title</label>
562
+ <frontend_type>text</frontend_type>
563
+ <sort_order>20</sort_order>
564
+ <show_in_default>1</show_in_default>
565
+ <show_in_website>1</show_in_website>
566
+ <show_in_store>1</show_in_store>
567
+ </title>
568
+ <order_status_payment_accepted translate="label">
569
+ <label>Order status when payment accepted</label>
570
+ <frontend_type>select</frontend_type>
571
+ <source_model>hipay/source_order_status_accepted</source_model>
572
+ <sort_order>23</sort_order>
573
+ <show_in_default>1</show_in_default>
574
+ <show_in_website>1</show_in_website>
575
+ <show_in_store>0</show_in_store>
576
+ </order_status_payment_accepted>
577
+ <order_status_payment_refused translate="label">
578
+ <label>Order status when payment refused</label>
579
+ <frontend_type>select</frontend_type>
580
+ <source_model>hipay/source_order_status_refused</source_model>
581
+ <sort_order>24</sort_order>
582
+ <show_in_default>1</show_in_default>
583
+ <show_in_website>1</show_in_website>
584
+ <show_in_store>0</show_in_store>
585
+ </order_status_payment_refused>
586
+ <order_status_payment_canceled translate="label">
587
+ <label>Order status when payment canceled by customer</label>
588
+ <frontend_type>select</frontend_type>
589
+ <source_model>hipay/source_order_status_canceled</source_model>
590
+ <sort_order>25</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
+ </order_status_payment_canceled>
595
+ <hipay_status_validate_order translate="label">
596
+ <label>Hipay status to validate order</label>
597
+ <frontend_type>select</frontend_type>
598
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
599
+ <sort_order>26</sort_order>
600
+ <show_in_default>1</show_in_default>
601
+ <show_in_website>1</show_in_website>
602
+ <show_in_store>0</show_in_store>
603
+ </hipay_status_validate_order>
604
+ <pending_redirect_page translate="label">
605
+ <label>Redirect page pending status</label>
606
+ <comment>Page to redirect when transaction is in pending status</comment>
607
+ <frontend_type>select</frontend_type>
608
+ <source_model>hipay/source_pendingredirect</source_model>
609
+ <sort_order>27</sort_order>
610
+ <show_in_default>1</show_in_default>
611
+ <show_in_website>1</show_in_website>
612
+ <show_in_store>0</show_in_store>
613
+ </pending_redirect_page>
614
+ <css_url translate="label coment">
615
+ <label>Css Url</label>
616
+ <comment>Important, HTTPS protocol is required</comment>
617
+ <frontend_type>text</frontend_type>
618
+ <sort_order>30</sort_order>
619
+ <show_in_default>1</show_in_default>
620
+ <show_in_website>1</show_in_website>
621
+ <show_in_store>1</show_in_store>
622
+ </css_url>
623
+ <template translate="label">
624
+ <label>Page payment template</label>
625
+ <frontend_type>select</frontend_type>
626
+ <source_model>hipay/source_template</source_model>
627
+ <sort_order>35</sort_order>
628
+ <show_in_default>1</show_in_default>
629
+ <show_in_website>1</show_in_website>
630
+ <show_in_store>0</show_in_store>
631
+ </template>
632
+ <re_add_to_cart translate="label comment">
633
+ <label>Add product to cart</label>
634
+ <comment>Fill cart when payment canceled or refused</comment>
635
+ <frontend_type>select</frontend_type>
636
+ <source_model>adminhtml/system_config_source_yesno</source_model>
637
+ <sort_order>95</sort_order>
638
+ <show_in_default>1</show_in_default>
639
+ <show_in_website>1</show_in_website>
640
+ <show_in_store>0</show_in_store>
641
+ </re_add_to_cart>
642
+ <cancel_pending_order translate="label comment">
643
+ <label>Cancel pending order</label>
644
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
645
+ <frontend_type>select</frontend_type>
646
+ <source_model>adminhtml/system_config_source_yesno</source_model>
647
+ <sort_order>97</sort_order>
648
+ <show_in_default>1</show_in_default>
649
+ <show_in_website>1</show_in_website>
650
+ <show_in_store>0</show_in_store>
651
+ </cancel_pending_order>
652
+ <allowspecific translate="label">
653
+ <label>Payment from applicable countries</label>
654
+ <frontend_type>allowspecific</frontend_type>
655
+ <sort_order>100</sort_order>
656
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
657
+ <show_in_default>1</show_in_default>
658
+ <show_in_website>1</show_in_website>
659
+ <show_in_store>1</show_in_store>
660
+ </allowspecific>
661
+ <specificcountry translate="label">
662
+ <label>Payment from Specific countries</label>
663
+ <frontend_type>multiselect</frontend_type>
664
+ <sort_order>110</sort_order>
665
+ <source_model>adminhtml/system_config_source_country</source_model>
666
+ <show_in_default>1</show_in_default>
667
+ <show_in_website>1</show_in_website>
668
+ <show_in_store>1</show_in_store>
669
+ </specificcountry>
670
+ <min_order_total translate="label">
671
+ <label>Minimum Order Total</label>
672
+ <frontend_type>text</frontend_type>
673
+ <sort_order>120</sort_order>
674
+ <show_in_default>1</show_in_default>
675
+ <show_in_website>1</show_in_website>
676
+ <show_in_store>1</show_in_store>
677
+ </min_order_total>
678
+ <max_order_total translate="label">
679
+ <label>Maximum Order Total</label>
680
+ <frontend_type>text</frontend_type>
681
+ <sort_order>121</sort_order>
682
+ <show_in_default>1</show_in_default>
683
+ <show_in_website>1</show_in_website>
684
+ <show_in_store>1</show_in_store>
685
+ </max_order_total>
686
+ <sort_order translate="label">
687
+ <label>Sort Order</label>
688
+ <frontend_type>text</frontend_type>
689
+ <sort_order>130</sort_order>
690
+ <show_in_default>1</show_in_default>
691
+ <show_in_website>1</show_in_website>
692
+ <show_in_store>1</show_in_store>
693
+ </sort_order>
694
+ <debug translate="label">
695
+ <label>Enable debug log</label>
696
+ <comment></comment>
697
+ <frontend_type>select</frontend_type>
698
+ <source_model>adminhtml/system_config_source_yesno</source_model>
699
+ <sort_order>150</sort_order>
700
+ <show_in_default>1</show_in_default>
701
+ <show_in_website>1</show_in_website>
702
+ <show_in_store>0</show_in_store>
703
+ </debug>
704
+ <is_test_mode translate="label comment">
705
+ <label>Enable test mode</label>
706
+ <comment></comment>
707
+ <frontend_type>select</frontend_type>
708
+ <source_model>adminhtml/system_config_source_yesno</source_model>
709
+ <sort_order>200</sort_order>
710
+ <show_in_default>1</show_in_default>
711
+ <show_in_website>1</show_in_website>
712
+ <show_in_store>1</show_in_store>
713
+ </is_test_mode>
714
+ </fields>
715
+ </hipay_ideal>
716
+ <hipay_ing translate="label" module="hipay">
717
+ <label>HiPay Fullservice ING Home'Pay</label>
718
+ <frontend_type>text</frontend_type>
719
+ <sort_order>220</sort_order>
720
+ <show_in_default>1</show_in_default>
721
+ <show_in_website>1</show_in_website>
722
+ <show_in_store>1</show_in_store>
723
+ <fields>
724
+ <active translate="label">
725
+ <label>Enabled</label>
726
+ <frontend_type>select</frontend_type>
727
+ <source_model>adminhtml/system_config_source_yesno</source_model>
728
+ <sort_order>10</sort_order>
729
+ <show_in_default>1</show_in_default>
730
+ <show_in_website>1</show_in_website>
731
+ <show_in_store>1</show_in_store>
732
+ </active>
733
+ <title translate="label">
734
+ <label>Title</label>
735
+ <frontend_type>text</frontend_type>
736
+ <sort_order>20</sort_order>
737
+ <show_in_default>1</show_in_default>
738
+ <show_in_website>1</show_in_website>
739
+ <show_in_store>1</show_in_store>
740
+ </title>
741
+ <order_status_payment_accepted translate="label">
742
+ <label>Order status when payment accepted</label>
743
+ <frontend_type>select</frontend_type>
744
+ <source_model>hipay/source_order_status_accepted</source_model>
745
+ <sort_order>23</sort_order>
746
+ <show_in_default>1</show_in_default>
747
+ <show_in_website>1</show_in_website>
748
+ <show_in_store>0</show_in_store>
749
+ </order_status_payment_accepted>
750
+ <order_status_payment_refused translate="label">
751
+ <label>Order status when payment refused</label>
752
+ <frontend_type>select</frontend_type>
753
+ <source_model>hipay/source_order_status_refused</source_model>
754
+ <sort_order>24</sort_order>
755
+ <show_in_default>1</show_in_default>
756
+ <show_in_website>1</show_in_website>
757
+ <show_in_store>0</show_in_store>
758
+ </order_status_payment_refused>
759
+ <order_status_payment_canceled translate="label">
760
+ <label>Order status when payment canceled by customer</label>
761
+ <frontend_type>select</frontend_type>
762
+ <source_model>hipay/source_order_status_canceled</source_model>
763
+ <sort_order>25</sort_order>
764
+ <show_in_default>1</show_in_default>
765
+ <show_in_website>1</show_in_website>
766
+ <show_in_store>0</show_in_store>
767
+ </order_status_payment_canceled>
768
+ <hipay_status_validate_order translate="label">
769
+ <label>Hipay status to validate order</label>
770
+ <frontend_type>select</frontend_type>
771
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
772
+ <sort_order>26</sort_order>
773
+ <show_in_default>1</show_in_default>
774
+ <show_in_website>1</show_in_website>
775
+ <show_in_store>0</show_in_store>
776
+ </hipay_status_validate_order>
777
+ <pending_redirect_page translate="label">
778
+ <label>Redirect page pending status</label>
779
+ <comment>Page to redirect when transaction is in pending status</comment>
780
+ <frontend_type>select</frontend_type>
781
+ <source_model>hipay/source_pendingredirect</source_model>
782
+ <sort_order>27</sort_order>
783
+ <show_in_default>1</show_in_default>
784
+ <show_in_website>1</show_in_website>
785
+ <show_in_store>0</show_in_store>
786
+ </pending_redirect_page>
787
+ <css_url translate="label coment">
788
+ <label>Css Url</label>
789
+ <comment>Important, HTTPS protocol is required</comment>
790
+ <frontend_type>text</frontend_type>
791
+ <sort_order>30</sort_order>
792
+ <show_in_default>1</show_in_default>
793
+ <show_in_website>1</show_in_website>
794
+ <show_in_store>1</show_in_store>
795
+ </css_url>
796
+ <template translate="label">
797
+ <label>Page payment template</label>
798
+ <frontend_type>select</frontend_type>
799
+ <source_model>hipay/source_template</source_model>
800
+ <sort_order>35</sort_order>
801
+ <show_in_default>1</show_in_default>
802
+ <show_in_website>1</show_in_website>
803
+ <show_in_store>0</show_in_store>
804
+ </template>
805
+ <re_add_to_cart translate="label comment">
806
+ <label>Add product to cart</label>
807
+ <comment>Fill cart when payment canceled or refused</comment>
808
+ <frontend_type>select</frontend_type>
809
+ <source_model>adminhtml/system_config_source_yesno</source_model>
810
+ <sort_order>95</sort_order>
811
+ <show_in_default>1</show_in_default>
812
+ <show_in_website>1</show_in_website>
813
+ <show_in_store>0</show_in_store>
814
+ </re_add_to_cart>
815
+ <cancel_pending_order translate="label comment">
816
+ <label>Cancel pending order</label>
817
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
818
+ <frontend_type>select</frontend_type>
819
+ <source_model>adminhtml/system_config_source_yesno</source_model>
820
+ <sort_order>97</sort_order>
821
+ <show_in_default>1</show_in_default>
822
+ <show_in_website>1</show_in_website>
823
+ <show_in_store>0</show_in_store>
824
+ </cancel_pending_order>
825
+ <allowspecific translate="label">
826
+ <label>Payment from applicable countries</label>
827
+ <frontend_type>allowspecific</frontend_type>
828
+ <sort_order>100</sort_order>
829
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
830
+ <show_in_default>1</show_in_default>
831
+ <show_in_website>1</show_in_website>
832
+ <show_in_store>1</show_in_store>
833
+ </allowspecific>
834
+ <specificcountry translate="label">
835
+ <label>Payment from Specific countries</label>
836
+ <frontend_type>multiselect</frontend_type>
837
+ <sort_order>110</sort_order>
838
+ <source_model>adminhtml/system_config_source_country</source_model>
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
+ </specificcountry>
843
+ <min_order_total translate="label">
844
+ <label>Minimum Order Total</label>
845
+ <frontend_type>text</frontend_type>
846
+ <sort_order>120</sort_order>
847
+ <show_in_default>1</show_in_default>
848
+ <show_in_website>1</show_in_website>
849
+ <show_in_store>1</show_in_store>
850
+ </min_order_total>
851
+ <max_order_total translate="label">
852
+ <label>Maximum Order Total</label>
853
+ <frontend_type>text</frontend_type>
854
+ <sort_order>121</sort_order>
855
+ <show_in_default>1</show_in_default>
856
+ <show_in_website>1</show_in_website>
857
+ <show_in_store>1</show_in_store>
858
+ </max_order_total>
859
+ <sort_order translate="label">
860
+ <label>Sort Order</label>
861
+ <frontend_type>text</frontend_type>
862
+ <sort_order>130</sort_order>
863
+ <show_in_default>1</show_in_default>
864
+ <show_in_website>1</show_in_website>
865
+ <show_in_store>1</show_in_store>
866
+ </sort_order>
867
+ <debug translate="label">
868
+ <label>Enable debug log</label>
869
+ <comment></comment>
870
+ <frontend_type>select</frontend_type>
871
+ <source_model>adminhtml/system_config_source_yesno</source_model>
872
+ <sort_order>150</sort_order>
873
+ <show_in_default>1</show_in_default>
874
+ <show_in_website>1</show_in_website>
875
+ <show_in_store>0</show_in_store>
876
+ </debug>
877
+ <is_test_mode translate="label comment">
878
+ <label>Enable test mode</label>
879
+ <comment></comment>
880
+ <frontend_type>select</frontend_type>
881
+ <source_model>adminhtml/system_config_source_yesno</source_model>
882
+ <sort_order>200</sort_order>
883
+ <show_in_default>1</show_in_default>
884
+ <show_in_website>1</show_in_website>
885
+ <show_in_store>1</show_in_store>
886
+ </is_test_mode>
887
+ </fields>
888
+ </hipay_ing>
889
+ <hipay_dexia translate="label" module="hipay">
890
+ <label>HiPay Fullservice Belfius / Dexia Direct Net</label>
891
+ <frontend_type>text</frontend_type>
892
+ <sort_order>220</sort_order>
893
+ <show_in_default>1</show_in_default>
894
+ <show_in_website>1</show_in_website>
895
+ <show_in_store>1</show_in_store>
896
+ <fields>
897
+ <active translate="label">
898
+ <label>Enabled</label>
899
+ <frontend_type>select</frontend_type>
900
+ <source_model>adminhtml/system_config_source_yesno</source_model>
901
+ <sort_order>10</sort_order>
902
+ <show_in_default>1</show_in_default>
903
+ <show_in_website>1</show_in_website>
904
+ <show_in_store>1</show_in_store>
905
+ </active>
906
+ <title translate="label">
907
+ <label>Title</label>
908
+ <frontend_type>text</frontend_type>
909
+ <sort_order>20</sort_order>
910
+ <show_in_default>1</show_in_default>
911
+ <show_in_website>1</show_in_website>
912
+ <show_in_store>1</show_in_store>
913
+ </title>
914
+ <order_status_payment_accepted translate="label">
915
+ <label>Order status when payment accepted</label>
916
+ <frontend_type>select</frontend_type>
917
+ <source_model>hipay/source_order_status_accepted</source_model>
918
+ <sort_order>23</sort_order>
919
+ <show_in_default>1</show_in_default>
920
+ <show_in_website>1</show_in_website>
921
+ <show_in_store>0</show_in_store>
922
+ </order_status_payment_accepted>
923
+ <order_status_payment_refused translate="label">
924
+ <label>Order status when payment refused</label>
925
+ <frontend_type>select</frontend_type>
926
+ <source_model>hipay/source_order_status_refused</source_model>
927
+ <sort_order>24</sort_order>
928
+ <show_in_default>1</show_in_default>
929
+ <show_in_website>1</show_in_website>
930
+ <show_in_store>0</show_in_store>
931
+ </order_status_payment_refused>
932
+ <order_status_payment_canceled translate="label">
933
+ <label>Order status when payment canceled by customer</label>
934
+ <frontend_type>select</frontend_type>
935
+ <source_model>hipay/source_order_status_canceled</source_model>
936
+ <sort_order>25</sort_order>
937
+ <show_in_default>1</show_in_default>
938
+ <show_in_website>1</show_in_website>
939
+ <show_in_store>0</show_in_store>
940
+ </order_status_payment_canceled>
941
+ <hipay_status_validate_order translate="label">
942
+ <label>Hipay status to validate order</label>
943
+ <frontend_type>select</frontend_type>
944
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
945
+ <sort_order>26</sort_order>
946
+ <show_in_default>1</show_in_default>
947
+ <show_in_website>1</show_in_website>
948
+ <show_in_store>0</show_in_store>
949
+ </hipay_status_validate_order>
950
+ <pending_redirect_page translate="label">
951
+ <label>Redirect page pending status</label>
952
+ <comment>Page to redirect when transaction is in pending status</comment>
953
+ <frontend_type>select</frontend_type>
954
+ <source_model>hipay/source_pendingredirect</source_model>
955
+ <sort_order>27</sort_order>
956
+ <show_in_default>1</show_in_default>
957
+ <show_in_website>1</show_in_website>
958
+ <show_in_store>0</show_in_store>
959
+ </pending_redirect_page>
960
+ <css_url translate="label coment">
961
+ <label>Css Url</label>
962
+ <comment>Important, HTTPS protocol is required</comment>
963
+ <frontend_type>text</frontend_type>
964
+ <sort_order>30</sort_order>
965
+ <show_in_default>1</show_in_default>
966
+ <show_in_website>1</show_in_website>
967
+ <show_in_store>1</show_in_store>
968
+ </css_url>
969
+ <template translate="label">
970
+ <label>Page payment template</label>
971
+ <frontend_type>select</frontend_type>
972
+ <source_model>hipay/source_template</source_model>
973
+ <sort_order>35</sort_order>
974
+ <show_in_default>1</show_in_default>
975
+ <show_in_website>1</show_in_website>
976
+ <show_in_store>0</show_in_store>
977
+ </template>
978
+ <re_add_to_cart translate="label comment">
979
+ <label>Add product to cart</label>
980
+ <comment>Fill cart when payment canceled or refused</comment>
981
+ <frontend_type>select</frontend_type>
982
+ <source_model>adminhtml/system_config_source_yesno</source_model>
983
+ <sort_order>95</sort_order>
984
+ <show_in_default>1</show_in_default>
985
+ <show_in_website>1</show_in_website>
986
+ <show_in_store>0</show_in_store>
987
+ </re_add_to_cart>
988
+ <cancel_pending_order translate="label comment">
989
+ <label>Cancel pending order</label>
990
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
991
+ <frontend_type>select</frontend_type>
992
+ <source_model>adminhtml/system_config_source_yesno</source_model>
993
+ <sort_order>97</sort_order>
994
+ <show_in_default>1</show_in_default>
995
+ <show_in_website>1</show_in_website>
996
+ <show_in_store>0</show_in_store>
997
+ </cancel_pending_order>
998
+ <allowspecific translate="label">
999
+ <label>Payment from applicable countries</label>
1000
+ <frontend_type>allowspecific</frontend_type>
1001
+ <sort_order>100</sort_order>
1002
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1003
+ <show_in_default>1</show_in_default>
1004
+ <show_in_website>1</show_in_website>
1005
+ <show_in_store>1</show_in_store>
1006
+ </allowspecific>
1007
+ <specificcountry translate="label">
1008
+ <label>Payment from Specific countries</label>
1009
+ <frontend_type>multiselect</frontend_type>
1010
+ <sort_order>110</sort_order>
1011
+ <source_model>adminhtml/system_config_source_country</source_model>
1012
+ <show_in_default>1</show_in_default>
1013
+ <show_in_website>1</show_in_website>
1014
+ <show_in_store>1</show_in_store>
1015
+ </specificcountry>
1016
+ <min_order_total translate="label">
1017
+ <label>Minimum Order Total</label>
1018
+ <frontend_type>text</frontend_type>
1019
+ <sort_order>120</sort_order>
1020
+ <show_in_default>1</show_in_default>
1021
+ <show_in_website>1</show_in_website>
1022
+ <show_in_store>1</show_in_store>
1023
+ </min_order_total>
1024
+ <max_order_total translate="label">
1025
+ <label>Maximum Order Total</label>
1026
+ <frontend_type>text</frontend_type>
1027
+ <sort_order>121</sort_order>
1028
+ <show_in_default>1</show_in_default>
1029
+ <show_in_website>1</show_in_website>
1030
+ <show_in_store>1</show_in_store>
1031
+ </max_order_total>
1032
+ <sort_order translate="label">
1033
+ <label>Sort Order</label>
1034
+ <frontend_type>text</frontend_type>
1035
+ <sort_order>130</sort_order>
1036
+ <show_in_default>1</show_in_default>
1037
+ <show_in_website>1</show_in_website>
1038
+ <show_in_store>1</show_in_store>
1039
+ </sort_order>
1040
+ <debug translate="label">
1041
+ <label>Enable debug log</label>
1042
+ <comment></comment>
1043
+ <frontend_type>select</frontend_type>
1044
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1045
+ <sort_order>150</sort_order>
1046
+ <show_in_default>1</show_in_default>
1047
+ <show_in_website>1</show_in_website>
1048
+ <show_in_store>0</show_in_store>
1049
+ </debug>
1050
+ <is_test_mode translate="label comment">
1051
+ <label>Enable test mode</label>
1052
+ <comment></comment>
1053
+ <frontend_type>select</frontend_type>
1054
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1055
+ <sort_order>200</sort_order>
1056
+ <show_in_default>1</show_in_default>
1057
+ <show_in_website>1</show_in_website>
1058
+ <show_in_store>1</show_in_store>
1059
+ </is_test_mode>
1060
+ </fields>
1061
+ </hipay_dexia>
1062
+ <hipay_cbc translate="label" module="hipay">
1063
+ <label>HiPay Fullservice CBC Online</label>
1064
+ <frontend_type>text</frontend_type>
1065
+ <sort_order>220</sort_order>
1066
+ <show_in_default>1</show_in_default>
1067
+ <show_in_website>1</show_in_website>
1068
+ <show_in_store>1</show_in_store>
1069
+ <fields>
1070
+ <active translate="label">
1071
+ <label>Enabled</label>
1072
+ <frontend_type>select</frontend_type>
1073
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1074
+ <sort_order>10</sort_order>
1075
+ <show_in_default>1</show_in_default>
1076
+ <show_in_website>1</show_in_website>
1077
+ <show_in_store>1</show_in_store>
1078
+ </active>
1079
+ <title translate="label">
1080
+ <label>Title</label>
1081
+ <frontend_type>text</frontend_type>
1082
+ <sort_order>20</sort_order>
1083
+ <show_in_default>1</show_in_default>
1084
+ <show_in_website>1</show_in_website>
1085
+ <show_in_store>1</show_in_store>
1086
+ </title>
1087
+ <order_status_payment_accepted translate="label">
1088
+ <label>Order status when payment accepted</label>
1089
+ <frontend_type>select</frontend_type>
1090
+ <source_model>hipay/source_order_status_accepted</source_model>
1091
+ <sort_order>23</sort_order>
1092
+ <show_in_default>1</show_in_default>
1093
+ <show_in_website>1</show_in_website>
1094
+ <show_in_store>0</show_in_store>
1095
+ </order_status_payment_accepted>
1096
+ <order_status_payment_refused translate="label">
1097
+ <label>Order status when payment refused</label>
1098
+ <frontend_type>select</frontend_type>
1099
+ <source_model>hipay/source_order_status_refused</source_model>
1100
+ <sort_order>24</sort_order>
1101
+ <show_in_default>1</show_in_default>
1102
+ <show_in_website>1</show_in_website>
1103
+ <show_in_store>0</show_in_store>
1104
+ </order_status_payment_refused>
1105
+ <order_status_payment_canceled translate="label">
1106
+ <label>Order status when payment canceled by customer</label>
1107
+ <frontend_type>select</frontend_type>
1108
+ <source_model>hipay/source_order_status_canceled</source_model>
1109
+ <sort_order>25</sort_order>
1110
+ <show_in_default>1</show_in_default>
1111
+ <show_in_website>1</show_in_website>
1112
+ <show_in_store>0</show_in_store>
1113
+ </order_status_payment_canceled>
1114
+ <hipay_status_validate_order translate="label">
1115
+ <label>Hipay status to validate order</label>
1116
+ <frontend_type>select</frontend_type>
1117
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
1118
+ <sort_order>26</sort_order>
1119
+ <show_in_default>1</show_in_default>
1120
+ <show_in_website>1</show_in_website>
1121
+ <show_in_store>0</show_in_store>
1122
+ </hipay_status_validate_order>
1123
+ <pending_redirect_page translate="label">
1124
+ <label>Redirect page pending status</label>
1125
+ <comment>Page to redirect when transaction is in pending status</comment>
1126
+ <frontend_type>select</frontend_type>
1127
+ <source_model>hipay/source_pendingredirect</source_model>
1128
+ <sort_order>27</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
+ </pending_redirect_page>
1133
+ <css_url translate="label coment">
1134
+ <label>Css Url</label>
1135
+ <comment>Important, HTTPS protocol is required</comment>
1136
+ <frontend_type>text</frontend_type>
1137
+ <sort_order>30</sort_order>
1138
+ <show_in_default>1</show_in_default>
1139
+ <show_in_website>1</show_in_website>
1140
+ <show_in_store>1</show_in_store>
1141
+ </css_url>
1142
+ <template translate="label">
1143
+ <label>Page payment template</label>
1144
+ <frontend_type>select</frontend_type>
1145
+ <source_model>hipay/source_template</source_model>
1146
+ <sort_order>35</sort_order>
1147
+ <show_in_default>1</show_in_default>
1148
+ <show_in_website>1</show_in_website>
1149
+ <show_in_store>0</show_in_store>
1150
+ </template>
1151
+ <re_add_to_cart translate="label comment">
1152
+ <label>Add product to cart</label>
1153
+ <comment>Fill cart when payment canceled or refused</comment>
1154
+ <frontend_type>select</frontend_type>
1155
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1156
+ <sort_order>95</sort_order>
1157
+ <show_in_default>1</show_in_default>
1158
+ <show_in_website>1</show_in_website>
1159
+ <show_in_store>0</show_in_store>
1160
+ </re_add_to_cart>
1161
+ <cancel_pending_order translate="label comment">
1162
+ <label>Cancel pending order</label>
1163
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
1164
+ <frontend_type>select</frontend_type>
1165
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1166
+ <sort_order>97</sort_order>
1167
+ <show_in_default>1</show_in_default>
1168
+ <show_in_website>1</show_in_website>
1169
+ <show_in_store>0</show_in_store>
1170
+ </cancel_pending_order>
1171
+ <allowspecific translate="label">
1172
+ <label>Payment from applicable countries</label>
1173
+ <frontend_type>allowspecific</frontend_type>
1174
+ <sort_order>100</sort_order>
1175
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1176
+ <show_in_default>1</show_in_default>
1177
+ <show_in_website>1</show_in_website>
1178
+ <show_in_store>1</show_in_store>
1179
+ </allowspecific>
1180
+ <specificcountry translate="label">
1181
+ <label>Payment from Specific countries</label>
1182
+ <frontend_type>multiselect</frontend_type>
1183
+ <sort_order>110</sort_order>
1184
+ <source_model>adminhtml/system_config_source_country</source_model>
1185
+ <show_in_default>1</show_in_default>
1186
+ <show_in_website>1</show_in_website>
1187
+ <show_in_store>1</show_in_store>
1188
+ </specificcountry>
1189
+ <min_order_total translate="label">
1190
+ <label>Minimum Order Total</label>
1191
+ <frontend_type>text</frontend_type>
1192
+ <sort_order>120</sort_order>
1193
+ <show_in_default>1</show_in_default>
1194
+ <show_in_website>1</show_in_website>
1195
+ <show_in_store>1</show_in_store>
1196
+ </min_order_total>
1197
+ <max_order_total translate="label">
1198
+ <label>Maximum Order Total</label>
1199
+ <frontend_type>text</frontend_type>
1200
+ <sort_order>121</sort_order>
1201
+ <show_in_default>1</show_in_default>
1202
+ <show_in_website>1</show_in_website>
1203
+ <show_in_store>1</show_in_store>
1204
+ </max_order_total>
1205
+ <sort_order translate="label">
1206
+ <label>Sort Order</label>
1207
+ <frontend_type>text</frontend_type>
1208
+ <sort_order>130</sort_order>
1209
+ <show_in_default>1</show_in_default>
1210
+ <show_in_website>1</show_in_website>
1211
+ <show_in_store>1</show_in_store>
1212
+ </sort_order>
1213
+ <debug translate="label">
1214
+ <label>Enable debug log</label>
1215
+ <comment></comment>
1216
+ <frontend_type>select</frontend_type>
1217
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1218
+ <sort_order>150</sort_order>
1219
+ <show_in_default>1</show_in_default>
1220
+ <show_in_website>1</show_in_website>
1221
+ <show_in_store>0</show_in_store>
1222
+ </debug>
1223
+ <is_test_mode translate="label comment">
1224
+ <label>Enable test mode</label>
1225
+ <comment></comment>
1226
+ <frontend_type>select</frontend_type>
1227
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1228
+ <sort_order>200</sort_order>
1229
+ <show_in_default>1</show_in_default>
1230
+ <show_in_website>1</show_in_website>
1231
+ <show_in_store>1</show_in_store>
1232
+ </is_test_mode>
1233
+ </fields>
1234
+ </hipay_cbc>
1235
+ <hipay_kbc translate="label" module="hipay">
1236
+ <label>HiPay Fullservice KBC Online</label>
1237
+ <frontend_type>text</frontend_type>
1238
+ <sort_order>220</sort_order>
1239
+ <show_in_default>1</show_in_default>
1240
+ <show_in_website>1</show_in_website>
1241
+ <show_in_store>1</show_in_store>
1242
+ <fields>
1243
+ <active translate="label">
1244
+ <label>Enabled</label>
1245
+ <frontend_type>select</frontend_type>
1246
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1247
+ <sort_order>10</sort_order>
1248
+ <show_in_default>1</show_in_default>
1249
+ <show_in_website>1</show_in_website>
1250
+ <show_in_store>1</show_in_store>
1251
+ </active>
1252
+ <title translate="label">
1253
+ <label>Title</label>
1254
+ <frontend_type>text</frontend_type>
1255
+ <sort_order>20</sort_order>
1256
+ <show_in_default>1</show_in_default>
1257
+ <show_in_website>1</show_in_website>
1258
+ <show_in_store>1</show_in_store>
1259
+ </title>
1260
+ <order_status_payment_accepted translate="label">
1261
+ <label>Order status when payment accepted</label>
1262
+ <frontend_type>select</frontend_type>
1263
+ <source_model>hipay/source_order_status_accepted</source_model>
1264
+ <sort_order>23</sort_order>
1265
+ <show_in_default>1</show_in_default>
1266
+ <show_in_website>1</show_in_website>
1267
+ <show_in_store>0</show_in_store>
1268
+ </order_status_payment_accepted>
1269
+ <order_status_payment_refused translate="label">
1270
+ <label>Order status when payment refused</label>
1271
+ <frontend_type>select</frontend_type>
1272
+ <source_model>hipay/source_order_status_refused</source_model>
1273
+ <sort_order>24</sort_order>
1274
+ <show_in_default>1</show_in_default>
1275
+ <show_in_website>1</show_in_website>
1276
+ <show_in_store>0</show_in_store>
1277
+ </order_status_payment_refused>
1278
+ <order_status_payment_canceled translate="label">
1279
+ <label>Order status when payment canceled by customer</label>
1280
+ <frontend_type>select</frontend_type>
1281
+ <source_model>hipay/source_order_status_canceled</source_model>
1282
+ <sort_order>25</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
+ </order_status_payment_canceled>
1287
+ <hipay_status_validate_order translate="label">
1288
+ <label>Hipay status to validate order</label>
1289
+ <frontend_type>select</frontend_type>
1290
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
1291
+ <sort_order>26</sort_order>
1292
+ <show_in_default>1</show_in_default>
1293
+ <show_in_website>1</show_in_website>
1294
+ <show_in_store>0</show_in_store>
1295
+ </hipay_status_validate_order>
1296
+ <pending_redirect_page translate="label">
1297
+ <label>Redirect page pending status</label>
1298
+ <comment>Page to redirect when transaction is in pending status</comment>
1299
+ <frontend_type>select</frontend_type>
1300
+ <source_model>hipay/source_pendingredirect</source_model>
1301
+ <sort_order>27</sort_order>
1302
+ <show_in_default>1</show_in_default>
1303
+ <show_in_website>1</show_in_website>
1304
+ <show_in_store>0</show_in_store>
1305
+ </pending_redirect_page>
1306
+ <css_url translate="label coment">
1307
+ <label>Css Url</label>
1308
+ <comment>Important, HTTPS protocol is required</comment>
1309
+ <frontend_type>text</frontend_type>
1310
+ <sort_order>30</sort_order>
1311
+ <show_in_default>1</show_in_default>
1312
+ <show_in_website>1</show_in_website>
1313
+ <show_in_store>1</show_in_store>
1314
+ </css_url>
1315
+ <template translate="label">
1316
+ <label>Page payment template</label>
1317
+ <frontend_type>select</frontend_type>
1318
+ <source_model>hipay/source_template</source_model>
1319
+ <sort_order>35</sort_order>
1320
+ <show_in_default>1</show_in_default>
1321
+ <show_in_website>1</show_in_website>
1322
+ <show_in_store>0</show_in_store>
1323
+ </template>
1324
+ <re_add_to_cart translate="label comment">
1325
+ <label>Add product to cart</label>
1326
+ <comment>Fill cart when payment canceled or refused</comment>
1327
+ <frontend_type>select</frontend_type>
1328
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1329
+ <sort_order>95</sort_order>
1330
+ <show_in_default>1</show_in_default>
1331
+ <show_in_website>1</show_in_website>
1332
+ <show_in_store>0</show_in_store>
1333
+ </re_add_to_cart>
1334
+ <cancel_pending_order translate="label comment">
1335
+ <label>Cancel pending order</label>
1336
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
1337
+ <frontend_type>select</frontend_type>
1338
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1339
+ <sort_order>97</sort_order>
1340
+ <show_in_default>1</show_in_default>
1341
+ <show_in_website>1</show_in_website>
1342
+ <show_in_store>0</show_in_store>
1343
+ </cancel_pending_order>
1344
+ <allowspecific translate="label">
1345
+ <label>Payment from applicable countries</label>
1346
+ <frontend_type>allowspecific</frontend_type>
1347
+ <sort_order>100</sort_order>
1348
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1349
+ <show_in_default>1</show_in_default>
1350
+ <show_in_website>1</show_in_website>
1351
+ <show_in_store>1</show_in_store>
1352
+ </allowspecific>
1353
+ <specificcountry translate="label">
1354
+ <label>Payment from Specific countries</label>
1355
+ <frontend_type>multiselect</frontend_type>
1356
+ <sort_order>110</sort_order>
1357
+ <source_model>adminhtml/system_config_source_country</source_model>
1358
+ <show_in_default>1</show_in_default>
1359
+ <show_in_website>1</show_in_website>
1360
+ <show_in_store>1</show_in_store>
1361
+ </specificcountry>
1362
+ <min_order_total translate="label">
1363
+ <label>Minimum Order Total</label>
1364
+ <frontend_type>text</frontend_type>
1365
+ <sort_order>120</sort_order>
1366
+ <show_in_default>1</show_in_default>
1367
+ <show_in_website>1</show_in_website>
1368
+ <show_in_store>1</show_in_store>
1369
+ </min_order_total>
1370
+ <max_order_total translate="label">
1371
+ <label>Maximum Order Total</label>
1372
+ <frontend_type>text</frontend_type>
1373
+ <sort_order>121</sort_order>
1374
+ <show_in_default>1</show_in_default>
1375
+ <show_in_website>1</show_in_website>
1376
+ <show_in_store>1</show_in_store>
1377
+ </max_order_total>
1378
+ <sort_order translate="label">
1379
+ <label>Sort Order</label>
1380
+ <frontend_type>text</frontend_type>
1381
+ <sort_order>130</sort_order>
1382
+ <show_in_default>1</show_in_default>
1383
+ <show_in_website>1</show_in_website>
1384
+ <show_in_store>1</show_in_store>
1385
+ </sort_order>
1386
+ <debug translate="label">
1387
+ <label>Enable debug log</label>
1388
+ <comment></comment>
1389
+ <frontend_type>select</frontend_type>
1390
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1391
+ <sort_order>150</sort_order>
1392
+ <show_in_default>1</show_in_default>
1393
+ <show_in_website>1</show_in_website>
1394
+ <show_in_store>0</show_in_store>
1395
+ </debug>
1396
+ <is_test_mode translate="label comment">
1397
+ <label>Enable test mode</label>
1398
+ <comment></comment>
1399
+ <frontend_type>select</frontend_type>
1400
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1401
+ <sort_order>200</sort_order>
1402
+ <show_in_default>1</show_in_default>
1403
+ <show_in_website>1</show_in_website>
1404
+ <show_in_store>1</show_in_store>
1405
+ </is_test_mode>
1406
+ </fields>
1407
+ </hipay_kbc>
1408
+ <hipay_giropay translate="label" module="hipay">
1409
+ <label>HiPay Fullservice Giropay</label>
1410
+ <frontend_type>text</frontend_type>
1411
+ <sort_order>220</sort_order>
1412
+ <show_in_default>1</show_in_default>
1413
+ <show_in_website>1</show_in_website>
1414
+ <show_in_store>1</show_in_store>
1415
+ <fields>
1416
+ <active translate="label">
1417
+ <label>Enabled</label>
1418
+ <frontend_type>select</frontend_type>
1419
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1420
+ <sort_order>10</sort_order>
1421
+ <show_in_default>1</show_in_default>
1422
+ <show_in_website>1</show_in_website>
1423
+ <show_in_store>1</show_in_store>
1424
+ </active>
1425
+ <title translate="label">
1426
+ <label>Title</label>
1427
+ <frontend_type>text</frontend_type>
1428
+ <sort_order>20</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
+ </title>
1433
+ <order_status_payment_accepted translate="label">
1434
+ <label>Order status when payment accepted</label>
1435
+ <frontend_type>select</frontend_type>
1436
+ <source_model>hipay/source_order_status_accepted</source_model>
1437
+ <sort_order>23</sort_order>
1438
+ <show_in_default>1</show_in_default>
1439
+ <show_in_website>1</show_in_website>
1440
+ <show_in_store>0</show_in_store>
1441
+ </order_status_payment_accepted>
1442
+ <order_status_payment_refused translate="label">
1443
+ <label>Order status when payment refused</label>
1444
+ <frontend_type>select</frontend_type>
1445
+ <source_model>hipay/source_order_status_refused</source_model>
1446
+ <sort_order>24</sort_order>
1447
+ <show_in_default>1</show_in_default>
1448
+ <show_in_website>1</show_in_website>
1449
+ <show_in_store>0</show_in_store>
1450
+ </order_status_payment_refused>
1451
+ <order_status_payment_canceled translate="label">
1452
+ <label>Order status when payment canceled by customer</label>
1453
+ <frontend_type>select</frontend_type>
1454
+ <source_model>hipay/source_order_status_canceled</source_model>
1455
+ <sort_order>25</sort_order>
1456
+ <show_in_default>1</show_in_default>
1457
+ <show_in_website>1</show_in_website>
1458
+ <show_in_store>0</show_in_store>
1459
+ </order_status_payment_canceled>
1460
+ <hipay_status_validate_order translate="label">
1461
+ <label>Hipay status to validate order</label>
1462
+ <frontend_type>select</frontend_type>
1463
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
1464
+ <sort_order>26</sort_order>
1465
+ <show_in_default>1</show_in_default>
1466
+ <show_in_website>1</show_in_website>
1467
+ <show_in_store>0</show_in_store>
1468
+ </hipay_status_validate_order>
1469
+ <pending_redirect_page translate="label">
1470
+ <label>Redirect page pending status</label>
1471
+ <comment>Page to redirect when transaction is in pending status</comment>
1472
+ <frontend_type>select</frontend_type>
1473
+ <source_model>hipay/source_pendingredirect</source_model>
1474
+ <sort_order>27</sort_order>
1475
+ <show_in_default>1</show_in_default>
1476
+ <show_in_website>1</show_in_website>
1477
+ <show_in_store>0</show_in_store>
1478
+ </pending_redirect_page>
1479
+ <css_url translate="label coment">
1480
+ <label>Css Url</label>
1481
+ <comment>Important, HTTPS protocol is required</comment>
1482
+ <frontend_type>text</frontend_type>
1483
+ <sort_order>30</sort_order>
1484
+ <show_in_default>1</show_in_default>
1485
+ <show_in_website>1</show_in_website>
1486
+ <show_in_store>1</show_in_store>
1487
+ </css_url>
1488
+ <template translate="label">
1489
+ <label>Page payment template</label>
1490
+ <frontend_type>select</frontend_type>
1491
+ <source_model>hipay/source_template</source_model>
1492
+ <sort_order>35</sort_order>
1493
+ <show_in_default>1</show_in_default>
1494
+ <show_in_website>1</show_in_website>
1495
+ <show_in_store>0</show_in_store>
1496
+ </template>
1497
+ <re_add_to_cart translate="label comment">
1498
+ <label>Add product to cart</label>
1499
+ <comment>Fill cart when payment canceled or refused</comment>
1500
+ <frontend_type>select</frontend_type>
1501
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1502
+ <sort_order>95</sort_order>
1503
+ <show_in_default>1</show_in_default>
1504
+ <show_in_website>1</show_in_website>
1505
+ <show_in_store>0</show_in_store>
1506
+ </re_add_to_cart>
1507
+ <cancel_pending_order translate="label comment">
1508
+ <label>Cancel pending order</label>
1509
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
1510
+ <frontend_type>select</frontend_type>
1511
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1512
+ <sort_order>97</sort_order>
1513
+ <show_in_default>1</show_in_default>
1514
+ <show_in_website>1</show_in_website>
1515
+ <show_in_store>0</show_in_store>
1516
+ </cancel_pending_order>
1517
+ <allowspecific translate="label">
1518
+ <label>Payment from applicable countries</label>
1519
+ <frontend_type>allowspecific</frontend_type>
1520
+ <sort_order>100</sort_order>
1521
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1522
+ <show_in_default>1</show_in_default>
1523
+ <show_in_website>1</show_in_website>
1524
+ <show_in_store>1</show_in_store>
1525
+ </allowspecific>
1526
+ <specificcountry translate="label">
1527
+ <label>Payment from Specific countries</label>
1528
+ <frontend_type>multiselect</frontend_type>
1529
+ <sort_order>110</sort_order>
1530
+ <source_model>adminhtml/system_config_source_country</source_model>
1531
+ <show_in_default>1</show_in_default>
1532
+ <show_in_website>1</show_in_website>
1533
+ <show_in_store>1</show_in_store>
1534
+ </specificcountry>
1535
+ <min_order_total translate="label">
1536
+ <label>Minimum Order Total</label>
1537
+ <frontend_type>text</frontend_type>
1538
+ <sort_order>120</sort_order>
1539
+ <show_in_default>1</show_in_default>
1540
+ <show_in_website>1</show_in_website>
1541
+ <show_in_store>1</show_in_store>
1542
+ </min_order_total>
1543
+ <max_order_total translate="label">
1544
+ <label>Maximum Order Total</label>
1545
+ <frontend_type>text</frontend_type>
1546
+ <sort_order>121</sort_order>
1547
+ <show_in_default>1</show_in_default>
1548
+ <show_in_website>1</show_in_website>
1549
+ <show_in_store>1</show_in_store>
1550
+ </max_order_total>
1551
+ <sort_order translate="label">
1552
+ <label>Sort Order</label>
1553
+ <frontend_type>text</frontend_type>
1554
+ <sort_order>130</sort_order>
1555
+ <show_in_default>1</show_in_default>
1556
+ <show_in_website>1</show_in_website>
1557
+ <show_in_store>1</show_in_store>
1558
+ </sort_order>
1559
+ <debug translate="label">
1560
+ <label>Enable debug log</label>
1561
+ <comment></comment>
1562
+ <frontend_type>select</frontend_type>
1563
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1564
+ <sort_order>150</sort_order>
1565
+ <show_in_default>1</show_in_default>
1566
+ <show_in_website>1</show_in_website>
1567
+ <show_in_store>0</show_in_store>
1568
+ </debug>
1569
+ <is_test_mode translate="label comment">
1570
+ <label>Enable test mode</label>
1571
+ <comment></comment>
1572
+ <frontend_type>select</frontend_type>
1573
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1574
+ <sort_order>200</sort_order>
1575
+ <show_in_default>1</show_in_default>
1576
+ <show_in_website>1</show_in_website>
1577
+ <show_in_store>1</show_in_store>
1578
+ </is_test_mode>
1579
+ </fields>
1580
+ </hipay_giropay>
1581
+ <hipay_przelewy24api translate="label" module="hipay">
1582
+ <label>HiPay Fullservice Przelewy24</label>
1583
+ <frontend_type>text</frontend_type>
1584
+ <sort_order>220</sort_order>
1585
+ <show_in_default>1</show_in_default>
1586
+ <show_in_website>1</show_in_website>
1587
+ <show_in_store>1</show_in_store>
1588
+ <fields>
1589
+ <active translate="label">
1590
+ <label>Enabled</label>
1591
+ <frontend_type>select</frontend_type>
1592
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1593
+ <sort_order>10</sort_order>
1594
+ <show_in_default>1</show_in_default>
1595
+ <show_in_website>1</show_in_website>
1596
+ <show_in_store>1</show_in_store>
1597
+ </active>
1598
+ <title translate="label">
1599
+ <label>Title</label>
1600
+ <frontend_type>text</frontend_type>
1601
+ <sort_order>20</sort_order>
1602
+ <show_in_default>1</show_in_default>
1603
+ <show_in_website>1</show_in_website>
1604
+ <show_in_store>1</show_in_store>
1605
+ </title>
1606
+ <order_status_payment_accepted translate="label">
1607
+ <label>Order status when payment accepted</label>
1608
+ <frontend_type>select</frontend_type>
1609
+ <source_model>hipay/source_order_status_accepted</source_model>
1610
+ <sort_order>23</sort_order>
1611
+ <show_in_default>1</show_in_default>
1612
+ <show_in_website>1</show_in_website>
1613
+ <show_in_store>0</show_in_store>
1614
+ </order_status_payment_accepted>
1615
+ <order_status_payment_refused translate="label">
1616
+ <label>Order status when payment refused</label>
1617
+ <frontend_type>select</frontend_type>
1618
+ <source_model>hipay/source_order_status_refused</source_model>
1619
+ <sort_order>24</sort_order>
1620
+ <show_in_default>1</show_in_default>
1621
+ <show_in_website>1</show_in_website>
1622
+ <show_in_store>0</show_in_store>
1623
+ </order_status_payment_refused>
1624
+ <order_status_payment_canceled translate="label">
1625
+ <label>Order status when payment canceled by customer</label>
1626
+ <frontend_type>select</frontend_type>
1627
+ <source_model>hipay/source_order_status_canceled</source_model>
1628
+ <sort_order>25</sort_order>
1629
+ <show_in_default>1</show_in_default>
1630
+ <show_in_website>1</show_in_website>
1631
+ <show_in_store>0</show_in_store>
1632
+ </order_status_payment_canceled>
1633
+ <hipay_status_validate_order translate="label">
1634
+ <label>Hipay status to validate order</label>
1635
+ <frontend_type>select</frontend_type>
1636
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
1637
+ <sort_order>26</sort_order>
1638
+ <show_in_default>1</show_in_default>
1639
+ <show_in_website>1</show_in_website>
1640
+ <show_in_store>0</show_in_store>
1641
+ </hipay_status_validate_order>
1642
+ <pending_redirect_page translate="label">
1643
+ <label>Redirect page pending status</label>
1644
+ <comment>Page to redirect when transaction is in pending status</comment>
1645
+ <frontend_type>select</frontend_type>
1646
+ <source_model>hipay/source_pendingredirect</source_model>
1647
+ <sort_order>27</sort_order>
1648
+ <show_in_default>1</show_in_default>
1649
+ <show_in_website>1</show_in_website>
1650
+ <show_in_store>0</show_in_store>
1651
+ </pending_redirect_page>
1652
+ <css_url translate="label coment">
1653
+ <label>Css Url</label>
1654
+ <comment>Important, HTTPS protocol is required</comment>
1655
+ <frontend_type>text</frontend_type>
1656
+ <sort_order>30</sort_order>
1657
+ <show_in_default>1</show_in_default>
1658
+ <show_in_website>1</show_in_website>
1659
+ <show_in_store>1</show_in_store>
1660
+ </css_url>
1661
+ <template translate="label">
1662
+ <label>Page payment template</label>
1663
+ <frontend_type>select</frontend_type>
1664
+ <source_model>hipay/source_template</source_model>
1665
+ <sort_order>35</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
+ </template>
1670
+ <re_add_to_cart translate="label comment">
1671
+ <label>Add product to cart</label>
1672
+ <comment>Fill cart when payment canceled or refused</comment>
1673
+ <frontend_type>select</frontend_type>
1674
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1675
+ <sort_order>95</sort_order>
1676
+ <show_in_default>1</show_in_default>
1677
+ <show_in_website>1</show_in_website>
1678
+ <show_in_store>0</show_in_store>
1679
+ </re_add_to_cart>
1680
+ <cancel_pending_order translate="label comment">
1681
+ <label>Cancel pending order</label>
1682
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
1683
+ <frontend_type>select</frontend_type>
1684
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1685
+ <sort_order>97</sort_order>
1686
+ <show_in_default>1</show_in_default>
1687
+ <show_in_website>1</show_in_website>
1688
+ <show_in_store>0</show_in_store>
1689
+ </cancel_pending_order>
1690
+ <allowspecific translate="label">
1691
+ <label>Payment from applicable countries</label>
1692
+ <frontend_type>allowspecific</frontend_type>
1693
+ <sort_order>100</sort_order>
1694
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1695
+ <show_in_default>1</show_in_default>
1696
+ <show_in_website>1</show_in_website>
1697
+ <show_in_store>1</show_in_store>
1698
+ </allowspecific>
1699
+ <specificcountry translate="label">
1700
+ <label>Payment from Specific countries</label>
1701
+ <frontend_type>multiselect</frontend_type>
1702
+ <sort_order>110</sort_order>
1703
+ <source_model>adminhtml/system_config_source_country</source_model>
1704
+ <show_in_default>1</show_in_default>
1705
+ <show_in_website>1</show_in_website>
1706
+ <show_in_store>1</show_in_store>
1707
+ </specificcountry>
1708
+ <min_order_total translate="label">
1709
+ <label>Minimum Order Total</label>
1710
+ <frontend_type>text</frontend_type>
1711
+ <sort_order>120</sort_order>
1712
+ <show_in_default>1</show_in_default>
1713
+ <show_in_website>1</show_in_website>
1714
+ <show_in_store>1</show_in_store>
1715
+ </min_order_total>
1716
+ <max_order_total translate="label">
1717
+ <label>Maximum Order Total</label>
1718
+ <frontend_type>text</frontend_type>
1719
+ <sort_order>121</sort_order>
1720
+ <show_in_default>1</show_in_default>
1721
+ <show_in_website>1</show_in_website>
1722
+ <show_in_store>1</show_in_store>
1723
+ </max_order_total>
1724
+ <sort_order translate="label">
1725
+ <label>Sort Order</label>
1726
+ <frontend_type>text</frontend_type>
1727
+ <sort_order>130</sort_order>
1728
+ <show_in_default>1</show_in_default>
1729
+ <show_in_website>1</show_in_website>
1730
+ <show_in_store>1</show_in_store>
1731
+ </sort_order>
1732
+ <debug translate="label">
1733
+ <label>Enable debug log</label>
1734
+ <comment></comment>
1735
+ <frontend_type>select</frontend_type>
1736
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1737
+ <sort_order>150</sort_order>
1738
+ <show_in_default>1</show_in_default>
1739
+ <show_in_website>1</show_in_website>
1740
+ <show_in_store>0</show_in_store>
1741
+ </debug>
1742
+ <is_test_mode translate="label comment">
1743
+ <label>Enable test mode</label>
1744
+ <comment></comment>
1745
+ <frontend_type>select</frontend_type>
1746
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1747
+ <sort_order>200</sort_order>
1748
+ <show_in_default>1</show_in_default>
1749
+ <show_in_website>1</show_in_website>
1750
+ <show_in_store>1</show_in_store>
1751
+ </is_test_mode>
1752
+ </fields>
1753
+ </hipay_przelewy24api>
1754
+ <hipay_qiwi translate="label" module="hipay">
1755
+ <label>HiPay Fullservice Visa Qiwi Wallet</label>
1756
+ <frontend_type>text</frontend_type>
1757
+ <sort_order>220</sort_order>
1758
+ <show_in_default>1</show_in_default>
1759
+ <show_in_website>1</show_in_website>
1760
+ <show_in_store>1</show_in_store>
1761
+ <fields>
1762
+ <active translate="label">
1763
+ <label>Enabled</label>
1764
+ <frontend_type>select</frontend_type>
1765
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1766
+ <sort_order>10</sort_order>
1767
+ <show_in_default>1</show_in_default>
1768
+ <show_in_website>1</show_in_website>
1769
+ <show_in_store>1</show_in_store>
1770
+ </active>
1771
+ <title translate="label">
1772
+ <label>Title</label>
1773
+ <frontend_type>text</frontend_type>
1774
+ <sort_order>20</sort_order>
1775
+ <show_in_default>1</show_in_default>
1776
+ <show_in_website>1</show_in_website>
1777
+ <show_in_store>1</show_in_store>
1778
+ </title>
1779
+ <order_status_payment_accepted translate="label">
1780
+ <label>Order status when payment accepted</label>
1781
+ <frontend_type>select</frontend_type>
1782
+ <source_model>hipay/source_order_status_accepted</source_model>
1783
+ <sort_order>23</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
+ </order_status_payment_accepted>
1788
+ <order_status_payment_refused translate="label">
1789
+ <label>Order status when payment refused</label>
1790
+ <frontend_type>select</frontend_type>
1791
+ <source_model>hipay/source_order_status_refused</source_model>
1792
+ <sort_order>24</sort_order>
1793
+ <show_in_default>1</show_in_default>
1794
+ <show_in_website>1</show_in_website>
1795
+ <show_in_store>0</show_in_store>
1796
+ </order_status_payment_refused>
1797
+ <order_status_payment_canceled translate="label">
1798
+ <label>Order status when payment canceled by customer</label>
1799
+ <frontend_type>select</frontend_type>
1800
+ <source_model>hipay/source_order_status_canceled</source_model>
1801
+ <sort_order>25</sort_order>
1802
+ <show_in_default>1</show_in_default>
1803
+ <show_in_website>1</show_in_website>
1804
+ <show_in_store>0</show_in_store>
1805
+ </order_status_payment_canceled>
1806
+ <hipay_status_validate_order translate="label">
1807
+ <label>Hipay status to validate order</label>
1808
+ <frontend_type>select</frontend_type>
1809
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
1810
+ <sort_order>26</sort_order>
1811
+ <show_in_default>1</show_in_default>
1812
+ <show_in_website>1</show_in_website>
1813
+ <show_in_store>0</show_in_store>
1814
+ </hipay_status_validate_order>
1815
+ <pending_redirect_page translate="label">
1816
+ <label>Redirect page pending status</label>
1817
+ <comment>Page to redirect when transaction is in pending status</comment>
1818
+ <frontend_type>select</frontend_type>
1819
+ <source_model>hipay/source_pendingredirect</source_model>
1820
+ <sort_order>27</sort_order>
1821
+ <show_in_default>1</show_in_default>
1822
+ <show_in_website>1</show_in_website>
1823
+ <show_in_store>0</show_in_store>
1824
+ </pending_redirect_page>
1825
+ <css_url translate="label coment">
1826
+ <label>Css Url</label>
1827
+ <comment>Important, HTTPS protocol is required</comment>
1828
+ <frontend_type>text</frontend_type>
1829
+ <sort_order>30</sort_order>
1830
+ <show_in_default>1</show_in_default>
1831
+ <show_in_website>1</show_in_website>
1832
+ <show_in_store>1</show_in_store>
1833
+ </css_url>
1834
+ <template translate="label">
1835
+ <label>Page payment template</label>
1836
+ <frontend_type>select</frontend_type>
1837
+ <source_model>hipay/source_template</source_model>
1838
+ <sort_order>35</sort_order>
1839
+ <show_in_default>1</show_in_default>
1840
+ <show_in_website>1</show_in_website>
1841
+ <show_in_store>0</show_in_store>
1842
+ </template>
1843
+ <re_add_to_cart translate="label comment">
1844
+ <label>Add product to cart</label>
1845
+ <comment>Fill cart when payment canceled or refused</comment>
1846
+ <frontend_type>select</frontend_type>
1847
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1848
+ <sort_order>95</sort_order>
1849
+ <show_in_default>1</show_in_default>
1850
+ <show_in_website>1</show_in_website>
1851
+ <show_in_store>0</show_in_store>
1852
+ </re_add_to_cart>
1853
+ <cancel_pending_order translate="label comment">
1854
+ <label>Cancel pending order</label>
1855
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
1856
+ <frontend_type>select</frontend_type>
1857
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1858
+ <sort_order>97</sort_order>
1859
+ <show_in_default>1</show_in_default>
1860
+ <show_in_website>1</show_in_website>
1861
+ <show_in_store>0</show_in_store>
1862
+ </cancel_pending_order>
1863
+ <allowspecific translate="label">
1864
+ <label>Payment from applicable countries</label>
1865
+ <frontend_type>allowspecific</frontend_type>
1866
+ <sort_order>100</sort_order>
1867
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1868
+ <show_in_default>1</show_in_default>
1869
+ <show_in_website>1</show_in_website>
1870
+ <show_in_store>1</show_in_store>
1871
+ </allowspecific>
1872
+ <specificcountry translate="label">
1873
+ <label>Payment from Specific countries</label>
1874
+ <frontend_type>multiselect</frontend_type>
1875
+ <sort_order>110</sort_order>
1876
+ <source_model>adminhtml/system_config_source_country</source_model>
1877
+ <show_in_default>1</show_in_default>
1878
+ <show_in_website>1</show_in_website>
1879
+ <show_in_store>1</show_in_store>
1880
+ </specificcountry>
1881
+ <min_order_total translate="label">
1882
+ <label>Minimum Order Total</label>
1883
+ <frontend_type>text</frontend_type>
1884
+ <sort_order>120</sort_order>
1885
+ <show_in_default>1</show_in_default>
1886
+ <show_in_website>1</show_in_website>
1887
+ <show_in_store>1</show_in_store>
1888
+ </min_order_total>
1889
+ <max_order_total translate="label">
1890
+ <label>Maximum Order Total</label>
1891
+ <frontend_type>text</frontend_type>
1892
+ <sort_order>121</sort_order>
1893
+ <show_in_default>1</show_in_default>
1894
+ <show_in_website>1</show_in_website>
1895
+ <show_in_store>1</show_in_store>
1896
+ </max_order_total>
1897
+ <sort_order translate="label">
1898
+ <label>Sort Order</label>
1899
+ <frontend_type>text</frontend_type>
1900
+ <sort_order>130</sort_order>
1901
+ <show_in_default>1</show_in_default>
1902
+ <show_in_website>1</show_in_website>
1903
+ <show_in_store>1</show_in_store>
1904
+ </sort_order>
1905
+ <debug translate="label">
1906
+ <label>Enable debug log</label>
1907
+ <comment></comment>
1908
+ <frontend_type>select</frontend_type>
1909
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1910
+ <sort_order>150</sort_order>
1911
+ <show_in_default>1</show_in_default>
1912
+ <show_in_website>1</show_in_website>
1913
+ <show_in_store>0</show_in_store>
1914
+ </debug>
1915
+ <is_test_mode translate="label comment">
1916
+ <label>Enable test mode</label>
1917
+ <comment></comment>
1918
+ <frontend_type>select</frontend_type>
1919
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1920
+ <sort_order>200</sort_order>
1921
+ <show_in_default>1</show_in_default>
1922
+ <show_in_website>1</show_in_website>
1923
+ <show_in_store>1</show_in_store>
1924
+ </is_test_mode>
1925
+ </fields>
1926
+ </hipay_qiwi>
1927
+ <hipay_webmoneyapi translate="label" module="hipay">
1928
+ <label>HiPay Fullservice WebMoney Transfer</label>
1929
+ <frontend_type>text</frontend_type>
1930
+ <sort_order>220</sort_order>
1931
+ <show_in_default>1</show_in_default>
1932
+ <show_in_website>1</show_in_website>
1933
+ <show_in_store>1</show_in_store>
1934
+ <fields>
1935
+ <active translate="label">
1936
+ <label>Enabled</label>
1937
+ <frontend_type>select</frontend_type>
1938
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1939
+ <sort_order>10</sort_order>
1940
+ <show_in_default>1</show_in_default>
1941
+ <show_in_website>1</show_in_website>
1942
+ <show_in_store>1</show_in_store>
1943
+ </active>
1944
+ <title translate="label">
1945
+ <label>Title</label>
1946
+ <frontend_type>text</frontend_type>
1947
+ <sort_order>20</sort_order>
1948
+ <show_in_default>1</show_in_default>
1949
+ <show_in_website>1</show_in_website>
1950
+ <show_in_store>1</show_in_store>
1951
+ </title>
1952
+ <order_status_payment_accepted translate="label">
1953
+ <label>Order status when payment accepted</label>
1954
+ <frontend_type>select</frontend_type>
1955
+ <source_model>hipay/source_order_status_accepted</source_model>
1956
+ <sort_order>23</sort_order>
1957
+ <show_in_default>1</show_in_default>
1958
+ <show_in_website>1</show_in_website>
1959
+ <show_in_store>0</show_in_store>
1960
+ </order_status_payment_accepted>
1961
+ <order_status_payment_refused translate="label">
1962
+ <label>Order status when payment refused</label>
1963
+ <frontend_type>select</frontend_type>
1964
+ <source_model>hipay/source_order_status_refused</source_model>
1965
+ <sort_order>24</sort_order>
1966
+ <show_in_default>1</show_in_default>
1967
+ <show_in_website>1</show_in_website>
1968
+ <show_in_store>0</show_in_store>
1969
+ </order_status_payment_refused>
1970
+ <order_status_payment_canceled translate="label">
1971
+ <label>Order status when payment canceled by customer</label>
1972
+ <frontend_type>select</frontend_type>
1973
+ <source_model>hipay/source_order_status_canceled</source_model>
1974
+ <sort_order>25</sort_order>
1975
+ <show_in_default>1</show_in_default>
1976
+ <show_in_website>1</show_in_website>
1977
+ <show_in_store>0</show_in_store>
1978
+ </order_status_payment_canceled>
1979
+ <hipay_status_validate_order translate="label">
1980
+ <label>Hipay status to validate order</label>
1981
+ <frontend_type>select</frontend_type>
1982
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
1983
+ <sort_order>26</sort_order>
1984
+ <show_in_default>1</show_in_default>
1985
+ <show_in_website>1</show_in_website>
1986
+ <show_in_store>0</show_in_store>
1987
+ </hipay_status_validate_order>
1988
+ <pending_redirect_page translate="label">
1989
+ <label>Redirect page pending status</label>
1990
+ <comment>Page to redirect when transaction is in pending status</comment>
1991
+ <frontend_type>select</frontend_type>
1992
+ <source_model>hipay/source_pendingredirect</source_model>
1993
+ <sort_order>27</sort_order>
1994
+ <show_in_default>1</show_in_default>
1995
+ <show_in_website>1</show_in_website>
1996
+ <show_in_store>0</show_in_store>
1997
+ </pending_redirect_page>
1998
+ <css_url translate="label coment">
1999
+ <label>Css Url</label>
2000
+ <comment>Important, HTTPS protocol is required</comment>
2001
+ <frontend_type>text</frontend_type>
2002
+ <sort_order>30</sort_order>
2003
+ <show_in_default>1</show_in_default>
2004
+ <show_in_website>1</show_in_website>
2005
+ <show_in_store>1</show_in_store>
2006
+ </css_url>
2007
+ <template translate="label">
2008
+ <label>Page payment template</label>
2009
+ <frontend_type>select</frontend_type>
2010
+ <source_model>hipay/source_template</source_model>
2011
+ <sort_order>35</sort_order>
2012
+ <show_in_default>1</show_in_default>
2013
+ <show_in_website>1</show_in_website>
2014
+ <show_in_store>0</show_in_store>
2015
+ </template>
2016
+ <re_add_to_cart translate="label comment">
2017
+ <label>Add product to cart</label>
2018
+ <comment>Fill cart when payment canceled or refused</comment>
2019
+ <frontend_type>select</frontend_type>
2020
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2021
+ <sort_order>95</sort_order>
2022
+ <show_in_default>1</show_in_default>
2023
+ <show_in_website>1</show_in_website>
2024
+ <show_in_store>0</show_in_store>
2025
+ </re_add_to_cart>
2026
+ <cancel_pending_order translate="label comment">
2027
+ <label>Cancel pending order</label>
2028
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
2029
+ <frontend_type>select</frontend_type>
2030
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2031
+ <sort_order>97</sort_order>
2032
+ <show_in_default>1</show_in_default>
2033
+ <show_in_website>1</show_in_website>
2034
+ <show_in_store>0</show_in_store>
2035
+ </cancel_pending_order>
2036
+ <allowspecific translate="label">
2037
+ <label>Payment from applicable countries</label>
2038
+ <frontend_type>allowspecific</frontend_type>
2039
+ <sort_order>100</sort_order>
2040
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2041
+ <show_in_default>1</show_in_default>
2042
+ <show_in_website>1</show_in_website>
2043
+ <show_in_store>1</show_in_store>
2044
+ </allowspecific>
2045
+ <specificcountry translate="label">
2046
+ <label>Payment from Specific countries</label>
2047
+ <frontend_type>multiselect</frontend_type>
2048
+ <sort_order>110</sort_order>
2049
+ <source_model>adminhtml/system_config_source_country</source_model>
2050
+ <show_in_default>1</show_in_default>
2051
+ <show_in_website>1</show_in_website>
2052
+ <show_in_store>1</show_in_store>
2053
+ </specificcountry>
2054
+ <min_order_total translate="label">
2055
+ <label>Minimum Order Total</label>
2056
+ <frontend_type>text</frontend_type>
2057
+ <sort_order>120</sort_order>
2058
+ <show_in_default>1</show_in_default>
2059
+ <show_in_website>1</show_in_website>
2060
+ <show_in_store>1</show_in_store>
2061
+ </min_order_total>
2062
+ <max_order_total translate="label">
2063
+ <label>Maximum Order Total</label>
2064
+ <frontend_type>text</frontend_type>
2065
+ <sort_order>121</sort_order>
2066
+ <show_in_default>1</show_in_default>
2067
+ <show_in_website>1</show_in_website>
2068
+ <show_in_store>1</show_in_store>
2069
+ </max_order_total>
2070
+ <sort_order translate="label">
2071
+ <label>Sort Order</label>
2072
+ <frontend_type>text</frontend_type>
2073
+ <sort_order>130</sort_order>
2074
+ <show_in_default>1</show_in_default>
2075
+ <show_in_website>1</show_in_website>
2076
+ <show_in_store>1</show_in_store>
2077
+ </sort_order>
2078
+ <debug translate="label">
2079
+ <label>Enable debug log</label>
2080
+ <comment></comment>
2081
+ <frontend_type>select</frontend_type>
2082
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2083
+ <sort_order>150</sort_order>
2084
+ <show_in_default>1</show_in_default>
2085
+ <show_in_website>1</show_in_website>
2086
+ <show_in_store>0</show_in_store>
2087
+ </debug>
2088
+ <is_test_mode translate="label comment">
2089
+ <label>Enable test mode</label>
2090
+ <comment></comment>
2091
+ <frontend_type>select</frontend_type>
2092
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2093
+ <sort_order>200</sort_order>
2094
+ <show_in_default>1</show_in_default>
2095
+ <show_in_website>1</show_in_website>
2096
+ <show_in_store>1</show_in_store>
2097
+ </is_test_mode>
2098
+ </fields>
2099
+ </hipay_webmoneyapi>
2100
+ <hipay_yandexapi translate="label" module="hipay">
2101
+ <label>HiPay Fullservice Yandex.Money</label>
2102
+ <frontend_type>text</frontend_type>
2103
+ <sort_order>220</sort_order>
2104
+ <show_in_default>1</show_in_default>
2105
+ <show_in_website>1</show_in_website>
2106
+ <show_in_store>1</show_in_store>
2107
+ <fields>
2108
+ <active translate="label">
2109
+ <label>Enabled</label>
2110
+ <frontend_type>select</frontend_type>
2111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2112
+ <sort_order>10</sort_order>
2113
+ <show_in_default>1</show_in_default>
2114
+ <show_in_website>1</show_in_website>
2115
+ <show_in_store>1</show_in_store>
2116
+ </active>
2117
+ <title translate="label">
2118
+ <label>Title</label>
2119
+ <frontend_type>text</frontend_type>
2120
+ <sort_order>20</sort_order>
2121
+ <show_in_default>1</show_in_default>
2122
+ <show_in_website>1</show_in_website>
2123
+ <show_in_store>1</show_in_store>
2124
+ </title>
2125
+ <order_status_payment_accepted translate="label">
2126
+ <label>Order status when payment accepted</label>
2127
+ <frontend_type>select</frontend_type>
2128
+ <source_model>hipay/source_order_status_accepted</source_model>
2129
+ <sort_order>23</sort_order>
2130
+ <show_in_default>1</show_in_default>
2131
+ <show_in_website>1</show_in_website>
2132
+ <show_in_store>0</show_in_store>
2133
+ </order_status_payment_accepted>
2134
+ <order_status_payment_refused translate="label">
2135
+ <label>Order status when payment refused</label>
2136
+ <frontend_type>select</frontend_type>
2137
+ <source_model>hipay/source_order_status_refused</source_model>
2138
+ <sort_order>24</sort_order>
2139
+ <show_in_default>1</show_in_default>
2140
+ <show_in_website>1</show_in_website>
2141
+ <show_in_store>0</show_in_store>
2142
+ </order_status_payment_refused>
2143
+ <order_status_payment_canceled translate="label">
2144
+ <label>Order status when payment canceled by customer</label>
2145
+ <frontend_type>select</frontend_type>
2146
+ <source_model>hipay/source_order_status_canceled</source_model>
2147
+ <sort_order>25</sort_order>
2148
+ <show_in_default>1</show_in_default>
2149
+ <show_in_website>1</show_in_website>
2150
+ <show_in_store>0</show_in_store>
2151
+ </order_status_payment_canceled>
2152
+ <hipay_status_validate_order translate="label">
2153
+ <label>Hipay status to validate order</label>
2154
+ <frontend_type>select</frontend_type>
2155
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
2156
+ <sort_order>26</sort_order>
2157
+ <show_in_default>1</show_in_default>
2158
+ <show_in_website>1</show_in_website>
2159
+ <show_in_store>0</show_in_store>
2160
+ </hipay_status_validate_order>
2161
+ <pending_redirect_page translate="label">
2162
+ <label>Redirect page pending status</label>
2163
+ <comment>Page to redirect when transaction is in pending status</comment>
2164
+ <frontend_type>select</frontend_type>
2165
+ <source_model>hipay/source_pendingredirect</source_model>
2166
+ <sort_order>27</sort_order>
2167
+ <show_in_default>1</show_in_default>
2168
+ <show_in_website>1</show_in_website>
2169
+ <show_in_store>0</show_in_store>
2170
+ </pending_redirect_page>
2171
+ <css_url translate="label coment">
2172
+ <label>Css Url</label>
2173
+ <comment>Important, HTTPS protocol is required</comment>
2174
+ <frontend_type>text</frontend_type>
2175
+ <sort_order>30</sort_order>
2176
+ <show_in_default>1</show_in_default>
2177
+ <show_in_website>1</show_in_website>
2178
+ <show_in_store>1</show_in_store>
2179
+ </css_url>
2180
+ <template translate="label">
2181
+ <label>Page payment template</label>
2182
+ <frontend_type>select</frontend_type>
2183
+ <source_model>hipay/source_template</source_model>
2184
+ <sort_order>35</sort_order>
2185
+ <show_in_default>1</show_in_default>
2186
+ <show_in_website>1</show_in_website>
2187
+ <show_in_store>0</show_in_store>
2188
+ </template>
2189
+ <re_add_to_cart translate="label comment">
2190
+ <label>Add product to cart</label>
2191
+ <comment>Fill cart when payment canceled or refused</comment>
2192
+ <frontend_type>select</frontend_type>
2193
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2194
+ <sort_order>95</sort_order>
2195
+ <show_in_default>1</show_in_default>
2196
+ <show_in_website>1</show_in_website>
2197
+ <show_in_store>0</show_in_store>
2198
+ </re_add_to_cart>
2199
+ <cancel_pending_order translate="label comment">
2200
+ <label>Cancel pending order</label>
2201
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
2202
+ <frontend_type>select</frontend_type>
2203
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2204
+ <sort_order>97</sort_order>
2205
+ <show_in_default>1</show_in_default>
2206
+ <show_in_website>1</show_in_website>
2207
+ <show_in_store>0</show_in_store>
2208
+ </cancel_pending_order>
2209
+ <allowspecific translate="label">
2210
+ <label>Payment from applicable countries</label>
2211
+ <frontend_type>allowspecific</frontend_type>
2212
+ <sort_order>100</sort_order>
2213
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2214
+ <show_in_default>1</show_in_default>
2215
+ <show_in_website>1</show_in_website>
2216
+ <show_in_store>1</show_in_store>
2217
+ </allowspecific>
2218
+ <specificcountry translate="label">
2219
+ <label>Payment from Specific countries</label>
2220
+ <frontend_type>multiselect</frontend_type>
2221
+ <sort_order>110</sort_order>
2222
+ <source_model>adminhtml/system_config_source_country</source_model>
2223
+ <show_in_default>1</show_in_default>
2224
+ <show_in_website>1</show_in_website>
2225
+ <show_in_store>1</show_in_store>
2226
+ </specificcountry>
2227
+ <min_order_total translate="label">
2228
+ <label>Minimum Order Total</label>
2229
+ <frontend_type>text</frontend_type>
2230
+ <sort_order>120</sort_order>
2231
+ <show_in_default>1</show_in_default>
2232
+ <show_in_website>1</show_in_website>
2233
+ <show_in_store>1</show_in_store>
2234
+ </min_order_total>
2235
+ <max_order_total translate="label">
2236
+ <label>Maximum Order Total</label>
2237
+ <frontend_type>text</frontend_type>
2238
+ <sort_order>121</sort_order>
2239
+ <show_in_default>1</show_in_default>
2240
+ <show_in_website>1</show_in_website>
2241
+ <show_in_store>1</show_in_store>
2242
+ </max_order_total>
2243
+ <sort_order translate="label">
2244
+ <label>Sort Order</label>
2245
+ <frontend_type>text</frontend_type>
2246
+ <sort_order>130</sort_order>
2247
+ <show_in_default>1</show_in_default>
2248
+ <show_in_website>1</show_in_website>
2249
+ <show_in_store>1</show_in_store>
2250
+ </sort_order>
2251
+ <debug translate="label">
2252
+ <label>Enable debug log</label>
2253
+ <comment></comment>
2254
+ <frontend_type>select</frontend_type>
2255
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2256
+ <sort_order>150</sort_order>
2257
+ <show_in_default>1</show_in_default>
2258
+ <show_in_website>1</show_in_website>
2259
+ <show_in_store>0</show_in_store>
2260
+ </debug>
2261
+ <is_test_mode translate="label comment">
2262
+ <label>Enable test mode</label>
2263
+ <comment></comment>
2264
+ <frontend_type>select</frontend_type>
2265
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2266
+ <sort_order>200</sort_order>
2267
+ <show_in_default>1</show_in_default>
2268
+ <show_in_website>1</show_in_website>
2269
+ <show_in_store>1</show_in_store>
2270
+ </is_test_mode>
2271
+ </fields>
2272
+ </hipay_yandexapi>
2273
+ <hipay_sofortapi translate="label" module="hipay">
2274
+ <label>HiPay Fullservice Sofort Überweisung</label>
2275
+ <frontend_type>text</frontend_type>
2276
+ <sort_order>225</sort_order>
2277
+ <show_in_default>1</show_in_default>
2278
+ <show_in_website>1</show_in_website>
2279
+ <show_in_store>1</show_in_store>
2280
+ <fields>
2281
+ <active translate="label">
2282
+ <label>Enabled</label>
2283
+ <frontend_type>select</frontend_type>
2284
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2285
+ <sort_order>10</sort_order>
2286
+ <show_in_default>1</show_in_default>
2287
+ <show_in_website>1</show_in_website>
2288
+ <show_in_store>1</show_in_store>
2289
+ </active>
2290
+ <title translate="label">
2291
+ <label>Title</label>
2292
+ <frontend_type>text</frontend_type>
2293
+ <sort_order>20</sort_order>
2294
+ <show_in_default>1</show_in_default>
2295
+ <show_in_website>1</show_in_website>
2296
+ <show_in_store>1</show_in_store>
2297
+ </title>
2298
+ <order_status_payment_accepted translate="label">
2299
+ <label>Order status when payment accepted</label>
2300
+ <frontend_type>select</frontend_type>
2301
+ <source_model>hipay/source_order_status_accepted</source_model>
2302
+ <sort_order>23</sort_order>
2303
+ <show_in_default>1</show_in_default>
2304
+ <show_in_website>1</show_in_website>
2305
+ <show_in_store>0</show_in_store>
2306
+ </order_status_payment_accepted>
2307
+ <order_status_payment_refused translate="label">
2308
+ <label>Order status when payment refused</label>
2309
+ <frontend_type>select</frontend_type>
2310
+ <source_model>hipay/source_order_status_refused</source_model>
2311
+ <sort_order>24</sort_order>
2312
+ <show_in_default>1</show_in_default>
2313
+ <show_in_website>1</show_in_website>
2314
+ <show_in_store>0</show_in_store>
2315
+ </order_status_payment_refused>
2316
+ <order_status_payment_canceled translate="label">
2317
+ <label>Order status when payment canceled by customer</label>
2318
+ <frontend_type>select</frontend_type>
2319
+ <source_model>hipay/source_order_status_canceled</source_model>
2320
+ <sort_order>25</sort_order>
2321
+ <show_in_default>1</show_in_default>
2322
+ <show_in_website>1</show_in_website>
2323
+ <show_in_store>0</show_in_store>
2324
+ </order_status_payment_canceled>
2325
+ <hipay_status_validate_order translate="label">
2326
+ <label>Hipay status to validate order</label>
2327
+ <frontend_type>select</frontend_type>
2328
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
2329
+ <sort_order>26</sort_order>
2330
+ <show_in_default>1</show_in_default>
2331
+ <show_in_website>1</show_in_website>
2332
+ <show_in_store>0</show_in_store>
2333
+ </hipay_status_validate_order>
2334
+ <pending_redirect_page translate="label">
2335
+ <label>Redirect page pending status</label>
2336
+ <comment>Page to redirect when transaction is in pending status</comment>
2337
+ <frontend_type>select</frontend_type>
2338
+ <source_model>hipay/source_pendingredirect</source_model>
2339
+ <sort_order>27</sort_order>
2340
+ <show_in_default>1</show_in_default>
2341
+ <show_in_website>1</show_in_website>
2342
+ <show_in_store>0</show_in_store>
2343
+ </pending_redirect_page>
2344
+ <re_add_to_cart translate="label comment">
2345
+ <label>Add product to cart</label>
2346
+ <comment>Fill cart when payment canceled or refused</comment>
2347
+ <frontend_type>select</frontend_type>
2348
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2349
+ <sort_order>95</sort_order>
2350
+ <show_in_default>1</show_in_default>
2351
+ <show_in_website>1</show_in_website>
2352
+ <show_in_store>0</show_in_store>
2353
+ </re_add_to_cart>
2354
+ <cancel_pending_order translate="label comment">
2355
+ <label>Cancel pending order</label>
2356
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
2357
+ <frontend_type>select</frontend_type>
2358
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2359
+ <sort_order>97</sort_order>
2360
+ <show_in_default>1</show_in_default>
2361
+ <show_in_website>1</show_in_website>
2362
+ <show_in_store>0</show_in_store>
2363
+ </cancel_pending_order>
2364
+ <allowspecific translate="label">
2365
+ <label>Payment from applicable countries</label>
2366
+ <frontend_type>allowspecific</frontend_type>
2367
+ <sort_order>100</sort_order>
2368
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2369
+ <show_in_default>1</show_in_default>
2370
+ <show_in_website>1</show_in_website>
2371
+ <show_in_store>1</show_in_store>
2372
+ </allowspecific>
2373
+ <specificcountry translate="label">
2374
+ <label>Payment from Specific countries</label>
2375
+ <frontend_type>multiselect</frontend_type>
2376
+ <sort_order>110</sort_order>
2377
+ <source_model>adminhtml/system_config_source_country</source_model>
2378
+ <show_in_default>1</show_in_default>
2379
+ <show_in_website>1</show_in_website>
2380
+ <show_in_store>1</show_in_store>
2381
+ </specificcountry>
2382
+ <min_order_total translate="label">
2383
+ <label>Minimum Order Total</label>
2384
+ <frontend_type>text</frontend_type>
2385
+ <sort_order>120</sort_order>
2386
+ <show_in_default>1</show_in_default>
2387
+ <show_in_website>1</show_in_website>
2388
+ <show_in_store>1</show_in_store>
2389
+ </min_order_total>
2390
+ <max_order_total translate="label">
2391
+ <label>Maximum Order Total</label>
2392
+ <frontend_type>text</frontend_type>
2393
+ <sort_order>121</sort_order>
2394
+ <show_in_default>1</show_in_default>
2395
+ <show_in_website>1</show_in_website>
2396
+ <show_in_store>1</show_in_store>
2397
+ </max_order_total>
2398
+ <sort_order translate="label">
2399
+ <label>Sort Order</label>
2400
+ <frontend_type>text</frontend_type>
2401
+ <sort_order>130</sort_order>
2402
+ <show_in_default>1</show_in_default>
2403
+ <show_in_website>1</show_in_website>
2404
+ <show_in_store>1</show_in_store>
2405
+ </sort_order>
2406
+ <debug translate="label">
2407
+ <label>Enable debug log</label>
2408
+ <comment></comment>
2409
+ <frontend_type>select</frontend_type>
2410
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2411
+ <sort_order>150</sort_order>
2412
+ <show_in_default>1</show_in_default>
2413
+ <show_in_website>1</show_in_website>
2414
+ <show_in_store>0</show_in_store>
2415
+ </debug>
2416
+ <is_test_mode translate="label comment">
2417
+ <label>Enable test mode</label>
2418
+ <comment></comment>
2419
+ <frontend_type>select</frontend_type>
2420
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2421
+ <sort_order>200</sort_order>
2422
+ <show_in_default>1</show_in_default>
2423
+ <show_in_website>1</show_in_website>
2424
+ <show_in_store>1</show_in_store>
2425
+ </is_test_mode>
2426
+ </fields>
2427
+ </hipay_sofortapi>
2428
+ <hipay_sisalapi translate="label" module="hipay">
2429
+ <label>HiPay Fullservice Sisal</label>
2430
+ <frontend_type>text</frontend_type>
2431
+ <sort_order>225</sort_order>
2432
+ <show_in_default>1</show_in_default>
2433
+ <show_in_website>1</show_in_website>
2434
+ <show_in_store>1</show_in_store>
2435
+ <fields>
2436
+ <active translate="label">
2437
+ <label>Enabled</label>
2438
+ <frontend_type>select</frontend_type>
2439
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2440
+ <sort_order>10</sort_order>
2441
+ <show_in_default>1</show_in_default>
2442
+ <show_in_website>1</show_in_website>
2443
+ <show_in_store>1</show_in_store>
2444
+ </active>
2445
+ <title translate="label">
2446
+ <label>Title</label>
2447
+ <frontend_type>text</frontend_type>
2448
+ <sort_order>20</sort_order>
2449
+ <show_in_default>1</show_in_default>
2450
+ <show_in_website>1</show_in_website>
2451
+ <show_in_store>1</show_in_store>
2452
+ </title>
2453
+ <order_status_payment_accepted translate="label">
2454
+ <label>Order status when payment accepted</label>
2455
+ <frontend_type>select</frontend_type>
2456
+ <source_model>hipay/source_order_status_accepted</source_model>
2457
+ <sort_order>23</sort_order>
2458
+ <show_in_default>1</show_in_default>
2459
+ <show_in_website>1</show_in_website>
2460
+ <show_in_store>0</show_in_store>
2461
+ </order_status_payment_accepted>
2462
+ <order_status_payment_refused translate="label">
2463
+ <label>Order status when payment refused</label>
2464
+ <frontend_type>select</frontend_type>
2465
+ <source_model>hipay/source_order_status_refused</source_model>
2466
+ <sort_order>24</sort_order>
2467
+ <show_in_default>1</show_in_default>
2468
+ <show_in_website>1</show_in_website>
2469
+ <show_in_store>0</show_in_store>
2470
+ </order_status_payment_refused>
2471
+ <order_status_payment_canceled translate="label">
2472
+ <label>Order status when payment canceled by customer</label>
2473
+ <frontend_type>select</frontend_type>
2474
+ <source_model>hipay/source_order_status_canceled</source_model>
2475
+ <sort_order>25</sort_order>
2476
+ <show_in_default>1</show_in_default>
2477
+ <show_in_website>1</show_in_website>
2478
+ <show_in_store>0</show_in_store>
2479
+ </order_status_payment_canceled>
2480
+ <hipay_status_validate_order translate="label">
2481
+ <label>Hipay status to validate order</label>
2482
+ <frontend_type>select</frontend_type>
2483
+ <source_model>hipay/source_order_hipayStatusValidate</source_model>
2484
+ <sort_order>26</sort_order>
2485
+ <show_in_default>1</show_in_default>
2486
+ <show_in_website>1</show_in_website>
2487
+ <show_in_store>0</show_in_store>
2488
+ </hipay_status_validate_order>
2489
+ <pending_redirect_page translate="label">
2490
+ <label>Redirect page pending status</label>
2491
+ <comment>Page to redirect when transaction is in pending status</comment>
2492
+ <frontend_type>select</frontend_type>
2493
+ <source_model>hipay/source_pendingredirect</source_model>
2494
+ <sort_order>27</sort_order>
2495
+ <show_in_default>1</show_in_default>
2496
+ <show_in_website>1</show_in_website>
2497
+ <show_in_store>0</show_in_store>
2498
+ </pending_redirect_page>
2499
+ <re_add_to_cart translate="label comment">
2500
+ <label>Add product to cart</label>
2501
+ <comment>Fill cart when payment canceled or refused</comment>
2502
+ <frontend_type>select</frontend_type>
2503
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2504
+ <sort_order>95</sort_order>
2505
+ <show_in_default>1</show_in_default>
2506
+ <show_in_website>1</show_in_website>
2507
+ <show_in_store>0</show_in_store>
2508
+ </re_add_to_cart>
2509
+ <cancel_pending_order translate="label comment">
2510
+ <label>Cancel pending order</label>
2511
+ <comment>Cancel orders stayed in pending because customer not validated payment</comment>
2512
+ <frontend_type>select</frontend_type>
2513
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2514
+ <sort_order>97</sort_order>
2515
+ <show_in_default>1</show_in_default>
2516
+ <show_in_website>1</show_in_website>
2517
+ <show_in_store>0</show_in_store>
2518
+ </cancel_pending_order>
2519
+ <allowspecific translate="label">
2520
+ <label>Payment from applicable countries</label>
2521
+ <frontend_type>allowspecific</frontend_type>
2522
+ <sort_order>100</sort_order>
2523
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2524
+ <show_in_default>1</show_in_default>
2525
+ <show_in_website>1</show_in_website>
2526
+ <show_in_store>1</show_in_store>
2527
+ </allowspecific>
2528
+ <specificcountry translate="label">
2529
+ <label>Payment from Specific countries</label>
2530
+ <frontend_type>multiselect</frontend_type>
2531
+ <sort_order>110</sort_order>
2532
+ <source_model>adminhtml/system_config_source_country</source_model>
2533
+ <show_in_default>1</show_in_default>
2534
+ <show_in_website>1</show_in_website>
2535
+ <show_in_store>1</show_in_store>
2536
+ </specificcountry>
2537
+ <min_order_total translate="label">
2538
+ <label>Minimum Order Total</label>
2539
+ <frontend_type>text</frontend_type>
2540
+ <sort_order>120</sort_order>
2541
+ <show_in_default>1</show_in_default>
2542
+ <show_in_website>1</show_in_website>
2543
+ <show_in_store>1</show_in_store>
2544
+ </min_order_total>
2545
+ <max_order_total translate="label">
2546
+ <label>Maximum Order Total</label>
2547
+ <frontend_type>text</frontend_type>
2548
+ <sort_order>121</sort_order>
2549
+ <show_in_default>1</show_in_default>
2550
+ <show_in_website>1</show_in_website>
2551
+ <show_in_store>1</show_in_store>
2552
+ </max_order_total>
2553
+ <sort_order translate="label">
2554
+ <label>Sort Order</label>
2555
+ <frontend_type>text</frontend_type>
2556
+ <sort_order>130</sort_order>
2557
+ <show_in_default>1</show_in_default>
2558
+ <show_in_website>1</show_in_website>
2559
+ <show_in_store>1</show_in_store>
2560
+ </sort_order>
2561
+ <debug translate="label">
2562
+ <label>Enable debug log</label>
2563
+ <comment></comment>
2564
+ <frontend_type>select</frontend_type>
2565
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2566
+ <sort_order>150</sort_order>
2567
+ <show_in_default>1</show_in_default>
2568
+ <show_in_website>1</show_in_website>
2569
+ <show_in_store>0</show_in_store>
2570
+ </debug>
2571
+ <is_test_mode translate="label comment">
2572
+ <label>Enable test mode</label>
2573
+ <comment></comment>
2574
+ <frontend_type>select</frontend_type>
2575
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2576
+ <sort_order>200</sort_order>
2577
+ <show_in_default>1</show_in_default>
2578
+ <show_in_website>1</show_in_website>
2579
+ <show_in_store>1</show_in_store>
2580
+ </is_test_mode>
2581
+ </fields>
2582
+ </hipay_sisalapi>
2583
+ </groups>
2584
+ </payment>
2585
+ </sections>
2586
+ </config>
app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+
7
+ $installer->startSetup();
8
+
9
+ $currentVersion = Mage::getVersion();
10
+ if (version_compare($currentVersion, '1.4.2') == 1)
11
+ {
12
+
13
+ $statusTable = $installer->getTable('sales/order_status');
14
+ $statusStateTable = $installer->getTable('sales/order_status_state');
15
+ $statusLabelTable = $installer->getTable('sales/order_status_label');
16
+
17
+ $status = 'pending_capture';
18
+ $label = 'Pending Capture';
19
+ $code = "processing";
20
+
21
+ //Insert new Status in DB
22
+ $data[0] = array(
23
+ 'status' => $status,
24
+ 'label' => $label,
25
+ );
26
+
27
+ $installer->getConnection()->insertArray($statusTable, array('status', 'label'), $data);
28
+ //Insert relation between state and status
29
+ $data[0] = array(
30
+ 'status' => $status,
31
+ 'state' => $code,
32
+ 'is_default'=> 0,
33
+ );
34
+
35
+ $installer->getConnection()->insertArray(
36
+ $statusStateTable,
37
+ array('status', 'state', 'is_default'),
38
+ $data
39
+ );
40
+ }
41
+
42
+
43
+
44
+ $installer->endSetup();
45
+
app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installerCustomer = new Mage_Customer_Model_Entity_Setup('allopass_hipay_setup');
4
+ /* @var $installerCustomer Mage_Customer_Model_Entity_Setup */
5
+
6
+ $installerCustomer->startSetup();
7
+
8
+ $entityId = $installerCustomer->getEntityTypeId('customer');
9
+ $attribute = $installerCustomer->getAttribute($entityId,'hipay_alias_oneclick');
10
+ if(!$attribute)
11
+ {
12
+
13
+ $installerCustomer->addAttribute('customer','hipay_alias_oneclick',array(
14
+ 'type' => 'varchar',
15
+ 'label' => 'Alias Oneclick Hipay',
16
+ 'visible' => true,
17
+ 'required' => false,
18
+ 'unique' => false,
19
+ 'sort_order' => 700,
20
+ 'default' => 0,
21
+ 'input' => 'text',
22
+
23
+ ));
24
+
25
+ $usedInForms = array(
26
+ 'adminhtml_customer',
27
+ );
28
+
29
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'hipay_alias_oneclick');
30
+ $attribute->setData('used_in_forms', $usedInForms);
31
+ $attribute->setData('sort_order', 700);
32
+
33
+ $attribute->save();
34
+
35
+ }
36
+
37
+ $entityId = $installerCustomer->getEntityTypeId('customer');
38
+ $attribute = $installerCustomer->getAttribute($entityId,'hipay_alias_recurring');
39
+ if(!$attribute)
40
+ {
41
+
42
+ $installerCustomer->addAttribute('customer','hipay_alias_recurring',array(
43
+ 'type' => 'varchar',
44
+ 'label' => 'Alias Recurring Hipay',
45
+ 'visible' => true,
46
+ 'required' => false,
47
+ 'unique' => false,
48
+ 'sort_order' => 710,
49
+ 'default' => 0,
50
+ 'input' => 'text',
51
+
52
+ ));
53
+
54
+ $usedInForms = array(
55
+ 'adminhtml_customer',
56
+ );
57
+
58
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'hipay_alias_recurring');
59
+ $attribute->setData('used_in_forms', $usedInForms);
60
+ $attribute->setData('sort_order', 700);
61
+
62
+ $attribute->save();
63
+
64
+ }
65
+
66
+ $attribute = $installerCustomer->getAttribute($entityId,'hipay_cc_number_enc');
67
+ if(!$attribute)
68
+ {
69
+
70
+ $installerCustomer->addAttribute('customer','hipay_cc_number_enc',array(
71
+ 'type' => 'varchar',
72
+ 'label' => 'Card number encrypted hipay',
73
+ 'visible' => true,
74
+ 'required' => false,
75
+ 'unique' => false,
76
+ 'sort_order' => 750,
77
+ 'default' => 0,
78
+ 'input' => 'text',
79
+
80
+ ));
81
+
82
+ $usedInForms = array(
83
+ 'adminhtml_customer',
84
+ );
85
+
86
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'hipay_cc_number_enc');
87
+ $attribute->setData('used_in_forms', $usedInForms);
88
+ $attribute->setData('sort_order', 700);
89
+
90
+ $attribute->save();
91
+
92
+ }
93
+
94
+ $attribute = $installerCustomer->getAttribute($entityId,'hipay_cc_exp_date');
95
+ if(!$attribute)
96
+ {
97
+
98
+ $installerCustomer->addAttribute('customer','hipay_cc_exp_date',array(
99
+ 'type' => 'varchar',
100
+ 'label' => 'Card expiration date hipay',
101
+ 'visible' => true,
102
+ 'required' => false,
103
+ 'unique' => false,
104
+ 'sort_order' => 750,
105
+ 'default' => 0,
106
+ 'input' => 'text',
107
+
108
+ ));
109
+
110
+ $usedInForms = array(
111
+ 'adminhtml_customer',
112
+ );
113
+
114
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'hipay_cc_exp_date');
115
+ $attribute->setData('used_in_forms', $usedInForms);
116
+ $attribute->setData('sort_order', 700);
117
+
118
+ $attribute->save();
119
+
120
+ }
121
+
122
+ $installerCustomer->endSetup();
123
+
app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installerCustomer = new Mage_Customer_Model_Entity_Setup('allopass_hipay_setup');
4
+ /* @var $installerCustomer Mage_Customer_Model_Entity_Setup */
5
+
6
+ $installerCustomer->startSetup();
7
+
8
+ $entityId = $installerCustomer->getEntityTypeId('customer');
9
+ $attribute = $installerCustomer->getAttribute($entityId,'hipay_cc_type');
10
+ if(!$attribute)
11
+ {
12
+
13
+ $installerCustomer->addAttribute('customer','hipay_cc_type',array(
14
+ 'type' => 'varchar',
15
+ 'label' => 'Card Type hipay',
16
+ 'visible' => true,
17
+ 'required' => false,
18
+ 'unique' => false,
19
+ 'sort_order' => 800,
20
+ 'default' => 0,
21
+ 'input' => 'text',
22
+
23
+ ));
24
+
25
+ $usedInForms = array(
26
+ 'adminhtml_customer',
27
+ );
28
+
29
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'hipay_cc_type');
30
+ $attribute->setData('used_in_forms', $usedInForms);
31
+ $attribute->setData('sort_order', 800);
32
+
33
+ $attribute->save();
34
+
35
+ }
36
+
37
+ $installerCustomer->endSetup();
38
+
app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+ $installer->startSetup();
7
+
8
+ $currentVersion = Mage::getVersion();
9
+ if (version_compare($currentVersion, '1.4.2') == 1)
10
+ {
11
+
12
+
13
+ $statusTable = $installer->getTable('sales/order_status');
14
+ $statusStateTable = $installer->getTable('sales/order_status_state');
15
+ $statusLabelTable = $installer->getTable('sales/order_status_label');
16
+
17
+ $status = 'capture_requested';
18
+ $label = 'Capture Requested';
19
+ $code = "processing";
20
+
21
+ //Insert new Status in DB
22
+ $data[0] = array(
23
+ 'status' => $status,
24
+ 'label' => $label,
25
+ );
26
+
27
+ $installer->getConnection()->insertArray($statusTable, array('status', 'label'), $data);
28
+ //Insert relation between state and status
29
+ $data[0] = array(
30
+ 'status' => $status,
31
+ 'state' => $code,
32
+ 'is_default'=> 0,
33
+ );
34
+
35
+ $installer->getConnection()->insertArray(
36
+ $statusStateTable,
37
+ array('status', 'state', 'is_default'),
38
+ $data
39
+ );
40
+
41
+ $status = 'refund_requested';
42
+ $label = 'Refund Requested';
43
+ $code = "processing";
44
+
45
+ //Insert new Status in DB
46
+ $data[0] = array(
47
+ 'status' => $status,
48
+ 'label' => $label,
49
+ );
50
+
51
+ $installer->getConnection()->insertArray($statusTable, array('status', 'label'), $data);
52
+ //Insert relation between state and status
53
+ $data[0] = array(
54
+ 'status' => $status,
55
+ 'state' => $code,
56
+ 'is_default'=> 0,
57
+ );
58
+
59
+ $installer->getConnection()->insertArray(
60
+ $statusStateTable,
61
+ array('status', 'state', 'is_default'),
62
+ $data
63
+ );
64
+
65
+
66
+
67
+ }
68
+
69
+
70
+
71
+ $installer->endSetup();
72
+
app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.4-0.1.5.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->run("
9
+
10
+ -- DROP TABLE IF EXISTS {$this->getTable('hipay_rule')};
11
+ CREATE TABLE {$this->getTable('hipay_rule')} (
12
+ `rule_id` int(10) unsigned NOT NULL auto_increment,
13
+ `method_code` varchar(60) NOT NULL,
14
+ `conditions_serialized` text NOT NULL,
15
+ `actions_serialized` text NOT NULL default '',
16
+ `product_ids` text,
17
+ `sort_order` int(10) unsigned NOT NULL default '0',
18
+ `simple_action` varchar(32) NOT NULL default '',
19
+ PRIMARY KEY (`rule_id`),
20
+ KEY `sort_order` (`sort_order`)
21
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
22
+ );
23
+ $installer->endSetup();
24
+
app/design/adminhtml/default/default/layout/hipay.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+
4
+ <adminhtml_system_config_edit>
5
+ <reference name="head">
6
+ <action method="setCanLoadExtJs"><flag>1</flag></action>
7
+ <!-- <action method="setCanLoadRulesJs"><flag>1</flag></action> -->
8
+ <action method="addItem"><type>skin_js</type><name>hipay/js/rules.js</name></action>
9
+ </reference>
10
+ </adminhtml_system_config_edit>
11
+
12
+ </layout>
app/design/adminhtml/default/default/template/hipay/system/config/form/field/rules.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_element = $this->getElement() ?>
2
+ <?php $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid(); ?>
3
+ <input type="hidden" value="<?php echo $_element->getRule()->getId() ?>" name="<?php echo $_element->getName() ?>" />
4
+ <div class="rule-tree">
5
+ <div id="rule<?php echo $_htmlId ?>">
6
+ <?php if ($_element->getRule() && $_element->getRule()->getConditions()) : ?>
7
+ <?php echo $_element->getRule()->getConditions()->asHtmlRecursive(); ?>
8
+ <?php endif; ?>
9
+ </div>
10
+ </div>
11
+ <script type="text/javascript">
12
+ var <?php echo $_htmlId ?> = new VarienRulesForm('rule<?php echo $_htmlId ?>', '<?php echo $this->getNewChildUrl() ?>');
13
+ <?php if ($_element->getReadonly()): ?>
14
+ <?php echo $_htmlId ?>.setReadonly(true);
15
+ <?php endif; ?>
16
+ </script>
17
+
app/design/frontend/default/default/layout/hipay.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+ <hipay_checkout_pending translate="label">
4
+ <label>Hipay Checkout Pending</label>
5
+ <reference name="root">
6
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
7
+ </reference>
8
+ <reference name="content">
9
+ <block type="hipay/checkout_pending" name="checkout.pending" template="hipay/checkout/pending.phtml"/>
10
+ </reference>
11
+ </hipay_checkout_pending>
12
+ </layout>
app/design/frontend/default/default/template/hipay/checkout/pending.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ?>
3
+ <div class="page-title">
4
+ <h1><?php echo $this->__('Your payment is in pending.') ?></h1>
5
+ </div>
6
+ <?php if ($this->getRealOrderId()) : ?><p><?php echo $this->__('Order #') . $this->getRealOrderId() ?></p><?php endif ?>
7
+ <?php if ($error = $this->getErrorMessage()) : ?><p><?php echo $error ?></p><?php endif ?>
8
+ <p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.', $this->getContinueShoppingUrl()) ?></p>
app/design/frontend/default/default/template/hipay/form/cc.phtml ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <div id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+
4
+ <ul class="form-list" id="card_payment_form_<?php echo $_code ?>" >
5
+ <?php /*
6
+ <li>
7
+ <div class="input-box">
8
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
9
+ <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')) ?>" />
10
+ </div>
11
+ </li>
12
+ */ ?>
13
+ <li>
14
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
15
+ <div class="input-box">
16
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
17
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
18
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
19
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
20
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
21
+ <?php endforeach ?>
22
+ </select>
23
+ </div>
24
+ </li>
25
+ <li>
26
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
27
+ <div class="input-box">
28
+ <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="" />
29
+ </div>
30
+ </li>
31
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
32
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
33
+ <div class="input-box">
34
+ <div class="v-fix">
35
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
36
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
37
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
38
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
39
+ <?php endforeach ?>
40
+ </select>
41
+ </div>
42
+ <div class="v-fix">
43
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
44
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
45
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
46
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
47
+ <?php endforeach ?>
48
+ </select>
49
+ </div>
50
+ </div>
51
+ </li>
52
+ <?php echo $this->getChildHtml() ?>
53
+ <?php if($this->hasVerification()): ?>
54
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
55
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
56
+ <div class="input-box">
57
+ <div class="v-fix">
58
+ <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="" />
59
+ </div>
60
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
61
+ </div>
62
+ </li>
63
+ <?php endif; ?>
64
+
65
+ </ul>
66
+ <?php if ($this->oneClickIsAllowed()) : ?>
67
+ <ul class="form-list" id="oneclick_card_payment_form_<?php echo $_code ?>">
68
+ <li>
69
+
70
+ <?php if (!$this->getCustomerHasAlias() || ($this->getCustomerHasAlias() && !$this->ccExpDateIsValid())) :?>
71
+ <div class="input-box">
72
+ <input id="<?php echo $_code ?>_create_alias_oneclick" value="create_oneclick" type="checkbox" name="payment[oneclick]" />
73
+ <label style="float: none;" for="<?php echo $_code ?>_create_alias_oneclick"><?php echo $this->__('Record your card data for a next buy.') ?></label>
74
+ </div>
75
+ <?php elseif ($this->getCustomerHasAlias() && $this->ccExpDateIsValid()): ?>
76
+ <script type="text/javascript">$('card_payment_form_<?php echo $_code ?>').hide();</script>
77
+ <div class="input-box">
78
+ <input id="<?php echo $_code ?>_use_alias_oneclick" value="use_oneclick" checked="checked" type="radio" name="payment[oneclick]" onclick="$('card_payment_form_<?php echo $_code ?>').hide();" />
79
+ <label style="float: none;" for="<?php echo $_code ?>_use_alias_oneclick"><?php echo $this->__('Use my recorded card') ?></label>
80
+ </div>
81
+ <div class="input-box info-card">
82
+ <label><?php echo $this->__('Actual card') ?> :</label>
83
+ <span><?php echo $this->getCustomer()->getHipayCcNumberEnc() ?></span>
84
+ </div>
85
+ <div class="input-box info-card">
86
+ <label><?php echo $this->__('Expiration date') ?> : <?php echo $this->getCustomer()->getHipayCcExpDate() ?></label>
87
+ </div>
88
+
89
+
90
+
91
+ <div class="input-box">
92
+ <input id="<?php echo $_code ?>_create_alias_oneclick" type="radio" name="payment[oneclick]" value="create_oneclick" onclick="$('card_payment_form_<?php echo $_code ?>').show();"/>
93
+ <label style="float: none;" for="<?php echo $_code ?>_create_alias_oneclick"><?php echo $this->__('Record new card data') ?></label>
94
+ </div>
95
+
96
+ <div class="input-box">
97
+ <input id="<?php echo $_code ?>_not_oneclick" type="radio" name="payment[oneclick]" value="not_oneclick" onclick="$('card_payment_form_<?php echo $_code ?>').show();" />
98
+ <label style="float: none;" for="<?php echo $_code ?>_not_oneclick"><?php echo $this->__('Not use record card data') ?></label>
99
+ </div>
100
+
101
+ <?php endif;?>
102
+ </li>
103
+
104
+ </ul>
105
+ <script type="text/javascript">
106
+ //<![CDATA[
107
+
108
+ var ToogleOneclick<?php echo $_code ?> = function() {
109
+ var elm = $('<?php echo $_code ?>_cc_type');
110
+ if (['','VI','MC','AE'].indexOf(elm.value) != -1) {
111
+ $('oneclick_card_payment_form_<?php echo $_code ?>').show();
112
+ } else {
113
+ $('<?php echo $_code ?>_create_alias_oneclick').checked = false;
114
+ $('oneclick_card_payment_form_<?php echo $_code ?>').hide();
115
+ }
116
+ };
117
+
118
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', ToogleOneclick<?php echo $_code ?>);
119
+ ToogleOneclick<?php echo $_code ?>();
120
+ //]]>
121
+ </script>
122
+ <?php endif; ?>
123
+ <?php echo $this->__('You will be debit of amount %s only after submit order.',Mage::app()->getStore()->getBaseCurrency()->format($this->getQuote()->getGrandTotal(), array(), true))?>
124
+ <script type="text/javascript">
125
+ //<![CDATA[
126
+
127
+ Validation.creditCartTypes.set('BCMC',[false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
128
+
129
+ var ToogleCvn<?php echo $_code ?> = function() {
130
+ var elm = $('<?php echo $_code ?>_cc_type');
131
+ if (['BCMC'].indexOf(elm.value) != -1) {
132
+ $('<?php echo $_code ?>_cc_type_cvv_div').hide();
133
+ } else {
134
+ $('<?php echo $_code ?>_cc_type_cvv_div').show();
135
+ }
136
+ };
137
+
138
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', ToogleCvn<?php echo $_code ?>);
139
+ ToogleCvn<?php echo $_code ?>();
140
+ //]]>
141
+ </script>
142
+
143
+ </div>
144
+
app/design/frontend/default/default/template/hipay/form/hosted.phtml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <div id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <?php if ($this->oneClickIsAllowed()) : ?>
4
+ <ul class="form-list" id="oneclick_hosted_payment_form_<?php echo $_code ?>">
5
+ <li>
6
+
7
+ <?php if (!$this->getCustomerHasAlias() || ($this->getCustomerHasAlias() && !$this->ccExpDateIsValid())) :?>
8
+ <div class="input-box">
9
+ <input id="<?php echo $_code ?>_create_alias_oneclick" value="create_oneclick" type="checkbox" name="payment[oneclick]" />
10
+ <label style="float: none;" for="<?php echo $_code ?>_create_alias_oneclick"><?php echo $this->__('Record your card data for a next buy.') ?></label>
11
+ </div>
12
+ <?php elseif ($this->getCustomerHasAlias() && $this->ccExpDateIsValid()): ?>
13
+ <div class="input-box">
14
+ <input id="<?php echo $_code ?>_use_alias_oneclick" value="use_oneclick" checked="checked" type="radio" name="payment[oneclick]" />
15
+ <label style="float: none;" for="<?php echo $_code ?>_use_alias_oneclick"><?php echo $this->__('Use my recorded card') ?></label>
16
+ </div>
17
+ <div class="input-box info-card">
18
+ <label><?php echo $this->__('Actual card') ?> :</label>
19
+ <span><?php echo $this->getCustomer()->getHipayCcNumberEnc() ?></span>
20
+ </div>
21
+ <div class="input-box info-card">
22
+ <label><?php echo $this->__('Expiration date') ?> : <?php echo $this->getCustomer()->getHipayCcExpDate() ?></label>
23
+ </div>
24
+ <div class="input-box">
25
+ <input id="<?php echo $_code ?>_create_alias_oneclick" type="radio" name="payment[oneclick]" value="create_oneclick"/>
26
+ <label style="float: none;" for="<?php echo $_code ?>_create_alias_oneclick"><?php echo $this->__('Record new card data') ?></label>
27
+ </div>
28
+
29
+ <div class="input-box">
30
+ <input id="<?php echo $_code ?>_not_oneclick" type="radio" name="payment[oneclick]" value="not_oneclick" />
31
+ <label style="float: none;" for="<?php echo $_code ?>_not_oneclick"><?php echo $this->__('Not use record card data') ?></label>
32
+ </div>
33
+
34
+ <?php endif;?>
35
+ </li>
36
+
37
+ </ul>
38
+ <?php endif; ?>
39
+ <?php echo $this->__('You will be redirect to payment page after submit order.')?>
40
+ <?php $iframe = $this->getIframeConfig()?>
41
+ <script type="text/javascript">
42
+ //<![CDATA[
43
+
44
+ Review.prototype.displayIframe = function(url) {
45
+
46
+
47
+
48
+ // Create container Iframe
49
+ var hipayIframeWrapper = $('hipay_iframe_wrapper');
50
+ if (hipayIframeWrapper === null) {
51
+ hipayIframeWrapper = new Element('div', {id: 'hipay_iframe_wrapper', style: 'text-align: center; border-bottom: 1px solid #BEBCB7; border-left: 1px solid #BEBCB7; border-right: 1px solid #BEBCB7;'});
52
+ $('checkout-review-table-wrapper').insert({after: hipayIframeWrapper});
53
+
54
+ }
55
+
56
+ // generate Iframe
57
+ <?php if (strlen($iframe['iframe_width']) > 1) $iframe_width = $iframe['iframe_width']; else $iframe_width = 450;
58
+ if (strlen($iframe['iframe_height']) > 1) $iframe_height = $iframe['iframe_height']; else $iframe_height = 670;
59
+ if (strlen($iframe['iframe_style']) > 1) $iframe_style = $iframe['iframe_style']; else $iframe_style = 'border:1px solid #CCC;border-radius:15px;padding:10px;max-width:500px;'; ?>
60
+ hipayIframeWrapper.appendChild(new Element('iframe', {frameBorder: 0, width: '<?php echo $iframe_width; ?>', height: '<?php echo $iframe_height; ?>', src: url, style: '<?php echo $iframe_style; ?>'}));
61
+ //var button = new Element('button', {'class': 'button', type: 'button'}).update('<span><span>Cancel</span></span>');
62
+ //Event.observe(button, 'click', this.cancel.bind(this));
63
+ //hipayIframeWrapper.appendChild(button);
64
+
65
+
66
+
67
+ };
68
+
69
+ Review.prototype.resetLoadWaiting = function(transport){
70
+ checkout.setLoadWaiting(false, this.isSuccess);
71
+ if (transport && transport.responseText) {
72
+ try{
73
+ response = eval('(' + transport.responseText + ')');
74
+ }
75
+ catch (e) {
76
+ response = {};
77
+ }
78
+
79
+ if(response.iframeUrl)
80
+ {
81
+ $$('.btn-checkout')[0].hide();
82
+ }
83
+ }
84
+ };
85
+
86
+ Review.prototype.nextStep = function(transport){
87
+ if (transport && transport.responseText) {
88
+ try{
89
+ response = eval('(' + transport.responseText + ')');
90
+ }
91
+ catch (e) {
92
+ response = {};
93
+ }
94
+
95
+ if(response.iframeUrl)
96
+ {
97
+
98
+ this.displayIframe(response.iframeUrl);
99
+ return;
100
+ }
101
+
102
+ if (response.redirect) {
103
+ this.isSuccess = true;
104
+ location.href = response.redirect;
105
+ return;
106
+ }
107
+ if (response.success) {
108
+ this.isSuccess = true;
109
+ window.location=this.successUrl;
110
+ }
111
+ else{
112
+ var msg = response.error_messages;
113
+ if (typeof(msg)=='object') {
114
+ msg = msg.join("\n");
115
+ }
116
+ if (msg) {
117
+ alert(msg);
118
+ }
119
+ }
120
+
121
+ if (response.update_section) {
122
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
123
+ }
124
+
125
+ if (response.goto_section) {
126
+ checkout.gotoSection(response.goto_section);
127
+ }
128
+ }
129
+ };
130
+
131
+
132
+ //]]>
133
+ </script>
134
+ </div>
app/etc/modules/Allopass_Hipay.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Allopass_Hipay>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Allopass_Hipay>
8
+ </modules>
9
+ </config>
app/locale/en_US/Allopass_Hipay.csv ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "HiPay API configuration","HiPay API configuration"
2
+ "Api username","Api username"
3
+ "Api password","Api password"
4
+ "Api username test","Api username test"
5
+ "Api password test","Api password test"
6
+ "Hipay Credit Card","Hipay Credit Card"
7
+ "Enabled","Enabled"
8
+ "Title","Title"
9
+ "Payment Action","Payment Action"
10
+ "Notification from Hipay:","Notification from Hipay:"
11
+ "status","status"
12
+ "Order %s by %s","Order %s by %s"
13
+ "amount: %s","amount: %s"
14
+ "failed","failed"
15
+ "successful","successful"
16
+ "Credit Card: xxxx-%s","Credit Card: xxxx-%s"
17
+ "Hipay Transaction ID %s","Hipay Transaction ID %s"
18
+ "Payment authorization error."Payment authorization error."
19
+ "Payment capturing error.","Payment capturing error."
20
+ "Payment accepted by Hipay.","Payment accepted by Hipay."
21
+ "Waiting for capture transaction ID '%s' of amount %s","Waiting for capture transaction ID '%s' of amount %s"
22
+ "Reason","Reason"
23
+ "Code Credit Card Type Hipay not found!","Code Credit Card Type Hipay not found!"
24
+ "Authorization","Authorization"
25
+ "Sale","Sale"
26
+ "basic","basic"
27
+ "basic2","basic2"
28
+ "Order canceled automatically by cron because order is pending since %d minutes","Order canceled automatically by cron because order is pending since %d minutes"
29
+ "--Please Select--","--Please Select--"
30
+ "Credit Card Number","Credit Card Number"
31
+ "Credit Card Type","Credit Card Type"
32
+ "Credit Card Types","Credit Card Types"
33
+ "Expiration Date","Expiration Date"
34
+ "Card Verification Number","Card Verification Number"
35
+ "Record your card data for a next buy.","Record your card data for a next buy."
36
+ "Use my recorded card","Use my recorded card"
37
+ "Record new card data","Record new card data"
38
+ "Not use record card data","Not use record card data"
39
+ "You will be redirect to payment page after submit order.","You will be redirect to payment page after submit order."
40
+ "Hipay Credit Card","Hipay Credit Card"
41
+ "Enabled","Enabled"
42
+ "Title","Title"
43
+ "Order status when payment accepted","Order status when payment accepted"
44
+ "Order status when payment refused","Order status when payment refused"
45
+ "Order status when payment canceled by customer","Order status when payment canceled by customer"
46
+ "Payment Action","Payment Action"
47
+ "Credit Card Types","Credit Card Types"
48
+ "Credit Card Verification","Credit Card Verification"
49
+ "Use 3D Secure","Enable 3D Secure"
50
+ "Use Oneclick","Use Oneclick"
51
+ "Use recurring profile","Use recurring profile"
52
+ "Create invoice when payment accepted","Create invoice when payment accepted"
53
+ "Add product to cart","Add product to cart"
54
+ "Fill cart when payment canceled or refused","Fill cart when payment canceled or refused"
55
+ "Cancel pending order","Cancel pending order"
56
+ "Cancel orders stayed in pending because customer not validated payment","Cancel orders stayed in pending because customer not validated payment"
57
+ "Payment from applicable countries","Payment from applicable countries"
58
+ "Payment from Specific countries","Payment from Specific countries"
59
+ "Minimum Order Total","Minimum Order Total"
60
+ "Maximum Order Total","Maximum Order Total"
61
+ "Sort order","Sort order"
62
+ "Enable debug log","Enable debug log"
63
+ "Enable test mode","Enable test mode"
64
+ "Css Url","Css Url"
65
+ "Important, HTTPS protocol is required","Important, HTTPS protocol is required"
66
+ "Page payment template","Page payment template"
67
+ "Display card selector","Display card selector"
68
+ "What is this?","What is this?"
69
+ "Hipay Hosted","Hipay Hosted"
70
+ "You will be debit of amount %s only after submit order.","You will be debit of amount %s only after submit order."
71
+ "Pending Capture","Pending Capture"
72
+ "Capture Requested","Capture Requested"
73
+ "Refund Requested","Refund Requested"
74
+ "Capture Requested by Hipay.","Capture Requested by Hipay."
75
+ "Payment accepted by Hipay.","Payment accepted by Hipay."
76
+ "Refund Requested by Hipay.","Refund Requested by Hipay."
77
+ "Refund accepted by Hipay.","Refund accepted by Hipay."
78
+ "Your payment is in pending.","Your payment is in pending."
79
+ "Order #","Order #"
80
+ "Pending page","Pending page"
81
+ "Success page","Success page"
82
+ "Failure page","Failure page"
83
+ "Redirect page pending status","Redirect page pending status"
84
+ "Page to redirect when transaction is in pending status","Page to redirect when transaction is in pending status"
85
+ "Record your card data for recurring.","Record your card data for recurring."
86
+ "Hipay status to validate order","Hipay status to validate order"
87
+ "Display hosted page in Iframe","Display hosted page in Iframe"
88
+ "Configure Rules to activate 3D Secure","Configure Rules to activate 3D Secure"
89
+ "Rules 3D Secure","Rules 3D Secure"
90
+ "Enable for all transactions","Enable for all transactions"
91
+ "Enable for configured 3ds rules","Enable for configured 3ds rules",
92
+ "Disabled","Disabled"
93
+ "Order Attribute","Order Attribute"
94
+ "Customer Attribute","Customer Attribute"
95
+ "Order's time","Order's time"
96
+ "Billing Postcode","Billing Postcode"
97
+ "Billing Region","Billing Region"
98
+ "Billing State/Province","Billing State/Province"
99
+ "Billing Country","Billing Country"
100
+ "Midnight - 8:00 a.m.","Midnight - 8:00 a.m."
101
+ "8:00 a.m. - 3:00 p.m.","8:00 a.m. - 3:00 p.m."
102
+ "3:00 pm. - 8:00 p.m.","3:00 pm. - 8:00 p.m."
103
+ "8:00 p.m. - 11:59 p.m.","8:00 p.m. - 11:59 p.m."
104
+ "Orders count","Orders count"
105
+ "Customer is guest","Customer is guest"
106
+ "Billing and shipping addresses are differents","Billing and shipping addresses are differents"
107
+
app/locale/fr_FR/Allopass_Hipay.csv ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "HiPay API configuration","Configuration de l'API Hipay"
2
+ "Api username","Identifiant de l'API"
3
+ "Api password","Mot de passe de l'API"
4
+ "Api username test","Identifiant TEST de l'API"
5
+ "Api password test","Mot de passe TEST de l'API"
6
+ "Hipay Credit Card","Carte de crédit Hipay"
7
+ "Enabled","Activé"
8
+ "Title","Titre"
9
+ "Payment Action","Type de paiement"
10
+ "Notification from Hipay:","Notification depuis Hipay:"
11
+ "status","statut"
12
+ "Order %s by %s","Commande %s de %s"
13
+ "amount: %s","montant: %s"
14
+ "failed","échec"
15
+ "successful","succès"
16
+ "Credit Card: xxxx-%s","Carte de crédit: xxxx-%s"
17
+ "Hipay Transaction ID %s","ID de transaction HIPAY %s"
18
+ "Payment authorization error."Erreur d'autorisation de paiement."
19
+ "Payment capturing error.","Erreur de capture du paiement."
20
+ "Payment accepted by Hipay.","Paiement accepté par Hipay."
21
+ "Waiting for capture transaction ID '%s' of amount %s","En attente de la capture de la transaction '%s' du montant %s"
22
+ "Reason","Raison"
23
+ "Code Credit Card Type Hipay not found!","Code du type de la carte de crédit non trouvé!"
24
+ "Authorization","Autorisation"
25
+ "Sale","Vente"
26
+ "basic","basic"
27
+ "basic2","basic2"
28
+ "Order canceled automatically by cron because order is pending since %d minutes","Commande annulée automatiquement par le cron car elle est en attente depuis %d minutes."
29
+ "--Please Select--","--Votre choix--"
30
+ "Credit Card Number","Numéro de carte bancaire"
31
+ "Credit Card Number: xxxx-%s","<strong>Numéro de carte de paiement :</strong> <span class=""nowrap"">xxxx-%s</span>"
32
+ "Credit Card Type","Type de carte de crédit"
33
+ "Credit Card Type: %s","<strong>Type de carte de paiement :</strong> <span class=""nowrap"">%s</span>"
34
+ "Credit Card Types","Types de cartes de paiement"
35
+ "Month","Mois"
36
+ "Year","Année"
37
+ "Expiration date","Date d'expiration"
38
+ "Expiration Date","Date d'expiration"
39
+ "Card Verification Number","Numéro de vérification"
40
+ "Record your card data for a next buy.","Enregistrez une empreinte de carte bancaire pour un prochain achat."
41
+ "Use my recorded card","Utiliser ma carte pré-enregistrée."
42
+ "Actual card","Carte actuelle"
43
+ "Record new card data","Remplacer vos données de Carte Bancaire."
44
+ "Not use record card data","Payer directement avec une autre Carte Bancaire."
45
+ "You will be redirect to payment page after submit order.","Vous serez redirigé vers la page de paiment après la validation de la commande."
46
+ "Order status when payment accepted","Statut de la commande quand le paiement est accepté."
47
+ "Order status when payment refused","Statut de la commande quand le paiement est refusé."
48
+ "Order status when payment canceled by customer","Statut de la commande quand le paiement est annulé par le client."
49
+ "Credit Card Verification","Vérification de la carte de crédit"
50
+ "Use 3D Secure","Activer 3DS"
51
+ "Use Oneclick","Activer le paiement oneclick"
52
+ "Use recurring profile","Activer le profile récurrent"
53
+ "Create invoice when payment accepted","Créer une facture quand le paiement est accepté"
54
+ "Add product to cart","Mettre à jour le panier"
55
+ "Fill cart when payment canceled or refused","Remet à jour le panier quand le paiement est annulé ou refusé."
56
+ "Cancel pending order","Annuler les commandes en attentes"
57
+ "Cancel orders stayed in pending because customer not validated payment","Annule les commandes en attentes depuis 30 minutes."
58
+ "Payment from Applicable Countries","Mode de paiement autorisé pour"
59
+ "Payment from Specific Countries","Mode de paiement autorisé pour les pays spécifiques"
60
+ "Minimum Order Total","Montant mini de commande"
61
+ "Maximum Order Total","Montant maxi de commande"
62
+ "Sort Order","Ordre de tri"
63
+ "Enable debug log","Mode debug"
64
+ "Enable test mode","Mode TEST"
65
+ "Css Url","Css Url"
66
+ "Important, HTTPS protocol is required","Important, le protocole HTTPS est requis."
67
+ "Page payment template","Template de la page de paiement."
68
+ "Display card selector","Afficher le sélecteur de carte"
69
+ "What is this?","Aide ?"
70
+ "Hipay Hosted","Hipay page hébergée"
71
+ "You will be debit of amount %s only after submit order.","Vous serez débité d'un montant de %s uniquement après validation de la commande à la prochaine étape."
72
+ "Pending Capture","En attente de capture"
73
+ "Capture Requested","Capture demandée"
74
+ "Refund Requested","Remboursement demandé"
75
+ "Capture Requested by Hipay.","Capture demandée by Hipay."
76
+ "Payment accepted by Hipay.","Paiement accepté by Hipay."
77
+ "Refund Requested by Hipay.","Remboursement demandé by Hipay."
78
+ "Refund accepted by Hipay.","Remboursement accepté by Hipay."
79
+ "Your payment is in pending.","Votre paiement est en attente de validation."
80
+ "Order #","Commande #"
81
+ "Pending page","Page en attente"
82
+ "Success page","Page succès"
83
+ "Failure page","Page échec"
84
+ "Redirect page pending status","Page de redirection statut en attente"
85
+ "Page to redirect when transaction is in pending status","Page de redirection quand le statut de transaction est en attente"
86
+ "Record your card data for recurring.","Enregistrez une empreinte de carte bancaire pour la récurrence du paiement."
87
+ "Hipay status to validate order","Statut Hipay validant la commande"
88
+ "Display hosted page in Iframe","Affiche la page de paiement dans une Iframe"
89
+ "Configure Rules to activate 3D Secure","Configurer les règles d'activation du 3d secure"
90
+ "Rules 3D Secure","Règles 3d Secure"
91
+ "Enable for all transactions","Activé pour toutes les transactions"
92
+ "Enable for configured 3ds rules","Activé pour les transactions défini par les règles 3DS (ci-dessous)",
93
+ "Disabled","Désactivé"
94
+ "Order Attribute","Attribut de la commande"
95
+ "Customer Attribute","Attribut du client"
96
+ "Order's time","Heure de la commande"
97
+ "Billing Postcode","Code postal de facturation"
98
+ "Billing Region","Region de facturation"
99
+ "Billing State/Province","Etat/province de la facturation "
100
+ "Billing Country","Pays de la facturation"
101
+ "Midnight - 8:00 a.m.","Entre minuit(inclu) et 8H"
102
+ "8:00 a.m. - 3:00 p.m.","Entre 8H et 15H(inclu)"
103
+ "3:00 pm. - 8:00 p.m.","Entre 15H et 20H(inclu)"
104
+ "8:00 p.m. - 11:59 p.m.","Entre 20H et minuit"
105
+ "Orders count","Nombre de commande passées (inclu celle en cours)"
106
+ "Customer is guest","Commande en tant qu'invité"
107
+ "Billing and shipping addresses are differents","Adresses de facturation et de livraison différentes"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Allopass_Hipay</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>HiPay Fullservice Payment Methods</summary>
10
+ <description>HiPay Fullservice payment methods with hosted page and API</description>
11
+ <notes>-New iframe templates</notes>
12
+ <authors><author><name>Kassim_Profileo</name><user>Kassim_Profileo</user><email>kassim@profileo.com</email></author></authors>
13
+ <date>2014-04-03</date>
14
+ <time>09:44:22</time>
15
+ <contents><target name="magecommunity"><dir name="Allopass"><dir name="Hipay"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="3dsRule.php" hash="b2e3f5307617948a1c74262ce55419eb"/></dir></dir></dir></dir></dir><dir name="Checkout"><file name="Pending.php" hash="48112f7e2fdcc79ee9431cf5350e223f"/></dir><dir name="Form"><file name="Abstract.php" hash="3a93bc3c0ee9162617437875a86bd36a"/><file name="Cc.php" hash="8be2f51b1ce2274e8afbc9666ed4c9ba"/><file name="Hosted.php" hash="1cbc3fe21de97bba192cd5e651dfaeae"/></dir><dir name="Info"><file name="Cc.php" hash="2f477423660d446c8956b5353b349172"/><file name="Hosted.php" hash="09bc0d102e35da8aad2c81f27cd8ba82"/></dir></dir><dir name="Controller"><file name="Payment.php" hash="06f798f91e1247f4958d1c22d8161d89"/></dir><dir name="Helper"><file name="Data.php" hash="e6d5f091392e105a21099815a2ac7f9d"/></dir><dir name="Model"><dir name="Api"><dir name="Http"><dir name="Client"><dir name="Adapter"><file name="Curl.php" hash="cebf9e03d310e65f23a2a4ddc980e26f"/><file name="Stream.php" hash="5a110dd1f33ee4c8319cec396fc4fa40"/></dir></dir></dir><file name="Request.php" hash="c73ab07965010a9d5da8a6f988f257e0"/><dir name="Response"><file name="Abstract.php" hash="a430ca978e61796696ae4ead61efdb60"/><file name="Error.php" hash="57386fde5e5993c1126418025093a58a"/><file name="Gateway.php" hash="49b0e43a55e223df601884cfd9a0d2c5"/><file name="Notification.php" hash="0f7373ec3435b477424352c058f42255"/><file name="Vault.php" hash="47b962a59c150ffd653ba4054bc053d0"/></dir></dir><file name="Config.php" hash="7b2b6b8d4568d5ce33decc529e45b60b"/><dir name="Log"><file name="Adapter.php" hash="9d5533d5d3622c72cbc84abfd4e3116c"/></dir><dir name="Method"><file name="Abstract.php" hash="1574c7f8335ef0513fde82ab95d066d5"/><file name="Cbc.php" hash="49d1b0e2ad320c1a78043bb7231de930"/><file name="Cc.php" hash="28bfd701d2aef69945df5af828993e77"/><file name="Dexia.php" hash="32d47390b7d48e19e4e5cf2b2abfa0cd"/><file name="Giropay.php" hash="ad5965ae76b9b2b9061f351e9f5fac74"/><file name="Hosted.php" hash="c4ac69e2b5bc07314d60c13cb1ccae26"/><file name="Ideal.php" hash="2a29b8ae0df1e3ae4e1f27fba31af70b"/><file name="Ing.php" hash="9a8f0a6e4a193c2c234987e4d68d6184"/><file name="Kbc.php" hash="7c3e32222e86261b55b0a64c382d8df9"/><file name="Przelewy24.php" hash="00b695e7b34b69f36d593587a9b5dcdd"/><file name="Przelewy24Api.php" hash="7d594585e929de59d5295bfeeff6b219"/><file name="Qiwi.php" hash="be4c74c534076b8cebd6ca1f74fe3b3b"/><file name="Sisal.php" hash="94565498ace1b5e29ae80e84951d655e"/><file name="SisalApi.php" hash="e0f93a847f833509255e36086faedaa6"/><file name="Sofort.php" hash="fa6cb68aff431c2dc91e7b3c62a29aaa"/><file name="SofortApi.php" hash="7f889f5f0986fc6dce71d847a854f1ab"/><file name="Webmoney.php" hash="33e86795573edcea55546c78ae9267f6"/><file name="WebmoneyApi.php" hash="ce8bc5c4c7ab75907b1ca63fd0ebedee"/><file name="Yandex.php" hash="ad5c8a351029b0f2f2df9806fb3cbb9b"/><file name="YandexApi.php" hash="ef4e7f17fa81f5ed63988054dee12c97"/></dir><file name="Observer.php" hash="a8a071ebc588374f71f8386f430011af"/><dir name="Resource"><dir name="Rule"><file name="Collection.php" hash="b4dd0d851cda670c6aafad0cf588b106"/></dir><file name="Rule.php" hash="115bccaa9e4d37ed03e179147ab3788d"/></dir><dir name="Rule"><dir name="Condition"><file name="Address.php" hash="a3cce578d61204adbc4a3e6c4791d055"/><file name="Combine.php" hash="e57da0bfd13c85721ef06d9f5c1d5a45"/><file name="Customer.php" hash="71117a9fe5f0cba3828da17c316a95a5"/><dir name="Product"><file name="Combine.php" hash="b99adc27124c3c6f56d04f0bcb5a42be"/><file name="Found.php" hash="bc266762458faaba326b7d7245b688a8"/><file name="Subselect.php" hash="5c0d482cddd69d82350bc5fec15c40b7"/></dir><file name="Product.php" hash="5186cb9be313c7a772a11613ff4d1406"/></dir><file name="Config.php" hash="7ae56d141ffa1da19faa2d26831f1c7d"/></dir><file name="Rule.php" hash="f4f865fc7e0e2204fd5b804b0a000ddb"/><dir name="Source"><file name="3ds.php" hash="26e27c20dd31babe710cb9470491fc40"/><file name="CcType.php" hash="1f53fb6d8b95c5457e0e59ab910681ca"/><file name="CcTypeHosted.php" hash="7ba8a5fe85f5a0fd93a8a99064ea5487"/><dir name="Order"><file name="HipayStatusValidate.php" hash="63414f71ce035909310f27842bc1b511"/><dir name="Status"><file name="Accepted.php" hash="77baf18f2ca518634a8b7091ad424e14"/><file name="Canceled.php" hash="49a6f0b6033e698fbefe01967b81b21d"/><file name="New.php" hash="226d2f1a5d441dbd6404ea342555e893"/><file name="Refused.php" hash="ea180aef11a6e8309623499d3abb3c5b"/></dir><file name="Status.php" hash="4d1f755c9a5b9747d7c5de83a9f26cee"/></dir><file name="PaymentAction.php" hash="10638f85360e7693819cbbfd156bed72"/><file name="Pendingredirect.php" hash="f0c3125415535637c159c97fc2627740"/><file name="Template.php" hash="47d84783ef5e3041bbbe9c5622e7e65f"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RuleController.php" hash="5fcf2a0b9807d0f8089b3f0cdfe30a24"/></dir><file name="CbcController.php" hash="11a793cfef50322482b4d1e44f7fb427"/><file name="CcController.php" hash="2e45012894cac90a24c2017a427258b5"/><file name="CheckoutController.php" hash="8d565df4627074dd62c59e6d5b301ce0"/><file name="DexiaController.php" hash="abafa7205262125aef603f0d51445ebd"/><file name="GiropayController.php" hash="93ebe6d63e60627ee86815a7cc23006b"/><file name="HostedController.php" hash="f0bd2d41f36b0453e42063531b88d4a3"/><file name="IdealController.php" hash="49bc5c1a52c98cef934b45ce27da574a"/><file name="IngController.php" hash="43b8ae9e752d5268a51a164abc98df9f"/><file name="KbcController.php" hash="fad29361513cc354dcf200fde25265da"/><file name="NotifyController.php" hash="00a9240f4d73645ada386477c6643eb1"/><file name="Przelewy24Controller.php" hash="d6923f98e8a53d8b8becd1d5ef99e0d0"/><file name="Przelewy24apiController.php" hash="bc488ef00a5a063d05aa12c545d8e8fe"/><file name="QiwiController.php" hash="6b3e05b2910dae0b919c50cb06363c57"/><file name="SisalController.php" hash="32bdb5bf400fa1c6ee5bfb2c79b889f9"/><file name="SisalapiController.php" hash="23a04c3fe9470ef98ce84fcf5c1dd9fe"/><file name="SofortController.php" hash="5479f2e8c3043ad0dd51167bd9bcf623"/><file name="SofortapiController.php" hash="74aa59c7c7795f9f61c6b4bfeae193e3"/><file name="WebmoneyController.php" hash="b52fdbc662da23f839750c9919aad809"/><file name="WebmoneyapiController.php" hash="f34dc66aca5218930be548c88e7e9004"/><file name="YandexController.php" hash="629ec07271f8a11d7c88824154b637f0"/><file name="YandexapiController.php" hash="9741c2a9427866895907629af1e9ed98"/></dir><dir name="etc"><file name="config.xml" hash="6447c17a34c7f25ba37b5172f91826a8"/><file name="system.xml" hash="22626c43e9acdf8b67b6d9deb9793b53"/></dir><dir name="sql"><dir name="allopass_hipay_setup"><file name="mysql4-install-0.1.0.php" hash="820dc1e282c2c88deeb167d61918088b"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="af83b289e454c2d2ab91d2a6800d079a"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="1aa9291c5ac40a03ccbf3bcb6ce0c47e"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="17ddfaae63edc655fec04dcd5f96136a"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="5dfaafe02016ff47dfd80c89effaaabb"/></dir></dir></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="hipay.xml" hash="3b054d16830742a04ff9fc49038ddb61"/></dir><dir name="template"><dir name="hipay"><dir name="checkout"><file name="pending.phtml" hash="34e6bba88ea5fdd6b4ea71595de638d6"/></dir><dir name="form"><file name="cc.phtml" hash="402c6497783c1b1a0449e60777b61b9d"/><file name="hosted.phtml" hash="2b9ab4d8fa2223bb5ee7b7ae8e53ab85"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="hipay.xml" hash="d55ac9fc80fa05741c4f7a1457211a77"/></dir><dir name="template"><dir name="hipay"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="rules.phtml" hash="b25ca0397baffa2306ab70776b2febac"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Allopass_Hipay.xml" hash="fd0ac2e9080c0a432a3a7b6d969171c0"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Allopass_Hipay.csv" hash="3879d574afc3e028875e4f4f846ac104"/></dir><dir name="fr_FR"><file name="Allopass_Hipay.csv" hash="fdc5bb9fe8061f5d0d381d28defa3056"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="hipay"><dir name="js"><file name="rules.js" hash="c9f87ded0b3a8505e78ab2584c2f098f"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/hipay/js/rules.js ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category Mage
21
+ * @package Mage_Adminhtml
22
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ var VarienRulesForm = new Class.create();
27
+ VarienRulesForm.prototype = {
28
+ initialize : function(parent, newChildUrl){
29
+ this.parent = $(parent);
30
+ this.newChildUrl = newChildUrl;
31
+ this.shownElement = null;
32
+ this.updateElement = null;
33
+ this.chooserSelectedItems = $H({});
34
+ this.readOnly = false;
35
+
36
+ var elems = this.parent.getElementsByClassName('rule-param');
37
+ for (var i=0; i<elems.length; i++) {
38
+ this.initParam(elems[i]);
39
+ }
40
+ },
41
+
42
+ setReadonly: function (readonly){
43
+ this.readOnly = readonly;
44
+ var elems = this.parent.getElementsByClassName('rule-param-remove');
45
+ for (var i=0; i<elems.length; i++) {
46
+ var element = elems[i];
47
+ if (this.readOnly) {
48
+ element.hide();
49
+ } else {
50
+ element.show();
51
+ }
52
+ }
53
+
54
+ var elems = this.parent.getElementsByClassName('rule-param-new-child');
55
+ for (var i=0; i<elems.length; i++) {
56
+ var element = elems[i];
57
+ if (this.readOnly) {
58
+ element.hide();
59
+ } else {
60
+ element.show();
61
+ }
62
+ }
63
+
64
+ var elems = this.parent.getElementsByClassName('rule-param');
65
+ for (var i=0; i<elems.length; i++) {
66
+ var container = elems[i];
67
+ var label = Element.down(container, '.label');
68
+ if (label) {
69
+ if (this.readOnly) {
70
+ label.addClassName('label-disabled');
71
+ } else {
72
+ label.removeClassName('label-disabled');
73
+ }
74
+ }
75
+ }
76
+ },
77
+
78
+ initParam: function (container) {
79
+ container.rulesObject = this;
80
+ var label = Element.down(container, '.label');
81
+ if (label) {
82
+ Event.observe(label, 'click', this.showParamInputField.bind(this, container));
83
+ }
84
+
85
+ var elem = Element.down(container, '.element');
86
+ if (elem) {
87
+ var trig = elem.down('.rule-chooser-trigger');
88
+ if (trig) {
89
+ Event.observe(trig, 'click', this.toggleChooser.bind(this, container));
90
+ }
91
+
92
+ var apply = elem.down('.rule-param-apply');
93
+ if (apply) {
94
+ Event.observe(apply, 'click', this.hideParamInputField.bind(this, container));
95
+ } else {
96
+ elem = elem.down('.element-value-changer');
97
+ elem.container = container;
98
+ if (!elem.multiple) {
99
+ Event.observe(elem, 'change', this.hideParamInputField.bind(this, container));
100
+ }
101
+ Event.observe(elem, 'blur', this.hideParamInputField.bind(this, container));
102
+ }
103
+ }
104
+
105
+ var remove = Element.down(container, '.rule-param-remove');
106
+ if (remove) {
107
+ Event.observe(remove, 'click', this.removeRuleEntry.bind(this, container));
108
+ }
109
+ },
110
+
111
+ showChooserElement: function (chooser) {
112
+ this.chooserSelectedItems = $H({});
113
+ if (chooser.hasClassName('no-split')) {
114
+ this.chooserSelectedItems.set(this.updateElement.value, 1);
115
+ } else {
116
+ var values = this.updateElement.value.split(','), s = '';
117
+ for (i=0; i<values.length; i++) {
118
+ s = values[i].strip();
119
+ if (s!='') {
120
+ this.chooserSelectedItems.set(s,1);
121
+ }
122
+ }
123
+ }
124
+ new Ajax.Request(chooser.getAttribute('url'), {
125
+ evalScripts: true,
126
+ parameters: {'form_key': FORM_KEY, 'selected[]':this.chooserSelectedItems.keys() },
127
+ onSuccess: function(transport) {
128
+ if (this._processSuccess(transport)) {
129
+ $(chooser).update(transport.responseText);
130
+ this.showChooserLoaded(chooser, transport);
131
+ }
132
+ }.bind(this),
133
+ onFailure: this._processFailure.bind(this)
134
+ });
135
+ },
136
+
137
+ showChooserLoaded: function(chooser, transport) {
138
+ chooser.style.display = 'block';
139
+ },
140
+
141
+ showChooser: function (container, event) {
142
+ var chooser = container.up('li');
143
+ if (!chooser) {
144
+ return;
145
+ }
146
+ chooser = chooser.down('.rule-chooser');
147
+ if (!chooser) {
148
+ return;
149
+ }
150
+ this.showChooserElement(chooser);
151
+ },
152
+
153
+ hideChooser: function (container, event) {
154
+ var chooser = container.up('li');
155
+ if (!chooser) {
156
+ return;
157
+ }
158
+ chooser = chooser.down('.rule-chooser');
159
+ if (!chooser) {
160
+ return;
161
+ }
162
+ chooser.style.display = 'none';
163
+ },
164
+
165
+ toggleChooser: function (container, event) {
166
+ if (this.readOnly) {
167
+ return false;
168
+ }
169
+
170
+ var chooser = container.up('li').down('.rule-chooser');
171
+ if (!chooser) {
172
+ return;
173
+ }
174
+ if (chooser.style.display=='block') {
175
+ chooser.style.display = 'none';
176
+ this.cleanChooser(container, event);
177
+ } else {
178
+ this.showChooserElement(chooser);
179
+ }
180
+ },
181
+
182
+ cleanChooser: function (container, event) {
183
+ var chooser = container.up('li').down('.rule-chooser');
184
+ if (!chooser) {
185
+ return;
186
+ }
187
+ chooser.innerHTML = '';
188
+ },
189
+
190
+ showParamInputField: function (container, event) {
191
+ if (this.readOnly) {
192
+ return false;
193
+ }
194
+
195
+ if (this.shownElement) {
196
+ this.hideParamInputField(this.shownElement, event);
197
+ }
198
+
199
+ Element.addClassName(container, 'rule-param-edit');
200
+ var elemContainer = Element.down(container, '.element');
201
+
202
+ var elem = Element.down(elemContainer, 'input.input-text');
203
+ if (elem) {
204
+ elem.focus();
205
+ if (elem && elem.id && elem.id.match(/__value$/)) {
206
+ this.updateElement = elem;
207
+ //this.showChooser(container, event);
208
+ }
209
+
210
+ }
211
+
212
+ var elem = Element.down(elemContainer, '.element-value-changer');
213
+ if (elem) {
214
+ elem.focus();
215
+ // trying to emulate enter to open dropdown
216
+ // if (document.createEventObject) {
217
+ // var event = document.createEventObject();
218
+ // event.altKey = true;
219
+ // event.keyCode = 40;
220
+ // elem.fireEvent("onkeydown", evt);
221
+ // } else {
222
+ // var event = document.createEvent("Events");
223
+ // event.altKey = true;
224
+ // event.keyCode = 40;
225
+ // elem.dispatchEvent(event);
226
+ // }
227
+ }
228
+
229
+ this.shownElement = container;
230
+ },
231
+
232
+ hideParamInputField: function (container, event) {
233
+ Element.removeClassName(container, 'rule-param-edit');
234
+ var label = Element.down(container, '.label'), elem;
235
+
236
+ if (!container.hasClassName('rule-param-new-child')) {
237
+ elem = Element.down(container, '.element-value-changer');
238
+ if (elem && elem.options) {
239
+ var selectedOptions = [];
240
+ for (i=0; i<elem.options.length; i++) {
241
+ if (elem.options[i].selected) {
242
+ selectedOptions.push(elem.options[i].text);
243
+ }
244
+ }
245
+
246
+ var str = selectedOptions.join(', ');
247
+ label.innerHTML = str!='' ? str : '...';
248
+ // if (elem && elem.selectedIndex>=0) {
249
+ // var str = elem.options[elem.selectedIndex].text;
250
+ // label.innerHTML = str!='' ? str : '...';
251
+ // }
252
+ }
253
+
254
+ elem = Element.down(container, 'input.input-text');
255
+ if (elem) {
256
+ var str = elem.value.replace(/(^\s+|\s+$)/g, '');
257
+ elem.value = str;
258
+ if (str=='') {
259
+ str = '...';
260
+ } else if (str.length>30) {
261
+ str = str.substr(0, 30)+'...';
262
+ }
263
+ label.innerHTML = str.escapeHTML();
264
+ }
265
+ } else {
266
+ elem = Element.down(container, '.element-value-changer');
267
+ if (elem.value) {
268
+ this.addRuleNewChild(elem);
269
+ }
270
+ elem.value = '';
271
+ }
272
+
273
+ if (elem && elem.id && elem.id.match(/__value$/)) {
274
+ this.hideChooser(container, event);
275
+ this.updateElement = null;
276
+ }
277
+
278
+ this.shownElement = null;
279
+ },
280
+
281
+ addRuleNewChild: function (elem) {
282
+ var parent_id = elem.id.replace(/^.*__(.*)__.*$/, '$1');
283
+ var children_ul = $(elem.id.replace(/__/g, ':').replace(/[^:]*$/, 'children').replace(/:/g, '__'));
284
+ var max_id = 0, i;
285
+ var children_inputs = Selector.findChildElements(children_ul, $A(['input.hidden']));
286
+ var nb = children_inputs.length;
287
+ if (children_inputs.length) {
288
+ children_inputs.each(function(el){
289
+ if (el.id.match(/__type$/)) {
290
+ var idReplace = el.id.replace(/^.*__.*?([0-9]+)_.*__.*$/, '$1');// modified form clean payment method name
291
+ i = 1 * idReplace;
292
+ max_id = i > max_id ? i : max_id;
293
+ }
294
+ });
295
+ }
296
+ var new_id = parent_id + '--' + (max_id + 1);
297
+ //alert(elem.value + " :: " + elem.id);
298
+ var new_type = elem.value;
299
+ var new_elem = document.createElement('LI');
300
+ new_elem.className = 'rule-param-wait';
301
+ new_elem.innerHTML = Translator.translate('Please wait, loading...');
302
+ children_ul.insertBefore(new_elem, $(elem).up('li'));
303
+
304
+ new Ajax.Request(this.newChildUrl, {
305
+ evalScripts: true,
306
+ parameters: {form_key: FORM_KEY, type:new_type.replace('/','-'), id:new_id },
307
+ onComplete: this.onAddNewChildComplete.bind(this, new_elem),
308
+ onSuccess: function(transport) {
309
+ if(this._processSuccess(transport)) {
310
+ $(new_elem).update(transport.responseText);
311
+ }
312
+ }.bind(this),
313
+ onFailure: this._processFailure.bind(this)
314
+ });
315
+ },
316
+
317
+ _processSuccess : function(transport) {
318
+ if (transport.responseText.isJSON()) {
319
+ var response = transport.responseText.evalJSON()
320
+ if (response.error) {
321
+ alert(response.message);
322
+ }
323
+ if(response.ajaxExpired && response.ajaxRedirect) {
324
+ setLocation(response.ajaxRedirect);
325
+ }
326
+ return false;
327
+ }
328
+ return true;
329
+ },
330
+
331
+ _processFailure : function(transport) {
332
+ location.href = BASE_URL;
333
+ },
334
+
335
+ onAddNewChildComplete: function (new_elem) {
336
+ if (this.readOnly) {
337
+ return false;
338
+ }
339
+
340
+ $(new_elem).removeClassName('rule-param-wait');
341
+ var elems = new_elem.getElementsByClassName('rule-param');
342
+ for (var i=0; i<elems.length; i++) {
343
+ this.initParam(elems[i]);
344
+ }
345
+ },
346
+
347
+ removeRuleEntry: function (container, event) {
348
+ var li = Element.up(container, 'li');
349
+ li.parentNode.removeChild(li);
350
+ },
351
+
352
+ chooserGridInit: function (grid) {
353
+ //grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
354
+ },
355
+
356
+ chooserGridRowInit: function (grid, row) {
357
+ if (!grid.reloadParams) {
358
+ grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
359
+ }
360
+ },
361
+
362
+ chooserGridRowClick: function (grid, event) {
363
+ var trElement = Event.findElement(event, 'tr');
364
+ var isInput = Event.element(event).tagName == 'INPUT';
365
+ if (trElement) {
366
+ var checkbox = Element.select(trElement, 'input');
367
+ if (checkbox[0]) {
368
+ var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
369
+ grid.setCheckboxChecked(checkbox[0], checked);
370
+
371
+ }
372
+ }
373
+ },
374
+
375
+ chooserGridCheckboxCheck: function (grid, element, checked) {
376
+ if (checked) {
377
+ if (!element.up('th')) {
378
+ this.chooserSelectedItems.set(element.value,1);
379
+ }
380
+ } else {
381
+ this.chooserSelectedItems.unset(element.value);
382
+ }
383
+ grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
384
+ this.updateElement.value = this.chooserSelectedItems.keys().join(', ');
385
+ }
386
+ }