Allopass_Hipay - Version 1.3.0

Version Notes

Download this release

Release Info

Developer Kassim Belghait
Extension Allopass_Hipay
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.4 to 1.3.0

Files changed (165) hide show
  1. app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit.php +0 -0
  2. app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit/Form.php +0 -0
  3. app/code/community/Allopass/Hipay/Block/Adminhtml/Customer/Edit/Tab/Card.php +2 -2
  4. app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile.php +0 -0
  5. app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit.php +0 -0
  6. app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit/Form.php +0 -0
  7. app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Grid.php +0 -0
  8. app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment.php +0 -0
  9. app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit.php +0 -0
  10. app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit/Form.php +0 -0
  11. app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Grid.php +0 -0
  12. app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/3dsRule.php +1 -1
  13. app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/Allowsplitpayment.php +0 -0
  14. app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/MultiselectSortable.php +0 -0
  15. app/code/community/Allopass/Hipay/Block/Card.php +0 -0
  16. app/code/community/Allopass/Hipay/Block/Card/Edit.php +0 -0
  17. app/code/community/Allopass/Hipay/Block/Checkout/Pending.php +0 -0
  18. app/code/community/Allopass/Hipay/Block/Form/Abstract.php +3 -5
  19. app/code/community/Allopass/Hipay/Block/Form/Cc.php +0 -0
  20. app/code/community/Allopass/Hipay/Block/Form/Hosted.php +0 -0
  21. app/code/community/Allopass/Hipay/Block/Info/Cc.php +0 -0
  22. app/code/community/Allopass/Hipay/Block/Info/Hosted.php +0 -0
  23. app/code/community/Allopass/Hipay/Controller/Payment.php +1 -0
  24. app/code/community/Allopass/Hipay/Helper/Data.php +34 -1
  25. app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Curl.php +0 -0
  26. app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Stream.php +0 -0
  27. app/code/community/Allopass/Hipay/Model/Api/Request.php +0 -0
  28. app/code/community/Allopass/Hipay/Model/Api/Response/Abstract.php +0 -0
  29. app/code/community/Allopass/Hipay/Model/Api/Response/Error.php +0 -0
  30. app/code/community/Allopass/Hipay/Model/Api/Response/Gateway.php +0 -0
  31. app/code/community/Allopass/Hipay/Model/Api/Response/Notification.php +0 -0
  32. app/code/community/Allopass/Hipay/Model/Api/Response/Vault.php +0 -0
  33. app/code/community/Allopass/Hipay/Model/Card.php +0 -0
  34. app/code/community/Allopass/Hipay/Model/Config.php +0 -0
  35. app/code/community/Allopass/Hipay/Model/Log/Adapter.php +0 -0
  36. app/code/community/Allopass/Hipay/Model/Method/Abstract.php +191 -51
  37. app/code/community/Allopass/Hipay/Model/Method/Cbc.php +0 -0
  38. app/code/community/Allopass/Hipay/Model/Method/Cc.php +12 -20
  39. app/code/community/Allopass/Hipay/Model/Method/CcXtimes.php +8 -0
  40. app/code/community/Allopass/Hipay/Model/Method/Dexia.php +0 -0
  41. app/code/community/Allopass/Hipay/Model/Method/Giropay.php +0 -0
  42. app/code/community/Allopass/Hipay/Model/Method/Hosted.php +0 -0
  43. app/code/community/Allopass/Hipay/Model/Method/HostedXtimes.php +8 -0
  44. app/code/community/Allopass/Hipay/Model/Method/Ideal.php +0 -0
  45. app/code/community/Allopass/Hipay/Model/Method/Ing.php +0 -0
  46. app/code/community/Allopass/Hipay/Model/Method/Kbc.php +0 -0
  47. app/code/community/Allopass/Hipay/Model/Method/PaypalApi.php +2 -1
  48. app/code/community/Allopass/Hipay/Model/Method/Przelewy24.php +0 -0
  49. app/code/community/Allopass/Hipay/Model/Method/Przelewy24Api.php +0 -0
  50. app/code/community/Allopass/Hipay/Model/Method/Qiwi.php +0 -0
  51. app/code/community/Allopass/Hipay/Model/Method/Sdd.php +168 -0
  52. app/code/community/Allopass/Hipay/Model/Method/Sisal.php +0 -0
  53. app/code/community/Allopass/Hipay/Model/Method/SisalApi.php +0 -0
  54. app/code/community/Allopass/Hipay/Model/Method/Sofort.php +0 -0
  55. app/code/community/Allopass/Hipay/Model/Method/SofortApi.php +0 -0
  56. app/code/community/Allopass/Hipay/Model/Method/Webmoney.php +0 -0
  57. app/code/community/Allopass/Hipay/Model/Method/WebmoneyApi.php +0 -0
  58. app/code/community/Allopass/Hipay/Model/Method/Yandex.php +0 -0
  59. app/code/community/Allopass/Hipay/Model/Method/YandexApi.php +0 -0
  60. app/code/community/Allopass/Hipay/Model/Observer.php +8 -10
  61. app/code/community/Allopass/Hipay/Model/PaymentProfile.php +0 -0
  62. app/code/community/Allopass/Hipay/Model/Resource/Card.php +0 -0
  63. app/code/community/Allopass/Hipay/Model/Resource/Card/Collection.php +0 -0
  64. app/code/community/Allopass/Hipay/Model/Resource/PaymentProfile.php +0 -0
  65. app/code/community/Allopass/Hipay/Model/Resource/PaymentProfile/Collection.php +0 -0
  66. app/code/community/Allopass/Hipay/Model/Resource/Rule.php +0 -0
  67. app/code/community/Allopass/Hipay/Model/Resource/Rule/Collection.php +0 -0
  68. app/code/community/Allopass/Hipay/Model/Resource/SplitPayment.php +0 -0
  69. app/code/community/Allopass/Hipay/Model/Resource/SplitPayment/Collection.php +0 -0
  70. app/code/community/Allopass/Hipay/Model/Rule.php +0 -0
  71. app/code/community/Allopass/Hipay/Model/Rule/Condition/Address.php +0 -0
  72. app/code/community/Allopass/Hipay/Model/Rule/Condition/Combine.php +0 -0
  73. app/code/community/Allopass/Hipay/Model/Rule/Condition/Customer.php +0 -0
  74. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product.php +0 -0
  75. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Combine.php +0 -0
  76. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Found.php +0 -0
  77. app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Subselect.php +0 -0
  78. app/code/community/Allopass/Hipay/Model/Rule/Config.php +0 -0
  79. app/code/community/Allopass/Hipay/Model/Source/3ds.php +0 -0
  80. app/code/community/Allopass/Hipay/Model/Source/CcType.php +0 -0
  81. app/code/community/Allopass/Hipay/Model/Source/CcTypeHosted.php +0 -0
  82. app/code/community/Allopass/Hipay/Model/Source/Order/HipayStatusValidate.php +0 -0
  83. app/code/community/Allopass/Hipay/Model/Source/Order/Status.php +0 -0
  84. app/code/community/Allopass/Hipay/Model/Source/Order/Status/Accepted.php +0 -0
  85. app/code/community/Allopass/Hipay/Model/Source/Order/Status/Canceled.php +0 -0
  86. app/code/community/Allopass/Hipay/Model/Source/Order/Status/New.php +0 -0
  87. app/code/community/Allopass/Hipay/Model/Source/Order/Status/Refused.php +0 -0
  88. app/code/community/Allopass/Hipay/Model/Source/PaymentAction.php +0 -0
  89. app/code/community/Allopass/Hipay/Model/Source/PaymentProfile.php +0 -0
  90. app/code/community/Allopass/Hipay/Model/Source/Pendingredirect.php +0 -0
  91. app/code/community/Allopass/Hipay/Model/Source/Template.php +0 -0
  92. app/code/community/Allopass/Hipay/Model/SplitPayment.php +6 -1
  93. app/code/community/Allopass/Hipay/Model/System/Config/Backend/CcTypes.php +0 -0
  94. app/code/community/Allopass/Hipay/controllers/Adminhtml/CardController.php +0 -0
  95. app/code/community/Allopass/Hipay/controllers/Adminhtml/PaymentController.php +14 -17
  96. app/code/community/Allopass/Hipay/controllers/Adminhtml/PaymentProfileController.php +0 -0
  97. app/code/community/Allopass/Hipay/controllers/Adminhtml/RuleController.php +0 -0
  98. app/code/community/Allopass/Hipay/controllers/{Sales → Adminhtml/Sales}/Order/CreateController.php +3 -3
  99. app/code/community/Allopass/Hipay/controllers/Adminhtml/SplitPaymentController.php +0 -0
  100. app/code/community/Allopass/Hipay/controllers/CardController.php +4 -3
  101. app/code/community/Allopass/Hipay/controllers/CbcController.php +0 -0
  102. app/code/community/Allopass/Hipay/controllers/CcController.php +0 -0
  103. app/code/community/Allopass/Hipay/controllers/CcxtimesController.php +15 -0
  104. app/code/community/Allopass/Hipay/controllers/CheckoutController.php +16 -10
  105. app/code/community/Allopass/Hipay/controllers/DexiaController.php +0 -0
  106. app/code/community/Allopass/Hipay/controllers/GiropayController.php +0 -0
  107. app/code/community/Allopass/Hipay/controllers/HostedController.php +0 -0
  108. app/code/community/Allopass/Hipay/controllers/HostedxtimesController.php +15 -0
  109. app/code/community/Allopass/Hipay/controllers/IdealController.php +0 -0
  110. app/code/community/Allopass/Hipay/controllers/IngController.php +0 -0
  111. app/code/community/Allopass/Hipay/controllers/KbcController.php +0 -0
  112. app/code/community/Allopass/Hipay/controllers/NotifyController.php +13 -25
  113. app/code/community/Allopass/Hipay/controllers/PaypalapiController.php +0 -0
  114. app/code/community/Allopass/Hipay/controllers/Przelewy24Controller.php +0 -0
  115. app/code/community/Allopass/Hipay/controllers/Przelewy24apiController.php +0 -0
  116. app/code/community/Allopass/Hipay/controllers/QiwiController.php +0 -0
  117. app/code/community/Allopass/Hipay/controllers/SddController.php +8 -0
  118. app/code/community/Allopass/Hipay/controllers/SisalController.php +0 -0
  119. app/code/community/Allopass/Hipay/controllers/SisalapiController.php +0 -0
  120. app/code/community/Allopass/Hipay/controllers/SofortController.php +0 -0
  121. app/code/community/Allopass/Hipay/controllers/SofortapiController.php +0 -0
  122. app/code/community/Allopass/Hipay/controllers/WebmoneyController.php +0 -0
  123. app/code/community/Allopass/Hipay/controllers/WebmoneyapiController.php +0 -0
  124. app/code/community/Allopass/Hipay/controllers/YandexController.php +0 -0
  125. app/code/community/Allopass/Hipay/controllers/YandexapiController.php +0 -0
  126. app/code/community/Allopass/Hipay/etc/config.xml +94 -5
  127. app/code/community/Allopass/Hipay/etc/system.xml +795 -42
  128. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-install-0.1.0.php +14 -14
  129. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.0-0.1.1.php +0 -0
  130. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.1-0.1.2.php +0 -0
  131. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.2-0.1.3.php +0 -0
  132. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-0.1.4-0.1.5.php +0 -0
  133. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.6-1.0.7.php +0 -0
  134. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.7-1.0.8.php +0 -0
  135. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.8-1.0.9.php +0 -0
  136. app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.9-1.1.0.php +0 -0
  137. app/design/adminhtml/default/default/layout/hipay.xml +0 -0
  138. app/design/adminhtml/default/default/template/hipay/form/cc.phtml +68 -57
  139. app/design/adminhtml/default/default/template/hipay/form/hosted.phtml +36 -15
  140. app/design/adminhtml/default/default/template/hipay/info/cc.phtml +0 -0
  141. app/design/adminhtml/default/default/template/hipay/info/hosted.phtml +0 -0
  142. app/design/adminhtml/default/default/template/hipay/system/config/form/field/rules.phtml +0 -0
  143. app/design/frontend/base/default/layout/hipay.xml +0 -0
  144. app/design/frontend/base/default/template/hipay/card/account.phtml +0 -0
  145. app/design/frontend/base/default/template/hipay/card/form/edit.phtml +0 -0
  146. app/design/frontend/base/default/template/hipay/checkout/pending.phtml +0 -0
  147. app/design/frontend/base/default/template/hipay/form/cc.phtml +88 -34
  148. app/design/frontend/base/default/template/hipay/form/hosted.phtml +49 -17
  149. app/design/frontend/base/default/template/hipay/info/cc.phtml +0 -0
  150. app/design/frontend/base/default/template/hipay/info/hosted.phtml +0 -0
  151. app/etc/modules/Allopass_Hipay.xml +0 -0
  152. app/locale/en_US/Allopass_Hipay.csv +15 -2
  153. app/locale/en_US/template/email/hipay_fraud_payment.html +0 -0
  154. app/locale/en_US/template/email/hipay_fraud_payment_accept.html +0 -0
  155. app/locale/en_US/template/email/hipay_fraud_payment_deny.html +0 -0
  156. app/locale/fr_FR/Allopass_Hipay.csv +16 -2
  157. app/locale/fr_FR/template/email/hipay_fraud_payment.html +66 -66
  158. app/locale/fr_FR/template/email/hipay_fraud_payment_accept.html +0 -0
  159. app/locale/fr_FR/template/email/hipay_fraud_payment_deny.html +0 -0
  160. app/locale/it_IT/Allopass_Hipay.csv +8 -0
  161. app/locale/it_IT/template/email/hipay_fraud_payment.html +0 -0
  162. app/locale/it_IT/template/email/hipay_fraud_payment_accept.html +0 -0
  163. app/locale/it_IT/template/email/hipay_fraud_payment_deny.html +0 -0
  164. package.xml +1 -18
  165. skin/adminhtml/default/default/hipay/js/rules.js +0 -0
app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit/Form.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/Customer/Edit/Tab/Card.php CHANGED
@@ -112,8 +112,8 @@ class Allopass_Hipay_Block_Adminhtml_Customer_Edit_Tab_Card extends
112
 
113
 
114
  public function getGridUrl() {
115
- return $this
116
- ->getUrl('hipay/adminhtml_card/cards',
117
  array('_current' => true));
118
  }
119
 
112
 
113
 
114
  public function getGridUrl() {
115
+ return Mage::helper('adminhtml')
116
+ ->getUrl('*/card/cards',
117
  array('_current' => true));
118
  }
119
 
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit/Form.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Grid.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit/Form.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Grid.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/3dsRule.php CHANGED
@@ -18,7 +18,7 @@ class Allopass_Hipay_Block_Adminhtml_System_Config_Form_Field_3dsRule extends M
18
  }
19
 
20
  public function getNewChildUrl(){
21
- return Mage::getUrl('hipay/adminhtml_rule/newConditionHtml/form/rule_conditions_fieldset');
22
  }
23
 
24
  /**
18
  }
19
 
20
  public function getNewChildUrl(){
21
+ return Mage::helper("adminhtml")->getUrl('*/rule/newConditionHtml',array('form'=>'rule_conditions_fieldset'));
22
  }
23
 
24
  /**
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/Allowsplitpayment.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/MultiselectSortable.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Card.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Card/Edit.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Checkout/Pending.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Form/Abstract.php CHANGED
@@ -99,11 +99,9 @@ abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_For
99
  {
100
 
101
  $checkoutMethod = $this->getQuote()->getCheckoutMethod();
102
- $minAmount = $this->getMethod()->getConfigData('min_order_total_split_payment');
103
-
104
- if($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST ||
105
- !$this->getMethod()->getConfigData('allow_split_payment') ||
106
- ($this->getMethod()->getConfigData('allow_split_payment') && !empty($minAmount) && $minAmount >= $this->getQuote()->getBaseGrandTotal() ))
107
  return false;
108
 
109
  return true;
99
  {
100
 
101
  $checkoutMethod = $this->getQuote()->getCheckoutMethod();
102
+ $minAmount = (float)$this->getMethod()->getConfigData('min_order_total_split_payment');
103
+
104
+ if($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST || (strpos($this->getMethodCode(), "xtimes") === false))
 
 
105
  return false;
106
 
107
  return true;
app/code/community/Allopass/Hipay/Block/Form/Cc.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Form/Hosted.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Info/Cc.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Block/Info/Hosted.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Controller/Payment.php CHANGED
@@ -103,6 +103,7 @@ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Actio
103
  public function pendingAction()
104
  {
105
  $this->processResponse();
 
106
  $this->_redirect($this->_getMethodInstance()->getConfigData('pending_redirect_page'));
107
 
108
  return $this;
103
  public function pendingAction()
104
  {
105
  $this->processResponse();
106
+
107
  $this->_redirect($this->_getMethodInstance()->getConfigData('pending_redirect_page'));
108
 
109
  return $this;
app/code/community/Allopass/Hipay/Helper/Data.php CHANGED
@@ -30,7 +30,6 @@ class Allopass_Hipay_Helper_Data extends Mage_Core_Helper_Abstract
30
  $part = (int)($amount / $maxCycles);
31
  $reste = $amount%$maxCycles;
32
  $fmod = fmod($amount, $maxCycles);
33
- //Mage::log("PART = ".$part." RESTE = ".$reste,null,'hipay_split_debug.log');
34
 
35
  for ($i=-1;$i<($maxCycles-1);$i++)
36
  {
@@ -574,4 +573,38 @@ class Allopass_Hipay_Helper_Data extends Mage_Core_Helper_Abstract
574
 
575
  return $ccTypeMagento;
576
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  }
30
  $part = (int)($amount / $maxCycles);
31
  $reste = $amount%$maxCycles;
32
  $fmod = fmod($amount, $maxCycles);
 
33
 
34
  for ($i=-1;$i<($maxCycles-1);$i++)
35
  {
573
 
574
  return $ccTypeMagento;
575
  }
576
+ /*
577
+ * TPPMAG1-2 - JPN
578
+ */
579
+ public function is3dSecure($use3dSecure, $config3dsRules, $payment = false)
580
+ {
581
+ $params = 0;
582
+ if($use3dSecure > 0 && !$payment){
583
+ $params = 1;
584
+ }else{
585
+ switch ((int)$use3dSecure) {
586
+ case 1:
587
+ $params = 1;
588
+ break;
589
+ case 2:
590
+ case 3:
591
+ /* @var $rule Allopass_Hipay_Model_Rule */
592
+ $rule = Mage::getModel('hipay/rule')->load($config3dsRules);
593
+ if($rule->getId() && $rule->validate($payment->getOrder()) )
594
+ {
595
+ $params = 1;
596
+ if((int)$use3dSecure == 3)//case for force 3ds if rules are validated
597
+ $params = 2;
598
+
599
+ }
600
+ break;
601
+ case 4:
602
+ $params = 2;
603
+ break;
604
+ }
605
+ }
606
+ return $params;
607
+ }
608
+
609
+
610
  }
app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Curl.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Http/Client/Adapter/Stream.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Request.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Response/Abstract.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Response/Error.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Response/Gateway.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Response/Notification.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Api/Response/Vault.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Card.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Config.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Log/Adapter.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Abstract.php CHANGED
@@ -93,10 +93,15 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
93
 
94
  public function assignInfoData($info,$data)
95
  {
96
- $info->setAdditionalInformation('create_oneclick',$data->getOneclick() == "create_oneclick" ? 1 : 0)
97
- ->setAdditionalInformation('use_oneclick',$data->getOneclick() == "use_oneclick" ? 1 : 0)
98
- ->setAdditionalInformation('selected_oneclick_card',$data->getOneclickCard() == "" ? 0 : $data->getOneclickCard())
99
- ->setAdditionalInformation('split_payment_id',$data->getSplitPaymentId() != "" ? $data->getSplitPaymentId() : 0);
 
 
 
 
 
100
 
101
 
102
  }
@@ -304,7 +309,7 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
304
  $payment,
305
  $gatewayResponse->getTransactionReference(),
306
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID,
307
- array('is_transaction_closed' => 1),
308
  array(
309
  $this->_realTransactionIdKey => $gatewayResponse->getTransactionReference(),
310
  ),
@@ -312,14 +317,44 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
312
  $payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount,true
313
  )
314
  );
315
- $state = Mage_Sales_Model_Order::STATE_CLOSED;
 
 
 
 
 
 
 
316
  $status = self::STATUS_EXPIRED;
317
-
318
- $order->setState($state,$status,$gatewayResponse->getMessage());
 
 
319
 
320
  $order->save();
321
  break;
322
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  case 116: //Authorized
324
 
325
  //check if this order was in state fraud detected
@@ -352,8 +387,17 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
352
  $notified = true);
353
 
354
  $order->save();
355
- if (!$order->getEmailSent()) {
356
- $order->sendNewOrderEmail();
 
 
 
 
 
 
 
 
 
357
  }
358
 
359
  $payment->setAmountAuthorized($gatewayResponse->getAuthorizedAmount());
@@ -396,6 +440,14 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
396
  break;
397
  }
398
 
 
 
 
 
 
 
 
 
399
  if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
400
  $order->unhold();
401
  }
@@ -456,8 +508,17 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
456
  $payment->setBaseAmountAuthorized($gatewayResponse->getAuthorizedAmount());
457
 
458
 
459
- if (!$order->getEmailSent()) {
460
- $order->sendNewOrderEmail();
 
 
 
 
 
 
 
 
 
461
  }
462
 
463
  break;
@@ -512,19 +573,55 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
512
  }
513
  elseif($order->canCreditmemo())
514
  {
515
- $service = Mage::getModel('sales/service_order', $order);
 
 
 
 
 
 
 
 
 
 
 
 
516
  $creditmemo = $service->prepareInvoiceCreditmemo($order->getInvoiceCollection()->getFirstItem());
517
  foreach ($creditmemo->getAllItems() as $creditmemoItem) {
518
  $creditmemoItem->setBackToStock(Mage::helper('cataloginventory')->isAutoReturnEnabled());
519
  }
520
  $creditmemo->setOfflineRequested(true);
 
521
  $transactionSave = Mage::getModel('core/resource_transaction')
522
  ->addObject($creditmemo)
523
  ->addObject($creditmemo->getOrder());
524
  if ($creditmemo->getInvoice()) {
525
  $transactionSave->addObject($creditmemo->getInvoice());
526
  }
527
- $transactionSave->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  }
529
 
530
  break;
@@ -569,7 +666,15 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
569
  break;
570
 
571
  case self::STATE_DECLINED:
572
-
 
 
 
 
 
 
 
 
573
  $reason = $gatewayResponse->getReason();
574
  $this->addTransaction(
575
  $payment,
@@ -594,7 +699,8 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
594
  $status = $order->getStatus();
595
  }
596
 
597
- $this->_setFraudDetected($gatewayResponse,$customer, $payment,$amount,true);
 
598
 
599
 
600
 
@@ -794,11 +900,13 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
794
  $transactionId = $payment->getLastTransId();
795
 
796
  $gatewayParams = array('operation'=>'refund','amount'=>$amount);
 
797
  /* @var $request Allopass_Hipay_Model_Api_Request */
798
  $request = Mage::getModel('hipay/api_request',array($this));
799
  $action = Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_MAINTENANCE . $transactionId;
800
 
801
 
 
802
  $this->_debug($gatewayParams);
803
 
804
  $gatewayResponse = $request->gatewayRequest($action,$gatewayParams,$payment->getOrder()->getStoreId());
@@ -813,7 +921,7 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
813
 
814
  /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
815
  $creditmemo = $payment->getCreditmemo();
816
- $creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_OPEN);
817
 
818
  break;
819
  default:
@@ -860,7 +968,7 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
860
 
861
  $params['description'] = Mage::helper('hipay')->__("Order %s by %s",$payment->getOrder()->getIncrementId(),$payment->getOrder()->getCustomerEmail());//MANDATORY
862
  $params['long_description'] = $longDesc;// optional
863
- $params['currency'] = $payment->getOrder()->getOrderCurrencyCode();
864
  $params['amount'] = $amount;
865
  $params['shipping'] = $payment->getOrder()->getShippingAmount();
866
  $params['tax'] = $payment->getOrder()->getTaxAmount();
@@ -886,46 +994,52 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
886
  */
887
  if(!is_null($token))
888
  $params['cardtoken'] = $token;
889
-
890
- $params['authentication_indicator'] = 0;
891
-
892
- switch ((int)$this->getConfigData('use_3d_secure')) {
893
- case 1:
894
- $params['authentication_indicator'] = 1;
895
- break;
896
- case 2:
897
- case 3:
898
- /* @var $rule Allopass_Hipay_Model_Rule */
899
- $rule = Mage::getModel('hipay/rule')->load($this->getConfigData('config_3ds_rules'));
900
- if($rule->getId() && $rule->validate($payment->getOrder()) )
901
- {
902
- $params['authentication_indicator'] = 1;
903
- if((int)$this->getConfigData('use_3d_secure') == 3)//case for force 3ds if rules are validated
904
- $params['authentication_indicator'] = 2;
905
-
906
- }
907
- break;
908
- case 4:
909
- $params['authentication_indicator'] = 2;
910
- break;
911
- }
912
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
913
 
 
 
914
  /**
915
  * Electronic Commerce Indicator
916
  */
917
- if($payment->getAdditionalInformation('use_oneclick'))
 
918
  $params['eci'] = 9; //Recurring E-commerce
 
 
 
 
919
 
920
  /**
921
  * Redirect urls
922
  */
923
- $isAdmin = $this->isAdmin();
924
- $params['accept_url'] = $isAdmin ? Mage::getUrl('hipay/adminhtml_payment/accept') : Mage::getUrl($this->getConfigData('accept_url'));
925
- $params['decline_url'] = $isAdmin ? Mage::getUrl('hipay/adminhtml_payment/decline') : Mage::getUrl($this->getConfigData('decline_url'));
926
- $params['pending_url'] = $isAdmin ? Mage::getUrl('hipay/adminhtml_payment/pending') : Mage::getUrl($this->getConfigData('pending_url'));
927
- $params['exception_url'] = $isAdmin ? Mage::getUrl('hipay/adminhtml_payment/exception') : Mage::getUrl($this->getConfigData('exception_url'));
928
- $params['cancel_url'] = $isAdmin ? Mage::getUrl('hipay/adminhtml_payment/cancel') : Mage::getUrl($this->getConfigData('cancel_url'));
929
 
930
  $params = $this->getCustomerParams($payment,$params);
931
  $params = $this->getShippingParams($payment,$params);
@@ -951,7 +1065,9 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
951
  if(($dob = $order->getCustomerDob()) != "")
952
  {
953
  $dob = new Zend_Date($dob);
954
- $params['birthdate'] = $dob->toString('YYYYMMdd');
 
 
955
  }
956
 
957
  $gender = $order->getCustomerGender();
@@ -1047,6 +1163,17 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
1047
 
1048
 
1049
 
 
 
 
 
 
 
 
 
 
 
 
1050
  }
1051
 
1052
  /**
@@ -1095,6 +1222,19 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
1095
 
1096
  switch ($gatewayResponse->getStatus())
1097
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
1098
  case "117": //Capture requested
1099
  case "118": //Capture
1100
  case "119": //Partially Capture
@@ -1112,7 +1252,7 @@ abstract class Allopass_Hipay_Model_Method_Abstract extends Mage_Payment_Model_M
1112
  $payment->setIsTransactionPending(true);
1113
  break;
1114
  default:
1115
- Mage::throwException( $gatewayResponse->getStatus() . " ==> " .$gatewayResponse->getMessage());
1116
  break;
1117
  }
1118
 
93
 
94
  public function assignInfoData($info,$data)
95
  {
96
+
97
+ $oneclickMode = $data->getData($this->getCode() . '_oneclick');
98
+ $oneclickCard = $data->getData($this->getCode() . '_oneclick_card');
99
+ $splitPaymentId = $data->getData($this->getCode() . '_split_payment_id');
100
+
101
+ $info->setAdditionalInformation('create_oneclick', $oneclickMode == "create_oneclick" ? 1 : 0)
102
+ ->setAdditionalInformation('use_oneclick',$oneclickMode == "use_oneclick" ? 1 : 0)
103
+ ->setAdditionalInformation('selected_oneclick_card',$oneclickCard == "" ? 0 : $oneclickCard)
104
+ ->setAdditionalInformation('split_payment_id',$splitPaymentId != "" ? $splitPaymentId : 0);
105
 
106
 
107
  }
309
  $payment,
310
  $gatewayResponse->getTransactionReference(),
311
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID,
312
+ array('is_transaction_closed' => 0),//Transaction was not closed, because admin can try capture after expiration
313
  array(
314
  $this->_realTransactionIdKey => $gatewayResponse->getTransactionReference(),
315
  ),
317
  $payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount,true
318
  )
319
  );
320
+
321
+ /**
322
+ * We change status to expired and state to holded
323
+ * So the administrator can try to capture transaction even if
324
+ * the auhorization was expired
325
+ *
326
+ */
327
+ $state = Mage_Sales_Model_Order::STATE_HOLDED;
328
  $status = self::STATUS_EXPIRED;
329
+ $order->setState(
330
+ $state,
331
+ $status,
332
+ $gatewayResponse->getMessage());
333
 
334
  $order->save();
335
  break;
336
+ case 115: //Canceled
337
+ if($order->cancel())
338
+ {
339
+
340
+ $order->cancel();
341
+
342
+ $this->addTransaction(
343
+ $payment,
344
+ $gatewayResponse->getTransactionReference(),
345
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID,
346
+ array('is_transaction_closed' => 1),//Transaction was not closed, because admin can try capture after expiration
347
+ array(
348
+ $this->_realTransactionIdKey => $gatewayResponse->getTransactionReference(),
349
+ ),
350
+ Mage::helper('hipay')->getTransactionMessage(
351
+ $payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount,true
352
+ )
353
+ );
354
+ }
355
+
356
+
357
+ break;
358
  case 116: //Authorized
359
 
360
  //check if this order was in state fraud detected
387
  $notified = true);
388
 
389
  $order->save();
390
+ // Send order confirmation email - TPPMAG1-29
391
+ + if (!$order->getEmailSent() && $order->getCanSendNewEmailFlag()) {
392
+ + try {
393
+ + if (method_exists($order, 'queueNewOrderEmail')) {
394
+ + $order->queueNewOrderEmail();
395
+ + } else {
396
+ + $order->sendNewOrderEmail();
397
+ + }
398
+ + } catch (Exception $e) {
399
+ + Mage::logException($e);
400
+ + }
401
  }
402
 
403
  $payment->setAmountAuthorized($gatewayResponse->getAuthorizedAmount());
440
  break;
441
  }
442
 
443
+ if ($amount != $order->getBaseGrandTotal()) {
444
+
445
+ $transactionId = $gatewayResponse->getTransactionReference();
446
+ $order->addStatusHistoryComment(Mage::helper('hipay')->__('Notification "Capture". Capture issued by merchant. Registered notification about captured amount of %s. Transaction ID: "%s". Invoice has not been created. Please create offline Invoice.',
447
+ $order->getBaseCurrency()->formatTxt($amount), $transactionId), false);
448
+ break;
449
+ }
450
+
451
  if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
452
  $order->unhold();
453
  }
508
  $payment->setBaseAmountAuthorized($gatewayResponse->getAuthorizedAmount());
509
 
510
 
511
+ // Send order confirmation email - TPPMAG1-29
512
+ + if (!$order->getEmailSent() && $order->getCanSendNewEmailFlag()) {
513
+ + try {
514
+ + if (method_exists($order, 'queueNewOrderEmail')) {
515
+ + $order->queueNewOrderEmail();
516
+ + } else {
517
+ + $order->sendNewOrderEmail();
518
+ + }
519
+ + } catch (Exception $e) {
520
+ + Mage::logException($e);
521
+ + }
522
  }
523
 
524
  break;
573
  }
574
  elseif($order->canCreditmemo())
575
  {
576
+
577
+ if ($amount != $order->getBaseGrandTotal()) {
578
+
579
+ $transactionId = $gatewayResponse->getTransactionReference();
580
+ $order->addStatusHistoryComment(Mage::helper('hipay')->__('Notification "Refunded". Refund issued by merchant. Registered notification about refunded amount of %s. Transaction ID: "%s". Credit Memo has not been created. Please create offline Credit Memo.',
581
+ $order->getBaseCurrency()->formatTxt($amount), $transactionId), false);
582
+ return $this;
583
+ }
584
+
585
+
586
+ /** @var $service Mage_Sales_Model_Service_Order */
587
+ /*$service = Mage::getModel('sales/service_order', $order);
588
+
589
  $creditmemo = $service->prepareInvoiceCreditmemo($order->getInvoiceCollection()->getFirstItem());
590
  foreach ($creditmemo->getAllItems() as $creditmemoItem) {
591
  $creditmemoItem->setBackToStock(Mage::helper('cataloginventory')->isAutoReturnEnabled());
592
  }
593
  $creditmemo->setOfflineRequested(true);
594
+ $creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_REFUNDED);
595
  $transactionSave = Mage::getModel('core/resource_transaction')
596
  ->addObject($creditmemo)
597
  ->addObject($creditmemo->getOrder());
598
  if ($creditmemo->getInvoice()) {
599
  $transactionSave->addObject($creditmemo->getInvoice());
600
  }
601
+ $transactionSave->save();*/
602
+
603
+ $amountTxt = $order->getBaseCurrency()->formatTxt($amount);
604
+
605
+ $transactionId = $gatewayResponse->getTransactionReference();
606
+
607
+ $comment = Mage::helper('hipay')->__('Refunded amount of %s. Transaction ID: "%s"', $amountTxt, $transactionId);
608
+
609
+ $isRefundFinal = $gatewayResponse->getRefundedAmount() == $order->getGrandTotal();
610
+ $payment->setIsTransactionClosed($isRefundFinal)
611
+ ->registerRefundNotification($amount);
612
+ $order->addStatusHistoryComment($comment, false);
613
+
614
+ // TODO: there is no way to close a capture right now
615
+ $creditmemo = $payment->getCreatedCreditmemo();
616
+ if ($creditmemo) {
617
+ $creditmemo->sendEmail();
618
+ $order->addStatusHistoryComment(
619
+ Mage::helper('hipay')->__('Notified customer about creditmemo #%s.', $creditmemo->getIncrementId())
620
+ )
621
+ ->setIsCustomerNotified(true)
622
+ ->save();
623
+ }
624
+
625
  }
626
 
627
  break;
666
  break;
667
 
668
  case self::STATE_DECLINED:
669
+ if(/* @TODO wait for response from hipay support
670
+ About issue #10 les notifications des différentes transactions HiPay se croisent
671
+ $order->getStatus() == self::STATUS_CAPTURE_REQUESTED || $order->getStatus() == self::STATUS_PENDING_CAPTURE ||*/
672
+ $order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING
673
+ || $order->getStatus() == Mage_Sales_Model_Order::STATE_COMPLETE || $order->getStatus() == Mage_Sales_Model_Order::STATE_CLOSED
674
+ )// for logic process
675
+ break;
676
+
677
+ $statusCode = (int)$gatewayResponse->getStatus();
678
  $reason = $gatewayResponse->getReason();
679
  $this->addTransaction(
680
  $payment,
699
  $status = $order->getStatus();
700
  }
701
 
702
+ if(in_array($statusCode,array(110)))
703
+ $this->_setFraudDetected($gatewayResponse,$customer, $payment,$amount,true);
704
 
705
 
706
 
900
  $transactionId = $payment->getLastTransId();
901
 
902
  $gatewayParams = array('operation'=>'refund','amount'=>$amount);
903
+
904
  /* @var $request Allopass_Hipay_Model_Api_Request */
905
  $request = Mage::getModel('hipay/api_request',array($this));
906
  $action = Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_MAINTENANCE . $transactionId;
907
 
908
 
909
+
910
  $this->_debug($gatewayParams);
911
 
912
  $gatewayResponse = $request->gatewayRequest($action,$gatewayParams,$payment->getOrder()->getStoreId());
921
 
922
  /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
923
  $creditmemo = $payment->getCreditmemo();
924
+ $creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_OPEN);//State open = pending state
925
 
926
  break;
927
  default:
968
 
969
  $params['description'] = Mage::helper('hipay')->__("Order %s by %s",$payment->getOrder()->getIncrementId(),$payment->getOrder()->getCustomerEmail());//MANDATORY
970
  $params['long_description'] = $longDesc;// optional
971
+ $params['currency'] = $payment->getOrder()->getBaseCurrencyCode();
972
  $params['amount'] = $amount;
973
  $params['shipping'] = $payment->getOrder()->getShippingAmount();
974
  $params['tax'] = $payment->getOrder()->getTaxAmount();
994
  */
995
  if(!is_null($token))
996
  $params['cardtoken'] = $token;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
 
998
+ // TPPMAG1-2 - JPN
999
+ //$params['authentication_indicator'] = 0;
1000
+ //switch ((int)$this->getConfigData('use_3d_secure')) {
1001
+ // case 1:
1002
+ // $params['authentication_indicator'] = 1;
1003
+ // break;
1004
+ // case 2:
1005
+ // case 3:
1006
+ // /* @var $rule Allopass_Hipay_Model_Rule */
1007
+ // $rule = Mage::getModel('hipay/rule')->load($this->getConfigData('config_3ds_rules'));
1008
+ // if($rule->getId() && $rule->validate($payment->getOrder()) )
1009
+ // {
1010
+ // $params['authentication_indicator'] = 1;
1011
+ // if((int)$this->getConfigData('use_3d_secure') == 3)//case for force 3ds if rules are validated
1012
+ // $params['authentication_indicator'] = 2;
1013
+ //
1014
+ // }
1015
+ // break;
1016
+ // case 4:
1017
+ // $params['authentication_indicator'] = 2;
1018
+ // break;
1019
+ //}
1020
+ $params['authentication_indicator'] = Mage::helper('hipay')->is3dSecure($this->getConfigData('use_3d_secure'), $this->getConfigData('config_3ds_rules'), $payment);
1021
 
1022
+ $isAdmin = $this->isAdmin();
1023
+
1024
  /**
1025
  * Electronic Commerce Indicator
1026
  */
1027
+ if($payment->getAdditionalInformation('use_oneclick')){
1028
+
1029
  $params['eci'] = 9; //Recurring E-commerce
1030
+ }
1031
+ elseif($isAdmin){
1032
+ $params['eci'] = 1; //MO/TO (Card Not Present). This value prevent from 3ds redirection in Admin payment.
1033
+ }
1034
 
1035
  /**
1036
  * Redirect urls
1037
  */
1038
+ $params['accept_url'] = $isAdmin ? Mage::helper('adminhtml')->getUrl('*/payment/accept') : Mage::getUrl($this->getConfigData('accept_url'));
1039
+ $params['decline_url'] = $isAdmin ? Mage::helper('adminhtml')->getUrl('*/payment/decline') : Mage::getUrl($this->getConfigData('decline_url'));
1040
+ $params['pending_url'] = $isAdmin ? Mage::helper('adminhtml')->getUrl('*/payment/pending') : Mage::getUrl($this->getConfigData('pending_url'));
1041
+ $params['exception_url'] = $isAdmin ? Mage::helper('adminhtml')->getUrl('*/payment/exception') : Mage::getUrl($this->getConfigData('exception_url'));
1042
+ $params['cancel_url'] = $isAdmin ? Mage::helper('adminhtml')->getUrl('*/payment/cancel') : Mage::getUrl($this->getConfigData('cancel_url'));
 
1043
 
1044
  $params = $this->getCustomerParams($payment,$params);
1045
  $params = $this->getShippingParams($payment,$params);
1065
  if(($dob = $order->getCustomerDob()) != "")
1066
  {
1067
  $dob = new Zend_Date($dob);
1068
+ $validator = new Zend_Validate_Date();
1069
+ if($validator->isValid($dob))
1070
+ $params['birthdate'] = $dob->toString('YYYYMMdd');
1071
  }
1072
 
1073
  $gender = $order->getCustomerGender();
1163
 
1164
 
1165
 
1166
+ }
1167
+
1168
+ protected function getCcTypeHipay($ccTypeMagento)
1169
+ {
1170
+ $ccTypes = Mage::getSingleton('hipay/config')->getCcTypesHipay();
1171
+
1172
+ if(isset($ccTypes[$ccTypeMagento]))
1173
+ return $ccTypes[$ccTypeMagento];
1174
+ else //Maybe it's already hipay code, we return it directly
1175
+ return $ccTypeMagento;
1176
+
1177
  }
1178
 
1179
  /**
1222
 
1223
  switch ($gatewayResponse->getStatus())
1224
  {
1225
+ case "116":
1226
+ $this->addTransaction(
1227
+ $payment,
1228
+ $gatewayResponse->getTransactionReference(),
1229
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
1230
+ array('is_transaction_closed' => 0),
1231
+ array(),
1232
+ Mage::helper('hipay')->getTransactionMessage(
1233
+ $payment, self::OPERATION_MAINTENANCE_ACCEPT_CHALLENGE, $gatewayResponse->getTransactionReference(), $amount
1234
+ )
1235
+ );
1236
+ $payment->setIsTransactionPending(true);
1237
+ break;
1238
  case "117": //Capture requested
1239
  case "118": //Capture
1240
  case "119": //Partially Capture
1252
  $payment->setIsTransactionPending(true);
1253
  break;
1254
  default:
1255
+ Mage::throwException( $gatewayResponse->getStatus() . " ==> " .$gatewayResponse->getMessage() . " is not processed!");
1256
  break;
1257
  }
1258
 
app/code/community/Allopass/Hipay/Model/Method/Cbc.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Cc.php CHANGED
@@ -22,17 +22,19 @@ class Allopass_Hipay_Model_Method_Cc extends Allopass_Hipay_Model_Method_Abstrac
22
  if (!($data instanceof Varien_Object)) {
23
  $data = new Varien_Object($data);
24
  }
 
 
25
  $info = $this->getInfoInstance();
26
- $info->setCcType($data->getCcType())
27
- ->setCcOwner($data->getCcOwner())
28
- ->setCcLast4(substr($data->getCcNumber(), -4))
29
- ->setCcNumber($data->getCcNumber())
30
- ->setCcCid($data->getCcCid())
31
- ->setCcExpMonth($data->getCcExpMonth())
32
- ->setCcExpYear($data->getCcExpYear())
33
- ->setCcSsIssue($data->getCcSsIssue())
34
- ->setCcSsStartMonth($data->getCcSsStartMonth())
35
- ->setCcSsStartYear($data->getCcSsStartYear())
36
  ;
37
 
38
  $this->assignInfoData($info, $data);
@@ -193,16 +195,6 @@ class Allopass_Hipay_Model_Method_Cc extends Allopass_Hipay_Model_Method_Abstrac
193
 
194
  }
195
 
196
- protected function getCcTypeHipay($ccTypeMagento)
197
- {
198
- $ccTypes = Mage::getSingleton('hipay/config')->getCcTypesHipay();
199
-
200
- if(isset($ccTypes[$ccTypeMagento]))
201
- return $ccTypes[$ccTypeMagento];
202
-
203
- Mage::throwException(Mage::helper('hipay')->__("Code Credit Card Type Hipay not found!"));
204
- }
205
-
206
 
207
 
208
  /**
22
  if (!($data instanceof Varien_Object)) {
23
  $data = new Varien_Object($data);
24
  }
25
+
26
+ Mage::log($data,null,'debug_data.log');
27
  $info = $this->getInfoInstance();
28
+ $info->setCcType($data->getData($this->getCode() . '_cc_type'))
29
+ ->setCcOwner($data->getData($this->getCode() . '_cc_owner'))
30
+ ->setCcLast4(substr($data->getData($this->getCode() . '_cc_number'), -4))
31
+ ->setCcNumber($data->getData($this->getCode() . '_cc_number'))
32
+ ->setCcCid($data->getData($this->getCode() . '_cc_cid'))
33
+ ->setCcExpMonth($data->getData($this->getCode() . '_cc_exp_month'))
34
+ ->setCcExpYear($data->getData($this->getCode() . '_cc_exp_year'))
35
+ ->setCcSsIssue($data->getData($this->getCode() . '_cc_ss_issue'))
36
+ ->setCcSsStartMonth($data->getData($this->getCode() . '_cc_ss_start_month'))
37
+ ->setCcSsStartYear($data->getData($this->getCode() . '_cc_ss_start_yeat'))
38
  ;
39
 
40
  $this->assignInfoData($info, $data);
195
 
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
198
 
199
 
200
  /**
app/code/community/Allopass/Hipay/Model/Method/CcXtimes.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_CcXtimes extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_canUseInternal = false;
5
+
6
+ protected $_code = 'hipay_ccxtimes';
7
+
8
+ }
app/code/community/Allopass/Hipay/Model/Method/Dexia.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Giropay.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Hosted.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/HostedXtimes.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_HostedXtimes extends Allopass_Hipay_Model_Method_Hosted
3
+ {
4
+ protected $_canUseInternal = false;
5
+
6
+ protected $_code = 'hipay_hostedxtimes';
7
+
8
+ }
app/code/community/Allopass/Hipay/Model/Method/Ideal.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Ing.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Kbc.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/PaypalApi.php CHANGED
@@ -55,11 +55,12 @@ class Allopass_Hipay_Model_Method_PaypalApi extends Allopass_Hipay_Model_Method_
55
 
56
  }
57
 
58
-
59
  protected function getCcTypeHipay($ccTypeMagento)
60
  {
61
  return $ccTypeMagento;
62
  }
 
63
 
64
  /**
65
  * Validate payment method information object
55
 
56
  }
57
 
58
+
59
  protected function getCcTypeHipay($ccTypeMagento)
60
  {
61
  return $ccTypeMagento;
62
  }
63
+
64
 
65
  /**
66
  * Validate payment method information object
app/code/community/Allopass/Hipay/Model/Method/Przelewy24.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Przelewy24Api.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Qiwi.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Sdd.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_Model_Method_Sdd extends Allopass_Hipay_Model_Method_Cc
3
+ {
4
+ protected $_code = 'hipay_sdd';
5
+ protected $_canRefund = false;
6
+ protected $_canRefundInvoicePartial = false;
7
+ /**
8
+ * Assign data to info model instance
9
+ *
10
+ * @param mixed $data
11
+ * @return Mage_Payment_Model_Info
12
+ */
13
+ public function assignData($data)
14
+ {
15
+ if (!($data instanceof Varien_Object)) {
16
+ $data = new Varien_Object($data);
17
+ }
18
+ $info = $this->getInfoInstance();
19
+ $info->setCcType('SDD')
20
+ ->setAdditionalInformation('cc_gender', $data->getCcGender())
21
+ ->setAdditionalInformation('cc_firstname', $data->getCcFirstname())
22
+ ->setAdditionalInformation('cc_lastname', $data->getCcLastname())
23
+ ->setAdditionalInformation('cc_iban', $data->getCcIban())
24
+ ->setAdditionalInformation('cc_code_bic',$data->getCcCodeBic())
25
+ ->setAdditionalInformation('cc_bank_name',$data->getCcBankName());
26
+
27
+ $this->assignInfoData($info, $data);
28
+
29
+ return $this;
30
+ }
31
+
32
+ public function initialize($paymentAction, $stateObject)
33
+ {
34
+ /* @var $payment Mage_Sales_Model_Order_Payment */
35
+ $payment = $this->getInfoInstance();
36
+ $order = $payment->getOrder();
37
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
38
+
39
+ return $this;
40
+ }
41
+
42
+ public function getOrderPlaceRedirectUrl()
43
+ {
44
+
45
+ return Mage::getUrl('hipay/sdd/sendRequest',array('_secure' => true));
46
+
47
+ }
48
+
49
+ public function place($payment, $amount)
50
+ {
51
+ // check if Electronic Signature
52
+ $codeElectronicSignature = $this->getConfigData('electronic_signature');
53
+ if($codeElectronicSignature > 0 )
54
+ {
55
+ // if Electronic signature, action hosted
56
+ $order = $payment->getOrder();
57
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
58
+ $request = Mage::getModel('hipay/api_request',array($this));
59
+ $payment->setAmount($amount);
60
+ $token = null;
61
+ $gatewayParams = $this->getGatewayParams($payment, $amount,$token);
62
+
63
+ if(is_null($token))
64
+ {
65
+
66
+ $gatewayParams['payment_product'] = $this->getCcTypeHipay($payment->getCcType()); ;
67
+ $gatewayParams['operation'] = $this->getOperation();
68
+
69
+ if(Mage::getStoreConfig('general/store_information/name') != "")
70
+ $gatewayParams['merchant_display_name'] = Mage::getStoreConfig('general/store_information/name');
71
+
72
+ $this->_debug($gatewayParams);
73
+ $gatewayResponse = $request->gatewayRequest(Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_ORDER,$gatewayParams,$payment->getOrder()->getStoreId());
74
+ $this->_debug($gatewayResponse->debug());
75
+
76
+ return $gatewayResponse->getForwardUrl();
77
+ }
78
+ else
79
+ {
80
+ $gatewayParams['operation'] = $this->getOperation();
81
+ $gatewayParams['payment_product'] = Mage::getSingleton('customer/session')->getCustomer()->getHipaySddType();
82
+
83
+ $this->_debug($gatewayParams);
84
+ $gatewayResponse = $request->gatewayRequest(Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_ORDER,$gatewayParams,$payment->getOrder()->getStoreId());
85
+ $this->_debug($gatewayResponse->debug());
86
+ $redirectUrl = $this->processResponseToRedirect($gatewayResponse, $payment, $amount);
87
+ return $redirectUrl;
88
+ }
89
+ }else{
90
+ // if not Electronic signature, action API
91
+ $order = $payment->getOrder();
92
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
93
+ $request = Mage::getModel('hipay/api_request',array($this));
94
+ $payment->setAmount($amount);
95
+ $token = $payment->getAdditionalInformation('token');
96
+ $gatewayParams = $this->getGatewayParams($payment, $amount,$token);
97
+ $gatewayParams['operation'] =$this->getOperation();
98
+ $paymentProduct = $this->getCcTypeHipay($payment->getCcType());
99
+
100
+ $gatewayParams['payment_product'] = $paymentProduct ;
101
+ $gatewayParams['gender'] = $payment->getAdditionalInformation('cc_gender');
102
+ $gatewayParams['firstname'] = $payment->getAdditionalInformation('cc_firstname');
103
+ $gatewayParams['lastname'] = $payment->getAdditionalInformation('cc_lastname');
104
+ $gatewayParams['recurring_payment'] = 0;
105
+ $gatewayParams['iban'] = $payment->getAdditionalInformation('cc_iban');
106
+ $gatewayParams['issuer_bank_id'] = $payment->getAdditionalInformation('cc_code_bic');
107
+ $gatewayParams['bank_name'] = $payment->getAdditionalInformation('cc_bank_name');
108
+ $gatewayParams['authentication_indicator'] = 0;
109
+ $this->_debug($gatewayParams);
110
+ $gatewayResponse = $request->gatewayRequest(Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_ORDER,$gatewayParams,$payment->getOrder()->getStoreId());
111
+ $this->_debug($gatewayResponse->debug());
112
+ $redirectUrl = $this->processResponseToRedirect($gatewayResponse, $payment, $amount);
113
+
114
+ return $redirectUrl;
115
+ }
116
+ }
117
+ /**
118
+ * Validate payment method information object
119
+ *
120
+ * @param Mage_Payment_Model_Info $info
121
+ * @return Mage_Payment_Model_Abstract
122
+ */
123
+ public function validate()
124
+ {
125
+ /**
126
+ * to validate payment method is allowed for billing country or not
127
+ */
128
+ $errorMsg = '';
129
+ $paymentInfo = $this->getInfoInstance();
130
+ // check if Electronic signature
131
+ $codeElectronicSignature = $this->getConfigData('electronic_signature');
132
+ if($codeElectronicSignature == 0 )
133
+ {
134
+
135
+ $iban = new Zend_Validate_Iban();
136
+ if(!$iban->isValid($paymentInfo->getAdditionalInformation('cc_iban')))
137
+ {
138
+ $errorMsg = Mage::helper('payment')->__('Iban is not correct, please enter a valid Iban.');
139
+ }
140
+ // variable pour la fonction empty
141
+ $var1 = $paymentInfo->getAdditionalInformation('cc_firstname');
142
+ $var2 = $paymentInfo->getAdditionalInformation('cc_lastname');
143
+ $var3 = $paymentInfo->getAdditionalInformation('cc_code_bic');
144
+ $var4 = $paymentInfo->getAdditionalInformation('cc_bank_name');
145
+ if(empty($var1))
146
+ {
147
+ $errorMsg = Mage::helper('payment')->__('Firstname is mandatory.');
148
+ }
149
+ if(empty($var2))
150
+ {
151
+ $errorMsg = Mage::helper('payment')->__('Lastname is mandatory.');
152
+ }
153
+ if(empty($var3))
154
+ {
155
+ $errorMsg = Mage::helper('payment')->__('Code BIC is not correct, please enter a valid Code BIC.');
156
+ }
157
+ if(empty($var4))
158
+ {
159
+ $errorMsg = Mage::helper('payment')->__('Bank name is not correct, please enter a valid Bank name.');
160
+ }
161
+ if($errorMsg)
162
+ {
163
+ Mage::throwException($errorMsg);
164
+ }
165
+ }
166
+ return $this;
167
+ }
168
+ }
app/code/community/Allopass/Hipay/Model/Method/Sisal.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/SisalApi.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Sofort.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/SofortApi.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Webmoney.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/WebmoneyApi.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/Yandex.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Method/YandexApi.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Observer.php CHANGED
@@ -10,12 +10,12 @@ class Allopass_Hipay_Model_Observer
10
  //Select only method with cancel orders enabled
11
  foreach (Mage::helper('hipay')->getHipayMethods() as $code=>$model)
12
  {
13
- if(Mage::getStoreConfig('payment/'.$code."/cancel_pending_order"))
14
  {
15
  $methodCodes[] = $code;
16
  }
17
  }
18
-
19
  if(count($methodCodes) < 1)
20
  return $this;
21
 
@@ -26,21 +26,19 @@ class Allopass_Hipay_Model_Observer
26
 
27
  /* @var $collection Mage_Sales_Model_Resource_Order_Collection */
28
  $collection = Mage::getResourceModel('sales/order_collection');
29
- $collection->addFieldToSelect(array('entity_id'))
30
- ->addFieldToFilter('state',Mage_Sales_Model_Order::STATE_NEW)
31
  ->addFieldToFilter('op.method',array('in'=>array_values($methodCodes)))
32
  ->addAttributeToFilter('created_at', array('to' => ($date->subMinute($limitedTime)->toString('Y-MM-dd HH:mm:ss'))))
33
  ->join(array('op' => 'sales/order_payment'), 'main_table.entity_id=op.parent_id', array('method'));
34
 
35
-
36
  /* @var $order Mage_Sales_Model_Order */
37
  foreach ($collection as $order)
38
  {
39
-
40
  if($order->canCancel())
41
  {
42
  try {
43
-
44
  $order->cancel();
45
  $order
46
  ->addStatusToHistory($order->getStatus(),// keep order status/state
@@ -89,7 +87,7 @@ class Allopass_Hipay_Model_Observer
89
  //TODO check if payment method is hosted and iframe active and is success
90
  $methodInstance = $payment->getMethodInstance();
91
  if($result['success']
92
- && $methodInstance->getCode() == 'hipay_hosted'
93
  && $methodInstance->getConfigData('display_iframe'))
94
  {
95
  $result['iframeUrl'] = $result['redirect'];
@@ -142,10 +140,10 @@ class Allopass_Hipay_Model_Observer
142
 
143
  if($order->canReviewPayment())
144
  {
145
- $url = $block->getUrl("hipay/adminhtml_payment/reviewCapturePayment");
146
  $message = Mage::helper('sales')->__('Are you sure you want to accept this payment?');
147
  $block->addButton('accept_capture_payment', array(
148
- 'label' => Mage::helper('sales')->__('Accept and Capture Payment'),
149
  'onclick' => "confirmSetLocation('{$message}', '{$url}')",
150
  ));
151
  }
10
  //Select only method with cancel orders enabled
11
  foreach (Mage::helper('hipay')->getHipayMethods() as $code=>$model)
12
  {
13
+ if(Mage::getStoreConfigFlag('payment/'.$code."/cancel_pending_order"))
14
  {
15
  $methodCodes[] = $code;
16
  }
17
  }
18
+
19
  if(count($methodCodes) < 1)
20
  return $this;
21
 
26
 
27
  /* @var $collection Mage_Sales_Model_Resource_Order_Collection */
28
  $collection = Mage::getResourceModel('sales/order_collection');
29
+ $collection->addFieldToSelect(array('entity_id','increment_id','store_id','state'))
30
+ ->addFieldToFilter('main_table.state',Mage_Sales_Model_Order::STATE_NEW)
31
  ->addFieldToFilter('op.method',array('in'=>array_values($methodCodes)))
32
  ->addAttributeToFilter('created_at', array('to' => ($date->subMinute($limitedTime)->toString('Y-MM-dd HH:mm:ss'))))
33
  ->join(array('op' => 'sales/order_payment'), 'main_table.entity_id=op.parent_id', array('method'));
34
 
 
35
  /* @var $order Mage_Sales_Model_Order */
36
  foreach ($collection as $order)
37
  {
 
38
  if($order->canCancel())
39
  {
40
  try {
41
+
42
  $order->cancel();
43
  $order
44
  ->addStatusToHistory($order->getStatus(),// keep order status/state
87
  //TODO check if payment method is hosted and iframe active and is success
88
  $methodInstance = $payment->getMethodInstance();
89
  if($result['success']
90
+ && ($methodInstance->getCode() == 'hipay_hosted' || $methodInstance->getCode() == 'hipay_hostedxtimes')
91
  && $methodInstance->getConfigData('display_iframe'))
92
  {
93
  $result['iframeUrl'] = $result['redirect'];
140
 
141
  if($order->canReviewPayment())
142
  {
143
+ $url = $block->getUrl("*/payment/reviewCapturePayment");
144
  $message = Mage::helper('sales')->__('Are you sure you want to accept this payment?');
145
  $block->addButton('accept_capture_payment', array(
146
+ 'label' => Mage::helper('hipay')->__('Accept and Capture Payment'),
147
  'onclick' => "confirmSetLocation('{$message}', '{$url}')",
148
  ));
149
  }
app/code/community/Allopass/Hipay/Model/PaymentProfile.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/Card.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/Card/Collection.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/PaymentProfile.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/PaymentProfile/Collection.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/Rule.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/Rule/Collection.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/SplitPayment.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Resource/SplitPayment/Collection.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Address.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Combine.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Customer.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Combine.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Found.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Condition/Product/Subselect.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Rule/Config.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/3ds.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/CcType.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/CcTypeHosted.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Order/HipayStatusValidate.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Order/Status.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Order/Status/Accepted.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Order/Status/Canceled.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Order/Status/New.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Order/Status/Refused.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/PaymentAction.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/PaymentProfile.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Pendingredirect.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/Source/Template.php CHANGED
File without changes
app/code/community/Allopass/Hipay/Model/SplitPayment.php CHANGED
@@ -78,7 +78,12 @@ class Allopass_Hipay_Model_SplitPayment extends Mage_Core_Model_Abstract
78
  public function getMethodInstance()
79
  {
80
  list($moduleName,$methodClass) = explode("_",$this->getMethodCode());
81
- return MAge::getSingleton($moduleName . "/method_" . $methodClass );
 
 
 
 
 
82
  }
83
 
84
  public function canPay()
78
  public function getMethodInstance()
79
  {
80
  list($moduleName,$methodClass) = explode("_",$this->getMethodCode());
81
+ //Fix bug due to upper letter in class name
82
+ if(strpos($methodClass,'xtimes') !== false)
83
+ {
84
+ $methodClass = str_replace("x","X",$methodClass);
85
+ }
86
+ return Mage::getSingleton($moduleName . "/method_" . $methodClass );
87
  }
88
 
89
  public function canPay()
app/code/community/Allopass/Hipay/Model/System/Config/Backend/CcTypes.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/Adminhtml/CardController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/Adminhtml/PaymentController.php CHANGED
@@ -14,14 +14,9 @@ class Allopass_Hipay_Adminhtml_PaymentController extends Mage_Adminhtml_Controll
14
  */
15
  protected function _getMethodInstance()
16
  {
17
-
18
- //list($module,$method) = explode("_", $this->getCheckout()->getMethod());
19
- //$modelName = $module . "/method_" . $method;
20
  $modelName = Mage::getStoreConfig('payment/'.$this->getCheckout()->getMethod()."/model");
21
-
22
- Mage::log($modelName,null,"debug_bo_hipay.log");
23
  return Mage::getSingleton($modelName);
24
- //Mage::throwException("Method: '" . __METHOD__ . "' must be implemented!");
25
  }
26
 
27
  public function reviewCapturePaymentAction()
@@ -42,6 +37,7 @@ class Allopass_Hipay_Adminhtml_PaymentController extends Mage_Adminhtml_Controll
42
  try {
43
 
44
  $order->getPayment()->accept();
 
45
  $message = $this->__('The payment has been accepted.');
46
  $order->save();
47
  $this->_getSession()->addSuccess($message);
@@ -72,7 +68,10 @@ class Allopass_Hipay_Adminhtml_PaymentController extends Mage_Adminhtml_Controll
72
 
73
  $transactionSave->save();
74
 
75
- $message = $this->__('The payment has been captured.');
 
 
 
76
  $this->_getSession()->addSuccess($message);
77
 
78
  } catch (Mage_Core_Exception $e) {
@@ -124,7 +123,7 @@ class Allopass_Hipay_Adminhtml_PaymentController extends Mage_Adminhtml_Controll
124
  ;
125
  $profiles = array();
126
  foreach ($collection as $profile) {
127
- //$referenceId = $gatewayResponse->getToken()."-".$profile->getId();
128
  $additionalInfo = array();
129
  $additionalInfo['ccType'] = $gatewayResponse->getBrand();
130
  $additionalInfo['ccExpMonth'] = $gatewayResponse->getCardExpiryMonth() ;
@@ -132,25 +131,22 @@ class Allopass_Hipay_Adminhtml_PaymentController extends Mage_Adminhtml_Controll
132
  $additionalInfo['token'] = $gatewayResponse->getToken();
133
  $additionalInfo['transaction_id'] = $gatewayResponse->getTransactionReference();
134
  $profile->setAdditionalInfo($additionalInfo);
135
- //$profile->setReferenceId($referenceId);
136
  $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
137
 
138
  $profile->save();
139
  }
140
  }
141
  }
142
- /*else
143
- {
144
- $this->processResponse();
145
- }*/
146
  $this->processResponse();
147
- Mage::log($this->getUrl('adminhtml/sales_order/view', array('order_id' => $this->getOrder()->getId())),null,"debug_hipay_redirect.log");
148
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
149
  $this->_redirect('adminhtml/sales_order/view', array('order_id' => $this->getOrder()->getId()));
150
- } else {
151
  $this->_redirect('adminhtml/sales_order/index');
152
- }
153
- //$this->_redirect('checkout/onepage/success');
154
 
155
  return $this;
156
  }
@@ -294,4 +290,5 @@ class Allopass_Hipay_Adminhtml_PaymentController extends Mage_Adminhtml_Controll
294
  {
295
  return Mage::getSingleton('checkout/session');
296
  }
 
297
  }
14
  */
15
  protected function _getMethodInstance()
16
  {
 
 
 
17
  $modelName = Mage::getStoreConfig('payment/'.$this->getCheckout()->getMethod()."/model");
 
 
18
  return Mage::getSingleton($modelName);
19
+
20
  }
21
 
22
  public function reviewCapturePaymentAction()
37
  try {
38
 
39
  $order->getPayment()->accept();
40
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,Allopass_Hipay_Model_Method_Cc::STATUS_PENDING_CAPTURE);
41
  $message = $this->__('The payment has been accepted.');
42
  $order->save();
43
  $this->_getSession()->addSuccess($message);
68
 
69
  $transactionSave->save();
70
 
71
+ $message = $this->__('The Capture was requested.');
72
+ $this->_getSession()->addSuccess($message);
73
+
74
+ $message = $this->__('You must reload the page to see new status.');
75
  $this->_getSession()->addSuccess($message);
76
 
77
  } catch (Mage_Core_Exception $e) {
123
  ;
124
  $profiles = array();
125
  foreach ($collection as $profile) {
126
+
127
  $additionalInfo = array();
128
  $additionalInfo['ccType'] = $gatewayResponse->getBrand();
129
  $additionalInfo['ccExpMonth'] = $gatewayResponse->getCardExpiryMonth() ;
131
  $additionalInfo['token'] = $gatewayResponse->getToken();
132
  $additionalInfo['transaction_id'] = $gatewayResponse->getTransactionReference();
133
  $profile->setAdditionalInfo($additionalInfo);
134
+
135
  $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
136
 
137
  $profile->save();
138
  }
139
  }
140
  }
141
+
 
 
 
142
  $this->processResponse();
143
+
144
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
145
  $this->_redirect('adminhtml/sales_order/view', array('order_id' => $this->getOrder()->getId()));
146
+ } else {
147
  $this->_redirect('adminhtml/sales_order/index');
148
+ }
149
+
150
 
151
  return $this;
152
  }
290
  {
291
  return Mage::getSingleton('checkout/session');
292
  }
293
+
294
  }
app/code/community/Allopass/Hipay/controllers/Adminhtml/PaymentProfileController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/Adminhtml/RuleController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/{Sales → Adminhtml/Sales}/Order/CreateController.php RENAMED
@@ -2,7 +2,7 @@
2
 
3
  require_once 'Mage/Adminhtml/controllers/Sales/Order/CreateController.php';
4
 
5
- class Allopass_Hipay_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
6
  {
7
 
8
 
@@ -39,8 +39,8 @@ class Allopass_Hipay_Sales_Order_CreateController extends Mage_Adminhtml_Sales_O
39
  */
40
  if(strpos($order->getPayment()->getMethod(), 'hipay') !== false)
41
  {
42
-
43
- $this->_redirect('hipay/adminhtml_payment/sendRequest',array('_secure' => true));
44
 
45
  // add order information to the session
46
  Mage::getSingleton('checkout/session')->setLastOrderId($order->getId())
2
 
3
  require_once 'Mage/Adminhtml/controllers/Sales/Order/CreateController.php';
4
 
5
+ class Allopass_Hipay_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
6
  {
7
 
8
 
39
  */
40
  if(strpos($order->getPayment()->getMethod(), 'hipay') !== false)
41
  {
42
+ $url = Mage::helper('adminhtml')->getUrl('*/payment/sendRequest',array('_secure' => true));
43
+ $this->_redirectUrl($url);
44
 
45
  // add order information to the session
46
  Mage::getSingleton('checkout/session')->setLastOrderId($order->getId())
app/code/community/Allopass/Hipay/controllers/Adminhtml/SplitPaymentController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/CardController.php CHANGED
@@ -129,6 +129,7 @@ class Allopass_Hipay_CardController extends Mage_Core_Controller_Front_Action
129
  // check if we know what should be deleted
130
  if ($cardId = $this->getRequest()->getParam('card_id')) {
131
  $customer = $this->_getSession()->getCustomer();
 
132
  $card = Mage::getModel('hipay/card');
133
 
134
  if ($cardId) {
@@ -144,11 +145,11 @@ class Allopass_Hipay_CardController extends Mage_Core_Controller_Front_Action
144
  return $this->_redirectError(Mage::getUrl('*/*/'));
145
  }
146
 
 
147
  try {
148
 
149
- //just disable the card
150
- $card->setCcStatus(Allopass_Hipay_Model_Card::STATUS_DISABLED);
151
- $card->save();
152
  // display success message
153
  $this->_getSession()->addSuccess(
154
  Mage::helper('hipay')->__('The card has been deleted.'));
129
  // check if we know what should be deleted
130
  if ($cardId = $this->getRequest()->getParam('card_id')) {
131
  $customer = $this->_getSession()->getCustomer();
132
+ /* @var $card Allopass_Hipay_Model_Card */
133
  $card = Mage::getModel('hipay/card');
134
 
135
  if ($cardId) {
145
  return $this->_redirectError(Mage::getUrl('*/*/'));
146
  }
147
 
148
+
149
  try {
150
 
151
+ //Delete the card
152
+ $card->delete();
 
153
  // display success message
154
  $this->_getSession()->addSuccess(
155
  Mage::helper('hipay')->__('The card has been deleted.'));
app/code/community/Allopass/Hipay/controllers/CbcController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/CcController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/CcxtimesController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_CcxtimesController 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_ccXtimes');
13
+ }
14
+
15
+ }
app/code/community/Allopass/Hipay/controllers/CheckoutController.php CHANGED
@@ -9,22 +9,28 @@ class Allopass_Hipay_CheckoutController extends Mage_Core_Controller_Front_Actio
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
 
9
  */
10
  public function preDispatch() {
11
  parent::preDispatch();
 
12
  }
13
 
14
 
15
  public function pendingAction()
16
  {
17
+ $session = $this->getOnepage()->getCheckout();
18
+ if (!$session->getLastSuccessQuoteId()) {
19
+ $this->_redirect('checkout/cart');
20
+ return;
21
+ }
22
 
23
+ $lastQuoteId = $session->getLastQuoteId();
24
+ $lastOrderId = $session->getLastOrderId();
25
+ $lastRecurringProfiles = $session->getLastRecurringProfileIds();
26
+ if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
27
+ $this->_redirect('checkout/cart');
28
+ return;
29
+ }
30
+
31
+ $session->clear();
32
+ $this->loadLayout();
33
+ $this->_initLayoutMessages('checkout/session');
34
  $this->renderLayout();
35
  }
36
 
app/code/community/Allopass/Hipay/controllers/DexiaController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/GiropayController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/HostedController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/HostedxtimesController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_HostedxtimesController 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_hostedXtimes');
13
+ }
14
+
15
+ }
app/code/community/Allopass/Hipay/controllers/IdealController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/IngController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/KbcController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/NotifyController.php CHANGED
@@ -13,8 +13,7 @@ class Allopass_Hipay_NotifyController extends 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);
@@ -49,28 +48,18 @@ class Allopass_Hipay_NotifyController extends Mage_Core_Controller_Front_Action
49
 
50
  if(strpos($orderArr['id'], 'recurring') !== false)
51
  {
52
- //return $this;
53
-
54
  list($action,$type,$profileId) = explode("-", $orderArr['id']);
55
 
56
  if($profileId)
57
  {
58
  /* @var $profile Mage_Sales_Model_Recurring_Profile */
59
  $profile = Mage::getModel('sales/recurring_profile')->load($profileId);
60
- if($profile->getId())
61
  {
62
-
63
-
64
- if($action == 'create' || $action == "payment")
65
- {
66
- //$order = $this->createProfileOrder($profile, $response);
67
- }
68
-
69
- //return $this;
70
-
71
  }
72
- else
73
- die(Mage::helper('hipay')->__("Profile for ID: %d doesn't exists (Recurring).",$profileId));
74
  }
75
  else
76
  die(Mage::helper('hipay')->__("Order Id not present (Recurring)."));
@@ -95,19 +84,18 @@ class Allopass_Hipay_NotifyController extends Mage_Core_Controller_Front_Action
95
  else
96
  $amount = $response->getRefundedAmount();
97
 
98
- $transactionId = $response->getTransactionReference();
99
-
100
-
101
- $methodInstance->processResponse($response, $payment, $amount);
102
-
103
-
104
  $message = Mage::helper('hipay')->__("Notification from Hipay:") . " " . Mage::helper('hipay')->__("status") . ": ". $response->getStatus(). " Message: " .$response->getMessage()." ".Mage::helper('hipay')->__('amount: %s',(string)$amount);
105
- //
106
  $order->addStatusToHistory($order->getStatus(), $message);
107
  $order->save();
 
 
 
108
 
109
- return $this;
110
-
111
 
112
  }
113
 
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);
48
 
49
  if(strpos($orderArr['id'], 'recurring') !== false)
50
  {
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
+ die(Mage::helper('hipay')->__("Profile for ID: %d doesn't exists (Recurring).",$profileId));
 
 
 
 
 
 
 
 
61
  }
62
+
 
63
  }
64
  else
65
  die(Mage::helper('hipay')->__("Order Id not present (Recurring)."));
84
  else
85
  $amount = $response->getRefundedAmount();
86
 
87
+ $transactionId = $response->getTransactionReference();
88
+
89
+ // Move Notification before processing
 
 
 
90
  $message = Mage::helper('hipay')->__("Notification from Hipay:") . " " . Mage::helper('hipay')->__("status") . ": ". $response->getStatus(). " Message: " .$response->getMessage()." ".Mage::helper('hipay')->__('amount: %s',(string)$amount);
91
+
92
  $order->addStatusToHistory($order->getStatus(), $message);
93
  $order->save();
94
+
95
+ // THEN processResponse
96
+ + $methodInstance->processResponse($response, $payment, $amount);
97
 
98
+ return $this;
 
99
 
100
  }
101
 
app/code/community/Allopass/Hipay/controllers/PaypalapiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/Przelewy24Controller.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/Przelewy24apiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/QiwiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/SddController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Allopass_Hipay_SddController extends Allopass_Hipay_Controller_Payment
3
+ {
4
+ protected function _getMethodInstance()
5
+ {
6
+ return Mage::getSingleton('hipay/method_sdd');
7
+ }
8
+ }
app/code/community/Allopass/Hipay/controllers/SisalController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/SisalapiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/SofortController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/SofortapiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/WebmoneyController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/WebmoneyapiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/YandexController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/controllers/YandexapiController.php CHANGED
File without changes
app/code/community/Allopass/Hipay/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Allopass_Hipay>
5
- <version>1.2.4</version>
6
  </Allopass_Hipay>
7
  </modules>
8
  <global>
@@ -107,12 +107,18 @@
107
  <name>Bancontact / Mister Cash</name>
108
  <order>60</order>
109
  </BCMC>
110
- <CB>
111
  <code>CB</code>
112
  <code_hipay>cb</code_hipay>
113
  <name>Carte Bancaire</name>
114
  <order>0</order>
115
  </CB>
 
 
 
 
 
 
116
  </types>
117
  </cc>
118
  <hosted>
@@ -350,7 +356,7 @@
350
  <active>0</active>
351
  <title>Credit Card</title>
352
  <payment_action>authorize_capture</payment_action>
353
- <cctypes>VI,MC,AE</cctypes>
354
  <display_card_owner>0</display_card_owner>
355
  <useccv>1</useccv>
356
  <order_status_payment_accepted>processing</order_status_payment_accepted>
@@ -358,7 +364,6 @@
358
  <order_status_payment_canceled>canceled</order_status_payment_canceled>
359
  <hipay_status_validate_order>118</hipay_status_validate_order>
360
  <pending_redirect_page>hipay/checkout/pending</pending_redirect_page>
361
- <allow_split_payment>0</allow_split_payment>
362
  <allow_use_oneclick>0</allow_use_oneclick>
363
  <invoice_create>1</invoice_create>
364
  <re_add_to_cart>0</re_add_to_cart>
@@ -374,6 +379,33 @@
374
  <use_3d_secure>1</use_3d_secure>
375
  <send_fraud_payment_email>0</send_fraud_payment_email>
376
  </hipay_cc>