o2ti_moip - Version 2.0.0

Version Notes

V2

Download this release

Release Info

Developer MOIP
Extension o2ti_moip
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.3.11 to 2.0.0

Files changed (165) hide show
  1. app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Button/Button.php +97 -0
  2. app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Field/Date.php +21 -0
  3. app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Field/Selectcron.php +26 -0
  4. app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Field/Text.php +22 -0
  5. app/code/local/MOIP/Account/Helper/Data.php +14 -0
  6. app/code/local/MOIP/Account/Model/Observer.php +271 -0
  7. app/code/local/MOIP/Account/controllers/Adminhtml/MoipaccountController.php +237 -0
  8. app/code/local/MOIP/Account/etc/config.xml +84 -0
  9. app/code/local/MOIP/Account/etc/system.xml +444 -0
  10. app/code/local/MOIP/All/etc/config.xml +1 -1
  11. app/code/local/MOIP/Onestepcheckout/Block/Checkout/Cart/Promotion.php +45 -0
  12. app/code/local/MOIP/Onestepcheckout/Block/Checkout/Onepage/Billing.php +15 -50
  13. app/code/local/MOIP/Onestepcheckout/Block/Checkout/Onepage/Shipping.php +1 -1
  14. app/code/local/MOIP/Onestepcheckout/Model/System/Config/Source/Pagelayout.php +2 -2
  15. app/code/local/MOIP/Onestepcheckout/Model/System/Config/Source/Payment/Allowedmethods.php +3 -7
  16. app/code/local/MOIP/Onestepcheckout/controllers/IndexController.php +247 -162
  17. app/code/local/MOIP/Onestepcheckout/controllers/OrderController.php +42 -0
  18. app/code/local/MOIP/Onestepcheckout/etc/config.xml +185 -157
  19. app/code/local/MOIP/Onestepcheckout/etc/system.xml +85 -57
  20. app/code/local/MOIP/Transparente/Block/Adminhtml/Info/Boleto.php +30 -0
  21. app/code/local/MOIP/Transparente/Block/Adminhtml/Info/Cc.php +10 -0
  22. app/code/local/MOIP/Transparente/Block/Adminhtml/Info/Tef.php +10 -0
  23. app/code/local/MOIP/Transparente/Block/Adminhtml/Sales/Order/Create/Totals/Fee.php +6 -0
  24. app/code/local/MOIP/Transparente/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Header.php +22 -0
  25. app/code/local/MOIP/Transparente/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Oauth.php +107 -0
  26. app/code/local/MOIP/Transparente/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Reset.php +81 -0
  27. app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Boleto.php +43 -0
  28. app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Cc.php +23 -0
  29. app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Customermessages.php +0 -9
  30. app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Tef.php +21 -0
  31. app/code/local/MOIP/Transparente/Block/Checkout/Totals/Fee.php +6 -0
  32. app/code/local/MOIP/Transparente/Block/Form/Admin.php +24 -0
  33. app/code/local/MOIP/Transparente/Block/Form/Boleto.php +65 -0
  34. app/code/local/MOIP/Transparente/Block/Form/Cc.php +236 -0
  35. app/code/local/MOIP/Transparente/Block/Form/Recurring.php +231 -0
  36. app/code/local/MOIP/Transparente/Block/Form/Tef.php +84 -0
  37. app/code/local/MOIP/Transparente/Block/Info.php +0 -177
  38. app/code/local/MOIP/Transparente/Block/Info/Admin.php +36 -0
  39. app/code/local/MOIP/Transparente/Block/Info/Boleto.php +43 -0
  40. app/code/local/MOIP/Transparente/Block/Info/Boletorecurring.php +64 -0
  41. app/code/local/MOIP/Transparente/Block/Info/Cc.php +133 -0
  42. app/code/local/MOIP/Transparente/Block/Info/Tef.php +21 -0
  43. app/code/local/MOIP/Transparente/Block/Onclick/Button.php +14 -0
  44. app/code/local/MOIP/Transparente/Block/Onclick/MoipOnclick.php +34 -0
  45. app/code/local/MOIP/Transparente/Block/Onclick/PaymentMethod.php +95 -0
  46. app/code/local/MOIP/Transparente/Block/Onclick/ShippingAddress.php +21 -0
  47. app/code/local/MOIP/Transparente/Block/Onclick/ShippingMethods.php +46 -0
  48. app/code/local/MOIP/Transparente/Block/Onclick/UpdateParcelas.php +33 -0
  49. app/code/local/MOIP/Transparente/Block/Product/List/Parcelas.php +224 -0
  50. app/code/local/MOIP/Transparente/Block/Product/View/Discount.php +41 -0
  51. app/code/local/MOIP/Transparente/Block/Product/View/Parcelas.php +224 -0
  52. app/code/local/MOIP/Transparente/Block/Sales/Order/Fee.php +27 -0
  53. app/code/local/MOIP/Transparente/Block/Standard/Cancel.php +11 -0
  54. app/code/local/MOIP/Transparente/Block/Standard/CartSave.php +12 -8
  55. app/code/local/MOIP/Transparente/Block/Standard/Form.php +48 -246
  56. app/code/local/MOIP/Transparente/Block/Standard/Info.php +207 -0
  57. app/code/local/MOIP/Transparente/Block/Standard/Redirect.php +179 -283
  58. app/code/local/MOIP/Transparente/Block/Standard/SuccessRecurring.php +25 -0
  59. app/code/local/MOIP/Transparente/Helper/Data.php +167 -0
  60. app/code/local/MOIP/Transparente/Model/Admin.php +7 -0
  61. app/code/local/MOIP/Transparente/Model/Adminhtml/Method/Boleto.php +100 -0
  62. app/code/local/MOIP/Transparente/Model/Adminhtml/Method/Cc.php +316 -0
  63. app/code/local/MOIP/Transparente/Model/Adminhtml/Method/Tef.php +103 -0
  64. app/code/local/MOIP/Transparente/Model/Api.php +577 -298
  65. app/code/local/MOIP/Transparente/Model/Method/Boleto.php +104 -0
  66. app/code/local/MOIP/Transparente/Model/Method/BoletoRecurring.php +340 -0
  67. app/code/local/MOIP/Transparente/Model/Method/Cc.php +320 -0
  68. app/code/local/MOIP/Transparente/Model/Method/CcRecurring.php +369 -0
  69. app/code/local/MOIP/Transparente/Model/Method/Tef.php +104 -0
  70. app/code/local/MOIP/Transparente/Model/Mysql4/Write.php +3 -3
  71. app/code/local/MOIP/Transparente/Model/Observer.php +377 -161
  72. app/code/local/MOIP/Transparente/Model/Recurringapi.php +603 -0
  73. app/code/local/MOIP/Transparente/Model/Sales/Order/Total/Creditmemo/Fee.php +37 -0
  74. app/code/local/MOIP/Transparente/Model/Sales/Order/Total/Invoice/Fee.php +40 -0
  75. app/code/local/MOIP/Transparente/Model/Sales/Quote/Address/Total/Fee.php +20 -0
  76. app/code/local/MOIP/Transparente/Model/Source/Holded.php +6 -0
  77. app/code/local/MOIP/Transparente/Model/Standard.php +56 -249
  78. app/code/local/MOIP/Transparente/controllers/IndexController.php +283 -148
  79. app/code/local/MOIP/Transparente/controllers/RecurringController.php +315 -0
  80. app/code/local/MOIP/Transparente/controllers/StandardController.php +670 -397
  81. app/code/local/MOIP/Transparente/etc/config.xml +279 -199
  82. app/code/local/MOIP/Transparente/etc/system.xml +1251 -1140
  83. app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-install-0.1.0.php +1 -0
  84. app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.1.0-0.2.0.php +0 -27
  85. app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.1.0-0.2.2.php +63 -0
  86. app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.2.0-0.2.1.php +0 -4
  87. app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.2.0-0.2.3.php +30 -0
  88. app/design/adminhtml/default/default/layout/moip_onestepcheckout.xml +1 -0
  89. app/design/adminhtml/default/default/template/MOIP/account/system/config/button/button.phtml +37 -0
  90. app/design/{frontend/base → adminhtml/default}/default/template/MOIP/transparente/Novaforma.phtml +0 -0
  91. app/design/adminhtml/default/default/template/MOIP/transparente/SuccessDetails.phtml +91 -0
  92. app/design/adminhtml/default/default/template/MOIP/transparente/boleto.phtml +35 -0
  93. app/design/adminhtml/default/default/template/MOIP/transparente/cartao.phtml +40 -0
  94. app/design/adminhtml/default/default/template/MOIP/transparente/cartoes_my_account.phtml +77 -0
  95. app/design/adminhtml/default/default/template/MOIP/transparente/emptyupdate.phtml +26 -0
  96. app/design/adminhtml/default/default/template/MOIP/transparente/form/admin.phtml +12 -0
  97. app/design/adminhtml/default/default/template/MOIP/transparente/form/boleto.phtml +14 -0
  98. app/design/adminhtml/default/default/template/MOIP/transparente/form/cc.phtml +354 -0
  99. app/design/adminhtml/default/default/template/MOIP/transparente/form/cc_info.phtml +76 -0
  100. app/design/adminhtml/default/default/template/MOIP/transparente/form/tef.phtml +24 -0
  101. app/design/adminhtml/default/default/template/MOIP/transparente/form/tef_info.phtml +76 -0
  102. app/design/adminhtml/default/default/template/MOIP/transparente/horizontal_form.phtml +433 -0
  103. app/design/adminhtml/default/default/template/MOIP/transparente/info.phtml +57 -49
  104. app/design/adminhtml/default/default/template/MOIP/transparente/info/admin.phtml +12 -0
  105. app/design/adminhtml/default/default/template/MOIP/transparente/info/boleto.phtml +23 -0
  106. app/design/adminhtml/default/default/template/MOIP/transparente/info/cc.phtml +35 -0
  107. app/design/adminhtml/default/default/template/MOIP/transparente/info/tef.phtml +17 -0
  108. app/design/adminhtml/default/default/template/MOIP/transparente/redirect.phtml +8 -0
  109. app/design/adminhtml/default/default/template/MOIP/transparente/redirect/boleto.phtml +35 -0
  110. app/design/adminhtml/default/default/template/MOIP/transparente/redirect/cartao.phtml +40 -0
  111. app/design/{frontend/base/default/template/MOIP/transparente → adminhtml/default/default/template/MOIP/transparente/redirect}/layout_boleto.phtml +0 -0
  112. app/design/adminhtml/default/default/template/MOIP/transparente/redirect/transferencia.phtml +24 -0
  113. app/design/adminhtml/default/default/template/MOIP/transparente/script.phtml +8 -0
  114. app/design/adminhtml/default/default/template/MOIP/transparente/transferencia.phtml +24 -0
  115. app/design/frontend/base/default/layout/moip_onestepcheckout.xml +130 -27
  116. app/design/frontend/base/default/layout/moip_transparente.xml +188 -80
  117. app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/CreateAccount.phtml +239 -0
  118. app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/billing.phtml +59 -0
  119. app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/billing/billingform.phtml +274 -0
  120. app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/logged/forgotpassword.phtml +56 -0
  121. app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/logged/login-pre.phtml +57 -0
  122. app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/onepagejs.phtml +277 -0
  123. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard.phtml +225 -184
  124. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/billing.phtml +5 -5
  125. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/billing/billingform.phtml +94 -102
  126. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/correio.phtml +0 -1
  127. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/coupon.phtml +23 -25
  128. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/forgotpassword.phtml +2 -9
  129. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/local.xml +4 -15
  130. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/login-pre.phtml +0 -98
  131. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/login.phtml +2 -2
  132. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/payment.phtml +11 -93
  133. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/payment/methods.phtml +6 -4
  134. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review.phtml +2 -2
  135. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/info.phtml +5 -2
  136. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/info_simple.phtml +35 -0
  137. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/item.phtml +14 -113
  138. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/options/additional.phtml +2 -1
  139. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/totals.phtml +3 -12
  140. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/totals_simple.phtml +48 -0
  141. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping.phtml +5 -2
  142. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping/shipping_form.phtml +1 -3
  143. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping_method.phtml +4 -1
  144. app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping_method/available.phtml +16 -33
  145. app/design/frontend/base/default/template/MOIP/onestepcheckout/{onepage.phtml → onepagejs.phtml} +197 -234
  146. app/design/frontend/base/default/template/MOIP/onestepcheckout/page/1column.phtml +60 -0
  147. app/design/frontend/base/default/template/MOIP/onestepcheckout/page/footer.phtml +1 -0
  148. app/design/frontend/base/default/template/MOIP/onestepcheckout/page/single-header.phtml +71 -0
  149. app/design/frontend/base/default/template/MOIP/onestepcheckout/progresso.phtml +37 -0
  150. app/design/frontend/base/default/template/MOIP/product/list/parcelas.phtml +35 -0
  151. app/design/frontend/base/default/template/MOIP/product/view/discount.phtml +5 -0
  152. app/design/frontend/base/default/template/MOIP/product/view/parcelas.phtml +28 -37
  153. app/design/frontend/base/default/template/MOIP/transparente/SuccessDetails.phtml +36 -45
  154. app/design/frontend/base/default/template/MOIP/transparente/boleto.phtml +0 -38
  155. app/design/frontend/base/default/template/MOIP/transparente/cartao.phtml +0 -163
  156. app/design/frontend/base/default/template/MOIP/transparente/cartoes_my_account.phtml +5 -5
  157. app/design/frontend/base/default/template/MOIP/transparente/checkout/sales/order/items/renderer/default.phtml +201 -0
  158. app/design/frontend/base/default/template/MOIP/transparente/checkout/sales/order/totals.phtml +52 -0
  159. app/design/frontend/base/default/template/MOIP/transparente/checkout/success/boleto.phtml +38 -0
  160. app/design/frontend/base/default/template/MOIP/transparente/checkout/success/success.phtml +67 -0
  161. app/design/frontend/base/default/template/MOIP/transparente/form/boleto.phtml +17 -0
  162. app/design/frontend/base/default/template/MOIP/transparente/form/cc.phtml +214 -0
  163. app/design/frontend/base/default/template/MOIP/transparente/form/recurring.phtml +104 -0
  164. app/design/frontend/base/default/template/MOIP/transparente/form/tef.phtml +24 -0
  165. app/design/frontend/base/default/template/MOIP/transparente/horizontal_form.phtml +18 -14
app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Button/Button.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Account_Block_Adminhtml_System_Config_Form_Button_Button
3
+
4
+ extends Mage_Adminhtml_Block_System_Config_Form_Field implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+ /*
7
+ * Set template
8
+ */
9
+ protected function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->setTemplate('MOIP/account/system/config/button/button.phtml');
13
+ }
14
+
15
+ /**
16
+ * Return element html
17
+ *
18
+ * @param Varien_Data_Form_Element_Abstract $element
19
+ * @return string
20
+ */
21
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ return $this->_toHtml();
24
+ }
25
+
26
+ /**
27
+ * Return ajax url for button
28
+ *
29
+ * @return string
30
+ */
31
+ public function getAjaxCheckUrl()
32
+ {
33
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_moipaccount/check');
34
+ }
35
+
36
+ /**
37
+ * Generate button html
38
+ *
39
+ * @return string
40
+ */
41
+ public function getButtonHtml()
42
+ {
43
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
44
+ ->setData(array(
45
+ 'id' => 'moipaccount_button',
46
+ 'label' => $this->helper('adminhtml')->__('Criar Conta Moip'),
47
+ 'onclick' => 'javascript:check(); return false;'
48
+ ));
49
+
50
+ return $button->toHtml();
51
+ }
52
+
53
+ public function render(Varien_Data_Form_Element_Abstract $element)
54
+ {
55
+
56
+ $login = Mage::getStoreConfig('account/config/moip_login',Mage::app()->getStore());
57
+ $email = Mage::getStoreConfig('account/config/moip_email',Mage::app()->getStore());
58
+ $person_email = Mage::getStoreConfig('account/config/email',Mage::app()->getStore());
59
+ $id = Mage::getStoreConfig('account/config/moip_id',Mage::app()->getStore());
60
+ $conta_criada = Mage::getStoreConfig('account/config/conta_configurada',Mage::app()->getStore());
61
+ if($conta_criada == 0){
62
+ $this->_element = $element;
63
+ return $this->toHtml();
64
+ } else {
65
+ $useContainerId = $element->getData('use_container_id');
66
+ return sprintf(
67
+ '<tr class="system-fieldset-sub-head" id="row_%s">
68
+ <td colspan="5" style="max-width:580px;">
69
+ <h4 id="%s">Sua conta está configurada</h4>
70
+ <p class="subheading-note">Seu Login é: <span style="font-size:11px;font-style:italic;color:#999;">%s</span></p>
71
+ <p class="subheading-note">Seu Email da conta é: <span style="font-size:11px;font-style:italic;color:#999;">%s</span></p>
72
+ <p class="subheading-note">Seu ID Moip é: <span style="font-size:11px;font-style:italic;color:#999;">%s</span></p>
73
+ </td>
74
+ </tr>',
75
+ $element->getHtmlId(), $element->getHtmlId(), $login, $email, $id
76
+ );
77
+ }
78
+
79
+
80
+
81
+
82
+
83
+
84
+ }
85
+
86
+
87
+ public function getValueConfig($value){
88
+ $configValue = Mage::getStoreConfig(
89
+ 'account/config/'.$value,
90
+ Mage::app()->getStore()
91
+ );
92
+ return $configValue;
93
+ }
94
+
95
+
96
+ }
97
+ ?>
app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Field/Date.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Account_Block_Adminhtml_System_Config_Form_Field_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $date = new Varien_Data_Form_Element_Date;
7
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
8
+
9
+ $data = array(
10
+ 'name' => $element->getName(),
11
+ 'html_id' => $element->getId(),
12
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
13
+ );
14
+ $date->setData($data);
15
+ $date->setValue($element->getValue(), $format);
16
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
17
+ $date->setForm($element->getForm());
18
+
19
+ return $date->getElementHtml();
20
+ }
21
+ }
app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Field/Selectcron.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Account_Block_Adminhtml_System_Config_Form_Field_Selectcron
4
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset{
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Yes')),
10
+ array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('No')),
11
+ );
12
+ }
13
+
14
+ /**
15
+ * Get options in "key-value" format
16
+ *
17
+ * @return array
18
+ */
19
+ public function toArray()
20
+ {
21
+ return array(
22
+ 0 => Mage::helper('adminhtml')->__('No'),
23
+ 1 => Mage::helper('adminhtml')->__('Yes'),
24
+ );
25
+ }
26
+ }
app/code/local/MOIP/Account/Block/Adminhtml/System/Config/Form/Field/Text.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Account_Block_Adminhtml_System_Config_Form_Field_Text
4
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+ /**
7
+ * Render element html
8
+ *
9
+ * @param Varien_Data_Form_Element_Abstract $element
10
+ * @return string
11
+ */
12
+ public function render(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ $useContainerId = $element->getData('use_container_id');
15
+ return sprintf(
16
+ '<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5" style="max-width:580px;"><h4 id="%s">%s</h4><p class="subheading-note" style="font-size:11px;font-style:italic;color:#999;"><span>%s</span></p></td></tr>',
17
+ $element->getHtmlId(), $element->getHtmlId(), $element->getLabel(), $element->getComment()
18
+ );
19
+
20
+
21
+ }
22
+ }
app/code/local/MOIP/Account/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
+ * @license http://openMsource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class MOIP_Account_Helper_Data extends Mage_Core_Helper_Abstract {
13
+
14
+ }
app/code/local/MOIP/Account/Model/Observer.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Account_Model_Observer
3
+ {
4
+
5
+ public function sales_order_invoice_save_after($observer)
6
+ {
7
+
8
+ $invoice = $observer->getEvent()->getInvoice();
9
+ $order = $invoice->getOrder();
10
+ $order_id = $invoice->getOrder()->getId();
11
+ $order_debug = $invoice->getOrder()->Debug();
12
+ $payment = $order->getPayment();
13
+ $addinfo = $payment->getAdditionalInformation();
14
+ $invoices = $invoice->getOrder()->hasInvoices();
15
+ $method = $payment->getMethod();
16
+ $shipping_method = $order->getShippingDescription();
17
+ $shipping = $order->getShippingMethod();
18
+ $id_address = $order->getShippingAddressId();
19
+ $street = $order->getShippingAddress()->getStreet(1);
20
+ $address = $order->getShippingAddress();
21
+ $debug = array(
22
+ 'invoce' => $invoice,
23
+ 'order_id' => $order_id,
24
+ 'method' => $method,
25
+ 'shipping' => $shipping_method,
26
+ 'shipping_code' => $shipping,
27
+ 'id_address' => $id_address,
28
+ 'street' => $street,
29
+ 'street2' => $street2,
30
+ );
31
+ $debug_json = json_encode($debug);
32
+ $code_service = $this->_getShippingMethod($shipping_code);
33
+
34
+ if($code_service == 'false'){
35
+ return;
36
+ }
37
+ $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?>
38
+ <soapenv:Envelope
39
+ xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
40
+ xmlns:vis="http://www.visualset.inf.br/"
41
+ />
42
+ ');
43
+
44
+ #var_dump($order->getCustomerTaxvat());
45
+ #die();
46
+ $configValue = Mage::getStoreConfig('shippingcode/config');
47
+
48
+ $Usuario = Mage::helper('core')->decrypt($configValue['usuario']);
49
+ $Token = Mage::helper('core')->decrypt($configValue['token']);
50
+ $NrContrato = Mage::helper('core')->decrypt($configValue['NrContrato']);
51
+ $CodigoAdministrativo = Mage::helper('core')->decrypt($configValue['CodigoAdministrativo']);
52
+ $NrCartao = Mage::helper('core')->decrypt($configValue['NrCartao']);
53
+
54
+ $Header = $xml->addChild('Header');
55
+ $body = $xml->addChild('Body');
56
+ $PostarObjeto = $body->addChild('PostarObjeto', null,'http://www.visualset.inf.br/');
57
+ $PostagemVipp = $PostarObjeto->addChild('PostagemVipp', null,'http://www.visualset.inf.br/');
58
+ $PerfilVipp = $PostagemVipp->addChild('PerfilVipp', null,'http://www.visualset.inf.br/');
59
+ $PerfilVipp->addChild('Usuario', 'epsadmin752','http://www.visualset.inf.br/');
60
+ $PerfilVipp->addChild('Token', '67820778','http://www.visualset.inf.br/');
61
+ $PerfilVipp->addChild('IdPerfil', '722','http://www.visualset.inf.br/');
62
+ $ContratoEct = $PostagemVipp->addChild('ContratoEct', null,'http://www.visualset.inf.br/');
63
+ $ContratoEct->addChild('NrContrato', $NrContrato,'http://www.visualset.inf.br/');
64
+ $ContratoEct->addChild('CodigoAdministrativo', $CodigoAdministrativo,'http://www.visualset.inf.br/');
65
+ $ContratoEct->addChild('NrCartao', $NrCartao,'http://www.visualset.inf.br/');
66
+ $Destinatario = $PostagemVipp->addChild('Destinatario', null,'http://www.visualset.inf.br/');
67
+ $Destinatario->addChild('CnpjCpf', preg_replace("/[^0-9]/", "", $order->getCustomerTaxvat()),'http://www.visualset.inf.br/');
68
+ $Destinatario->addChild('IeRg', null,'http://www.visualset.inf.br/');
69
+ $Destinatario->addChild('Nome', $order->getCustomerFirstname().' '.$order->getCustomerLastname(),'http://www.visualset.inf.br/');
70
+ $Destinatario->addChild('Endereco', $address->getStreet(1),'http://www.visualset.inf.br/');
71
+ $Destinatario->addChild('Numero', $address->getStreet(2),'http://www.visualset.inf.br/');
72
+ $Destinatario->addChild('Complemento', $address->getStreet(3),'http://www.visualset.inf.br/');
73
+ $Destinatario->addChild('Bairro', $address->getStreet(4),'http://www.visualset.inf.br/');
74
+ $Destinatario->addChild('Cidade', $address->getCity(),'http://www.visualset.inf.br/');
75
+ $Destinatario->addChild('UF', $address->getRegionCode(),'http://www.visualset.inf.br/');
76
+ $Destinatario->addChild('Cep', preg_replace("/[^0-9]/", "", $address->getPostcode()),'http://www.visualset.inf.br/');
77
+ $Destinatario->addChild('Telefone', preg_replace("/[^0-9]/", "", $address->getTelephone()),'http://www.visualset.inf.br/');
78
+ $Destinatario->addChild('TelefoneSMS', null,'http://www.visualset.inf.br/');
79
+ $Destinatario->addChild('Email', $order->getCustomerEmail(),'http://www.visualset.inf.br/');
80
+ $Servico = $PostagemVipp->addChild('Servico', null,'http://www.visualset.inf.br/');
81
+ $Servico->addChild('ServicoECT', '40436','http://www.visualset.inf.br/');
82
+ $Volumes = $PostagemVipp->addChild('Volumes',null,'http://www.visualset.inf.br/');
83
+ $VolumeObjeto = $Volumes->addChild('VolumeObjeto',null,'http://www.visualset.inf.br/');
84
+ $VolumeObjeto->addChild('Peso',null,'http://www.visualset.inf.br/');
85
+ $VolumeObjeto->addChild('Altura',null,'http://www.visualset.inf.br/');
86
+ $VolumeObjeto->addChild('Largura',null,'http://www.visualset.inf.br/');
87
+ $VolumeObjeto->addChild('Comprimento',null,'http://www.visualset.inf.br/');
88
+ $VolumeObjeto->addChild('CodigoBarraVolume',null,'http://www.visualset.inf.br/');
89
+ $VolumeObjeto->addChild('CodigoBarraCliente',null,'http://www.visualset.inf.br/');
90
+ $VolumeObjeto->addChild('ObservacaoVisual',null,'http://www.visualset.inf.br/');
91
+ $VolumeObjeto->addChild('PosicaoVolume',null,'http://www.visualset.inf.br/');
92
+ $VolumeObjeto->addChild('Conteudo',null,'http://www.visualset.inf.br/');
93
+ $VolumeObjeto->addChild('ValorDeclarado',null,'http://www.visualset.inf.br/');
94
+ $VolumeObjeto->addChild('AdicionaisVolume',null,'http://www.visualset.inf.br/');
95
+ $VolumeObjeto->addChild('VlrACobrar',null,'http://www.visualset.inf.br/');
96
+ $VolumeObjeto->addChild('Etiqueta',null,'http://www.visualset.inf.br/');
97
+
98
+
99
+ $request = $xml->asXML();
100
+ Mage::log('aciona'. $debug_json, null, 'Log_ShippingCode.log', true);
101
+
102
+ $etiqueta = $this->sendXml($request);
103
+ $this->completeShipment($order, $etiqueta, $shipping, $shipping_method );
104
+ }
105
+
106
+ public function sendXml($xml){
107
+ Mage::log($xml, null, 'ShippingCode.xml', true);
108
+
109
+
110
+ $client = new SoapClient('http://sistemas.cvm.gov.br/webservices/Sistemas/SCW/CDocs/WsDownloadInfs.asmx?WSDL', array('trace' => TRUE));
111
+
112
+ #$request = file_get_contents('/hd2/sites/magento_erp/magento-ce-1.9.0.1/xml_send.xml');
113
+ #Mage::log($request, null, 'ShippingCode.xml', true);
114
+
115
+ $response = $client->__doRequest($xml, 'http://vpsrv.visualset.com.br/?wsdl', 'http://www.visualset.inf.br/PostarObjeto', '1.2');
116
+
117
+ Mage::log($response, null, 'ShippingCode.xml', true);
118
+
119
+ $xml = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $response);
120
+ $xml = simplexml_load_string($xml);
121
+ $json = json_encode($xml);
122
+ $responseArray = json_decode($json,true);
123
+
124
+ $etiqueta = $responseArray['soapBody']['PostarObjetoResponse']['PostarObjetoResult']['Postagem']['Volumes']['VolumeObjeto']['Etiqueta'];
125
+
126
+ Mage::log(json_encode($etiqueta), null, 'Log_ShippingCode.log', true);
127
+ return $etiqueta;
128
+ }
129
+
130
+ public function completeShipment($order , $shipmentTrackingNumber, $shipmentCarrierCode, $shipmentCarrierTitle )
131
+ {
132
+ /**
133
+ * It can be an alphanumeric string, but definitely unique.
134
+ */
135
+
136
+ if($shipmentTrackingNumber){
137
+ $customerEmailComments = 'Seu produto já foi enviado para expedição e poderá ser rastreado pelo código de postagem. '.$shipmentTrackingNumber;
138
+ }
139
+
140
+
141
+
142
+
143
+ if (!$order->getId()) {
144
+ Mage::throwException("Order does not exist, for the Shipment process to complete");
145
+ }
146
+
147
+ if ($order->canShip() && $shipmentTrackingNumber) {
148
+ try {
149
+ $shipment = Mage::getModel('sales/service_order', $order)
150
+ ->prepareShipment($this->_getItemQtys($order));
151
+
152
+
153
+
154
+ $arrTracking = array(
155
+ 'carrier_code' => 'correios',
156
+ 'title' => isset($shipmentCarrierTitle) ? $shipmentCarrierTitle : $order->getShippingCarrier()->getConfigData('title'),
157
+ 'number' => $shipmentTrackingNumber,
158
+ );
159
+
160
+ $track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
161
+ $shipment->addTrack($track);
162
+
163
+ // Register Shipment
164
+ $shipment->register();
165
+
166
+ // Save the Shipment
167
+ $this->_saveShipment($shipment, $order, $customerEmailComments);
168
+
169
+ // Finally, Save the Order
170
+ $this->_saveOrder($order, $customerEmailComments);
171
+ } catch (Exception $e) {
172
+ throw $e;
173
+ }
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Get the Quantities shipped for the Order, based on an item-level
179
+ * This method can also be modified, to have the Partial Shipment functionality in place
180
+ *
181
+ * @param $order Mage_Sales_Model_Order
182
+ * @return array
183
+ */
184
+ protected function _getItemQtys(Mage_Sales_Model_Order $order)
185
+ {
186
+ $qty = array();
187
+
188
+ foreach ($order->getAllItems() as $_eachItem) {
189
+ if ($_eachItem->getParentItemId()) {
190
+ $qty[$_eachItem->getParentItemId()] = $_eachItem->getQtyOrdered();
191
+ } else {
192
+ $qty[$_eachItem->getId()] = $_eachItem->getQtyOrdered();
193
+ }
194
+ }
195
+
196
+ return $qty;
197
+ }
198
+
199
+ /**
200
+ * Saves the Shipment changes in the Order
201
+ *
202
+ * @param $shipment Mage_Sales_Model_Order_Shipment
203
+ * @param $order Mage_Sales_Model_Order
204
+ * @param $customerEmailComments string
205
+ */
206
+ protected function _saveShipment(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order $order, $customerEmailComments)
207
+ {
208
+ $shipment->getOrder()->setIsInProcess(true);
209
+ $transactionSave = Mage::getModel('core/resource_transaction')
210
+ ->addObject($shipment)
211
+ ->addObject($order)
212
+ ->save();
213
+
214
+ $emailSentStatus = $shipment->getData('email_sent');
215
+
216
+ $shipment->sendEmail(true, $customerEmailComments);
217
+ $shipment->setEmailSent(true);
218
+
219
+
220
+ return $this;
221
+ }
222
+
223
+ /**
224
+ * Saves the Order, to complete the full life-cycle of the Order
225
+ * Order status will now show as Complete
226
+ *
227
+ * @param $order Mage_Sales_Model_Order
228
+ */
229
+ protected function _saveOrder(Mage_Sales_Model_Order $order, $customerEmailComments)
230
+ {
231
+ $order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
232
+ $order->setData('status', $configValue['order_status_holded']);
233
+ $configValue = Mage::getStoreConfig('shippingcode/config');
234
+ $order->setStatus($configValue['order_status_complete']);
235
+ $order->getState('Enviado para Expedição');
236
+ $history = $order->addStatusHistoryComment($customerEmailComments, true);
237
+ $history->setIsCustomerNotified(true);
238
+ $order->save();
239
+
240
+
241
+
242
+ return $this;
243
+ }
244
+
245
+ public function _getShippingMethod($shipping_code){
246
+ //intelipost_3 - e-sedex
247
+ //intelipost_2 - sedex
248
+ //intelipost_1 - pac
249
+ // correios
250
+ /*
251
+ Código Serviço
252
+ 40010 SEDEX Varejo
253
+ 40045 SEDEX a Cobrar Varejo
254
+ 40215 SEDEX 10 Varejo
255
+ 40290 SEDEX Hoje Varejo
256
+ 41106 PAC Varejo
257
+ */
258
+
259
+ if($shipping_code == "intelipost_1")
260
+ return 41106;
261
+ elseif ($shipping_code == "intelipost_2")
262
+ return 40010;
263
+ elseif ($shipping_code == "intelipost_3")
264
+ return 40010;
265
+ elseif($shipping_code == "freeshipping_freeshipping")
266
+ return false;
267
+ else
268
+ return false;
269
+
270
+ }
271
+ }
app/code/local/MOIP/Account/controllers/Adminhtml/MoipaccountController.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Account_Adminhtml_MoipaccountController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ const TOKEN_TEST = "8OKLQFT5XQZXU7CKXX43GPJOMIJPMSMF";
7
+ const ENDPOINT_TEST = "https://sandbox.moip.com.br/v2/";
8
+ const ENDPOINT_PROD = "https://api.moip.com.br/v2/";
9
+
10
+ public function checkAction()
11
+ {
12
+ $name = $this->getValueConfig('name');
13
+ $email = $this->getValueConfig('email');
14
+
15
+ $cpf = $this->getValueConfig('cpf');
16
+ $rg = $this->getValueConfig('rg');
17
+ $birthDate = Mage::app()->getLocale()->date($this->getValueConfig('birthDate'), null, null, false)->toString('Y-MM-dd');
18
+ // $mother = $this->getValueConfig('mother');
19
+ // $father = $this->getValueConfig('father');
20
+
21
+ $phone = $this->getValueConfig('phone');
22
+
23
+ $phone_ddd = $this->getNumberOrDDD($phone, true);
24
+ $phone_nun = $this->getNumberOrDDD($phone, false);
25
+ $end_rua = $this->getValueConfig('end_rua');
26
+ $end_numero = $this->getValueConfig('end_numero');
27
+ $end_complemento = $this->getValueConfig('end_complemento');
28
+ $end_bairro = $this->getValueConfig('end_bairro');
29
+ $end_cidade = $this->getValueConfig('end_cidade');
30
+ $end_zipcode = $this->getValueConfig('end_zipcode');
31
+ $region_id = strtoupper($this->getValueConfig('region_id'));
32
+
33
+
34
+ $use_pj = $this->getValueConfig('use_pj');
35
+
36
+
37
+ $pj_name = $this->getValueConfig('pj_name');
38
+
39
+ $pj_razao = $this->getValueConfig('pj_razao');
40
+ $pj_cnpj = $this->getValueConfig('pj_cnpj');
41
+
42
+ $pj_fone = $this->getValueConfig('pj_fone');
43
+ $pj_phone_ddd = $this->getNumberOrDDD($pj_fone, true);
44
+ $pj_phone_nun = $this->getNumberOrDDD($pj_fone, false);
45
+
46
+
47
+ $pj_end_rua = $this->getValueConfig('pj_end_rua');
48
+ $pj_end_numero = $this->getValueConfig('pj_end_numero');
49
+ $pj_end_complemento = $this->getValueConfig('pj_end_complemento');
50
+ $pj_end_bairro = $this->getValueConfig('pj_end_bairro');
51
+ $pj_end_cidade = $this->getValueConfig('pj_end_cidade');
52
+ $pj_region_id = $this->getValueConfig('pj_region_id');
53
+ $pj_end_zipcode = strtoupper($this->getValueConfig('pj_end_zipcode'));
54
+
55
+ if($use_pj != 1){
56
+ $company = array( "company" => array(
57
+ "name" => $pj_name,
58
+ "businessName" => $pj_razao,
59
+ "taxDocument" => array(
60
+ "type" => "CNPJ",
61
+ "number" => $pj_cnpj
62
+ ),
63
+
64
+
65
+ "phone" => array(
66
+ "countryCode" => "55",
67
+ "areaCode" => $pj_phone_ddd,
68
+ "number" => $pj_phone_nun
69
+ ),
70
+
71
+
72
+ "address" => array(
73
+ "street" => $pj_end_rua,
74
+ "streetNumber" => $pj_end_numero,
75
+ "complement" => $pj_end_complemento,
76
+ "district" => $pj_end_bairro,
77
+ "zipcode" => $pj_end_zipcode,
78
+ "city" => $pj_end_cidade,
79
+ "state" => "SP",
80
+ "country" => "BRA"
81
+ )
82
+ )
83
+ );
84
+
85
+ } else {
86
+ $company = null;
87
+ }
88
+
89
+ $array = array(
90
+ "email" => array('address' => $email ),
91
+ "person" => array(
92
+ 'name' => $name,
93
+ 'taxDocument' => array(
94
+ 'type' => "CPF",
95
+ 'number' => $cpf
96
+ ),
97
+ 'identityDocument' => array(
98
+ 'type' => "RG",
99
+ 'number' => $rg
100
+ ),
101
+ 'birthDate' => $birthDate,
102
+ // 'parentsName' => array(
103
+ // 'mother' => $mother,
104
+ // 'father' => $father
105
+ // ),
106
+ 'phone' => array(
107
+ 'countryCode' => '55',
108
+ 'areaCode' => $phone_ddd,
109
+ 'number' => $phone_nun,
110
+ ),
111
+ 'address' => array(
112
+ 'street' => $end_rua,
113
+ 'streetNumber' => $end_numero,
114
+ 'complement' => $end_complemento,
115
+ 'district' => $end_bairro,
116
+ 'zipcode' => $end_zipcode,
117
+ 'city' => $end_cidade,
118
+ 'state' => 'SP',
119
+ 'country' => 'BRA',
120
+ ),
121
+
122
+ ),
123
+ $company,
124
+ );
125
+
126
+ $account = $this->createAccount(json_encode($array));
127
+ $model = new Mage_Core_Model_Config();
128
+ $store_code = 'default';
129
+ $store_id = Mage::app()->getStore()->getStoreId();
130
+ if(!isset($account->errors)){
131
+ $redirect = $account->_links->setPassword->href;
132
+ $setRedirect['page_redirect'] = '1';
133
+ $setRedirect['url_redirect'] = $redirect;
134
+ $model->saveConfig('account/config/moip_login', $account->login, $store_code, $store_id);
135
+ $model->saveConfig('account/config/moip_id', $account->id, $store_code, $store_id);
136
+ $model->saveConfig('account/config/moip_email', $account->address, $store_code, $store_id);
137
+ $model->saveConfig('account/config/conta_configurada', 1, $store_code, $store_id);
138
+
139
+ return $this->getResponse()->setBody(json_encode($setRedirect));
140
+ } else {
141
+ $this->getResponse()->setHeader('Content-type', 'application/json');
142
+
143
+
144
+ if(isset($account->additionalInfo)){
145
+ $errors['page_redirect'] = '0';
146
+ $model->saveConfig('account/config/moip_login', $account->additionalInfo->account->login, $store_code, $store_id);
147
+ $model->saveConfig('account/config/moip_id', $account->additionalInfo->account->id, $store_code, $store_id);
148
+ $model->saveConfig('account/config/moip_email', $account->additionalInfo->account->email, $store_code, $store_id);
149
+ $model->saveConfig('account/config/conta_configurada', 1, $store_code, $store_id);
150
+
151
+ $errors['id'] = $account->additionalInfo->account->id;
152
+ $errors['login'] = $account->additionalInfo->account->login;
153
+ $errors['email'] = $account->additionalInfo->account->email;
154
+ } else {
155
+ foreach ($account->errors as $key => $value) {
156
+ $model->saveConfig('account/config/conta_configurada', 0, $store_code, $store_id);
157
+ $errors['page_redirect'] = '0';
158
+ $errors = $value->description;
159
+ }
160
+ }
161
+ }
162
+
163
+ return $this->getResponse()->setBody(json_encode($errors));
164
+
165
+ }
166
+
167
+
168
+
169
+ public function getValueConfig($value){
170
+ $configValue = Mage::getStoreConfig(
171
+ 'account/config/'.$value,
172
+ Mage::app()->getStore()
173
+ );
174
+ return $configValue;
175
+ }
176
+
177
+ public function createAccount($json)
178
+ {
179
+
180
+ $url = self::ENDPOINT_TEST."accounts";
181
+ $Basic = base64_encode(self::TOKEN_TEST . ":" . self::KEY_TEST);
182
+ $header = "Authorization: OAuth " . self::Oauth_TEST;
183
+ $documento = 'Content-Type: application/json; charset=utf-8';
184
+ $result = array();
185
+ $ch = curl_init();
186
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
187
+ curl_setopt($ch, CURLOPT_URL, $url);
188
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
189
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
190
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
191
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
192
+ $header,
193
+ $documento
194
+ ));
195
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
196
+ $responseBody = curl_exec($ch);
197
+ $info_curl = curl_getinfo($ch);
198
+ curl_close($ch);
199
+ $this->generateLog($json, 'MOIP_CreateAccount.log');
200
+ $this->generateLog($responseBody, 'MOIP_CreateAccount.log');
201
+ $this->generateLog($header, 'MOIP_CreateAccount.log');
202
+ $this->generateLog(json_encode($info_curl), 'MOIP_CreateAccount.log');
203
+
204
+ $decode = json_decode($responseBody);
205
+ return $decode;
206
+ }
207
+
208
+
209
+ public function generateLog($variable, $name_log){
210
+ $dir_log = Mage::getBaseDir('var').'/log/MOIP/';
211
+ if (!file_exists($dir_log)) {
212
+ mkdir($dir_log, 0755, true);
213
+ }
214
+ Mage::log($variable, null, 'MOIP/'.$name_log, true);
215
+ return;
216
+ }
217
+
218
+ public function getNumberOrDDD($param_telefone, $param_ddd = false)
219
+ {
220
+ $cust_ddd = '11';
221
+ $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
222
+ $st = strlen($cust_telephone) - 8;
223
+ if ($st > 0) {
224
+ $cust_ddd = substr($cust_telephone, 0, 2);
225
+ $cust_telephone = substr($cust_telephone, $st, 8);
226
+ }
227
+ if ($param_ddd === false) {
228
+ $retorno = $cust_telephone;
229
+ } else {
230
+ $retorno = $cust_ddd;
231
+ }
232
+ return $retorno;
233
+ }
234
+
235
+ }
236
+
237
+ ?>
app/code/local/MOIP/Account/etc/config.xml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MOIP_Account>
5
+ <version>0.1.0</version>
6
+ </MOIP_Account>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <moipaccount after="Mage_Adminhtml">MOIP_Account</moipaccount>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <acl>
21
+ <resources>
22
+ <all>
23
+ <title>Allow Everything</title>
24
+ </all>
25
+ <admin>
26
+ <children>
27
+ <MOIP_Account>
28
+ <title>MOIP_Account</title>
29
+ <sort_order>20</sort_order>
30
+ </MOIP_Account>
31
+ <system>
32
+ <children>
33
+ <config>
34
+ <children>
35
+ <account translate="title" module="account">
36
+ <title>Account Moip</title>
37
+ </account>
38
+ </children>
39
+ </config>
40
+ </children>
41
+ </system>
42
+ </children>
43
+ </admin>
44
+ </resources>
45
+ </acl>
46
+ </adminhtml>
47
+ <global>
48
+ <helpers>
49
+ <account>
50
+ <class>MOIP_Account_Helper</class>
51
+ </account>
52
+ </helpers>
53
+ <events>
54
+ <!--sales_order_invoice_save_after>
55
+ <observers>
56
+ <account>
57
+ <type>singleton</type>
58
+ <class>O2TI_account_Model_Observer</class>
59
+ <method>sales_order_invoice_save_after</method>
60
+ </account>
61
+ </observers>
62
+ </sales_order_invoice_save_after -->
63
+
64
+ </events>
65
+ <models>
66
+ <account>
67
+ <class>MOIP_Account_Model</class>
68
+ </account>
69
+ </models>
70
+ <blocks>
71
+ <account>
72
+ <class>MOIP_Account_Block</class>
73
+ </account>
74
+
75
+ </blocks>
76
+ </global>
77
+ <default>
78
+ <account>
79
+ <config>
80
+ <conta_configurada>0</conta_configurada>
81
+ </config>
82
+ </account>
83
+ </default>
84
+ </config>
app/code/local/MOIP/Account/etc/system.xml ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <moip translate="label" module="account">
5
+ <label>MOIP.COM.BR</label>
6
+ <sort_order>100</sort_order>
7
+ </moip>
8
+ </tabs>
9
+ <sections>
10
+ <account translate="label" module="account">
11
+ <label><![CDATA[ <div style="height: 33px; "><img src="http://imagem.o2ti.com/transparente_moip.png" style="float:left; "/><div style="padding-top:8px;color:#2f3850">Moip Account<sup style="float: right;">API-V2</sup></div></div>]]></label>
12
+ <tab>moip</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>10</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <config translate="label">
20
+ <label>Configuração de Conta Moip</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+
28
+
29
+ <check translate="label">
30
+ <label>Criar Conta</label>
31
+ <frontend_type>button</frontend_type>
32
+ <frontend_model>account/adminhtml_system_config_form_button_button</frontend_model>
33
+ <sort_order>0</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </check>
38
+
39
+ <type_account_moip translate="label">
40
+ <label>Tipo de conta</label>
41
+ <depends>
42
+ <conta_configurada>0</conta_configurada>
43
+ </depends>
44
+ <frontend_model>account/adminhtml_system_config_form_field_text</frontend_model>
45
+ <sort_order>0</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </type_account_moip>
50
+ <use_pj translate="label">
51
+ <label>Você possuí CNPJ?</label>
52
+ <depends>
53
+ <conta_configurada>0</conta_configurada>
54
+ </depends>
55
+ <comment><![CDATA[Não é necessário CNPJ para criar sua conta no moip, essa informação é apenas para validarmos se haverá ou não solicitação de dados empresáriais.]]></comment>
56
+ <frontend_type>select</frontend_type>
57
+ <source_model>adminhtml/system_config_source_yesno</source_model>
58
+ <sort_order>1</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </use_pj>
63
+ <heading_persona translate="label">
64
+ <label>Dados Pessoais</label>
65
+ <frontend_model>account/adminhtml_system_config_form_field_text</frontend_model>
66
+ <depends>
67
+ <conta_configurada>0</conta_configurada>
68
+ </depends>
69
+ <sort_order>5</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ </heading_persona>
74
+ <name translate="label">
75
+ <label>Nome:</label>
76
+ <depends>
77
+ <conta_configurada>0</conta_configurada>
78
+ </depends>
79
+ <validate>required-entry validate-alphanum-with-spaces</validate>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>6</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </name>
86
+ <email translate="label">
87
+ <label>Email:</label>
88
+ <validate>required-entry validate-email</validate>
89
+ <depends>
90
+ <conta_configurada>0</conta_configurada>
91
+ </depends>
92
+ <frontend_type>text</frontend_type>
93
+ <sort_order>7</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </email>
98
+ <phone translate="label">
99
+ <depends>
100
+ <conta_configurada>0</conta_configurada>
101
+ </depends>
102
+
103
+ <label>Telefone:</label>
104
+ <validate>required-entry validate-length minimum-length-10 maximum-length-11</validate>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>8</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ </phone>
111
+
112
+ <heading_document translate="label">
113
+ <label>Documentos Pessoais</label>
114
+ <depends>
115
+ <conta_configurada>0</conta_configurada>
116
+ </depends>
117
+
118
+ <frontend_model>account/adminhtml_system_config_form_field_text</frontend_model>
119
+ <sort_order>20</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ </heading_document>
124
+
125
+ <cpf translate="label">
126
+ <label>CPF:</label>
127
+ <depends>
128
+ <conta_configurada>0</conta_configurada>
129
+ </depends>
130
+ <validate>required-entry validate-length minimum-length-11 maximum-length-11</validate>
131
+ <frontend_type>text</frontend_type>
132
+ <sort_order>25</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </cpf>
137
+ <rg translate="label">
138
+ <label>RG:</label>
139
+ <depends>
140
+ <conta_configurada>0</conta_configurada>
141
+ </depends>
142
+ <validate>required-entry</validate>
143
+ <frontend_type>text</frontend_type>
144
+ <sort_order>26</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </rg>
149
+ <birthDate translate="label">
150
+ <label>Data de Nascimento:</label>
151
+ <depends>
152
+ <conta_configurada>0</conta_configurada>
153
+ </depends>
154
+ <validate>required-entry validate-length minimum-length-10 maximum-length-10</validate>
155
+ <frontend_model>account/adminhtml_system_config_form_field_date</frontend_model>
156
+ <frontend_type>text</frontend_type>
157
+ <sort_order>27</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ </birthDate>
162
+
163
+ <heading_endereco translate="label">
164
+ <depends>
165
+ <conta_configurada>0</conta_configurada>
166
+
167
+ </depends>
168
+ <label>Endereço Residencial</label>
169
+ <frontend_model>account/adminhtml_system_config_form_field_text</frontend_model>
170
+ <sort_order>40</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ </heading_endereco>
175
+ <end_rua translate="label">
176
+ <depends>
177
+ <conta_configurada>0</conta_configurada>
178
+ </depends>
179
+ <label>Rua:</label>
180
+ <validate>required-entry validate-alphanum-with-spaces</validate>
181
+ <frontend_type>text</frontend_type>
182
+ <sort_order>42</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ </end_rua>
187
+ <end_numero translate="label">
188
+ <depends>
189
+ <conta_configurada>0</conta_configurada>
190
+ </depends>
191
+ <label>Número:</label>
192
+ <validate>required-entry validate-alphanum-with-spaces</validate>
193
+ <frontend_type>text</frontend_type>
194
+ <sort_order>43</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ </end_numero>
199
+ <end_complemento translate="label">
200
+ <depends>
201
+ <conta_configurada>0</conta_configurada>
202
+ </depends>
203
+ <label>Complemento:</label>
204
+ <frontend_type>text</frontend_type>
205
+ <sort_order>44</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ </end_complemento>
210
+ <end_bairro translate="label">
211
+ <depends>
212
+ <conta_configurada>0</conta_configurada>
213
+ </depends>
214
+ <label>Bairro:</label>
215
+ <validate>required-entry validate-alphanum-with-spaces</validate>
216
+ <frontend_type>text</frontend_type>
217
+ <sort_order>45</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>1</show_in_website>
220
+ <show_in_store>1</show_in_store>
221
+ </end_bairro>
222
+ <end_cidade translate="label">
223
+ <depends>
224
+ <conta_configurada>0</conta_configurada>
225
+ </depends>
226
+ <label>Cidade:</label>
227
+ <validate>required-entry validate-alphanum-with-spaces</validate>
228
+ <frontend_type>text</frontend_type>
229
+ <sort_order>46</sort_order>
230
+ <show_in_default>1</show_in_default>
231
+ <show_in_website>1</show_in_website>
232
+ <show_in_store>1</show_in_store>
233
+ </end_cidade>
234
+ <region_id translate="label">
235
+ <depends>
236
+ <conta_configurada>0</conta_configurada>
237
+ </depends>
238
+ <label>Estado</label>
239
+ <validate>required-entry validate-alpha validate-length minimum-length-2 maximum-length-2</validate>
240
+ <frontend_type>text</frontend_type>
241
+ <sort_order>47</sort_order>
242
+ <show_in_default>1</show_in_default>
243
+ <show_in_website>1</show_in_website>
244
+ <show_in_store>0</show_in_store>
245
+ </region_id>
246
+ <end_zipcode translate="label">
247
+ <depends>
248
+ <conta_configurada>0</conta_configurada>
249
+ </depends>
250
+ <label>CEP</label>
251
+ <validate>required-entry validate-length minimum-length-8 maximum-length-8</validate>
252
+ <frontend_type>text</frontend_type>
253
+ <sort_order>47</sort_order>
254
+ <show_in_default>1</show_in_default>
255
+ <show_in_website>1</show_in_website>
256
+ <show_in_store>0</show_in_store>
257
+ </end_zipcode>
258
+
259
+
260
+
261
+
262
+ <heading_pj translate="label">
263
+
264
+ <label>Pessoa Jurídica</label>
265
+ <frontend_model>account/adminhtml_system_config_form_field_text</frontend_model>
266
+ <depends>
267
+ <conta_configurada>0</conta_configurada>
268
+ <use_pj>1</use_pj>
269
+ </depends>
270
+ <sort_order>50</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ </heading_pj>
275
+ <pj_name translate="label">
276
+ <label>Nome Fantasia</label>
277
+
278
+ <depends>
279
+ <conta_configurada>0</conta_configurada>
280
+ <use_pj>1</use_pj>
281
+ </depends>
282
+ <validate>required-entry validate-alphanum-with-spaces</validate>
283
+ <frontend_type>text</frontend_type>
284
+ <sort_order>51</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>0</show_in_store>
288
+ </pj_name>
289
+ <pj_fone translate="label">
290
+ <depends>
291
+ <conta_configurada>0</conta_configurada>
292
+ <use_pj>1</use_pj>
293
+ </depends>
294
+ <validate>required-entry validate-length minimum-length-10 maximum-length-11</validate>
295
+ <label>Telefone</label>
296
+ <frontend_type>text</frontend_type>
297
+ <sort_order>52</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
+ <show_in_store>0</show_in_store>
301
+ </pj_fone>
302
+
303
+ <pj_razao translate="label">
304
+ <depends>
305
+ <conta_configurada>0</conta_configurada>
306
+ <use_pj>1</use_pj>
307
+ </depends>
308
+ <label>Razão Social</label>
309
+ <frontend_type>text</frontend_type>
310
+ <sort_order>52</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>0</show_in_store>
314
+ </pj_razao>
315
+ <pj_cnpj translate="label">
316
+ <depends>
317
+ <conta_configurada>0</conta_configurada>
318
+ <use_pj>1</use_pj>
319
+ </depends>
320
+ <validate>required-entry validate-length minimum-length-14 maximum-length-14</validate>
321
+ <label>CNPJ</label>
322
+ <frontend_type>text</frontend_type>
323
+ <sort_order>60</sort_order>
324
+ <show_in_default>1</show_in_default>
325
+ <show_in_website>1</show_in_website>
326
+ <show_in_store>0</show_in_store>
327
+ </pj_cnpj>
328
+
329
+ <heading_pj_endereco translate="label">
330
+ <depends>
331
+ <conta_configurada>0</conta_configurada>
332
+ <use_pj>1</use_pj>
333
+ </depends>
334
+ <label>Endereço Empresarial</label>
335
+ <frontend_model>account/adminhtml_system_config_form_field_text</frontend_model>
336
+ <sort_order>70</sort_order>
337
+ <show_in_default>1</show_in_default>
338
+ <show_in_website>1</show_in_website>
339
+ <show_in_store>1</show_in_store>
340
+ </heading_pj_endereco>
341
+
342
+
343
+
344
+ <pj_end_rua translate="label">
345
+ <depends>
346
+ <conta_configurada>0</conta_configurada>
347
+ <use_pj>1</use_pj>
348
+ </depends>
349
+ <label>Rua:</label>
350
+ <validate>required-entry validate-alphanum-with-spaces</validate>
351
+ <frontend_type>text</frontend_type>
352
+ <sort_order>72</sort_order>
353
+ <show_in_default>1</show_in_default>
354
+ <show_in_website>1</show_in_website>
355
+ <show_in_store>1</show_in_store>
356
+ </pj_end_rua>
357
+ <pj_end_numero translate="label">
358
+ <depends>
359
+ <conta_configurada>0</conta_configurada>
360
+ <use_pj>1</use_pj>
361
+ </depends>
362
+ <label>Número:</label>
363
+ <validate>required-entry validate-alphanum-with-spaces</validate>
364
+ <frontend_type>text</frontend_type>
365
+ <sort_order>73</sort_order>
366
+ <show_in_default>1</show_in_default>
367
+ <show_in_website>1</show_in_website>
368
+ <show_in_store>1</show_in_store>
369
+ </pj_end_numero>
370
+ <pj_end_complemento translate="label">
371
+ <depends>
372
+ <conta_configurada>0</conta_configurada>
373
+ <use_pj>1</use_pj>
374
+ </depends>
375
+
376
+ <label>Complemento:</label>
377
+ <frontend_type>text</frontend_type>
378
+ <sort_order>74</sort_order>
379
+ <show_in_default>1</show_in_default>
380
+ <show_in_website>1</show_in_website>
381
+ <show_in_store>1</show_in_store>
382
+ </pj_end_complemento>
383
+ <pj_end_bairro translate="label">
384
+ <depends>
385
+ <conta_configurada>0</conta_configurada>
386
+ <use_pj>1</use_pj>
387
+ </depends>
388
+ <label>Bairro:</label>
389
+ <validate>required-entry validate-alphanum-with-spaces</validate>
390
+ <frontend_type>text</frontend_type>
391
+ <sort_order>75</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>1</show_in_store>
395
+ </pj_end_bairro>
396
+ <pj_end_cidade translate="label">
397
+ <depends>
398
+ <conta_configurada>0</conta_configurada>
399
+ <use_pj>1</use_pj>
400
+ </depends>
401
+ <label>Cidade:</label>
402
+ <validate>required-entry validate-alphanum-with-spaces</validate>
403
+ <frontend_type>text</frontend_type>
404
+ <sort_order>76</sort_order>
405
+ <show_in_default>1</show_in_default>
406
+ <show_in_website>1</show_in_website>
407
+ <show_in_store>1</show_in_store>
408
+ </pj_end_cidade>
409
+ <pj_region_id translate="label">
410
+ <depends>
411
+ <conta_configurada>0</conta_configurada>
412
+ <use_pj>1</use_pj>
413
+ </depends>
414
+ <label>Estado</label>
415
+ <validate>required-entry validate-alpha validate-length minimum-length-2 maximum-length-2</validate>
416
+ <frontend_type>text</frontend_type>
417
+ <sort_order>77</sort_order>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ <show_in_store>0</show_in_store>
421
+ </pj_region_id>
422
+ <pj_end_zipcode translate="label">
423
+ <depends>
424
+ <conta_configurada>0</conta_configurada>
425
+ <use_pj>1</use_pj>
426
+ </depends>
427
+ <label>CEP</label>
428
+ <validate>required-entry validate-length minimum-length-8 maximum-length-8</validate>
429
+ <frontend_type>text</frontend_type>
430
+ <sort_order>78</sort_order>
431
+ <show_in_default>1</show_in_default>
432
+ <show_in_website>1</show_in_website>
433
+ <show_in_store>0</show_in_store>
434
+ </pj_end_zipcode>
435
+
436
+ </fields>
437
+ </config>
438
+ </groups>
439
+ </account>
440
+ </sections>
441
+ </config>
442
+
443
+
444
+
app/code/local/MOIP/All/etc/config.xml CHANGED
@@ -8,7 +8,7 @@
8
  <admin>
9
  <routers>
10
  <moipall>
11
- <use>admin</use>
12
  <args>
13
  <module>MOIP_All</module>
14
  <frontName>moipall</frontName>
8
  <admin>
9
  <routers>
10
  <moipall>
11
+ <moipall after="Mage_Adminhtml">All_Adminhtml</moipall>
12
  <args>
13
  <module>MOIP_All</module>
14
  <frontName>moipall</frontName>
app/code/local/MOIP/Onestepcheckout/Block/Checkout/Cart/Promotion.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Onestepcheckout_Block_Checkout_Cart_Promotion extends Mage_Checkout_Block_Cart_Abstract {
3
+ public function getTotals()
4
+ {
5
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
6
+ $subtotal = $quote->getSubtotal();
7
+ return $subtotal;
8
+ }
9
+
10
+ public function getDiffCart(){
11
+ $totals = $this->getTotals();
12
+ if($totals < 99){
13
+
14
+ $diff = 100 - $totals;
15
+ return $diff;
16
+
17
+ } elseif($totals >= 100 && $totals < 200){
18
+
19
+ $diff = 200 - $totals;
20
+ return $diff;
21
+
22
+ } elseif($totals >= 200){
23
+
24
+ return false;
25
+
26
+ } else {
27
+ return false;
28
+ }
29
+
30
+ }
31
+
32
+ public function getConditionCart(){
33
+ $totals = $this->getTotals();
34
+ if($totals < 100){
35
+ return 1;
36
+ } elseif($totals >= 100 && $totals < 200){
37
+ return 2;
38
+ } elseif($totals >= 200){
39
+ return 3;
40
+ } else {
41
+ return false;
42
+ }
43
+
44
+ }
45
+ }
app/code/local/MOIP/Onestepcheckout/Block/Checkout/Onepage/Billing.php CHANGED
@@ -2,19 +2,11 @@
2
  class MOIP_Onestepcheckout_Block_Checkout_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
3
  {
4
 
5
- public function getCountryHtmlSelect($type)
6
- {
7
- $select = $this->getLayout()->createBlock('core/html_select')
8
- ->setName($type.'[country_id]')
9
- ->setId($type.':country_id')
10
- ->setTitle(Mage::helper('checkout')->__('Country'))
11
- ->setClass('validate-select billing_country')
12
- ->setValue("BR")
13
- ->setOptions($this->getCountryOptions());
14
- return $select->getHtml();
15
- }
16
-
17
- public function getAddressesHtmlSelect22($type)
18
  {
19
 
20
  if ($this->isCustomerLoggedIn()) {
@@ -54,43 +46,16 @@ class MOIP_Onestepcheckout_Block_Checkout_Onepage_Billing extends Mage_Checkout_
54
  }
55
  return '';
56
  }
57
- public function MyStatus(){
58
- return Mage::getSingleton('customer/session')->isLoggedIn();
59
- }
60
- public function Data(){
61
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
62
- $customer = Mage::getSingleton('customer/session')->getCustomer();
63
- $firstname = $customer->getFirstname();
64
- $lastname = $customer->getLastname();
65
- $taxvat = $customer->getTaxvat();
66
- $exibe_email = 0;
67
- } else {
68
- $fullname = "";
69
- $firstname = "";
70
- $lastname = "";
71
- $taxvat = "";
72
- $exibe_email = 1;
73
- }
74
- if($this->getAddress()){
75
- $firstname = $this->getAddress()->getFirstname();
76
- $lastname = $this->getAddress()->getLastname();
77
- }
78
- $_dob = $this->getLayout()->createBlock('customer/widget_dob');
79
- $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat');
80
- $_gender = $this->getLayout()->createBlock('customer/widget_gender');
81
- $data = array(
82
- 'customer' => $customer,
83
- 'firstname' => $firstname,
84
- 'lastname' => $lastname,
85
- 'region_select' => $region_select,
86
- 'taxvat' => $taxvat,
87
- 'exibe_email' => $exibe_email,
88
- '_dob' => $_dob,
89
- '_taxvat' => $_taxvat,
90
- '_gender' => $_gender
91
- );
92
- return $data;
93
 
94
- }
 
 
95
 
96
  }
2
  class MOIP_Onestepcheckout_Block_Checkout_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
3
  {
4
 
5
+ public function getCountries()
6
+ {
7
+ return Mage::getResourceModel('directory/country_collection')->loadByStore();
8
+ }
9
+ public function getAddressesHtmlSelect($type)
 
 
 
 
 
 
 
 
10
  {
11
 
12
  if ($this->isCustomerLoggedIn()) {
46
  }
47
  return '';
48
  }
49
+
50
+ public function getStyleCreateAccount(){
51
+ if ($this->isCustomerLoggedIn()) {
52
+ return null;
53
+ }
54
+ elseif (Mage::getStoreConfig('onestepcheckout/layout/page_layout')==5) {
55
+ return "grid12-6";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
+ }
58
+
59
+ }
60
 
61
  }
app/code/local/MOIP/Onestepcheckout/Block/Checkout/Onepage/Shipping.php CHANGED
@@ -37,6 +37,6 @@ class MOIP_Onestepcheckout_Block_Checkout_Onepage_Shipping extends Mage_Checkout
37
 
38
  return $select->getHtml();
39
  }
40
- return '';
41
  }
42
  }
37
 
38
  return $select->getHtml();
39
  }
40
+ return ;
41
  }
42
  }
app/code/local/MOIP/Onestepcheckout/Model/System/Config/Source/Pagelayout.php CHANGED
@@ -5,9 +5,9 @@ class MOIP_Onestepcheckout_Model_System_Config_Source_Pagelayout
5
  {
6
  return array(
7
  array('value'=>2, 'label'=>Mage::helper('onestepcheckout')->__('2 Colunas')),
8
- array('value'=>3, 'label'=>Mage::helper('onestepcheckout')->__('3 Colunas')),
9
  array('value'=>4, 'label'=>Mage::helper('onestepcheckout')->__('3 Colunas - revisão do pedido na lateral')),
10
- array('value'=>5, 'label'=>Mage::helper('onestepcheckout')->__('Pre Cadastro em 1 Coluna')),
11
  );
12
  }
13
 
5
  {
6
  return array(
7
  array('value'=>2, 'label'=>Mage::helper('onestepcheckout')->__('2 Colunas')),
8
+ array('value'=>3, 'label'=>Mage::helper('onestepcheckout')->__('3 Colunas - revisão do pedido aberta embaixo')),
9
  array('value'=>4, 'label'=>Mage::helper('onestepcheckout')->__('3 Colunas - revisão do pedido na lateral')),
10
+ array('value'=>5, 'label'=>Mage::helper('onestepcheckout')->__('3 Colunas - revisão do pedido fechada')),
11
  );
12
  }
13
 
app/code/local/MOIP/Onestepcheckout/Model/System/Config/Source/Payment/Allowedmethods.php CHANGED
@@ -24,18 +24,14 @@
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
 
27
- class MOIP_Onestepcheckout_Model_System_Config_Source_Payment_Allowedmethods
28
- // extends Mage_Adminhtml_Model_System_Config_Source_Payment_Allmethods
29
  {
30
  protected function _getPaymentMethods()
31
  {
32
- //var_dump(Mage::getSingleton('payment/config')->getActiveMethods());die();
33
  return Mage::getSingleton('payment/config')->getActiveMethods();
34
  }
35
- public function getPaymentMe(){
36
-
37
- //var_dump($this-> _getPaymentMethods());
38
- }
39
  public function toOptionArray()
40
  {
41
  $methods = array(array('value'=>'', 'label'=>''));
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
 
27
+ class MOIP_Onestepcheckout_Model_System_Config_Source_Payment_Allowedmethods extends Mage_Adminhtml_Model_System_Config_Source_Payment_Allmethods
 
28
  {
29
  protected function _getPaymentMethods()
30
  {
31
+
32
  return Mage::getSingleton('payment/config')->getActiveMethods();
33
  }
34
+
 
 
 
35
  public function toOptionArray()
36
  {
37
  $methods = array(array('value'=>'', 'label'=>''));
app/code/local/MOIP/Onestepcheckout/controllers/IndexController.php CHANGED
@@ -1,7 +1,9 @@
1
  <?php
2
  require_once 'Mage/Checkout/controllers/OnepageController.php';
3
  class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageController
4
- { protected $notshiptype=0;
 
 
5
  public function getCheckout() {
6
  return Mage::getSingleton('checkout/session');
7
  }
@@ -12,17 +14,55 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
12
  return Mage::getSingleton('checkout/type_onepage');
13
  }
14
 
 
 
15
  protected function _getQuote() {
16
  return Mage::getSingleton('checkout/cart')->getQuote();
17
  }
18
- public function indexAction() {
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  if (!Mage::getStoreConfig('onestepcheckout/config/allowguestcheckout')) {
 
 
 
 
 
 
 
 
 
 
 
21
  if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
22
- $this->_redirect('customer/account/login');
 
 
23
  return;
 
 
24
  }
25
  }
 
 
26
  if ($this->_initAction()) {
27
 
28
  if ($blocks=$this->getLayout()->getBlock('checkout.onepage')) {
@@ -37,6 +77,19 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
37
  }
38
 
39
  public function _initAction() {
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  if (!Mage::helper('checkout')->canOnepageCheckout()) {
41
  Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
42
  return false;
@@ -51,16 +104,14 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
51
  return false;
52
  }
53
  Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
54
- Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure'=>true)));
55
  $this->initInfoaddress();
56
  $this->getOnepage()->initCheckout();
57
 
58
  $defaultpaymentmethod=$this->initpaymentmethod();
59
  if ($defaultpaymentmethod) {
60
  try{
61
- Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->setPaymentMethod($defaultpaymentmethod);
62
- $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
63
- $payment->importData(array('method'=>$defaultpaymentmethod));
64
  }catch(Exception $e) {
65
  }
66
  }
@@ -75,8 +126,9 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
75
  $this->_initLayoutMessages('customer/session');
76
  $this->_initLayoutMessages('checkout/session');
77
  $this->_initLayoutMessages('catalog/session');
78
-
79
- $this->getLayout()->getBlock('head')->setTitle($this->__(Mage::getStoreConfig('onestepcheckout/layout/page_titulo')));
 
80
 
81
  return true;
82
  }
@@ -139,16 +191,12 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
139
  try{
140
  if ($listmethod ==null or $listmethod=='') {return;}
141
  if (sizeof($listmethod)==1) {
142
- if($listmethod[0] != "moip_transparente_standard"){
143
- Mage::getSingleton('checkout/session')->addError("O meio de pagamento preferêncial deve ser o Transparente.");
144
- }
145
  return $listmethod[0];
146
  }else {
147
  foreach ($listmethod as $methodname) {
148
  if (Mage::getStoreConfig("onestepcheckout/config/default_paymentmethod")==$methodname) {
149
- if($methodname != "moip_transparente_standard"){
150
- Mage::getSingleton('checkout/session')->addError("O meio de pagamento preferêncial deve ser o Transparente.");
151
- }
152
  return $methodname;
153
  }
154
  }
@@ -173,7 +221,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
173
  'city'=>'',
174
  'region_id'=>'',
175
  'region'=>'',
176
- 'postcode'=>'00000-000',
177
  'country_id'=>'BR',
178
  'telephone'=>'',
179
  'fax'=>'',
@@ -310,15 +358,21 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
310
  return true;
311
  }
312
  public function updateshippingmethodAction() {
313
- $data = $this->getRequest()->getPost('shipping_method', '');
314
- $result = $this->getOnepage()->saveShippingMethod($data);
315
-
 
 
 
 
316
  if (!isset($result['error'])) {
317
- Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
318
- array('request'=>$this->getRequest(),
319
- 'quote'=>$this->getOnepage()->getQuote()));
320
- $this->getOnepage()->getQuote()->collectTotals();
321
- $this->getOnePage()->getQuote()->getShippingAddress()->setShippingMethod($data)->save();
 
 
322
  }
323
 
324
  $this->getOnepage()->getQuote()->collectTotals()->save();
@@ -326,28 +380,33 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
326
 
327
  }
328
  public function updatepaymentmethodAction() {
 
 
 
329
  $shipping = $this->getRequest()->getPost('shipping_method', '');
330
 
331
- $data=$this->getRequest()->getPost('payment','');
332
-
333
- $result = $this->getOnepage()->saveShippingMethod($shipping);
334
-
335
- if (!isset($result['error'])) {
336
- Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
337
- array('request'=>$this->getRequest(),
338
- 'quote'=>$this->getOnepage()->getQuote()));
339
-
340
- $this->getOnePage()->getQuote()->getShippingAddress()->setShippingMethod($shipping)->save();
341
- }
342
 
343
- $this->getOnepage()->getQuote()->collectTotals()->save();
 
344
 
345
  try{
346
- $this->getOnepage()->savePayment($data);
 
 
 
 
 
 
 
 
 
 
 
347
 
348
- }
349
- catch (Exception $e) {
350
- $this->_getQuote()->save();
351
  }
352
 
353
  $this->updatereviewmethodAction();
@@ -384,22 +443,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
384
  Mage::getSingleton('checkout/cart')->removeItem($id)->save();
385
  } catch (Exception $e) {
386
  $success=0;
387
- echo '{"r":"'.$success.'","error":"'.Mage::helper('onestepcheckout')->__('Cannot remove the item.').'","view":' .json_encode($this->renderReview()).'}';die;
388
- return ;
389
- }
390
- }
391
- $success=1;
392
- if (!$this->_getQuote()->getItemsCount()) {
393
- echo '{"r":"'.$success.'","view":"<script type=\"text/javascript\">window.location=\"'.Mage::getUrl('checkout/onepage').'\"</script>"}';die;
394
- return;
395
- }
396
- else {
397
- if ($hasgiftbox) {
398
- echo '{"r":"'.$success.'","view":' .json_encode($this->renderReview()).',"giftbox":' .json_encode($this->renderGiftbox()) .'}';die;
399
- return ;
400
- }
401
- else {
402
- echo '{"r":"'.$success.'","view":' .json_encode($this->renderReview()).'}';die;
403
  return ;
404
  }
405
  }
@@ -427,54 +471,18 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
427
  public function updatecouponAction() {
428
  $this->_initLayoutMessages('checkout/session');
429
  $data = $this->getRequest()->getPost('shipping_method', '');
430
- $couponCode = (string) $this->getRequest()->getPost('coupon_code');
431
- if ($this->getRequest()->getPost('remove') == 1) {
432
- $couponCode = '';
433
- }
434
- $oldCouponCode = $this->_getQuote()->getCouponCode();
435
- if (!strlen($couponCode) && !strlen($oldCouponCode)) {
436
- echo '{"r":"0","coupon":'.json_encode($this->renderCoupon()).',"view":' . json_encode($this->renderReview()).'}';die;
437
- return;
438
- }
439
- try {
440
- $result = $this->getOnepage()->saveShippingMethod($data);
441
- if (!$result) {
442
- Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
443
- array('request'=>$this->getRequest(),
444
- 'quote'=>$this->getOnepage()->getQuote()));
445
- $this->getOnepage()->getQuote()->collectTotals();
446
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
447
- }
448
- $this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
449
- $this->getOnePage()->getQuote()->getShippingAddress()->setShippingMethod($data)->save();
450
- $this->_getQuote()->setCouponCode(strlen($couponCode) ? $couponCode : '')
451
- ->collectTotals()
452
- ->save();
453
- if ($couponCode) {
454
- if ($couponCode == $this->_getQuote()->getCouponCode()) {
455
- Mage::getSingleton('checkout/session')->addSuccess(
456
- $this->__('Coupon code "%s" was applied.', Mage::helper('core')->htmlEscape($couponCode))
457
- );
458
- }
459
- else {
460
- Mage::getSingleton('checkout/session')->addError(
461
- $this->__('Coupon code "%s" is not valid.', Mage::helper('core')->htmlEscape($couponCode))
462
- );
463
- }
464
- } else {
465
- Mage::getSingleton('checkout/session')->addSuccess($this->__('Coupon code was canceled.'));
466
- }
467
- }
468
- catch (Mage_Core_Exception $e) {
469
- Mage::getSingleton('checkout/session')->addError($e->getMessage());
470
- }
471
- catch (Exception $e) {
472
- Mage::getSingleton('checkout/session')->addError($this->__('Cannot apply the coupon code.'));
473
- }
474
- $this->_initLayoutMessages('checkout/session');
475
- $success=1;
476
- echo '{"r":"'.$success.'","coupon":'.json_encode($this->renderCoupon()).',"view":' .json_encode($this->renderReview()).'}';die;
477
- return ;
478
  }
479
  public function renderReview() {
480
  $layout=$this->getLayout();
@@ -505,7 +513,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
505
  return $output;
506
  }
507
  public function updatepaymenttypeAction() {
508
-
509
  $this->loadLayout()->renderLayout();
510
 
511
  }
@@ -559,23 +567,74 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
559
  $this->getOnepage()->getQuote()->setCheckoutMethod('register');
560
  $postData = $this->getRequest()->getPost('billing', array());
561
  $postData['email'] = trim($postData['email']);
562
- $dob = Mage::app()->getLocale()->date($postData['dob'], null, null, false)->toString('yyyy-MM-dd');
 
 
 
 
 
 
 
563
  $websiteId = Mage::app()->getWebsite()->getId();
564
  $store = Mage::app()->getStore();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
565
  $customer = Mage::getModel("customer/customer");
566
  $customer ->setWebsiteId($websiteId)
567
  ->setStore($store)
568
  ->setFirstname($postData['firstname'])
569
  ->setLastname($postData['lastname'])
570
  ->setEmail($postData['email'])
571
- ->setTaxvat($postData['taxvat'])
572
  ->setDob($dob)
573
- ->setGender($postData['gender'])
574
- ->setTipopessoa($postData['tipopessoa'])
575
- ->setCnpj($postData['cnpj'])
576
- ->setinsestadual($postData['insestadual'])
577
- ->setNomefantasia($postData['nomefantasia'])
578
- ->setRazaosocial($postData['razaosocial'])
579
  ->setPassword($postData['confirm_password']);
580
  $customer->save();
581
 
@@ -659,6 +718,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
659
  }
660
  }
661
  public function updateordermethodAction() {
 
662
  if (!$this->isCustomerLoggedIn()) {
663
  $result_save_method = $this->getOnepage()->saveCheckoutMethod('register');
664
  }
@@ -705,7 +765,31 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
705
  } else {
706
  $this->getOnepage()->getQuote()->setCheckoutMethod('register');
707
  $postData = $this->getRequest()->getPost('billing', array());
708
- $dob = Mage::app()->getLocale()->date($postData['dob'], null, null, false)->toString('yyyy-MM-dd');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
  $websiteId = Mage::app()->getWebsite()->getId();
710
  $store = Mage::app()->getStore();
711
  $customer = Mage::getModel("customer/customer");
@@ -715,9 +799,9 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
715
  ->setFirstname($postData['firstname'])
716
  ->setLastname($postData['lastname'])
717
  ->setEmail($postData['email'])
718
- ->setTaxvat($postData['taxvat'])
719
  ->setDob($dob)
720
- ->setGender($postData['gender'])
721
  ->setTipopessoa($postData['tipopessoa'])
722
  ->setRazaosocial($postData['razaosocial'])
723
  ->setNomefantasia($postData['nomefantasia'])
@@ -733,7 +817,9 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
733
  $this->saveAddress('billing', $data_save_billing);
734
  }
735
  catch (Exception $e) {
736
- $this->getResponse()->setBody($e->getMessage());
 
 
737
  }
738
  }
739
 
@@ -777,8 +863,8 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
777
  $this->getOnePage()->getQuote()->getShippingAddress()->setShippingMethod($data_save_shipping_method)->save();
778
  } catch(Exception $e) {
779
  $message = $e->getMessage();
780
- Mage::getSingleton('checkout/session')->addError($this->__($message));
781
- $this->_redirect('checkout/onepage/');
782
  return;
783
  }
784
 
@@ -790,8 +876,9 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
790
  $result_savepayment = $this->getOnepage()->savePayment($data_savepayment);
791
  } catch(Exception $e) {
792
  $message = $e->getMessage();
793
- Mage::getSingleton('checkout/session')->addError($this->__($message));
794
- $this->_redirect('checkout/onepage/');
 
795
  return;
796
  }
797
  $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
@@ -809,6 +896,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
809
  if ($this->isCustomerLoggedIn()) {
810
  $customer = Mage::getSingleton('customer/session')->getCustomer();
811
  $customer->setIsSubscribed(1);
 
812
  }else {
813
  $this->savesubscibe($data_save_billing['email']);
814
  }
@@ -817,9 +905,8 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
817
  }
818
  catch (Exception $e) {
819
  $message = $e->getMessage();
820
- Mage::getSingleton('checkout/session')->addError($this->__($message));
821
- $this->_redirect('checkout/onepage/');
822
- return;
823
  }
824
  $session = $this->getOnepage()->getCheckout();
825
  $lastOrderId = $session->getLastOrderId();
@@ -835,7 +922,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
835
  $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
836
  $result_order['success'] = true;
837
  $result_order['error'] = false;
838
- $quote = Mage::getSingleton('checkout/session')->getQuote();
839
  $allQuoteItems = $quote->getAllItems();
840
  foreach ($allQuoteItems as $_item) {
841
  $_product = $_item->getProduct();
@@ -845,10 +932,24 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
845
  }
846
  $quote->save();
847
  if (isset($redirectUrl)) {
848
- $this->_redirectUrl($redirectUrl);
 
 
 
 
 
 
849
  return;
850
  }
851
- $this->_redirect('checkout/onepage/success');
 
 
 
 
 
 
 
 
852
  }
853
 
854
 
@@ -869,7 +970,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
869
  'city'=>'n/a',
870
  'region_id'=>'n/a',
871
  'region'=>'n/a' ,
872
- 'postcode'=>'n/a',
873
  'country_id'=>'n/a',
874
  'telephone'=>'n/a',
875
  'fax'=>'n/a',
@@ -906,7 +1007,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
906
  'city'=>'n/a',
907
  'region_id'=>'n/a',
908
  'region'=>'n/a' ,
909
- 'postcode'=>'.',
910
  'country_id'=>'n/a',
911
  'telephone'=>'n/a',
912
  'fax'=>'n/a',
@@ -938,7 +1039,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
938
  'city'=>'',
939
  'region_id'=>'',
940
  'region'=>'' ,
941
- 'postcode'=>'.',
942
  'country_id'=>'',
943
  'telephone'=>'',
944
  'fax'=>'',
@@ -1000,7 +1101,7 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
1000
 
1001
  public function savesubscibe($mail) {
1002
  if ($mail) {
1003
- if (version_compare(Mage::getVersion(), '1.3.2.4', '>')) {
1004
  $session = Mage::getSingleton('checkout/session');
1005
  $customerSession = Mage::getSingleton('customer/session');
1006
  $email = (string) $mail;
@@ -1028,41 +1129,20 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
1028
  }
1029
  }
1030
  catch (Mage_Core_Exception $e) {
1031
- $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage()));
 
 
1032
  }
1033
  catch (Exception $e) {
1034
- $session->addException($e, $this->__('There was a problem with the subscription.'));
1035
- }
1036
- }
1037
- else {
1038
- if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
1039
- $session = Mage::getSingleton('core/session');
1040
- $email = (string) $this->getRequest()->getPost('email');
1041
-
1042
- try {
1043
- if (!Zend_Validate::is($email, 'EmailAddress')) {
1044
- Mage::throwException($this->__('Please enter a valid email address'));
1045
- }
1046
-
1047
- $status = Mage::getModel('newsletter/subscriber')->subscribe($email);
1048
- if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
1049
- $session->addSuccess($this->__('Confirmation request has been sent'));
1050
- }
1051
- else {
1052
- $session->addSuccess($this->__('Thank you for your subscription'));
1053
- }
1054
- }
1055
- catch (Mage_Core_Exception $e) {
1056
- $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage()));
1057
- }
1058
- catch (Exception $e) {
1059
- $session->addException($e, $this->__('There was a problem with the subscription'));
1060
- }
1061
  }
1062
- }
1063
  }
1064
 
1065
  }
 
1066
  public function updatebillingformAction() {
1067
  $this->updatebillingform();
1068
  }
@@ -1114,7 +1194,10 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
1114
  }
1115
 
1116
  }
1117
- public function saveAddress($type,$data)
 
 
 
1118
  {
1119
 
1120
  $addressId = $this->getRequest()->getPost($type.'_address_id');
@@ -1138,7 +1221,9 @@ class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageControll
1138
  ->setIsDefaultShipping(1)->setSaveInAddressBook('1');
1139
  $address->save();
1140
  } catch (Mage_Core_Exception $e) {
1141
- $this->getResponse()->setBody($e->getMessage());
 
 
1142
  }
1143
  }
1144
 
1
  <?php
2
  require_once 'Mage/Checkout/controllers/OnepageController.php';
3
  class MOIP_Onestepcheckout_IndexController extends Mage_Checkout_OnepageController
4
+ {
5
+ protected $notshiptype=0;
6
+
7
  public function getCheckout() {
8
  return Mage::getSingleton('checkout/session');
9
  }
14
  return Mage::getSingleton('checkout/type_onepage');
15
  }
16
 
17
+
18
+
19
  protected function _getQuote() {
20
  return Mage::getSingleton('checkout/cart')->getQuote();
21
  }
22
+ public function cadastroAction() {
23
 
24
+
25
+ if ($this->_initAction()) {
26
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
27
+ if ($blocks=$this->getLayout()->getBlock('checkout.onepage')) {
28
+ $blocks=$this->getLayout()->getBlock('checkout.onepage')->unsetChildren();
29
+ }
30
+
31
+ $this->renderLayout();
32
+ } else {
33
+ $this->_redirect('checkout/onepage');
34
+ }
35
+ }
36
+ else{
37
+ $this->_redirect('checkout/cart');
38
+ }
39
+
40
+ }
41
+
42
+ public function indexAction() {
43
  if (!Mage::getStoreConfig('onestepcheckout/config/allowguestcheckout')) {
44
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
45
+
46
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
47
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('checkout/onepage/', array('_secure'=>true)));
48
+ $this->_redirect('customer/account/');
49
+ return;
50
+ }
51
+ }
52
+
53
+
54
+ if(Mage::getStoreConfig('onestepcheckout/layout/use_pre_cadastro')==1){
55
  if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
56
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
57
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('checkout/onepage/', array('_secure'=>true)));
58
+ $this->_redirect('checkout/onepage/cadastro');
59
  return;
60
+ } else {
61
+ $this->renderLayout();
62
  }
63
  }
64
+
65
+
66
  if ($this->_initAction()) {
67
 
68
  if ($blocks=$this->getLayout()->getBlock('checkout.onepage')) {
77
  }
78
 
79
  public function _initAction() {
80
+
81
+
82
+ if (!Mage::getStoreConfig('checkout/options/guest_checkout')) {
83
+ Mage::getSingleton('checkout/session')->addError($this->__('aO checkout não está disponível para perfils anônimo. Altere a configuração sua loja em > Sistema > Configurações > Fechar Pedido.'));
84
+ return false;
85
+ }
86
+
87
+
88
+ /*if (Mage::getStoreConfig('checkout/options/customer_must_be_logged') == 0) {
89
+ Mage::getSingleton('checkout/session')->addError($this->__('O checkout não está disponível para perfils anônimo. Altere a configuração sua loja em > Sistema > Configurações > Fechar Pedido.'));
90
+ return false;
91
+ }*/
92
+
93
  if (!Mage::helper('checkout')->canOnepageCheckout()) {
94
  Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
95
  return false;
104
  return false;
105
  }
106
  Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
107
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('checkout/onepage/', array('_secure'=>true)));
108
  $this->initInfoaddress();
109
  $this->getOnepage()->initCheckout();
110
 
111
  $defaultpaymentmethod=$this->initpaymentmethod();
112
  if ($defaultpaymentmethod) {
113
  try{
114
+ Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->setPaymentMethod();
 
 
115
  }catch(Exception $e) {
116
  }
117
  }
126
  $this->_initLayoutMessages('customer/session');
127
  $this->_initLayoutMessages('checkout/session');
128
  $this->_initLayoutMessages('catalog/session');
129
+ Mage::getSingleton('catalog/session')->getData('messages')->clear();
130
+ Mage::getSingleton('checkout/session')->getData('messages')->clear();
131
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Checkout'));
132
 
133
  return true;
134
  }
191
  try{
192
  if ($listmethod ==null or $listmethod=='') {return;}
193
  if (sizeof($listmethod)==1) {
194
+
 
 
195
  return $listmethod[0];
196
  }else {
197
  foreach ($listmethod as $methodname) {
198
  if (Mage::getStoreConfig("onestepcheckout/config/default_paymentmethod")==$methodname) {
199
+
 
 
200
  return $methodname;
201
  }
202
  }
221
  'city'=>'',
222
  'region_id'=>'',
223
  'region'=>'',
224
+ 'postcode'=>'',
225
  'country_id'=>'BR',
226
  'telephone'=>'',
227
  'fax'=>'',
358
  return true;
359
  }
360
  public function updateshippingmethodAction() {
361
+ error_reporting(E_ALL);
362
+ ini_set("display_errors",1);
363
+
364
+ $data = $this->getRequest()->getPost('shipping_method', '');
365
+ $result = $this->getOnepage()->saveShippingMethod($data);
366
+
367
+
368
  if (!isset($result['error'])) {
369
+ Mage::dispatchEvent(
370
+ 'checkout_controller_onepage_save_shipping_method',
371
+ array(
372
+ 'request' => $this->getRequest(),
373
+ 'quote' => $this->getOnepage()->getQuote()));
374
+ $this->getOnepage()->getQuote()->collectTotals();
375
+
376
  }
377
 
378
  $this->getOnepage()->getQuote()->collectTotals()->save();
380
 
381
  }
382
  public function updatepaymentmethodAction() {
383
+ error_reporting(E_ALL);
384
+ ini_set("display_errors",1);
385
+ $this->getOnepage()->savePayment();
386
  $shipping = $this->getRequest()->getPost('shipping_method', '');
387
 
388
+
 
 
 
 
 
 
 
 
 
 
389
 
390
+
391
+ $data=$this->getRequest()->getPost('payment','');
392
 
393
  try{
394
+ $this->getOnepage()->savePayment($data);
395
+
396
+ $result = $this->getOnepage()->saveShippingMethod($shipping);
397
+
398
+ if (!isset($result['error'])) {
399
+ Mage::dispatchEvent(
400
+ 'checkout_controller_onepage_save_shipping_method',
401
+ array(
402
+ 'request' => $this->getRequest(),
403
+ 'quote' => $this->getOnepage()->getQuote()));
404
+ $this->getOnepage()->getQuote()->collectTotals()->save();
405
+ }
406
 
407
+ }
408
+ catch (Exception $e) {
409
+ $this->_getQuote()->save();
410
  }
411
 
412
  $this->updatereviewmethodAction();
443
  Mage::getSingleton('checkout/cart')->removeItem($id)->save();
444
  } catch (Exception $e) {
445
  $success=0;
446
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  return ;
448
  }
449
  }
471
  public function updatecouponAction() {
472
  $this->_initLayoutMessages('checkout/session');
473
  $data = $this->getRequest()->getPost('shipping_method', '');
474
+ $couponCode = (string) $this->getRequest()->getParam('coupon_code');
475
+
476
+ Mage::getSingleton('checkout/session')
477
+ ->getQuote()
478
+ ->setCouponCode(strlen($couponCode) ? $couponCode : '')
479
+ ->collectTotals()
480
+ ->save();
481
+
482
+ $json_array = array('status' => 'success');
483
+
484
+ return $this->getResponse()->setBody(json_encode($json_array));
485
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  }
487
  public function renderReview() {
488
  $layout=$this->getLayout();
513
  return $output;
514
  }
515
  public function updatepaymenttypeAction() {
516
+
517
  $this->loadLayout()->renderLayout();
518
 
519
  }
567
  $this->getOnepage()->getQuote()->setCheckoutMethod('register');
568
  $postData = $this->getRequest()->getPost('billing', array());
569
  $postData['email'] = trim($postData['email']);
570
+
571
+ if(isset($postData['dob'])){
572
+ $dob = Mage::app()->getLocale()->date($postData['dob'], null, null, false)->toString('yyyy-MM-dd');
573
+ } else {
574
+ $dob = null;
575
+ }
576
+
577
+
578
  $websiteId = Mage::app()->getWebsite()->getId();
579
  $store = Mage::app()->getStore();
580
+ if(isset($postData['gender'])){
581
+ $gender = $postData['gender'];
582
+ } else {
583
+ $gender = null;
584
+ }
585
+ if(isset($postData['gender'])){
586
+ $gender = $postData['gender'];
587
+ } else {
588
+ $gender = null;
589
+ }
590
+ if(isset($postData['taxvat'])){
591
+ $taxvat = $postData['taxvat'];
592
+ } else {
593
+ $taxvat = null;
594
+ }
595
+
596
+ if(isset($postData['tipopessoa'])){
597
+ $tipopessoa = $postData['tipopessoa'];
598
+ } else {
599
+ $tipopessoa = null;
600
+ }
601
+
602
+ if(isset($postData['cnpj'])){
603
+ $cnpj = $postData['cnpj'];
604
+ } else {
605
+ $cnpj = null;
606
+ }
607
+ if(isset($postData['insestadual'])){
608
+ $insestadual = $postData['insestadual'];
609
+ } else {
610
+ $insestadual = null;
611
+ }
612
+ if(isset($postData['nomefantasia'])){
613
+ $nomefantasia = $postData['nomefantasia'];
614
+ } else {
615
+ $nomefantasia = null;
616
+ }
617
+ if(isset($postData['razaosocial'])){
618
+ $razaosocial = $postData['razaosocial'];
619
+ } else {
620
+ $razaosocial = null;
621
+ }
622
+
623
+
624
  $customer = Mage::getModel("customer/customer");
625
  $customer ->setWebsiteId($websiteId)
626
  ->setStore($store)
627
  ->setFirstname($postData['firstname'])
628
  ->setLastname($postData['lastname'])
629
  ->setEmail($postData['email'])
630
+ ->setTaxvat($taxvat)
631
  ->setDob($dob)
632
+ ->setGender($gender)
633
+ ->setTipopessoa($tipopessoa)
634
+ ->setCnpj($cnpj)
635
+ ->setinsestadual($insestadual)
636
+ ->setNomefantasia($nomefantasia)
637
+ ->setRazaosocial($razaosocial)
638
  ->setPassword($postData['confirm_password']);
639
  $customer->save();
640
 
718
  }
719
  }
720
  public function updateordermethodAction() {
721
+
722
  if (!$this->isCustomerLoggedIn()) {
723
  $result_save_method = $this->getOnepage()->saveCheckoutMethod('register');
724
  }
765
  } else {
766
  $this->getOnepage()->getQuote()->setCheckoutMethod('register');
767
  $postData = $this->getRequest()->getPost('billing', array());
768
+
769
+ if(isset($postData['dob'])){
770
+ $dob = Mage::app()->getLocale()->date($postData['dob'], null, null, false)->toString('yyyy-MM-dd');
771
+ } else {
772
+ $dob = null;
773
+ }
774
+
775
+
776
+ $websiteId = Mage::app()->getWebsite()->getId();
777
+ $store = Mage::app()->getStore();
778
+ if(isset($postData['gender'])){
779
+ $gender = $postData['gender'];
780
+ } else {
781
+ $gender = null;
782
+ }
783
+ if(isset($postData['gender'])){
784
+ $gender = $postData['gender'];
785
+ } else {
786
+ $gender = null;
787
+ }
788
+ if(isset($postData['taxvat'])){
789
+ $taxvat = $postData['taxvat'];
790
+ } else {
791
+ $taxvat = null;
792
+ }
793
  $websiteId = Mage::app()->getWebsite()->getId();
794
  $store = Mage::app()->getStore();
795
  $customer = Mage::getModel("customer/customer");
799
  ->setFirstname($postData['firstname'])
800
  ->setLastname($postData['lastname'])
801
  ->setEmail($postData['email'])
802
+ ->setTaxvat($taxvat)
803
  ->setDob($dob)
804
+ ->setGender($gender)
805
  ->setTipopessoa($postData['tipopessoa'])
806
  ->setRazaosocial($postData['razaosocial'])
807
  ->setNomefantasia($postData['nomefantasia'])
817
  $this->saveAddress('billing', $data_save_billing);
818
  }
819
  catch (Exception $e) {
820
+ $message = $e->getMessage();
821
+ $json_response = array('erros' => 1, 'msg_error' => $message);
822
+ $this->getResponse()->setBody(json_encode($json_response));
823
  }
824
  }
825
 
863
  $this->getOnePage()->getQuote()->getShippingAddress()->setShippingMethod($data_save_shipping_method)->save();
864
  } catch(Exception $e) {
865
  $message = $e->getMessage();
866
+ $json_response = array('erros' => 1, 'msg_error' => $message);
867
+ $this->getResponse()->setBody(json_encode($json_response));
868
  return;
869
  }
870
 
876
  $result_savepayment = $this->getOnepage()->savePayment($data_savepayment);
877
  } catch(Exception $e) {
878
  $message = $e->getMessage();
879
+ $json_response = array('erros' => 1, 'msg_error' => $message);
880
+ $this->getResponse()->setBody(json_encode($json_response));
881
+
882
  return;
883
  }
884
  $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
896
  if ($this->isCustomerLoggedIn()) {
897
  $customer = Mage::getSingleton('customer/session')->getCustomer();
898
  $customer->setIsSubscribed(1);
899
+ $this->savesubscibe($data_save_billing['email']);
900
  }else {
901
  $this->savesubscibe($data_save_billing['email']);
902
  }
905
  }
906
  catch (Exception $e) {
907
  $message = $e->getMessage();
908
+ $json_response = array('erros' => 1, 'msg_error' => $message);
909
+ $this->getResponse()->setBody(json_encode($json_response));
 
910
  }
911
  $session = $this->getOnepage()->getCheckout();
912
  $lastOrderId = $session->getLastOrderId();
922
  $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
923
  $result_order['success'] = true;
924
  $result_order['error'] = false;
925
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
926
  $allQuoteItems = $quote->getAllItems();
927
  foreach ($allQuoteItems as $_item) {
928
  $_product = $_item->getProduct();
932
  }
933
  $quote->save();
934
  if (isset($redirectUrl)) {
935
+ $convertQuote = Mage::getSingleton('sales/convert_quote');
936
+ $order = $convertQuote->toOrder($quote);
937
+ $json_response = array('erros' => 0, 'msg_success' => $redirectUrl);
938
+ $this->getResponse()->setBody(json_encode($json_response));
939
+
940
+
941
+
942
  return;
943
  }
944
+ $convertQuote = Mage::getSingleton('sales/convert_quote');
945
+ $order = $convertQuote->toOrder($quote);
946
+ $json_response = array('erros' => 0, 'msg_success' => Mage::getUrl('checkout/onepage/success'));
947
+ $this->getResponse()->setBody(json_encode($json_response));
948
+
949
+
950
+
951
+
952
+
953
  }
954
 
955
 
970
  'city'=>'n/a',
971
  'region_id'=>'n/a',
972
  'region'=>'n/a' ,
973
+ 'postcode'=>'',
974
  'country_id'=>'n/a',
975
  'telephone'=>'n/a',
976
  'fax'=>'n/a',
1007
  'city'=>'n/a',
1008
  'region_id'=>'n/a',
1009
  'region'=>'n/a' ,
1010
+ 'postcode'=>'',
1011
  'country_id'=>'n/a',
1012
  'telephone'=>'n/a',
1013
  'fax'=>'n/a',
1039
  'city'=>'',
1040
  'region_id'=>'',
1041
  'region'=>'' ,
1042
+ 'postcode'=>'',
1043
  'country_id'=>'',
1044
  'telephone'=>'',
1045
  'fax'=>'',
1101
 
1102
  public function savesubscibe($mail) {
1103
  if ($mail) {
1104
+
1105
  $session = Mage::getSingleton('checkout/session');
1106
  $customerSession = Mage::getSingleton('customer/session');
1107
  $email = (string) $mail;
1129
  }
1130
  }
1131
  catch (Mage_Core_Exception $e) {
1132
+ $message = $e->getMessage();
1133
+ $json_response = array('erros' => 1, 'msg_error' => $message);
1134
+ $this->getResponse()->setBody(json_encode($json_response));
1135
  }
1136
  catch (Exception $e) {
1137
+ $message = $e->getMessage();
1138
+ $json_response = array('erros' => 1, 'msg_error' => $message);
1139
+ $this->getResponse()->setBody(json_encode($json_response));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1140
  }
1141
+
1142
  }
1143
 
1144
  }
1145
+
1146
  public function updatebillingformAction() {
1147
  $this->updatebillingform();
1148
  }
1194
  }
1195
 
1196
  }
1197
+
1198
+
1199
+
1200
+ public function saveAddress($type,$data)
1201
  {
1202
 
1203
  $addressId = $this->getRequest()->getPost($type.'_address_id');
1221
  ->setIsDefaultShipping(1)->setSaveInAddressBook('1');
1222
  $address->save();
1223
  } catch (Mage_Core_Exception $e) {
1224
+ $message = $e->getMessage();
1225
+ $json_response = array('erros' => 1, 'msg_error' => $message);
1226
+ $this->getResponse()->setBody(json_encode($json_response));
1227
  }
1228
  }
1229
 
app/code/local/MOIP/Onestepcheckout/controllers/OrderController.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Sales/controllers/OrderController.php';
4
+ class MOIP_Onestepcheckout_OrderController extends Mage_Sales_OrderController{
5
+
6
+ public function reorderAction()
7
+ {
8
+
9
+ if (!$this->_loadValidOrder()) {
10
+ return;
11
+ }
12
+ $order = Mage::registry('current_order');
13
+
14
+ $cart = Mage::getSingleton('checkout/cart');
15
+ $cartTruncated = false;
16
+ /* @var $cart Mage_Checkout_Model_Cart */
17
+
18
+ $items = $order->getItemsCollection();
19
+ foreach ($items as $item) {
20
+ try {
21
+ $cart->addOrderItem($item);
22
+ } catch (Mage_Core_Exception $e){
23
+ if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
24
+ Mage::getSingleton('checkout/session')->addNotice($e->getMessage());
25
+ }
26
+ else {
27
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
28
+ }
29
+ $this->_redirect('*/*/history');
30
+ } catch (Exception $e) {
31
+ Mage::getSingleton('checkout/session')->addException($e,
32
+ Mage::helper('checkout')->__('Cannot add the item to shopping cart.')
33
+ );
34
+ $this->_redirect('checkout/cart');
35
+ }
36
+ }
37
+
38
+ $cart->save();
39
+ $this->_redirect('checkout/onepage');
40
+
41
+ }
42
+ }
app/code/local/MOIP/Onestepcheckout/etc/config.xml CHANGED
@@ -17,6 +17,10 @@
17
  <frontName>onestepcheckout</frontName>
18
  </args>
19
  </onestepcheckout>
 
 
 
 
20
  </routers>
21
  <layout>
22
  <updates>
@@ -26,42 +30,40 @@
26
  </updates>
27
  </layout>
28
  <translate>
29
- <modules>
30
- <MOIP_Onestepcheckout>
31
- <files>
32
- <default>MOIP_Onestepcheckout.csv</default>
33
- </files>
34
- </MOIP_Onestepcheckout>
35
- </modules>
36
- </translate>
37
  </frontend>
38
  <admin>
39
  <routers>
40
- <onestepcheckout>
41
- <use>admin</use>
42
- <args>
43
- <module>MOIP_Onestepcheckout</module>
44
- <frontName>onestepcheckout</frontName>
45
- </args>
46
- </onestepcheckout>
 
47
  </routers>
48
  </admin>
49
  <adminhtml>
50
-
51
-
52
- <acl>
53
- <resources>
54
- <all>
55
- <title>Allow Everything</title>
56
- </all>
57
- <admin>
58
- <children>
59
- <MOIP_Onestepcheckout>
60
- <title>Onestepcheckout Module</title>
61
- <sort_order>10</sort_order>
62
- </MOIP_Onestepcheckout>
63
-
64
- <system>
65
  <children>
66
  <config>
67
  <children>
@@ -72,34 +74,41 @@
72
  </config>
73
  </children>
74
  </system>
75
- </children>
76
- </admin>
77
- </resources>
78
- </acl>
79
- <layout>
80
- <updates>
81
- <onestepcheckout>
82
- <file>moip_onestepcheckout.xml</file>
83
- </onestepcheckout>
84
- </updates>
85
- </layout>
86
- <translate>
87
- <modules>
88
- <MOIP_Onestepcheckout>
89
- <files>
90
- <default>MOIP_Onestepcheckout.csv</default>
91
- </files>
92
- </MOIP_Onestepcheckout>
93
- </modules>
94
- </translate>
95
  </adminhtml>
96
  <global>
97
- <rewrite>
98
- <moip_onestepcheckout_index>
99
- <from><![CDATA[#^/checkout/onepage/#]]></from>
100
- <to>/onestepcheckout/index/</to>
101
- </moip_onestepcheckout_index>
102
- </rewrite>
 
 
 
 
 
 
 
103
  <models>
104
  <onestepcheckout>
105
  <class>MOIP_Onestepcheckout_Model</class>
@@ -113,12 +122,11 @@
113
  </onestepcheckout>
114
  </entities>
115
  </onestepcheckout_mysql4>
116
- <sales>
117
- <rewrite>
118
- <quote_address>MOIP_Onestepcheckout_Model_Sales_Quote_Address</quote_address>
119
- </rewrite>
120
- </sales>
121
-
122
  </models>
123
  <resources>
124
  <moip_onestepcheckout_setup>
@@ -144,7 +152,6 @@
144
  <onestepcheckout>
145
  <class>MOIP_Onestepcheckout_Block</class>
146
  </onestepcheckout>
147
-
148
  </blocks>
149
  <helpers>
150
  <onestepcheckout>
@@ -152,101 +159,122 @@
152
  </onestepcheckout>
153
  </helpers>
154
  <events>
155
- <checkout_cart_add_product_complete>
156
- <observers>
157
- <onstepcheckout>
158
- <type>singleton</type>
159
- <class>onestepcheckout/observer</class>
160
- <method>checkout_cart_add_product_complete</method>
161
- </onstepcheckout>
162
- </observers>
163
- </checkout_cart_add_product_complete>
164
- </events>
165
- <fieldsets>
166
- <checkout_onepage_quote>
167
- <customer_tipopessoa>
168
- <to_customer>tipopessoa</to_customer>
169
- </customer_tipopessoa>
170
- <customer_nomefantasia>
171
- <to_customer>nomefantasia</to_customer>
172
- </customer_nomefantasia>
173
- <customer_razaosocial>
174
- <to_customer>razaosocial</to_customer>
175
- </customer_razaosocial>
176
- <customer_cnpj>
177
- <to_customer>cnpj</to_customer>
178
- </customer_cnpj>
179
- <customer_insestadual>
180
- <to_customer>insestadual</to_customer>
181
- </customer_insestadual>
182
-
183
- </checkout_onepage_quote>
184
- <customer_account>
185
- <tipopessoa>
186
- <to_quote>customer_tipopessoa</to_quote>
187
- </tipopessoa>
188
- <nomefantasia>
189
- <to_quote>customer_nomefantasia</to_quote>
190
- </nomefantasia>
191
- <razaosocial>
192
- <to_quote>customer_razaosocial</to_quote>
193
- </razaosocial>
194
- <cnpj>
195
- <to_quote>customer_cnpj</to_quote>
196
- </cnpj>
197
- <insestadual>
198
- <to_quote>customer_insestadual</to_quote>
199
- </insestadual>
200
- </customer_account>
201
-
202
  <customer_account>
203
- <tipopessoa><create>1</create><update>1</update><name>1</name></tipopessoa>
204
- <nomefantasia><create>1</create><update>1</update><name>1</name></nomefantasia>
205
- <razaosocial><create>1</create><update>1</update><name>1</name></razaosocial>
206
- <cnpj><create>1</create><update>1</update><name>1</name></cnpj>
207
- <insestadual><create>1</create><update>1</update><name>1</name></insestadual>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  </customer_account>
209
  </fieldsets>
210
  </global>
211
- <default>
212
- <onestepcheckout>
213
- <config>
214
- <enabled>1</enabled>
215
- <default_paymentmethod>moip_transparente_standard</default_paymentmethod>
216
- <allowshippingotheraddress>1</allowshippingotheraddress>
217
- <allowguestcheckout>1</allowguestcheckout>
218
- <allowregister>1</allowregister>
219
- <enable_buscacep>1</enable_buscacep>
220
- <enable_pj>1</enable_pj>
221
- <create_account>1</create_account>
222
- <style_color>000000</style_color>
223
- <botao_color>000000</botao_color>
224
- <default_country>BR</default_country>
225
- </config>
226
- <layout>
227
- <use_secure>1</use_secure>
228
- <page_titulo>Pagamento</page_titulo>
229
- <page_conteudo>Sua compra segura via Transparente</page_conteudo>
230
- <page_layout>3</page_layout>
231
- <style_cor>000000</style_cor>
232
- <botao_cor>000000</botao_cor>
233
- <page_conteudo>Preencha os dados para concluir seu pedido</page_conteudo>
234
- <allowsubscribenewsletter>2</allowsubscribenewsletter>
235
- <enable_quicklogin>1</enable_quicklogin>
236
- </layout>
237
- <addfield>
238
- <street_lines>4</street_lines>
239
- <addressbook>1</addressbook>
240
- <allowcoupon>1</allowcoupon>
241
- <showimageproduct>1</showimageproduct>
242
- <enable_giftmessage>0</enable_giftmessage>
243
- </addfield>
244
- <termcondition>
245
- <allow_options>1</allow_options>
246
- <content_options>Termos e condições do site...</content_options>
247
- <boxwidth>250</boxwidth>
248
- <boxheight>350</boxheight>
249
- </termcondition>
250
- </onestepcheckout>
251
- </default>
252
- </config>
 
 
 
17
  <frontName>onestepcheckout</frontName>
18
  </args>
19
  </onestepcheckout>
20
+
21
+
22
+
23
+
24
  </routers>
25
  <layout>
26
  <updates>
30
  </updates>
31
  </layout>
32
  <translate>
33
+ <modules>
34
+ <MOIP_Onestepcheckout>
35
+ <files>
36
+ <default>MOIP_Onestepcheckout.csv</default>
37
+ </files>
38
+ </MOIP_Onestepcheckout>
39
+ </modules>
40
+ </translate>
41
  </frontend>
42
  <admin>
43
  <routers>
44
+ <onestepcheckout>
45
+
46
+ <onestepcheckout after="Mage_Adminhtml">Onestepcheckout_Adminhtml</onestepcheckout>
47
+ <args>
48
+ <module>MOIP_Onestepcheckout</module>
49
+ <frontName>onestepcheckout</frontName>
50
+ </args>
51
+ </onestepcheckout>
52
  </routers>
53
  </admin>
54
  <adminhtml>
55
+ <acl>
56
+ <resources>
57
+ <all>
58
+ <title>Allow Everything</title>
59
+ </all>
60
+ <admin>
61
+ <children>
62
+ <MOIP_Onestepcheckout>
63
+ <title>Onestepcheckout Module</title>
64
+ <sort_order>10</sort_order>
65
+ </MOIP_Onestepcheckout>
66
+ <system>
 
 
 
67
  <children>
68
  <config>
69
  <children>
74
  </config>
75
  </children>
76
  </system>
77
+ </children>
78
+ </admin>
79
+ </resources>
80
+ </acl>
81
+ <layout>
82
+ <updates>
83
+ <onestepcheckout>
84
+ <file>moip_onestepcheckout.xml</file>
85
+ </onestepcheckout>
86
+ </updates>
87
+ </layout>
88
+ <translate>
89
+ <modules>
90
+ <MOIP_Onestepcheckout>
91
+ <files>
92
+ <default>MOIP_Onestepcheckout.csv</default>
93
+ </files>
94
+ </MOIP_Onestepcheckout>
95
+ </modules>
96
+ </translate>
97
  </adminhtml>
98
  <global>
99
+ <rewrite>
100
+ <moip_onestepcheckout_index>
101
+ <from><![CDATA[#^/checkout/onepage/#]]></from>
102
+ <to>/onestepcheckout/index/</to>
103
+ </moip_onestepcheckout_index>
104
+
105
+
106
+ <moip_onestepcheckout_order>
107
+ <from><![CDATA[#^/sales/order/reorder/#]]></from>
108
+ <to>/onestepcheckout/order/reorder/</to>
109
+ </moip_onestepcheckout_order>
110
+
111
+ </rewrite>
112
  <models>
113
  <onestepcheckout>
114
  <class>MOIP_Onestepcheckout_Model</class>
122
  </onestepcheckout>
123
  </entities>
124
  </onestepcheckout_mysql4>
125
+ <sales>
126
+ <rewrite>
127
+ <quote_address>MOIP_Onestepcheckout_Model_Sales_Quote_Address</quote_address>
128
+ </rewrite>
129
+ </sales>
 
130
  </models>
131
  <resources>
132
  <moip_onestepcheckout_setup>
152
  <onestepcheckout>
153
  <class>MOIP_Onestepcheckout_Block</class>
154
  </onestepcheckout>
 
155
  </blocks>
156
  <helpers>
157
  <onestepcheckout>
159
  </onestepcheckout>
160
  </helpers>
161
  <events>
162
+ <checkout_cart_add_product_complete>
163
+ <observers>
164
+ <onstepcheckout>
165
+ <type>singleton</type>
166
+ <class>onestepcheckout/observer</class>
167
+ <method>checkout_cart_add_product_complete</method>
168
+ </onstepcheckout>
169
+ </observers>
170
+ </checkout_cart_add_product_complete>
171
+ </events>
172
+ <fieldsets>
173
+ <checkout_onepage_quote>
174
+ <customer_tipopessoa>
175
+ <to_customer>tipopessoa</to_customer>
176
+ </customer_tipopessoa>
177
+ <customer_nomefantasia>
178
+ <to_customer>nomefantasia</to_customer>
179
+ </customer_nomefantasia>
180
+ <customer_razaosocial>
181
+ <to_customer>razaosocial</to_customer>
182
+ </customer_razaosocial>
183
+ <customer_cnpj>
184
+ <to_customer>cnpj</to_customer>
185
+ </customer_cnpj>
186
+ <customer_insestadual>
187
+ <to_customer>insestadual</to_customer>
188
+ </customer_insestadual>
189
+ </checkout_onepage_quote>
190
+ <customer_account>
191
+ <tipopessoa>
192
+ <to_quote>customer_tipopessoa</to_quote>
193
+ </tipopessoa>
194
+ <nomefantasia>
195
+ <to_quote>customer_nomefantasia</to_quote>
196
+ </nomefantasia>
197
+ <razaosocial>
198
+ <to_quote>customer_razaosocial</to_quote>
199
+ </razaosocial>
200
+ <cnpj>
201
+ <to_quote>customer_cnpj</to_quote>
202
+ </cnpj>
203
+ <insestadual>
204
+ <to_quote>customer_insestadual</to_quote>
205
+ </insestadual>
206
+ </customer_account>
 
 
207
  <customer_account>
208
+ <tipopessoa>
209
+ <create>1</create>
210
+ <update>1</update>
211
+ <name>1</name>
212
+ </tipopessoa>
213
+ <nomefantasia>
214
+ <create>1</create>
215
+ <update>1</update>
216
+ <name>1</name>
217
+ </nomefantasia>
218
+ <razaosocial>
219
+ <create>1</create>
220
+ <update>1</update>
221
+ <name>1</name>
222
+ </razaosocial>
223
+ <cnpj>
224
+ <create>1</create>
225
+ <update>1</update>
226
+ <name>1</name>
227
+ </cnpj>
228
+ <insestadual>
229
+ <create>1</create>
230
+ <update>1</update>
231
+ <name>1</name>
232
+ </insestadual>
233
  </customer_account>
234
  </fieldsets>
235
  </global>
236
+ <default>
237
+ <onestepcheckout>
238
+ <config>
239
+ <enabled>1</enabled>
240
+ <default_paymentmethod></default_paymentmethod>
241
+ <allowshippingotheraddress>1</allowshippingotheraddress>
242
+ <allowguestcheckout>1</allowguestcheckout>
243
+ <allowregister>1</allowregister>
244
+ <enable_buscacep>1</enable_buscacep>
245
+ <enable_pj>1</enable_pj>
246
+ <create_account>1</create_account>
247
+ <style_color>000000</style_color>
248
+ <botao_color>000000</botao_color>
249
+ <default_country>BR</default_country>
250
+ </config>
251
+ <layout>
252
+ <use_secure>1</use_secure>
253
+ <page_titulo>Pagamento</page_titulo>
254
+ <page_conteudo>Sua compra segura via Transparente</page_conteudo>
255
+ <use_linha_suporte>1</use_linha_suporte>
256
+ <content_linha_suporte><![CDATA[Dúvidas? <a href="javascript:$zopim.livechat.window.show()" class="chat" id="control_chat">Chat Online</a> | Sac (11) 3333-3333]]></content_linha_suporte>
257
+ <page_layout>3</page_layout>
258
+ <style_cor>000000</style_cor>
259
+ <botao_cor>000000</botao_cor>
260
+ <style_cor_background>F7F7F7</style_cor_background>
261
+ <style_cor_header>FFFFFF</style_cor_header>
262
+ <allowsubscribenewsletter>2</allowsubscribenewsletter>
263
+ <enable_quicklogin>1</enable_quicklogin>
264
+ </layout>
265
+ <addfield>
266
+ <street_lines>4</street_lines>
267
+ <addressbook>1</addressbook>
268
+ <allowcoupon>1</allowcoupon>
269
+ <showimageproduct>1</showimageproduct>
270
+ <enable_giftmessage>0</enable_giftmessage>
271
+ </addfield>
272
+ <termcondition>
273
+ <allow_options>1</allow_options>
274
+ <content_options><![CDATA[Termos e condições do site...]]></content_options>
275
+ <boxwidth>250</boxwidth>
276
+ <boxheight>350</boxheight>
277
+ </termcondition>
278
+ </onestepcheckout>
279
+ </default>
280
+ </config>
app/code/local/MOIP/Onestepcheckout/etc/system.xml CHANGED
@@ -1,41 +1,37 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <!-- Headers Tabs, mageworld la ten dat bat ky -->
4
- <tabs>
5
  <moip translate="label" module="onestepcheckout">
6
  <label>MOIP.COM.BR</label>
7
  <sort_order>100</sort_order>
8
  </moip>
9
  </tabs>
10
- <!-- Headers Tabs has a number of sections. -->
11
  <sections>
12
  <onestepcheckout translate="label" module="onestepcheckout">
13
- <label><![CDATA[ <div style="height: 33px; "><img src="https://imagem.o2ti.com/checkout_moip.png" style="float:left; "/><div style="padding-top:8px;color:#2f3850;margin-left: 30px;"> Moip Carrinho<sup style="float: right;">v2.0.0</sup></div></div>]]></label>
14
  <tab>moip</tab>
15
  <frontend_type>text</frontend_type>
16
  <sort_order>100</sort_order>
17
  <show_in_default>1</show_in_default>
18
  <show_in_website>1</show_in_website>
19
  <show_in_store>1</show_in_store>
20
-
21
  <groups>
22
  <config translate="label">
23
- <comment>
24
- <![CDATA[
25
- <div>
26
- <a style="float: left;text-decoration:none;width:100%" href="http://www.moip.com/magento.php" target="_blank" style="float: left;"><img src="https://imagem.o2ti.com/checkout_moip.png" style="float:left;"/><h1 style="float:left;">Moip Carrinho</h1><sup>v2.0.0</sup>
27
- </a>
28
- <div style="float: left; color:#2f3850">
29
- <label style="font-size: 34px">Vers&atilde;o: <strong>Gratuita para uso com o MoIP Transparente</strong></label>
30
- </div>
31
 
32
- <br style="clear: both;"/>
33
 
34
- <p>Essa versão tem o download gratuito desde que utilizem o MoIP Transparente desenvolvido pelo MOIP como o meios de pagamento preferencial em seu site.</p>
35
- <p>Criado por: <a href="http://www.moip.com.br" target="_blank">Moip S/A</a></p>
36
- <hr>
37
- </div>
38
- ]]></comment>
39
  <label>Geral</label>
40
  <frontend_type>text</frontend_type>
41
  <sort_order>1</sort_order>
@@ -43,8 +39,16 @@
43
  <show_in_website>1</show_in_website>
44
  <show_in_store>1</show_in_store>
45
  <fields>
46
-
47
- <default_country translate="label">
 
 
 
 
 
 
 
 
48
  <label>País Padrão</label>
49
  <frontend_type>select</frontend_type>
50
  <source_model>adminhtml/system_config_source_country</source_model>
@@ -62,7 +66,7 @@
62
  <show_in_website>1</show_in_website>
63
  <show_in_store>1</show_in_store>
64
  </enable_buscacep>
65
- <enable_pj translate="label">
66
  <label>Habilitar compra por Pessoa Jurídica?</label>
67
  <frontend_type>select</frontend_type>
68
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -80,7 +84,7 @@
80
  <show_in_website>1</show_in_website>
81
  <show_in_store>1</show_in_store>
82
  </default_paymentmethod>
83
- <allowshippingotheraddress translate="label">
84
  <label>Permitir envio para outro endereço</label>
85
  <frontend_type>select</frontend_type>
86
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -89,7 +93,7 @@
89
  <show_in_website>1</show_in_website>
90
  <show_in_store>1</show_in_store>
91
  </allowshippingotheraddress>
92
- <allowguestcheckout translate="label">
93
  <label>Permitir acesso sem estar logado</label>
94
  <frontend_type>select</frontend_type>
95
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -115,7 +119,7 @@
115
  <show_in_default>1</show_in_default>
116
  <show_in_website>1</show_in_website>
117
  <show_in_store>1</show_in_store>
118
- <comment>Deixe marcado como SIM para criar conta obrigatoriamente.</comment>
119
  </create_account>
120
  <disable_shop_cart translate="label">
121
  <label>Redirecionar botão comprar direto para o checkout</label>
@@ -126,10 +130,9 @@
126
  <show_in_website>1</show_in_website>
127
  <show_in_store>1</show_in_store>
128
  </disable_shop_cart>
129
-
130
  </fields>
131
  </config>
132
- <layout translate="label">
133
  <label>Layout do Checkout</label>
134
  <frontend_type>text</frontend_type>
135
  <sort_order>2</sort_order>
@@ -137,40 +140,71 @@
137
  <show_in_website>1</show_in_website>
138
  <show_in_store>1</show_in_store>
139
  <fields>
140
- <page_titulo translate="label">
141
- <label>Titulo da Página - Head da Página</label>
142
- <frontend_type>text</frontend_type>
143
- <sort_order>1</sort_order>
144
- <show_in_default>1</show_in_default>
145
- <show_in_website>1</show_in_website>
146
- <show_in_store>1</show_in_store>
147
- <comment>Título da página</comment>
148
- </page_titulo>
149
  <page_layout translate="label">
150
  <label>Layout do Checkout</label>
151
  <frontend_type>select</frontend_type>
152
  <source_model>onestepcheckout/system_config_source_pagelayout</source_model>
153
- <sort_order>2</sort_order>
154
  <show_in_default>1</show_in_default>
155
  <show_in_website>1</show_in_website>
156
  <show_in_store>1</show_in_store>
157
  <comment>Formato da página</comment>
158
  </page_layout>
159
- <site_response>
160
- <label>Seu Site é Responsivo?</label>
161
  <frontend_type>select</frontend_type>
162
  <source_model>adminhtml/system_config_source_yesno</source_model>
163
- <sort_order>3</sort_order>
164
  <show_in_default>1</show_in_default>
165
  <show_in_website>1</show_in_website>
166
  <show_in_store>1</show_in_store>
167
- <comment>Se o site é responsivel coloque sim, isto corrigirá o layout de nosso modulo.</comment>
168
- </site_response>
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  <style_cor translate="label">
171
  <label>Cor do Checkout</label>
172
  <frontend_type>text</frontend_type>
173
- <sort_order>4</sort_order>
174
  <show_in_default>1</show_in_default>
175
  <show_in_website>1</show_in_website>
176
  <show_in_store>1</show_in_store>
@@ -179,29 +213,27 @@
179
  <botao_cor translate="label">
180
  <label>Cor dos Botões</label>
181
  <frontend_type>text</frontend_type>
182
- <sort_order>5</sort_order>
183
  <show_in_default>1</show_in_default>
184
  <show_in_website>1</show_in_website>
185
  <show_in_store>1</show_in_store>
186
  <comment>Default dos Cor dos Botões: 000. Não usar o "#", apenas o número.</comment>
187
  </botao_cor>
188
-
189
-
190
  <allowremoveproduct translate="label">
191
  <label>Permitir remover produto</label>
192
  <frontend_type>select</frontend_type>
193
  <source_model>adminhtml/system_config_source_yesno</source_model>
194
- <sort_order>17</sort_order>
195
  <show_in_default>1</show_in_default>
196
  <show_in_website>1</show_in_website>
197
  <show_in_store>1</show_in_store>
198
  </allowremoveproduct>
199
-
200
  <enable_quicklogin translate="label">
201
  <label>Habilitar login por ajax?</label>
202
  <frontend_type>select</frontend_type>
203
  <source_model>adminhtml/system_config_source_yesno</source_model>
204
- <sort_order>14</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
  <show_in_store>1</show_in_store>
@@ -216,7 +248,6 @@
216
  <show_in_website>1</show_in_website>
217
  <show_in_store>1</show_in_store>
218
  <fields>
219
-
220
  <street_lines translate="label comment">
221
  <label>Número de linhas do endereço </label>
222
  <sort_order>2</sort_order>
@@ -226,7 +257,6 @@
226
  <backend_model>adminhtml/system_config_backend_customer_address_street</backend_model>
227
  <comment>Obrigatóriamente 4</comment>
228
  </street_lines>
229
-
230
  <enable_messagetosystem translate="label">
231
  <label>Comentários nos pedidos</label>
232
  <frontend_type>select</frontend_type>
@@ -237,7 +267,6 @@
237
  <show_in_store>1</show_in_store>
238
  <comment>Usado pelo cliente para comentar o pedido</comment>
239
  </enable_messagetosystem>
240
-
241
  <allowcoupon translate="label">
242
  <label>Coupom de desconto</label>
243
  <frontend_type>select</frontend_type>
@@ -277,7 +306,7 @@
277
  </usenews>
278
  </fields>
279
  </addfield>
280
- <modaluse translate="label">
281
  <label>Box Modal</label>
282
  <frontend_type>text</frontend_type>
283
  <sort_order>6</sort_order>
@@ -285,7 +314,7 @@
285
  <show_in_website>1</show_in_website>
286
  <show_in_store>1</show_in_store>
287
  <fields>
288
- <termos translate="label">
289
  <label>Habilitar Modal de termos e condições</label>
290
  <frontend_type>select</frontend_type>
291
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -322,7 +351,7 @@
322
  <depends>
323
  <use_secure>1</use_secure>
324
  </depends>
325
- <frontend_type>editor</frontend_type>
326
  <frontend_model>onestepcheckout/adminhtml_system_config_editor</frontend_model>
327
  <sort_order>8</sort_order>
328
  <show_in_default>1</show_in_default>
@@ -332,8 +361,7 @@
332
  </secure>
333
  </fields>
334
  </modaluse>
335
-
336
  </groups>
337
  </onestepcheckout>
338
  </sections>
339
- </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <tabs>
 
4
  <moip translate="label" module="onestepcheckout">
5
  <label>MOIP.COM.BR</label>
6
  <sort_order>100</sort_order>
7
  </moip>
8
  </tabs>
 
9
  <sections>
10
  <onestepcheckout translate="label" module="onestepcheckout">
11
+ <label><![CDATA[ <div style="height: 33px; "><img src="http://imagem.o2ti.com/checkout_moip.png" style="float:left; "/><div style="padding-top:8px;color:#2f3850;margin-left: 30px;"> Moip Carrinho<sup style="float: right;">API V2</sup></div></div>]]></label>
12
  <tab>moip</tab>
13
  <frontend_type>text</frontend_type>
14
  <sort_order>100</sort_order>
15
  <show_in_default>1</show_in_default>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
 
18
  <groups>
19
  <config translate="label">
20
+ <comment><![CDATA[
21
+ <div>
22
+ <a style="float: left;text-decoration:none;width:100%" href="http://www.moip.com/magento.php" target="_blank" style="float: left;"><img src="https://imagem.o2ti.com/checkout_moip.png" style="float:left;"/><h1 style="float:left;">Moip Carrinho</h1><sup>API V2</sup>
23
+ </a>
24
+ <div style="float: left; color:#2f3850">
25
+ <label style="font-size: 34px">Vers&atilde;o: <strong>Gratuita para uso com o MoIP Transparente</strong></label>
26
+ </div>
 
27
 
28
+ <br style="clear: both;"/>
29
 
30
+ <p>Essa versão tem o download e uso gratuito desde que utilizem o Moip Transparente como o método de pagamento preferencial em seu site.</p>
31
+ <p>Criado por: <a href="solucoes.moip.com.br/magento" target="_blank">Moip S/A</a></p>
32
+ <hr>
33
+ </div>
34
+ ]]></comment>
35
  <label>Geral</label>
36
  <frontend_type>text</frontend_type>
37
  <sort_order>1</sort_order>
39
  <show_in_website>1</show_in_website>
40
  <show_in_store>1</show_in_store>
41
  <fields>
42
+ <enabled translate="label">
43
+ <label>Habilitar Checkout:</label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_yesno</source_model>
46
+ <sort_order>1</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </enabled>
51
+ <default_country translate="label">
52
  <label>País Padrão</label>
53
  <frontend_type>select</frontend_type>
54
  <source_model>adminhtml/system_config_source_country</source_model>
66
  <show_in_website>1</show_in_website>
67
  <show_in_store>1</show_in_store>
68
  </enable_buscacep>
69
+ <enable_pj translate="label">
70
  <label>Habilitar compra por Pessoa Jurídica?</label>
71
  <frontend_type>select</frontend_type>
72
  <source_model>adminhtml/system_config_source_yesno</source_model>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>1</show_in_store>
86
  </default_paymentmethod>
87
+ <allowshippingotheraddress translate="label">
88
  <label>Permitir envio para outro endereço</label>
89
  <frontend_type>select</frontend_type>
90
  <source_model>adminhtml/system_config_source_yesno</source_model>
93
  <show_in_website>1</show_in_website>
94
  <show_in_store>1</show_in_store>
95
  </allowshippingotheraddress>
96
+ <allowguestcheckout translate="label">
97
  <label>Permitir acesso sem estar logado</label>
98
  <frontend_type>select</frontend_type>
99
  <source_model>adminhtml/system_config_source_yesno</source_model>
119
  <show_in_default>1</show_in_default>
120
  <show_in_website>1</show_in_website>
121
  <show_in_store>1</show_in_store>
122
+ <comment>Deixe marcado como SIM para criar conta obrigatoriamente.</comment>
123
  </create_account>
124
  <disable_shop_cart translate="label">
125
  <label>Redirecionar botão comprar direto para o checkout</label>
130
  <show_in_website>1</show_in_website>
131
  <show_in_store>1</show_in_store>
132
  </disable_shop_cart>
 
133
  </fields>
134
  </config>
135
+ <layout translate="label">
136
  <label>Layout do Checkout</label>
137
  <frontend_type>text</frontend_type>
138
  <sort_order>2</sort_order>
140
  <show_in_website>1</show_in_website>
141
  <show_in_store>1</show_in_store>
142
  <fields>
 
 
 
 
 
 
 
 
 
143
  <page_layout translate="label">
144
  <label>Layout do Checkout</label>
145
  <frontend_type>select</frontend_type>
146
  <source_model>onestepcheckout/system_config_source_pagelayout</source_model>
147
+ <sort_order>0</sort_order>
148
  <show_in_default>1</show_in_default>
149
  <show_in_website>1</show_in_website>
150
  <show_in_store>1</show_in_store>
151
  <comment>Formato da página</comment>
152
  </page_layout>
153
+ <use_pre_cadastro translate="label">
154
+ <label>Usar Pré-Cadastro</label>
155
  <frontend_type>select</frontend_type>
156
  <source_model>adminhtml/system_config_source_yesno</source_model>
157
+ <sort_order>1</sort_order>
158
  <show_in_default>1</show_in_default>
159
  <show_in_website>1</show_in_website>
160
  <show_in_store>1</show_in_store>
161
+ </use_pre_cadastro>
 
162
 
163
+ <use_linha_suporte translate="label">
164
+ <label>Usar Linha com Suporte no header</label>
165
+ <frontend_type>select</frontend_type>
166
+ <source_model>adminhtml/system_config_source_yesno</source_model>
167
+ <sort_order>2</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </use_linha_suporte>
172
+ <content_linha_suporte>
173
+ <label>Conteúdo linha de suporte</label>
174
+ <depends>
175
+ <use_linha_suporte>1</use_linha_suporte>
176
+ </depends>
177
+ <frontend_type>editor</frontend_type>
178
+ <frontend_model>onestepcheckout/adminhtml_system_config_editor</frontend_model>
179
+ <validate>required-entry</validate>
180
+ <sort_order>3</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ <comment>Insira sua linha de contatos para suporte</comment>
185
+ </content_linha_suporte>
186
+ <style_cor_background translate="label">
187
+ <label>Cor do Background</label>
188
+ <frontend_type>text</frontend_type>
189
+ <sort_order>5</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <show_in_store>1</show_in_store>
193
+ <comment>Default do checkout: 000. Não usar o "#", apenas o número.</comment>
194
+ </style_cor_background>
195
+ <style_cor_header translate="label">
196
+ <label>Cor do Header</label>
197
+ <frontend_type>text</frontend_type>
198
+ <sort_order>6</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>1</show_in_store>
202
+ <comment>Default do checkout: 000. Não usar o "#", apenas o número.</comment>
203
+ </style_cor_header>
204
  <style_cor translate="label">
205
  <label>Cor do Checkout</label>
206
  <frontend_type>text</frontend_type>
207
+ <sort_order>7</sort_order>
208
  <show_in_default>1</show_in_default>
209
  <show_in_website>1</show_in_website>
210
  <show_in_store>1</show_in_store>
213
  <botao_cor translate="label">
214
  <label>Cor dos Botões</label>
215
  <frontend_type>text</frontend_type>
216
+ <sort_order>8</sort_order>
217
  <show_in_default>1</show_in_default>
218
  <show_in_website>1</show_in_website>
219
  <show_in_store>1</show_in_store>
220
  <comment>Default dos Cor dos Botões: 000. Não usar o "#", apenas o número.</comment>
221
  </botao_cor>
222
+
 
223
  <allowremoveproduct translate="label">
224
  <label>Permitir remover produto</label>
225
  <frontend_type>select</frontend_type>
226
  <source_model>adminhtml/system_config_source_yesno</source_model>
227
+ <sort_order>10</sort_order>
228
  <show_in_default>1</show_in_default>
229
  <show_in_website>1</show_in_website>
230
  <show_in_store>1</show_in_store>
231
  </allowremoveproduct>
 
232
  <enable_quicklogin translate="label">
233
  <label>Habilitar login por ajax?</label>
234
  <frontend_type>select</frontend_type>
235
  <source_model>adminhtml/system_config_source_yesno</source_model>
236
+ <sort_order>11</sort_order>
237
  <show_in_default>1</show_in_default>
238
  <show_in_website>1</show_in_website>
239
  <show_in_store>1</show_in_store>
248
  <show_in_website>1</show_in_website>
249
  <show_in_store>1</show_in_store>
250
  <fields>
 
251
  <street_lines translate="label comment">
252
  <label>Número de linhas do endereço </label>
253
  <sort_order>2</sort_order>
257
  <backend_model>adminhtml/system_config_backend_customer_address_street</backend_model>
258
  <comment>Obrigatóriamente 4</comment>
259
  </street_lines>
 
260
  <enable_messagetosystem translate="label">
261
  <label>Comentários nos pedidos</label>
262
  <frontend_type>select</frontend_type>
267
  <show_in_store>1</show_in_store>
268
  <comment>Usado pelo cliente para comentar o pedido</comment>
269
  </enable_messagetosystem>
 
270
  <allowcoupon translate="label">
271
  <label>Coupom de desconto</label>
272
  <frontend_type>select</frontend_type>
306
  </usenews>
307
  </fields>
308
  </addfield>
309
+ <modaluse translate="label">
310
  <label>Box Modal</label>
311
  <frontend_type>text</frontend_type>
312
  <sort_order>6</sort_order>
314
  <show_in_website>1</show_in_website>
315
  <show_in_store>1</show_in_store>
316
  <fields>
317
+ <termos translate="label">
318
  <label>Habilitar Modal de termos e condições</label>
319
  <frontend_type>select</frontend_type>
320
  <source_model>adminhtml/system_config_source_yesno</source_model>
351
  <depends>
352
  <use_secure>1</use_secure>
353
  </depends>
354
+ <frontend_type>editor</frontend_type>
355
  <frontend_model>onestepcheckout/adminhtml_system_config_editor</frontend_model>
356
  <sort_order>8</sort_order>
357
  <show_in_default>1</show_in_default>
361
  </secure>
362
  </fields>
363
  </modaluse>
 
364
  </groups>
365
  </onestepcheckout>
366
  </sections>
367
+ </config>
app/code/local/MOIP/Transparente/Block/Adminhtml/Info/Boleto.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Info_Boleto extends Mage_Payment_Block_Info
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('MOIP/transparente/info/boleto.phtml');
9
+ }
10
+
11
+
12
+ public function getMethodInstance()
13
+ {
14
+ if (!$this->hasMethodInstance()) {
15
+ if ($this->getMethod()) {
16
+ $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
17
+ if ($instance) {
18
+ $instance->setInfoInstance($this);
19
+ $this->setMethodInstance($instance);
20
+ return $instance;
21
+ }
22
+ }
23
+ Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
24
+ }
25
+
26
+ return $this->_getData('method_instance');
27
+ }
28
+
29
+
30
+ }
app/code/local/MOIP/Transparente/Block/Adminhtml/Info/Cc.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Info_Cc extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('MOIP/transparente/info/cc.phtml');
8
+ }
9
+
10
+ }
app/code/local/MOIP/Transparente/Block/Adminhtml/Info/Tef.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Info_Tef extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('MOIP/transparente/info/tef.phtml');
8
+ }
9
+
10
+ }
app/code/local/MOIP/Transparente/Block/Adminhtml/Sales/Order/Create/Totals/Fee.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Adminhtml_Sales_Order_Create_Totals_Fee extends Mage_Adminhtml_Block_Sales_Order_Create_Totals_Default
3
+ {
4
+ #protected $_template = 'MOIP/transparente/sales/order/create/totals/fee.phtml';
5
+ }
6
+ ?>
app/code/local/MOIP/Transparente/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Header.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Adminhtml_System_Config_Form_Fieldset_Modules_Header
4
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+ /**
7
+ * Render element html
8
+ *
9
+ * @param Varien_Data_Form_Element_Abstract $element
10
+ * @return string
11
+ */
12
+ public function render(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ $useContainerId = $element->getData('use_container_id');
15
+ return sprintf(
16
+ '<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5" style="max-width:580px;"><h4 id="%s">%s</h4><p class="subheading-note" style="font-size:11px;font-style:italic;color:#666;"><span>%s</span></p></td></tr>',
17
+ $element->getHtmlId(), $element->getHtmlId(), $element->getLabel(), $element->getComment()
18
+ );
19
+
20
+
21
+ }
22
+ }
app/code/local/MOIP/Transparente/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Oauth.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Adminhtml_System_Config_Form_Fieldset_Modules_Oauth extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ /**
6
+ * Return header html for fieldset
7
+ *
8
+ * @param Varien_Data_Form_Element_Abstract $element
9
+ * @return string
10
+ */
11
+ protected function _getHeaderHtml($element)
12
+ {
13
+ $validacao = Mage::getSingleton('transparente/standard')->getConfigData('validador_retorno');
14
+
15
+ $code = Mage::getSingleton('adminhtml/config_data')->getStore();
16
+
17
+
18
+ if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore()))
19
+ {
20
+ $store_id = Mage::getModel('core/store')->load($code)->getId();
21
+ } elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) {
22
+ $website_id = Mage::getModel('core/website')->load($code)->getId();
23
+ $store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
24
+ } else {
25
+ $store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
26
+ }
27
+ if($code == ""){
28
+ $code = "default";
29
+ }
30
+
31
+ $redirectUri = Mage::getUrl('Transparente/standard/Oauth/'.'validacao/'.$validacao.'/store_scope/'.$code.'/store_id/'.$store_id); // Esse é um controle para get da autorização...
32
+ $redirectUri = urlencode($redirectUri);
33
+ $redirectUri = "http://moip.o2ti.com/magento/redirect/?client_id=".$redirectUri; //Aqui voce pode construir sua url URI no entanto precisa estar exatamente como indicado no app construido...
34
+ $responseType = "CODE";
35
+ $scope = "CREATE_ORDERS|VIEW_ORDERS|CREATE_PAYMENTS|VIEW_PAYMENTS";
36
+ $webhooks_url = Mage::getUrl('Transparente/standard/EnableWebhooks/validacao/'.$validacao.'/');
37
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
38
+
39
+ $app_id_moip_dev = "APP-9MUFQ39Y4CQU"; //Alterar aqui caso necessário.
40
+
41
+ $endpoint_moip = "https://sandbox.moip.com.br/oauth/authorize";
42
+ $set_url_btn = $endpoint_moip.'?responseType='.$responseType.'&appId='.$app_id_moip_dev.'&redirectUri='.$redirectUri.'&scope='.$scope;
43
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_dev');
44
+ $webhooks_return = Mage::getSingleton('transparente/standard')->getConfigData('webhook_key_dev');
45
+
46
+ if(!is_null($oauth) || isset($oauth)) {
47
+
48
+
49
+ $text_logar_se .= "<h2>Sua loja está autorizada a realizar vendas no ambiente:</h2> <p> Teste - Não processa compras reais.</p><hr/>";
50
+ if(!$webhooks_return || is_null($webhooks_return)){
51
+ $text_logar_se .= "<h2>Para configurar o retorno da transação acesse:</h2> <p> <a href='{$webhooks_url}''>Clique aqui</a> para configurar o retorno de status da transação </p>";
52
+ } else {
53
+ $text_logar_se .= "Registro do MOIP: ".$webhooks_return;
54
+ }
55
+
56
+
57
+
58
+ } else {
59
+
60
+ $set_url_btn = $endpoint_moip.'?responseType='.$responseType.'&appId='.$app_id_moip_dev.'&redirectUri='.$redirectUri.'&scope='.$scope;
61
+ $criar_conta = 'Para criar uma conta de teste acesse <a href="https://labs.moip.com.br/login/">clique aqui</a>';
62
+ $btn = '<p><a href="'.$set_url_btn.'"><img src="' . $this->getSkinUrl('MOIP/transparente/imagem/btn-login-moip.png') . '" alt="Botão Login Moip" /></a></p><p>'.$criar_conta.'</p>';
63
+ $text_logar_se .= "<p>2º - Passo - Para Realizar Transações no ambiente de Sandbox (ambiente para testes), por favor autorize o aplicativo:</p>".$btn;
64
+
65
+
66
+ }
67
+
68
+
69
+ } else {
70
+
71
+ $app_id_moip_prod = "APP-AKYBMMVU1FL1";
72
+ $endpoint_moip = "https://api.moip.com.br/oauth/authorize";
73
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod');
74
+ $webhooks_return = Mage::getSingleton('transparente/standard')->getConfigData('webhook_key_prod');
75
+
76
+ if(!is_null($oauth) || isset($oauth)) {
77
+
78
+ $text_logar_se = "<h2>Sua loja está autorizada a para realizar vendas no ambiente:</h2> <p>Produção</p><hr/>";
79
+ if(!$webhooks_return || is_null($webhooks_return)){
80
+ $text_logar_se .= "<h2>Para configurar o retorno da transação acesse:</h2> <p> <a href='{$webhooks_url}''>Clique aqui</a> para configurar o retorno de status da transação </p>";
81
+ } else {
82
+ $text_logar_se .= "Registro do MOIP: ".$webhooks_return;
83
+ }
84
+
85
+ } else {
86
+
87
+ $set_url_btn = $endpoint_moip.'?responseType='.$responseType.'&appId='.$app_id_moip_prod.'&redirectUri='.$redirectUri.'&scope='.$scope;
88
+ $criar_conta = 'Para criar uma conta no Moip acesse <a href="https://www.moip.com.br/login/">clique aqui</a>';
89
+ $btn = '<p><a href="'.$set_url_btn.'"><img src="' . $this->getSkinUrl('MOIP/transparente/imagem/btn-login-moip.png') . '" alt="Botão Login Moip" /></a></p><p>'.$criar_conta.'</p>';
90
+ $text_logar_se = "<h2>Para Realizar Transações no ambiente de Desenvolvimento (ambiente para produção, compras reais), por favor autorize o aplicativo:</h2>".$btn;
91
+
92
+
93
+ }
94
+ }
95
+
96
+
97
+ if($validacao){
98
+ $info_config = $text_logar_se;
99
+ }else {
100
+ $info_config = '<h2>Vamos Configurar a sua conta?</h2><p>1º - Passo - Insira no campo a baixo "Validação de comunicação" para continuar a sua instalação e clique em Salvar Configuração.</p>';
101
+ }
102
+ $html = parent::_getHeaderHtml($element);
103
+ $html = $html.$info_config;
104
+ return $html;
105
+ }
106
+ }
107
+ ?>
app/code/local/MOIP/Transparente/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Reset.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Adminhtml_System_Config_Form_Fieldset_Modules_Reset extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ /**
6
+ * Return header html for fieldset
7
+ *
8
+ * @param Varien_Data_Form_Element_Abstract $element
9
+ * @return string
10
+ */
11
+ protected function _getHeaderHtml($element)
12
+ {
13
+ $info_config = null;
14
+ $validacao = Mage::getSingleton('transparente/standard')->getConfigData('validador_retorno');
15
+
16
+ $code = Mage::getSingleton('adminhtml/config_data')->getStore();
17
+
18
+
19
+
20
+ $info_config .= '<p>Caso necessário você pode Apagar Todos os dados das configurações Moip para os ambientes.</p>';
21
+
22
+ $info_config .= '<hr><h3>Seus dados Atuais são:</h3>';
23
+
24
+ $oauth_dev = Mage::getSingleton('transparente/standard')->getConfigData('oauth_dev');
25
+ $publickey_dev= Mage::getSingleton('transparente/standard')->getConfigData('publickey_dev');
26
+
27
+
28
+
29
+ if(!is_null($oauth_dev)) {
30
+
31
+ $info_config .= '<tr id="row_moipall_advanced_rest">
32
+ <td class="label">
33
+ <label for="row_moipall_advanced_rest"> Seu Token Oauth - Ambiente de Teste:</label>
34
+ </td>
35
+ <td class="value">
36
+ <input readonly value="'.$oauth_dev.'" type="text" class="input-text" >
37
+ </td>
38
+ </tr>';
39
+
40
+ $info_config .= '<tr id="row_moipall_advanced_rest"> <td class="label"> <label for="row_moipall_advanced_rest"> Sua Public Key - Ambiente de Testes</label> </td> <td class="value"> <textarea id="row_moipall_advanced_rest" class=" textarea" rows="2" cols="15" readonly>'.$publickey_dev.'</textarea> </td></tr>';
41
+
42
+ } else {
43
+
44
+
45
+ $info_config .= "<p>O Ambiente de Teste não está configurado</p>";
46
+
47
+ }
48
+
49
+
50
+
51
+
52
+ $oauth_prod = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod');
53
+ $publickey_prod = Mage::getSingleton('transparente/standard')->getConfigData('publickey_prod');
54
+
55
+ if(!is_null($oauth_prod)) {
56
+
57
+
58
+ $info_config .= '<tr id="row_moipall_advanced_rest">
59
+ <td class="label">
60
+ <label for="row_moipall_advanced_rest"> Seu Token Oauth - Ambiente de Produção:</label>
61
+ </td>
62
+ <td class="value">
63
+ <input readonly value="'.$oauth_prod.'" type="text" class="input-text" >
64
+ </td>
65
+ </tr>';
66
+
67
+ $info_config .= '<tr id="row_moipall_advanced_rest"> <td class="label"> <label for="row_moipall_advanced_rest"> Sua Public Key - Ambiente de Produção</label> </td> <td class="value"> <textarea id="row_moipall_advanced_rest" class=" textarea" rows="2" cols="15" readonly>'.$publickey_prod.'</textarea> </td></tr>';
68
+
69
+ } else {
70
+
71
+ $info_config .= "<p>O Ambiente de Produção não está configurado</p>";
72
+
73
+ }
74
+
75
+
76
+ $html = parent::_getHeaderHtml($element);
77
+ $html = $html.$info_config;
78
+ return $html;
79
+ }
80
+ }
81
+ ?>
app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Boleto.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Info_Boleto extends Mage_Payment_Block_Info
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('MOIP/transparente/info/boleto.phtml');
9
+ }
10
+
11
+ protected function _prepareInfo()
12
+ {
13
+
14
+
15
+ $order = $this->getInfo()->getOrder();
16
+
17
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
18
+ $order = $order->getId();
19
+
20
+ $model = Mage::getModel('transparente/write');
21
+ $result = $model->load($order, 'mage_pay')->getData();
22
+
23
+ return $result;
24
+ }
25
+ public function getMethodInstance()
26
+ {
27
+ if (!$this->hasMethodInstance()) {
28
+ if ($this->getMethod()) {
29
+ $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
30
+ if ($instance) {
31
+ $instance->setInfoInstance($this);
32
+ $this->setMethodInstance($instance);
33
+ return $instance;
34
+ }
35
+ }
36
+ Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
37
+ }
38
+
39
+ return $this->_getData('method_instance');
40
+ }
41
+
42
+
43
+ }
app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Cc.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Info_Cc extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('MOIP/transparente/info/cc.phtml');
8
+ }
9
+ protected function _prepareInfo()
10
+ {
11
+
12
+
13
+ $order = $this->getInfo()->getOrder();
14
+
15
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
16
+ $order = $order->getId();
17
+
18
+ $model = Mage::getModel('transparente/write');
19
+ $result = $model->load($order, 'mage_pay')->getData();
20
+
21
+ return $result;
22
+ }
23
+ }
app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Customermessages.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- class MOIP_Onestepcheckout_Block_Adminhtml_Onestepcheckout_Sales_Order_View_Tab_Info_Customermessages extends Mage_Adminhtml_Block_Sales_Order_Abstract
3
- {
4
- public function _prepareLayout()
5
- {
6
- return parent::_prepareLayout();
7
- }
8
-
9
- }
 
 
 
 
 
 
 
 
 
app/code/local/MOIP/Transparente/Block/Adminhtml/moip/Info/Tef.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Info_Tef extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('MOIP/transparente/info/tef.phtml');
8
+ }
9
+ protected function _prepareInfo()
10
+ {
11
+ $order = $this->getInfo()->getOrder();
12
+
13
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
14
+ $order = $order->getId();
15
+
16
+ $model = Mage::getModel('transparente/write');
17
+ $result = $model->load($order, 'mage_pay')->getData();
18
+
19
+ return $result;
20
+ }
21
+ }
app/code/local/MOIP/Transparente/Block/Checkout/Totals/Fee.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Checkout_Totals_Fee extends Mage_Checkout_Block_Total_Default
4
+ {
5
+
6
+ }
app/code/local/MOIP/Transparente/Block/Form/Admin.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ class MOIP_Transparente_Block_Form_Admin extends Mage_Payment_Block_Form {
14
+
15
+ protected function _construct() {
16
+ $this->setTemplate('MOIP/transparente/form/admin.phtml');
17
+ parent::_construct();
18
+ }
19
+
20
+
21
+
22
+
23
+
24
+ }
app/code/local/MOIP/Transparente/Block/Form/Boleto.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ class MOIP_Transparente_Block_Form_Boleto extends Mage_Payment_Block_Form {
14
+
15
+ protected function _construct() {
16
+ $this->setTemplate('MOIP/transparente/form/boleto.phtml');
17
+ parent::_construct();
18
+ }
19
+
20
+
21
+ public function mostraBoleto() {
22
+ if (strpos(Mage::getSingleton('transparente/standard')->getConfigData('formas_pagamento'), "BoletoBancario") !== false) {
23
+ return true;
24
+ }else {
25
+ return false;
26
+ }
27
+ }
28
+
29
+ public function getBoletoIcon() {
30
+ if (Mage::getStoreConfig('moipall/config/trocar_icone')) {
31
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/icone_boleto');
32
+ }else {
33
+ return $this->getSkinUrl('MOIP/transparente/imagem/ababoleto.png');
34
+ }
35
+ }
36
+
37
+ //imagem do boleto
38
+ public function getBoletoImage() {
39
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
40
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/boleto');
41
+ }else {
42
+ return $this->getSkinUrl('MOIP/transparente/imagem/Bradesco.png');
43
+ }
44
+ }
45
+
46
+
47
+ public function getCheckout() {
48
+ return Mage::getSingleton('checkout/session');
49
+ }
50
+
51
+ public function getGrandTotal(){
52
+ #var_dump(Mage::getSingleton('checkout/session')->getQuote()->getData());
53
+ return Mage::helper('core')->currency(Mage::getSingleton('checkout/session')->getQuote()->getData('grand_total'), true, false);
54
+ }
55
+ public function getQuote() {
56
+ return $this->getCheckout()->getQuote();
57
+ }
58
+
59
+
60
+ public function getOnepage() {
61
+ return (string)Mage::getSingleton('checkout/type_onepage');
62
+ }
63
+
64
+
65
+ }
app/code/local/MOIP/Transparente/Block/Form/Cc.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ class MOIP_Transparente_Block_Form_Cc extends Mage_Payment_Block_Form {
14
+
15
+ protected function _construct() {
16
+ $this->setTemplate('MOIP/transparente/form/cc.phtml');
17
+ parent::_construct();
18
+ }
19
+
20
+
21
+
22
+ public function getPublicKey(){
23
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
24
+ return Mage::getSingleton('transparente/standard')->getConfigData('publickey_dev');
25
+ } else {
26
+ return Mage::getSingleton('transparente/standard')->getConfigData('publickey_prod');
27
+ }
28
+ }
29
+
30
+
31
+ public function mostraCartao() {
32
+ if (strpos(Mage::getSingleton('transparente/standard')->getConfigData('formas_pagamento'), "CartaoCredito") !== false) {
33
+ return true;
34
+ }else {
35
+ return false;
36
+ }
37
+ }
38
+
39
+
40
+
41
+ public function getCartaoIcon() {
42
+ if (Mage::getStoreConfig('moipall/config/trocar_icone')) {
43
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/icone_cartao');
44
+ }else {
45
+ return $this->getSkinUrl('MOIP/transparente/imagem/abacartao.png');
46
+ }
47
+ }
48
+
49
+ //confs de parcelamento
50
+ public function getParcelamentoSelect() {
51
+
52
+ $api = Mage::getSingleton('transparente/api');
53
+ $parcelamento = $api->getParcelamento();
54
+
55
+
56
+ foreach ($parcelamento as $key => $value) {
57
+
58
+ if($key > 1){
59
+ $juros = $value['juros'];
60
+ $parcelas_result = $value['parcela'];
61
+ $total_parcelado = $value['total_parcelado'];
62
+ if($juros > 0)
63
+ $asterisco = '*';
64
+ else
65
+ $asterisco = ' sem juros';
66
+ $parcelas[]= '<option value="'.$key.'">'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.$asterisco.'</option>';
67
+ #$parcelas[]= '<li><input type="radio" name="payment[credito_parcelamento]" title="Selecione as Parcelas" id="credito_parcelamento" class="input-radio validate-one-required-by-name" value="'.$key.'"><label>'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</label></li>';
68
+ }
69
+ else if ($key == 0) {
70
+ $parcelas[]= '<option value="1">À vista no total de sem juros</option>';
71
+ }
72
+ }
73
+
74
+
75
+ return $parcelas;
76
+
77
+ }
78
+ public function getVisaImage() {
79
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
80
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_visa');
81
+ }else {
82
+ return $this->getSkinUrl('MOIP/transparente/imagem/Visa.png');
83
+ }
84
+ }
85
+ public function getMastercardImage() {
86
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
87
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_master');
88
+ }else {
89
+ return $this->getSkinUrl('MOIP/transparente/imagem/Mastercard.png');
90
+ }
91
+ }
92
+ public function getDinersImage() {
93
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
94
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_diners');
95
+ }else {
96
+ return $this->getSkinUrl('MOIP/transparente/imagem/Diners.png');
97
+ }
98
+ }
99
+ public function getAmericanExpressImage() {
100
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
101
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_american');
102
+ }else {
103
+ return $this->getSkinUrl('MOIP/transparente/imagem/AmericanExpress.png');
104
+ }
105
+ }
106
+ public function getHipercardImage() {
107
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
108
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hipercard');
109
+ }else {
110
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hipercard.png');
111
+ }
112
+ }
113
+
114
+ public function getHiperImage() {
115
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
116
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hiper');
117
+ }else {
118
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hiper.png');
119
+ }
120
+ }
121
+
122
+ public function getEloImage() {
123
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
124
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_elo');
125
+ }else {
126
+ return $this->getSkinUrl('MOIP/transparente/imagem/Elo.png');
127
+ }
128
+ }
129
+
130
+ public function imageCofre($brand){
131
+ if($brand == "VISA"){
132
+ $image_brand = $this->getVisaImage();
133
+ } elseif ($brand == "MASTERCARD") {
134
+ $image_brand = $this->getMastercardImage();
135
+ } elseif ($brand == "AMERICANEXPRESS") {
136
+ $image_brand = $this->getAmericanExpressImage();
137
+ } elseif ($brand == "DINERS") {
138
+ $image_brand = $this->getDinersImage();
139
+ } elseif ($brand == "HIPPERCARD") {
140
+ $image_brand = $this->getHipercardImage();
141
+ } elseif ($brand == "HIPER") {
142
+ $image_brand = $this->getHiperImage();
143
+ } elseif ($brand == "ELO") {
144
+ $image_brand = $this->getEloImage();
145
+ } else {
146
+ $image_brand = "";
147
+ }
148
+ return $image_brand;
149
+ }
150
+ public function getCofre() {
151
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
152
+ $data_array = array();
153
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
154
+ $resource = Mage::getSingleton('core/resource');
155
+
156
+ $readConnection = $resource->getConnection('core_read');
157
+ $table = (string) Mage::getConfig()->getTablePrefix().'moip_transparentev2';
158
+
159
+ $query = 'SELECT * FROM ' . $table .' WHERE customer_id='.$customerData->getID().' AND moip_card_id IS NOT NULL';
160
+ $results = $readConnection->fetchAll($query);
161
+
162
+ if($results){
163
+ return Mage::helper('core')->jsonEncode((object)$results);
164
+ } else {
165
+ return 'false';
166
+ }
167
+
168
+ } else {
169
+ return 'false';
170
+ }
171
+
172
+ }
173
+
174
+ public function getDateCard($select){
175
+ if($this->getQuote()->getBillingAddress()){
176
+ $checkout = $this->getQuote()->getBillingAddress();
177
+ if($select == "name"){
178
+ return $checkout->getFirstname()." ".$checkout->getLastname();
179
+ } elseif($select == "telephone-ddd") {
180
+ return $this->getNumberOrDDD($checkout->getTelephone(), true);
181
+ } elseif($select == "telephone-number") {
182
+ return $this->getNumberOrDDD($checkout->getTelephone(), false);
183
+ } elseif($select =="taxvat"){
184
+ return $this->getQuote()->getCustomer()->getTaxvat();
185
+ } elseif($select == "dob"){
186
+ return $this->getQuote()->getCustomer()->getDob();
187
+ } elseif($select == "dob-day"){
188
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('dd');
189
+ } elseif($select =="dob-month") {
190
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('MM');
191
+ } elseif ($select == "dob-year") {
192
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('Y');
193
+ }
194
+ else{
195
+ return;
196
+ }
197
+ }
198
+ else {
199
+ return;
200
+ }
201
+ }
202
+
203
+ public function getNumberOrDDD($param_telefone, $param_ddd = false) {
204
+
205
+ $cust_ddd = '11';
206
+ $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
207
+ $st = strlen($cust_telephone) - 8;
208
+ if ($st > 0) {
209
+ $cust_ddd = substr($cust_telephone, 0, 2);
210
+ $cust_telephone = substr($cust_telephone, $st, 8);
211
+ }
212
+
213
+ if ($param_ddd === false) {
214
+ $retorno = $cust_telephone;
215
+ } else {
216
+ $retorno = $cust_ddd;
217
+ }
218
+
219
+ return $retorno;
220
+ }
221
+ public function getCheckout() {
222
+ return Mage::getSingleton('checkout/session');
223
+ }
224
+
225
+
226
+ public function getQuote() {
227
+ return $this->getCheckout()->getQuote();
228
+ }
229
+
230
+
231
+ public function getOnepage() {
232
+ return (string)Mage::getSingleton('checkout/type_onepage');
233
+ }
234
+
235
+
236
+ }
app/code/local/MOIP/Transparente/Block/Form/Recurring.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ class MOIP_Transparente_Block_Form_Recurring extends Mage_Payment_Block_Form {
14
+ protected function _construct() {
15
+ parent::_construct();
16
+
17
+ return $this->setTemplate('MOIP/transparente/form/recurring.phtml');
18
+ }
19
+ public function getPublicKey(){
20
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
21
+ return Mage::getSingleton('transparente/standard')->getConfigData('publickey_dev');
22
+ } else {
23
+ return Mage::getSingleton('transparente/standard')->getConfigData('publickey_prod');
24
+ }
25
+ }
26
+
27
+
28
+ public function mostraCartao() {
29
+ if (strpos(Mage::getSingleton('transparente/standard')->getConfigData('formas_pagamento'), "CartaoCredito") !== false) {
30
+ return true;
31
+ }else {
32
+ return false;
33
+ }
34
+ }
35
+
36
+
37
+
38
+ public function getCartaoIcon() {
39
+ if (Mage::getStoreConfig('moipall/config/trocar_icone')) {
40
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/icone_cartao');
41
+ }else {
42
+ return $this->getSkinUrl('MOIP/transparente/imagem/abacartao.png');
43
+ }
44
+ }
45
+
46
+ //confs de parcelamento
47
+ public function getParcelamentoSelect() {
48
+
49
+ $api = Mage::getSingleton('transparente/api');
50
+ $parcelamento = $api->getParcelamento();
51
+
52
+
53
+ foreach ($parcelamento as $key => $value) {
54
+
55
+ if($key > 0){
56
+ $juros = $value['juros'];
57
+ $parcelas_result = $value['parcela'];
58
+ $total_parcelado = $value['total_parcelado'];
59
+
60
+ if($juros > 0)
61
+ $asterisco = '*';
62
+ else
63
+ $asterisco = '';
64
+
65
+ $parcelas[]= '<option value="'.$key.'">'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.$asterisco.'</option>';
66
+ #$parcelas[]= '<li><input type="radio" name="payment[credito_parcelamento]" title="Selecione as Parcelas" id="credito_parcelamento" class="input-radio validate-one-required-by-name" value="'.$key.'"><label>'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</label></li>';
67
+
68
+ }
69
+ }
70
+
71
+
72
+ return $parcelas;
73
+
74
+ }
75
+ public function getVisaImage() {
76
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
77
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_visa');
78
+ }else {
79
+ return $this->getSkinUrl('MOIP/transparente/imagem/Visa.png');
80
+ }
81
+ }
82
+ public function getMastercardImage() {
83
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
84
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_master');
85
+ }else {
86
+ return $this->getSkinUrl('MOIP/transparente/imagem/Mastercard.png');
87
+ }
88
+ }
89
+ public function getDinersImage() {
90
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
91
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_diners');
92
+ }else {
93
+ return $this->getSkinUrl('MOIP/transparente/imagem/Diners.png');
94
+ }
95
+ }
96
+ public function getAmericanExpressImage() {
97
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
98
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_american');
99
+ }else {
100
+ return $this->getSkinUrl('MOIP/transparente/imagem/AmericanExpress.png');
101
+ }
102
+ }
103
+ public function getHipercardImage() {
104
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
105
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hipercard');
106
+ }else {
107
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hipercard.png');
108
+ }
109
+ }
110
+
111
+ public function getHiperImage() {
112
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
113
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hiper');
114
+ }else {
115
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hiper.png');
116
+ }
117
+ }
118
+
119
+ public function getEloImage() {
120
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
121
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_elo');
122
+ }else {
123
+ return $this->getSkinUrl('MOIP/transparente/imagem/Elo.png');
124
+ }
125
+ }
126
+
127
+ public function imageCofre($brand){
128
+ if($brand == "VISA"){
129
+ $image_brand = $this->getVisaImage();
130
+ } elseif ($brand == "MASTERCARD") {
131
+ $image_brand = $this->getMastercardImage();
132
+ } elseif ($brand == "AMERICANEXPRESS") {
133
+ $image_brand = $this->getAmericanExpressImage();
134
+ } elseif ($brand == "DINERS") {
135
+ $image_brand = $this->getDinersImage();
136
+ } elseif ($brand == "HIPPERCARD") {
137
+ $image_brand = $this->getHipercardImage();
138
+ } elseif ($brand == "HIPER") {
139
+ $image_brand = $this->getHiperImage();
140
+ } elseif ($brand == "ELO") {
141
+ $image_brand = $this->getEloImage();
142
+ } else {
143
+ $image_brand = "";
144
+ }
145
+ return $image_brand;
146
+ }
147
+ public function getCofre() {
148
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
149
+ $data_array = array();
150
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
151
+ $resource = Mage::getSingleton('core/resource');
152
+
153
+ $readConnection = $resource->getConnection('core_read');
154
+ $table = (string) Mage::getConfig()->getTablePrefix().'moip_transparentev2';
155
+
156
+ $query = 'SELECT * FROM ' . $table .' WHERE customer_id='.$customerData->getID().' AND moip_card_id IS NOT NULL';
157
+ $results = $readConnection->fetchAll($query);
158
+
159
+ if($results){
160
+ return Mage::helper('core')->jsonEncode((object)$results);
161
+ } else {
162
+ return 'false';
163
+ }
164
+
165
+ } else {
166
+ return 'false';
167
+ }
168
+
169
+ }
170
+
171
+ public function getDateCard($select){
172
+ if($this->getQuote()->getBillingAddress()){
173
+ $checkout = $this->getQuote()->getBillingAddress();
174
+ if($select == "name"){
175
+ return $checkout->getFirstname()." ".$checkout->getLastname();
176
+ } elseif($select == "telephone-ddd") {
177
+ return $this->getNumberOrDDD($checkout->getTelephone(), true);
178
+ } elseif($select == "telephone-number") {
179
+ return $this->getNumberOrDDD($checkout->getTelephone(), false);
180
+ } elseif($select =="taxvat"){
181
+ return $this->getQuote()->getCustomer()->getTaxvat();
182
+ } elseif($select == "dob"){
183
+ return $this->getQuote()->getCustomer()->getDob();
184
+ } elseif($select == "dob-day"){
185
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('dd');
186
+ } elseif($select =="dob-month") {
187
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('MM');
188
+ } elseif ($select == "dob-year") {
189
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('Y');
190
+ }
191
+ else{
192
+ return;
193
+ }
194
+ }
195
+ else {
196
+ return;
197
+ }
198
+ }
199
+
200
+ public function getNumberOrDDD($param_telefone, $param_ddd = false) {
201
+
202
+ $cust_ddd = '11';
203
+ $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
204
+ $st = strlen($cust_telephone) - 8;
205
+ if ($st > 0) {
206
+ $cust_ddd = substr($cust_telephone, 0, 2);
207
+ $cust_telephone = substr($cust_telephone, $st, 8);
208
+ }
209
+
210
+ if ($param_ddd === false) {
211
+ $retorno = $cust_telephone;
212
+ } else {
213
+ $retorno = $cust_ddd;
214
+ }
215
+
216
+ return $retorno;
217
+ }
218
+ public function getCheckout() {
219
+ return Mage::getSingleton('checkout/session');
220
+ }
221
+
222
+
223
+ public function getQuote() {
224
+ return $this->getCheckout()->getQuote();
225
+ }
226
+
227
+
228
+ public function getOnepage() {
229
+ return (string)Mage::getSingleton('checkout/type_onepage');
230
+ }
231
+ }
app/code/local/MOIP/Transparente/Block/Form/Tef.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ class MOIP_Transparente_Block_Form_Tef extends Mage_Payment_Block_Form {
14
+
15
+ protected function _construct() {
16
+ $this->setTemplate('MOIP/transparente/form/tef.phtml');
17
+ parent::_construct();
18
+ }
19
+
20
+
21
+
22
+ public function mostraTransferencia() {
23
+ if (strpos(Mage::getSingleton('transparente/standard')->getConfigData('formas_pagamento'), "DebitoBancario") !== false) {
24
+ return true;
25
+ }else {
26
+ return false;
27
+ }
28
+ }
29
+
30
+ public function getTransferenciaIcon() {
31
+ if (Mage::getStoreConfig('moipall/config/trocar_icone')) {
32
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/icone_transf');
33
+ }else {
34
+ return $this->getSkinUrl('MOIP/transparente/imagem/abatransf.png');
35
+ }
36
+ }
37
+
38
+ //imagens de transferencia
39
+ public function getBBImage() {
40
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
41
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_bb');
42
+ }else {
43
+ return $this->getSkinUrl('MOIP/transparente/imagem/BancoDoBrasil.png');
44
+ }
45
+ }
46
+ public function getBradescoImage() {
47
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
48
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_bradesco');
49
+ }else {
50
+ return $this->getSkinUrl('MOIP/transparente/imagem/Bradesco.png');
51
+ }
52
+ }
53
+ public function getItauImage() {
54
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
55
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_itau');
56
+ }else {
57
+ return $this->getSkinUrl('MOIP/transparente/imagem/Itau.png');
58
+ }
59
+ }
60
+ public function getBanrisulImage() {
61
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
62
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_banrisul');
63
+ }else {
64
+ return $this->getSkinUrl('MOIP/transparente/imagem/Banrisul.png');
65
+ }
66
+ }
67
+
68
+
69
+ public function getCheckout() {
70
+ return Mage::getSingleton('checkout/session');
71
+ }
72
+
73
+
74
+ public function getQuote() {
75
+ return $this->getCheckout()->getQuote();
76
+ }
77
+
78
+
79
+ public function getOnepage() {
80
+ return (string)Mage::getSingleton('checkout/type_onepage');
81
+ }
82
+
83
+
84
+ }
app/code/local/MOIP/Transparente/Block/Info.php DELETED
@@ -1,177 +0,0 @@
1
- <?php
2
-
3
- class MOIP_Transparente_Block_Info extends Mage_Payment_Block_Info
4
- {
5
- protected function _construct()
6
- {
7
- parent::_construct();
8
- $this->setTemplate('MOIP/transparente/info.phtml');
9
- }
10
-
11
-
12
-
13
- public function getTransparente()
14
- {
15
- return Mage::getSingleton('transparente/api');
16
- }
17
-
18
-
19
- public function getBoletoImage() {
20
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
21
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/boleto');
22
- }else {
23
- return $this->getSkinUrl('MOIP/transparente/imagem/Bradesco.png');
24
- }
25
- }
26
-
27
- //imagens de transferencia
28
- public function getBBImage() {
29
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
30
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_bb');
31
- }else {
32
- return $this->getSkinUrl('MOIP/transparente/imagem/BancoDoBrasil.png');
33
- }
34
- }
35
- public function getBradescoImage() {
36
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
37
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_bradesco');
38
- }else {
39
- return $this->getSkinUrl('MOIP/transparente/imagem/Bradesco.png');
40
- }
41
- }
42
- public function getItauImage() {
43
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
44
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_itau');
45
- }else {
46
- return $this->getSkinUrl('MOIP/transparente/imagem/Itau.png');
47
- }
48
- }
49
- public function getBanrisulImage() {
50
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
51
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_banrisul');
52
- }else {
53
- return $this->getSkinUrl('MOIP/transparente/imagem/Banrisul.png');
54
- }
55
- }
56
-
57
- //imagens de cartao
58
- public function getVisaImage() {
59
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
60
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_visa');
61
- }else {
62
- return $this->getSkinUrl('MOIP/transparente/imagem/Visa.png');
63
- }
64
- }
65
- public function getMastercardImage() {
66
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
67
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_master');
68
- }else {
69
- return $this->getSkinUrl('MOIP/transparente/imagem/Mastercard.png');
70
- }
71
- }
72
- public function getDinersImage() {
73
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
74
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_diners');
75
- }else {
76
- return $this->getSkinUrl('MOIP/transparente/imagem/Diners.png');
77
- }
78
- }
79
- public function getAmericanExpressImage() {
80
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
81
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_american');
82
- }else {
83
- return $this->getSkinUrl('MOIP/transparente/imagem/AmericanExpress.png');
84
- }
85
- }
86
- public function getHipercardImage() {
87
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
88
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hipercard');
89
- }else {
90
- return $this->getSkinUrl('MOIP/transparente/imagem/Hipercard.png');
91
- }
92
- }
93
-
94
- public function getImagePg($param){
95
- $nome ="";
96
- switch ($param) {
97
- case "Visa":
98
- $nome = $this->getVisaImage();
99
- break;
100
- case "Mastercard":
101
- $nome = $this->getMastercardImage();
102
- break;
103
- case "AmericanExpress":
104
- $nome = $this->getAmericanExpressImage();
105
- break;
106
- case "Dinners":
107
- $nome = $this->getDinersImage();
108
- break;
109
- case "Hipercard":
110
- $nome = $this->getHipercardImage();
111
- break;
112
- default:
113
- $nome = $param;
114
- break;
115
- }
116
- return $nome;
117
-
118
- }
119
- private function getNomePagamento($param) {
120
- $nome = "";
121
- switch ($param) {
122
- case "BoletoBancario":
123
- $nome = "Boleto Bancário";
124
- break;
125
- case "DebitoBancario":
126
- $nome = "Transferência Bancária";
127
- break;
128
- case "CartaoCredito":
129
- $nome = "Cartão de Crédito";
130
- break;
131
- }
132
- return $nome;
133
- }
134
-
135
- public function toPdf()
136
- {
137
- $this->setTemplate('MOIP/transparente/info/pdf.phtml');
138
- return $this->toHtml();
139
- }
140
-
141
- protected function _prepareInfo()
142
- {
143
-
144
- $order_get = Mage::app()->getRequest()->getParam('order_id');
145
- $order = $this->getInfo()->getOrder();
146
-
147
- $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
148
- $order = $order->getIncrementId();
149
-
150
- $model = Mage::getModel('transparente/write');
151
- $result = $model->load($order, 'realorder_id');
152
- $dados = array();
153
-
154
- if((int)$customer_order->getTipopessoa()!= 1){
155
- $dados['compra_pj'] = 1;
156
- $dados['cnpj'] = $customer_order->getCnpj();
157
- $dados['razaosocial'] = $customer_order->getRazaosocial();
158
- $dados['nomefantasia'] = $customer_order->getNomefantasia();
159
- $dados['insestadual'] = $customer_order->getInsestadual();
160
- }
161
-
162
- $dados['result_meio'] = $this->getNomePagamento($result->getMeio_pg());
163
- $dados['meio_pago'] = $this->getNomePagamento($result->getMeio_pg());
164
- $dados['realorder_id'] = $result->getRealorder_id();
165
- $dados['order_idtransparente'] = $result->getorder_idtransparente();
166
- $dados['boleto_line'] = $result->getBoleto_line();
167
- $dados['customer_id'] = $result->getCustomerId();
168
- $dados['brand'] = $result->getBrand();
169
- $dados['creditcard_parc'] = $result->getCreditcard_parc();
170
- $dados['first6'] = $result->getFirst6();
171
- $dados['last4'] = $result->getLast4();
172
- $dados['token'] = $result->getToken();
173
- $dados['image'] = $this->getImagePg($result->getBrandTransparente());
174
- $dados['url'] = $result->getUrlcheckout_pg();
175
- return $dados;
176
- }
177
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/MOIP/Transparente/Block/Info/Admin.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Info_Admin extends Mage_Payment_Block_Info
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('MOIP/transparente/info/admin.phtml');
9
+ }
10
+
11
+ protected function _prepareInfo()
12
+ {
13
+ $order = $this->getInfo()->getAdditionalData();
14
+
15
+
16
+ return unserialize($order);
17
+ }
18
+ public function getMethodInstance()
19
+ {
20
+ if (!$this->hasMethodInstance()) {
21
+ if ($this->getMethod()) {
22
+ $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
23
+ if ($instance) {
24
+ $instance->setInfoInstance($this);
25
+ $this->setMethodInstance($instance);
26
+ return $instance;
27
+ }
28
+ }
29
+ Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
30
+ }
31
+
32
+ return $this->_getData('method_instance');
33
+ }
34
+
35
+
36
+ }
app/code/local/MOIP/Transparente/Block/Info/Boleto.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Info_Boleto extends Mage_Payment_Block_Info
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('MOIP/transparente/info/boleto.phtml');
9
+ }
10
+
11
+ protected function _prepareInfo()
12
+ {
13
+
14
+
15
+ $order = $this->getInfo()->getOrder();
16
+
17
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
18
+ $order = $order->getId();
19
+
20
+ $model = Mage::getModel('transparente/write');
21
+ $result = $model->load($order, 'mage_pay')->getData();
22
+
23
+ return $result;
24
+ }
25
+ public function getMethodInstance()
26
+ {
27
+ if (!$this->hasMethodInstance()) {
28
+ if ($this->getMethod()) {
29
+ $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
30
+ if ($instance) {
31
+ $instance->setInfoInstance($this);
32
+ $this->setMethodInstance($instance);
33
+ return $instance;
34
+ }
35
+ }
36
+ Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
37
+ }
38
+
39
+ return $this->_getData('method_instance');
40
+ }
41
+
42
+
43
+ }
app/code/local/MOIP/Transparente/Block/Info/Boletorecurring.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Base payment iformation block
29
+ *
30
+ */
31
+ class MOIP_Transparente_Block_Info_Boletorecurring extends Mage_Payment_Block_Info
32
+ {
33
+ /**
34
+ * Payment rendered specific information
35
+ *
36
+ * @var Varien_Object
37
+ */
38
+
39
+
40
+ protected function _construct()
41
+ {
42
+ parent::_construct();
43
+ $this->setTemplate('MOIP/transparente/info/boletorecurring.phtml');
44
+ }
45
+
46
+ /**
47
+ * Retrieve info model
48
+ *
49
+ * @return Mage_Payment_Model_Info
50
+ */
51
+ protected function _prepareInfo()
52
+ {
53
+ $order = $this->getInfo()->getOrder();
54
+ if($order){
55
+ $order = $this->getInfo()->getOrder();
56
+
57
+ $order = Mage::getModel('sales/order')->load((int)$order->getId());
58
+
59
+
60
+ return $order->getPayment()->getAdditionalInformation('link_boleto');
61
+ }
62
+
63
+ }
64
+ }
app/code/local/MOIP/Transparente/Block/Info/Cc.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Info_Cc extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('MOIP/transparente/info/cc.phtml');
8
+ }
9
+ protected function _prepareInfo()
10
+ {
11
+
12
+
13
+ $order = $this->getInfo()->getOrder();
14
+
15
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
16
+ $order = $order->getId();
17
+
18
+ $model = Mage::getModel('transparente/write');
19
+ $result = $model->load($order, 'mage_pay')->getData();
20
+
21
+ return $result;
22
+ }
23
+
24
+ /**
25
+ * Encrypt data
26
+ *
27
+ * @param string $data
28
+ * @return string
29
+ */
30
+ public function encrypt($data)
31
+ {
32
+ if ($data) {
33
+ return Mage::helper('core')->encrypt($data);
34
+ }
35
+ return $data;
36
+ }
37
+
38
+ /**
39
+ * Decrypt data
40
+ *
41
+ * @param string $data
42
+ * @return string
43
+ */
44
+ public function decrypt($data)
45
+ {
46
+ if ($data) {
47
+ return Mage::helper('core')->decrypt($data);
48
+ }
49
+ return $data;
50
+ }
51
+
52
+ /**
53
+ * Additional information setter
54
+ * Updates data inside the 'additional_information' array
55
+ * or all 'additional_information' if key is data array
56
+ *
57
+ * @param string|array $key
58
+ * @param mixed $value
59
+ * @return Mage_Payment_Model_Info
60
+ * @throws Mage_Core_Exception
61
+ */
62
+ public function setAdditionalInformation($key, $value = null)
63
+ {
64
+ if (is_object($value)) {
65
+ Mage::throwException(Mage::helper('sales')->__('Payment disallow storing objects.'));
66
+ }
67
+ $this->_initAdditionalInformation();
68
+ if (is_array($key) && is_null($value)) {
69
+ $this->_additionalInformation = $key;
70
+ } else {
71
+ $this->_additionalInformation[$key] = $value;
72
+ }
73
+ return $this->setData('additional_information', $this->_additionalInformation);
74
+ }
75
+
76
+ /**
77
+ * Getter for entire additional_information value or one of its element by key
78
+ *
79
+ * @param string $key
80
+ * @return array|null|mixed
81
+ */
82
+ public function getAdditionalInformation($key = null)
83
+ {
84
+ $this->_initAdditionalInformation();
85
+ if (null === $key) {
86
+ return $this->_additionalInformation;
87
+ }
88
+ return isset($this->_additionalInformation[$key]) ? $this->_additionalInformation[$key] : null;
89
+ }
90
+
91
+ /**
92
+ * Unsetter for entire additional_information value or one of its element by key
93
+ *
94
+ * @param string $key
95
+ * @return Mage_Payment_Model_Info
96
+ */
97
+ public function unsAdditionalInformation($key = null)
98
+ {
99
+ if ($key && isset($this->_additionalInformation[$key])) {
100
+ unset($this->_additionalInformation[$key]);
101
+ return $this->setData('additional_information', $this->_additionalInformation);
102
+ }
103
+ $this->_additionalInformation = -1;
104
+ return $this->unsetData('additional_information');
105
+ }
106
+
107
+ /**
108
+ * Check whether there is additional information by specified key
109
+ *
110
+ * @param $key
111
+ * @return bool
112
+ */
113
+ public function hasAdditionalInformation($key = null)
114
+ {
115
+ $this->_initAdditionalInformation();
116
+ return null === $key
117
+ ? !empty($this->_additionalInformation)
118
+ : array_key_exists($key, $this->_additionalInformation);
119
+ }
120
+
121
+ /**
122
+ * Make sure _additionalInformation is an array
123
+ */
124
+ protected function _initAdditionalInformation()
125
+ {
126
+ if (-1 === $this->_additionalInformation) {
127
+ $this->_additionalInformation = $this->_getData('additional_information');
128
+ }
129
+ if (null === $this->_additionalInformation) {
130
+ $this->_additionalInformation = array();
131
+ }
132
+ }
133
+ }
app/code/local/MOIP/Transparente/Block/Info/Tef.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Info_Tef extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('MOIP/transparente/info/tef.phtml');
8
+ }
9
+ protected function _prepareInfo()
10
+ {
11
+ $order = $this->getInfo()->getOrder();
12
+
13
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
14
+ $order = $order->getId();
15
+
16
+ $model = Mage::getModel('transparente/write');
17
+ $result = $model->load($order, 'mage_pay')->getData();
18
+
19
+ return $result;
20
+ }
21
+ }
app/code/local/MOIP/Transparente/Block/Onclick/Button.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Onclick_Button extends Mage_Core_Block_Template
3
+ {
4
+
5
+ public function _prepareLayout()
6
+ {
7
+ return parent::_prepareLayout();
8
+ }
9
+ public function __construct(){
10
+
11
+ parent::__construct();
12
+ }
13
+
14
+ }
app/code/local/MOIP/Transparente/Block/Onclick/MoipOnclick.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Onclick_MoipOnclick extends Mage_Core_Block_Template
3
+ {
4
+
5
+
6
+ public function getCheckout() {
7
+ return Mage::getSingleton('checkout/session');
8
+ }
9
+ public function getQuote() {
10
+ return Mage::getSingleton('checkout/session')->getQuote();
11
+ }
12
+ public function getOnepage() {
13
+ return Mage::getSingleton('checkout/type_onepage');
14
+ }
15
+ protected function _getQuote() {
16
+ return Mage::getSingleton('checkout/cart')->getQuote();
17
+ }
18
+
19
+
20
+ public function _prepareLayout()
21
+ {
22
+
23
+
24
+ return parent::_prepareLayout();
25
+ }
26
+ public function __construct(){
27
+
28
+ parent::__construct();
29
+ }
30
+
31
+
32
+
33
+
34
+ }
app/code/local/MOIP/Transparente/Block/Onclick/PaymentMethod.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Onclick_PaymentMethod extends Mage_Payment_Block_Form_Container
4
+ {
5
+ public function getQuote()
6
+ {
7
+ return Mage::getSingleton('checkout/session')->getQuote();
8
+ }
9
+
10
+ /**
11
+ * Check payment method model
12
+ *
13
+ * @param Mage_Payment_Model_Method_Abstract|null
14
+ * @return bool
15
+ */
16
+ protected function _canUseMethod($method)
17
+ {
18
+ return $method && $method->canUseCheckout() && parent::_canUseMethod($method);
19
+ }
20
+
21
+ /**
22
+ * Retrieve code of current payment method
23
+ *
24
+ * @return mixed
25
+ */
26
+ public function getSelectedMethodCode()
27
+ {
28
+ if ($method = $this->getQuote()->getPayment()->getMethod()) {
29
+ return $method;
30
+ }
31
+ return false;
32
+ }
33
+
34
+ /**
35
+ * Payment method form html getter
36
+ * @param Mage_Payment_Model_Method_Abstract $method
37
+ */
38
+ public function getPaymentMethodFormHtml(Mage_Payment_Model_Method_Abstract $method)
39
+ {
40
+ return $this->getChildHtml('payment.method.' . $method->getCode());
41
+ }
42
+
43
+ /**
44
+ * Return method title for payment selection page
45
+ *
46
+ * @param Mage_Payment_Model_Method_Abstract $method
47
+ */
48
+ public function getMethodTitle(Mage_Payment_Model_Method_Abstract $method)
49
+ {
50
+ $form = $this->getChild('payment.method.' . $method->getCode());
51
+ if ($form && $form->hasMethodTitle()) {
52
+ return $form->getMethodTitle();
53
+ }
54
+ return $method->getTitle();
55
+ }
56
+
57
+ /**
58
+ * Payment method additional label part getter
59
+ * @param Mage_Payment_Model_Method_Abstract $method
60
+ */
61
+ public function getMethodLabelAfterHtml(Mage_Payment_Model_Method_Abstract $method)
62
+ {
63
+ if ($form = $this->getChild('payment.method.' . $method->getCode())) {
64
+ return $form->getMethodLabelAfterHtml();
65
+ }
66
+ }
67
+ public function getCofre() {
68
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
69
+ $data_array = array();
70
+ $customerData = Mage::getSingleton( 'customer/session' )->getCustomer();
71
+ $resource = Mage::getSingleton('core/resource');
72
+
73
+ $readConnection = $resource->getConnection('core_read');
74
+ $table = Mage::getConfig()->getTablePrefix().'moip_transparentev2';
75
+
76
+ $query = 'SELECT * FROM ' . $table .' WHERE customer_id='.$customerData->getID().' AND moip_card_id IS NOT NULL';
77
+ $results = $readConnection->fetchAll($query);
78
+
79
+ if($results){
80
+ return json_encode($results, true);
81
+ } else {
82
+ return 'false';
83
+ }
84
+
85
+ } else {
86
+ return 'false';
87
+ }
88
+
89
+ }
90
+
91
+ public function getChildParcealas(){
92
+ return $this->getLayout()->getBlock('moip.onclick.payment.method.parcelas')->toHtml();
93
+ }
94
+
95
+ }
app/code/local/MOIP/Transparente/Block/Onclick/ShippingAddress.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Onclick_ShippingAddress extends Mage_Checkout_Block_Onepage_Billing
3
+ {
4
+ public function getAddressesHtmlSelect($type)
5
+ {
6
+
7
+ if ($this->isCustomerLoggedIn()) {
8
+ $options = array();
9
+
10
+ $address_shipping = $this->getCustomer()->getDefaultBilling();
11
+ if ($address_shipping){
12
+ $address = Mage::getModel('customer/address')->load($address_shipping);
13
+ $htmlAddress = $address->format('html');
14
+ }
15
+
16
+
17
+ return $htmlAddress;
18
+ }
19
+ return ;
20
+ }
21
+ }
app/code/local/MOIP/Transparente/Block/Onclick/ShippingMethods.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Onclick_ShippingMethods extends Mage_Checkout_Block_Onepage_Abstract
3
+ {
4
+ protected $_rates;
5
+ protected $_address;
6
+
7
+ public function getShippingRates()
8
+ {
9
+
10
+ if (empty($this->_rates)) {
11
+ $this->getAddress()->collectShippingRates()->save();
12
+
13
+ $groups = $this->getAddress()->getGroupedAllShippingRates();
14
+
15
+ return $this->_rates = $groups;
16
+ }
17
+
18
+ return $this->_rates;
19
+ }
20
+
21
+ public function getAddress()
22
+ {
23
+ if (empty($this->_address)) {
24
+ $this->_address = $this->getQuote()->getShippingAddress();
25
+ }
26
+ return $this->_address;
27
+ }
28
+
29
+ public function getCarrierName($carrierCode)
30
+ {
31
+ if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) {
32
+ return $name;
33
+ }
34
+ return $carrierCode;
35
+ }
36
+
37
+ public function getAddressShippingMethod()
38
+ {
39
+ return $this->getAddress()->getShippingMethod();
40
+ }
41
+
42
+ public function getShippingPrice($price, $flag)
43
+ {
44
+ return $this->getQuote()->getStore()->convertPrice(Mage::helper('tax')->getShippingPrice($price, $flag, $this->getAddress()), true);
45
+ }
46
+ }
app/code/local/MOIP/Transparente/Block/Onclick/UpdateParcelas.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Onclick_UpdateParcelas extends Mage_Core_Block_Template
3
+ {
4
+ public function getParcelamentoSelect() {
5
+
6
+ $api = Mage::getSingleton('transparente/api');
7
+ $parcelamento = $api->getParcelamento();
8
+
9
+
10
+ foreach ($parcelamento as $key => $value) {
11
+
12
+ if($key > 0){
13
+ $juros = $value['juros'];
14
+ $parcelas_result = $value['parcela'];
15
+ $total_parcelado = $value['total_parcelado'];
16
+
17
+ if($juros > 0)
18
+ $asterisco = '*';
19
+ else
20
+ $asterisco = '';
21
+
22
+ $parcelas[]= '<option value="'.$key.'">'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.$asterisco.'</option>';
23
+ #$parcelas[]= '<li><input type="radio" name="payment[credito_parcelamento]" title="Selecione as Parcelas" id="credito_parcelamento" class="input-radio validate-one-required-by-name" value="'.$key.'"><label>'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</label></li>';
24
+
25
+ }
26
+ }
27
+
28
+
29
+ return $parcelas;
30
+
31
+ }
32
+
33
+ }
app/code/local/MOIP/Transparente/Block/Product/List/Parcelas.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Product_List_Parcelas extends Mage_Core_Block_Template {
3
+ public function __construct(){
4
+ parent::__construct();
5
+ }
6
+
7
+ public function getParcelamento($price, $method) {
8
+
9
+ if($price){
10
+ $parcelamento = $this->getParcelamentoProduct($price);
11
+
12
+ foreach ($parcelamento as $key => $value):
13
+ if($key > 0){
14
+ $juros = $value['juros'];
15
+ $parcelas_result = $value['parcela'];
16
+ $total_parcelado = $value['total_parcelado'];
17
+ if($juros > 0)
18
+ $asterisco = '';
19
+ else
20
+ $asterisco = ' sem juros';
21
+ $parcelas[]= $key.'x de '.$parcelas_result.$asterisco;
22
+ }
23
+
24
+ endforeach;
25
+ if($method == 'reduzido'){
26
+ return end($parcelas);
27
+ } elseif($method == 'integral') {
28
+ return $parcelas;
29
+ } else {
30
+ return ;
31
+ }
32
+
33
+ } else {
34
+ return ;
35
+ }
36
+
37
+
38
+ }
39
+ public function getVisaImage() {
40
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
41
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_visa');
42
+ }else {
43
+ return $this->getSkinUrl('MOIP/transparente/imagem/Visa.png');
44
+ }
45
+ }
46
+ public function getMastercardImage() {
47
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
48
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_master');
49
+ }else {
50
+ return $this->getSkinUrl('MOIP/transparente/imagem/Mastercard.png');
51
+ }
52
+ }
53
+ public function getDinersImage() {
54
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
55
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_diners');
56
+ }else {
57
+ return $this->getSkinUrl('MOIP/transparente/imagem/Diners.png');
58
+ }
59
+ }
60
+ public function getAmericanExpressImage() {
61
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
62
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_american');
63
+ }else {
64
+ return $this->getSkinUrl('MOIP/transparente/imagem/AmericanExpress.png');
65
+ }
66
+ }
67
+ public function getHipercardImage() {
68
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
69
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hipercard');
70
+ }else {
71
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hipercard.png');
72
+ }
73
+ }
74
+
75
+ public function getHiperImage() {
76
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
77
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hiper');
78
+ }else {
79
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hiper.png');
80
+ }
81
+ }
82
+
83
+ public function getEloImage() {
84
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
85
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_elo');
86
+ }else {
87
+ return $this->getSkinUrl('MOIP/transparente/imagem/Elo.png');
88
+ }
89
+ }
90
+
91
+ public function getParcelamentoProduct($valor){
92
+ $config_parcelas_juros = $this->getInfoParcelamentoJuros();
93
+ $config_parcelas_minimo = $this->getInfoParcelamentoMinimo();
94
+ $config_parcelas_maximo = Mage::getStoreConfig('payment/moip_cc/nummaxparcelamax');
95
+ $json_parcelas = array();
96
+ $count = 0;
97
+ $json_parcelas[0] = array(
98
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
99
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
100
+ 'total_juros' => 0,
101
+ 'juros' => 0
102
+ );
103
+ $json_parcelas[1] = array(
104
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
105
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
106
+ 'total_juros' => 0,
107
+ 'juros' => 0
108
+ );
109
+
110
+
111
+ $max_div = (int)$valor/$config_parcelas_minimo;
112
+ if($max_div > $config_parcelas_maximo) {
113
+ $max_div = $config_parcelas_maximo;
114
+ } elseif ($max_div > 12) {
115
+ $max_div = 12;
116
+ }
117
+
118
+ foreach ($config_parcelas_juros as $key => $value) {
119
+ if($count <= $max_div){
120
+ if($value > 0){
121
+ if(Mage::getStoreConfig('payment/moip_cc/tipodejuros') == 1) {
122
+ $parcela = $this->getJurosComposto($valor, $value, $count);
123
+ } else {
124
+ $parcela = $this->getJurosSimples($valor, $value, $count);
125
+ }
126
+ $total_parcelado = $parcela * $count;
127
+ $juros = $value;
128
+ if($parcela > 5 && $parcela > $config_parcelas_minimo){
129
+ $json_parcelas[$count] = array(
130
+ 'parcela' => Mage::helper('core')->currency($parcela, true, false),
131
+ 'total_parcelado' => Mage::helper('core')->currency($total_parcelado, true, false),
132
+ 'total_juros' => $total_parcelado - $valor,
133
+ 'juros' => $juros,
134
+ );
135
+ }
136
+ } else {
137
+ if($valor > 0 && $count > 0){
138
+ $json_parcelas[$count] = array(
139
+ 'parcela' => Mage::helper('core')->currency(($valor/$count), true, false),
140
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
141
+ 'total_juros' => 0,
142
+ 'juros' => 0
143
+ );
144
+ }
145
+ }
146
+ }
147
+
148
+
149
+
150
+
151
+
152
+ $count++;
153
+ }
154
+ return $json_parcelas;
155
+ }
156
+
157
+ public function getJurosSimples($valor, $juros, $parcela)
158
+ {
159
+ $principal = $valor;
160
+ $taxa = $juros/100;
161
+ $valjuros = $principal * $taxa;
162
+ $valParcela = ($principal + $valjuros)/$parcela;
163
+ return $valParcela;
164
+ }
165
+
166
+ public function getJurosComposto($valor, $juros, $parcela)
167
+ {
168
+ $principal = $valor;
169
+ $taxa = $juros/100;
170
+ $valParcela = ($principal * $taxa) / (1 - (pow(1 / (1 + $taxa), $parcela)));
171
+ return $valParcela;
172
+ }
173
+
174
+ public function getInfoParcelamentoJuros() {
175
+ $juros = array();
176
+
177
+ $juros['0'] = 0;
178
+
179
+ $juros['1'] = 0;
180
+
181
+ $juros['2'] = Mage::getStoreConfig('payment/moip_cc/parcela2');
182
+
183
+
184
+ $juros['3'] = Mage::getStoreConfig('payment/moip_cc/parcela3');
185
+
186
+
187
+ $juros['4'] = Mage::getStoreConfig('payment/moip_cc/parcela4');
188
+
189
+
190
+ $juros['5'] = Mage::getStoreConfig('payment/moip_cc/parcela5');
191
+
192
+
193
+ $juros['6'] = Mage::getStoreConfig('payment/moip_cc/parcela6');
194
+
195
+
196
+ $juros['7'] = Mage::getStoreConfig('payment/moip_cc/parcela7');
197
+
198
+
199
+ $juros['8'] = Mage::getStoreConfig('payment/moip_cc/parcela8');
200
+
201
+
202
+ $juros['9'] = Mage::getStoreConfig('payment/moip_cc/parcela9');
203
+
204
+
205
+ $juros['10'] = Mage::getStoreConfig('payment/moip_cc/parcela10');
206
+
207
+
208
+ $juros['11'] = Mage::getStoreConfig('payment/moip_cc/parcela11');
209
+
210
+
211
+ $juros['12'] = Mage::getStoreConfig('payment/moip_cc/parcela12');
212
+
213
+ return $juros;
214
+ }
215
+
216
+ public function getInfoParcelamentoMinimo() {
217
+
218
+
219
+ $valor = Mage::getStoreConfig('payment/moip_cc/valor_minimo');
220
+
221
+
222
+ return $valor;
223
+ }
224
+ }
app/code/local/MOIP/Transparente/Block/Product/View/Discount.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Product_View_Discount extends Mage_Catalog_Block_Product_View {
3
+ public function __construct(){
4
+ parent::__construct();
5
+ }
6
+
7
+ public function getPercentual(){
8
+ $rules = Mage::getResourceModel('salesrule/rule_collection')->load();
9
+
10
+ foreach ($rules as $rule) {
11
+ if ($rule->getIsActive()) {
12
+ $conditions = "";
13
+ $conditions_serialized = "";
14
+ $conditions_serialized = $rule->getConditionsSerialized();
15
+ $conditions = unserialize($conditions_serialized);
16
+
17
+
18
+ foreach ($conditions["conditions"] as $key => $value) {
19
+
20
+
21
+ $_enable = ($value["attribute"] == 'payment_method' && ($value["value"] == 'moip_boleto' || $value["value"] == 'moip_tef') ) ? 1 : 0;
22
+
23
+ if($_enable){
24
+ $rule = Mage::getModel('salesrule/rule')->load($rule->getId());
25
+ $percentual = $rule->getDiscountAmount();
26
+ }
27
+
28
+ }
29
+ }
30
+ return $percentual;
31
+ }
32
+ }
33
+
34
+ public function getNewPriceDiscount(){
35
+ $_product = $this->getProduct();
36
+ $price = $_product->getFinalPrice();
37
+ $percentual = $this->getPercentual() / 100;
38
+ $valor_final = $price - ($percentual * $price);
39
+ return Mage::helper('core')->currency($valor_final, true, false);
40
+ }
41
+ }
app/code/local/MOIP/Transparente/Block/Product/View/Parcelas.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Product_View_Parcelas extends Mage_Catalog_Block_Product_View{
3
+ public function __construct(){
4
+ parent::__construct();
5
+ }
6
+
7
+ public function getParcelamento($price, $method) {
8
+
9
+ if($price){
10
+ $parcelamento = $this->getParcelamentoProduct($price);
11
+
12
+ foreach ($parcelamento as $key => $value):
13
+ if($key > 0){
14
+ $juros = $value['juros'];
15
+ $parcelas_result = $value['parcela'];
16
+ $total_parcelado = $value['total_parcelado'];
17
+ if($juros > 0)
18
+ $asterisco = '';
19
+ else
20
+ $asterisco = ' sem juros';
21
+ $parcelas[]= $key.'x de <span class="parcela-valor">'.$parcelas_result.'</span>'.$asterisco;
22
+ }
23
+
24
+ endforeach;
25
+ if($method == 'reduzido'){
26
+ return end($parcelas);
27
+ } elseif($method == 'integral') {
28
+ return $parcelas;
29
+ } else {
30
+ return ;
31
+ }
32
+
33
+ } else {
34
+ return ;
35
+ }
36
+
37
+
38
+ }
39
+ public function getVisaImage() {
40
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
41
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_visa');
42
+ }else {
43
+ return $this->getSkinUrl('MOIP/transparente/imagem/Visa.png');
44
+ }
45
+ }
46
+ public function getMastercardImage() {
47
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
48
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_master');
49
+ }else {
50
+ return $this->getSkinUrl('MOIP/transparente/imagem/Mastercard.png');
51
+ }
52
+ }
53
+ public function getDinersImage() {
54
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
55
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_diners');
56
+ }else {
57
+ return $this->getSkinUrl('MOIP/transparente/imagem/Diners.png');
58
+ }
59
+ }
60
+ public function getAmericanExpressImage() {
61
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
62
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_american');
63
+ }else {
64
+ return $this->getSkinUrl('MOIP/transparente/imagem/AmericanExpress.png');
65
+ }
66
+ }
67
+ public function getHipercardImage() {
68
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
69
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hipercard');
70
+ }else {
71
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hipercard.png');
72
+ }
73
+ }
74
+
75
+ public function getHiperImage() {
76
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
77
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hiper');
78
+ }else {
79
+ return $this->getSkinUrl('MOIP/transparente/imagem/Hiper.png');
80
+ }
81
+ }
82
+
83
+ public function getEloImage() {
84
+ if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
85
+ return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_elo');
86
+ }else {
87
+ return $this->getSkinUrl('MOIP/transparente/imagem/Elo.png');
88
+ }
89
+ }
90
+
91
+ public function getParcelamentoProduct($valor){
92
+ $config_parcelas_juros = $this->getInfoParcelamentoJuros();
93
+ $config_parcelas_minimo = $this->getInfoParcelamentoMinimo();
94
+ $config_parcelas_maximo = Mage::getStoreConfig('payment/moip_cc/nummaxparcelamax');
95
+ $json_parcelas = array();
96
+ $count = 0;
97
+ $json_parcelas[0] = array(
98
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
99
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
100
+ 'total_juros' => 0,
101
+ 'juros' => 0
102
+ );
103
+ $json_parcelas[1] = array(
104
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
105
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
106
+ 'total_juros' => 0,
107
+ 'juros' => 0
108
+ );
109
+
110
+
111
+ $max_div = (int)$valor/$config_parcelas_minimo;
112
+ if($max_div > $config_parcelas_maximo) {
113
+ $max_div = $config_parcelas_maximo;
114
+ } elseif ($max_div > 12) {
115
+ $max_div = 12;
116
+ }
117
+
118
+ foreach ($config_parcelas_juros as $key => $value) {
119
+ if($count <= $max_div){
120
+ if($value > 0){
121
+ if(Mage::getStoreConfig('payment/moip_cc/tipodejuros') == 1) {
122
+ $parcela = $this->getJurosComposto($valor, $value, $count);
123
+ } else {
124
+ $parcela = $this->getJurosSimples($valor, $value, $count);
125
+ }
126
+ $total_parcelado = $parcela * $count;
127
+ $juros = $value;
128
+ if($parcela > 5 && $parcela > $config_parcelas_minimo){
129
+ $json_parcelas[$count] = array(
130
+ 'parcela' => Mage::helper('core')->currency($parcela, true, false),
131
+ 'total_parcelado' => Mage::helper('core')->currency($total_parcelado, true, false),
132
+ 'total_juros' => $total_parcelado - $valor,
133
+ 'juros' => $juros,
134
+ );
135
+ }
136
+ } else {
137
+ if($valor > 0 && $count > 0){
138
+ $json_parcelas[$count] = array(
139
+ 'parcela' => Mage::helper('core')->currency(($valor/$count), true, false),
140
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
141
+ 'total_juros' => 0,
142
+ 'juros' => 0
143
+ );
144
+ }
145
+ }
146
+ }
147
+
148
+
149
+
150
+
151
+
152
+ $count++;
153
+ }
154
+ return $json_parcelas;
155
+ }
156
+
157
+ public function getJurosSimples($valor, $juros, $parcela)
158
+ {
159
+ $principal = $valor;
160
+ $taxa = $juros/100;
161
+ $valjuros = $principal * $taxa;
162
+ $valParcela = ($principal + $valjuros)/$parcela;
163
+ return $valParcela;
164
+ }
165
+
166
+ public function getJurosComposto($valor, $juros, $parcela)
167
+ {
168
+ $principal = $valor;
169
+ $taxa = $juros/100;
170
+ $valParcela = ($principal * $taxa) / (1 - (pow(1 / (1 + $taxa), $parcela)));
171
+ return $valParcela;
172
+ }
173
+
174
+ public function getInfoParcelamentoJuros() {
175
+ $juros = array();
176
+
177
+ $juros['0'] = 0;
178
+
179
+ $juros['1'] = 0;
180
+
181
+ $juros['2'] = Mage::getStoreConfig('payment/moip_cc/parcela2');
182
+
183
+
184
+ $juros['3'] = Mage::getStoreConfig('payment/moip_cc/parcela3');
185
+
186
+
187
+ $juros['4'] = Mage::getStoreConfig('payment/moip_cc/parcela4');
188
+
189
+
190
+ $juros['5'] = Mage::getStoreConfig('payment/moip_cc/parcela5');
191
+
192
+
193
+ $juros['6'] = Mage::getStoreConfig('payment/moip_cc/parcela6');
194
+
195
+
196
+ $juros['7'] = Mage::getStoreConfig('payment/moip_cc/parcela7');
197
+
198
+
199
+ $juros['8'] = Mage::getStoreConfig('payment/moip_cc/parcela8');
200
+
201
+
202
+ $juros['9'] = Mage::getStoreConfig('payment/moip_cc/parcela9');
203
+
204
+
205
+ $juros['10'] = Mage::getStoreConfig('payment/moip_cc/parcela10');
206
+
207
+
208
+ $juros['11'] = Mage::getStoreConfig('payment/moip_cc/parcela11');
209
+
210
+
211
+ $juros['12'] = Mage::getStoreConfig('payment/moip_cc/parcela12');
212
+
213
+ return $juros;
214
+ }
215
+
216
+ public function getInfoParcelamentoMinimo() {
217
+
218
+
219
+ $valor = Mage::getStoreConfig('payment/moip_cc/valor_minimo');
220
+
221
+
222
+ return $valor;
223
+ }
224
+ }
app/code/local/MOIP/Transparente/Block/Sales/Order/Fee.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Sales_Order_Fee extends Mage_Sales_Block_Order_Totals
3
+ {
4
+ protected $_code = 'fee';
5
+
6
+ protected function _initTotals() {
7
+ parent::_initTotals();
8
+ $shipping = $this->getSource()->getShippingAmount();
9
+ $amt = $this->getSource()->getSubtotal() + $shipping;
10
+ $total = $this->getSource()->getGrandTotal();
11
+ $juros = $total - $amt;
12
+ $amt = $this->getSource()->getFeeAmount();
13
+ $baseAmt = $this->getSource()->getBaseFeeAmount();
14
+ if ($juros > 0) {
15
+ $this->addTotal(new Varien_Object(array(
16
+ 'code' => 'fee',
17
+ 'value' => $juros,
18
+ 'base_value' => $juros,
19
+ 'label' => 'Juros do Cartão',
20
+ )), 'fee');
21
+ }
22
+ return $this;
23
+ }
24
+
25
+ }
26
+
27
+ ?>
app/code/local/MOIP/Transparente/Block/Standard/Cancel.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Standard_Cancel extends Mage_Checkout_Block_Onepage_Failure{
3
+
4
+
5
+ public function __construct(){
6
+ $this->_expireCart();
7
+ $session = Mage::getSingleton('checkout/session');
8
+ Mage::dispatchEvent('sales_order_item_cancel', array('order_ids' => array($session->getOrder()->getId())));
9
+ parent::__construct();
10
+ }
11
+ }
app/code/local/MOIP/Transparente/Block/Standard/CartSave.php CHANGED
@@ -40,15 +40,15 @@ class MOIP_Transparente_Block_Standard_CartSave extends Mage_Checkout_Block_Onep
40
  }
41
  }
42
  public function imageCofre($brand){
43
- if($brand == "Visa"){
44
  $image_brand = $this->getVisaImage();
45
- } elseif ($brand == "Mastercard") {
46
  $image_brand = $this->getMastercardImage();
47
- } elseif ($brand == "AmericanExpress") {
48
  $image_brand = $this->getAmericanExpressImage();
49
- } elseif ($brand == "Diners") {
50
  $image_brand = $this->getDinersImage();
51
- } elseif ($brand == "Hipercard") {
52
  $image_brand = $this->getHipercardImage();
53
  } else {
54
  $image_brand = "";
@@ -60,15 +60,19 @@ class MOIP_Transparente_Block_Standard_CartSave extends Mage_Checkout_Block_Onep
60
  $data_array = array();
61
  $customerData = Mage::getSingleton('customer/session')->getCustomer();
62
  $resource = Mage::getSingleton('core/resource');
 
63
  $readConnection = $resource->getConnection('core_read');
64
- $table = (string) Mage::getConfig()->getTablePrefix().'moip_transparente';
65
- $query = 'SELECT * FROM ' . $table .' WHERE customer_id='.$customerData->getID().' AND cofre IS NOT NULL';
 
66
  $results = $readConnection->fetchAll($query);
 
67
  if($results){
68
  return Mage::helper('core')->jsonEncode((object)$results);
69
  } else {
70
- return 'false';
71
  }
 
72
  } else {
73
  return 'false';
74
  }
40
  }
41
  }
42
  public function imageCofre($brand){
43
+ if($brand == "VISA"){
44
  $image_brand = $this->getVisaImage();
45
+ } elseif ($brand == "MASTERCARD") {
46
  $image_brand = $this->getMastercardImage();
47
+ } elseif ($brand == "AMERICANEXPRESS") {
48
  $image_brand = $this->getAmericanExpressImage();
49
+ } elseif ($brand == "DINERS") {
50
  $image_brand = $this->getDinersImage();
51
+ } elseif ($brand == "HIPERCARD") {
52
  $image_brand = $this->getHipercardImage();
53
  } else {
54
  $image_brand = "";
60
  $data_array = array();
61
  $customerData = Mage::getSingleton('customer/session')->getCustomer();
62
  $resource = Mage::getSingleton('core/resource');
63
+
64
  $readConnection = $resource->getConnection('core_read');
65
+ $table = (string) Mage::getConfig()->getTablePrefix().'moip_transparentev2';
66
+
67
+ $query = 'SELECT * FROM ' . $table .' WHERE customer_id='.$customerData->getID().' AND moip_card_id IS NOT NULL';
68
  $results = $readConnection->fetchAll($query);
69
+
70
  if($results){
71
  return Mage::helper('core')->jsonEncode((object)$results);
72
  } else {
73
+ return 'false';
74
  }
75
+
76
  } else {
77
  return 'false';
78
  }
app/code/local/MOIP/Transparente/Block/Standard/Form.php CHANGED
@@ -13,12 +13,7 @@
13
  class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
14
 
15
  protected function _construct() {
16
- #$transparente_layout = Mage::getStoreConfig('moipall/config/transparente_layout');
17
- #if ($transparente_layout == "Horizontal"):
18
- $this->setTemplate('MOIP/transparente/horizontal_form.phtml');
19
- #else:
20
- # $this->setTemplate('MOIP/transparente/vertical_form.phtml');
21
- #endif;
22
  parent::_construct();
23
  }
24
 
@@ -27,54 +22,13 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
27
  $this->setChild('scripts', $this->getLayout()->createBlock('core/template') ->setTemplate('MOIP/transparente/script.phtml'));
28
  return parent::_prepareLayout();
29
  }
30
- public function boletoDisponivel($dataToReturn) {
31
-
32
- $_Produtos = Mage::getSingleton('checkout/cart')->getQuote()->getAllItems();
33
-
34
- $stockProducts = array();
35
- $noBoletoProducts = array();
36
- $result = '';
37
- $error = false;
38
-
39
- foreach ($_Produtos as $product) {
40
- $_product = Mage::getModel('catalog/product')->load($product->getProductId());
41
- if ($_product->getProibirBoleto()) {
42
- $noBoletoProducts[] = $_product->getName();
43
- $error = true;
44
- }
45
- if ((int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty() <= Mage::getSingleton('transparente/standard')->getConfigData('estoqueboleto')) {
46
- $stockProducts[] = $_product->getName();
47
- $error = true;
48
- }
49
- }
50
-
51
-
52
- if ($error) {
53
- if (sizeof($stockProducts) > 0) {
54
- if (sizeof($stockProducts) > 1) {
55
- $result .= 'Os Produtos '.implode(', ', $stockProducts).' não tem estoque o suficiente para ser comprados por Boleto.<br />';
56
- }else {
57
- $result .= 'O Produto '.implode('', $stockProducts).' não tem estoque o suficiente para ser comprado por Boleto.<br />';
58
- }
59
- }
60
-
61
- if (sizeof($noBoletoProducts) > 0) {
62
- if (sizeof($noBoletoProducts) > 1) {
63
- $result .= 'Os Produtos '.implode(', ', $noBoletoProducts).' não podem ser comprados por Boleto.<br />';
64
- }else {
65
- $result .= 'O Produto '.implode('', $noBoletoProducts).' não pode ser comprado por Boleto.<br />';
66
- }
67
- }
68
- }
69
-
70
- if ($dataToReturn == 'text' && $error) {
71
- return '<div class="alert alert-error">'.$result.'</div>';
72
- }else if ($dataToReturn == 'valid') {
73
- return $error;
74
- }else if ($error) {
75
- return array('error'=>$error, 'text'=>'<div class="alert alert-error">'.$result.'</div>');
76
- }
77
 
 
 
 
 
 
 
78
  }
79
 
80
  public function mostraBoleto() {
@@ -100,77 +54,7 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
100
  }
101
 
102
 
103
- //textos de desconto
104
- public function getTextoBoleto($dataToReturn) {
105
- $valor_pedido = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();
106
- $textoresumo = "";
107
- if (Mage::getStoreConfig('moipall/pagamento_avancado/pagamento_boleto')) {
108
-
109
-
110
- if ($valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor'))
111
- {
112
-
113
- if ($valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') && (int)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') != 0)
114
- {
115
-
116
- $textoresumo = "Desconto de: ".Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2')."%.";
117
- $descontotexto = $textoresumo ."<br/>Págavel em qualquer banco, casas lotéricas ou via internet bank.";
118
- }
119
-
120
- else {
121
-
122
- $textoresumo = "Desconto de: ".Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc')."%.";
123
- $descontotexto = $textoresumo ."<br/>Págavel em qualquer banco, casas lotéricas ou via internet bank.";
124
- }
125
- }
126
- else {
127
- $textoresumo = "Págavel em qualquer banco";
128
- $descontotexto = "Págavel em qualquer banco, casas lotéricas ou via internet bank.";
129
- }
130
 
131
- } else {
132
- $textoresumo = "Págavel em qualquer banco";
133
- $descontotexto = "Págavel em qualquer banco, casas lotéricas ou via internet bank.";
134
- }
135
-
136
- if ($dataToReturn == 'preview') {
137
- return $textoresumo;
138
- } else if ($dataToReturn == "texto" ) {
139
- return $descontotexto;
140
- }
141
- }
142
- public function getTextoTranferencia($dataToReturn) {
143
- $valor_pedido = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();
144
- if (Mage::getStoreConfig('moipall/pagamento_avancado/transf_desc')) {
145
- if ($valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor'))
146
- {
147
-
148
- if ($valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') && (int)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') != 0)
149
- {
150
-
151
- $textoresumo = "Desconto de: ".Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2')."%.";
152
- $descontotexto = $textoresumo;
153
- }
154
-
155
- else {
156
-
157
- $textoresumo = "Desconto de: ".Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc')."%.";
158
- $descontotexto = $textoresumo;
159
- }
160
- }
161
-
162
- }else {
163
- $textoresumo = "Via internet bank.";
164
- $descontotexto = "";
165
- }
166
- if ($dataToReturn == 'preview') {
167
- return $textoresumo;
168
- } else if ($dataToReturn == "texto") {
169
- return $descontotexto;
170
- }
171
- }
172
-
173
- //Icones Principais
174
  public function getBoletoIcon() {
175
  if (Mage::getStoreConfig('moipall/config/trocar_icone')) {
176
  return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/icone_boleto');
@@ -232,42 +116,6 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
232
  }
233
  }
234
 
235
- //imagens de cartao
236
- public function getVisaImage() {
237
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
238
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_visa');
239
- }else {
240
- return $this->getSkinUrl('MOIP/transparente/imagem/Visa.png');
241
- }
242
- }
243
- public function getMastercardImage() {
244
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
245
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_master');
246
- }else {
247
- return $this->getSkinUrl('MOIP/transparente/imagem/Mastercard.png');
248
- }
249
- }
250
- public function getDinersImage() {
251
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
252
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_diners');
253
- }else {
254
- return $this->getSkinUrl('MOIP/transparente/imagem/Diners.png');
255
- }
256
- }
257
- public function getAmericanExpressImage() {
258
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
259
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_american');
260
- }else {
261
- return $this->getSkinUrl('MOIP/transparente/imagem/AmericanExpress.png');
262
- }
263
- }
264
- public function getHipercardImage() {
265
- if (Mage::getStoreConfig('moipall/config/trocar_bandeira_cartao')) {
266
- return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/cartao_hipercard');
267
- }else {
268
- return $this->getSkinUrl('MOIP/transparente/imagem/Hipercard.png');
269
- }
270
- }
271
 
272
 
273
  //confs de parcelamento
@@ -277,8 +125,7 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
277
  $parcelax = "";
278
  $precox = "";
279
  $api = Mage::getSingleton('transparente/api');
280
- $api->setContaTransparente(Mage::getSingleton('transparente/standard')->getConfigData('conta_transparente'));
281
- $api->setAmbiente(Mage::getSingleton('transparente/standard')->getConfigData('ambiente'));
282
 
283
  $cartTotal = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();
284
 
@@ -288,9 +135,6 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
288
  foreach ($parcela_decode as $key => $value) {
289
 
290
  if ($key <= Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax')) {
291
-
292
- if (Mage::getStoreConfig('moipall/config/transparente_layout') == "Horizontal")
293
- {
294
  $juros = $parcela_decode[$key]['juros'];
295
  $parcelas_result = $parcela_decode[$key]['parcela'];
296
  $total_parcelado = $parcela_decode[$key]['total_parcelado'];
@@ -299,18 +143,7 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
299
  else
300
  $asterisco = '';
301
  $parcelas[]= '<option value="'.$key.'">'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</option>';
302
- } else {
303
- $juros = $parcela_decode[$key]['juros'];
304
- $parcelas_result = $parcela_decode[$key]['parcela'];
305
- $total_parcelado = $parcela_decode[$key]['total_parcelado'];
306
- if($juros > 0)
307
- $asterisco = '*';
308
- else
309
- $asterisco = '';
310
-
311
- $parcelas[]= '<li><input type="radio" name="payment[credito_parcelamento]" title="Selecione as Parcelas" id="credito_parcelamento" class="input-radio validate-one-required-by-name" value="'.$key.'"><label>'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</label></li>';
312
- }
313
-
314
  }
315
  }
316
  }else {
@@ -375,87 +208,54 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
375
  }
376
 
377
  }
378
- //get customer data
379
- public function getCustomerData($selector) {
380
 
381
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
382
- if ($selector == "nome") {
383
- return Mage::getSingleton('customer/session')->getCustomer()->getName();
384
- }elseif ($selector == "cpf") {
385
- return Mage::getSingleton('customer/session')->getCustomer()->getTaxvat();
386
- }elseif ($selector == "telefone") {
387
- return Mage::getSingleton('customer/session')->getCustomer()->getTelephone();
388
- }elseif ($selector == "dob") {
389
- $dn = Mage::getSingleton('customer/session')->getCustomer()->getdob();
390
- return date("d/m/Y", strtotime($dn));
391
- }
392
-
393
- }
394
-
395
- }
396
-
397
- public function getBoletoPrice() {
398
-
399
- $desconto = 0;
400
- $valor_pedido = Mage::getModel('checkout/session')->getQuote()->getSubtotal();
401
- $cart = Mage::getModel('checkout/session')->getQuote();
402
- $shippingMethod = $cart->getShippingAddress();
403
- $price_shipping = $shippingMethod['shipping_amount'];
404
- $valor_pedido = Mage::getModel('checkout/session')->getQuote()->getSubtotal();
405
- if (Mage::getStoreConfig('moipall/pagamento_avancado/transf_desc')) {
406
- if ($valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor')) {
407
- $desconto = (float)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc');
408
- }
409
- if (Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') != "" && $valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') && $valor_pedido < Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor3') ) {
410
- $desconto = (float)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2');
411
  }
412
-
413
- if (Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor3') != "" && $valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor3') ) {
414
- $desconto = (float)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc3');
415
  }
416
- $valor_pre = (float)$valor_pedido-((float)$valor_pedido/100*$desconto);
417
- $valor_pedido = $valor_pre + $price_shipping;
418
- return Mage::helper('core')->currency($valor_pedido,true,false);
419
  }
420
-
421
  else {
422
- return Mage::helper('core')->currency($valor_pedido,true,false);
423
  }
424
-
425
-
426
-
427
-
428
-
429
  }
430
 
431
- public function getTransferenciaPrice() {
432
- $desconto = 0;
433
- $valor_pedido = Mage::getModel('checkout/session')->getQuote()->getSubtotal();
434
- $cart = Mage::getModel('checkout/session')->getQuote();
435
- $shippingMethod = $cart->getShippingAddress();
436
- $price_shipping = $shippingMethod['shipping_amount'];
437
- $valor_pedido = Mage::getModel('checkout/session')->getQuote()->getSubtotal();
438
- if (Mage::getStoreConfig('moipall/pagamento_avancado/transf_desc')) {
439
- if ($valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor')) {
440
- $desconto = (float)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc');
441
- }
442
- if (Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') != "" && $valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') && $valor_pedido < Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor3') ) {
443
- $desconto = (float)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2');
444
- }
445
 
446
- if (Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor3') != "" && $valor_pedido >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor3') ) {
447
- $desconto = (float)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc3');
448
- }
449
- $valor_pre = (float)$valor_pedido-((float)$valor_pedido/100*$desconto);
450
- $valor_pedido = $valor_pre + $price_shipping;
451
- return Mage::helper('core')->currency($valor_pedido,true,false);
452
- }
453
 
454
- else {
455
- return Mage::helper('core')->currency($valor_pedido,true,false);
456
- }
 
 
457
 
458
- }
 
459
  public function getCheckout() {
460
  return Mage::getSingleton('checkout/session');
461
  }
@@ -469,4 +269,6 @@ class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
469
  public function getOnepage() {
470
  return (string)Mage::getSingleton('checkout/type_onepage');
471
  }
 
 
472
  }
13
  class MOIP_Transparente_Block_Standard_Form extends Mage_Payment_Block_Form {
14
 
15
  protected function _construct() {
16
+ $this->setTemplate('MOIP/transparente/horizontal_form.phtml');
 
 
 
 
 
17
  parent::_construct();
18
  }
19
 
22
  $this->setChild('scripts', $this->getLayout()->createBlock('core/template') ->setTemplate('MOIP/transparente/script.phtml'));
23
  return parent::_prepareLayout();
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ public function getPublicKey(){
27
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
28
+ return Mage::getSingleton('transparente/standard')->getConfigData('publickey_dev');
29
+ } else {
30
+ return Mage::getSingleton('transparente/standard')->getConfigData('publickey_prod');
31
+ }
32
  }
33
 
34
  public function mostraBoleto() {
54
  }
55
 
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  public function getBoletoIcon() {
59
  if (Mage::getStoreConfig('moipall/config/trocar_icone')) {
60
  return Mage::getBaseUrl('media') . "moip/alltransparente/". Mage::getStoreConfig('moipall/config/icone_boleto');
116
  }
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
 
121
  //confs de parcelamento
125
  $parcelax = "";
126
  $precox = "";
127
  $api = Mage::getSingleton('transparente/api');
128
+
 
129
 
130
  $cartTotal = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();
131
 
135
  foreach ($parcela_decode as $key => $value) {
136
 
137
  if ($key <= Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax')) {
 
 
 
138
  $juros = $parcela_decode[$key]['juros'];
139
  $parcelas_result = $parcela_decode[$key]['parcela'];
140
  $total_parcelado = $parcela_decode[$key]['total_parcelado'];
143
  else
144
  $asterisco = '';
145
  $parcelas[]= '<option value="'.$key.'">'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</option>';
146
+ # $parcelas[]= '<li><input type="radio" name="payment[credito_parcelamento]" title="Selecione as Parcelas" id="credito_parcelamento" class="input-radio validate-one-required-by-name" value="'.$key.'"><label>'.$key.'x de '.$parcelas_result.' no total de '.$total_parcelado.' '.$asterisco.'</label></li>';
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
  }
149
  }else {
208
  }
209
 
210
  }
 
 
211
 
212
+ public function getDateCard($select){
213
+ if($this->getQuote()->getBillingAddress()){
214
+ $checkout = $this->getQuote()->getBillingAddress();
215
+ if($select == "name"){
216
+ return $checkout->getFirstname()." ".$checkout->getLastname();
217
+ } elseif($select == "telephone-ddd") {
218
+ return $this->getNumberOrDDD($checkout->getTelephone(), true);
219
+ } elseif($select == "telephone-number") {
220
+ return $this->getNumberOrDDD($checkout->getTelephone(), false);
221
+ } elseif($select =="taxvat"){
222
+ return $this->getQuote()->getCustomer()->getTaxvat();
223
+ } elseif($select == "dob"){
224
+ return $this->getQuote()->getCustomer()->getDob();
225
+ } elseif($select == "dob-day"){
226
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('dd');
227
+ } elseif($select =="dob-month") {
228
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('MM');
229
+ } elseif ($select == "dob-year") {
230
+ return Mage::app()->getLocale()->date($this->getQuote()->getCustomer()->getDob(), null, null, false)->toString('Y');
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
+ else{
233
+ return;
 
234
  }
 
 
 
235
  }
 
236
  else {
237
+ return;
238
  }
 
 
 
 
 
239
  }
240
 
241
+ public function getNumberOrDDD($param_telefone, $param_ddd = false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
242
 
243
+ $cust_ddd = '11';
244
+ $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
245
+ $st = strlen($cust_telephone) - 8;
246
+ if ($st > 0) {
247
+ $cust_ddd = substr($cust_telephone, 0, 2);
248
+ $cust_telephone = substr($cust_telephone, $st, 8);
249
+ }
250
 
251
+ if ($param_ddd === false) {
252
+ $retorno = $cust_telephone;
253
+ } else {
254
+ $retorno = $cust_ddd;
255
+ }
256
 
257
+ return $retorno;
258
+ }
259
  public function getCheckout() {
260
  return Mage::getSingleton('checkout/session');
261
  }
269
  public function getOnepage() {
270
  return (string)Mage::getSingleton('checkout/type_onepage');
271
  }
272
+
273
+
274
  }
app/code/local/MOIP/Transparente/Block/Standard/Info.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Block_Standard_Info extends Mage_Payment_Block_Info
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('MOIP/transparente/info.phtml');
9
+ }
10
+
11
+
12
+
13
+ public function getTransparente()
14
+ {
15
+ return Mage::getSingleton('transparente/api');
16
+ }
17
+
18
+ public function getNomeBrand($param) {
19
+ $nome = "";
20
+ switch ($param) {
21
+ case "VI":
22
+ $nome = "Visa";
23
+ break;
24
+ case "MC":
25
+ $nome = "MasterCard";
26
+ break;
27
+ case "AE":
28
+ $nome = "American Express";
29
+ break;
30
+ case "DC":
31
+ $nome = "Dinners Club";
32
+ break;
33
+ }
34
+ return $nome;
35
+ }
36
+ private function getNomePagamento($param) {
37
+ $nome = "";
38
+ switch ($param) {
39
+ case "BoletoBancario":
40
+ $nome = "Boleto Bancário";
41
+ break;
42
+ case "DebitoBancario":
43
+ $nome = "Transferência Bancária";
44
+ break;
45
+ case "CartaoCredito":
46
+ $nome = "Cartão de Crédito";
47
+ break;
48
+ }
49
+ return $nome;
50
+ }
51
+
52
+ public function toPdf()
53
+ {
54
+ $this->setTemplate('MOIP/transparente/info/pdf.phtml');
55
+ return $this->toHtml();
56
+ }
57
+
58
+ protected function _prepareInfo()
59
+ {
60
+
61
+
62
+ $order = $this->getInfo()->getOrder();
63
+
64
+ $customer_order = Mage::getModel('customer/customer')->load($order->getCustomerId());
65
+ $order = $order->getId();
66
+
67
+ $model = Mage::getModel('transparente/write');
68
+ $result = $model->load($order, 'mage_pay')->getData();
69
+ $dados = array();
70
+
71
+ if((int)$customer_order->getTipopessoa()!= 1){
72
+ $dados['compra_pj'] = 1;
73
+ $dados['cnpj'] = $customer_order->getCnpj();
74
+ $dados['razaosocial'] = $customer_order->getRazaosocial();
75
+ $dados['nomefantasia'] = $customer_order->getNomefantasia();
76
+ $dados['insestadual'] = $customer_order->getInsestadual();
77
+ }
78
+ $dados= array_merge($result, $dados);
79
+ return $dados;
80
+ }
81
+ public function getMethodInstance()
82
+ {
83
+ if (!$this->hasMethodInstance()) {
84
+ if ($this->getMethod()) {
85
+ $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
86
+ if ($instance) {
87
+ $instance->setInfoInstance($this);
88
+ $this->setMethodInstance($instance);
89
+ return $instance;
90
+ }
91
+ }
92
+ Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
93
+ }
94
+
95
+ return $this->_getData('method_instance');
96
+ }
97
+
98
+ /**
99
+ * Encrypt data
100
+ *
101
+ * @param string $data
102
+ * @return string
103
+ */
104
+ public function encrypt($data)
105
+ {
106
+ if ($data) {
107
+ return Mage::helper('core')->encrypt($data);
108
+ }
109
+ return $data;
110
+ }
111
+
112
+ /**
113
+ * Decrypt data
114
+ *
115
+ * @param string $data
116
+ * @return string
117
+ */
118
+ public function decrypt($data)
119
+ {
120
+ if ($data) {
121
+ return Mage::helper('core')->decrypt($data);
122
+ }
123
+ return $data;
124
+ }
125
+
126
+ /**
127
+ * Additional information setter
128
+ * Updates data inside the 'additional_information' array
129
+ * or all 'additional_information' if key is data array
130
+ *
131
+ * @param string|array $key
132
+ * @param mixed $value
133
+ * @return Mage_Payment_Model_Info
134
+ * @throws Mage_Core_Exception
135
+ */
136
+ public function setAdditionalInformation($key, $value = null)
137
+ {
138
+ if (is_object($value)) {
139
+ Mage::throwException(Mage::helper('sales')->__('Payment disallow storing objects.'));
140
+ }
141
+ $this->_initAdditionalInformation();
142
+ if (is_array($key) && is_null($value)) {
143
+ $this->_additionalInformation = $key;
144
+ } else {
145
+ $this->_additionalInformation[$key] = $value;
146
+ }
147
+ return $this->setData('additional_information', $this->_additionalInformation);
148
+ }
149
+
150
+ /**
151
+ * Getter for entire additional_information value or one of its element by key
152
+ *
153
+ * @param string $key
154
+ * @return array|null|mixed
155
+ */
156
+ public function getAdditionalInformation($key = null)
157
+ {
158
+ $this->_initAdditionalInformation();
159
+ if (null === $key) {
160
+ return $this->_additionalInformation;
161
+ }
162
+ return isset($this->_additionalInformation[$key]) ? $this->_additionalInformation[$key] : null;
163
+ }
164
+
165
+ /**
166
+ * Unsetter for entire additional_information value or one of its element by key
167
+ *
168
+ * @param string $key
169
+ * @return Mage_Payment_Model_Info
170
+ */
171
+ public function unsAdditionalInformation($key = null)
172
+ {
173
+ if ($key && isset($this->_additionalInformation[$key])) {
174
+ unset($this->_additionalInformation[$key]);
175
+ return $this->setData('additional_information', $this->_additionalInformation);
176
+ }
177
+ $this->_additionalInformation = -1;
178
+ return $this->unsetData('additional_information');
179
+ }
180
+
181
+ /**
182
+ * Check whether there is additional information by specified key
183
+ *
184
+ * @param $key
185
+ * @return bool
186
+ */
187
+ public function hasAdditionalInformation($key = null)
188
+ {
189
+ $this->_initAdditionalInformation();
190
+ return null === $key
191
+ ? !empty($this->_additionalInformation)
192
+ : array_key_exists($key, $this->_additionalInformation);
193
+ }
194
+
195
+ /**
196
+ * Make sure _additionalInformation is an array
197
+ */
198
+ protected function _initAdditionalInformation()
199
+ {
200
+ if (-1 === $this->_additionalInformation) {
201
+ $this->_additionalInformation = $this->_getData('additional_information');
202
+ }
203
+ if (null === $this->_additionalInformation) {
204
+ $this->_additionalInformation = array();
205
+ }
206
+ }
207
+ }
app/code/local/MOIP/Transparente/Block/Standard/Redirect.php CHANGED
@@ -1,297 +1,193 @@
1
  <?php
2
- class MOIP_Transparente_Block_Standard_Redirect extends Mage_Checkout_Block_Onepage_Success{
3
- public function __construct(){
4
- parent::__construct();
5
- }
6
- public function getSaveDate($order, $result_decode, $customerData = null, $pgtoArray, $client_array){
7
-
8
- if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
9
- $url = "https://desenvolvedor.moip.com.br/sandbox/Instrucao.do?token=";
10
- }
11
- else {
12
- $url = "https://www.moip.com.br/Instrucao.do?token=";
13
- }
14
-
15
- $model_del = Mage::getModel('transparente/write');
16
-
17
- $model_del->load($order, 'realorder_id');
18
- if($model_del->getRealorder_id()){
19
- Mage::getSingleton('core/session')->addError('A página não pode ser recarregada.');
20
- Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
21
- return;
22
- }
23
- $model = Mage::getModel('transparente/write');
24
- $model->setRealorder_id($order);
25
- $model->setMeio_pg($pgtoArray['forma_pagamento']);
26
- $model->setCreditcard_parc($pgtoArray['credito_parcelamento']);
27
- if($pgtoArray['forma_pagamento'] == "BoletoBancario"){
28
- $brand = "Bradesco";
29
- } elseif ($pgtoArray['forma_pagamento'] == "DebitoBancario") {
30
- $brand = $pgtoArray['debito_instituicao'];
31
- } else {
32
- $brand = $pgtoArray['credito_instituicao'];
33
- if($pgtoArray['use_cofre'] != 1){
34
- $model->setbrand_transparente($brand);
35
- $model->setCreditcard_parc($pgtoArray['credito_parcelamento']);
36
- $model->setFirst6(substr((string)$pgtoArray['credito_numero'], 0, 6));
37
- $model->setLast4(substr((string)$pgtoArray['credito_numero'],-4,4));
38
- } else {
39
- $model->setbrand_transparente($pgtoArray['cofre_brand']);
40
- $model->setCreditcard_parc($pgtoArray['cofre_parcelamento']);
41
- $model->setFirst6('****');
42
- $model->setLast4('****');
43
- }
44
- if($pgtoArray['save_cart'] == "on"){
45
- $model->setAceitaCofre(1);
46
- } else{
47
- $model->setAceitaCofre(0);
48
- }
49
- }
50
- $model->setCustomer_id($customerData->getId());
51
- $model->setUrlcheckout_pg($url.$result_decode['token']);
52
- $model->setToken($result_decode['token']);
53
- $model->setStatus_token($result_decode['status']);
54
- $model->save();
55
-
56
- try{
57
- $order_send = Mage::getModel('sales/order')->load($order, 'increment_id');
58
- $order_send->sendNewOrderEmail();
59
- }
60
- catch (Exception $ex) { };
61
- return true;
62
- }
63
-
64
- public function getUrlAmbiente(){
65
- if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste")
66
- $url = "https://desenvolvedor.moip.com.br/sandbox/";
67
- else
68
- $url = "https://www.moip.com.br/";
69
-
70
- return $url;
71
- }
72
-
73
-
74
- public function getOrder()
75
- {
76
- $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
77
-
78
- $current_order = Mage::getModel('sales/order')->getCollection()
79
- ->addFieldToFilter('increment_id', $orderId);
80
-
81
- if($current_order) {
82
- foreach( $current_order as $order ) {
83
- $final = $order;
84
- break;
85
- }
86
- }
87
-
88
- return $final;
89
- }
90
-
91
-
92
- public function getJson($pgtoArray){
93
-
94
- if($pgtoArray['forma_pagamento'] == "BoletoBancario"){
95
- $json = array(
96
- 'Forma' => $pgtoArray['forma_pagamento'],
97
- );
98
- } elseif ($pgtoArray['forma_pagamento'] == "DebitoBancario") {
99
- $json = array(
100
- 'Forma' => $pgtoArray['forma_pagamento'],
101
- 'Instituicao' => $pgtoArray['debito_instituicao'],
102
- );
103
-
104
- } else {
105
- if($pgtoArray['use_cofre'] != 1){
106
- $expiracao = $pgtoArray['credito_expiracao_mes']."/".$pgtoArray['credito_expiracao_ano'];
107
- $DataNascimento = date('d/m/Y', strtotime($pgtoArray['credito_portador_nascimento']));
108
- $json = array(
109
- 'Forma' => $pgtoArray['forma_pagamento'],
110
- 'Instituicao' => $pgtoArray['credito_instituicao'],
111
- 'Parcelas' => $pgtoArray['credito_parcelamento'],
112
- 'CartaoCredito' => array(
113
- 'Numero' => $pgtoArray['credito_numero'],
114
- 'Expiracao' => $expiracao,
115
- 'CodigoSeguranca' => $pgtoArray['credito_codigo_seguranca'],
116
- 'Portador' => array(
117
- 'Nome' => $pgtoArray['credito_portador_nome'],
118
- 'DataNascimento' => $DataNascimento,
119
- 'Telefone' => $pgtoArray['credito_portador_DDD'].$pgtoArray['credito_portador_telefone'],
120
- 'Identidade' => $pgtoArray['credito_portador_cpf']),
121
- ),
122
- );
123
- } else{
124
- $json = array(
125
- 'Forma' => $pgtoArray['forma_pagamento'],
126
- 'Instituicao' => $pgtoArray['cofre_brand'],
127
- 'Parcelas' => $pgtoArray['cofre_parcelamento'],
128
- 'CartaoCredito' => array(
129
- 'Cofre' => $pgtoArray['cofre_numero'],
130
- 'CodigoSeguranca' => $pgtoArray['cofre_cvv']
131
- ),
132
- );
133
- }
134
-
135
- }
136
- $json = Mage::helper('core')->jsonEncode((object)$json);
137
- return $json;
138
-
139
- }
140
- public function getOrder_dados($order_dados){
141
-
142
- return $order_dados;
143
- }
144
-
145
- public function getErroCartao($result_decode)
146
- {
147
- if(array_key_exists('errors', $result_decode)){
148
- $dados_ErroCartao = array();
149
- $dados_ErroCartao['errors'] = $result_decode->errors;
150
- foreach ($result_decode->errors as $key => $value)
151
- {
152
- $dados_ErroCartao['code'] = $value->code;
153
- $dados_ErroCartao['description'] = $value->description;
154
- }
155
- $dados_ErroCartao = Mage::helper('core')->jsonEncode((object)$dados_ErroCartao);
156
- return $dados_ErroCartao;
157
- } else{
158
- return false;
159
- }
160
- }
161
- public function getCartao($result_decode, $pagamento)
162
- {
163
-
164
- return false;
165
-
166
- }
167
- public function getTrackingTransparente($order_dados)
168
  {
 
 
 
 
 
 
 
 
 
169
 
170
- $order = Mage::getModel('sales/order')->loadByIncrementId($order_dados['id_transacao']);
171
- $orderIds = $order->getId();
172
- $collection = Mage::getResourceModel('sales/order_collection')
173
- ->addFieldToFilter('entity_id', array('in' => $orderIds))
174
- ;
175
- $result = array();
176
- foreach ($collection as $order) {
177
- if ($order->getIsVirtual()) {
178
- $address = $order->getBillingAddress();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  } else {
180
- $address = $order->getShippingAddress();
181
  }
182
- $result[] = sprintf("_gaq.push(['_addTrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);",
183
- $order->getIncrementId(),
184
- $this->jsQuoteEscape(Mage::app()->getStore()->getFrontendName()),
185
- $order->getBaseGrandTotal(),
186
- $order->getBaseTaxAmount(),
187
- $order->getBaseShippingAmount(),
188
- $this->jsQuoteEscape(Mage::helper('core')->escapeHtml($address->getCity())),
189
- $this->jsQuoteEscape(Mage::helper('core')->escapeHtml($address->getRegion())),
190
- $this->jsQuoteEscape(Mage::helper('core')->escapeHtml($address->getCountry()))
191
- );
192
- foreach ($order->getAllVisibleItems() as $item) {
193
- $cProduct = Mage::getModel('catalog/product');
194
- $cProductId = $cProduct->getIdBySku($item->getSku());
195
- $cProduct->load($cProductId);
196
- $category_list = "";
197
- $cats = $cProduct->getCategoryCollection()->exportToArray();
198
-
199
- foreach($cats as $cat){
200
- $category_list .= Mage::getModel('catalog/category')->load($cat['entity_id'])->getName()."|";
201
- }
 
 
 
 
 
 
 
 
202
 
 
 
 
203
 
204
- $category_list = rtrim($category_list,"|");
205
 
206
- $result[] = sprintf("_gaq.push(['_addItem', '%s', '%s', '%s', '%s', '%s', '%s']);",
207
- $order->getIncrementId(),
208
- $this->jsQuoteEscape($item->getSku()), $this->jsQuoteEscape($item->getName()),
209
- $category_list,
210
- $item->getBasePrice(), $item->getQtyOrdered()
211
- );
212
- }
213
- $result[] = "_gaq.push(['_trackTrans']);";
214
- }
215
-
216
- return implode("\n", $result);
217
  }
218
 
219
- public function getTrans_Transparente($result_decode, $pagamento)
220
- {
221
-
222
- return true;
223
- }
224
 
225
- public function getBoleto_Transparente($result_decode)
226
- {
 
227
 
228
- return true;
229
- }
 
 
 
 
 
 
 
 
230
 
231
- private function getBarcode($valor){
232
- $fino = 1 ;
233
- $largo = 3 ;
234
- $altura = 50 ;
235
- $barcodes[0] = "00110" ;
236
- $barcodes[1] = "10001" ;
237
- $barcodes[2] = "01001" ;
238
- $barcodes[3] = "11000" ;
239
- $barcodes[4] = "00101" ;
240
- $barcodes[5] = "10100" ;
241
- $barcodes[6] = "01100" ;
242
- $barcodes[7] = "00011" ;
243
- $barcodes[8] = "10010" ;
244
- $barcodes[9] = "01010" ;
245
- for($f1=9;$f1>=0;$f1--)
246
- {
247
- for($f2=9;$f2>=0;$f2--){
248
- $f = ($f1 * 10) + $f2;
249
- $texto = "";
250
- for($i=1;$i<6;$i++){
251
- $texto .= substr($barcodes[$f1],($i-1),1) . substr($barcodes[$f2],($i-1),1);
252
- }
253
- $barcodes[$f] = $texto;
254
- }
255
- }
256
- $image_p = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'MOIP/transparente/imagem/boleto/p.png';
257
- $image_b = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'MOIP/transparente/imagem/boleto/b.png';
258
- $image_boleto = "<img src='{$image_p}' width='{$fino}' height='{$altura}' border='0'>
259
- <img src='{$image_b}' width='{$fino}' height='{$altura}' border='0'>
260
- <img src='{$image_p}' width='{$fino}' height='{$altura}' border='0'>
261
- <img src='{$image_b}' width='{$fino}' height='{$altura}' border='0'>";
262
- $texto = $valor ;
263
- if((strlen($texto) % 2) <> 0){
264
- $texto = "0" . $texto;
265
- }
266
- while (strlen($texto) > 0) {
267
- $i = round($this->esquerda($texto,2));
268
- $texto = $this->direita($texto,strlen($texto)-2);
269
- $f = $barcodes[$i];
270
- for($i=1;$i<11;$i+=2){
271
- if(substr($f,($i-1),1) == "0"){
272
- $f1 = $fino;
273
- } else {
274
- $f1 = $largo;
275
- }
276
- $image_boleto .= "<img src='{$image_p}' width='{$f1}' height='{$altura}' border='0'>";
277
- if(substr($f,$i,1) == "0") {
278
- $f2 = $fino;
279
- }else{
280
- $f2 = $largo;
281
- }
282
- $image_boleto .= "<img src='{$image_b}' width='{$f2}' height='{$altura}' border='0'>";
283
- }
284
- }
285
- $image_boleto .= "<img src='{$image_p}' width='{$largo}' height='{$altura}' border='0'>
286
- <img src='{$image_b}' width='{$fino}' height='{$altura}' border='0'>
287
- <img src='{$image_p}' width='1' height='{$altura}' border='0'> ";
288
- return $image_boleto;
289
- }
290
 
291
- private function esquerda($entra,$comp){
292
- return substr($entra,0,$comp);
293
- }
294
- private function direita($entra,$comp){
295
- return substr($entra,strlen($entra)-$comp,$comp);
296
- }
297
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ class MOIP_Transparente_Block_Standard_Redirect extends Mage_Checkout_Block_Onepage_Success
3
+ {
4
+ public function __construct()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  {
6
+ $this->_expireCart();
7
+ $session = Mage::getSingleton('checkout/session');
8
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array(
9
+ 'order_ids' => array(
10
+ $session->getLastOrderId()
11
+ )
12
+ ));
13
+ parent::__construct();
14
+ }
15
 
16
+ public function getSaveDate()
17
+ {
18
+ $order = $this->getOrder();
19
+ $info = $order->getPayment();
20
+ $pgto = $this->getMoipPayment();
21
+ $responseMoipJson = $pgto['response_moip'];
22
+ $responseMoip = $pgto['response_moip'];
23
+ $forma_pagamento = $order->getPayment()->getMethodInstance()->getCode();
24
+ $orderIdMoip = $pgto['order_moip'];
25
+ $mage_pay = $order->getId();
26
+ $model_del = Mage::getModel('transparente/write');
27
+ $model_del->load($mage_pay, 'mage_pay');
28
+ if ($model_del->getMoipPay()) {
29
+ $url = "sales/order/view/order_id/" . $mage_pay;
30
+ return;
31
+ }
32
+ $email = $order->getBillingAddress()->getEmail();
33
+ $customerId = $order->getCustomerId();
34
+ $fees = $responseMoip->amount->fees;
35
+ $moipidPay = $responseMoip->id;
36
+ if ($forma_pagamento == "moip_boleto") {
37
+ $href = $responseMoip->_links->payBoleto->redirectHref;
38
+ $moip_boleto_expirationDate = $responseMoip->fundingInstrument->boleto->expirationDate;
39
+ $moip_boleto_lineCode = $responseMoip->fundingInstrument->boleto->lineCode;
40
+ $state_onhold = $this->initState('order_status_holded_boleto');
41
+ $comment = "Aguardando confirmação automática de pagamento.";
42
+
43
+ } elseif ($forma_pagamento == "moip_tef") {
44
+ $href = $responseMoip->_links->payOnlineBankDebitBB->redirectHref;
45
+ $moip_transf_expirationDate = $responseMoip->fundingInstrument->onlineBankDebit->expirationDate;
46
+ $moip_transf_bankName = $responseMoip->fundingInstrument->onlineBankDebit->bankName;
47
+ $state_onhold = $this->initState('order_status_holded_tef');
48
+ $comment = "Aguardando confirmação automática de pagamento.";
49
+ } elseif ($forma_pagamento == "moip_cc") {
50
+ $status = $responseMoip->status;
51
+ $moip_card_installmentCount = $responseMoip->installmentCount;
52
+ $moip_card_brand = $responseMoip->fundingInstrument->creditCard->brand;
53
+ if($pgto['save_card']){
54
+ $moip_card_id = $responseMoip->fundingInstrument->creditCard->id;
55
  } else {
56
+ $moip_card_id = null;
57
  }
58
+ $moip_card_first6 = $responseMoip->fundingInstrument->creditCard->first6;
59
+ $moip_card_last4 = $responseMoip->fundingInstrument->creditCard->last4;
60
+ $moip_card_birthdate = $responseMoip->fundingInstrument->creditCard->holder->birthdate;
61
+ $moip_card_taxDocument = $responseMoip->fundingInstrument->creditCard->holder->taxDocument->number;
62
+ $moip_card_fullname = $responseMoip->fundingInstrument->creditCard->holder->fullname;
63
+ $state_onhold = $this->initState('order_status_holded');
64
+ $comment = "Aguardando confirmação automática de pagamento.";
65
+ }
66
+ $model = Mage::getModel('transparente/write');
67
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste")
68
+ $ambiente = "teste";
69
+ else
70
+ $ambiente = "producao";
71
+ $order_moip = str_replace("ORD-", "", $orderIdMoip);
72
+ $model->setMagePay($mage_pay)->setMoipOrder($order_moip)->setCustomerEmail($email)->setCustomerId($customerId)->setFormaPagamento($forma_pagamento)->setMoipAmbiente($ambiente)->setMoipFees($fees)->setMoipPay($moipidPay);
73
+ if ($forma_pagamento == "moip_boleto") {
74
+ $model->setMoipHrefBoleto($href)->setMoipExpirationBoleto($moip_boleto_expirationDate)->setMoipLinecodeBoleto($moip_boleto_lineCode);
75
+ $model->save();
76
+ } elseif ($forma_pagamento == "moip_tef") {
77
+ $model->setMoipHrefTrans($href)->setMoipBankNameTrans($moip_transf_bankName)->setMoipExpirationTrans($moip_transf_expirationDate);
78
+ $model->save();
79
+ } elseif ($forma_pagamento == "moip_cc") {
80
+ $model->setMoipCardInstallment($moip_card_installmentCount)->setMoipCardBrand($moip_card_brand)->setMoipCardId($moip_card_id)->setMoipCardFirst6($moip_card_first6)->setMoipCardLast4($moip_card_last4)->setMoipCardBirthdate($moip_card_birthdate)->setMoipCardTaxdocument($moip_card_taxDocument)->setMoipCardFullname($moip_card_fullname);
81
+ $model->save();
82
+ }
83
+ $order->sendNewOrderEmail();
84
+ $order->setEmailSent(true);
85
+ $order->save();
86
 
87
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, $state_onhold, $comment, $notified = false, $includeComment = true);
88
+ $order->save();
89
+ #$order->sendOrderUpdateEmail(true, $comment);
90
 
 
91
 
92
+ return $this;
 
 
 
 
 
 
 
 
 
 
93
  }
94
 
 
 
 
 
 
95
 
96
+ public function initState($value){
97
+ return Mage::getSingleton('transparente/standard')->getConfigData($value);
98
+ }
99
 
100
+ public function getMoipPayment()
101
+ {
102
+ return $this->getCheckout()->getMoipData();
103
+ }
104
+ public function getCardStatus()
105
+ {
106
+ $pgto = $this->getMoipPayment();
107
+ $responseMoipJson = $pgto['response_moip'];
108
+ return $responseMoipJson->status;
109
+ }
110
 
111
+ public function getLinkReorder()
112
+ {
113
+ $order = $this->getOrder();
114
+ return $order->getId();
115
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
+ public function getBoletoLinks()
118
+ {
119
+ $pgto = $this->getMoipPayment();
120
+ $responseMoipJson = $pgto['response_moip'];
121
+ return $responseMoipJson->_links->payBoleto->redirectHref;
122
+ }
123
+ public function getBoletoCode()
124
+ {
125
+ $pgto = $this->getMoipPayment();
126
+ $responseMoipJson = $pgto['response_moip'];
127
+ return $responseMoipJson->fundingInstrument->boleto->lineCode;
128
+ }
129
+ public function getDebitLinks()
130
+ {
131
+ $pgto = $this->getMoipPayment();
132
+ $responseMoipJson = $pgto['response_moip'];
133
+ if ($pgto['banknumber_moip'] == '001') {
134
+ return $responseMoipJson->_links->payOnlineBankDebitBB->redirectHref;
135
+ } elseif ($pgto['banknumber_moip'] == '237') {
136
+ return $responseMoipJson->_links->payOnlineBankDebitBradesco->redirectHref;
137
+ } elseif ($pgto['banknumber_moip'] == '341') {
138
+ return $responseMoipJson->_links->payOnlineBankDebitItau->redirectHref;
139
+ } else {
140
+ return $responseMoipJson->_links->payOnlineBankDebitBanrisul->redirectHref;
141
+ }
142
+ }
143
+ public function setDataMoip()
144
+ {
145
+ $this->getSaveDate();
146
+ }
147
+ public function getDataMoip()
148
+ {
149
+ return $this->$_MoipData;
150
+ }
151
+ protected function _expireCart()
152
+ {
153
+ if (!Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
154
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
155
+ exit;
156
+ }
157
+ }
158
+ public function getUrlAmbiente()
159
+ {
160
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste")
161
+ $url = "https://desenvolvedor.moip.com.br/sandbox/";
162
+ else
163
+ $url = "https://www.moip.com.br/";
164
+ return $url;
165
+ }
166
+ public function getOrder()
167
+ {
168
+ $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
169
+ $current_order = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('increment_id', $orderId);
170
+ if ($current_order) {
171
+ foreach ($current_order as $order) {
172
+ $final = $order;
173
+ break;
174
+ }
175
+ }
176
+ return $final;
177
+ }
178
+ public function getChildTemplate()
179
+ {
180
+ $order = $this->getOrder();
181
+ $info = $order->getPayment()->getMethodInstance()->getCode();
182
+ if ($info == "moip_boleto")
183
+ return $this->getChildHtml('transparente.boleto');
184
+ elseif ($info == "moip_tef")
185
+ return $this->getChildHtml('transparente.transferencia');
186
+ elseif ($info == "moip_cc")
187
+ return $this->getChildHtml('transparente.cartao');
188
+ }
189
+ protected function getCheckout()
190
+ {
191
+ return Mage::getSingleton('checkout/session');
192
+ }
193
+ }
app/code/local/MOIP/Transparente/Block/Standard/SuccessRecurring.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Block_Standard_SuccessRecurring extends Mage_Sales_Block_Items_Abstract{
3
+
4
+ public function __construct(){
5
+ parent::__construct();
6
+ }
7
+ public function getOrder()
8
+ {
9
+ $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
10
+
11
+ $current_order = Mage::getModel('sales/order')->getCollection()
12
+ ->addFieldToFilter('increment_id', $orderId);
13
+
14
+ if($current_order) {
15
+ foreach( $current_order as $order ) {
16
+ $final = $order;
17
+ break;
18
+ }
19
+ }
20
+
21
+ return $final;
22
+ }
23
+
24
+ }
25
+ ?>
app/code/local/MOIP/Transparente/Helper/Data.php CHANGED
@@ -10,5 +10,172 @@
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class MOIP_Transparente_Helper_Data extends Mage_Core_Helper_Abstract {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class MOIP_Transparente_Helper_Data extends Mage_Core_Helper_Abstract {
13
+
14
+ public function getParcelas($price, $method) {
15
+
16
+ if($price){
17
+ $parcelamento = $this->getParcelamentoProduct($price);
18
+
19
+ foreach ($parcelamento as $key => $value):
20
+ if($key > 0){
21
+ $juros = $value['juros'];
22
+ $parcelas_result = $value['parcela'];
23
+ $total_parcelado = $value['total_parcelado'];
24
+ if($juros > 0)
25
+ $asterisco = '';
26
+ else
27
+ $asterisco = ' sem juros';
28
+ $parcelas[]= $key.'x de '.$parcelas_result.$asterisco;
29
+ }
30
+
31
+ endforeach;
32
+ if($method == 'reduzido'){
33
+ return end($parcelas);
34
+ } elseif($method == 'integral') {
35
+ return $parcelas;
36
+ } else {
37
+ return ;
38
+ }
39
 
40
+ } else {
41
+ return ;
42
+ }
43
+
44
+
45
+ }
46
+
47
+
48
+ public function getParcelamentoProduct($valor){
49
+ $config_parcelas_juros = $this->getInfoParcelamentoJuros();
50
+ $config_parcelas_minimo = $this->getInfoParcelamentoMinimo();
51
+ $config_parcelas_maximo = Mage::getStoreConfig('payment/moip_cc/nummaxparcelamax');
52
+ $json_parcelas = array();
53
+ $count = 0;
54
+ $json_parcelas[0] = array(
55
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
56
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
57
+ 'total_juros' => 0,
58
+ 'juros' => 0
59
+ );
60
+ $json_parcelas[1] = array(
61
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
62
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
63
+ 'total_juros' => 0,
64
+ 'juros' => 0
65
+ );
66
+
67
+
68
+ $max_div = (int)$valor/$config_parcelas_minimo;
69
+ if($max_div > $config_parcelas_maximo) {
70
+ $max_div = $config_parcelas_maximo;
71
+ } elseif ($max_div > 12) {
72
+ $max_div = 12;
73
+ }
74
+
75
+ foreach ($config_parcelas_juros as $key => $value) {
76
+ if($count <= $max_div){
77
+ if($value > 0){
78
+ if(Mage::getStoreConfig('payment/moip_cc/tipodejuros') == 1) {
79
+ $parcela = $this->getJurosComposto($valor, $value, $count);
80
+ } else {
81
+ $parcela = $this->getJurosSimples($valor, $value, $count);
82
+ }
83
+ $total_parcelado = $parcela * $count;
84
+ $juros = $value;
85
+ if($parcela > 5 && $parcela > $config_parcelas_minimo){
86
+ $json_parcelas[$count] = array(
87
+ 'parcela' => Mage::helper('core')->currency($parcela, true, false),
88
+ 'total_parcelado' => Mage::helper('core')->currency($total_parcelado, true, false),
89
+ 'total_juros' => $total_parcelado - $valor,
90
+ 'juros' => $juros,
91
+ );
92
+ }
93
+ } else {
94
+ if($valor > 0 && $count > 0){
95
+ $json_parcelas[$count] = array(
96
+ 'parcela' => Mage::helper('core')->currency(($valor/$count), true, false),
97
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
98
+ 'total_juros' => 0,
99
+ 'juros' => 0
100
+ );
101
+ }
102
+ }
103
+ }
104
+
105
+
106
+
107
+
108
+
109
+ $count++;
110
+ }
111
+ return $json_parcelas;
112
+ }
113
+
114
+ public function getJurosSimples($valor, $juros, $parcela)
115
+ {
116
+ $principal = $valor;
117
+ $taxa = $juros/100;
118
+ $valjuros = $principal * $taxa;
119
+ $valParcela = ($principal + $valjuros)/$parcela;
120
+ return $valParcela;
121
+ }
122
+
123
+ public function getJurosComposto($valor, $juros, $parcela)
124
+ {
125
+ $principal = $valor;
126
+ $taxa = $juros/100;
127
+ $valParcela = ($principal * $taxa) / (1 - (pow(1 / (1 + $taxa), $parcela)));
128
+ return $valParcela;
129
+ }
130
+
131
+ public function getInfoParcelamentoJuros() {
132
+ $juros = array();
133
+
134
+ $juros['0'] = 0;
135
+
136
+ $juros['1'] = 0;
137
+
138
+ $juros['2'] = Mage::getStoreConfig('payment/moip_cc/parcela2');
139
+
140
+
141
+ $juros['3'] = Mage::getStoreConfig('payment/moip_cc/parcela3');
142
+
143
+
144
+ $juros['4'] = Mage::getStoreConfig('payment/moip_cc/parcela4');
145
+
146
+
147
+ $juros['5'] = Mage::getStoreConfig('payment/moip_cc/parcela5');
148
+
149
+
150
+ $juros['6'] = Mage::getStoreConfig('payment/moip_cc/parcela6');
151
+
152
+
153
+ $juros['7'] = Mage::getStoreConfig('payment/moip_cc/parcela7');
154
+
155
+
156
+ $juros['8'] = Mage::getStoreConfig('payment/moip_cc/parcela8');
157
+
158
+
159
+ $juros['9'] = Mage::getStoreConfig('payment/moip_cc/parcela9');
160
+
161
+
162
+ $juros['10'] = Mage::getStoreConfig('payment/moip_cc/parcela10');
163
+
164
+
165
+ $juros['11'] = Mage::getStoreConfig('payment/moip_cc/parcela11');
166
+
167
+
168
+ $juros['12'] = Mage::getStoreConfig('payment/moip_cc/parcela12');
169
+
170
+ return $juros;
171
+ }
172
+
173
+ public function getInfoParcelamentoMinimo() {
174
+
175
+
176
+ $valor = Mage::getStoreConfig('payment/moip_cc/valor_minimo');
177
+
178
+
179
+ return $valor;
180
+ }
181
  }
app/code/local/MOIP/Transparente/Model/Admin.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Admin
3
+ {
4
+
5
+
6
+ }
7
+
app/code/local/MOIP/Transparente/Model/Adminhtml/Method/Boleto.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_Boleto extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_boleto';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/adminhtml_form_boleto';
7
+ protected $_infoBlockType = 'transparente/info_boleto';
8
+ protected $_isGateway = true;
9
+ protected $_canAuthorize = true;
10
+ protected $_canCapture = true;
11
+ protected $_canCapturePartial = true;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+ protected $_canVoid = true;
15
+ protected $_canUseInternal = true;
16
+ protected $_canUseCheckout = true;
17
+ protected $_canUseForMultishipping = true;
18
+ protected $_canSaveCc = true;
19
+ protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $additionaldata = array();
29
+ $info->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
30
+ return $this;
31
+ }
32
+ public function prepareSave()
33
+ {
34
+ $info = $this->getInfoInstance();
35
+ return $this;
36
+ }
37
+ public function prepare()
38
+ {
39
+ $info = $this->getInfoInstance();
40
+ $additionaldata = unserialize($info->getAdditionalData());
41
+ $session = Mage::getSingleton('checkout/session');
42
+ $session->setMoipData($additionaldata);
43
+ }
44
+ public function validate()
45
+ {
46
+ parent::validate();
47
+ $info = $this->getInfoInstance();
48
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
49
+ $errorMsg = false;
50
+ if ($errorMsg === false) {
51
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
52
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
53
+ }
54
+ }
55
+ if ($errorMsg) {
56
+ Mage::throwException($errorMsg);
57
+ }
58
+ return $this;
59
+ }
60
+ public function getApi()
61
+ {
62
+ $api = Mage::getModel('transparente/api');
63
+ return $api;
64
+ }
65
+ public function getOrderPlaceRedirectUrl()
66
+ {
67
+ $info = $this->getInfoInstance();
68
+ $quote = $info->getQuote();
69
+ $additionaldata = unserialize($info->getAdditionalData());
70
+ $json_order = $this->getApi()->getDados($quote);
71
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
72
+ $json_payment = $this->getApi()->getPaymentJsonBoleto($info, $quote);
73
+ $payment = $this->getApi()->generatePayment($json_payment, $IdMoip);
74
+ $additionaldataAfter = array(
75
+ 'token_moip' => $json_order,
76
+ 'response_moip' => $payment,
77
+ 'order_moip' => (string) $IdMoip
78
+ );
79
+ $additionaldata = array_merge($additionaldata, $additionaldataAfter);
80
+ $info->setAdditionalData(serialize($additionaldataAfter))->save()->setAdditionalInformation(serialize($additionaldataAfter))->save();
81
+ Mage::log('json ' . $json_payment, null, 'MOIP_PaymentJsonSend.log', true);
82
+ $this->prepare();
83
+ if (isset($payment->errors)) {
84
+ foreach ($payment->errors as $key => $value) {
85
+ $erros = (string) $value->description . " " . $erros;
86
+ }
87
+ $session = Mage::getSingleton('checkout/session');
88
+ $session->setMoipError($erros);
89
+ Mage::log('json' . $json_payment, null, 'MOIP_ErrorPayment.log', true);
90
+ Mage::log('Erro no pagamento moip order' . $payment, null, 'MOIP_ErrorPayment.log', true);
91
+ return Mage::getUrl('transparente/standard/cancel', array(
92
+ '_secure' => true
93
+ ));
94
+ } else {
95
+ return Mage::getUrl('transparente/standard/redirect', array(
96
+ '_secure' => true
97
+ ));
98
+ }
99
+ }
100
+ }
app/code/local/MOIP/Transparente/Model/Adminhtml/Method/Cc.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_Cc extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_cc';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/form_cc';
7
+ protected $_infoBlockType = 'transparente/info_cc';
8
+ protected $_isGateway = true;
9
+ protected $_canAuthorize = true;
10
+ protected $_canCapture = true;
11
+ protected $_canCapturePartial = true;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+ protected $_canVoid = true;
15
+ protected $_canUseInternal = true;
16
+ protected $_canUseCheckout = true;
17
+ protected $_canUseForMultishipping = true;
18
+ protected $_canSaveCc = true;
19
+ protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+ public function getPayment()
22
+ {
23
+ return $this->getQuote()->getPayment();
24
+ }
25
+ public function getSession()
26
+ {
27
+ return Mage::getSingleton('transparente/session');
28
+ }
29
+ public function getCheckout()
30
+ {
31
+ return Mage::getSingleton('checkout/session');
32
+ }
33
+ public function getQuote()
34
+ {
35
+ return $this->getCheckout()->getQuote();
36
+ }
37
+ public function assignData($data)
38
+ {
39
+ if (!($data instanceof Varien_Object)) {
40
+ $data = new Varien_Object($data);
41
+ }
42
+ $info = $this->getInfoInstance();
43
+ $dataNascimento = $data->getMoipCcOwnerExpDay() . "/" . $data->getMoipCcOwnerExpMonth() . "/" . $data->getMoipCcOwnerExpYear();
44
+ if ($data->getMoipCcPaymentInCofre() == 0)
45
+ $use_cofre = 1;
46
+ else
47
+ $use_cofre = 0;
48
+ $additionaldata = array(
49
+ 'taxdocument_moip' => preg_replace("/[^0-9]/", "", $data->getMoipCcTaxdocument()),
50
+ 'installmentcount_moip' => $data->getMoipCcInstallmentCount(),
51
+ 'installmentcountcofre_moip' => $data->getMoipCcCountCofre(),
52
+ 'phonenumber_moip' => $data->getMoipCcPhoneNumber(),
53
+ 'phoneddd_moip' => preg_replace("/[^0-9]/", "", $data->getMoipCcPhoneCode()),
54
+ 'birthdate_moip' => $dataNascimento,
55
+ 'hash_moip' => $data->getMoipCcEncrypted(),
56
+ 'credit_card_cofre_nb' => (string) $data->getMoipCcCofreNb(),
57
+ 'use_cofre' => (int) $use_cofre,
58
+ 'credit_card_ccv' => $data->getMoipCcCofreId(),
59
+ 'fullname_moip' => $data->getMoipCcOwner()
60
+ );
61
+ $info->setCcType($data->getMoipCcType())->setCcLast4(substr($data->getMoipCcNumber(), -4))->setCcNumber($data->getMoipCcNumber())->setCcExpMonth($data->getMoipCcExpMonth())->setCcExpYear($data->getMoipCcExpYear())->setCcCid($data->getMoipCcCid())->setCcOwner($data->getMoipCcOwner())->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
62
+ $this->getMethodJuros();
63
+ return $this;
64
+ }
65
+ public function prepareSave()
66
+ {
67
+ $info = $this->getInfoInstance();
68
+ if ($this->_canSaveCc) {
69
+ $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
70
+ }
71
+ $info->setCcCidEnc($info->encrypt($info->getCcCid()));
72
+ $info->setCcNumber(null)->setCcCid(null);
73
+ return $this;
74
+ }
75
+ public function prepare()
76
+ {
77
+ $info = $this->getInfoInstance();
78
+ $additionaldata = unserialize($info->getAdditionalData());
79
+ $session = Mage::getSingleton('checkout/session');
80
+ $session->setMoipData($additionaldata);
81
+ }
82
+ public function validate()
83
+ {
84
+ parent::validate();
85
+ $info = $this->getInfoInstance();
86
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
87
+ $errorMsg = false;
88
+ $additionaldata = unserialize($info->getAdditionalData());
89
+ if ($additionaldata['use_cofre'] == 0) {
90
+ $ccNumber = $info->getCcNumber();
91
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
92
+ $info->setCcNumber($ccNumber);
93
+ $ccType = '';
94
+ if ($this->validateCcNum($ccNumber)) {
95
+ $ccTypeRegExpList = array(
96
+ 'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
97
+ 'MC' => '/^5[1-5][0-9]{14}$/',
98
+ 'AE' => '/^3[47][0-9]{13}$/',
99
+ 'DC' => '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/',
100
+ 'EO' => '/^([0-9])$/',
101
+ 'HI' => '/^([0-9])$/',
102
+ 'HP' => '/^([0-9])$/'
103
+ );
104
+ $specifiedCCType = $info->getCcType();
105
+ if ($specifiedCCType == 'VI' || $$specifiedCCType == "MC" || $$specifiedCCType == "AE" || $$specifiedCCType == "DC") {
106
+ if (array_key_exists($specifiedCCType, $ccTypeRegExpList)) {
107
+ $ccTypeRegExp = $ccTypeRegExpList[$specifiedCCType];
108
+ if (!preg_match($ccTypeRegExp, $ccNumber)) {
109
+ $errorMsg = Mage::helper('transparente')->__('Ops, não consigo processar o seu cartão confira o número por favor.');
110
+ }
111
+ }
112
+ } else {
113
+ if ($specifiedCCType)
114
+ $errorMsg = "";
115
+ else
116
+ $errorMsg = Mage::helper('transparente')->__('Ops, não consigo processar o seu cartão confira o número por favor.');
117
+ }
118
+ } else {
119
+ $errorMsg = Mage::helper('transparente')->__('O número do cartão está inválido');
120
+ }
121
+ if ($errorMsg === false) {
122
+ $verifcationRegEx = $this->getVerificationRegEx();
123
+ $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
124
+ if (!$info->getCcCid() || !$regExp || !preg_match($regExp, $info->getCcCid())) {
125
+ $errorMsg = Mage::helper('transparente')->__('O Código de Segurança (cvv) está inválido');
126
+ }
127
+ }
128
+ if ($errorMsg === false) {
129
+ if (!$info->getCcOwner()) {
130
+ $errorMsg = Mage::helper('transparente')->__('O nome do portador do cartão não está correto');
131
+ }
132
+ }
133
+ if ($errorMsg === false) {
134
+ if (!isset($additionaldata['hash_moip'])) {
135
+ $errorMsg = Mage::helper('transparente')->__('Seu cartão não pode ser processado via Moip, por favor escolha outro meio de pagamento.');
136
+ }
137
+ }
138
+ if ($errorMsg === false) {
139
+ if (!$this->getValidaCPF($additionaldata['taxdocument_moip'])) {
140
+ $errorMsg = Mage::helper('transparente')->__('Informe um CPF válido, caso seu cartão seja empresarial é necessário informar o seu CPF.');
141
+ }
142
+ }
143
+ if ($errorMsg === false) {
144
+ $phone = $additionaldata['phonenumber_moip'];
145
+ }
146
+ if ($errorMsg === false) {
147
+ if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
148
+ $errorMsg = $year . Mage::helper('transparente')->__('Seu Cartão está vencido, verifique se data está corretamente preenchida.');
149
+ }
150
+ }
151
+ if ($errorMsg === false) {
152
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
153
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
154
+ }
155
+ }
156
+ if ($errorMsg === false) {
157
+ if (!$additionaldata['installmentcount_moip']) {
158
+ $errorMsg = Mage::helper('transparente')->__('Selecione o número de parcelas para o pagamento.');
159
+ }
160
+ }
161
+ } elseif ($additionaldata['use_cofre'] == 1) {
162
+ if ($errorMsg === false) {
163
+ if (!$additionaldata['credit_card_ccv']) {
164
+ $errorMsg = Mage::helper('transparente')->__('Informe o código de segurança do cartão selecionado.');
165
+ }
166
+ }
167
+ if ($errorMsg === false) {
168
+ if (!$additionaldata['installmentcountcofre_moip']) {
169
+ $errorMsg = Mage::helper('transparente')->__('Selecione o número de parcelas para o pagamento.');
170
+ }
171
+ }
172
+ }
173
+ if ($errorMsg) {
174
+ Mage::throwException($errorMsg);
175
+ }
176
+ return $this;
177
+ }
178
+ public function validateCcNum($ccNumber)
179
+ {
180
+ $cardNumber = strrev($ccNumber);
181
+ $numSum = 0;
182
+ for ($i = 0; $i < strlen($cardNumber); $i++) {
183
+ $currentNum = substr($cardNumber, $i, 1);
184
+ if ($i % 2 == 1) {
185
+ $currentNum *= 2;
186
+ }
187
+ if ($currentNum > 9) {
188
+ $firstNum = $currentNum % 10;
189
+ $secondNum = ($currentNum - $firstNum) / 10;
190
+ $currentNum = $firstNum + $secondNum;
191
+ }
192
+ $numSum += $currentNum;
193
+ }
194
+ return ($numSum % 10 == 0);
195
+ }
196
+ public function getVerificationRegEx()
197
+ {
198
+ $verificationExpList = array(
199
+ 'VI' => '/^[0-9]{3}$/',
200
+ 'MC' => '/^[0-9]{3}$/',
201
+ 'AE' => '/^[0-9]{4}$/',
202
+ 'DC' => '/^[0-9]{3}$/',
203
+ 'EO' => '/^[0-9]{3}$/',
204
+ 'HI' => '/^[0-9]{4}$/'
205
+ );
206
+ return $verificationExpList;
207
+ }
208
+ public function getValidaCPF($cpf = null)
209
+ {
210
+ if (empty($cpf)) {
211
+ return false;
212
+ } else if ($cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') {
213
+ return false;
214
+ } else {
215
+ for ($t = 9; $t < 11; $t++) {
216
+ for ($d = 0, $c = 0; $c < $t; $c++) {
217
+ $d += $cpf{$c} * (($t + 1) - $c);
218
+ }
219
+ $d = ((10 * $d) % 11) % 10;
220
+ if ($cpf{$c} != $d) {
221
+ return false;
222
+ }
223
+ }
224
+ return true;
225
+ }
226
+ }
227
+ protected function _validateExpDate($expYear, $expMonth)
228
+ {
229
+ $date = Mage::app()->getLocale()->date();
230
+ if (!$expYear || !$expMonth || ($date->compareYear($expYear) == 1) || ($date->compareYear($expYear) == 0 && ($date->compareMonth($expMonth) == 1))) {
231
+ return false;
232
+ }
233
+ return true;
234
+ }
235
+ public function getApi()
236
+ {
237
+ $api = Mage::getModel('transparente/api');
238
+ return $api;
239
+ }
240
+ public function getOrderPlaceRedirectUrl()
241
+ {
242
+ $info = $this->getInfoInstance();
243
+ $quote = $info->getQuote();
244
+ $additionaldata = unserialize($info->getAdditionalData());
245
+ $json_order = $this->getApi()->getDados($quote);
246
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
247
+ $json_payment = $this->getApi()->getPaymentJsonCc($info, $quote);
248
+ $payment = $this->getApi()->generatePayment($json_payment, $IdMoip);
249
+ $additionaldataAfter = array(
250
+ 'token_moip' => $json_order,
251
+ 'response_moip' => $payment,
252
+ 'order_moip' => (string) $IdMoip
253
+ );
254
+ $additionaldata = array_merge($additionaldata, $additionaldataAfter);
255
+ $info->setAdditionalData(serialize($additionaldata))->save();
256
+ $info->setAdditionalInformation(serialize($additionaldata))->save();
257
+ Mage::log('json ' . $json_payment, null, 'MOIP_PaymentJsonSend.log', true);
258
+ $this->prepare();
259
+ if (isset($payment->errors)) {
260
+ foreach ($payment->errors as $key => $value) {
261
+ $erros = (string) $value->description . " " . $erros;
262
+ }
263
+ $session = Mage::getSingleton('checkout/session');
264
+ $session->setMoipError($erros);
265
+ Mage::log('json' . $json_payment, null, 'MOIP_ErrorPayment.log', true);
266
+ Mage::log('Erro no pagamento moip order' . $payment, null, 'MOIP_ErrorPayment.log', true);
267
+ return Mage::getUrl('transparente/standard/cancel', array(
268
+ '_secure' => true
269
+ ));
270
+ } else {
271
+ return Mage::getUrl('transparente/standard/redirect', array(
272
+ '_secure' => true
273
+ ));
274
+ }
275
+ }
276
+ public function getMethodJuros()
277
+ {
278
+ $quote = $this->getQuote();
279
+ $info = $quote->getPayment();
280
+ $additionaldata = unserialize($info->getAdditionalData());
281
+ if ($additionaldata['installmentcount_moip']) {
282
+ $parcela = $additionaldata['installmentcount_moip'];
283
+ } else {
284
+ $parcela = $additionaldata['installmentcountcofre_moip'];
285
+ }
286
+ if (!$quote->getFeeAmount())
287
+ $juros = $this->setJurosMoip($quote, $parcela);
288
+ return $this;
289
+ }
290
+ public function setJurosMoip($quote, $parcela)
291
+ {
292
+ if (!$quote->isVirtual()) {
293
+ $address = $quote->getShippingAddress();
294
+ } else {
295
+ $address = $quote->getBillingAddress();
296
+ }
297
+ $api = Mage::getSingleton('transparente/api');
298
+ $total_geral = $address->getGrandTotal();
299
+ if ($address->getFeeAmount() == 0) {
300
+ $address->setFeeAmount(0);
301
+ $address->setBaseFeeAmount(0);
302
+ $address->save();
303
+ $juros = $address->getFeeAmount();
304
+ $total = $total_geral - $juros;
305
+ Mage::log('json' . $total, null, 'MOIP_PaymentJsonSend.log', true);
306
+ $parcelamento = $api->getParcelamento();
307
+ $balance = $parcelamento[$parcela]['total_juros'];
308
+ $address->setFeeAmount($balance);
309
+ $address->setBaseFeeAmount($balance);
310
+ $address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
311
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
312
+ $address->save();
313
+ }
314
+ return $this;
315
+ }
316
+ }
app/code/local/MOIP/Transparente/Model/Adminhtml/Method/Tef.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_Tef extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_tef';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/form_tef';
7
+ protected $_infoBlockType = 'transparente/info_tef';
8
+ protected $_isGateway = true;
9
+ protected $_canAuthorize = true;
10
+ protected $_canCapture = true;
11
+ protected $_canCapturePartial = true;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+ protected $_canVoid = true;
15
+ protected $_canUseInternal = true;
16
+ protected $_canUseCheckout = true;
17
+ protected $_canUseForMultishipping = true;
18
+ protected $_canSaveCc = true;
19
+ protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+ public function assignData($data)
22
+ {
23
+ if (!($data instanceof Varien_Object)) {
24
+ $data = new Varien_Object($data);
25
+ }
26
+ $info = $this->getInfoInstance();
27
+ $additionaldata = array(
28
+ 'banknumber_moip' => $data->getMoipTefBanknumber()
29
+ );
30
+ $info->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
31
+ return $this;
32
+ }
33
+ public function prepareSave()
34
+ {
35
+ $info = $this->getInfoInstance();
36
+ return $this;
37
+ }
38
+ public function prepare()
39
+ {
40
+ $info = $this->getInfoInstance();
41
+ $additionaldata = unserialize($info->getAdditionalData());
42
+ $session = Mage::getSingleton('checkout/session');
43
+ $session->setMoipData($additionaldata);
44
+ }
45
+ public function validate()
46
+ {
47
+ parent::validate();
48
+ $info = $this->getInfoInstance();
49
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
50
+ $errorMsg = false;
51
+ $additionaldata = unserialize($info->getAdditionalData());
52
+ if ($errorMsg === false) {
53
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
54
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
55
+ }
56
+ }
57
+ if ($errorMsg) {
58
+ Mage::throwException($errorMsg);
59
+ }
60
+ return $this;
61
+ }
62
+ public function getApi()
63
+ {
64
+ $api = Mage::getModel('transparente/api');
65
+ return $api;
66
+ }
67
+ public function getOrderPlaceRedirectUrl()
68
+ {
69
+ $info = $this->getInfoInstance();
70
+ $quote = $info->getQuote();
71
+ $additionaldata = unserialize($info->getAdditionalData());
72
+ $json_order = $this->getApi()->getDados($quote);
73
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
74
+ $json_payment = $this->getApi()->getPaymentJsonTef($info, $quote);
75
+ $payment = $this->getApi()->generatePayment($json_payment, $IdMoip);
76
+ $additionaldataAfter = array(
77
+ 'token_moip' => $json_order,
78
+ 'response_moip' => $payment,
79
+ 'order_moip' => (string) $IdMoip
80
+ );
81
+ $additionaldata = array_merge($additionaldata, $additionaldataAfter);
82
+ $info->setAdditionalData(serialize($additionaldata))->save();
83
+ $info->setAdditionalInformation(serialize($additionaldata))->save();
84
+ Mage::log('json ' . $json_payment, null, 'MOIP_PaymentJsonSend.log', true);
85
+ $this->prepare();
86
+ if (isset($payment->errors)) {
87
+ foreach ($payment->errors as $key => $value) {
88
+ $erros = (string) $value->description . " " . $erros;
89
+ }
90
+ $session = Mage::getSingleton('checkout/session');
91
+ $session->setMoipError($erros);
92
+ Mage::log('json' . $json_payment, null, 'MOIP_ErrorPayment.log', true);
93
+ Mage::log('Erro no pagamento moip order' . $payment, null, 'MOIP_ErrorPayment.log', true);
94
+ return Mage::getUrl('transparente/standard/cancel', array(
95
+ '_secure' => true
96
+ ));
97
+ } else {
98
+ return Mage::getUrl('transparente/standard/redirect', array(
99
+ '_secure' => true
100
+ ));
101
+ }
102
+ }
103
+ }
app/code/local/MOIP/Transparente/Model/Api.php CHANGED
@@ -1,342 +1,621 @@
1
  <?php
2
- class MOIP_Transparente_Model_Api {
3
-
4
- const TOKEN_TEST = "3UNGHOJCLVXZVOYF85JGILKALZSROU2O";
5
- const KEY_TEST = "VX2MOP4AEXFQYHBYIWT0GINNVXFZO9TJCKJ6AWDR";
6
- const TOKEN_PROD = "FEE5P78NA6RZAHBNH3GLMWZFWRE7IU3D";
7
- const KEY_PROD = "Y8DIATTADUNVOSXKDN0JVDAQ1KU7UPJHEGPM7SBA";
8
-
9
- private $conta_transparente = null;
10
-
11
- public function getContaTransparente() {
12
- return $this->conta_transparente;
 
 
13
  }
14
-
15
- public function setContaTransparente($conta_transparente) {
16
- $this->conta_transparente = $conta_transparente;
17
  }
18
-
19
- public function getAmbiente() {
20
- return $this->ambiente;
21
  }
22
-
23
- public function setAmbiente($ambiente) {
24
- $this->ambiente = $ambiente;
25
  }
26
-
27
- public function getListaComissoesAvancadas($order, $meio) {
28
- $valor_comissao = 20/100;
29
-
30
- foreach ($order->getAllVisibleItems() as $key => $item)
31
- {
32
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
33
- $comissao_valor= $item->getPrice()-($item->getPrice()*$valor_comissao);
34
- $comissoes[] = array (
35
- 'Razao' => 'Produto '.$item->getName().' x '.$item->getQtyToInvoice().' sku: '. $item->getSku(),
36
- 'LoginMoIP' => $product->getAttributeText('loginmoip'),
37
- 'ValorFixo' => $comissao_valor
38
- );
39
  }
40
-
41
  return $comissoes;
42
  }
43
-
44
- public function generatePedido($data, $pgto) {
45
- if($pgto['credito_parcelamento'] == ""){
46
- $pgto['credito_parcelamento'] = 2;
 
 
 
 
 
 
 
47
  }
48
- $standard = Mage::getSingleton('transparente/standard');
49
- $parcelamento = $standard->getInfoParcelamento();
50
- $meio = $pgto["forma_pagamento"];
51
- $vcmentoboleto = $pgto["vcmentoboleto"];
52
- $forma_pgto = "";
53
- $validacao_nasp = $standard->getConfigData('validador_retorno');
54
- $url_retorno = Mage::getBaseUrl()."Transparente/standard/success/validacao/".$validacao_nasp."/";
55
- $order = Mage::getModel('sales/order')->loadByIncrementId($data['id_transacao']);
56
- $increment = $data['id_transacao'];
57
- $data['id_transacao'] = $order->getID();
58
- $amout = $order->getGrandTotal();
59
- $valorcompra = $amout;
60
- $vcmentoboleto = $standard->getConfigData('vcmentoboleto');
61
- $vcmento = date('c', strtotime("+" . $vcmentoboleto . " days"));
62
-
63
- if($pgto['tipoderecebimento'] =="0"):
64
- $tipoderecebimento = "Parcelado";
65
- else:
66
- $tipoderecebimento = "Avista";
67
- endif;
68
-
69
- $tipo_parcelamento = Mage::getSingleton('transparente/standard')->getConfigData('jurostipo');
70
-
71
- $comissionamento = Mage::getStoreConfig('moipall/mktplace/comissionamento');
72
-
73
-
74
-
75
-
76
-
77
- $rand = rand(1000,9999999999);
78
-
79
- $id_proprio = $rand.$pgto['conta_transparente'].'_'.$data['id_transacao'];
80
-
81
- # $xml = $this->generateXml($json);
82
- $xml = new SimpleXMLElement('<?xml version = "1.0" encoding = "UTF-8"?><EnviarInstrucao/>');
83
- $InstrucaoUnica = $xml->addChild('InstrucaoUnica');
84
- $InstrucaoUnica->addAttribute('TipoValidacao', 'Transparente');
85
- $InstrucaoUnica->addChild('Razao', 'Pagamento do Pedido #'.$increment);
86
- $Valores = $InstrucaoUnica->addChild('Valores');
87
- $Valor = $Valores->addChild('Valor', number_format($valorcompra, 2, '.', ''));
88
- $Valor->addAttribute('moeda', 'BRL');
89
- $Recebedor = $InstrucaoUnica->addChild('Recebedor');
90
- $Recebedor->addChild('LoginMoIP', $pgto['conta_transparente']);
91
- $Recebedor->addChild('Apelido', $pgto['apelido']);
92
-
93
-
94
- if($comissionamento){
95
- $Comissoes = $InstrucaoUnica->addChild('Comissoes');
96
- $Comissionamento = $Comissoes->addChild('Comissionamento');
97
- $Comissionamento->addChild('Razao', 'Pagamento do Pedido #'.$data['id_transacao'].' da Loja '.$pgto['apelido']);
98
- $Comissionado = $Comissionamento->addChild('Comissionado');
99
- $Comissionado->addChild('LoginMoIP', Mage::getStoreConfig('moipall/mktplace/logincomissionamento'));
100
- $Comissionamento->addChild('ValorPercentual', Mage::getStoreConfig('moipall/mktplace/porc_comissionamento'));
101
- if(Mage::getStoreConfig('moipall/mktplace/pagadordataxa')){
102
- $PagadorTaxa = $Comissoes->addChild('PagadorTaxa');
103
- $PagadorTaxa->addChild('LoginMoIP',Mage::getStoreConfig('moipall/mktplace/logincomissionamento'));
104
- }
105
  }
106
- /* suprimido para comissionamento simples
107
- $comissioes_avancadas = $this->getListaComissoesAvancadas($order, $pgto['forma_pagamento']);
108
- $Comissoes = $InstrucaoUnica->addChild('Comissoes');
109
- foreach ($comissioes_avancadas as $key => $value) {
110
- $Comissionamento = $Comissoes->addChild('Comissionamento');
111
- $Comissionamento->addChild('Razao', $value['Razao']);
112
- $Comissionado = $Comissionamento->addChild('Comissionado');
113
- $Comissionado->addChild('LoginMoIP', $value['LoginMoIP']);
114
- $Comissionamento->addChild('ValorFixo', $value['ValorFixo']);
115
  }
116
- */
117
- $InstrucaoUnica->addChild('IdProprio', $id_proprio);
118
- $Pagador = $InstrucaoUnica->addChild('Pagador');
119
- $Pagador->addChild('Nome',$data['pagador_nome']);
120
- $Pagador->addChild('Email',$data['pagador_email']);
121
- $Pagador->addChild('IdPagador',$data['pagador_email']);
122
- $EnderecoCobranca = $Pagador->addChild('EnderecoCobranca');
123
- $EnderecoCobranca->addChild('Logradouro', $data['pagador_logradouro']);
124
- $EnderecoCobranca->addChild('Numero', 'n '.$data['pagador_numero']);
125
- $EnderecoCobranca->addChild('Complemento', $data['pagador_complemento']);
126
- $EnderecoCobranca->addChild('Bairro', $data['pagador_bairro']);
127
- $EnderecoCobranca->addChild('Cidade', $data['pagador_cidade']);
128
- $EnderecoCobranca->addChild('Estado', $data['pagador_estado']);
129
- $EnderecoCobranca->addChild('Pais', 'BRA');
130
- $EnderecoCobranca->addChild('CEP', $data['pagador_cep']);
131
- $EnderecoCobranca->addChild('TelefoneFixo', $data['pagador_ddd'] . $data['pagador_telefone']);
132
- $Parcelamentos = $InstrucaoUnica->addChild('Parcelamentos');
133
- if($tipo_parcelamento == 1){
134
- $max_parcelas = $parcelamento['c_ate1'];
135
- $min_parcelas = $parcelamento['c_de1'];
136
- $juros = $parcelamento['c_juros1'];
137
- if($max_parcelas == 12){
138
- $Parcelamento = $Parcelamentos->addChild('Parcelamento');
139
- $Parcelamento->addChild('MinimoParcelas',$min_parcelas);
140
- $Parcelamento->addChild('MaximoParcelas',$max_parcelas);
141
- $Parcelamento->addChild('Recebimento',$tipoderecebimento);
142
- $Parcelamento->addChild('Juros',$juros);
143
- } else{
144
- $Parcelamento = $Parcelamentos->addChild('Parcelamento');
145
- $Parcelamento->addChild('MinimoParcelas',$min_parcelas);
146
- $Parcelamento->addChild('MaximoParcelas',$max_parcelas);
147
- $Parcelamento->addChild('Recebimento',$tipoderecebimento);
148
- $Parcelamento->addChild('Juros',$juros);
149
-
150
- $Parcelamento = $Parcelamentos->addChild('Parcelamento');
151
- $Parcelamento->addChild('MinimoParcelas',$max_parcelas+1);
152
- $Parcelamento->addChild('MaximoParcelas',12);
153
- $Parcelamento->addChild('Recebimento',$tipoderecebimento);
154
- $Parcelamento->addChild('Juros',1.99);
155
- }
156
  } else {
157
- for ($i=2; $i <= 12; $i++) {
158
- $Parcelamento = $Parcelamentos->addChild('Parcelamento');
159
- $juros_parcela = 's_juros'.$i;
160
- $Parcelamento->addChild('MinimoParcelas',$i);
161
- $Parcelamento->addChild('MaximoParcelas',$i);
162
- $Parcelamento->addChild('Recebimento',$tipoderecebimento);
163
- $Parcelamento->addChild('Juros',$parcelamento[$juros_parcela]);
164
- $Parcelamento->addChild('Repassar','true');
165
- }
 
 
 
 
 
 
 
 
166
  }
167
- $FormasPagamento = $InstrucaoUnica->addChild('FormasPagamento');
168
- $FormasPagamento->addChild('FormaPagamento', 'CartaoCredito' );
169
- $FormasPagamento->addChild('FormaPagamento', 'CartaoDebito' );
170
- $FormasPagamento->addChild('FormaPagamento', 'DebitoBancario' );
171
- $FormasPagamento->addChild('FormaPagamento', 'BoletoBancario' );
172
- $FormasPagamento->addChild('FormaPagamento', 'FinanciamentoBancario');
173
- if ($meio == "BoletoBancario"){
174
- $Boleto_xml = $InstrucaoUnica->addChild('Boleto');
175
- $Boleto_xml->addChild('Instrucao1', 'Pagamento do Pedido #'.$increment);
176
- $Boleto_xml->addChild('Instrucao2', 'NÃO RECEBER APÓS O VENCIMENTO');
177
- $Boleto_xml->addChild('Instrucao3', '+ Info em: '.Mage::getBaseUrl());
178
- $Boleto_xml->addChild('DataVencimento');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
- $InstrucaoUnica->addChild('URLNotificacao', $url_retorno);
181
- $request = $xml->asXML();
182
- $request = utf8_decode($request);
183
- $request = utf8_encode($request);
184
- #var_dump($request); die();
185
- return $request;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
- public function generateUrl($token) {
188
- if ($this->getAmbiente() == "teste")
189
- $url = $token;
 
 
 
 
 
 
 
190
  else
191
- $url = $token;
192
- return $url;
193
  }
194
-
195
- public function getParcelamentoComposto($valor) {
196
- $standard = Mage::getSingleton('transparente/standard');
197
- $parcelamento = $standard->getInfoParcelamento();
198
- $parcelas = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  $json_parcelas = array();
200
- $juros = array();
201
- $primeiro = 1;
202
- $max_div = $valor/(int)Mage::getSingleton('transparente/standard')->getConfigData('valorminimoparcela');
203
- $valor_juros= Mage::getSingleton('transparente/standard')->getConfigData('parcelamento_c_juros1');
204
-
205
- if($valor <= Mage::getSingleton('transparente/standard')->getConfigData('valorminimoparcela')){
206
- $json_parcelas[1] = array(
207
- 'parcela' => Mage::helper('core')->currency($valor, true, false),
208
- 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
209
- 'juros' => 0
210
- );
211
- $json_parcelas = Mage::helper('core')->jsonEncode((object)$json_parcelas);
212
- return $json_parcelas;
 
 
 
 
 
 
 
213
  }
214
 
215
- if($parcelamento['c_ate1'] < $max_div){
216
- $max_div = $parcelamento['c_ate1'];
 
 
 
 
 
 
 
 
 
 
217
  }
218
-
219
- for ($i=1; $i <= $max_div; $i++) {
220
- if($i > 1){
221
- $total_parcelado[$i] = $this->getJurosComposto($valor, $valor_juros, $i)*$i;
222
- $parcelas[$i] = $this->getJurosComposto($valor, $valor_juros, $i);
223
- $juros[$i] = $valor_juros;
224
- }
225
- else {
226
- $total_parcelado[$i] = $valor;
227
- $parcelas[$i] = $valor*$i;
228
- $juros[$i] = 0;
229
- }
230
- if($i <= Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax')){
231
- $json_parcelas[$i] = array(
232
- 'parcela' => Mage::helper('core')->currency($parcelas[$i], true, false),
233
- 'total_parcelado' => Mage::helper('core')->currency($total_parcelado[$i], true, false),
234
- 'juros' => $juros[$i]
235
- );
236
- $primeiro++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
- }
239
- if($primeiro < 12 && $primeiro < ($valor/(int)Mage::getSingleton('transparente/standard')->getConfigData('valorminimoparcela')) )
240
- {
241
- while ($primeiro <= 12) {
242
- $total_parcelado[$primeiro] = "";
243
- $parcelas[$primeiro] = $this->getJurosComposto($valor, '2.99', $primeiro);
244
- $total_parcelado[$primeiro] = $parcelas[$primeiro]*$primeiro;
245
- $juros[$primeiro] = '2.99';
246
-
247
- $json_parcelas[$primeiro] = array(
248
- 'parcela' => Mage::helper('core')->currency($parcelas[$primeiro], true, false),
249
- 'total_parcelado' => Mage::helper('core')->currency($total_parcelado[$primeiro], true, false),
250
- 'juros' => '2.99'
251
- );
252
- $primeiro++;
253
- }
254
- }
255
- $json_parcelas = Mage::helper('core')->jsonEncode((object)$json_parcelas);
256
- return $json_parcelas;
257
 
 
 
 
 
 
 
 
258
  }
259
 
260
- public function getParcelamentoSimples($valor) {
261
- $standard = Mage::getSingleton('transparente/standard');
262
- $parcelamento = $standard->getInfoParcelamento();
263
- $parcelas = array();
264
  $juros = array();
265
- $primeiro = 1;
266
- $max_div = (int)($valor/Mage::getSingleton('transparente/standard')->getConfigData('valorminimoparcela'));
267
 
268
- if($valor <= Mage::getSingleton('transparente/standard')->getConfigData('valorminimoparcela')){
269
- $json_parcelas[1] = array(
270
- 'parcela' => Mage::helper('core')->currency($valor, true, false),
271
- 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
272
- 'juros' => 0
273
- );
274
- $json_parcelas = Mage::helper('core')->jsonEncode((object)$json_parcelas);
275
- return $json_parcelas;
276
- }
277
- if(Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax') > $max_div){
278
- $max_div = $max_div;
279
- } else {
280
- $max_div = Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax');
281
- }
282
 
283
- for ($i=1; $i <= $max_div; $i++) {
284
- $juros_parcela = 's_juros'.$i;
285
 
286
- if($i > 1){
287
- $taxa = $parcelamento[$juros_parcela] / 100;
288
- $valor_add = $valor * $taxa;
289
- $total_parcelado[$i] = $valor + $valor_add;
290
- $parcelas[$i] = ($valor + $valor_add)/$i;
291
- $juros[$i] = $parcelamento[$juros_parcela];
292
- }
293
- else {
294
- $total_parcelado[$i] = $valor;
295
- $parcelas[$i] = $valor*$i;
296
- $juros[$i] = 0;
297
- }
298
- if($i <= Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax')){
299
- $json_parcelas[$i] = array(
300
- 'parcela' => Mage::helper('core')->currency($parcelas[$i], true, false),
301
- 'total_parcelado' => Mage::helper('core')->currency($total_parcelado[$i], true, false),
302
- 'juros' => $juros[$i]
303
- );
304
- }
305
- }
306
- $json_parcelas = Mage::helper('core')->jsonEncode((object)$json_parcelas);
307
- return $json_parcelas;
308
 
309
- }
 
310
 
311
- public function getParcelamento($valor) {
 
312
 
313
- $tipo_parcelamento = Mage::getSingleton('transparente/standard')->getConfigData('jurostipo');
 
314
 
315
- if($tipo_parcelamento == 1){
316
- $tipo = $this->getParcelamentoComposto($valor);
317
- } else {
318
- $tipo = $this->getParcelamentoSimples($valor);
319
- }
320
 
321
- return $tipo;
322
 
323
- }
324
 
325
- public function getJurosSimples($valor, $juros, $parcela) {
326
 
327
- return $valParcela;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  }
329
 
330
- public function getJurosComposto($valor, $juros, $parcela) {
331
- $principal = $valor;
332
- if($juros != 0){
333
- $taxa = $juros/100;
334
- $valParcela = ($principal * $taxa)/(1 - (pow(1/(1+$taxa), $parcela)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  } else {
336
- $valParcela = $principal/$parcela;
337
  }
 
338
 
339
- return $valParcela;
340
  }
341
-
342
  }
 
1
  <?php
2
+ class MOIP_Transparente_Model_Api
3
+ {
4
+ const TOKEN_TEST = "8OKLQFT5XQZXU7CKXX43GPJOMIJPMSMF";
5
+ const KEY_TEST = "NT0UKOXS4ALNSVOXJVNXVKRLEOQCITHI5HDKW3LI";
6
+ const ENDPOINT_TEST = "https://sandbox.moip.com.br/v2/";
7
+ const TOKEN_PROD = "EVCHBAUMKM0U4EE4YXIA8VMC0KBEPKN2";
8
+ const KEY_PROD = "4NECP62EKI8HRSMN3FGYOZNVYZOMBDY0EQHK9MHO";
9
+ const ENDPOINT_PROD = "https://api.moip.com.br/v2/";
10
+
11
+
12
+ public function getPayment()
13
+ {
14
+ return $this->getQuote()->getPayment();
15
  }
16
+ public function getSession()
17
+ {
18
+ return Mage::getSingleton('transparente/session');
19
  }
20
+ public function getCheckout()
21
+ {
22
+ return Mage::getSingleton('checkout/session');
23
  }
24
+ public function getQuote()
25
+ {
26
+ return $this->getCheckout()->getQuote();
27
  }
28
+ public function getListaComissoesAvancadas($order, $meio)
29
+ {
30
+ $valor_comissao = 20 / 100;
31
+ foreach ($order->getAllVisibleItems() as $key => $item) {
32
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
33
+ $comissao_valor = $item->getPrice() - ($item->getPrice() * $valor_comissao);
34
+ $comissoes[] = array(
35
+ 'Razao' => 'Produto ' . $item->getName() . ' x ' . $item->getQtyToInvoice() . ' sku: ' . $item->getSku(),
36
+ #'LoginMoIP' => $product->getAttributeText('loginmoip'),
37
+ 'ValorFixo' => $comissao_valor
38
+ );
 
 
39
  }
 
40
  return $comissoes;
41
  }
42
+ public function generatePayment($json, $IdMoip)
43
+ {
44
+ $documento = 'Content-Type: application/json; charset=utf-8';
45
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
46
+ $url = self::ENDPOINT_TEST."orders/{$IdMoip}/payments";
47
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_dev');
48
+ $header = "Authorization: OAuth " . $oauth;
49
+ } else {
50
+ $url = self::ENDPOINT_PROD."orders/{$IdMoip}/payments";
51
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod');
52
+ $header = "Authorization: OAuth " . $oauth;
53
  }
54
+ $result = array();
55
+ $ch = curl_init();
56
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
57
+ curl_setopt($ch, CURLOPT_URL, $url);
58
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
59
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
60
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
61
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
62
+ $header,
63
+ $documento
64
+ ));
65
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
66
+ $responseBody = curl_exec($ch);
67
+ $info_curl = curl_getinfo($ch);
68
+ curl_close($ch);
69
+ $this->generateLog("------ Geração do Pagamento ------", 'MOIP_Order.log');
70
+ $this->generateLog("------ Json Enviado do Pagamento ------", 'MOIP_Order.log');
71
+ $this->generateLog($json, 'MOIP_Order.log');
72
+ $this->generateLog($oauth, 'MOIP_Order.log');
73
+ $this->generateLog("------ Resposta do Pagamento ------", 'MOIP_Order.log');
74
+ $this->generateLog($responseBody, 'MOIP_Order.log');
75
+ $this->generateLog("------ CurlInfo do Pagamento ------", 'MOIP_Order.log');
76
+ $this->generateLog(json_encode($info_curl), 'MOIP_Order.log');
77
+
78
+ $decode = json_decode($responseBody);
79
+ return $decode;
80
+ }
81
+ public function getListaProdutos($quote)
82
+ {
83
+ $items = $quote->getallvisibleitems();
84
+ $itemcount = count($items);
85
+ $produtos = array();
86
+ foreach ($items as $itemId => $item) {
87
+ if ($item->getPrice() > 0) {
88
+ $produtos[] = array(
89
+ 'product' => $item->getName(),
90
+ 'quantity' => $item->getQty(),
91
+ 'detail' => $item->getSku(),
92
+ 'price' => number_format($item->getPrice(), 2, '', '')
93
+ );
94
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
+ return $produtos;
97
+ }
98
+ public function getAuditOrder($quote, $shipping)
99
+ {
100
+ $grandTotalProd = null;
101
+ foreach ($quote->getAllItems() as $item) {
102
+ $grandTotalProd += $item->getPriceInclTax() * $item->getQty();
 
 
103
  }
104
+ $totals = $quote->getTotals();
105
+ $grandTotal = $totals['grand_total']->getValue();
106
+ $total_cal = $grandTotalProd + $shipping;
107
+ if ($total_cal != $grandTotal) {
108
+ if ($total_cal > $grandTotal) {
109
+ $diff = $total_cal - $grandTotal;
110
+ $return_values = array(
111
+ "shipping" => number_format($shipping, 2, '', ''),
112
+ "discount" => number_format($diff, 2, '', ''),
113
+ "addition" => 0
114
+ );
115
+ } else {
116
+ $diff = $grandTotal - $total_cal;
117
+ $return_values = array(
118
+ "shipping" => number_format($shipping, 2, '', ''),
119
+ "discount" => 0,
120
+ "addition" => number_format($diff, 2, '', '')
121
+ );
122
+ }
123
+ } else {
124
+ $return_values = array(
125
+ "shipping" => number_format($shipping, 2, '', ''),
126
+ "discount" => 0,
127
+ "addition" => 0
128
+ );
129
+ }
130
+ return $return_values;
131
+ }
132
+ public function getDados($quote)
133
+ {
134
+ $id_proprio = $quote->getReservedOrderId();
135
+
136
+
137
+ if ($quote->getShippingAddress()) {
138
+ $a = $quote->getShippingAddress();
139
+ $b = $quote->getBillingAddress();
140
+ $this->generateLog($b->Debug(), 'MOIP_OrderDebug.log');
141
+
 
 
142
  } else {
143
+ $a = $quote->getShippingAddress();
144
+ $b = $quote->getBillingAddress();
145
+ $this->generateLog($b->Debug(), 'MOIP_OrderDebug.log');
146
+ }
147
+ $email = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
148
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
149
+ $cep = substr(preg_replace("/[^0-9]/", "", $b->getPostcode()) . '00000000', 0, 8);
150
+ $billing_cep = substr(preg_replace("/[^0-9]/", "", $a->getPostcode()) . '00000000', 0, 8);
151
+ $dob = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('Y-MM-dd');
152
+ $dob = explode('-',$dob);
153
+ $dob_day = $dob[2];
154
+ if(is_null($dob_day)){
155
+ $dob_day = 01;
156
+ }
157
+ $dob_month = $dob[1];
158
+ if(is_null($dob_month)){
159
+ $dob_month = 01;
160
  }
161
+ $dob_year = $dob[0];
162
+ if($dob_year < 1900){
163
+ $dob_year += 1900;
164
+ }
165
+ $dob = $dob_year."-".$dob_month."-".$dob_day;
166
+
167
+ $taxvat = $quote->getCustomerTaxvat();
168
+ $taxvat = preg_replace("/[^0-9]/", "", $taxvat);
169
+ $website_id = Mage::app()->getWebsite()->getId();
170
+ $website_name = Mage::app()->getWebsite()->getName();
171
+ $store_name = Mage::app()->getStore()->getName();
172
+ $data = array(
173
+ 'id_transacao' => $quote->getId(),
174
+ 'nome' => 'Pagamento a ' . $website_name,
175
+ 'nome' => $b->getFirstname() . ' ' . $b->getLastname(),
176
+ 'email' => strtolower($email),
177
+ 'ddd' => $this->getNumberOrDDD($b->getTelephone(), true),
178
+ 'telefone' => $this->getNumberOrDDD($b->getTelephone()),
179
+ 'mobile' => $this->getNumberOrDDD($b->getFax()),
180
+ 'mobile_ddd' => $this->getNumberOrDDD($b->getFax(), true),
181
+ 'shipping_logradouro' => $b->getStreet(1),
182
+ 'shipping_numero' => $this->getNumEndereco($b->getStreet(2), $b->getStreet(1)),
183
+ 'shipping_complemento' => $b->getStreet(3),
184
+ 'shipping_bairro' => $b->getStreet(4),
185
+ 'shipping_cep' => $cep,
186
+ 'shipping_cidade' => $b->getCity(),
187
+ 'shipping_estado' => strtoupper($b->getRegionCode()),
188
+ 'shipping_pais' => $b->getCountry(),
189
+ 'billing_logradouro' => $a->getStreet(1),
190
+ 'billing_numero' => $this->getNumEndereco($a->getStreet(2), $a->getStreet(1)),
191
+ 'billing_complemento' => $a->getStreet(3),
192
+ 'billing_bairro' => $a->getStreet(4),
193
+ 'billing_cep' => $billing_cep,
194
+ 'billing_cidade' => $a->getCity(),
195
+ 'billing_estado' => strtoupper($a->getRegionCode()),
196
+ 'billing_pais' => $a->getCountry(),
197
+ 'cpf' => $taxvat,
198
+ 'celular' => $this->getNumberOrDDD($b->getFax(), true) . '' . $this->getNumberOrDDD($b->getFax()),
199
+ 'sexo' => '',
200
+ 'data_nascimento' => $dob,
201
+ 'frete' => number_format($b->getShippingAmount(), 2, '', '')
202
+ );
203
+ $autida_values = $this->getAuditOrder($quote, $b->getShippingAmount());
204
+ $json_order = array(
205
+ "ownId" => $id_proprio,
206
+ "amount" => array(
207
+ "currency" => "BRL",
208
+ "subtotals" => $autida_values
209
+ ),
210
+ "items" => $this->getListaProdutos($quote),
211
+ "customer" => array(
212
+ "ownId" => $data['email'],
213
+ "fullname" => $data['nome'],
214
+ "email" => $data['email'],
215
+ "birthDate" => $data['data_nascimento'],
216
+ "taxDocument" => array(
217
+ "type" => "CPF",
218
+ "number" => $data['cpf']
219
+ ),
220
+ "phone" => array(
221
+ "countryCode" => "55",
222
+ "areaCode" => $data['ddd'],
223
+ "number" => $data['telefone']
224
+ ),
225
+ "mobile" => array(
226
+ "countryCode" => "55",
227
+ "areaCode" => $data['mobile_ddd'],
228
+ "number" => $data['mobile']
229
+ ),
230
+ "shippingAddress" => array(
231
+ "street" => $data['shipping_logradouro'],
232
+ "streetNumber" => $data['shipping_numero'],
233
+ "complement" => $data['shipping_complemento'],
234
+ "district" => $data['shipping_bairro'],
235
+ "city" => $data['shipping_cidade'],
236
+ "state" => $data['shipping_estado'],
237
+ "country" => "BRA",
238
+ "zipCode" => $data['shipping_cep']
239
+ ),
240
+ "billingAddress" => array(
241
+ "street" => $data['billing_logradouro'],
242
+ "streetNumber" => $data['billing_numero'],
243
+ "complement" => $data['billing_complemento'],
244
+ "district" => $data['billing_bairro'],
245
+ "city" => $data['billing_cidade'],
246
+ "state" => $data['billing_estado'],
247
+ "country" => "BRA",
248
+ "zipCode" => $data['billing_cep']
249
+ )
250
+ )
251
+ );
252
+ $json_order = Mage::helper('core')->jsonEncode((object) $json_order);
253
+ $this->generateLog("------ Geração da order #{$id_proprio} ------", 'MOIP_Order.log');
254
+ $this->generateLog("------ Json Enviado da order ------", 'MOIP_Order.log');
255
+ $this->generateLog($json_order, 'MOIP_Order.log');
256
+ return $json_order;
257
+ }
258
+ public function getOrderIdMoip($json_order)
259
+ {
260
+ $session = $this->getCheckout();
261
+ $documento = 'Content-Type: application/json; charset=utf-8';
262
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
263
+ $url = self::ENDPOINT_TEST."orders/";
264
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_dev');
265
+ $header = "Authorization: OAuth " . $oauth;
266
+ } else {
267
+ $url = self::ENDPOINT_PROD."orders/";
268
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod');
269
+ $header = "Authorization: OAuth " . $oauth;
270
  }
271
+ $result = array();
272
+ $ch = curl_init();
273
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
274
+ curl_setopt($ch, CURLOPT_URL, $url);
275
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
276
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
277
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $json_order);
278
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
279
+ $header,
280
+ $documento
281
+ ));
282
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
283
+ $responseBody = curl_exec($ch);
284
+ $info_curl = curl_getinfo($ch);
285
+ curl_close($ch);
286
+ $decode = json_decode($responseBody);
287
+ $this->generateLog($header, 'MOIP_Order.log');
288
+ $this->generateLog("------ Resposta da Order ------", 'MOIP_Order.log');
289
+ $this->generateLog($responseBody, 'MOIP_Order.log');
290
+ $this->generateLog("------ CurlInfo da Order ------", 'MOIP_Order.log');
291
+ $this->generateLog(json_encode($info_curl), 'MOIP_Order.log');
292
+ return $decode->id;
293
  }
294
+ public function getNumEndereco($endereco, $enderecob)
295
+ {
296
+ $numEnderecoDefault = '0';
297
+ if (!$endereco)
298
+ $endereco = $enderecob;
299
+ else
300
+ $endereco = $endereco;
301
+ $numEndereco = trim(preg_replace("/[^0-9]/", "", $endereco));
302
+ if ($numEndereco)
303
+ return ($numEndereco);
304
  else
305
+ return ($numEnderecoDefault);
 
306
  }
307
+ public function getPosSeparador($endereco)
308
+ {
309
+ $posSeparador = strpos($endereco, ',');
310
+ if ($posSeparador === false)
311
+ $posSeparador = strpos($endereco, '-');
312
+ return ($posSeparador);
313
+ }
314
+ public function getNumberOrDDD($param_telefone, $param_ddd = false)
315
+ {
316
+ $cust_ddd = '11';
317
+ $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
318
+ $st = strlen($cust_telephone) - 8;
319
+ if ($st > 0) {
320
+ $cust_ddd = substr($cust_telephone, 0, 2);
321
+ $cust_telephone = substr($cust_telephone, $st, 8);
322
+ }
323
+ if ($param_ddd === false) {
324
+ $retorno = $cust_telephone;
325
+ } else {
326
+ $retorno = $cust_ddd;
327
+ }
328
+ return $retorno;
329
+ }
330
+ public function getPaymentJsonCc($info, $quote)
331
+ {
332
+ $additionaldata = unserialize($info->getAdditionalData());
333
+
334
+ $dob = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('Y-MM-dd');
335
+ $dob = explode('-',$dob);
336
+ $dob_day = $dob[2];
337
+ if(is_null($dob_day)){
338
+ $dob_day = 01;
339
+ }
340
+ $dob_month = $dob[1];
341
+ if(is_null($dob_month)){
342
+ $dob_month = 01;
343
+ }
344
+ $dob_year = $dob[0];
345
+ if($dob_year < 1900){
346
+ $dob_year += 1900;
347
+ }
348
+
349
+ $b = $quote->getBillingAddress();
350
+ $dob = $dob_year."-".$dob_month."-".$dob_day;
351
+ $ddd = $this->getNumberOrDDD($b->getTelephone(), true);
352
+ $telefone = $this->getNumberOrDDD($b->getTelephone());
353
+ if ($additionaldata['use_cofre'] == 0) {
354
+ $json = array(
355
+ "installmentCount" => $additionaldata['installmentcount_moip'],
356
+ "fundingInstrument" => array(
357
+ "method" => "CREDIT_CARD",
358
+ "creditCard" => array(
359
+ "hash" => $additionaldata['hash_moip'],
360
+ "holder" => array(
361
+ "fullname" => $additionaldata['fullname_moip'],
362
+ "birthdate" => $dob,
363
+ "taxDocument" => array(
364
+ "type" => "CPF",
365
+ "number" => $additionaldata['taxdocument_moip']
366
+ ),
367
+ "phone" => array(
368
+ "countryCode" => "55",
369
+ "areaCode" => $ddd,
370
+ "number" => $telefone
371
+ )
372
+ )
373
+ )
374
+ )
375
+ );
376
+ } elseif ($additionaldata['use_cofre'] == 1) {
377
+ $json = array(
378
+ "installmentCount" => $additionaldata['installmentcountcofre_moip'],
379
+ "fundingInstrument" => array(
380
+ "method" => "CREDIT_CARD",
381
+ "creditCard" => array(
382
+ "id" => $additionaldata['credit_card_cofre_nb'],
383
+ "cvc" => $additionaldata['credit_card_ccv']
384
+ )
385
+ )
386
+ );
387
+ }
388
+ $json = Mage::helper('core')->jsonEncode((object) $json);
389
+ return $json;
390
+ }
391
+ public function getPaymentJsonBoleto($info, $quote)
392
+ {
393
+ $additionaldata = unserialize($info->getAdditionalData());
394
+ $json = array(
395
+ "fundingInstrument" => array(
396
+ "method" => "BOLETO",
397
+ "boleto" => array(
398
+ "expirationDate" => $this->getDataVencimento(Mage::getStoreConfig('payment/moip_boleto/vcmentoboleto')),
399
+ "instructionLines" => array(
400
+ "first" => "Pagamento do pedido na loja: " . Mage::getStoreConfig('payment/moip_transparente_standard/apelido'),
401
+ "second" => "Não Receber após o Vencimento",
402
+ "third" => "+ Info em: " . Mage::getBaseUrl()
403
+ )
404
+ )
405
+ )
406
+ );
407
+ $json = Mage::helper('core')->jsonEncode((object) $json);
408
+ return $json;
409
+ }
410
+ public function getPaymentJsonTef($info, $quote)
411
+ {
412
+ $additionaldata = unserialize($info->getAdditionalData());
413
+ $json = array(
414
+ "fundingInstrument" => array(
415
+ "method" => "ONLINE_BANK_DEBIT",
416
+ "onlineBankDebit" => array(
417
+ "bankNumber" => $additionaldata['banknumber_moip'],
418
+ "expirationDate" => $this->getDataVencimento(Mage::getStoreConfig('payment/tef_boleto/vcmentotef')),
419
+ "returnUri" => Mage::getBaseUrl()
420
+ )
421
+ )
422
+ );
423
+ $json = Mage::helper('core')->jsonEncode((object) $json);
424
+ return $json;
425
+ }
426
+ public function getDataVencimento($NDias)
427
+ {
428
+ $DataAct = date("Ymd");
429
+ $d = new DateTime($DataAct);
430
+ $t = $d->getTimestamp();
431
+ for ($i = 0; $i < $NDias; $i++) {
432
+ $addDay = 86400;
433
+ $nextDay = date('w', ($t + $addDay));
434
+ if ($nextDay == 0 || $nextDay == 6) {
435
+ $i--;
436
+ }
437
+ $t = $t + $addDay;
438
+ }
439
+ $d->setTimestamp($t);
440
+ return $d->format('Y-m-d');
441
+ }
442
+
443
+ public function getParcelamento(){
444
+ $valor = $this->getQuote()->getGrandTotal();
445
+ $config_parcelas_juros = $this->getInfoParcelamentoJuros();
446
+ $config_parcelas_minimo = $this->getInfoParcelamentoMinimo();
447
+ $config_parcelas_maximo = Mage::getStoreConfig('payment/moip_cc/nummaxparcelamax');
448
  $json_parcelas = array();
449
+ $count = 0;
450
+ $json_parcelas[0] = array(
451
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
452
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
453
+ 'total_juros' => 0,
454
+ 'juros' => 0
455
+ );
456
+ $json_parcelas[1] = array(
457
+ 'parcela' => Mage::helper('core')->currency($valor, true, false),
458
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
459
+ 'total_juros' => 0,
460
+ 'juros' => 0
461
+ );
462
+
463
+
464
+ $max_div = (int)$valor/$config_parcelas_minimo;
465
+ if($max_div > $config_parcelas_maximo) {
466
+ $max_div = $config_parcelas_maximo;
467
+ } elseif ($max_div > 12) {
468
+ $max_div = 12;
469
  }
470
 
471
+ if(Mage::getStoreConfig('payment/moip_cc/parcelas_avancadas') == 1){
472
+ if($valor > Mage::getStoreConfig('payment/moip_cc/condicional_3_sem_juros') ){
473
+ $limite = Mage::getStoreConfig('payment/moip_cc/condicional_3_max_parcela');;
474
+ } elseif ($valor >= Mage::getStoreConfig('payment/moip_cc/condicional_2_sem_juros')) {
475
+ $limite = Mage::getStoreConfig('payment/moip_cc/condicional_2_max_parcela');
476
+ } elseif ($valor <= Mage::getStoreConfig('payment/moip_cc/condicional_1_sem_juros')) {
477
+ $limite = Mage::getStoreConfig('payment/moip_cc/condicional_1_max_parcela');
478
+ } else {
479
+ $limite = Mage::getStoreConfig('nummaxparcelamax');
480
+ }
481
+ } else {
482
+ $limite = $max_div;
483
  }
484
+
485
+
486
+ foreach ($config_parcelas_juros as $key => $value) {
487
+ if($count <= $max_div){
488
+ if($value > 0){
489
+ if(Mage::getStoreConfig('payment/moip_cc/tipodejuros') == 1) {
490
+ if($limite >= $count && Mage::getStoreConfig('payment/moip_cc/parcelas_avancadas')){
491
+ $parcela = $this->getJurosComposto($valor, 0, $count);
492
+ } else {
493
+ $parcela = $this->getJurosComposto($valor, $value, $count);
494
+ }
495
+ } else {
496
+ if($limite >= $count && Mage::getStoreConfig('payment/moip_cc/parcelas_avancadas')){
497
+ $parcela = $this->getJurosSimples($valor, 0, $count);
498
+ } else {
499
+ $parcela = $this->getJurosSimples($valor, $value, $count);
500
+ }
501
+ }
502
+
503
+ $total_parcelado = $parcela * $count;
504
+ $juros = $value;
505
+ if($parcela > 5 && $parcela > $config_parcelas_minimo){
506
+ $json_parcelas[$count] = array(
507
+ 'parcela' => Mage::helper('core')->currency($parcela, true, false),
508
+ 'total_parcelado' => Mage::helper('core')->currency($total_parcelado, true, false),
509
+ 'total_juros' => $total_parcelado - $valor,
510
+ 'juros' => $juros,
511
+ );
512
+ }
513
+ } else {
514
+ if($valor > 0 && $count > 0){
515
+ $json_parcelas[$count] = array(
516
+ 'parcela' => Mage::helper('core')->currency(($valor/$count), true, false),
517
+ 'total_parcelado' => Mage::helper('core')->currency($valor, true, false),
518
+ 'total_juros' => 0,
519
+ 'juros' => 0
520
+ );
521
+ }
522
  }
523
+ }
524
+
525
+ $count++;
526
+ }
527
+ foreach ($json_parcelas as $key => $value) {
528
+ if($key > $limite)
529
+ unset($json_parcelas[$key]);
530
+ }
531
+
532
+ return $json_parcelas;
533
+ }
534
+ public function getJurosComposto($valor, $juros, $parcela)
535
+ {
536
+ $principal = $valor;
537
+ $taxa = $juros/100;
538
+ $valParcela = ($principal * $taxa) / (1 - (pow(1 / (1 + $taxa), $parcela)));
539
+ return $valParcela;
540
+ }
 
541
 
542
+ public function getJurosSimples($valor, $juros, $parcela)
543
+ {
544
+ $principal = $valor;
545
+ $taxa = $juros/100;
546
+ $valjuros = $principal * $taxa;
547
+ $valParcela = ($principal + $valjuros)/$parcela;
548
+ return $valParcela;
549
  }
550
 
551
+ public function getInfoParcelamentoJuros() {
 
 
 
552
  $juros = array();
 
 
553
 
554
+ $juros['0'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
+ $juros['1'] = 0;
 
557
 
558
+ $juros['2'] = Mage::getStoreConfig('payment/moip_cc/parcela2');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
 
560
+
561
+ $juros['3'] = Mage::getStoreConfig('payment/moip_cc/parcela3');
562
 
563
+
564
+ $juros['4'] = Mage::getStoreConfig('payment/moip_cc/parcela4');
565
 
566
+
567
+ $juros['5'] = Mage::getStoreConfig('payment/moip_cc/parcela5');
568
 
 
 
 
 
 
569
 
570
+ $juros['6'] = Mage::getStoreConfig('payment/moip_cc/parcela6');
571
 
 
572
 
573
+ $juros['7'] = Mage::getStoreConfig('payment/moip_cc/parcela7');
574
 
575
+
576
+ $juros['8'] = Mage::getStoreConfig('payment/moip_cc/parcela8');
577
+
578
+
579
+ $juros['9'] = Mage::getStoreConfig('payment/moip_cc/parcela9');
580
+
581
+
582
+ $juros['10'] = Mage::getStoreConfig('payment/moip_cc/parcela10');
583
+
584
+
585
+ $juros['11'] = Mage::getStoreConfig('payment/moip_cc/parcela11');
586
+
587
+
588
+ $juros['12'] = Mage::getStoreConfig('payment/moip_cc/parcela12');
589
+
590
+ return $juros;
591
  }
592
 
593
+ public function getInfoParcelamentoMinimo() {
594
+
595
+
596
+ $valor = Mage::getStoreConfig('payment/moip_cc/valor_minimo');
597
+
598
+
599
+ return $valor;
600
+ }
601
+
602
+
603
+ public function generateLog($variable, $name_log){
604
+
605
+
606
+ if(Mage::getSingleton('transparente/standard')->getConfigData('log') == 1){
607
+ $dir_log = Mage::getBaseDir('var').'/log/MOIP/';
608
+
609
+ if (!file_exists($dir_log)) {
610
+ mkdir($dir_log, 0755, true);
611
+ }
612
+
613
+ Mage::log($variable, null, 'MOIP/'.$name_log, true);
614
  } else {
615
+
616
  }
617
+
618
 
 
619
  }
 
620
  }
621
+
app/code/local/MOIP/Transparente/Model/Method/Boleto.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_Boleto extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_boleto';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/form_boleto';
7
+ protected $_infoBlockType = 'transparente/info_boleto';
8
+ protected $_isGateway = true;
9
+ protected $_canAuthorize = true;
10
+ protected $_canCapture = true;
11
+ protected $_canCapturePartial = true;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+ protected $_canVoid = true;
15
+ protected $_canUseInternal = false;
16
+ protected $_canUseCheckout = true;
17
+ protected $_canUseForMultishipping = false;
18
+ protected $_canSaveCc = false;
19
+ protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $additionaldata = array(
29
+ 'var_para_boleto' => "boleto e"
30
+ );
31
+ $info->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
32
+ return $this;
33
+ }
34
+ public function prepareSave()
35
+ {
36
+ $info = $this->getInfoInstance();
37
+ return $this;
38
+ }
39
+ public function prepare()
40
+ {
41
+ $info = $this->getInfoInstance();
42
+ $additionaldata = unserialize($info->getAdditionalData());
43
+ $session = Mage::getSingleton('checkout/session');
44
+ $session->setMoipData($additionaldata);
45
+ }
46
+ public function validate()
47
+ {
48
+ parent::validate();
49
+ $info = $this->getInfoInstance();
50
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
51
+ $errorMsg = false;
52
+ if ($errorMsg === false) {
53
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
54
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
55
+ }
56
+ }
57
+ if ($errorMsg) {
58
+ Mage::throwException($errorMsg);
59
+ }
60
+ return $this;
61
+ }
62
+ public function getApi()
63
+ {
64
+ $api = Mage::getModel('transparente/api');
65
+ return $api;
66
+ }
67
+ public function getOrderPlaceRedirectUrl()
68
+ {
69
+ $api = $this->getApi();
70
+ $info = $this->getInfoInstance();
71
+ $quote = $info->getQuote();
72
+ $additionaldata = unserialize($info->getAdditionalData());
73
+ $json_order = $this->getApi()->getDados($quote);
74
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
75
+ $json_payment = $this->getApi()->getPaymentJsonBoleto($info, $quote);
76
+ $payment = $this->getApi()->generatePayment($json_payment, $IdMoip);
77
+ $additionaldataAfter = array(
78
+ 'token_moip' => $json_order,
79
+ 'response_moip' => $payment,
80
+ 'order_moip' => (string) $IdMoip
81
+ );
82
+ $additionaldata = array_merge($additionaldata, $additionaldataAfter);
83
+ $info->setAdditionalData(serialize($additionaldataAfter))->save()->setAdditionalInformation(serialize($additionaldataAfter))->save();
84
+
85
+ $this->prepare();
86
+ if (isset($payment->errors)) {
87
+ foreach ($payment->errors as $key => $value) {
88
+ $erros = (string) $value->description . " " . $erros;
89
+ }
90
+ $session = Mage::getSingleton('checkout/session');
91
+ $session->setMoipError($erros);
92
+ $api->generateLog($json_payment, 'MOIP_ErrorPayment.log');
93
+ $api->generateLog($payment, 'MOIP_ErrorPayment.log');
94
+
95
+ return Mage::getUrl('transparente/standard/cancel', array(
96
+ '_secure' => true
97
+ ));
98
+ } else {
99
+ return Mage::getUrl('transparente/standard/redirect', array(
100
+ '_secure' => true
101
+ ));
102
+ }
103
+ }
104
+ }
app/code/local/MOIP/Transparente/Model/Method/BoletoRecurring.php ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_BoletoRecurring extends Mage_Payment_Model_Method_Abstract implements Mage_Payment_Model_Recurring_Profile_MethodInterface
3
+ {
4
+
5
+ protected $_code = 'moip_boletorecurring';
6
+ protected $_formBlockType = 'transparente/form_boleto';
7
+ protected $_infoBlockType = 'transparente/info_boletorecurring';
8
+ protected $_isGateway = false;
9
+ protected $_canOrder = false;
10
+ protected $_canAuthorize = false;
11
+ protected $_canCapture = false;
12
+ protected $_canCapturePartial = false;
13
+ protected $_canRefund = false;
14
+ protected $_canRefundInvoicePartial = false;
15
+ protected $_canVoid = false;
16
+ protected $_canUseInternal = false;
17
+ protected $_canUseCheckout = true;
18
+ protected $_canUseForMultishipping = false;
19
+ protected $_canFetchTransactionInfo = true;
20
+ protected $_canCreateBillingAgreement = false;
21
+ protected $_canReviewPayment = true;
22
+
23
+ public function getPayment()
24
+ {
25
+ return $this->getQuote()->getPayment();
26
+ }
27
+ public function getSession()
28
+ {
29
+ return Mage::getSingleton('transparente/session');
30
+ }
31
+ public function getCheckout()
32
+ {
33
+ return Mage::getSingleton('checkout/session');
34
+ }
35
+ public function getQuote()
36
+ {
37
+ return $this->getCheckout()->getQuote();
38
+ }
39
+
40
+
41
+ public function validate()
42
+ {
43
+
44
+
45
+ parent::validate();
46
+ $info = $this->getInfoInstance();
47
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
48
+ $errorMsg = false;
49
+ $additionaldata = unserialize($info->getAdditionalData());
50
+
51
+ $ccNumber = $info->getRecurringNumber();
52
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
53
+ $info->setCcNumber($ccNumber);
54
+ $ccType = '';
55
+
56
+
57
+ if ($errorMsg) {
58
+ Mage::throwException($errorMsg);
59
+ }
60
+ return $this;
61
+ }
62
+ public function validateCcNum($ccNumber)
63
+ {
64
+ $cardNumber = strrev($ccNumber);
65
+ $numSum = 0;
66
+ for ($i = 0; $i < strlen($cardNumber); $i++) {
67
+ $currentNum = substr($cardNumber, $i, 1);
68
+ if ($i % 2 == 1) {
69
+ $currentNum *= 2;
70
+ }
71
+ if ($currentNum > 9) {
72
+ $firstNum = $currentNum % 10;
73
+ $secondNum = ($currentNum - $firstNum) / 10;
74
+ $currentNum = $firstNum + $secondNum;
75
+ }
76
+ $numSum += $currentNum;
77
+ }
78
+ return ($numSum % 10 == 0);
79
+ }
80
+ public function getVerificationRegEx()
81
+ {
82
+ $verificationExpList = array(
83
+ 'VI' => '/^[0-9]{3}$/',
84
+ 'MC' => '/^[0-9]{3}$/',
85
+ 'AE' => '/^[0-9]{4}$/',
86
+ 'DC' => '/^[0-9]{3}$/',
87
+ 'EO' => '/^[0-9]{3}$/',
88
+ 'HI' => '/^[0-9]{4}$/'
89
+ );
90
+ return $verificationExpList;
91
+ }
92
+ public function getValidaCPF($cpf = null)
93
+ {
94
+ if (empty($cpf)) {
95
+ return false;
96
+ } else if ($cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') {
97
+ return false;
98
+ } else {
99
+ for ($t = 9; $t < 11; $t++) {
100
+ for ($d = 0, $c = 0; $c < $t; $c++) {
101
+ $d += $cpf{$c} * (($t + 1) - $c);
102
+ }
103
+ $d = ((10 * $d) % 11) % 10;
104
+ if ($cpf{$c} != $d) {
105
+ return false;
106
+ }
107
+ }
108
+ return true;
109
+ }
110
+ }
111
+ protected function _validateExpDate($expYear, $expMonth)
112
+ {
113
+ $date = Mage::app()->getLocale()->date();
114
+ if (!$expYear || !$expMonth || ($date->compareYear($expYear) == 1) || ($date->compareYear($expYear) == 0 && ($date->compareMonth($expMonth) == 1))) {
115
+ return false;
116
+ }
117
+ return true;
118
+ }
119
+ public function getApiMoip()
120
+ {
121
+ $api = Mage::getSingleton('transparente/recurringapi');
122
+ return $api;
123
+
124
+ }
125
+
126
+ public function canUseCheckout()
127
+ {
128
+ $cart = Mage::getModel('checkout/cart')->getQuote();
129
+ foreach ($cart->getAllItems() as $item) {
130
+ if (!$item->getProduct()->getIsRecurring())
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+
136
+ public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
137
+ {
138
+
139
+
140
+ return $this;
141
+ }
142
+
143
+ public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $payment)
144
+ {
145
+
146
+ $api = $this->getApiMoip();
147
+ $response2 = $api->searchCustomersPlans($profile, $payment);
148
+ $response2 = json_decode($response2, false);
149
+ $moip_code = $response2->code;
150
+ $session = Mage::getSingleton('checkout/session');
151
+ $link_boleto = $response2->_links->boleto->redirect_href;
152
+
153
+ $session->setMoipBoletoLink($link_boleto);
154
+ if ($moip_code) {
155
+ $profile->setReferenceId($moip_code);
156
+ $payment->setSkipTransactionCreation(true);
157
+
158
+ if ((float) $profile->getInitAmount()) {
159
+ $productItemInfo = new Varien_Object;
160
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_INITIAL);
161
+ $productItemInfo->setPrice($profile->getInitAmount()-$profile->getShippingAmount());
162
+
163
+ $order = $profile->createOrder($productItemInfo);
164
+
165
+ $payment = $order->getPayment();
166
+ $payment->setTransactionId($moip_code)->setIsTransactionClosed(1);
167
+ $order->save();
168
+ $profile->addOrderRelation($order->getId());
169
+ $order->save();
170
+ $payment->save();
171
+
172
+ $transaction = Mage::getModel('sales/order_payment_transaction');
173
+ $transaction->setTxnId($trans_id);
174
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
175
+ $transaction->setPaymentId($payment->getId());
176
+ $transaction->setOrderId($order->getId());
177
+ $transaction->setOrderPaymentObject($payment);
178
+ $transaction->setIsClosed(1);
179
+ $transaction->save();
180
+ }
181
+
182
+ $this->chargeRecurringProfile($profile, $moip_code);
183
+
184
+ return $this;
185
+
186
+ } else {
187
+
188
+ if (!$profile->getInitMayFail()) {
189
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED);
190
+ $profile->save();
191
+ }
192
+
193
+ Mage::throwException($response['msg']);
194
+
195
+ }
196
+ }
197
+
198
+ public function getRecurringProfileDetails($referenceId, Varien_Object $result)
199
+ {
200
+
201
+
202
+ return $this;
203
+ }
204
+
205
+ public function canGetRecurringProfileDetails()
206
+ {
207
+
208
+
209
+ return true;
210
+ }
211
+
212
+ public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
213
+ {
214
+
215
+
216
+ return $this;
217
+ }
218
+
219
+ public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
220
+ {
221
+
222
+
223
+ switch ($profile->getNewState()) {
224
+ case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
225
+ {
226
+
227
+ $profile_id = $profile->getId();
228
+
229
+
230
+
231
+ $moip = $this->getApiMoip()->activateSubscription($profile_id);
232
+ $action = 'start';
233
+ break;
234
+ }
235
+ case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
236
+ {
237
+
238
+ $profile_id = $profile->getId();
239
+
240
+
241
+
242
+ $moip = $this->getApiMoip()->cancelSubscription($profile_id);
243
+ $action = 'cancel';
244
+ break;
245
+ }
246
+
247
+ case Mage_Sales_Model_Recurring_Profile::STATE_EXPIRED:
248
+ $action = 'cancel';
249
+ break;
250
+ case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
251
+ {
252
+
253
+ $profile_id = $profile->getId();
254
+
255
+
256
+
257
+ $moip = $this->getApiMoip()->suspendSubscription($profile_id);
258
+ $action = 'stop';
259
+ break;
260
+ }
261
+
262
+
263
+ default:
264
+ return $this;
265
+ }
266
+ }
267
+
268
+
269
+ public function chargeRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, $trans_id){
270
+
271
+
272
+
273
+ $productItemInfo = new Varien_Object;
274
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
275
+ $productItemInfo->setPrice( $profile->getTaxAmount() + $profile->getBillingAmount() );
276
+
277
+ $order = $profile->createOrder($productItemInfo);
278
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW);
279
+
280
+ $payment = $order->getPayment();
281
+ $payment->setTransactionId($trans_id)->setIsTransactionClosed(1);
282
+ $order->save();
283
+ $profile->addOrderRelation($order->getId());
284
+ $payment->save();
285
+
286
+ $transaction= Mage::getModel('sales/order_payment_transaction');
287
+ $transaction->setTxnId($trans_id);
288
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
289
+ $transaction->setPaymentId($payment->getId());
290
+ $transaction->setOrderId($order->getId());
291
+ $transaction->setOrderPaymentObject($payment);
292
+ $transaction->setIsClosed( 1 );
293
+
294
+ $transaction->save();
295
+
296
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
297
+
298
+ // change updated_at to one cycle ahead
299
+ $this->_setUpdateDateToNextPeriod($profile->getId());
300
+
301
+ return true;
302
+
303
+
304
+ }
305
+
306
+
307
+ protected function _setUpdateDateToNextPeriod($profile_id)
308
+ {
309
+
310
+
311
+ $_resource = Mage::getSingleton('core/resource');
312
+ $sql = '
313
+ UPDATE ' . $_resource->getTableName('sales_recurring_profile') . '
314
+ SET updated_at = CASE period_unit
315
+ WHEN "day" THEN DATE_ADD(updated_at, INTERVAL period_frequency DAY)
316
+ WHEN "week" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*7) DAY)
317
+ WHEN "semi_month" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*14) DAY)
318
+ WHEN "month" THEN DATE_ADD(updated_at, INTERVAL period_frequency MONTH)
319
+ WHEN "year" THEN DATE_ADD(updated_at, INTERVAL period_frequency YEAR)
320
+ END
321
+ WHERE profile_id = :pid';
322
+
323
+ $connection = $_resource->getConnection('core_write');
324
+ $pdoStatement = $connection->prepare($sql);
325
+ $pdoStatement->bindValue(':pid', $profile_id);
326
+ return $pdoStatement->execute();
327
+ }
328
+
329
+ protected function _sendRequest($action, array $params = array())
330
+ {
331
+
332
+ return array(
333
+ 'result' => 'SUCCESS',
334
+ 'msg' => 'Success',
335
+ 'action' => $action,
336
+ 'token' => 'token-' . uniqid()
337
+ );
338
+ }
339
+
340
+ }
app/code/local/MOIP/Transparente/Model/Method/Cc.php ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_Cc extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_cc';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/form_cc';
7
+ protected $_infoBlockType = 'transparente/info_cc';
8
+ protected $_isGateway = true;
9
+ protected $_canAuthorize = true;
10
+ protected $_canCapture = true;
11
+ protected $_canCapturePartial = true;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+ protected $_canVoid = true;
15
+ protected $_canUseInternal = false;
16
+ protected $_canUseCheckout = true;
17
+ protected $_canUseForMultishipping = false;
18
+ protected $_canSaveCc = true;
19
+ protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+ public function getPayment()
22
+ {
23
+ return $this->getQuote()->getPayment();
24
+ }
25
+ public function getSession()
26
+ {
27
+ return Mage::getSingleton('transparente/session');
28
+ }
29
+ public function getCheckout()
30
+ {
31
+ return Mage::getSingleton('checkout/session');
32
+ }
33
+ public function getQuote()
34
+ {
35
+ return $this->getCheckout()->getQuote();
36
+ }
37
+ public function assignData($data)
38
+ {
39
+ if (!($data instanceof Varien_Object)) {
40
+ $data = new Varien_Object($data);
41
+ }
42
+ $info = $this->getInfoInstance();
43
+ $dataNascimento = $data->getMoipCcOwnerExpDay() . "/" . $data->getMoipCcOwnerExpMonth() . "/" . $data->getMoipCcOwnerExpYear();
44
+ if ($data->getMoipCcPaymentInCofre() == 0)
45
+ $use_cofre = 1;
46
+ else
47
+ $use_cofre = 0;
48
+ $additionaldata = array(
49
+ 'taxdocument_moip' => preg_replace("/[^0-9]/", "", $data->getMoipCcTaxdocument()),
50
+ 'installmentcount_moip' => $data->getMoipCcInstallmentCount(),
51
+ 'installmentcountcofre_moip' => $data->getMoipCcCountCofre(),
52
+ //'phonenumber_moip' => $data->getMoipCcPhoneNumber(),
53
+ // 'phoneddd_moip' => preg_replace("/[^0-9]/", "", $data->getMoipCcPhoneCode()),
54
+ // 'birthdate_moip' => $dataNascimento,
55
+ 'hash_moip' => $data->getMoipCcEncrypted(),
56
+ 'credit_card_cofre_nb' => (string) $data->getMoipCcCofreNb(),
57
+ 'save_card' => $data->getMoipCcSaveCard(),
58
+ 'use_cofre' => (int) $use_cofre,
59
+ 'credit_card_ccv' => $data->getMoipCcCofreId(),
60
+ 'fullname_moip' => $data->getMoipCcOwner()
61
+ );
62
+ $info->setCcType($data->getMoipCcType())->setCcLast4(substr($data->getMoipCcNumber(), -4))->setCcNumber($data->getMoipCcNumber())->setCcExpMonth($data->getMoipCcExpMonth())->setCcExpYear($data->getMoipCcExpYear())->setCcCid($data->getMoipCcCid())->setCcOwner($data->getMoipCcOwner())->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
63
+ $this->getMethodJuros();
64
+ return $this;
65
+ }
66
+ public function prepareSave()
67
+ {
68
+ $info = $this->getInfoInstance();
69
+ if ($this->_canSaveCc) {
70
+ $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
71
+ }
72
+ $info->setCcCidEnc($info->encrypt($info->getCcCid()));
73
+ $info->setCcNumber(null)->setCcCid(null);
74
+ return $this;
75
+ }
76
+ public function prepare()
77
+ {
78
+ $info = $this->getInfoInstance();
79
+ $additionaldata = unserialize($info->getAdditionalData());
80
+ $session = Mage::getSingleton('checkout/session');
81
+ $session->setMoipData($additionaldata);
82
+ }
83
+ public function validate()
84
+ {
85
+ parent::validate();
86
+ $info = $this->getInfoInstance();
87
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
88
+ $errorMsg = false;
89
+ $additionaldata = unserialize($info->getAdditionalData());
90
+ if ($additionaldata['use_cofre'] == 0) {
91
+ $ccNumber = $info->getCcNumber();
92
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
93
+ $info->setCcNumber($ccNumber);
94
+ $ccType = '';
95
+ if ($this->validateCcNum($ccNumber)) {
96
+ $ccTypeRegExpList = array(
97
+ 'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
98
+ 'MC' => '/^5[1-5][0-9]{14}$/',
99
+ 'AE' => '/^3[47][0-9]{13}$/',
100
+ 'DC' => '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/',
101
+ 'EO' => '/^([0-9])$/',
102
+ 'HI' => '/^([0-9])$/',
103
+ 'HP' => '/^([0-9])$/'
104
+ );
105
+ $specifiedCCType = $info->getCcType();
106
+ if ($specifiedCCType == 'VI' || $specifiedCCType == "MC" || $$specifiedCCType == "AE" || $$specifiedCCType == "DC") {
107
+ if (array_key_exists($specifiedCCType, $ccTypeRegExpList)) {
108
+ $ccTypeRegExp = $ccTypeRegExpList[$specifiedCCType];
109
+ if (!preg_match($ccTypeRegExp, $ccNumber)) {
110
+ $errorMsg = Mage::helper('transparente')->__('Ops, não consigo processar o seu cartão confira o número por favor.');
111
+ }
112
+ }
113
+ } else {
114
+ if ($specifiedCCType)
115
+ $errorMsg = "";
116
+ else
117
+ $errorMsg = Mage::helper('transparente')->__('Ops, não consigo processar o seu cartão confira o número por favor.');
118
+ }
119
+ } else {
120
+ $errorMsg = Mage::helper('transparente')->__('O número do cartão está inválido');
121
+ }
122
+ if ($errorMsg === false) {
123
+ $verifcationRegEx = $this->getVerificationRegEx();
124
+ $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
125
+ if (!$info->getCcCid() || !$regExp || !preg_match($regExp, $info->getCcCid())) {
126
+ $errorMsg = Mage::helper('transparente')->__('O Código de Segurança (cvv) está inválido');
127
+ }
128
+ }
129
+ if ($errorMsg === false) {
130
+ if (!$info->getCcOwner()) {
131
+ $errorMsg = Mage::helper('transparente')->__('O nome do portador do cartão não está correto');
132
+ }
133
+ }
134
+ if ($errorMsg === false) {
135
+ if (!isset($additionaldata['hash_moip'])) {
136
+ $errorMsg = Mage::helper('transparente')->__('Seu cartão não pode ser processado via Moip, por favor escolha outro meio de pagamento.');
137
+ }
138
+ }
139
+ if ($errorMsg === false) {
140
+ if (!$this->getValidaCPF($additionaldata['taxdocument_moip'])) {
141
+ $errorMsg = Mage::helper('transparente')->__('Informe um CPF válido, caso seu cartão seja empresarial é necessário informar o seu CPF.');
142
+ }
143
+ }
144
+ // if ($errorMsg === false) {
145
+ // $phone = $additionaldata['phonenumber_moip'];
146
+ // }
147
+ if ($errorMsg === false) {
148
+ if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
149
+ $errorMsg = $year . Mage::helper('transparente')->__('Seu Cartão está vencido, verifique se data está corretamente preenchida.');
150
+ }
151
+ }
152
+ if ($errorMsg === false) {
153
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
154
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
155
+ }
156
+ }
157
+ if ($errorMsg === false) {
158
+ if (!$additionaldata['installmentcount_moip']) {
159
+ $errorMsg = Mage::helper('transparente')->__('Selecione o número de parcelas para o pagamento.');
160
+ }
161
+ }
162
+ } elseif ($additionaldata['use_cofre'] == 1) {
163
+ if ($errorMsg === false) {
164
+ if (!$additionaldata['credit_card_ccv']) {
165
+ $errorMsg = Mage::helper('transparente')->__('Informe o código de segurança do cartão selecionado.');
166
+ }
167
+ }
168
+ if ($errorMsg === false) {
169
+ if (!$additionaldata['installmentcountcofre_moip']) {
170
+ $errorMsg = Mage::helper('transparente')->__('Selecione o número de parcelas para o pagamento.');
171
+ }
172
+ }
173
+ }
174
+ if ($errorMsg) {
175
+ Mage::throwException($errorMsg);
176
+ }
177
+ return $this;
178
+ }
179
+ public function validateCcNum($ccNumber)
180
+ {
181
+ $cardNumber = strrev($ccNumber);
182
+ $numSum = 0;
183
+ for ($i = 0; $i < strlen($cardNumber); $i++) {
184
+ $currentNum = substr($cardNumber, $i, 1);
185
+ if ($i % 2 == 1) {
186
+ $currentNum *= 2;
187
+ }
188
+ if ($currentNum > 9) {
189
+ $firstNum = $currentNum % 10;
190
+ $secondNum = ($currentNum - $firstNum) / 10;
191
+ $currentNum = $firstNum + $secondNum;
192
+ }
193
+ $numSum += $currentNum;
194
+ }
195
+ return ($numSum % 10 == 0);
196
+ }
197
+ public function getVerificationRegEx()
198
+ {
199
+ $verificationExpList = array(
200
+ 'VI' => '/^[0-9]{3}$/',
201
+ 'MC' => '/^[0-9]{3}$/',
202
+ 'AE' => '/^[0-9]{4}$/',
203
+ 'DC' => '/^[0-9]{3}$/',
204
+ 'EO' => '/^[0-9]{3}$/',
205
+ 'HI' => '/^[0-9]{4}$/'
206
+ );
207
+ return $verificationExpList;
208
+ }
209
+ public function getValidaCPF($cpf = null)
210
+ {
211
+ if (empty($cpf)) {
212
+ return false;
213
+ } else if ($cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') {
214
+ return false;
215
+ } else {
216
+ for ($t = 9; $t < 11; $t++) {
217
+ for ($d = 0, $c = 0; $c < $t; $c++) {
218
+ $d += $cpf{$c} * (($t + 1) - $c);
219
+ }
220
+ $d = ((10 * $d) % 11) % 10;
221
+ if ($cpf{$c} != $d) {
222
+ return false;
223
+ }
224
+ }
225
+ return true;
226
+ }
227
+ }
228
+ protected function _validateExpDate($expYear, $expMonth)
229
+ {
230
+ $date = Mage::app()->getLocale()->date();
231
+ if (!$expYear || !$expMonth || ($date->compareYear($expYear) == 1) || ($date->compareYear($expYear) == 0 && ($date->compareMonth($expMonth) == 1))) {
232
+ return false;
233
+ }
234
+ return true;
235
+ }
236
+ public function getApi()
237
+ {
238
+ $api = Mage::getModel('transparente/api');
239
+ return $api;
240
+ }
241
+ public function getOrderPlaceRedirectUrl()
242
+ {
243
+ $api = $this->getApi();
244
+ $info = $this->getInfoInstance();
245
+ $quote = $info->getQuote();
246
+ $additionaldata = unserialize($info->getAdditionalData());
247
+ $json_order = $this->getApi()->getDados($quote);
248
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
249
+ $json_payment = $this->getApi()->getPaymentJsonCc($info, $quote);
250
+ $payment = $this->getApi()->generatePayment($json_payment, $IdMoip);
251
+ $additionaldataAfter = array(
252
+ 'token_moip' => $json_order,
253
+ 'response_moip' => $payment,
254
+ 'order_moip' => (string) $IdMoip
255
+ );
256
+ $additionaldata = array_merge($additionaldata, $additionaldataAfter);
257
+ $info->setAdditionalData(serialize($additionaldata))->save();
258
+ $info->setAdditionalInformation(serialize($additionaldata))->save();
259
+
260
+ $this->prepare();
261
+ if (isset($payment->errors)) {
262
+ foreach ($payment->errors as $key => $value) {
263
+ $erros = (string) $value->description . " " . $erros;
264
+ }
265
+ $session = Mage::getSingleton('checkout/session');
266
+ $session->setMoipError($erros);
267
+ $api->generateLog($json_payment, 'MOIP_ErrorPayment.log');
268
+ $api->generateLog($payment, 'MOIP_ErrorPayment.log');
269
+ return Mage::getUrl('transparente/standard/cancel', array(
270
+ '_secure' => true
271
+ ));
272
+ } else {
273
+ return Mage::getUrl('transparente/standard/redirect', array(
274
+ '_secure' => true
275
+ ));
276
+ }
277
+ }
278
+ public function getMethodJuros()
279
+ {
280
+ $quote = $this->getQuote();
281
+ $info = $quote->getPayment();
282
+ $additionaldata = unserialize($info->getAdditionalData());
283
+ if ($additionaldata['installmentcount_moip']) {
284
+ $parcela = $additionaldata['installmentcount_moip'];
285
+ } else {
286
+ $parcela = $additionaldata['installmentcountcofre_moip'];
287
+ }
288
+ if (!$quote->getFeeAmount())
289
+ $juros = $this->setJurosMoip($quote, $parcela);
290
+ return $this;
291
+ }
292
+ public function setJurosMoip($quote, $parcela)
293
+ {
294
+ if (!$quote->isVirtual()) {
295
+ $address = $quote->getShippingAddress();
296
+ } else {
297
+ $address = $quote->getBillingAddress();
298
+ }
299
+ $api = Mage::getSingleton('transparente/api');
300
+ $total_geral = $address->getGrandTotal();
301
+ if ($address->getFeeAmount() == 0) {
302
+ $address->setFeeAmount(0);
303
+ $address->setBaseFeeAmount(0);
304
+ $address->save();
305
+ $juros = $address->getFeeAmount();
306
+ $total = $total_geral - $juros;
307
+ $parcelamento = $api->getParcelamento();
308
+ if($parcelamento && $parcela){
309
+ $balance = $parcelamento[$parcela]['total_juros'];
310
+ $address->setFeeAmount($balance);
311
+ $address->setBaseFeeAmount($balance);
312
+ $address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
313
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
314
+ $address->save();
315
+ }
316
+
317
+ }
318
+ return $this;
319
+ }
320
+ }
app/code/local/MOIP/Transparente/Model/Method/CcRecurring.php ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_CcRecurring extends Mage_Payment_Model_Method_Abstract implements Mage_Payment_Model_Recurring_Profile_MethodInterface
3
+ {
4
+
5
+ protected $_code = 'moip_ccrecurring';
6
+ protected $_formBlockType = 'transparente/form_recurring';
7
+
8
+ protected $_isGateway = false;
9
+ protected $_canOrder = false;
10
+ protected $_canAuthorize = false;
11
+ protected $_canCapture = false;
12
+ protected $_canCapturePartial = false;
13
+ protected $_canRefund = false;
14
+ protected $_canRefundInvoicePartial = false;
15
+ protected $_canVoid = false;
16
+ protected $_canUseInternal = false;
17
+ protected $_canUseCheckout = true;
18
+ protected $_canUseForMultishipping = false;
19
+ protected $_canFetchTransactionInfo = true;
20
+ protected $_canCreateBillingAgreement = false;
21
+ protected $_canReviewPayment = true;
22
+
23
+ public function getPayment()
24
+ {
25
+ return $this->getQuote()->getPayment();
26
+ }
27
+ public function getSession()
28
+ {
29
+ return Mage::getSingleton('transparente/session');
30
+ }
31
+ public function getCheckout()
32
+ {
33
+ return Mage::getSingleton('checkout/session');
34
+ }
35
+ public function getQuote()
36
+ {
37
+ return $this->getCheckout()->getQuote();
38
+ }
39
+ public function assignData($data)
40
+ {
41
+ if (!($data instanceof Varien_Object)) {
42
+ $data = new Varien_Object($data);
43
+ }
44
+ $info = $this->getInfoInstance();
45
+ $dataNascimento = $data->getMoipCcrecurringOwnerExpDay() . "/" . $data->getMoipCcrecurringOwnerExpMonth() . "/" . $data->getMoipCcrecurringOwnerExpYear();
46
+
47
+ $additionaldata = array(
48
+ 'hash_moip' => $data->getMoipCcrecurringNumber()
49
+ );
50
+ $info->setCcType($data->getMoipCcrecurringType())->setCcLast4(substr($data->getMoipCcrecurringNumber(), -4))->setCcNumber($data->getMoipCcrecurringNumber())->setCcExpMonth($data->getMoipCcrecurringExpMonth())->setCcExpYear($data->getMoipCcrecurringExpYear())->setCcCid($data->getMoipCcrecurringCid())->setCcOwner($data->getMoipCcrecurringOwner())->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
51
+ return $this;
52
+ }
53
+ public function prepareSave()
54
+ {
55
+
56
+ $info = $this->getInfoInstance();
57
+ if ($this->_canSaveCc) {
58
+ $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
59
+ }
60
+ $info->setCcCidEnc($info->encrypt($info->getRecurringCid()));
61
+ $info->setCcNumber(null)->setRecurringCid(null);
62
+ return $this;
63
+ }
64
+ public function prepare()
65
+ {
66
+
67
+ $info = $this->getInfoInstance();
68
+ $additionaldata = unserialize($info->getAdditionalData());
69
+ $session = Mage::getSingleton('checkout/session');
70
+ $session->setMoipData($additionaldata);
71
+ }
72
+ public function validate()
73
+ {
74
+
75
+
76
+ parent::validate();
77
+ $info = $this->getInfoInstance();
78
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
79
+ $errorMsg = false;
80
+ $additionaldata = unserialize($info->getAdditionalData());
81
+
82
+ $ccNumber = $info->getRecurringNumber();
83
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
84
+ $info->setCcNumber($ccNumber);
85
+ $ccType = '';
86
+
87
+
88
+ if ($errorMsg) {
89
+ Mage::throwException($errorMsg);
90
+ }
91
+ return $this;
92
+ }
93
+ public function validateCcNum($ccNumber)
94
+ {
95
+ $cardNumber = strrev($ccNumber);
96
+ $numSum = 0;
97
+ for ($i = 0; $i < strlen($cardNumber); $i++) {
98
+ $currentNum = substr($cardNumber, $i, 1);
99
+ if ($i % 2 == 1) {
100
+ $currentNum *= 2;
101
+ }
102
+ if ($currentNum > 9) {
103
+ $firstNum = $currentNum % 10;
104
+ $secondNum = ($currentNum - $firstNum) / 10;
105
+ $currentNum = $firstNum + $secondNum;
106
+ }
107
+ $numSum += $currentNum;
108
+ }
109
+ return ($numSum % 10 == 0);
110
+ }
111
+ public function getVerificationRegEx()
112
+ {
113
+ $verificationExpList = array(
114
+ 'VI' => '/^[0-9]{3}$/',
115
+ 'MC' => '/^[0-9]{3}$/',
116
+ 'AE' => '/^[0-9]{4}$/',
117
+ 'DC' => '/^[0-9]{3}$/',
118
+ 'EO' => '/^[0-9]{3}$/',
119
+ 'HI' => '/^[0-9]{4}$/'
120
+ );
121
+ return $verificationExpList;
122
+ }
123
+ public function getValidaCPF($cpf = null)
124
+ {
125
+ if (empty($cpf)) {
126
+ return false;
127
+ } else if ($cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') {
128
+ return false;
129
+ } else {
130
+ for ($t = 9; $t < 11; $t++) {
131
+ for ($d = 0, $c = 0; $c < $t; $c++) {
132
+ $d += $cpf{$c} * (($t + 1) - $c);
133
+ }
134
+ $d = ((10 * $d) % 11) % 10;
135
+ if ($cpf{$c} != $d) {
136
+ return false;
137
+ }
138
+ }
139
+ return true;
140
+ }
141
+ }
142
+ protected function _validateExpDate($expYear, $expMonth)
143
+ {
144
+ $date = Mage::app()->getLocale()->date();
145
+ if (!$expYear || !$expMonth || ($date->compareYear($expYear) == 1) || ($date->compareYear($expYear) == 0 && ($date->compareMonth($expMonth) == 1))) {
146
+ return false;
147
+ }
148
+ return true;
149
+ }
150
+ public function getApiMoip()
151
+ {
152
+ $api = Mage::getSingleton('transparente/recurringapi');
153
+ return $api;
154
+
155
+ }
156
+
157
+ public function canUseCheckout()
158
+ {
159
+ $cart = Mage::getModel('checkout/cart')->getQuote();
160
+ foreach ($cart->getAllItems() as $item) {
161
+ if (!$item->getProduct()->getIsRecurring())
162
+ return false;
163
+ }
164
+ return true;
165
+ }
166
+
167
+ public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
168
+ {
169
+
170
+
171
+ return $this;
172
+ }
173
+
174
+ public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $payment)
175
+ {
176
+
177
+ $api = $this->getApiMoip();
178
+ $response2 = $api->setCustomersPlans($profile, $payment);
179
+ $response2 = json_decode($response2, false);
180
+ $moip_code = $response2->code;
181
+ $session = Mage::getSingleton('checkout/session');
182
+ $session->setMoipBoletoLink(null);
183
+ if ($moip_code) {
184
+ $profile->setReferenceId($moip_code);
185
+ $payment->setSkipTransactionCreation(true);
186
+
187
+ if ((float) $profile->getInitAmount()) {
188
+ $productItemInfo = new Varien_Object;
189
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_INITIAL);
190
+ $productItemInfo->setPrice($profile->getInitAmount());
191
+
192
+ $order = $profile->createOrder($productItemInfo);
193
+
194
+ $payment = $order->getPayment();
195
+ $payment->setTransactionId($moip_code)->setIsTransactionClosed(1);
196
+ $order->save();
197
+ $profile->addOrderRelation($order->getId());
198
+ $order->save();
199
+ $payment->save();
200
+
201
+ $transaction = Mage::getModel('sales/order_payment_transaction');
202
+ $transaction->setTxnId($trans_id);
203
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
204
+ $transaction->setPaymentId($payment->getId());
205
+ $transaction->setOrderId($order->getId());
206
+ $transaction->setOrderPaymentObject($payment);
207
+ $transaction->setIsClosed(1);
208
+ $transaction->save();
209
+ }
210
+
211
+ $this->chargeRecurringProfile($profile, $moip_code);
212
+
213
+ return $this;
214
+
215
+ } else {
216
+
217
+ if (!$profile->getInitMayFail()) {
218
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED);
219
+ $profile->save();
220
+ }
221
+
222
+ Mage::throwException($response['msg']);
223
+
224
+ }
225
+ }
226
+
227
+ public function getRecurringProfileDetails($referenceId, Varien_Object $result)
228
+ {
229
+
230
+
231
+ return $this;
232
+ }
233
+
234
+ public function canGetRecurringProfileDetails()
235
+ {
236
+
237
+
238
+ return true;
239
+ }
240
+
241
+ public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
242
+ {
243
+
244
+
245
+ return $this;
246
+ }
247
+
248
+ public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
249
+ {
250
+
251
+
252
+ switch ($profile->getNewState()) {
253
+ case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
254
+ {
255
+
256
+ $profile_id = $profile->getId();
257
+
258
+
259
+
260
+ $moip = $this->getApiMoip()->activateSubscription($profile_id);
261
+ $action = 'start';
262
+ break;
263
+ }
264
+ case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
265
+ {
266
+
267
+ $profile_id = $profile->getId();
268
+
269
+
270
+
271
+ $moip = $this->getApiMoip()->cancelSubscription($profile_id);
272
+ $action = 'cancel';
273
+ break;
274
+ }
275
+
276
+ case Mage_Sales_Model_Recurring_Profile::STATE_EXPIRED:
277
+ $action = 'cancel';
278
+ break;
279
+ case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
280
+ {
281
+
282
+ $profile_id = $profile->getId();
283
+
284
+
285
+
286
+ $moip = $this->getApiMoip()->suspendSubscription($profile_id);
287
+ $action = 'stop';
288
+ break;
289
+ }
290
+
291
+
292
+ default:
293
+ return $this;
294
+ }
295
+ }
296
+
297
+
298
+ public function chargeRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, $trans_id){
299
+
300
+
301
+
302
+ $productItemInfo = new Varien_Object;
303
+ $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
304
+ $productItemInfo->setPrice( $profile->getTaxAmount() + $profile->getBillingAmount() + $profile->getShippingAmount() );
305
+
306
+ $order = $profile->createOrder($productItemInfo);
307
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW);
308
+
309
+ $payment = $order->getPayment();
310
+ $payment->setTransactionId($trans_id)->setIsTransactionClosed(1);
311
+ $order->save();
312
+ $profile->addOrderRelation($order->getId());
313
+ $payment->save();
314
+
315
+ $transaction= Mage::getModel('sales/order_payment_transaction');
316
+ $transaction->setTxnId($trans_id);
317
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
318
+ $transaction->setPaymentId($payment->getId());
319
+ $transaction->setOrderId($order->getId());
320
+ $transaction->setOrderPaymentObject($payment);
321
+ $transaction->setIsClosed( 1 );
322
+
323
+ $transaction->save();
324
+
325
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
326
+
327
+ // change updated_at to one cycle ahead
328
+ $this->_setUpdateDateToNextPeriod($profile->getId());
329
+
330
+ return true;
331
+
332
+
333
+ }
334
+
335
+
336
+ protected function _setUpdateDateToNextPeriod($profile_id)
337
+ {
338
+
339
+
340
+ $_resource = Mage::getSingleton('core/resource');
341
+ $sql = '
342
+ UPDATE ' . $_resource->getTableName('sales_recurring_profile') . '
343
+ SET updated_at = CASE period_unit
344
+ WHEN "day" THEN DATE_ADD(updated_at, INTERVAL period_frequency DAY)
345
+ WHEN "week" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*7) DAY)
346
+ WHEN "semi_month" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*14) DAY)
347
+ WHEN "month" THEN DATE_ADD(updated_at, INTERVAL period_frequency MONTH)
348
+ WHEN "year" THEN DATE_ADD(updated_at, INTERVAL period_frequency YEAR)
349
+ END
350
+ WHERE profile_id = :pid';
351
+
352
+ $connection = $_resource->getConnection('core_write');
353
+ $pdoStatement = $connection->prepare($sql);
354
+ $pdoStatement->bindValue(':pid', $profile_id);
355
+ return $pdoStatement->execute();
356
+ }
357
+
358
+ protected function _sendRequest($action, array $params = array())
359
+ {
360
+
361
+ return array(
362
+ 'result' => 'SUCCESS',
363
+ 'msg' => 'Success',
364
+ 'action' => $action,
365
+ 'token' => 'token-' . uniqid()
366
+ );
367
+ }
368
+
369
+ }
app/code/local/MOIP/Transparente/Model/Method/Tef.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Method_Tef extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_tef';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/form_tef';
7
+ protected $_infoBlockType = 'transparente/info_tef';
8
+ protected $_isGateway = true;
9
+ protected $_canAuthorize = true;
10
+ protected $_canCapture = true;
11
+ protected $_canCapturePartial = true;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+ protected $_canVoid = true;
15
+ protected $_canUseInternal = false;
16
+ protected $_canUseCheckout = true;
17
+ protected $_canUseForMultishipping = false;
18
+ protected $_canSaveCc = false;
19
+ protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+ public function assignData($data)
22
+ {
23
+ if (!($data instanceof Varien_Object)) {
24
+ $data = new Varien_Object($data);
25
+ }
26
+ $info = $this->getInfoInstance();
27
+ $additionaldata = array(
28
+ 'banknumber_moip' => $data->getMoipTefBanknumber()
29
+ );
30
+ $info->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
31
+ return $this;
32
+ }
33
+ public function prepareSave()
34
+ {
35
+ $info = $this->getInfoInstance();
36
+ return $this;
37
+ }
38
+ public function prepare()
39
+ {
40
+ $info = $this->getInfoInstance();
41
+ $additionaldata = unserialize($info->getAdditionalData());
42
+ $session = Mage::getSingleton('checkout/session');
43
+ $session->setMoipData($additionaldata);
44
+ }
45
+ public function validate()
46
+ {
47
+ parent::validate();
48
+ $info = $this->getInfoInstance();
49
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
50
+ $errorMsg = false;
51
+ $additionaldata = unserialize($info->getAdditionalData());
52
+ if ($errorMsg === false) {
53
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
54
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
55
+ }
56
+ }
57
+ if ($errorMsg) {
58
+ Mage::throwException($errorMsg);
59
+ }
60
+ return $this;
61
+ }
62
+ public function getApi()
63
+ {
64
+ $api = Mage::getModel('transparente/api');
65
+ return $api;
66
+ }
67
+ public function getOrderPlaceRedirectUrl()
68
+ {
69
+ $api = $this->getApi();
70
+ $info = $this->getInfoInstance();
71
+ $quote = $info->getQuote();
72
+ $additionaldata = unserialize($info->getAdditionalData());
73
+ $json_order = $this->getApi()->getDados($quote);
74
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
75
+ $json_payment = $this->getApi()->getPaymentJsonTef($info, $quote);
76
+ $payment = $this->getApi()->generatePayment($json_payment, $IdMoip);
77
+ $additionaldataAfter = array(
78
+ 'token_moip' => $json_order,
79
+ 'response_moip' => $payment,
80
+ 'order_moip' => (string) $IdMoip
81
+ );
82
+ $additionaldata = array_merge($additionaldata, $additionaldataAfter);
83
+ $info->setAdditionalData(serialize($additionaldata))->save();
84
+ $info->setAdditionalInformation(serialize($additionaldata))->save();
85
+
86
+ $this->prepare();
87
+ if (isset($payment->errors)) {
88
+ foreach ($payment->errors as $key => $value) {
89
+ $erros = (string) $value->description . " " . $erros;
90
+ }
91
+ $session = Mage::getSingleton('checkout/session');
92
+ $session->setMoipError($erros);
93
+ $api->generateLog($json_payment, 'MOIP_ErrorPayment.log');
94
+ $api->generateLog($payment, 'MOIP_ErrorPayment.log');
95
+ return Mage::getUrl('transparente/standard/cancel', array(
96
+ '_secure' => true
97
+ ));
98
+ } else {
99
+ return Mage::getUrl('transparente/standard/redirect', array(
100
+ '_secure' => true
101
+ ));
102
+ }
103
+ }
104
+ }
app/code/local/MOIP/Transparente/Model/Mysql4/Write.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
  class MOIP_Transparente_Model_Mysql4_Write extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
  public function _construct()
5
- {
6
- $this->_init('transparente/write', 'order_id');
7
  }
8
  }
9
  ?>
1
+ <?php
2
  class MOIP_Transparente_Model_Mysql4_Write extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
  public function _construct()
5
+ {
6
+ $this->_init('transparente/write', 'entity_id_moip');
7
  }
8
  }
9
  ?>
app/code/local/MOIP/Transparente/Model/Observer.php CHANGED
@@ -1,180 +1,396 @@
1
  <?php
2
-
3
  class Moip_Transparente_Model_Observer
4
  {
5
- public function getMethod($observer) {
6
- $aplica = 0;
7
- $discountAmount = 0;
8
- $quote=$observer->getEvent()->getQuote();
9
-
10
- if($quote->getPayment()->getFormaPagamento() == 'BoletoBancario'){
11
- $type = 'Boleto Bancário';
12
- $valorinicial = $quote->getGrandTotal();
13
- if (Mage::getStoreConfig('moipall/pagamento_avancado/pagamento_boleto')){
14
-
15
- if ($valorinicial >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor'))
16
- {
17
-
18
- if ($valorinicial >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') && (int)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') != 0)
19
- {
20
-
21
- $valorinicial = $quote->getSubtotal();
22
- $percentual_valor = (double)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2')/100;
23
- $percentual = Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2');
24
- $discountAmount = $valorinicial * $percentual_valor;
25
- $aplica = 1;
26
- }
27
-
28
- else {
29
-
30
- $valorinicial = $quote->getSubtotal();
31
- $percentual_valor = (double)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc')/100;
32
- $percentual = Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc');
33
- $discountAmount = $valorinicial * $percentual_valor;
34
- $aplica = 1;
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
 
 
 
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
- }else if($quote->getPayment()->getFormaPagamento() == 'DebitoBancario'){
41
- $type = 'Débito Bancário';
42
- if (Mage::getStoreConfig('moipall/pagamento_avancado/transf_desc')){
43
- if ($valorinicial >= Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') && (int)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_valor2') != 0)
44
- {
45
-
46
- $valorinicial = $quote->getSubtotal();
47
- $percentual_valor = (double)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2')/100;
48
- $percentual = Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc2');
49
- $discountAmount = $valorinicial * $percentual_valor;
50
- $aplica = 1;
51
- } else {
52
-
53
- $valorinicial = $quote->getSubtotal();
54
- $percentual_valor = (double)Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc')/100;
55
- $percentual = Mage::getStoreConfig('moipall/pagamento_avancado/boleto_desc');
56
- $discountAmount = $valorinicial * $percentual_valor;
57
- $aplica = 1;
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
- }
61
- if($aplica){
62
- $total = $quote->getBaseSubtotal();
63
- $quote->setSubtotal(0);
64
- $quote->setBaseSubtotal(0);
65
-
66
- $quote->setSubtotalWithDiscount(0);
67
- $quote->setBaseSubtotalWithDiscount(0);
68
-
69
- $quote->setGrandTotal(0);
70
- $quote->setBaseGrandTotal(0);
71
-
72
-
73
- $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');
74
- foreach($quote->getAllAddresses() as $address)
75
- {
76
-
77
- $address->setSubtotal(0);
78
- $address->setBaseSubtotal(0);
79
-
80
- $address->setGrandTotal(0);
81
- $address->setBaseGrandTotal(0);
82
-
83
- $address->collectTotals();
84
-
85
- $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());
86
- $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());
87
- $quote->setSubtotalWithDiscount((float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());
88
- $quote->setBaseSubtotalWithDiscount((float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());
89
- $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());
90
- $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());
91
- $quote->save();
92
-
93
- $quote->setGrandTotal($quote->getBaseSubtotal() - $discountAmount)
94
- ->setBaseGrandTotal($quote->getBaseSubtotal() - $discountAmount)
95
- ->setSubtotalWithDiscount($quote->getBaseSubtotal() - $discountAmount)
96
- ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $discountAmount)
97
- ->save();
98
-
99
-
100
- if($address->getAddressType() == $canAddItems)
101
- {
102
- $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount() - $discountAmount);
103
- $address->setGrandTotal((float) $address->getGrandTotal() - $discountAmount);
104
- $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount() - $discountAmount);
105
- $address->setBaseGrandTotal((float) $address->getBaseGrandTotal() - $discountAmount);
106
-
107
- // When Mageno Promo Code is used
108
- if($address->getDiscountDescription())
109
- {
110
- $address->setDiscountAmount(($address->getDiscountAmount() - $discountAmount));
111
- //$address->setDiscountAmount($total - $discountAmount);
112
- $address->setDiscountDescription($address->getDiscountDescription().' , '.$percentual.'% sobre subtotal');
113
- //$address->setBaseDiscountAmount($total - $discountAmount);
114
- $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount() - $discountAmount));
115
- }
116
- // When Subscribed Customer 5% discount is used
117
- else
118
- {
119
- //$address->setDiscountAmount(-($discountAmount));
120
- $address->setDiscountAmount($discountAmount);
121
- $address->setDiscountDescription($percentual.'% sobre subtotal');
122
- $address->setBaseDiscountAmount($discountAmount);
123
- //$address->setBaseDiscountAmount(-($discountAmount));
124
- }
125
-
126
- $address->save();
127
- }
128
- }
129
 
130
- foreach($quote->getAllItems() as $item)
131
- {
132
- //We apply discount amount based on the ratio between the GrandTotal and the RowTotal
133
- $rat = $item->getPriceInclTax() / $total;
134
- $ratdisc = $discountAmount * $rat;
 
135
 
136
- $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());
137
- $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc) * $item->getQty())->save();
138
- }
139
 
140
 
141
- }
142
 
143
- }
144
- public function setStatus() {
145
- $time = time();
146
- $to = date('Y-m-d H:i:s', $time);
147
- $moip_boleto_vencimento = Mage::getStoreConfig('payment/moip_transparente_standard/vcmentoboleto') + 4;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  $time_boleto = '-'.(int)$moip_boleto_vencimento.' day';
149
- $from = date('Y-m-d H:i:s',(strtotime ( $time_boleto, strtotime ( $to) ) ));
150
- $to = date('Y-m-d H:i:s', $time);
151
- $moip_boleto_vencimento2 = Mage::getStoreConfig('payment/moip_transparente_standard/vcmentoboleto') + 3;
152
- $time_boleto2 = '-'.(int)$moip_boleto_vencimento2.' day';
153
- $to_end = date('Y-m-d H:i:s',(strtotime ( $time_boleto2, strtotime ( $to) ) ));
154
- Mage::log($from, null, 'MOIP_Cron.log', true);
155
- $order_collection = Mage::getModel('sales/order')->getCollection()
156
- ->addFieldToFilter('created_at', array('from' => $from, 'to' => $to_end))
157
- ->addAttributeToFilter('status', 'holded');
158
- foreach($order_collection as $order){
159
- $order = Mage::getModel('sales/order')->load($order->getEntityId());
160
-
161
- if($order->canUnhold()) {
162
- $order->unhold()->save();
163
- }
164
-
165
- if(!$order->canCancel())
166
- continue;
167
- $link = Mage::getUrl('sales/order/reorder/');
168
- $link = $link.'order_id/'.$order->getEntityId();
169
- $comment = "Cancelado por tempo limite para a notificação de pagamento, caso tenha feito o pagamento entre em contato com o nosso atendimento, se desejar poderá refazer o seu pedido acessando: ".$link;
170
- $status = 'canceled';
171
- $order->cancel();
172
- $state = Mage_Sales_Model_Order::STATE_CANCELED;
173
- $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
174
- $order->sendOrderUpdateEmail(true, $comment);
175
- $order->save();
176
  }
177
  }
178
 
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
1
  <?php
 
2
  class Moip_Transparente_Model_Observer
3
  {
4
+
5
+ public function getStateAll($order){
6
+ $standard = $this->getStandard();
7
+ $api = $this->getApi();
8
+ $model = Mage::getModel('transparente/write');
9
+ $api->generateLog("------- CONSULTA -------", 'MOIP_CRON.log');
10
+ $api->generateLog($order->getId(), 'MOIP_CRON.log');
11
+ $api->generateLog($moip_pay, 'MOIP_CRON.log');
12
+ $result = $model->load($order->getId(), 'mage_pay');
13
+ $moip_pay = $result->getMoipPay();
14
+ $url = "https://api.moip.com.br/v2/webhooks?resourceId=".$moip_pay;
15
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod');
16
+ $header = "Authorization: OAuth " . $oauth;
17
+ $documento = 'Content-Type: application/json; charset=utf-8';
18
+ $result = array();
19
+ $ch = curl_init();
20
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21
+ curl_setopt($ch, CURLOPT_URL, $url);
22
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
23
+ $header
24
+ ));
25
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
26
+ $responseBody = curl_exec($ch);
27
+ $info_curl = curl_getinfo($ch);
28
+ curl_close($ch);
29
+ $api->generateLog($moip_pay, 'MOIP_CRON.log');
30
+
31
+ foreach (json_decode($responseBody, true) as $key => $value) {
32
+ foreach ($value as $key => $_value) {
33
+ $api->generateLog($_value['event'], 'MOIP_CRON.log');
34
+ if($_value['event'] == "PAYMENT.AUTHORIZED"){
35
+ $paid = $standard->getConfigData('order_status_processing');
36
+ $upOrder = $this->autorizaPagamento($order, $paid);
37
+ $autorize_pagamento = 1;
38
+ } elseif ($_value['event'] == "PAYMENT.CANCELLED") {
39
+
40
+ if($order->canUnhold()) {
41
+ $order->unhold()->save();
42
+ }
43
+
44
+ $order->cancel()->save();
45
+ $link = Mage::getUrl('sales/order/reorder/');
46
+ $link = $link.'order_id/'.$order->getEntityId();
47
+ $comment = "Cancelado por tempo limite para a notificação de pagamento, caso já tenha feito o pagamento entre em contato com o nosso atendimento, se desejar poderá refazer o seu pedido acessando: ".$link;
48
+ $status = 'canceled';
49
+ $order->cancel();
50
+ $state = Mage_Sales_Model_Order::STATE_CANCELED;
51
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
52
+ $order->sendOrderUpdateEmail(true, $comment);
53
+ $order->save();
54
+ } else {
55
+ return;
56
  }
57
+ }
58
+
59
+ }
60
+ return;
61
+
62
+ }
63
+
64
+ public function setStatusCcAll() {
65
+ $api = $this->getApi();
66
+ $api->generateLog("aciona", 'MOIP_CRON.log');
67
+
68
+
69
+ $to = date('Y-m-d', time());
70
+
71
+ $moip_boleto_vencimento = 3;
72
+ $time_boleto = '-'.(int)$moip_boleto_vencimento.' day';
73
+
74
+
75
+ $from_boleto = date('Y-m-d',(strtotime($time_boleto, strtotime($to))));
76
 
77
+
78
+ $from_date = date('Y-m-d H:i:s', strtotime("$from_boleto 00:00:00"));
79
+ $to_date = date('Y-m-d H:i:s', strtotime("$from_boleto 23:59:59"));
80
 
81
+
82
+
83
+
84
+ $api->generateLog($from_date, 'MOIP_CRON.log');
85
+ $api->generateLog($to_date, 'MOIP_CRON.log');
86
+ $orders = Mage::getModel("sales/order")->getCollection()->join(
87
+ array('payment' => 'sales/order_payment'),
88
+ 'main_table.entity_id=payment.parent_id',
89
+ array('payment_method' => 'payment.method')
90
+ );
91
+ $orders->addFieldToFilter('created_at', array('gteq' => $from_date))
92
+ ->addFieldToFilter('created_at', array('lteq' => $to_date))
93
+ ->addFieldToFilter('payment.method', array(array('eq' => 'moip_cc')))
94
+ >addAttributeToFilter('status', array('neq' => array('canceled','complete','closed')));
95
+
96
+ foreach($orders as $order){
97
+ $order = Mage::getModel('sales/order')->load($order->getEntityId());
98
+ $this->setStateAll($order);
99
  }
100
+ }
101
+
102
+
103
+
104
+ public function setStatusBoletoAll() {
105
+ $api = $this->getApi();
106
+ $api->generateLog("aciona", 'MOIP_CRON.log');
107
+
108
+
109
+ $to = date('Y-m-d', time());
110
+
111
+ $moip_boleto_vencimento = Mage::getStoreConfig('payment/moip_transparente_standard/vcmentoboleto') + 6;
112
+ $time_boleto = '-'.(int)$moip_boleto_vencimento.' day';
113
+
114
+
115
+ $from_boleto = date('Y-m-d',(strtotime($time_boleto, strtotime($to))));
116
+
117
+
118
+ $from_date = date('Y-m-d H:i:s', strtotime("$from_boleto 00:00:00"));
119
+ $to_date = date('Y-m-d H:i:s', strtotime("$from_boleto 23:59:59"));
120
+
121
+
122
+
123
+
124
+ $api->generateLog($from_date, 'MOIP_CRON.log');
125
+ $api->generateLog($to_date, 'MOIP_CRON.log');
126
+ $orders = Mage::getModel("sales/order")->getCollection()->join(
127
+ array('payment' => 'sales/order_payment'),
128
+ 'main_table.entity_id=payment.parent_id',
129
+ array('payment_method' => 'payment.method')
130
+ );
131
+ $orders->addFieldToFilter('created_at', array('gteq' => $from_date))
132
+ ->addFieldToFilter('created_at', array('lteq' => $to_date))
133
+ ->addFieldToFilter('payment.method', array(array('eq' => 'moip_boleto')))
134
+ >addAttributeToFilter('status', array('neq' => array('canceled','complete','closed')));
135
+
136
+ foreach($orders as $order){
137
+ $order = Mage::getModel('sales/order')->load($order->getEntityId());
138
+ $this->setStateAll($order);
139
  }
140
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
+ public function setStatusTefAll() {
143
+ $api = $this->getApi();
144
+ $api->generateLog("aciona", 'MOIP_CRON.log');
145
+
146
+
147
+ $to = date('Y-m-d', time());
148
 
149
+ $moip_boleto_vencimento = Mage::getStoreConfig('payment/moip_transparente_standard/vcmentoboleto') + 5;
150
+ $time_boleto = '-'.(int)$moip_boleto_vencimento.' day';
 
151
 
152
 
153
+ $from_boleto = date('Y-m-d',(strtotime($time_boleto, strtotime($to))));
154
 
155
+
156
+ $from_date = date('Y-m-d H:i:s', strtotime("$from_boleto 00:00:00"));
157
+ $to_date = date('Y-m-d H:i:s', strtotime("$from_boleto 23:59:59"));
158
+
159
+
160
+
161
+
162
+ $api->generateLog($from_date, 'MOIP_CRON.log');
163
+ $api->generateLog($to_date, 'MOIP_CRON.log');
164
+ $orders = Mage::getModel("sales/order")->getCollection()->join(
165
+ array('payment' => 'sales/order_payment'),
166
+ 'main_table.entity_id=payment.parent_id',
167
+ array('payment_method' => 'payment.method')
168
+ );
169
+ $orders->addFieldToFilter('created_at', array('gteq' => $from_date))
170
+ ->addFieldToFilter('created_at', array('lteq' => $to_date))
171
+ ->addFieldToFilter('payment.method', array(array('eq' => 'moip_tef')))
172
+ >addAttributeToFilter('status', array('neq' => array('canceled','complete','closed')));
173
+
174
+ foreach($orders as $order){
175
+ $order = Mage::getModel('sales/order')->load($order->getEntityId());
176
+ $this->setStateAll($order);
177
+ }
178
+ }
179
+
180
+ public function setStatusAll() {
181
+ $api = $this->getApi();
182
+ $api->generateLog("aciona", 'MOIP_CRON.log');
183
+
184
+
185
+ $to = date('Y-m-d', time());
186
+
187
+ $moip_boleto_vencimento = Mage::getStoreConfig('payment/moip_transparente_standard/vcmentoboleto') + 7;
188
  $time_boleto = '-'.(int)$moip_boleto_vencimento.' day';
189
+
190
+
191
+ $from_boleto = date('Y-m-d',(strtotime($time_boleto, strtotime($to))));
192
+
193
+
194
+ $from_date = date('Y-m-d H:i:s', strtotime("$from_boleto 00:00:00"));
195
+ $to_date = date('Y-m-d H:i:s', strtotime("$from_boleto 23:59:59"));
196
+
197
+
198
+
199
+
200
+ $api->generateLog($from_date, 'MOIP_CRON.log');
201
+ $api->generateLog($to_date, 'MOIP_CRON.log');
202
+ $orders = Mage::getModel("sales/order")->getCollection()->join(
203
+ array('payment' => 'sales/order_payment'),
204
+ 'main_table.entity_id=payment.parent_id',
205
+ array('payment_method' => 'payment.method')
206
+ );
207
+ $orders->addFieldToFilter('created_at', array('gteq' => $from_date))
208
+ ->addFieldToFilter('created_at', array('lteq' => $to_date))
209
+ ->addFieldToFilter('payment.method', array(array('eq' => 'moip_cc'), array('eq' => 'moip_boleto'), array('eq' => 'moip_tef')))
210
+ >addAttributeToFilter('status', array('neq' => array('canceled','complete','closed')));
211
+
212
+ foreach($orders as $order){
213
+ $order = Mage::getModel('sales/order')->load($order->getEntityId());
214
+ $this->setStateAll($order);
 
215
  }
216
  }
217
 
218
 
219
+ public function setHoldedNotification(){
220
+ $api = $this->getApi();
221
+ $api->generateLog("----- Enviando Boleto a vencer -----", 'MOIP_CRON.log');
222
+
223
+
224
+ $to = date('Y-m-d', time());
225
+
226
+ $moip_boleto_vencimento = Mage::getStoreConfig('payment/moip_transparente_standard/vcmentoboleto');
227
+ $time_boleto = '-'.(int)$moip_boleto_vencimento.' day';
228
+
229
+
230
+ $from_boleto = date('Y-m-d',(strtotime($time_boleto, strtotime($to))));
231
+
232
+
233
+ $from_date = date('Y-m-d H:i:s', strtotime("$from_boleto 00:00:00"));
234
+ $to_date = date('Y-m-d H:i:s', strtotime("$from_boleto 23:59:59"));
235
+
236
+
237
+
238
+
239
+ $api->generateLog($from_date, 'MOIP_CRON.log');
240
+ $api->generateLog($to_date, 'MOIP_CRON.log');
241
+ $orders = Mage::getModel("sales/order")->getCollection()->join(
242
+ array('payment' => 'sales/order_payment'),
243
+ 'main_table.entity_id=payment.parent_id',
244
+ array('payment_method' => 'payment.method')
245
+ );
246
+ $orders->addFieldToFilter('created_at', array('gteq' => $from_date))
247
+ ->addFieldToFilter('created_at', array('lteq' => $to_date))
248
+ ->addFieldToFilter('payment.method', array(array('eq' => 'moip_boleto')))
249
+ >addAttributeToFilter('status', array('neq' => array('canceled','complete','closed')));
250
+
251
+ foreach($orders as $order){
252
+ $order = Mage::getModel('sales/order')->load($order->getEntityId());
253
+ $onhold = $standard->getConfigData('order_status_holded_boleto');
254
+ $state = Mage_Sales_Model_Order::STATE_HOLDED;
255
+ $status = $onhold;
256
+ $comment = "Seu boleto está próximo a vencer, caso não tenha realizado o pagamento ainda, acesse sua conta e realize agora.";
257
+ $update = $this->updateInOrder($order, $state, $status, $comment);
258
+
259
+ }
260
+
261
+
262
+ }
263
+
264
+
265
+
266
+ public function getPriceBundle($product) {
267
+
268
+ $grouped_product_model = Mage::getModel('catalog/product_type_grouped');
269
+ $groupedParentId = $grouped_product_model->getParentIdsByChild($product->getId());
270
+ $_associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
271
+
272
+ foreach($_associatedProducts as $_associatedProduct) {
273
+ if($ogPrice = $_associatedProduct->getPrice()) {
274
+ $ogPrice = $_associatedProduct->getPrice();
275
+ }
276
+ }
277
+
278
+ return $ogPrice;
279
+
280
+
281
+ }
282
+
283
+ public function getApi()
284
+ {
285
+ $api = Mage::getModel('transparente/api');
286
+ return $api;
287
+ }
288
+
289
+ public function getStandard() {
290
+ return Mage::getSingleton('transparente/standard');
291
+ }
292
+
293
+
294
+ public function autorizaPagamento($order, $paid){
295
+
296
+
297
+ if($order->canUnhold()) {
298
+ $order->unhold()->save();
299
+ }
300
+
301
+ $invoice = $order->prepareInvoice();
302
+ if ($this->getStandard()->canCapture())
303
+ {
304
+ $invoice->register()->capture();
305
+ }
306
+ Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
307
+ $invoice->sendEmail();
308
+ $invoice->setEmailSent(true);
309
+ $invoice->save();
310
+
311
+
312
+
313
+ return;
314
+ }
315
+
316
+ public function updateInOrder($order, $state, $status, $comment){
317
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
318
+ $order->save();
319
+ $order->sendOrderUpdateEmail(true, $comment);
320
+ return true;
321
+ }
322
+
323
+
324
+ public function catalog_product_save_after_plans($observer){
325
+ $product = $observer->getProduct();
326
+ if($product->getIsRecurring()){
327
+ $recurring = $product->getRecurringProfile();
328
+
329
+ if($recurring['init_amount']){
330
+ $setup = number_format($recurring['init_amount'], 2, '', '');
331
+ } else {
332
+ $setup = $recurring['init_amount'];
333
+ }
334
+ if($recurring['trial_period_frequency']){
335
+ if($recurring['trial_period_unit'] == 'day')
336
+ $trial_date = $recurring['trial_period_frequency'];
337
+ elseif($recurring['trial_period_unit'] == 'week')
338
+ $trial_date = $recurring['trial_period_frequency']*7;
339
+ elseif($recurring['trial_period_unit'] == 'semi_month')
340
+ $trial_date = $recurring['trial_period_frequency']*14;
341
+ elseif($recurring['trial_period_unit'] == 'month')
342
+ $trial_date = $recurring['trial_period_frequency']*30;
343
+ elseif($recurring['trial_period_unit'] == 'year')
344
+ $trial_date = $recurring['trial_period_frequency']*360;
345
+
346
+ } else {
347
+ $trial_date = 0;
348
+ }
349
+
350
+
351
+ if($product->getTypeId() != "grouped"){
352
+ $data = array(
353
+ 'code' => $product->getSku(),
354
+ 'name' => $product->getName(),
355
+ 'description' => $recurring['schedule_description'],
356
+ 'max_qty' => $recurring['period_max_cycles'],
357
+ 'amount' => number_format($product->getFinalPrice(), 2, '', ''),
358
+ 'setup_fee' => $setup,
359
+ 'interval' => array(
360
+ 'length' => $recurring['period_frequency'],
361
+ 'unit' => $recurring['period_unit'],
362
+ ),
363
+ 'billing_cycles' => $recurring['period_max_cycles'],
364
+
365
+ 'status' => 'ACTIVE',
366
+ 'payment_method' => 'ALL',
367
+ );
368
+ } else {
369
+ $data = array(
370
+ 'code' => $product->getSku(),
371
+ 'name' => $product->getName(),
372
+ 'description' => $recurring['schedule_description'],
373
+ 'max_qty' => $recurring['period_max_cycles'],
374
+ 'amount' => number_format($this->getPriceBundle($product), 2, '', ''),
375
+ 'setup_fee' => $setup,
376
+ 'interval' => array(
377
+ 'length' => $recurring['period_frequency'],
378
+ 'unit' => $recurring['period_unit'],
379
+ ),
380
+ 'billing_cycles' => $recurring['period_max_cycles'],
381
+ 'status' => 'ACTIVE',
382
+ 'payment_method' => 'ALL',
383
+
384
+
385
+ );
386
+ }
387
+
388
+ $api = Mage::getSingleton('transparente/recurringapi');
389
+ $plans_data = $api->ConsultPlans($data);
390
+
391
+
392
+ return;
393
+ }
394
+
395
+ }
396
  }
app/code/local/MOIP/Transparente/Model/Recurringapi.php ADDED
@@ -0,0 +1,603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Moip_Transparente_Model_Recurringapi {
3
+
4
+ const ENDPOINT_RECURRING_TEST = "https://sandbox.moip.com.br/assinaturas/v1/";
5
+ const ENDPOINT_RECURRING_PROD = "https://api.moip.com.br/assinaturas/v1/";
6
+
7
+
8
+
9
+ public function getToken(){
10
+ $configValue = Mage::getStoreConfig('payment/moip_recurring/api_id');
11
+ $api_token = Mage::helper('core')->decrypt($configValue);
12
+ return $api_token;
13
+ }
14
+
15
+ public function getKey(){
16
+ $configValue = Mage::getStoreConfig('payment/moip_recurring/api_key');
17
+ $api_key = Mage::helper('core')->decrypt($configValue);
18
+ return $api_key;
19
+ }
20
+
21
+
22
+
23
+
24
+ public function searchCustomersPlans($profile, $payments){
25
+ $quote = $payments->getQuote();
26
+ $customer = $quote->getCustomer();
27
+ $customer_plans_id = $customer->getId();
28
+ $this->generateLog($customer_plans_id, 'MOIP_CreateSubscriptionsPlans.log');
29
+ $documento = 'Content-Type: application/json; charset=utf-8';
30
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
31
+ $url = self::ENDPOINT_RECURRING_TEST."customers";
32
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
33
+ } else {
34
+ $url = self::ENDPOINT_RECURRING_PROD."customers";
35
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
36
+ }
37
+ $result = array();
38
+ $ch = curl_init();
39
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
40
+ curl_setopt($ch, CURLOPT_URL, $url);
41
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
42
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
43
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
44
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
45
+ $header,
46
+ $documento
47
+ ));
48
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
49
+ $responseBody = curl_exec($ch);
50
+ $info_curl = curl_getinfo($ch);
51
+ curl_close($ch);
52
+ $decode_user_plans = json_decode($responseBody, true);
53
+ foreach ($decode_user_plans as $key => $value) {
54
+ foreach ($value as $key => $value) {
55
+ $plans_code[] = $value['code'];
56
+ }
57
+ }
58
+ if(in_array($customer_plans_id, $plans_code))
59
+ return $this->generateUpdateCustomer($profile, $payments);
60
+ else
61
+ return $this->setCustomersPlans($profile, $payments);
62
+ }
63
+
64
+ public function setCustomersPlans($profile, $payments){
65
+ $quote = $payments->getQuote();
66
+ $customer = $quote->getCustomer();
67
+ $additionaldata = unserialize($payments->getAdditionalData());
68
+ if ($quote->getShippingAddress()) {
69
+ $address = $quote->getShippingAddress();
70
+ } else {
71
+ $address = $quote->getBillingAddress();
72
+ }
73
+ $birthdate = $quote->getCustomerDob();
74
+ $day = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('dd');
75
+ $month = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('MM');
76
+ $year = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('Y');
77
+ $method_type = $payments->getQuote()->getPayment()->getMethodInstance()->getCode();
78
+
79
+ if($method_type == 'moip_boletorecurring'){
80
+ $customer_plans = array(
81
+ 'code' => $customer->getId(),
82
+ 'fullname' => $customer->getName(),
83
+ 'email' => strtolower(Mage::getSingleton('customer/session')->getCustomer()->getEmail()),
84
+ 'cpf' => preg_replace("/[^0-9]/", "",$customer->getTaxvat()),
85
+ 'phone_area_code' => $this->getNumberOrDDD($address->getTelephone(), true),
86
+ 'phone_number' => $this->getNumberOrDDD($address->getTelephone(), false),
87
+ 'birthdate_day' => $day,
88
+ 'birthdate_month' => $month,
89
+ 'birthdate_year' => $year,
90
+ 'address' => array(
91
+ 'street' => $address->getStreet(1),
92
+ 'number' => $this->getNumEndereco($address->getStreet(2), $address->getStreet(1)),
93
+ 'complement' => $address->getStreet(3),
94
+ 'district' => $address->getStreet(4),
95
+ 'city' => $address->getCity(),
96
+ 'state' => strtoupper($address->getRegionCode()),
97
+ 'country' => "BRA",
98
+ 'zipcode' => substr(preg_replace("/[^0-9]/", "", $address->getPostcode()) . '00000000', 0, 8)
99
+ ),
100
+
101
+ );
102
+ } else {
103
+ $customer_plans = array(
104
+ 'code' => $customer->getId(),
105
+ 'fullname' => $customer->getName(),
106
+ 'email' => strtolower(Mage::getSingleton('customer/session')->getCustomer()->getEmail()),
107
+ 'cpf' => preg_replace("/[^0-9]/", "",$customer->getTaxvat()),
108
+ 'phone_area_code' => $this->getNumberOrDDD($address->getTelephone(), true),
109
+ 'phone_number' => $this->getNumberOrDDD($address->getTelephone(), false),
110
+ 'birthdate_day' => $day,
111
+ 'birthdate_month' => $month,
112
+ 'birthdate_year' => $year,
113
+ 'address' => array(
114
+ 'street' => $address->getStreet(1),
115
+ 'number' => $this->getNumEndereco($address->getStreet(2), $address->getStreet(1)),
116
+ 'complement' => $address->getStreet(3),
117
+ 'district' => $address->getStreet(4),
118
+ 'city' => $address->getCity(),
119
+ 'state' => strtoupper($address->getRegionCode()),
120
+ 'country' => "BRA",
121
+ 'zipcode' => substr(preg_replace("/[^0-9]/", "", $address->getPostcode()) . '00000000', 0, 8)
122
+ ),
123
+ 'billing_info' => array(
124
+ 'credit_card' => array(
125
+ 'holder_name' => $payments->getCcOwner(),
126
+ 'number' => $additionaldata['hash_moip'],
127
+ 'expiration_month' => $payments->getCcExpMonth(),
128
+ 'expiration_year' => $payments->getCcExpYear(),
129
+ ),
130
+ ),
131
+ );
132
+ }
133
+
134
+
135
+ $this->generateLog(json_encode($customer_plans), 'MOIP_RecurringCustomer.log');
136
+ return $this->createCustomersPlans($customer_plans, $profile, $payments);
137
+ }
138
+
139
+ public function createCustomersPlans($data, $profile, $payments){
140
+ $data = json_encode($data);
141
+ $documento = 'Content-Type: application/json; charset=utf-8';
142
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
143
+ $method_type = $payments->getQuote()->getPayment()->getMethodInstance()->getCode();
144
+ if($method_type == "moip_boletorecurring"){
145
+ $url = self::ENDPOINT_RECURRING_TEST."customers?new_vault=false";
146
+ } else {
147
+ $url = self::ENDPOINT_RECURRING_TEST."customers?new_vault=true";
148
+ }
149
+
150
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
151
+ } else {
152
+
153
+ $method_type = $payments->getQuote()->getPayment()->getMethodInstance()->getCode();
154
+ if($method_type == "moip_boletorecurring"){
155
+ $url = self::ENDPOINT_RECURRING_PROD."customers?new_vault=false";
156
+ } else {
157
+ $url = self::ENDPOINT_RECURRING_PROD."customers?new_vault=true";
158
+ }
159
+
160
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
161
+ }
162
+ $result = array();
163
+ $ch = curl_init();
164
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
165
+ curl_setopt($ch, CURLOPT_URL, $url);
166
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
167
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
168
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
169
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
170
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
171
+ $header,
172
+ $documento
173
+ ));
174
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
175
+ $responseBody = curl_exec($ch);
176
+ $info_curl = curl_getinfo($ch);
177
+ curl_close($ch);
178
+ $this->generateLog($data, 'MOIP_RecurringCreateCustomerRequest.log');
179
+ $this->generateLog($responseBody, 'MOIP_RecurringCreateCustomerRequest.log');
180
+ $this->generateLog($header, 'MOIP_RecurringCreateCustomerRequest.log');
181
+ $this->generateLog(json_encode($info_curl), 'MOIP_RecurringCreateCustomerRequest.log');
182
+
183
+ $decode = json_decode($responseBody);
184
+ return $this->generateUpdateCustomer($profile, $payments);
185
+ }
186
+
187
+ public function generateUpdateCustomer($profile, $payments)
188
+ {
189
+ $quote = $payments->getQuote();
190
+ $customer = $quote->getCustomer();
191
+ $customer_id = $customer->getId();
192
+ $method_type = $payments->getQuote()->getPayment()->getMethodInstance()->getCode();
193
+ if ($quote->getShippingAddress()) {
194
+ $address = $quote->getShippingAddress();
195
+ } else {
196
+ $address = $quote->getBillingAddress();
197
+ }
198
+ if($method_type != 'moip_boletorecurring'){
199
+ $additionaldata = unserialize($payments->getAdditionalData());
200
+ $birthdate = $quote->getCustomerDob();
201
+ $day = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('dd');
202
+ $month = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('MM');
203
+ $year = Mage::app()->getLocale()->date($quote->getCustomerDob(), null, null, false)->toString('Y');
204
+ $customer_plans = array(
205
+
206
+ 'credit_card' => array(
207
+ 'holder_name' => $payments->getCcOwner(),
208
+ 'number' => $additionaldata['hash_moip'],
209
+ 'expiration_month' => $payments->getCcExpMonth(),
210
+ 'expiration_year' => $payments->getCcExpYear(),
211
+ ),
212
+
213
+ );
214
+
215
+
216
+
217
+
218
+ $data = json_encode($customer_plans);
219
+ $documento = 'Content-Type: application/json; charset=utf-8';
220
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
221
+ $url = self::ENDPOINT_RECURRING_TEST."customers/{$customer_id}/billing_infos";
222
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
223
+ } else {
224
+ $url = self::ENDPOINT_RECURRING_PROD."customers/{$customer_id}/billing_infos";
225
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
226
+ }
227
+ $result = array();
228
+ $ch = curl_init();
229
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
230
+ curl_setopt($ch, CURLOPT_URL, $url);
231
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
232
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
233
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
234
+ $header,
235
+ $documento
236
+ ));
237
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
238
+ $responseBody = curl_exec($ch);
239
+ $info_curl = curl_getinfo($ch);
240
+ curl_close($ch);
241
+ $this->generateLog($header, 'MOIP_UpdateCustomer.log');
242
+ $this->generateLog($documento, 'MOIP_UpdateCustomer.log');
243
+ $this->generateLog(json_encode($customer_plans), 'MOIP_UpdateCustomer.log');
244
+
245
+ $this->generateLog(json_encode($info_curl), 'MOIP_UpdateCustomer.log');
246
+ $this->generateLog($url, 'MOIP_UpdateCustomer.log');
247
+ }
248
+ return $this->setCreateSubscriptionsPlans($profile, $payments);
249
+
250
+ }
251
+
252
+ public function cancelSubscription($prolie_id){
253
+ #https://sandbox.moip.com.br/assinaturas/v1/subscriptions/{code}/cancel
254
+
255
+ $documento = 'Content-Type: application/json; charset=utf-8';
256
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
257
+ $url = self::ENDPOINT_RECURRING_TEST."subscriptions/{$prolie_id}/cancel";
258
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
259
+ } else {
260
+ $url = self::ENDPOINT_RECURRING_PROD."subscriptions/{$prolie_id}/cancel";
261
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
262
+ }
263
+
264
+ $ch = curl_init();
265
+ curl_setopt($ch, CURLOPT_URL, $url);
266
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
267
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
268
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
269
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
270
+ $header,
271
+ $documento
272
+ ));
273
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
274
+ $responseBody = curl_exec($ch);
275
+ $info_curl = curl_getinfo($ch);
276
+ curl_close($ch);
277
+
278
+ $this->generateLog($url, 'MOIP_CanceleCustomer.log');
279
+ $this->generateLog(json_encode($prolie_id), 'MOIP_CanceleCustomer.log');
280
+ $this->generateLog(json_encode($header), 'MOIP_CanceleCustomer.log');
281
+ $this->generateLog(json_encode($info_curl), 'MOIP_CanceleCustomer.log');
282
+
283
+
284
+
285
+ }
286
+ public function suspendSubscription($prolie_id){
287
+ #https://sandbox.moip.com.br/assinaturas/v1/subscriptions/{code}/cancel
288
+
289
+ $documento = 'Content-Type: application/json; charset=utf-8';
290
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
291
+ $url = self::ENDPOINT_RECURRING_TEST."subscriptions/{$prolie_id}/suspend";
292
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
293
+ } else {
294
+ $url = self::ENDPOINT_RECURRING_PROD."subscriptions/{$prolie_id}/suspend";
295
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
296
+ }
297
+
298
+ $ch = curl_init();
299
+ curl_setopt($ch, CURLOPT_URL, $url);
300
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
301
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
302
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
303
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
304
+ $header,
305
+ $documento
306
+ ));
307
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
308
+ $responseBody = curl_exec($ch);
309
+ $info_curl = curl_getinfo($ch);
310
+ curl_close($ch);
311
+
312
+ $this->generateLog($url, 'MOIP_CanceleCustomer.log');
313
+ $this->generateLog(json_encode($prolie_id), 'MOIP_CanceleCustomer.log');
314
+ $this->generateLog(json_encode($header), 'MOIP_CanceleCustomer.log');
315
+ $this->generateLog(json_encode($info_curl), 'MOIP_CanceleCustomer.log');
316
+
317
+
318
+
319
+ }
320
+
321
+ public function activateSubscription($prolie_id){
322
+ #https://sandbox.moip.com.br/assinaturas/v1/subscriptions/{code}/cancel
323
+
324
+ $documento = 'Content-Type: application/json; charset=utf-8';
325
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
326
+ $url = self::ENDPOINT_RECURRING_TEST."subscriptions/{$prolie_id}/activate";
327
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
328
+ } else {
329
+ $url = self::ENDPOINT_RECURRING_PROD."subscriptions/{$prolie_id}/activate";
330
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
331
+ }
332
+
333
+ $ch = curl_init();
334
+ curl_setopt($ch, CURLOPT_URL, $url);
335
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
336
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
337
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
338
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
339
+ $header,
340
+ $documento
341
+ ));
342
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
343
+ $responseBody = curl_exec($ch);
344
+ $info_curl = curl_getinfo($ch);
345
+ curl_close($ch);
346
+
347
+ $this->generateLog($url, 'MOIP_CanceleCustomer.log');
348
+ $this->generateLog(json_encode($prolie_id), 'MOIP_CanceleCustomer.log');
349
+ $this->generateLog(json_encode($header), 'MOIP_CanceleCustomer.log');
350
+ $this->generateLog(json_encode($info_curl), 'MOIP_CanceleCustomer.log');
351
+
352
+
353
+
354
+ }
355
+
356
+
357
+
358
+
359
+ /* cria assinaturas */
360
+ public function setCreateSubscriptionsPlans($profile, $payments){
361
+ $quote = $payments->getQuote();
362
+ $customer = $quote->getCustomer();
363
+ $customer_plans = $customer->getId();
364
+ $cartItems = $quote->getAllVisibleItems();
365
+ $method = $payments->getQuote()->getPayment()->getMethodInstance()->getCode();
366
+ if($method == 'moip_boletorecurring'){
367
+ $method_type = "BOLETO";
368
+ } else {
369
+ $method_type = "CREDIT_CARD";
370
+ }
371
+ $this->generateLog($method_type, 'MOIP_CreateSubscriptionsPlans.log');
372
+ foreach ($cartItems as $item) {
373
+ $code_plans = $item->getSku();
374
+
375
+ $send_subscription = array(
376
+ 'code' => $profile->getId(),
377
+ 'amount' => number_format($profile->getTaxAmount() + $profile->getBillingAmount() + $profile->getShippingAmount(), 2, '', ''),
378
+ "payment_method" => $method_type,
379
+ 'plan' => array(
380
+ 'code' => $code_plans
381
+ ),
382
+ 'customer' => array(
383
+ 'code' => $customer->getId(),
384
+ ),
385
+ );
386
+ $send_subscription_json = json_encode($send_subscription);
387
+ $documento = 'Content-Type: application/json; charset=utf-8';
388
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
389
+ $url = self::ENDPOINT_RECURRING_TEST."subscriptions";
390
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
391
+ } else {
392
+ $url = self::ENDPOINT_RECURRING_PROD."subscriptions";
393
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
394
+ }
395
+ $result = array();
396
+ $ch = curl_init();
397
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
398
+ curl_setopt($ch, CURLOPT_URL, $url);
399
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
400
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
401
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $send_subscription_json);
402
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
403
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
404
+ $header,
405
+ $documento
406
+ ));
407
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
408
+ $responseBody = curl_exec($ch);
409
+ $info_curl = curl_getinfo($ch);
410
+ curl_close($ch);
411
+ $this->generateLog($send_subscription_json, 'MOIP_CreateSubscriptionsPlans.log');
412
+ $this->generateLog($responseBody, 'MOIP_CreateSubscriptionsPlans.log');
413
+ $this->generateLog($header, 'MOIP_CreateSubscriptionsPlans.log');
414
+ $this->generateLog(json_encode($info_curl), 'MOIP_CreateSubscriptionsPlans.log');
415
+ }
416
+
417
+
418
+ $this->generateLog($send_subscription_json, 'MOIP_CreateSubscriptionsPlans.log');
419
+ return $responseBody;
420
+ }
421
+
422
+
423
+
424
+
425
+ /* Cria e gerencia planos de assinaturas */
426
+ public function ConsultPlans($data){
427
+ $documento = 'Content-Type: application/json; charset=utf-8';
428
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
429
+ $url = self::ENDPOINT_RECURRING_TEST."plans";
430
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
431
+ } else {
432
+ $url = self::ENDPOINT_RECURRING_PROD."plans";
433
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
434
+ }
435
+ $result = array();
436
+ $ch = curl_init();
437
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
438
+ curl_setopt($ch, CURLOPT_URL, $url);
439
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
440
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
441
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
442
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
443
+ $header,
444
+ $documento
445
+ ));
446
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
447
+ $responseBody = curl_exec($ch);
448
+ $info_curl = curl_getinfo($ch);
449
+ curl_close($ch);
450
+
451
+ # Mage::log($responseBody, null, 'MOIP_RecurringPlansResponse.log', true);
452
+
453
+ $decode_plans = json_decode($responseBody, true);
454
+ foreach ($decode_plans as $key => $value) {
455
+ foreach ($value as $key => $valueb) {
456
+ $plans_code[] = $valueb['code'];
457
+ }
458
+ }
459
+ if(in_array($data['code'], $plans_code))
460
+ return $this->setUpdatePlans($data);
461
+ else
462
+ return $this->setCreatePlans($data);
463
+ }
464
+
465
+ public function setCreatePlans($data){
466
+ $data = json_encode($data);
467
+ $documento = 'Content-Type: application/json; charset=utf-8';
468
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
469
+ $url = self::ENDPOINT_RECURRING_TEST."plans";
470
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
471
+ } else {
472
+ $url = self::ENDPOINT_RECURRING_PROD."plans";
473
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
474
+ }
475
+ $result = array();
476
+ $ch = curl_init();
477
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
478
+ curl_setopt($ch, CURLOPT_URL, $url);
479
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
480
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
481
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
482
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
483
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
484
+ $header,
485
+ $documento
486
+ ));
487
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
488
+ $responseBody = curl_exec($ch);
489
+ $info_curl = curl_getinfo($ch);
490
+ curl_close($ch);
491
+ $this->generateLog($data, 'MOIP_RecurringPlansRequest.log');
492
+ $this->generateLog($responseBody->message, 'MOIP_RecurringPlansRequest.log');
493
+ $this->generateLog($header, 'MOIP_RecurringPlansRequest.log');
494
+ $this->generateLog(json_encode($info_curl), 'MOIP_RecurringPlansRequest.log');
495
+
496
+ $decode = json_decode($responseBody, true);
497
+
498
+ if($info_curl['http_code'] == 200 || $info_curl['http_code'] == 201){
499
+ Mage::getSingleton('core/session')->addSuccess('Plano Criado com sucesso');
500
+ } else {
501
+ Mage::getSingleton('core/session')->addError('Não foi possivel criar o plano recorrente, resposta do servidor Moip: '.$info_curl['http_code']." ".$responseBody);
502
+ }
503
+
504
+
505
+ return $decode;
506
+ }
507
+
508
+
509
+
510
+ public function setUpdatePlans($data){
511
+ $plans_code = $data['code'];
512
+ $data = json_encode($data);
513
+ $documento = 'Content-Type: application/json; charset=utf-8';
514
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
515
+ $url = self::ENDPOINT_RECURRING_TEST."plans/{$plans_code}";
516
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
517
+ } else {
518
+ $url = self::ENDPOINT_RECURRING_PROD."plans/{$plans_code}";
519
+ $header = "Authorization: Basic " . base64_encode($this->getToken() . ":" . $this->getKey());
520
+ }
521
+ $result = array();
522
+ $ch = curl_init();
523
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
524
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
525
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
526
+ curl_setopt($ch, CURLOPT_URL, $url);
527
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
528
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
529
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
530
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
531
+ $header,
532
+ $documento
533
+ ));
534
+ curl_setopt($ch, CURLOPT_USERAGENT, 'MoipMagento/2.0.0');
535
+ $responseBody = curl_exec($ch);
536
+ $info_curl = curl_getinfo($ch);
537
+ curl_close($ch);
538
+
539
+ $this->generateLog($url, 'MOIP_RecurringPlansUpdate.log');
540
+ $this->generateLog($data, 'MOIP_RecurringPlansUpdate.log');
541
+ $this->generateLog($responseBody, 'MOIP_RecurringPlansUpdate.log');
542
+ $this->generateLog(json_encode($info_curl), 'MOIP_RecurringPlansUpdate.log');
543
+
544
+ $decode = json_decode($responseBody);
545
+ if($info_curl['http_code'] == 200){
546
+ Mage::getSingleton('core/session')->addSuccess('Plano Atualizado com sucesso');
547
+ } else {
548
+ Mage::getSingleton('core/session')->addError('Não foi possivel atualizar o plano resposta do servidor Moip: '.$info_curl['http_code']." ".$responseBody);
549
+
550
+ }
551
+
552
+
553
+
554
+ return $decode;
555
+
556
+ }
557
+
558
+ /* tratamento de infos */
559
+ public function getNumEndereco($endereco, $enderecob)
560
+ {
561
+ $numEnderecoDefault = '0';
562
+ if (!$endereco)
563
+ $endereco = $enderecob;
564
+ else
565
+ $endereco = $endereco;
566
+ $numEndereco = trim(preg_replace("/[^0-9]/", "", $endereco));
567
+ if ($numEndereco)
568
+ return ($numEndereco);
569
+ else
570
+ return ($numEnderecoDefault);
571
+ }
572
+
573
+ public function getNumberOrDDD($param_telefone, $param_ddd = false)
574
+ {
575
+ $cust_ddd = '11';
576
+ $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
577
+ $st = strlen($cust_telephone) - 8;
578
+ if ($st > 0) {
579
+ $cust_ddd = substr($cust_telephone, 0, 2);
580
+ $cust_telephone = substr($cust_telephone, $st, 8);
581
+ }
582
+ if ($param_ddd === false) {
583
+ $retorno = $cust_telephone;
584
+ } else {
585
+ $retorno = $cust_ddd;
586
+ }
587
+ return $retorno;
588
+ }
589
+
590
+ public function generateLog($variable, $name_log){
591
+ if(Mage::getSingleton('transparente/standard')->getConfigData('log') == 1){
592
+ $dir_log = Mage::getBaseDir('var').'/log/MOIP/Assinaturas/';
593
+
594
+ if (!file_exists($dir_log)) {
595
+ mkdir($dir_log, 0755, true);
596
+ }
597
+
598
+ Mage::log($variable, null, 'MOIP/Assinaturas/'.$name_log, true);
599
+ } else {
600
+
601
+ }
602
+ }
603
+ }
app/code/local/MOIP/Transparente/Model/Sales/Order/Total/Creditmemo/Fee.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MOIP_Transparente_Model_Sales_Order_Total_Creditmemo_Fee extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
4
+ {
5
+
6
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
7
+ {
8
+ $order = $creditmemo->getOrder();
9
+
10
+ if($order->getFeeAmountInvoiced() > 0) {
11
+
12
+ $feeAmountLeft = $order->getFeeAmountInvoiced() - $order->getFeeAmountRefunded();
13
+ $basefeeAmountLeft = $order->getBaseFeeAmountInvoiced() - $order->getBaseFeeAmountRefunded();
14
+
15
+ if ($basefeeAmountLeft > 0) {
16
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $feeAmountLeft);
17
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $basefeeAmountLeft);
18
+ $creditmemo->setFeeAmount($feeAmountLeft);
19
+ $creditmemo->setBaseFeeAmount($basefeeAmountLeft);
20
+ }
21
+
22
+ } else {
23
+
24
+ $feeAmount = $order->getFeeAmountInvoiced();
25
+ $basefeeAmount = $order->getBaseFeeAmountInvoiced();
26
+
27
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $feeAmount);
28
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $basefeeAmount);
29
+ $creditmemo->setFeeAmount($feeAmount);
30
+ $creditmemo->setBaseFeeAmount($basefeeAmount);
31
+
32
+ }
33
+
34
+ return $this;
35
+ }
36
+
37
+ }
app/code/local/MOIP/Transparente/Model/Sales/Order/Total/Invoice/Fee.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by Magentix
4
+ * Based on Module from "Excellence Technologies" (excellencetechnologies.in)
5
+ *
6
+ * @category Magentix
7
+ * @package Magentix_Fee
8
+ * @author Matthieu Vion (http://www.magentix.fr)
9
+ * @license This work is free software, you can redistribute it and/or modify it
10
+ */
11
+
12
+ class MOIP_Transparente_Model_Sales_Order_Total_Invoice_Fee extends Mage_Sales_Model_Order_Invoice_Total_Abstract
13
+ {
14
+
15
+
16
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
17
+ {
18
+ $order = $invoice->getOrder();
19
+
20
+ $feeAmountLeft = $order->getFeeAmount() - $order->getFeeAmountInvoiced();
21
+ $baseFeeAmountLeft = $order->getBaseFeeAmount() - $order->getBaseFeeAmountInvoiced();
22
+
23
+ if (abs($baseFeeAmountLeft) < $invoice->getBaseGrandTotal()) {
24
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $feeAmountLeft);
25
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseFeeAmountLeft);
26
+ } else {
27
+ $feeAmountLeft = $invoice->getGrandTotal() * -1;
28
+ $baseFeeAmountLeft = $invoice->getBaseGrandTotal() * -1;
29
+
30
+ $invoice->setGrandTotal(0);
31
+ $invoice->setBaseGrandTotal(0);
32
+ }
33
+
34
+ $invoice->setFeeAmount($feeAmountLeft);
35
+ $invoice->setBaseFeeAmount($baseFeeAmountLeft);
36
+
37
+ return $this;
38
+ }
39
+
40
+ }
app/code/local/MOIP/Transparente/Model/Sales/Quote/Address/Total/Fee.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_Model_Sales_Quote_Address_Total_Fee extends Mage_Sales_Model_Quote_Address_Total_Abstract{
3
+ protected $_code = 'fee';
4
+
5
+
6
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
7
+ {
8
+ $amt = $address->getFeeAmount();
9
+ if($amt){
10
+ $address->addTotal(array(
11
+ 'code'=>$this->getCode(),
12
+ 'title'=>'Juros do Cartão',
13
+ 'value'=> $amt
14
+ ));
15
+ return $this;
16
+ } else {
17
+ return $this;
18
+ }
19
+ }
20
+ }
app/code/local/MOIP/Transparente/Model/Source/Holded.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Moip_Transparente_Model_Source_Holded extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
4
+ {
5
+ protected $_stateStatuses = Mage_Sales_Model_Order::STATE_HOLDED;
6
+ }
app/code/local/MOIP/Transparente/Model/Standard.php CHANGED
@@ -1,272 +1,79 @@
1
  <?php
2
- class MOIP_Transparente_Model_Standard extends Mage_Payment_Model_Method_Abstract {
3
- protected $_code = 'moip_transparente_standard';
4
- protected $_formBlockType = 'transparente/standard_form';
5
- protected $_infoBlockType = 'transparente/info';
 
 
6
  protected $_isGateway = true;
7
  protected $_canAuthorize = true;
8
  protected $_canCapture = true;
9
  protected $_canCapturePartial = true;
10
  protected $_canRefund = true;
 
11
  protected $_canVoid = true;
12
- protected $_canUseInternal = false;
13
- protected $_canUseCheckout = true;
14
- protected $_canUseForMultishipping = true;
15
  protected $_canSaveCc = false;
16
  protected $_allowCurrencyCode = array('BRL');
17
- /**
18
- * Armazena as informações passadas via formulário no frontend
19
- * @access public
20
- * @param array $data
21
- * @return MOIP_Transparente_Model_Standard
22
- */
23
- public function assignData($data) {
24
  if (!($data instanceof Varien_Object)) {
25
  $data = new Varien_Object($data);
26
  }
27
-
28
- $info = $this->getInfoInstance();
29
- $info->setFormaPagamento($data->getFormaPagamento());
30
- $info->setDebitoInstituicao($data->getDebitoInstituicao());
31
- $info->setCreditoInstituicao($data->getCreditoInstituicao());
32
- $info->setCreditoNumero($data->getCreditoNumero());
33
- $info->setUseCofre($data->getUseCofre());
34
- $info->setCofreBrand($data->getCofreBrand());
35
- $info->setCofreNumero($data->getCofreNumero());
36
- $info->setCofreParcelamento($data->getCofreParcelamento());
37
- $info->setCofreCvv($data->getCofreCvv());
38
- $info->setSaveCart($data->getSaveCart());
39
- $info->setCreditoExpiracaoMes($data->getCreditoExpiracaoMes());
40
- $info->setCreditoExpiracaoAno($data->getCreditoExpiracaoAno());
41
- $info->setCreditoCodigoSeguranca($data->getCreditoCodigoSeguranca());
42
- $info->setCreditoParcelamento($data->getCreditoParcelamento());
43
- $info->setCreditoPortadorNome($data->getCreditoPortadorNome());
44
- $info->setCreditoPortadorCpf($data->getCreditoPortadorCpf());
45
- $info->setCreditoPortadorTelefone($data->getCreditoPortadorTelefone());
46
- $info->setCreditoPortadorNascimento($data->getCreditoPortadorNascimento());
47
-
48
- Mage::dispatchEvent('transparente_sales_quote_assign_data_after', array('quote'=>Mage::getSingleton('checkout/session')->getQuote()));
49
-
50
  return $this;
51
  }
52
-
53
- public function getPayment() {
54
- return $this->getQuote()->getPayment();
55
- }
56
- public function getSession() {
57
- return Mage::getSingleton('transparente/session');
58
- }
59
- public function getCheckout() {
60
- return Mage::getSingleton('checkout/session');
61
- }
62
- public function getPaymentMethods() {
63
- return $this->getConfigData('formas_pagamento');
64
  }
65
- public function getQuote() {
66
- return $this->getCheckout()->getQuote();
 
 
 
67
  }
68
- public function validate() {
 
69
  parent::validate();
 
70
  $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
71
- if (!in_array($currency_code, $this->_allowCurrencyCode)) {
72
- Mage::throwException(Mage::helper('transparente')->__('Selected currency code (' . $currency_code . ') is not compatabile with Transparente'));
 
 
 
 
 
 
73
  }
74
  return $this;
75
  }
76
-
77
- public function prepare() {
78
- $info = $this->getInfoInstance();
79
- $pgtoArray = array();
80
- $pgtoArray['forma_pagamento'] = $info->getFormaPagamento();
81
- $pgtoArray['debito_instituicao'] = $info->getDebitoInstituicao();
82
- $pgtoArray['vcmentoboleto'] = $this->getConfigData('vcmentoboleto');
83
- $pgtoArray['tipoderecebimento'] = $this->getConfigData('tipoderecebimento');
84
- $pgtoArray['parcelamento'] = $this->getConfigData('parcelamento');
85
- $pgtoArray['nummaxparcelamax'] = $this->getConfigData('nummaxparcelamax');
86
- $pgtoArray['comissionamento'] = $this->getConfigData('comissionamento');
87
- $pgtoArray['logincomissionamento'] = $this->getConfigData('logincomissionamento');
88
- $pgtoArray['porc_comissionamento'] = $this->getConfigData('porc_comissionamento');
89
- $pgtoArray['pagadordataxa'] = $this->getConfigData('pagadordataxa');
90
- $pgtoArray['conta_transparente'] = $this->getConfigData('conta_transparente');
91
- $pgtoArray['apelido'] = $this->getConfigData('apelido');
92
- $pgtoArray['credito_instituicao'] = $info->getCreditoInstituicao();
93
- $pgtoArray['credito_numero'] = $info->getCreditoNumero();
94
- $pgtoArray['use_cofre'] = $info->getUseCofre();
95
- $pgtoArray['cofre_brand'] = $info->getCofreBrand();
96
- $pgtoArray['cofre_numero'] = $info->getCofreNumero();
97
- $pgtoArray['cofre_parcelamento'] = $info->getCofreParcelamento();
98
- $pgtoArray['cofre_cvv'] = $info->getCofreCvv();
99
- $pgtoArray['save_cart'] = $info->getSaveCart();
100
- $pgtoArray['credito_expiracao_mes'] = $info->getCreditoExpiracaoMes();
101
- $pgtoArray['credito_expiracao_ano'] = $info->getCreditoExpiracaoAno();
102
- $pgtoArray['credito_codigo_seguranca'] = $info->getCreditoCodigoSeguranca();
103
- $pgtoArray['credito_parcelamento'] = $info->getCreditoParcelamento();
104
- $pgtoArray['credito_portador_nome'] = $info->getCreditoPortadorNome();
105
- $cpf = $info->getCreditoPortadorCpf();
106
- $pgtoArray['credito_portador_cpf'] = preg_replace("/[^0-9]/", "", $cpf);
107
- $pgtoArray['credito_portador_DDD'] = $this->getNumberOrDDD($info->getCreditoPortadorTelefone(), true);
108
- $pgtoArray['credito_portador_telefone'] = $this->getNumberOrDDD($info->getCreditoPortadorTelefone());
109
- $pgtoArray['credito_portador_nascimento'] = date('Y-m-d', strtotime($info->getCreditoPortadorNascimento()));
110
- $api = Mage::getModel('transparente/api');
111
- $api->setAmbiente($this->getConfigData('ambiente'));
112
- $session = Mage::getSingleton('checkout/session');
113
- $session->setPgtoArray($pgtoArray);
114
- $session->setTransparenteFields($this->getStandardCheckoutFormFields());
115
- }
116
- public function getOrderPlaceRedirectUrl() {
117
- $this->prepare();
118
- return Mage::getUrl('transparente/standard/redirect', array('_secure' => true));
119
- }
120
-
121
- public function getStandardCheckoutFormFields() {
122
-
123
- $a = $this->getQuote()->getBillingAddress();
124
- $email=Mage::getSingleton('customer/session')->getCustomer()->getEmail();
125
- $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
126
- $cep = substr(preg_replace("/[^0-9]/", "", $a->getPostcode()) . '00000000', 0, 8);
127
-
128
- $dob = Mage::app()->getLocale()->date($this->getQuote()->getCustomerDob(), null, null, false)->toString('Y-MM-dd');
129
- $taxvat = $this->getQuote()->getCustomerTaxvat();
130
- $taxvat = preg_replace("/[^0-9]/", "", $taxvat);
131
- $website_id = Mage::app()->getWebsite()->getId();
132
- $website_name = Mage::app()->getWebsite()->getName();
133
- $store_name = Mage::app()->getStore()->getName();
134
- $info = $this->getInfoInstance();
135
- $Arr = array(
136
- 'id_carteira' => $this->getConfigData('conta_transparente'),
137
- 'id_transacao' => $this->getQuote()->getReservedOrderId(),
138
- 'nome' => 'Pagamento a ' . $website_name,
139
- 'descricao' => $this->getListaProdutos(),
140
- 'pagador_nome' => $a->getFirstname() . ' ' . $a->getLastname(),
141
- 'pagador_email' => strtolower($email),
142
- 'pagador_ddd' => $this->getNumberOrDDD($a->getTelephone(), true),
143
- 'pagador_telefone' => $this->getNumberOrDDD($a->getTelephone()),
144
- 'pagador_logradouro' => $a->getStreet(1),
145
- 'pagador_numero' => $a->getStreet(2),
146
- 'pagador_complemento' => $a->getStreet(3),
147
- 'pagador_bairro' => $a->getStreet(4),
148
- 'pagador_cep' => $cep,
149
- 'pagador_cidade' => $a->getCity(),
150
- 'pagador_estado' => strtoupper($a->getRegionCode()),
151
- 'pagador_pais' => $a->getCountry(),
152
- 'pagador_cpf' => $taxvat,
153
- 'pagador_celular' => $this->getNumberOrDDD($a->getFax(), true) . '' . $this->getNumberOrDDD($a->getFax()),
154
- 'pagador_sexo' => '',
155
- 'pagador_data_nascimento' => $dob,
156
- );
157
- return $Arr;
158
- }
159
- public function getInfoParcelamento() {
160
- $config = array();
161
- $max = 12;
162
- $config['c_de1'] = (int)$this->getConfigData('parcelamento_c_de1');
163
- $config['c_ate1'] = (int) $this->getConfigData('parcelamento_c_ate1');
164
- $config['c_juros1'] = $this->getConfigData('parcelamento_c_juros1');
165
- $config['c_de2'] = (int)$this->getConfigData('parcelamento_c_de2');
166
- $config['c_ate2'] = (int)$this->getConfigData('parcelamento_c_ate2');
167
- $config['c_juros2'] = $this->getConfigData('parcelamento_c_juros2');
168
- $config['c_de3'] = (int)$this->getConfigData('parcelamento_c_de3');
169
- $config['c_ate3'] = (int)$this->getConfigData('parcelamento_c_ate3');
170
- $config['c_juros3'] = $this->getConfigData('parcelamento_c_juros3');
171
-
172
-
173
-
174
-
175
-
176
- $config['s_juros1'] = $this->getConfigData('parcelamento_s_juros1');
177
- $config['s_juros2'] = $this->getConfigData('parcelamento_s_juros2');
178
- $config['s_juros3'] = $this->getConfigData('parcelamento_s_juros3');
179
- $config['s_juros4'] = $this->getConfigData('parcelamento_s_juros4');
180
- $config['s_juros5'] = $this->getConfigData('parcelamento_s_juros5');
181
- $config['s_juros6'] = $this->getConfigData('parcelamento_s_juros6');
182
- $config['s_juros7'] = $this->getConfigData('parcelamento_s_juros7');
183
- $config['s_juros8'] = $this->getConfigData('parcelamento_s_juros8');
184
- $config['s_juros9'] = $this->getConfigData('parcelamento_s_juros9');
185
- $config['s_juros10'] = $this->getConfigData('parcelamento_s_juros10');
186
- $config['s_juros11'] = $this->getConfigData('parcelamento_s_juros11');
187
- $config['s_juros12'] = $this->getConfigData('parcelamento_s_juros12');
188
-
189
-
190
- $config['vcmentoboleto'] = $this->getConfigData('vcmentoboleto');
191
-
192
- return $config;
193
- }
194
- function getListaProdutos() {
195
- $lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
196
- $orderId = Mage::getModel('sales/order')
197
- ->loadByIncrementId($lastOrderId)
198
- ->getEntityId();
199
- $_order = Mage::getModel('sales/order')->load($orderId);
200
- $items = $_order->getAllItems();
201
- $itemcount=count($items);
202
- $produtos=array();
203
-
204
- foreach ($items as $itemId => $item)
205
- {
206
- $produtos[] = array (
207
- 'product' => $item->getName(),
208
- 'quantity' =>$item->getQtyToInvoice(),
209
- 'detail' => $item->getSku(),
210
- 'price' => number_format($item->getPrice(),2,'','')
211
- );
212
- }
213
-
214
- return $produtos;
215
  }
216
 
217
- private function getNumEndereco($endereco) {
218
- $numEndereco = '';
219
-
220
- $posSeparador = $this->getPosSeparador($endereco, false);
221
- if ($posSeparador !== false)
222
- $numEndereco = trim(substr($endereco, $posSeparador + 1));
223
-
224
- $posComplemento = $this->getPosSeparador($numEndereco, true);
225
- if ($posComplemento !== false)
226
- $numEndereco = trim(substr($numEndereco, 0, $posComplemento));
227
-
228
- return($numEndereco);
229
- }
230
- function getPosSeparador($endereco, $procuraEspaco = false) {
231
- $posSeparador = strpos($endereco, ',');
232
- if ($posSeparador === false)
233
- $posSeparador = strpos($endereco, '-');
234
-
235
- if ($procuraEspaco)
236
- if ($posSeparador === false)
237
- $posSeparador = strrpos($endereco, ' ');
238
-
239
- return($posSeparador);
240
- }
241
-
242
- function getNumberOrDDD($param_telefone, $param_ddd = false) {
243
-
244
- $cust_ddd = '00';
245
- $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
246
- $st = strlen($cust_telephone) - 8;
247
- if ($st > 0) { //No caso essa seqüência é mais de 8 caracteres
248
- $cust_ddd = substr($cust_telephone, 0, 2);
249
- $cust_telephone = substr($cust_telephone, $st, 8);
250
- }
251
-
252
- if ($param_ddd === false) {
253
- $retorno = $cust_telephone;
254
- } else {
255
- $retorno = $cust_ddd;
256
- }
257
-
258
- return $retorno;
259
- }
260
-
261
- function getPesoProdutosPedido() {
262
- $items = $this->getQuote()->getAllVisibleItems();
263
- if ($items) {
264
- $item_peso = 0;
265
- foreach ($items as $item) {
266
- $item_peso = $item_peso + round($item->getWeight());
267
- }
268
- }
269
- return $item_peso;
270
- }
271
- }
272
-
1
  <?php
2
+ class MOIP_Transparente_Model_Standard extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const METHOD_CODE = 'moip_transparente_standard';
5
+ protected $_code = self::METHOD_CODE;
6
+ protected $_formBlockType = 'transparente/form_admin';
7
+ protected $_infoBlockType = 'transparente/info_admin';
8
  protected $_isGateway = true;
9
  protected $_canAuthorize = true;
10
  protected $_canCapture = true;
11
  protected $_canCapturePartial = true;
12
  protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
  protected $_canVoid = true;
15
+ protected $_canUseInternal = true;
16
+ protected $_canUseCheckout = false;
17
+ protected $_canUseForMultishipping = false;
18
  protected $_canSaveCc = false;
19
  protected $_allowCurrencyCode = array('BRL');
20
+ protected $_canFetchTransactionInfo = true;
21
+
22
+ public function assignData($data)
23
+ {
24
+ $additionaldata = array();
 
 
25
  if (!($data instanceof Varien_Object)) {
26
  $data = new Varien_Object($data);
27
  }
28
+ $info = $this->getInfoInstance();
29
+
30
+
31
+ $quote = $info->getQuote();
32
+ $json_order = $this->getApi()->getDados($quote);
33
+ $IdMoip = $this->getApi()->getOrderIdMoip($json_order);
34
+ $decode = json_decode($IdMoip, true);
35
+ $link_boleto = $decode['_links']['checkout']['payBoleto']['redirectHref'];
36
+ $link_cc = $decode['_links']['checkout']['payCreditCard']['redirectHref'];
37
+ $info = $this->getInfoInstance();
38
+ $additionaldata = array(
39
+ 'link_boleto' => $link_boleto,
40
+ 'link_cc' => $link_cc
41
+ );
42
+ $info->setAdditionalData(serialize($additionaldata))->save()->setAdditionalInformation(serialize($additionaldata))->save();
43
+
 
 
 
 
 
 
 
44
  return $this;
45
  }
46
+ public function prepareSave()
47
+ {
48
+ $info = $this->getInfoInstance();
49
+ return $this;
 
 
 
 
 
 
 
 
50
  }
51
+ public function prepare()
52
+ {
53
+ $info = $this->getInfoInstance();
54
+ $additionaldata = unserialize($info->getAdditionalData());
55
+
56
  }
57
+ public function validate()
58
+ {
59
  parent::validate();
60
+ $info = $this->getInfoInstance();
61
  $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
62
+ $errorMsg = false;
63
+ if ($errorMsg === false) {
64
+ if (!in_array($currency_code, $this->_allowCurrencyCode)) {
65
+ Mage::throwException(Mage::helper('transparente')->__('O Moip Não pode Transacionar pedidos feitos em (' . $currency_code . ') verifique as configurações de Moeda do seu magento.'));
66
+ }
67
+ }
68
+ if ($errorMsg) {
69
+ Mage::throwException($errorMsg);
70
  }
71
  return $this;
72
  }
73
+ public function getApi()
74
+ {
75
+ $api = Mage::getModel('transparente/admin');
76
+ return $api;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/MOIP/Transparente/controllers/IndexController.php CHANGED
@@ -1,46 +1,9 @@
1
- <?php
2
- class MOIP_Transparente_IndexController extends Mage_Core_Controller_Front_Action
3
- {
4
- protected function indexAction() {
5
- $this->loadLayout();
6
- $this->renderLayout();
7
- return true;
8
- }
9
- public function ParcelamentoAction() {
10
- $api = Mage::getModel('transparente/api');
11
- if($this->getRequest()->getParams()){
12
- $data = $this->getRequest()->getPost();
13
-
14
-
15
-
16
- if($data['itens_total'] > 1){
17
- $item_count = $data['itens_total']." itens";
18
- }
19
- else {
20
- $item_count = $data['itens_total']." item";
21
- }
22
- echo ' <div class="total_itens">
23
- Você compra:
24
- <span class="soma_related_itens">'.$item_count.'</span>
25
- </div>';
26
-
27
- $parcelamento = $api->getParcelamento($data['valor']);
28
- $parcela_decode = json_decode($parcelamento,true);
29
- foreach ($parcela_decode as $key => $value):
30
- if ($key <= Mage::getSingleton('transparente/standard')->getConfigData('nummaxparcelamax')):
31
- $juros = $parcela_decode[$key]['juros'];
32
- $parcelas_result = $parcela_decode[$key]['parcela'];
33
- $total_parcelado = $parcela_decode[$key]['total_parcelado'];
34
- if($juros > 0)
35
- $asterisco = '';
36
- else
37
- $asterisco = ' sem juros';
38
- $parcelas[]= '<div class="parcela_add_prod_related">em <span class="parcelas_em">'.$key.'x de '.$parcelas_result.'</span>'.$asterisco.'</div><div>ou <span class="parcelas_em_total">'.Mage::helper('core')->currency($data['valor'], true, false).' à vista</span> com desconto</div>';
39
- endif;
40
- endforeach;
41
- echo end($parcelas);
42
- }
43
- }
44
  public function CartoesAction() {
45
  $this->loadLayout();
46
  $this->renderLayout();
@@ -49,126 +12,298 @@ class MOIP_Transparente_IndexController extends Mage_Core_Controller_Front_Actio
49
  if($this->getRequest()->getParams()){
50
  $data = $this->getRequest()->getParams();
51
  $model = Mage::getModel('transparente/write');
52
- $model->load($data['cofre_remove'], 'cofre');
53
- $model->setAceitaCofre(0);
54
- $model->setCofre();
55
  $model->save();
56
  return true;
57
  }
58
  }
59
- public function NovaformaAction() {
60
- if($this->getRequest()->getParams()){
61
- $model = Mage::getModel('transparente/write');
62
- $api = Mage::getModel('transparente/api');
63
- $post = $this->getRequest()->getPost();
64
- $model->load($post['order_id']);
65
- $model->getDate();
66
- $pgtoArray = array();
67
- $pgtoArray['forma_pagamento'] = $post['forma_de_pagamento'];
68
- $pgtoArray['credito_instituicao'] = $post['bandeira'];
69
- $pgtoArray['credito_numero'] = $post['Numero'];
70
- $pgtoArray['credito_expiracao_mes'] = $post['Expiracao_mes'];
71
- $pgtoArray['credito_expiracao_ano'] = $post['Expiracao_ano'];
72
- $pgtoArray['credito_codigo_seguranca'] = $post['CodigoSeguranca'];
73
- $pgtoArray['credito_parcelamento'] = $post['parcelas'];
74
- $pgtoArray['credito_portador_nome'] = $post['Portador'];
75
- $pgtoArray["vcmentoboleto"] = "3";
76
- $cpf = $post['CPF'];
77
- $pgtoArray['credito_portador_cpf'] = preg_replace("/[^0-9]/", "", $cpf);
78
- $pgtoArray['credito_portador_DDD'] = $this->getNumberOrDDD($post['Telefone'], true);
79
- $pgtoArray['credito_portador_telefone'] = $this->getNumberOrDDD($post['Telefone']);
80
- $pgtoArray['credito_portador_nascimento'] = date('Y-m-d', strtotime($post['DataNascimento']));
81
- $model->setMeio_pg($post['forma_de_pagamento']);
82
- if($post['forma_de_pagamento'] == "BoletoBancario"){
83
- $model->setbrand_transparente('Bradesco');
84
- }
85
- if ($post['forma_de_pagamento'] == "CartaoCredito") {
86
- $model->setCreditcard_parc($post['parcelas']);
87
- $model->setbrand_transparente($post['bandeira']);
88
- $model->setfirst6(substr($post['Numero'], 0, 6));
89
- $model->setLast4(substr($post['Numero'], -4));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
- if($post['forma_de_pagamento'] == "DebitoBancario")
92
- {
93
- $model->setbrand_transparente((string)$post['instituicao']);
94
-
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
- $model->save();
98
- if($post['forma_de_pagamento'] == "BoletoBancario"){
99
- $json = array(
100
- 'Forma' => 'BoletoBancario',
101
- );
102
- } elseif ($post['forma_de_pagamento'] == "DebitoBancario") {
103
- $json = array(
104
- 'Forma' => 'DebitoBancario',
105
- 'Instituicao' => $post['instituicao'],
106
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
 
 
 
 
 
108
  } else {
 
 
 
 
 
109
 
110
- $json = array(
111
- 'Forma' => $post['forma_de_pagamento'],
112
- 'Instituicao' => $post['bandeira'],
113
- 'Parcelas' => $post['parcelas'],
114
- 'CartaoCredito' => array(
115
- 'Numero' => $post['Numero'],
116
- 'Expiracao' => $post['Expiracao_mes']."/".$post['Expiracao_ano'],
117
- 'CodigoSeguranca' => $post['CodigoSeguranca'],
118
- 'Portador' => array(
119
- 'Nome' => $post['Portador'],
120
- 'DataNascimento' => date('Y-m-d', strtotime($post['DataNascimento'])),
121
- 'Telefone' => $this->getNumberOrDDD($post['Telefone'], true).$this->getNumberOrDDD($post['Telefone']),
122
- 'Identidade' => $cpf,
123
- ),
124
- ),
125
- );
126
  }
127
- echo Mage::helper('core')->jsonEncode((object)$json);
 
 
 
128
  }
129
  }
130
- public function RepagAction() {
131
- if($this->getRequest()->getParams()){
132
- $post = $this->getRequest()->getPost();
133
- $cpf = preg_replace("/[^0-9]/", "", $post['CPF']);
134
- $api = Mage::getModel('transparente/api');
135
- $json = array(
136
- 'Forma' => "CartaoCredito",
137
- 'Instituicao' => $post['bandeira'],
138
- 'Parcelas' => $post['parcelas'],
139
- 'CartaoCredito' => array(
140
- 'Numero' => $post['Numero'],
141
- 'Expiracao' => $post['Expiracao_mes']."/".$post['Expiracao_ano'],
142
- 'CodigoSeguranca' => $post['CodigoSeguranca'],
143
- 'Portador' => array(
144
- 'Nome' => $post['Portador'],
145
- 'DataNascimento' => date('Y-m-d', strtotime($post['DataNascimento'])),
146
- 'Telefone' => $this->getNumberOrDDD($post['Telefone'], true).$this->getNumberOrDDD($post['Telefone']),
147
- 'Identidade' => $cpf,
148
- ),
149
- ),
150
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  }
152
- echo Mage::helper('core')->jsonEncode((object)$json);
153
- var_dump($json);
154
- return true;
155
  }
156
- function getNumberOrDDD($param_telefone, $param_ddd = false) {
157
-
158
- $cust_ddd = '00';
159
- $cust_telephone = preg_replace("/[^0-9]/", "", $param_telefone);
160
- $st = strlen($cust_telephone) - 8;
161
- if ($st > 0) { //No caso essa seqüência é mais de 8 caracteres
162
- $cust_ddd = substr($cust_telephone, 0, 2);
163
- $cust_telephone = substr($cust_telephone, $st, 8);
164
- }
165
 
166
- if ($param_ddd === false) {
167
- $retorno = $cust_telephone;
168
- } else {
169
- $retorno = $cust_ddd;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
 
 
 
 
171
 
172
- return $retorno;
173
- }
174
  }
1
+ <?php
2
+ require_once 'Mage/Checkout/controllers/CartController.php';
3
+ class MOIP_Transparente_IndexController extends Mage_Checkout_CartController
4
+ {
5
+
6
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  public function CartoesAction() {
8
  $this->loadLayout();
9
  $this->renderLayout();
12
  if($this->getRequest()->getParams()){
13
  $data = $this->getRequest()->getParams();
14
  $model = Mage::getModel('transparente/write');
15
+ $model->load($data['cofre_remove'], 'moip_card_id');
16
+ $model->setMoipCardId();
 
17
  $model->save();
18
  return true;
19
  }
20
  }
21
+
22
+
23
+ public function getCheckout() {
24
+ return Mage::getSingleton('checkout/session');
25
+ }
26
+ public function getQuote() {
27
+ return Mage::getSingleton('checkout/session')->getQuote();
28
+ }
29
+ public function getOnepage() {
30
+ return Mage::getSingleton('checkout/type_onepage');
31
+ }
32
+ protected function _getQuote() {
33
+ return Mage::getSingleton('checkout/cart')->getQuote();
34
+ }
35
+ public function renderLogin() {
36
+
37
+ return $this->getLayout()->getBlock('moip.onclick.login')->toHtml();
38
+ }
39
+
40
+ public function renderPayment() {
41
+ $this->loadLayout();
42
+ return $this->getLayout()->getBlock('moip.onclick.payment')->toHtml();
43
+ }
44
+
45
+ public function addAction()
46
+ {
47
+ $cart = $this->_getCart();
48
+ $params = $this->getRequest()->getParams();
49
+ if($params['isAjax'] == 1){
50
+ $response = array();
51
+ try {
52
+ if (isset($params['qty'])) {
53
+ $filter = new Zend_Filter_LocalizedToNormalized(
54
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
55
+ );
56
+ $params['qty'] = $filter->filter($params['qty']);
57
+ }
58
+
59
+ $product = $this->_initProduct();
60
+ $related = $this->getRequest()->getParam('related_product');
61
+
62
+ /**
63
+ * Check product availability
64
+ */
65
+ if (!$product) {
66
+ $response['status'] = 'ERROR';
67
+ $response['message'] = $this->__('<h4 class="modal-title">Desculpe, função desabilitada, use o botão comprar</h4>');
68
+ }
69
+
70
+ $cart->addProduct($product, $params);
71
+ if (!empty($related)) {
72
+ $cart->addProductsByIds(explode(',', $related));
73
+ }
74
+
75
+ $cart->save();
76
+
77
+ $this->_getSession()->setCartWasUpdated(true);
78
+
79
+ /**
80
+ * @todo remove wishlist observer processAddToCart
81
+ */
82
+ Mage::dispatchEvent('checkout_cart_add_product_complete',
83
+ array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
84
+ );
85
+
86
+ if (!$cart->getQuote()->getHasError()){
87
+ $message = $this->__('<h4 class="modal-title">Produto Adcionado ao Carrinho</h4>');
88
+ $response['status'] = 'SUCCESS';
89
+ $response['message'] = $message;
90
+ $count = Mage::helper('checkout/cart')->getSummaryCount();
91
+ $response['counttop'] = $count;
92
+ //New Code Here
93
+ Mage::register('referrer_url', $this->_getRefererUrl());
94
+
95
+ }
96
+ } catch (Mage_Core_Exception $e) {
97
+ $msg = "";
98
+ if ($this->_getSession()->getUseNotice(true)) {
99
+ $msg = $e->getMessage();
100
+ } else {
101
+ $messages = array_unique(explode("\n", $e->getMessage()));
102
+ foreach ($messages as $message) {
103
+ $msg .= $message.'<br/>';
104
+ }
105
+ }
106
+
107
+ $response['status'] = 'ERROR';
108
+ $response['message'] = $msg;
109
+ } catch (Exception $e) {
110
+ $response['status'] = 'ERROR';
111
+ $response['message'] = $this->__('<h4 class="modal-title">Não foi possível adcionar ao carrinho</h4>');
112
+ Mage::logException($e);
113
  }
114
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
115
+ return;
116
+ }else{
117
+ return parent::addAction();
118
+ }
119
+ }
120
+
121
+
122
+ public function addOnclickAction()
123
+ {
124
+ $cart = $this->_getCart();
125
+ $params = $this->getRequest()->getParams();
126
+ if($params['onclick'] == 1){
127
+ $response = array();
128
+ try {
129
+ if (isset($params['qty'])) {
130
+ $filter = new Zend_Filter_LocalizedToNormalized(
131
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
132
+ );
133
+ $params['qty'] = $filter->filter($params['qty']);
134
+ }
135
+
136
+ $product = $this->_initProduct();
137
+ $related = $this->getRequest()->getParam('related_product');
138
+
139
+
140
+ if (!$product) {
141
+ $response['_status'] = 'ERROR';
142
+ $response['message'] = $this->__('<h4 class="modal-title">Unable to find Product ID</h4>');
143
+ }
144
+
145
+ $cart->addProduct($product, $params);
146
+ if (!empty($related)) {
147
+ $cart->addProductsByIds(explode(',', $related));
148
+ }
149
+
150
+ $cart->save();
151
+
152
+ $this->_getSession()->setCartWasUpdated(true);
153
+
154
 
155
+ Mage::dispatchEvent('checkout_cart_add_product_complete',
156
+ array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
157
+ );
158
+
159
+ if (!$cart->getQuote()->getHasError()){
160
+ $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->htmlEscape($product->getName()));
161
+
162
+ if( !Mage::getSingleton( 'customer/session' )->isLoggedIn() )
163
+ {
164
+ $this->loadLayout();
165
+ $session = Mage::getSingleton( 'customer/session' );
166
+ $session->setBeforeAuthUrl($this->_getRefererUrl());
167
+ $response['_status'] = 'SUCCESS';
168
+ $login_onclick = $this->renderLogin();
169
+ Mage::register('referrer_url', $this->_getRefererUrl());
170
+ $response['message'] = $login_onclick;
171
+
172
+ } else {
173
+ $response['_status'] = 'SUCCESS';
174
+ $this->loadLayout();
175
+
176
+ $_customer = Mage::getSingleton( 'customer/session' )->getCustomer();
177
+ $address_id = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
178
+ $address = Mage::getModel('customer/address')->load($address_id);
179
+ $applyrule=$this->getQuote()->getAppliedRuleIds();
180
+ $applyaction=Mage::getModel('salesrule/rule')->load($applyrule)->getSimpleAction();
181
+ $this->getQuote()->getShippingAddress()
182
+ ->setCountryId($address->getCountryId())
183
+ ->setPostcode($address->getPostcode())
184
+ ->setCollectShippingRates(true);
185
+ $this->_getQuote()->save();
186
+
187
+ $moip_onclick = $this->renderPayment();
188
+
189
+ Mage::register('referrer_url', $this->_getRefererUrl());
190
+
191
+ $response['message'] = $moip_onclick;
192
+ }
193
 
194
+ }
195
+ } catch (Mage_Core_Exception $e) {
196
+ $msg = "";
197
+ if ($this->_getSession()->getUseNotice(true)) {
198
+ $msg = $e->getMessage();
199
  } else {
200
+ $messages = array_unique(explode("\n", $e->getMessage()));
201
+ foreach ($messages as $message) {
202
+ $msg .= $message.'<br/>';
203
+ }
204
+ }
205
 
206
+ $response['_status'] = 'ERROR';
207
+ $response['message'] = $msg;
208
+ } catch (Exception $e) {
209
+ $response['_status'] = 'ERROR';
210
+ $response['message'] = $this->__('<h4 class="modal-title">Não foi possível adcionar o produto via onclick.</h4>');
211
+ Mage::logException($e);
 
 
 
 
 
 
 
 
 
 
212
  }
213
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
214
+ return;
215
+ }else{
216
+ return parent::addAction();
217
  }
218
  }
219
+
220
+ public function MoipOnclickAction() {
221
+ $datapost = $this->getRequest()->getPost();
222
+ $address_billing = null;
223
+ $_customer = Mage::getSingleton( 'customer/session' )->getCustomer();
224
+ $quote = $this->getQuote();
225
+ $address_billing = $this->getQuote()->getBillingAddress();
226
+
227
+ $customerAddressbilling = $this->getQuote()->getBillingAddress();
228
+
229
+ #$address_billing->importCustomerAddress($customerAddressbilling);
230
+
231
+ $storeId = Mage::app()->getStore()->getId();
232
+
233
+ $checkout = Mage::getSingleton('checkout/type_onepage');
234
+
235
+ $checkout->initCheckout();
236
+
237
+ $checkout->saveCheckoutMethod('register');
238
+
239
+ $checkout->saveShippingMethod($datapost["shipping_method"]);
240
+ $additionaldata = array(
241
+ 'method' => 'moip_cc',
242
+ 'moip_cc_count_cofre' => $datapost['moip_cc_count_cofre'],
243
+ 'moip_cc_payment_in_cofre' => '0',
244
+ 'moip_cc_use_cofre' => '1',
245
+ 'moip_cc_cofre_nb' => $datapost['moip_cc_cofre_nb'],
246
+ 'moip_cc_cofre_id' => $datapost['moip_cc_cofre_id'],
247
+ );
248
+
249
+ $this->getQuote()->getPayment()->importData($additionaldata);
250
+ $checkout->saveOrder();
251
+ try {
252
+
253
+
254
+ $allQuoteItems = $this->getQuote()->getAllItems();
255
+ foreach ($allQuoteItems as $_item) {
256
+ $_product = $_item->getProduct();
257
+ if ($_product->getIsPreparedToDelete()) {
258
+ $quote->removeItem($_item->getId());
259
+ }
260
+ }
261
+ $this->getQuote()->save();
262
+ $mensage['_status'] = "SUCCESS";
263
+ $mensage['url_redirect'] = $quote->getPayment()->getOrderPlaceRedirectUrl();
264
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($mensage));
265
+ return;
266
+ }
267
+ catch (Exception $ex) {
268
+ $mensage['_status'] = "ERROR";
269
+ $mensage['mensage'] = $ex->getMessage();
270
+ return;
271
  }
 
 
 
272
  }
 
 
 
 
 
 
 
 
 
273
 
274
+ public function LoginOnclickAction() {
275
+ $datapost = $this->getRequest()->getPost();
276
+
277
+ $email = $datapost['email'];
278
+ $password = $datapost['password'];
279
+
280
+ $session = Mage::getSingleton('customer/session');
281
+
282
+ try {
283
+ $session->login($email, $password);
284
+ $customer = $session->getCustomer();
285
+
286
+ $session->setCustomerAsLoggedIn($customer);
287
+ $_customer = Mage::getSingleton( 'customer/session' )->getCustomer();
288
+ $address_id = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
289
+ $address = Mage::getModel('customer/address')->load($address_id);
290
+ $applyrule=$this->getQuote()->getAppliedRuleIds();
291
+ $applyaction=Mage::getModel('salesrule/rule')->load($applyrule)->getSimpleAction();
292
+ $this->getQuote()->getShippingAddress()
293
+ ->setCountryId($address->getCountryId())
294
+ ->setPostcode($address->getPostcode())
295
+ ->setCollectShippingRates(true);
296
+ $this->_getQuote()->save();
297
+ $response['_status'] = 'SUCCESS';
298
+ $response['mensage'] = $this->renderPayment();
299
+
300
+ } catch(Exception $ex) {
301
+ $response['_status'] = 'ERROR';
302
+ $response['mensage'] = '<ul class="messages"><li class="error-msg"><ul><li><span>Login não pode ser feito, verifique seu e-mail e senha.</span></li></ul></li></ul>';
303
  }
304
+ return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
305
+
306
+ }
307
+
308
 
 
 
309
  }
app/code/local/MOIP/Transparente/controllers/RecurringController.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MOIP_Transparente_RecurringController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+ public function getApiMoip()
6
+ {
7
+ $api = Mage::getSingleton('transparente/recurringapi');
8
+ return $api;
9
+
10
+ }
11
+
12
+ public function NewTranscitionAction()
13
+ {
14
+
15
+ $api = $this->getApiMoip();
16
+ $chave1 = Mage::getStoreConfig('payment/moip_transparente_standard/validador_retorno');
17
+
18
+ $data = $this->getRequest()->getParams();
19
+ $json_moip = $this->getRequest()->getRawBody();
20
+ $decode = json_decode($json_moip, false);
21
+
22
+
23
+
24
+
25
+ if($data['validacao'] == $chave1){
26
+ $order_event = $decode->event;
27
+
28
+ if($order_event == 'payment.status_updated'){
29
+
30
+
31
+
32
+ $api->generateLog($json_moip, 'MOIP_Webhooks.log');
33
+ $order_trans = $decode->resource->subscription_code;
34
+ $order_trans_status = $decode->resource->status->description;
35
+ if($order_trans_status == "Autorizado"){
36
+ $new_order_data = $this->consultRecurring($order_trans);
37
+ $order_create = $this->CreateOrder($new_order_data);
38
+
39
+ echo "criada order: ".$order_create->getId();
40
+ echo "status: ".$order_trans_status;
41
+
42
+ echo $this->setStatesRecurring($order_create, $order_trans_status);
43
+
44
+ $order_create->sendNewOrderEmail();
45
+ } else {
46
+ echo "Não lerei essa info";
47
+ return;
48
+ }
49
+
50
+
51
+ } elseif($order_event == 'payment.created'){
52
+ echo "Não lerei essa info";
53
+ return;
54
+
55
+
56
+ }
57
+
58
+ }
59
+
60
+
61
+ }
62
+ public function consultRecurring($code_id){
63
+ $profile = Mage::getModel('sales/recurring_profile')->load($code_id);
64
+ $order = $profile->getOrderInfo();
65
+ $order_id = $order['entity_id'];
66
+ $customer = $profile->getCustomerId();
67
+ $shipping_amount = $profile->getShippingAmount();
68
+ $payment_method = $profile->getMethodCode();
69
+ $shipping = $profile->getShippingAddressInfo();
70
+ $dicount = $profile->getDiscountAmount();
71
+ $base_dicount = $profile->getBaseDiscountAmount();
72
+ $shipping_method = $shipping['shipping_method'];
73
+ $shipping_description = $shipping['shipping_description'];
74
+ $products = $profile->getOrderItemInfo();
75
+ $products_order = array(
76
+ $products['product_id'] => array(
77
+ 'qty' => (int) $products['qty']
78
+ )
79
+ );
80
+
81
+ $order_init = array(
82
+ 'profile' => $profile,
83
+ 'order_info' => $order,
84
+ 'order_id' => $order_id,
85
+ 'customer_id' => $customer,
86
+ 'order_discount' => $dicount,
87
+ 'order_base_discount' => $base_dicount,
88
+ 'products' => $products_order,
89
+ 'shipping_amount' => $shipping_amount,
90
+ 'payment' => $payment_method,
91
+ 'shipping' => $shipping_method,
92
+ 'shipping_description' => $shipping_description
93
+ );
94
+
95
+ return $order_init;
96
+ }
97
+
98
+ public function CreateOrder($order_init = array(), $link = null)
99
+ {
100
+ $products_init = $order_init['products'];
101
+ $payment_init = $order_init['payment'];
102
+ $shipping_init = $order_init['shipping'];
103
+ $shipping_description_init = $order_init['shipping_description'];
104
+ $shipping_price_init = $order_init['shipping_amount'];
105
+ $profile = $order_init['profile'];
106
+ $customer_id = $order_init['customer_id'];
107
+ $dicount = $order_init['order_discount'];
108
+ $base_dicount = $order_init['order_base_discount'];
109
+
110
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
111
+
112
+ $transaction = Mage::getModel('core/resource_transaction');
113
+ $storeId = $customer->getStoreId();
114
+ $reservedOrderId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($storeId);
115
+
116
+ $order = Mage::getModel('sales/order')
117
+ ->setIncrementId($reservedOrderId)
118
+ ->setStoreId($storeId)
119
+ ->setQuoteId(0)
120
+ ->setGlobal_currency_code('BRL')
121
+ ->setBase_currency_code('BRL')
122
+ ->setStore_currency_code('BRL')
123
+ ->setOrder_currency_code('BRL');
124
+
125
+ $order->setCustomer_email($customer->getEmail())
126
+ ->setCustomerFirstname($customer->getFirstname())
127
+ ->setCustomerLastname($customer->getLastname())
128
+ ->setCustomerTaxvat($customer->getTaxvat())
129
+ ->setCustomerGroupId($customer->getGroupId())
130
+ ->setCustomer_is_guest(0)
131
+ ->setCustomer($customer);
132
+
133
+ $billing = $customer->getDefaultBilling();
134
+ $address = Mage::getModel('customer/address')->load($billing);
135
+ $billingAddress = Mage::getModel('sales/order_address')->setStoreId($storeId)->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
136
+ ->setCustomerId($customer->getId())
137
+ ->setCustomerAddressId($customer->getDefaultBilling())
138
+ ->setPrefix($address->getPrefix())
139
+ ->setFirstname($address->getFirstname())
140
+ ->setMiddlename($address->getMiddlename())
141
+ ->setLastname($address->getLastname())
142
+ ->setSuffix($address->getSuffix())
143
+ ->setCompany($address->getCompany())
144
+ ->setStreet($address->getStreet())
145
+ ->setCity($address->getCity())
146
+ ->setCountryId($address->getCountryId())
147
+ ->setRegion($address->getRegion())
148
+ ->setRegionId($address->getRegionId())
149
+ ->setPostcode($address->getPostcode())
150
+ ->setTelephone($address->getTelephone())
151
+ ->setFax($address->getFax())
152
+ ->setVatId($customer->getTaxvat());
153
+ $order->setBillingAddress($billingAddress);
154
+
155
+ $shipping = $customer->getDefaultShippingAddress();
156
+ $shippingAddress = Mage::getModel('sales/order_address')->setStoreId($storeId)->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
157
+ ->setCustomerId($customer->getId())
158
+ ->setCustomerAddressId($customer->getDefaultShipping())
159
+ ->setCustomerAddressId($shipping->getId())
160
+ ->setPrefix($shipping->getPrefix())
161
+ ->setFirstname($shipping->getFirstname())
162
+ ->setMiddlename($shipping->getMiddlename())
163
+ ->setLastname($shipping->getLastname())
164
+ ->setCustomerTaxvat($customer->getTaxvat())
165
+ ->setSuffix($shipping->getSuffix())
166
+ ->setCompany($shipping->getCompany())
167
+ ->setStreet($shipping->getStreet())
168
+ ->setCity($shipping->getCity())
169
+ ->setCountryId($shipping->getCountryId())
170
+ ->setRegion($shipping->getRegion())
171
+ ->setRegionId($shipping->getRegionId())
172
+ ->setPostcode($shipping->getPostcode())
173
+ ->setTelephone($shipping->getTelephone())
174
+ ->setFax($shipping->getFax())
175
+ ->setVatId($customer->getTaxvat());
176
+
177
+ $order->setShippingAddress($shippingAddress);
178
+ $order->setShippingMethod($shipping_init)->setShippingDescription($shipping_description_init);
179
+
180
+
181
+ $orderPayment = Mage::getModel('sales/order_payment')->setStoreId($storeId)->setCustomerPaymentId(0)->setMethod($payment_init)->setPo_number(' – ');
182
+ $order->setPayment($orderPayment);
183
+ if($link)
184
+ $orderPayment->setAdditionalInformation('link_boleto', $link);
185
+
186
+ $subTotal = 0;
187
+ $products = $products_init;
188
+
189
+ foreach ($products as $productId => $product) {
190
+ $_product = Mage::getModel('catalog/product')->load($productId);
191
+ $rowTotal = $_product->getPrice() * $product['qty'];
192
+ $orderItem = Mage::getModel('sales/order_item')->setStoreId($storeId)->setQuoteItemId(0)->setQuoteParentItemId(NULL)->setProductId($productId)->setProductType($_product->getTypeId())->setQtyBackordered(NULL)->setTotalQtyOrdered($product['rqty'])->setQtyOrdered($product['qty'])->setName($_product->getName())->setSku($_product->getSku())->setPrice($_product->getPrice())->setBasePrice($_product->getPrice())->setOriginalPrice($_product->getPrice())->setRowTotal($rowTotal)->setBaseRowTotal($rowTotal);
193
+
194
+ $subTotal += $rowTotal;
195
+ $order->addItem($orderItem);
196
+ }
197
+ $subTotal = $subTotal + $shipping_price_init;
198
+ $order->setSubtotal($subTotal)
199
+ ->setBaseSubtotal($subTotal)
200
+ ->setGrandTotal($subTotal)
201
+ ->setBaseShippingAmount($shipping_price_init)
202
+ ->setShippingAmount($shipping_price_init)
203
+ ->setBaseGrandTotal($subTotal)
204
+ ->setBaseDiscountAmount($base_discount)
205
+ ->setDiscountAmount($discount);
206
+
207
+ $transaction->addObject($order);
208
+ $transaction->addCommitCallback(array(
209
+ $order,
210
+ 'place'
211
+ ));
212
+
213
+ $transaction->save();
214
+
215
+
216
+ $profile->addOrderRelation($order->getId());
217
+
218
+ return $order;
219
+
220
+ }
221
+
222
+
223
+
224
+
225
+ public function setStatesRecurring($order, $status_moip)
226
+ {
227
+ $order_status = $order->getStatus();
228
+ $onhold = Mage::getSingleton('transparente/standard')->getConfigData('order_status_holded_trial');
229
+ $paid = Mage::getSingleton('transparente/standard')->getConfigData('order_status_processing');
230
+
231
+ if ($order->getId()) {
232
+ try {
233
+
234
+
235
+ $paid = Mage::getSingleton('transparente/standard')->getConfigData('order_status_processing');
236
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
237
+ $status = $paid;
238
+ $comment = "Pagamento Autorizado";
239
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
240
+ $order->save();
241
+ $order->sendOrderUpdateEmail(true, $comment);
242
+ $invoice = $order->prepareInvoice();
243
+ Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
244
+ $invoice->sendEmail();
245
+ $invoice->setEmailSent(true);
246
+ $invoice->save();
247
+
248
+
249
+ }
250
+ catch (Exception $order) {
251
+
252
+ Mage::throwException(Mage::helper('core')->__('Order não encontrada'));
253
+ }
254
+
255
+ } else {
256
+ Mage::throwException(Mage::helper('core')->__('Order não encontrada'));
257
+ }
258
+ }
259
+
260
+
261
+ public function autorizaPagamento($order, $paid)
262
+ {
263
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
264
+ $status = $paid;
265
+ $comment = "Pagamento Autorizado";
266
+ $invoice = $order->prepareInvoice();
267
+ if ($this->getStandard()->canCapture()) {
268
+ $invoice->register()->capture();
269
+ }
270
+ Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
271
+ $invoice->sendEmail();
272
+ $invoice->setEmailSent(true);
273
+ $invoice->save();
274
+ $update = $this->updateInOrder($order, $state, $status, $comment);
275
+ return $update;
276
+ }
277
+
278
+ public function iniciaPagamento($order, $onhold)
279
+ {
280
+ $state = Mage_Sales_Model_Order::STATE_HOLDED;
281
+ $status = $onhold;
282
+ $comment = "Pagamento Iniciado";
283
+ $update = $this->updateInOrder($order, $state, $status, $comment);
284
+ return $update;
285
+ }
286
+
287
+ public function iniciaPagamentoEspecial($order, $onhold)
288
+ {
289
+ $state = Mage_Sales_Model_Order::STATE_NEW;
290
+ $status = 'pending';
291
+ $comment = "Order de solicitação de recorrência.";
292
+ $update = $this->updateInOrder($order, $state, $status, $comment);
293
+ return $update;
294
+ }
295
+
296
+ public function cancelaPagamento($order)
297
+ {
298
+ $state = Mage_Sales_Model_Order::STATE_CANCELED;
299
+ $comment = "Pagamento Não Autorizado";
300
+ $status = 'canceled';
301
+ $order->cancel();
302
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
303
+ $order->save();
304
+ $update = $this->updateInOrder($order, $state, $status, $comment);
305
+ return $update;
306
+ }
307
+
308
+ public function updateInOrder($order, $state, $status, $comment){
309
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
310
+ $order->save();
311
+ $order->sendOrderUpdateEmail(true, $comment);
312
+ return true;
313
+ }
314
+
315
+ }
app/code/local/MOIP/Transparente/controllers/StandardController.php CHANGED
@@ -10,12 +10,13 @@
10
  * @license Autorizado o uso por tempo indeterminado
11
  */
12
  class MOIP_Transparente_StandardController extends Mage_Core_Controller_Front_Action {
 
13
  public function getStandard() {
14
  return Mage::getSingleton('transparente/standard');
15
  }
 
16
  public function _prepareLayout()
17
  {
18
- $this->addMessages(Mage::getSingleton('core/session')->getMessages(true));
19
  parent::_prepareLayout();
20
  }
21
 
@@ -26,17 +27,101 @@ class MOIP_Transparente_StandardController extends Mage_Core_Controller_Front_Ac
26
  }
27
  }
28
 
29
- public function generateToken($xml) {
 
 
 
 
 
 
30
  $session = Mage::getSingleton('checkout/session');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- $documento = 'Content-Type: application/xml; charset=utf-8';
33
  if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
34
- $url = "https://desenvolvedor.moip.com.br/sandbox/ws/alpha/EnviarInstrucao/Unica";
35
- $header = "Authorization: Basic " . base64_encode(MOIP_Transparente_Model_Api::TOKEN_TEST . ":" . MOIP_Transparente_Model_Api::KEY_TEST);
 
 
 
 
 
 
 
 
36
  }
37
  else {
38
- $url = "https://www.moip.com.br/ws/alpha/EnviarInstrucao/Unica";
39
- $header = "Authorization: Basic " . base64_encode(MOIP_Transparente_Model_Api::TOKEN_PROD . ":" . MOIP_Transparente_Model_Api::KEY_PROD);
 
 
 
 
 
 
 
 
40
  }
41
  $result = array();
42
  $ch = curl_init();
@@ -44,55 +129,159 @@ class MOIP_Transparente_StandardController extends Mage_Core_Controller_Front_Ac
44
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
45
  curl_setopt($ch, CURLOPT_TIMEOUT, 6000);
46
  curl_setopt($ch, CURLOPT_POST, true);
47
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
48
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
49
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
50
  curl_setopt($ch, CURLOPT_HTTPHEADER, array($header, $documento));
 
 
51
  $res = curl_exec($ch);
52
  curl_close($ch);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
 
54
 
55
- $res = simplexml_load_string($res);
56
- if($res->Resposta->Status == "Sucesso"){
57
- $result['status'] = (string)$res->Resposta->Status;
58
- $result['token'] = (string)$res->Resposta->Token;
59
- Mage::log($result['token'], null, 'MOIP_Transparente.log', true);
60
- Mage::log($xml, null, 'MOIP_Transparente.log', true);
61
- $session->setResult_decode($result);
62
- return $result;
63
- }
64
- else {
65
- $result['erro'] = (string)$res->Resposta->Erro;
66
- Mage::log("Erro em status do server transparente ".$result['erro'], null, 'MOIP_Transparente.log', true);
67
- Mage::log($xml, null, 'MOIP_Transparente.log', true);
68
- Mage::getSingleton('core/session')->addError('Não foi possível processar o seu pagamento: motivo '.$result['erro'].' Corrija o dado solcitado e tente comprar novamente.');
69
 
70
- return $result;
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
 
 
 
 
73
 
74
- }
75
- public function redirectAction() {
76
- $session = Mage::getSingleton('checkout/session');
77
- $session->setCurrent_order('');
78
- $session->setPgtoarry('');
79
- $session->setClient_array('');
80
- $getSaltes = Mage::getModel('sales/order');
81
- $standard = $this->getStandard();
82
- $fields = $session->getTransparenteFields();
83
- $pgtoArray = $session->getPgtoArray();
84
- $api = Mage::getModel('transparente/api');
85
- $api->setAmbiente($standard->getConfigData('ambiente'));
86
- $pedido_send = $api->generatePedido($fields, $pgtoArray);
87
- $gettoken = $this->generateToken($pedido_send);
88
- $session->setCurrent_order($getSaltes->load($session->getLastOrderId()));
89
- $session->setPgtoarry($pgtoArray);
90
- $session->setClient_array($fields);
91
- $this->loadLayout();
92
- $this->renderLayout();
93
- }
94
 
95
 
 
96
  public function cancelAction() {
97
  $session = Mage::getSingleton('checkout/session');
98
  $session->setQuoteId($session->getTransparenteStandardQuoteId(true));
@@ -101,286 +290,148 @@ class MOIP_Transparente_StandardController extends Mage_Core_Controller_Front_Ac
101
  $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
102
  if ($order->getId()) {
103
  $order->cancel()->save();
 
 
 
 
 
104
  }
105
  }
106
- $this->_redirect('checkout/cart');
107
  }
108
- protected function _getItemQtys()
109
- {
110
- $data = $this->getRequest()->getParam('invoice');
111
- if (isset($data['items'])) {
112
- $qtys = $data['items'];
113
- } else {
114
- $qtys = array();
115
- }
116
- return $qtys;
117
- }
118
- public function successAction() {
119
- $standard = $this->getStandard();
120
- $naexecuta = "";
121
- $nao_processa = "";
122
- $validacao = $this->getRequest()->getParams();
123
- echo "Okay Nasp! ";
124
- if($validacao['validacao'] == $standard->getConfigData('validador_retorno')){
125
- $data = $this->getRequest()->getPost();
126
- $login = $standard->getConfigData('conta_transparente')."_";
127
- $data_transparente = trim($data['id_transacao']);
128
- $order_magento = strpos($data_transparente, $login);
129
- $order_magento = substr($data_transparente, strpos($data_transparente, "_") + 1);
130
- $model = Mage::getModel('transparente/write');
131
-
132
- $order = Mage::getModel('sales/order')->load($order_magento);
133
- $id_order = $order->getId();
134
- $incrementid = $order->getIncrementId();
135
- $model->load($incrementid, 'realorder_id');
136
- $meio_pago = $model->getMeioPg();
137
- if($meio_pago == "CartaoCredito"){
138
- if($model->getAceitaCofre() == 1){
139
- $model->setCofre($data['cofre']);
140
- $model->save();
141
- }
142
- }
143
- $states_atual = $order->getStatus();
144
- if($states_atual == "processing"){
145
- $naexecuta = 1;
146
- return;
147
- }
148
- if($states_atual == "complete"){
149
- $naexecuta = 1;
150
- return;
151
- }
152
- if($states_atual == "closed"){
153
- $naexecuta = 1;
154
- return;
155
- }
156
 
157
- if($states_atual == 'canceled' && $data['status_pagamento']==5){
158
- $naexecuta = 1;
159
- return;
160
- }
161
 
162
- if ($order->isCanceled() && $data['status_pagamento'] == "1") {
163
-
164
-
165
-
166
-
167
- foreach ($order->getAllItems() as $item) {
168
- echo $data['status_pagamento'] ;
169
- $item->setQtyCanceled($item->getQtyOrdered());
170
- $item->save();
171
- $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($item->getProductId());
172
- $stockItem->subtractQty($item->getQtyOrdered());
173
- $stockItem->setIsInStock(true)->setStockStatusChangedAutomaticallyFlag(true);
174
- $stockItem->save();
175
- $produtos = $item->getProductId();
176
- $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $produtos);
177
- $qty = $item->getQtyOrdered();
178
- $rowTotal = $item->getPrice();
179
- $orderItemProductOption = $item->getProductOptions();
180
- $_customOptions = array(
181
- 'info_buyRequest' => $orderItemProductOption['info_buyRequest']
182
- );
183
-
184
- $orderItem = Mage::getModel('sales/order_item')
185
- ->setStoreId($order->getStore()->getStoreId())
186
- ->setQuoteItemId($item->getId())
187
- ->setQuoteParentItemId(NULL)
188
- ->setProductId($item->getId())
189
- ->setProductOptions(array_merge($orderItemProductOption, $_customOptions))
190
- ->setProductType($item->getTypeId())
191
- ->setQtyBackordered(NULL)
192
- ->setTotalQtyOrdered($qty)
193
- ->setQtyOrdered($qty)
194
- ->setName($item->getName())
195
- ->setSku($item->getSku())
196
- ->setPrice($item->getPrice())
197
- ->setBasePrice($item->getPrice())
198
- ->setOriginalPrice($item->getPrice())
199
- ->setRowTotal($rowTotal)
200
- ->setBaseRowTotal($rowTotal)
201
- ->setOrder($order);
202
- $orderItem->save();
203
-
204
- }
205
-
206
- $order->save();
207
-
208
- $nao_processa = 1;
209
-
210
-
211
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
212
- $status = 'processing';
213
- $comment = $this->getStatusPagamentoTransparente($status).' Usando RePagamento - Codig. Transparente: '.$data['cod_moip'];
214
- $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
215
- $order->save();
216
-
217
- /*
218
- #gerar invoice mas não adicona o item para o repagamento... analisando.
219
- $invoice = $order->prepareInvoice();
220
- $invoice->sendEmail();
221
- $invoice->setEmailSent(true);
222
- $invoice->save();
223
- */
224
- }
225
 
226
- switch ($data['status_pagamento']) {
227
- case "1":
228
- if($states_atual != 'processing' && $nao_processa != 1){
229
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
230
- $status = 'processing';
231
- $comment = $this->getStatusPagamentoTransparente($status).' - Codig. Transparente: '.$data['cod_moip'];
232
- $invoice = $order->prepareInvoice();
233
- if ($this->getStandard()->canCapture())
234
- {
235
- $invoice->register()->capture();
236
- }
237
- Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
238
- $invoice->sendEmail();
239
- $invoice->setEmailSent(true);
240
- $invoice->save();
241
- } else {
242
- $naexecuta = 1;
243
- return;
244
- }
245
- break;
246
- case "2":
247
- $state = Mage_Sales_Model_Order::STATE_HOLDED;
248
- $status = 'holded';
249
- $comment = $this->getStatusPagamentoTransparente($data['status_pagamento']).' - Codig. Transparente: '.$data['cod_moip'];
250
- break;
251
- case "3":
252
- if($states_atual != 'processing' && $states_atual != 'holded'){
253
- $state = Mage_Sales_Model_Order::STATE_HOLDED;
254
- $status = 'holded';
255
- $comment = $this->getStatusPagamentoTransparente($data['status_pagamento']).' - Codig. Transparente: '.$data['cod_moip'];
256
- } else {
257
- $naexecuta = 1;
258
- return;
259
- }
260
- break;
261
- case "5":
262
- if($order->canUnhold()) {
263
- $order->unhold()->save();
264
- }
265
-
266
- if(!$order->canCancel())
267
- continue;
268
- $state = Mage_Sales_Model_Order::STATE_CANCELED;
269
- $status = 'canceled';
270
- $comment = $this->getStatusPagamentoTransparente($data['status_pagamento']).' - Codig. Transparente: '.$data['cod_moip'].' - Motivo: '.utf8_encode($data['classificacao']);
271
- $order->cancel();
272
- break;
273
- case "6":
274
-
275
- $state = Mage_Sales_Model_Order::STATE_HOLDED;
276
- $status = 'holded';
277
- $comment = $this->getStatusPagamentoTransparente($data['status_pagamento']).' - Codig. Transparente: '.$data['cod_moip'];
278
- break;
279
- }
280
- if($naexecuta != 1){
281
- $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
282
- $order->save();
283
- if(Mage::getStoreConfig('payment/moip_transparente_standard/notificar_cliente') == 1){
284
- if( $order->getStatus() != 'pending' && $data['status_pagamento'] != 2){
285
- $order->sendOrderUpdateEmail(true, $comment);
286
- }
287
- }
288
- echo 'Processo de retorno concluido para o pedido #'.$id_order.' Status '.$status;
289
- Mage::log("Cliente do pedido ".$id_order. " - Status - " .$states_atual ." retorno completo ".implode('', $data), null, 'MOIP_Nasp.log', true);
290
- }
291
- else {
292
- Mage::log("Nao atualizado transparente Cliente do pedido ".$id_order. " - Status - " .$states_atual ." retorno ".implode(' ', $data) , null, 'MOIP_Nasp.log', true);
293
- }
294
  }
295
- }
296
-
297
- private function getNomePagamento($param) {
298
- $nome = "";
299
- switch ($param) {
300
- case "BoletoBancario":
301
- $nome = "Boleto Bancário";
302
- break;
303
- case "DebitoBancario":
304
- $nome = "Debito Bancário";
305
- break;
306
- case "CartaoCredito":
307
- $nome = "Cartão de Crédito";
308
- break;
309
- default:
310
- $nome ="meio";
311
- break;
312
  }
313
- return $nome;
314
- }
 
 
315
 
316
- private function getStatusPagamentoTransparente($param) {
317
- switch ($param) {
318
- case "1":
319
- $param = "Pagamento Autorizado";
320
- break;
321
- case "2":
322
- $param = "Pagamento Iniciado";
323
- break;
324
- case "3":
325
- $param = "Boleto Impresso";
326
- break;
327
- case "4":
328
- $param = "Pagamento Concluido";
329
- break;
330
- case "5":
331
- $param = "Pagamento Cancelado";
332
- break;
333
- case "6":
334
- $param = "Pagamento em análise";
335
- break;
336
- case "7":
337
- $param = "Pagamento Reembolsado";
338
- break;
339
- case "8":
340
- $param = "Pagamento Revertido pela Operadora";
341
- break;
342
- default:
343
- $param = "Consultar no Moip";
344
- break;
345
- }
346
- return $param;
347
- }
348
 
349
- private function _sendStatusMail($order, $tokenpagamento)
350
- {
351
- $emailTemplate = Mage::getModel('core/email_template');
352
- $emailTemplate->loadDefault('moip_ordem_tpl');
353
- $emailTemplate->setTemplateSubject('Pedido Cancelado');
354
- $salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
355
- $salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');
356
- $emailTemplate->setSenderName($salesData['name']);
357
- $emailTemplate->setSenderEmail($salesData['email']);
358
- $emailTemplateVariables['username'] = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
359
- $emailTemplateVariables['order_id'] = $order->getIncrementId();
360
- $emailTemplateVariables['token'] = $tokenpagamento;
361
- $emailTemplateVariables['store_name'] = $order->getStoreName();
362
- $emailTemplateVariables['store_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
363
- $emailTemplate->send($order->getCustomerEmail(), $order->getStoreName(), $emailTemplateVariables);
364
- }
365
 
366
- public function email_erro_pgtoAction() {
367
- if ($_GET['erro'] != "true"){
368
- $erro = $_GET['erro'];
369
- $pedido = $_GET['pedido'];
370
- $navegador = $_GET['navegador'];
371
- Mage::log("Cliente do pedido ".$pedido. " - Erro - " .$erro. " navegador ". $navegador, null, 'MOIP_Transparente.log', true);
 
 
 
 
 
 
 
372
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  }
374
 
375
 
376
- public function post_correio($url, $get) {
377
- $url = explode('?', $url, 2);
378
- $ch = curl_init($url[0]."?".http_build_query($get));
379
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
380
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
381
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
382
- return curl_exec($ch);
383
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  public function buscaCepAction() {
385
  $data = $this->getRequest()->getParams();
386
  if ($data['meio'] == "buscaend") {
@@ -423,96 +474,318 @@ class MOIP_Transparente_StandardController extends Mage_Core_Controller_Front_Ac
423
  $response = $client->request();
424
 
425
  if($response->getBody() != "503"){
426
- $res = $response->getBody();
427
-
428
- $endereco = Mage::helper('core')->jsonDecode($res);
429
-
430
-
431
- switch ($endereco['uf']) {
432
- case "AC":
433
- $endereco['ufid'] = 485;
434
- break;
435
- case "AL":
436
- $endereco['ufid'] = 486;
437
- break;
438
- case "AP":
439
- $endereco['ufid'] = 487;
440
- break;
441
- case "AM":
442
- $endereco['ufid'] = 488;
443
- break;
444
- case "BA":
445
- $endereco['ufid'] = 489;
446
- break;
447
- case "CE":
448
- $endereco['ufid'] = 490;
449
- break;
450
- case "DF":
451
- $endereco['ufid'] = 491;
452
- break;
453
- case "ES":
454
- $endereco['ufid'] = 492;
455
- break;
456
- case "GO":
457
- $endereco['ufid'] = 493;
458
- break;
459
- case "MA":
460
- $endereco['ufid'] = 494;
461
- break;
462
- case "MT":
463
- $endereco['ufid'] = 495;
464
- break;
465
- case "MS":
466
- $endereco['ufid'] = 496;
467
- break;
468
- case "MG":
469
- $endereco['ufid'] = 497;
470
- break;
471
- case "PA":
472
- $endereco['ufid'] = 498;
473
- break;
474
- case "PB":
475
- $endereco['ufid'] = 499;
476
- break;
477
- case "PR":
478
- $endereco['ufid'] = 500;
479
- break;
480
- case "PE":
481
- $endereco['ufid'] = 501;
482
- break;
483
- case "PI":
484
- $endereco['ufid'] = 502;
485
- break;
486
- case "RJ":
487
- $endereco['ufid'] = 503;
488
- break;
489
- case "RN":
490
- $endereco['ufid'] = 504;
491
- break;
492
- case "RS":
493
- $endereco['ufid'] = 505;
494
- break;
495
- case "RO":
496
- $endereco['ufid'] = 506;
497
- break;
498
- case "RR":
499
- $endereco['ufid'] = 507;
500
- break;
501
- case "SC":
502
- $endereco['ufid'] = 508;
503
- break;
504
- case "SP":
505
- $endereco['ufid'] = 509;
506
- break;
507
- case "SE":
508
- $endereco['ufid'] = 510;
509
- break;
510
- case "TO":
511
- $endereco['ufid'] = 511;
512
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  }
514
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode((object)$endereco));
 
 
515
  }
516
  }
 
 
 
517
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  }
 
10
  * @license Autorizado o uso por tempo indeterminado
11
  */
12
  class MOIP_Transparente_StandardController extends Mage_Core_Controller_Front_Action {
13
+
14
  public function getStandard() {
15
  return Mage::getSingleton('transparente/standard');
16
  }
17
+
18
  public function _prepareLayout()
19
  {
 
20
  parent::_prepareLayout();
21
  }
22
 
27
  }
28
  }
29
 
30
+ public function getApi()
31
+ {
32
+ $api = Mage::getModel('transparente/api');
33
+ return $api;
34
+ }
35
+
36
+ public function redirectAction() {
37
  $session = Mage::getSingleton('checkout/session');
38
+ $getSaltes = Mage::getModel('sales/order');
39
+ $session->setCurrent_order($getSaltes->load($session->getLastOrderId()));
40
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($session->getLastOrderId())));
41
+ $this->loadLayout();
42
+ $this->renderLayout();
43
+ }
44
+
45
+ protected function _getItemQtys()
46
+ {
47
+ $data = $this->getRequest()->getParam('invoice');
48
+ if (isset($data['items'])) {
49
+ $qtys = $data['items'];
50
+ } else {
51
+ $qtys = array();
52
+ }
53
+ return $qtys;
54
+ }
55
+
56
+ public function OauthAction() {
57
+ $api = $this->getApi();
58
+ $standard = $this->getStandard();
59
+ $data = $this->getRequest()->getParams();
60
+ $model = new Mage_Core_Model_Config();
61
+ $api->generateLog($data['validacao'], 'MOIP_Oauth.log');
62
+
63
+ $json_log = json_encode($data);
64
+ $api->generateLog($json_log, 'MOIP_Oauth.log');
65
+ if($data['validacao']== $standard->getConfigData('validador_retorno')){
66
+ $store_id = $data['store_id'];
67
+
68
+ if($data['store_id']){
69
+ $store_code = $data['store_id'];
70
+ } else {
71
+ $store_code = 'default';
72
+ }
73
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
74
+ $oauth = $this->getOauthAcess($data['code']);
75
+ $oauth_decode = json_decode($oauth, true);
76
+ $api->generateLog($oauth_decode['accessToken'], 'MOIP_Oauth.log');
77
+ $model->saveConfig('payment/moip_transparente_standard/oauth_dev', $oauth_decode['accessToken'], $store_code, $store_id);
78
+ $public_key = $this->getKeyPublic($oauth_decode['accessToken']);
79
+ $model->saveConfig('payment/moip_transparente_standard/publickey_dev', $public_key, $store_code, $store_id);
80
+ } else {
81
+ $oauth = $this->getOauthAcess($data['code']);
82
+ $oauth_decode = json_decode($oauth, true);
83
+ $api->generateLog($oauth_decode['accessToken'], 'MOIP_Oauth.log');
84
+ $model->saveConfig('payment/moip_transparente_standard/oauth_prod', (string)$oauth_decode['accessToken'], 'default', 0);
85
+ $public_key = $this->getKeyPublic($oauth_decode['accessToken']);
86
+ $model->saveConfig('payment/moip_transparente_standard/publickey_prod', $public_key, $store_code, 0);
87
+ }
88
+ Mage::getSingleton('core/session')->addSuccess('Configuração Concluída, por favor realize o seu teste.');
89
+ $url = "";
90
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl($url));
91
+ } else {
92
+ echo utf8_decode("ha ha ha... você não tem autorização para realizar pagamentos...");
93
+ }
94
+
95
+ }
96
+
97
+ public function getOauthAcess($code) {
98
+ $api = $this->getApi();
99
+ $documento = 'Content-Type: application/json; charset=utf-8';
100
+ $api->generateLog($code, 'MOIP_Oauth.log');
101
 
 
102
  if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
103
+ $url = "https://sandbox.moip.com.br/oauth/accesstoken";
104
+ $header = "Authorization: Basic " . base64_encode(MOIP_Transparente_Model_Api::TOKEN_TEST . ":" . MOIP_Transparente_Model_Api::KEY_TEST);
105
+ $array_json = array(
106
+ 'appId' => 'APP-9MUFQ39Y4CQU', //Alterar aqui tb....
107
+ 'appSecret' => '26xa86dbc7mhdyqq2w69vscvhz47cri', //Alterar aqui tb....
108
+ 'redirectUri' => 'http://moip.o2ti.com/magento/redirect/',
109
+ 'grantType' => 'authorization_code',
110
+ 'code' => $code
111
+ );
112
+ $json = json_encode($array_json);
113
  }
114
  else {
115
+ $url = "https://api.moip.com.br/oauth/accesstoken";
116
+ $header = "Authorization: Basic " . base64_encode(MOIP_Transparente_Model_Api::TOKEN_PROD . ":" . MOIP_Transparente_Model_Api::KEY_PROD);
117
+ $array_json = array(
118
+ 'appId' => 'APP-AKYBMMVU1FL1', //Alterar aqui tb....
119
+ 'appSecret' => 'db9pavx8542khvsyn3s0tpxyu2gom2m', //Alterar aqui tb....
120
+ 'redirectUri' => 'http://moip.o2ti.com/magento/redirect/',
121
+ 'grantType' => 'authorization_code',
122
+ 'code' => $code
123
+ );
124
+ $json = json_encode($array_json);
125
  }
126
  $result = array();
127
  $ch = curl_init();
129
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
130
  curl_setopt($ch, CURLOPT_TIMEOUT, 6000);
131
  curl_setopt($ch, CURLOPT_POST, true);
132
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
133
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
134
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
135
  curl_setopt($ch, CURLOPT_HTTPHEADER, array($header, $documento));
136
+ curl_setopt($ch,CURLOPT_USERAGENT,'MoipMagento/2.0.0');
137
+
138
  $res = curl_exec($ch);
139
  curl_close($ch);
140
+ $api->generateLog($res, 'MOIP_Oauth.log');
141
+
142
+ return $res;
143
+ }
144
+
145
+
146
+
147
+
148
+ public function getKeyPublic($oauth) {
149
+ $api = $this->getApi();
150
+ $api->generateLog($oauth, 'MOIP_Oauth.log');
151
+ $documento = 'Content-Type: application/json; charset=utf-8';
152
+
153
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
154
+ $url = "https://sandbox.moip.com.br/v2/keys/";
155
+ $header = "Authorization: OAuth " . $oauth;
156
+ } else {
157
+ $url = "https://api.moip.com.br/v2/keys/";
158
+ $header = "Authorization: OAuth " . $oauth;
159
+ }
160
+ $result = array();
161
+ $ch = curl_init();
162
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
163
+ curl_setopt($ch, CURLOPT_URL, $url);
164
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
165
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
166
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
167
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
168
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
169
+ curl_setopt($ch,CURLOPT_USERAGENT,'MoipMagento/2.0.0');
170
+ $responseBody = curl_exec($ch);
171
+ curl_close($ch);
172
+
173
+ $api->generateLog($responseBody, 'MOIP_Oauth.log');
174
+ $responseBody = json_decode($responseBody, true);
175
+ $public_key = $responseBody['keys']['encryption'];
176
+ $api->generateLog($public_key, 'MOIP_Oauth.log');
177
+
178
+
179
+ return $public_key;
180
+ }
181
+
182
+ public function successAction() {
183
+ error_reporting(E_ALL);
184
+ ini_set("display_errors",1);
185
+
186
+ $api = $this->getApi();
187
+ $standard = $this->getStandard();
188
+ $validacao = $this->getRequest()->getParams();
189
+ $result = array('');
190
+ $status_moip = "";
191
+ $moip_ord = "";
192
+ $json_moip = $this->getRequest()->getRawBody();
193
+ if(!isset($validacao)){
194
+ return;
195
+ }
196
+
197
+ $json_moip = json_decode($json_moip);
198
+
199
+ if(isset($json_moip->resource->payment)){
200
+
201
+ $moip_ord = (string)$json_moip->resource->payment->_links->order->title;
202
+ $status_moip = (string)$json_moip->resource->payment->status;
203
+
204
+ } else {
205
+ $refundToStoreCreditAmount = null;
206
+ $moip_ord = $json_moip->resource->order->id;
207
+ $status_moip = (string)$json_moip->resource->order->status;
208
+ if (isset($json_moip->resource->order->refunds)) {
209
+
210
+ $refunds = $json_moip->resource->order->refunds;
211
+ foreach ($refunds as $key => $value) {
212
+ $refundToStoreCreditAmount = $value->amount->total;
213
+ }
214
+ $comment = "Reembolso para o Pedido: ".$moip_ord;
215
+
216
+ $refundToStoreCreditAmount = $refundToStoreCreditAmount/100;
217
+
218
+
219
+
220
+ }
221
 
222
+ }
223
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
+ $model = Mage::getModel('transparente/write');
226
+ $order_moip = str_replace("ORD-", "",$moip_ord);
227
+ $result = $model->load($order_moip, 'moip_order');
228
+ $mage_ord = $result->getMagePay();
229
+ $method = $result->getFormaPagamento();
230
+
231
+ if($method == "moip_boleto"){
232
+ $onhold = $standard->getConfigData('order_status_holded_boleto');
233
+ } elseif ($method == "moip_cc"){
234
+ $onhold = $standard->getConfigData('order_status_holded');
235
+ } elseif($method == "moip_tef"){
236
+ $onhold = $standard->getConfigData('order_status_holded_tef');
237
+ } else {
238
+ $onhold = $standard->getConfigData('order_status_holded');
239
+ }
240
+
241
+
242
+
243
+
244
+ if($validacao['validacao']== $standard->getConfigData('validador_retorno') && $status_moip != ""){
245
+
246
+ $order = Mage::getModel('sales/order')->load($mage_ord);
247
+ $order_status = $order->getStatus();
248
+ $api->generateLog($json_moip, 'MOIP_WebHooks.log');
249
+ $api->generateLog($status_moip, 'MOIP_WebHooks.log');
250
+ $api->generateLog($order_moip, 'MOIP_WebHooks.log');
251
+ $api->generateLog($mage_ord, 'MOIP_WebHooks.log');
252
+ if($order->getId()){
253
+ try {
254
+ if($status_moip == "AUTHORIZED" && $order_status != "processing"){
255
+ $paid = $standard->getConfigData('order_status_processing');
256
+
257
+ $upOrder = $this->autorizaPagamento($order, $paid);
258
+ return $upOrder;
259
+ } elseif($status_moip == "WAITING" && $order_status == "pending") {
260
+ $upOrder = $this->iniciaPagamento($order, $onhold);
261
+ return $upOrder;
262
+
263
+ } elseif($status_moip == "CANCELLED" && $order_status != "processing"){
264
+ $details = $json_moip->resource->payment->cancellationDetails->description;
265
+
266
+ $upOrder = $this->cancelaPagamento($order,$details);
267
+ return $upOrder;
268
+ } elseif($status_moip == "REFUNDED"){
269
+ return $this->refundPagamento($order, $refundToStoreCreditAmount, $comment);
270
+ } else{
271
+ die();
272
+ }
273
+ } catch (Exception $order) {
274
+ $api->generateLog($order, 'MOIP_WebHooksErro.log');
275
+ }
276
 
277
+ } else {
278
+ Mage::throwException(Mage::helper('core')->__('Order não encontrada'));
279
+ }
280
+ }
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
 
283
 
284
+ }
285
  public function cancelAction() {
286
  $session = Mage::getSingleton('checkout/session');
287
  $session->setQuoteId($session->getTransparenteStandardQuoteId(true));
290
  $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
291
  if ($order->getId()) {
292
  $order->cancel()->save();
293
+ $state = Mage_Sales_Model_Order::STATE_CANCELED;
294
+ $status = 'canceled';
295
+ $comment = $session->getMoipError();
296
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
297
+ $order->save();
298
  }
299
  }
300
+ $this->_redirect('checkout/onepage/failure');
301
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
 
 
 
 
 
303
 
304
+ public function autorizaPagamento($order, $paid){
305
+ sleep(10);
306
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
 
308
+ if($order->canUnhold()) {
309
+ $order->unhold()->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  }
311
+
312
+ $invoice = $order->prepareInvoice();
313
+ if ($this->getStandard()->canCapture())
314
+ {
315
+ $invoice->register()->capture();
 
 
 
 
 
 
 
 
 
 
 
 
316
  }
317
+ Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
318
+ $invoice->sendEmail();
319
+ $invoice->setEmailSent(true);
320
+ $invoice->save();
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
+
324
+ return;
325
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
326
 
327
+ public function iniciaPagamento($order, $onhold){
328
+
329
+ $state = Mage_Sales_Model_Order::STATE_HOLDED;
330
+ $status = $onhold;
331
+ $comment = "Pagamento Iniciado, aguardando confirmação automática.";
332
+ $update = $this->updateInOrder($order, $state, $status, $comment);
333
+ return $update;
334
+ }
335
+
336
+ public function cancelaPagamento($order, $details){
337
+ sleep(3);
338
+ if($order->canUnhold()) {
339
+ $order->unhold()->save();
340
  }
341
+ $order->cancel()->save();
342
+ $state = Mage_Sales_Model_Order::STATE_CANCELED;
343
+ $link = Mage::getUrl('sales/order/reorder/');
344
+ $link = $link.'order_id/'.$order->getEntityId();
345
+ $comment = "Motivo: ".$details." Para refazer o pagamento acesse o link: ".$link;
346
+ $status = 'canceled';
347
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
348
+ $order->save();
349
+ $order->sendOrderUpdateEmail(true, $comment);
350
+ return $update;
351
+ }
352
+
353
+ public function refundPagamento($order, $refundToStoreCreditAmount, $comment)
354
+ {
355
+
356
+ if (!$order->getId()) {
357
+ $this->_fault('order_not_exists');
358
+ }
359
+ if (!$order->canCreditmemo()) {
360
+ $this->_fault('cannot_create_creditmemo');
361
+ }
362
+ $data = array();
363
+
364
+
365
+ $service = Mage::getModel('sales/service_order', $order);
366
+
367
+ $creditmemo = $service->prepareCreditmemo($data);
368
+
369
+
370
+ if ($refundToStoreCreditAmount) {
371
+
372
+ if ($order->getCustomerIsGuest()) {
373
+ $this->_fault('cannot_refund_to_storecredit');
374
+ }
375
+ $refundToStoreCreditAmount = max(
376
+ 0,
377
+ min($creditmemo->getBaseCustomerBalanceReturnMax(), $refundToStoreCreditAmount)
378
+ );
379
+ if ($refundToStoreCreditAmount) {
380
+ $refundToStoreCreditAmount = $creditmemo->getStore()->roundPrice($refundToStoreCreditAmount);
381
+ $creditmemo->setBaseCustomerBalanceTotalRefunded($refundToStoreCreditAmount);
382
+ $refundToStoreCreditAmount = $creditmemo->getStore()->roundPrice(
383
+ $refundToStoreCreditAmount*$order->getStoreToOrderRate()
384
+ );
385
+ // this field can be used by customer balance observer
386
+ $creditmemo->setBsCustomerBalTotalRefunded($refundToStoreCreditAmount);
387
+ // setting flag to make actual refund to customer balance after credit memo save
388
+ $creditmemo->setCustomerBalanceRefundFlag(true);
389
+ }
390
+ }
391
+ $creditmemo->setPaymentRefundDisallowed(true)->register();
392
+ // add comment to creditmemo
393
+
394
+ $creditmemo->addComment($comment, 1);
395
+
396
+ try {
397
+ Mage::getModel('core/resource_transaction')
398
+ ->addObject($creditmemo)
399
+ ->addObject($order)
400
+ ->save();
401
+
402
+ $creditmemo->sendEmail(true, $comment);
403
+ } catch (Mage_Core_Exception $e) {
404
+ $this->_fault('data_invalid', $e->getMessage());
405
+ }
406
+ echo $creditmemo->getIncrementId();
407
+
408
+
409
+
410
  }
411
 
412
 
413
+ public function updateInOrder($order, $state, $status, $comment){
414
+ $order->setState($state, $status, $comment, $notified = true, $includeComment = true);
415
+ $order->save();
416
+ $order->sendOrderUpdateEmail(true, $comment);
417
+ return true;
418
+ }
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+ public function post_correio($url, $get) {
427
+ $url = explode('?', $url, 2);
428
+ $ch = curl_init($url[0]."?".http_build_query($get));
429
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
430
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
431
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
432
+ return curl_exec($ch);
433
+ }
434
+
435
  public function buscaCepAction() {
436
  $data = $this->getRequest()->getParams();
437
  if ($data['meio'] == "buscaend") {
474
  $response = $client->request();
475
 
476
  if($response->getBody() != "503"){
477
+ $res = $response->getBody();
478
+
479
+ $endereco = Mage::helper('core')->jsonDecode($res);
480
+
481
+ /*
482
+ //Remover comentário para usar a versão em que o distrito federal está fora da ordem alfabética. Nesse caso lembre-se que precisa remover o switch de baixo.
483
+ switch ($endereco['uf']) {
484
+ case "AC":
485
+ $endereco['ufid'] = 485;
486
+ break;
487
+ case "AL":
488
+ $endereco['ufid'] = 486;
489
+ break;
490
+ case "AP":
491
+ $endereco['ufid'] = 487;
492
+ break;
493
+ case "AM":
494
+ $endereco['ufid'] = 488;
495
+ break;
496
+ case "BA":
497
+ $endereco['ufid'] = 489;
498
+ break;
499
+ case "CE":
500
+ $endereco['ufid'] = 490;
501
+ break;
502
+ case "DF":
503
+ $endereco['ufid'] = 511;
504
+ break;
505
+ case "ES":
506
+ $endereco['ufid'] = 491;
507
+ break;
508
+ case "GO":
509
+ $endereco['ufid'] = 492;
510
+ break;
511
+ case "MA":
512
+ $endereco['ufid'] = 493;
513
+ break;
514
+ case "MT":
515
+ $endereco['ufid'] = 494;
516
+ break;
517
+ case "MS":
518
+ $endereco['ufid'] = 495;
519
+ break;
520
+ case "MG":
521
+ $endereco['ufid'] = 496;
522
+ break;
523
+ case "PA":
524
+ $endereco['ufid'] = 497;
525
+ break;
526
+ case "PB":
527
+ $endereco['ufid'] = 498;
528
+ break;
529
+ case "PR":
530
+ $endereco['ufid'] = 499;
531
+ break;
532
+ case "PE":
533
+ $endereco['ufid'] = 500;
534
+ break;
535
+ case "PI":
536
+ $endereco['ufid'] = 501;
537
+ break;
538
+ case "RJ":
539
+ $endereco['ufid'] = 502;
540
+ break;
541
+ case "RN":
542
+ $endereco['ufid'] = 503;
543
+ break;
544
+ case "RS":
545
+ $endereco['ufid'] = 504;
546
+ break;
547
+ case "RO":
548
+ $endereco['ufid'] = 505;
549
+ break;
550
+ case "RR":
551
+ $endereco['ufid'] = 506;
552
+ break;
553
+ case "SC":
554
+ $endereco['ufid'] = 507;
555
+ break;
556
+ case "SP":
557
+ $endereco['ufid'] = 508;
558
+ break;
559
+ case "SE":
560
+ $endereco['ufid'] = 509;
561
+ break;
562
+ case "TO":
563
+ $endereco['ufid'] = 510;
564
+ break;
565
+ }*/
566
+
567
+ switch ($endereco['uf']) {
568
+ case "AC":
569
+ $endereco['ufid'] = 485;
570
+ break;
571
+ case "AL":
572
+ $endereco['ufid'] = 486;
573
+ break;
574
+ case "AP":
575
+ $endereco['ufid'] = 487;
576
+ break;
577
+ case "AM":
578
+ $endereco['ufid'] = 488;
579
+ break;
580
+ case "BA":
581
+ $endereco['ufid'] = 489;
582
+ break;
583
+ case "CE":
584
+ $endereco['ufid'] = 490;
585
+ break;
586
+ case "DF":
587
+ $endereco['ufid'] = 491;
588
+ break;
589
+ case "ES":
590
+ $endereco['ufid'] = 492;
591
+ break;
592
+ case "GO":
593
+ $endereco['ufid'] = 493;
594
+ break;
595
+ case "MA":
596
+ $endereco['ufid'] = 494;
597
+ break;
598
+ case "MT":
599
+ $endereco['ufid'] = 495;
600
+ break;
601
+ case "MS":
602
+ $endereco['ufid'] = 496;
603
+ break;
604
+ case "MG":
605
+ $endereco['ufid'] = 497;
606
+ break;
607
+ case "PA":
608
+ $endereco['ufid'] = 498;
609
+ break;
610
+ case "PB":
611
+ $endereco['ufid'] = 499;
612
+ break;
613
+ case "PR":
614
+ $endereco['ufid'] = 500;
615
+ break;
616
+ case "PE":
617
+ $endereco['ufid'] = 501;
618
+ break;
619
+ case "PI":
620
+ $endereco['ufid'] = 502;
621
+ break;
622
+ case "RJ":
623
+ $endereco['ufid'] = 503;
624
+ break;
625
+ case "RN":
626
+ $endereco['ufid'] = 504;
627
+ break;
628
+ case "RS":
629
+ $endereco['ufid'] = 505;
630
+ break;
631
+ case "RO":
632
+ $endereco['ufid'] = 506;
633
+ break;
634
+ case "RR":
635
+ $endereco['ufid'] = 507;
636
+ break;
637
+ case "SC":
638
+ $endereco['ufid'] = 508;
639
+ break;
640
+ case "SP":
641
+ $endereco['ufid'] = 509;
642
+ break;
643
+ case "SE":
644
+ $endereco['ufid'] = 510;
645
+ break;
646
+ case "TO":
647
+ $endereco['ufid'] = 511;
648
+ break;
649
+ }
650
+ if($endereco['ufid'])
651
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode((object)$endereco));
652
+ else
653
+ $this->getResponse()->setBody('Correios indisponível');
654
+ }
655
+ }
656
+ }
657
+
658
+ public function EnableWebhooksAction(){
659
+
660
+ $validacao = $this->getRequest()->getParams();
661
+
662
+ if($validacao['validacao']== Mage::getSingleton('transparente/standard')->getConfigData('validador_retorno')){
663
+
664
+ $model = new Mage_Core_Model_Config();
665
+ $validacao = Mage::getSingleton('transparente/standard')->getConfigData('validador_retorno');
666
+ $status_controller = array("PAYMENT.AUTHORIZED","PAYMENT.CANCELLED","REFUND.REQUESTED");
667
+ $webhooks = array(
668
+ "events" => $status_controller,
669
+ "target" => Mage::getUrl('Transparente/standard/success/'.'validacao/'.$validacao.'/'),
670
+ "media" => "WEBHOOK"
671
+ );
672
+
673
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
674
+ $url = "https://sandbox.moip.com.br/v2/preferences/notifications/";
675
+ $oauth = trim(Mage::getSingleton('transparente/standard')->getConfigData('oauth_dev'));
676
+ $header = "Authorization: OAuth {$oauth}";
677
+ $documento = "Content-Type: application/json";
678
+ } else {
679
+ $url = "https://api.moip.com.br/v2/preferences/notifications/";
680
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod') ;
681
+ $header = "Authorization: OAuth {$oauth}";
682
+ $documento = "Content-Type: application/json";
683
+ }
684
+
685
+ $json = json_encode($webhooks);
686
+
687
+ $result = array();
688
+ $ch = curl_init();
689
+ curl_setopt($ch, CURLOPT_URL,$url);
690
+ curl_setopt($ch, CURLOPT_POST, true);
691
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
692
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
693
+ curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
694
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array($header, $documento));
695
+ curl_setopt($ch, CURLOPT_USERAGENT,'MoipMagento/2.0.0');
696
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
697
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
698
+
699
+ $res = curl_exec($ch);
700
+ $info = curl_getinfo($ch);
701
+ curl_close($ch);
702
+ $responseBody = json_decode($res, true);
703
+
704
+ $result = array('header' => array($header, $documento),
705
+ 'url' => $url,
706
+ "json_send" => $webhooks,
707
+ "responseBody" => $responseBody,
708
+ "responseCode" => $info
709
+
710
+ );
711
+ $json_debug = json_encode($result);
712
+
713
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
714
+ $model->saveConfig('payment/moip_transparente_standard/webhook_key_dev', $responseBody['token'], 'default', 0);
715
+ } else {
716
+ $model->saveConfig('payment/moip_transparente_standard/webhook_key_prod', $responseBody['token'], 'default', 0);
717
  }
718
+
719
+ if($responseBody['token']){
720
+ echo "WebHooks configurado com sucesso.";
721
  }
722
  }
723
+
724
+
725
+
726
  }
727
+
728
+ public function ClearMoipAction(){
729
+ $model = new Mage_Core_Model_Config();
730
+ $validacao = $this->getRequest()->getParams();
731
+ if($validacao['validacao']== Mage::getSingleton('transparente/standard')->getConfigData('validador_retorno')){
732
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
733
+ $model->deleteConfig('payment/moip_transparente_standard/webhook_key_dev');
734
+ $model->deleteConfig('payment/moip_transparente_standard/oauth_dev');
735
+
736
+ } else {
737
+ $model->deleteConfig('payment/moip_transparente_standard/webhook_key_prod');
738
+ $model->deleteConfig('payment/moip_transparente_standard/oauth_prod');
739
+
740
+ }
741
+ echo "Configurações atuais foram apagadas. Por favor, repita o processo de instalação.";
742
+ }
743
+ }
744
+ public function DebugKeyPublicAction() {
745
+
746
+ $data = $this->getRequest()->getParams();
747
+ if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
748
+
749
+
750
+ if($data['oauth']){
751
+ $oauth = $data['oauth'];
752
+ } else {
753
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_dev') ;
754
+ }
755
+ $url = "https://sandbox.moip.com.br/v2/keys/";
756
+ $header = "Authorization: OAuth " . $oauth;
757
+ echo "oauth ".$oauth;
758
+
759
+ } else {
760
+ echo "in produtçao: ";
761
+ $url = "https://api.moip.com.br/v2/keys/";
762
+ if($data['oauth']){
763
+ $oauth = $data['oauth'];
764
+ echo "oauth ".$oauth;
765
+ } else {
766
+ $oauth = Mage::getSingleton('transparente/standard')->getConfigData('oauth_prod') ;
767
+ }
768
+
769
+ $header = "Authorization: OAuth " . $oauth;
770
+ }
771
+
772
+ $result = array();
773
+ $ch = curl_init();
774
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
775
+ curl_setopt($ch, CURLOPT_URL, $url);
776
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
777
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
778
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
779
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
780
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
781
+ curl_setopt($ch,CURLOPT_USERAGENT,'MoipMagento/2.0.0');
782
+ $responseBody = curl_exec($ch);
783
+ curl_close($ch);
784
+ $responseBody = json_decode($responseBody, true);
785
+ $public_key = $responseBody['keys']['encryption'];
786
+
787
+ return $public_key;
788
+ }
789
+
790
  }
791
+
app/code/local/MOIP/Transparente/etc/config.xml CHANGED
@@ -1,24 +1,23 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <modules>
4
- <MOIP_Transparente>
5
- <version>0.2.1</version>
6
- </MOIP_Transparente>
7
- </modules>
8
- <global>
9
- <fieldsets>
10
- <sales_convert_quote_payment>
11
- <forma_pagamento>
12
- <to_order_payment>*</to_order_payment>
13
- </forma_pagamento>
14
- <credito_parcela>
15
- <to_order_payment>*</to_order_payment>
16
- </credito_parcela>
17
- </sales_convert_quote_payment>
18
- </fieldsets>
19
-
20
- <models>
21
- <transparente>
22
  <class>MOIP_Transparente_Model</class>
23
  <resourceModel>transparente_mysql4</resourceModel>
24
  </transparente>
@@ -26,187 +25,268 @@
26
  <class>MOIP_Transparente_Model_Mysql4</class>
27
  <entities>
28
  <write>
29
- <table>moip_transparente</table>
30
  </write>
31
  </entities>
32
  </transparente_mysql4>
33
- </models>
34
- <resources>
35
- <transparente_setup>
36
- <setup>
37
- <module>MOIP_Transparente</module>
38
- </setup>
39
- <connection>
40
- <use>core_setup</use>
41
- </connection>
42
- </transparente_setup>
43
- <transparente_write>
44
- <connection>
45
- <use>core_write</use>
46
- </connection>
47
- </transparente_write>
48
- <transparente_read>
49
- <connection>
50
-                     <use>core_read</use>
51
-                 </connection>
52
- </transparente_read>
53
- </resources>
54
- <blocks>
55
- <transparente>
56
- <class>MOIP_Transparente_Block</class>
57
- </transparente>
58
- </blocks>
59
- <helpers>
60
- <transparente>
61
- <class>MOIP_Transparente_Helper</class>
62
- </transparente>
63
- </helpers>
64
-
65
- <events>
66
- <transparente_sales_quote_assign_data_after>
67
- <observers>
68
- <get_transparente>
69
- <type>singleton</type>
70
- <class>transparente/observer</class>
71
- <method>getMethod</method>
72
- </get_transparente>
73
- </observers>
74
- </transparente_sales_quote_assign_data_after>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
- <!--sales_order_save_before>
77
- <observers>
78
- <get_token>
79
- <type>singleton</type>
80
- <class>transparente/observer</class>
81
- <method>getTokenCheckout</method>
82
- </get_token>
83
- </observers>
84
- </sales_order_save_before-->
85
- </events>
86
- <template>
87
- <email>
88
- <moip_envio translate="label">
89
- <label>Pedido Pago</label>
90
- <file>vendedor.html</file>
91
- <type>html</type>
92
- </moip_envio>
93
- </email>
94
- </template>
95
- </global>
96
- <frontend>
97
- <secure_url>
98
- <Transparente>/Transparente/</Transparente>
99
- </secure_url>
100
- <routers>
101
- <transparente>
102
- <use>standard</use>
103
- <args>
104
- <module>MOIP_Transparente</module>
105
- <frontName>Transparente</frontName>
106
- </args>
107
- </transparente>
108
- </routers>
109
- <translate>
110
- <modules>
111
- <transparente>
112
- <files>
113
- <default>transparente.csv</default>
114
- </files>
115
- </transparente>
116
- </modules>
117
- </translate>
118
- <layout>
119
- <updates>
120
- <transparente>
121
- <file>moip_transparente.xml</file>
122
- </transparente>
123
- </updates>
124
- </layout>
125
- </frontend>
126
- <admin>
127
- <routers>
128
- <MOIP_Transparente>
129
- <use>admin</use>
130
- <args>
131
- <module>MOIP_Transparente</module>
132
- <frontName>transparente</frontName>
133
- </args>
134
- </MOIP_Transparente>
135
- </routers>
136
- </admin>
137
- <adminhtml>
138
- <translate>
139
- <modules>
140
- <transparente>
141
- <files>
142
- <default>transparente.csv</default>
143
- </files>
144
- </transparente>
145
- </modules>
146
- </translate>
147
- <layout>
148
- <updates>
149
- <transparente>
150
- <file>transparente.xml</file>
151
- </transparente>
152
- </updates>
153
- </layout>
154
- </adminhtml>
155
- <crontab>
156
- <jobs>
157
- <transparente>
158
- <schedule><cron_expr>* * * * *</cron_expr></schedule>
159
- <run><model>transparente/observer::setStatus</model></run>
160
- </transparente>
161
- </jobs>
162
- </crontab>
163
- <default>
164
- <payment>
165
- <moip_transparente_standard>
166
- <active>1</active>
167
- <model>MOIP_Transparente_Model_Standard</model>
168
- <title><![CDATA[Transparente]]></title>
169
- <title>Pagamento 100% Seguro - Transparente | Grupo IG</title>
170
- <order_status>pending</order_status>
171
- <validador_retorno>dsakdsa123das</validador_retorno>
172
- <validopara_transparente>1</validopara_transparente>
173
- <conta_transparente>elisei</conta_transparente>
174
- <apelido>Instalação Padrão MOIP | ALTERE PARA O NOME DA SUA EMPRESA</apelido>
175
- <notificar_cliente>1</notificar_cliente>
176
- <tipoderecebimento>1</tipoderecebimento>
177
- <pagamento_direto>1</pagamento_direto>
178
- <parcelamento>1</parcelamento>
179
- <jurostipo>1</jurostipo>
180
- <estoqueboleto>-99</estoqueboleto>
181
- <parcelamento_c_de1>1</parcelamento_c_de1>
182
- <parcelamento_c_ate1>12</parcelamento_c_ate1>
183
- <parcelamento_c_juros1>2.99</parcelamento_c_juros1>
184
- <parcelamento_s_juros2>1.25</parcelamento_s_juros2>
185
- <parcelamento_s_juros3>2.49</parcelamento_s_juros3>
186
- <parcelamento_s_juros4>3.74</parcelamento_s_juros4>
187
- <parcelamento_s_juros5>4.98</parcelamento_s_juros5>
188
- <parcelamento_s_juros6>6.23</parcelamento_s_juros6>
189
- <parcelamento_s_juros7>7.47</parcelamento_s_juros7>
190
- <parcelamento_s_juros8>8.72</parcelamento_s_juros8>
191
- <parcelamento_s_juros9>9.96</parcelamento_s_juros9>
192
- <parcelamento_s_juros10>11.21</parcelamento_s_juros10>
193
- <parcelamento_s_juros11>12.45</parcelamento_s_juros11>
194
- <parcelamento_s_juros12>13.70</parcelamento_s_juros12>
195
- <formas_pagamento>BoletoBancario,DebitoBancario,CartaoCredito</formas_pagamento>
196
- <nummaxparcelamax>12</nummaxparcelamax>
197
- <valorminimoparcela>5</valorminimoparcela>
198
- <vcmentoboleto>3</vcmentoboleto>
199
- <ambiente>teste</ambiente>
200
- <allowspecific>0</allowspecific>
201
- </moip_transparente_standard>
202
- </payment>
203
- <moipall>
204
- <config>
205
- <enable_jquery>1</enable_jquery>
206
- <icones_na_entrega>1</icones_na_entrega>
207
- <enable_carrinho>1</enable_carrinho>
208
- <transparente_layout>Horizontal</transparente_layout>
209
- </config>
210
- </moipall>
211
- </default>
212
- </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <modules>
4
+ <MOIP_Transparente>
5
+ <version>0.2.3</version>
6
+ </MOIP_Transparente>
7
+ </modules>
8
+ <fieldsets>
9
+ <sales_convert_quote_address>
10
+ <fee_amount>
11
+ <to_order>*</to_order>
12
+ </fee_amount>
13
+ <base_fee_amount>
14
+ <to_order>*</to_order>
15
+ </base_fee_amount>
16
+ </sales_convert_quote_address>
17
+ </fieldsets>
18
+ <global>
19
+ <models>
20
+ <transparente>
 
21
  <class>MOIP_Transparente_Model</class>
22
  <resourceModel>transparente_mysql4</resourceModel>
23
  </transparente>
25
  <class>MOIP_Transparente_Model_Mysql4</class>
26
  <entities>
27
  <write>
28
+ <table>moip_transparentev2</table>
29
  </write>
30
  </entities>
31
  </transparente_mysql4>
32
+ </models>
33
+ <resources>
34
+ <transparente_setup>
35
+ <setup>
36
+ <module>MOIP_Transparente</module>
37
+ </setup>
38
+ <connection>
39
+ <use>core_setup</use>
40
+ </connection>
41
+ </transparente_setup>
42
+ <transparente_write>
43
+ <connection>
44
+ <use>core_write</use>
45
+ </connection>
46
+ </transparente_write>
47
+ <transparente_read>
48
+ <connection>
49
+ <use>core_read</use>
50
+ </connection>
51
+ </transparente_read>
52
+ </resources>
53
+ <blocks>
54
+ <transparente>
55
+ <class>MOIP_Transparente_Block</class>
56
+ </transparente>
57
+ <sales>
58
+ <rewrite>
59
+ <order_totals>MOIP_Transparente_Block_Sales_Order_Fee</order_totals>
60
+ </rewrite>
61
+ </sales>
62
+ </blocks>
63
+ <helpers>
64
+ <transparente>
65
+ <class>MOIP_Transparente_Helper</class>
66
+ </transparente>
67
+ </helpers>
68
+ <sales>
69
+ <quote>
70
+ <totals>
71
+ <fee>
72
+ <class>transparente/sales_quote_address_total_fee</class>
73
+ <after>subtotal</after>
74
+ </fee>
75
+ </totals>
76
+ </quote>
77
+ <order_invoice>
78
+ <totals>
79
+ <fee>
80
+ <class>transparente/sales_order_total_invoice_fee</class>
81
+ <after>subtotal</after>
82
+ </fee>
83
+ </totals>
84
+ </order_invoice>
85
+ <order_creditmemo>
86
+ <totals>
87
+ <fee>
88
+ <class>transparente/sales_order_total_creditmemo_fee</class>
89
+ <after>subtotal</after>
90
+ </fee>
91
+ </totals>
92
+ </order_creditmemo>
93
+ </sales>
94
+ <events>
95
+ <catalog_product_save_after>
96
+ <observers>
97
+ <transparente>
98
+ <type>singleton</type>
99
+ <class>transparente/observer</class>
100
+ <method>catalog_product_save_after_plans</method>
101
+ </transparente>
102
+ </observers>
103
+ </catalog_product_save_after>
104
+ <checkout_submit_all_after>
105
+ <observers>
106
+ <recorrente>
107
+ <type>singleton</type>
108
+ <class>transparente/observer</class>
109
+ <method>sales_order_place_before_success</method>
110
+ </recorrente>
111
+ </observers>
112
+ </checkout_submit_all_after>
113
+ </events>
114
+ </global>
115
+ <frontend>
116
+ <secure_url>
117
+ <Transparente>/Transparente/</Transparente>
118
+ </secure_url>
119
+ <routers>
120
+ <transparente>
121
+ <use>standard</use>
122
+ <args>
123
+ <module>MOIP_Transparente</module>
124
+ <frontName>Transparente</frontName>
125
+ </args>
126
+ </transparente>
127
+ </routers>
128
+ <translate>
129
+ <modules>
130
+ <transparente>
131
+ <files>
132
+ <default>transparente.csv</default>
133
+ </files>
134
+ </transparente>
135
+ </modules>
136
+ </translate>
137
+ <layout>
138
+ <updates>
139
+ <Transparente>
140
+ <file>moip_transparente.xml</file>
141
+ </Transparente>
142
+ </updates>
143
+ </layout>
144
+ </frontend>
145
+ <admin>
146
+ <routers>
147
+ <MOIP_Transparente>
148
+ <transparente after="Mage_Adminhtml">Transparente_Adminhtml</transparente>
149
+ <args>
150
+ <module>MOIP_Transparente</module>
151
+ <frontName>transparente</frontName>
152
+ </args>
153
+ </MOIP_Transparente>
154
+ </routers>
155
+ </admin>
156
+ <adminhtml>
157
+ <translate>
158
+ <modules>
159
+ <transparente>
160
+ <files>
161
+ <default>transparente.csv</default>
162
+ </files>
163
+ </transparente>
164
+ </modules>
165
+ </translate>
166
+ <layout>
167
+ <updates>
168
+ <transparente>
169
+ <file>moip_transparente.xml</file>
170
+ </transparente>
171
+ </updates>
172
+ </layout>
173
+ </adminhtml>
174
+ <crontab>
175
+ <jobs>
176
+ <transparente_set_state_cc>
177
+ <schedule>
178
+ <cron_expr>30 2 * * *</cron_expr>
179
+ </schedule>
180
+ <run>
181
+ <model>transparente/observer::setStatusCcAll</model>
182
+ </run>
183
+ </transparente_set_state_cc>
184
+ <transparente_set_state_boleto>
185
+ <schedule>
186
+ <cron_expr>30 2 * * *</cron_expr>
187
+ </schedule>
188
+ <run>
189
+ <model>transparente/observer::setStatusBoletoAll</model>
190
+ </run>
191
+ </transparente_set_state_boleto>
192
+ <transparente_set_state_tef>
193
+ <schedule>
194
+ <cron_expr>30 2 * * *</cron_expr>
195
+ </schedule>
196
+ <run>
197
+ <model>transparente/observer::setStatusTefAll</model>
198
+ </run>
199
+ </transparente_set_state_tef>
200
+ <transparente_send_onhold>
201
+ <schedule>
202
+ <cron_expr>30 2 * * *</cron_expr>
203
+ </schedule>
204
+ <run>
205
+ <model>transparente/observer::setHoldedNotification</model>
206
+ </run>
207
+ </transparente_send_onhold>
208
+ <transparente_set_state_all>
209
+ <schedule>
210
+ <cron_expr>30 2 * * *</cron_expr>
211
+ </schedule>
212
+ <run>
213
+ <model>transparente/observer::setStatusAll</model>
214
+ </run>
215
+ </transparente_set_state_all>
216
+
217
+ </jobs>
218
+ </crontab>
219
+ <default>
220
+ <payment>
221
+ <moip_transparente_standard>
222
+ <active>1</active>
223
+ <log>1</log>
224
+ <title>Pagamento via Admin - Moip</title>
225
+ <model>MOIP_Transparente_Model_Standard</model>
226
+ <order_status>pending</order_status>
227
+ <validopara_transparente>1</validopara_transparente>
228
+ <apelido>ALTERE PARA O NOME DA SUA EMPRESA</apelido>
229
+ <notificar_cliente>1</notificar_cliente>
230
+ <ambiente>teste</ambiente>
231
+ <allowspecific>0</allowspecific>
232
+ <min_order_total>5</min_order_total>
233
+ </moip_transparente_standard>
234
+ <moip_boleto>
235
+ <active>1</active>
236
+ <vcmentoboleto>3</vcmentoboleto>
237
+ <model>MOIP_Transparente_Model_Method_Boleto</model>
238
+ <title>Boleto Bancário</title>
239
+ <min_order_total>5</min_order_total>
240
+ </moip_boleto>
241
+ <moip_cc>
242
+ <active>1</active>
243
+ <model>MOIP_Transparente_Model_Method_Cc</model>
244
+ <title>Cartão de Crédito</title>
245
+ <parcelamento>1</parcelamento>
246
+ <valor_minimo>5</valor_minimo>
247
+ <parcela2>4.50</parcela2>
248
+ <parcela3>5.00</parcela3>
249
+ <parcela4>5.50</parcela4>
250
+ <parcela5>6.50</parcela5>
251
+ <parcela6>7.50</parcela6>
252
+ <parcela7>8.50</parcela7>
253
+ <parcela8>9.50</parcela8>
254
+ <parcela9>10.50</parcela9>
255
+ <parcela10>11.50</parcela10>
256
+ <parcela11>12.00</parcela11>
257
+ <parcela12>12.50</parcela12>
258
+ <parcelas_avancadas>0</parcelas_avancadas>
259
+ <nummaxparcelamax>12</nummaxparcelamax>
260
+ <valorminimoparcela>5</valorminimoparcela>
261
+ <min_order_total>5</min_order_total>
262
+ </moip_cc>
263
+ <moip_tef>
264
+ <active>0</active>
265
+ <vcmentotef>3</vcmentotef>
266
+ <model>MOIP_Transparente_Model_Method_Tef</model>
267
+ <title>Débito em Conta</title>
268
+ <vcmentoboleto>3</vcmentoboleto>
269
+ <min_order_total>5</min_order_total>
270
+ </moip_tef>
271
+
272
 
273
+ <moip_ccrecurring>
274
+ <model>MOIP_Transparente_Model_Method_CcRecurring</model>
275
+ <title>Cartão de Crédito Recorrente</title>
276
+ </moip_ccrecurring>
277
+ <moip_boletorecurring>
278
+ <model>MOIP_Transparente_Model_Method_BoletoRecurring</model>
279
+ <title>Boleto Bancário Recorrente</title>
280
+ </moip_boletorecurring>
281
+ </payment>
282
+ <moipall>
283
+ <config>
284
+ <enable_jquery>1</enable_jquery>
285
+ <enable_bootstrap>1</enable_bootstrap>
286
+ <icones_na_entrega>1</icones_na_entrega>
287
+ <enable_carrinho>1</enable_carrinho>
288
+ <transparente_layout>Horizontal</transparente_layout>
289
+ </config>
290
+ </moipall>
291
+ </default>
292
+ </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/MOIP/Transparente/etc/system.xml CHANGED
@@ -1,1142 +1,1253 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <sections>
4
- <payment translate="label" module="payment">
5
- <groups>
6
- <moip_transparente_standard translate="label">
7
- <label><![CDATA[Moip Transparente]]></label>
8
- <sort_order>420</sort_order>
9
- <show_in_default>1</show_in_default>
10
- <show_in_website>1</show_in_website>
11
- <show_in_store>1</show_in_store>
12
- <fields>
13
- <active translate="label">
14
- <label>Habilitar módulo</label>
15
- <frontend_type>select</frontend_type>
16
- <source_model>adminhtml/system_config_source_yesno</source_model>
17
- <sort_order>1</sort_order>
18
- <show_in_default>1</show_in_default>
19
- <show_in_website>1</show_in_website>
20
- <show_in_store>1</show_in_store>
21
- </active>
22
- <title translate="label">
23
- <label>Título</label>
24
- <frontend_type>text</frontend_type>
25
- <sort_order>2</sort_order>
26
- <show_in_default>1</show_in_default>
27
- <show_in_website>1</show_in_website>
28
- <show_in_store>1</show_in_store>
29
- </title>
30
-
31
- <order_status translate="label">
32
- <label>Status dos novos pedidos</label>
33
- <frontend_type>select</frontend_type>
34
- <source_model>adminhtml/system_config_source_order_status_new</source_model>
35
- <sort_order>3</sort_order>
36
- <show_in_default>1</show_in_default>
37
- <show_in_website>1</show_in_website>
38
- <show_in_store>1</show_in_store>
39
- </order_status>
40
-
41
- <ambiente translate="label">
42
- <label>Ambiente</label>
43
- <comment>
44
- <![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
45
- <p>Ambiente de teste só pode ser usado pela MOIP.</p>
46
- </div></div>]]>
47
- </comment>
48
- <frontend_type>select</frontend_type>
49
- <source_model>MOIP_Transparente_Model_Source_Ambiente</source_model>
50
- <sort_order>4</sort_order>
51
- <show_in_default>1</show_in_default>
52
- <show_in_website>1</show_in_website>
53
- <show_in_store>1</show_in_store>
54
- </ambiente>
55
- <conta_transparente translate="label">
56
- <label>Login Transparente</label>
57
- <depends>
58
- <ambiente>producao</ambiente>
59
- </depends>
60
- <comment>
61
- <![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
62
- <p>Não utilize o email e sim o login.</p>
63
- </div></div>]]>
64
- </comment>
65
- <frontend_type>text</frontend_type>
66
- <sort_order>5</sort_order>
67
- <show_in_default>1</show_in_default>
68
- <show_in_website>1</show_in_website>
69
- <show_in_store>1</show_in_store>
70
- </conta_transparente>
71
- <validador_retorno>
72
- <label>Chave de validação para o retorno do Status</label>
73
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
74
- <p>Coloque qualquer valor, desde que não contenha espaço ou caracter especial.</p>
75
- <p>Ex. válido: NomeDaSuaLoja1313.</p>
76
- <p>Ex. inválido: Nome Da Sua Loja 1313.</p>
77
- </div></div>]]>
78
- </comment>
79
- <frontend_type>text</frontend_type>
80
- <sort_order>6</sort_order>
81
- <show_in_default>1</show_in_default>
82
- <show_in_website>1</show_in_website>
83
- <show_in_store>1</show_in_store>
84
- </validador_retorno>
85
- <apelido translate="label">
86
- <label>Nome Fantasia da Loja</label>
87
- <frontend_type>text</frontend_type>
88
- <sort_order>7</sort_order>
89
- <show_in_default>1</show_in_default>
90
- <show_in_website>1</show_in_website>
91
- <show_in_store>1</show_in_store>
92
- </apelido>
93
- <tipoderecebimento translate="label">
94
- <label>Receber o valor do parcelamento à vista?</label>
95
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
96
- <p>Deixe marcado como sim para o recebimento convencional no transparente, não altere se não possuir autorização para recebimento parcelado.</p>
97
- </div></div>]]>
98
- </comment>
99
- <frontend_type>select</frontend_type>
100
- <source_model>adminhtml/system_config_source_yesno</source_model>
101
- <sort_order>8</sort_order>
102
- <show_in_default>1</show_in_default>
103
- <show_in_website>1</show_in_website>
104
- <show_in_store>1</show_in_store>
105
- </tipoderecebimento>
106
-
107
- <formas_pagamento translate="label">
108
- <label>Formas de Pagamento</label>
109
- <frontend_type>multiselect</frontend_type>
110
- <source_model>MOIP_Transparente_Model_Source_FormasPagamento</source_model>
111
- <sort_order>9</sort_order>
112
- <show_in_default>1</show_in_default>
113
- <show_in_website>1</show_in_website>
114
- <show_in_store>1</show_in_store>
115
- </formas_pagamento>
116
- <notificar_cliente>
117
- <label>Enviar email a cada alteração de status ao cliente</label>
118
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
119
- <p>Deixe marcado como sim para o acompanhar via email a alteração de status de seu pedido.</p>
120
- </div></div>]]>
121
- </comment>
122
- <frontend_type>select</frontend_type>
123
- <source_model>adminhtml/system_config_source_yesno</source_model>
124
- <sort_order>10</sort_order>
125
- <show_in_default>1</show_in_default>
126
- <show_in_website>1</show_in_website>
127
- <show_in_store>1</show_in_store>
128
- </notificar_cliente>
129
-
130
- <parcelamento_c_de1 translate="label">
131
- <label> - Parcelas de:</label>
132
- <depends>
133
- <jurostipo>1</jurostipo>
134
- </depends>
135
- <frontend_type>text</frontend_type>
136
- <sort_order>13</sort_order>
137
- <show_in_default>1</show_in_default>
138
- <show_in_website>1</show_in_website>
139
- <show_in_store>1</show_in_store>
140
- </parcelamento_c_de1>
141
-
142
- <parcelamento_c_ate1 translate="label">
143
- <label>1° - Parcelas até:</label>
144
- <depends>
145
- <jurostipo>1</jurostipo>
146
- </depends>
147
- <frontend_type>text</frontend_type>
148
- <sort_order>14</sort_order>
149
- <show_in_default>1</show_in_default>
150
- <show_in_website>1</show_in_website>
151
- <show_in_store>1</show_in_store>
152
- </parcelamento_c_ate1>
153
-
154
- <parcelamento_c_juros1 translate="label">
155
- <label>1° - Juros de (%):</label>
156
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
157
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
158
- </div></div>]]>
159
- </comment>
160
- <depends>
161
- <jurostipo>1</jurostipo>
162
- </depends>
163
- <frontend_type>text</frontend_type>
164
- <sort_order>15</sort_order>
165
- <show_in_default>1</show_in_default>
166
- <show_in_website>1</show_in_website>
167
- <show_in_store>1</show_in_store>
168
- </parcelamento_c_juros1>
169
-
170
-
171
- <parcelamento_s_juros1 translate="label">
172
- <label> - Juros de (%):</label>
173
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
174
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
175
- </div></div>]]>
176
- </comment>
177
- <depends>
178
- <jurostipo>0</jurostipo>
179
- </depends>
180
- <frontend_type>text</frontend_type>
181
- <sort_order>31</sort_order>
182
- <show_in_default>1</show_in_default>
183
- <show_in_website>1</show_in_website>
184
- <show_in_store>1</show_in_store>
185
- </parcelamento_s_juros1>
186
-
187
- <parcelamento_s_juros2 translate="label">
188
- <label>2° - Juros de (%):</label>
189
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
190
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
191
- </div></div>]]>
192
- </comment>
193
- <depends>
194
- <jurostipo>0</jurostipo>
195
- </depends>
196
- <frontend_type>text</frontend_type>
197
- <sort_order>31</sort_order>
198
- <show_in_default>1</show_in_default>
199
- <show_in_website>1</show_in_website>
200
- <show_in_store>1</show_in_store>
201
- </parcelamento_s_juros2>
202
-
203
-
204
- <parcelamento_s_juros3 translate="label">
205
- <label> - Juros de (%):</label>
206
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
207
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
208
- </div></div>]]>
209
- </comment>
210
- <depends>
211
- <jurostipo>0</jurostipo>
212
- </depends>
213
- <frontend_type>text</frontend_type>
214
- <sort_order>32</sort_order>
215
- <show_in_default>1</show_in_default>
216
- <show_in_website>1</show_in_website>
217
- <show_in_store>1</show_in_store>
218
- </parcelamento_s_juros3>
219
-
220
-
221
-
222
- <parcelamento_s_juros4 translate="label">
223
- <label> - Juros de (%):</label>
224
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
225
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
226
- </div></div>]]>
227
- </comment>
228
- <depends>
229
- <jurostipo>0</jurostipo>
230
- </depends>
231
- <frontend_type>text</frontend_type>
232
- <sort_order>35</sort_order>
233
- <show_in_default>1</show_in_default>
234
- <show_in_website>1</show_in_website>
235
- <show_in_store>1</show_in_store>
236
- </parcelamento_s_juros4>
237
-
238
-
239
-
240
-
241
- <parcelamento_s_juros5 translate="label">
242
- <label>5° - Juros de (%):</label>
243
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
244
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
245
- </div></div>]]>
246
- </comment>
247
- <depends>
248
- <jurostipo>0</jurostipo>
249
- </depends>
250
- <frontend_type>text</frontend_type>
251
- <sort_order>38</sort_order>
252
- <show_in_default>1</show_in_default>
253
- <show_in_website>1</show_in_website>
254
- <show_in_store>1</show_in_store>
255
- </parcelamento_s_juros5>
256
-
257
-
258
- <parcelamento_s_juros6 translate="label">
259
- <label>6° - Juros de (%):</label>
260
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
261
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
262
- </div></div>]]>
263
- </comment>
264
- <depends>
265
- <jurostipo>0</jurostipo>
266
- </depends>
267
- <frontend_type>text</frontend_type>
268
- <sort_order>41</sort_order>
269
- <show_in_default>1</show_in_default>
270
- <show_in_website>1</show_in_website>
271
- <show_in_store>1</show_in_store>
272
- </parcelamento_s_juros6>
273
-
274
-
275
-
276
- <parcelamento_s_juros7 translate="label">
277
- <label> - Juros de (%):</label>
278
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
279
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
280
- </div></div>]]>
281
- </comment>
282
- <depends>
283
- <jurostipo>0</jurostipo>
284
- </depends>
285
- <frontend_type>text</frontend_type>
286
- <sort_order>44</sort_order>
287
- <show_in_default>1</show_in_default>
288
- <show_in_website>1</show_in_website>
289
- <show_in_store>1</show_in_store>
290
- </parcelamento_s_juros7>
291
-
292
-
293
-
294
-
295
- <parcelamento_s_juros8 translate="label">
296
- <label>8° - Juros de (%):</label>
297
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
298
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
299
- </div></div>]]>
300
- </comment>
301
- <depends>
302
- <jurostipo>0</jurostipo>
303
- </depends>
304
- <frontend_type>text</frontend_type>
305
- <sort_order>47</sort_order>
306
- <show_in_default>1</show_in_default>
307
- <show_in_website>1</show_in_website>
308
- <show_in_store>1</show_in_store>
309
- </parcelamento_s_juros8>
310
-
311
-
312
-
313
-
314
- <parcelamento_s_juros9 translate="label">
315
- <label> - Juros de (%):</label>
316
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
317
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
318
- </div></div>]]>
319
- </comment>
320
- <depends>
321
- <jurostipo>0</jurostipo>
322
- </depends>
323
- <frontend_type>text</frontend_type>
324
- <sort_order>50</sort_order>
325
- <show_in_default>1</show_in_default>
326
- <show_in_website>1</show_in_website>
327
- <show_in_store>1</show_in_store>
328
- </parcelamento_s_juros9>
329
-
330
-
331
- <parcelamento_s_juros10 translate="label">
332
- <label>10° - Juros de (%):</label>
333
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
334
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
335
- </div></div>]]>
336
- </comment>
337
- <depends>
338
- <jurostipo>0</jurostipo>
339
- </depends>
340
- <frontend_type>text</frontend_type>
341
- <sort_order>53</sort_order>
342
- <show_in_default>1</show_in_default>
343
- <show_in_website>1</show_in_website>
344
- <show_in_store>1</show_in_store>
345
- </parcelamento_s_juros10>
346
-
347
-
348
-
349
-
350
- <parcelamento_s_juros11 translate="label">
351
- <label>11° - Juros de (%):</label>
352
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
353
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
354
- </div></div>]]>
355
- </comment>
356
- <depends>
357
- <jurostipo>0</jurostipo>
358
- </depends>
359
- <frontend_type>text</frontend_type>
360
- <sort_order>56</sort_order>
361
- <show_in_default>1</show_in_default>
362
- <show_in_website>1</show_in_website>
363
- <show_in_store>1</show_in_store>
364
- </parcelamento_s_juros11>
365
-
366
-
367
-
368
- <parcelamento_s_juros12 translate="label">
369
- <label>12° - Juros de (%):</label>
370
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
371
- <p>Faixas de parcelamento com cartão de crédito. (somente para Transparente)</p>
372
- </div></div>]]>
373
- </comment>
374
- <depends>
375
- <jurostipo>0</jurostipo>
376
- </depends>
377
- <frontend_type>text</frontend_type>
378
- <sort_order>59</sort_order>
379
- <show_in_default>1</show_in_default>
380
- <show_in_website>1</show_in_website>
381
- <show_in_store>1</show_in_store>
382
- </parcelamento_s_juros12>
383
-
384
-
385
- <nummaxparcelamax translate="label">
386
- <label>Número Máximo de Parcelas Permitido</label>
387
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
388
- <p>Por default são 12 parcelas.</p>
389
- </div></div>]]>
390
- </comment>
391
- <frontend_type>text</frontend_type>
392
- <sort_order>10</sort_order>
393
- <show_in_default>1</show_in_default>
394
- <show_in_website>1</show_in_website>
395
- <show_in_store>1</show_in_store>
396
- </nummaxparcelamax>
397
- <valorminimoparcela translate="label">
398
- <label>Valor Mínimo das Parcelas</label>
399
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
400
- <p>Não pode ser menor que 5 reais.</p>
401
- </div></div>]]>
402
- </comment>
403
- <frontend_type>text</frontend_type>
404
- <sort_order>11</sort_order>
405
- <show_in_default>1</show_in_default>
406
- <show_in_website>1</show_in_website>
407
- <show_in_store>1</show_in_store>
408
- </valorminimoparcela>
409
-
410
-
411
- <jurostipo translate="label">
412
- <label>Usar juros composto?</label>
413
- <comment><![CDATA[<div class="custom-options"><div class="box" style="width:243px;">
414
- <p>PARA CONFIGURAR PAGAMENTO PARCELAMENTO SEM JUROS VEJA O VIDEO: http://youtu.be/1ZnubvLmOTM</p>
415
- </div></div>]]>
416
- </comment>
417
- <frontend_type>select</frontend_type>
418
- <source_model>adminhtml/system_config_source_yesno</source_model>
419
- <sort_order>12</sort_order>
420
- <show_in_default>1</show_in_default>
421
- <show_in_website>1</show_in_website>
422
- <show_in_store>1</show_in_store>
423
- </jurostipo>
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
- <vcmentoboleto translate="label">
435
- <label>Dias de Vencimento para o Boleto:</label>
436
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
437
- <p>Aqui você informar os dias de vencimento do boleto.</p>
438
- </div></div>]]>
439
- </comment>
440
- <frontend_type>text</frontend_type>
441
- <sort_order>80</sort_order>
442
- <show_in_default>1</show_in_default>
443
- <show_in_website>1</show_in_website>
444
- <show_in_store>1</show_in_store>
445
- </vcmentoboleto>
446
- <estoqueboleto translate="label">
447
- <label>Permitir compra por boleto apenas e estoque for maior ou igual a:</label>
448
- <comment><![CDATA[<br /><div class="custom-options "><div class="box" style="width:243px;">
449
- <p>Informe a quantidade mínima em estoque que permite ao cliente pagar por boleto.</br>
450
- Para não limitar a geração do boleto informe um valor negativo ex: -99.</p>
451
- </div></div>]]>
452
- </comment>
453
- <frontend_type>text</frontend_type>
454
- <sort_order>81</sort_order>
455
- <show_in_default>1</show_in_default>
456
- <show_in_website>1</show_in_website>
457
- <show_in_store>1</show_in_store>
458
- </estoqueboleto>
459
-
460
- <allowspecific translate="label">
461
- <label>Pagamento a partir de países aplicáveis</label>
462
- <frontend_type>allowspecific</frontend_type>
463
- <sort_order>82</sort_order>
464
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
465
- <show_in_default>1</show_in_default>
466
- <show_in_website>1</show_in_website>
467
- <show_in_store>1</show_in_store>
468
- </allowspecific>
469
- <specificcountry translate="label">
470
- <label>Pagamento a partir de determinados países</label>
471
- <frontend_type>multiselect</frontend_type>
472
- <sort_order>83</sort_order>
473
- <source_model>adminhtml/system_config_source_country</source_model>
474
- <show_in_default>1</show_in_default>
475
- <show_in_website>1</show_in_website>
476
- <show_in_store>1</show_in_store>
477
- </specificcountry>
478
-
479
- </fields>
480
- </moip_transparente_standard>
481
- </groups>
482
- </payment>
483
- <moipall translate="label" module="moipall">
484
- <label><![CDATA[ <div style="height: 33px; "><img src="//imagem.O2TI.com/transparente_moip.png" style="float:left; "/><div style="padding-top:8px;color:#2f3850">Moip Avançado!<sup style="float: right;">v2.0.0</sup></div></div>]]></label>
485
- <tab>moip</tab>
486
- <frontend_type>text</frontend_type>
487
- <sort_order>200</sort_order>
488
- <show_in_default>1</show_in_default>
489
- <show_in_website>1</show_in_website>
490
- <show_in_store>1</show_in_store>
491
- <groups>
492
- <config translate="label">
493
- <label>Designer</label>
494
- <frontend_type>text</frontend_type>
495
- <sort_order>1</sort_order>
496
- <show_in_default>1</show_in_default>
497
- <show_in_website>1</show_in_website>
498
- <show_in_store>1</show_in_store>
499
- <fields>
500
- <enable_jquery>
501
- <label>Habilitar jquery dos módulos?</label>
502
- <frontend_type>select</frontend_type>
503
- <source_model>adminhtml/system_config_source_yesno</source_model>
504
- <comment>Se sua loja já possuí o jquery sendo chamado coloque desabilite a nova chamada.</comment>
505
- <sort_order>0</sort_order>
506
- <show_in_default>1</show_in_default>
507
- <show_in_website>1</show_in_website>
508
- <show_in_store>1</show_in_store>
509
- </enable_jquery>
510
- <enable_carrinho>
511
- <label>Vai usar o módulo Carrinho MoIP?</label>
512
- <frontend_type>select</frontend_type>
513
- <source_model>adminhtml/system_config_source_yesno</source_model>
514
- <comment>Se sua loja sua loja for usar outro checkout, marque como não?.</comment>
515
- <sort_order>1</sort_order>
516
- <show_in_default>1</show_in_default>
517
- <show_in_website>1</show_in_website>
518
- <show_in_store>1</show_in_store>
519
- </enable_carrinho>
520
- <transparente_layout translate="label">
521
- <label>Qual o Layout escolhido?</label>
522
- <frontend_type>select</frontend_type>
523
- <source_model>MOIP_Transparente_Model_Source_Layout</source_model>
524
- <sort_order>2</sort_order>
525
- <show_in_default>1</show_in_default>
526
- <show_in_website>1</show_in_website>
527
- <show_in_store>1</show_in_store>
528
- </transparente_layout>
529
- <trocar_icone translate="label">
530
- <label>Trocar Ícones Meios Aceitos</label>
531
- <frontend_type>select</frontend_type>
532
- <source_model>adminhtml/system_config_source_yesno</source_model>
533
- <sort_order>3</sort_order>
534
- <show_in_default>1</show_in_default>
535
- <show_in_website>1</show_in_website>
536
- <show_in_store>1</show_in_store>
537
- </trocar_icone>
538
- <icone_cartao translate="label comment">
539
- <depends>
540
- <trocar_icone>1</trocar_icone>
541
- </depends>
542
- <label>Icone Cartão: </label>
543
- <comment>Icone para a aba dos cartões</comment>
544
- <frontend_type>image</frontend_type>
545
- <backend_model>adminhtml/system_config_backend_image</backend_model>
546
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
547
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
548
- <sort_order>4</sort_order>
549
- <show_in_default>1</show_in_default>
550
- <show_in_website>1</show_in_website>
551
- <show_in_store>1</show_in_store>
552
- </icone_cartao>
553
- <icone_boleto translate="label comment">
554
- <depends>
555
- <trocar_icone>1</trocar_icone>
556
- </depends>
557
- <label>Icone Boleto: </label>
558
- <comment>Icone para a aba dos Boleto</comment>
559
- <frontend_type>image</frontend_type>
560
- <backend_model>adminhtml/system_config_backend_image</backend_model>
561
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
562
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
563
- <sort_order>5</sort_order>
564
- <show_in_default>1</show_in_default>
565
- <show_in_website>1</show_in_website>
566
- <show_in_store>1</show_in_store>
567
- </icone_boleto>
568
- <icone_transf translate="label comment">
569
- <depends>
570
- <trocar_icone>1</trocar_icone>
571
- </depends>
572
- <label>Icone Transferência: </label>
573
- <comment>Icone para a aba dos Transferência</comment>
574
- <frontend_type>image</frontend_type>
575
- <backend_model>adminhtml/system_config_backend_image</backend_model>
576
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
577
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
578
- <sort_order>6</sort_order>
579
- <show_in_default>1</show_in_default>
580
- <show_in_website>1</show_in_website>
581
- <show_in_store>1</show_in_store>
582
- </icone_transf>
583
- <trocar_bandeira_cartao translate="label">
584
- <label>Trocar Ícones das Bandeira dos Cartões</label>
585
- <frontend_type>select</frontend_type>
586
- <source_model>adminhtml/system_config_source_yesno</source_model>
587
- <sort_order>7</sort_order>
588
- <show_in_default>1</show_in_default>
589
- <show_in_website>1</show_in_website>
590
- <show_in_store>1</show_in_store>
591
- </trocar_bandeira_cartao>
592
- <cartao_visa translate="label">
593
- <depends>
594
- <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
595
- </depends>
596
- <label>Visa</label>
597
- <frontend_type>image</frontend_type>
598
- <backend_model>adminhtml/system_config_backend_image</backend_model>
599
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
600
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
601
- <sort_order>8</sort_order>
602
- <show_in_default>1</show_in_default>
603
- <show_in_website>1</show_in_website>
604
- <show_in_store>1</show_in_store>
605
- </cartao_visa>
606
- <cartao_master translate="label">
607
- <depends>
608
- <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
609
- </depends>
610
- <label>MasterCard</label>
611
- <frontend_type>image</frontend_type>
612
- <backend_model>adminhtml/system_config_backend_image</backend_model>
613
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
614
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
615
- <sort_order>9</sort_order>
616
- <show_in_default>1</show_in_default>
617
- <show_in_website>1</show_in_website>
618
- <show_in_store>1</show_in_store>
619
- </cartao_master>
620
- <cartao_diners translate="label">
621
- <depends>
622
- <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
623
- </depends>
624
- <label>Diners</label>
625
- <frontend_type>image</frontend_type>
626
- <backend_model>adminhtml/system_config_backend_image</backend_model>
627
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
628
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
629
- <sort_order>10</sort_order>
630
- <show_in_default>1</show_in_default>
631
- <show_in_website>1</show_in_website>
632
- <show_in_store>1</show_in_store>
633
- </cartao_diners>
634
- <cartao_american translate="label">
635
- <depends>
636
- <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
637
- </depends>
638
- <label>American Express</label>
639
- <frontend_type>image</frontend_type>
640
- <backend_model>adminhtml/system_config_backend_image</backend_model>
641
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
642
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
643
- <sort_order>11</sort_order>
644
- <show_in_default>1</show_in_default>
645
- <show_in_website>1</show_in_website>
646
- <show_in_store>1</show_in_store>
647
- </cartao_american>
648
- <cartao_hipercard translate="label">
649
- <depends>
650
- <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
651
- </depends>
652
- <label>Hipercard</label>
653
- <frontend_type>image</frontend_type>
654
- <backend_model>adminhtml/system_config_backend_image</backend_model>
655
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
656
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
657
- <sort_order>12</sort_order>
658
- <show_in_default>1</show_in_default>
659
- <show_in_website>1</show_in_website>
660
- <show_in_store>1</show_in_store>
661
- </cartao_hipercard>
662
- <trocar_bandeira_banco translate="label">
663
- <label>Trocar Ícones das Bandeira dos Bancos</label>
664
- <frontend_type>select</frontend_type>
665
- <source_model>adminhtml/system_config_source_yesno</source_model>
666
- <sort_order>13</sort_order>
667
- <show_in_default>1</show_in_default>
668
- <show_in_website>1</show_in_website>
669
- <show_in_store>1</show_in_store>
670
- </trocar_bandeira_banco>
671
- <cartao_bb translate="label">
672
- <depends>
673
- <trocar_bandeira_banco>1</trocar_bandeira_banco>
674
- </depends>
675
- <label>Banco do Brasil</label>
676
- <frontend_type>image</frontend_type>
677
- <backend_model>adminhtml/system_config_backend_image</backend_model>
678
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
679
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
680
- <sort_order>14</sort_order>
681
- <show_in_default>1</show_in_default>
682
- <show_in_website>1</show_in_website>
683
- <show_in_store>1</show_in_store>
684
- </cartao_bb>
685
- <cartao_bradesco translate="label">
686
- <depends>
687
- <trocar_bandeira_banco>1</trocar_bandeira_banco>
688
- </depends>
689
- <label>Bradesco</label>
690
- <frontend_type>image</frontend_type>
691
- <backend_model>adminhtml/system_config_backend_image</backend_model>
692
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
693
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
694
- <sort_order>15</sort_order>
695
- <show_in_default>1</show_in_default>
696
- <show_in_website>1</show_in_website>
697
- <show_in_store>1</show_in_store>
698
- </cartao_bradesco>
699
- <cartao_itau translate="label">
700
- <depends>
701
- <trocar_bandeira_banco>1</trocar_bandeira_banco>
702
- </depends>
703
- <label>Itaú</label>
704
- <frontend_type>image</frontend_type>
705
- <backend_model>adminhtml/system_config_backend_image</backend_model>
706
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
707
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
708
- <sort_order>16</sort_order>
709
- <show_in_default>1</show_in_default>
710
- <show_in_website>1</show_in_website>
711
- <show_in_store>1</show_in_store>
712
- </cartao_itau>
713
- <cartao_banrisul translate="label">
714
- <depends>
715
- <trocar_bandeira_banco>1</trocar_bandeira_banco>
716
- </depends>
717
- <label>Banrisul</label>
718
- <frontend_type>image</frontend_type>
719
- <backend_model>adminhtml/system_config_backend_image</backend_model>
720
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
721
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
722
- <sort_order>17</sort_order>
723
- <show_in_default>1</show_in_default>
724
- <show_in_website>1</show_in_website>
725
- <show_in_store>1</show_in_store>
726
- </cartao_banrisul>
727
- <trocar_bandeira_boleto translate="label">
728
- <label>Trocar Ícones do boleto</label>
729
- <frontend_type>select</frontend_type>
730
- <source_model>adminhtml/system_config_source_yesno</source_model>
731
- <sort_order>18</sort_order>
732
- <show_in_default>1</show_in_default>
733
- <show_in_website>1</show_in_website>
734
- <show_in_store>1</show_in_store>
735
- </trocar_bandeira_boleto>
736
- <boleto translate="label">
737
- <depends>
738
- <trocar_bandeira_boleto>1</trocar_bandeira_boleto>
739
- </depends>
740
- <label>Icone Interno do Boleto</label>
741
- <comment>Icone de dentro da aba do boleto. Lembre-se o banco emissor é o Bradesco</comment>
742
- <frontend_type>image</frontend_type>
743
- <backend_model>adminhtml/system_config_backend_image</backend_model>
744
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
745
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
746
- <sort_order>19</sort_order>
747
- <show_in_default>1</show_in_default>
748
- <show_in_website>1</show_in_website>
749
- <show_in_store>1</show_in_store>
750
- </boleto>
751
- <icones_na_entrega translate="label">
752
- <label>Mostrar icones da entrega?</label>
753
- <frontend_type>select</frontend_type>
754
- <source_model>adminhtml/system_config_source_yesno</source_model>
755
- <sort_order>20</sort_order>
756
- <show_in_default>1</show_in_default>
757
- <show_in_website>1</show_in_website>
758
- <show_in_store>1</show_in_store>
759
- </icones_na_entrega>
760
- <trocar_icones_na_entrega translate="label">
761
- <label>Trocar icones da entrega?</label>
762
- <depends>
763
- <icones_na_entrega>1</icones_na_entrega>
764
- </depends>
765
- <frontend_type>select</frontend_type>
766
- <source_model>adminhtml/system_config_source_yesno</source_model>
767
- <sort_order>21</sort_order>
768
- <show_in_default>1</show_in_default>
769
- <show_in_website>1</show_in_website>
770
- <show_in_store>1</show_in_store>
771
- </trocar_icones_na_entrega>
772
- <icone_sedex translate="label comment">
773
- <depends>
774
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
775
- </depends>
776
- <label>Icone Sedex: </label>
777
- <frontend_type>image</frontend_type>
778
- <backend_model>adminhtml/system_config_backend_image</backend_model>
779
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
780
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
781
- <sort_order>22</sort_order>
782
- <show_in_default>1</show_in_default>
783
- <show_in_website>1</show_in_website>
784
- <show_in_store>1</show_in_store>
785
- </icone_sedex>
786
- <icone_pac translate="label comment">
787
- <depends>
788
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
789
- </depends>
790
- <label>Icone Pac: </label>
791
- <frontend_type>image</frontend_type>
792
- <backend_model>adminhtml/system_config_backend_image</backend_model>
793
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
794
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
795
- <sort_order>23</sort_order>
796
- <show_in_default>1</show_in_default>
797
- <show_in_website>1</show_in_website>
798
- <show_in_store>1</show_in_store>
799
- </icone_pac>
800
- <icone_sedex_a translate="label comment">
801
- <depends>
802
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
803
- </depends>
804
- <label>Sedex a Cobrar: </label>
805
-
806
- <frontend_type>image</frontend_type>
807
- <backend_model>adminhtml/system_config_backend_image</backend_model>
808
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
809
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
810
- <sort_order>24</sort_order>
811
- <show_in_default>1</show_in_default>
812
- <show_in_website>1</show_in_website>
813
- <show_in_store>1</show_in_store>
814
- </icone_sedex_a>
815
- <icone_sedex_hoje translate="label comment">
816
- <depends>
817
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
818
- </depends>
819
- <label>Sedex Hoje: </label>
820
- <frontend_type>image</frontend_type>
821
- <backend_model>adminhtml/system_config_backend_image</backend_model>
822
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
823
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
824
- <sort_order>25</sort_order>
825
- <show_in_default>1</show_in_default>
826
- <show_in_website>1</show_in_website>
827
- <show_in_store>1</show_in_store>
828
- </icone_sedex_hoje>
829
- <icone_sedex_10 translate="label comment">
830
- <depends>
831
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
832
- </depends>
833
- <label>Sedex 10: </label>
834
- <frontend_type>image</frontend_type>
835
- <backend_model>adminhtml/system_config_backend_image</backend_model>
836
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
837
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
838
- <sort_order>26</sort_order>
839
- <show_in_default>1</show_in_default>
840
- <show_in_website>1</show_in_website>
841
- <show_in_store>1</show_in_store>
842
- </icone_sedex_10>
843
- <icone_sedex_c translate="label comment">
844
- <depends>
845
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
846
- </depends>
847
- <label>Sedex Com Contrato:</label>
848
- <frontend_type>image</frontend_type>
849
- <backend_model>adminhtml/system_config_backend_image</backend_model>
850
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
851
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
852
- <sort_order>27</sort_order>
853
- <show_in_default>1</show_in_default>
854
- <show_in_website>1</show_in_website>
855
- <show_in_store>1</show_in_store>
856
- </icone_sedex_c>
857
- <icone_sedex_e translate="label comment">
858
- <depends>
859
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
860
- </depends>
861
- <label>E-Sedex Com Contrato:</label>
862
- <frontend_type>image</frontend_type>
863
- <backend_model>adminhtml/system_config_backend_image</backend_model>
864
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
865
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
866
- <sort_order>28</sort_order>
867
- <show_in_default>1</show_in_default>
868
- <show_in_website>1</show_in_website>
869
- <show_in_store>1</show_in_store>
870
- </icone_sedex_e>
871
- <icone_pac_c translate="label comment">
872
- <depends>
873
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
874
- </depends>
875
- <label>PAC Com Contrato:</label>
876
- <frontend_type>image</frontend_type>
877
- <backend_model>adminhtml/system_config_backend_image</backend_model>
878
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
879
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
880
- <sort_order>29</sort_order>
881
- <show_in_default>1</show_in_default>
882
- <show_in_website>1</show_in_website>
883
- <show_in_store>1</show_in_store>
884
- </icone_pac_c>
885
- <icone_gratis translate="label comment">
886
- <depends>
887
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
888
- </depends>
889
- <label>Frete Grátis: </label>
890
- <frontend_type>image</frontend_type>
891
- <backend_model>adminhtml/system_config_backend_image</backend_model>
892
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
893
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
894
- <sort_order>30</sort_order>
895
- <show_in_default>1</show_in_default>
896
- <show_in_website>1</show_in_website>
897
- <show_in_store>1</show_in_store>
898
- </icone_gratis>
899
- <icone_fixo translate="label comment">
900
- <depends>
901
- <trocar_icones_na_entrega>1</trocar_icones_na_entrega>
902
- </depends>
903
- <label>Frete Fixo: </label>
904
- <frontend_type>image</frontend_type>
905
- <backend_model>adminhtml/system_config_backend_image</backend_model>
906
- <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
907
- <base_url type="media" scope_info="1">moip/alltransparente</base_url>
908
- <sort_order>31</sort_order>
909
- <show_in_default>1</show_in_default>
910
- <show_in_website>1</show_in_website>
911
- <show_in_store>1</show_in_store>
912
- </icone_fixo>
913
- </fields>
914
- </config>
915
-
916
- <pagamento_avancado translate="label">
917
- <label>Configurações de Pagamento Avançadas</label>
918
- <frontend_type>text</frontend_type>
919
- <sort_order>2</sort_order>
920
- <show_in_default>1</show_in_default>
921
- <show_in_website>1</show_in_website>
922
- <show_in_store>1</show_in_store>
923
- <fields>
924
- <pagamento_boleto translate="label">
925
- <label>Desconto Para Boleto</label>
926
- <frontend_type>select</frontend_type>
927
- <source_model>adminhtml/system_config_source_yesno</source_model>
928
- <sort_order>1</sort_order>
929
- <show_in_default>1</show_in_default>
930
- <show_in_website>1</show_in_website>
931
- <show_in_store>1</show_in_store>
932
- </pagamento_boleto>
933
- <boleto_desc translate="label comment">
934
- <depends>
935
- <pagamento_boleto>1</pagamento_boleto>
936
- </depends>
937
- <label>1º Valor de desconto: </label>
938
- <frontend_type>text</frontend_type>
939
- <comment>Em Percentual use somente o número sem o "%"</comment>
940
- <frontend_type>text</frontend_type>
941
- <sort_order>3</sort_order>
942
- <show_in_default>1</show_in_default>
943
- <show_in_website>1</show_in_website>
944
- <show_in_store>1</show_in_store>
945
- </boleto_desc>
946
- <boleto_valor translate="label comment">
947
- <depends>
948
- <pagamento_boleto>1</pagamento_boleto>
949
- </depends>
950
- <label>Para nos pedidos acima de: </label>
951
- <frontend_type>text</frontend_type>
952
- <comment>A primeira faixa de desconto será válida para pagamentos acima de qual valor? Você pode usar valor 0 para aplicar a qualquer pedido</comment>
953
- <frontend_type>text</frontend_type>
954
- <sort_order>4</sort_order>
955
- <show_in_default>1</show_in_default>
956
- <show_in_website>1</show_in_website>
957
- <show_in_store>1</show_in_store>
958
- </boleto_valor>
959
- <boleto_desc2 translate="label comment">
960
- <depends>
961
- <pagamento_boleto>1</pagamento_boleto>
962
- </depends>
963
- <label>2º Valor de desconto: </label>
964
- <frontend_type>text</frontend_type>
965
- <comment>Em Percentual use somente o número sem o "%"</comment>
966
- <frontend_type>text</frontend_type>
967
- <sort_order>5</sort_order>
968
- <show_in_default>1</show_in_default>
969
- <show_in_website>1</show_in_website>
970
- <show_in_store>1</show_in_store>
971
- </boleto_desc2>
972
- <boleto_valor2 translate="label comment">
973
- <depends>
974
- <pagamento_boleto>1</pagamento_boleto>
975
- </depends>
976
- <label>Para nos pedidos acima de: </label>
977
- <frontend_type>text</frontend_type>
978
- <comment>A Segunda faixa de desconto será válida para pagamentos acima de qual valor? Obrigatoriamente deverá ser maior que a primeira.</comment>
979
- <frontend_type>text</frontend_type>
980
- <sort_order>6</sort_order>
981
- <show_in_default>1</show_in_default>
982
- <show_in_website>1</show_in_website>
983
- <show_in_store>1</show_in_store>
984
- </boleto_valor2>
985
-
986
- <transf_desc translate="label comment">
987
- <depends>
988
- <pagamento_boleto>1</pagamento_boleto>
989
- </depends>
990
- <label>Aplicar mesmas regras ao pagamento por transferência?</label>
991
- <frontend_type>select</frontend_type>
992
- <source_model>adminhtml/system_config_source_yesno</source_model>
993
- <comment>Caso marque sim o pagamento por transferência estará sujeito as mesmas regras do boleto</comment>
994
- <sort_order>9</sort_order>
995
- <show_in_default>1</show_in_default>
996
- <show_in_website>1</show_in_website>
997
- <show_in_store>1</show_in_store>
998
- </transf_desc>
999
-
1000
-
1001
- </fields>
1002
- </pagamento_avancado>
1003
- <mktplace translate="label">
1004
- <label>MarketPlace - A melhor maneira de comissionar suas multilojas</label>
1005
- <frontend_type>text</frontend_type>
1006
- <sort_order>2</sort_order>
1007
- <show_in_default>1</show_in_default>
1008
- <show_in_website>1</show_in_website>
1009
- <show_in_store>1</show_in_store>
1010
- <fields>
1011
-
1012
- <comissionamento translate="label">
1013
- <label>Ativar Comissionamento para MktPlace?</label>
1014
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
1015
- <p>Esta opção deverá ser utilizada por quem realiza pagamento de comissões a outros logins Transparente.</p>
1016
- </div></div>]]>
1017
- </comment>
1018
- <frontend_type>select</frontend_type>
1019
- <source_model>adminhtml/system_config_source_yesno</source_model>
1020
- <sort_order>22</sort_order>
1021
- <show_in_default>1</show_in_default>
1022
- <show_in_website>1</show_in_website>
1023
- <show_in_store>1</show_in_store>
1024
- </comissionamento>
1025
- <logincomissionamento translate="label">
1026
- <label>Login de Comissionamento</label>
1027
- <depends>
1028
- <comissionamento>1</comissionamento>
1029
- </depends>
1030
- <frontend_type>text</frontend_type>
1031
- <sort_order>23</sort_order>
1032
- <show_in_default>1</show_in_default>
1033
- <show_in_website>1</show_in_website>
1034
- <show_in_store>1</show_in_store>
1035
- </logincomissionamento>
1036
- <pagadordataxa translate="label">
1037
- <label>É o comissionado deverá pagar a taxa Transparente</label>
1038
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
1039
- <p>Marque sim para a taxa Transparente da transação ser descontada do valor pago ao comissionado.</p>
1040
- </div></div>]]>
1041
- </comment>
1042
- <depends>
1043
- <comissionamento>1</comissionamento>
1044
- </depends>
1045
- <frontend_type>select</frontend_type>
1046
- <source_model>adminhtml/system_config_source_yesno</source_model>
1047
- <sort_order>25</sort_order>
1048
- <show_in_default>1</show_in_default>
1049
- <show_in_website>1</show_in_website>
1050
- <show_in_store>1</show_in_store>
1051
- </pagadordataxa>
1052
- <porc_comissionamento translate="label">
1053
- <label>Porcentagem de Comissionamento</label>
1054
- <depends>
1055
- <comissionamento>1</comissionamento>
1056
- <pagadordataxa>0</pagadordataxa>
1057
- </depends>
1058
- <frontend_type>text</frontend_type>
1059
- <sort_order>26</sort_order>
1060
- <show_in_default>1</show_in_default>
1061
- <show_in_website>1</show_in_website>
1062
- <show_in_store>1</show_in_store>
1063
- </porc_comissionamento>
1064
- <porc_comissionamento_cartao translate="label">
1065
- <label>Porcentagem para Cartão</label>
1066
- <depends>
1067
- <comissionamento>1</comissionamento>
1068
- <pagadordataxa>1</pagadordataxa>
1069
- </depends>
1070
- <frontend_type>text</frontend_type>
1071
- <sort_order>27</sort_order>
1072
- <show_in_default>1</show_in_default>
1073
- <show_in_website>1</show_in_website>
1074
- <show_in_store>1</show_in_store>
1075
- </porc_comissionamento_cartao>
1076
- <porc_comissionamento_boleto translate="label">
1077
- <label>Porcentagem para Boleto</label>
1078
- <depends>
1079
- <comissionamento>1</comissionamento>
1080
- <pagadordataxa>1</pagadordataxa>
1081
- </depends>
1082
- <frontend_type>text</frontend_type>
1083
- <sort_order>28</sort_order>
1084
- <show_in_default>1</show_in_default>
1085
- <show_in_website>1</show_in_website>
1086
- <show_in_store>1</show_in_store>
1087
- </porc_comissionamento_boleto>
1088
- <porc_comissionamento_transf translate="label">
1089
- <label>Porcentagem para Transferência</label>
1090
- <depends>
1091
- <comissionamento>1</comissionamento>
1092
- <pagadordataxa>1</pagadordataxa>
1093
- </depends>
1094
- <frontend_type>text</frontend_type>
1095
- <sort_order>29</sort_order>
1096
- <show_in_default>1</show_in_default>
1097
- <show_in_website>1</show_in_website>
1098
- <show_in_store>1</show_in_store>
1099
- </porc_comissionamento_transf>
1100
- </fields>
1101
- </mktplace>
1102
- <google translate="label">
1103
- <label>Google e outras analises - Análise de funil e tag de conversão</label>
1104
- <frontend_type>text</frontend_type>
1105
- <sort_order>4</sort_order>
1106
- <show_in_default>1</show_in_default>
1107
- <show_in_website>1</show_in_website>
1108
- <show_in_store>1</show_in_store>
1109
- <fields>
1110
-
1111
- <idgoogle translate="label">
1112
- <label>ID da conta Google</label>
1113
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
1114
- <p>Insira o seu código como por exemplo </br> UA-33860171-1.</p>
1115
- </div></div>]]>
1116
- </comment>
1117
- <frontend_type>text</frontend_type>
1118
- <sort_order>1</sort_order>
1119
- <show_in_default>1</show_in_default>
1120
- <show_in_website>1</show_in_website>
1121
- <show_in_store>1</show_in_store>
1122
- </idgoogle>
1123
- <outros_funil translate="label">
1124
- <label>Outras tags de conversão</label>
1125
- <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
1126
- <p>Você pode colar outros scripts de acompanhamento por aqui.</p>
1127
- </div></div>]]>
1128
- </comment>
1129
- <frontend_type>textarea</frontend_type>
1130
- <sort_order>2</sort_order>
1131
- <show_in_default>1</show_in_default>
1132
- <show_in_website>1</show_in_website>
1133
- <show_in_store>1</show_in_store>
1134
- </outros_funil>
1135
-
1136
-
1137
- </fields>
1138
- </google>
1139
- </groups>
1140
- </moipall>
1141
- </sections>
1142
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?xml version="1.0"?>
2
  <config>
3
+ <sections>
4
+ <payment translate="label" module="payment">
5
+ <groups>
6
+ <moip_transparente_standard translate="label">
7
+ <label><![CDATA[Moip Transparente - Configuração Inicial]]></label>
8
+ <frontend_type>text</frontend_type>
9
+ <frontend_model>MOIP_Transparente_Block_Adminhtml_System_Config_Form_Fieldset_Modules_Oauth</frontend_model>
10
+ <sort_order>10000</sort_order>
11
+ <show_in_default>1</show_in_default>
12
+ <show_in_website>1</show_in_website>
13
+ <show_in_store>1</show_in_store>
14
+ <fields>
15
+ <title_comunicacao translate="label">
16
+ <label>Identificação e Ambiente</label>
17
+
18
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
19
+ <sort_order>0</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>1</show_in_store>
23
+ </title_comunicacao>
24
+
25
+
26
+ <validador_retorno>
27
+ <label>Validação de comunicação</label>
28
+ <comment><![CDATA[
29
+ <p>Coloque qualquer valor, desde que não contenha espaço ou caracter especial.</p>
30
+ <p>Ex. válido: NomeDaSuaLoja1313.</p>
31
+ <p>Ex. inválido: Nome Da Sua Loja 1313.</p>
32
+ ]]>
33
+ </comment>
34
+ <validate>validate-alphanum</validate>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>1</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </validador_retorno>
41
+
42
+ <ambiente translate="label">
43
+ <label>Ambiente</label>
44
+ <comment><![CDATA[Ambiente de teste pode ser usado pela MOIP.]]>
45
+ </comment>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>MOIP_Transparente_Model_Source_Ambiente</source_model>
48
+ <sort_order>2</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </ambiente>
53
+
54
+ <apelido translate="label">
55
+ <label>Nome Fantasia da Loja</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>3</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </apelido>
62
+
63
+
64
+ <title_status translate="label">
65
+ <label>Defina os status de pedidos para o nosso módulo de pagamento</label>
66
+ <comment><![CDATA[
67
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.</p>
68
+ ]]>
69
+ </comment>
70
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
71
+ <sort_order>10</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </title_status>
76
+ <order_status translate="label">
77
+ <label>Status dos Pedidos Iniciados</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
80
+ <comment><![CDATA[
81
+ <p>É o primeiro status de todo o pedido, ele signfica que foi recebida a ordem de compra.</p>
82
+ <p>No entanto o pagamento ainda não foi processado ou válidado.</p>
83
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.]]>
84
+ </comment>
85
+ <sort_order>11</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </order_status>
90
+ <order_status_processing translate="label">
91
+ <label>Status Aprovados</label>
92
+ <frontend_type>select</frontend_type>
93
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
94
+ <comment><![CDATA[
95
+ <p>É o primeiro status de pedido pago.</p>
96
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.</p>
97
+ ]]>
98
+ </comment>
99
+ <sort_order>12</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </order_status_processing>
104
+ <order_status_holded translate="label">
105
+ <label>Status em Análise</label>
106
+ <frontend_type>select</frontend_type>
107
+ <source_model>MOIP_Transparente_Model_Source_Holded</source_model>
108
+ <comment><![CDATA[
109
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.</p>
110
+ ]]>
111
+ </comment>
112
+ <sort_order>13</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </order_status_holded>
117
+ <order_status_holded_boleto translate="label">
118
+ <label>Status para Boleto em Aberto</label>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>MOIP_Transparente_Model_Source_Holded</source_model>
121
+ <comment><![CDATA[
122
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.</p>
123
+ ]]>
124
+ </comment>
125
+ <sort_order>14</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </order_status_holded_boleto>
130
+ <order_status_holded_tef translate="label">
131
+ <label>Status para Transferência em Aberto</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>MOIP_Transparente_Model_Source_Holded</source_model>
134
+ <comment><![CDATA[
135
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.</p>
136
+ ]]>
137
+ </comment>
138
+ <sort_order>15</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </order_status_holded_tef>
143
+
144
+ <title_config_mage translate="label">
145
+ <label>Demais configurações</label>
146
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
147
+ <sort_order>20</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </title_config_mage>
152
+ <allowspecific translate="label">
153
+ <label>Pagamento a partir de países aplicáveis</label>
154
+ <frontend_type>allowspecific</frontend_type>
155
+ <sort_order>21</sort_order>
156
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ </allowspecific>
161
+ <specificcountry translate="label">
162
+ <label>Pagamento a partir de determinados países</label>
163
+ <frontend_type>multiselect</frontend_type>
164
+ <sort_order>22</sort_order>
165
+ <source_model>adminhtml/system_config_source_country</source_model>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </specificcountry>
170
+ <active translate="label">
171
+ <label>Habilitar venda via admin</label>
172
+ <comment>Em beta. Ainda não há retorno do status dessa transação</comment>
173
+ <frontend_type>select</frontend_type>
174
+ <source_model>adminhtml/system_config_source_yesno</source_model>
175
+ <sort_order>23</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ </active>
180
+
181
+ <log>
182
+ <label>Habilitar Log</label>
183
+ <comment>Durante o primeiro mês é recomendável manter habilitado</comment>
184
+ <frontend_type>select</frontend_type>
185
+ <source_model>adminhtml/system_config_source_yesno</source_model>
186
+ <sort_order>24</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </log>
191
+
192
+ </fields>
193
+ </moip_transparente_standard>
194
+ <moip_cc>
195
+ <label><![CDATA[Moip Transparente - Cartão de Crédito]]></label>
196
+ <frontend_type>text</frontend_type>
197
+
198
+ <sort_order>20000</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>1</show_in_store>
202
+ <fields>
203
+
204
+ <title_moip_cc translate="label">
205
+ <label>Defina as configuações do recebimento por cartão de crédito</label>
206
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
207
+ <comment><![CDATA[Se tiver dúvidas, escreva para gente: magento@moip.com.br ]]></comment>
208
+ <sort_order>0</sort_order>
209
+ <show_in_default>1</show_in_default>
210
+ <show_in_website>1</show_in_website>
211
+ <show_in_store>1</show_in_store>
212
+ </title_moip_cc>
213
+ <active translate="label">
214
+ <label>Habilitar módulo</label>
215
+ <frontend_type>select</frontend_type>
216
+ <source_model>adminhtml/system_config_source_yesno</source_model>
217
+ <sort_order>1</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>1</show_in_website>
220
+ <show_in_store>1</show_in_store>
221
+ </active>
222
+ <title translate="label">
223
+ <label>Título exibido no checkout</label>
224
+ <frontend_type>text</frontend_type>
225
+ <sort_order>2</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
+ </title>
230
+
231
+ <valor_minimo>
232
+ <label>Valor Mínimo da Parcela:</label>
233
+
234
+ <comment>Não pode ser menor que 5 reais. Use ponto não vírgula.</comment>
235
+ <frontend_type>text</frontend_type>
236
+ <validate>required-entry</validate>
237
+ <sort_order>5</sort_order>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>1</show_in_store>
241
+ </valor_minimo>
242
+ <nummaxparcelamax translate="label">
243
+ <label>Número Máximo de Parcelas Permitido</label>
244
+
245
+ <comment><![CDATA[O Máximo permitido são 12 parcelas.]]>
246
+ </comment>
247
+ <frontend_type>text</frontend_type>
248
+ <sort_order>4</sort_order>
249
+ <show_in_default>1</show_in_default>
250
+ <show_in_website>1</show_in_website>
251
+ <show_in_store>1</show_in_store>
252
+ </nummaxparcelamax>
253
+
254
+ <tipodejuros translate="label">
255
+ <label>O juros do parcelamento será Composto?</label>
256
+ <comment><![CDATA[O tipo de juros que seu contrato com o moip oferece está disponivel nesse link: <a href="https://www.moip.com.br/AdmMainMenuMyData.do?method=accountdata">Clique aqui</a>.]]>
257
+ </comment>
258
+ <frontend_type>select</frontend_type>
259
+ <source_model>adminhtml/system_config_source_yesno</source_model>
260
+ <sort_order>3</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ </tipodejuros>
265
+
266
+ <title_juros translate="label">
267
+ <label>Definição de juros para compras parceladas</label>
268
+
269
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
270
+ <comment><![CDATA[O juros que você definir aqui não altera o valor do juros que o Moip irá cobrar de sua transação, essa regra serve para você definir os juros que seu consumidor irá pagar ao comprar parcelado em seu site. Você pode até mesmo assumir o juros total ou parcial para o seu cliente.]]></comment>
271
+ <sort_order>10</sort_order>
272
+ <show_in_default>1</show_in_default>
273
+ <show_in_website>1</show_in_website>
274
+ <show_in_store>1</show_in_store>
275
+ </title_juros>
276
+ <parcela2 translate="label">
277
+ <label>Juros da parcela:</label>
278
+
279
+ <comment>Use ponto não vírgula.</comment>
280
+ <validate>validate-percents required-entry</validate>
281
+ <frontend_type>text</frontend_type>
282
+ <sort_order>17</sort_order>
283
+ <show_in_default>1</show_in_default>
284
+ <show_in_website>1</show_in_website>
285
+ <show_in_store>1</show_in_store>
286
+ </parcela2>
287
+
288
+
289
+ <parcela3 translate="label">
290
+ <label>Juros da 3ª parcela:</label>
291
+
292
+ <comment>Use ponto não vírgula.</comment>
293
+ <frontend_type>text</frontend_type>
294
+ <validate>validate-percents required-entry</validate>
295
+ <sort_order>19</sort_order>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>1</show_in_store>
299
+ </parcela3>
300
+
301
+ <parcela4 translate="label">
302
+ <label>Juros da 4ª parcela:</label>
303
+
304
+ <comment>Use ponto não vírgula.</comment>
305
+ <frontend_type>text</frontend_type>
306
+ <validate>validate-percents required-entry</validate>
307
+ <sort_order>21</sort_order>
308
+ <show_in_default>1</show_in_default>
309
+ <show_in_website>1</show_in_website>
310
+ <show_in_store>1</show_in_store>
311
+ </parcela4>
312
+
313
+
314
+ <parcela5 translate="label">
315
+ <label>Juros da parcela:</label>
316
+
317
+ <comment>Use ponto não vírgula.</comment>
318
+ <frontend_type>text</frontend_type>
319
+ <validate>validate-percents required-entry</validate>
320
+ <sort_order>23</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <show_in_store>1</show_in_store>
324
+ </parcela5>
325
+
326
+
327
+ <parcela6 translate="label">
328
+ <label>Juros da 6ª parcela:</label>
329
+
330
+ <comment>Use ponto não vírgula.</comment>
331
+ <frontend_type>text</frontend_type>
332
+ <validate>validate-percents required-entry</validate>
333
+ <sort_order>25</sort_order>
334
+ <show_in_default>1</show_in_default>
335
+ <show_in_website>1</show_in_website>
336
+ <show_in_store>1</show_in_store>
337
+ </parcela6>
338
+
339
+
340
+ <parcela7 translate="label">
341
+ <label>Juros da 7ª parcela:</label>
342
+
343
+ <comment>Use ponto não vírgula.</comment>
344
+ <frontend_type>text</frontend_type>
345
+ <validate>validate-percents required-entry</validate>
346
+ <sort_order>27</sort_order>
347
+ <show_in_default>1</show_in_default>
348
+ <show_in_website>1</show_in_website>
349
+ <show_in_store>1</show_in_store>
350
+ </parcela7>
351
+
352
+
353
+ <parcela8 translate="label">
354
+ <label>Juros da 8ª parcela:</label>
355
+
356
+ <comment>Use ponto não vírgula.</comment>
357
+ <frontend_type>text</frontend_type>
358
+ <validate>validate-percents required-entry</validate>
359
+ <sort_order>29</sort_order>
360
+ <show_in_default>1</show_in_default>
361
+ <show_in_website>1</show_in_website>
362
+ <show_in_store>1</show_in_store>
363
+ </parcela8>
364
+
365
+
366
+ <parcela9 translate="label">
367
+ <label>Juros da 9ª parcela:</label>
368
+
369
+ <comment>Use ponto não vírgula.</comment>
370
+ <frontend_type>text</frontend_type>
371
+ <validate>validate-percents required-entry</validate>
372
+ <sort_order>31</sort_order>
373
+ <show_in_default>1</show_in_default>
374
+ <show_in_website>1</show_in_website>
375
+ <show_in_store>1</show_in_store>
376
+ </parcela9>
377
+
378
+
379
+ <parcela10 translate="label">
380
+ <label>Juros da 10ª parcela:</label>
381
+
382
+ <comment>Use ponto não vírgula.</comment>
383
+ <frontend_type>text</frontend_type>
384
+ <validate>validate-percents required-entry</validate>
385
+ <sort_order>33</sort_order>
386
+ <show_in_default>1</show_in_default>
387
+ <show_in_website>1</show_in_website>
388
+ <show_in_store>1</show_in_store>
389
+ </parcela10>
390
+
391
+
392
+ <parcela11 translate="label">
393
+ <label>Juros da 11ª parcela:</label>
394
+
395
+ <comment>Use ponto não vírgula.</comment>
396
+ <frontend_type>text</frontend_type>
397
+ <validate>validate-percents required-entry</validate>
398
+ <sort_order>35</sort_order>
399
+ <show_in_default>1</show_in_default>
400
+ <show_in_website>1</show_in_website>
401
+ <show_in_store>1</show_in_store>
402
+ </parcela11>
403
+
404
+
405
+ <parcela12 translate="label">
406
+ <label>Juros da 12ª parcela:</label>
407
+
408
+ <comment>Use ponto não vírgula.</comment>
409
+ <frontend_type>text</frontend_type>
410
+ <validate>validate-percents required-entry</validate>
411
+ <sort_order>37</sort_order>
412
+ <show_in_default>1</show_in_default>
413
+ <show_in_website>1</show_in_website>
414
+ <show_in_store>1</show_in_store>
415
+ </parcela12>
416
+
417
+ <title_regra_juros translate="label">
418
+ <label>Definição Avançadas para Juros</label>
419
+
420
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
421
+ <comment><![CDATA[ESTE RECURSO É DESTINADO SOMENTE A QUEM POSSUI REGRAS COMPLEXAS DE PARCELAMENTO. PARA REALIZAR APENAS PARCELAMENTO SEM JUROS CONSULTE O VIDEO: <a href="http://youtu.be/Q2AN_3CARb8">Parcelamento sem juros.</a> OU SE FOR MESMO UTILIZAR O MODO AVANÇADO CONSULTE O GUIA: <a href="http://youtu.be/sUyS_GbU5xU">Parcelamento sem juros com regras complexas.</a>.]]></comment>
422
+ <sort_order>50</sort_order>
423
+ <show_in_default>1</show_in_default>
424
+ <show_in_website>1</show_in_website>
425
+ <show_in_store>1</show_in_store>
426
+ </title_regra_juros>
427
+
428
+ <parcelas_avancadas translate="label">
429
+ <label>Definir parcelamento sem juros de acordo com o valor do pedido?</label>
430
+ <frontend_type>select</frontend_type>
431
+ <source_model>adminhtml/system_config_source_yesno</source_model>
432
+ <sort_order>51</sort_order>
433
+ <show_in_default>1</show_in_default>
434
+ <show_in_website>1</show_in_website>
435
+ <show_in_store>1</show_in_store>
436
+ </parcelas_avancadas>
437
+
438
+
439
+ <condicional_1_sem_juros translate="label">
440
+ <label>1ª Regra (pedidos até):</label>
441
+ <depends>
442
+ <parcelas_avancadas>1</parcelas_avancadas>
443
+ </depends>
444
+ <comment>Use ponto não vírgula.</comment>
445
+ <frontend_type>text</frontend_type>
446
+ <validate>validate-price required-entry</validate>
447
+ <sort_order>52</sort_order>
448
+ <show_in_default>1</show_in_default>
449
+ <show_in_website>1</show_in_website>
450
+ <show_in_store>1</show_in_store>
451
+ </condicional_1_sem_juros>
452
+
453
+ <condicional_1_max_parcela translate="label">
454
+ <label>Número máximo de parcelas sem juros para a 1ª regra:</label>
455
+ <depends>
456
+ <parcelas_avancadas>1</parcelas_avancadas>
457
+ </depends>
458
+ <comment>Use ponto não vírgula.</comment>
459
+ <frontend_type>text</frontend_type>
460
+ <validate>validate-percents required-entry</validate>
461
+ <sort_order>53</sort_order>
462
+ <show_in_default>1</show_in_default>
463
+ <show_in_website>1</show_in_website>
464
+ <show_in_store>1</show_in_store>
465
+ </condicional_1_max_parcela>
466
+
467
+
468
+ <condicional_2_sem_juros translate="label">
469
+ <label>2ª Regra (acima de):</label>
470
+ <depends>
471
+ <parcelas_avancadas>1</parcelas_avancadas>
472
+ </depends>
473
+ <comment>Use ponto não vírgula.</comment>
474
+ <frontend_type>text</frontend_type>
475
+ <validate>validate-price required-entry</validate>
476
+ <sort_order>54</sort_order>
477
+ <show_in_default>1</show_in_default>
478
+ <show_in_website>1</show_in_website>
479
+ <show_in_store>1</show_in_store>
480
+ </condicional_2_sem_juros>
481
+
482
+ <condicional_2_max_parcela translate="label">
483
+ <label>Número máximo de parcelas sem juros para a 2ª regra:</label>
484
+ <depends>
485
+ <parcelas_avancadas>1</parcelas_avancadas>
486
+ </depends>
487
+ <comment>Use ponto não vírgula.</comment>
488
+ <frontend_type>text</frontend_type>
489
+ <validate>validate-percents required-entry</validate>
490
+ <sort_order>55</sort_order>
491
+ <show_in_default>1</show_in_default>
492
+ <show_in_website>1</show_in_website>
493
+ <show_in_store>1</show_in_store>
494
+ </condicional_2_max_parcela>
495
+
496
+
497
+ <condicional_3_sem_juros translate="label">
498
+ <label>3ª Regra (pedidos acima de):</label>
499
+ <depends>
500
+ <parcelas_avancadas>1</parcelas_avancadas>
501
+ </depends>
502
+ <comment>Use ponto não vírgula.</comment>
503
+ <frontend_type>text</frontend_type>
504
+ <validate>validate-price required-entry</validate>
505
+ <sort_order>56</sort_order>
506
+ <show_in_default>1</show_in_default>
507
+ <show_in_website>1</show_in_website>
508
+ <show_in_store>1</show_in_store>
509
+ </condicional_3_sem_juros>
510
+
511
+ <condicional_3_max_parcela translate="label">
512
+ <label>Número máximo de parcelas sem juros para a 3ª regra:</label>
513
+ <depends>
514
+ <parcelas_avancadas>1</parcelas_avancadas>
515
+ </depends>
516
+ <comment>Use ponto não vírgula.</comment>
517
+ <frontend_type>text</frontend_type>
518
+ <validate>validate-percents required-entry</validate>
519
+ <sort_order>57</sort_order>
520
+ <show_in_default>1</show_in_default>
521
+ <show_in_website>1</show_in_website>
522
+ <show_in_store>1</show_in_store>
523
+ </condicional_3_max_parcela>
524
+ <title_regra_magento translate="label">
525
+ <label>Definição regras convencionais do Magento</label>
526
+
527
+ <frontend_model>transparente/adminhtml_system_config_form_fieldset_modules_header</frontend_model>
528
+ <sort_order>60</sort_order>
529
+ <show_in_default>1</show_in_default>
530
+ <show_in_website>1</show_in_website>
531
+ <show_in_store>1</show_in_store>
532
+ </title_regra_magento>
533
+ <min_order_total translate="label">
534
+ <label>Minimum Order Total</label>
535
+ <comment>O Moip não irá processar pagamentos abaixo de R$ 5.00</comment>
536
+ <frontend_type>text</frontend_type>
537
+ <sort_order>61</sort_order>
538
+ <show_in_default>1</show_in_default>
539
+ <show_in_website>1</show_in_website>
540
+ <show_in_store>0</show_in_store>
541
+ </min_order_total>
542
+ <max_order_total translate="label">
543
+ <label>Maximum Order Total</label>
544
+ <frontend_type>text</frontend_type>
545
+ <sort_order>62</sort_order>
546
+ <show_in_default>1</show_in_default>
547
+ <show_in_website>1</show_in_website>
548
+ <show_in_store>0</show_in_store>
549
+ </max_order_total>
550
+ <sort_order>
551
+ <label>Order de exibição no checkout:</label>
552
+ <frontend_type>text</frontend_type>
553
+ <sort_order>63</sort_order>
554
+ <show_in_default>1</show_in_default>
555
+ <show_in_website>1</show_in_website>
556
+ <show_in_store>1</show_in_store>
557
+ </sort_order>
558
+ </fields>
559
+ </moip_cc>
560
+ <moip_boleto>
561
+ <label><![CDATA[Moip Transparente - Boleto]]></label>
562
+ <frontend_type>text</frontend_type>
563
+ <comment><![CDATA[Definas as configurações para o recebimento por boleto]]></comment>
564
+ <sort_order>30000</sort_order>
565
+ <show_in_default>1</show_in_default>
566
+ <show_in_website>1</show_in_website>
567
+ <show_in_store>1</show_in_store>
568
+ <fields>
569
+ <active translate="label">
570
+ <label>Habilitar módulo</label>
571
+ <frontend_type>select</frontend_type>
572
+ <source_model>adminhtml/system_config_source_yesno</source_model>
573
+ <sort_order>1</sort_order>
574
+ <show_in_default>1</show_in_default>
575
+ <show_in_website>1</show_in_website>
576
+ <show_in_store>1</show_in_store>
577
+ </active>
578
+ <title translate="label">
579
+ <label>Título exibido no checkout</label>
580
+ <frontend_type>text</frontend_type>
581
+ <sort_order>2</sort_order>
582
+ <show_in_default>1</show_in_default>
583
+ <show_in_website>1</show_in_website>
584
+ <show_in_store>1</show_in_store>
585
+ </title>
586
+ <vcmentoboleto translate="label">
587
+ <label>Vencimento da transação:</label>
588
+ <comment><![CDATA[Aqui você informar número de dias de um pagamento.]]>
589
+ </comment>
590
+ <frontend_type>text</frontend_type>
591
+ <sort_order>80</sort_order>
592
+ <show_in_default>1</show_in_default>
593
+ <show_in_website>1</show_in_website>
594
+ <show_in_store>1</show_in_store>
595
+ </vcmentoboleto>
596
+ <sort_order>
597
+ <label>Order de exibição no checkout:</label>
598
+ <frontend_type>text</frontend_type>
599
+ <sort_order>90</sort_order>
600
+ <show_in_default>1</show_in_default>
601
+ <show_in_website>1</show_in_website>
602
+ <show_in_store>1</show_in_store>
603
+ </sort_order>
604
+ <min_order_total translate="label">
605
+ <label>Minimum Order Total</label>
606
+ <comment>O Moip não irá processar pagamentos abaixo de R$ 5.00</comment>
607
+ <frontend_type>text</frontend_type>
608
+ <sort_order>110</sort_order>
609
+ <show_in_default>1</show_in_default>
610
+ <show_in_website>1</show_in_website>
611
+ <show_in_store>0</show_in_store>
612
+ </min_order_total>
613
+ <max_order_total translate="label">
614
+ <label>Maximum Order Total</label>
615
+ <frontend_type>text</frontend_type>
616
+ <sort_order>111</sort_order>
617
+ <show_in_default>1</show_in_default>
618
+ <show_in_website>1</show_in_website>
619
+ <show_in_store>0</show_in_store>
620
+ </max_order_total>
621
+ <sort_order>
622
+ <label>Order de exibição no checkout:</label>
623
+ <frontend_type>text</frontend_type>
624
+ <sort_order>90</sort_order>
625
+ <show_in_default>1</show_in_default>
626
+ <show_in_website>1</show_in_website>
627
+ <show_in_store>1</show_in_store>
628
+ </sort_order>
629
+ </fields>
630
+ </moip_boleto>
631
+
632
+ <moip_tef>
633
+ <label><![CDATA[Moip Transparente - Transferência Bancária]]></label>
634
+ <frontend_type>text</frontend_type>
635
+ <comment><![CDATA[Definas as configurações para o recebimento por transferência]]></comment>
636
+ <sort_order>40000</sort_order>
637
+ <show_in_default>1</show_in_default>
638
+ <show_in_website>1</show_in_website>
639
+ <show_in_store>1</show_in_store>
640
+ <fields>
641
+ <active translate="label">
642
+ <label>Habilitar módulo</label>
643
+ <frontend_type>select</frontend_type>
644
+ <source_model>adminhtml/system_config_source_yesno</source_model>
645
+ <sort_order>1</sort_order>
646
+ <show_in_default>1</show_in_default>
647
+ <show_in_website>1</show_in_website>
648
+ <show_in_store>1</show_in_store>
649
+ </active>
650
+ <title translate="label">
651
+ <label>Título exibido no checkout</label>
652
+ <frontend_type>text</frontend_type>
653
+ <sort_order>2</sort_order>
654
+ <show_in_default>1</show_in_default>
655
+ <show_in_website>1</show_in_website>
656
+ <show_in_store>1</show_in_store>
657
+ </title>
658
+ <vcmentotef translate="label">
659
+ <label>Vencimento da transação:</label>
660
+ <comment>
661
+ <![CDATA[Dias em que o cliente pode realizar o pagamento.]]>
662
+ </comment>
663
+ <frontend_type>text</frontend_type>
664
+ <sort_order>80</sort_order>
665
+ <show_in_default>1</show_in_default>
666
+ <show_in_website>1</show_in_website>
667
+ <show_in_store>1</show_in_store>
668
+ </vcmentotef>
669
+ <sort_order>
670
+ <label>Order de exibição no checkout:</label>
671
+ <frontend_type>text</frontend_type>
672
+ <sort_order>90</sort_order>
673
+ <show_in_default>1</show_in_default>
674
+ <show_in_website>1</show_in_website>
675
+ <show_in_store>1</show_in_store>
676
+ </sort_order>
677
+ <min_order_total translate="label">
678
+ <label>Minimum Order Total</label>
679
+ <comment>O Moip não irá processar pagamentos abaixo de R$ 5.00</comment>
680
+ <frontend_type>text</frontend_type>
681
+ <sort_order>110</sort_order>
682
+ <show_in_default>1</show_in_default>
683
+ <show_in_website>1</show_in_website>
684
+ <show_in_store>0</show_in_store>
685
+ </min_order_total>
686
+ <max_order_total translate="label">
687
+ <label>Maximum Order Total</label>
688
+ <frontend_type>text</frontend_type>
689
+ <sort_order>111</sort_order>
690
+ <show_in_default>1</show_in_default>
691
+ <show_in_website>1</show_in_website>
692
+ <show_in_store>0</show_in_store>
693
+ </max_order_total>
694
+ <sort_order>
695
+ <label>Order de exibição no checkout:</label>
696
+ <frontend_type>text</frontend_type>
697
+ <sort_order>90</sort_order>
698
+ <show_in_default>1</show_in_default>
699
+ <show_in_website>1</show_in_website>
700
+ <show_in_store>1</show_in_store>
701
+ </sort_order>
702
+ </fields>
703
+ </moip_tef>
704
+ <moip_recurring>
705
+ <label><![CDATA[Moip Assinaturas - Configuração Inicial]]></label>
706
+ <frontend_type>text</frontend_type>
707
+ <comment><![CDATA[Definas as configurações para o recebimento pelo assinaturas]]></comment>
708
+ <sort_order>50000</sort_order>
709
+ <show_in_default>1</show_in_default>
710
+ <show_in_website>1</show_in_website>
711
+ <show_in_store>1</show_in_store>
712
+ <fields>
713
+ <api_id>
714
+ <label>API Token</label>
715
+ <frontend_type>obscure</frontend_type>
716
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
717
+ <sort_order>3</sort_order>
718
+ <show_in_default>1</show_in_default>
719
+ <show_in_website>1</show_in_website>
720
+ <show_in_store>0</show_in_store>
721
+ </api_id>
722
+ <api_key>
723
+ <label>API Key</label>
724
+ <frontend_type>obscure</frontend_type>
725
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
726
+ <sort_order>4</sort_order>
727
+ <show_in_default>1</show_in_default>
728
+ <show_in_website>1</show_in_website>
729
+ <show_in_store>0</show_in_store>
730
+ </api_key>
731
+ </fields>
732
+ </moip_recurring>
733
+ <moip_ccrecurring>
734
+ <label><![CDATA[Moip Assinaturas - Cartão de Crédito]]></label>
735
+ <frontend_type>text</frontend_type>
736
+ <comment><![CDATA[Definas as configurações para o recebimento pelo assinaturas]]></comment>
737
+ <sort_order>60000</sort_order>
738
+ <show_in_default>1</show_in_default>
739
+ <show_in_website>1</show_in_website>
740
+ <show_in_store>1</show_in_store>
741
+ <fields>
742
+ <active translate="label">
743
+ <label>Enabled</label>
744
+ <frontend_type>select</frontend_type>
745
+ <source_model>adminhtml/system_config_source_yesno</source_model>
746
+ <sort_order>1</sort_order>
747
+ <show_in_default>1</show_in_default>
748
+ <show_in_website>1</show_in_website>
749
+ <show_in_store>0</show_in_store>
750
+ </active>
751
+ <title translate="label">
752
+ <label>Title</label>
753
+ <frontend_type>text</frontend_type>
754
+ <sort_order>2</sort_order>
755
+ <show_in_default>1</show_in_default>
756
+ <show_in_website>1</show_in_website>
757
+ <show_in_store>0</show_in_store>
758
+ </title>
759
+
760
+ <order_status_holded_trial translate="label">
761
+ <label>Status pedido em Trial</label>
762
+ <frontend_type>select</frontend_type>
763
+ <source_model>MOIP_Transparente_Model_Source_Holded</source_model>
764
+ <comment><![CDATA[
765
+ <p>Saiba mais <a href="https://youtu.be/">no video (ainda não disponível)</a>.</p>
766
+ ]]>
767
+ </comment>
768
+ <sort_order>5</sort_order>
769
+ <show_in_default>1</show_in_default>
770
+ <show_in_website>1</show_in_website>
771
+ <show_in_store>1</show_in_store>
772
+ </order_status_holded_trial>
773
+ <order_status translate="label">
774
+ <label>Status dos Pedidos Iniciados</label>
775
+ <frontend_type>select</frontend_type>
776
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
777
+ <comment><![CDATA[
778
+ <p>É o primeiro status de todo o pedido, ele signfica que foi recebida a ordem de compra.</p>
779
+ <p>No entanto o pagamento ainda não foi processado ou válidado.</p>
780
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.]]>
781
+ </comment>
782
+ <sort_order>6</sort_order>
783
+ <show_in_default>1</show_in_default>
784
+ <show_in_website>1</show_in_website>
785
+ <show_in_store>1</show_in_store>
786
+ </order_status>
787
+ <allowspecific translate="label">
788
+ <label>Pagamento a partir de países aplicáveis</label>
789
+ <frontend_type>select</frontend_type>
790
+ <sort_order>65</sort_order>
791
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
792
+ <show_in_default>1</show_in_default>
793
+ <show_in_website>1</show_in_website>
794
+ <show_in_store>0</show_in_store>
795
+ </allowspecific>
796
+ <specificcountry translate="label">
797
+ <label>Countries Payment Applicable From</label>
798
+ <frontend_type>multiselect</frontend_type>
799
+ <sort_order>66</sort_order>
800
+ <source_model>adminhtml/system_config_source_country</source_model>
801
+ <depends>
802
+ <allowspecific>1</allowspecific>
803
+ </depends>
804
+ <show_in_default>1</show_in_default>
805
+ <show_in_website>1</show_in_website>
806
+ <show_in_store>0</show_in_store>
807
+ </specificcountry>
808
+ <sort_order translate="label">
809
+ <label>Sort Order</label>
810
+ <frontend_type>text</frontend_type>
811
+ <sort_order>70</sort_order>
812
+ <show_in_default>1</show_in_default>
813
+ <show_in_website>1</show_in_website>
814
+ <show_in_store>0</show_in_store>
815
+ </sort_order>
816
+ </fields>
817
+ </moip_ccrecurring>
818
+
819
+ <moip_boletorecurring>
820
+ <label><![CDATA[Moip Assinaturas - Boleto Recorrente]]></label>
821
+ <frontend_type>text</frontend_type>
822
+ <comment><![CDATA[Definas as configurações para o recebimento pelo assinaturas]]></comment>
823
+ <sort_order>70000</sort_order>
824
+ <show_in_default>1</show_in_default>
825
+ <show_in_website>1</show_in_website>
826
+ <show_in_store>1</show_in_store>
827
+ <fields>
828
+ <active translate="label">
829
+ <label>Enabled</label>
830
+ <frontend_type>select</frontend_type>
831
+ <source_model>adminhtml/system_config_source_yesno</source_model>
832
+ <sort_order>1</sort_order>
833
+ <show_in_default>1</show_in_default>
834
+ <show_in_website>1</show_in_website>
835
+ <show_in_store>0</show_in_store>
836
+ </active>
837
+ <title translate="label">
838
+ <label>Title</label>
839
+ <frontend_type>text</frontend_type>
840
+ <sort_order>2</sort_order>
841
+ <show_in_default>1</show_in_default>
842
+ <show_in_website>1</show_in_website>
843
+ <show_in_store>0</show_in_store>
844
+ </title>
845
+
846
+ <order_status_holded_trial translate="label">
847
+ <label>Status pedido em Trial</label>
848
+ <frontend_type>select</frontend_type>
849
+ <source_model>MOIP_Transparente_Model_Source_Holded</source_model>
850
+ <comment><![CDATA[
851
+ <p>Saiba mais <a href="https://youtu.be/">no video (ainda não disponível)</a>.</p>
852
+ ]]>
853
+ </comment>
854
+ <sort_order>5</sort_order>
855
+ <show_in_default>1</show_in_default>
856
+ <show_in_website>1</show_in_website>
857
+ <show_in_store>1</show_in_store>
858
+ </order_status_holded_trial>
859
+ <order_status translate="label">
860
+ <label>Status dos Pedidos Iniciados</label>
861
+ <frontend_type>select</frontend_type>
862
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
863
+ <comment><![CDATA[
864
+ <p>É o primeiro status de todo o pedido, ele signfica que foi recebida a ordem de compra.</p>
865
+ <p>No entanto o pagamento ainda não foi processado ou válidado.</p>
866
+ <p>Saiba mais <a href="https://youtu.be/qs9EBHFBptU">no video</a>.]]>
867
+ </comment>
868
+ <sort_order>6</sort_order>
869
+ <show_in_default>1</show_in_default>
870
+ <show_in_website>1</show_in_website>
871
+ <show_in_store>1</show_in_store>
872
+ </order_status>
873
+ <allowspecific translate="label">
874
+ <label>Pagamento a partir de países aplicáveis</label>
875
+ <frontend_type>select</frontend_type>
876
+ <sort_order>65</sort_order>
877
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
878
+ <show_in_default>1</show_in_default>
879
+ <show_in_website>1</show_in_website>
880
+ <show_in_store>0</show_in_store>
881
+ </allowspecific>
882
+ <specificcountry translate="label">
883
+ <label>Countries Payment Applicable From</label>
884
+ <frontend_type>multiselect</frontend_type>
885
+ <sort_order>66</sort_order>
886
+ <source_model>adminhtml/system_config_source_country</source_model>
887
+ <depends>
888
+ <allowspecific>1</allowspecific>
889
+ </depends>
890
+ <show_in_default>1</show_in_default>
891
+ <show_in_website>1</show_in_website>
892
+ <show_in_store>0</show_in_store>
893
+ </specificcountry>
894
+ <sort_order translate="label">
895
+ <label>Sort Order</label>
896
+ <frontend_type>text</frontend_type>
897
+ <sort_order>70</sort_order>
898
+ <show_in_default>1</show_in_default>
899
+ <show_in_website>1</show_in_website>
900
+ <show_in_store>0</show_in_store>
901
+ </sort_order>
902
+ </fields>
903
+ </moip_boletorecurring>
904
+
905
+ </groups>
906
+ </payment>
907
+ <moipall translate="label" module="moipall">
908
+ <label><![CDATA[ <div style="height: 33px; "><img src="http://imagem.O2TI.com/transparente_moip.png" style="float:left; "/><div style="padding-top:8px;color:#2f3850">Moip Avançado!<sup style="float: right;">API V2</sup></div></div>]]></label>
909
+ <tab>moip</tab>
910
+ <frontend_type>text</frontend_type>
911
+ <sort_order>200</sort_order>
912
+ <show_in_default>1</show_in_default>
913
+ <show_in_website>1</show_in_website>
914
+ <show_in_store>1</show_in_store>
915
+ <groups>
916
+ <config translate="label">
917
+ <label>Designer</label>
918
+ <frontend_type>text</frontend_type>
919
+ <sort_order>1</sort_order>
920
+ <show_in_default>1</show_in_default>
921
+ <show_in_website>1</show_in_website>
922
+ <show_in_store>1</show_in_store>
923
+ <fields>
924
+ <enable_jquery>
925
+ <label>Habilitar jquery dos módulos?</label>
926
+ <frontend_type>select</frontend_type>
927
+ <source_model>adminhtml/system_config_source_yesno</source_model>
928
+ <comment>Se sua loja já possuí o jquery sendo chamado coloque desabilite a nova chamada.</comment>
929
+ <sort_order>0</sort_order>
930
+ <show_in_default>1</show_in_default>
931
+ <show_in_website>1</show_in_website>
932
+ <show_in_store>1</show_in_store>
933
+ </enable_jquery>
934
+ <enable_bootstrap>
935
+ <label>Usar Bootstrap.js do módulo?</label>
936
+ <frontend_type>select</frontend_type>
937
+ <source_model>adminhtml/system_config_source_yesno</source_model>
938
+ <comment>Se sua loja é feita com tema bootstrap marque não.</comment>
939
+ <sort_order>1</sort_order>
940
+ <show_in_default>1</show_in_default>
941
+ <show_in_website>1</show_in_website>
942
+ <show_in_store>1</show_in_store>
943
+ </enable_bootstrap>
944
+ <trocar_icone translate="label">
945
+ <label>Trocar Ícones Meios Aceitos</label>
946
+ <frontend_type>select</frontend_type>
947
+ <source_model>adminhtml/system_config_source_yesno</source_model>
948
+ <sort_order>3</sort_order>
949
+ <show_in_default>1</show_in_default>
950
+ <show_in_website>1</show_in_website>
951
+ <show_in_store>1</show_in_store>
952
+ </trocar_icone>
953
+ <icone_cartao translate="label comment">
954
+ <depends>
955
+ <trocar_icone>1</trocar_icone>
956
+ </depends>
957
+ <label>Icone Cartão: </label>
958
+ <comment>Icone para a aba dos cartões</comment>
959
+ <frontend_type>image</frontend_type>
960
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
961
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
962
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
963
+ <sort_order>4</sort_order>
964
+ <show_in_default>1</show_in_default>
965
+ <show_in_website>1</show_in_website>
966
+ <show_in_store>1</show_in_store>
967
+ </icone_cartao>
968
+ <icone_boleto translate="label comment">
969
+ <depends>
970
+ <trocar_icone>1</trocar_icone>
971
+ </depends>
972
+ <label>Icone Boleto: </label>
973
+ <comment>Icone para a aba dos Boleto</comment>
974
+ <frontend_type>image</frontend_type>
975
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
976
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
977
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
978
+ <sort_order>5</sort_order>
979
+ <show_in_default>1</show_in_default>
980
+ <show_in_website>1</show_in_website>
981
+ <show_in_store>1</show_in_store>
982
+ </icone_boleto>
983
+ <icone_transf translate="label comment">
984
+ <depends>
985
+ <trocar_icone>1</trocar_icone>
986
+ </depends>
987
+ <label>Icone Transferência: </label>
988
+ <comment>Icone para a aba dos Transferência</comment>
989
+ <frontend_type>image</frontend_type>
990
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
991
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
992
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
993
+ <sort_order>6</sort_order>
994
+ <show_in_default>1</show_in_default>
995
+ <show_in_website>1</show_in_website>
996
+ <show_in_store>1</show_in_store>
997
+ </icone_transf>
998
+ <trocar_bandeira_cartao translate="label">
999
+ <label>Trocar Ícones das Bandeira dos Cartões</label>
1000
+ <frontend_type>select</frontend_type>
1001
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1002
+ <sort_order>7</sort_order>
1003
+ <show_in_default>1</show_in_default>
1004
+ <show_in_website>1</show_in_website>
1005
+ <show_in_store>1</show_in_store>
1006
+ </trocar_bandeira_cartao>
1007
+ <cartao_visa translate="label">
1008
+ <depends>
1009
+ <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
1010
+ </depends>
1011
+ <label>Visa</label>
1012
+ <frontend_type>image</frontend_type>
1013
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1014
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1015
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1016
+ <sort_order>8</sort_order>
1017
+ <show_in_default>1</show_in_default>
1018
+ <show_in_website>1</show_in_website>
1019
+ <show_in_store>1</show_in_store>
1020
+ </cartao_visa>
1021
+ <cartao_master translate="label">
1022
+ <depends>
1023
+ <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
1024
+ </depends>
1025
+ <label>MasterCard</label>
1026
+ <frontend_type>image</frontend_type>
1027
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1028
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1029
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1030
+ <sort_order>9</sort_order>
1031
+ <show_in_default>1</show_in_default>
1032
+ <show_in_website>1</show_in_website>
1033
+ <show_in_store>1</show_in_store>
1034
+ </cartao_master>
1035
+ <cartao_diners translate="label">
1036
+ <depends>
1037
+ <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
1038
+ </depends>
1039
+ <label>Diners</label>
1040
+ <frontend_type>image</frontend_type>
1041
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1042
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1043
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1044
+ <sort_order>10</sort_order>
1045
+ <show_in_default>1</show_in_default>
1046
+ <show_in_website>1</show_in_website>
1047
+ <show_in_store>1</show_in_store>
1048
+ </cartao_diners>
1049
+ <cartao_american translate="label">
1050
+ <depends>
1051
+ <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
1052
+ </depends>
1053
+ <label>American Express</label>
1054
+ <frontend_type>image</frontend_type>
1055
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1056
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1057
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1058
+ <sort_order>11</sort_order>
1059
+ <show_in_default>1</show_in_default>
1060
+ <show_in_website>1</show_in_website>
1061
+ <show_in_store>1</show_in_store>
1062
+ </cartao_american>
1063
+ <cartao_hipercard translate="label">
1064
+ <depends>
1065
+ <trocar_bandeira_cartao>1</trocar_bandeira_cartao>
1066
+ </depends>
1067
+ <label>Hipercard</label>
1068
+ <frontend_type>image</frontend_type>
1069
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1070
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1071
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1072
+ <sort_order>12</sort_order>
1073
+ <show_in_default>1</show_in_default>
1074
+ <show_in_website>1</show_in_website>
1075
+ <show_in_store>1</show_in_store>
1076
+ </cartao_hipercard>
1077
+ <trocar_bandeira_banco translate="label">
1078
+ <label>Trocar Ícones das Bandeira dos Bancos</label>
1079
+ <frontend_type>select</frontend_type>
1080
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1081
+ <sort_order>13</sort_order>
1082
+ <show_in_default>1</show_in_default>
1083
+ <show_in_website>1</show_in_website>
1084
+ <show_in_store>1</show_in_store>
1085
+ </trocar_bandeira_banco>
1086
+ <cartao_bb translate="label">
1087
+ <depends>
1088
+ <trocar_bandeira_banco>1</trocar_bandeira_banco>
1089
+ </depends>
1090
+ <label>Banco do Brasil</label>
1091
+ <frontend_type>image</frontend_type>
1092
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1093
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1094
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1095
+ <sort_order>14</sort_order>
1096
+ <show_in_default>1</show_in_default>
1097
+ <show_in_website>1</show_in_website>
1098
+ <show_in_store>1</show_in_store>
1099
+ </cartao_bb>
1100
+ <cartao_bradesco translate="label">
1101
+ <depends>
1102
+ <trocar_bandeira_banco>1</trocar_bandeira_banco>
1103
+ </depends>
1104
+ <label>Bradesco</label>
1105
+ <frontend_type>image</frontend_type>
1106
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1107
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1108
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1109
+ <sort_order>15</sort_order>
1110
+ <show_in_default>1</show_in_default>
1111
+ <show_in_website>1</show_in_website>
1112
+ <show_in_store>1</show_in_store>
1113
+ </cartao_bradesco>
1114
+ <cartao_itau translate="label">
1115
+ <depends>
1116
+ <trocar_bandeira_banco>1</trocar_bandeira_banco>
1117
+ </depends>
1118
+ <label>Itaú</label>
1119
+ <frontend_type>image</frontend_type>
1120
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1121
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1122
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1123
+ <sort_order>16</sort_order>
1124
+ <show_in_default>1</show_in_default>
1125
+ <show_in_website>1</show_in_website>
1126
+ <show_in_store>1</show_in_store>
1127
+ </cartao_itau>
1128
+ <cartao_banrisul translate="label">
1129
+ <depends>
1130
+ <trocar_bandeira_banco>1</trocar_bandeira_banco>
1131
+ </depends>
1132
+ <label>Banrisul</label>
1133
+ <frontend_type>image</frontend_type>
1134
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1135
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1136
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1137
+ <sort_order>17</sort_order>
1138
+ <show_in_default>1</show_in_default>
1139
+ <show_in_website>1</show_in_website>
1140
+ <show_in_store>1</show_in_store>
1141
+ </cartao_banrisul>
1142
+ <trocar_bandeira_boleto translate="label">
1143
+ <label>Trocar Ícones do boleto</label>
1144
+ <frontend_type>select</frontend_type>
1145
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1146
+ <sort_order>18</sort_order>
1147
+ <show_in_default>1</show_in_default>
1148
+ <show_in_website>1</show_in_website>
1149
+ <show_in_store>1</show_in_store>
1150
+ </trocar_bandeira_boleto>
1151
+ <boleto translate="label">
1152
+ <depends>
1153
+ <trocar_bandeira_boleto>1</trocar_bandeira_boleto>
1154
+ </depends>
1155
+ <label>Icone Interno do Boleto</label>
1156
+ <comment>Icone de dentro da aba do boleto. Lembre-se o banco emissor é o Bradesco</comment>
1157
+ <frontend_type>image</frontend_type>
1158
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1159
+ <upload_dir config="system/filesystem/media" scope_info="1">moip/alltransparente</upload_dir>
1160
+ <base_url type="media" scope_info="1">moip/alltransparente</base_url>
1161
+ <sort_order>19</sort_order>
1162
+ <show_in_default>1</show_in_default>
1163
+ <show_in_website>1</show_in_website>
1164
+ <show_in_store>1</show_in_store>
1165
+ </boleto>
1166
+ </fields>
1167
+ </config>
1168
+ <google translate="label">
1169
+ <label>Tag de conversão</label>
1170
+ <frontend_type>text</frontend_type>
1171
+ <sort_order>4</sort_order>
1172
+ <show_in_default>1</show_in_default>
1173
+ <show_in_website>1</show_in_website>
1174
+ <show_in_store>1</show_in_store>
1175
+ <fields>
1176
+ <outros_funil translate="label">
1177
+ <label>Outras tags de conversão</label>
1178
+ <comment><![CDATA[<br /><div class="custom-options"><div class="box" style="width:243px;">
1179
+ <p>Você pode colar outros scripts de acompanhamento por aqui.</p>
1180
+ <p>Será aceito apenas script de html ou js. não use códigos em php.</p>
1181
+ </div></div>]]></comment>
1182
+ <frontend_type>textarea</frontend_type>
1183
+ <sort_order>2</sort_order>
1184
+ <show_in_default>1</show_in_default>
1185
+ <show_in_website>1</show_in_website>
1186
+ <show_in_store>1</show_in_store>
1187
+ </outros_funil>
1188
+ </fields>
1189
+ </google>
1190
+ <advanced_reset translate="label">
1191
+ <label>Reset de Meios de Pagamento Moip</label>
1192
+ <frontend_model>MOIP_Transparente_Block_Adminhtml_System_Config_Form_Fieldset_Modules_Reset</frontend_model>
1193
+ <sort_order>5</sort_order>
1194
+ <show_in_default>1</show_in_default>
1195
+ <show_in_website>1</show_in_website>
1196
+ <show_in_store>1</show_in_store>
1197
+
1198
+ </advanced_reset>
1199
+ <oneclick_config>
1200
+ <label>Compra com 1 Click</label>
1201
+ <frontend_type>text</frontend_type>
1202
+ <sort_order>4</sort_order>
1203
+ <show_in_default>1</show_in_default>
1204
+ <show_in_website>1</show_in_website>
1205
+ <show_in_store>1</show_in_store>
1206
+ <fields>
1207
+ <enable_oneclick>
1208
+ <label>Habilitar compra com 1 clique?</label>
1209
+ <frontend_type>select</frontend_type>
1210
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1211
+ <comment>A compra com 1 clique está disponível na página de produto.</comment>
1212
+ <sort_order>0</sort_order>
1213
+ <show_in_default>1</show_in_default>
1214
+ <show_in_website>1</show_in_website>
1215
+ <show_in_store>1</show_in_store>
1216
+ </enable_oneclick>
1217
+ <enable_jquery>
1218
+ <label>Uusar Jquery?</label>
1219
+ <frontend_type>select</frontend_type>
1220
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1221
+ <comment>Define a chamada ou não do jquery.js na página de produto.</comment>
1222
+ <sort_order>2</sort_order>
1223
+ <show_in_default>1</show_in_default>
1224
+ <show_in_website>1</show_in_website>
1225
+ <show_in_store>1</show_in_store>
1226
+ </enable_jquery>
1227
+ <enable_noconflit>
1228
+ <label>Usar NoConflit jQuery?</label>
1229
+ <frontend_type>select</frontend_type>
1230
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1231
+ <comment>Função nativa do jQuery que evita conflitos de js.</comment>
1232
+ <sort_order>3</sort_order>
1233
+ <show_in_default>1</show_in_default>
1234
+ <show_in_website>1</show_in_website>
1235
+ <show_in_store>1</show_in_store>
1236
+ </enable_noconflit>
1237
+ <enable_bootstrap>
1238
+ <label>Usar Bootstrap?</label>
1239
+ <frontend_type>select</frontend_type>
1240
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1241
+ <comment>Chamar biblioteca do bootstrap.</comment>
1242
+ <sort_order>4</sort_order>
1243
+ <show_in_default>1</show_in_default>
1244
+ <show_in_website>1</show_in_website>
1245
+ <show_in_store>1</show_in_store>
1246
+ </enable_bootstrap>
1247
+ </fields>
1248
+ </oneclick_config>
1249
+
1250
+ </groups>
1251
+ </moipall>
1252
+ </sections>
1253
+ </config>
app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-install-0.1.0.php CHANGED
@@ -8,6 +8,7 @@
8
  * @author Transparente Pagamentos S/a
9
  * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
11
  */
12
  $installer = $this;
13
 
8
  * @author Transparente Pagamentos S/a
9
  * @copyright Copyright (c) 2010 Transparente Pagamentos S/A
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ * @return Criação dos estados brasileiros
12
  */
13
  $installer = $this;
14
 
app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.1.0-0.2.0.php CHANGED
@@ -11,32 +11,5 @@
11
  */
12
  $installer = $this;
13
  $installer->startSetup();
14
- $tablePrefix = (string) Mage::getConfig()->getTablePrefix();
15
-
16
- $installer->run("
17
- CREATE TABLE IF NOT EXISTS `".$tablePrefix."moip_transparente` (
18
- `order_id` int(11) NOT NULL AUTO_INCREMENT,
19
- `realorder_id` int(11) DEFAULT NULL,
20
- `meio_pg` longtext DEFAULT NULL,
21
- `key_payment` char(50) DEFAULT NULL,
22
- `order_idtransparente` char(50) DEFAULT NULL,
23
- `customer_id` int(11) DEFAULT NULL,
24
- `customer_idtransparente` char(50) DEFAULT NULL,
25
- `creditcard_parc` char(50) DEFAULT NULL,
26
- `creditcard_idtransparente` char(50) DEFAULT NULL,
27
- `brand_transparente` varchar(250) DEFAULT NULL,
28
- `first6` int(11) DEFAULT NULL,
29
- `last4` int(11) DEFAULT NULL,
30
- `boleto_line` char(100) DEFAULT NULL,
31
- `urlcheckout_pg` text DEFAULT NULL,
32
- `fees` char(50) DEFAULT NULL,
33
- `json_send` longtext DEFAULT NULL,
34
- `token` varchar(250) DEFAULT NULL,
35
- `status_token` varchar(250) DEFAULT NULL,
36
- PRIMARY KEY (`order_id`)
37
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
38
-
39
- $installer->startSetup();
40
-
41
  $installer->endSetup();
42
  ?>
11
  */
12
  $installer = $this;
13
  $installer->startSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  $installer->endSetup();
15
  ?>
app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.1.0-0.2.2.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2013 Moip Soluções Web
10
+ * @license Licença válida por tempo indeterminado
11
+ */
12
+
13
+
14
+ $installer = $this;
15
+ $installer->startSetup();
16
+ $tablePrefix = (string) Mage::getConfig()->getTablePrefix();
17
+ $resource = Mage::getSingleton('core/resource');
18
+
19
+ $writeConnection = $resource->getConnection('core_write');
20
+
21
+ $table = $resource->getTableName('core/resource');
22
+
23
+ $query = "UPDATE {$table} SET `version` = '0.1.0', `data_version` = '0.1.0' WHERE `core_resource`.`code` = 'transparente_setup'";
24
+
25
+ $writeConnection->query($query);
26
+
27
+ $installer->run("
28
+ DROP TABLE IF EXISTS `".$tablePrefix."moip_transparentev2`;
29
+ CREATE TABLE IF NOT EXISTS `".$tablePrefix."moip_transparentev2` (
30
+ `entity_id_moip` int(11) NOT NULL AUTO_INCREMENT,
31
+ `mage_pay` int(11) DEFAULT NULL,
32
+ `moip_order` varchar(256) DEFAULT NULL,
33
+ `customer_email` varchar(256) DEFAULT NULL,
34
+ `customer_id` int(11) DEFAULT NULL,
35
+ `forma_pagamento` varchar(256) DEFAULT NULL,
36
+ `moip_response` longtext DEFAULT NULL,
37
+ `moip_ambiente` varchar(256) DEFAULT NULL,
38
+ `moip_fees` varchar(256) DEFAULT NULL,
39
+ `moip_pay` varchar(256) DEFAULT NULL,
40
+ `moip_href_boleto` varchar(2083) DEFAULT NULL,
41
+ `moip_expiration_boleto` varchar(256) DEFAULT NULL,
42
+ `moip_linecode_boleto` varchar(2083) DEFAULT NULL,
43
+ `moip_href_trans` varchar(2083) DEFAULT NULL,
44
+ `moip_bankName_trans` varchar(256) DEFAULT NULL,
45
+ `moip_expiration_trans` varchar(256) DEFAULT NULL,
46
+ `moip_card_installment` int(1) DEFAULT NULL,
47
+ `moip_card_brand` varchar(256) DEFAULT NULL,
48
+ `moip_card_id` varchar(256) DEFAULT NULL,
49
+ `moip_card_first6` varchar(256) DEFAULT NULL,
50
+ `moip_card_last4` varchar(256) DEFAULT NULL,
51
+ `moip_card_birthdate` varchar(256) DEFAULT NULL,
52
+ `moip_card_taxdocument` varchar(256) DEFAULT NULL,
53
+ `moip_card_fullname` varchar(256) DEFAULT NULL,
54
+ PRIMARY KEY (`entity_id_moip`)
55
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
56
+
57
+ $installer->startSetup();
58
+
59
+ $installer->endSetup();
60
+
61
+
62
+ ?>
63
+
app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.2.0-0.2.1.php CHANGED
@@ -14,10 +14,6 @@ $installer = $this;
14
  $installer->startSetup();
15
  $tablePrefix = (string) Mage::getConfig()->getTablePrefix();
16
 
17
- $installer->run("ALTER TABLE `".$tablePrefix."moip_transparente`
18
- ADD `cofre` VARCHAR( 250 ) NULL AFTER `status_token`,
19
- ADD `cofre_parcela` VARCHAR( 30 ) NULL AFTER `cofre`,
20
- ADD `aceita_cofre` VARCHAR( 30 )NULL AFTER `cofre_parcela`");
21
  $installer->startSetup();
22
 
23
  $installer->endSetup();
14
  $installer->startSetup();
15
  $tablePrefix = (string) Mage::getConfig()->getTablePrefix();
16
 
 
 
 
 
17
  $installer->startSetup();
18
 
19
  $installer->endSetup();
app/code/local/MOIP/Transparente/sql/transparente_setup/mysql4-upgrade-0.2.0-0.2.3.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparente - Transparente Payment Module
4
+ *
5
+ * @title Magento -> Custom Payment Module for Transparente (Brazil)
6
+ * @category Payment Gateway
7
+ * @package MOIP_Transparente
8
+ * @author Transparente Pagamentos S/a
9
+ * @copyright Copyright (c) 2013 Moip Soluções Web
10
+ * @license Licença válida por tempo indeterminado
11
+ */
12
+
13
+ $installer = $this;
14
+ $installer->startSetup();
15
+ $installer->run("
16
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
17
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
18
+ ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
19
+ ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
20
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `fee_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
21
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
22
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `fee_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
23
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
24
+ ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
25
+ ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
26
+ ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
27
+ ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
28
+ ");
29
+ $installer->endSetup();
30
+ ?>
app/design/adminhtml/default/default/layout/moip_onestepcheckout.xml CHANGED
@@ -12,4 +12,5 @@
12
  <action method="setCanLoadTinyMce"><load>1</load></action>
13
  </reference>
14
  </adminhtml_system_config_edit>
 
15
  </layout>
12
  <action method="setCanLoadTinyMce"><load>1</load></action>
13
  </reference>
14
  </adminhtml_system_config_edit>
15
+
16
  </layout>
app/design/adminhtml/default/default/template/MOIP/account/system/config/button/button.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $email = $this->getValueConfig('email'); ?>
2
+ <?php if(!empty($email)): ?>
3
+
4
+
5
+ <script type="text/javascript">
6
+ //<![CDATA[
7
+
8
+ function check() {
9
+ var configForm = new varienForm('config_edit_form');
10
+
11
+ if (configForm.validator.validate()) {
12
+ new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
13
+ method: 'post',
14
+ onSuccess: function(transport){
15
+
16
+ if (transport.responseText){
17
+ var data_response = transport.responseText.evalJSON();
18
+ if(data_response.page_redirect == 0){
19
+ location.reload();
20
+ } else{
21
+ window.location.href = data_response.url_redirect;
22
+
23
+ }
24
+
25
+ }
26
+ }
27
+ });
28
+ }
29
+ }
30
+ //]]>
31
+ </script>
32
+ <?php $name = $this->getValueConfig('name'); ?>
33
+ <h2>Olá <?php echo $name ?>, crie sua conta no Moip clicando no botão a baixo:</h2>
34
+ <?php echo $this->getButtonHtml() ?>
35
+ <?php else: ?>
36
+ <h2>Configure sua conta moip preenchendo os dados:</h2>
37
+ <?php endif; ?>
app/design/{frontend/base → adminhtml/default}/default/template/MOIP/transparente/Novaforma.phtml RENAMED
File without changes
app/design/adminhtml/default/default/template/MOIP/transparente/SuccessDetails.phtml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+
3
+ <div class="grid12-12">
4
+
5
+ <div class="grid12-5">
6
+ <div class="box">
7
+ <div class="box-title">
8
+ <h3>Número do Pedido</h3>
9
+ </div>
10
+ <div class="box-content">
11
+ <div class="order-id">#<?php echo $_order->getIncrementId() ?></div>
12
+ </div>
13
+ </div>
14
+ <?php if($_order->getShippingDescription()): ?>
15
+ <div class="box">
16
+
17
+ <div class="box-title">
18
+ <h3><?php echo $this->__('Endereço de Entrega') ?></h3>
19
+ </div>
20
+ <div class="box-content">
21
+ <address>
22
+
23
+ <?php echo $_order->getShippingAddress()->format('html'); ?>
24
+
25
+ </address>
26
+ </div>
27
+ </div>
28
+ <div class="box">
29
+
30
+ <div class="box-title">
31
+ <h3><?php echo $this->__('Dados de Entrega') ?></h3>
32
+ </div>
33
+ <div class="box-content">
34
+ <p>
35
+ Seu pedido será enviado por:
36
+ <div> <?php echo $_order->getShippingDescription(); ?></div>
37
+ </p>
38
+ </div>
39
+
40
+
41
+ </div>
42
+ <?php endif; ?>
43
+ </div>
44
+ <div class="grid12-7">
45
+ <div class="box">
46
+
47
+ <div class="box-title">
48
+ <h3>Itens</h3>
49
+ </div>
50
+ <div class="box-content">
51
+ <table class="data-table cart-table-items" id="checkout-review-table">
52
+ <col />
53
+ <col width="25%" />
54
+ <col width="1" />
55
+ <col width="1" />
56
+ <col width="1" />
57
+ <thead>
58
+ <tr>
59
+ <th><?php echo $this->__('Product Name') ?></th>
60
+ <th><?php echo $this->__('SKU') ?></th>
61
+ <th class="a-right"><?php echo $this->__('Price') ?></th>
62
+ <th class="a-center"><?php echo $this->__('Qty') ?></th>
63
+ <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
64
+ </tr>
65
+ </thead>
66
+ <tfoot>
67
+ <?php echo $this->getChildHtml('order_totals') ?>
68
+ </tfoot>
69
+ <?php $_items = $_order->getItemsCollection(); ?>
70
+ <?php $_index = 0; ?>
71
+ <?php $_count = $_items->count(); ?>
72
+ <?php foreach ($_items as $_item): ?>
73
+ <?php if ($_item->getParentItem()) continue; ?>
74
+ <tbody>
75
+ <?php echo $this->getItemHtml($_item) ?>
76
+ </tbody>
77
+ <?php endforeach; ?>
78
+ </table>
79
+ <script type="text/javascript">decorateTable('checkout-review-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
80
+ </div>
81
+
82
+
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
+
88
+
89
+ <div class="goto-home">
90
+ <?php echo Mage::getStoreConfig("moipall/google/outros_funil"); ?>
91
+ </div>
app/design/adminhtml/default/default/template/MOIP/transparente/boleto.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setDataMoip(); ?>
2
+
3
+ <?php $url_boleto = $this->getBoletoLinks().'/print'; ?>
4
+
5
+ <div class="method-type-payment grid12-12">
6
+ <h3><?php echo $this->__('Quase lá! Agora só falta pagar o boleto.') ?></h3>
7
+ </div>
8
+ <div class="method-type-action grid12-12">
9
+ <div class="grid12-6">
10
+ <h3><?php echo $this->__('Código de Barra') ?></h3>
11
+ <div>
12
+
13
+ <div class="input-box">
14
+ <input type="text" name="codigo-barra" id="bar-code" value="<?php echo $this->getBoletoCode() ?>" title="Código de Barra" class="input-text required-entry">
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <div class="grid12-6">
19
+ <h3><?php echo $this->__('Visualizar Boleto') ?></h3>
20
+ <button class="button btn-checkout" data-toggle="modal" data-target="#largeModal" ><span><span><i class="fa fa-print"></i> Visualizar Boleto</span></span></button>
21
+ </div>
22
+
23
+
24
+
25
+ </div>
26
+
27
+ <script type="text/javascript">
28
+ //<![CDATA[
29
+ jQuery('body').append('<div class="modal fade animated" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="largeModal" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Boleto Bancário</h4> </div> <div class="modal-body"> <iframe width="800" onload="this.height=screen.height;" scrolling= "no" frameBorder="0" allowtransparency="true" src="<?php echo $url_boleto ?>"> </iframe> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button> </div> </div> </div> </div>');
30
+ jQuery('#largeModal').modal('toggle');
31
+ //]]>
32
+ </script>
33
+
34
+
35
+
app/design/adminhtml/default/default/template/MOIP/transparente/cartao.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setDataMoip(); ?>
2
+ <?php $status = $this->getCardStatus(); ?>
3
+
4
+
5
+ <?php if($status == "CANCELLED"): ?>
6
+ <div class="method-type-payment grid12-12">
7
+ <h2><?php echo $this->__('Pagamento Cancelado') ?></h2>
8
+ </div>
9
+ <div class="method-type-action grid12-12">
10
+ <ul class="messages"><li class="error-msg"><ul><li><span><?php echo $this->__('O pagamento não pode ser realizado com sucesso por favor escolha outro método de pagamento.') ?></span></li></ul></li></ul>
11
+ </div>
12
+ <?php elseif($status == "IN_ANALYSIS"): ?>
13
+ <div class="method-type-payment grid12-12">
14
+ <h2><?php echo $this->__('Pagamento em análise') ?></h2>
15
+ </div>
16
+ <div class="method-type-action grid12-12">
17
+ <p><?php echo $this->__('Seu pagamento foi encaminhado para a análise, por favor aguarde a atualização automática do pedido.') ?></p>
18
+ </div>
19
+ <?php elseif($status == "AUTHORIZED"): ?>
20
+ <div class="method-type-payment grid12-12">
21
+ <h2><?php echo $this->__('Pagamento Aprovado') ?></h2>
22
+ </div>
23
+ <div class="method-type-action grid12-12">
24
+ <p><?php echo $this->__('Seu pagamento foi aprovado.') ?></p>
25
+ </div>
26
+ <?php elseif($status == "WAITING"): ?>
27
+ <div class="method-type-payment grid12-12">
28
+ <h2><?php echo $this->__('Pagamento em análise') ?></h2>
29
+ </div>
30
+ <div class="method-type-action grid12-12">
31
+ <p><?php echo $this->__('Seu pagamento foi encaminhado para a análise, por favor aguarde a atualização automática do pedido.') ?></p>
32
+ </div>
33
+ <?php else: ?>
34
+ <div class="method-type-payment grid12-12">
35
+ <h2><?php echo $this->__('Desculpe, houve um erro em nosso sistema') ?></h2>
36
+ </div>
37
+ <div class="method-type-action grid12-12">
38
+ <ul class="messages"><li class="error-msg"><ul><li><span><?php echo $this->__('Não conseguimos identificar o status de seu pagamento, por favor entre em contato com nossa equipe de atendimento antes de realizar uma nova transação.') ?></span></li></ul></li></ul>
39
+ </div>
40
+ <?php endif; ?>
app/design/adminhtml/default/default/template/MOIP/transparente/cartoes_my_account.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $cofre = $this->getCofre(); ?>
2
+ <?php if($cofre !="false"): ?>
3
+ <h2>Gerencie Seus Cartões</h2>
4
+ <p>Seus cartões são mantidos plenamente seguros, os dados aqui mostrados possuem apenas informações públicas sobre eles, sendo criado pela bandeira de seu cartão apenas uma chave codificada
5
+ que nos permite acessa-los quando você for realizar um novo pedido.</p>
6
+ <p>Essa chave é válida únicamente para a nossa loja, não sendo aceita em demais estabeleciomentos.</p>
7
+
8
+
9
+ <?php $cofre = Mage::helper('core')->jsonDecode($cofre); ?>
10
+ <form method="POST" action='<?php echo Mage::getBaseUrl('web', true); ?>transparente/index/Remove/' id="remove_card" class="remove_card">
11
+ <div class="block block-account">
12
+ <div class="block-title">
13
+ <strong><span>Remova seus Cartões</span></strong>
14
+ </div>
15
+ <div class="block-content">
16
+
17
+ <ul class="form-list-cofre">
18
+ <?php foreach ($cofre as $key => $value): ?>
19
+ <?php $cardBrand = $value['moip_card_brand'] ?>
20
+ <?php $cardNunber = $value['moip_card_id'] ?>
21
+ <li class="cofre">
22
+ <label>
23
+ <div class="radio_cofre">
24
+ <input id="cartao_remove" class="validate-one-required-by-name" type="radio" name="cofre_remove" title="Cartão de Crédito Salvo" value="<?php echo $cardNunber ?>">
25
+ </div>
26
+ <div class="image_cofre">
27
+ <img src="<?php echo $this->imageCofre($value['moip_card_brand']); ?>" alt="<?php echo $value['moip_card_brand']; ?>" border="0">
28
+ </div>
29
+ <div class="cofre_number">
30
+ <p class="brand_title"><?php echo $value['moip_card_fullname']; ?> </p>
31
+ <p><?php echo $value['moip_card_first6'] ?> ** **** <?php echo $value['moip_card_last4'] ?></p>
32
+ </div>
33
+ </label>
34
+ </li>
35
+ <?php endforeach; ?>
36
+ </ul>
37
+ <div class="action_remove">
38
+ <button type="submit" title="Remover" class="button"><span><span>Remover</span></span></button>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </form>
43
+
44
+ <script type="text/javascript">
45
+ //<![CDATA[
46
+ var remove_card = new VarienForm('remove_card');
47
+
48
+ jQuery("#remove_card").submit(function(e){
49
+ if(remove_card.validator.validate()){
50
+ var postData = jQuery(this).serializeArray();
51
+ var formURL = jQuery(this).attr("action");
52
+ jQuery("#remove_card").hide();
53
+ jQuery("#loading_mask_loader").show();
54
+ jQuery.ajax(
55
+ {
56
+ url : formURL,
57
+ type: "POST",
58
+ data : postData,
59
+ success:function(data, textStatus, jqXHR)
60
+ {
61
+ location.reload();
62
+ },
63
+
64
+ });
65
+ }
66
+ e.preventDefault();
67
+ });
68
+ //]]>
69
+ </script>
70
+ <?php else: ?>
71
+ <h2>Você ainda não salvou o seu cartão</h2>
72
+ <p>Seus cartões são mantidos plenamente seguros, os dados aqui mostrados possuem apenas informações públicas sobre eles, sendo criado pela bandeira de seu cartão apenas uma chave codificada
73
+ que nos permite acessa-los quando você for realizar um novo pedido.</p>
74
+ <p>Essa chave é válida únicamente para a nossa loja, não sendo aceita em demais estabeleciomentos.</p>
75
+ <h4>Para Salvar seus cartões é fácil:</h4>
76
+ <p>Em sua próxima compra basta marcar o campo: "Salvar Cartão para Compra Futura", ele fica logo a baixo do campo "Opções de Parcelamento" no checkout de sua página.</p>
77
+ <?php endif; ?>
app/design/adminhtml/default/default/template/MOIP/transparente/emptyupdate.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if($this->getRequest()->getParams()){
2
+ $post = $this->getRequest()->getPost();
3
+ $transparente_id = $post['transparente_id'];
4
+ $pgtoArray = array();
5
+ $pgtoArray['forma_pagamento'] = $post['forma_de_pagamento'];
6
+ $pgtoArray['credito_instituicao'] = $post['bandeira'];
7
+ $pgtoArray['credito_numero'] = $post['Numero'];
8
+ $pgtoArray['credito_expiracao_mes'] = $post['Expiracao_mes'];
9
+ $pgtoArray['credito_expiracao_ano'] = $post['Expiracao_ano'];
10
+ $pgtoArray['credito_codigo_seguranca'] = $post['CodigoSeguranca'];
11
+ $pgtoArray['credito_parcelamento'] = $post['parcelas'];
12
+ $pgtoArray['credito_portador_nome'] = $post['Portador'];
13
+ $pgtoArray["vcmentoboleto"] = "3";
14
+ $cpf = $post['CPF'];
15
+ $pgtoArray['credito_portador_cpf'] = preg_replace("/[^0-9]/", "", $cpf);
16
+ $pgtoArray['credito_portador_DDD'] = $this->getNumberOrDDD($post['Telefone'], true);
17
+ $pgtoArray['credito_portador_telefone'] = $this->getNumberOrDDD($post['Telefone']);
18
+ $pgtoArray['credito_portador_nascimento'] = date('Y-m-d', strtotime($post['DataNascimento']));
19
+ Mage::unregister('result_decode');
20
+ $api = Mage::getModel('transparente/api');
21
+ $pagar = $api->getRePagar($transparente_id, $pgtoArray);
22
+ Mage::Register('result_decode', $pagar);
23
+ $refez = json_decode($pagar);
24
+ }
25
+
26
+ echo $refez; ?>
app/design/adminhtml/default/default/template/MOIP/transparente/form/admin.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+
4
+ <div class="recommendation">
5
+ <ul class="checkout-info-admin">
6
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Por razões de segurança da web não permitido obter os dados de cartão do cliente.') ?></p></li>
7
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Você deverá concluir a transação e informar que o cliente receberá um email com link de pagamento') ?></p></li>
8
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Você poderá acompanha-lo durante todo o processo no então, não solicite dados de cartão do cliente.') ?></p></li>
9
+ </ul>
10
+ </div>
11
+
12
+ </ul>
app/design/adminhtml/default/default/template/MOIP/transparente/form/boleto.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+
4
+ <div class="recommendation">
5
+ <ul class="checkout-info-boleto">
6
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Pagamento somente à vista') ?></p></li>
7
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('O boleto vence em %s dias úteis', Mage::getStoreConfig('payment/moip_boleto/vcmentoboleto')) ?>.</p></li>
8
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('É necessário imprimir o boleto ou utilizar o código de barras do mesmo para fazer o pagamento.') ?></p></li>
9
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Imprima o boleto após a finalização da compra.') ?></p></li>
10
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('O boleto não será enviado para o seu endereço físico.') ?></p></li>
11
+ </ul>
12
+ </div>
13
+
14
+ </ul>
app/design/adminhtml/default/default/template/MOIP/transparente/form/cc.phtml ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+ <?php $cofre = $this->getCofre(); ?>
4
+ <?php if($cofre != "false"): ?>
5
+ <script type="text/javascript">
6
+ $j(document).ready(function(){
7
+ SetCofre();
8
+ });
9
+ </script>
10
+
11
+ <div class="payment-cofre">
12
+ <?php $cofre = Mage::helper('core')->jsonDecode($cofre); ?>
13
+
14
+
15
+ <?php foreach ($cofre as $key => $value): ?>
16
+ <?php $cardBrand = $value['moip_card_brand'] ?>
17
+ <?php $cardNunber = $value['moip_card_id'] ?>
18
+
19
+ <li class="cofre">
20
+ <label>
21
+ <div class="radio_cofre">
22
+ <input id="payment_card_cofre" type="radio" title="Cartão de Crédito Salvo" class="validate-one-required-by-name"
23
+ name="payment[<?php echo $_code ?>_cofre_nb]" value="<?php echo $cardNunber ?>">
24
+ </div>
25
+ <div class="image_cofre">
26
+ <img src="<?php echo $this->imageCofre($value['moip_card_brand']); ?>" alt="<?php echo $value['moip_card_brand']; ?>" border="0">
27
+ </div>
28
+ <div class="cofre_number">
29
+ <p class="brand_title"><?php echo $value['moip_card_fullname']; ?> </p>
30
+ <p><?php echo $value['moip_card_first6'] ?> ** **** <?php echo $value['moip_card_last4'] ?></p>
31
+ </div>
32
+ </label>
33
+ </li>
34
+
35
+ <?php endforeach; ?>
36
+ <li class="wide">
37
+ <label for="<?php echo $_code ?>_cofre_id" class="required"><em>*</em><?php echo $this->__('Cod. de Segurança') ?></label>
38
+ <div class="input-box">
39
+
40
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cofre_id]" title="Código de Seguranção do Seu Cartão" class="input-text validate-required required-entry" id="<?php echo $_code ?>_cofre_id" placeholder="CVV" value="">
41
+
42
+
43
+ </div>
44
+ </li>
45
+ <li class="wide">
46
+ <label for="<?php echo $_code ?>_installment_cofre" class="required"><em>*</em><?php echo $this->__('Parcelas') ?></label>
47
+ <div class="input-box">
48
+ <select name="payment[<?php echo $_code ?>_count_cofre]" id="<?php echo $_code ?>_count_cofre" class="validate-select" title="Número de Parcelas de sua Compra - Cofre" >
49
+ <option value="" select>Selecione as parcelas</option>
50
+ <?php $parcelas = $this->getParcelamentoSelect(); ?>
51
+ <?php foreach ( $parcelas as $key => $value) { ?>
52
+ <?php echo $parcelas[$key]; ?>
53
+ <?php } ?>
54
+ </select>
55
+ </div>
56
+ </li>
57
+ </div>
58
+ <?php endif ?>
59
+
60
+ <div class="payment-card">
61
+ <div class="clearer">
62
+ <textarea id="id-chave-publica" class="chave-publica-moip" style="display:none !important;"><?php echo $this->getPublicKey() ?></textarea>
63
+ <input id="encrypted_value" class="encrypted_value input-text required-entry" name="payment[<?php echo $_code ?>_encrypted]" type="hidden" value="" title="Os dados do cartão de crédito são inválidos.">
64
+
65
+ </div>
66
+
67
+ <li>
68
+ <div class="no-display">
69
+ <input class="<?php echo $_code ?>_type" id="<?php echo $_code ?>_type" type="hidden" name="payment[<?php echo $_code ?>_type]" />
70
+ </div>
71
+ </li>
72
+ <li class="wide">
73
+ <ul id="<?php echo $_code ?>_type">
74
+ <li class="VI">Visa</li>
75
+ <li class="MC">Mastercard</li>
76
+ <li class="AE">American Express</li>
77
+ <li class="DI ">Dinners</li>
78
+ <li class="EO">Elo</li>
79
+ <li class="HI">Hipercard</li>
80
+ <li class="HP">Hipper</li>
81
+ </ul>
82
+ </li>
83
+
84
+ <li class="fields card-number">
85
+ <label for="<?php echo $_code ?>_number" class="required"><em>*</em><?php echo $this->__('Número do Cartão') ?></label>
86
+ <div class="input-box">
87
+ <input type="text" id="<?php echo $_code ?>_number" pattern="\d*" name="payment[<?php echo $_code ?>_number]" title="Número do seu Cartão de Crédito" class="required-entry input-text" placeholder="Número do Cartão" value="">
88
+ </div>
89
+ </li>
90
+
91
+ <li class="fields card-cvv">
92
+ <label for="<?php echo $_code ?>_cid" class="required"><em>*</em><?php echo $this->__('Cod. de Segurança') ?></label>
93
+ <div class="input-box">
94
+ <div class="v-fix">
95
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cid]" title="Código de Seguranção do Seu Cartão" class="input-text cvv required-entry" id="<?php echo $_code ?>_cid" placeholder="CVV" value="">
96
+ </div>
97
+
98
+ </div>
99
+ </li>
100
+
101
+ <li class="wide">
102
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiração') ?></label>
103
+ <div class="input-box">
104
+ <div class="v-fix">
105
+ <select name="payment[<?php echo $_code ?>_exp_month]" id="credito_expiracao_mes" class="validate-select" title="Mês de Vencimento do seu Cartão">
106
+ <option value="">Mês</option>
107
+ <option value="01">01 - Janeiro</option>
108
+ <option value="02">02 - Fevereiro</option>
109
+ <option value="03">03 - Março</option>
110
+ <option value="04">04 - Abril</option>
111
+ <option value="05">05 - Maio</option>
112
+ <option value="06">06 - Junho</option>
113
+ <option value="07">07 - Julho</option>
114
+ <option value="08">08 - Agosto</option>
115
+ <option value="09">09 - Setembro</option>
116
+ <option value="10">10 - Outubro</option>
117
+ <option value="11">11 - Novembro</option>
118
+ <option value="12">12 - Dezembro</option>
119
+ </select>
120
+ </div>
121
+ <div class="v-fix">
122
+ <select name="payment[<?php echo $_code ?>_exp_year]" id="credito_expiracao_ano" class="validate-select" title="Ano de Vencimento do seu Cartão">
123
+ <option value="">Ano</option>
124
+
125
+ <option value="2015">15</option>
126
+ <option value="2016">16</option>
127
+ <option value="2017">17</option>
128
+ <option value="2018">18</option>
129
+ <option value="2019">19</option>
130
+ <option value="2020">20</option>
131
+ <option value="2021">21</option>
132
+ <option value="2022">22</option>
133
+ <option value="2023">23</option>
134
+ <option value="2024">24</option>
135
+ <option value="2025">25</option>
136
+ <option value="2026">26</option>
137
+ <option value="2027">27</option>
138
+ <option value="2028">28</option>
139
+ <option value="2029">29</option>
140
+ <option value="2030">30</option>
141
+ </select>
142
+ </div>
143
+ </div>
144
+ </li>
145
+ <li class="wide">
146
+ <label for="<?php echo $_code ?>_installment_count" class="required"><em>*</em><?php echo $this->__('Parcelas') ?></label>
147
+ <div class="input-box">
148
+
149
+ <select name="payment[<?php echo $_code ?>_installment_count]" id="credito_parcelamento" class="required-entry validate-select" title="Número de Parcelas de sua Compra">
150
+ <option select value="">Selecione as parcelas</option>
151
+ <?php $parcelas = $this->getParcelamentoSelect(); ?>
152
+
153
+ <?php foreach ( $parcelas as $key => $value) { ?>
154
+ <?php echo $parcelas[$key]; ?>
155
+ <?php } ?>
156
+ </select>
157
+ </div>
158
+ </li>
159
+ <li class="wide">
160
+ <label for="<?php echo $_code ?>_taxDocument" class="required"><em>*</em><?php echo $this->__('CPF do Titular do Cartão') ?></label>
161
+ <div class="input-box">
162
+ <input type="text" name="payment[<?php echo $_code ?>_taxdocument]" value="<?php echo $this->getDateCard('taxvat') ?>" class="input-text required-entry" title="CPF do Titular de seu Cartão" id="credito_portador_cpf" placeholder="CPF do Titular do Cartão" >
163
+ </div>
164
+ </li>
165
+ <li class="wide card-port">
166
+ <label for="<?php echo $_code ?>_fullname" class="required"><em>*</em><?php echo $this->__('Nome do Titular Cartão') ?></label>
167
+ <div class="input-box">
168
+ <input type="text" name="payment[<?php echo $_code ?>_owner]" value="<?php echo $this->getDateCard('name') ?>" class="input-text required-entry" title="Nome Impresso em seu Cartão" id="credito_portador_nome" placeholder="Nome Impresso no Cartão">
169
+ </div>
170
+ </li>
171
+
172
+ <li class="wide card-port">
173
+ <label for="<?php echo $_code ?>_Phone" class="required"><em>*</em><?php echo $this->__('Telefone do Titular Cartão') ?></label>
174
+ <div class="input-box">
175
+ <input type="hidden" name="payment[<?php echo $_code ?>_PhoneRegion]" value="55" id="credito_portador_telefone" title="Telefone do Titular do Cartão" class="input-text required-entry" placeholder="Telefone de Contato" >
176
+ <div class="v-fix">
177
+ ( <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_phone_code]" value="<?php echo $this->getDateCard('telephone-ddd') ?>" id="credito_portador_telefone" title="Telefone do Titular do Cartão" class="input-text ddd required-entry" placeholder="Telefone de Contato"> )
178
+ </div>
179
+ <div class="v-fix">
180
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_phone_number]" value="<?php echo $this->getDateCard('telephone-number') ?>" d="credito_portador_telefone" title="Telefone do Titular do Cartão" class="input-text telefone required-entry" placeholder="Telefone de Contato">
181
+ </div>
182
+ </div>
183
+ </li>
184
+ <li class="wide card-port">
185
+ <label for="<?php echo $_code ?>_birthdate" class="required"><em>*</em><?php echo $this->__('Data de Nascimento Titular do Cartão') ?></label>
186
+ <div class="input-box">
187
+ <div class="v-fix">
188
+ <select name="payment[<?php echo $_code ?>_owner_exp_day]" class="validate-select owner_day" title="Ano de Nacimento do Titular do Catão">
189
+ <option value="<?php echo $this->getDateCard('dob-day') ?>" select><?php echo ($this->getDateCard('dob-day') ? $this->getDateCard('dob-day') : "Dia" )?></option>
190
+ <option value="01">01</option>
191
+ <option value="02">02</option>
192
+ <option value="03">03</option>
193
+ <option value="04">04</option>
194
+ <option value="05">05</option>
195
+ <option value="06">06</option>
196
+ <option value="07">07</option>
197
+ <option value="08">08</option>
198
+ <option value="09">09</option>
199
+ <option value="10">10</option>
200
+ <option value="11">11</option>
201
+ <option value="12">12</option>
202
+ <option value="13">13</option>
203
+ <option value="14">14</option>
204
+ <option value="15">15</option>
205
+ <option value="16">16</option>
206
+ <option value="17">17</option>
207
+ <option value="18">18</option>
208
+ <option value="19">19</option>
209
+ <option value="20">20</option>
210
+ <option value="21">21</option>
211
+ <option value="22">22</option>
212
+ <option value="23">23</option>
213
+ <option value="24">24</option>
214
+ <option value="25">25</option>
215
+ <option value="26">26</option>
216
+ <option value="27">27</option>
217
+ <option value="28">28</option>
218
+ <option value="29">29</option>
219
+ <option value="30">30</option>
220
+ <option value="31">31</option>
221
+ </select>
222
+ </div>
223
+ <div class="v-fix">
224
+ <select name="payment[<?php echo $_code ?>_owner_exp_month]" class="validate-select owner_month" title="Ano de Nacimento do Titular do Catão">
225
+ <option value="<?php echo $this->getDateCard('dob-month') ?>" select><?php echo ($this->getDateCard('dob-month') ? $this->getDateCard('dob-month') : "Mês" )?></option>
226
+ <option value="01">01 - Janeiro</option>
227
+ <option value="02">02 - Fevereiro</option>
228
+ <option value="03">03 - Março</option>
229
+ <option value="04">04 - Abril</option>
230
+ <option value="05">05 - Maio</option>
231
+ <option value="06">06 - Junho</option>
232
+ <option value="07">07 - Jullho</option>
233
+ <option value="08">08 - Agosto</option>
234
+ <option value="09">09 - Setembro</option>
235
+ <option value="10">10 - Outubro</option>
236
+ <option value="11">11 - Novembro</option>
237
+ <option value="12">12 - Dezembro</option>
238
+ </select>
239
+ </div>
240
+ <div class="v-fix">
241
+ <select name="payment[<?php echo $_code ?>_owner_exp_year]" class="validate-select owner_year" title="Ano de Nacimento do Titular do Catão">
242
+ <option value="<?php echo $this->getDateCard('dob-year') ?>" select><?php echo ($this->getDateCard('dob-year') ? $this->getDateCard('dob-year') : "Ano" )?></option>
243
+ <option value="1935">1935</option>
244
+ <option value="1936">1936</option>
245
+ <option value="1937">1937</option>
246
+ <option value="1938">1938</option>
247
+ <option value="1939">1939</option>
248
+ <option value="1940">1940</option>
249
+ <option value="1941">1941</option>
250
+ <option value="1942">1942</option>
251
+ <option value="1943">1943</option>
252
+ <option value="1944">1944</option>
253
+ <option value="1945">1945</option>
254
+ <option value="1946">1946</option>
255
+ <option value="1947">1947</option>
256
+ <option value="1948">1948</option>
257
+ <option value="1949">1949</option>
258
+ <option value="1950">1950</option>
259
+ <option value="1951">1951</option>
260
+ <option value="1952">1952</option>
261
+ <option value="1953">1953</option>
262
+ <option value="1954">1954</option>
263
+ <option value="1955">1955</option>
264
+ <option value="1956">1956</option>
265
+ <option value="1957">1957</option>
266
+ <option value="1958">1958</option>
267
+ <option value="1959">1959</option>
268
+ <option value="1960">1960</option>
269
+ <option value="1961">1961</option>
270
+ <option value="1962">1962</option>
271
+ <option value="1963">1963</option>
272
+ <option value="1964">1964</option>
273
+ <option value="1965">1965</option>
274
+ <option value="1966">1966</option>
275
+ <option value="1967">1967</option>
276
+ <option value="1968">1968</option>
277
+ <option value="1969">1969</option>
278
+ <option value="1970">1970</option>
279
+ <option value="1971">1971</option>
280
+ <option value="1972">1972</option>
281
+ <option value="1973">1973</option>
282
+ <option value="1974">1974</option>
283
+ <option value="1975">1975</option>
284
+ <option value="1976">1976</option>
285
+ <option value="1977">1977</option>
286
+ <option value="1978">1978</option>
287
+ <option value="1979">1979</option>
288
+ <option value="1980">1980</option>
289
+ <option value="1981">1981</option>
290
+ <option value="1982">1982</option>
291
+ <option value="1983">1983</option>
292
+ <option value="1984">1984</option>
293
+ <option value="1985">1985</option>
294
+ <option value="1986">1986</option>
295
+ <option value="1987">1987</option>
296
+ <option value="1988">1988</option>
297
+ <option value="1989">1989</option>
298
+ <option value="1990">1990</option>
299
+ <option value="1991">1991</option>
300
+ <option value="1992">1992</option>
301
+ <option value="1993">1993</option>
302
+ <option value="1994">1994</option>
303
+ <option value="1995">1995</option>
304
+ <option value="1996">1996</option>
305
+ <option value="1997">1997</option>
306
+ <option value="1998">1998</option>
307
+ <option value="1999">1999</option>
308
+ <option value="2000">2000</option>
309
+ <option value="2001">2001</option>
310
+ <option value="2002">2002</option>
311
+ <option value="2003">2003</option>
312
+ <option value="2004">2004</option>
313
+ <option value="2005">2005</option>
314
+ <option value="2006">2006</option>
315
+ <option value="2007">2007</option>
316
+ <option value="2008">2008</option>
317
+ <option value="2009">2009</option>
318
+ <option value="2010">2010</option>
319
+ <option value="2011">2011</option>
320
+ <option value="2012">2012</option>
321
+ <option value="2013">2013</option>
322
+ <option value="2014">2014</option>
323
+ </select>
324
+ </div>
325
+ </div>
326
+ </li>
327
+ <li class="wide">
328
+ <label>
329
+ <input type="checkbox" name="titular-card" title="Salvar este endereço" value="1" class="titular-card validate-number input-checkbox" checked="checked"> Eu sou o Titular do Cartão</label>
330
+ </li>
331
+ </div>
332
+
333
+
334
+ <?php if($cofre != "false"): ?>
335
+ <div class="clearer">
336
+ <li class="wide">
337
+ <label>
338
+ <input type="checkbox" name="payment[<?php echo $_code ?>_payment_in_cofre]" title="Usar um novo cartão?" value="0" class="new-card validate-number input-checkbox"> Usar outro Cartão não listado?
339
+ </label>
340
+ </li>
341
+ </div>
342
+ <?php else: ?>
343
+ <input type="hidden" name="payment[<?php echo $_code ?>_payment_in_cofre]" title="Usar um novo cartão?" value="1" class="new-card validate-number input-checkbox">
344
+ <?php endif; ?>
345
+ </ul>
346
+ <script type="text/javascript">
347
+ //<![CDATA[
348
+
349
+ $j(document).ready(function(){
350
+ MoipPagamentosCc();
351
+ });
352
+
353
+ //]]>
354
+ </script>
app/design/adminhtml/default/default/template/MOIP/transparente/form/cc_info.phtml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId(); */
3
+ if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
4
+ ?>
5
+ <?php $info = $this->_prepareInfo(); ?>
6
+ <?php $meio = $info['forma_pagamento'];?>
7
+
8
+ <?php if($meio == "CartaoCredito"): ?>
9
+
10
+
11
+ <div class="box-content">
12
+ <h3><?php echo $info['moip_card_brand']; ?> <b><?php echo $info['moip_card_installment']; ?><b> parcelas</h3>
13
+ <div class="input-value">
14
+ <?php echo $info['moip_card_fullname'] ?>
15
+ </div>
16
+
17
+ <div class="input-value">
18
+ <label>6 Primeiros dígitos do cartão</label>
19
+ <?php echo $info['moip_card_first6'] ?>
20
+ </div>
21
+
22
+ <div class="input-value">
23
+ <label>4 Últimos dígitos do cartão</label>
24
+ <?php echo $info['moip_card_last4'] ?>
25
+ </div>
26
+
27
+
28
+ <div class="input-value">
29
+ <label>Data de Nascimento do Titular</label>
30
+ <?php echo $info['moip_card_birthdate'] ?>
31
+ </div>
32
+
33
+ <div class="input-value">
34
+ <label>Pagamento n.º</label>
35
+ <?php echo $info['moip_pay'] ?>
36
+ </div>
37
+
38
+ </div>
39
+
40
+ <?php endif ?>
41
+
42
+ <?php if($meio == "BoletoBancario"): ?>
43
+ <div class="box-content">
44
+ <p>Boleto Bancário</p>
45
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_boleto'] ?>" target="_blank">Imprimir Boleto</a></p>
46
+ <p>Código de Barras</p>
47
+ <p><input type="text" value="<?php echo $info['moip_linecode_boleto'] ?>" readonly="disable"></p>
48
+ <p>Vencimento: <?php echo date('d-m-Y', strtotime($info['moip_expiration_boleto'])) ?></p>
49
+
50
+ </div>
51
+ <?php endif ?>
52
+
53
+ <?php if($meio == "DebitoBancario"): ?>
54
+ <p>Transferência Bancária</p>
55
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_trans'] ?>" target="_blank">Ir Ao banco</a></p>
56
+
57
+
58
+ </div>
59
+ <?php endif ?>
60
+
61
+
62
+ <?php } else { ?>
63
+
64
+ <?php $addtional = $this->getMethod()->getInfoInstance()->getAdditionalData();?>
65
+ <?php $addtional = unserialize($addtional); ?>
66
+ <?php if($addtional['formapagamento_moip'] == "CartaoCredito"): ?>
67
+ <?php echo Mage::helper('transparente')->__('Nome Impresso no cartão: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
68
+ <?php echo Mage::helper('transparente')->__('Bandeira: %s', $this->htmlEscape($this->getNomeBrand($this->getInfo()->getCcType()))) ?><br/>
69
+ <?php echo Mage::helper('transparente')->__('Número do cartão: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
70
+ <?php echo Mage::helper('transparente')->__('Vencimento do cartão: %s/%s', $this->htmlEscape($this->getInfo()->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?><br/>
71
+
72
+ <?php else: ?>
73
+ <?php echo $addtional['formapagamento_moip'] ?>
74
+ <?php endif; ?>
75
+
76
+ <?php } ?>
app/design/adminhtml/default/default/template/MOIP/transparente/form/tef.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+ <div class="recommendation">
4
+ <ul class="checkout-info-boleto">
5
+ <li class="checkout-info-item"><p class="checkout-info-text">É Obrigatório ter o TOKEN do banco em mãos.</p></li>
6
+ <li class="checkout-info-item"><p class="checkout-info-text">Pagamento somente à vista.</p></li>
7
+ </ul>
8
+ </div>
9
+ <ul>
10
+ <li>
11
+ <label for="<?php echo $_code ?>_banknumber" class="required"><em>*</em><?php echo $this->__('Banco para Transferência On-line') ?></label>
12
+ <div class="input-box">
13
+ <select name="payment[<?php echo $_code ?>_banknumber]" class="input-box required-entry validate-select" id="bamk-of-tef" title="Banco Para Transferência">
14
+ <option value="" select>Selecione o seu banco.</option>
15
+ <option value="001">Banco do Brasil</option>
16
+ <option value="237">Brandesco</option>
17
+ <option value="341">Itaú</option>
18
+ <option value="041">Banrisul</option>
19
+ </select>
20
+ </div>
21
+ </li>
22
+ </ul>
23
+
24
+ </ul>
app/design/adminhtml/default/default/template/MOIP/transparente/form/tef_info.phtml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId(); */
3
+ if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
4
+ ?>
5
+ <?php $info = $this->_prepareInfo(); ?>
6
+ <?php $meio = $info['forma_pagamento'];?>
7
+
8
+ <?php if($meio == "CartaoCredito"): ?>
9
+
10
+
11
+ <div class="box-content">
12
+ <h3><?php echo $info['moip_card_brand']; ?> <b><?php echo $info['moip_card_installment']; ?><b> parcelas</h3>
13
+ <div class="input-value">
14
+ <?php echo $info['moip_card_fullname'] ?>
15
+ </div>
16
+
17
+ <div class="input-value">
18
+ <label>6 Primeiros dígitos do cartão</label>
19
+ <?php echo $info['moip_card_first6'] ?>
20
+ </div>
21
+
22
+ <div class="input-value">
23
+ <label>4 Últimos dígitos do cartão</label>
24
+ <?php echo $info['moip_card_last4'] ?>
25
+ </div>
26
+
27
+
28
+ <div class="input-value">
29
+ <label>Data de Nascimento do Titular</label>
30
+ <?php echo $info['moip_card_birthdate'] ?>
31
+ </div>
32
+
33
+ <div class="input-value">
34
+ <label>Pagamento n.º</label>
35
+ <?php echo $info['moip_pay'] ?>
36
+ </div>
37
+
38
+ </div>
39
+
40
+ <?php endif ?>
41
+
42
+ <?php if($meio == "BoletoBancario"): ?>
43
+ <div class="box-content">
44
+ <p>Boleto Bancário</p>
45
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_boleto'] ?>" target="_blank">Imprimir Boleto</a></p>
46
+ <p>Código de Barras</p>
47
+ <p><input type="text" value="<?php echo $info['moip_linecode_boleto'] ?>" readonly="disable"></p>
48
+ <p>Vencimento: <?php echo date('d-m-Y', strtotime($info['moip_expiration_boleto'])) ?></p>
49
+
50
+ </div>
51
+ <?php endif ?>
52
+
53
+ <?php if($meio == "DebitoBancario"): ?>
54
+ <p>Transferência Bancária</p>
55
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_trans'] ?>" target="_blank">Ir Ao banco</a></p>
56
+
57
+
58
+ </div>
59
+ <?php endif ?>
60
+
61
+
62
+ <?php } else { ?>
63
+
64
+ <?php $addtional = $this->getMethod()->getInfoInstance()->getAdditionalData();?>
65
+ <?php $addtional = unserialize($addtional); ?>
66
+ <?php if($addtional['formapagamento_moip'] == "CartaoCredito"): ?>
67
+ <?php echo Mage::helper('transparente')->__('Nome Impresso no cartão: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
68
+ <?php echo Mage::helper('transparente')->__('Bandeira: %s', $this->htmlEscape($this->getNomeBrand($this->getInfo()->getCcType()))) ?><br/>
69
+ <?php echo Mage::helper('transparente')->__('Número do cartão: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
70
+ <?php echo Mage::helper('transparente')->__('Vencimento do cartão: %s/%s', $this->htmlEscape($this->getInfo()->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?><br/>
71
+
72
+ <?php else: ?>
73
+ <?php echo $addtional['formapagamento_moip'] ?>
74
+ <?php endif; ?>
75
+
76
+ <?php } ?>
app/design/adminhtml/default/default/template/MOIP/transparente/horizontal_form.phtml ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+
4
+ <ul class="nav nav-tabs" id="MoipPagamentosForma" role="tablist">
5
+
6
+ <?php if($this->mostraCartao()): ?>
7
+ <li role="presentation" class="active" >
8
+ <a href="#CartaoCredito" role="tab" class="CartaoCredito">
9
+ <span class="icon-tab-moip"><img alt="Cartão de Crédito" src="<?php echo $this->getCartaoIcon(); ?>"></span>
10
+ <span>Cartão</span>
11
+ </a>
12
+ </li>
13
+ <?php endif; ?>
14
+
15
+ <?php if($this->mostraBoleto()): ?>
16
+ <li role="presentation">
17
+ <a href="#BoletoBancario" role="tab" >
18
+ <span class="icon-tab-moip"><img alt="Boleto Bancário" src="<?php echo $this->getBoletoIcon(); ?>"></span>
19
+ <span>Boleto</span>
20
+ </a>
21
+ </li>
22
+ <?php endif; ?>
23
+
24
+ <?php if($this->mostraTransferencia()): ?>
25
+ <li role="presentation">
26
+ <a href="#DebitoBancario" class="DebitoBancario" role="tab" >
27
+ <span class="icon-tab-moip"><img alt="Transferência Bancária" src="<?php echo $this->getTransferenciaIcon(); ?>"></span>
28
+ <span>Transf.</span>
29
+ </a>
30
+ </li>
31
+ <?php endif; ?>
32
+
33
+ </ul>
34
+
35
+ <div class="tab-content">
36
+ <input type="hidden" value="CartaoCredito" id="forma_pagamento_moip" class="required-entry" name="payment[<?php echo $_code ?>_forma_pagamento]" title="Selecione Meio de Pagamento">
37
+ <div role="tabpanel" class="tab-pane fade active in" id="CartaoCredito">
38
+
39
+ <?php $cofre = $this->getCofre(); ?>
40
+ <?php if($cofre != "false"): ?>
41
+ <script type="text/javascript">
42
+ $j(document).ready(function(){
43
+ SetCofre();
44
+ });
45
+ </script>
46
+
47
+ <div class="payment-cofre">
48
+ <?php $cofre = Mage::helper('core')->jsonDecode($cofre); ?>
49
+
50
+
51
+ <?php foreach ($cofre as $key => $value): ?>
52
+ <?php $cardBrand = $value['moip_card_brand'] ?>
53
+ <?php $cardNunber = $value['moip_card_id'] ?>
54
+
55
+ <li class="cofre">
56
+ <label>
57
+ <div class="radio_cofre">
58
+ <input id="payment_card_cofre" type="radio" title="Cartão de Crédito Salvo" class="validate-one-required-by-name"
59
+ name="payment[<?php echo $_code ?>_cofre_nb]" value="<?php echo $cardNunber ?>">
60
+ </div>
61
+ <div class="image_cofre">
62
+ <img src="<?php echo $this->imageCofre($value['moip_card_brand']); ?>" alt="<?php echo $value['moip_card_brand']; ?>" border="0">
63
+ </div>
64
+ <div class="cofre_number">
65
+ <p class="brand_title"><?php echo $value['moip_card_fullname']; ?> </p>
66
+ <p><?php echo $value['moip_card_first6'] ?> ** **** <?php echo $value['moip_card_last4'] ?></p>
67
+ </div>
68
+ </label>
69
+ </li>
70
+
71
+ <?php endforeach; ?>
72
+ <li class="wide">
73
+ <label for="<?php echo $_code ?>_cofre_id" class="required"><em>*</em><?php echo $this->__('Cod. de Segurança') ?></label>
74
+ <div class="input-box">
75
+
76
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cofre_id]" title="Código de Seguranção do Seu Cartão" class="input-text validate-required required-entry" id="<?php echo $_code ?>_cofre_id" placeholder="CVV" value="">
77
+
78
+
79
+ </div>
80
+ </li>
81
+ <li class="wide">
82
+ <label for="<?php echo $_code ?>_cc_installment_cofre" class="required"><em>*</em><?php echo $this->__('Parcelas') ?></label>
83
+ <div class="input-box">
84
+ <select name="payment[<?php echo $_code ?>_count_cofre]" id="<?php echo $_code ?>_count_cofre" class="validate-select" title="Número de Parcelas de sua Compra - Cofre" >
85
+ <option value=="1" select>Selecione as parcelas</option>
86
+ <?php $parcelas = $this->getParcelamento('parcelas'); ?>
87
+ <?php foreach ( $parcelas as $key => $value) { ?>
88
+ <?php echo $parcelas[$key]; ?>
89
+ <?php } ?>
90
+ </select>
91
+ </div>
92
+ </li>
93
+ </div>
94
+
95
+ <?php endif ?>
96
+
97
+ <div class="payment-card">
98
+ <div class="clearer">
99
+ <textarea id="id-chave-publica" class="chave-publica-moip" style="display:none !important;"><?php echo $this->getPublicKey() ?></textarea>
100
+ <input id="encrypted_value" class="encrypted_value input-text required-entry" name="payment[<?php echo $_code ?>_cc_encrypted]" type="hidden" value="" title="Os dados do cartão de crédito são inválidos.">
101
+
102
+ </div>
103
+
104
+ <li>
105
+ <div class="no-display">
106
+ <input class="<?php echo $_code ?>_cc_type" id="<?php echo $_code ?>_cc_type" type="hidden" name="payment[<?php echo $_code ?>_cc_type]" />
107
+ </div>
108
+ </li>
109
+ <li class="wide">
110
+ <ul id="<?php echo $_code ?>_cc_type">
111
+ <li class="VI">Visa</li>
112
+ <li class="MC">Mastercard</li>
113
+ <li class="AE">American Express</li>
114
+ <li class="DI ">Dinners</li>
115
+ <li class="EO">Elo</li>
116
+ <li class="HI">Hipercard</li>
117
+ <li class="HP">Hipper</li>
118
+ </ul>
119
+ </li>
120
+ <li class="fields card-number">
121
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Número do Cartão') ?></label>
122
+ <div class="input-box">
123
+ <input type="text" id="moip_cc_number" pattern="\d*" name="payment[<?php echo $_code ?>_cc_number]" data-encrypted-input="fundingInstrument[creditCard][number]" title="Número do seu Cartão de Crédito" class="required-entry input-text" placeholder="Número do Cartão" value="">
124
+ </div>
125
+ </li>
126
+
127
+ <li class="fields card-cvv">
128
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Cod. de Segurança') ?></label>
129
+ <div class="input-box">
130
+ <div class="v-fix">
131
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cc_cid]" data-encrypted-input="fundingInstrument[creditCard][cvc]" title="Código de Seguranção do Seu Cartão" class="input-text cvv required-entry" id="<?php echo $_code ?>_cc_cid" placeholder="CVV" value="">
132
+ </div>
133
+
134
+ </div>
135
+ </li>
136
+
137
+ <li class="wide">
138
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiração') ?></label>
139
+ <div class="input-box">
140
+ <div class="v-fix">
141
+ <select name="payment[<?php echo $_code ?>_cc_exp_month]" id="credito_expiracao_mes" class="validate-select" title="Mês de Vencimento do seu Cartão" data-input="fundingInstrument[creditCard][expirationMonth]">
142
+ <option value="">Mês</option>
143
+ <option value="01">01 - Janeiro</option>
144
+ <option value="02">02 - Fevereiro</option>
145
+ <option value="03">03 - Março</option>
146
+ <option value="04">04 - Abril</option>
147
+ <option value="05">05 - Maio</option>
148
+ <option value="06">06 - Junho</option>
149
+ <option value="07">07 - Julho</option>
150
+ <option value="08">08 - Agosto</option>
151
+ <option value="09">09 - Setembro</option>
152
+ <option value="10">10 - Outubro</option>
153
+ <option value="11">11 - Novembro</option>
154
+ <option value="12">12 - Dezembro</option>
155
+ </select>
156
+ </div>
157
+ <div class="v-fix">
158
+ <select name="payment[<?php echo $_code ?>_cc_exp_year]" id="credito_expiracao_ano" class="validate-select" title="Ano de Vencimento do seu Cartão" data-input="fundingInstrument[creditCard][expirationYear]">
159
+ <option value="">Ano</option>
160
+
161
+ <option value="2015">15</option>
162
+ <option value="2016">16</option>
163
+ <option value="2017">17</option>
164
+ <option value="2018">18</option>
165
+ <option value="2019">19</option>
166
+ <option value="2020">20</option>
167
+ <option value="2021">21</option>
168
+ <option value="2022">22</option>
169
+ <option value="2023">23</option>
170
+ <option value="2024">24</option>
171
+ <option value="2025">25</option>
172
+ <option value="2026">26</option>
173
+ <option value="2027">27</option>
174
+ <option value="2028">28</option>
175
+ <option value="2029">29</option>
176
+ <option value="2030">30</option>
177
+ </select>
178
+ </div>
179
+ </div>
180
+ </li>
181
+ <li class="wide">
182
+ <label for="<?php echo $_code ?>_cc_installment_count" class="required"><em>*</em><?php echo $this->__('Parcelas') ?></label>
183
+ <div class="input-box">
184
+ <select name="payment[<?php echo $_code ?>_cc_installment_count]" data-input="installmentCount" id="credito_parcelamento" class="validate-select" title="Número de Parcelas de sua Compra">
185
+ <option value="1" select>Selecione as parcelas</option>
186
+ <?php $parcelas = $this->getParcelamento('parcelas'); ?>
187
+ <?php foreach ( $parcelas as $key => $value) { ?>
188
+ <?php echo $parcelas[$key]; ?>
189
+ <?php } ?>
190
+ </select>
191
+ </div>
192
+ </li>
193
+
194
+ <li class="wide card-port">
195
+ <label for="<?php echo $_code ?>_cc_fullname" class="required"><em>*</em><?php echo $this->__('Nome do Titular Cartão') ?></label>
196
+ <div class="input-box">
197
+ <input type="text" name="payment[<?php echo $_code ?>_cc_owner]" value="<?php echo $this->getDateCard('name') ?>" class="input-text required-entry" title="Nome Impresso em seu Cartão" id="credito_portador_nome" placeholder="Nome Impresso no Cartão" data-input="fundingInstrument[creditCard][holder][fullname]">
198
+ </div>
199
+ </li>
200
+ <li class="wide card-port">
201
+ <label for="<?php echo $_code ?>_cc_taxDocument" class="required"><em>*</em><?php echo $this->__('CPF do Titular do Cartão') ?></label>
202
+ <div class="input-box">
203
+ <input type="text" name="payment[<?php echo $_code ?>_cc_taxdocument]" value="<?php echo $this->getDateCard('taxvat') ?>" class="input-text required-entry" title="CPF do Titular de seu Cartão" id="credito_portador_cpf" placeholder="CPF do Titular do Cartão" data-input="fundingInstrument[creditCard][holder][taxDocument][number]">
204
+ </div>
205
+ </li>
206
+ <li class="wide card-port">
207
+ <label for="<?php echo $_code ?>_cc_Phone" class="required"><em>*</em><?php echo $this->__('Telefone do Titular Cartão') ?></label>
208
+ <div class="input-box">
209
+ <input type="hidden" name="payment[<?php echo $_code ?>_cc_PhoneRegion]" value="55" id="credito_portador_telefone" title="Telefone do Titular do Cartão" class="input-text required-entry" placeholder="Telefone de Contato" data-input="fundingInstrument[creditCard][holder][phone][countryCode]">
210
+ <div class="v-fix">
211
+ ( <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cc_phone_code]" value="<?php echo $this->getDateCard('telephone-ddd') ?>" id="credito_portador_telefone" title="Telefone do Titular do Cartão" class="input-text ddd required-entry" placeholder="Telefone de Contato" data-input="fundingInstrument[creditCard][holder][phone][areaCode]"> )
212
+ </div>
213
+ <div class="v-fix">
214
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cc_phone_number]" value="<?php echo $this->getDateCard('telephone-number') ?>" d="credito_portador_telefone" title="Telefone do Titular do Cartão" class="input-text telefone required-entry" placeholder="Telefone de Contato" data-input="fundingInstrument[creditCard][holder][phone][number]">
215
+ </div>
216
+ </div>
217
+ </li>
218
+ <li class="wide card-port">
219
+ <label for="<?php echo $_code ?>_cc_birthdate" class="required"><em>*</em><?php echo $this->__('Data de Nascimento Titular do Cartão') ?></label>
220
+ <div class="input-box">
221
+ <div class="v-fix">
222
+ <select name="payment[<?php echo $_code ?>_cc_owner_exp_day]" class="validate-select owner_day" title="Ano de Nacimento do Titular do Catão" data-input="fundingInstrument[creditCard][holder][birthdateDay]">
223
+ <option value="<?php echo $this->getDateCard('dob-day') ?>" select><?php echo ($this->getDateCard('dob-day') ? $this->getDateCard('dob-day') : "Dia" )?></option>
224
+ <option value="01">01</option>
225
+ <option value="02">02</option>
226
+ <option value="03">03</option>
227
+ <option value="04">04</option>
228
+ <option value="05">05</option>
229
+ <option value="06">06</option>
230
+ <option value="07">07</option>
231
+ <option value="08">08</option>
232
+ <option value="09">09</option>
233
+ <option value="10">10</option>
234
+ <option value="11">11</option>
235
+ <option value="12">12</option>
236
+ <option value="13">13</option>
237
+ <option value="14">14</option>
238
+ <option value="15">15</option>
239
+ <option value="16">16</option>
240
+ <option value="17">17</option>
241
+ <option value="18">18</option>
242
+ <option value="19">19</option>
243
+ <option value="20">20</option>
244
+ <option value="21">21</option>
245
+ <option value="22">22</option>
246
+ <option value="23">23</option>
247
+ <option value="24">24</option>
248
+ <option value="25">25</option>
249
+ <option value="26">26</option>
250
+ <option value="27">27</option>
251
+ <option value="28">28</option>
252
+ <option value="29">29</option>
253
+ <option value="30">30</option>
254
+ <option value="31">31</option>
255
+ </select>
256
+ </div>
257
+ <div class="v-fix">
258
+ <select name="payment[<?php echo $_code ?>_cc_owner_exp_month]" class="validate-select owner_month" title="Ano de Nacimento do Titular do Catão" data-input="fundingInstrument[creditCard][holder][birthdateMonth]">
259
+ <option value="<?php echo $this->getDateCard('dob-month') ?>" select><?php echo ($this->getDateCard('dob-month') ? $this->getDateCard('dob-month') : "Mês" )?></option>
260
+ <option value="01">01 - Janeiro</option>
261
+ <option value="02">02 - Fevereiro</option>
262
+ <option value="03">03 - Março</option>
263
+ <option value="04">04 - Abril</option>
264
+ <option value="05">05 - Maio</option>
265
+ <option value="06">06 - Junho</option>
266
+ <option value="07">07 - Jullho</option>
267
+ <option value="08">08 - Agosto</option>
268
+ <option value="09">09 - Setembro</option>
269
+ <option value="10">10 - Outubro</option>
270
+ <option value="11">11 - Novembro</option>
271
+ <option value="12">12 - Dezembro</option>
272
+ </select>
273
+ </div>
274
+ <div class="v-fix">
275
+ <select name="payment[<?php echo $_code ?>_cc_owner_exp_year]" class="validate-select owner_year" title="Ano de Nacimento do Titular do Catão" data-input="fundingInstrument[creditCard][holder][birthdateYear]">
276
+ <option value="<?php echo $this->getDateCard('dob-year') ?>" select><?php echo ($this->getDateCard('dob-year') ? $this->getDateCard('dob-year') : "Ano" )?></option>
277
+ <option value="1935">1935</option>
278
+ <option value="1936">1936</option>
279
+ <option value="1937">1937</option>
280
+ <option value="1938">1938</option>
281
+ <option value="1939">1939</option>
282
+ <option value="1940">1940</option>
283
+ <option value="1941">1941</option>
284
+ <option value="1942">1942</option>
285
+ <option value="1943">1943</option>
286
+ <option value="1944">1944</option>
287
+ <option value="1945">1945</option>
288
+ <option value="1946">1946</option>
289
+ <option value="1947">1947</option>
290
+ <option value="1948">1948</option>
291
+ <option value="1949">1949</option>
292
+ <option value="1950">1950</option>
293
+ <option value="1951">1951</option>
294
+ <option value="1952">1952</option>
295
+ <option value="1953">1953</option>
296
+ <option value="1954">1954</option>
297
+ <option value="1955">1955</option>
298
+ <option value="1956">1956</option>
299
+ <option value="1957">1957</option>
300
+ <option value="1958">1958</option>
301
+ <option value="1959">1959</option>
302
+ <option value="1960">1960</option>
303
+ <option value="1961">1961</option>
304
+ <option value="1962">1962</option>
305
+ <option value="1963">1963</option>
306
+ <option value="1964">1964</option>
307
+ <option value="1965">1965</option>
308
+ <option value="1966">1966</option>
309
+ <option value="1967">1967</option>
310
+ <option value="1968">1968</option>
311
+ <option value="1969">1969</option>
312
+ <option value="1970">1970</option>
313
+ <option value="1971">1971</option>
314
+ <option value="1972">1972</option>
315
+ <option value="1973">1973</option>
316
+ <option value="1974">1974</option>
317
+ <option value="1975">1975</option>
318
+ <option value="1976">1976</option>
319
+ <option value="1977">1977</option>
320
+ <option value="1978">1978</option>
321
+ <option value="1979">1979</option>
322
+ <option value="1980">1980</option>
323
+ <option value="1981">1981</option>
324
+ <option value="1982">1982</option>
325
+ <option value="1983">1983</option>
326
+ <option value="1984">1984</option>
327
+ <option value="1985">1985</option>
328
+ <option value="1986">1986</option>
329
+ <option value="1987">1987</option>
330
+ <option value="1988">1988</option>
331
+ <option value="1989">1989</option>
332
+ <option value="1990">1990</option>
333
+ <option value="1991">1991</option>
334
+ <option value="1992">1992</option>
335
+ <option value="1993">1993</option>
336
+ <option value="1994">1994</option>
337
+ <option value="1995">1995</option>
338
+ <option value="1996">1996</option>
339
+ <option value="1997">1997</option>
340
+ <option value="1998">1998</option>
341
+ <option value="1999">1999</option>
342
+ <option value="2000">2000</option>
343
+ <option value="2001">2001</option>
344
+ <option value="2002">2002</option>
345
+ <option value="2003">2003</option>
346
+ <option value="2004">2004</option>
347
+ <option value="2005">2005</option>
348
+ <option value="2006">2006</option>
349
+ <option value="2007">2007</option>
350
+ <option value="2008">2008</option>
351
+ <option value="2009">2009</option>
352
+ <option value="2010">2010</option>
353
+ <option value="2011">2011</option>
354
+ <option value="2012">2012</option>
355
+ <option value="2013">2013</option>
356
+ <option value="2014">2014</option>
357
+ </select>
358
+ </div>
359
+ </div>
360
+ </li>
361
+ <li class="wide">
362
+ <label>
363
+ <input type="checkbox" name="titular-card" title="Salvar este endereço" value="1" class="titular-card validate-number input-checkbox" checked="checked"> Eu sou o Titular do Cartão</label>
364
+ </li>
365
+ </div>
366
+ <?php if($cofre != "false"): ?>
367
+ <div class="clearer">
368
+ <li class="wide">
369
+ <label>
370
+ <input type="checkbox" name="payment[<?php echo $_code ?>_payment_in_cofre]" title="Usar um novo cartão?" value="0" class="new-card validate-number input-checkbox"> Usar outro Cartão não listado?
371
+ </label>
372
+ </li>
373
+ </div>
374
+ <?php else: ?>
375
+ <input type="hidden" name="payment[<?php echo $_code ?>_payment_in_cofre]" title="Usar um novo cartão?" value="1" class="new-card validate-number input-checkbox">
376
+ <?php endif; ?>
377
+ </div>
378
+
379
+ <div role="tabpanel" class="tab-pane fade" id="BoletoBancario" >
380
+ <h3>Boleto Bancário</h3>
381
+
382
+ <div class="recommendation">
383
+ <ul class="checkout-info-boleto">
384
+ <li class="checkout-info-item"><p class="checkout-info-text">Pagamento somente à vista.</p></li>
385
+ <li class="checkout-info-item"><p class="checkout-info-text">O boleto vence em 3 dias úteis.</p></li>
386
+ <li class="checkout-info-item"><p class="checkout-info-text">É necessário imprimir o boleto ou utilizar o código de barras do mesmo para fazer o pagamento.</p></li>
387
+ <li class="checkout-info-item"><p class="checkout-info-text">Imprima o boleto após a finalização da compra.</p></li>
388
+ <li class="checkout-info-item"><p class="checkout-info-text">O boleto não será enviado para o seu endereço físico</p></li>
389
+ </ul>
390
+ </div>
391
+ </div>
392
+
393
+ <div role="tabpanel" class="tab-pane fade" id="DebitoBancario" >
394
+ <h3>Transferência Online</h3>
395
+ <ul>
396
+ <li>
397
+ <label for="<?php echo $_code ?>_banknumber" class="required"><em>*</em><?php echo $this->__('Banco para Transferência On-line') ?></label>
398
+ <div class="input-box">
399
+ <select name="payment[<?php echo $_code ?>_banknumber]" class="input-box" id="bamk-of-tef" title="Banco Para Transferência">
400
+ <option value="" select>Selecione o seu banco.</option>
401
+ <option value="001">Banco do Brasil</option>
402
+ <option value="237">Brandesco</option>
403
+ <option value="341">Itaú</option>
404
+ <option value="041">Banrisul</option>
405
+ </select>
406
+ </div>
407
+ </li>
408
+ </ul>
409
+ <div class="recommendation">
410
+ <ul class="checkout-info-boleto">
411
+ <li class="checkout-info-item"><p class="checkout-info-text">É Obrigatório ter o TOKEN do banco em mãos.</p></li>
412
+ <li class="checkout-info-item"><p class="checkout-info-text">Pagamento somente à vista.</p></li>
413
+ </ul>
414
+ </div>
415
+ </div>
416
+
417
+ </div>
418
+
419
+
420
+
421
+ </ul>
422
+ <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
423
+ <script type="text/javascript" src="https://assets.moip.com.br/integration/moip.min.js"></script>
424
+ <script type="text/javascript">
425
+ //<![CDATA[
426
+
427
+ $j(document).ready(function(){
428
+
429
+ MoipPagamentos();
430
+ });
431
+
432
+ //]]>
433
+ </script>
app/design/adminhtml/default/default/template/MOIP/transparente/info.phtml CHANGED
@@ -1,68 +1,76 @@
1
  <?php
 
2
  if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
3
  ?>
4
  <?php $info = $this->_prepareInfo(); ?>
5
- <?php if($info['result_meio'] == "Cartão de Crédito"): ?>
6
- <div class="cartao" style="width:100%">
7
- <h4>Pago em <?php echo $info['creditcard_parc']; ?> parcelas via:</h4>
8
- </div>
9
- <div class="cartao" style="width:100%">
10
- <div class="image" style="width:30%; float:left;">
11
- <?php $imagem = $info['image']; ?>
12
- <div class="image" style="padding:5px"><img src="<?php echo $imagem; ?>"></div>
13
- </div>
14
- <div class="dados" style="width:70%; float:left">
15
- <label>6 Primeiros dígitos do cartão</label>
16
- <div class="input-text"><strong><?php echo $info['first6'] ?></strong></div>
17
- <label>4 Últimos dígitos do cartão</label>
18
- <div class="input-text"><strong><?php echo $info['last4'] ?></strong></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </div>
20
- </div>
21
  <?php endif ?>
22
 
 
 
 
 
 
 
 
23
 
24
- <?php if($info['result_meio'] == "Boleto Bancário"): ?>
25
- <div class="metodo title"><h3><?php echo $info['result_meio'] ?></h3></div>
26
- <div style="clear:both; width:100%;">
27
- <div style="clear:both;width:100%"><a class="button btn-checkout btn-default scalable" title="Finalizar compra" href="<?php echo $info['url'] ?>">Ver boleto</a></div>
28
- </div></br>
29
- <div class="boleto_line_title"><h4>Ou Cópie o endereço:</h4></div>
30
- <div class="boleto_line"><input type="text" class="input-text" value="<?php echo $info['url'] ?>" readonly="true" style="width:350px"></div>
31
  <?php endif ?>
32
 
 
 
 
33
 
34
 
35
- <?php if($info['result_meio'] == "Transferência Bancária"): ?>
36
- <div class="metodo title"><h3><?php echo $info['result_meio'] ?></h3></div>
37
- <div class="trans" style="width:100%">
38
- <div style="clear:both;width:100%"><a class="button btn-checkout btn-default scalable" title="Finalizar compra" href="<?php echo $info['url'] ?>">Ir Ao banco</a></div>
39
- <div class="boleto_line_title" style="clear:both;width:100%"><h4>Ou Cole a Url na Barra do Navegador:</h4></div>
40
- <div class="boleto_line" style="clear:both;width:100%"><input type="text" class="input-text" value="<?php echo $info['url'] ?>" readonly="true" style="width:350px"></div>
41
  </div>
42
  <?php endif ?>
43
 
44
 
45
- <?php } if(Mage::app()->getRequest()->getModuleName() == "onestepcheckout" || Mage::app()->getRequest()->getModuleName() == "checkout" ) { ?>
46
 
47
- <?php echo "Pagamento via Moip Pagamentos S/A" ?>
 
 
 
 
 
 
48
 
49
- <?php } if(Mage::app()->getRequest()->getModuleName() == "sales"): ?>
50
- <?php
51
- $order = Mage::getModel('sales/order')->load($info['realorder_id'], 'increment_id');
52
- $states = $order->getStatus();
53
- if($states == "pending" || $order->isCanceled()){
54
- $api = $this->getTransparente();
55
- $resposta_transparente = $info['token'];
56
- if (Mage::getSingleton('transparente/standard')->getConfigData('ambiente') == "teste") {
57
- $url = "https://desenvolvedor.moip.com.br/sandbox/Instrucao.do?token=";
58
- $urljs = "https://desenvolvedor.moip.com.br/sandbox/";
59
- }
60
- else {
61
- $url = "https://www.moip.com.br/Instrucao.do?token=";
62
- $urljs = "https://www.moip.com.br/";
63
- }
64
- ?>
65
 
66
- <?php
67
- }
68
- endif; ?>
1
  <?php
2
+ /* Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId(); */
3
  if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
4
  ?>
5
  <?php $info = $this->_prepareInfo(); ?>
6
+ <?php $meio = $info['forma_pagamento'];?>
7
+
8
+ <?php if($meio == "CartaoCredito"): ?>
9
+
10
+
11
+ <div class="box-content">
12
+ <h3><?php echo $info['moip_card_brand']; ?> <b><?php echo $info['moip_card_installment']; ?><b> parcelas</h3>
13
+ <div class="input-value">
14
+ <?php echo $info['moip_card_fullname'] ?>
15
+ </div>
16
+
17
+ <div class="input-value">
18
+ <label>6 Primeiros dígitos do cartão</label>
19
+ <?php echo $info['moip_card_first6'] ?>
20
+ </div>
21
+
22
+ <div class="input-value">
23
+ <label>4 Últimos dígitos do cartão</label>
24
+ <?php echo $info['moip_card_last4'] ?>
25
+ </div>
26
+
27
+
28
+ <div class="input-value">
29
+ <label>Data de Nascimento do Titular</label>
30
+ <?php echo $info['moip_card_birthdate'] ?>
31
+ </div>
32
+
33
+ <div class="input-value">
34
+ <label>Pagamento n.º</label>
35
+ <?php echo $info['moip_pay'] ?>
36
+ </div>
37
+
38
  </div>
39
+
40
  <?php endif ?>
41
 
42
+ <?php if($meio == "BoletoBancario"): ?>
43
+ <div class="box-content">
44
+ <p>Boleto Bancário</p>
45
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_boleto'] ?>" target="_blank">Imprimir Boleto</a></p>
46
+ <p>Código de Barras</p>
47
+ <p><input type="text" value="<?php echo $info['moip_linecode_boleto'] ?>" readonly="disable"></p>
48
+ <p>Vencimento: <?php echo date('d-m-Y', strtotime($info['moip_expiration_boleto'])) ?></p>
49
 
50
+ </div>
 
 
 
 
 
 
51
  <?php endif ?>
52
 
53
+ <?php if($meio == "DebitoBancario"): ?>
54
+ <p>Transferência Bancária</p>
55
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_trans'] ?>" target="_blank">Ir Ao banco</a></p>
56
 
57
 
 
 
 
 
 
 
58
  </div>
59
  <?php endif ?>
60
 
61
 
62
+ <?php } else { ?>
63
 
64
+ <?php $addtional = $this->getMethod()->getInfoInstance()->getAdditionalData();?>
65
+ <?php $addtional = unserialize($addtional); ?>
66
+ <?php if($addtional['formapagamento_moip'] == "CartaoCredito"): ?>
67
+ <?php echo Mage::helper('transparente')->__('Nome Impresso no cartão: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
68
+ <?php echo Mage::helper('transparente')->__('Bandeira: %s', $this->htmlEscape($this->getNomeBrand($this->getInfo()->getCcType()))) ?><br/>
69
+ <?php echo Mage::helper('transparente')->__('Número do cartão: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
70
+ <?php echo Mage::helper('transparente')->__('Vencimento do cartão: %s/%s', $this->htmlEscape($this->getInfo()->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?><br/>
71
 
72
+ <?php else: ?>
73
+ <?php echo $addtional['formapagamento_moip'] ?>
74
+ <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
+ <?php } ?>
 
 
app/design/adminhtml/default/default/template/MOIP/transparente/info/admin.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $info = $this->_prepareInfo(); ?>
2
+
3
+ <div class="box-content">
4
+ <p>Pedido Realizado via admin para pagar escolha os métodos abaixo</p>
5
+ <p>Para Pagar por Cartão de Crédito:</p>
6
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['link_cc'] ?>" target="_blank" style="
7
+ max-width: 200px;">Pagar Por Cartão</a></p>
8
+ <p>Para Pagar por Boleto</p>
9
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['link_boleto'] ?>" target="_blank" style="
10
+ max-width: 200px;">Pagar Por Boleto</a></p>
11
+
12
+ </div>
app/design/adminhtml/default/default/template/MOIP/transparente/info/boleto.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId(); */
3
+ if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
4
+ ?>
5
+ <?php $info = $this->_prepareInfo(); ?>
6
+
7
+ <div class="box-content">
8
+ <p><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?></p>
9
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_boleto'] ?>" target="_blank" style="
10
+ max-width: 200px;">Imprimir Boleto</a></p>
11
+ <p>Código de Barras</p>
12
+ <p><input type="text" value="<?php echo $info['moip_linecode_boleto'] ?>" readonly="disable" style="
13
+ max-width: 200px; white-space: nowrap;
14
+ overflow: hidden;
15
+ text-overflow: ellipsis;"></p>
16
+ <p>Vencimento: <?php echo date('d-m-Y', strtotime($info['moip_expiration_boleto'])) ?></p>
17
+
18
+ </div>
19
+
20
+
21
+ <?php } else { ?>
22
+ <?php echo $addtional['formapagamento_moip'] ?>
23
+ <?php } ?>
app/design/adminhtml/default/default/template/MOIP/transparente/info/cc.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId(); */
3
+
4
+ if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
5
+ ?>
6
+ <?php $info = $this->_prepareInfo(); ?>
7
+
8
+ <?php echo $info['moip_card_brand']; ?> <?php echo $info['moip_card_installment']; ?> parcelas
9
+ <br/>
10
+ <?php echo $info['moip_card_fullname'] ?>
11
+ <br/>
12
+ 6 Primeiros dígitos do cartão: <?php echo $info['moip_card_first6'] ?><br/>
13
+
14
+
15
+ 4 Últimos dígitos do cartão: <?php echo $info['moip_card_last4'] ?><br/>
16
+
17
+
18
+
19
+ Pagamento n.º: <?php echo $info['moip_pay'] ?><br/>
20
+
21
+
22
+
23
+
24
+
25
+
26
+ <?php } else { ?>
27
+
28
+ <?php $addtional = $this->getMethod()->getInfoInstance()->getAdditionalData();?>
29
+ <?php $addtional = unserialize($addtional); ?>
30
+
31
+ <?php echo Mage::helper('transparente')->__('Nome Impresso no cartão: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
32
+ <?php echo Mage::helper('transparente')->__('Bandeira: %s', $this->htmlEscape($this->getInfo()->getCcType())) ?><br/>
33
+ <?php echo Mage::helper('transparente')->__('Número do cartão: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
34
+ <?php echo Mage::helper('transparente')->__('Vencimento do cartão: %s/%s', $this->htmlEscape($this->getInfo()->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?><br/>
35
+ <?php } ?>
app/design/adminhtml/default/default/template/MOIP/transparente/info/tef.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId(); */
3
+ if(Mage::app()->getRequest()->getModuleName() != "onestepcheckout" && Mage::app()->getRequest()->getModuleName() != "checkout"){
4
+ ?>
5
+ <?php $info = $this->_prepareInfo(); ?>
6
+ <div class="box-content">
7
+ <p><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?></p>
8
+ <p><a class="button btn-checkout btn-default" title="Finalizar compra" href="<?php echo $info['moip_href_trans'] ?>" target="_blank">Ir Ao banco</a></p>
9
+ </div>
10
+
11
+
12
+
13
+ <?php } else { ?>
14
+
15
+ <p><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?></p>
16
+
17
+ <?php } ?>
app/design/adminhtml/default/default/template/MOIP/transparente/redirect.phtml CHANGED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <div class="grid12-12">
2
+ <?php
3
+ echo $this->getChildTemplate();
4
+ ?>
5
+ </div>
6
+
7
+
8
+
app/design/adminhtml/default/default/template/MOIP/transparente/redirect/boleto.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setDataMoip(); ?>
2
+
3
+ <?php $url_boleto = $this->getBoletoLinks().'/print'; ?>
4
+
5
+ <div class="method-type-payment grid12-12">
6
+ <h3><?php echo $this->__('Quase lá! Agora só falta pagar o boleto.') ?></h3>
7
+ </div>
8
+ <div class="method-type-action grid12-12">
9
+ <div class="grid12-6">
10
+ <h3><?php echo $this->__('Código de Barra') ?></h3>
11
+ <div>
12
+
13
+ <div class="input-box">
14
+ <input type="text" name="codigo-barra" id="bar-code" value="<?php echo $this->getBoletoCode() ?>" title="Código de Barra" class="input-text required-entry">
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <div class="grid12-6">
19
+ <h3><?php echo $this->__('Visualizar Boleto') ?></h3>
20
+ <button class="button btn-checkout" data-toggle="modal" data-target="#largeModal" ><span><span><i class="fa fa-print"></i> Visualizar Boleto</span></span></button>
21
+ </div>
22
+
23
+
24
+
25
+ </div>
26
+
27
+ <script type="text/javascript">
28
+ //<![CDATA[
29
+ jQuery('body').append('<div class="modal fade animated" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="largeModal" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Boleto Bancário</h4> </div> <div class="modal-body"> <iframe width="800" onload="this.height=screen.height;" scrolling= "no" frameBorder="0" allowtransparency="true" src="<?php echo $url_boleto ?>"> </iframe> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button> </div> </div> </div> </div>');
30
+ jQuery('#largeModal').modal('toggle');
31
+ //]]>
32
+ </script>
33
+
34
+
35
+
app/design/adminhtml/default/default/template/MOIP/transparente/redirect/cartao.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setDataMoip(); ?>
2
+ <?php $status = $this->getCardStatus(); ?>
3
+
4
+
5
+ <?php if($status == "CANCELLED"): ?>
6
+ <div class="method-type-payment grid12-12">
7
+ <h2><?php echo $this->__('Pagamento Cancelado') ?></h2>
8
+ </div>
9
+ <div class="method-type-action grid12-12">
10
+ <ul class="messages"><li class="error-msg"><ul><li><span><?php echo $this->__('O pagamento não pode ser realizado com sucesso por favor escolha outro método de pagamento.') ?></span></li></ul></li></ul>
11
+ </div>
12
+ <?php elseif($status == "IN_ANALYSIS"): ?>
13
+ <div class="method-type-payment grid12-12">
14
+ <h2><?php echo $this->__('Pagamento em análise') ?></h2>
15
+ </div>
16
+ <div class="method-type-action grid12-12">
17
+ <p><?php echo $this->__('Seu pagamento foi encaminhado para a análise, por favor aguarde a atualização automática do pedido.') ?></p>
18
+ </div>
19
+ <?php elseif($status == "AUTHORIZED"): ?>
20
+ <div class="method-type-payment grid12-12">
21
+ <h2><?php echo $this->__('Pagamento Aprovado') ?></h2>
22
+ </div>
23
+ <div class="method-type-action grid12-12">
24
+ <p><?php echo $this->__('Seu pagamento foi aprovado.') ?></p>
25
+ </div>
26
+ <?php elseif($status == "WAITING"): ?>
27
+ <div class="method-type-payment grid12-12">
28
+ <h2><?php echo $this->__('Pagamento em análise') ?></h2>
29
+ </div>
30
+ <div class="method-type-action grid12-12">
31
+ <p><?php echo $this->__('Seu pagamento foi encaminhado para a análise, por favor aguarde a atualização automática do pedido.') ?></p>
32
+ </div>
33
+ <?php else: ?>
34
+ <div class="method-type-payment grid12-12">
35
+ <h2><?php echo $this->__('Desculpe, houve um erro em nosso sistema') ?></h2>
36
+ </div>
37
+ <div class="method-type-action grid12-12">
38
+ <ul class="messages"><li class="error-msg"><ul><li><span><?php echo $this->__('Não conseguimos identificar o status de seu pagamento, por favor entre em contato com nossa equipe de atendimento antes de realizar uma nova transação.') ?></span></li></ul></li></ul>
39
+ </div>
40
+ <?php endif; ?>
app/design/{frontend/base/default/template/MOIP/transparente → adminhtml/default/default/template/MOIP/transparente/redirect}/layout_boleto.phtml RENAMED
File without changes
app/design/adminhtml/default/default/template/MOIP/transparente/redirect/transferencia.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setDataMoip(); ?>
2
+ <?php $href = $this->getDebitLinks(); ?>
3
+ <div class="method-type-payment grid12-12">
4
+ <h3>Quase lá! Por favor conclua a transação em seu banco.</h3>
5
+ </div>
6
+ <div class="method-type-action grid12-12">
7
+ <p>Você será redirecionado para o seu banco em <strong><span id="count">10</span>s</strong>, para concluir o pagamento</p>
8
+ <button type="button" title="Finalizar compra" class="button btn-checkout" onclick="window.location='<?php echo $href ?>'"><span><span>Ir ao Banco <i class="fa fa-arrow-right"></i></span></span></button>
9
+ </div>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ jQuery(document).ready(function(){
13
+ var counter = 10;
14
+ setInterval(function() {
15
+ counter--;
16
+ if(counter < 0) {
17
+ window.location = '<?php echo $href ?>';
18
+ } else {
19
+ document.getElementById("count").innerHTML = counter;
20
+ }
21
+ }, 1000);
22
+ });
23
+ //]]>
24
+ </script>
app/design/adminhtml/default/default/template/MOIP/transparente/script.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ $j(document).ready(function(){
4
+ MoipPagamentos();
5
+ });
6
+
7
+ //]]>
8
+ </script>
app/design/adminhtml/default/default/template/MOIP/transparente/transferencia.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setDataMoip(); ?>
2
+ <?php $href = $this->getDebitLinks(); ?>
3
+ <div class="method-type-payment grid12-12">
4
+ <h3>Quase lá! Agora só falta pagar o boleto.</h3>
5
+ </div>
6
+ <div class="method-type-action grid12-12">
7
+ <p>Você será redirecionado para o seu banco em <strong><span id="count">10</span>s</strong>, para concluir o pagamento</p>
8
+ <button type="button" title="Finalizar compra" class="button btn-checkout" onclick="window.location='<?php echo $href ?>'"><span><span>Ir ao Banco <i class="fa fa-arrow-right"></i></span></span></button>
9
+ </div>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ jQuery(document).ready(function(){
13
+ var counter = 10;
14
+ setInterval(function() {
15
+ counter--;
16
+ if(counter < 0) {
17
+ window.location = '<?php echo $href ?>';
18
+ } else {
19
+ document.getElementById("count").innerHTML = counter;
20
+ }
21
+ }, 1000);
22
+ });
23
+ //]]>
24
+ </script>
app/design/frontend/base/default/layout/moip_onestepcheckout.xml CHANGED
@@ -1,39 +1,131 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
- <checkout_onepage_index>
 
 
 
 
 
 
 
 
 
 
4
  <reference name="head">
5
 
6
- <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/jquery.js</script></action>
7
- <action method="addJs"><script>MOIP/jquery_noconflict.js</script></action>
8
- <action method="addJs"><script>MOIP/onestepcheckout/change-events.js</script></action>
9
  <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
10
- <action method="addJs"><script>MOIP/script_mask.js</script></action>
11
- <action method="addJs"><script>MOIP/validacao.js</script></action>
12
- <action method="addJs"><script>varien/accordion.js</script></action>
13
- <action method="addJs"><script>MOIP/bootstrap-modal.js</script></action>
14
  <action method="addItem"><type>skin_js</type><name>js/opcheckout.js</name></action>
 
15
  <action method="addCss"><stylesheet>MOIP/onestepcheckout/css/onestepcheckout.css</stylesheet></action>
16
- <action method="addCss"><stylesheet>MOIP/onestepcheckout/css/bootstrap-modal.css</stylesheet></action>
17
- <!--block type="page/html_head" output="toHtml" name="onepage_js" template="MOIP/onestepcheckout/onepage.phtml" /-->
18
- <!-- estes são exemplos de como remover outros js do site
19
- use o <type>skin_js</type> se o js estiver na pasta skin
20
- <action method="removeItem"><type>skin_js</type><name>js/jquery.js</name></action>
21
- ou use <type>js</type> caso o js da pasta pasta_da_loja/js
22
- <action method="removeItem"><type>js</type><name>plugins/jquery.flexslider-min.js</name></action>
23
- -->
 
 
 
 
 
 
 
 
 
 
 
24
  </reference>
25
- <reference name="checkout.onepage">
26
- <action method="setTemplate">
27
- <template>MOIP/onestepcheckout/onepage.phtml</template>
28
- </action>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  </reference>
 
 
30
  <reference name="root">
31
  <remove name="right"/>
32
  <remove name="left"/>
33
- <action method="setTemplate"><template>page/1column.phtml</template></action>
 
34
  </reference>
35
- <reference name="content">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  <block type="core/template" name="onestepcheckout.daskboard" as="daskboard" template="MOIP/onestepcheckout/daskboard.phtml">
 
 
 
 
 
 
 
 
37
  <block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="MOIP/onestepcheckout/daskboard/onepage/login.phtml"/>
38
  <block type="customer/account_forgotpassword" name="checkout.onepage.forgotpassword" as="forgotpassword" template="MOIP/onestepcheckout/daskboard/onepage/forgotpassword.phtml"/>
39
 
@@ -44,7 +136,7 @@
44
 
45
  <block type="checkout/cart_coupon" name="checkout.onepage.coupon" as="coupon" template="MOIP/onestepcheckout/daskboard/onepage/coupon.phtml"/>
46
 
47
- <block type="checkout/onepage_shipping_method_additional" name="onestepcheckout.onepage.shipping_method.additional" as="additional" template="MOIP/onestepcheckout/daskboard/onepage/review/options/additional.phtml"/>
48
 
49
  <block type="onestepcheckout/checkout_onepage_review_options" name="checkout.onepage.review.options" as="options" template="MOIP/onestepcheckout/daskboard/onepage/review/options.phtml">
50
 
@@ -74,9 +166,15 @@
74
  <label>Items After</label>
75
  </block>
76
  </block>
77
- </block>
78
  </block>
79
  </reference>
 
 
 
 
 
 
80
  </checkout_onepage_index>
81
 
82
  <onestepcheckout_index_updateshippingmethod>
@@ -151,7 +249,7 @@
151
 
152
  <onestepcheckout_index_updateshippingtype>
153
  <remove name="right"/>
154
- <remove name="left"/>
155
  <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="MOIP/onestepcheckout/daskboard/onepage/shipping_method/available.phtml"/>
156
  </onestepcheckout_index_updateshippingtype>
157
 
@@ -166,9 +264,14 @@
166
  <remove name="left"/>
167
  <block type="MOIP_Onestepcheckout_Block_Checkout_Onepage_Billing" name="root" output="toHtml" as="billing_form" template="MOIP/onestepcheckout/daskboard/onepage/billing/billingform.phtml"/>
168
  </onestepcheckout_index_updatebillingform>
 
 
 
 
169
 
 
170
 
171
-
172
  <onestepcheckout_index_updateshippingform>
173
  <reference name="root">
174
  <action method="setTemplate"><template>MOIP/onestepcheckout/emptyupdate.phtml</template></action>
@@ -177,5 +280,5 @@
177
  <block type="onestepcheckout/checkout_onepage_shipping" name="checkout.onepage.shipping.shippingform" as="shipping_form" template="MOIP/onestepcheckout/daskboard/onepage/shipping/shipping_form.phtml"/>
178
  </reference>
179
  </onestepcheckout_index_updateshippingform>
180
-
181
  </layout>
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
+ <checkout_cart_index>
4
+ <reference name="head">
5
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
6
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
7
+ <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
8
+ </reference>
9
+ </checkout_cart_index>
10
+ <checkout_onepage_cadastro>
11
+ <reference name="root">
12
+ <action method="setTemplate"><template>MOIP/onestepcheckout/page/1column.phtml</template></action>
13
+ </reference>
14
  <reference name="head">
15
 
16
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
17
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
 
18
  <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
19
+ <action method="addJs"><script>MOIP/onestepcheckout/change-events.js</script></action>
 
 
 
20
  <action method="addItem"><type>skin_js</type><name>js/opcheckout.js</name></action>
21
+
22
  <action method="addCss"><stylesheet>MOIP/onestepcheckout/css/onestepcheckout.css</stylesheet></action>
23
+
24
+ <block type="core/text" name="moip.bootstrap" >
25
+ <action method="setText" ifconfig="moipall/config/enable_bootstrap">
26
+ <text>
27
+ <![CDATA[
28
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
29
+ <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
30
+ ]]>
31
+ </text>
32
+ </action>
33
+ </block>
34
+ <block type="core/template" name="onepage_js" template="MOIP/onestepcheckout/cadastro/onepagejs.phtml" />
35
+
36
+ <!-- estes são exemplos de como remover outros js do site
37
+ use o <type>skin_js</type> se o js estiver na pasta skin
38
+ <action method="removeItem"><type>skin_js</type><name>js/jquery.js</name></action>
39
+ ou use <type>js</type> caso o js da pasta pasta_da_loja/js
40
+ <action method="removeItem"><type>js</type><name>plugins/jquery.flexslider-min.js</name></action>
41
+ -->
42
  </reference>
43
+ <reference name="header">
44
+ <action method="setTemplate">
45
+ <template>MOIP/onestepcheckout/page/single-header.phtml</template>
46
+ </action>
47
+ <block type="core/template" name="progresso" as="progresso" template="MOIP/onestepcheckout/progresso.phtml" />
48
+ </reference>
49
+ <reference name="content" >
50
+ <block type="core/template" name="onestepcheckout.daskboard" as="daskboard" template="MOIP/onestepcheckout/cadastro/CreateAccount.phtml">
51
+ <block type="checkout/cart_coupon" name="checkout.onepage.coupon" as="coupon" template="MOIP/onestepcheckout/daskboard/onepage/coupon.phtml"/>
52
+ <block type="checkout/onepage_login" name="checkout.onepage.login" as="login-pre" template="MOIP/onestepcheckout/cadastro/logged/login-pre.phtml"/>
53
+ <block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="MOIP/onestepcheckout/daskboard/onepage/login.phtml"/>
54
+ <block type="customer/account_forgotpassword" name="forgotpassword" as="forgotpassword" template="MOIP/onestepcheckout/cadastro/logged/forgotpassword.phtml"/>
55
+ <block type="onestepcheckout/checkout_onepage_billing" name="checkout.onepage.billing" as="billing" template="MOIP/onestepcheckout/cadastro/billing.phtml">
56
+ <block type="onestepcheckout/checkout_onepage_billing" name="checkout.onepage.billing.billingform" as="billing_form" template="MOIP/onestepcheckout/cadastro/billing/billingform.phtml"/>
57
+ </block>
58
+ <block type="checkout/onepage_review" name="checkout.onepage.review" as="review" template="MOIP/onestepcheckout/daskboard/onepage/review.phtml">
59
+ <block type="checkout/onepage_review_info" name="info" template="MOIP/onestepcheckout/daskboard/onepage/review/info.phtml">
60
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>MOIP/onestepcheckout/daskboard/onepage/review/item.phtml</template></action>
61
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>MOIP/onestepcheckout/daskboard/onepage/review/item.phtml</template></action>
62
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>MOIP/onestepcheckout/daskboard/onepage/review/item.phtml</template></action>
63
+ <action method="addItemRender"><type>bundle</type><block>bundle/checkout_cart_item_renderer</block><template>MOIP/onestepcheckout/daskboard/onepage/review/item.phtml</template></action>
64
+ <block type="core/text_list" name="checkout.onepage.review.info.items.before" as="items_before"/>
65
+ <block type="checkout/cart_totals" name="totals" template="MOIP/onestepcheckout/daskboard/onepage/review/totals.phtml" />
66
+ <block type="core/text_list" name="checkout.onepage.review.info.items.before" as="items_before" translate="label">
67
+ <label>Items Before</label>
68
+ </block>
69
+ <block type="core/text_list" name="checkout.onepage.review.info.items.after" as="items_after" translate="label">
70
+ <label>Items After</label>
71
+ </block>
72
+ </block>
73
+ </block>
74
+ </block>
75
  </reference>
76
+ </checkout_onepage_cadastro>
77
+ <checkout_onepage_index>
78
  <reference name="root">
79
  <remove name="right"/>
80
  <remove name="left"/>
81
+ <remove name="checkout.onepage"/>
82
+ <action method="setTemplate"><template>MOIP/onestepcheckout/page/1column.phtml</template></action>
83
  </reference>
84
+
85
+ <reference name="head">
86
+
87
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
88
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
89
+ <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
90
+ <action method="addJs"><script>MOIP/onestepcheckout/change-events.js</script></action>
91
+ <action method="addItem"><type>skin_js</type><name>js/opcheckout.js</name></action>
92
+ <action method="addCss"><stylesheet>MOIP/onestepcheckout/css/onestepcheckout.css</stylesheet></action>
93
+ <block type="core/text" name="moip.bootstrap" >
94
+ <action method="setText" ifconfig="moipall/config/enable_bootstrap">
95
+ <text>
96
+ <![CDATA[
97
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
98
+ <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
99
+ ]]>
100
+ </text>
101
+ </action>
102
+ </block>
103
+ <block type="core/template" name="onepage_js" template="MOIP/onestepcheckout/onepagejs.phtml" />
104
+
105
+ <!-- estes são exemplos de como remover outros js do site
106
+ use o <type>skin_js</type> se o js estiver na pasta skin
107
+ <action method="removeItem"><type>skin_js</type><name>js/jquery.js</name></action>
108
+ ou use <type>js</type> caso o js da pasta pasta_da_loja/js
109
+ <action method="removeItem"><type>js</type><name>plugins/jquery.flexslider-min.js</name></action>
110
+ -->
111
+ </reference>
112
+ <reference name="header">
113
+ <action method="setTemplate">
114
+ <template>MOIP/onestepcheckout/page/single-header.phtml</template>
115
+ </action>
116
+ <block type="core/template" name="progresso" as="progresso" template="MOIP/onestepcheckout/progresso.phtml" />
117
+ </reference>
118
+
119
+ <reference name="content" >
120
  <block type="core/template" name="onestepcheckout.daskboard" as="daskboard" template="MOIP/onestepcheckout/daskboard.phtml">
121
+ <block type="checkout/onepage_review" name="checkout.onepage.review.simple" as="review.simple" template="MOIP/onestepcheckout/daskboard/onepage/review.phtml">
122
+ <block type="checkout/onepage_review_info" name="info" template="MOIP/onestepcheckout/daskboard/onepage/review/info_simple.phtml">
123
+ <block type="checkout/cart_totals" name="totals" template="MOIP/onestepcheckout/daskboard/onepage/review/totals_simple.phtml" />
124
+ <block type="core/text_list" name="checkout.onepage.review.info.items.before" as="items_before" translate="label">
125
+ <label>Items Before</label>
126
+ </block>
127
+ </block>
128
+ </block>
129
  <block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="MOIP/onestepcheckout/daskboard/onepage/login.phtml"/>
130
  <block type="customer/account_forgotpassword" name="checkout.onepage.forgotpassword" as="forgotpassword" template="MOIP/onestepcheckout/daskboard/onepage/forgotpassword.phtml"/>
131
 
136
 
137
  <block type="checkout/cart_coupon" name="checkout.onepage.coupon" as="coupon" template="MOIP/onestepcheckout/daskboard/onepage/coupon.phtml"/>
138
 
139
+ <block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="checkout/onepage/shipping_method/additional.phtml"/>
140
 
141
  <block type="onestepcheckout/checkout_onepage_review_options" name="checkout.onepage.review.options" as="options" template="MOIP/onestepcheckout/daskboard/onepage/review/options.phtml">
142
 
166
  <label>Items After</label>
167
  </block>
168
  </block>
169
+ </block>
170
  </block>
171
  </reference>
172
+ <!-- reference name="checkout.onepage.review.info.items.after">
173
+ <block type="monkey/checkout_subscribe" name="magemonkey.subscribe"
174
+ template="magemonkey/checkout/subscribe.phtml">
175
+ <block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml"/>
176
+ </block>
177
+ </reference -->
178
  </checkout_onepage_index>
179
 
180
  <onestepcheckout_index_updateshippingmethod>
249
 
250
  <onestepcheckout_index_updateshippingtype>
251
  <remove name="right"/>
252
+ <remove name="left"/>
253
  <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="MOIP/onestepcheckout/daskboard/onepage/shipping_method/available.phtml"/>
254
  </onestepcheckout_index_updateshippingtype>
255
 
264
  <remove name="left"/>
265
  <block type="MOIP_Onestepcheckout_Block_Checkout_Onepage_Billing" name="root" output="toHtml" as="billing_form" template="MOIP/onestepcheckout/daskboard/onepage/billing/billingform.phtml"/>
266
  </onestepcheckout_index_updatebillingform>
267
+ <onestepcheckout_index_updateordermethod>
268
+ <reference name="root">
269
+ <action method="setTemplate"><template>MOIP/onestepcheckout/emptyupdate.phtml</template></action>
270
+ </reference>
271
 
272
+ </onestepcheckout_index_updateordermethod>
273
 
274
+
275
  <onestepcheckout_index_updateshippingform>
276
  <reference name="root">
277
  <action method="setTemplate"><template>MOIP/onestepcheckout/emptyupdate.phtml</template></action>
280
  <block type="onestepcheckout/checkout_onepage_shipping" name="checkout.onepage.shipping.shippingform" as="shipping_form" template="MOIP/onestepcheckout/daskboard/onepage/shipping/shipping_form.phtml"/>
281
  </reference>
282
  </onestepcheckout_index_updateshippingform>
283
+
284
  </layout>
app/design/frontend/base/default/layout/moip_transparente.xml CHANGED
@@ -1,60 +1,159 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
- <catalog_product_view translate="label">
 
4
  <reference name="head">
5
- <action method="addCss"><stylesheet>MOIP/transparente/css/product_view.css</stylesheet></action>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  </reference>
7
- <reference name="product.info">
8
- <block type="MOIP_Transparente_Block_Product_View" name="product.info.parcelas" as="parcelas" template="MOIP/product/view/parcelas.phtml"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  </reference>
10
- </catalog_product_view>
11
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  <checkout_onepage_index>
14
  <reference name="head">
15
- <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/jquery.js</script></action>
16
- <action method="addJs"><script>MOIP/jquery_noconflict.js</script></action>
17
- <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
18
- <action method="addJs"><script>MOIP/script_mask.js</script></action>
19
- <action method="addJs"><script>MOIP/transparente/valide.js</script></action>
20
- <action method="addJs"><script>MOIP/transparente/bootstrap-tab.js</script></action>
21
- <action method="addCss"><stylesheet>MOIP/transparente/css/bootstrap-tabs.css</stylesheet></action>
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  </reference>
23
  </checkout_onepage_index>
 
 
24
  <transparente_standard_redirect>
25
  <reference name="head">
26
 
27
  <action method="setTitle"><params><![CDATA[Pagamento via MoIP S/A]]></params></action>
28
- <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/jquery.js</script></action>
29
- <action method="addJs"><script>MOIP/jquery_noconflict.js</script></action>
30
- <action method="addJs"><script>MOIP/bootstrap-modal.js</script></action>
31
- <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
32
- <action method="addJs"><script>MOIP/script_mask.js</script></action>
33
- <action method="addJs"><script>MOIP/validacao.js</script></action>
34
- <action method="addCss"><stylesheet>MOIP/transparente/css/bootstrap.css</stylesheet></action>
35
- <action method="addCss"><stylesheet>MOIP/onestepcheckout/css/bootstrap-modal.css</stylesheet></action>
36
  </reference>
 
37
  <reference name="root">
38
  <action method="setTemplate"><template>page/1column.phtml</template></action>
39
  </reference>
40
  <reference name="content">
41
  <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.comum" template="MOIP/transparente/redirect.phtml">
42
-
43
- <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.transferencia" template="MOIP/transparente/transferencia.phtml"></block>
44
- <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.boleto" template="MOIP/transparente/boleto.phtml"></block>
45
- <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.cartao" template="MOIP/transparente/cartao.phtml">
46
- <block type="MOIP_Transparente_Block_Standard_Redirect" name="cartao_form" template="MOIP/transparente/refaz.phtml">
47
- <action method="setBlockId"><block_id>cartao_form</block_id></action>
48
- </block>
49
- </block>
50
  </block>
51
-
52
  <block type="MOIP_Transparente_Block_Standard_SuccessDetails" name="success.order" template="MOIP/transparente/SuccessDetails.phtml">
53
- <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>sales/order/items/renderer/default.phtml</template></action>
54
- <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>sales/order/items/renderer/default.phtml</template></action>
55
- <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
56
- <action method="setLabelProperties"><value>colspan="4" class="a-right"</value></action>
57
- <action method="setValueProperties"><value>class="last a-right"</value></action>
58
  <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
59
  <action method="setIsPlaneMode"><value>1</value></action>
60
  </block>
@@ -65,55 +164,14 @@
65
  </reference>
66
  </transparente_standard_redirect>
67
 
68
- <transparente_index_index>
69
- <reference name="root">
70
- <action method="setTemplate"><template>MOIP/transparente/emptyupdate.phtml</template></action>
71
- </reference>
72
- </transparente_index_index>
73
-
74
- <transparente_index_novaforma>
75
- <reference name="root">
76
- <action method="setTemplate"><template>page/1column.phtml</template></action>
77
- </reference>
78
- </transparente_index_novaforma>
79
-
80
- <sales_order_view>
81
- <reference name="head">
82
- <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/jquery.js</script></action>
83
- <action method="addJs"><script>MOIP/jquery_noconflict.js</script></action>
84
- <action method="addJs"><script>MOIP/transparente/bootstrap.min.js</script></action>
85
- <action method="addJs"><script>MOIP/transparente/bootstrap-modal.js</script></action>
86
- <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
87
- <action method="addJs"><script>MOIP/script_mask.js</script></action>
88
- <action method="addJs"><script>MOIP/validacao.js</script></action>
89
- <action method="addCss"><stylesheet>MOIP/transparente/css/bootstrap.css</stylesheet></action>
90
- </reference>
91
- </sales_order_view>
92
-
93
-
94
 
95
- <customer_address_form>
96
- <reference name="head">
97
- <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/jquery.js</script></action>
98
- <action method="addJs"><script>MOIP/jquery_noconflict.js</script></action>
99
- <action method="addJs"><script>MOIP/transparente/bootstrap.min.js</script></action>
100
- <action method="addJs"><script>MOIP/transparente/bootstrap-modal.js</script></action>
101
- <action method="addJs"><script>MOIP/jquery.mask.min.js</script></action>
102
- <action method="addJs"><script>MOIP/script_mask.js</script></action>
103
- <action method="addJs"><script>MOIP/validacao.js</script></action>
104
- <action method="addCss"><stylesheet>MOIP/transparente/css/bootstrap.css</stylesheet></action>
105
- </reference>
106
- <reference name="my.account.wrapper">
107
- <block type="customer/address_edit" name="customer_address_edit" template="MOIP/customer/address/edit.phtml"/>
108
- </reference>
109
- </customer_address_form>
110
 
111
- <sales>
112
  <block type="MOIP_Transparente_Block_Standard_Info" name="transparente.info" template="MOIP/transparente/info.phtml"></block>
113
  </sales>
114
 
115
-
116
- <customer_account>
117
  <reference name="customer_account_navigation">
118
  <action method="addLink" translate="label" module="transparente"><name>transparente</name><path>transparente/index/Cartoes</path><label>Meus Cartões</label></action>
119
  </reference>
@@ -133,6 +191,56 @@
133
  <block type="MOIP_Transparente_Block_Standard_CartSave" template="MOIP/transparente/cartoes_my_account.phtml">
134
  </block>
135
  </reference>
136
-
137
  </transparente_index_cartoes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  </layout>
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
+
4
+ <opc_index_index>
5
  <reference name="head">
6
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
7
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
8
+ <action method="addJs"><script>MOIP/transparente/moip.js</script></action>
9
+ <action method="addCss"><stylesheet>MOIP/transparente/css/form.css</stylesheet></action>
10
+ <block type="core/text" name="moip.cdn">
11
+ <action method="setText">
12
+ <text>
13
+ <![CDATA[
14
+
15
+ <script type="text/javascript" src="https://assets.moip.com.br/integration/moip.min.js"></script>
16
+ <script type="text/javascript">
17
+ MoipPagamentosCc();
18
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
19
+ Validation.creditCartTypes.set('EO', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
20
+ Validation.creditCartTypes.set('HI', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
21
+ Validation.creditCartTypes.set('HP', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
22
+ </script>
23
+ ]]>
24
+ </text>
25
+ </action>
26
+ </block>
27
  </reference>
28
+ </opc_index_index>
29
+
30
+ <onepagecheckout_index_index>
31
+ <reference name="head">
32
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
33
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
34
+ <action method="addJs"><script>MOIP/transparente/moip.js</script></action>
35
+ <action method="addCss"><stylesheet>MOIP/transparente/css/form.css</stylesheet></action>
36
+ <block type="core/text" name="moip.cdn">
37
+ <action method="setText">
38
+ <text>
39
+ <![CDATA[
40
+
41
+ <script type="text/javascript" src="https://assets.moip.com.br/integration/moip.min.js"></script>
42
+ <script type="text/javascript">
43
+ MoipPagamentosCc();
44
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
45
+ Validation.creditCartTypes.set('EO', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
46
+ Validation.creditCartTypes.set('HI', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
47
+ Validation.creditCartTypes.set('HP', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
48
+ </script>
49
+ ]]>
50
+ </text>
51
+ </action>
52
+ </block>
53
+ </reference>
54
+ </onepagecheckout_index_index>
55
+ <onestepcheckout_index_index>
56
+ <reference name="head">
57
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
58
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
59
+ <action method="addJs"><script>MOIP/transparente/moip.js</script></action>
60
+ <action method="addCss"><stylesheet>MOIP/transparente/css/form.css</stylesheet></action>
61
+ <block type="core/text" name="moip.cdn">
62
+ <action method="setText">
63
+ <text>
64
+ <![CDATA[
65
+
66
+ <script type="text/javascript" src="https://assets.moip.com.br/integration/moip.min.js"></script>
67
+ <script type="text/javascript">
68
+ MoipPagamentosCc();
69
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
70
+ Validation.creditCartTypes.set('EO', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
71
+ Validation.creditCartTypes.set('HI', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
72
+ Validation.creditCartTypes.set('HP', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
73
+ </script>
74
+ ]]>
75
+ </text>
76
+ </action>
77
+ </block>
78
  </reference>
79
+ </onestepcheckout_index_index>
80
+ <inovarti_onestepcheckout_index_index>
81
+ <reference name="head">
82
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
83
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
84
+ <action method="addJs"><script>MOIP/transparente/moip.js</script></action>
85
+ <action method="addCss"><stylesheet>MOIP/transparente/css/form.css</stylesheet></action>
86
+ <block type="core/text" name="moip.cdn">
87
+ <action method="setText">
88
+ <text>
89
+ <![CDATA[
90
+
91
+ <script type="text/javascript" src="https://assets.moip.com.br/integration/moip.min.js"></script>
92
+ <script type="text/javascript">
93
+ MoipPagamentosCc();
94
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
95
+ Validation.creditCartTypes.set('EO', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
96
+ Validation.creditCartTypes.set('HI', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
97
+ Validation.creditCartTypes.set('HP', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
98
+ </script>
99
+ ]]>
100
+ </text>
101
+ </action>
102
+ </block>
103
+ </reference>
104
+ </inovarti_onestepcheckout_index_index>
105
 
106
  <checkout_onepage_index>
107
  <reference name="head">
108
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
109
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
110
+ <action method="addJs"><script>MOIP/transparente/moip.js</script></action>
111
+ <action method="addCss"><stylesheet>MOIP/transparente/css/form.css</stylesheet></action>
112
+ <block type="core/text" name="moip.cdn">
113
+ <action method="setText">
114
+ <text>
115
+ <![CDATA[
116
+ <script type="text/javascript" src="https://assets.moip.com.br/integration/moip.min.js"></script>
117
+ <script type="text/javascript">
118
+ MoipPagamentosCc();
119
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
120
+ Validation.creditCartTypes.set('EO', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
121
+ Validation.creditCartTypes.set('HI', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
122
+ Validation.creditCartTypes.set('HP', [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]);
123
+ </script>
124
+ ]]>
125
+ </text>
126
+ </action>
127
+ </block>
128
  </reference>
129
  </checkout_onepage_index>
130
+
131
+
132
  <transparente_standard_redirect>
133
  <reference name="head">
134
 
135
  <action method="setTitle"><params><![CDATA[Pagamento via MoIP S/A]]></params></action>
136
+ <action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
137
+ <action method="addJs"><script>MOIP/core/jquery_noconflict.js</script></action>
138
+ <action method="addCss"><stylesheet>MOIP/transparente/css/redirect.css</stylesheet></action>
139
+
 
 
 
 
140
  </reference>
141
+
142
  <reference name="root">
143
  <action method="setTemplate"><template>page/1column.phtml</template></action>
144
  </reference>
145
  <reference name="content">
146
  <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.comum" template="MOIP/transparente/redirect.phtml">
147
+ <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.transferencia" template="MOIP/transparente/redirect/transferencia.phtml"></block>
148
+ <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.boleto" template="MOIP/transparente/redirect/boleto.phtml"></block>
149
+ <block type="MOIP_Transparente_Block_Standard_Redirect" name="transparente.cartao" template="MOIP/transparente/redirect/cartao.phtml"></block>
 
 
 
 
 
150
  </block>
 
151
  <block type="MOIP_Transparente_Block_Standard_SuccessDetails" name="success.order" template="MOIP/transparente/SuccessDetails.phtml">
152
+ <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>MOIP/transparente/checkout/sales/order/items/renderer/default.phtml</template></action>
153
+ <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>MOIP/transparente/checkout/sales/order/items/renderer/default.phtml</template></action>
154
+ <block type="sales/order_totals" name="order_totals" template="MOIP/transparente/checkout/sales/order/totals.phtml">
155
+ <action method="setLabelProperties"><value>colspan="2" class="a-right"</value></action>
156
+
157
  <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
158
  <action method="setIsPlaneMode"><value>1</value></action>
159
  </block>
164
  </reference>
165
  </transparente_standard_redirect>
166
 
167
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
+ <sales>
171
  <block type="MOIP_Transparente_Block_Standard_Info" name="transparente.info" template="MOIP/transparente/info.phtml"></block>
172
  </sales>
173
 
174
+ <customer_account>
 
175
  <reference name="customer_account_navigation">
176
  <action method="addLink" translate="label" module="transparente"><name>transparente</name><path>transparente/index/Cartoes</path><label>Meus Cartões</label></action>
177
  </reference>
191
  <block type="MOIP_Transparente_Block_Standard_CartSave" template="MOIP/transparente/cartoes_my_account.phtml">
192
  </block>
193
  </reference>
 
194
  </transparente_index_cartoes>
195
+
196
+ <catalog_product_view translate="label">
197
+ <reference name="head">
198
+ <action method="addJs" ifconfig="moipall/oneclick_config/enable_jquery"><script>MOIP/jquery.js</script></action>
199
+ <action method="addJs" ifconfig="moipall/oneclick_config/enable_noconflit"><script>MOIP/jquery_noconflict.js</script></action>
200
+ <action method="addJs" ifconfig="moipall/oneclick_config/enable_bootstrap"><script>MOIP/core/bootstrap-modal.js</script></action>
201
+ <action method="addItem" ifconfig="moipall/oneclick_config/enable_bootstrap"><type>skin_css</type><name>MOIP/core/css/bootstrap-modal.css</name></action>
202
+ <action method="addItem" ifconfig="moipall/oneclick_config/enable_bootstrap"><type>skin_css</type><name>MOIP/core/css/bootstrap-popover.css</name></action>
203
+
204
+ </reference>
205
+ <reference name="product.info">
206
+ <block type="MOIP_Transparente_Block_Product_View_Parcelas" name="product.info.parcelas" as="parcelas" template="MOIP/product/view/parcelas.phtml"/>
207
+ <block type="MOIP_Transparente_Block_Product_View_Discount" name="product.info.discount" as="discount" template="MOIP/product/view/discount.phtml"/>
208
+ <block type="MOIP_Transparente_Block_Onclick_Button" name="product.info.onclick.button" as="oneclick-button" template="MOIP/transparente/onclick/Button.phtml"/>
209
+ </reference>
210
+ <reference name="before_body_end">
211
+ <block type="core/template" name="product.info.onclick.js" after="-" template="MOIP/transparente/onclick/js.phtml"/>
212
+ </reference>
213
+ </catalog_product_view>
214
+
215
+ <transparente_index_addonclick>
216
+ <reference name="root">
217
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
218
+ </reference>
219
+ <reference name="content">
220
+ <block type="MOIP_Transparente_Block_Onclick_MoipOnclick" name="moip.onclick.payment" template="MOIP/transparente/onclick/MoipOnclick.phtml">
221
+ <block type="MOIP_Transparente_Block_Onclick_ShippingAddress" name="moip.onclick.shipping.address" template="MOIP/transparente/onclick/ShippingAddress.phtml" />
222
+ <block type="MOIP_Transparente_Block_Onclick_ShippingMethods" name="moip.onclick.shipping.methods" template="MOIP/transparente/onclick/ShippingMethods.phtml" />
223
+ <block type="MOIP_Transparente_Block_Onclick_PaymentMethod" name="moip.onclick.payment.method" template="MOIP/transparente/onclick/PaymentMethod.phtml">
224
+ <block type="MOIP_Transparente_Block_Onclick_UpdateParcelas" name="moip.onclick.payment.method.parcelas" template="MOIP/transparente/onclick/Parcelas.phtml" />
225
+ </block>
226
+ </block>
227
+ <block type="core/template" name="moip.onclick.login" template="MOIP/transparente/onclick/LoginOnclick.phtml" />
228
+ </reference>
229
+ </transparente_index_addonclick>
230
+
231
+ <transparente_index_loginonclick>
232
+ <reference name="root">
233
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
234
+ </reference>
235
+ <reference name="content">
236
+ <block type="MOIP_Transparente_Block_Onclick_MoipOnclick" name="moip.onclick.payment" template="MOIP/transparente/onclick/MoipOnclick.phtml">
237
+ <block type="MOIP_Transparente_Block_Onclick_ShippingAddress" name="moip.onclick.shipping.address" template="MOIP/transparente/onclick/ShippingAddress.phtml" />
238
+ <block type="MOIP_Transparente_Block_Onclick_ShippingMethods" name="moip.onclick.shipping.methods" template="MOIP/transparente/onclick/ShippingMethods.phtml" />
239
+ <block type="MOIP_Transparente_Block_Onclick_PaymentMethod" name="moip.onclick.payment.method" template="MOIP/transparente/onclick/PaymentMethod.phtml">
240
+ <block type="MOIP_Transparente_Block_Onclick_UpdateParcelas" name="moip.onclick.payment.method.parcelas" template="MOIP/transparente/onclick/Parcelas.phtml" />
241
+ </block>
242
+ </block>
243
+ </reference>
244
+ </transparente_index_loginonclick>
245
+
246
  </layout>
app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/CreateAccount.phtml ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $color = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor'); ?>
2
+ <?php $botao_color = "#".Mage::getStoreConfig('onestepcheckout/layout/botao_cor');?>
3
+ <?php $style_cor_background = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor_background');?>
4
+ <?php $style_cor_header = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor_header');?>
5
+ <?php $style_cor_step = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor_step');?>
6
+ <?php $islogin=0; if(Mage::getSingleton('customer/session')->isLoggedIn()) $islogin=1; ?>
7
+ <style type="text/css">
8
+ #loginbox, #btn_logar,.btn-update-qty{background:<?php echo $botao_color;?>;padding: 5px 10px;color:#fff;text-decoration: none;border-radius: 5px;text-align: center;width: 90%; cursor: pointer;}
9
+ p.moip-osc-block-title{color:<?php echo $color;?>;}
10
+ .moip-osc-block-title>h3 {color: <?php echo $color;?>;}
11
+ h2, h1 {color: <?php echo $color;?>;}
12
+ .full-container {background: <?php echo $style_cor_header;?>}
13
+ .wrapper {background: <?php echo $style_cor_background;?>}
14
+ .header {background: <?php echo $style_cor_header;?>}
15
+ </style>
16
+
17
+
18
+ <div class="container body-wrapper">
19
+ <div class="row">
20
+
21
+ <div class=" col-sm-12 col-lg-8 col-md-8">
22
+
23
+ <div class="moip-osc-block" >
24
+ <div class="moip-osc-block-title">
25
+ <h3><?php echo $this->__('Entrar ou Cadastrar-se');?></h3>
26
+ </div>
27
+
28
+ <div class="moip-osc-block-content">
29
+ <div class="a-center pre-step">
30
+ <form id="onestep_form_identifique" autocomplete="off" action="<?php echo $this->getUrl('onestepcheckout/index/updateemailmsg') ?>" method="POST" class="scaffold-form">
31
+ <h2>Identificação</h2>
32
+ <p>Para finalizar a compra, informe seu e-mail.</p>
33
+
34
+ <div class="input-group input-group-lg">
35
+
36
+ <input type="text" type="text" name="checked-login" id="checked-login" title="Endereço de e-mail" class="form-control input-text validate-email required-entry" placeholder="Digite seu e-mail">
37
+ <span class="input-group-btn">
38
+ <button class="btn btn-secondary btn-success" title="Acesse com seu email" type="submit" name="pre-login" id="pre-login"><span><span>Continuar</span></span></button>
39
+ </span>
40
+ </div>
41
+ <div class="secure-enable">
42
+ <h1><i class="fa fa-lock"></i></h1>
43
+ <h3>Você está em um ambiente seguro</h3>
44
+ <?php echo $this->__(Mage::getStoreConfig('onestepcheckout/modaluse/secure'));?>
45
+ </div>
46
+ </form>
47
+ </div>
48
+ <div class="no-display" id="login-checked">
49
+
50
+ <h2>Acesse sua conta</h2>
51
+ <?php echo $this->getChildHtml('login-pre',false,true);?>
52
+ </div>
53
+ <div class="billing_start no-display" id="create-checked">
54
+
55
+ <h2>Crie sua conta</h2>
56
+ <div id="cadastrar"><?php echo $this->getChildHtml('billing',false,true);?></div>
57
+
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="col-sm-12 col-lg-4 col-md-4">
64
+
65
+ <div class="moip-osc-block" >
66
+ <div class="moip-osc-block-title">
67
+ <h3><?php echo $this->__('Revisão');?></h3>
68
+ </div>
69
+
70
+ <div class="moip-osc-block-content">
71
+ <div id="review">
72
+ <div class="panel-body"><?php echo $this->getChildHtml('review',false,true);?></div>
73
+
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
+ </div>
79
+
80
+ </div>
81
+ </div>
82
+
83
+ <div id="loading-mask">
84
+ <div id="loading_mask_loader" class="loader">
85
+ <img alt="Loading..." class="loading_img" src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>">
86
+ <p><span>Atualizando dados, por favor aguarde...</span></p>
87
+ </div>
88
+ </div>
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <?php if(!$islogin):?>
96
+
97
+ <div class="modal fade" id="loginModel" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
98
+ <div class="modal-dialog">
99
+ <div class="modal-content">
100
+ <div class="modal-header">
101
+ <h4 class="modal-title" id="myModalLabel">Entrar</h4>
102
+ </div>
103
+ <div class="modal-body">
104
+ <?php echo $this->getChildHtml('login',false,true);?>
105
+ </div>
106
+ <div class="modal-footer">
107
+ <button type="button" class="button btn btn-default" data-dismiss="modal">Fechar</button>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <?php endif; ?>
114
+
115
+ <?php if(!$islogin):?>
116
+
117
+ <div class="modal fade" id="EsqueceuSenha" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
118
+ <div class="modal-dialog">
119
+ <div class="modal-content">
120
+ <div class="modal-header">
121
+ <h4 class="modal-title" id="myModalLabel">Recuperar Senha</h4>
122
+ </div>
123
+ <div class="modal-body">
124
+ <?php echo $this->getChildHtml('forgotpassword',false,true);?>
125
+ </div>
126
+ <div class="modal-footer">
127
+ <button type="button" class="button btn btn-default" data-dismiss="modal">Fechar</button>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </div>
132
+
133
+ <?php endif; ?>
134
+
135
+ <div class="modal fade" id="store_secure_content" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
136
+ <div class="modal-dialog">
137
+ <div class="modal-content">
138
+ <div class="modal-header">
139
+ <h4 class="modal-title" id="myModalLabel">Loja Segura</h4>
140
+ </div>
141
+ <div class="modal-body">
142
+ <?php echo $this->__(Mage::getStoreConfig('onestepcheckout/modaluse/secure'));?>
143
+ </div>
144
+ <div class="modal-footer">
145
+ <button type="button" class="button btn btn-default" data-dismiss="modal">Fechar</button>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+
152
+
153
+ <div class="modal fade" id="termos_modal" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
154
+ <div class="modal-dialog">
155
+ <div class="modal-content">
156
+ <div class="modal-header">
157
+ <h4 class="modal-title" id="myModalLabel">Termos e Condições</h4>
158
+ </div>
159
+ <div class="modal-body">
160
+ <?php echo $this->__(Mage::getStoreConfig('onestepcheckout/modaluse/content_options'));?>
161
+ </div>
162
+ <div class="modal-footer">
163
+ <button type="button" class="button btn btn-default" data-dismiss="modal">Fechar</button>
164
+ </div>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+
170
+
171
+ <div class="modal fade" id="ErrosFinalizacao" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="false">
172
+ <div class="modal-dialog">
173
+ <div class="modal-content">
174
+ <div class="modal-header">
175
+ <h4 class="modal-title" id="myModalLabel">Ops, encontramos erros nos campos abaixo:</h4>
176
+ </div>
177
+ <div class="modal-body">
178
+ <div class="erros_cadastro">
179
+ <ul class="erros_cadastro_valores"></ul>
180
+ </div>
181
+ </div>
182
+ <div class="modal-footer">
183
+ <button type="button" class="button btn btn-default" data-dismiss="modal">Ok, entendi!</button>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ <script type="text/javascript">
190
+
191
+ var formId = 'onestep_form_identifique';
192
+ var myForm = new VarienForm(formId, true);
193
+ var postUrl = "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>";
194
+ function doAjax() {
195
+ if (myForm.validator.validate()) {
196
+ new Ajax.Request(
197
+ postUrl, {
198
+ method:'post',
199
+ parameters: "email="+jQuery('#checked-login').val(),
200
+ onSuccess:function(response) {
201
+
202
+ var responsetxt = response.responseText || "0";
203
+
204
+ if(responsetxt==0){
205
+
206
+ jQuery('#loading-mask').hide();
207
+ jQuery('.pre-step').hide();
208
+ jQuery('#login-checked').show();
209
+ jQuery('#login-checked').removeClass('no-display');
210
+ jQuery('#checked-login-email').val(jQuery('#checked-login').val());
211
+
212
+
213
+
214
+ }else{
215
+ jQuery('#loading-mask').hide();
216
+ jQuery('.pre-step').hide();
217
+ jQuery('#billing\\:email').val(jQuery('#checked-login').val());
218
+ jQuery('#create-checked').removeClass('no-display');
219
+ jQuery('#create-checked').show();
220
+
221
+
222
+ }
223
+ },
224
+ onLoading:function(request, json){
225
+ jQuery('#loading-mask').show();
226
+ },
227
+
228
+ }
229
+ );
230
+ }
231
+ }
232
+
233
+ new Event.observe(formId, 'submit', function(e){
234
+ e.stop();
235
+ doAjax();
236
+ });
237
+
238
+
239
+ </script>
app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/billing.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ <div id="co-billing-form">
4
+ <?php if ($this->customerHasAddresses()): ?>
5
+ <ul class="form-list" >
6
+ <li class="wide">
7
+ <label for="billing-address-select" style="_width:250px;"><?php echo $this->__('Selecione o endereço de seu cadastro ou crie um novo:') ?></label>
8
+ <div class="input-box">
9
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
10
+ </div>
11
+ </li>
12
+ </ul>
13
+ <?php endif ?>
14
+ <?php echo $this->getChildHtml('billing_form');?>
15
+
16
+
17
+ </div>
18
+
19
+
20
+
21
+
22
+
23
+ <script type="text/javascript">
24
+ //<![CDATA[
25
+
26
+ var billaddbook = 1;
27
+ jQuery("#billing\\:save_in_address_book").click(function() {
28
+ if (this.value != billaddbook) {
29
+ temp = billaddbook;
30
+ billaddbook = this.value;
31
+ jQuery("#billing\\:save_in_address_book").attr("value", temp);
32
+ }
33
+ });
34
+
35
+ function updateBillingForm(address_id, flag) {
36
+ if (address_id == "") {
37
+ var temp_id = jQuery("#billing\\:address_id").val();
38
+ jQuery('#billing-new-address-form').clearForm();
39
+ jQuery("#billing\\:address_id").val('');
40
+ } else {
41
+
42
+ jQuery.ajax({
43
+ type: "POST",
44
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/updatebillingform')?>",
45
+ data: jQuery("#onestep_form").serialize(),
46
+
47
+ success: function(msg) {
48
+ jQuery('#moip_onstepcheckout_billing_form').html(msg);
49
+ jQuery('#moip_onstepcheckout_billing_form').find("script").each(function(i) {
50
+                     eval(jQuery(this).text());
51
+                 });
52
+ updateShippingType();
53
+ }
54
+ });
55
+ }
56
+ }
57
+
58
+ //]]>
59
+ </script>
app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/billing/billingform.phtml ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="onestep_form_account" autocomplete="off" action="<?php echo $this->getUrl('onestepcheckout/index/CreataAccountInit') ?>" method="POST" class="scaffold-form">
2
+ <?php echo $this->getBlockHtml('formkey') ?>
3
+ <?php $state_cep = ($this->customerHasAddresses() ? "show-zip-code" : 'hide-zip-code'); ?>
4
+
5
+ <fieldset>
6
+
7
+ <ul class="form-list" id="moip_onstepcheckout_billing_form" >
8
+ <input type="hidden" title="Permanecer logado" name="form_key" value="<? echo Mage::getSingleton('core/session')->getFormKey(); ?>" class="input-hidden" />
9
+ <input type="hidden" name="billing[address_id]" title="Endereço selecionado" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id"class="input-hidden" />
10
+ <div class="col-lg-6 col-xm-12">
11
+ <li class="fields">
12
+ <div class="customer-name field">
13
+ <label for="billing:firstname" class="required">Nome</label>
14
+ <div class="input-box">
15
+ <input autocomplete="off" type="text" id="billing:firstname" name="billing[firstname]" value="<?php echo $this->getAddress()->getFirstname() ?>" title="Nome" class="input-text required-entry" placeholder="Nome">
16
+ </div>
17
+ </div>
18
+ <div class="field name-lastname">
19
+ <label for="billing:lastname" class="required">Sobrenome</label>
20
+ <div class="input-box">
21
+ <input autocomplete="off" type="text" id="billing:lastname" name="billing[lastname]" value="<?php echo $this->getAddress()->getLastname() ?>" title="Sobrenome" class="input-text required-entry" placeholder="Sobrenome">
22
+ </div>
23
+ </div>
24
+ </li>
25
+ <?php if(Mage::getStoreConfig('onestepcheckout/config/enable_pj')):?>
26
+ <li class="fields pj-pf">
27
+ <div class="field">
28
+ <label class="">
29
+ <input autocomplete="off" type="radio" name="billing[tipopessoa]" class="radio validate-one-required-by-name" value="1" id="billing:pf" onclick="getval(this);" checked>
30
+ Pessoa Física
31
+ </label>
32
+ </div>
33
+ <div class="field">
34
+ <label class="">
35
+ <input autocomplete="off" type="radio" name="billing[tipopessoa]" class="radio validate-one-required-by-name" value="2" id="billing:pj" onclick="getval(this);">
36
+ Pessoa Jurídica
37
+ </label>
38
+ </div>
39
+ </li>
40
+ <li class="fields dados-pj">
41
+ <div class="field">
42
+ <label for="billing:nomefantasia" class="required">Nome Fantasia</label>
43
+ <div class="input-box">
44
+ <input autocomplete="off" type="text" title="Nome Fantasia" class="input-text" name="billing[nomefantasia]" id="nomefantasia" value="<?php echo $this->htmlEscape(Mage::getSingleton('customer/session')->getCustomer()->getNomefantasia()); ?>" placeholder="Nome Fantasia">
45
+ </div>
46
+ </div>
47
+ <div class="field">
48
+ <label for="billing:razaosocial" class="required">Razão Social</label>
49
+ <div class="input-box">
50
+ <input autocomplete="off" type="text" title="razao_social" class="input-text" name="billing[razaosocial]" id="razaosocial" value="<?php echo $this->htmlEscape(Mage::getSingleton('customer/session')->getCustomer()->getRazaosocial()) ?>" placeholder="Razão Solcial" >
51
+ </div>
52
+ </div>
53
+ </li>
54
+ <li class="fields dados-pj">
55
+ <div class="field">
56
+ <label for="billing:cnpj" class="required">CNPJ</label>
57
+ <div class="input-box">
58
+ <input autocomplete="off" type="text" title="cnpj" class="input-text" name="billing[cnpj]" id="cnpj" value="<?php echo $this->htmlEscape(Mage::getSingleton('customer/session')->getCustomer()->getCnpj()) ?>" placeholder="CNPJ">
59
+ </div>
60
+ </div>
61
+ <div class="field">
62
+ <label for="billing:insestadual" class="required">Inscrição Estadual</label>
63
+ <div class="input-box">
64
+ <input autocomplete="off" type="text" title="Inscrição Estadual" class="input-text" name="billing[insestadual]" value="<?php echo $this->htmlEscape(Mage::getSingleton('customer/session')->getCustomer()->getInsestadual()) ?>" id="insestadual" value="" placeholder="Inscrição Social">
65
+ </div>
66
+ <input autocomplete="off" type="checkbox" name="Isento" title="Isento para a Inscrição Estadual" onclick="marcar_isento()" style="width: 15px !important;"><label>Isento</label>
67
+ </div>
68
+ </li>
69
+ <?php endif; ?>
70
+
71
+ <li class="fields">
72
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
73
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
74
+ <?php if ($_taxvat->isEnabled()): ?>
75
+ <div class="field">
76
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
77
+ </div>
78
+ <script type="text/javascript">
79
+ //<![CDATA[
80
+ $('billing:taxvat').addClassName('validar_cpf');
81
+ Validation.add('validar_cpf', 'O CPF ou CNPJ informado \xE9 invalido', function(v){return validaCPF(v,0);});
82
+ //]]>
83
+ </script>
84
+ <?php endif ?>
85
+ <?php if ($_dob->isEnabled()): ?>
86
+ <div class="field">
87
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
88
+ </div>
89
+ <?php endif; ?>
90
+
91
+
92
+ </li>
93
+ <li class="fields">
94
+ <div class="field">
95
+ <label for="billing:telephone" class="required">Telefone</label>
96
+ <div class="input-box">
97
+ <input autocomplete="off" type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="Telefone" class="input-text validate-tel-national required-entry" id="billing:telephone" placeholder="Telefone">
98
+ <script type="text/javascript">
99
+ //<![CDATA[
100
+ Validation.add('validate-tel-national', 'Entre com telefone válido: (99)9999-?9999', function(v) {
101
+ return Validation.get('IsEmpty').test(v) || /^([()])([0-9]){2}([)])([0-9]){4}([-])([0-9]){4,5}$/.test(v);
102
+ });
103
+ //]]>
104
+ </script>
105
+ </div>
106
+ </div>
107
+ <div class="field">
108
+ <label for="billing:telephone" class="required">Celular</label>
109
+ <div class="input-box">
110
+ <input autocomplete="off" type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="Celular" class="input-text validate-cel-national input-text" id="billing:fax" placeholder="Celular">
111
+ <script type="text/javascript">
112
+ //<![CDATA[
113
+ Validation.add('validate-cel-national', 'Entre com telefone válido: (99)9999-?9999', function(v) {
114
+ return Validation.get('IsEmpty').test(v) || /^([()])([0-9]){2}([)])([0-9]){4}([-])([0-9]){4,5}$/.test(v);
115
+ });
116
+ //]]>
117
+ </script>
118
+ </div>
119
+ </div>
120
+
121
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
122
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
123
+ <li class="fields">
124
+
125
+ <?php if ($_gender->isEnabled()): ?>
126
+ <div class="field">
127
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
128
+ </div>
129
+ <?php endif ?>
130
+ </li>
131
+ <?php endif ?>
132
+
133
+ </li>
134
+ </div>
135
+
136
+ <div class="col-lg-6 col-xm-12">
137
+ <?php if(!$this->isCustomerLoggedIn()): ?>
138
+ <li class="wide">
139
+ <label for="billing:email" class="required">Endereço de e-mail</label>
140
+ <div class="input-box">
141
+ <input autocomplete="off" type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="Endereço de e-mail" class="input-text validate-email required-entry" placeholder="Email">
142
+ </div>
143
+ </li>
144
+ <?php else: ?>
145
+ <input autocomplete="off" type="hidden" name="billing[email]" value="<?php echo $this->htmlEscape( Mage::getSingleton('customer/session')->getCustomer()->getEmail()) ?>" id="email" class="input-hidden">
146
+ <?php endif; ?>
147
+ <?php if(!$this->isCustomerLoggedIn()): ?>
148
+ <li class="fields" id="register-customer-password" style="display:block;">
149
+ <div class="field">
150
+ <label for="billing:customer_password" class="required">Crie sua Senha</label>
151
+ <div class="input-box">
152
+ <input autocomplete="off" type="password" name="billing[customer_password]" id="billing:customer_password" title="Senha" class="input-text required-entry validate-password" placeholder="Senha">
153
+ </div>
154
+ </div>
155
+ <div class="field">
156
+ <label for="billing:confirm_password" class="required">Confirmar sua Senha</label>
157
+ <div class="input-box">
158
+ <input autocomplete="off" type="password" name="billing[confirm_password]" onkeypress="valide_senha(this);" title="Confirmar senha" id="billing:confirm_password" class="input-text required-entry validate-cpassword" placeholder="Confirmar Senha">
159
+ </div>
160
+ </div>
161
+ </li>
162
+ <input autocomplete="off" type="hidden" name="billing[register_new_account]" value="1" title="Criar conta" id="register_new_account" class="input-hidden">
163
+ <input autocomplete="off" type="hidden" name="billing[persistent_remember_me]" value="1" title="Continuar logado" id="persistent_remember_me" class="input-hidden">
164
+ <p style="padding-bottom:10px;">A senha criada será utilizada para você ter acesso futuro a loja e acompanhar o seu pedido.</p>
165
+ <?php endif; ?>
166
+ </div>
167
+ <div class="col-lg-12 col-xm-12">
168
+ <li class="fields">
169
+ <div class="field">
170
+
171
+ <label for="billing:postcode" class="required">CEP</label>
172
+ <div class="input-box">
173
+ <input autocomplete="off" type="text" title="CEP" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry moipzip" onchange="javascript: buscarEndereco('billing');" style="width: 100px;" placeholder="CEP">
174
+ </div>
175
+ <script type="text/javascript">
176
+ //<![CDATA[
177
+ Validation.add('validate-zip-international', 'Entre com um cep válido: 99999-999', function(v) {
178
+ return Validation.get('IsEmpty').test(v) || /^([0-9]){5}([-])([0-9]){3}$/.test(v);
179
+ });
180
+ //]]>
181
+ </script>
182
+ </div>
183
+ <div class="field get-cep">
184
+
185
+ <span>Buscar Endereço</span>
186
+
187
+ </div>
188
+ </li>
189
+ <li class="wide <?php echo $state_cep ?>">
190
+ <label for="billing:street1" class="required">Endereço</label>
191
+ <div class="input-box <?php echo $state_cep ?>">
192
+ <input autocomplete="off" type="text" title="Endereço da rua" name="billing[street][0]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry validate-length minimum-length-4 maximum-length-45" placeholder="Endereço">
193
+ </div>
194
+ </li>
195
+ <li class="fields <?php echo $state_cep ?>">
196
+ <div class="field <?php echo $state_cep ?>">
197
+ <label for="billing:street2" class="required">Número</label>
198
+ <div class="input-box">
199
+ <input autocomplete="off" type="text" title="Número" name="billing[street][1]" id="billing:street2" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(2)) ?>" class="input-text required-entry validate-length minimum-length-1 maximum-length-5" placeholder="Número">
200
+ </div>
201
+ </div>
202
+ <div class="field <?php echo $state_cep ?>">
203
+ <label for="billing:street3">Complemento</label>
204
+ <div class="input-box">
205
+ <input autocomplete="off" type="text" title="Complemento" name="billing[street][2]" id="billing:street3" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(3)) ?>" class="input-text validate-length minimum-length-1 maximum-length-30" placeholder="Complemento">
206
+ </div>
207
+ </div>
208
+ </li>
209
+
210
+
211
+
212
+ <li class="fields <?php echo $state_cep ?>">
213
+ <div class="field <?php echo $state_cep ?>">
214
+ <label for="billing:street4" class="required">Bairro</label>
215
+ <div class="input-box">
216
+ <input autocomplete="off" type="text" title="Bairro" name="billing[street][3]" id="billing:street4" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(4)) ?>" class="input-text required-entry validate-length minimum-length-1 maximum-length-30" placeholder="Bairro">
217
+ </div>
218
+ </div>
219
+ <div class="field <?php echo $state_cep ?>">
220
+ <label for="billing:city" class="required">Cidade</label>
221
+ <div class="input-box">
222
+ <input autocomplete="off" type="text" title="Cidade" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>"class="input-text required-entry" id="billing:city" placeholder="Cidade">
223
+ </div>
224
+ </div>
225
+ </li>
226
+
227
+ <li class="fields <?php echo $state_cep ?>">
228
+ <div class="field <?php echo $state_cep ?>">
229
+ <label for="billing:region_id" class="">Estado</label>
230
+ <div class="input-box">
231
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
232
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
233
+ </select>
234
+ <script type="text/javascript">
235
+ //<![CDATA[
236
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
237
+ //]]>
238
+ </script>
239
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
240
+ </div>
241
+ </div>
242
+
243
+ <div class="field no-display">
244
+ <label for="billing:country_id" class="required"><em></em>País</label>
245
+ <div class="input-box">
246
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
247
+ </div>
248
+ </div>
249
+ </li>
250
+
251
+
252
+ <li class="control">
253
+ <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>">
254
+ <input type="hidden" name="billing[save_in_address_book]" value="1" />
255
+ <input type="hidden" name="billing[address_id]" value=""/>
256
+ </li>
257
+ <div class="buttons-set">
258
+ <button type="submit" title="Prosseguir" class="btn btn-success" id="init-account"><span><span>Prosseguir</span></span></button>
259
+ </div>
260
+ </div>
261
+ </ul>
262
+ </fieldset>
263
+ <script type="text/javascript">
264
+ //<![CDATA[
265
+ jQuery(function(){jQuery("#billing-new-address-form").show();});
266
+ var billing = new Billing("co-billing-form","<?php echo $this->getUrl('checkout/onepage/getAddress/address/') ?>", "<?php echo $this->getUrl('checkout/onepage/saveBilling/') ?>");
267
+ var billingForm = new VarienForm("co-billing-form");
268
+
269
+ var billingRegionUpdater = new RegionUpdater("billing:country_id", "billing:region", "billing:region_id", countryRegions, undefined, "billing:postcode");
270
+ var formAccount = new VarienForm('onestep_form_account', true);
271
+ //]]>
272
+ </script>
273
+
274
+ </form>
app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/logged/forgotpassword.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <form method="post" id="form-validate" >
3
+ <div class="fieldset" >
4
+ <p><?php echo $this->__('Por favor, informe o email. Será encaminhado um link para o seu email com a nova senha.')?></p>
5
+ <ul class="form-list">
6
+ <li >
7
+ <label for="email_address" class="required"><?php echo $this->__('Email Address');?> <em >* </em> </label>
8
+ <div class="input-box" >
9
+ <input type="text" name="email" alt="email" id="email_address" class="input-text required-entry validate-email cp-email-recuperar-senha" value="<?php echo $this->htmlEscape($this->getEmailValue()) ?>" />
10
+ <div id="errorforgotpass" class="validation-advice"><?php echo $this->__('Invalid email!');?></div>
11
+ </div>
12
+ </li>
13
+ </ul>
14
+ </div>
15
+ <div class="buttons-set" >
16
+ <span id="forgotpass-please-wait" class="please-wait">
17
+ <img class="v-middle" title="Loading next step..." alt="Loading next step..." src="<?php echo $this->getSkinUrl('/MOIP/onestepcheckout/images/opc-ajax-loader.gif') ?>"><?php echo $this->__('Loading...');?>
18
+ </span>
19
+ <button id="btforgotpass" type="button" onclick="onepageforgotpassword(this)" title="<?php echo $this->__('Submit') ?>" class="button"><span ><span><?php echo $this->__('Submit') ?></span></span></button>
20
+ <button type="button" class="no-button" data-dismiss="modal" aria-hidden="true">Voltar para página de login</button>
21
+ </div>
22
+ </form>
23
+
24
+ <script type="text/javascript">
25
+ //<![CDATA[
26
+ var dataForm = new VarienForm('form-validate', true);
27
+ function onepageforgotpassword(button)
28
+ {
29
+ if(dataForm.validator && dataForm.validator.validate()){
30
+ updateForgotpassword(jQuery('#email_address').val());
31
+ }
32
+ jQuery('#errorforgotpass').css('display','none');
33
+ }
34
+ //]]>
35
+ </script>
36
+ <script type="text/javascript">
37
+ //<![CDATA[
38
+ jQuery('#forgotpass-please-wait').css('display','none');
39
+ jQuery('#errorforgotpass').css('display','none');
40
+ function updateForgotpassword(email) {
41
+ jQuery('#btforgotpass').css('display','none');
42
+ jQuery('#forgotpass-please-wait').css('display','block');
43
+ jQuery.ajax({
44
+ type: "POST",
45
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/forgotpass')?>",
46
+ data: "email="+email,
47
+ success: function(msg){
48
+
49
+ jQuery('#form-validate').html("<h2>O email de recuperaçao de senha foi enviado.</h2><button type='button' class='buttons-set' data-dismiss='modal' aria-hidden='true'>Voltar para página de login</button>");
50
+
51
+
52
+ }
53
+ });
54
+ }
55
+ //]]>
56
+ </script>
app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/logged/login-pre.phtml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="form-list">
2
+ <li class="wide">
3
+ <label for="login-email" class="required" >Email</label>
4
+ <div class="input-box" >
5
+ <input type="text" name="checked-logi-email" id="checked-login-email" title="Endereço de e-mail" class=" form-control input-text validate-email" placeholder="Digite seu e-mail">
6
+ </div>
7
+ </li>
8
+ <li class="wide">
9
+ <label for="login-password" class="required" >Senha</label>
10
+ <div class="input-box">
11
+ <input type="password" class="form-control input-text" placeholder="Digite sua senha" id="login-password-pre">
12
+ </div>
13
+ </li>
14
+ <li>
15
+ <a href="#" data-toggle="modal" data-target="#EsqueceuSenha" class="f-left link-recuperar-senha"><?php echo $this->__('Forgot your password?') ?></a>
16
+ </li>
17
+ </ul>
18
+ <div class="buttons-set">
19
+ <button class="btn btn-secondary btn-success" title="Entrar" onclick="onepageLoginPre(this)" type="button" name="pre-login"><span><span>Entrar</span></span></button>
20
+ </div>
21
+
22
+
23
+ <div id="dados_incorretos" style="display:none; height:90px;position: relative">
24
+ <ul class="messages"> <li class="error-msg">Dados incorretos, por favor tente novamente.<li><ul>
25
+ </div>
26
+ <div class="logando_aguarde" style="display:none">
27
+ <span>Por favor, aguarde!</span>
28
+ <p id="loading_mask_loader" class="loader"><img alt="Loading..." src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>">.</p>
29
+
30
+ </div>
31
+
32
+
33
+
34
+ <script type="text/javascript">
35
+ //<![CDATA[
36
+ function onepageLoginPre(email,password)
37
+ {
38
+ jQuery('#dados_incorretos').hide('fast');
39
+ jQuery.ajax({
40
+ type: "POST",
41
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/updatelogin')?>",
42
+ data: "email="+jQuery('#checked-login-email').val()+"&"+"password="+jQuery('#login-password-pre').val(),
43
+ success: function(msg){
44
+ if(msg==0){
45
+
46
+ jQuery('#dados_incorretos').show('slow');
47
+
48
+ } else {
49
+ jQuery('.logando_aguarde').show();
50
+ var url="<?php echo Mage::getUrl('checkout/onepage'); ?>";
51
+ jQuery(location).attr('href',url);
52
+ }
53
+ }
54
+ });
55
+ }
56
+ //]]>
57
+ </script>
app/design/frontend/base/default/template/MOIP/onestepcheckout/cadastro/onepagejs.phtml ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
2
+
3
+ <script type="text/javascript">
4
+ //<![CDATA[
5
+
6
+
7
+ (function($) {
8
+
9
+ var buscacepurl = "<?php echo Mage::getUrl('Transparente/Standard/buscaCep') ?>";
10
+
11
+ logined = function()
12
+ {
13
+ <?php if(Mage::getSingleton('customer/session')->isLoggedIn()):?>
14
+ return 1;
15
+ <?php else: ?>
16
+ return 0;
17
+ <?php endif ?>
18
+ }
19
+ ProxCamp = function(fields) {
20
+ fields.value=soNumeros(fields.value)
21
+ if (fields.value.length == fields.maxLength) {
22
+ for (var i = 0; i < fields.form.length; i++) {
23
+ if (fields.form[i] == fields && fields.form[(i + 1)] && fields.form[(i + 1)].type != "hidden") {
24
+ fields.form[(i + 1)].focus();
25
+ break;
26
+ }
27
+ }
28
+ }
29
+ };
30
+
31
+
32
+
33
+ soNumeros = function(v){
34
+ return v.replace(/\D/g,"")
35
+ };
36
+
37
+
38
+
39
+
40
+
41
+ getval = function(sel) {
42
+ if (sel.value == 1){
43
+ jQuery('.dados-pj').slideUp();
44
+ jQuery('.dados-pj input:not([type=checkbox])').removeClass('required-entry');
45
+ }else{
46
+ jQuery('.dados-pj').slideDown();
47
+ jQuery('.dados-pj input:not([type=checkbox])').addClass('required-entry');
48
+ }
49
+ };
50
+
51
+ marcar_isento = function() {
52
+ jQuery("#insestadual").val("Isento");
53
+ };
54
+
55
+
56
+ buscarEndereco = function(whatform) {
57
+ if (whatform == "billing") {
58
+ jQuery(".hide-zip-code").removeClass("hide-zip-code");
59
+ var campos = {
60
+ postcode: document.getElementById('billing:postcode'),
61
+ street_1: document.getElementById('billing:street1'),
62
+ street_4: document.getElementById('billing:street4'),
63
+ city: document.getElementById('billing:city'),
64
+ region: document.getElementById('billing:region_id')
65
+ };
66
+
67
+ }
68
+ if (whatform == "shipping") {
69
+ var campos = {
70
+ postcode: document.getElementById('shipping:postcode'),
71
+ street_1: document.getElementById('shipping:street1'),
72
+ street_4: document.getElementById('shipping:street4'),
73
+ city: document.getElementById('shipping:city'),
74
+ region: document.getElementById('shipping:region_id'),
75
+ };
76
+
77
+ }
78
+ if (whatform == "register") {
79
+ var campos = {
80
+ postcode: document.getElementById('postcode'),
81
+ street_1: document.getElementById('street_1'),
82
+ street_4: document.getElementById('street_4'),
83
+ city: document.getElementById('city'),
84
+ region: document.getElementById('region_id')
85
+ };
86
+ }
87
+
88
+ jQuery.ajax({
89
+ type:'GET',
90
+ url: buscacepurl+'meio/cep/cep/' + campos.postcode.value.replace(/\+/g, ''),
91
+
92
+ beforeSend: function(data){
93
+ jQuery(campos.street_1).attr('placeholder', 'Buscando Endereço');
94
+ jQuery(campos.street_4).attr('placeholder', 'Buscando Endereço');
95
+ jQuery(campos.city).attr('placeholder', 'Buscando Endereço');
96
+ },
97
+
98
+ success: function(data){
99
+ jQuery('#loading-mask').fadeOut();
100
+ jQuery("#billing\\:street2").focus();
101
+ if(data){
102
+ var addressData = jQuery.parseJSON(data);
103
+ if(addressData.logradouro != "undefined"){
104
+ jQuery(campos.street_1).attr('placeholder', 'Rua');
105
+ jQuery(campos.street_2).attr('placeholder', 'N.º');
106
+ jQuery(campos.street_4).attr('placeholder', 'Bairro');
107
+ jQuery(campos.city).attr('placeholder', 'Cidade');
108
+ jQuery(campos.street_1).val(addressData.logradouro);
109
+ jQuery(campos.street_4).val(addressData.bairro);
110
+ jQuery(campos.city).val(addressData.cidade);
111
+ jQuery(campos.region).val(addressData.ufid);
112
+
113
+ }else {
114
+ jQuery(campos.street_1).val('');
115
+ jQuery(campos.street_4).val('');
116
+ jQuery(campos.city).val('');
117
+ jQuery(campos.street_1).attr('placeholder', 'Rua');
118
+ jQuery(campos.street_2).attr('placeholder', 'N.º');
119
+ jQuery(campos.street_4).attr('placeholder', 'Bairro');
120
+ jQuery(campos.city).attr('placeholder', 'Cidade');
121
+ }
122
+
123
+
124
+ } else {
125
+ jQuery(campos.street_1).attr('placeholder', 'Rua');
126
+ jQuery(campos.street_2).attr('placeholder', 'N.º');
127
+ jQuery(campos.street_4).attr('placeholder', 'Bairro');
128
+ jQuery(campos.city).attr('placeholder', 'Cidade');
129
+
130
+ }
131
+ },
132
+ error: function(){
133
+ jQuery(campos.street_1).val("");
134
+ jQuery(campos.street_4).val("");
135
+ jQuery(campos.city).val("");
136
+ jQuery(campos.region).val("");
137
+
138
+ },
139
+ });
140
+ };
141
+
142
+
143
+
144
+ showcreateAccount = function(){
145
+ jQuery("#cadastrar").removeClass('force-nodisplay');
146
+
147
+ jQuery("#criar_loga").hide();
148
+ };
149
+
150
+
151
+ checkedLoginStep = function(val){
152
+ jQuery('#loading-mask').show();
153
+ jQuery.ajax({
154
+ async:false,
155
+ type: "POST",
156
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>",
157
+ data:"email="+val,
158
+
159
+ success: function(msg){
160
+
161
+ if(msg==0){
162
+ jQuery('#loading-mask').hide();
163
+ jQuery('.pre-step').hide();
164
+ jQuery('#login-checked').show();
165
+ jQuery('#login-checked').removeClass('no-display');
166
+ jQuery('#checked-login-email').val(val);
167
+
168
+ }else{
169
+ jQuery('#loading-mask').hide();
170
+ jQuery('.pre-step').hide();
171
+ jQuery('#billing\\:email').val(val);
172
+ jQuery('#create-checked').removeClass('no-display');
173
+ jQuery('#create-checked').show();
174
+ }
175
+
176
+ }
177
+ });
178
+ }
179
+ updateEmailmsg = function(val){
180
+
181
+ jQuery.ajax({
182
+ type: "POST",
183
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>",
184
+ data:"email="+val,
185
+
186
+ success: function(msg){
187
+ val=jQuery('#billing\\:email').val();
188
+ emailvalidated=Validation.get('IsEmpty').test(val) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(val);
189
+
190
+ var error="<div id=\"message-box\"><div class=\"validation-advice\" style=\"position:relative;\">Email já cadastrado, por favor <a href=\"#\" data-toggle=\"modal\" data-target=\"#loginModel\" id=\"loginbox\">Clique aqui e faça o login</a></div></div>";
191
+ if(msg==0){
192
+ jQuery('#billing\\:email').after(error);
193
+ jQuery('#message-box').html(error);
194
+ return 0;
195
+
196
+ }else{
197
+ if(logined()!=1){
198
+ jQuery('#message-box').html('');
199
+ }
200
+ jQuery('#billing\\:email').removeClass('validation-failed');
201
+ return 1;
202
+ }
203
+ }
204
+ });
205
+ }
206
+
207
+
208
+
209
+ })(jQuery);
210
+
211
+
212
+
213
+ jQuery(document).ready(function(){
214
+ ChangeEvents();
215
+ Setmask();
216
+
217
+ jQuery('#init-account').bind("click",function(e){
218
+ e.preventDefault();
219
+
220
+ var form = new VarienForm('onestep_form_account', true);
221
+
222
+ if(form.validator.validate()) {
223
+ var email = jQuery('#billing\\:email').val();
224
+ jQuery.ajax({
225
+ type: "POST",
226
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>",
227
+ data:"email="+email,
228
+
229
+ success: function(msg){
230
+
231
+ if(msg==0){
232
+ return false;
233
+
234
+ }else{
235
+ jQuery('#loading-mask').show();
236
+ jQuery( "#onestep_form_account" ).submit();
237
+ }
238
+ }
239
+ });
240
+
241
+
242
+
243
+ } else {
244
+ jQuery(".erros_cadastro_valores").html("");
245
+ var erro_dado = [];
246
+ var j = 0;
247
+ jQuery(".validation-failed").each(function() {
248
+ j++;
249
+ temp_erro = jQuery(this).attr("title");
250
+ if(jQuery.inArray(temp_erro, erro_dado) != 1){
251
+ erro_dado[j] = jQuery(this).attr("title");
252
+ jQuery(".erros_cadastro_valores").append('<li>'+erro_dado[j]+'</li>');
253
+ }
254
+
255
+
256
+ });
257
+
258
+ jQuery('#ErrosFinalizacao').modal('toggle');
259
+
260
+ return false;
261
+ }
262
+
263
+ });
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+ });
274
+
275
+
276
+ //]]>
277
+ </script>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard.phtml CHANGED
@@ -1,213 +1,257 @@
1
  <?php $color = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor'); ?>
2
  <?php $botao_color = "#".Mage::getStoreConfig('onestepcheckout/layout/botao_cor');?>
 
 
 
3
  <?php $islogin=0; if(Mage::getSingleton('customer/session')->isLoggedIn()) $islogin=1; ?>
4
  <style type="text/css">
5
- #loginbox, #btn_logar,.btn-update-qty{background:<?php echo $botao_color;?>;padding: 5px 10px;color:#fff;text-decoration: none;border-radius: 5px;text-align: center;}
6
- div.moip-osc-block-title{border-bottom:4px solid <?php echo $color;?>;}
7
  p.moip-osc-block-title{color:<?php echo $color;?>;}
8
  .moip-osc-block-title>h3 {color: <?php echo $color;?>;}
9
-
10
-
 
 
 
 
 
 
 
 
 
 
11
  </style>
12
  <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==2){
13
- $class_nodisplay = "";
14
- $urlPost= $this->getUrl('onestepcheckout/index/updateordermethod');
15
- $class_1collun = "span4 grid12-4";
16
- $class_2collun = "span8 grid12-8";
17
- $style_2collun = "";
18
- $style_2collun = "";
19
- $class_3collun = "span8 grid12-8";
20
- $class_4collun = "span8 grid12-8";
21
  } elseif(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==3){
22
- $class_nodisplay = "";
23
- $urlPost= $this->getUrl('onestepcheckout/index/updateordermethod');
24
- $class_1collun = "span4 grid12-4";
25
- $class_2collun = "span8 grid12-8";
26
- $style_2collun = "margin-left:0 !important; margin-right: 0 !important; width: 65% !important";
27
- $class_Shippingcollun = "span6 grid12-6";
28
- $class_Paymentcollun = "span6 grid12-6";
29
- $class_3collun = "span8 grid12-8";
30
  } elseif(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==4){
31
- $class_nodisplay = "";
32
- $urlPost= $this->getUrl('onestepcheckout/index/updateordermethod');
33
- $class_1collun = "span4 grid12-4";
34
- $class_2collun = "span4 grid12-4";
35
- $style_2collun = "";
36
- $style_2collun = "";
37
- $class_3collun = "span4 grid12-4";
38
  } else {
39
- if($islogin){
40
- $class_nodisplay = "";
41
- $urlPost= $this->getUrl('onestepcheckout/index/updateordermethod');
42
- $class_1collun = "span4 grid12-4";
43
- $class_2collun = "span4 grid12-5";
44
- $style_2collun = "";
45
- $class_3collun = "span8 grid12-3";
46
-
47
- } else {
48
- $urlPost= $this->getUrl('onestepcheckout/index/CreataAccountInit');
49
- $class_nodisplay = "force-nodisplay";
50
- $class_1collun = "span4 grid12-8";
51
- $class_2collun = "span4 grid12-8";
52
- $style_2collun = "";
53
- $class_Shippingcollun = "span6 grid12-6";
54
- $class_Paymentcollun = "span6 grid12-6";
55
- $style_2collun = "";
56
- $class_3collun = "span4 grid12-4";
57
- }
58
- } ?>
59
 
 
60
 
61
- <div class="moip-osc-threecolumns moip-osc-checkoutcontainer moip-osc-skin-generic">
62
 
63
- <form id="onestep_form" autocomplete="off" action="<?php echo $urlPost ?>" method="POST" class="scaffold-form">
 
 
64
  <?php echo $this->getBlockHtml('formkey') ?>
65
- <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==5): ?>
66
- <div class="moip-osc-column <?php echo $class_3collun;?>" id="review_collum">
67
- <div class="moip-osc-block">
68
- <div class="moip-osc-block-title">
69
- <div class="onestepcheckout-numbers onestepcheckout-numbers-6"></div>
70
- <h3><?php echo $this->__('Itens do Carrinho');?></h3>
71
- </div>
72
- <div class="moip-osc-block-content">
73
- <?php echo $this->getChildHtml('review',false,true);?>
74
-
75
- <?php if(Mage::helper('onestepcheckout')->showCouponCode() && $islogin):?>
76
- <?php echo $this->getChildHtml('coupon',false,true);?>
77
- <?php endif;?>
78
-
79
  </div>
80
- </div>
81
- </div>
82
- <?php endif;?>
83
- <div class="moip-osc-column <?php echo $class_1collun; ?>" id="first_collun">
84
- <div class="moip-osc-block-title">
85
- <div class="onestepcheckout-numbers onestepcheckout-numbers-1"></div>
86
- <h3><?php echo $this->__('Dados de Cadastro');?></h3>
87
- </div>
88
- <div class="moip-osc-block-content">
89
- <div class="billing_start">
90
- <?php if($class_nodisplay): ?>
91
- <div id="criar_loga">
92
- <div class="span6 grid12-6">
93
- <h2>Quero me Cadastrar</h2>
94
- <div class="content">
95
-
96
- <p class="form-instructions">Cadastre-se para finalizar seu pedido</p>
97
-
98
- <div class="buttons-set">
99
- <div onclick="showcreateAccount();" class="button btn-button" id="btn_logar">Criar Conta</div>
100
- </div>
101
- </div>
102
  </div>
103
- <div class="span6 grid12-6" style="border-left:1px solid; padding-left:2%;width: 45%;">
104
- <h2>Já Tenho Cadastro</h2>
105
- <div class="content">
106
-
107
- <p class="form-instructions">Já tem um cadastro conosco?</p>
108
-
109
- <div class="buttons-set">
110
- <a href="#" data-toggle="modal" class="button btn-button" data-target="#loginModel" id="loginbox" style="display:block">Clique aqui e faça o login</a>
111
- </div>
112
  </div>
113
-
114
-
115
  </div>
116
  </div>
117
- <?php endif ?>
118
- <div class="<?php echo $class_nodisplay; ?>" id="cadastrar"><?php echo $this->getChildHtml('billing',false,true);?></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  </div>
121
- </div>
122
- <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()): ?>
123
- <?php if(Mage::getStoreConfig('onestepcheckout/config/allowshippingotheraddress')):?>
124
- <div style="display:none;" id="shipping_show">
125
- <div class="moip-osc-block-title">
126
- <div class="onestepcheckout-numbers onestepcheckout-numbers-2" ></div>
127
- <h3><?php echo $this->__('Shipping address');?></h3>
128
- </div>
129
- <div class="moip-osc-block-content">
130
- <div>
131
- <?php echo $this->getChildHtml('shipping',false,true);?>
132
- </div>
133
- </div>
134
- </div>
135
  <?php endif; ?>
136
- <?php endif;?>
 
 
 
 
 
137
 
138
- </div>
 
 
139
 
140
- <div class="moip-osc-column <?php echo $class_2collun.' '.$class_nodisplay; ?>" style="<?php echo $style_2collun ?>">
141
 
142
- <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
143
- <div class="moip-osc-column <?php echo $class_Shippingcollun; ?>">
144
- <div class="moip-osc-block" >
145
- <div class="moip-osc-block-title">
146
- <div class="onestepcheckout-numbers onestepcheckout-numbers-2" id="moip-osc-p2"></div>
147
- <h3> <?php echo $this->__('Envio');?> </h3>
148
- </div>
149
- <div class="moip-osc-block-content">
150
- <?php if(!$class_nodisplay): ?>
151
- <?php echo $this->getChildHtml('shipping_method',false,true);?>
152
- <?php if(Mage::helper('onestepcheckout')->enableGiftMessage()):?>
153
- <?php echo $this->getChildHtml('additional',false,true) ?>
154
- <?php endif; ?>
155
- <?php endif; ?>
156
- </div>
157
- </div>
158
- </div>
159
- <?php endif?>
160
- <div class="moip-osc-column <?php echo $class_Paymentcollun; ?>">
161
- <div class="moip-osc-block">
162
- <div class="moip-osc-block-title">
163
- <div <?php
164
- if(Mage::helper('onestepcheckout')->onlyProductDownloadable()){
165
- echo "class='onestepcheckout-numbers onestepcheckout-numbers-2' id='moip-osc-p2'";
166
- }else{
167
- echo "class='onestepcheckout-numbers onestepcheckout-numbers-3' id='moip-osc-p3'";
168
- }
169
- ?>>
170
  </div>
171
- <h3><?php echo $this->__('Pagamento');?></h3>
172
  </div>
173
- <div class="moip-osc-block-content">
174
- <?php if(!$class_nodisplay): ?>
175
- <?php echo $this->getChildHtml('payment',false,true);?>
176
- <?php endif; ?>
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </div>
179
  </div>
180
- </div>
181
-
182
- </div>
183
- <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')!=5): ?>
184
- <div class="moip-osc-column <?php echo $class_3collun;?>" id="review_collum">
185
- <div class="moip-osc-block">
186
- <div class="moip-osc-block-title">
187
- <div class="onestepcheckout-numbers onestepcheckout-numbers-6"></div>
188
- <h3><?php echo $this->__('Itens do Carrinho');?></h3>
189
  </div>
190
- <div class="moip-osc-block-content">
191
- <?php echo $this->getChildHtml('review',false,true);?>
192
- <?php if(Mage::helper('onestepcheckout')->showCouponCode()):?>
193
- <?php echo $this->getChildHtml('coupon',false,true);?>
194
- <?php endif;?>
195
-
 
 
 
 
 
 
 
 
 
196
  </div>
197
- </div>
198
- </div>
199
- <?php endif;?>
200
-
201
-
202
-
203
  </form>
204
-
205
  </div>
206
-
 
207
  <div id="loading-mask">
208
  <div id="loading_mask_loader" class="loader">
209
  <img alt="Loading..." class="loading_img" src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>">
210
- <span>Atualizando dados, por favor aguarde...</span>
211
  </div>
212
  </div>
213
 
@@ -217,17 +261,15 @@
217
 
218
 
219
  <div class="modal fade" id="ErrosFinalizacao" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="false">
220
- <div class="modal-dialog modal-sm">
221
  <div class="modal-content">
222
  <div class="modal-header">
223
- <h4 class="modal-title" id="myModalLabel">Ops, corriga os campos abaixo:</h4>
224
  </div>
225
  <div class="modal-body">
226
  <div class="erros_cadastro">
227
- <ul class="erros_cadastro_valores">
228
- </ul>
229
-
230
- </div>
231
  </div>
232
  <div class="modal-footer">
233
  <button type="button" class="button btn btn-default" data-dismiss="modal">Ok, entendi!</button>
@@ -239,7 +281,7 @@
239
  <?php if(!$islogin):?>
240
 
241
  <div class="modal fade" id="loginModel" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
242
- <div class="modal-dialog modal-sm">
243
  <div class="modal-content">
244
  <div class="modal-header">
245
  <h4 class="modal-title" id="myModalLabel">Entrar</h4>
@@ -259,7 +301,7 @@
259
  <?php if(!$islogin):?>
260
 
261
  <div class="modal fade" id="EsqueceuSenha" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
262
- <div class="modal-dialog modal-sm">
263
  <div class="modal-content">
264
  <div class="modal-header">
265
  <h4 class="modal-title" id="myModalLabel">Recuperar Senha</h4>
@@ -277,10 +319,10 @@
277
  <?php endif; ?>
278
 
279
  <div class="modal fade" id="store_secure_content" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
280
- <div class="modal-dialog modal-sm">
281
  <div class="modal-content">
282
  <div class="modal-header">
283
- <h4 class="modal-title" id="myModalLabel">Loja Segura</h4>
284
  </div>
285
  <div class="modal-body">
286
  <?php echo $this->__(Mage::getStoreConfig('onestepcheckout/modaluse/secure'));?>
@@ -295,7 +337,7 @@
295
 
296
 
297
  <div class="modal fade" id="termos_modal" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
298
- <div class="modal-dialog modal-sm">
299
  <div class="modal-content">
300
  <div class="modal-header">
301
  <h4 class="modal-title" id="myModalLabel">Termos e Condições</h4>
@@ -311,4 +353,3 @@
311
  </div>
312
 
313
 
314
-
1
  <?php $color = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor'); ?>
2
  <?php $botao_color = "#".Mage::getStoreConfig('onestepcheckout/layout/botao_cor');?>
3
+ <?php $style_cor_background = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor_background');?>
4
+ <?php $style_cor_header = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor_header');?>
5
+ <?php $style_cor_step = "#".Mage::getStoreConfig('onestepcheckout/layout/style_cor_step');?>
6
  <?php $islogin=0; if(Mage::getSingleton('customer/session')->isLoggedIn()) $islogin=1; ?>
7
  <style type="text/css">
8
+ #loginbox, #btn_logar,.btn-update-qty{background:<?php echo $botao_color;?>;padding: 5px 10px;color:#fff;text-decoration: none;border-radius: 5px;text-align: center;width: 90%; cursor: pointer;}
9
+
10
  p.moip-osc-block-title{color:<?php echo $color;?>;}
11
  .moip-osc-block-title>h3 {color: <?php echo $color;?>;}
12
+ .wrapper {background: <?php echo $style_cor_background;?>}
13
+ .header {background: <?php echo $style_cor_header;?>}
14
+ .full-container {background: <?php echo $style_cor_header;?>}
15
+ <?php if($islogin): ?>
16
+ #review_info {display: none;}
17
+ #review_collum > .moip-osc-block > .moip-osc-block-content, #first_collun > .moip-osc-block-content {background: #FBFBFB; color: #ccc;}
18
+ #first_collun > .moip-osc-block-content .form-list .input-box input, #first_collun > .moip-osc-block-content .form-list .input-box select{background: #FBFBFB; color: #ccc;}
19
+ #first_collun > .moip-osc-block-content:hover .form-list .input-box input, #first_collun > .moip-osc-block-content:hover .form-list .input-box select{background: #FFF; color: #000;}
20
+ #review_collum > .moip-osc-block > .moip-osc-block-content:hover, #first_collun > .moip-osc-block-content:hover {background: #FFF; color: #000;}
21
+ #first_collun > .moip-osc-block-content .form-list label { display: none;}
22
+ #first_collun > .moip-osc-block-content .form-list .control label {display: block}
23
+ <?php endif;?>
24
  </style>
25
  <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==2){
26
+ $class_address_user = "col-xm-12 col-lg-4 col-md-4";
27
+ $class_set_midle_coll = "col-xm-12 col-lg-8 col-lg-8";
28
+ $class_Shippingcollun = "no-set-coll";
29
+ $class_Paymentcollun = "no-set-coll";
30
+ $class_Review = "col-lg-4 col-xm-12 col-md-4";
31
+
 
 
32
  } elseif(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==3){
33
+ $class_address_user = "col-xm-12 col-lg-4 col-md-4";
34
+ $class_set_midle_coll = "no-set-coll";
35
+ $class_Shippingcollun = "col-lg-4 col-xm-12 col-md-4";
36
+ $class_Paymentcollun = "col-lg-4 col-xm-12 col-md-4";
 
 
 
 
37
  } elseif(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==4){
38
+
39
+ $class_address_user = "col-xm-12 col-lg-4 col-md-4";
40
+ $class_set_midle_coll = "col-xm-12 col-lg-4 col-md-4";
41
+ $class_Shippingcollun = "no-set-coll";
42
+ $class_Paymentcollun = "no-set-coll";
43
+ $class_Review = "col-lg-4 col-xm-12 col-md-4";
 
44
  } else {
45
+ $class_address_user = "col-xm-12 col-lg-4 col-md-4";
46
+ $class_Shippingcollun = "col-lg-4 col-xm-12 col-md-4";
47
+ $class_Paymentcollun = "col-lg-4 col-xm-12 col-md-4";
48
+ $class_Review = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ } ?>
51
 
 
52
 
53
+ <div class="container body-wrapper">
54
+ <div class="row">
55
+ <form id="onestep_form" autocomplete="off" action="<?php echo $this->getUrl('onestepcheckout/index/updateordermethod') ?>" method="POST" class="scaffold-form">
56
  <?php echo $this->getBlockHtml('formkey') ?>
57
+
58
+ <div class="moip-osc-column <?php echo $class_address_user; ?>" id="first_collun">
59
+ <div class="moip-osc-block-title">
60
+ <h3><?php echo $this->__('Dados de Cadastro');?></h3>
61
+ </div>
62
+ <div class="moip-osc-block-content force-none-float">
63
+ <div class="billing_start">
64
+ <div id="cadastrar"><?php echo $this->getChildHtml('billing',false,true);?></div>
 
 
 
 
 
 
65
  </div>
66
+ </div>
67
+ <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()): ?>
68
+ <?php if(Mage::getStoreConfig('onestepcheckout/config/allowshippingotheraddress')):?>
69
+ <div style="display:none;" id="shipping_show">
70
+ <div class="moip-osc-block-title">
71
+ <h3><?php echo $this->__('Shipping address');?></h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  </div>
73
+ <div class="moip-osc-block-content">
74
+ <div>
75
+ <?php echo $this->getChildHtml('shipping',false,true);?>
 
 
 
 
 
 
76
  </div>
 
 
77
  </div>
78
  </div>
79
+ <?php endif; ?>
80
+ <?php endif;?>
81
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==5 || Mage::getStoreConfig('onestepcheckout/layout/page_layout')==2): ?>
82
+ <div class="panel-group">
83
+ <div class="panel panel-default">
84
+ <div class="panel-heading">
85
+ <h4 class="panel-title">
86
+ <a data-toggle="collapse" href="#review">Revisão dos Itens</a>
87
+ </h4>
88
+ </div>
89
+ <div id="review" class="panel-collapse collapse">
90
+ <div class="panel-body"><?php echo $this->getChildHtml('review',false,true);?></div>
91
+
92
+ </div>
93
+ </div>
94
+ </div>
95
+ <div class="panel-group">
96
+ <div class="panel panel-default">
97
+ <div class="panel-heading">
98
+ <h4 class="panel-title">
99
+ <a data-toggle="collapse" href="#coupon">Tem um Cupom?</a>
100
+ </h4>
101
+ </div>
102
+ <div id="coupon" class="panel-collapse collapse">
103
+ <div class="panel-body"><?php echo $this->getChildHtml('coupon',false,true);?></div>
104
+
105
+ </div>
106
+ </div>
107
+ </div>
108
+
109
+
110
+ <?php endif; ?>
111
 
112
  </div>
113
+
114
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==4 || Mage::getStoreConfig('onestepcheckout/layout/page_layout')==2): ?>
115
+ <div class="<?php echo $class_set_midle_coll ?>">
 
 
 
 
 
 
 
 
 
 
 
116
  <?php endif; ?>
117
+
118
+ <div class="<?php echo $class_Shippingcollun ?>">
119
+ <div class="moip-osc-block" >
120
+ <div class="moip-osc-block-title">
121
+ <h3> <?php echo $this->__('Entrega');?> </h3>
122
+ </div>
123
 
124
+ <div class="moip-osc-block-content">
125
+
126
+ <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
127
 
 
128
 
129
+
130
+ <?php echo $this->getChildHtml('shipping_method',false,true);?>
131
+ <?php if(Mage::helper('onestepcheckout')->enableGiftMessage()):?>
132
+ <?php echo $this->getChildHtml('additional',false,true) ?>
133
+ <?php endif; ?>
134
+
135
+
136
+
137
+ <?php endif?>
138
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  </div>
 
140
  </div>
141
+ </div>
142
+
 
 
143
 
144
+ <div class="<?php echo $class_Paymentcollun ?>">
145
+ <div class="moip-osc-block" >
146
+ <div class="moip-osc-block-title">
147
+ <h3> <?php echo $this->__('Pagamento');?> </h3>
148
+ </div>
149
+ <div class="moip-osc-block-content">
150
+
151
+ <?php echo $this->getChildHtml('payment',false,true);?>
152
+
153
+
154
+ <div class="buttons-set">
155
+ <?php $islogin=0; if(Mage::getSingleton('customer/session')->isLoggedIn()) $islogin=1; ?>
156
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==5 ){
157
+ if(!$islogin){
158
+ $notenable = 1;
159
+ } else{
160
+ $notenable = "";
161
+ }
162
+ } else {
163
+ $notenable = "";
164
+ }
165
+
166
+ ?>
167
+ <?php if(!$notenable): ?>
168
+
169
+
170
+ <div id="checkout-review-terms">
171
+ <?php if(Mage::getStoreConfig('onestepcheckout/modaluse/termos')):?>
172
+ <div class="onestepcheckout-enable-terms" style="postion:relative;">
173
+ <ul class="form-list">
174
+ <li class="control">
175
+ <input class="required-entry checkbox" type="checkbox" id="id_accept_terms" name="accept_terms" value="1" checked="checked" s />
176
+ <label for="termos"><?php echo $this->__('Eu aceito o');?> <a id="onestepcheckout-toc-link" data-toggle="modal" data-target="#termos_modal" href="#"><?php echo $this->__('Contrato de compra e os Termos de uso do site.');?></a></label>
177
+ </li>
178
+ </ul>
179
+ </div>
180
+ <?php endif ?>
181
+ </div>
182
+ <?php if(Mage::getStoreConfig('onestepcheckout/addfield/usenews')==1):?>
183
+ <?php if(Mage::helper('onestepcheckout')->issubscribed()):?>
184
+ <ul class="form-list">
185
+ <li class="control">
186
+ <input type="checkbox" name="subscribe_newsletter" value="0" title="<?php echo $this->__('Receber novidades') ?>" id="subscribe_newsletter" class="checkbox"> <label for="subscribe_newsletter"><?php echo $this->__('Receber novidades') ?></label>
187
+ </li>
188
+ </ul>
189
+ <?php endif?>
190
+ <?php endif ?>
191
+
192
+ <?php if(Mage::getStoreConfig('onestepcheckout/addfield/usenews')==2):?>
193
+ <?php if(Mage::helper('onestepcheckout')->issubscribed()):?>
194
+ <ul class="form-list">
195
+ <li class="control">
196
+ <input type="checkbox" name="subscribe_newsletter" value="1" checked="checked" title="<?php echo $this->__('Receber novidades') ?>" id="subscribe_newsletter" class="checkbox"> <label for="subscribe_newsletter" style="float:none;"><?php echo $this->__('Receber novidades') ?></label>
197
+ </li>
198
+ </ul>
199
+ <?php endif?>
200
+ <?php endif?>
201
+
202
+
203
+
204
+
205
+ <div id="onestepcheckout_place_order_button">
206
+ <button type="button" title="<?php echo $this->__('Place Order') ?>" class="btn-checkout btn btn-success btn-lg btn-block" id="checkout-onepage-buttom">
207
+ <span><span><?php echo $this->__('Place Order') ?> <i class="fa fa-arrow-right"></i></span></span></button>
208
+ </div>
209
+
210
+ <?php if(Mage::getStoreConfig('onestepcheckout/modaluse/use_secure')){ ?>
211
+
212
+ <?php } ?>
213
+
214
+
215
+
216
+ <?php if(Mage::helper('onestepcheckout')->showComment()):?>
217
+ <div class="onestepcheckout-comments">
218
+ <label for="id_comments"><?php echo $this->__('Comentários do Pedido:');?></label><br/>
219
+ <textarea id="id_comments" name="onestepcheckout_comments" cols="40" rows="4"></textarea>
220
+ </div>
221
+ <?php endif;?>
222
+
223
+ <?php endif; ?>
224
+ </div>
225
+ </div>
226
  </div>
227
  </div>
228
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==4 || Mage::getStoreConfig('onestepcheckout/layout/page_layout')==2): ?>
 
 
 
 
 
 
 
 
229
  </div>
230
+ <?php endif; ?>
231
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==3 || Mage::getStoreConfig('onestepcheckout/layout/page_layout')==4): ?>
232
+ <div class="<?php echo $class_Review ?>">
233
+ <div class="moip-osc-block" >
234
+ <div class="moip-osc-block-title">
235
+ <h3><?php echo $this->__('Revisão');?></h3>
236
+ </div>
237
+
238
+ <div class="moip-osc-block-content">
239
+ <div id="review">
240
+ <div class="panel-body"><?php echo $this->getChildHtml('review',false,true);?></div>
241
+
242
+ </div>
243
+ </div>
244
+ </div>
245
  </div>
246
+ <?php endif; ?>
 
 
 
 
 
247
  </form>
 
248
  </div>
249
+ </div>
250
+
251
  <div id="loading-mask">
252
  <div id="loading_mask_loader" class="loader">
253
  <img alt="Loading..." class="loading_img" src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>">
254
+ <p><span>Atualizando dados, por favor aguarde...</span></p>
255
  </div>
256
  </div>
257
 
261
 
262
 
263
  <div class="modal fade" id="ErrosFinalizacao" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="false">
264
+ <div class="modal-dialog">
265
  <div class="modal-content">
266
  <div class="modal-header">
267
+ <h4 class="modal-title" id="myModalLabel">Ops, encontramos erros nos campos abaixo:</h4>
268
  </div>
269
  <div class="modal-body">
270
  <div class="erros_cadastro">
271
+ <ul class="erros_cadastro_valores"></ul>
272
+ </div>
 
 
273
  </div>
274
  <div class="modal-footer">
275
  <button type="button" class="button btn btn-default" data-dismiss="modal">Ok, entendi!</button>
281
  <?php if(!$islogin):?>
282
 
283
  <div class="modal fade" id="loginModel" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
284
+ <div class="modal-dialog">
285
  <div class="modal-content">
286
  <div class="modal-header">
287
  <h4 class="modal-title" id="myModalLabel">Entrar</h4>
301
  <?php if(!$islogin):?>
302
 
303
  <div class="modal fade" id="EsqueceuSenha" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
304
+ <div class="modal-dialog">
305
  <div class="modal-content">
306
  <div class="modal-header">
307
  <h4 class="modal-title" id="myModalLabel">Recuperar Senha</h4>
319
  <?php endif; ?>
320
 
321
  <div class="modal fade" id="store_secure_content" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
322
+ <div class="modal-dialog">
323
  <div class="modal-content">
324
  <div class="modal-header">
325
+ <h4 class="modal-title" id="myModalLabel">Site Seguro</h4>
326
  </div>
327
  <div class="modal-body">
328
  <?php echo $this->__(Mage::getStoreConfig('onestepcheckout/modaluse/secure'));?>
337
 
338
 
339
  <div class="modal fade" id="termos_modal" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
340
+ <div class="modal-dialog">
341
  <div class="modal-content">
342
  <div class="modal-header">
343
  <h4 class="modal-title" id="myModalLabel">Termos e Condições</h4>
353
  </div>
354
 
355
 
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/billing.phtml CHANGED
@@ -1,16 +1,16 @@
1
- <?php $myStatus = $this->isCustomerLoggedIn(); ?>
2
- <script type="text/javascript" src="<?php echo $this->getJsUrl('MOIP/onestepcheckout/billing.js') ?>"></script>
3
  <div id="co-billing-form">
4
- <?php if($myStatus): ?>
5
  <ul class="form-list" >
6
  <li class="wide">
7
  <label for="billing-address-select" style="_width:250px;"><?php echo $this->__('Selecione o endereço de seu cadastro ou crie um novo:') ?></label>
8
  <div class="input-box">
9
- <?php echo $this->getAddressesHtmlSelect22('billing') ?>
10
  </div>
11
  </li>
12
  </ul>
13
- <?php endif ?>
14
  <?php echo $this->getChildHtml('billing_form');?>
15
 
16
 
1
+
2
+
3
  <div id="co-billing-form">
4
+ <?php if ($this->customerHasAddresses()): ?>
5
  <ul class="form-list" >
6
  <li class="wide">
7
  <label for="billing-address-select" style="_width:250px;"><?php echo $this->__('Selecione o endereço de seu cadastro ou crie um novo:') ?></label>
8
  <div class="input-box">
9
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
10
  </div>
11
  </li>
12
  </ul>
13
+ <?php endif ?>
14
  <?php echo $this->getChildHtml('billing_form');?>
15
 
16
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/billing/billingform.phtml CHANGED
@@ -1,67 +1,42 @@
1
- <?php
2
- $myStatus = $this->isCustomerLoggedIn();
3
- $data = $this->data();
4
- $fullname = $data['fullname'];
5
- $firstname = $data['firstname'];
6
- $lastname = $data['lastname'];
7
- $region_select = $this->escapeHtml($this->getAddress()->getRegion());
8
- $taxvat = $data['taxvat'];
9
- $exibe_email = $data['exibe_email'];
10
- $_dob = $this->getLayout()->createBlock('customer/widget_dob');
11
- $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat');
12
- $_gender = $this->getLayout()->createBlock('customer/widget_gender');
13
- if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==5){
14
- if(!$myStatus){
15
- $force_division = "span6 grid12-6";
16
- $tyle="border-right:1px solid;width: 47%;";
17
-
18
- } else {
19
- $force_division = "";
20
- $tyle="";
21
- }
22
-
23
- } else {
24
- $force_division = "";
25
- $tyle="";
26
- }
27
- ?>
28
  <fieldset>
29
  <ul class="form-list" id="moip_onstepcheckout_billing_form" >
30
- <?php if(!$myStatus):?>
31
- <?php if(Mage::getStoreConfig('onestepcheckout/layout/enable_quicklogin') && !$force_division):?>
 
32
  <a id="loginbox" href="#" data-toggle="modal" data-target="#loginModel" title="Entrar com a sua conta"><?php echo $this->__('Already registered? Click here to login.');?></a>
 
33
  <?php endif?>
34
- <?php endif?>
35
- <input type="hidden" title="Permanecer logado" name="form_key" value="<? echo Mage::getSingleton('core/session')->getFormKey(); ?>" class="input-hidden" />
36
  <input type="hidden" name="billing[address_id]" title="Endereço selecionado" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id"class="input-hidden" />
37
- <div class="<?php echo $force_division ?>" style="<?php echo $tyle; ?>">
38
- <?php if($force_division): ?><h3>Meu Cadastro</h3><?php endif; ?>
39
  <li class="fields">
40
  <div class="customer-name field">
41
  <label for="billing:firstname" class="required"><em>*</em>Nome</label>
42
  <div class="input-box">
43
- <input autocomplete="off" type="text" id="billing:firstname" name="billing[firstname]" value="<?php echo $firstname; ?>" title="Nome" class="input-text required-entry" placeholder="Nome">
44
  </div>
45
  </div>
46
  <div class="field name-lastname">
47
  <label for="billing:lastname" class="required"><em>*</em>Sobrenome</label>
48
  <div class="input-box">
49
- <input autocomplete="off" type="text" id="billing:lastname" name="billing[lastname]" value="<?php echo $lastname; ?>" title="Sobrenome" class="input-text required-entry" placeholder="Sobrenome">
50
  </div>
51
  </div>
52
  </li>
53
- <?php if($exibe_email != 0): ?>
54
  <li class="wide">
55
  <label for="billing:email" class="required"><em>*</em>Endereço de e-mail</label>
56
  <div class="input-box">
57
- <input autocomplete="off" type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape( Mage::getSingleton('customer/session')->getCustomer()->getEmail()) ?>" <?php if($myStatus) echo 'readonly="true"'; ?> title="Endereço de e-mail" class="input-text validate-email required-entry" placeholder="Email">
58
  </div>
59
  </li>
60
  <?php else: ?>
61
  <input autocomplete="off" type="hidden" name="billing[email]" value="<?php echo $this->htmlEscape( Mage::getSingleton('customer/session')->getCustomer()->getEmail()) ?>" id="email" class="input-hidden">
62
 
63
  <?php endif; ?>
64
- <?php if(!$myStatus): ?>
65
  <li class="fields" id="register-customer-password" style="display:block;">
66
  <div class="field">
67
  <label for="billing:customer_password" class="required"><em>*</em>Crie sua Senha</label>
@@ -77,12 +52,13 @@
77
  </div>
78
  </li>
79
  <input autocomplete="off" type="hidden" name="billing[register_new_account]" value="1" title="Criar conta" id="register_new_account" class="input-hidden">
80
- <input autocomplete="off" type="hidden" name="billing[persistent_remember_me]" value="1" title="Continuar logado" id="persistent_remember_me" class="input-hidden">
 
 
 
81
 
82
 
83
- <p style="padding-bottom:10px;">A senha criada será utilizada para você ter acesso futuro a loja e acompanhar o seu pedido.</p>
84
 
85
- <?php endif; ?>
86
  <?php if(Mage::getStoreConfig('onestepcheckout/config/enable_pj')):?>
87
 
88
 
@@ -132,21 +108,29 @@
132
 
133
  <?php endif; ?>
134
  <li class="fields">
135
- <?php if ($_taxvat->isEnabled()): ?>
136
- <div class="field">
137
- <label for="billing:taxvat" class="required"><em>*</em>CPF </label>
138
- <div class="input-box">
139
- <input autocomplete="off" type="text" id="billing:taxvat" name="billing[taxvat]"value="<?php echo $taxvat;?>" title="CPF" class="input-text required-entry" placeholder="CPF">
140
- </div>
141
- <script type="text/javascript">
142
- //<![CDATA[
143
  $('billing:taxvat').addClassName('validar_cpf');
144
- Validation.add('validar_cpf', 'O CPF informado \xE9 invalido', function(v){return validaCPF(v,0);});
145
- //]]>
146
- </script>
147
- </div>
 
 
 
 
148
  <?php endif; ?>
149
- <div class="field">
 
 
 
 
150
  <label for="billing:telephone" class="required"><em>*</em>Telefone</label>
151
  <div class="input-box">
152
  <input autocomplete="off" type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="Telefone" class="input-text validate-tel-national required-entry" id="billing:telephone" placeholder="Telefone">
@@ -159,26 +143,36 @@
159
  </script>
160
  </div>
161
  </div>
162
- </li>
163
- <li class="fields">
164
- <?php if ($_dob->isEnabled()): ?>
165
- <div class="field">
166
- <?php echo $this->getLayout()->createBlock('customer/widget_dob')
167
- ->setDate($this->getCustomer()->getDob())
168
- ->setFieldIdFormat('billing:%s')
169
- ->setFieldNameFormat('billing[%s]')
170
- ->toHtml() ?>
171
- </div>
172
- <?php endif ?>
173
- <?php if ($_gender->isEnabled()): ?>
174
- <div class="field">
175
- <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml(); ?>
176
  </div>
177
- <?php endif ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </li>
179
  </div>
180
- <div class="<?php echo $force_division ?>">
181
- <?php if($force_division): ?><h3>Meu Endereço</h3><?php endif; ?>
182
  <li class="fields">
183
  <div class="field">
184
 
@@ -200,34 +194,34 @@
200
  </div>
201
  </div>
202
  </li>
203
- <li class="wide">
204
  <label for="billing:street1" class="required"><em>*</em>Endereço</label>
205
  <div class="input-box">
206
- <input autocomplete="off" type="text" title="Endereço da rua" name="billing[street][0]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" placeholder="Endereço">
207
  </div>
208
  </li>
209
- <li class="fields">
210
  <div class="field">
211
  <label for="billing:street2" class="required"><em>*</em>Número</label>
212
  <div class="input-box">
213
- <input autocomplete="off" type="text" title="Número" name="billing[street][1]" id="billing:street2" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(2)) ?>" class="input-text required-entry" placeholder="Número">
214
  </div>
215
  </div>
216
  <div class="field">
217
- <label for="billing:street3" class="required">Complemento</label>
218
  <div class="input-box">
219
- <input autocomplete="off" type="text" title="Complemento" name="billing[street][2]" id="billing:street3" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(3)) ?>" class="input-text" placeholder="Complemento">
220
  </div>
221
  </div>
222
  </li>
223
 
224
 
225
 
226
- <li class="fields">
227
  <div class="field">
228
  <label for="billing:street4" class="required"><em>*</em>Bairro</label>
229
  <div class="input-box">
230
- <input autocomplete="off" type="text" title="Bairro" name="billing[street][3]" id="billing:street4" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(4)) ?>" class="input-text required-entry" placeholder="Bairro">
231
  </div>
232
  </div>
233
  <div class="field">
@@ -237,17 +231,19 @@
237
  </div>
238
  </div>
239
  </li>
240
- <li class="fields">
241
  <div class="field">
242
  <label for="billing:region_id" class=""><em>*</em>Estado</label>
243
  <div class="input-box">
244
- <select id="billing:region_id" name="billing[region_id]" title="Estado" style="display: none;" defaultvalue="" class="validate-select">
245
- <option value="">Por favor, selecione o estado</option>
246
- </select>
247
- <script type="text/javascript">//<![CDATA[
248
- $("billing:region_id").setAttribute("defaultValue", "");
249
- //]]></script>
250
- <input autocomplete="off" type="text" maxlength="2" id="billing:region" name="billing[region]" value="<?php echo $region_select ?>" title="Estado" class="input-text" style="" >
 
 
251
  </div>
252
  </div>
253
 
@@ -258,37 +254,33 @@
258
  </div>
259
  </div>
260
  </li>
261
- <?php if($force_division): ?>
262
- <div class="buttons-set">
263
- <button type="submit" onclick="createAccount();" title="Prosseguir" class="button btn-button"><span><span>Prosseguir</span></span></button>
264
- </div>
265
- <?php endif; ?>
266
  </div>
267
 
268
 
269
  <li class="control">
270
  <?php if(Mage::getStoreConfig('onestepcheckout/config/allowshippingotheraddress')):?>
271
 
272
- <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
273
- <?php if(!$force_division): ?>
274
- <a class="btn button" id="ship_to_same_address" onclick="jQuery('#billing\\:ship_to_same_address').val('0');">Enviar Para Outro Endereço</a>
275
- <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>" id="billing:ship_to_same_address" class="checkbox" checked="checked" >
276
- <?php endif; ?>
277
  <?php else:?>
278
- <?php if(!$force_division): ?>
279
  <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>">
280
- <?php endif; ?>
281
  <?php endif; ?>
282
 
283
  <?php else:?>
284
- <?php if(!$force_division): ?>
285
  <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>">
286
- <?php endif; ?>
287
  <?php endif; ?>
288
  </li>
289
 
290
  <li class="control">
291
- <?php if ($myStatus):?>
292
 
293
  <input type="checkbox" name="save_in_address_book" <?php if (!Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()):?> value="1" <?php else: ?> value='0' <?php endif; ?>onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if (!Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()):?> checked="checked"<?php endif;?> title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" class="checkbox" />
294
  <label for="billing:save_in_address_book" ><?php echo $this->__('Salvar como novo endereço') ?></label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <fieldset>
2
  <ul class="form-list" id="moip_onstepcheckout_billing_form" >
3
+ <?php if(!$this->isCustomerLoggedIn()): ?>
4
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/enable_quicklogin')):?>
5
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')!=5): ?>
6
  <a id="loginbox" href="#" data-toggle="modal" data-target="#loginModel" title="Entrar com a sua conta"><?php echo $this->__('Already registered? Click here to login.');?></a>
7
+ <?php endif?>
8
  <?php endif?>
9
+ <?php endif?>
10
+ <input type="hidden" title="Permanecer logado" name="form_key" value="<? echo Mage::getSingleton('core/session')->getFormKey(); ?>" class="input-hidden" />
11
  <input type="hidden" name="billing[address_id]" title="Endereço selecionado" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id"class="input-hidden" />
12
+ <div class="<?php echo $this->getStyleCreateAccount(); ?>">
13
+
14
  <li class="fields">
15
  <div class="customer-name field">
16
  <label for="billing:firstname" class="required"><em>*</em>Nome</label>
17
  <div class="input-box">
18
+ <input autocomplete="off" type="text" id="billing:firstname" name="billing[firstname]" value="<?php echo $this->getAddress()->getFirstname() ?>" title="Nome" class="input-text required-entry" placeholder="Nome">
19
  </div>
20
  </div>
21
  <div class="field name-lastname">
22
  <label for="billing:lastname" class="required"><em>*</em>Sobrenome</label>
23
  <div class="input-box">
24
+ <input autocomplete="off" type="text" id="billing:lastname" name="billing[lastname]" value="<?php echo $this->getAddress()->getLastname() ?>" title="Sobrenome" class="input-text required-entry" placeholder="Sobrenome">
25
  </div>
26
  </div>
27
  </li>
28
+ <?php if(!$this->isCustomerLoggedIn()): ?>
29
  <li class="wide">
30
  <label for="billing:email" class="required"><em>*</em>Endereço de e-mail</label>
31
  <div class="input-box">
32
+ <input autocomplete="off" type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="Endereço de e-mail" class="input-text validate-email required-entry" placeholder="Email">
33
  </div>
34
  </li>
35
  <?php else: ?>
36
  <input autocomplete="off" type="hidden" name="billing[email]" value="<?php echo $this->htmlEscape( Mage::getSingleton('customer/session')->getCustomer()->getEmail()) ?>" id="email" class="input-hidden">
37
 
38
  <?php endif; ?>
39
+ <?php if(!$this->isCustomerLoggedIn()): ?>
40
  <li class="fields" id="register-customer-password" style="display:block;">
41
  <div class="field">
42
  <label for="billing:customer_password" class="required"><em>*</em>Crie sua Senha</label>
52
  </div>
53
  </li>
54
  <input autocomplete="off" type="hidden" name="billing[register_new_account]" value="1" title="Criar conta" id="register_new_account" class="input-hidden">
55
+ <input autocomplete="off" type="hidden" name="billing[persistent_remember_me]" value="1" title="Continuar logado" id="persistent_remember_me" class="input-hidden">
56
+ <p style="padding-bottom:10px;">A senha criada será utilizada para você ter acesso futuro a loja e acompanhar o seu pedido.</p>
57
+ <?php endif; ?>
58
+
59
 
60
 
 
61
 
 
62
  <?php if(Mage::getStoreConfig('onestepcheckout/config/enable_pj')):?>
63
 
64
 
108
 
109
  <?php endif; ?>
110
  <li class="fields">
111
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
112
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
113
+ <?php if ($_taxvat->isEnabled()): ?>
114
+ <div class="field">
115
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
116
+ </div>
117
+ <script type="text/javascript">
118
+ //<![CDATA[
119
  $('billing:taxvat').addClassName('validar_cpf');
120
+ Validation.add('validar_cpf', 'O CPF ou CNPJ informado \xE9 invalido', function(v){return validaCPF(v,0);});
121
+ //]]>
122
+ </script>
123
+ <?php endif ?>
124
+ <?php if ($_dob->isEnabled()): ?>
125
+ <div class="field">
126
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
127
+ </div>
128
  <?php endif; ?>
129
+
130
+
131
+ </li>
132
+ <li class="fields">
133
+ <div class="field">
134
  <label for="billing:telephone" class="required"><em>*</em>Telefone</label>
135
  <div class="input-box">
136
  <input autocomplete="off" type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="Telefone" class="input-text validate-tel-national required-entry" id="billing:telephone" placeholder="Telefone">
143
  </script>
144
  </div>
145
  </div>
146
+ <div class="field">
147
+ <label for="billing:telephone" class="required"><em>*</em>Celular</label>
148
+ <div class="input-box">
149
+ <input autocomplete="off" type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="Celular" class="input-text validate-cel-national input-text" id="billing:fax" placeholder="Celular">
150
+ <script type="text/javascript">
151
+ //<![CDATA[
152
+ Validation.add('validate-cel-national', 'Entre com telefone válido: (99)9999-?9999', function(v) {
153
+ return Validation.get('IsEmpty').test(v) || /^([()])([0-9]){2}([)])([0-9]){4}([-])([0-9]){4,5}$/.test(v);
154
+ });
155
+ //]]>
156
+ </script>
 
 
 
157
  </div>
158
+ </div>
159
+
160
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
161
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
162
+ <li class="fields">
163
+
164
+ <?php if ($_gender->isEnabled()): ?>
165
+ <div class="field">
166
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
167
+ </div>
168
+ <?php endif ?>
169
+ </li>
170
+ <?php endif ?>
171
+
172
  </li>
173
  </div>
174
+ <div class="<?php echo $this->getStyleCreateAccount(); ?>" sytle="clear: both;">
175
+
176
  <li class="fields">
177
  <div class="field">
178
 
194
  </div>
195
  </div>
196
  </li>
197
+ <li class="wide ">
198
  <label for="billing:street1" class="required"><em>*</em>Endereço</label>
199
  <div class="input-box">
200
+ <input autocomplete="off" type="text" title="Endereço da rua" name="billing[street][0]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry validate-length minimum-length-4 maximum-length-45" placeholder="Endereço">
201
  </div>
202
  </li>
203
+ <li class="fields ">
204
  <div class="field">
205
  <label for="billing:street2" class="required"><em>*</em>Número</label>
206
  <div class="input-box">
207
+ <input autocomplete="off" type="text" title="Número" name="billing[street][1]" id="billing:street2" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(2)) ?>" class="input-text required-entry validate-length minimum-length-1 maximum-length-5" placeholder="Número">
208
  </div>
209
  </div>
210
  <div class="field">
211
+ <label for="billing:street3">Complemento</label>
212
  <div class="input-box">
213
+ <input autocomplete="off" type="text" title="Complemento" name="billing[street][2]" id="billing:street3" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(3)) ?>" class="input-text validate-length minimum-length-1 maximum-length-30" placeholder="Complemento">
214
  </div>
215
  </div>
216
  </li>
217
 
218
 
219
 
220
+ <li class="fields ">
221
  <div class="field">
222
  <label for="billing:street4" class="required"><em>*</em>Bairro</label>
223
  <div class="input-box">
224
+ <input autocomplete="off" type="text" title="Bairro" name="billing[street][3]" id="billing:street4" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(4)) ?>" class="input-text required-entry validate-length minimum-length-1 maximum-length-30" placeholder="Bairro">
225
  </div>
226
  </div>
227
  <div class="field">
231
  </div>
232
  </div>
233
  </li>
234
+ <li class="fields ">
235
  <div class="field">
236
  <label for="billing:region_id" class=""><em>*</em>Estado</label>
237
  <div class="input-box">
238
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
239
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
240
+ </select>
241
+ <script type="text/javascript">
242
+ //<![CDATA[
243
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
244
+ //]]>
245
+ </script>
246
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
247
  </div>
248
  </div>
249
 
254
  </div>
255
  </div>
256
  </li>
257
+
 
 
 
 
258
  </div>
259
 
260
 
261
  <li class="control">
262
  <?php if(Mage::getStoreConfig('onestepcheckout/config/allowshippingotheraddress')):?>
263
 
264
+ <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable() && !$this->getStyleCreateAccount()):?>
265
+
266
+ <div class="btn button" onclick="SendAddresShipping()"><span><span><?php echo $this->__('Enviar Para Outro Endereço') ?></span></span></div>
267
+ <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>" id="ship_to_same_address" >
268
+
269
  <?php else:?>
270
+
271
  <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>">
272
+
273
  <?php endif; ?>
274
 
275
  <?php else:?>
276
+
277
  <input type="hidden" name="ship_to_same_address" value="1" title="<?php echo $this->__('ship to same address') ?>">
278
+
279
  <?php endif; ?>
280
  </li>
281
 
282
  <li class="control">
283
+ <?php if($this->isCustomerLoggedIn()): ?>
284
 
285
  <input type="checkbox" name="save_in_address_book" <?php if (!Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()):?> value="1" <?php else: ?> value='0' <?php endif; ?>onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if (!Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()):?> checked="checked"<?php endif;?> title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" class="checkbox" />
286
  <label for="billing:save_in_address_book" ><?php echo $this->__('Salvar como novo endereço') ?></label>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/correio.phtml DELETED
@@ -1 +0,0 @@
1
- Correio
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/coupon.phtml CHANGED
@@ -1,30 +1,28 @@
1
  <div class="discount-form">
2
- <h2 style="margin-top:3px"> <?php echo $this->__('Discount Codes') ?></h2>
3
- <span class="cupom_tem" style="cursor:pointer"><?php echo $this->__('Você tem um cupom de desconto? Clique aqui para utiliza-lo.') ?></span>
4
 
5
- <div class="cupom_tem_codigo" style="<?php if(!$this->getCouponCode()) { ?>display:none; <?php } ?>">
6
- <input type="hidden" name="remove" id="remove-coupone" value="0" />
7
- <div class="input-box">
8
- <input class="input-text" title="cupom de desconto" id="coupon_code" name="coupon_code" value="<?php echo $this->htmlEscape($this->getCouponCode()) ?>" style="max-width: 180px;" />
9
- </div>
10
- <div class="buttons-set" style="padding-bottom: 20px;">
11
- <button type="button" title="<?php echo $this->__('Apply Coupon') ?>" class="button" onclick="if(!jQuery('#coupon_code').val()){alert('Por Favor, insira um cupom.')}else{updateCoupon();}" value="<?php echo $this->__('Apply Coupon') ?>"><span><span><?php echo $this->__('Apply Coupon') ?></span></span></button>
12
- <?php if(strlen($this->getCouponCode())): ?>
13
- &nbsp; <button type="button" title="<?php echo $this->__('Cancel Coupon') ?>" class="button" onclick="jQuery('#remove-coupone').val(1);updateCoupon()" value="<?php echo $this->__('Cancel Coupon') ?>"><span><span><?php echo $this->__('Cancel Coupon') ?></span></span></button>
14
- <?php endif;?>
 
 
 
 
 
 
 
15
  </div>
16
- </div>
17
- <p id="loading_mask_loader" class="loader" style="display:none"><img alt="Loading..." src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>"><br>Atualizando dados, por favor aguarde...</p>
 
 
18
  </div>
19
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
20
- <script type="text/javascript">
21
- //<![CDATA[
22
- jQuery(document).ready(function(){
23
- jQuery('.cupom_tem').bind({
24
- click: function(){
25
- jQuery('.cupom_tem_codigo').slideToggle();
26
- }
27
- });
28
- });
29
- //]]>
30
- </script>
1
  <div class="discount-form">
2
+ <?php if(!$this->getCouponCode()): ?>
3
+
4
 
5
+ <div>
6
+ <input type="hidden" name="remove" id="remove-coupone" value="0" />
7
+ <ul class="form-list">
8
+ <li class="wide">
9
+ <label>Cupom de desconto:</label>
10
+ <div class="input-box">
11
+ <input class="input-text" title="cupom de desconto" id="coupon_code" name="coupon_code" value="<?php echo $this->htmlEscape($this->getCouponCode()) ?>"/>
12
+ </div>
13
+ </li>
14
+
15
+ </ul>
16
+
17
+ <p class="small">O cupom é opcional. Você deverá informar apenas se tiver um, caso não tenha deixe o campo em branco.</p>
18
+ <div class="buttons-set" style="padding-bottom: 20px;">
19
+ <button type="button" title="<?php echo $this->__('Apply Coupon') ?>" class="button" onclick="if(!jQuery('#coupon_code').val()){alert('Por Favor, insira um cupom.')}else{updateCoupon();}" value="<?php echo $this->__('Apply Coupon') ?>"><span><span><?php echo $this->__('Apply Coupon') ?></span></span></button>
20
+
21
+ </div>
22
  </div>
23
+ <p id="loading_mask_loader" class="loader" style="display:none"><img alt="Loading..." src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>"><br>Atualizando dados, por favor aguarde...</p>
24
+ <?php else: ?>
25
+ O "<?php echo $this->getCouponCode() ?>" foi aplicado.
26
+ <?php endif; ?>
27
  </div>
28
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/forgotpassword.phtml CHANGED
@@ -45,17 +45,10 @@ function updateForgotpassword(email) {
45
  url: "<?php echo Mage::getUrl('onestepcheckout/index/forgotpass')?>",
46
  data: "email="+email,
47
  success: function(msg){
48
- if(msg==1){
49
- jQuery('#voltarLogin').html("<div class='moip-osc-title-login envia-senha'></div><p>O email de recuperaçao de senha foi enviado.</p><button type='button' class='buttons-set' data-dismiss='modal' aria-hidden='true'>Voltar para página de login</button>");
50
 
51
 
52
- }
53
- else {
54
- jQuery('#btforgotpass').css('display','block');
55
- jQuery('#forgotpass-please-wait').css('display','none');
56
- jQuery('#errorforgotpass').css('display','block');
57
- jQuery('#email_address').addClass('validation-failed')
58
- }
59
  }
60
  });
61
  }
45
  url: "<?php echo Mage::getUrl('onestepcheckout/index/forgotpass')?>",
46
  data: "email="+email,
47
  success: function(msg){
48
+
49
+ jQuery('#form-validate').html("<h2>O email de recuperaçao de senha foi enviado.</h2><button type='button' class='buttons-set' data-dismiss='modal' aria-hidden='true'>Voltar para página de login</button>");
50
 
51
 
 
 
 
 
 
 
 
52
  }
53
  });
54
  }
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/local.xml CHANGED
@@ -28,24 +28,13 @@
28
  <config>
29
  <skin>default</skin>
30
  <report>
31
- <!--
32
- "action" can be set to "print" to show exception on screen and "email"
33
- to send exception on specified email
34
- -->
35
  <action>print</action>
36
- <!--
37
- in "subject" you can set subject of email
38
- -->
39
  <subject>Store Debug Information</subject>
40
- <!--
41
- "email_address" admin email address
42
- -->
43
  <email_address></email_address>
44
- <!--
45
- "trash" is handle about trace info
46
- value "leave" is for store on disk
47
- value "delete" is for cleaning
48
- -->
49
  <trash>leave</trash>
50
  </report>
51
  </config>
28
  <config>
29
  <skin>default</skin>
30
  <report>
31
+
 
 
 
32
  <action>print</action>
33
+
 
 
34
  <subject>Store Debug Information</subject>
35
+
 
 
36
  <email_address></email_address>
37
+
 
 
 
 
38
  <trash>leave</trash>
39
  </report>
40
  </config>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/login-pre.phtml DELETED
@@ -1,98 +0,0 @@
1
- <div class="col1-set">
2
- <?php echo $this->getChildHtml('login_before')?>
3
- <div >
4
-
5
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
6
-
7
- <form id="login-form-checkout-pre" method="post">
8
- <fieldset>
9
- <div >
10
- <ul class="form-list">
11
- <li>
12
- <label for="login-email" class="required" >E-mail<em>*</em></label>
13
- <div class="input-box" style="float:left;">
14
- <input type="text" class="input-text required-entry validate-email" id="login-email-pre" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" />
15
- </div>
16
- </li>
17
- <li>
18
- <label for="login-password" class="required" >Senha<em style="position:static;float:none;color:#EB340A;font-style:normal;right:-8px;top:0;">*</em></label>
19
- <div class="input-box" style="float:left;">
20
- <input type="password" class="input-text required-entry" id="login-password-pre" name="login[password]" />
21
- </div>
22
- </li>
23
- <li>
24
- <a href="#" data-toggle="modal" data-target="#EsqueceuSenha" class="f-left link-recuperar-senha"><?php echo $this->__('Forgot your password?') ?></a>
25
- </li>
26
- </ul>
27
- </div>
28
- <div id="dados_incorretos" style="display:none; height:90px;position: relative">
29
- <ul class="messages"> <li class="error-msg">Dados incorretos, por favor tente novamente.<li><ul>
30
- </div>
31
- <div class="logando_aguarde" style="display:none">
32
- <span>Por favor, aguarde!</span>
33
- <p id="loading_mask_loader" class="loader"><img alt="Loading..." src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>">.</p>
34
-
35
- </div>
36
-
37
- <div class="buttons-set">
38
-
39
-
40
- <button type="button" class="button" onclick="onepageLogin(this)"><span ><span ><?php echo $this->__('Login') ?></span></span></button>
41
-
42
-
43
-
44
- </div>
45
-
46
- </fieldset>
47
- </form>
48
- </div>
49
- </div>
50
- <script type="text/javascript">
51
- //<![CDATA[
52
- var loginForm = new VarienForm('login-form-checkout-pre', true);
53
- $('login-email').observe('keypress', bindLoginPost);
54
- $('login-password').observe('keypress', bindLoginPost);
55
- function bindLoginPost(evt){
56
- if (evt.keyCode == Event.KEY_RETURN) {
57
- return false;
58
- }
59
- }
60
- function onepageLogin(button)
61
- {
62
- if(loginForm.validator && loginForm.validator.validate()){
63
- updateLogin(jQuery('#login-email-pre').val(),jQuery('#login-password-pre').val());
64
- }
65
- jQuery('#errorlogin-pre').css('display','none');
66
- return false;
67
- }
68
- //]]>
69
- </script>
70
- <script type="text/javascript">
71
- //<![CDATA[
72
- function updateLogin(email,password)
73
- {
74
-
75
- jQuery('.buttons-set .button').css('display','none');
76
- jQuery.ajax({
77
- type: "POST",
78
- url: "<?php echo Mage::getUrl('onestepcheckout/index/updatelogin')?>",
79
- data: "email="+email+"&"+"password="+password,
80
- success: function(msg){
81
- if(msg==0){
82
- jQuery('.buttons-set .button').css('display','block');
83
- jQuery('#login-please-wait').css('display','none');
84
- jQuery('#dados_incorretos').css('display','block');
85
- jQuery('#errorlogin').css('display','block');
86
- jQuery('#login-email').addClass('validation-failed');
87
- jQuery('#login-password').addClass('validation-failed');
88
- }
89
- else{
90
- jQuery('.logando_aguarde').show();
91
- var url="<?php echo Mage::getUrl('checkout/onepage'); ?>";
92
- jQuery(location).attr('href',url);
93
- }
94
- }
95
- });
96
- }
97
- //]]>
98
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/login.phtml CHANGED
@@ -1,8 +1,8 @@
1
  <div class="col1-set">
2
- <?php echo $this->getChildHtml('login_before')?>
3
  <div >
4
 
5
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
6
 
7
  <form id="login-form-checkout" method="post">
8
  <fieldset>
1
  <div class="col1-set">
2
+
3
  <div >
4
 
5
+
6
 
7
  <form id="login-form-checkout" method="post">
8
  <fieldset>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/payment.phtml CHANGED
@@ -24,107 +24,24 @@
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
- <script type="text/javascript">
28
- //<![CDATA[
29
- var payment = new Payment('co-payment-form', '<?php echo $this->getUrl("checkout/onepage/savePayment") ?>');
30
- //]]>
31
- </script>
32
  <div id="co-payment-form">
33
- <fieldset id="checkout-payment-method-load">
34
  <?php echo $this->getChildHtml('methods') ?>
35
- </fieldset>
36
-
37
-
38
-
39
- </div
40
- <div class="buttons-set">
41
- <?php $islogin=0; if(Mage::getSingleton('customer/session')->isLoggedIn()) $islogin=1; ?>
42
- <?php if(Mage::getStoreConfig('onestepcheckout/layout/page_layout')==5 ){
43
- if(!$islogin){
44
- $notenable = 1;
45
- } else{
46
- $notenable = "";
47
- }
48
- } else {
49
- $notenable = "";
50
- }
51
-
52
- ?>
53
- <?php if(!$notenable): ?>
54
-
55
-
56
- <div id="checkout-review-terms">
57
- <?php if(Mage::getStoreConfig('onestepcheckout/modaluse/termos')):?>
58
- <div class="onestepcheckout-enable-terms" style="postion:relative;">
59
- <ul class="form-list">
60
- <li class="control">
61
- <input class="required-entry checkbox" type="checkbox" id="id_accept_terms" name="accept_terms" value="1" checked="checked" s />
62
- <label for="termos"><?php echo $this->__('Eu aceito o');?> <a id="onestepcheckout-toc-link" data-toggle="modal" data-target="#termos_modal" href="#"><?php echo $this->__('Contrato de compra e os Termos de uso do site.');?></a></label>
63
- </li>
64
- </ul>
65
- </div>
66
- <?php endif ?>
67
- </div>
68
- <?php if(Mage::getStoreConfig('onestepcheckout/addfield/usenews')==1):?>
69
- <?php if(Mage::helper('onestepcheckout')->issubscribed()):?>
70
- <ul class="form-list">
71
- <li class="control">
72
- <input type="checkbox" name="subscribe_newsletter" value="0" title="<?php echo $this->__('Receber novidades') ?>" id="subscribe_newsletter" class="checkbox"> <label for="subscribe_newsletter"><?php echo $this->__('Receber novidades') ?></label>
73
- </li>
74
- </ul>
75
- <?php endif?>
76
- <?php endif ?>
77
-
78
- <?php if(Mage::getStoreConfig('onestepcheckout/addfield/usenews')==2):?>
79
- <?php if(Mage::helper('onestepcheckout')->issubscribed()):?>
80
- <ul class="form-list">
81
- <li class="control">
82
- <input type="checkbox" name="subscribe_newsletter" value="1" checked="checked" title="<?php echo $this->__('Receber novidades') ?>" id="subscribe_newsletter" class="checkbox"> <label for="subscribe_newsletter" style="float:none;"><?php echo $this->__('Receber novidades') ?></label>
83
- </li>
84
- </ul>
85
- <?php endif?>
86
- <?php endif?>
87
-
88
-
89
-
90
-
91
- <div style="float: right;" id="onestepcheckout_place_order_button">
92
- <button type="button" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" id="checkout-onepage-buttom">
93
- <span><span><?php echo $this->__('Place Order') ?> <i class="fa fa-arrow-right"></i></span></span></button>
94
- </div>
95
-
96
- <?php if(Mage::getStoreConfig('onestepcheckout/modaluse/use_secure')){ ?>
97
- <div>
98
- <a id="store_secure" data-toggle="modal" data-target="#store_secure_content">
99
- <span class="secure_store"><img src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/loja_segura.jpg') ?>" alt="<?php echo $this->__('Loja Segura, Saiba mais') ?>" title="<?php echo $this->__('Loja Segura, Saiba mais...') ?>" class="v-middle" /> </span>
100
- </a>
101
- </div>
102
- <?php } ?>
103
-
104
-
105
-
106
- <?php if(Mage::helper('onestepcheckout')->showComment()):?>
107
- <div class="onestepcheckout-comments">
108
- <label for="id_comments"><?php echo $this->__('Comments');?></label><br/>
109
- <textarea id="id_comments" name="onestepcheckout_comments" cols="40" rows="4"></textarea>
110
- </div>
111
- <?php endif;?>
112
-
113
- <?php endif; ?>
114
  </div>
115
-
116
  <div class="tool-tip" id="payment-tool-tip" style="display:none;">
117
- <div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
118
- <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
119
  </div>
120
-
121
-
122
  <script type="text/javascript">
123
  //<![CDATA[
124
  function toggleToolTip(event){
125
  if($('payment-tool-tip')){
126
  $('payment-tool-tip').setStyle({
127
  top: (Event.pointerY(event)-560)+'px'//,
 
128
  })
129
  $('payment-tool-tip').toggle();
130
  }
@@ -135,11 +52,12 @@
135
  }
136
  //]]>
137
  </script>
138
-
139
- <script type="text/javascript">
140
  //<![CDATA[
 
141
  payment.currentMethod = "<?php echo $this->getChild('methods')->getSelectedMethodCode() ?>";
142
- payment.initWhatIsCvvListeners();
 
143
  //]]>
144
  </script>
145
 
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
+
28
+ <h4 class="sub-title-method"><div class="onestepcheckout-numbers onestepcheckout-numbers-2" id="moip-osc-p2"></div><?php echo $this->__('Meio de Pagamento') ?></h4>
 
 
 
29
  <div id="co-payment-form">
30
+ <div id="checkout-payment-method-load">
31
  <?php echo $this->getChildHtml('methods') ?>
32
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  </div>
 
34
  <div class="tool-tip" id="payment-tool-tip" style="display:none;">
35
+ <div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Close')) ?>"><?php echo $this->__('Close') ?></a></div>
36
+ <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Card Verification Number Visual Reference')) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Card Verification Number Visual Reference')) ?>" /></div>
37
  </div>
 
 
38
  <script type="text/javascript">
39
  //<![CDATA[
40
  function toggleToolTip(event){
41
  if($('payment-tool-tip')){
42
  $('payment-tool-tip').setStyle({
43
  top: (Event.pointerY(event)-560)+'px'//,
44
+ //left: (Event.pointerX(event)+100)+'px'
45
  })
46
  $('payment-tool-tip').toggle();
47
  }
52
  }
53
  //]]>
54
  </script>
55
+ <script type="text/javascript">
 
56
  //<![CDATA[
57
+ var payment = new Payment('co-payment-form', '<?php echo $this->getUrl("checkout/onepage/savePayment") ?>');
58
  payment.currentMethod = "<?php echo $this->getChild('methods')->getSelectedMethodCode() ?>";
59
+ payment.initWhatIsCvvListeners();
60
+ payment.init();
61
  //]]>
62
  </script>
63
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/payment/methods.phtml CHANGED
@@ -3,12 +3,15 @@
3
  <dt>
4
 
5
  <?php if( sizeof($this->getMethods()) > 1 ): ?>
6
- <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="Meio de Pagamento" onclick="payment.switchMethod('<?php echo $_code ?>');updatePaymentMethod(this.value);"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> class="radio payment_method_handle validate-one-required-by-name" />
7
  <?php else: ?>
8
- <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio payment_method_handle validate-one-required-by-name" onclick="payment.switchMethod('<?php echo $_code ?>');updatePaymentMethod(this.value);" /></span>
9
  <?php endif; ?>
 
 
 
10
 
11
- <label for="p_method_<?php echo $_code ?>"><?php echo $_method->getTitle() ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
12
  </dt>
13
 
14
  <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
@@ -23,6 +26,5 @@
23
  <script type="text/javascript">
24
  //<![CDATA[
25
  <?php echo $this->getChildHtml('scripts'); ?>
26
- payment.init();
27
  //]]>
28
  </script>
3
  <dt>
4
 
5
  <?php if( sizeof($this->getMethods()) > 1 ): ?>
6
+ <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="Meio de Pagamento" onclick="payment.switchMethod('<?php echo $_code ?>');updatePaymentMethod();" class="radio payment_method_handle validate-one-required-by-name" />
7
  <?php else: ?>
8
+ <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio payment_method_handle validate-one-required-by-name" onclick="payment.switchMethod('<?php echo $_code ?>');updatePaymentMethod();" /></span>
9
  <?php endif; ?>
10
+ <?php $img_name = "MOIP/transparente/imagem/{$_code}.png"; ?>
11
+ <label for="p_method_<?php echo $_code ?>"><img src="<?php echo$this->getSkinUrl($img_name, array('_secure'=>true)) ?>" class="image-method-payment" alt="<?php echo $_method->getTitle() ?>">
12
+ <?php echo $_method->getTitle() ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?>
13
 
14
+ </label>
15
  </dt>
16
 
17
  <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
26
  <script type="text/javascript">
27
  //<![CDATA[
28
  <?php echo $this->getChildHtml('scripts'); ?>
 
29
  //]]>
30
  </script>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review.phtml CHANGED
@@ -1,3 +1,3 @@
1
- <?php echo $this->getChildHtml('items_before'); ?>
2
  <?php echo $this->getChildHtml('info') ?>
3
- <?php echo $this->getChildHtml('items_after'); ?>
1
+
2
  <?php echo $this->getChildHtml('info') ?>
3
+
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/info.phtml CHANGED
@@ -27,16 +27,19 @@
27
  <?php echo $this->getChildHtml('items_before'); ?>
28
  <div id="checkout-review-table-wrapper">
29
  <table class="data-table cart-table-items" id="checkout-review-table">
30
- <?php echo $this->getChildHtml('totals'); ?>
31
  <thead>
32
  <tr>
33
- <th><?php echo $this->__('Product Name') ?></th>
 
34
  <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
35
  </tr>
36
  </thead>
37
  <?php foreach($this->getItems() as $_item): ?>
38
  <?php echo $this->getItemHtml($_item)?>
39
  <?php endforeach ?>
 
 
40
  </table>
41
  </div>
42
  <?php echo $this->getChildHtml('items_after'); ?>
27
  <?php echo $this->getChildHtml('items_before'); ?>
28
  <div id="checkout-review-table-wrapper">
29
  <table class="data-table cart-table-items" id="checkout-review-table">
30
+
31
  <thead>
32
  <tr>
33
+ <th class="a-left" width="50%"><?php echo $this->__('Name') ?></th>
34
+ <th class="a-center"><?php echo $this->__('Qtd.') ?></th>
35
  <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
36
  </tr>
37
  </thead>
38
  <?php foreach($this->getItems() as $_item): ?>
39
  <?php echo $this->getItemHtml($_item)?>
40
  <?php endforeach ?>
41
+
42
+ <?php echo $this->getChildHtml('totals'); ?>
43
  </table>
44
  </div>
45
  <?php echo $this->getChildHtml('items_after'); ?>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/info_simple.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_iphone
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div id="checkout-review-table-wrapper">
28
+ <table class="data-table cart-table-items scroll" id="checkout-review-table">
29
+
30
+
31
+
32
+
33
+ <?php echo $this->getChildHtml('totals'); ?>
34
+ </table>
35
+ </div>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/item.phtml CHANGED
@@ -27,22 +27,17 @@
27
  <?php $_item = $this->getItem()?>
28
  <tbody>
29
  <tr>
30
- <td colspan="2">
31
- <?php if(Mage::helper('onestepcheckout')->showImageProduct()):?>
32
- <div style="float:left;width:25%;">
33
- <a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>">
34
- <img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" />
35
- </a>
36
- </div>
37
- <?php endif?>
38
- <div style="float:left;width:75%;">
39
  <div class="product-name"><h3 class="product-name"><?php echo $this->htmlEscape($this->getProductName()) ?></h3> </div>
40
  <?php if(Mage::getStoreConfig("onestepcheckout/layout/allowremoveproduct")):?>
41
  <div class="product-remove"><a href="javascript:void(0);" title="<?php echo $this->__('Remove item')?>" class="btn-remove2" onclick="removeProductId('<?php echo $this->getItem()->getId()?>');"><?php echo $this->__('Remove item')?></a></div>
42
  <?php endif?>
43
- </div>
44
-
45
- <?php if ($_options = $this->getOptionList()):?>
46
  <dl class="item-options">
47
  <?php foreach ($_options as $_option) : ?>
48
  <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
@@ -64,109 +59,15 @@
64
  <?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
65
  <?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
66
  <?php endif;?>
67
-
68
  </td>
69
- </tr>
70
- <tr>
71
- <td class="a-left">
72
- <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
73
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
74
- <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
75
- <?php else: ?>
76
- <span class="cart-price">
77
- <?php endif; ?>
78
-
79
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
80
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
81
- X
82
- <input name="cartControl[<?php echo $this->getItem()->getId()?>][qty]" size="4" name="update_cart_action" onfocus="inbtn(<?php echo $_item->getId() ?>)" id="<?php echo $_item->getId() ?>" value="<?php echo $_item->getQty() ?>" class="input-text qty qty_product_update" maxlength="12" />
83
- <div id="up_<?php echo $_item->getId() ?>" class="button btn-update btn-update-qty" onclick="updateQty()" ><span><span>Ok</span></span></div>
84
- <?php else: ?>
85
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
86
- X
87
-
88
- <input name="cartControl[<?php echo $this->getItem()->getId()?>][qty]" size="4" name="update_cart_action" onfocus="inbtn(<?php echo $_item->getId() ?>)" id="<?php echo $_item->getId() ?>" value="<?php echo $_item->getQty() ?>" class="input-text qty qty_product_update" maxlength="12" />
89
- <div id="up_<?php echo $_item->getId() ?>" class="button btn-update btn-update-qty" onclick="updateQty()" ><span><span><i class="fa fa-refresh"></i> Ok</span></span></div>
90
- <?php endif; ?>
91
-
92
- </span>
93
-
94
-
95
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
96
-
97
- <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
98
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
99
- <small>
100
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
101
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
102
- <?php endforeach; ?>
103
- </small>
104
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
105
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
106
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
107
- <?php endforeach; ?>
108
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
109
- <small>
110
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
111
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
112
- <?php endforeach; ?>
113
- </small>
114
- <?php endif; ?>
115
- </div>
116
-
117
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
118
- <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
119
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
120
- </div>
121
- <?php endif; ?>
122
- <?php endif; ?>
123
- <?php endif; ?>
124
- <?php if ($this->helper('tax')->displayCartPriceInclTax()): ?>
125
- <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
126
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
127
- <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
128
- <?php else: ?>
129
- <span class="cart-price">
130
- <?php endif; ?>
131
-
132
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
133
- <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
134
- <?php else: ?>
135
- <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
136
- <?php endif; ?>
137
-
138
- </span>
139
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
140
-
141
- <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
142
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
143
- <small>
144
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
145
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
146
- <?php endforeach; ?>
147
- </small>
148
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
149
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
150
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
151
- <?php endforeach; ?>
152
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
153
- <small>
154
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
155
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
156
- <?php endforeach; ?>
157
- </small>
158
- <?php endif; ?>
159
- </div>
160
-
161
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
162
- <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
163
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
164
- </div>
165
- <?php endif; ?>
166
- <?php endif; ?>
167
- <?php endif; ?>
168
  </td>
169
- <td class="a-right">
170
  <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
171
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
172
  <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
27
  <?php $_item = $this->getItem()?>
28
  <tbody>
29
  <tr>
30
+ <td colspan="1" class="a-left">
31
+ <?php if(Mage::helper('onestepcheckout')->showImageProduct()):?>
32
+
33
+ <img src="<?php echo $this->getProductThumbnail()->resize(45); ?>" width="45" height="45" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="img-thumbnail"/>
34
+
35
+ <?php endif?>
 
 
 
36
  <div class="product-name"><h3 class="product-name"><?php echo $this->htmlEscape($this->getProductName()) ?></h3> </div>
37
  <?php if(Mage::getStoreConfig("onestepcheckout/layout/allowremoveproduct")):?>
38
  <div class="product-remove"><a href="javascript:void(0);" title="<?php echo $this->__('Remove item')?>" class="btn-remove2" onclick="removeProductId('<?php echo $this->getItem()->getId()?>');"><?php echo $this->__('Remove item')?></a></div>
39
  <?php endif?>
40
+ <?php if ($_options = $this->getOptionList()):?>
 
 
41
  <dl class="item-options">
42
  <?php foreach ($_options as $_option) : ?>
43
  <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
59
  <?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
60
  <?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
61
  <?php endif;?>
62
+
63
  </td>
64
+
65
+ <td colspan="1" class="a-center">
66
+
67
+ <?php echo $_item->getQty() ?>
68
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  </td>
70
+ <td colspan="1" class="a-right">
71
  <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
72
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
73
  <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/options/additional.phtml CHANGED
@@ -1,3 +1,4 @@
 
1
  <?php if (!$this->getQuote()->isVirtual()): ?>
2
- <?php echo $this->helper('giftmessage/message')->getInline('onepage_checkout', $this->getQuote(), $this->getDontDisplayContainer()) ?>
3
  <?php endif; ?>
1
+
2
  <?php if (!$this->getQuote()->isVirtual()): ?>
3
+ <?php echo $this->helper('giftmessage/message')->getInline('multishipping_adress', Mage::getSingleton('checkout/session')->getQuote(), $this->getDontDisplayContainer()) ?>
4
  <?php endif; ?>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/totals.phtml CHANGED
@@ -29,20 +29,11 @@
29
  */
30
  ?>
31
  <?php if ($this->getTotals()): ?>
32
- <tfoot>
33
- <?php $_colspan = 0; ?>
34
  <?php echo $this->renderTotals(null, $_colspan); ?>
35
  <?php echo $this->renderTotals('footer', $_colspan); ?>
36
- <?php if ($this->needDisplayBaseGrandtotal()):?>
37
- <tr>
38
- <td class="a-right" colspan="<?php echo $_colspan; ?>">
39
- <small><?php echo $this->helper('sales')->__('Your credit card will be charged for') ?></small>
40
- </td>
41
- <td class="a-right">
42
- <small><?php echo $this->displayBaseGrandtotal() ?></small>
43
- </td>
44
- </tr>
45
- <?php endif?>
46
  </tfoot>
47
  <?php endif; ?>
48
 
29
  */
30
  ?>
31
  <?php if ($this->getTotals()): ?>
32
+ <tfoot class="foot-table-review">
33
+ <?php $_colspan = 2; ?>
34
  <?php echo $this->renderTotals(null, $_colspan); ?>
35
  <?php echo $this->renderTotals('footer', $_colspan); ?>
36
+
 
 
 
 
 
 
 
 
 
37
  </tfoot>
38
  <?php endif; ?>
39
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/review/totals_simple.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * @see Mage_Checkout_Block_Cart_Totals
29
+ */
30
+ ?>
31
+ <?php if ($this->getTotals()): ?>
32
+ <tfoot style="width:100%">
33
+ <?php $_colspan = 0; ?>
34
+ <?php echo $this->renderTotals(null, $_colspan); ?>
35
+ <?php echo $this->renderTotals('footer', $_colspan); ?>
36
+ <?php if ($this->needDisplayBaseGrandtotal()):?>
37
+ <tr>
38
+ <td class="a-right" colspan="<?php echo $_colspan; ?>">
39
+ <small><?php echo $this->helper('sales')->__('Your credit card will be charged for') ?></small>
40
+ </td>
41
+ <td class="a-right">
42
+ <small><?php echo $this->displayBaseGrandtotal() ?></small>
43
+ </td>
44
+ </tr>
45
+ <?php endif?>
46
+ </tfoot>
47
+ <?php endif; ?>
48
+
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping.phtml CHANGED
@@ -47,7 +47,7 @@
47
  </div>
48
  </li>
49
  <?php echo $this->getChildHtml('shipping_form');?>
50
- <ul class="form-list">
51
  <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses() && Mage::helper('onestepcheckout')->showAddressBook()):?>
52
  <li class="control">
53
  <input type="checkbox" style="_float:left;" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book" style="_width:150px;"><?php echo $this->__('Save in address book') ?></label>
@@ -62,7 +62,10 @@
62
  </li>
63
  <?php endif;?>
64
  <li class="control">
65
- <input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked);" class="checkbox" /><label for="shipping:same_as_billing" style="float:none;"><?php echo $this->__('Use Billing Address') ?></label>
 
 
 
66
  </li>
67
  </ul>
68
  </ul>
47
  </div>
48
  </li>
49
  <?php echo $this->getChildHtml('shipping_form');?>
50
+ <ul class="form-list" style="float:none;clear:both">
51
  <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses() && Mage::helper('onestepcheckout')->showAddressBook()):?>
52
  <li class="control">
53
  <input type="checkbox" style="_float:left;" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book" style="_width:150px;"><?php echo $this->__('Save in address book') ?></label>
62
  </li>
63
  <?php endif;?>
64
  <li class="control">
65
+ <div class="btn button" onclick="SendShippingForBilling()"><span><span><?php echo $this->__('Enviar para endereço de cobrança') ?></span></span></div>
66
+ <input type="hidden" name="shipping[same_as_billing]" value="1" title="<?php echo $this->__('Use Billing Address') ?>" id="ship_to_same_address" >
67
+
68
+
69
  </li>
70
  </ul>
71
  </ul>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping/shipping_form.phtml CHANGED
@@ -56,9 +56,7 @@
56
  </div>
57
  </li>
58
  <li class="field">
59
- <div class="input-box" style="margin-top: 20px;margin-bottom: 8px;">
60
- <a id="correio" href="#inlinecorreio" title="">Não sabe o CEP?</a>
61
- </div>
62
  </li>
63
  </li>
64
  <li class="wide">
56
  </div>
57
  </li>
58
  <li class="field">
59
+
 
 
60
  </li>
61
  </li>
62
  <li class="wide">
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping_method.phtml CHANGED
@@ -1,4 +1,7 @@
1
- <div id="co-shipping-method-form" >
 
 
 
2
  <div id="checkout-shipping-method-load">
3
  <?php echo $this->getChildHtml('available') ?>
4
  </div>
1
+ <h4 class="sub-title-method">
2
+ <div class="onestepcheckout-numbers onestepcheckout-numbers-1" id="moip-osc-p1"></div><?php echo $this->__('Meio de Envio') ?>
3
+ </h4>
4
+ <div id="co-shipping-method-form" >
5
  <div id="checkout-shipping-method-load">
6
  <?php echo $this->getChildHtml('available') ?>
7
  </div>
app/design/frontend/base/default/template/MOIP/onestepcheckout/daskboard/onepage/shipping_method/available.phtml CHANGED
@@ -8,10 +8,10 @@
8
  <?php else: ?>
9
  <dl id="checkout-shipping-method-loadding" class="sp-methods">
10
  <?php $_sole = count($this->getShippingRates()) == 1; foreach ($this->getShippingRates() as $code => $_rates): ?>
11
- <dt><?php echo $this->getCarrierName($code); ?></dt>
12
  <dd>
13
- <ul class="shipping">
14
- <?php $_sole = $_sole && count($_rates) == "nada"; foreach ($_rates as $_rate): ?>
15
  <li>
16
  <?php if ($_rate->getErrorMessage()): ?>
17
  <div class="erro_cep sem_cep" style="display:none;">
@@ -23,50 +23,33 @@
23
  <?php else: ?>
24
  <?php if ($_sole) : ?>
25
  <span class="no-display"><input name="shipping_method" type="radio" title="Meio de Envio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" class="validate-one-required-by-name"/></span>
26
- <script type="text/javascript">
27
- //<![CDATA[
28
- updateShippingMethod();
29
- //]]>
30
- </script>
31
  <?php else: ?>
32
- <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" title="Meio de Envio" id="s_method_<?php echo $_rate->getCode() ?>" class="radio shipping_method_handle validate-one-required-by-name" onclick="updateShippingMethod();"/>
33
  <?php endif; ?>
34
  <label for="s_method_<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" value="<?php echo $_rate->getPrice() ?>">
35
 
36
- <?php if(Mage::getStoreConfig('moipall/config/icones_na_entrega')): ?>
37
- <?php
38
- if ($code == "pedroteixeira_correios" || $code == "flatrate" || $code == "freeshipping"){
39
- $pedroteixeira_correios_40045 = $this->getSkinUrl('MOIP/transparente/imagem/pedroteixeira_correios_40045.png'); //sedex_acobrar
40
- $pedroteixeira_correios_41106 = $this->getSkinUrl('MOIP/transparente/imagem/pedroteixeira_correios_41106.png'); //pac
41
- $pedroteixeira_correios_40010 = $this->getSkinUrl('MOIP/transparente/imagem/pedroteixeira_correios_40010.png'); //sedex
42
- $pedroteixeira_correios_40215 = $this->getSkinUrl('MOIP/transparente/imagem/pedroteixeira_correios_40215.png'); //sedex10
43
- $pedroteixeira_correios_40290 = $this->getSkinUrl('MOIP/transparente/imagem/pedroteixeira_correios_40290.png'); //sedexhoje
44
- $freeshipping_freeshipping = $this->getSkinUrl('MOIP/transparente/imagem/freeshipping_freeshipping.png'); //frete gratis
45
- $flatrate_flatrate = $this->getSkinUrl('MOIP/transparente/imagem/flatrate_flatrate.png'); //frete fixo
46
- }
47
- ?>
48
-
49
- <img src="<?php echo $this->getSkinUrl('MOIP/transparente/imagem/'); echo $_rate->getCode()?>.gif" id="moip<?php echo $_rate->getCode() ?>.png" alt="<?php echo $_rate->getMethodTitle() ?>" class="image_shipping">
50
-
51
- <?php endif; ?>
52
- <?php echo $_rate->getMethodTitle() ?>
53
- <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
54
- <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
55
- <?php echo $_excl; ?>
56
- <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
57
- (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
58
- <?php endif; ?>
59
- </label>
60
  <?php endif ?>
61
  </li>
62
  <?php endforeach; ?>
63
  </ul>
64
  </dd>
65
  <?php endforeach; ?>
 
66
  </dl>
67
  <?php endif; ?>
68
  <script type="text/javascript">
69
  //<![CDATA[
 
70
  if(jQuery("#billing\\:postcode").val() == '' || jQuery("#billing\\:postcode").val() == '.'){
71
  jQuery(".sem_cep").show();
72
  jQuery(".com_cep").hide();
8
  <?php else: ?>
9
  <dl id="checkout-shipping-method-loadding" class="sp-methods">
10
  <?php $_sole = count($this->getShippingRates()) == 1; foreach ($this->getShippingRates() as $code => $_rates): ?>
11
+ <dt><span class="icon ic ic-truck"></span> <?php echo $this->getCarrierName($code); ?></dt>
12
  <dd>
13
+ <ul class="shipping" id="decore-shipping">
14
+ <?php $_sole = $_sole && count($_rates) == "1"; foreach ($_rates as $_rate): ?>
15
  <li>
16
  <?php if ($_rate->getErrorMessage()): ?>
17
  <div class="erro_cep sem_cep" style="display:none;">
23
  <?php else: ?>
24
  <?php if ($_sole) : ?>
25
  <span class="no-display"><input name="shipping_method" type="radio" title="Meio de Envio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" class="validate-one-required-by-name"/></span>
26
+
 
 
 
 
27
  <?php else: ?>
28
+ <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" title="Meio de Envio" id="s_method_<?php echo $_rate->getCode() ?>" class="radio shipping_method_handle validate-one-required-by-name"/>
29
  <?php endif; ?>
30
  <label for="s_method_<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" value="<?php echo $_rate->getPrice() ?>">
31
 
32
+
33
+ <?php echo $_rate->getMethodTitle() ?>
34
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
35
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
36
+ <?php echo $_excl; ?>
37
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
38
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
39
+ <?php endif; ?>
40
+ </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  <?php endif ?>
42
  </li>
43
  <?php endforeach; ?>
44
  </ul>
45
  </dd>
46
  <?php endforeach; ?>
47
+ <span>* O Prazo de envio inicia após a confirmação automática do pagamento.</span>
48
  </dl>
49
  <?php endif; ?>
50
  <script type="text/javascript">
51
  //<![CDATA[
52
+ decorateList("decore-shipping");
53
  if(jQuery("#billing\\:postcode").val() == '' || jQuery("#billing\\:postcode").val() == '.'){
54
  jQuery(".sem_cep").show();
55
  jQuery(".com_cep").hide();
app/design/frontend/base/default/template/MOIP/onestepcheckout/{onepage.phtml → onepagejs.phtml} RENAMED
@@ -1,4 +1,5 @@
1
  <script type="text/javascript">countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
 
2
  <script type="text/javascript">
3
  //<![CDATA[
4
 
@@ -11,11 +12,14 @@ var updatecouponurl = "<?php echo Mage::getUrl('onestepcheckout/index/updatecoup
11
  var updateqtyurl = "<?php echo Mage::getUrl('onestepcheckout/index/updateqty')?>";
12
  var removeproducturl = "<?php echo Mage::getUrl('onestepcheckout/index/removeproduct')?>";
13
  var updateshippingmethodurl = "<?php echo Mage::getUrl('onestepcheckout/index/updateshippingmethod') ?>";
 
14
  var updatereviewurl = "<?php echo Mage::getUrl('onestepcheckout/index/updatereviewmethod') ?>";
15
  var createaccounturl = "<?php echo Mage::getUrl('onestepcheckout/index/CreataAccountInit') ?>";
16
  var buscacepurl = "<?php echo Mage::getUrl('Transparente/Standard/buscaCep') ?>";
 
 
17
 
18
- function ProxCamp(fields) {
19
  fields.value=soNumeros(fields.value)
20
  if (fields.value.length == fields.maxLength) {
21
  for (var i = 0; i < fields.form.length; i++) {
@@ -25,19 +29,31 @@ function ProxCamp(fields) {
25
  }
26
  }
27
  }
28
- }
29
- function soNumeros(v){
 
 
 
30
  return v.replace(/\D/g,"")
31
- }
32
- function has_default_billing()
 
 
33
  {
34
  <?php if (Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
 
35
  return 1;
36
  <?php else: ?>
 
 
 
37
  return 0;
38
  <?php endif ?>
39
- }
40
- function getval(sel) {
 
 
 
41
  if (sel.value == 1){
42
  jQuery('.dados-pj').slideUp();
43
  jQuery('.dados-pj input:not([type=checkbox])').removeClass('required-entry');
@@ -45,30 +61,17 @@ function getval(sel) {
45
  jQuery('.dados-pj').slideDown();
46
  jQuery('.dados-pj input:not([type=checkbox])').addClass('required-entry');
47
  }
48
- }
49
- function marcar_isento() {
 
50
  jQuery("#insestadual").val("Isento");
51
- }
52
- function seleciona_cep_busca(valor) {
53
- var cep_buscado = jQuery('.'+valor.className).val();
54
- jQuery("#billing\\:postcode").val(cep_buscado);
55
- buscarEndereco('billing');
56
- jQuery.fancybox.close();
57
- jQuery("#billing\\:street2").focus();
58
- }
59
- function busca_endereco_correios(){
60
- var url = buscacepurl+'meio/buscaend/logradouro/' + jQuery("#endereco_de_consulta").val().replace(/[^a-zA-ZãéíóúãõàèìòùÀÈÌÙÒÃÂâÁÉÍÓÚ ]/g, '') +'/busca_uf/'+jQuery("#busca_uf").val();
61
- jQuery.getJSON(url, function (result) {
62
- for (var i = 0; i < result.length; i++) {
63
- jQuery(".resultados_get_busca").append('<label class="busca_end_label"><div class="seletec_result_end"><input type="radio" value="'+result[i].retorno.cep+'" class="cep_encontrado_'+result[i].retorno.cep+'" onclick="javascript:seleciona_cep_busca(this);"></div><div class="dados_result_end"><span class="cidade">'+result[i].retorno.cidade + ' - ' + result[i].retorno.uf+'</span><span class="cep">'+result[i].retorno.cep+'</span><span class="rua">'+result[i].retorno.rua+'</span></div></label>');
64
- }
65
- jQuery("#searchForm").hide();
66
- jQuery("#buscar_nos_correios").show();
67
- });
68
  };
69
 
70
- function buscarEndereco(whatform) {
 
 
71
  if (whatform == "billing") {
 
72
  var campos = {
73
  postcode: document.getElementById('billing:postcode'),
74
  street_1: document.getElementById('billing:street1'),
@@ -110,21 +113,37 @@ function buscarEndereco(whatform) {
110
 
111
  success: function(data){
112
  jQuery('#loading-mask').fadeOut();
 
113
  if(data){
114
  var addressData = jQuery.parseJSON(data);
115
-
116
- jQuery(campos.street_1).val(addressData.logradouro);
117
- jQuery(campos.street_4).val(addressData.bairro);
118
- jQuery(campos.city).val(addressData.cidade);
119
- jQuery(campos.region).val(addressData.ufid);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  if (campos.postcode != "" && campos.postcode != ".")
121
  {
122
  updateShippingType(campos.postcode);
123
  };
124
- jQuery("#billing\\:street2").focus();
125
  } else {
126
  jQuery(campos.street_1).attr('placeholder', 'Rua');
127
- jQuery(campos.street_4).attr('placeholder', 'N.º');
 
128
  jQuery(campos.city).attr('placeholder', 'Cidade');
129
  if (campos.postcode != "" && campos.postcode != ".")
130
  {
@@ -144,7 +163,8 @@ function buscarEndereco(whatform) {
144
  },
145
  });
146
  };
147
- function createAccount () {
 
148
  var formAccount = new VarienForm('onestep_form', true);
149
  jQuery('#loading-mask').show();
150
 
@@ -156,13 +176,15 @@ function createAccount () {
156
  jQuery('#loading-mask').hide();
157
  }
158
 
159
- }
160
- function showcreateAccount(){
 
161
  jQuery("#cadastrar").removeClass('force-nodisplay');
162
- jQuery("#cadastrar").show('slow');
163
  jQuery("#criar_loga").hide();
164
- }
165
- function updateShippingMethod() {
 
166
  var msg = '';
167
  if(document.getElementById('billing:postcode') != "" && document.getElementById('billing:postcode') != "." ){
168
  jQuery.ajax({
@@ -174,7 +196,7 @@ function updateShippingMethod() {
174
 
175
  jQuery('.validation-advice').hide();
176
  jQuery("input[name='shipping_method']").removeClass('validation-failed');
177
- jQuery('#checkout-payment-method-load').html('<div class="update_payment">Calculando valor do pagamento.<img class="Loading" alt="Loading..." src="<?php echo $this->getSkinUrl("MOIP/onestepcheckout/images/ajax-loader-tr.gif")?>"></div>');
178
  updatePaymentAssociated();
179
 
180
  },
@@ -198,7 +220,41 @@ function updateShippingMethod() {
198
 
199
  }
200
  };
201
- function updateShippingType(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  var msg = '';
203
  <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
204
  jQuery.ajax({
@@ -207,7 +263,7 @@ function updateShippingType(){
207
  data:jQuery("#onestep_form").serialize(),
208
  beforeSend: function(){
209
  jQuery('#message-box').html('');
210
- jQuery('#checkout-shipping-method-load').html('<div class="update_shipping">Calculando Frete.<img class="Loading" alt="Loading..." src="<?php echo $this->getSkinUrl("MOIP/onestepcheckout/images/ajax-loader-tr.gif")?>"></div>');
211
  },
212
  success: function(msg){
213
  jQuery('#checkout-shipping-method-load').html(msg);
@@ -220,25 +276,10 @@ function updateShippingType(){
220
  },
221
  });
222
  <?php endif?>
223
- }
224
- function updatePaymentAssociated() {
225
- var msg = '';
226
- jQuery.ajax({
227
- type: "POST",
228
- url: updatepaymenttypeurl,
229
- data: jQuery("#onestep_form").serialize(),
230
- beforeSend: function(data){
231
- updatePaymentMethod();
232
- },
233
- success: function(msg) {
234
- jQuery('#checkout-payment-method-load').html(msg);
235
- jQuery('#checkout-payment-method-load').find("script").each(function(i) {
236
-                     eval(jQuery(this).text());
237
-                 });
238
- },
239
- });
240
- }
241
- function updateClear() {
242
  jQuery.ajax({
243
  async: false,
244
  type: "POST",
@@ -257,8 +298,27 @@ function updateClear() {
257
  jQuery('#checkout-shipping-method-load').html("Não foi possível cotar o seu frete, por favor recarrege a página ou entre em contato com nossa loja.");
258
  },
259
  });
260
- }
261
- function updatePaymentMethod() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  var msg = '';
263
  jQuery.ajax({
264
  url: updatepaymentmethodurl,
@@ -276,7 +336,8 @@ function updatePaymentMethod() {
276
  });
277
 
278
  };
279
- function updateCoupon() {
 
280
  jQuery(".cupom_tem").hide();
281
  jQuery("#loading_mask_loader").show();
282
  jQuery.ajax({
@@ -290,23 +351,17 @@ function updateCoupon() {
290
  type: "POST",
291
  data: jQuery("#onestep_form").serialize(),
292
  });
293
- jQuery('#checkout-payment-method-load').html();
294
- str = jQuery.parseJSON(msg);
295
- jQuery('.discount-form').html(str.coupon);
296
- jQuery('#checkout-review-table-wrapper').html(str.view);
297
- jQuery('#checkout-review-table-wrapper').find("script").each(function(i) {
298
-                     eval(jQuery(this).text());
299
-                 });
300
 
301
  })
302
  .fail(function() {
303
- updateCoupon(code, isremove);
304
  })
305
  .always(function() {
306
- updateShippingType(document.getElementById('billing:postcode'));
307
  });
308
  };
309
- function removeProduct(id) {
310
  hasgift = (typeof(jQuery('#allow-gift-message-container')) != 'undefined') ? 1 : 0;
311
 
312
  jQuery.ajax({
@@ -322,40 +377,23 @@ function removeProduct(id) {
322
  url: updatepaymenttypeurl,
323
  data: jQuery("#onestep_form").serialize(),
324
  success: function(msg) {
325
- jQuery('#checkout-payment-method-load').html(msg);
326
  }
327
  });
328
- str = jQuery.parseJSON(msg);
329
- if (str.view.search("<script") != 0) {
330
- if (str.giftbox) {
331
- jQuery('#checkout-review-table-wrappe').html(str.view);
332
- jQuery('#onepage-checkout-shipping-method-additional-load').html(str.giftbox);
333
- } else {
334
- jQuery('#checkout-review-table-wrapper').html(str.view);
335
- jQuery('#checkout-review-table-wrapper').find("script").each(function(i) {
336
-                     eval(jQuery(this).text());
337
-                 });
338
- }
339
- } else {
340
- jQuery('#checkout-review-table-wrapper').append(str.view);
341
- jQuery('#checkout-review-table-wrapper').find("script").each(function(i) {
342
-                     eval(jQuery(this).text());
343
-                 });
344
- }
345
  }
346
  });
347
  updateShippingType(document.getElementById('billing:postcode'));
348
  }
349
- function logined()
350
  {
351
  <?php if(Mage::getSingleton('customer/session')->isLoggedIn()):?>
352
-
353
- return 1;
354
  <?php else: ?>
355
- return 0;
356
  <?php endif ?>
357
  }
358
- function hasaddress(){
359
  <?php if(count(Mage::getSingleton('customer/session')->getCustomer()->getAddresses())): ?>
360
  updateShippingType(document.getElementById('billing:postcode'));
361
  return 1;
@@ -364,35 +402,65 @@ function hasaddress(){
364
  <?php endif; ?>
365
  }
366
 
367
- function removeProductId(product_id){
368
  if(confirm("<?php echo $this->__('Tem certeza que deseja remover o produto?')?>")){
369
  removeProduct(product_id);
370
  }
371
  }
372
- function updateEmailmsg(val){
 
373
  jQuery.ajax({
374
- async:true,
375
  type: "POST",
376
  url: "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>",
377
  data:"email="+val,
378
- beforeSend: function(){
379
- jQuery('#message-box').html('');
380
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  success: function(msg){
 
 
 
382
  var error="<div id=\"message-box\"><div class=\"validation-advice\" style=\"position:relative;\">Email já cadastrado, por favor <a href=\"#\" data-toggle=\"modal\" data-target=\"#loginModel\" id=\"loginbox\">Clique aqui e faça o login</a></div></div>";
383
  if(msg==0){
384
  jQuery('#billing\\:email').after(error);
385
  jQuery('#message-box').html(error);
 
 
386
  }else{
387
  if(logined()!=1){
388
  jQuery('#message-box').html('');
389
  }
390
  jQuery('#billing\\:email').removeClass('validation-failed');
 
391
  }
392
  }
393
  });
394
  }
395
- function updateQty(){
 
396
  jQuery('#loading-mask').show();
397
 
398
  jQuery.ajax({
@@ -408,146 +476,41 @@ function updateQty(){
408
  });
409
 
410
  }
411
- function inbtn(id){
 
 
412
  removeElemento = "#up_"+id;
413
 
414
  jQuery(removeElemento).addClass('btn-update-qty-visible');
415
  }
416
 
417
- jQuery(function () {
418
-
419
- jQuery('#billing\\:taxvat').mask("000.000.000-00", {placeholder: "___.___.___-__"});
420
- jQuery('#shipping\\:taxvat').mask("000.000.000-00", {placeholder: "___.___.___-__"});
421
- jQuery('#taxvat').mask("000.000.000-00", {placeholder: "___.___.___-__"});
422
-
423
- jQuery('#cnpj').mask("00.000.000-0000-00", {placeholder: "__.___.___-____-__"});
424
- jQuery('#billing\\:postcode').mask("00000-000", {placeholder: "_____-___"});
425
- jQuery('#shipping\\:postcode').mask("00000-000", {placeholder: "_____-___"});
426
- jQuery('#postcode').mask("00000-000", {placeholder: "_____-___"});
427
- jQuery('#zip').mask("00000-000", {placeholder: "_____-___"});
428
- jQuery('#billing\\:fax').mask("(00)0000-0000Z", {placeholder: "(__)____-_____",translation: {'Z': {pattern: /[0-9]/, optional: true}}});
429
- jQuery('#billing\\:telephone').mask("(00)0000-0000Z", {placeholder: "(__)____-_____",translation: {'Z': {pattern: /[0-9]/, optional: true}}});
430
- jQuery('#shipping\\:telephone').mask("(00)0000-0000Z", {placeholder: "(__)____-_____",translation: {'Z': {pattern: /[0-9]/, optional: true}}});
431
- jQuery('#shipping\\:fax').mask("(00)0000-0000Z", {placeholder: "(__)____-_____",translation: {'Z': {pattern: /[0-9]/, optional: true}}});
432
- jQuery('#credito_portador_telefone').mask("(00)0000-0000Z", {placeholder: "(__)____-_____",translation: {'Z': {pattern: /[0-9]/, optional: true}}});
433
-
434
- jQuery('.btn-checkout').bind("click",function(e){
435
- jQuery(".btn-checkout").attr("disabled", "disabled");
436
- jQuery(".btn-checkout").hide();
437
- jQuery('#co-payment-form').show();
438
- var form = new VarienForm('onestep_form', true);
439
- if(!form.validator.validate()) {
440
- var logic= false;
441
- if(logined()!=1){
442
- val=jQuery('#billing\\:email').val();
443
- emailvalidated=Validation.get('IsEmpty').test(val) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(val);
444
- if(val!="" && emailvalidated){
445
- updateEmailmsg(val);
446
- }
447
- }
448
-
449
- } else {
450
- var logic= true;
451
- if(logined()!=1){
452
- var msgerror=1;
453
- val=jQuery('#billing\\:email').val();
454
- emailvalidated=Validation.get('IsEmpty').test(val) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(val);
455
- if(val!="" && emailvalidated){
456
- msgerror=updateEmailmsg(val);
457
- }
458
- if(msgerror==0){
459
- return false;
460
- }
461
-
462
- }
463
- }
464
- if(logic){
465
- jQuery('#loading-mask').show();
466
- jQuery('#onestep_form').submit();
467
- return true;
468
- } else {
469
-
470
- jQuery(".erros_cadastro_valores").html("");
471
- var erro_dado = [];
472
- var j = 0;
473
- jQuery(".validation-failed").each(function() {
474
- j++;
475
- temp_erro = jQuery(this).attr("title");
476
- if(jQuery.inArray(temp_erro, erro_dado) != 1){
477
- erro_dado[j] = jQuery(this).attr("title");
478
- jQuery(".erros_cadastro_valores").append('<li>'+erro_dado[j]+'</li>');
479
- }
480
 
481
 
482
- });
483
- if(jQuery.inArray("Meio de Envio", erro_dado) == 1){
484
- jQuery('#checkout-shipping-method-loadding').append('<dt><div class="validation-advice" id="advice-required-entry_shipping" style="position:relative;">Você deverá selecionar uma forma de envio.</div></dt>');
485
- }
486
- jQuery('#ErrosFinalizacao').modal('toggle');
487
- jQuery('.validation-advice').delay(3000).fadeOut("slow");
488
- jQuery(".btn-checkout").removeAttr("disabled");
489
- jQuery(".btn-checkout").show("slow");
490
- return false;
491
- }
492
- });
493
- jQuery('#onestep_form :input').blur(function() {
494
- if(jQuery(this).attr('id') != "billing:day" && jQuery(this).attr('id') != "billing:month"){
495
- Validation.validate(jQuery(this).attr('id'));
496
- }
497
- });
498
- jQuery("#billing\\:day").attr('maxlength', '2');
499
- jQuery("#billing\\:day").attr('onkeyup', 'ProxCamp(this)');
500
- jQuery("#billing\\:month").attr('maxlength', '2');
501
- jQuery("#billing\\:month").attr('onkeyup', 'ProxCamp(this)');
502
- jQuery("#billing\\:year").attr('maxlength', '4');
503
- jQuery("#billing\\:year").attr('onkeyup', 'ProxCamp(this)');
504
- if (!logined()) {
505
- jQuery('#allow-gift-message-container').clearForm();
506
- }
507
- jQuery('[id="billing:postcode"]').addClass('required-entry');
508
- jQuery('[id="shipping:postcode"]').addClass('required-entry');
509
- jQuery('[id="billing:region_id"]').addClass('validate-select');
510
- jQuery('[id="shipping:region_id"]').addClass('validate-select');
511
-
512
- if (logined()) {
513
- if (!has_default_billing()) {
514
- jQuery('#billing-new-address-form').clearForm();
515
- jQuery('#shipping-new-address-form').clearForm();
516
- }
517
- } else {
518
- jQuery('#billing-new-address-form').clearForm();
519
- jQuery('#shipping-new-address-form').clearForm();
520
- }
521
- <?php
522
- $islogin=0;
523
- if(Mage::getSingleton('customer/session')->isLoggedIn()){
524
- $islogin=1;
525
- }
526
- ?>
527
 
 
 
 
 
 
 
 
 
 
528
  <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
529
- jQuery('#credito_numero_moip').focus(function() {
530
- if(!jQuery("input[name='shipping_method']:checked").val()){
531
- jQuery('.form-list.cartao').html("Desculpe, Selecione primeiramente a Forma de Envio no passo 2.");
532
- }
533
- });
 
534
  <?php endif?>
 
 
 
535
  });
 
 
536
  //]]>
537
  </script>
538
 
539
-
540
- <script type="text/javascript">
541
- //<![CDATA[
542
- var accordion = new Accordion('checkoutSteps', '.step-title', true);
543
- <?php if($this->getActiveStep()): ?>
544
- accordion.openSection('opc-<?php echo $this->getActiveStep() ?>');
545
- <?php endif ?>
546
- var checkout = new Checkout(accordion,{
547
- progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
548
- review: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
549
- saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
550
- failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
551
- );
552
- //]]>
553
- </script>
1
  <script type="text/javascript">countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
2
+
3
  <script type="text/javascript">
4
  //<![CDATA[
5
 
12
  var updateqtyurl = "<?php echo Mage::getUrl('onestepcheckout/index/updateqty')?>";
13
  var removeproducturl = "<?php echo Mage::getUrl('onestepcheckout/index/removeproduct')?>";
14
  var updateshippingmethodurl = "<?php echo Mage::getUrl('onestepcheckout/index/updateshippingmethod') ?>";
15
+ var updateordermethodurl = "<?php echo Mage::getUrl('onestepcheckout/index/updateordermethod') ?>";
16
  var updatereviewurl = "<?php echo Mage::getUrl('onestepcheckout/index/updatereviewmethod') ?>";
17
  var createaccounturl = "<?php echo Mage::getUrl('onestepcheckout/index/CreataAccountInit') ?>";
18
  var buscacepurl = "<?php echo Mage::getUrl('Transparente/Standard/buscaCep') ?>";
19
+ (function($) {
20
+
21
 
22
+ ProxCamp = function(fields) {
23
  fields.value=soNumeros(fields.value)
24
  if (fields.value.length == fields.maxLength) {
25
  for (var i = 0; i < fields.form.length; i++) {
29
  }
30
  }
31
  }
32
+ };
33
+
34
+
35
+
36
+ soNumeros = function(v){
37
  return v.replace(/\D/g,"")
38
+ };
39
+
40
+
41
+ has_default_billing = function()
42
  {
43
  <?php if (Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
44
+
45
  return 1;
46
  <?php else: ?>
47
+
48
+ jQuery("#billing\\:firstname").val("");
49
+ jQuery("#billing\\:lastname").val("");
50
  return 0;
51
  <?php endif ?>
52
+ };
53
+
54
+
55
+
56
+ getval = function(sel) {
57
  if (sel.value == 1){
58
  jQuery('.dados-pj').slideUp();
59
  jQuery('.dados-pj input:not([type=checkbox])').removeClass('required-entry');
61
  jQuery('.dados-pj').slideDown();
62
  jQuery('.dados-pj input:not([type=checkbox])').addClass('required-entry');
63
  }
64
+ };
65
+
66
+ marcar_isento = function() {
67
  jQuery("#insestadual").val("Isento");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  };
69
 
70
+
71
+
72
+ buscarEndereco = function(whatform) {
73
  if (whatform == "billing") {
74
+ jQuery(".hide-zip-code").addClass("show-zip-code");
75
  var campos = {
76
  postcode: document.getElementById('billing:postcode'),
77
  street_1: document.getElementById('billing:street1'),
113
 
114
  success: function(data){
115
  jQuery('#loading-mask').fadeOut();
116
+ jQuery("#billing\\:street2").focus();
117
  if(data){
118
  var addressData = jQuery.parseJSON(data);
119
+ if(addressData.logradouro != "undefined"){
120
+ jQuery(campos.street_1).attr('placeholder', 'Rua');
121
+ jQuery(campos.street_2).attr('placeholder', 'N.º');
122
+ jQuery(campos.street_4).attr('placeholder', 'Bairro');
123
+ jQuery(campos.city).attr('placeholder', 'Cidade');
124
+ jQuery(campos.street_1).val(addressData.logradouro);
125
+ jQuery(campos.street_4).val(addressData.bairro);
126
+ jQuery(campos.city).val(addressData.cidade);
127
+ jQuery(campos.region).val(addressData.ufid);
128
+
129
+ }else {
130
+ jQuery(campos.street_1).val('');
131
+ jQuery(campos.street_4).val('');
132
+ jQuery(campos.city).val('');
133
+ jQuery(campos.street_1).attr('placeholder', 'Rua');
134
+ jQuery(campos.street_2).attr('placeholder', 'N.º');
135
+ jQuery(campos.street_4).attr('placeholder', 'Bairro');
136
+ jQuery(campos.city).attr('placeholder', 'Cidade');
137
+ }
138
  if (campos.postcode != "" && campos.postcode != ".")
139
  {
140
  updateShippingType(campos.postcode);
141
  };
142
+
143
  } else {
144
  jQuery(campos.street_1).attr('placeholder', 'Rua');
145
+ jQuery(campos.street_2).attr('placeholder', 'N.º');
146
+ jQuery(campos.street_4).attr('placeholder', 'Bairro');
147
  jQuery(campos.city).attr('placeholder', 'Cidade');
148
  if (campos.postcode != "" && campos.postcode != ".")
149
  {
163
  },
164
  });
165
  };
166
+
167
+ createAccount = function() {
168
  var formAccount = new VarienForm('onestep_form', true);
169
  jQuery('#loading-mask').show();
170
 
176
  jQuery('#loading-mask').hide();
177
  }
178
 
179
+ };
180
+
181
+ showcreateAccount = function(){
182
  jQuery("#cadastrar").removeClass('force-nodisplay');
183
+
184
  jQuery("#criar_loga").hide();
185
+ };
186
+
187
+ updateShippingMethod = function() {
188
  var msg = '';
189
  if(document.getElementById('billing:postcode') != "" && document.getElementById('billing:postcode') != "." ){
190
  jQuery.ajax({
196
 
197
  jQuery('.validation-advice').hide();
198
  jQuery("input[name='shipping_method']").removeClass('validation-failed');
199
+ jQuery('#checkout-payment-method-load').html('<div class="update_payment"><p>Calculando valor do pagamento.</p><img class="Loading" alt="Loading..." src="<?php echo $this->getSkinUrl("MOIP/onestepcheckout/images/ajax-loader-tr.gif")?>"></div>');
200
  updatePaymentAssociated();
201
 
202
  },
220
 
221
  }
222
  };
223
+ updateOrderMethod = function() {
224
+ var msg = '';
225
+
226
+ jQuery.ajax({
227
+ type: "POST",
228
+ url: updateordermethodurl,
229
+
230
+ data: jQuery("#onestep_form").serialize(),
231
+
232
+ success: function(msg) {
233
+ var result = jQuery.parseJSON(msg);
234
+ if(result.erros == 1){
235
+ jQuery(".erros_cadastro_valores").append('<li>'+result.msg_error+'</li>');
236
+ jQuery('#loading-mask').hide();
237
+ jQuery('#ErrosFinalizacao').modal('toggle');
238
+
239
+ } else{
240
+ window.location.href = result.msg_success;
241
+ }
242
+
243
+
244
+
245
+ },
246
+ fail:function() {
247
+ location.reload();
248
+ },
249
+ always: function() {
250
+
251
+ },
252
+ })
253
+
254
+
255
+ };
256
+
257
+ updateShippingType = function(){
258
  var msg = '';
259
  <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
260
  jQuery.ajax({
263
  data:jQuery("#onestep_form").serialize(),
264
  beforeSend: function(){
265
  jQuery('#message-box').html('');
266
+ jQuery('#checkout-shipping-method-load').html('<div class="update_shipping"><p>Calculando Frete.</p><img class="Loading" alt="Loading..." src="<?php echo $this->getSkinUrl("MOIP/onestepcheckout/images/ajax-loader-tr.gif")?>"></div>');
267
  },
268
  success: function(msg){
269
  jQuery('#checkout-shipping-method-load').html(msg);
276
  },
277
  });
278
  <?php endif?>
279
+ };
280
+
281
+ updateClear = function() {
282
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  jQuery.ajax({
284
  async: false,
285
  type: "POST",
298
  jQuery('#checkout-shipping-method-load').html("Não foi possível cotar o seu frete, por favor recarrege a página ou entre em contato com nossa loja.");
299
  },
300
  });
301
+ };
302
+
303
+ updatePaymentAssociated = function() {
304
+ var msg = '';
305
+ jQuery.ajax({
306
+ type: "POST",
307
+ url: updatepaymenttypeurl,
308
+ data: jQuery("#onestep_form").serialize(),
309
+ beforeSend: function(data){
310
+ updatePaymentMethod();
311
+ },
312
+ success: function(msg) {
313
+ jQuery('#checkout-payment-method-load').html(msg);
314
+ jQuery('#checkout-payment-method-load').find("script").each(function(i) {
315
+                     eval(jQuery(this).text());
316
+                 });
317
+ },
318
+ });
319
+ };
320
+
321
+ updatePaymentMethod = function() {
322
  var msg = '';
323
  jQuery.ajax({
324
  url: updatepaymentmethodurl,
336
  });
337
 
338
  };
339
+
340
+ updateCoupon = function() {
341
  jQuery(".cupom_tem").hide();
342
  jQuery("#loading_mask_loader").show();
343
  jQuery.ajax({
351
  type: "POST",
352
  data: jQuery("#onestep_form").serialize(),
353
  });
354
+ location.reload();
 
 
 
 
 
 
355
 
356
  })
357
  .fail(function() {
358
+ location.reload();
359
  })
360
  .always(function() {
361
+ location.reload();
362
  });
363
  };
364
+ removeProduct = function(id) {
365
  hasgift = (typeof(jQuery('#allow-gift-message-container')) != 'undefined') ? 1 : 0;
366
 
367
  jQuery.ajax({
377
  url: updatepaymenttypeurl,
378
  data: jQuery("#onestep_form").serialize(),
379
  success: function(msg) {
380
+ location.reload();
381
  }
382
  });
383
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
385
  });
386
  updateShippingType(document.getElementById('billing:postcode'));
387
  }
388
+ logined = function()
389
  {
390
  <?php if(Mage::getSingleton('customer/session')->isLoggedIn()):?>
391
+ return 1;
 
392
  <?php else: ?>
393
+ return 0;
394
  <?php endif ?>
395
  }
396
+ hasaddress = function(){
397
  <?php if(count(Mage::getSingleton('customer/session')->getCustomer()->getAddresses())): ?>
398
  updateShippingType(document.getElementById('billing:postcode'));
399
  return 1;
402
  <?php endif; ?>
403
  }
404
 
405
+ removeProductId = function(product_id){
406
  if(confirm("<?php echo $this->__('Tem certeza que deseja remover o produto?')?>")){
407
  removeProduct(product_id);
408
  }
409
  }
410
+ checkedLoginStep = function(val){
411
+
412
  jQuery.ajax({
413
+ async:false,
414
  type: "POST",
415
  url: "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>",
416
  data:"email="+val,
417
+
418
+ success: function(msg){
419
+
420
+ if(msg==0){
421
+ jQuery('.pre-step').hide();
422
+ jQuery('#login-checked').show();
423
+ jQuery('#checked-login-email').val(val);
424
+
425
+ }else{
426
+ jQuery('.pre-step').hide();
427
+ jQuery('#billing\\:email').val(val);
428
+ jQuery('#create-checked').show();
429
+ }
430
+
431
+ }
432
+ });
433
+ }
434
+ updateEmailmsg = function(val){
435
+
436
+ jQuery.ajax({
437
+ async:false,
438
+ type: "POST",
439
+ url: "<?php echo Mage::getUrl('onestepcheckout/index/updateemailmsg')?>",
440
+ data:"email="+val,
441
+
442
  success: function(msg){
443
+ val=jQuery('#billing\\:email').val();
444
+ emailvalidated=Validation.get('IsEmpty').test(val) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(val);
445
+
446
  var error="<div id=\"message-box\"><div class=\"validation-advice\" style=\"position:relative;\">Email já cadastrado, por favor <a href=\"#\" data-toggle=\"modal\" data-target=\"#loginModel\" id=\"loginbox\">Clique aqui e faça o login</a></div></div>";
447
  if(msg==0){
448
  jQuery('#billing\\:email').after(error);
449
  jQuery('#message-box').html(error);
450
+ return 0;
451
+
452
  }else{
453
  if(logined()!=1){
454
  jQuery('#message-box').html('');
455
  }
456
  jQuery('#billing\\:email').removeClass('validation-failed');
457
+ return 1;
458
  }
459
  }
460
  });
461
  }
462
+
463
+ updateQty = function(){
464
  jQuery('#loading-mask').show();
465
 
466
  jQuery.ajax({
476
  });
477
 
478
  }
479
+
480
+
481
+ inbtn = function(id){
482
  removeElemento = "#up_"+id;
483
 
484
  jQuery(removeElemento).addClass('btn-update-qty-visible');
485
  }
486
 
487
+ })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
 
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
 
491
+ jQuery(document).ready(function(){
492
+ var payment = new Payment('co-payment-form', '<?php echo $this->getUrl("checkout/onepage/savePayment") ?>');
493
+
494
+ payment.initWhatIsCvvListeners();
495
+ payment.init();
496
+ has_default_billing();
497
+ ChangeEvents();
498
+ Setmask();
499
+ updateClear();
500
  <?php if(!Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
501
+ jQuery('#moip_cc_number').focus(function() {
502
+ var selectShipping = jQuery("input[name='shipping_method']:checked").val();
503
+ if(typeof selectShipping == 'undefined'){
504
+ jQuery('#payment_form_moip_cc').html("Desculpe, Selecione primeiramente a Forma de Envio");
505
+ }
506
+ });
507
  <?php endif?>
508
+ jQuery("input[name='shipping_method']").change(function () {
509
+ updateShippingMethod();
510
+ });
511
  });
512
+
513
+
514
  //]]>
515
  </script>
516
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/MOIP/onestepcheckout/page/1column.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Template for Mage_Page_Block_Html
30
+ */
31
+ ?>
32
+ <!DOCTYPE html>
33
+ <html lang="en">
34
+ <head>
35
+ <?php echo $this->getChildHtml('head') ?>
36
+ </head>
37
+ <body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
38
+
39
+
40
+ <div class="wrapper">
41
+ <?php echo $this->getChildHtml('header') ?>
42
+ <?php echo $this->getChildHtml('global_notices') ?>
43
+ <div class="page container">
44
+
45
+ <div class="container">
46
+ <?php echo $this->getChildHtml('after_body_start') ?>
47
+ <?php echo $this->getChildHtml('global_messages') ?>
48
+ <?php echo $this->getChildHtml('content') ?>
49
+ </div>
50
+
51
+ </div>
52
+ <div class="full-container">
53
+ <?php # echo $this->getChildHtml('footer') ?>
54
+ <?php echo $this->getChildHtml('global_cookie_notice') ?>
55
+ <?php echo $this->getChildHtml('before_body_end') ?>
56
+ </div>
57
+ </div>
58
+ <?php echo $this->getAbsoluteFooter() ?>
59
+ </body>
60
+ </html>
app/design/frontend/base/default/template/MOIP/onestepcheckout/page/footer.phtml ADDED
@@ -0,0 +1 @@
 
1
+ incluir selos de compra segura...
app/design/frontend/base/default/template/MOIP/onestepcheckout/page/single-header.phtml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ /**
27
+ * @var Mage_Page_Block_Html_Header $this
28
+ */
29
+ ?>
30
+ <div class="full-container">
31
+
32
+ <div class="container">
33
+ <div class="row">
34
+ <div class="header">
35
+ <div class="col-lg-3 col-md-3 col-xm-12">
36
+
37
+ <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
38
+
39
+
40
+ </div>
41
+ <div class="col-lg-6 col-md-6 col-xm-12">
42
+ <h1 class="checkout-title-header">Pagamento</h1>
43
+ <?php if(Mage::getStoreConfig('onestepcheckout/layout/use_linha_suporte')): ?>
44
+ <?php echo $this->__(Mage::getStoreConfig('onestepcheckout/layout/content_linha_suporte'));?>
45
+ <?php endif; ?>
46
+
47
+ </div>
48
+ <div class="col-lg-3 col-md-3 col-xm-12 hidden-xs">
49
+ <div class="siteblindado a-right">
50
+ <a id="store_secure_buttom" href="#" data-toggle="modal" data-target="#store_secure_content" title="Loja Segura, confira!">
51
+ <img src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/loja_segura.jpg'); ?>">
52
+ </a>
53
+ </div>
54
+ </div>
55
+
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+
61
+
62
+ <div class="container">
63
+ <div class="row">
64
+
65
+ <?php echo $this->getChildHtml('progresso') ?>
66
+
67
+
68
+ </div>
69
+ </div>
70
+
71
+ <?php echo $this->getChildHtml('topContainer') ?>
app/design/frontend/base/default/template/MOIP/onestepcheckout/progresso.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $request = $this->getRequest();
3
+ $module = $request->getModuleName();
4
+ $controller = $request->getControllerName();
5
+ $action = $request->getActionName();
6
+
7
+ if($action == "cadastro") {
8
+ $step1 = "active";
9
+ $step2 = "disabled";
10
+ $step3 = "disabled";
11
+ } elseif ($action == "index") {
12
+ $step1 = "complete";
13
+ $step2 = "active";
14
+ $step3 = "disabled";
15
+ } elseif ($action == "redirect"){
16
+ $step1 = "complete";
17
+ $step2 = "complete";
18
+ $step3 = "active";
19
+
20
+ }
21
+ ?>
22
+ <div class="row bs-wizard hidden-xs">
23
+
24
+ <div class="col-xs-6 bs-wizard-step <?php echo $step1 ?>">
25
+ <div class="text-center bs-wizard-stepnum ">Identificação</div>
26
+ <div class="progress"><div class="progress-bar"></div></div>
27
+ <span class="bs-wizard-dot"></span>
28
+ </div>
29
+
30
+ <div class="col-xs-6 bs-wizard-step <?php echo $step2 ?>"><!-- complete -->
31
+ <div class="text-center bs-wizard-stepnum">Entrega & Pagamento</div>
32
+ <div class="progress"><div class="progress-bar"></div></div>
33
+ <span class="bs-wizard-dot"></span>
34
+ </div>
35
+
36
+
37
+ </div>
app/design/frontend/base/default/template/MOIP/product/list/parcelas.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_product = $this->getProduct(); ?>
2
+ <?php if(!$_product->getIsRecurring()): ?>
3
+ <?php $price = $_product->getFinalPrice(); ?>
4
+ <?php $parcial = $this->getParcelamento($price, 'reduzido'); ?>
5
+ <?php $integral = $this->getParcelamento($price, 'integral'); ?>
6
+ <?php if($parcial): ?>
7
+ <div class="" id="parecelas-view-<?php echo $_product->getId() ?>" title="Parcelamento no Cartão de Crédito" data-container="body" data-toggle="popover" data-placement="bottom" >em <?php echo $this->getParcelamento($price, 'reduzido'); ?></div>
8
+
9
+ <?php endif ?>
10
+ <?php if($integral): ?>
11
+
12
+ <div class="parcelas-integrais-content" style="display:none">
13
+ <div class="result-moip-parcelas">
14
+ <?php $_count = count($integral); ?>
15
+ <?php if($_count > 3 ) :?>
16
+ <ul id="parcelamento_integral" class="bullet">
17
+ <?php foreach ($integral as $key => $value): ?>
18
+ <li><?php echo $value; ?></li>
19
+ <?php endforeach ?>
20
+ </ul>
21
+ <?php endif ?>
22
+ </div>
23
+
24
+ </div>
25
+ <?php endif ?>
26
+ <script type="text/javascript">decorateList('parcelamento_integral')
27
+ jQuery('#parecelas-view-<?php echo $_product->getId() ?>').popover({
28
+ content: jQuery('.parcelas-integrais-content').html(),
29
+ html: true,
30
+ template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div><div class="popover-footer"><div class="images-moip-parcelas"><ul class="product_view_bandeiras"><li><img src="<?php echo $this->getVisaImage(); ?>" id="Moip_Visa" alt="Visa" border="0"></li><li><img src="<?php echo $this->getMastercardImage(); ?>" id="Moip_Mastercard" alt="Mastercard" border="0" ></li><li><img src="<?php echo $this->getAmericanExpressImage(); ?>" id="Moip_AmericanExpress" alt="AmericanExpress" border="0" ></li><li><img src="<?php echo $this->getDinersImage(); ?>" id="Moip_Diners" alt="Diners" border="0" ></li><li><img src="<?php echo $this->getEloImage(); ?>" id="Moip_Elo" alt="Elo" border="0" ></li><li><img src="<?php echo $this->getHiperImage(); ?>" id="Moip_Hiper" alt="Hiper" border="0" ></li><li><img src="<?php echo $this->getHipercardImage(); ?>" id="Moip_Hipercard" alt="Hipercard" border="0" ></li></ul></div></div></div>'
31
+ });
32
+ </script>
33
+ <?php endif ?>
34
+
35
+
app/design/frontend/base/default/template/MOIP/product/view/discount.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if($this->getPercentual()): ?>
2
+ <div class="background double price-boleto"><span> ou </span></div>
3
+ <div class="line-boleto-text"><?php echo $this->__(' %s de desconto no boleto', (int)$this->getPercentual().'%') ?></div>
4
+ <div class="line-boleto-price"><?php echo $this->getNewPriceDiscount(); ?></div>
5
+ <?php endif ?>
app/design/frontend/base/default/template/MOIP/product/view/parcelas.phtml CHANGED
@@ -1,54 +1,45 @@
1
  <?php $_product = $this->getProduct(); ?>
 
2
  <?php $price = $_product->getFinalPrice(); ?>
3
  <?php $parcial = $this->getParcelamento($price, 'reduzido'); ?>
4
  <?php $integral = $this->getParcelamento($price, 'integral'); ?>
5
  <?php if($parcial): ?>
6
- <div class="price-box">
7
- <div class="parcela-price">
8
- <span class="parcela-label">Parcele até em</span>
9
- <span class="parcela">
10
- <?php echo $this->getParcelamento($price, 'reduzido'); ?>
11
-
12
- </span>
13
- <a href="#" data-target-element="#parcelas_integrais" class="skip-link skip-parcelas_integrais">
14
- ver parcelas
15
- </a>
16
- </div>
17
- </div>
18
  <?php endif ?>
19
  <?php if($integral): ?>
20
- <div id="parcelas_integrais" class="skip-content">
21
- <h3>Cartão de Crédito:</h3>
22
- <div class="grid12-4">
23
- <ul class="product_view_bandeiras hide-below-768">
24
- <li>
25
- <img src="<?php echo $this->getVisaImage(); ?>" id="Moip_Visa" alt="Visa" border="0">
26
- </li>
27
- <li>
28
- <img src="<?php echo $this->getMastercardImage(); ?>" id="Moip_Mastercard" alt="Mastercard" border="0" >
29
- </li>
30
- <li>
31
- <img src="<?php echo $this->getAmericanExpressImage(); ?>" id="Moip_AmericanExpress" alt="AmericanExpress" border="0" >
32
- </li>
33
- <li>
34
- <img src="<?php echo $this->getDinersImage(); ?>" id="Moip_Diners" alt="Diners" border="0" >
35
- </li>
36
- <li>
37
- <img src="<?php echo $this->getHipercardImage(); ?>" id="Moip_Hipercard" alt="Hipercard" border="0" >
38
- </li>
39
- </ul>
40
- </div>
41
- <div class="grid12-8">
42
  <?php $_count = count($integral); ?>
43
- <?php if($_count > 3 ) :?>
44
  <ul id="parcelamento_integral" class="bullet">
45
  <?php foreach ($integral as $key => $value): ?>
46
  <li><?php echo $value; ?></li>
47
  <?php endforeach ?>
48
  </ul>
49
- <?php endif ?>
 
 
50
  </div>
51
 
52
  </div>
53
  <?php endif ?>
54
- <script type="text/javascript">decorateList('parcelamento_integral')</script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php $_product = $this->getProduct(); ?>
2
+ <?php if(!$_product->getIsRecurring()): ?>
3
  <?php $price = $_product->getFinalPrice(); ?>
4
  <?php $parcial = $this->getParcelamento($price, 'reduzido'); ?>
5
  <?php $integral = $this->getParcelamento($price, 'integral'); ?>
6
  <?php if($parcial): ?>
7
+ <div id="parecelas-view" title="Parcelamento no Cartão de Crédito" data-toggle="popover-manual-moip" content-dynamic="popover-parcelas-content" data-placement="left" class="noselect" >em até <?php echo $this->getParcelamento($price, 'reduzido'); ?></div>
8
+
 
 
 
 
 
 
 
 
 
 
9
  <?php endif ?>
10
  <?php if($integral): ?>
11
+
12
+ <div class="popover-parcelas-content hidden" >
13
+ <div class="result-moip-parcelas">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  <?php $_count = count($integral); ?>
15
+ <?php if($_count > 2 ) :?>
16
  <ul id="parcelamento_integral" class="bullet">
17
  <?php foreach ($integral as $key => $value): ?>
18
  <li><?php echo $value; ?></li>
19
  <?php endforeach ?>
20
  </ul>
21
+ <?php else: ?>
22
+ Page com os cartões
23
+ <?php endif; ?>
24
  </div>
25
 
26
  </div>
27
  <?php endif ?>
28
+ <script type="text/javascript">decorateList('parcelamento_integral')
29
+ jQuery('#parecelas-view').popover({
30
+ content: jQuery('.popover-parcelas-content').html(),
31
+ html: true,
32
+ trigger: 'click',
33
+ template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div><div class="popover-footer"><div class="images-moip-parcelas"><ul class="product_view_bandeiras"><li><img src="<?php echo $this->getVisaImage(); ?>" width="34px" height="22px" id="Moip_Visa" alt="Visa" border="0"></li><li><img src="<?php echo $this->getMastercardImage(); ?>" id="Moip_Mastercard" width="34px" height="22px" i alt="Mastercard" border="0" ></li><li><img src="<?php echo $this->getAmericanExpressImage(); ?>" id="Moip_AmericanExpress"width="34px" height="22px" alt="AmericanExpress" border="0" ></li><li><img src="<?php echo $this->getDinersImage(); ?>" width="34px" height="22px" id="Moip_Diners" alt="Diners" border="0" ></li><li><img src="<?php echo $this->getEloImage(); ?>"width="34px" height="22px" id="Moip_Elo" alt="Elo" border="0" ></li><li><img src="<?php echo $this->getHiperImage(); ?>" id="Moip_Hiper" alt="Hiper"width="34px" height="22px" border="0" ></li><li><img src="<?php echo $this->getHipercardImage(); ?>" id="Moip_Hipercard"width="34px" height="22px" alt="Hipercard" border="0" ></li></ul></div></div></div>'
34
+ }).on("click", function () {
35
+ jQuery('#parecelas-view').popover("show");
36
+ jQuery(".popover.fade.left.in").css({"top": "30px"});
37
+ })
38
+ .on("mouseout", function () {
39
+ setTimeout(function () {
40
+ jQuery('#parecelas-view').popover("hide");
41
+ }, 1000);
42
+ });
43
+ </script>
44
+ <?php endif ?>
45
+
app/design/frontend/base/default/template/MOIP/transparente/SuccessDetails.phtml CHANGED
@@ -1,19 +1,47 @@
1
  <?php $_order = $this->getOrder() ?>
 
 
2
 
3
- <div class="col2-set">
4
- <div class="col-1">
5
  <div class="box">
6
-
7
  <div class="box-title">
8
  <h3>Número do Pedido</h3>
9
  </div>
10
  <div class="box-content">
11
  <div class="order-id">#<?php echo $_order->getIncrementId() ?></div>
12
  </div>
13
-
14
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  </div>
16
- <div class="col-2">
17
  <div class="box">
18
 
19
  <div class="box-title">
@@ -25,12 +53,9 @@
25
  <col width="25%" />
26
  <col width="1" />
27
  <col width="1" />
28
- <col width="1" />
29
  <thead>
30
  <tr>
31
  <th><?php echo $this->__('Product Name') ?></th>
32
- <th><?php echo $this->__('SKU') ?></th>
33
- <th class="a-right"><?php echo $this->__('Price') ?></th>
34
  <th class="a-center"><?php echo $this->__('Qty') ?></th>
35
  <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
36
  </tr>
@@ -55,46 +80,12 @@
55
  </div>
56
  </div>
57
  </div>
58
- <?php if($_order->getShippingDescription()): ?>
59
- <div class="col2-set">
60
- <div class="col-1">
61
- <div class="box">
62
-
63
- <div class="box-title">
64
- <h3>Endereço de Entrega</h3>
65
- </div>
66
- <div class="box-content">
67
- <p>
68
-
69
- <?php echo $_order->getShippingAddress()->format('html'); ?>
70
-
71
- </p>
72
- </div>
73
-
74
-
75
- </div>
76
- </div>
77
- <div class="col-2">
78
- <div class="box">
79
-
80
- <div class="box-title">
81
- <h3>Dados de Entrega</h3>
82
- </div>
83
- <div class="box-content">
84
- <p>
85
- Seu pedido será enviado por:
86
- <div> <?php echo $_order->getShippingDescription(); ?></div>
87
- </p>
88
- </div>
89
 
90
 
91
- </div>
92
- </div>
93
- </div>
94
- <?php endif; ?>
95
 
96
 
97
  <div class="goto-home">
98
- <a href="<?php echo Mage::helper('core/url')->getHomeUrl(); ?>" class="button btn-checkout">Voltar para a home</a>
99
  </div>
100
- <?php echo Mage::getStoreConfig("moipall/google/outros_funil"); ?>
1
  <?php $_order = $this->getOrder() ?>
2
+ <div class="container">
3
+ <div class="row">
4
 
5
+ <div class="col-sm-12 col-lg-5 grid12-5">
 
6
  <div class="box">
 
7
  <div class="box-title">
8
  <h3>Número do Pedido</h3>
9
  </div>
10
  <div class="box-content">
11
  <div class="order-id">#<?php echo $_order->getIncrementId() ?></div>
12
  </div>
 
13
  </div>
14
+ <?php if($_order->getShippingDescription()): ?>
15
+ <div class="box">
16
+
17
+ <div class="box-title">
18
+ <h3><?php echo $this->__('Endereço de Entrega') ?></h3>
19
+ </div>
20
+ <div class="box-content">
21
+ <address>
22
+
23
+ <?php echo $_order->getShippingAddress()->format('html'); ?>
24
+
25
+ </address>
26
+ </div>
27
+ </div>
28
+ <div class="box">
29
+
30
+ <div class="box-title">
31
+ <h3><?php echo $this->__('Dados de Entrega') ?></h3>
32
+ </div>
33
+ <div class="box-content">
34
+ <p>
35
+ Seu pedido será enviado por:
36
+ <div> <?php echo $_order->getShippingDescription(); ?></div>
37
+ </p>
38
+ </div>
39
+
40
+
41
+ </div>
42
+ <?php endif; ?>
43
  </div>
44
+ <div class="col-sm-12 col-lg-7 grid12-7">
45
  <div class="box">
46
 
47
  <div class="box-title">
53
  <col width="25%" />
54
  <col width="1" />
55
  <col width="1" />
 
56
  <thead>
57
  <tr>
58
  <th><?php echo $this->__('Product Name') ?></th>
 
 
59
  <th class="a-center"><?php echo $this->__('Qty') ?></th>
60
  <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
61
  </tr>
80
  </div>
81
  </div>
82
  </div>
83
+
84
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
 
 
 
 
 
87
 
88
 
89
  <div class="goto-home">
90
+ <?php echo Mage::getStoreConfig("moipall/google/outros_funil"); ?>
91
  </div>
 
app/design/frontend/base/default/template/MOIP/transparente/boleto.phtml DELETED
@@ -1,38 +0,0 @@
1
- <?php $session = Mage::getSingleton('checkout/session'); ?>
2
- <?php $pgtoArraya = $session->getPgtoarry(); ?>
3
- <?php $result_decode = $session->getResult_decode(); ?>
4
- <?php $token = $result_decode['token']; ?>
5
-
6
- <div class="method-type-payment">
7
- <h3>Quase lá! Agora só falta pagar o boleto.</h3>
8
- </div>
9
- <div class="method-type-action">
10
- <button class="button btn-checkout" data-toggle="modal" data-target="#largeModal" ><span><span><i class="fa fa-print"></i> Imprimir Boleto</span></span></button>
11
-
12
-
13
- </div>
14
-
15
-
16
- <script type="text/javascript">
17
- //<![CDATA[
18
- jQuery(document).ready(function(){
19
- jQuery("#token").val("<?php echo $result_decode['token'] ?>");
20
- var settings =
21
- <?php echo $this->getJson($pgtoArraya); ?>
22
- ;
23
- MoipWidget(settings);
24
-
25
- });
26
- var sucesso = function(data){
27
- jQuery('body').append('<div class="modal fade" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="largeModal" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Boleto Bancário</h4> </div> <div class="modal-body"> <iframe width="800" onload="this.height=screen.height;" scrolling= "no" frameBorder="0" allowtransparency="true" src="<?php echo $this->getUrlAmbiente(); ?>Instrucao.do?token=<?php echo $token ?>"> </iframe> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button> </div> </div> </div> </div>');
28
- jQuery('#largeModal').modal('toggle');
29
- };
30
-
31
- var erroValidacao = function(data){
32
- alert(data);
33
- };
34
- //]]>
35
- </script>
36
-
37
-
38
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/MOIP/transparente/cartao.phtml DELETED
@@ -1,163 +0,0 @@
1
- <?php $session = Mage::getSingleton('checkout/session'); ?>
2
- <?php $pgtoArraya = $session->getPgtoarry(); ?>
3
- <?php $result_decode = $session->getResult_decode(); ?>
4
-
5
-
6
- <div class="method-type-payment">
7
- <h3>Cartão de Crédito</h3>
8
- <div class="loader"/>Por favor, aguarde!<p><img src="<?php echo $this->getSkinUrl('MOIP/transparente/imagem/ajax-loader.gif'); ?>" border="0"></p></div>
9
- </div>
10
- <div class="method-type-action">
11
- <div id="pgcartao">
12
- <div id="statustransparente"></div>
13
- <div id="statustransparenteadd"></div>
14
- <div id="statustransparenteadd2"></div>
15
- </div>
16
-
17
- <!--div class="warning-block" style="display:none">
18
- <h3>O Pagamento não pode ser realizado</h3>
19
- <strong>Erros Apresentados:</strong>
20
- <div class="error-msg"><ul class="erros_transparente"></ul></div>
21
- </div -->
22
- <div style="display: none;" id="loading-mask">
23
- <p id="loading_mask_loader" class="loader"><img alt="Loading..." src="<?php echo $this->getSkinUrl('MOIP/onestepcheckout/images/ajax-loader-tr.gif')?>"><br>Realizando pagamento, por favor aguarde...</p>
24
- </div>
25
- <!-- div class="repeat_cartao" style="display:none;clear:both;">
26
- <div class="title_refaz"><h3>Você poderá refazer o pagamento usando o formulário abaixo</h3></div>
27
- <?php #echo $this->getChildHtml('cartao_form'); ?>
28
- </div -->
29
- </div>
30
-
31
-
32
-
33
- <script type="text/javascript">
34
- //<![CDATA[
35
- var erroValidacao = "";
36
- var sucesso = "";
37
- var sucesso = function(data){
38
- if (data.Status == "Cancelado"){
39
- jQuery(".repeat_cartao").show();
40
- jQuery(".warning-block").css({display:"block"});
41
- jQuery(".loader").css({display:"none"});
42
- jQuery("#statustransparente").html("<h3>Pagamento Cancelado</h3>");
43
- jQuery("#statustransparenteadd").html("Transação não aprovada.");
44
- if(data.hasOwnProperty(data.Classificacao)){
45
- var motivo = JSON.stringify(data.Classificacao.Descricao);
46
- } else{
47
- var motivo = "semretorno";
48
- }
49
- if(motivo == '"Desconhecido"'){
50
- jQuery(".erros_transparente").html("Seus dados estão incorretos ou não podemos envia-los a operadora de crédito.");
51
- }
52
- if(motivo == '"Transação não processada"'){
53
- jQuery(".erros_transparente").html("O pagamento não pode ser processado.</br>Por favor, tente novamente.</br>Caso o erro persista, entre em contato com o nosso atendimento.");
54
- }
55
- if(motivo == '"Política de segurança do Transparente"'){
56
- jQuery(".erros_transparente").html("Pagamento não autorizado.</br>Entre em contato com o seu banco antes de uma nova tentativa.");
57
- }
58
- if(motivo == '"Política de segurança do Banco Emissor"'){
59
- jQuery(".erros_transparente").html("O pagamento não foi autorizado pelo Banco Emissor do seu Cartão.</br>Entre em contato com o Banco para entender o motivo e refazer o pagamento..");
60
- }
61
- if(motivo == '"Cartão vencido"'){
62
- jQuery(".erros_transparente").html("A validade do seu Cartão expirou.</br>Escolha outra forma de pagamento para concluir o pagamento.");
63
- }
64
- if(motivo == '"Dados inválidos"'){
65
- jQuery(".erros_transparente").html("Dados informados inválidos.</br>Você digitou algo errado durante o preenchimento dos dados do seu Cartão.</br>Certifique-se de que está usando o Cartão correto e faça uma nova tentativa.");
66
- }
67
- if(motivo =='semretorno' ){
68
- jQuery(".erros_transparente").html("Verifique os dados e tente pagar novamente.");
69
- }
70
- }
71
- if (data.Status == "EmAnalise"){
72
- jQuery(".loader").css({display:"none"});
73
- jQuery("#pgcartao").css({display:"block"});
74
- jQuery("#statustransparente").css({display:"block"});
75
- jQuery("#statustransparente").html("<h3>Pagamento Aguardando Aprovação</h3>");
76
- jQuery("#statustransparenteadd").html("Por favor, aguarde a análise da transação. Assim que for alterado o status você será informado via e-mail.");
77
- jQuery("#statustransparenteadd2").html("Este Pagamento foi processado por Moip S/A, a equipe de análise de risco poderá entrar em contato para confirmar dados da transação.");
78
-
79
- }
80
- if (data.Status == "Autorizado"){
81
- jQuery(".loader").css({display:"none"});
82
- jQuery("#statustransparente").html("<h3>Pagamento Aprovado</h3>");
83
- jQuery("#statustransparenteadd").html("Por favor, aguarde o processo de envio.");
84
-
85
- }
86
- }
87
- var erroValidacao = function(data) {
88
- jQuery(".repeat_cartao").show();
89
- jQuery(".loading-mask").hide();
90
- jQuery(".loader").css({display:"none"});
91
- jQuery(".warning-block").show();
92
- infosTransparente = '<li class="erro" style="list-style: none;margin-left: 29px;font-weight: bold;">'+data.Mensagem+'</li>';
93
- jQuery(".erros_transparente").html("");
94
- jQuery(".erros_transparente").append(infosTransparente);
95
- var infosTransparente ="";
96
- for (i=0; i<data.length; i++) {
97
- Transparente = data[i];
98
-
99
- for(j in Transparente)
100
- {
101
- atributo = j;
102
- if(atributo == "Mensagem")
103
- {
104
- valor = Transparente[j];
105
- infosTransparente = '<li class="erro" style="list-style: none;margin-left: 29px;font-weight: bold;">'+valor+'</li>';
106
- }
107
- }
108
-
109
- jQuery(".erros_transparente").html("");
110
- jQuery(".erros_transparente").append(infosTransparente);
111
- }
112
- }
113
-
114
- jQuery(document).ready(function(){
115
- var settings = <?php echo $this->getJson($pgtoArraya); ?>;
116
- MoipWidget(settings);
117
- });
118
- /* jQuery("#refazercartao").submit(function(e){
119
- jQuery(".warning-block").hide();
120
- jQuery(".title_refaz").hide();
121
- jQuery("#pgcartao").hide();
122
- jQuery(".loading-mask").show();
123
- var postData = jQuery(this).serializeArray();
124
- var formURL = jQuery(this).attr("action");
125
- jQuery.ajax(
126
- {
127
- url : formURL,
128
- type: "POST",
129
- data : postData,
130
- success:function(data, textStatus, jqXHR)
131
- {
132
- jQuery("#loading-mask").hide();
133
- var settings =
134
- {
135
- "Forma": "CartaoCredito",
136
- "Instituicao": jQuery("#bandeira").val(),
137
- "Parcelas": jQuery("#Parcelas").val(),
138
- "CartaoCredito":
139
- {
140
- "Numero": jQuery("input[name=Numero]").val(),
141
- "Expiracao": jQuery("input[name=Expiracao_mes]").val()+'/'+jQuery("input[name=Expiracao_ano]").val(),
142
- "CodigoSeguranca": jQuery("input[name=CodigoSeguranca]").val(),
143
- "Portador": {
144
- "Nome" : jQuery("input[name=Portador]").val(),
145
- "DataNascimento": jQuery("input[name=DataNascimento]").val(),
146
- "Telefone": jQuery("input[name=Telefone]").val(),
147
- "Identidade": jQuery("input[name=CPF]").val()
148
- }
149
- }
150
- }
151
- sendToCreditCard2(settings);
152
- },
153
-
154
- });
155
- e.preventDefault();
156
- });
157
- function sendToCreditCard2(valores){
158
- var settings = valores
159
- MoipWidget(settings);
160
- jQuery(".loading-mask").hide();
161
- } */
162
- //]]>
163
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/MOIP/transparente/cartoes_my_account.phtml CHANGED
@@ -16,19 +16,19 @@ que nos permite acessa-los quando você for realizar um novo pedido.</p>
16
 
17
  <ul class="form-list-cofre">
18
  <?php foreach ($cofre as $key => $value): ?>
19
- <?php $cardBrand = $value['brand_transparente'] ?>
20
- <?php $cardNunber = $value['cofre'] ?>
21
  <li class="cofre">
22
  <label>
23
  <div class="radio_cofre">
24
  <input id="cartao_remove" class="validate-one-required-by-name" type="radio" name="cofre_remove" title="Cartão de Crédito Salvo" value="<?php echo $cardNunber ?>">
25
  </div>
26
  <div class="image_cofre">
27
- <img src="<?php echo $this->imageCofre($value['brand_transparente']); ?>" alt="<?php echo $value['brand_transparente']; ?>" border="0">
28
  </div>
29
  <div class="cofre_number">
30
- <h4 class="brand_title"><?php echo $value['brand_transparente']; ?> </h4>
31
- <?php echo $value['first6'] ?> ** **** <?php echo $value['last4'] ?>
32
  </div>
33
  </label>
34
  </li>
16
 
17
  <ul class="form-list-cofre">
18
  <?php foreach ($cofre as $key => $value): ?>
19
+ <?php $cardBrand = $value['moip_card_brand'] ?>
20
+ <?php $cardNunber = $value['moip_card_id'] ?>
21
  <li class="cofre">
22
  <label>
23
  <div class="radio_cofre">
24
  <input id="cartao_remove" class="validate-one-required-by-name" type="radio" name="cofre_remove" title="Cartão de Crédito Salvo" value="<?php echo $cardNunber ?>">
25
  </div>
26
  <div class="image_cofre">
27
+ <img src="<?php echo $this->imageCofre($value['moip_card_brand']); ?>" alt="<?php echo $value['moip_card_brand']; ?>" border="0">
28
  </div>
29
  <div class="cofre_number">
30
+ <p class="brand_title"><?php echo $value['moip_card_fullname']; ?> </p>
31
+ <p><?php echo $value['moip_card_first6'] ?> ** **** <?php echo $value['moip_card_last4'] ?></p>
32
  </div>
33
  </label>
34
  </li>
app/design/frontend/base/default/template/MOIP/transparente/checkout/sales/order/items/renderer/default.phtml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_item = $this->getItem() ?>
28
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
29
+ <td>
30
+ <?php $_product = Mage::getModel('catalog/product')->load($_item->getProductId()); ?>
31
+ <img src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail'); ?>" width="45" height="45" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" class="img-thumbnail"/>
32
+
33
+
34
+
35
+ <strong class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></strong>
36
+ <?php if($_options = $this->getItemOptions()): ?>
37
+ <dl class="item-options">
38
+ <?php foreach ($_options as $_option) : ?>
39
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
40
+ <?php if (!$this->getPrintStatus()): ?>
41
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
42
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
43
+ <?php echo $_formatedOptionValue['value'] ?>
44
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
45
+ <div class="truncated_full_value">
46
+ <dl class="item-options">
47
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
48
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
49
+ </dl>
50
+ </div>
51
+ <?php endif; ?>
52
+ </dd>
53
+ <?php else: ?>
54
+ <dd>
55
+ <?php echo nl2br($this->escapeHtml( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) )) ?>
56
+ </dd>
57
+ <?php endif; ?>
58
+ <?php endforeach; ?>
59
+ </dl>
60
+ <?php endif; ?>
61
+ <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
62
+ <?php if ($addtInfoBlock) :?>
63
+ <?php echo $addtInfoBlock->setItem($_item)->toHtml(); ?>
64
+ <?php endif; ?>
65
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
66
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
67
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
68
+ <?php endif; ?>
69
+ </td>
70
+ <td class="a-right">
71
+ <span class="nobr">
72
+ <?php echo $this->getItem()->getQtyOrdered()*1 ?>
73
+ </span>
74
+ </td>
75
+ <td class="a-right">
76
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
77
+ <span class="price-excl-tax">
78
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
79
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
80
+ <span class="cart-price">
81
+ <?php endif; ?>
82
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
83
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
84
+ </span>
85
+ <?php endif; ?>
86
+ <?php endif; ?>
87
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
88
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
89
+ <?php else: ?>
90
+ <span class="cart-price">
91
+ <?php endif; ?>
92
+
93
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
94
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
95
+ <?php else: ?>
96
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
97
+ <?php endif; ?>
98
+
99
+ </span>
100
+
101
+
102
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
103
+
104
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
105
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
106
+ <small>
107
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
108
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
109
+ <?php endforeach; ?>
110
+ </small>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
112
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
113
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></small></span>
114
+ <?php endforeach; ?>
115
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
116
+ <small>
117
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
118
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
119
+ <?php endforeach; ?>
120
+ </small>
121
+ <?php endif; ?>
122
+ </span>
123
+
124
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
125
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
126
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?></span>
127
+ </span>
128
+ <?php endif; ?>
129
+ <?php endif; ?>
130
+ </span>
131
+ <br />
132
+ <?php endif; ?>
133
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
134
+ <span class="price-incl-tax">
135
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
136
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
137
+ <span class="cart-price">
138
+ <?php endif; ?>
139
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
140
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
141
+ </span>
142
+ <?php endif; ?>
143
+ <?php endif; ?>
144
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
145
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
146
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
147
+ <?php else: ?>
148
+ <span class="cart-price">
149
+ <?php endif; ?>
150
+
151
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
152
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
153
+ <?php else: ?>
154
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
155
+ <?php endif; ?>
156
+
157
+ </span>
158
+
159
+
160
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
161
+
162
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
163
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
164
+ <small>
165
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
166
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
167
+ <?php endforeach; ?>
168
+ </small>
169
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
170
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
171
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
172
+ <?php endforeach; ?>
173
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
174
+ <small>
175
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
176
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
177
+ <?php endforeach; ?>
178
+ </small>
179
+ <?php endif; ?>
180
+ </span>
181
+
182
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
183
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
184
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
185
+ </span>
186
+ <?php endif; ?>
187
+ <?php endif; ?>
188
+ </span>
189
+ <?php endif; ?>
190
+ </td>
191
+
192
+
193
+ <!--
194
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
195
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?></th>
196
+ <?php endif; ?>
197
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
198
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($this->getItem())); ?></th>
199
+ <?php endif; ?>
200
+ -->
201
+ </tr>
app/design/frontend/base/default/template/MOIP/transparente/checkout/sales/order/totals.phtml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ /**
27
+ * @var $this Mage_Sales_Block_Order_Totals
28
+ * @see Mage_Sales_Block_Order_Totals
29
+ */
30
+ ?>
31
+ <?php foreach ($this->getTotals() as $_code => $_total): ?>
32
+ <?php if ($_total->getBlockName()): ?>
33
+ <?php echo $this->getChildHtml($_total->getBlockName(), false); ?>
34
+ <?php else:?>
35
+ <tr class="<?php echo $_code?>">
36
+ <td <?php echo $this->getLabelProperties()?>>
37
+ <?php if ($_total->getStrong()):?>
38
+ <strong><?php echo $this->escapeHtml($_total->getLabel());?></strong>
39
+ <?php else:?>
40
+ <?php echo $this->escapeHtml($_total->getLabel());?>
41
+ <?php endif?>
42
+ </td>
43
+ <td <?php echo $this->getValueProperties()?>>
44
+ <?php if ($_total->getStrong()):?>
45
+ <strong><?php echo $this->formatValue($_total) ?></strong>
46
+ <?php else:?>
47
+ <?php echo $this->formatValue($_total) ?>
48
+ <?php endif?>
49
+ </td>
50
+ </tr>
51
+ <?php endif?>
52
+ <?php endforeach?>
app/design/frontend/base/default/template/MOIP/transparente/checkout/success/boleto.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ <?php $boleto = Mage::getSingleton('checkout/session')->getMoipBoletoLink() ?>
4
+
5
+ <?php if($boleto): ?>
6
+
7
+ <?php $url_boleto = $boleto.'/print'; ?>
8
+
9
+ <div class="method-type-payment grid12-12">
10
+ <h3><?php echo $this->__('Quase lá! Agora só falta pagar o boleto.') ?></h3>
11
+ </div>
12
+ <div class="method-type-action grid12-12">
13
+ <div class="grid12-6">
14
+ <h3><?php echo $this->__('Código de Barra') ?></h3>
15
+ <div>
16
+
17
+ <div class="input-box">
18
+ <input type="text" name="codigo-barra" id="bar-code" value="" title="Código de Barra" class="input-text required-entry">
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <div class="grid12-6">
23
+ <h3><?php echo $this->__('Visualizar Boleto') ?></h3>
24
+ <button class="button btn-checkout" data-toggle="modal" data-target="#largeModal" ><span><span><i class="fa fa-print"></i> Visualizar Boleto</span></span></button>
25
+ </div>
26
+
27
+
28
+
29
+ </div>
30
+
31
+ <script type="text/javascript">
32
+ //<![CDATA[
33
+ jQuery('body').append('<div class="modal fade animated" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="largeModal" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Boleto Bancário</h4> </div> <div class="modal-body"> <iframe width="800" onload="this.height=screen.height;" scrolling= "no" frameBorder="0" allowtransparency="true" src="<?php echo $url_boleto ?>"> </iframe> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button> </div> </div> </div> </div>');
34
+ jQuery('#largeModal').modal('toggle');
35
+ //]]>
36
+ </script>
37
+
38
+ <?php endif; ?>
app/design/frontend/base/default/template/MOIP/transparente/checkout/success/success.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+
29
+ <div class="page-title">
30
+ <h1><?php echo $this->__('Your order has been received.') ?></h1>
31
+ </div>
32
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
33
+ <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
34
+
35
+ <?php if ($this->getOrderId()):?>
36
+ <?php if ($this->getCanViewOrder()) :?>
37
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
38
+ <?php else :?>
39
+ <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
40
+ <?php endif;?>
41
+ <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
42
+ <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
43
+ <p>
44
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
45
+ <?php echo $this->getChildHtml() ?>
46
+ </p>
47
+ <?php endif;?>
48
+ <?php endif;?>
49
+
50
+ <?php if ($this->getAgreementRefId()): ?>
51
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
52
+ <?php endif;?>
53
+
54
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
55
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
56
+ <ul class="disc">
57
+ <?php foreach($profiles as $profile):?>
58
+ <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
59
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
60
+ <?php endforeach;?>
61
+ </ul>
62
+ <?php endif;?>
63
+ <?php echo $this->getChildHtml('success_order_boleto'); ?>
64
+ <div class="buttons-set">
65
+ <button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
66
+ </div>
67
+
app/design/frontend/base/default/template/MOIP/transparente/form/boleto.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+
3
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
4
+
5
+ <div class="recommendation">
6
+ <ul class="checkout-info-boleto">
7
+
8
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('O Boleto pode ser pago em qualquer Casa Lotérica ou ainda via Internet Banking') ?></p></li>
9
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Pagamento somente à vista') ?></p></li>
10
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('O boleto vence em %s dias úteis', Mage::getStoreConfig('payment/moip_boleto/vcmentoboleto')) ?>.</p></li>
11
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('É necessário imprimir o boleto ou utilizar o código de barras do mesmo para fazer o pagamento.') ?></p></li>
12
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('Imprima o boleto após a finalização da compra.') ?></p></li>
13
+ <li class="checkout-info-item"><p class="checkout-info-text"><?php echo Mage::helper('transparente')->__('O boleto não será enviado para o seu endereço físico.') ?></p></li>
14
+ </ul>
15
+ </div>
16
+
17
+ </ul>
app/design/frontend/base/default/template/MOIP/transparente/form/cc.phtml ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" class="form-list" style="display:none">
3
+ <?php $cofre = $this->getCofre(); ?>
4
+ <?php if($cofre != "false"): ?>
5
+ <script type="text/javascript">
6
+ $j(document).ready(function(){
7
+ SetCofre();
8
+ });
9
+ </script>
10
+
11
+ <div class="payment-cofre">
12
+ <?php $cofre = Mage::helper('core')->jsonDecode($cofre); ?>
13
+
14
+ <ul id="decore-li-cofre">
15
+ <?php foreach ($cofre as $key => $value): ?>
16
+ <?php $cardBrand = $value['moip_card_brand'] ?>
17
+ <?php $cardNunber = $value['moip_card_id'] ?>
18
+
19
+
20
+
21
+ <li class="cofre">
22
+ <label>
23
+ <div class="radio_cofre">
24
+ <input id="payment_card_cofre" type="radio" title="Selecione o Cartão de Crédito Salvo" class="validate-one-required-by-name"
25
+ name="payment[<?php echo $_code ?>_cofre_nb]" value="<?php echo $cardNunber ?>">
26
+ </div>
27
+ <div class="image_cofre">
28
+ <img src="<?php echo $this->imageCofre($value['moip_card_brand']); ?>" alt="<?php echo $value['moip_card_brand']; ?>" border="0">
29
+ </div>
30
+ <div class="cofre_number">
31
+ <p class="brand_title"><?php echo $value['moip_card_fullname']; ?> </p>
32
+ <p><?php echo $value['moip_card_first6'] ?> ** **** <?php echo $value['moip_card_last4'] ?></p>
33
+ </div>
34
+ </label>
35
+ </li>
36
+
37
+
38
+ <?php endforeach; ?>
39
+ </ul>
40
+ <li class="wide">
41
+ <label for="<?php echo $_code ?>_cofre_id" class="required"><?php echo $this->__('Cod. de Segurança') ?></label>
42
+ <div class="input-box">
43
+
44
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cofre_id]" title="Código de Seguranção do Seu Cartão" class="input-text validate-required required-entry validate-length minimum-length-3 maximum-length-4" id="<?php echo $_code ?>_cofre_id" placeholder="CVV" value="">
45
+
46
+
47
+ </div>
48
+ </li>
49
+ <li class="wide">
50
+ <label for="<?php echo $_code ?>_installment_cofre" class="required"><?php echo $this->__('Parcelas') ?></label>
51
+ <div class="input-box">
52
+ <select name="payment[<?php echo $_code ?>_count_cofre]" id="<?php echo $_code ?>_count_cofre" class="validate-select" title="Número de Parcelas de sua Compra - Cofre" >
53
+ <option value="" select>Selecione as parcelas</option>
54
+ <?php $parcelas = $this->getParcelamentoSelect(); ?>
55
+ <?php foreach ( $parcelas as $key => $value) { ?>
56
+ <?php echo $parcelas[$key]; ?>
57
+ <?php } ?>
58
+ </select>
59
+ </div>
60
+ </li>
61
+ <script type="text/javascript">decorateList('decore-li-cofre')</script>
62
+ </div>
63
+ <?php endif ?>
64
+
65
+ <div class="payment-card">
66
+ <div class="clearer">
67
+ <textarea id="id-chave-publica" class="chave-publica-moip" style="display:none !important;"><?php echo $this->getPublicKey() ?></textarea>
68
+ <input id="encrypted_value" class="encrypted_value input-text required-entry" name="payment[<?php echo $_code ?>_encrypted]" type="hidden" value="" title="Os dados do cartão de crédito são inválidos.">
69
+
70
+ </div>
71
+
72
+ <li class="wide">
73
+ <div class="no-display">
74
+ <input class="<?php echo $_code ?>_type" id="<?php echo $_code ?>_type" type="hidden" name="payment[<?php echo $_code ?>_type]" />
75
+ </div>
76
+ </li>
77
+ <li class="wide">
78
+ <ul id="<?php echo $_code ?>_type">
79
+ <li class="VI">Visa</li>
80
+ <li class="MC">Mastercard</li>
81
+ <li class="AE">American Express</li>
82
+ <li class="DI ">Dinners</li>
83
+ <li class="EO">Elo</li>
84
+ <li class="HI">Hipercard</li>
85
+ <li class="HP">Hipper</li>
86
+ </ul>
87
+ </li>
88
+ <li class="wide">
89
+ <label for="<?php echo $_code ?>_fullname" class="required"><?php echo $this->__('Nome do Impresso Cartão') ?></label>
90
+ <div class="input-box">
91
+ <input type="text" name="payment[<?php echo $_code ?>_owner]" value="" class="input-text required-entry" title="Nome Impresso em seu Cartão" id="credito_portador_nome" placeholder="Nome Impresso no Cartão">
92
+
93
+ </div>
94
+ </li>
95
+ <li class="fields card-number">
96
+ <label for="<?php echo $_code ?>_number" class="required"><?php echo $this->__('Número do Cartão') ?></label>
97
+ <div class="input-box">
98
+ <input type="text" id="<?php echo $_code ?>_number" pattern="\d*" name="payment[<?php echo $_code ?>_number]" title="Número do seu Cartão de Crédito" class="required-entry input-text" placeholder="Número do Cartão" value="">
99
+ </div>
100
+ </li>
101
+
102
+ <li class="fields card-cvv">
103
+ <label for="<?php echo $_code ?>_cid" class="required"><?php echo $this->__('Cod. de Segurança') ?></label>
104
+ <div class="input-box">
105
+ <div class="v-fix">
106
+ <input type="text" pattern="\d*" name="payment[<?php echo $_code ?>_cid]" title="Código de Seguranção do Seu Cartão" class="input-text cvv validate-length minimum-length-3 maximum-length-4 required-entry" id="<?php echo $_code ?>_cid" placeholder="CVV" value=""><a href="#" class="cvv-what-is-this">?</a>
107
+ </div>
108
+
109
+ </div>
110
+ </li>
111
+
112
+ <li class="wide">
113
+ <label for="<?php echo $_code ?>_expiration" class="required"><?php echo $this->__('Expiração') ?></label>
114
+ <div class="input-box">
115
+ <div class="v-fix">
116
+ <select name="payment[<?php echo $_code ?>_exp_month]" id="credito_expiracao_mes" class="validate-select" title="Mês de Vencimento do seu Cartão">
117
+ <option value="">Mês</option>
118
+ <option value="01">01 - Janeiro</option>
119
+ <option value="02">02 - Fevereiro</option>
120
+ <option value="03">03 - Março</option>
121
+ <option value="04">04 - Abril</option>
122
+ <option value="05">05 - Maio</option>
123
+ <option value="06">06 - Junho</option>
124
+ <option value="07">07 - Julho</option>
125
+ <option value="08">08 - Agosto</option>
126
+ <option value="09">09 - Setembro</option>
127
+ <option value="10">10 - Outubro</option>
128
+ <option value="11">11 - Novembro</option>
129
+ <option value="12">12 - Dezembro</option>
130
+ </select>
131
+ </div>
132
+ <div class="v-fix">
133
+ <select name="payment[<?php echo $_code ?>_exp_year]" id="credito_expiracao_ano" class="validate-select" title="Ano de Vencimento do seu Cartão">
134
+ <option value="">Ano</option>
135
+
136
+
137
+ <option value="2016">16</option>
138
+ <option value="2017">17</option>
139
+ <option value="2018">18</option>
140
+ <option value="2019">19</option>
141
+ <option value="2020">20</option>
142
+ <option value="2021">21</option>
143
+ <option value="2022">22</option>
144
+ <option value="2023">23</option>
145
+ <option value="2024">24</option>
146
+ <option value="2025">25</option>
147
+ <option value="2026">26</option>
148
+ <option value="2027">27</option>
149
+ <option value="2028">28</option>
150
+ <option value="2029">29</option>
151
+ <option value="2030">30</option>
152
+ <option value="2031">31</option>
153
+ </select>
154
+ </div>
155
+ </div>
156
+ </li>
157
+ <li class="wide">
158
+ <label for="<?php echo $_code ?>_installment_count" class="required"><?php echo $this->__('Parcelas') ?></label>
159
+ <div class="input-box">
160
+
161
+ <select name="payment[<?php echo $_code ?>_installment_count]" id="credito_parcelamento" class="required-entry validate-select" title="Número de Parcelas de sua Compra">
162
+ <option select value="">Selecione as parcelas</option>
163
+ <?php $parcelas = $this->getParcelamentoSelect(); ?>
164
+
165
+ <?php foreach ( $parcelas as $key => $value) { ?>
166
+ <?php echo $parcelas[$key]; ?>
167
+ <?php } ?>
168
+ </select>
169
+ </div>
170
+ </li>
171
+ <li class="wide">
172
+ <label><input type="checkbox" name="payment[<?php echo $_code ?>_personal_info]" id="personal-card-info-control" title="Você é o Titular do Cartão" value="0" class=" validate-number input-checkbox" checked>Sou o Titular do Cartão</label>
173
+ </li>
174
+
175
+ <li class="wide personal-card-info no-display">
176
+ <label for="<?php echo $_code ?>_taxDocument" class="required"><?php echo $this->__('CPF do Titular do Cartão') ?></label>
177
+ <div class="input-box">
178
+ <input type="text" name="payment[<?php echo $_code ?>_taxdocument]" value="<?php echo $this->getDateCard('taxvat') ?>" class="input-text required-entry" title="CPF do Titular de seu Cartão" id="credito_portador_cpf" placeholder="CPF do Titular do Cartão" >
179
+ </div>
180
+ </li>
181
+
182
+
183
+
184
+ <li class="wide">
185
+ <label>
186
+ <input type="checkbox" name="payment[<?php echo $_code ?>_save_card]" title="Salvar Cartão Para Próximas Compras?" value="" class=" validate-number input-checkbox save-card" > Salvar Cartão</label>
187
+ </li>
188
+
189
+
190
+ </div>
191
+
192
+
193
+ <?php if($cofre != "false"): ?>
194
+ <div class="clearer">
195
+ <li class="wide">
196
+ <label>
197
+ <input type="checkbox" name="payment[<?php echo $_code ?>_payment_in_cofre]" title="Usar um novo cartão?" value="0" class="new-card validate-number input-checkbox"> Usar outro Cartão não listado?
198
+ </label>
199
+ </li>
200
+ </div>
201
+ <?php else: ?>
202
+
203
+ <input type="hidden" name="payment[<?php echo $_code ?>_payment_in_cofre]" title="Usar um novo cartão?" value="1" class="new-card validate-number input-checkbox">
204
+ <?php endif; ?>
205
+ </ul>
206
+ <script type="text/javascript">
207
+ //<![CDATA[
208
+
209
+ jQuery(document).ready(function(){
210
+ MoipPagamentosCc();
211
+ });
212
+
213
+ //]]>
214
+ </script>
app/design/frontend/base/default/template/MOIP/transparente/form/recurring.phtml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+
4
+
5
+ <div class="payment-card">
6
+ <div class="clearer">
7
+ <textarea id="id-chave-publica" class="chave-publica-moip" style="display:none !important;"><?php echo $this->getPublicKey() ?></textarea>
8
+
9
+
10
+ </div>
11
+
12
+ <li>
13
+ <div class="no-display">
14
+ <input class="<?php echo $_code ?>_type" id="<?php echo $_code ?>_type" type="hidden" name="payment[<?php echo $_code ?>_type]" />
15
+ </div>
16
+ </li>
17
+ <li class="wide">
18
+ <ul id="<?php echo $_code ?>_type">
19
+ <li class="VI">Visa</li>
20
+ <li class="MC">Mastercard</li>
21
+ <li class="AE">American Express</li>
22
+ <li class="DI ">Dinners</li>
23
+ <li class="EO">Elo</li>
24
+
25
+ </ul>
26
+ </li>
27
+
28
+ <li class="fields card-number">
29
+ <label for="<?php echo $_code ?>_number" class="required"><em>*</em><?php echo $this->__('Número do Cartão') ?></label>
30
+ <div class="input-box">
31
+ <input type="text" id="<?php echo $_code ?>_number" pattern="\d*" value="4747474747474747" name="payment[<?php echo $_code ?>_number]" title="Número do seu Cartão de Crédito" class="required-entry input-text" placeholder="Número do Cartão" value="">
32
+ </div>
33
+ </li>
34
+
35
+
36
+ <li class="wide">
37
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiração') ?></label>
38
+ <div class="input-box">
39
+ <div class="v-fix">
40
+ <select name="payment[<?php echo $_code ?>_exp_month]" id="credito_expiracao_mes" class="validate-select" title="Mês de Vencimento do seu Cartão">
41
+ <option value="">Mês</option>
42
+ <option value="01">01 - Janeiro</option>
43
+ <option value="02">02 - Fevereiro</option>
44
+ <option value="03">03 - Março</option>
45
+ <option value="04">04 - Abril</option>
46
+ <option value="05">05 - Maio</option>
47
+ <option value="06">06 - Junho</option>
48
+ <option value="07">07 - Julho</option>
49
+ <option value="08">08 - Agosto</option>
50
+ <option value="09">09 - Setembro</option>
51
+ <option value="10" selected="select">10 - Outubro</option>
52
+ <option value="11">11 - Novembro</option>
53
+ <option value="12">12 - Dezembro</option>
54
+ </select>
55
+ </div>
56
+ <div class="v-fix">
57
+ <select name="payment[<?php echo $_code ?>_exp_year]" id="credito_expiracao_ano" class="validate-select" title="Ano de Vencimento do seu Cartão">
58
+ <option value="">Ano</option>
59
+
60
+ <option value="15">15</option>
61
+ <option value="16">16</option>
62
+ <option value="17">17</option>
63
+ <option value="18">18</option>
64
+ <option value="19">19</option>
65
+ <option value="20" selected="select">20</option>
66
+ <option value="21">21</option>
67
+ <option value="22">22</option>
68
+ <option value="23">23</option>
69
+ <option value="24">24</option>
70
+ <option value="25">25</option>
71
+ <option value="26">26</option>
72
+ <option value="27">27</option>
73
+ <option value="28">28</option>
74
+ <option value="29">29</option>
75
+ <option value="30">30</option>
76
+ </select>
77
+ </div>
78
+ </div>
79
+ </li>
80
+
81
+ <li class="wide ">
82
+ <label for="<?php echo $_code ?>_fullname" class="required"><em>*</em><?php echo $this->__('Nome do Titular Cartão') ?></label>
83
+ <div class="input-box">
84
+ <input type="text" name="payment[<?php echo $_code ?>_owner]" value="<?php echo $this->getDateCard('name') ?>" class="input-text required-entry" title="Nome Impresso em seu Cartão" id="credito_portador_nome" placeholder="Nome Impresso no Cartão">
85
+ </div>
86
+ </li>
87
+
88
+
89
+
90
+
91
+ </div>
92
+
93
+
94
+
95
+ </ul>
96
+ <script type="text/javascript">
97
+ //<![CDATA[
98
+
99
+ $j(document).ready(function(){
100
+ MoipPagamentosRecurring();
101
+ });
102
+
103
+ //]]>
104
+ </script>
app/design/frontend/base/default/template/MOIP/transparente/form/tef.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+ <div class="recommendation">
4
+ <ul class="checkout-info-boleto">
5
+ <li class="checkout-info-item"><p class="checkout-info-text">É Obrigatório ter o TOKEN do banco em mãos.</p></li>
6
+ <li class="checkout-info-item"><p class="checkout-info-text">Pagamento somente à vista.</p></li>
7
+ </ul>
8
+ </div>
9
+ <ul>
10
+ <li>
11
+ <label for="<?php echo $_code ?>_banknumber" class="required"><em>*</em><?php echo $this->__('Banco para Transferência On-line') ?></label>
12
+ <div class="input-box">
13
+ <select name="payment[<?php echo $_code ?>_banknumber]" class="input-box required-entry validate-select" id="bamk-of-tef" title="Selecionar Banco Para Transferência">
14
+ <option value="" select>Selecione o seu banco.</option>
15
+ <!-- <option value="001">Banco do Brasil</option>
16
+ <option value="237">Brandesco</option> -->
17
+ <option value="341">Itaú</option>
18
+ <!-- <option value="041">Banrisul</option> -->
19
+ </select>
20
+ </div>
21
+ </li>
22
+ </ul>
23
+
24
+ </ul>
app/design/frontend/base/default/template/MOIP/transparente/horizontal_form.phtml CHANGED
@@ -1,138 +1,140 @@
1
- <?php $cofre = $this->getCofre(); ?>
2
- <?php $nome ="" ?>
3
- <?php $telefone ="" ?>
4
- <?php $cpf ="" ?>
5
- <?php $dn ="" ?>
6
- <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('MOIP/transparente/css/horizontal_form.css'); ?>"media="all">
7
- <script type="text/javascript" src="<?php echo $this->getJsUrl('MOIP/transparente/checkout.js') ?>"></script>
8
- <fieldset class="form-list">
9
- <div id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
10
- <input type="hidden" value="CartaoCredito" id="forma_pagamento_moip" name="payment[forma_pagamento]" title="Selecione Meio de Pagamento">
11
- <ul class="nav nav-tabs nav-justified" id="moipPagamentos">
12
  <?php if($this->mostraCartao()): ?>
13
- <li><a href="#CartaoCredito"><img alt="Cartão de Crédito" src="<?php echo $this->getCartaoIcon(); ?>"></a></li>
14
  <?php endif; ?>
15
  <?php if($this->mostraBoleto()): ?>
16
- <li><a href="#BoletoBancario"><img alt="Boleto Bancário" src="<?php echo $this->getBoletoIcon(); ?>"></a></li>
17
  <?php endif; ?>
18
  <?php if($this->mostraTransferencia()): ?>
19
- <li><a href="#DebitoBancario"><img alt="Transferência Bancária" id="imageboleto" src="<?php echo $this->getTransferenciaIcon(); ?>"></a></li>
20
  <?php endif; ?>
21
  </ul>
22
 
23
  <div class="tab-content">
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
3
+
4
+ <ul class="nav nav-tabs nav-pills" id="moipPagamentos">
 
 
 
 
 
 
 
5
  <?php if($this->mostraCartao()): ?>
6
+ <li><a href="#CartaoCredito"><span class="icon-tab-moip"><img alt="Cartão de Crédito" src="<?php echo $this->getCartaoIcon(); ?>"></span> Cartão</a></li>
7
  <?php endif; ?>
8
  <?php if($this->mostraBoleto()): ?>
9
+ <li><a href="#BoletoBancario"><span class="icon-tab-moip"><img alt="Boleto Bancário" src="<?php echo $this->getBoletoIcon(); ?>"></span> Boleto</a></li>
10
  <?php endif; ?>
11
  <?php if($this->mostraTransferencia()): ?>
12
+ <li><a href="#DebitoBancario"><span class="icon-tab-moip"><img alt="Transferência Bancária" id="imageboleto" src="<?php echo $this->getTransferenciaIcon(); ?>"></span> Transf.</a></li>
13
  <?php endif; ?>
14
  </ul>
15
 
16
  <div class="tab-content">
17
+ <input type="hidden" value="CartaoCredito" id="forma_pagamento_moip" name="payment[<?php echo $_code ?>_forma_pagamento]" title="Selecione Meio de Pagamento">
18
+ <div class="tab-pane" id="CartaoCredito" style="display:none;">
19
+ <li>
20
+
21
+ <div class="no-display">
22
+ <input class="<?php echo $_code ?>_cc_type" id="<?php echo $_code ?>_cc_type" type="hidden" name="payment[<?php echo $_code ?>_cc_type]" />
23
+ </div>
24
+ </li>
25
+
26
+ <li class="fields card-number">
27
+ <label for="<?php echo $_co