Mundipagg_Integracao - Version 2.6.1

Version Notes

Hotfix on 2.6.0 migration

Download this release

Release Info

Developer MundiPagg
Extension Mundipagg_Integracao
Version 2.6.1
Comparing to
See all releases


Version 2.6.1

Files changed (181) hide show
  1. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Form/Field/Installments.php +49 -0
  2. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +57 -0
  3. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Invoice/Totals.php +57 -0
  4. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Invoice/View.php +55 -0
  5. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Totals.php +57 -0
  6. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Transactions/Detail/Grid.php +46 -0
  7. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/System/Config/Form/Button.php +76 -0
  8. app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Version.php +37 -0
  9. app/code/community/Uecommerce/Mundipagg/Block/Checkout/Onepage/Payment/Methods.php +45 -0
  10. app/code/community/Uecommerce/Mundipagg/Block/Info.php +76 -0
  11. app/code/community/Uecommerce/Mundipagg/Block/Parcelamento.php +100 -0
  12. app/code/community/Uecommerce/Mundipagg/Block/Sales/Order/Creditmemo/Totals.php +57 -0
  13. app/code/community/Uecommerce/Mundipagg/Block/Sales/Order/Invoice/Totals.php +57 -0
  14. app/code/community/Uecommerce/Mundipagg/Block/Sales/Order/Totals.php +57 -0
  15. app/code/community/Uecommerce/Mundipagg/Block/Standard/Boleto.php +47 -0
  16. app/code/community/Uecommerce/Mundipagg/Block/Standard/Cancel.php +59 -0
  17. app/code/community/Uecommerce/Mundipagg/Block/Standard/Debit.php +56 -0
  18. app/code/community/Uecommerce/Mundipagg/Block/Standard/Fcancel.php +43 -0
  19. app/code/community/Uecommerce/Mundipagg/Block/Standard/Form.php +90 -0
  20. app/code/community/Uecommerce/Mundipagg/Block/Standard/Partial.php +176 -0
  21. app/code/community/Uecommerce/Mundipagg/Block/Standard/Redirect.php +175 -0
  22. app/code/community/Uecommerce/Mundipagg/Block/Standard/Success.php +179 -0
  23. app/code/community/Uecommerce/Mundipagg/Controller/Abstract.php +80 -0
  24. app/code/community/Uecommerce/Mundipagg/Helper/Data.php +506 -0
  25. app/code/community/Uecommerce/Mundipagg/Helper/Installments.php +336 -0
  26. app/code/community/Uecommerce/Mundipagg/Helper/Log.php +63 -0
  27. app/code/community/Uecommerce/Mundipagg/Helper/Util.php +9 -0
  28. app/code/community/Uecommerce/Mundipagg/Helper/Version.php +107 -0
  29. app/code/community/Uecommerce/Mundipagg/Model/.DS_Store +0 -0
  30. app/code/community/Uecommerce/Mundipagg/Model/Api.php +1809 -0
  31. app/code/community/Uecommerce/Mundipagg/Model/Boleto.php +138 -0
  32. app/code/community/Uecommerce/Mundipagg/Model/Cardonfile.php +44 -0
  33. app/code/community/Uecommerce/Mundipagg/Model/Creditcard.php +198 -0
  34. app/code/community/Uecommerce/Mundipagg/Model/Creditcardoneinstallment.php +174 -0
  35. app/code/community/Uecommerce/Mundipagg/Model/Customer/Session.php +17 -0
  36. app/code/community/Uecommerce/Mundipagg/Model/Customers.php +39 -0
  37. app/code/community/Uecommerce/Mundipagg/Model/Debit.php +122 -0
  38. app/code/community/Uecommerce/Mundipagg/Model/Fivecreditcards.php +249 -0
  39. app/code/community/Uecommerce/Mundipagg/Model/Fourcreditcards.php +229 -0
  40. app/code/community/Uecommerce/Mundipagg/Model/Observer.php +356 -0
  41. app/code/community/Uecommerce/Mundipagg/Model/Offlineretry.php +17 -0
  42. app/code/community/Uecommerce/Mundipagg/Model/Order/Invoice/Interest.php +42 -0
  43. app/code/community/Uecommerce/Mundipagg/Model/Providervalidation.php +15 -0
  44. app/code/community/Uecommerce/Mundipagg/Model/Quote/Address/Interest.php +89 -0
  45. app/code/community/Uecommerce/Mundipagg/Model/Recurrency.php +412 -0
  46. app/code/community/Uecommerce/Mundipagg/Model/Resource/Cardonfile.php +39 -0
  47. app/code/community/Uecommerce/Mundipagg/Model/Resource/Cardonfile/Collection.php +49 -0
  48. app/code/community/Uecommerce/Mundipagg/Model/Resource/Customers.php +39 -0
  49. app/code/community/Uecommerce/Mundipagg/Model/Resource/Customers/Collection.php +43 -0
  50. app/code/community/Uecommerce/Mundipagg/Model/Resource/Offlineretry.php +7 -0
  51. app/code/community/Uecommerce/Mundipagg/Model/Resource/Offlineretry/Collection.php +20 -0
  52. app/code/community/Uecommerce/Mundipagg/Model/Resource/Setup.php +34 -0
  53. app/code/community/Uecommerce/Mundipagg/Model/Source/Antifraud.php +20 -0
  54. app/code/community/Uecommerce/Mundipagg/Model/Source/Banks.php +41 -0
  55. app/code/community/Uecommerce/Mundipagg/Model/Source/CctypeProductInstallments.php +47 -0
  56. app/code/community/Uecommerce/Mundipagg/Model/Source/Cctypes.php +53 -0
  57. app/code/community/Uecommerce/Mundipagg/Model/Source/Debit.php +44 -0
  58. app/code/community/Uecommerce/Mundipagg/Model/Source/Environment.php +41 -0
  59. app/code/community/Uecommerce/Mundipagg/Model/Source/FControlEnvironment.php +27 -0
  60. app/code/community/Uecommerce/Mundipagg/Model/Source/Frequency.php +50 -0
  61. app/code/community/Uecommerce/Mundipagg/Model/Source/Installments.php +49 -0
  62. app/code/community/Uecommerce/Mundipagg/Model/Source/PaymentAction.php +52 -0
  63. app/code/community/Uecommerce/Mundipagg/Model/Source/PaymentMethods.php +62 -0
  64. app/code/community/Uecommerce/Mundipagg/Model/Standard.php +1869 -0
  65. app/code/community/Uecommerce/Mundipagg/Model/System/Config/Backend/Installments.php +52 -0
  66. app/code/community/Uecommerce/Mundipagg/Model/Threecreditcards.php +212 -0
  67. app/code/community/Uecommerce/Mundipagg/Model/Twocreditcards.php +195 -0
  68. app/code/community/Uecommerce/Mundipagg/Test/Selenium/Abstract.php +441 -0
  69. app/code/community/Uecommerce/Mundipagg/Test/Selenium/BoletoTest.php +81 -0
  70. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes.php +234 -0
  71. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes/CreditcardTest.php +34 -0
  72. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes/CreditcardoneinstallmentTest.php +37 -0
  73. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes/FivecreditcardsTest.php +33 -0
  74. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes/FourcheditcardsTest.php +36 -0
  75. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes/ThreecreditcardsTest.php +38 -0
  76. app/code/community/Uecommerce/Mundipagg/Test/Selenium/CcTypes/TwocreditcardsTest.php +38 -0
  77. app/code/community/Uecommerce/Mundipagg/Test/Selenium/DebitTest.php +98 -0
  78. app/code/community/Uecommerce/Mundipagg/controllers/Adminhtml/IndexController.php +92 -0
  79. app/code/community/Uecommerce/Mundipagg/controllers/ClearsaleController.php +28 -0
  80. app/code/community/Uecommerce/Mundipagg/controllers/FcontrolController.php +98 -0
  81. app/code/community/Uecommerce/Mundipagg/controllers/StandardController.php +443 -0
  82. app/code/community/Uecommerce/Mundipagg/controllers/StoneController.php +28 -0
  83. app/code/community/Uecommerce/Mundipagg/etc/config.xml +363 -0
  84. app/code/community/Uecommerce/Mundipagg/etc/jstranslator.xml +15 -0
  85. app/code/community/Uecommerce/Mundipagg/etc/system.xml +1144 -0
  86. app/code/community/Uecommerce/Mundipagg/etc/wsdl.xml +62 -0
  87. app/code/community/Uecommerce/Mundipagg/etc/xtest.xml +143 -0
  88. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/install-0.3.0.php +92 -0
  89. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-0.3.0-0.3.5.php +81 -0
  90. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-0.3.5-0.4.0.php +89 -0
  91. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-0.3.5-1.0.1.php +89 -0
  92. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-0.4.0-1.0.1.php +89 -0
  93. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-0.4.1-0.4.2.php +148 -0
  94. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-0.4.1-1.0.1.php +89 -0
  95. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.0-1.0.1.php +89 -0
  96. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.1-1.0.2.php +35 -0
  97. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.10-1.0.11.php +35 -0
  98. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.11-2.0.0.php +92 -0
  99. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.2-1.0.3.php +35 -0
  100. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.3-1.0.4.php +35 -0
  101. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.4-1.0.5.php +35 -0
  102. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.5-1.0.6.php +35 -0
  103. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.6-1.0.7.php +35 -0
  104. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.7-1.0.8.php +35 -0
  105. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.8-1.0.9.php +35 -0
  106. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-1.0.9-1.0.10.php +35 -0
  107. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.0-2.0.1.php +55 -0
  108. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.0-2.1.0.php +81 -0
  109. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.1-2.0.2.php +42 -0
  110. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.2-2.0.3.php +35 -0
  111. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.3-2.0.4.php +35 -0
  112. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.4-2.0.5.php +35 -0
  113. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.5-2.0.6.php +35 -0
  114. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.6-2.0.7.php +35 -0
  115. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.7-2.0.8.php +35 -0
  116. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.8-2.0.9.php +35 -0
  117. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.0.9-2.1.0.php +104 -0
  118. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.1.2-2.1.3.php +41 -0
  119. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.5.7-2.5.8.php +11 -0
  120. app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.5.8-2.6.0.php +16 -0
  121. app/design/adminhtml/default/default/layout/mundipagg.xml +39 -0
  122. app/design/adminhtml/default/default/template/mundipagg/boleto.phtml +29 -0
  123. app/design/adminhtml/default/default/template/mundipagg/form.phtml +379 -0
  124. app/design/adminhtml/default/default/template/mundipagg/payment/.DS_Store +0 -0
  125. app/design/adminhtml/default/default/template/mundipagg/payment/info/mundipagg.phtml +234 -0
  126. app/design/adminhtml/default/default/template/mundipagg/system/config/button.phtml +28 -0
  127. app/design/frontend/base/default/layout/mundipagg.xml +156 -0
  128. app/design/frontend/base/default/template/mundipagg/antifraud/clearsale.phtml +61 -0
  129. app/design/frontend/base/default/template/mundipagg/antifraud/fcontrol.phtml +59 -0
  130. app/design/frontend/base/default/template/mundipagg/antifraud/stone.phtml +61 -0
  131. app/design/frontend/base/default/template/mundipagg/boleto.phtml +30 -0
  132. app/design/frontend/base/default/template/mundipagg/cancel.phtml +36 -0
  133. app/design/frontend/base/default/template/mundipagg/debit.phtml +51 -0
  134. app/design/frontend/base/default/template/mundipagg/extras.phtml +1 -0
  135. app/design/frontend/base/default/template/mundipagg/fcancel.phtml +36 -0
  136. app/design/frontend/base/default/template/mundipagg/form.phtml +381 -0
  137. app/design/frontend/base/default/template/mundipagg/parcelamento.phtml +8 -0
  138. app/design/frontend/base/default/template/mundipagg/partial.phtml +147 -0
  139. app/design/frontend/base/default/template/mundipagg/payment/info/mundipagg.phtml +95 -0
  140. app/design/frontend/base/default/template/mundipagg/redirect.phtml +50 -0
  141. app/design/frontend/base/default/template/mundipagg/success.phtml +224 -0
  142. app/design/frontend/base/default/template/mundipagg/totals.phtml +52 -0
  143. app/design/frontend/rwd/default/template/mundipagg/debit.phtml +52 -0
  144. app/design/frontend/rwd/default/template/mundipagg/form.phtml +381 -0
  145. app/etc/modules/Uecommerce_Mundipagg.xml +9 -0
  146. app/locale/en_US/Uecommerce_Mundipagg.csv +151 -0
  147. app/locale/pt_BR/Uecommerce_Mundipagg.csv +199 -0
  148. js/uecommerce/mundipagg.js +872 -0
  149. package.xml +22 -0
  150. skin/adminhtml/default/default/images/mundipagg/.DS_Store +0 -0
  151. skin/adminhtml/default/default/images/mundipagg/ajax-loader.gif +0 -0
  152. skin/adminhtml/default/default/images/mundipagg/boleto.jpg +0 -0
  153. skin/adminhtml/default/default/images/mundipagg/mundipagg-avatar-blue.png +0 -0
  154. skin/frontend/base/default/css/mundipagg.css +129 -0
  155. skin/frontend/base/default/images/mundipagg/.DS_Store +0 -0
  156. skin/frontend/base/default/images/mundipagg/001.png +0 -0
  157. skin/frontend/base/default/images/mundipagg/237.png +0 -0
  158. skin/frontend/base/default/images/mundipagg/341.png +0 -0
  159. skin/frontend/base/default/images/mundipagg/AE.png +0 -0
  160. skin/frontend/base/default/images/mundipagg/DI.png +0 -0
  161. skin/frontend/base/default/images/mundipagg/EL.png +0 -0
  162. skin/frontend/base/default/images/mundipagg/HI.png +0 -0
  163. skin/frontend/base/default/images/mundipagg/MC.png +0 -0
  164. skin/frontend/base/default/images/mundipagg/VBV.jpg +0 -0
  165. skin/frontend/base/default/images/mundipagg/VBV.png +0 -0
  166. skin/frontend/base/default/images/mundipagg/VI.png +0 -0
  167. skin/frontend/base/default/images/mundipagg/ajax-loader.gif +0 -0
  168. skin/frontend/base/default/images/mundipagg/boleto.jpg +0 -0
  169. skin/frontend/base/default/images/mundipagg/cc_types.png +0 -0
  170. skin/frontend/base/default/images/mundipagg/cielo_mastercard.png +0 -0
  171. skin/frontend/base/default/images/mundipagg/cielo_visa.png +0 -0
  172. skin/frontend/default/default/images/mundipagg/.DS_Store +0 -0
  173. skin/frontend/default/default/images/mundipagg/EL.png +0 -0
  174. skin/frontend/default/default/images/mundipagg/HI.png +0 -0
  175. skin/frontend/default/default/images/mundipagg/ae.png +0 -0
  176. skin/frontend/default/default/images/mundipagg/boleto.jpg +0 -0
  177. skin/frontend/default/default/images/mundipagg/cielo_mastercard.png +0 -0
  178. skin/frontend/default/default/images/mundipagg/cielo_visa.png +0 -0
  179. skin/frontend/default/default/images/mundipagg/di.png +0 -0
  180. skin/frontend/default/default/images/mundipagg/mc.png +0 -0
  181. skin/frontend/default/default/images/mundipagg/vi.png +0 -0
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Form/Field/Installments.php ADDED
@@ -0,0 +1,49 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+ class Uecommerce_Mundipagg_Block_Adminhtml_Form_Field_Installments extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
31
+ {
32
+ protected function _prepareToRender()
33
+ {
34
+ $this->addColumn('installment_boundary', array(
35
+ 'label' => Mage::helper('mundipagg')->__('Amount (incl.)'),
36
+ 'style' => 'width:100px',
37
+ ));
38
+ $this->addColumn('installment_frequency', array(
39
+ 'label' => Mage::helper('mundipagg')->__('Maximum Number of Installments'),
40
+ 'style' => 'width:100px',
41
+ ));
42
+ $this->addColumn('installment_interest', array(
43
+ 'label' => Mage::helper('mundipagg')->__('Interest Rate (%)'),
44
+ 'style' => 'width:100px',
45
+ ));
46
+ $this->_addAfter = false;
47
+ $this->_addButtonLabel = Mage::helper('mundipagg')->__('Add Installment Boundary');
48
+ }
49
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2014 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals
32
+ {
33
+ /**
34
+ * Initialize order totals array
35
+ *
36
+ * @return Mage_Sales_Block_Order_Totals
37
+ */
38
+ protected function _initTotals()
39
+ {
40
+ parent::_initTotals();
41
+
42
+ $source = $this->getSource();
43
+
44
+ if($this->getSource()->getMundipaggInterest() > 0)
45
+ {
46
+ $this->addTotalBefore(new Varien_Object(array
47
+ (
48
+ 'code' => 'mundipagg_interest',
49
+ 'field' => 'interest',
50
+ 'value' => $this->getSource()->getMundipaggInterest(),
51
+ 'label' => $this->__('Interest')
52
+ )), 'grand_total');
53
+ }
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Invoice/Totals.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2014 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
32
+ {
33
+ /**
34
+ * Initialize order totals array
35
+ *
36
+ * @return Mage_Sales_Block_Order_Totals
37
+ */
38
+ protected function _initTotals()
39
+ {
40
+ parent::_initTotals();
41
+
42
+ $source = $this->getSource();
43
+
44
+ if($this->getSource()->getMundipaggInterest() > 0)
45
+ {
46
+ $this->addTotalBefore(new Varien_Object(array
47
+ (
48
+ 'code' => 'mundipagg_interest',
49
+ 'field' => 'interest',
50
+ 'value' => $this->getSource()->getMundipaggInterest(),
51
+ 'label' => $this->__('Interest')
52
+ )), 'grand_total');
53
+ }
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Invoice/View.php ADDED
@@ -0,0 +1,55 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_Sales_Order_Invoice_View extends Mage_Adminhtml_Block_Sales_Order_Invoice_View
32
+ {
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+
37
+ $this->_removeButton('void');
38
+
39
+ $orderPayment = $this->getInvoice()->getOrder()->getPayment();
40
+
41
+ if ($this->_isAllowedAction('creditmemo') ) {
42
+ if (($orderPayment->canRefundPartialPerInvoice()
43
+ && $this->getInvoice()->canRefund()
44
+ && $orderPayment->getAmountPaid() > $orderPayment->getAmountRefunded())
45
+ || ($orderPayment->canRefund() && !$this->getInvoice()->getIsUsedForRefund())) {
46
+ $this->_addButton('capture', array( // capture?
47
+ 'label' => Mage::helper('sales')->__('Credit Memo'),
48
+ 'class' => 'go',
49
+ 'onclick' => 'setLocation(\''.$this->getCreditMemoUrl().'\')'
50
+ )
51
+ );
52
+ }
53
+ }
54
+ }
55
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Order/Totals.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2014 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
32
+ {
33
+ /**
34
+ * Initialize order totals array
35
+ *
36
+ * @return Mage_Sales_Block_Order_Totals
37
+ */
38
+ protected function _initTotals()
39
+ {
40
+ parent::_initTotals();
41
+
42
+ $source = $this->getSource();
43
+
44
+ if($this->getSource()->getMundipaggInterest() > 0)
45
+ {
46
+ $this->addTotalBefore(new Varien_Object(array
47
+ (
48
+ 'code' => 'mundipagg_interest',
49
+ 'field' => 'interest',
50
+ 'value' => $this->getSource()->getMundipaggInterest(),
51
+ 'label' => $this->__('Interest')
52
+ )), 'grand_total');
53
+ }
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Sales/Transactions/Detail/Grid.php ADDED
@@ -0,0 +1,46 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_Sales_Transactions_Detail_Grid extends Mage_Adminhtml_Block_Sales_Transactions_Detail_Grid
32
+ {
33
+ /**
34
+ * Retrieve Transaction addtitional info
35
+ *
36
+ * FIX: Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS inside getAdditionalInformation()
37
+ * was causing no Transaction Details display
38
+ *
39
+ * @return array
40
+ */
41
+ public function getTransactionAdditionalInfo()
42
+ {
43
+ $info = Mage::registry('current_transaction')->getAdditionalInformation();
44
+ return (is_array($info)) ? $info : array();
45
+ }
46
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,76 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
32
+ {
33
+ /**
34
+ * Set template
35
+ */
36
+ protected function _construct() {
37
+ parent::_construct();
38
+ $this->setTemplate('mundipagg/system/config/button.phtml');
39
+ }
40
+
41
+ /**
42
+ * Return element html
43
+ *
44
+ * @param Varien_Data_Form_Element_Abstract $element
45
+ * @return string
46
+ */
47
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
48
+ {
49
+ return $this->_toHtml();
50
+ }
51
+
52
+ /**
53
+ * Return ajax url for button
54
+ *
55
+ * @return string
56
+ */
57
+ public function getAjaxOldSettingsUrl(){
58
+ return Mage::helper('adminhtml')->getUrl('mundipagg/adminhtml_index/setoldsettings');
59
+ }
60
+
61
+ /**
62
+ * Generate button html
63
+ *
64
+ * @return string
65
+ */
66
+ public function getButtonHtml(){
67
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
68
+ ->setData(array(
69
+ 'id' => 'mundipagg_button',
70
+ 'label' => $this->helper('adminhtml')->__('Set old settings'),
71
+ 'onclick' => 'javascript:setOldSettings(); return false;'
72
+ ));
73
+
74
+ return $button->toHtml();
75
+ }
76
+ }
app/code/community/Uecommerce/Mundipagg/Block/Adminhtml/Version.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Adminhtml_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
32
+ {
33
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
34
+ {
35
+ return (string) Mage::helper('mundipagg')->getExtensionVersion();
36
+ }
37
+ }
app/code/community/Uecommerce/Mundipagg/Block/Checkout/Onepage/Payment/Methods.php ADDED
@@ -0,0 +1,45 @@
1
+ <?php
2
+
3
+ class Uecommerce_Mundipagg_Block_Checkout_Onepage_Payment_Methods extends Mage_Checkout_Block_Onepage_Payment_Methods
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $payment = $this->getRequest()->getParam('payment');
8
+ $session = Mage::getSingleton('checkout/session');
9
+ $paymentMethod = $session->getData('payment_method_in_session');
10
+
11
+ if(isset($payment['method'])) {
12
+ // If payment method in request is different from the value set in the session
13
+ if($paymentMethod != $payment['method']) {
14
+ // Reset payment
15
+ $this->setPaymentMethod('');
16
+ // Set new payment method
17
+ $this->setPaymentMethod($payment['method']);
18
+ // Set new payment in session
19
+ $session->setData('payment_method_in_session', $payment['method']);
20
+ }
21
+ } else {
22
+ // Reset payment
23
+ $this->setPaymentMethod('');
24
+ }
25
+
26
+ parent::_construct();
27
+ }
28
+
29
+ /**
30
+ * Set payment and remove discounts.
31
+ * @param string $paymentCode
32
+ */
33
+ protected function setPaymentMethod($paymentCode = '')
34
+ {
35
+ $quote = $this->getQuote();
36
+ $quote->getPayment()->setMethod($paymentCode);
37
+ $quote->getBillingAddress()->setPaymentMethod($paymentCode);
38
+ $quote->getShippingAddress()->setPaymentMethod($paymentCode);
39
+ $quote->setTotalsCollectedFlag(false)->collectTotals();
40
+
41
+ $cart = Mage::getSingleton('checkout/cart');
42
+ $cart->init();
43
+ $cart->save();
44
+ }
45
+ }
app/code/community/Uecommerce/Mundipagg/Block/Info.php ADDED
@@ -0,0 +1,76 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Info extends Mage_Payment_Block_Info
32
+ {
33
+ protected function _construct()
34
+ {
35
+ parent::_construct();
36
+ $this->setTemplate('mundipagg/payment/info/mundipagg.phtml');
37
+ }
38
+
39
+ /**
40
+ * Retrieve order model instance
41
+ *
42
+ * @return Mage_Sales_Model_Order
43
+ */
44
+ public function getOrder()
45
+ {
46
+ return Mage::registry('current_order');
47
+ }
48
+
49
+ /**
50
+ * Retrieve invoice model instance
51
+ *
52
+ * @return Mage_Sales_Model_Order_Invoice
53
+ */
54
+ public function getInvoice()
55
+ {
56
+ return Mage::registry('current_invoice');
57
+ }
58
+
59
+ /**
60
+ * Retrieve shipment model instance
61
+ *
62
+ * @return Mage_Sales_Model_Order_Shipment
63
+ */
64
+ public function getShipment()
65
+ {
66
+ return Mage::registry('current_shipment');
67
+ }
68
+
69
+ /**
70
+ * Retrieve payment method
71
+ */
72
+ public function getFormaPagamento()
73
+ {
74
+ return $this->getInfo()->getAdditionalInformation('PaymentMethod');
75
+ }
76
+ }
app/code/community/Uecommerce/Mundipagg/Block/Parcelamento.php ADDED
@@ -0,0 +1,100 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Parcelamento extends Mage_Core_Block_Template
32
+ {
33
+ protected $_price = null;
34
+
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->setTemplate('mundipagg/parcelamento.phtml');
39
+
40
+
41
+ }
42
+
43
+ protected function _beforeToHtml()
44
+ {
45
+ $this->setPrice($this->getData('price'));
46
+ $this->setParcelamentoProduto($this->getData('parcelamento_produto'));
47
+ }
48
+
49
+ public function setPrice($price)
50
+ {
51
+ $this->_price = $price;
52
+ }
53
+
54
+ public function getPrice()
55
+ {
56
+ return $this->_price;
57
+ }
58
+
59
+ public function setParcelamentoProduto($parcelamento)
60
+ {
61
+ $this->_parcelamento = $parcelamento;
62
+ }
63
+
64
+ public function getParcelamentoProduto()
65
+ {
66
+ return $this->_parcelamento;
67
+ }
68
+
69
+ /**
70
+ * Call it on category or product page
71
+ * echo $this->getLayout()->createBlock("mundipagg/parcelamento")->setData('price', $_product->getPrice())->toHtml();
72
+ */
73
+ public function getParcelamento()
74
+ {
75
+ $active = Mage::getStoreConfig('payment/mundipagg_creditcard/active');
76
+
77
+ if ($active) {
78
+ $parcelamento = Mage::getStoreConfig('payment/mundipagg_standard/product_pages_installment_default');
79
+
80
+ $installmentsHelper = Mage::helper('mundipagg/installments');
81
+ $installmentsHelper->displayTotal = false;
82
+ $parcelamentoMax = $installmentsHelper->getInstallmentForCreditCardType($parcelamento, $this->getPrice());
83
+
84
+ return end($parcelamentoMax);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Call it on category or product page
90
+ * echo $this->getLayout()->createBlock("mundipagg/parcelamento")->setData('price', $_product->getPrice())->setData('parcelamento_produto', $_product->getParcelamento())->toHtml();
91
+ */
92
+ public function getParcelamentoCustom()
93
+ {
94
+ if ($this->getParcelamentoProduto() == '') {
95
+ return 3;
96
+ } else {
97
+ return $this->getParcelamentoProduto();
98
+ }
99
+ }
100
+ }
app/code/community/Uecommerce/Mundipagg/Block/Sales/Order/Creditmemo/Totals.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2014 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Sales_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Creditmemo_Totals
32
+ {
33
+ /**
34
+ * Initialize order totals array
35
+ *
36
+ * @return Mage_Sales_Block_Order_Totals
37
+ */
38
+ protected function _initTotals()
39
+ {
40
+ parent::_initTotals();
41
+
42
+ $source = $this->getSource();
43
+
44
+ if($this->getSource()->getMundipaggInterest() > 0)
45
+ {
46
+ $this->addTotalBefore(new Varien_Object(array
47
+ (
48
+ 'code' => 'mundipagg_interest',
49
+ 'field' => 'interest',
50
+ 'value' => $this->getSource()->getMundipaggInterest(),
51
+ 'label' => $this->__('Interest')
52
+ )), 'grand_total');
53
+ }
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Uecommerce/Mundipagg/Block/Sales/Order/Invoice/Totals.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2014 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Sales_Order_Invoice_Totals extends Mage_Sales_Block_Order_Invoice_Totals
32
+ {
33
+ /**
34
+ * Initialize order totals array
35
+ *
36
+ * @return Mage_Sales_Block_Order_Totals
37
+ */
38
+ protected function _initTotals()
39
+ {
40
+ parent::_initTotals();
41
+
42
+ $source = $this->getSource();
43
+
44
+ if($this->getSource()->getMundipaggInterest() > 0)
45
+ {
46
+ $this->addTotalBefore(new Varien_Object(array
47
+ (
48
+ 'code' => 'mundipagg_interest',
49
+ 'field' => 'interest',
50
+ 'value' => $this->getSource()->getMundipaggInterest(),
51
+ 'label' => $this->__('Interest')
52
+ )), 'grand_total');
53
+ }
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Uecommerce/Mundipagg/Block/Sales/Order/Totals.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2014 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals
32
+ {
33
+ /**
34
+ * Initialize order totals array
35
+ *
36
+ * @return Mage_Sales_Block_Order_Totals
37
+ */
38
+ protected function _initTotals()
39
+ {
40
+ parent::_initTotals();
41
+
42
+ $source = $this->getSource();
43
+
44
+ if($this->getSource()->getMundipaggInterest() > 0)
45
+ {
46
+ $this->addTotalBefore(new Varien_Object(array
47
+ (
48
+ 'code' => 'mundipagg_interest',
49
+ 'field' => 'interest',
50
+ 'value' => $this->getSource()->getMundipaggInterest(),
51
+ 'label' => $this->__('Interest')
52
+ )), 'grand_total');
53
+ }
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Boleto.php ADDED
@@ -0,0 +1,47 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Boleto extends Mage_Payment_Block_Form
32
+ {
33
+ protected function _construct()
34
+ {
35
+ parent::_construct();
36
+
37
+ $this->setTemplate('mundipagg/boleto.phtml');
38
+ }
39
+
40
+ /**
41
+ * Return Standard model
42
+ */
43
+ public function getStandard()
44
+ {
45
+ return Mage::getModel('mundipagg/standard');
46
+ }
47
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Cancel.php ADDED
@@ -0,0 +1,59 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Cancel extends Mage_Core_Block_Template
32
+ {
33
+ /**
34
+ * Internal constructor
35
+ * Set template for redirect
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ parent::_construct();
41
+ $this->setTemplate('mundipagg/cancel.phtml');
42
+ }
43
+
44
+ /**
45
+ * Get Error Description
46
+ * @return string
47
+ **/
48
+ public function getErrorDescription()
49
+ {
50
+ $session = Mage::getSingleton('checkout/session');
51
+ $session->setQuoteId($session->getMundipaggStandardQuoteId(true));
52
+
53
+ if ($session->getLastRealOrderId()) {
54
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
55
+
56
+ return $order->getPayment()->getAdditionalInformation('ErrorDescription');
57
+ }
58
+ }
59
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Debit.php ADDED
@@ -0,0 +1,56 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2015 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Debit extends Mage_Payment_Block_Form
32
+ {
33
+ protected function _construct()
34
+ {
35
+ parent::_construct();
36
+
37
+ $this->setTemplate('mundipagg/debit.phtml');
38
+ }
39
+
40
+ /**
41
+ * Debit Types
42
+ */
43
+ public function getDebitTypes()
44
+ {
45
+ $debitTypes = Mage::getStoreConfig('payment/mundipagg_debit/debit_types');
46
+
47
+ if ($debitTypes != '') {
48
+ $debitTypes = explode(",", $debitTypes);
49
+ }
50
+ else {
51
+ $debitTypes = array();
52
+ }
53
+
54
+ return $debitTypes;
55
+ }
56
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Fcancel.php ADDED
@@ -0,0 +1,43 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Fcancel extends Mage_Core_Block_Template
32
+ {
33
+ /**
34
+ * Internal constructor
35
+ * Set template for redirect
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ parent::_construct();
41
+ $this->setTemplate('mundipagg/fcancel.phtml');
42
+ }
43
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Form.php ADDED
@@ -0,0 +1,90 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Form extends Mage_Payment_Block_Form
32
+ {
33
+ protected function _construct()
34
+ {
35
+ parent::_construct();
36
+
37
+ $this->setTemplate('mundipagg/form.phtml');
38
+
39
+ // Get Customer Credit Cards Saved On File
40
+ if ($this->helper('customer')->isLoggedIn()) {
41
+ $entityId = Mage::getSingleton('customer/session')->getId();
42
+
43
+ $ccsCollection = Mage::getResourceModel('mundipagg/cardonfile_collection')
44
+ ->addEntityIdFilter($entityId)
45
+ ->addExpiresAtFilter();
46
+
47
+ $this->setCcs($ccsCollection);
48
+ } else if (Mage::getSingleton('adminhtml/session_quote')->getQuote()->getCustomerId()) {
49
+ $entityId = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getCustomerId();
50
+
51
+ $ccsCollection = Mage::getResourceModel('mundipagg/cardonfile_collection')
52
+ ->addEntityIdFilter($entityId)
53
+ ->addExpiresAtFilter();
54
+
55
+ $this->setCcs($ccsCollection);
56
+ } else {
57
+ $this->setCcs(array());
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Return Standard model
63
+ */
64
+ public function getStandard()
65
+ {
66
+ return Mage::getModel('mundipagg/standard');
67
+ }
68
+
69
+ /**
70
+ * Get installments
71
+ */
72
+ public function getInstallments($ccType = null)
73
+ {
74
+ $session = Mage::getSingleton('admin/session');
75
+
76
+ if ($session->isLoggedIn()) {
77
+ $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
78
+ } else {
79
+ $quote =(Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();;
80
+ }
81
+
82
+ $quote->setMundipaggInterest(0.0);
83
+ $quote->setMundipaggBaseInterest(0.0);
84
+ $quote->setTotalsCollectedFlag(false)->collectTotals();
85
+ $quote->save();
86
+
87
+ return Mage::helper('mundipagg/installments')->getInstallmentForCreditCardType($ccType);
88
+
89
+ }
90
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Partial.php ADDED
@@ -0,0 +1,176 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Partial extends Mage_Checkout_Block_Onepage_Payment_Methods
32
+ {
33
+ /**
34
+ * Internal constructor
35
+ * Set template for redirect
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ parent::_construct();
41
+
42
+ $this->setTemplate('mundipagg/partial.phtml');
43
+
44
+ // Get Customer Credit Cards Saved On File
45
+ if ($this->helper('customer')->isLoggedIn()) {
46
+ $entityId = Mage::getSingleton('customer/session')->getId();
47
+
48
+ $ccsCollection = Mage::getResourceModel('mundipagg/cardonfile_collection')
49
+ ->addEntityIdFilter($entityId)
50
+ ->addExpiresAtFilter();
51
+
52
+ $this->setCcs($ccsCollection);
53
+ } else {
54
+ $this->setCcs(array());
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Initialize data and prepare it for output
60
+ */
61
+ protected function _beforeToHtml()
62
+ {
63
+ //return parent::_beforeToHtml();
64
+ }
65
+
66
+ /**
67
+ * Return Standard model
68
+ */
69
+ public function getStandard()
70
+ {
71
+ return Mage::getModel('mundipagg/standard');
72
+ }
73
+
74
+ /**
75
+ * Return creditcard model
76
+ */
77
+ public function getCreditcard()
78
+ {
79
+ return Mage::getModel('mundipagg/creditcard');
80
+ }
81
+
82
+ /**
83
+ * Return twocreditcards model
84
+ */
85
+ public function getTwocreditcards()
86
+ {
87
+ return Mage::getModel('mundipagg/twocreditcards');
88
+ }
89
+
90
+ /**
91
+ * Return threecreditcards model
92
+ */
93
+ public function getThreecreditcards()
94
+ {
95
+ return Mage::getModel('mundipagg/threecreditcards');
96
+ }
97
+
98
+ /**
99
+ * Return fourcreditcards model
100
+ */
101
+ public function getFourcreditcards()
102
+ {
103
+ return Mage::getModel('mundipagg/fourcreditcards');
104
+ }
105
+
106
+ /**
107
+ * Return fivecreditcards model
108
+ */
109
+ public function getFivecreditcards()
110
+ {
111
+ return Mage::getModel('mundipagg/fivecreditcards');
112
+ }
113
+
114
+ /**
115
+ * Get last quote that is in session
116
+ */
117
+ public function getQuote()
118
+ {
119
+ $lastQuoteId = Mage::getSingleton('checkout/session')->getLastSuccessQuoteId();
120
+
121
+ return Mage::getModel('sales/quote')->load($lastQuoteId);
122
+ }
123
+
124
+ /**
125
+ * Get last order that is in session
126
+ */
127
+ public function getOrder()
128
+ {
129
+ $session = Mage::getSingleton('checkout/session');
130
+
131
+ $session->setQuoteId($session->getMundipaggStandardQuoteId(true));
132
+
133
+ if ($session->getLastRealOrderId()) {
134
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
135
+
136
+ return $order;
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Get last order baseGrandTotal that is in session
142
+ */
143
+ public function getQuoteBaseGrandTotal()
144
+ {
145
+ return $this->getOrder()->getBaseGrandTotal();
146
+ }
147
+
148
+ /**
149
+ * Retrieve availale payment methods
150
+ *
151
+ * @return array
152
+ */
153
+ public function getMethods()
154
+ {
155
+ $methods = $this->getData('methods');
156
+ if (is_null($methods)) {
157
+ $quote = $this->getQuote();
158
+ $store = $quote ? $quote->getStoreId() : null;
159
+ $methods = $this->helper('payment')->getStoreMethods($store, $quote);
160
+ $total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount();
161
+
162
+ foreach ($methods as $key => $method) {
163
+ if ($this->_canUseMethod($method)
164
+ && ($total != 0
165
+ || $method->getCode() == 'free'
166
+ || ($quote->hasRecurringItems() && $method->canManageRecurringProfiles()))) {
167
+ $this->_assignMethod($method);
168
+ } else {
169
+ unset($methods[$key]);
170
+ }
171
+ }
172
+ $this->setData('methods', $methods);
173
+ }
174
+ return $methods;
175
+ }
176
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Redirect.php ADDED
@@ -0,0 +1,175 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Redirect extends Mage_Core_Block_Template
32
+ {
33
+ /**
34
+ * @deprecated after 1.4.0.1
35
+ */
36
+ private $_order;
37
+
38
+ /**
39
+ * Retrieve identifier of created order
40
+ *
41
+ * @return string
42
+ * @deprecated after 1.4.0.1
43
+ */
44
+ public function getOrderId()
45
+ {
46
+ return $this->_getData('order_id');
47
+ }
48
+
49
+ /**
50
+ * Check order print availability
51
+ *
52
+ * @return bool
53
+ * @deprecated after 1.4.0.1
54
+ */
55
+ public function canPrint()
56
+ {
57
+ return $this->_getData('can_view_order');
58
+ }
59
+
60
+ /**
61
+ * Get url for order detale print
62
+ *
63
+ * @return string
64
+ * @deprecated after 1.4.0.1
65
+ */
66
+ public function getPrintUrl()
67
+ {
68
+ return $this->_getData('print_url');
69
+ }
70
+
71
+ /**
72
+ * Get url for view order details
73
+ *
74
+ * @return string
75
+ * @deprecated after 1.4.0.1
76
+ */
77
+ public function getViewOrderUrl()
78
+ {
79
+ return $this->_getData('view_order_id');
80
+ }
81
+
82
+ /**
83
+ * See if the order has state, visible on frontend
84
+ *
85
+ * @return bool
86
+ */
87
+ public function isOrderVisible()
88
+ {
89
+ return (bool)$this->_getData('is_order_visible');
90
+ }
91
+
92
+ /**
93
+ * Get payment method
94
+ *
95
+ * @return string
96
+ */
97
+ public function getPaymentMethod()
98
+ {
99
+ return $this->_getData('payment_method');
100
+ }
101
+
102
+ /**
103
+ * Getter for recurring profile view page
104
+ *
105
+ * @param $profile
106
+ */
107
+ public function getProfileUrl(Varien_Object $profile)
108
+ {
109
+ return $this->getUrl('sales/recurring_profile/view', array('profile' => $profile->getId()));
110
+ }
111
+
112
+ /**
113
+ * Internal constructor
114
+ * Set template for redirect
115
+ *
116
+ */
117
+ public function __construct() {
118
+ parent::_construct();
119
+ $this->setTemplate('mundipagg/redirect.phtml');
120
+ }
121
+
122
+ /**
123
+ * Initialize data and prepare it for output
124
+ */
125
+ protected function _beforeToHtml()
126
+ {
127
+ $this->_prepareLastOrder();
128
+ return parent::_beforeToHtml();
129
+ }
130
+
131
+ /**
132
+ * Get last order ID from session, fetch it and check whether it can be viewed, printed etc
133
+ */
134
+ protected function _prepareLastOrder()
135
+ {
136
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
137
+ if ($orderId) {
138
+ $order = Mage::getModel('sales/order')->load($orderId);
139
+ if ($order->getId()) {
140
+ $isVisible = !in_array($order->getState(),
141
+ Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
142
+ $this->addData(array(
143
+ 'is_order_visible' => $isVisible,
144
+ 'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)),
145
+ 'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)),
146
+ 'can_print_order' => $isVisible,
147
+ 'can_view_order' => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible,
148
+ 'order_id' => $order->getIncrementId(),
149
+ 'payment_method' => $order->getPayment()->getAdditionalInformation('PaymentMethod'),
150
+ ));
151
+ }
152
+ }
153
+ }
154
+
155
+ public function getInfoInstance()
156
+ {
157
+ return Mage::getModel('mundipagg/standard')->getInfoInstance();
158
+ }
159
+
160
+ /**
161
+ * Return Boleto URL in order to print it
162
+ * @return string
163
+ **/
164
+ public function getBoletoUrl()
165
+ {
166
+ $session = Mage::getSingleton('checkout/session');
167
+ $session->setQuoteId($session->getMundipaggStandardQuoteId(true));
168
+
169
+ if ($session->getLastRealOrderId()) {
170
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
171
+
172
+ return $order->getPayment()->getAdditionalInformation('BoletoUrl');
173
+ }
174
+ }
175
+ }
app/code/community/Uecommerce/Mundipagg/Block/Standard/Success.php ADDED
@@ -0,0 +1,179 @@
1
+ <?php
2
+ /**
3
+ * Uecommerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Uecommerce EULA.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.uecommerce.com.br/
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the extension
14
+ * to newer versions in the future. If you wish to customize the extension
15
+ * for your needs please refer to http://www.uecommerce.com.br/ for more information
16
+ *
17
+ * @category Uecommerce
18
+ * @package Uecommerce_Mundipagg
19
+ * @copyright Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
20
+ * @license http://www.uecommerce.com.br/
21
+ */
22
+
23
+ /**
24
+ * Mundipagg Payment module
25
+ *
26
+ * @category Uecommerce
27
+ * @package Uecommerce_Mundipagg
28
+ * @author Uecommerce Dev Team
29
+ */
30
+
31
+ class Uecommerce_Mundipagg_Block_Standard_Success extends Mage_Sales_Block_Items_Abstract
32
+ {
33
+ /**
34
+ * @deprecated after 1.4.0.1
35
+ */
36
+ private $_order;
37
+
38
+ /**
39
+ * Retrieve identifier of created order
40
+ *
41
+ * @return string
42
+ * @deprecated after 1.4.0.1
43
+ */
44
+ public function getOrderId()
45
+ {
46
+ return $this->_getData('order_id');
47
+ }
48
+
49
+ public function getBaseGrandTotal()
50
+ {
51
+ return $this->_getData('base_grand_total');
52
+ }
53
+
54
+ /**
55
+ * Check order print availability
56
+ *
57
+ * @return bool
58
+ * @deprecated after 1.4.0.1
59
+ */
60
+ public function canPrint()
61
+ {
62
+ return $this->_getData('can_view_order');
63
+ }
64
+
65
+ /**
66
+ * Get url for order detale print
67
+ *
68
+ * @return string
69
+ * @deprecated after 1.4.0.1
70
+ */
71
+ public function getPrintUrl()
72
+ {
73
+ return $this->_getData('print_url');
74
+ }
75
+
76
+ /**
77
+ * Get url for view order details
78
+ *
79
+ * @return string
80
+ * @deprecated after 1.4.0.1
81
+ */
82
+ public function getViewOrderUrl()
83
+ {
84
+ return $this->_getData('view_order_id');
85
+ }
86
+
87
+ /**
88
+ * See if the order has state, visible on frontend
89
+ *
90
+ * @return bool
91
+ */
92
+ public function isOrderVisible()
93
+ {
94
+ return (bool)$this->_getData('is_order_visible');
95
+ }
96
+
97
+ /**
98
+ * Get payment method
99
+ *
100
+ * @return string
101
+ */
102
+ public function getPaymentMethod()
103
+ {
104
+ return $this->_getData('payment_method');
105
+ }
106
+
107
+ /**
108
+ * Getter for recurring profile view page
109
+ *
110
+ * @param $profile
111
+ */
112
+ public function getProfileUrl(Varien_Object $profile)
113
+ {
114
+ return $this->getUrl('sales/recurring_profile/view', array('profile' => $profile->getId()));
115
+ }
116
+
117
+ /**
118
+ * Internal constructor
119
+ * Set template for redirect
120
+ *
121
+ */
122
+ public function __construct()
123
+ {
124
+ parent::_construct();
125
+ $this->setTemplate('mundipagg/success.phtml');
126
+ }
127
+
128
+ /**
129
+ * Initialize data and prepare it for output
130
+ */
131
+ protected function _beforeToHtml()
132
+ {
133
+ $this->_prepareLastOrder();
134
+ return parent::_beforeToHtml();
135
+ }
136
+
137
+ /**
138
+ * Get last order ID from session, fetch it and check whether it can be viewed, printed etc
139
+ */
140
+ protected function _prepareLastOrder()
141
+ {
142
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
143
+ if ($orderId) {
144
+ $order = Mage::getModel('sales/order')->load($orderId);
145
+ if ($order->getId()) {
146
+ $isVisible = !in_array($order->getState(),
147
+ Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
148
+ $this->addData(array(
149
+ 'is_order_visible' => $isVisible,
150
+ 'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)),
151
+ 'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)),
152
+ 'can_print_order' => $isVisible,
153
+ 'can_view_order' => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible,
154
+ 'order_id' => $order->getIncrementId(),
155
+ 'payment_method' => $order->getPayment()->getAdditionalInformation('PaymentMethod'),
156
+ 'base_grand_total' => $order->getBaseGrandTotal(),
157
+ ));
158
+ }
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Return Boleto URL in order to print it
164
+ * @return string
165
+ **/
166
+ public function getBoletoUrl()
167
+ {
168
+ $session = Mage::getSingleton('checkout/session');
169
+ $session->setQuoteId($session->getMundipaggStandardQuoteId(true));
170
+
171
+ if ($session->getLastRealOrderId()) {
172
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
173
+
174
+ $boleto = $order->getPayment()->getAdditionalInformation('BoletoUrl');
175
+
176
+ return $boleto;
177
+ }
178
+ }
179
+ }
app/code/community/Uecommerce/Mundipagg/Controller/Abstract.php ADDED
@@ -0,0 +1,80 @@
1
+ <?php
2
+
3
+ class Uecommerce_Mundipagg_Controller_Abstract extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function _construct() {
6
+ parent::_construct();
7
+
8
+ $environment = Mage::getStoreConfig('payment/mundipagg_standard/environment');
9
+
10
+ if ($environment == 'production') {
11
+ if ($this->requestIsValid() == false) {
12
+ echo $this->getResponseForInvalidRequest();
13
+ die();
14
+ }
15
+ }
16
+ }
17
+
18
+ protected function jsonResponse($responseArray) {
19
+ $json = json_encode($responseArray);
20
+
21
+ $this->getResponse()->setHeader('Content-type', 'application/json');
22
+ $this->getResponse()->setBody($json);
23
+ }
24
+
25
+ protected function requestIsValid() {
26
+ $helperLog = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
27
+ $serverHost = $_SERVER['HTTP_HOST'];
28
+ $request = $this->getRequest();
29
+
30
+ //getting request origin
31
+ $requestServer = $request->getServer();
32
+ $requestServerName = $requestServer['SERVER_NAME'];
33
+
34
+ //validating if the request is from the store and is ajax
35
+ if ($requestServerName == $serverHost && $request->isXmlHttpRequest()) {
36
+ return true;
37
+
38
+ } else {
39
+ $logMessage = "[SecurityAlert] Someone have tried to get data from a controller outside of the server.";
40
+
41
+ $helperLog->warning($logMessage);
42
+ $helperLog->warning(print_r($requestServer, true));
43
+
44
+ return false;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * @return string
50
+ */
51
+ protected function getResponseForInvalidRequest() {
52
+ return "Bad guy... Go away, we have data about you now.";
53
+ }
54
+
55
+ public function reportErrorAction() {
56
+
57
+ try {
58
+ $message = $this->getRequest()->getPost('errorMessage');
59
+ $helperLog = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
60
+ $api = new Uecommerce_Mundipagg_Model_Api();
61
+
62
+ $helperLog->error($message);
63
+ $api->mailError($message);
64
+
65
+ } catch (Exception $e) {
66
+ }
67
+ }
68
+
69
+ protected function getSessionId() {
70
+ $sessionId = Uecommerce_Mundipagg_Model_Customer_Session::getSessionId();
71
+
72
+ if (is_null($sessionId) || $sessionId == false || empty($sessionId)) {
73
+ $sessionId = uniqid('mund19-');
74
+ Uecommerce_Mundipagg_Model_Customer_Session::setSessionId($sessionId);
75
+ }
76