MercadoPagoTransparent - Version 2.2.0

Version Notes

- Fix issue with multiple notifications
- Fix issue with approved tickets notifications
- Change logic for shipments calculation
- Add option include/exclude financing cost from the orders
- Fix other minor issues

Download this release

Release Info

Developer MercadoPago
Extension MercadoPagoTransparent
Version 2.2.0
Comparing to
See all releases


Code changes from version 0.0.4 to 2.2.0

Files changed (116) hide show
  1. app/code/community/MercadoPago/Core/Block/AbstractForm.php +0 -0
  2. app/code/community/MercadoPago/Core/Block/AbstractSuccess.php +0 -0
  3. app/code/community/MercadoPago/Core/Block/Adminhtml/System/Config/Fieldset/Payment.php +3 -2
  4. app/code/community/MercadoPago/Core/Block/Custom/Form.php +0 -0
  5. app/code/community/MercadoPago/Core/Block/Custom/Info.php +0 -0
  6. app/code/community/MercadoPago/Core/Block/Custom/Success.php +0 -0
  7. app/code/community/MercadoPago/Core/Block/Customticket/Form.php +0 -0
  8. app/code/community/MercadoPago/Core/Block/Customticket/Info.php +0 -0
  9. app/code/community/MercadoPago/Core/Block/Customticket/Success.php +0 -0
  10. app/code/community/MercadoPago/Core/Block/Discount.php +0 -0
  11. app/code/community/MercadoPago/Core/Block/Sales/Order/Totals/Discount/Coupon.php +0 -0
  12. app/code/community/MercadoPago/Core/Block/Sales/Order/Totals/Finance/Cost.php +0 -0
  13. app/code/community/MercadoPago/Core/Block/Standard/Form.php +0 -0
  14. app/code/community/MercadoPago/Core/Block/Standard/Info.php +0 -0
  15. app/code/community/MercadoPago/Core/Block/Standard/Pay.php +0 -0
  16. app/code/community/MercadoPago/Core/Block/Standard/Success.php +0 -0
  17. app/code/community/MercadoPago/Core/Helper/Data.php +90 -27
  18. app/code/community/MercadoPago/Core/Helper/Message/Abstract.php +0 -0
  19. app/code/community/MercadoPago/Core/Helper/Response.php +0 -0
  20. app/code/community/MercadoPago/Core/Helper/StatusDetailMessage.php +0 -0
  21. app/code/community/MercadoPago/Core/Helper/StatusMessage.php +0 -0
  22. app/code/community/MercadoPago/Core/Helper/StatusOrderMessage.php +0 -0
  23. app/code/community/MercadoPago/Core/Model/Api/Exception.php +0 -0
  24. app/code/community/MercadoPago/Core/Model/Api/V0/Exception.php +0 -0
  25. app/code/community/MercadoPago/Core/Model/Api/V1/Exception.php +0 -0
  26. app/code/community/MercadoPago/Core/Model/Core.php +211 -184
  27. app/code/community/MercadoPago/Core/Model/Custom/Finance/Cost.php +0 -0
  28. app/code/community/MercadoPago/Core/Model/Custom/Finance/Cost/Creditmemo.php +0 -0
  29. app/code/community/MercadoPago/Core/Model/Custom/Finance/Cost/Invoice.php +0 -0
  30. app/code/community/MercadoPago/Core/Model/Custom/Payment.php +11 -17
  31. app/code/community/MercadoPago/Core/Model/CustomPayment.php +6 -0
  32. app/code/community/MercadoPago/Core/Model/CustomTicket/Payment.php +12 -27
  33. app/code/community/MercadoPago/Core/Model/Discount/Coupon.php +0 -0
  34. app/code/community/MercadoPago/Core/Model/Discount/Coupon/Creditmemo.php +0 -0
  35. app/code/community/MercadoPago/Core/Model/Discount/Coupon/Invoice.php +0 -0
  36. app/code/community/MercadoPago/Core/Model/Observer.php +39 -34
  37. app/code/community/MercadoPago/Core/Model/Source/CategoryId.php +0 -0
  38. app/code/community/MercadoPago/Core/Model/Source/Country.php +0 -0
  39. app/code/community/MercadoPago/Core/Model/Source/Installments.php +0 -0
  40. app/code/community/MercadoPago/Core/Model/Source/Order/Status.php +0 -0
  41. app/code/community/MercadoPago/Core/Model/Source/PaymentMethods.php +10 -8
  42. app/code/community/MercadoPago/Core/Model/Source/TypeCheckout.php +0 -0
  43. app/code/community/MercadoPago/Core/Model/Standard/Payment.php +45 -51
  44. app/code/community/MercadoPago/Core/controllers/ApiController.php +0 -0
  45. app/code/community/MercadoPago/Core/controllers/NotificationsController.php +154 -55
  46. app/code/community/MercadoPago/Core/controllers/PayController.php +0 -0
  47. app/code/community/MercadoPago/Core/controllers/SuccessController.php +10 -1
  48. app/code/community/MercadoPago/Core/etc/config.xml +3 -4
  49. app/code/community/MercadoPago/Core/etc/system.xml +17 -1
  50. app/code/community/MercadoPago/Core/sql/mercadopago_setup/install-2.1.0.php +0 -0
  51. app/code/community/MercadoPago/Core/sql/mercadopago_setup/upgrade-2.1.0-2.1.1.php +0 -0
  52. app/code/community/MercadoPago/Core/sql/mercadopago_setup/upgrade-2.1.1-2.1.2.php +0 -0
  53. app/code/community/MercadoPago/MercadoEnvios/Block/Adminhtml/System/Config/Fieldset/Carrier.php +0 -0
  54. app/code/community/MercadoPago/MercadoEnvios/Block/Adminhtml/System/Config/Fieldset/Mapping.php +0 -0
  55. app/code/community/MercadoPago/MercadoEnvios/Helper/CarrierData.php +120 -0
  56. app/code/community/MercadoPago/MercadoEnvios/Helper/Data.php +48 -85
  57. app/code/community/MercadoPago/MercadoEnvios/Helper/ItemData.php +0 -0
  58. app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Attribute/Validation/Mapping.php +0 -0
  59. app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Source/Shipping/FreeMethod.php +0 -0
  60. app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Source/Shipping/Method.php +9 -0
  61. app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Source/Shipping/Print/Mode.php +11 -0
  62. app/code/community/MercadoPago/MercadoEnvios/Model/Observer.php +26 -1
  63. app/code/community/MercadoPago/MercadoEnvios/Model/Shipping/Carrier/MercadoEnvios.php +20 -7
  64. app/code/community/MercadoPago/MercadoEnvios/etc/config.xml +13 -1
  65. app/code/community/MercadoPago/MercadoEnvios/etc/system.xml +9 -0
  66. app/code/community/MercadoPago/OneStepCheckout/Block/Custom/Form.php +0 -1
  67. app/code/community/MercadoPago/OneStepCheckout/Block/Customticket/Form.php +0 -0
  68. app/code/community/MercadoPago/OneStepCheckout/Helper/Data.php +0 -0
  69. app/code/community/MercadoPago/OneStepCheckout/Model/Observer.php +0 -0
  70. app/code/community/MercadoPago/OneStepCheckout/etc/config.xml +1 -1
  71. app/code/community/MercadoPago/OneStepCheckout/etc/system.xml +0 -0
  72. app/design/adminhtml/default/default/layout/mercadopago.xml +0 -0
  73. app/design/adminhtml/default/default/template/mercadopago/array_dropdown.phtml +0 -0
  74. app/design/adminhtml/default/default/template/mercadopago/custom/info.phtml +0 -0
  75. app/design/adminhtml/default/default/template/mercadopago/custom_ticket/info.phtml +0 -0
  76. app/design/adminhtml/default/default/template/mercadopago/standard/info.phtml +0 -0
  77. app/design/frontend/base/default/layout/mercadopago.xml +0 -0
  78. app/design/frontend/base/default/template/mercadopago/clean.phtml +0 -0
  79. app/design/frontend/base/default/template/mercadopago/custom/form.phtml +2 -3
  80. app/design/frontend/base/default/template/mercadopago/custom/info.phtml +0 -0
  81. app/design/frontend/base/default/template/mercadopago/custom/success.phtml +0 -0
  82. app/design/frontend/base/default/template/mercadopago/custom_ticket/form.phtml +0 -0
  83. app/design/frontend/base/default/template/mercadopago/custom_ticket/info.phtml +0 -0
  84. app/design/frontend/base/default/template/mercadopago/custom_ticket/success.phtml +0 -0
  85. app/design/frontend/base/default/template/mercadopago/discount.phtml +0 -0
  86. app/design/frontend/base/default/template/mercadopago/onestepcheckout/custom/form.phtml +1 -2
  87. app/design/frontend/base/default/template/mercadopago/standard/form.phtml +0 -0
  88. app/design/frontend/base/default/template/mercadopago/standard/info.phtml +0 -0
  89. app/design/frontend/base/default/template/mercadopago/standard/pay.phtml +0 -0
  90. app/design/frontend/base/default/template/mercadopago/standard/success.phtml +0 -0
  91. app/etc/modules/MercadoPago_Core.xml +0 -9
  92. app/etc/modules/MercadoPago_MercadoEnvios.xml +0 -12
  93. app/etc/modules/MercadoPago_OneStepCheckout.xml +0 -12
  94. app/locale/en_US/MercadoPago_Core.csv +13 -1
  95. app/locale/es_AR/MercadoPago_Core.csv +13 -1
  96. app/locale/es_CL/MercadoPago_Core.csv +13 -1
  97. app/locale/es_CO/MercadoPago_Core.csv +13 -1
  98. app/locale/es_ES/MercadoPago_Core.csv +13 -1
  99. app/locale/es_MX/MercadoPago_Core.csv +13 -1
  100. app/locale/es_VE/MercadoPago_Core.csv +13 -1
  101. app/locale/pt_BR/MercadoPago_Core.csv +12 -1
  102. js/mercadopago/jquery-1.11.0.min.js +0 -0
  103. js/mercadopago/mercadopago.js +54 -59
  104. js/mercadopago/mercadopago_osc.js +60 -63
  105. js/mercadopago/tiny.min.js +0 -0
  106. js/mercadopago/tinyJ.js +0 -0
  107. lib/MercadoPago/Lib/Api.php +0 -0
  108. lib/MercadoPago/Lib/RestClient.php +0 -0
  109. package.xml +165 -58
  110. skin/adminhtml/default/default/mercadopago/images/cards.jpg +0 -0
  111. skin/adminhtml/default/default/mercadopago/images/logo.png +0 -0
  112. skin/adminhtml/default/default/mercadopago/images/mercadoenvios.png +0 -0
  113. skin/adminhtml/default/default/mercadopago/styles.css +0 -0
  114. skin/frontend/base/default/mercadopago/css/style-success.css +0 -0
  115. skin/frontend/base/default/mercadopago/css/style.css +0 -0
  116. skin/frontend/base/default/mercadopago/images/loading.gif +0 -0
app/code/community/MercadoPago/Core/Block/AbstractForm.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/AbstractSuccess.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Adminhtml/System/Config/Fieldset/Payment.php CHANGED
@@ -13,8 +13,9 @@ class MercadoPago_Core_Block_Adminhtml_System_Config_Fieldset_Payment
13
  */
14
  protected function _getHeaderTitleHtml($element)
15
  {
16
- $configData = $this->getData('config_data');
17
- $imageUrl = $configData['payment/mercadopago_standard/banner_checkout'];
 
18
 
19
  $html = '<div class="config-heading meli" ><div class="heading"><strong id="meli-logo">' . $element->getLegend();
20
  $html .= '</strong></div>';
13
  */
14
  protected function _getHeaderTitleHtml($element)
15
  {
16
+ $website = Mage::helper('mercadopago')->getAdminSelectedWebsite();
17
+
18
+ $imageUrl = $website->getConfig('payment/mercadopago_standard/banner_checkout');
19
 
20
  $html = '<div class="config-heading meli" ><div class="heading"><strong id="meli-logo">' . $element->getLegend();
21
  $html .= '</strong></div>';
app/code/community/MercadoPago/Core/Block/Custom/Form.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Custom/Info.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Custom/Success.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Customticket/Form.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Customticket/Info.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Customticket/Success.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Discount.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Sales/Order/Totals/Discount/Coupon.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Sales/Order/Totals/Finance/Cost.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Standard/Form.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Standard/Info.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Standard/Pay.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Block/Standard/Success.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Helper/Data.php CHANGED
@@ -27,6 +27,11 @@ class MercadoPago_Core_Helper_Data
27
  const PLATFORM_DESKTOP = 'Desktop';
28
  const TYPE = 'magento';
29
 
 
 
 
 
 
30
  public function log($message, $file = "mercadopago.log", $array = null)
31
  {
32
  $actionLog = Mage::getStoreConfig('payment/mercadopago/logs');
@@ -40,27 +45,45 @@ class MercadoPago_Core_Helper_Data
40
  }
41
  }
42
 
43
- public function getApiInstance()
44
  {
45
- $params = func_num_args();
46
- if ($params > 2 || $params < 1) {
47
- Mage::throwException("Invalid arguments. Use CLIENT_ID and CLIENT SECRET, or ACCESS_TOKEN");
48
- }
49
- if ($params == 1) {
50
- $api = new MercadoPago_Lib_Api(func_get_arg(0));
51
- $api->set_platform(self::PLATFORM_V1_WHITELABEL);
52
- } else {
53
- $api = new MercadoPago_Lib_Api(func_get_arg(0), func_get_arg(1));
54
- $api->set_platform(self::PLATFORM_DESKTOP);
55
- }
56
- if (Mage::getStoreConfigFlag('payment/mercadopago_standard/sandbox_mode')) {
57
- $api->sandbox_mode(true);
58
  }
 
59
 
60
- $api->set_type(self::TYPE . ' ' . (string) Mage::getConfig()->getModuleConfig("MercadoPago_Core")->version);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
- return $api;
63
 
 
 
 
 
64
  }
65
 
66
  public function isValidAccessToken($accessToken)
@@ -160,12 +183,12 @@ class MercadoPago_Core_Helper_Data
160
 
161
  public function setOrderSubtotals($data, $order)
162
  {
163
- if (isset($data['total_paid_amount'])){
164
- $balance = $this->_getMultiCardValue($data['total_paid_amount']);
165
  } else {
166
  $balance = $data['transaction_details']['total_paid_amount'];
167
  }
168
- $shippingCost = $this->_getMultiCardValue($data['shipping_cost']);
169
 
170
  $order->setGrandTotal($balance);
171
  $order->setBaseGrandTotal($balance);
@@ -174,8 +197,8 @@ class MercadoPago_Core_Helper_Data
174
  $order->setShippingAmount($shippingCost);
175
  }
176
 
177
- $couponAmount = $this->_getMultiCardValue($data['coupon_amount']);
178
- $transactionAmount = $this->_getMultiCardValue($data['transaction_amount']);
179
 
180
  if ($couponAmount) {
181
  $order->setDiscountCouponAmount($couponAmount * -1);
@@ -185,7 +208,7 @@ class MercadoPago_Core_Helper_Data
185
  $balance = $balance - $transactionAmount - $shippingCost;
186
  }
187
 
188
- if (Zend_Locale_Math::round($balance,4) > 0) {
189
  $order->setFinanceCostAmount($balance);
190
  $order->setBaseFinanceCostAmount($balance);
191
  }
@@ -207,15 +230,55 @@ class MercadoPago_Core_Helper_Data
207
  return $payment;
208
  }
209
 
210
- protected function _getMultiCardValue($fullValue) {
 
211
  $finalValue = 0;
212
- $values = explode('|', $fullValue);
213
- foreach ($values as $value) {
214
- $value = (float) str_replace(' ', '', $value);
215
- $finalValue = $finalValue + $value;
 
 
 
 
 
 
216
  }
217
 
218
  return $finalValue;
219
  }
220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
27
  const PLATFORM_DESKTOP = 'Desktop';
28
  const TYPE = 'magento';
29
 
30
+ protected $_statusUpdatedFlag = false;
31
+ protected $_apiInstance;
32
+
33
+ protected $_website;
34
+
35
  public function log($message, $file = "mercadopago.log", $array = null)
36
  {
37
  $actionLog = Mage::getStoreConfig('payment/mercadopago/logs');
45
  }
46
  }
47
 
48
+ public function isStatusUpdated()
49
  {
50
+ return $this->_statusUpdatedFlag;
51
+ }
52
+
53
+ public function setStatusUpdated($notificationData)
54
+ {
55
+ $order = Mage::getModel('sales/order')->loadByIncrementId($notificationData["external_reference"]);
56
+ $status = $notificationData['status'];
57
+ $currentStatus = $order->getPayment()->getAdditionalInformation('status');
58
+ if ($status == $currentStatus && $order->getState() === Mage_Sales_Model_Order::STATE_COMPLETE) {
59
+ $this->_statusUpdatedFlag = true;
 
 
 
60
  }
61
+ }
62
 
63
+ public function getApiInstance()
64
+ {
65
+ if (empty($this->_apiInstance)) {
66
+ $params = func_num_args();
67
+ if ($params > 2 || $params < 1) {
68
+ Mage::throwException("Invalid arguments. Use CLIENT_ID and CLIENT SECRET, or ACCESS_TOKEN");
69
+ }
70
+ if ($params == 1) {
71
+ $api = new MercadoPago_Lib_Api(func_get_arg(0));
72
+ $api->set_platform(self::PLATFORM_V1_WHITELABEL);
73
+ } else {
74
+ $api = new MercadoPago_Lib_Api(func_get_arg(0), func_get_arg(1));
75
+ $api->set_platform(self::PLATFORM_DESKTOP);
76
+ }
77
+ if (Mage::getStoreConfigFlag('payment/mercadopago_standard/sandbox_mode')) {
78
+ $api->sandbox_mode(true);
79
+ }
80
 
81
+ $api->set_type(self::TYPE . ' ' . (string)Mage::getConfig()->getModuleConfig("MercadoPago_Core")->version);
82
 
83
+ $this->_apiInstance = $api;
84
+ }
85
+
86
+ return $this->_apiInstance;
87
  }
88
 
89
  public function isValidAccessToken($accessToken)
183
 
184
  public function setOrderSubtotals($data, $order)
185
  {
186
+ if (isset($data['total_paid_amount'])) {
187
+ $balance = $this->_getMultiCardValue($data, 'total_paid_amount');
188
  } else {
189
  $balance = $data['transaction_details']['total_paid_amount'];
190
  }
191
+ $shippingCost = $this->_getMultiCardValue($data, 'shipping_cost');
192
 
193
  $order->setGrandTotal($balance);
194
  $order->setBaseGrandTotal($balance);
197
  $order->setShippingAmount($shippingCost);
198
  }
199
 
200
+ $couponAmount = $this->_getMultiCardValue($data, 'coupon_amount');
201
+ $transactionAmount = $this->_getMultiCardValue($data, 'transaction_amount');
202
 
203
  if ($couponAmount) {
204
  $order->setDiscountCouponAmount($couponAmount * -1);
208
  $balance = $balance - $transactionAmount - $shippingCost;
209
  }
210
 
211
+ if (Zend_Locale_Math::round($balance, 4) > 0) {
212
  $order->setFinanceCostAmount($balance);
213
  $order->setBaseFinanceCostAmount($balance);
214
  }
230
  return $payment;
231
  }
232
 
233
+ protected function _getMultiCardValue($data, $field)
234
+ {
235
  $finalValue = 0;
236
+ if (!isset($data[$field])) {
237
+ return $finalValue;
238
+ }
239
+ $amountValues = explode('|', $data[$field]);
240
+ $statusValues = explode('|', $data['status']);
241
+ foreach ($amountValues as $key => $value) {
242
+ $value = (float)str_replace(' ', '', $value);
243
+ if (str_replace(' ', '', $statusValues[$key]) == 'approved') {
244
+ $finalValue = $finalValue + $value;
245
+ }
246
  }
247
 
248
  return $finalValue;
249
  }
250
 
251
+ public function getSuccessUrl()
252
+ {
253
+ if (Mage::getStoreConfig('payment/mercadopago/use_successpage_mp')) {
254
+ $url = 'mercadopago/success';
255
+ } else {
256
+ $url = 'checkout/onepage/success';
257
+ }
258
+
259
+ return $url;
260
+ }
261
+
262
+ /**
263
+ * Return the website associated to admin combo select
264
+ *
265
+ * @return Mage_Core_Model_Website
266
+ */
267
+ public function getAdminSelectedWebsite()
268
+ {
269
+ if (isset($this->_website)) {
270
+ return $this->_website;
271
+ }
272
+
273
+ $websiteId = Mage::getSingleton('adminhtml/config_data')->getWebsite();
274
+
275
+ if ($websiteId) {
276
+ $this->_website = Mage::app()->getWebsite($websiteId);
277
+ } else {
278
+ $this->_website = Mage::app()->getWebsite();
279
+ }
280
+
281
+ return $this->_website;
282
+ }
283
+
284
  }
app/code/community/MercadoPago/Core/Helper/Message/Abstract.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Helper/Response.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Helper/StatusDetailMessage.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Helper/StatusMessage.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Helper/StatusOrderMessage.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Api/Exception.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Api/V0/Exception.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Api/V1/Exception.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Core.php CHANGED
@@ -18,14 +18,13 @@ class MercadoPago_Core_Model_Core
18
  extends Mage_Payment_Model_Method_Abstract
19
  {
20
  protected $_code = 'mercadopago';
 
 
 
21
 
22
  protected $_isGateway = true;
23
  protected $_canOrder = true;
24
- protected $_canAuthorize = true;
25
- protected $_canCapture = true;
26
- protected $_canCapturePartial = true;
27
  protected $_canRefund = true;
28
- protected $_canRefundInvoicePartial = true;
29
  protected $_canVoid = true;
30
  protected $_canUseInternal = true;
31
  protected $_canUseCheckout = true;
@@ -87,83 +86,83 @@ class MercadoPago_Core_Model_Core
87
  return Mage::getModel('sales/order')->loadByIncrementId($incrementId);
88
  }
89
 
90
- public function getInfoPaymentByOrder($order_id)
91
  {
92
- $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
93
  $payment = $order->getPayment();
94
- $info_payments = array();
95
- $fields = array(
96
- array("field" => "cardholderName", "title" => "Card Holder Name: %s"),
97
- array("field" => "trunc_card", "title" => "Card Number: %s"),
98
- array("field" => "payment_method", "title" => "Payment Method: %s"),
99
- array("field" => "expiration_date", "title" => "Expiration Date: %s"),
100
- array("field" => "installments", "title" => "Installments: %s"),
101
- array("field" => "statement_descriptor", "title" => "Statement Descriptor: %s"),
102
- array("field" => "payment_id", "title" => "Payment id (MercadoPago): %s"),
103
- array("field" => "status", "title" => "Payment Status: %s"),
104
- array("field" => "status_detail", "title" => "Payment Detail: %s"),
105
- array("field" => "activation_uri", "title" => "Generate Ticket")
106
- );
107
-
108
- foreach ($fields as $field):
109
- if ($payment->getAdditionalInformation($field['field']) != ""):
110
  $text = Mage::helper('mercadopago')->__($field['title'], $payment->getAdditionalInformation($field['field']));
111
- $info_payments[$field['field']] = array(
112
  "text" => $text,
113
  "value" => $payment->getAdditionalInformation($field['field'])
114
- );
115
- endif;
116
- endforeach;
117
 
118
- return $info_payments;
119
  }
120
 
121
  protected function validStatusTwoPayments($status)
122
  {
123
- $array_status = explode(" | ", $status);
124
- $status_verif = true;
125
- $status_final = "";
126
- foreach ($array_status as $status):
127
 
128
- if ($status_final == "") {
129
- $status_final = $status;
130
  } else {
131
- if ($status_final != $status) {
132
- $status_verif = false;
133
  }
134
  }
135
  endforeach;
136
 
137
- if ($status_verif === false) {
138
- $status_final = "other";
139
  }
140
 
141
- return $status_final;
142
  }
143
 
144
- public function getMessageByStatus($status, $status_detail, $payment_method, $installment, $amount)
145
  {
146
  $status = $this->validStatusTwoPayments($status);
147
- $status_detail = $this->validStatusTwoPayments($status_detail);
148
 
149
- $message = array(
150
  "title" => "",
151
  "message" => ""
152
- );
153
 
154
  $rawMessage = Mage::helper('mercadopago/statusMessage')->getMessage($status);
155
  $message['title'] = Mage::helper('mercadopago')->__($rawMessage['title']);
156
 
157
  if ($status == 'rejected') {
158
- if ($status_detail == 'cc_rejected_invalid_installments') {
159
  $message['message'] = Mage::helper('mercadopago')
160
- ->__(Mage::helper('mercadopago/statusDetailMessage')->getMessage($status_detail), strtoupper($payment_method), $installment);
161
- } elseif ($status_detail == 'cc_rejected_call_for_authorize') {
162
  $message['message'] = Mage::helper('mercadopago')
163
- ->__(Mage::helper('mercadopago/statusDetailMessage')->getMessage($status_detail), strtoupper($payment_method), $amount);
164
  } else {
165
  $message['message'] = Mage::helper('mercadopago')
166
- ->__(Mage::helper('mercadopago/statusDetailMessage')->getMessage($status_detail), strtoupper($payment_method));
167
  }
168
  } else {
169
  $message['message'] = Mage::helper('mercadopago')->__($rawMessage['message']);
@@ -179,27 +178,27 @@ class MercadoPago_Core_Model_Core
179
  $email = $order['customer_email'];
180
  }
181
 
182
- $first_name = htmlentities($customer->getFirstname());
183
- if ($first_name == "") {
184
- $first_name = $order->getBillingAddress()->getFirstname();
185
  }
186
 
187
- $last_name = htmlentities($customer->getLastname());
188
- if ($last_name == "") {
189
- $last_name = $order->getBillingAddress()->getLastname();
190
  }
191
 
192
- return array('email' => $email, 'first_name' => $first_name, 'last_name' => $last_name);
193
  }
194
 
195
  protected function getItemsInfo($order)
196
  {
197
- $dataItems = array();
198
  foreach ($order->getAllVisibleItems() as $item) {
199
  $product = $item->getProduct();
200
  $image = (string)Mage::helper('catalog/image')->init($product, 'image');
201
 
202
- $dataItems[] = array(
203
  "id" => $item->getSku(),
204
  "title" => $product->getName(),
205
  "description" => $product->getName(),
@@ -207,29 +206,29 @@ class MercadoPago_Core_Model_Core
207
  "category_id" => Mage::getStoreConfig('payment/mercadopago/category_id'),
208
  "quantity" => (int)number_format($item->getQtyOrdered(), 0, '.', ''),
209
  "unit_price" => (float)number_format($product->getPrice(), 2, '.', '')
210
- );
211
  }
212
 
213
  /* verify discount and add it like an item */
214
  $discount = $this->getDiscount();
215
  if ($discount != 0) {
216
- $dataItems[] = array(
217
  "title" => "Discount by the Store",
218
  "description" => "Discount by the Store",
219
  "quantity" => 1,
220
  "unit_price" => (float)number_format($discount, 2, '.', '')
221
- );
222
  }
223
 
224
  return $dataItems;
225
 
226
  }
227
 
228
- protected function getCouponInfo($coupon, $coupon_code)
229
  {
230
- $infoCoupon = array();
231
  $infoCoupon['coupon_amount'] = (float)$coupon['response']['coupon_amount'];
232
- $infoCoupon['coupon_code'] = $coupon_code;
233
  $infoCoupon['campaign_id'] = $coupon['response']['id'];
234
  if ($coupon['status'] == 200) {
235
  Mage::helper('mercadopago')->log("Coupon applied. API response 200.", self::LOG_FILE);
@@ -240,78 +239,81 @@ class MercadoPago_Core_Model_Core
240
  return $infoCoupon;
241
  }
242
 
243
- public function makeDefaultPreferencePaymentV1($payment_info = array())
244
  {
245
  $quote = $this->_getQuote();
246
- $order_id = $quote->getReservedOrderId();
247
- $order = $this->_getOrder($order_id);
248
  $customer = Mage::getSingleton('customer/session')->getCustomer();
249
 
250
- $billing_address = $quote->getBillingAddress()->getData();
251
  $customerInfo = $this->getCustomerInfo($customer, $order);
252
 
253
  /* INIT PREFERENCE */
254
- $preference = array();
255
 
256
  $preference['notification_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "mercadopago/notifications/custom";
257
-
258
  $preference['transaction_amount'] = (float)$this->getAmount();
259
 
260
- $preference['external_reference'] = $order_id;
261
  $preference['payer']['email'] = $customerInfo['email'];
262
 
263
- if (!empty($payment_info['identification_type'])) {
264
- $preference['payer']['identification']['type'] = $payment_info['identification_type'];
265
- $preference['payer']['identification']['number'] = $payment_info['identification_number'];
266
  }
267
  $preference['additional_info']['items'] = $this->getItemsInfo($order);
268
 
269
  $preference['additional_info']['payer']['first_name'] = $customerInfo['first_name'];
270
  $preference['additional_info']['payer']['last_name'] = $customerInfo['last_name'];
271
 
272
- $preference['additional_info']['payer']['address'] = array(
273
- "zip_code" => $billing_address['postcode'],
274
- "street_name" => $billing_address['street'] . " - " . $billing_address['city'] . " - " . $billing_address['country_id'],
275
  "street_number" => ''
276
- );
277
 
278
  $preference['additional_info']['payer']['registration_date'] = date('Y-m-d', $customer->getCreatedAtTimestamp()) . "T" . date('H:i:s', $customer->getCreatedAtTimestamp());
279
 
280
- $shipping = $order->getShippingAddress()->getData();
 
 
281
 
282
- $preference['additional_info']['shipments']['receiver_address'] = array(
283
- "zip_code" => $shipping['postcode'],
284
- "street_name" => $shipping['street'] . " - " . $shipping['city'] . " - " . $shipping['country_id'],
285
- "street_number" => '',
286
- "floor" => "-",
287
- "apartment" => "-",
288
 
289
- );
 
290
 
291
- $preference['additional_info']['payer']['phone'] = array(
292
  "area_code" => "0",
293
- "number" => $shipping['telephone']
294
- );
295
 
296
- if (!empty($payment_info['coupon_code'])) {
297
- $coupon_code = $payment_info['coupon_code'];
298
- Mage::helper('mercadopago')->log("Validating coupon_code: " . $coupon_code, self::LOG_FILE);
299
 
300
- $coupon = $this->validCoupon($coupon_code);
301
  Mage::helper('mercadopago')->log("Response API Coupon: ", self::LOG_FILE, $coupon);
302
 
303
- $couponInfo = $this->getCouponInfo($coupon, $coupon_code);
304
  $preference['coupon_amount'] = $couponInfo['coupon_amount'];
305
- $preference['coupon_code'] = $couponInfo['coupon_code'];
306
  $preference['campaign_id'] = $couponInfo['campaign_id'];
307
 
308
  }
309
 
310
- $sponsor_id = Mage::getStoreConfig('payment/mercadopago/sponsor_id');
311
- Mage::helper('mercadopago')->log("Sponsor_id", 'mercadopago-standard.log', $sponsor_id);
312
- if (!empty($sponsor_id)) {
313
- Mage::helper('mercadopago')->log("Sponsor_id identificado", self::LOG_FILE, $sponsor_id);
314
- $preference['sponsor_id'] = (int)$sponsor_id;
315
  }
316
 
317
  return $preference;
@@ -321,12 +323,13 @@ class MercadoPago_Core_Model_Core
321
  public function postPaymentV1($preference)
322
  {
323
 
324
- //obtem access_token
325
- $access_token = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
326
- Mage::helper('mercadopago')->log("Access Token for Post", self::LOG_FILE, $access_token);
 
327
 
328
- //seta sdk php mercadopago
329
- $mp = Mage::helper('mercadopago')->getApiInstance($access_token);
330
  $response = $mp->post("/v1/payments", $preference);
331
  Mage::helper('mercadopago')->log("POST /v1/payments", self::LOG_FILE, $response);
332
 
@@ -353,35 +356,43 @@ class MercadoPago_Core_Model_Core
353
 
354
  public function getPayment($payment_id)
355
  {
356
- $clienId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
357
- $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
358
- $mp = Mage::helper('mercadopago')->getApiInstance($clienId, $clientSecret);
 
 
359
 
360
  return $mp->get_payment($payment_id);
361
  }
362
 
363
  public function getPaymentV1($payment_id)
364
  {
365
- $this->access_token = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
366
- $mp = Mage::helper('mercadopago')->getApiInstance($this->access_token);
 
 
367
 
368
  return $mp->get("/v1/payments/" . $payment_id);
369
  }
370
 
371
  public function getMerchantOrder($merchant_order_id)
372
  {
373
- $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
374
- $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
375
- $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
 
 
376
 
377
  return $mp->get("/merchant_orders/" . $merchant_order_id);
378
  }
379
 
380
  public function getPaymentMethods()
381
  {
382
- $this->access_token = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
 
 
383
 
384
- $mp = Mage::helper('mercadopago')->getApiInstance($this->access_token);
385
 
386
  $payment_methods = $mp->get("/v1/payment_methods");
387
 
@@ -413,9 +424,11 @@ class MercadoPago_Core_Model_Core
413
 
414
  public function validCoupon($id)
415
  {
416
- $this->access_token = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
 
 
417
 
418
- $mp = Mage::helper('mercadopago')->getApiInstance($this->access_token);
419
 
420
  $params = array(
421
  "transaction_amount" => $this->getAmount(),
@@ -433,7 +446,22 @@ class MercadoPago_Core_Model_Core
433
  return $details_discount;
434
  }
435
 
436
- public function setStatusOrder($payment, $stateObject = null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  {
438
  $helper = Mage::helper('mercadopago');
439
  $order = Mage::getModel('sales/order')->loadByIncrementId($payment["external_reference"]);
@@ -443,45 +471,29 @@ class MercadoPago_Core_Model_Core
443
  $status = $payment['status_final'];
444
  }
445
  $message = $helper->getMessage($status, $payment);
 
 
 
446
 
447
  try {
448
  if ($status == 'approved') {
449
  Mage::helper('mercadopago')->setOrderSubtotals($payment, $order);
450
-
451
- if (!$order->hasInvoices()) {
452
- $invoice = $order->prepareInvoice();
453
- $invoice->register()->pay();
454
- Mage::getModel('core/resource_transaction')
455
- ->addObject($invoice)
456
- ->addObject($invoice->getOrder())
457
- ->save();
458
-
459
- $invoice->sendEmail(true, $message);
460
- }
461
  //Associate card to customer
462
  $additionalInfo = $order->getPayment()->getAdditionalInformation();
463
  if (isset($additionalInfo['token'])) {
464
  Mage::getModel('mercadopago/custom_payment')->customerAndCards($additionalInfo['token'], $payment);
465
  }
466
 
467
-
468
  } elseif ($status == 'refunded' || $status == 'cancelled') {
469
- $order->cancel();
470
- }
471
-
472
- $statusOrder = $helper->getStatusOrder($status);
473
- if ($stateObject) {
474
- $stateObject->setStatus($statusOrder);
475
- $stateObject->setState($helper->_getAssignedState($statusOrder));
476
- $stateObject->setIsNotified(true);
477
  }
 
 
478
 
479
- $order->setState($helper->_getAssignedState($statusOrder));
480
- $order->addStatusToHistory($statusOrder, $message, true);
481
- $order->sendOrderUpdateEmail(true, $message);
482
-
483
- $status_save = $order->save();
484
- $helper->log("Update order", 'mercadopago.log', $status_save->getData());
485
  $helper->log($message, 'mercadopago.log');
486
 
487
  return ['text' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
@@ -492,60 +504,75 @@ class MercadoPago_Core_Model_Core
492
  }
493
  }
494
 
495
- public function updateOrder($data)
496
  {
497
- Mage::helper('mercadopago')->log("Update Order", 'mercadopago-notification.log');
 
498
 
499
- try {
500
- $order = Mage::getModel('sales/order')->loadByIncrementId($data["external_reference"]);
501
 
502
- $payment_order = $order->getPayment();
 
 
 
 
503
 
504
- $additionalFields = array(
505
- 'status',
506
- 'status_detail',
507
- 'payment_id',
508
- 'transaction_amount',
509
- 'cardholderName',
510
- 'installments',
511
- 'statement_descriptor',
512
- 'trunc_card'
 
 
513
 
514
- );
515
 
516
- foreach ($additionalFields as $field) {
517
- if (isset($data[$field])) {
518
- $payment_order->setAdditionalInformation($field, $data[$field]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
  }
520
- }
521
-
522
- if (isset($data['payment_method_id'])) {
523
- $payment_order->setAdditionalInformation('payment_method', $data['payment_method_id']);
524
- }
525
 
526
- $payment_status = $payment_order->save();
527
- Mage::helper('mercadopago')->log("Update Payment", 'mercadopago.log', $payment_status->getData());
 
528
 
529
- if ($data['payer_first_name']) {
530
- $order->setCustomerFirstname($data['payer_first_name']);
531
- }
532
 
533
- if ($data['payer_last_name']) {
534
- $order->setCustomerLastname($data['payer_last_name']);
535
- }
 
 
536
 
537
- if ($data['payer_email']) {
538
- $order->setCustomerEmail($data['payer_email']);
539
  }
540
-
541
-
542
- $status_save = $order->save();
543
- Mage::helper('mercadopago')->log("Update order", 'mercadopago.log', $status_save->getData());
544
- } catch (Exception $e) {
545
- Mage::helper('mercadopago')->log("error in update order status: " . $e, 'mercadopago.log');
546
- $this->getResponse()->setBody($e);
547
-
548
- $this->getResponse()->setHttpResponseCode(MercadoPago_Core_Helper_Response::HTTP_BAD_REQUEST);
549
  }
550
  }
551
 
18
  extends Mage_Payment_Model_Method_Abstract
19
  {
20
  protected $_code = 'mercadopago';
21
+ protected $_accessToken;
22
+ protected $_clientId;
23
+ protected $_clientSecret;
24
 
25
  protected $_isGateway = true;
26
  protected $_canOrder = true;
 
 
 
27
  protected $_canRefund = true;
 
28
  protected $_canVoid = true;
29
  protected $_canUseInternal = true;
30
  protected $_canUseCheckout = true;
86
  return Mage::getModel('sales/order')->loadByIncrementId($incrementId);
87
  }
88
 
89
+ public function getInfoPaymentByOrder($orderId)
90
  {
91
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
92
  $payment = $order->getPayment();
93
+ $infoPayments = [];
94
+ $fields = [
95
+ ["field" => "cardholderName", "title" => "Card Holder Name: %s"],
96
+ ["field" => "trunc_card", "title" => "Card Number: %s"],
97
+ ["field" => "payment_method", "title" => "Payment Method: %s"],
98
+ ["field" => "expiration_date", "title" => "Expiration Date: %s"],
99
+ ["field" => "installments", "title" => "Installments: %s"],
100
+ ["field" => "statement_descriptor", "title" => "Statement Descriptor: %s"],
101
+ ["field" => "payment_id", "title" => "Payment id (MercadoPago): %s"],
102
+ ["field" => "status", "title" => "Payment Status: %s"],
103
+ ["field" => "status_detail", "title" => "Payment Detail: %s"],
104
+ ["field" => "activation_uri", "title" => "Generate Ticket"]
105
+ ];
106
+
107
+ foreach ($fields as $field) {
108
+ if ($payment->getAdditionalInformation($field['field']) != "") {
109
  $text = Mage::helper('mercadopago')->__($field['title'], $payment->getAdditionalInformation($field['field']));
110
+ $infoPayments[$field['field']] = [
111
  "text" => $text,
112
  "value" => $payment->getAdditionalInformation($field['field'])
113
+ ];
114
+ }
115
+ }
116
 
117
+ return $infoPayments;
118
  }
119
 
120
  protected function validStatusTwoPayments($status)
121
  {
122
+ $arrayStatus = explode(" | ", $status);
123
+ $statusVerif = true;
124
+ $statusFinal = "";
125
+ foreach ($arrayStatus as $status):
126
 
127
+ if ($statusFinal == "") {
128
+ $statusFinal = $status;
129
  } else {
130
+ if ($statusFinal != $status) {
131
+ $statusVerif = false;
132
  }
133
  }
134
  endforeach;
135
 
136
+ if ($statusVerif === false) {
137
+ $statusFinal = "other";
138
  }
139
 
140
+ return $statusFinal;
141
  }
142
 
143
+ public function getMessageByStatus($status, $statusDetail, $paymentMethod, $installment, $amount)
144
  {
145
  $status = $this->validStatusTwoPayments($status);
146
+ $statusDetail = $this->validStatusTwoPayments($statusDetail);
147
 
148
+ $message = [
149
  "title" => "",
150
  "message" => ""
151
+ ];
152
 
153
  $rawMessage = Mage::helper('mercadopago/statusMessage')->getMessage($status);
154
  $message['title'] = Mage::helper('mercadopago')->__($rawMessage['title']);
155
 
156
  if ($status == 'rejected') {
157
+ if ($statusDetail == 'cc_rejected_invalid_installments') {
158
  $message['message'] = Mage::helper('mercadopago')
159
+ ->__(Mage::helper('mercadopago/statusDetailMessage')->getMessage($statusDetail), strtoupper($paymentMethod), $installment);
160
+ } elseif ($statusDetail == 'cc_rejected_call_for_authorize') {
161
  $message['message'] = Mage::helper('mercadopago')
162
+ ->__(Mage::helper('mercadopago/statusDetailMessage')->getMessage($statusDetail), strtoupper($paymentMethod), $amount);
163
  } else {
164
  $message['message'] = Mage::helper('mercadopago')
165
+ ->__(Mage::helper('mercadopago/statusDetailMessage')->getMessage($statusDetail), strtoupper($paymentMethod));
166
  }
167
  } else {
168
  $message['message'] = Mage::helper('mercadopago')->__($rawMessage['message']);
178
  $email = $order['customer_email'];
179
  }
180
 
181
+ $firstName = htmlentities($customer->getFirstname());
182
+ if ($firstName == "") {
183
+ $firstName = $order->getBillingAddress()->getFirstname();
184
  }
185
 
186
+ $lastName = htmlentities($customer->getLastname());
187
+ if ($lastName == "") {
188
+ $lastName = $order->getBillingAddress()->getLastname();
189
  }
190
 
191
+ return ['email' => $email, 'first_name' => $firstName, 'last_name' => $lastName];
192
  }
193
 
194
  protected function getItemsInfo($order)
195
  {
196
+ $dataItems = [];
197
  foreach ($order->getAllVisibleItems() as $item) {
198
  $product = $item->getProduct();
199
  $image = (string)Mage::helper('catalog/image')->init($product, 'image');
200
 
201
+ $dataItems[] = [
202
  "id" => $item->getSku(),
203
  "title" => $product->getName(),
204
  "description" => $product->getName(),
206
  "category_id" => Mage::getStoreConfig('payment/mercadopago/category_id'),
207
  "quantity" => (int)number_format($item->getQtyOrdered(), 0, '.', ''),
208
  "unit_price" => (float)number_format($product->getPrice(), 2, '.', '')
209
+ ];
210
  }
211
 
212
  /* verify discount and add it like an item */
213
  $discount = $this->getDiscount();
214
  if ($discount != 0) {
215
+ $dataItems[] = [
216
  "title" => "Discount by the Store",
217
  "description" => "Discount by the Store",
218
  "quantity" => 1,
219
  "unit_price" => (float)number_format($discount, 2, '.', '')
220
+ ];
221
  }
222
 
223
  return $dataItems;
224
 
225
  }
226
 
227
+ protected function getCouponInfo($coupon, $couponCode)
228
  {
229
+ $infoCoupon = [];
230
  $infoCoupon['coupon_amount'] = (float)$coupon['response']['coupon_amount'];
231
+ $infoCoupon['coupon_code'] = $couponCode;
232
  $infoCoupon['campaign_id'] = $coupon['response']['id'];
233
  if ($coupon['status'] == 200) {
234
  Mage::helper('mercadopago')->log("Coupon applied. API response 200.", self::LOG_FILE);
239
  return $infoCoupon;
240
  }
241
 
242
+ public function makeDefaultPreferencePaymentV1($paymentInfo = [])
243
  {
244
  $quote = $this->_getQuote();
245
+ $orderId = $quote->getReservedOrderId();
246
+ $order = $this->_getOrder($orderId);
247
  $customer = Mage::getSingleton('customer/session')->getCustomer();
248
 
249
+ $billingAddress = $quote->getBillingAddress()->getData();
250
  $customerInfo = $this->getCustomerInfo($customer, $order);
251
 
252
  /* INIT PREFERENCE */
253
+ $preference = [];
254
 
255
  $preference['notification_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "mercadopago/notifications/custom";
256
+ $preference['description'] = Mage::helper('mercadopago')->__("Order # %s in store %s", $orderId, Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true));
257
  $preference['transaction_amount'] = (float)$this->getAmount();
258
 
259
+ $preference['external_reference'] = $orderId;
260
  $preference['payer']['email'] = $customerInfo['email'];
261
 
262
+ if (!empty($paymentInfo['identification_type'])) {
263
+ $preference['payer']['identification']['type'] = $paymentInfo['identification_type'];
264
+ $preference['payer']['identification']['number'] = $paymentInfo['identification_number'];
265
  }
266
  $preference['additional_info']['items'] = $this->getItemsInfo($order);
267
 
268
  $preference['additional_info']['payer']['first_name'] = $customerInfo['first_name'];
269
  $preference['additional_info']['payer']['last_name'] = $customerInfo['last_name'];
270
 
271
+ $preference['additional_info']['payer']['address'] = [
272
+ "zip_code" => $billingAddress['postcode'],
273
+ "street_name" => $billingAddress['street'] . " - " . $billingAddress['city'] . " - " . $billingAddress['country_id'],
274
  "street_number" => ''
275
+ ];
276
 
277
  $preference['additional_info']['payer']['registration_date'] = date('Y-m-d', $customer->getCreatedAtTimestamp()) . "T" . date('H:i:s', $customer->getCreatedAtTimestamp());
278
 
279
+ if ($order->canShip()) {
280
+ $shippingAddress = $order->getShippingAddress();
281
+ $shipping = $shippingAddress->getData();
282
 
283
+ $preference['additional_info']['shipments']['receiver_address'] = [
284
+ "zip_code" => $shipping['postcode'],
285
+ "street_name" => $shipping['street'] . " - " . $shipping['city'] . " - " . $shipping['country_id'],
286
+ "street_number" => '',
287
+ "floor" => "-",
288
+ "apartment" => "-",
289
 
290
+ ];
291
+ }
292
 
293
+ $preference['additional_info']['payer']['phone'] = [
294
  "area_code" => "0",
295
+ "number" => $billingAddress['telephone']
296
+ ];
297
 
298
+ if (!empty($paymentInfo['coupon_code'])) {
299
+ $couponCode = $paymentInfo['coupon_code'];
300
+ Mage::helper('mercadopago')->log("Validating coupon_code: " . $couponCode, self::LOG_FILE);
301
 
302
+ $coupon = $this->validCoupon($couponCode);
303
  Mage::helper('mercadopago')->log("Response API Coupon: ", self::LOG_FILE, $coupon);
304
 
305
+ $couponInfo = $this->getCouponInfo($coupon, $couponCode);
306
  $preference['coupon_amount'] = $couponInfo['coupon_amount'];
307
+ $preference['coupon_code'] = strtoupper($couponInfo['coupon_code']);
308
  $preference['campaign_id'] = $couponInfo['campaign_id'];
309
 
310
  }
311
 
312
+ $sponsorId = Mage::getStoreConfig('payment/mercadopago/sponsor_id');
313
+ Mage::helper('mercadopago')->log("Sponsor_id", 'mercadopago-standard.log', $sponsorId);
314
+ if (!empty($sponsorId)) {
315
+ Mage::helper('mercadopago')->log("Sponsor_id identificado", self::LOG_FILE, $sponsorId);
316
+ $preference['sponsor_id'] = (int)$sponsorId;
317
  }
318
 
319
  return $preference;
323
  public function postPaymentV1($preference)
324
  {
325
 
326
+ if (!$this->_accessToken) {
327
+ $this->_accessToken = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
328
+ }
329
+ Mage::helper('mercadopago')->log("Access Token for Post", self::LOG_FILE, $this->_accessToken);
330
 
331
+ //set sdk php mercadopago
332
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_accessToken);
333
  $response = $mp->post("/v1/payments", $preference);
334
  Mage::helper('mercadopago')->log("POST /v1/payments", self::LOG_FILE, $response);
335
 
356
 
357
  public function getPayment($payment_id)
358
  {
359
+ if (!$this->_clientId || !$this->_clientSecret) {
360
+ $this->_clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
361
+ $this->_clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
362
+ }
363
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_clientId, $this->_clientSecret);
364
 
365
  return $mp->get_payment($payment_id);
366
  }
367
 
368
  public function getPaymentV1($payment_id)
369
  {
370
+ if (!$this->_accessToken) {
371
+ $this->_accessToken = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
372
+ }
373
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_accessToken);
374
 
375
  return $mp->get("/v1/payments/" . $payment_id);
376
  }
377
 
378
  public function getMerchantOrder($merchant_order_id)
379
  {
380
+ if (!$this->_clientId || !$this->_clientSecret) {
381
+ $this->_clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
382
+ $this->_clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
383
+ }
384
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_clientId, $this->_clientSecret);
385
 
386
  return $mp->get("/merchant_orders/" . $merchant_order_id);
387
  }
388
 
389
  public function getPaymentMethods()
390
  {
391
+ if (!$this->_accessToken) {
392
+ $this->_accessToken = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
393
+ }
394
 
395
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_accessToken);
396
 
397
  $payment_methods = $mp->get("/v1/payment_methods");
398
 
424
 
425
  public function validCoupon($id)
426
  {
427
+ if (!$this->_accessToken) {
428
+ $this->_accessToken = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
429
+ }
430
 
431
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_accessToken);
432
 
433
  $params = array(
434
  "transaction_amount" => $this->getAmount(),
446
  return $details_discount;
447
  }
448
 
449
+ protected function _createInvoice($order, $message)
450
+ {
451
+ if (!$order->hasInvoices()) {
452
+ $invoice = $order->prepareInvoice();
453
+ $invoice->register();
454
+ $invoice->pay();
455
+ Mage::getModel('core/resource_transaction')
456
+ ->addObject($invoice)
457
+ ->addObject($invoice->getOrder())
458
+ ->save();
459
+
460
+ $invoice->sendEmail(true, $message);
461
+ }
462
+ }
463
+
464
+ public function setStatusOrder($payment)
465
  {
466
  $helper = Mage::helper('mercadopago');
467
  $order = Mage::getModel('sales/order')->loadByIncrementId($payment["external_reference"]);
471
  $status = $payment['status_final'];
472
  }
473
  $message = $helper->getMessage($status, $payment);
474
+ if (Mage::helper('mercadopago')->isStatusUpdated()) {
475
+ return ['text' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
476
+ }
477
 
478
  try {
479
  if ($status == 'approved') {
480
  Mage::helper('mercadopago')->setOrderSubtotals($payment, $order);
481
+ $this->_createInvoice($order, $message);
 
 
 
 
 
 
 
 
 
 
482
  //Associate card to customer
483
  $additionalInfo = $order->getPayment()->getAdditionalInformation();
484
  if (isset($additionalInfo['token'])) {
485
  Mage::getModel('mercadopago/custom_payment')->customerAndCards($additionalInfo['token'], $payment);
486
  }
487
 
 
488
  } elseif ($status == 'refunded' || $status == 'cancelled') {
489
+ //generate credit memo and return items to stock according to setting
490
+ $this->_generateCreditMemo($order, $payment);
 
 
 
 
 
 
491
  }
492
+ //if state is not complete updates according to setting
493
+ $this->_updateStatus($order, $helper, $status, $message);
494
 
495
+ $statusSave = $order->save();
496
+ $helper->log("Update order", 'mercadopago.log', $statusSave->getData());
 
 
 
 
497
  $helper->log($message, 'mercadopago.log');
498
 
499
  return ['text' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
504
  }
505
  }
506
 
507
+ protected function _updateStatus($order, $helper, $status, $message)
508
  {
509
+ if ($order->getState() !== Mage_Sales_Model_Order::STATE_COMPLETE) {
510
+ $statusOrder = $helper->getStatusOrder($status);
511
 
 
 
512
 
513
+ $order->setState($helper->_getAssignedState($statusOrder));
514
+ $order->addStatusToHistory($statusOrder, $message, true);
515
+ $order->sendOrderUpdateEmail(true, $message);
516
+ }
517
+ }
518
 
519
+ protected function _generateCreditMemo($order, $payment)
520
+ {
521
+ if (isset($payment['amount_refunded']) && $payment['amount_refunded'] > 0 && $payment['amount_refunded'] == $payment['total_paid_amount']) {
522
+ $order->getPayment()->registerRefundNotification($payment['amount_refunded']);
523
+ $creditMemo = array_pop($order->getCreditmemosCollection()->setPageSize(1)->setCurPage(1)->load()->getItems());
524
+ foreach ($creditMemo->getAllItems() as $creditMemoItem) {
525
+ $creditMemoItem->setBackToStock(Mage::helper('cataloginventory')->isAutoReturnEnabled());
526
+ }
527
+ $creditMemo->save();
528
+ $order->cancel();
529
+ }
530
 
531
+ }
532
 
533
+ public function updateOrder($data)
534
+ {
535
+ Mage::helper('mercadopago')->log("Update Order", 'mercadopago-notification.log');
536
+ if (!Mage::helper('mercadopago')->isStatusUpdated()) {
537
+
538
+ try {
539
+ $order = Mage::getModel('sales/order')->loadByIncrementId($data["external_reference"]);
540
+
541
+ $paymentOrder = $order->getPayment();
542
+
543
+ $additionalFields = [
544
+ 'status',
545
+ 'status_detail',
546
+ 'payment_id',
547
+ 'transaction_amount',
548
+ 'cardholderName',
549
+ 'installments',
550
+ 'statement_descriptor',
551
+ 'trunc_card',
552
+ 'id'
553
+ ];
554
+
555
+ foreach ($additionalFields as $field) {
556
+ if (isset($data[$field])) {
557
+ $paymentOrder->setAdditionalInformation($field, $data[$field]);
558
+ }
559
  }
 
 
 
 
 
560
 
561
+ if (isset($data['payment_method_id'])) {
562
+ $paymentOrder->setAdditionalInformation('payment_method', $data['payment_method_id']);
563
+ }
564
 
565
+ $paymentStatus = $paymentOrder->save();
566
+ Mage::helper('mercadopago')->log("Update Payment", 'mercadopago.log', $paymentStatus->getData());
 
567
 
568
+ $statusSave = $order->save();
569
+ Mage::helper('mercadopago')->log("Update order", 'mercadopago.log', $statusSave->getData());
570
+ } catch (Exception $e) {
571
+ Mage::helper('mercadopago')->log("error in update order status: " . $e, 'mercadopago.log');
572
+ $this->getResponse()->setBody($e);
573
 
574
+ $this->getResponse()->setHttpResponseCode(MercadoPago_Core_Helper_Response::HTTP_BAD_REQUEST);
 
575
  }
 
 
 
 
 
 
 
 
 
576
  }
577
  }
578
 
app/code/community/MercadoPago/Core/Model/Custom/Finance/Cost.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Custom/Finance/Cost/Creditmemo.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Custom/Finance/Cost/Invoice.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Custom/Payment.php CHANGED
@@ -44,25 +44,18 @@ class MercadoPago_Core_Model_Custom_Payment
44
 
45
  $response = $this->preparePostPayment();
46
 
47
- if ($response !== false):
48
-
49
  $payment = $response['response'];
50
  //set status
51
  $this->getInfoInstance()->setAdditionalInformation('status', $payment['status']);
52
  $this->getInfoInstance()->setAdditionalInformation('status_detail', $payment['status_detail']);
53
-
54
- if ($response['status'] == 200 || $response['status'] == 201) {
55
- Mage::helper('mercadopago')->log("Received Payment data", self::LOG_FILE, $payment);
56
-
57
- $payment = Mage::helper('mercadopago')->setPayerInfo($payment);
58
- $core = Mage::getModel('mercadopago/core');
59
- Mage::helper('mercadopago')->log("Update Order", self::LOG_FILE);
60
- $core->updateOrder($payment);
61
- $core->setStatusOrder($payment, $stateObject);
62
- }
63
 
64
  return true;
65
- endif;
66
 
67
  return false;
68
  }
@@ -187,7 +180,7 @@ class MercadoPago_Core_Model_Custom_Payment
187
 
188
  public function getOrCreateCustomer($email)
189
  {
190
- if (empty($email)){
191
  return false;
192
  }
193
  $access_token = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
@@ -240,10 +233,10 @@ class MercadoPago_Core_Model_Custom_Payment
240
  }
241
  }
242
  $params = ["token" => $token];
243
- if (isset($payment['issuer_id'])){
244
  $params['issuer_id'] = (int)$payment['issuer_id'];
245
  }
246
- if (isset($payment['payment_method_id'])){
247
  $params['payment_method_id'] = $payment['payment_method_id'];
248
  }
249
  $card = $mp->post("/v1/customers/" . $customer['id'] . "/cards", $params);
@@ -272,7 +265,8 @@ class MercadoPago_Core_Model_Custom_Payment
272
  return Mage::getUrl('mercadopago/success', ['_secure' => true]);
273
  }
274
 
275
- public function getCode() {
 
276
  return $this->_code;
277
  }
278
 
44
 
45
  $response = $this->preparePostPayment();
46
 
47
+ if ($response) {
 
48
  $payment = $response['response'];
49
  //set status
50
  $this->getInfoInstance()->setAdditionalInformation('status', $payment['status']);
51
  $this->getInfoInstance()->setAdditionalInformation('status_detail', $payment['status_detail']);
52
+ $this->getInfoInstance()->setAdditionalInformation('payment_id_detail', $payment['id']);
53
+ $stateObject->setState(Mage::helper('mercadopago')->_getAssignedState('pending_payment'));
54
+ $stateObject->setStatus('pending_payment');
55
+ $stateObject->setIsNotified(false);
 
 
 
 
 
 
56
 
57
  return true;
58
+ }
59
 
60
  return false;
61
  }
180
 
181
  public function getOrCreateCustomer($email)
182
  {
183
+ if (empty($email)) {
184
  return false;
185
  }
186
  $access_token = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
233
  }
234
  }
235
  $params = ["token" => $token];
236
+ if (isset($payment['issuer_id'])) {
237
  $params['issuer_id'] = (int)$payment['issuer_id'];
238
  }
239
+ if (isset($payment['payment_method_id'])) {
240
  $params['payment_method_id'] = $payment['payment_method_id'];
241
  }
242
  $card = $mp->post("/v1/customers/" . $customer['id'] . "/cards", $params);
265
  return Mage::getUrl('mercadopago/success', ['_secure' => true]);
266
  }
267
 
268
+ public function getCode()
269
+ {
270
  return $this->_code;
271
  }
272
 
app/code/community/MercadoPago/Core/Model/CustomPayment.php CHANGED
@@ -39,6 +39,12 @@ abstract class MercadoPago_Core_Model_CustomPayment
39
  return false;
40
  }
41
 
 
 
 
 
 
 
42
  return Mage::helper('mercadopago')->isValidAccessToken($accessToken);
43
  }
44
 
39
  return false;
40
  }
41
 
42
+ $debugMode = Mage::getStoreConfig('payment/mercadopago/debug_mode');
43
+ $secure = Mage::app()->getFrontController()->getRequest()->isSecure();
44
+ if (!$secure && !$debugMode ) {
45
+ return false;
46
+ }
47
+
48
  return Mage::helper('mercadopago')->isValidAccessToken($accessToken);
49
  }
50
 
app/code/community/MercadoPago/Core/Model/CustomTicket/Payment.php CHANGED
@@ -17,7 +17,6 @@
17
  class MercadoPago_Core_Model_CustomTicket_Payment
18
  extends MercadoPago_Core_Model_CustomPayment
19
  {
20
- //configura o lugar do arquivo para listar meios de pagamento
21
  protected $_formBlockType = 'mercadopago/customticket_form';
22
  protected $_infoBlockType = 'mercadopago/customticket_info';
23
 
@@ -46,23 +45,21 @@ class MercadoPago_Core_Model_CustomTicket_Payment
46
 
47
  public function assignData($data)
48
  {
49
-
50
  // route /checkout/onepage/savePayment
51
  if (!($data instanceof Varien_Object)) {
52
  $data = new Varien_Object($data);
53
  }
54
 
55
- //get array info
56
- $info_form = $data->getData();
57
- $info_form = $info_form['mercadopago_customticket'];
58
 
59
- Mage::helper('mercadopago')->log("info form", 'mercadopago-custom.log', $info_form);
60
 
61
  $info = $this->getInfoInstance();
62
- $info->setAdditionalInformation('payment_method', $info_form['payment_method_ticket']);
63
 
64
- if (isset($info_form['coupon_code'])) {
65
- $info->setAdditionalInformation('coupon_code', $info_form['coupon_code']);
66
  }
67
 
68
  return $this;
@@ -73,23 +70,19 @@ class MercadoPago_Core_Model_CustomTicket_Payment
73
  Mage::helper('mercadopago')->log("Ticket -> init prepare post payment", 'mercadopago-custom.log');
74
  $core = Mage::getModel('mercadopago/core');
75
  $quote = $this->_getQuote();
76
- $order_id = $quote->getReservedOrderId();
77
- $order = $this->_getOrder($order_id);
78
 
79
- //pega payment dentro da order para pegar as informacoes adicionadas pela funcao assignData()
80
  $payment = $order->getPayment();
81
 
82
- $payment_info = array();
83
 
84
- /* verifica se o pagamento possui coupon_code */
85
  if ($payment->getAdditionalInformation("coupon_code") != "") {
86
- $payment_info['coupon_code'] = $payment->getAdditionalInformation("coupon_code");
87
  }
88
 
89
- /* cria a preferencia padrão */
90
- $preference = $core->makeDefaultPreferencePaymentV1($payment_info);
91
 
92
- /* adiciona informações sobre pagamento com ticket */
93
  $preference['payment_method_id'] = $payment->getAdditionalInformation("payment_method");
94
 
95
  Mage::helper('mercadopago')->log("Ticket -> PREFERENCE to POST /v1/payments", 'mercadopago-custom.log', $preference);
@@ -101,15 +94,7 @@ class MercadoPago_Core_Model_CustomTicket_Payment
101
 
102
  public function getOrderPlaceRedirectUrl()
103
  {
104
- // requisicao vem da pagina de finalizacao de pedido
105
- return Mage::getUrl('mercadopago/success', array('_secure' => true));
106
- }
107
-
108
-
109
- public function getSuccessBlockType()
110
- {
111
- return $this->_successBlockType;
112
  }
113
 
114
-
115
  }
17
  class MercadoPago_Core_Model_CustomTicket_Payment
18
  extends MercadoPago_Core_Model_CustomPayment
19
  {
 
20
  protected $_formBlockType = 'mercadopago/customticket_form';
21
  protected $_infoBlockType = 'mercadopago/customticket_info';
22
 
45
 
46
  public function assignData($data)
47
  {
 
48
  // route /checkout/onepage/savePayment
49
  if (!($data instanceof Varien_Object)) {
50
  $data = new Varien_Object($data);
51
  }
52
 
53
+ $infoForm = $data->getData();
54
+ $infoForm = $infoForm['mercadopago_customticket'];
 
55
 
56
+ Mage::helper('mercadopago')->log("info form", 'mercadopago-custom.log', $infoForm);
57
 
58
  $info = $this->getInfoInstance();
59
+ $info->setAdditionalInformation('payment_method', $infoForm['payment_method_ticket']);
60
 
61
+ if (isset($infoForm['coupon_code'])) {
62
+ $info->setAdditionalInformation('coupon_code', $infoForm['coupon_code']);
63
  }
64
 
65
  return $this;
70
  Mage::helper('mercadopago')->log("Ticket -> init prepare post payment", 'mercadopago-custom.log');
71
  $core = Mage::getModel('mercadopago/core');
72
  $quote = $this->_getQuote();
73
+ $orderId = $quote->getReservedOrderId();
74
+ $order = $this->_getOrder($orderId);
75
 
 
76
  $payment = $order->getPayment();
77
 
78
+ $paymentInfo = [];
79
 
 
80
  if ($payment->getAdditionalInformation("coupon_code") != "") {
81
+ $paymentInfo['coupon_code'] = $payment->getAdditionalInformation("coupon_code");
82
  }
83
 
84
+ $preference = $core->makeDefaultPreferencePaymentV1($paymentInfo);
 
85
 
 
86
  $preference['payment_method_id'] = $payment->getAdditionalInformation("payment_method");
87
 
88
  Mage::helper('mercadopago')->log("Ticket -> PREFERENCE to POST /v1/payments", 'mercadopago-custom.log', $preference);
94
 
95
  public function getOrderPlaceRedirectUrl()
96
  {
97
+ return Mage::getUrl('mercadopago/success', ['_secure' => true]);
 
 
 
 
 
 
 
98
  }
99
 
 
100
  }
app/code/community/MercadoPago/Core/Model/Discount/Coupon.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Discount/Coupon/Creditmemo.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Discount/Coupon/Invoice.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Observer.php CHANGED
@@ -45,6 +45,7 @@ class MercadoPago_Core_Model_Observer
45
 
46
  private $available_transparent_credit_cart = ['mla', 'mlb', 'mlm', 'mco', 'mlv', 'mlc'];
47
  private $available_transparent_ticket = ['mla', 'mlb', 'mlm'];
 
48
 
49
  const LOG_FILE = 'mercadopago.log';
50
 
@@ -55,6 +56,9 @@ class MercadoPago_Core_Model_Observer
55
  */
56
  public function checkAndValidData($observer)
57
  {
 
 
 
58
  $this->validateAccessToken();
59
 
60
  $this->validateClientCredentials();
@@ -71,41 +75,42 @@ class MercadoPago_Core_Model_Observer
71
 
72
  public function availableCheckout()
73
  {
74
- //verifica se o pais selecionado possui integracao para utilizar os checkouts transparents
 
75
 
76
- $country = Mage::getStoreConfig('payment/mercadopago/country');
77
 
78
  if (!in_array($country, $this->available_transparent_credit_cart)) {
79
- Mage::getConfig()->saveConfig('payment/mercadopago_custom/active', 0);
80
  }
81
 
82
  if (!in_array($country, $this->available_transparent_ticket)) {
83
- Mage::getConfig()->saveConfig('payment/mercadopago_customticket/active', 0);
84
  }
85
  }
86
 
87
- public function checkBanner($type_checkout)
88
  {
89
  //get country
90
- $country = Mage::getStoreConfig('payment/mercadopago/country');
91
- if (!isset($this->banners[$type_checkout][$country])) {
92
  return;
93
  }
94
- $default_banner = $this->banners[$type_checkout][$country];
95
 
96
- $current_banner = Mage::getStoreConfig('payment/' . $type_checkout . '/banner_checkout');
97
 
98
- Mage::helper('mercadopago')->log("Type Checkout Path: " . $type_checkout, self::LOG_FILE);
99
- Mage::helper('mercadopago')->log("Current Banner: " . $current_banner, self::LOG_FILE);
100
- Mage::helper('mercadopago')->log("Default Banner: " . $default_banner, self::LOG_FILE);
101
 
102
- if (in_array($current_banner, $this->banners[$type_checkout])) {
103
  Mage::helper('mercadopago')->log("Banner default need update...", self::LOG_FILE);
104
 
105
- if ($default_banner != $current_banner) {
106
- Mage::getConfig()->saveConfig('payment/' . $type_checkout . '/banner_checkout', $default_banner);
107
 
108
- Mage::helper('mercadopago')->log('payment/' . $type_checkout . '/banner_checkout setted ' . $default_banner, self::LOG_FILE);
109
  }
110
  }
111
  }
@@ -113,15 +118,15 @@ class MercadoPago_Core_Model_Observer
113
 
114
  public function setSponsor()
115
  {
116
- Mage::helper('mercadopago')->log("Sponsor_id: " . Mage::getStoreConfig('payment/mercadopago/sponsor_id'), self::LOG_FILE);
117
 
118
- $sponsor_id = "";
119
  Mage::helper('mercadopago')->log("Valid user test", self::LOG_FILE);
120
 
121
- $access_token = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
122
- Mage::helper('mercadopago')->log("Get access_token: " . $access_token, self::LOG_FILE);
123
 
124
- $mp = Mage::helper('mercadopago')->getApiInstance($access_token);
125
  $user = $mp->get("/users/me");
126
  Mage::helper('mercadopago')->log("API Users response", self::LOG_FILE, $user);
127
 
@@ -129,38 +134,38 @@ class MercadoPago_Core_Model_Observer
129
 
130
  switch ($user['response']['site_id']) {
131
  case 'MLA':
132
- $sponsor_id = 186172525;
133
  break;
134
  case 'MLB':
135
- $sponsor_id = 186175129;
136
  break;
137
  case 'MLM':
138
- $sponsor_id = 186175064;
139
  break;
140
  case 'MCO':
141
- $sponsor_id = 206959966;
142
  break;
143
  case 'MLC':
144
- $sponsor_id = 206959756;
145
  break;
146
  case 'MLV':
147
- $sponsor_id = 206960619;
148
  break;
149
  default:
150
- $sponsor_id = "";
151
  break;
152
  }
153
 
154
- Mage::helper('mercadopago')->log("Sponsor id setted", self::LOG_FILE, $sponsor_id);
155
  }
156
 
157
- Mage::getConfig()->saveConfig('payment/mercadopago/sponsor_id', $sponsor_id);
158
- Mage::helper('mercadopago')->log("Sponsor saved", self::LOG_FILE, $sponsor_id);
159
  }
160
 
161
  protected function validateAccessToken()
162
  {
163
- $accessToken = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
164
  if (!empty($accessToken)) {
165
  if (!Mage::helper('mercadopago')->isValidAccessToken($accessToken)) {
166
  Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Custom Checkout: Invalid access token'));
@@ -170,8 +175,8 @@ class MercadoPago_Core_Model_Observer
170
 
171
  protected function validateClientCredentials()
172
  {
173
- $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
174
- $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
175
  if (!empty($clientId) && !empty($clientSecret)) {
176
  if (!Mage::helper('mercadopago')->isValidClientCredentials($clientId, $clientSecret)) {
177
  Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Classic Checkout: Invalid client id or client secret'));
45
 
46
  private $available_transparent_credit_cart = ['mla', 'mlb', 'mlm', 'mco', 'mlv', 'mlc'];
47
  private $available_transparent_ticket = ['mla', 'mlb', 'mlm'];
48
+ private $_website;
49
 
50
  const LOG_FILE = 'mercadopago.log';
51
 
56
  */
57
  public function checkAndValidData($observer)
58
  {
59
+
60
+ $this->_website = Mage::helper('mercadopago')->getAdminSelectedWebsite();
61
+
62
  $this->validateAccessToken();
63
 
64
  $this->validateClientCredentials();
75
 
76
  public function availableCheckout()
77
  {
78
+ //check if country is available for transparent checkout
79
+ //and disables method if it is not
80
 
81
+ $country = $this->_website->getConfig('payment/mercadopago/country');
82
 
83
  if (!in_array($country, $this->available_transparent_credit_cart)) {
84
+ Mage::getConfig()->saveConfig('payment/mercadopago_custom/active', 0, 'websites', $this->_website->getId());
85
  }
86
 
87
  if (!in_array($country, $this->available_transparent_ticket)) {
88
+ Mage::getConfig()->saveConfig('payment/mercadopago_customticket/active', 0, 'websites', $this->_website->getId());
89
  }
90
  }
91
 
92
+ public function checkBanner($typeCheckout)
93
  {
94
  //get country
95
+ $country = $this->_website->getConfig('payment/mercadopago/country');
96
+ if (!isset($this->banners[$typeCheckout][$country])) {
97
  return;
98
  }
99
+ $defaultBanner = $this->banners[$typeCheckout][$country];
100
 
101
+ $currentBanner = $this->_website->getConfig('payment/' . $typeCheckout . '/banner_checkout');
102
 
103
+ Mage::helper('mercadopago')->log("Type Checkout Path: " . $typeCheckout, self::LOG_FILE);
104
+ Mage::helper('mercadopago')->log("Current Banner: " . $currentBanner, self::LOG_FILE);
105
+ Mage::helper('mercadopago')->log("Default Banner: " . $defaultBanner, self::LOG_FILE);
106
 
107
+ if (in_array($currentBanner, $this->banners[$typeCheckout])) {
108
  Mage::helper('mercadopago')->log("Banner default need update...", self::LOG_FILE);
109
 
110
+ if ($defaultBanner != $currentBanner) {
111
+ Mage::getConfig()->saveConfig('payment/' . $typeCheckout . '/banner_checkout', $defaultBanner, 'websites', $this->_website->getId());
112
 
113
+ Mage::helper('mercadopago')->log('payment/' . $typeCheckout . '/banner_checkout setted ' . $defaultBanner, self::LOG_FILE);
114
  }
115
  }
116
  }
118
 
119
  public function setSponsor()
120
  {
121
+ Mage::helper('mercadopago')->log("Sponsor_id: " . $this->_website->getConfig('payment/mercadopago/sponsor_id'), self::LOG_FILE);
122
 
123
+ $sponsorId = "";
124
  Mage::helper('mercadopago')->log("Valid user test", self::LOG_FILE);
125
 
126
+ $accessToken = $this->_website->getConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
127
+ Mage::helper('mercadopago')->log("Get access_token: " . $accessToken, self::LOG_FILE);
128
 
129
+ $mp = Mage::helper('mercadopago')->getApiInstance($accessToken);
130
  $user = $mp->get("/users/me");
131
  Mage::helper('mercadopago')->log("API Users response", self::LOG_FILE, $user);
132
 
134
 
135
  switch ($user['response']['site_id']) {
136
  case 'MLA':
137
+ $sponsorId = 186172525;
138
  break;
139
  case 'MLB':
140
+ $sponsorId = 186175129;
141
  break;
142
  case 'MLM':
143
+ $sponsorId = 186175064;
144
  break;
145
  case 'MCO':
146
+ $sponsorId = 206959966;
147
  break;
148
  case 'MLC':
149
+ $sponsorId = 206959756;
150
  break;
151
  case 'MLV':
152
+ $sponsorId = 206960619;
153
  break;
154
  default:
155
+ $sponsorId = "";
156
  break;
157
  }
158
 
159
+ Mage::helper('mercadopago')->log("Sponsor id setted", self::LOG_FILE, $sponsorId);
160
  }
161
 
162
+ Mage::getConfig()->saveConfig('payment/mercadopago/sponsor_id', $sponsorId, $this->_website->getId());
163
+ Mage::helper('mercadopago')->log("Sponsor saved", self::LOG_FILE, $sponsorId);
164
  }
165
 
166
  protected function validateAccessToken()
167
  {
168
+ $accessToken = $this->_website->getConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
169
  if (!empty($accessToken)) {
170
  if (!Mage::helper('mercadopago')->isValidAccessToken($accessToken)) {
171
  Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Custom Checkout: Invalid access token'));
175
 
176
  protected function validateClientCredentials()
177
  {
178
+ $clientId = $this->_website->getConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
179
+ $clientSecret = $this->_website->getConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
180
  if (!empty($clientId) && !empty($clientSecret)) {
181
  if (!Mage::helper('mercadopago')->isValidClientCredentials($clientId, $clientSecret)) {
182
  Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Classic Checkout: Invalid client id or client secret'));
app/code/community/MercadoPago/Core/Model/Source/CategoryId.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Source/Country.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Source/Installments.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Source/Order/Status.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Source/PaymentMethods.php CHANGED
@@ -24,12 +24,14 @@ class MercadoPago_Core_Model_Source_PaymentMethods
24
  $methods = array();
25
  $helper = Mage::helper('mercadopago');
26
 
27
- //adiciona um valor vazio caso nao queria excluir nada
28
- $methods[] = array("value" => "", "label" => "");
29
 
30
- $accessToken = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
31
- $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
32
- $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
 
 
33
  if (empty($accessToken) && !$helper->isValidClientCredentials($clientId, $clientSecret)) {
34
  return $methods;
35
  }
@@ -39,9 +41,9 @@ class MercadoPago_Core_Model_Source_PaymentMethods
39
  $accessToken = $helper->getAccessToken();
40
  }
41
 
42
- $helper->log("Get payment methods by country... ", 'mercadopago.log');
43
- $helper->log("API payment methods: " . "/v1/payment_methods?access_token=" . $accessToken, 'mercadopago.log');
44
- $response = MercadoPago_Lib_RestClient::get("/v1/payment_methods?access_token=" . $accessToken);
45
 
46
  $helper->log("API payment methods", 'mercadopago.log', $response);
47
 
24
  $methods = array();
25
  $helper = Mage::helper('mercadopago');
26
 
27
+ //empty value, to include all methods
28
+ $methods[] = ['value' => '', 'label' => ''];
29
 
30
+ $website = $helper->getAdminSelectedWebsite();
31
+
32
+ $accessToken = $website->getConfig(self::XML_PATH_ACCESS_TOKEN);
33
+ $clientId = $website->getConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
34
+ $clientSecret = $website->getConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
35
  if (empty($accessToken) && !$helper->isValidClientCredentials($clientId, $clientSecret)) {
36
  return $methods;
37
  }
41
  $accessToken = $helper->getAccessToken();
42
  }
43
 
44
+ $helper->log('Get payment methods by country... ', 'mercadopago.log');
45
+ $helper->log('API payment methods: ' . '/v1/payment_methods?access_token=' . $accessToken, 'mercadopago.log');
46
+ $response = MercadoPago_Lib_RestClient::get('/sites/'. strtoupper($website->getConfig('payment/mercadopago/country')) .'/payment_methods?marketplace=NONE');
47
 
48
  $helper->log("API payment methods", 'mercadopago.log', $response);
49
 
app/code/community/MercadoPago/Core/Model/Source/TypeCheckout.php CHANGED
File without changes
app/code/community/MercadoPago/Core/Model/Standard/Payment.php CHANGED
@@ -38,21 +38,19 @@ class MercadoPago_Core_Model_Standard_Payment
38
 
39
  public function postPago()
40
  {
41
- //seta sdk php mercadopago
42
  $client_id = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
43
  $client_secret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
44
  $mp = Mage::helper('mercadopago')->getApiInstance($client_id, $client_secret);
45
 
46
- //monta a prefernecia
47
  $pref = $this->makePreference();
48
  Mage::helper('mercadopago')->log("make array", self::LOG_FILE, $pref);
49
 
50
- //faz o posto do pagamento
51
  $response = $mp->create_preference($pref);
52
  Mage::helper('mercadopago')->log("create preference result", self::LOG_FILE, $response);
53
 
54
- $array_assign = [];
55
-
56
  if ($response['status'] == 200 || $response['status'] == 201) {
57
  $payment = $response['response'];
58
  if (Mage::getStoreConfigFlag('payment/mercadopago_standard/sandbox_mode')) {
@@ -61,7 +59,7 @@ class MercadoPago_Core_Model_Standard_Payment
61
  $init_point = $payment['init_point'];
62
  }
63
 
64
- $array_assign = [
65
  "init_point" => $init_point,
66
  "type_checkout" => $this->getConfigData('type_checkout'),
67
  "iframe_width" => $this->getConfigData('iframe_width'),
@@ -72,7 +70,7 @@ class MercadoPago_Core_Model_Standard_Payment
72
 
73
  Mage::helper('mercadopago')->log("Array preference ok", self::LOG_FILE);
74
  } else {
75
- $array_assign = [
76
  "message" => Mage::helper('mercadopago')->__('An error has occurred. Please refresh the page.'),
77
  "json" => json_encode($response),
78
  "status" => 400
@@ -81,12 +79,11 @@ class MercadoPago_Core_Model_Standard_Payment
81
  Mage::helper('mercadopago')->log("Array preference error", self::LOG_FILE);
82
  }
83
 
84
- return $array_assign;
85
  }
86
 
87
  public function getOrderPlaceRedirectUrl()
88
  {
89
- // requisicao vem da pagina de finalizacao de pedido
90
  return Mage::getUrl('mercadopago/pay', ['_secure' => true]);
91
  }
92
 
@@ -136,10 +133,10 @@ class MercadoPago_Core_Model_Standard_Payment
136
  protected function getExcludedPaymentsMethods()
137
  {
138
  $excludedMethods = [];
139
- $excluded_payment_methods = $this->getConfigData('excluded_payment_methods');
140
- $arr_epm = explode(",", $excluded_payment_methods);
141
- if (count($arr_epm) > 0) {
142
- foreach ($arr_epm as $m) {
143
  $excludedMethods[] = ["id" => $m];
144
  }
145
  }
@@ -164,37 +161,37 @@ class MercadoPago_Core_Model_Standard_Payment
164
 
165
  $this->_calculateDiscountAmount($arr['items'], $order);
166
  $this->_calculateBaseTaxAmount($arr['items'], $order);
167
- $total_item = $this->getTotalItems($arr['items']);
168
- $total_item += (float)$order->getBaseShippingAmount();
169
- $order_amount = (float)$order->getBaseGrandTotal();
170
- if (!$order_amount) {
171
- $order_amount = (float)$order->getBasePrice() + $order->getBaseShippingAmount();
172
  }
173
- if ($total_item > $order_amount || $total_item < $order_amount) {
174
- $diff_price = $order_amount - $total_item;
175
  $arr['items'][] = [
176
  "title" => "Difference amount of the items with a total",
177
  "description" => "Difference amount of the items with a total",
178
  "category_id" => Mage::getStoreConfig('payment/mercadopago/category_id'),
179
  "quantity" => 1,
180
- "unit_price" => (float)$diff_price
181
  ];
182
- Mage::helper('mercadopago')->log("Total itens: " . $total_item, self::LOG_FILE);
183
- Mage::helper('mercadopago')->log("Total order: " . $order_amount, self::LOG_FILE);
184
- Mage::helper('mercadopago')->log("Difference add itens: " . $diff_price, self::LOG_FILE);
185
  }
 
 
 
186
 
187
- $shippingAddress = $order->getShippingAddress();
188
- $shipping = $shippingAddress->getData();
189
-
190
- $arr['payer']['phone'] = [
191
- "area_code" => "-",
192
- "number" => $shipping['telephone']
193
- ];
194
-
195
- $arr['shipments'] = $this->_getParamShipment($paramsShipment,$order,$shippingAddress);
196
 
197
- $billing_address = $order->getBillingAddress()->getData();
 
 
198
 
199
  $arr['payer']['date_created'] = date('Y-m-d', $customer->getCreatedAtTimestamp()) . "T" . date('H:i:s', $customer->getCreatedAtTimestamp());
200
  $arr['payer']['email'] = htmlentities($customer->getEmail());
@@ -209,14 +206,15 @@ class MercadoPago_Core_Model_Standard_Payment
209
  }
210
 
211
  $arr['payer']['address'] = [
212
- "zip_code" => $billing_address['postcode'],
213
- "street_name" => $billing_address['street'] . " - " . $billing_address['city'] . " - " . $billing_address['country_id'],
214
  "street_number" => ""
215
  ];
216
 
 
217
  $arr['back_urls'] = [
218
- "success" => Mage::getUrl('mercadopago/success'),
219
- "pending" => Mage::getUrl('mercadopago/success'),
220
  "failure" => Mage::getUrl('checkout/onepage/failure')
221
  ];
222
 
@@ -226,16 +224,16 @@ class MercadoPago_Core_Model_Standard_Payment
226
  $installments = $this->getConfigData('installments');
227
  $arr['payment_methods']['installments'] = (int)$installments;
228
 
229
- $auto_return = $this->getConfigData('auto_return');
230
- if ($auto_return == 1) {
231
  $arr['auto_return'] = "approved";
232
  }
233
 
234
- $sponsor_id = Mage::getStoreConfig('payment/mercadopago/sponsor_id');
235
- Mage::helper('mercadopago')->log("Sponsor_id", self::LOG_FILE, $sponsor_id);
236
- if (!empty($sponsor_id)) {
237
- Mage::helper('mercadopago')->log("Sponsor_id identificado", self::LOG_FILE, $sponsor_id);
238
- $arr['sponsor_id'] = (int)$sponsor_id;
239
  }
240
 
241
  return $arr;
@@ -252,21 +250,17 @@ class MercadoPago_Core_Model_Standard_Payment
252
  ];
253
  }
254
 
255
- protected function _getParamShipment($params,$order,$shippingAddress) {
256
  $paramsShipment = $params->getValues();
257
  if (empty($paramsShipment)) {
258
  $paramsShipment = $params->getData();
259
  $paramsShipment['cost'] = (float)$order->getBaseShippingAmount();
 
260
  }
261
  $paramsShipment['receiver_address'] = $this->getReceiverAddress($shippingAddress);
262
  return $paramsShipment;
263
  }
264
 
265
- public function getSuccessBlockType()
266
- {
267
- return $this->_successBlockType;
268
- }
269
-
270
  /**
271
  * Check whether payment method can be used
272
  *
38
 
39
  public function postPago()
40
  {
41
+ //get mercadopago api instance
42
  $client_id = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
43
  $client_secret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
44
  $mp = Mage::helper('mercadopago')->getApiInstance($client_id, $client_secret);
45
 
46
+ //create preference
47
  $pref = $this->makePreference();
48
  Mage::helper('mercadopago')->log("make array", self::LOG_FILE, $pref);
49
 
50
+ //make payment request
51
  $response = $mp->create_preference($pref);
52
  Mage::helper('mercadopago')->log("create preference result", self::LOG_FILE, $response);
53
 
 
 
54
  if ($response['status'] == 200 || $response['status'] == 201) {
55
  $payment = $response['response'];
56
  if (Mage::getStoreConfigFlag('payment/mercadopago_standard/sandbox_mode')) {
59
  $init_point = $payment['init_point'];
60
  }
61
 
62
+ $arrayAssign = [
63
  "init_point" => $init_point,
64
  "type_checkout" => $this->getConfigData('type_checkout'),
65
  "iframe_width" => $this->getConfigData('iframe_width'),
70
 
71
  Mage::helper('mercadopago')->log("Array preference ok", self::LOG_FILE);
72
  } else {
73
+ $arrayAssign = [
74
  "message" => Mage::helper('mercadopago')->__('An error has occurred. Please refresh the page.'),
75
  "json" => json_encode($response),
76
  "status" => 400
79
  Mage::helper('mercadopago')->log("Array preference error", self::LOG_FILE);
80
  }
81
 
82
+ return $arrayAssign;
83
  }
84
 
85
  public function getOrderPlaceRedirectUrl()
86
  {
 
87
  return Mage::getUrl('mercadopago/pay', ['_secure' => true]);
88
  }
89
 
133
  protected function getExcludedPaymentsMethods()
134
  {
135
  $excludedMethods = [];
136
+ $excludedPaymentMethods = $this->getConfigData('excluded_payment_methods');
137
+ $arrEpm = explode(",", $excludedPaymentMethods);
138
+ if (count($arrEpm) > 0) {
139
+ foreach ($arrEpm as $m) {
140
  $excludedMethods[] = ["id" => $m];
141
  }
142
  }
161
 
162
  $this->_calculateDiscountAmount($arr['items'], $order);
163
  $this->_calculateBaseTaxAmount($arr['items'], $order);
164
+ $totalItem = $this->getTotalItems($arr['items']);
165
+ $totalItem += (float)$order->getBaseShippingAmount();
166
+ $orderAmount = (float)$order->getBaseGrandTotal();
167
+ if (!$orderAmount) {
168
+ $orderAmount = (float)$order->getBasePrice() + $order->getBaseShippingAmount();
169
  }
170
+ if ($totalItem > $orderAmount || $totalItem < $orderAmount) {
171
+ $diffPrice = $orderAmount - $totalItem;
172
  $arr['items'][] = [
173
  "title" => "Difference amount of the items with a total",
174
  "description" => "Difference amount of the items with a total",
175
  "category_id" => Mage::getStoreConfig('payment/mercadopago/category_id'),
176
  "quantity" => 1,
177
+ "unit_price" => (float)$diffPrice
178
  ];
179
+ Mage::helper('mercadopago')->log("Total itens: " . $totalItem, self::LOG_FILE);
180
+ Mage::helper('mercadopago')->log("Total order: " . $orderAmount, self::LOG_FILE);
181
+ Mage::helper('mercadopago')->log("Difference add itens: " . $diffPrice, self::LOG_FILE);
182
  }
183
+ if ($order->canShip()) {
184
+ $shippingAddress = $order->getShippingAddress();
185
+ $shipping = $shippingAddress->getData();
186
 
187
+ $arr['payer']['phone'] = [
188
+ "area_code" => "-",
189
+ "number" => $shipping['telephone']
190
+ ];
 
 
 
 
 
191
 
192
+ $arr['shipments'] = $this->_getParamShipment($paramsShipment, $order, $shippingAddress);
193
+ }
194
+ $billingAddress = $order->getBillingAddress()->getData();
195
 
196
  $arr['payer']['date_created'] = date('Y-m-d', $customer->getCreatedAtTimestamp()) . "T" . date('H:i:s', $customer->getCreatedAtTimestamp());
197
  $arr['payer']['email'] = htmlentities($customer->getEmail());
206
  }
207
 
208
  $arr['payer']['address'] = [
209
+ "zip_code" => $billingAddress['postcode'],
210
+ "street_name" => $billingAddress['street'] . " - " . $billingAddress['city'] . " - " . $billingAddress['country_id'],
211
  "street_number" => ""
212
  ];
213
 
214
+ $url = 'mercadopago/success';
215
  $arr['back_urls'] = [
216
+ "success" => Mage::getUrl($url),
217
+ "pending" => Mage::getUrl($url),
218
  "failure" => Mage::getUrl('checkout/onepage/failure')
219
  ];
220
 
224
  $installments = $this->getConfigData('installments');
225
  $arr['payment_methods']['installments'] = (int)$installments;
226
 
227
+ $autoReturn = $this->getConfigData('auto_return');
228
+ if ($autoReturn == 1) {
229
  $arr['auto_return'] = "approved";
230
  }
231
 
232
+ $sponsorId = Mage::getStoreConfig('payment/mercadopago/sponsor_id');
233
+ Mage::helper('mercadopago')->log("Sponsor_id", self::LOG_FILE, $sponsorId);
234
+ if (!empty($sponsorId)) {
235
+ Mage::helper('mercadopago')->log("Sponsor_id identificado", self::LOG_FILE, $sponsorId);
236
+ $arr['sponsor_id'] = (int)$sponsorId;
237
  }
238
 
239
  return $arr;
250
  ];
251
  }
252
 
253
+ protected function _getParamShipment($params, $order, $shippingAddress) {
254
  $paramsShipment = $params->getValues();
255
  if (empty($paramsShipment)) {
256
  $paramsShipment = $params->getData();
257
  $paramsShipment['cost'] = (float)$order->getBaseShippingAmount();
258
+ $paramsShipment['mode'] = 'custom';
259
  }
260
  $paramsShipment['receiver_address'] = $this->getReceiverAddress($shippingAddress);
261
  return $paramsShipment;
262
  }
263
 
 
 
 
 
 
264
  /**
265
  * Check whether payment method can be used
266
  *
app/code/community/MercadoPago/Core/controllers/ApiController.php CHANGED
File without changes
app/code/community/MercadoPago/Core/controllers/NotificationsController.php CHANGED
@@ -23,97 +23,193 @@ class MercadoPago_Core_NotificationsController
23
  protected $_mpcartid = null;
24
  protected $_sendemail = false;
25
  protected $_hash = null;
 
 
26
 
27
  const LOG_FILE = 'mercadopago-notification.log';
28
 
29
  protected function _getDataPayments($merchantOrder)
30
  {
31
- $data = array();
32
  $core = Mage::getModel('mercadopago/core');
 
33
  foreach ($merchantOrder['payments'] as $payment) {
34
- $response = $core->getPayment($payment['id']);
35
- $payment = $response['response']['collection'];
36
- $data = $this->formatArrayPayment($data, $payment);
37
  }
38
 
39
  return $data;
40
  }
41
 
42
- protected function getStatusFinal($dataStatus)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  {
44
- $status_final = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  $statuses = explode('|', $dataStatus);
46
  foreach ($statuses as $status) {
47
  $status = str_replace(' ', '', $status);
48
- if ($status_final == "") {
49
- $status_final = $status;
50
- } else {
51
- if ($status_final != $status) {
52
- $status_final = false;
53
- }
54
  }
55
  }
56
 
57
- return $status_final;
 
 
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  public function standardAction()
62
  {
63
  $request = $this->getRequest();
64
  //notification received
65
- Mage::helper('mercadopago')->log("Standard Received notification", self::LOG_FILE, $request->getParams());
66
-
 
 
67
  $core = Mage::getModel('mercadopago/core');
68
 
69
  $id = $request->getParam('id');
70
  $topic = $request->getParam('topic');
 
 
 
 
 
 
 
71
 
72
- if (!empty($id) && $topic == 'merchant_order') {
73
  $response = $core->getMerchantOrder($id);
74
- Mage::helper('mercadopago')->log("Return merchant_order", self::LOG_FILE, $response);
75
- if ($response['status'] == 200 || $response['status'] == 201) {
76
- $merchant_order = $response['response'];
77
-
78
- if (count($merchant_order['payments']) > 0) {
79
- $data = $this->_getDataPayments($merchant_order);
80
- $status_final = $this->getStatusFinal($data['status']);
81
- $shipmentData = (isset($merchant_order['shipments'][0])) ? $merchant_order['shipments'][0] : [];
82
- Mage::helper('mercadopago')->log("Update Order", self::LOG_FILE);
83
- $core->updateOrder($data);
84
- if(!empty($shipmentData)) {
85
- Mage::dispatchEvent('mercadopago_standard_notification_before_set_status',
86
- array('shipmentData' => $shipmentData,
87
- 'orderId' => $merchant_order['external_reference'])
88
- );
89
- }
90
- if ($status_final != false) {
91
- $data['status_final'] = $status_final;
92
- Mage::helper('mercadopago')->log("Received Payment data", self::LOG_FILE, $data);
93
- $setStatusResponse = $core->setStatusOrder($data);
94
- $this->getResponse()->setBody($setStatusResponse['text']);
95
- $this->getResponse()->setHttpResponseCode($setStatusResponse['code']);
96
- } else {
97
- $this->getResponse()->setBody("Status not final");
98
- $this->getResponse()->setHttpResponseCode(MercadoPago_Core_Helper_Response::HTTP_OK);
99
- }
100
-
101
- Mage::dispatchEvent('mercadopago_standard_notification_received',
102
- array('payment' => $data,
103
- 'merchant_order' => $merchant_order)
104
- );
105
-
106
- Mage::helper('mercadopago')->log("Http code", self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
107
- return;
108
- }
109
  }
 
 
 
 
 
 
 
 
 
 
 
 
110
  } else {
111
- Mage::helper('mercadopago')->log("Merchant Order not found", self::LOG_FILE, $request->getParams());
112
- $this->getResponse()->setBody("Merchant Order not found");
113
- $this->getResponse()->setHttpResponseCode(MercadoPago_Core_Helper_Response::HTTP_NOT_FOUND);
114
  }
115
 
116
- Mage::helper('mercadopago')->log("Http code", self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  public function customAction()
@@ -135,11 +231,13 @@ class MercadoPago_Core_NotificationsController
135
  $payment = Mage::helper('mercadopago')->setPayerInfo($payment);
136
 
137
  Mage::helper('mercadopago')->log("Update Order", self::LOG_FILE);
 
138
  $core->updateOrder($payment);
139
  $setStatusResponse = $core->setStatusOrder($payment);
140
  $this->getResponse()->setBody($setStatusResponse['text']);
141
  $this->getResponse()->setHttpResponseCode($setStatusResponse['code']);
142
  Mage::helper('mercadopago')->log("Http code", self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
 
143
  return;
144
  }
145
  }
@@ -164,6 +262,7 @@ class MercadoPago_Core_NotificationsController
164
  "coupon_amount",
165
  "installments",
166
  "shipping_cost",
 
167
  );
168
 
169
  foreach ($fields as $field) {
23
  protected $_mpcartid = null;
24
  protected $_sendemail = false;
25
  protected $_hash = null;
26
+ protected $_finalStatus = ['rejected', 'cancelled', 'refunded', 'charge_back'];
27
+ protected $_notFinalStatus = ['authorized', 'process', 'in_mediation'];
28
 
29
  const LOG_FILE = 'mercadopago-notification.log';
30
 
31
  protected function _getDataPayments($merchantOrder)
32
  {
 
33
  $core = Mage::getModel('mercadopago/core');
34
+ $data = array();
35
  foreach ($merchantOrder['payments'] as $payment) {
36
+ $data = $this->_getFormattedPaymentData($payment['id'], $core, $data);
 
 
37
  }
38
 
39
  return $data;
40
  }
41
 
42
+ protected function _getFormattedPaymentData($paymentId, $core, $data = [])
43
+ {
44
+ $response = $core->getPayment($paymentId);
45
+ $payment = $response['response']['collection'];
46
+
47
+ return $this->formatArrayPayment($data, $payment);
48
+ }
49
+
50
+ protected function _dateCompare($a, $b)
51
+ {
52
+ $t1 = strtotime($a['value']);
53
+ $t2 = strtotime($b['value']);
54
+
55
+ return $t2 - $t1;
56
+ }
57
+
58
+ /**
59
+ * @param $payments
60
+ * @param $status
61
+ *
62
+ * @return int
63
+ */
64
+ protected function _getLastPaymentIndex($payments, $status)
65
  {
66
+ $dates = [];
67
+ foreach ($payments as $key => $payment) {
68
+ if (in_array($payment['status'], $status)) {
69
+ $dates[] = ['key' => $key, 'value' => $payment['last_modified']];
70
+ }
71
+ }
72
+ usort($dates, array(get_class($this), "_dateCompare"));
73
+ if ($dates) {
74
+ $lastModified = array_pop($dates);
75
+
76
+ return $lastModified['key'];
77
+ }
78
+
79
+ return 0;
80
+ }
81
+
82
+ /**
83
+ * Returns status that must be set to order, if a not final status exists
84
+ * then the last of this statuses is returned. Else the last of final statuses
85
+ * is returned
86
+ *
87
+ * @param $dataStatus
88
+ * @param $merchantOrder
89
+ *
90
+ * @return string
91
+ */
92
+ protected function getStatusFinal($dataStatus, $merchantOrder)
93
+ {
94
+ if ($merchantOrder['total_amount'] == $merchantOrder['paid_amount']) {
95
+ return 'approved';
96
+ }
97
+ $payments = $merchantOrder['payments'];
98
  $statuses = explode('|', $dataStatus);
99
  foreach ($statuses as $status) {
100
  $status = str_replace(' ', '', $status);
101
+ if (in_array($status, $this->_notFinalStatus)) {
102
+ $lastPaymentIndex = $this->_getLastPaymentIndex($payments, $this->_notFinalStatus);
103
+
104
+ return $payments[$lastPaymentIndex]['status'];
 
 
105
  }
106
  }
107
 
108
+ $lastPaymentIndex = $this->_getLastPaymentIndex($payments, $this->_finalStatus);
109
+
110
+ return $payments[$lastPaymentIndex]['status'];
111
  }
112
 
113
+ protected function _responseLog($helper)
114
+ {
115
+ $helper->log("Http code", self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
116
+ }
117
+
118
+ protected function _shipmentExists($shipmentData, $merchantOrder)
119
+ {
120
+ return (!empty($shipmentData) && !empty($merchantOrder));
121
+ }
122
+
123
+ protected function _getShipmentsArray($merchantOrder)
124
+ {
125
+ return (isset($merchantOrder['shipments'][0])) ? $merchantOrder['shipments'][0] : [];
126
+ }
127
+
128
+ protected function _isValidResponse($response)
129
+ {
130
+ return ($response['status'] == 200 || $response['status'] == 201);
131
+ }
132
+
133
+ protected function _emptyParams($p1, $p2)
134
+ {
135
+ return (empty($p1) || empty($p2));
136
+ }
137
 
138
  public function standardAction()
139
  {
140
  $request = $this->getRequest();
141
  //notification received
142
+ $helper = Mage::helper('mercadopago');
143
+ $shipmentData = '';
144
+ $merchantOrder = '';
145
+ $helper->log("Standard Received notification", self::LOG_FILE, $request->getParams());
146
  $core = Mage::getModel('mercadopago/core');
147
 
148
  $id = $request->getParam('id');
149
  $topic = $request->getParam('topic');
150
+ if ($this->_emptyParams($id, $topic)) {
151
+ $helper->log("Merchant Order not found", self::LOG_FILE, $request->getParams());
152
+ $this->getResponse()->setBody("Merchant Order not found");
153
+ $this->getResponse()->setHttpResponseCode(MercadoPago_Core_Helper_Response::HTTP_NOT_FOUND);
154
+
155
+ return;
156
+ }
157
 
158
+ if ($topic == 'merchant_order') {
159
  $response = $core->getMerchantOrder($id);
160
+ $helper->log("Return merchant_order", self::LOG_FILE, $response);
161
+ if (!$this->_isValidResponse($response)) {
162
+ $this->_responseLog($helper);
163
+
164
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
166
+ $merchantOrder = $response['response'];
167
+ if (count($merchantOrder['payments']) == 0) {
168
+ $this->_responseLog($helper);
169
+
170
+ return;
171
+ }
172
+ $data = $this->_getDataPayments($merchantOrder);
173
+ $statusFinal = $this->getStatusFinal($data['status'], $merchantOrder);
174
+ $shipmentData = $this->_getShipmentsArray($merchantOrder);
175
+ } elseif ($topic == 'payment') {
176
+ $data = $this->_getFormattedPaymentData($id, $core);
177
+ $statusFinal = $data['status'];
178
  } else {
179
+ $this->_responseLog($helper);
180
+
181
+ return;
182
  }
183
 
184
+ $helper->log("Update Order", self::LOG_FILE);
185
+ $helper->setStatusUpdated($data);
186
+ $core->updateOrder($data);
187
+ if ($this->_shipmentExists($shipmentData, $merchantOrder)) {
188
+ Mage::dispatchEvent('mercadopago_standard_notification_before_set_status',
189
+ array('shipmentData' => $shipmentData,
190
+ 'orderId' => $merchantOrder['external_reference'])
191
+ );
192
+ }
193
+ if ($statusFinal != false) {
194
+ $data['status_final'] = $statusFinal;
195
+ $helper->log("Received Payment data", self::LOG_FILE, $data);
196
+ $setStatusResponse = $core->setStatusOrder($data);
197
+ $this->getResponse()->setBody($setStatusResponse['text']);
198
+ $this->getResponse()->setHttpResponseCode($setStatusResponse['code']);
199
+ } else {
200
+ $this->getResponse()->setBody("Status not final");
201
+ $this->getResponse()->setHttpResponseCode(MercadoPago_Core_Helper_Response::HTTP_OK);
202
+ }
203
+
204
+ if ($this->_shipmentExists($shipmentData, $merchantOrder)) {
205
+ Mage::dispatchEvent('mercadopago_standard_notification_received',
206
+ array('payment' => $data,
207
+ 'merchant_order' => $merchantOrder)
208
+ );
209
+ }
210
+
211
+
212
+ $this->_responseLog($helper);
213
  }
214
 
215
  public function customAction()
231
  $payment = Mage::helper('mercadopago')->setPayerInfo($payment);
232
 
233
  Mage::helper('mercadopago')->log("Update Order", self::LOG_FILE);
234
+ Mage::helper('mercadopago')->setStatusUpdated($payment);
235
  $core->updateOrder($payment);
236
  $setStatusResponse = $core->setStatusOrder($payment);
237
  $this->getResponse()->setBody($setStatusResponse['text']);
238
  $this->getResponse()->setHttpResponseCode($setStatusResponse['code']);
239
  Mage::helper('mercadopago')->log("Http code", self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
240
+
241
  return;
242
  }
243
  }
262
  "coupon_amount",
263
  "installments",
264
  "shipping_cost",
265
+ "amount_refunded",
266
  );
267
 
268
  foreach ($fields as $field) {
app/code/community/MercadoPago/Core/controllers/PayController.php CHANGED
File without changes
app/code/community/MercadoPago/Core/controllers/SuccessController.php CHANGED
@@ -25,13 +25,17 @@ class MercadoPago_Core_SuccessController
25
  return $this->_order;
26
  }
27
 
 
 
 
 
28
  /**
29
  * Send email of new order
30
  */
31
  protected function sendNewOrderMail()
32
  {
33
  $order = $this->getOrder();
34
- if ($order->getCanSendNewEmailFlag()) {
35
  try {
36
  $order->sendNewOrderEmail();
37
  } catch (Exception $e) {
@@ -57,6 +61,11 @@ class MercadoPago_Core_SuccessController
57
  public function indexAction()
58
  {
59
  $this->sendNewOrderMail();
 
 
 
 
 
60
  $checkoutTypeHandle = $this->getCheckoutHandle();
61
  $this->loadLayout(['default', $checkoutTypeHandle]);
62
 
25
  return $this->_order;
26
  }
27
 
28
+ protected function _getQuoteId() {
29
+ return Mage::getSingleton('checkout/type_onepage')->getCheckout()->getLastQuoteId();
30
+ }
31
+
32
  /**
33
  * Send email of new order
34
  */
35
  protected function sendNewOrderMail()
36
  {
37
  $order = $this->getOrder();
38
+ if ($order->getCanSendNewEmailFlag() && !$order->getEmailSent()) {
39
  try {
40
  $order->sendNewOrderEmail();
41
  } catch (Exception $e) {
61
  public function indexAction()
62
  {
63
  $this->sendNewOrderMail();
64
+ if (!Mage::getStoreConfig('payment/mercadopago/use_successpage_mp')) {
65
+ Mage::getSingleton('checkout/type_onepage')->getCheckout()->setLastSuccessQuoteId($this->_getQuoteId());
66
+ $this->_redirect('checkout/onepage/success',$this->_request->getParams());
67
+ return;
68
+ }
69
  $checkoutTypeHandle = $this->getCheckoutHandle();
70
  $this->loadLayout(['default', $checkoutTypeHandle]);
71
 
app/code/community/MercadoPago/Core/etc/config.xml CHANGED
@@ -18,7 +18,7 @@
18
  <config>
19
  <modules>
20
  <MercadoPago_Core>
21
- <version>2.1.5</version>
22
  </MercadoPago_Core>
23
  </modules>
24
 
@@ -154,9 +154,7 @@
154
  </updates>
155
  </layout>
156
  </adminhtml>
157
-
158
-
159
-
160
  <default>
161
  <payment>
162
  <mercadopago>
@@ -168,6 +166,7 @@
168
  <order_status_rejected>pending</order_status_rejected>
169
  <order_status_cancelled>pending</order_status_cancelled>
170
  <order_status_chargeback>pending</order_status_chargeback>
 
171
  <logs>0</logs>
172
  <debug_mode>0</debug_mode>
173
  </mercadopago>
18
  <config>
19
  <modules>
20
  <MercadoPago_Core>
21
+ <version>2.2.0</version>
22
  </MercadoPago_Core>
23
  </modules>
24
 
154
  </updates>
155
  </layout>
156
  </adminhtml>
157
+
 
 
158
  <default>
159
  <payment>
160
  <mercadopago>
166
  <order_status_rejected>pending</order_status_rejected>
167
  <order_status_cancelled>pending</order_status_cancelled>
168
  <order_status_chargeback>pending</order_status_chargeback>
169
+ <use_successpage_mp>1</use_successpage_mp>
170
  <logs>0</logs>
171
  <debug_mode>0</debug_mode>
172
  </mercadopago>
app/code/community/MercadoPago/Core/etc/system.xml CHANGED
@@ -116,6 +116,16 @@
116
  <show_in_website>1</show_in_website>
117
  <show_in_store>1</show_in_store>
118
  </order_status_chargeback>
 
 
 
 
 
 
 
 
 
 
119
  <logs translate="label">
120
  <label>Logs</label>
121
  <frontend_type>select</frontend_type>
@@ -181,7 +191,7 @@
181
  <show_in_store>1</show_in_store>
182
  <sort_order>20</sort_order>
183
  <fields>
184
- <active translate="label">
185
  <label>Enabled</label>
186
  <frontend_type>select</frontend_type>
187
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -189,6 +199,12 @@
189
  <show_in_default>1</show_in_default>
190
  <show_in_website>1</show_in_website>
191
  <show_in_store>0</show_in_store>
 
 
 
 
 
 
192
  </active>
193
  <title translate="label">
194
  <label>Payment Title</label>
116
  <show_in_website>1</show_in_website>
117
  <show_in_store>1</show_in_store>
118
  </order_status_chargeback>
119
+ <use_successpage_mp translate="label comment">
120
+ <label>Use Mercado Pago success page</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ <sort_order>135</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>0</show_in_store>
127
+ <comment>If set this config with NO, magento success page will be used</comment>
128
+ </use_successpage_mp>
129
  <logs translate="label">
130
  <label>Logs</label>
131
  <frontend_type>select</frontend_type>
191
  <show_in_store>1</show_in_store>
192
  <sort_order>20</sort_order>
193
  <fields>
194
+ <active translate="label comment">
195
  <label>Enabled</label>
196
  <frontend_type>select</frontend_type>
197
  <source_model>adminhtml/system_config_source_yesno</source_model>
199
  <show_in_default>1</show_in_default>
200
  <show_in_website>1</show_in_website>
201
  <show_in_store>0</show_in_store>
202
+ <comment>
203
+ <![CDATA[It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
204
+ During the sandbox mode tests, you can operate over HTTP,
205
+ but for homologation you'll need to acquire the certificate in case you don't have it.
206
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>]]>
207
+ </comment>
208
  </active>
209
  <title translate="label">
210
  <label>Payment Title</label>
app/code/community/MercadoPago/Core/sql/mercadopago_setup/install-2.1.0.php CHANGED
File without changes
app/code/community/MercadoPago/Core/sql/mercadopago_setup/upgrade-2.1.0-2.1.1.php CHANGED
File without changes
app/code/community/MercadoPago/Core/sql/mercadopago_setup/upgrade-2.1.1-2.1.2.php CHANGED
File without changes
app/code/community/MercadoPago/MercadoEnvios/Block/Adminhtml/System/Config/Fieldset/Carrier.php CHANGED
File without changes
app/code/community/MercadoPago/MercadoEnvios/Block/Adminhtml/System/Config/Fieldset/Mapping.php CHANGED
File without changes
app/code/community/MercadoPago/MercadoEnvios/Helper/CarrierData.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_MercadoEnvios_Helper_CarrierData
4
+ extends Mage_Core_Helper_Abstract
5
+ {
6
+
7
+ const XML_PATH_ATTRIBUTES_MAPPING = 'carriers/mercadoenvios/attributesmapping';
8
+ const ME_LENGTH_UNIT = 'cm';
9
+ const ME_WEIGHT_UNIT = 'gr';
10
+
11
+ protected $_products = [];
12
+ protected $_mapping;
13
+
14
+ protected $_maxWeight = ['mla' => '25000', 'mlb' => '30000', 'mlm' => ''];
15
+ protected $_individualDimensions = ['height' => ['mla' => ['min' => '0', 'max' => '70'], 'mlb' => ['min' => '2', 'max' => '105'], 'mlm' => ['min' => '0', 'max' => '80']],
16
+ 'width' => ['mla' => ['min' => '0', 'max' => '70'], 'mlb' => ['min' => '11', 'max' => '105'], 'mlm' => ['min' => '0', 'max' => '80']],
17
+ 'length' => ['mla' => ['min' => '0', 'max' => '70'], 'mlb' => ['min' => '16', 'max' => '105'], 'mlm' => ['min' => '0', 'max' => '120']],
18
+ 'weight' => ['mla' => ['min' => '0', 'max' => '25000'], 'mlb' => ['min' => '0', 'max' => '30000'], 'mlm' => ['min' => '0', 'max' => '70000']],
19
+ ];
20
+ protected $_globalMaxDimensions = ['mla' => '210',
21
+ 'mlb' => '200',
22
+ 'mlm' => '347',
23
+ ];
24
+
25
+
26
+ /**
27
+ * @param $item Mage_Sales_Model_Quote_Item
28
+ */
29
+ public function _getShippingDimension($item, $type)
30
+ {
31
+ $attributeMapped = $this->_getConfigAttributeMapped($type);
32
+ if (empty($attributeMapped)) {
33
+ $helper = Mage::helper('mercadopago_mercadoenvios');
34
+ $helper->log('Invalid attributes mapping: PRODUCT ', $item->getData());
35
+ Mage::throwException('Invalid attributes mapping');
36
+ }
37
+ if (!isset($this->_products[$item->getProductId()])) {
38
+ $this->_products[$item->getProductId()] = Mage::getModel('catalog/product')->load($item->getProductId());
39
+ }
40
+ $product = $this->_products[$item->getProductId()];
41
+ $result = $product->getData($attributeMapped);
42
+ $result = $this->getAttributesMappingUnitConversion($type, $result);
43
+ $this->validateProductDimension($result, $type, $item);
44
+
45
+ return $result;
46
+ }
47
+
48
+ protected function validateProductDimension($dimension, $type, $item)
49
+ {
50
+ $helper = Mage::helper('mercadopago_mercadoenvios');
51
+ $country = Mage::getStoreConfig('payment/mercadopago/country');
52
+ if ((!ceil($dimension) > 0) or ($dimension > $this->_individualDimensions[$type][$country]['max']) or ($dimension < $this->_individualDimensions[$type][$country]['min'])) {
53
+ $helper->log('Invalid dimension product: PRODUCT ', $item->getData());
54
+ Mage::throwException('Invalid dimensions product');
55
+ }
56
+ }
57
+
58
+ public function validateCartDimension($height, $width, $length, $weight)
59
+ {
60
+ $country = Mage::getStoreConfig('payment/mercadopago/country');
61
+ if (!isset($this->_globalMaxDimensions[$country])) {
62
+ return;
63
+ }
64
+ $helper = Mage::helper('mercadopago_mercadoenvios');
65
+ if (($height + $width + $length) > $this->_globalMaxDimensions[$country]) {
66
+ $helper->log('Invalid dimensions in cart:', ['width' => $width, 'height' => $height, 'length' => $length, 'weight' => $weight,]);
67
+ Mage::register('mercadoenvios_msg', $this->__('Package exceed maximum dimensions'));
68
+ Mage::throwException('Invalid dimensions cart');
69
+ }
70
+ }
71
+
72
+ protected function _getConfigAttributeMapped($type)
73
+ {
74
+ return (isset($this->getAttributeMapping()[$type]['code'])) ? $this->getAttributeMapping()[$type]['code'] : null;
75
+ }
76
+
77
+ public function getAttributeMapping()
78
+ {
79
+ if (empty($this->_mapping)) {
80
+ $mapping = Mage::getStoreConfig(self::XML_PATH_ATTRIBUTES_MAPPING);
81
+ $mapping = unserialize($mapping);
82
+ $mappingResult = [];
83
+ foreach ($mapping as $key => $map) {
84
+ $mappingResult[$key] = ['code' => $map['attribute_code'], 'unit' => $map['unit']];
85
+ }
86
+ $this->_mapping = $mappingResult;
87
+ }
88
+
89
+ return $this->_mapping;
90
+ }
91
+
92
+ /**
93
+ * @param $attributeType string
94
+ * @param $value string
95
+ *
96
+ * @return string
97
+ */
98
+ public function getAttributesMappingUnitConversion($attributeType, $value)
99
+ {
100
+ $this->_getConfigAttributeMapped($attributeType);
101
+
102
+ if ($attributeType == 'weight') {
103
+ //check if needs conversion
104
+ if ($this->_mapping[$attributeType]['unit'] != self::ME_WEIGHT_UNIT) {
105
+ $unit = new Zend_Measure_Weight((float)$value);
106
+ $unit->convertTo(Zend_Measure_Weight::GRAM);
107
+
108
+ return $unit->getValue();
109
+ }
110
+
111
+ } elseif ($this->_mapping[$attributeType]['unit'] != self::ME_LENGTH_UNIT) {
112
+ $unit = new Zend_Measure_Length((float)$value);
113
+ $unit->convertTo(Zend_Measure_Length::CENTIMETER);
114
+
115
+ return $unit->getValue();
116
+ }
117
+
118
+ return $value;
119
+ }
120
+ }
app/code/community/MercadoPago/MercadoEnvios/Helper/Data.php CHANGED
@@ -16,6 +16,7 @@ class MercadoPago_MercadoEnvios_Helper_Data
16
 
17
  public static $enabled_methods = ['mla', 'mlb', 'mlm'];
18
 
 
19
  /**
20
  * @param $quote Mage_Sales_Model_Quote
21
  */
@@ -25,75 +26,33 @@ class MercadoPago_MercadoEnvios_Helper_Data
25
  $height = 0;
26
  $length = 0;
27
  $weight = 0;
 
28
  $helperItem = Mage::helper('mercadopago_mercadoenvios/itemData');
 
29
  foreach ($items as $item) {
30
- if (!$helperItem->itemHasChildren($item)) {
31
- $width += $this->_getShippingDimension($item, 'width');
32
- $height += $this->_getShippingDimension($item, 'height');
33
- $length += $this->_getShippingDimension($item, 'length');
34
- $weight += $this->_getShippingDimension($item, 'weight');
35
- }
 
 
 
 
36
  }
37
  $height = ceil($height);
38
  $width = ceil($width);
39
  $length = ceil($length);
40
  $weight = ceil($weight);
41
 
42
- if (!($height > 0 && $length > 0 && $width > 0 && $weight > 0)) {
43
- $this->log('Invalid dimensions in cart:', ['width'=>$width,'height'=>$height,'length'=>$length,'weight'=>$weight,]);
44
- Mage::throwException('Invalid dimensions cart');
45
- }
46
 
47
- return $height . 'x' . $width . 'x' . $length . ',' . $weight;
48
 
49
  }
50
 
51
- /**
52
- * @param $item Mage_Sales_Model_Quote_Item
53
- */
54
- protected function _getShippingDimension($item, $type)
55
- {
56
- $attributeMapped = $this->_getConfigAttributeMapped($type);
57
- if (!empty($attributeMapped)) {
58
- if (!isset($this->_products[$item->getProductId()])) {
59
- $this->_products[$item->getProductId()] = Mage::getModel('catalog/product')->load($item->getProductId());
60
- }
61
- $product = $this->_products[$item->getProductId()];
62
- $helperItem = Mage::helper('mercadopago_mercadoenvios/itemData');
63
- $result = $product->getData($attributeMapped);
64
- $result = $this->getAttributesMappingUnitConversion($type, $result);
65
- $qty = $helperItem->itemGetQty($item);
66
- $result = $result * $qty;
67
- if (empty($result)) {
68
- $this->log('Invalid dimension product: PRODUCT ', $item->getData());
69
- Mage::throwException('Invalid dimensions product');
70
- }
71
-
72
- return $result;
73
- }
74
-
75
- return 0;
76
- }
77
-
78
- protected function _getConfigAttributeMapped($type)
79
- {
80
- return (isset($this->getAttributeMapping()[$type]['code'])) ? $this->getAttributeMapping()[$type]['code'] : null;
81
- }
82
-
83
- public function getAttributeMapping()
84
- {
85
- if (empty($this->_mapping)) {
86
- $mapping = Mage::getStoreConfig(self::XML_PATH_ATTRIBUTES_MAPPING);
87
- $mapping = unserialize($mapping);
88
- $mappingResult = [];
89
- foreach ($mapping as $key => $map) {
90
- $mappingResult[$key] = ['code' => $map['attribute_code'], 'unit' => $map['unit']];
91
- }
92
- $this->_mapping = $mappingResult;
93
- }
94
-
95
- return $this->_mapping;
96
- }
97
 
98
  /**
99
  * @return Mage_Sales_Model_Quote
@@ -116,34 +75,7 @@ class MercadoPago_MercadoEnvios_Helper_Data
116
  return ($shippingMethod == MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios::CODE);
117
  }
118
 
119
- /**
120
- * @param $attributeType string
121
- * @param $value string
122
- *
123
- * @return string
124
- */
125
- public function getAttributesMappingUnitConversion($attributeType, $value)
126
- {
127
- $this->_getConfigAttributeMapped($attributeType);
128
-
129
- if ($attributeType == 'weight') {
130
- //check if needs conversion
131
- if ($this->_mapping[$attributeType]['unit'] != self::ME_WEIGHT_UNIT) {
132
- $unit = new Zend_Measure_Weight((float)$value);
133
- $unit->convertTo(Zend_Measure_Weight::GRAM);
134
-
135
- return $unit->getValue();
136
- }
137
-
138
- } elseif ($this->_mapping[$attributeType]['unit'] != self::ME_LENGTH_UNIT) {
139
- $unit = new Zend_Measure_Length((float)$value);
140
- $unit->convertTo(Zend_Measure_Length::CENTIMETER);
141
-
142
- return $unit->getValue();
143
- }
144
 
145
- return $value;
146
- }
147
 
148
  public function getFreeMethod($request)
149
  {
@@ -202,7 +134,7 @@ class MercadoPago_MercadoEnvios_Helper_Data
202
  if ($shipment->getShippingLabel()) {
203
  $params = [
204
  'shipment_ids' => $shipment->getShippingLabel(),
205
- 'response_type' => 'zpl2',
206
  'access_token' => Mage::helper('mercadopago')->getAccessToken()
207
  ];
208
 
@@ -263,4 +195,35 @@ class MercadoPago_MercadoEnvios_Helper_Data
263
  }
264
  }
265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  }
16
 
17
  public static $enabled_methods = ['mla', 'mlb', 'mlm'];
18
 
19
+
20
  /**
21
  * @param $quote Mage_Sales_Model_Quote
22
  */
26
  $height = 0;
27
  $length = 0;
28
  $weight = 0;
29
+ $bulk = 0;
30
  $helperItem = Mage::helper('mercadopago_mercadoenvios/itemData');
31
+ $helperCarrier = Mage::helper('mercadopago_mercadoenvios/carrierData');
32
  foreach ($items as $item) {
33
+ $tempWidth = $helperCarrier->_getShippingDimension($item, 'width');
34
+ $tempHeight = $helperCarrier->_getShippingDimension($item, 'height');
35
+ $tempLength = $helperCarrier->_getShippingDimension($item, 'length');
36
+ $tempWeight = $helperCarrier->_getShippingDimension($item, 'weight');
37
+ $qty = $helperItem->itemGetQty($item);
38
+ $bulk += ($tempWidth * $tempHeight * $tempLength) * $qty;
39
+ $width += $tempWidth * $qty;
40
+ $height += $tempHeight * $qty;
41
+ $length += $tempLength * $qty;
42
+ $weight += $tempWeight * $qty;
43
  }
44
  $height = ceil($height);
45
  $width = ceil($width);
46
  $length = ceil($length);
47
  $weight = ceil($weight);
48
 
49
+ $helperCarrier->validateCartDimension($height, $width, $length, $weight);
50
+ $bulk = ceil(pow($bulk, 1/3));
 
 
51
 
52
+ return $bulk . 'x' . $bulk . 'x' . $bulk . ',' . $weight;
53
 
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  /**
58
  * @return Mage_Sales_Model_Quote
75
  return ($shippingMethod == MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios::CODE);
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
 
 
79
 
80
  public function getFreeMethod($request)
81
  {
134
  if ($shipment->getShippingLabel()) {
135
  $params = [
136
  'shipment_ids' => $shipment->getShippingLabel(),
137
+ 'response_type' => Mage::getStoreConfig('carriers/mercadoenvios/shipping_label'),
138
  'access_token' => Mage::helper('mercadopago')->getAccessToken()
139
  ];
140
 
195
  }
196
  }
197
 
198
+ /**
199
+ * Return items for further shipment rate evaluation. We need to pass children of a bundle instead passing the
200
+ * bundle itself, otherwise we may not get a rate at all (e.g. when total weight of a bundle exceeds max weight
201
+ * despite each item by itself is not)
202
+ *
203
+ * @return array
204
+ */
205
+ public function getAllItems($allItems)
206
+ {
207
+ $items = array();
208
+ foreach ($allItems as $item) {
209
+ /* @var $item Mage_Sales_Model_Quote_Item */
210
+ if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
211
+ // Don't process children here - we will process (or already have processed) them below
212
+ continue;
213
+ }
214
+
215
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
216
+ foreach ($item->getChildren() as $child) {
217
+ if (!$child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
218
+ $items[] = $child;
219
+ }
220
+ }
221
+ } else {
222
+ // Ship together - count compound item as one solid
223
+ $items[] = $item;
224
+ }
225
+ }
226
+
227
+ return $items;
228
+ }
229
  }
app/code/community/MercadoPago/MercadoEnvios/Helper/ItemData.php CHANGED
File without changes
app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Attribute/Validation/Mapping.php CHANGED
File without changes
app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Source/Shipping/FreeMethod.php CHANGED
File without changes
app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Source/Shipping/Method.php CHANGED
@@ -27,4 +27,13 @@ class MercadoPago_MercadoEnvios_Model_Adminhtml_Source_Shipping_Method
27
  return null;
28
  }
29
 
 
 
 
 
 
 
 
 
 
30
  }
27
  return null;
28
  }
29
 
30
+ public function getAvailableCodes() {
31
+ $methods = $this->toOptionArray();
32
+ $codes = [];
33
+ foreach ($methods as $method) {
34
+ $codes[] = $method['value'];
35
+ }
36
+ return $codes;
37
+ }
38
+
39
  }
app/code/community/MercadoPago/MercadoEnvios/Model/Adminhtml/Source/Shipping/Print/Mode.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_MercadoEnvios_Model_Adminhtml_Source_Shipping_Print_Mode
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return [['value' => 'pdf' , 'label' => 'PDF'],['value' => 'zpl2' , 'label' => 'ZIP']];
9
+ }
10
+
11
+ }
app/code/community/MercadoPago/MercadoEnvios/Model/Observer.php CHANGED
@@ -127,11 +127,12 @@ class MercadoPago_MercadoEnvios_Model_Observer
127
  $shippingAddress = $order->getShippingAddress();
128
  $zipCode = $shippingAddress->getPostcode();
129
  $defaultShippingId = substr($method, strpos($method, '_') + 1);
 
130
  $paramsME = [
131
  'mode' => 'me2',
132
  'zip_code' => $zipCode,
133
  'default_shipping_method' => intval($defaultShippingId),
134
- 'dimensions' => Mage::helper('mercadopago_mercadoenvios')->getDimensions($order->getAllItems())
135
  ];
136
  if ($shippingCost == 0) {
137
  $paramsME['free_methods'] = [['id' => intval($defaultShippingId)]];
@@ -173,4 +174,28 @@ class MercadoPago_MercadoEnvios_Model_Observer
173
  }
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
127
  $shippingAddress = $order->getShippingAddress();
128
  $zipCode = $shippingAddress->getPostcode();
129
  $defaultShippingId = substr($method, strpos($method, '_') + 1);
130
+ $helperMe = Mage::helper('mercadopago_mercadoenvios');
131
  $paramsME = [
132
  'mode' => 'me2',
133
  'zip_code' => $zipCode,
134
  'default_shipping_method' => intval($defaultShippingId),
135
+ 'dimensions' => $helperMe->getDimensions($helperMe->getAllItems($order->getAllItems()))
136
  ];
137
  if ($shippingCost == 0) {
138
  $paramsME['free_methods'] = [['id' => intval($defaultShippingId)]];
174
  }
175
  }
176
 
177
+ public function validateShippingMethod()
178
+ {
179
+ $selectedMethods = Mage::getStoreConfig('carriers/mercadoenvios/availablemethods');
180
+ $validate = true;
181
+ if (Mage::getStoreConfig('carriers/mercadoenvios/active')){
182
+ if (empty($selectedMethods)) {
183
+ $validate = false;
184
+ } else {
185
+ $methods = Mage::getModel('mercadopago_mercadoenvios/adminhtml_source_shipping_method')->getAvailableCodes();
186
+ $currentMethods = explode(',', Mage::getStoreConfig('carriers/mercadoenvios/availablemethods', '0'));
187
+ foreach ($currentMethods as $currentMethod) {
188
+ if (!in_array($currentMethod,$methods)) {
189
+ $validate = false;
190
+ }
191
+ }
192
+ }
193
+ }
194
+
195
+ if (!$validate){
196
+ Mage::getConfig()->saveConfig('carriers/mercadoenvios/active', '0');
197
+ Mage::throwException(Mage::helper('mercadopago_mercadoenvios')->__('MercadoEnvíos - Please enable a shipping method at least'));
198
+ }
199
+ }
200
+
201
  }
app/code/community/MercadoPago/MercadoEnvios/Model/Shipping/Carrier/MercadoEnvios.php CHANGED
@@ -18,6 +18,7 @@ class MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios
18
  protected $_methods;
19
  protected $_request;
20
 
 
21
  /**
22
  * Collect and get rates
23
  *
@@ -70,7 +71,7 @@ class MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios
70
 
71
  protected function getDataAllowedMethods()
72
  {
73
- if (empty($this->_methods)) {
74
  $quote = Mage::helper('mercadopago_mercadoenvios')->getQuote();
75
 
76
  $shippingAddress = $quote->getShippingAddress();
@@ -79,17 +80,19 @@ class MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios
79
  }
80
  $postcode = $shippingAddress->getPostcode();
81
 
82
- $client_id = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
83
- $client_secret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
84
- $mp = Mage::helper('mercadopago')->getApiInstance($client_id, $client_secret);
85
-
86
  try {
87
- $dimensions = Mage::helper('mercadopago_mercadoenvios')->getDimensions($quote->getAllItems());
 
88
  } catch (Exception $e) {
89
  $this->_methods = self::INVALID_METHOD;
 
90
  return;
91
  }
92
 
 
 
 
 
93
  $params = [
94
  "dimensions" => $dimensions,
95
  "zip_code" => $postcode,
@@ -104,6 +107,9 @@ class MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios
104
  $this->_methods = $response['response']['options'];
105
  } else {
106
  $this->_methods = self::INVALID_METHOD;
 
 
 
107
  Mage::helper('mercadopago_mercadoenvios')->log('Request params: ', $params);
108
  Mage::helper('mercadopago_mercadoenvios')->log('Error response API: ', $response);
109
  }
@@ -156,8 +162,13 @@ class MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios
156
  $error = Mage::getModel('shipping/rate_result_error');
157
  $error->setCarrier($this->_code);
158
  $error->setCarrierTitle($this->getConfigData('title'));
 
159
  $msg = $this->getConfigData('specificerrmsg');
 
 
 
160
  $error->setErrorMessage($msg);
 
161
  return $error;
162
  }
163
 
@@ -179,13 +190,15 @@ class MercadoPago_MercadoEnvios_Model_Shipping_Carrier_MercadoEnvios
179
  return in_array($rateId, $this->_available);
180
  }
181
 
182
- public function isActive() {
 
183
  if (!Mage::getStoreConfigFlag('payment/mercadopago_standard/active')) {
184
  return false;
185
  }
186
  if (!Mage::helper('mercadopago_mercadoenvios')->isCountryEnabled()) {
187
  return false;
188
  }
 
189
  return parent::isActive();
190
  }
191
 
18
  protected $_methods;
19
  protected $_request;
20
 
21
+
22
  /**
23
  * Collect and get rates
24
  *
71
 
72
  protected function getDataAllowedMethods()
73
  {
74
+ if (empty($this->_methods) && !empty($this->_request)) {
75
  $quote = Mage::helper('mercadopago_mercadoenvios')->getQuote();
76
 
77
  $shippingAddress = $quote->getShippingAddress();
80
  }
81
  $postcode = $shippingAddress->getPostcode();
82
 
 
 
 
 
83
  try {
84
+ $helperMe = Mage::helper('mercadopago_mercadoenvios');
85
+ $dimensions = $helperMe->getDimensions($helperMe->getAllItems($this->_request->getAllItems()));
86
  } catch (Exception $e) {
87
  $this->_methods = self::INVALID_METHOD;
88
+
89
  return;
90
  }
91
 
92
+ $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
93
+ $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
94
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
95
+
96
  $params = [
97
  "dimensions" => $dimensions,
98
  "zip_code" => $postcode,
107
  $this->_methods = $response['response']['options'];
108
  } else {
109
  $this->_methods = self::INVALID_METHOD;
110
+ if (isset($response['response']['message'])) {
111
+ Mage::register('mercadoenvios_msg', $response['response']['message']);
112
+ }
113
  Mage::helper('mercadopago_mercadoenvios')->log('Request params: ', $params);
114
  Mage::helper('mercadopago_mercadoenvios')->log('Error response API: ', $response);
115
  }
162
  $error = Mage::getModel('shipping/rate_result_error');
163
  $error->setCarrier($this->_code);
164
  $error->setCarrierTitle($this->getConfigData('title'));
165
+
166
  $msg = $this->getConfigData('specificerrmsg');
167
+ if ($customMsg = Mage::registry('mercadoenvios_msg')) {
168
+ $msg = $msg . ' - ' . $customMsg;
169
+ }
170
  $error->setErrorMessage($msg);
171
+
172
  return $error;
173
  }
174
 
190
  return in_array($rateId, $this->_available);
191
  }
192
 
193
+ public function isActive()
194
+ {
195
  if (!Mage::getStoreConfigFlag('payment/mercadopago_standard/active')) {
196
  return false;
197
  }
198
  if (!Mage::helper('mercadopago_mercadoenvios')->isCountryEnabled()) {
199
  return false;
200
  }
201
+
202
  return parent::isActive();
203
  }
204
 
app/code/community/MercadoPago/MercadoEnvios/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <MercadoPago_MercadoEnvios>
5
- <version>2.1.5</version>
6
  </MercadoPago_MercadoEnvios>
7
  </modules>
8
  <frontend>
@@ -86,8 +86,20 @@
86
  <class>MercadoPago_MercadoEnvios_Model_Observer</class>
87
  <method>checkAndValidateData</method>
88
  </payment_section_observer>
 
 
 
 
89
  </observers>
90
  </admin_system_config_changed_section_payment>
 
 
 
 
 
 
 
 
91
  </events>
92
 
93
  </global>
2
  <config>
3
  <modules>
4
  <MercadoPago_MercadoEnvios>
5
+ <version>2.2.0</version>
6
  </MercadoPago_MercadoEnvios>
7
  </modules>
8
  <frontend>
86
  <class>MercadoPago_MercadoEnvios_Model_Observer</class>
87
  <method>checkAndValidateData</method>
88
  </payment_section_observer>
89
+ <payment_section_observer_shipping_method>
90
+ <class>MercadoPago_MercadoEnvios_Model_Observer</class>
91
+ <method>validateShippingMethod</method>
92
+ </payment_section_observer_shipping_method>
93
  </observers>
94
  </admin_system_config_changed_section_payment>
95
+ <admin_system_config_changed_section_carriers>
96
+ <observers>
97
+ <payment_section_observer_shipping_method>
98
+ <class>MercadoPago_MercadoEnvios_Model_Observer</class>
99
+ <method>validateShippingMethod</method>
100
+ </payment_section_observer_shipping_method>
101
+ </observers>
102
+ </admin_system_config_changed_section_carriers>
103
  </events>
104
 
105
  </global>
app/code/community/MercadoPago/MercadoEnvios/etc/system.xml CHANGED
@@ -159,6 +159,15 @@
159
  <show_in_website>1</show_in_website>
160
  <show_in_store>0</show_in_store>
161
  </sort_order>
 
 
 
 
 
 
 
 
 
162
  </fields>
163
  </mercadoenvios>
164
  </fields>
159
  <show_in_website>1</show_in_website>
160
  <show_in_store>0</show_in_store>
161
  </sort_order>
162
+ <shipping_label translate="label">
163
+ <label>Shipping label download option</label>
164
+ <frontend_type>select</frontend_type>
165
+ <source_model>mercadopago_mercadoenvios/adminhtml_source_shipping_print_mode</source_model>
166
+ <sort_order>90</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>0</show_in_store>
170
+ </shipping_label>
171
  </fields>
172
  </mercadoenvios>
173
  </fields>
app/code/community/MercadoPago/OneStepCheckout/Block/Custom/Form.php CHANGED
@@ -27,7 +27,6 @@ class MercadoPago_OneStepCheckout_Block_Custom_Form
27
  '
28
  <script type="text/javascript">var PublicKeyMercadoPagoCustom = "' . $public_key . '";</script>
29
  <script src="https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js"></script>
30
- <script src="http://ui.mlstatic.com/chico/tiny/0.1.1/tiny.min.js"></script>
31
  <script type="text/javascript" src="%s"></script>
32
  <script type="text/javascript" src="%s"></script>
33
  <script type="text/javascript" src="%s"></script>',
27
  '
28
  <script type="text/javascript">var PublicKeyMercadoPagoCustom = "' . $public_key . '";</script>
29
  <script src="https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js"></script>
 
30
  <script type="text/javascript" src="%s"></script>
31
  <script type="text/javascript" src="%s"></script>
32
  <script type="text/javascript" src="%s"></script>',
app/code/community/MercadoPago/OneStepCheckout/Block/Customticket/Form.php CHANGED
File without changes
app/code/community/MercadoPago/OneStepCheckout/Helper/Data.php CHANGED
File without changes
app/code/community/MercadoPago/OneStepCheckout/Model/Observer.php CHANGED
File without changes
app/code/community/MercadoPago/OneStepCheckout/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <MercadoPago_OneStepCheckout>
5
- <version>2.1.5</version>
6
  </MercadoPago_OneStepCheckout>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <MercadoPago_OneStepCheckout>
5
+ <version>2.2.0</version>
6
  </MercadoPago_OneStepCheckout>
7
  </modules>
8
  <global>
app/code/community/MercadoPago/OneStepCheckout/etc/system.xml CHANGED
File without changes
app/design/adminhtml/default/default/layout/mercadopago.xml CHANGED
File without changes
app/design/adminhtml/default/default/template/mercadopago/array_dropdown.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/mercadopago/custom/info.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/mercadopago/custom_ticket/info.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/mercadopago/standard/info.phtml CHANGED
File without changes
app/design/frontend/base/default/layout/mercadopago.xml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/clean.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/custom/form.phtml CHANGED
@@ -43,7 +43,7 @@ $customer = $this->getCustomerAndCards();
43
  <label for="cardNumber"><?php echo $this->__('Payment Method'); ?></label>
44
  <select id="cardId" name="payment[<?php echo $_code; ?>][cardId]" data-checkout="cardId" data-element-id="#cardId__mp">
45
  <?php foreach ($customer['cards'] as $card) { ?>
46
- <option value="<?php echo $card["id"]; ?>" first_six_digits="<?php echo $card["first_six_digits"]; ?>" security_code_length="<?php echo $card["security_code"]["length"]; ?>">
47
 
48
  <?php echo $card["payment_method"]["name"].' '; ?><?php echo $this->__('ended in'); ?><?php echo ' '.$card["last_four_digits"]; ?>
49
  </option>
@@ -70,13 +70,12 @@ $customer = $this->getCustomerAndCards();
70
 
71
  <li>
72
  <ul id="mercadopago_checkout_custom_card">
 
73
  <li id="paymentMethod__mp">
74
  <label for="paymentMethod"><?php echo $this->__('Payment Method'); ?></label>
75
  <select id="paymentMethod" data-checkout="paymentMethod" name="payment[<?php echo $_code; ?>][paymentMethod]" data-element-id="#paymentMethod__mp" class="validate-select"></select>
76
  </li>
77
  <li id="cardNumber__mp">
78
- <div><a id="return_list_card_mp" class="action_ocp"><?php echo $this->__('Return to cards list'); ?></a></div>
79
-
80
  <label for="cardNumber"><?php echo $this->__('Card Number'); ?></label>
81
  <input type="text" id="cardNumber" data-checkout="cardNumber" data-element-id="#cardNumber__mp"/>
82
 
43
  <label for="cardNumber"><?php echo $this->__('Payment Method'); ?></label>
44
  <select id="cardId" name="payment[<?php echo $_code; ?>][cardId]" data-checkout="cardId" data-element-id="#cardId__mp">
45
  <?php foreach ($customer['cards'] as $card) { ?>
46
+ <option value="<?php echo $card["id"]; ?>" first_six_digits="<?php echo $card["first_six_digits"]; ?>" security_code_length="<?php echo $card["security_code"]["length"]; ?>" secure_thumb="<?php echo $card["payment_method"]["secure_thumbnail"]; ?>">
47
 
48
  <?php echo $card["payment_method"]["name"].' '; ?><?php echo $this->__('ended in'); ?><?php echo ' '.$card["last_four_digits"]; ?>
49
  </option>
70
 
71
  <li>
72
  <ul id="mercadopago_checkout_custom_card">
73
+ <div><a id="return_list_card_mp" class="action_ocp"><?php echo $this->__('Return to cards list'); ?></a></div>
74
  <li id="paymentMethod__mp">
75
  <label for="paymentMethod"><?php echo $this->__('Payment Method'); ?></label>
76
  <select id="paymentMethod" data-checkout="paymentMethod" name="payment[<?php echo $_code; ?>][paymentMethod]" data-element-id="#paymentMethod__mp" class="validate-select"></select>
77
  </li>
78
  <li id="cardNumber__mp">
 
 
79
  <label for="cardNumber"><?php echo $this->__('Card Number'); ?></label>
80
  <input type="text" id="cardNumber" data-checkout="cardNumber" data-element-id="#cardNumber__mp"/>
81
 
app/design/frontend/base/default/template/mercadopago/custom/info.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/custom/success.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/custom_ticket/form.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/custom_ticket/info.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/custom_ticket/success.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/discount.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/onestepcheckout/custom/form.phtml CHANGED
@@ -96,12 +96,11 @@ $customer = $this->getCustomerAndCards();
96
  <li>
97
  <ul id="mercadopago_checkout_custom_card">
98
  <li id="paymentMethod__mp">
 
99
  <label for="paymentMethod"><?php echo $this->__('Payment Method'); ?></label>
100
  <select id="paymentMethod" data-checkout="paymentMethod" name="payment[<?php echo $_code; ?>][paymentMethod]" data-element-id="#paymentMethod__mp" class="validate-select"></select>
101
  </li>
102
  <li id="cardNumber__mp">
103
- <div><a id="return_list_card_mp" class="action_ocp"><?php echo $this->__('Return to cards list'); ?></a></div>
104
-
105
  <label for="cardNumber"><?php echo $this->__('Card Number'); ?></label>
106
  <input type="text" id="cardNumber" data-checkout="cardNumber" data-element-id="#cardNumber__mp"/>
107
 
96
  <li>
97
  <ul id="mercadopago_checkout_custom_card">
98
  <li id="paymentMethod__mp">
99
+ <div><a id="return_list_card_mp" class="action_ocp"><?php echo $this->__('Return to cards list'); ?></a></div>
100
  <label for="paymentMethod"><?php echo $this->__('Payment Method'); ?></label>
101
  <select id="paymentMethod" data-checkout="paymentMethod" name="payment[<?php echo $_code; ?>][paymentMethod]" data-element-id="#paymentMethod__mp" class="validate-select"></select>
102
  </li>
103
  <li id="cardNumber__mp">
 
 
104
  <label for="cardNumber"><?php echo $this->__('Card Number'); ?></label>
105
  <input type="text" id="cardNumber" data-checkout="cardNumber" data-element-id="#cardNumber__mp"/>
106
 
app/design/frontend/base/default/template/mercadopago/standard/form.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/standard/info.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/standard/pay.phtml CHANGED
File without changes
app/design/frontend/base/default/template/mercadopago/standard/success.phtml CHANGED
File without changes
app/etc/modules/MercadoPago_Core.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <MercadoPago_Core>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </MercadoPago_Core>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
app/etc/modules/MercadoPago_MercadoEnvios.xml DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <MercadoPago_MercadoEnvios>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <MercadoPago_Core />
9
- </depends>
10
- </MercadoPago_MercadoEnvios>
11
- </modules>
12
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/MercadoPago_OneStepCheckout.xml DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <MercadoPago_OneStepCheckout>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <MercadoPago_Core />
9
- </depends>
10
- </MercadoPago_OneStepCheckout>
11
- </modules>
12
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
app/locale/en_US/MercadoPago_Core.csv CHANGED
@@ -163,4 +163,16 @@
163
  "Mercado Pago - Custom Checkout: Invalid access token","Mercado Pago - Custom Checkout: Invalid access token"
164
  "(estimated date %s)","(estimated date %s)"
165
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured", "MercadoEnvios is not enabled in the country where Mercado Pago is configured"
166
- "Discount Mercado Pago","Discount Mercado Pago"
 
 
 
 
 
 
 
 
 
 
 
 
163
  "Mercado Pago - Custom Checkout: Invalid access token","Mercado Pago - Custom Checkout: Invalid access token"
164
  "(estimated date %s)","(estimated date %s)"
165
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured", "MercadoEnvios is not enabled in the country where Mercado Pago is configured"
166
+ "Discount Mercado Pago","Discount Mercado Pago"
167
+
168
+ "Is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
169
+ During the sandbox mode tests, you can operate over HTTP,
170
+ but for homologation you'll need to acquire the certificate in case you don't have it.
171
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
172
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
173
+ During the sandbox mode tests, you can operate over HTTP,
174
+ but for homologation you'll need to acquire the certificate in case you don't have it.
175
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>"
176
+
177
+ "Use Mercado Pago success page","Use Mercado Pago success page"
178
+ "If set this config with NO, magento success page will be used","If set this config with NO, magento success page will be used"
app/locale/es_AR/MercadoPago_Core.csv CHANGED
@@ -169,4 +169,16 @@
169
  "Cannot repeat MercadoEnvios Product size attributes","No puede repetir los atributos de tamaño de producto de MercadoEnvios"
170
  "Checkout Classic Method must be enabled","El método de pago Checkout Classic debe estar habilitado"
171
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured", "MercadoEnvios no está disponible en el país configurado para Mercado Pago"
172
- "Discount Mercado Pago","Descuento de Mercado Pago"
 
 
 
 
 
 
 
 
 
 
 
 
169
  "Cannot repeat MercadoEnvios Product size attributes","No puede repetir los atributos de tamaño de producto de MercadoEnvios"
170
  "Checkout Classic Method must be enabled","El método de pago Checkout Classic debe estar habilitado"
171
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured", "MercadoEnvios no está disponible en el país configurado para Mercado Pago"
172
+ "Discount Mercado Pago","Descuento de Mercado Pago"
173
+
174
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
175
+ During the sandbox mode tests, you can operate over HTTP,
176
+ but for homologation you'll need to acquire the certificate in case you don't have it.
177
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
178
+ "es requisito que cuentes con un certificado SSL, y que el formulario de pagos sea servido bajo una página HTTPS.
179
+ Durante las pruebas en modo sandbox, puedes operar en HTTP, pero para homologarte, deberás adquirir el certificado en caso de que no lo poseas.
180
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver más</a>"
181
+
182
+ "Use Mercado Pago success page","Usar succes page de Mercado Pago"
183
+ "If set this config with NO, magento success page will be used","Si esta configuración se setea en NO, se usará la success page de Magento"
184
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
app/locale/es_CL/MercadoPago_Core.csv CHANGED
@@ -112,4 +112,16 @@
112
  "Automatic notification of the Mercado Pago: The payment was rejected.","Notificación automática de Mercado Pago: El pago fué rechazado."
113
  "<br/> Payment id: %s","<br/> Número de Pago: %s"
114
  "<br/> Status: %s","<br/> Estado: %s"
115
- "<br/> Status Detail: %s","<br/> Detalle del Estado: %s"
 
 
 
 
 
 
 
 
 
 
 
 
112
  "Automatic notification of the Mercado Pago: The payment was rejected.","Notificación automática de Mercado Pago: El pago fué rechazado."
113
  "<br/> Payment id: %s","<br/> Número de Pago: %s"
114
  "<br/> Status: %s","<br/> Estado: %s"
115
+ "<br/> Status Detail: %s","<br/> Detalle del Estado: %s"
116
+
117
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
118
+ During the sandbox mode tests, you can operate over HTTP,
119
+ but for homologation you'll need to acquire the certificate in case you don't have it.
120
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
121
+ "es requisito que cuentes con un certificado SSL, y que el formulario de pagos sea servido bajo una página HTTPS.
122
+ Durante las pruebas en modo sandbox, puedes operar en HTTP, pero para homologarte, deberás adquirir el certificado en caso de que no lo poseas.
123
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver más</a>"
124
+
125
+ "Use Mercado Pago success page","Usar succes page de Mercado Pago"
126
+ "If set this config with NO, magento success page will be used","Si esta configuración se setea en NO, se usará la success page de Magento"
127
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
app/locale/es_CO/MercadoPago_Core.csv CHANGED
@@ -124,4 +124,16 @@
124
  "Default issuer", "Cualquier otro banco"
125
 
126
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mco/account/credentials"
127
- "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
 
 
 
 
 
 
 
 
 
 
 
 
124
  "Default issuer", "Cualquier otro banco"
125
 
126
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mco/account/credentials"
127
+ "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
128
+
129
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
130
+ During the sandbox mode tests, you can operate over HTTP,
131
+ but for homologation you'll need to acquire the certificate in case you don't have it.
132
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
133
+ "es requisito que cuentes con un certificado SSL, y que el formulario de pagos sea servido bajo una página HTTPS.
134
+ Durante las pruebas en modo sandbox, puedes operar en HTTP, pero para homologarte, deberás adquirir el certificado en caso de que no lo poseas.
135
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver más</a>"
136
+
137
+ "Use Mercado Pago success page","Usar succes page de Mercado Pago"
138
+ "If set this config with NO, magento success page will be used","Si esta configuración se setea en NO, se usará la success page de Magento"
139
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
app/locale/es_ES/MercadoPago_Core.csv CHANGED
@@ -119,4 +119,16 @@
119
  "<br/> Status Detail: %s","<br/> Detalle del Estado: %s"
120
 
121
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mla/account/credentials"
122
- "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
 
 
 
 
 
 
 
 
 
 
 
 
119
  "<br/> Status Detail: %s","<br/> Detalle del Estado: %s"
120
 
121
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mla/account/credentials"
122
+ "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
123
+
124
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
125
+ During the sandbox mode tests, you can operate over HTTP,
126
+ but for homologation you'll need to acquire the certificate in case you don't have it.
127
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
128
+ "es requisito que cuentes con un certificado SSL, y que el formulario de pagos sea servido bajo una página HTTPS.
129
+ Durante las pruebas en modo sandbox, puedes operar en HTTP, pero para homologarte, deberás adquirir el certificado en caso de que no lo poseas.
130
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver Más</a>"
131
+
132
+ "Use Mercado Pago success page","Usar succes page de Mercado Pago"
133
+ "If set this config with NO, magento success page will be used","Si esta configuración se setea en NO, se usará la success page de Magento"
134
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
app/locale/es_MX/MercadoPago_Core.csv CHANGED
@@ -125,4 +125,16 @@
125
  "Default issuer", "Cualquier otro banco"
126
 
127
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mlm/account/credentials"
128
- "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
 
 
 
 
 
 
 
 
 
 
 
 
125
  "Default issuer", "Cualquier otro banco"
126
 
127
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mlm/account/credentials"
128
+ "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
129
+
130
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
131
+ During the sandbox mode tests, you can operate over HTTP,
132
+ but for homologation you'll need to acquire the certificate in case you don't have it.
133
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
134
+ "es requisito que cuentes con un certificado SSL, y que el formulario de pagos sea servido bajo una página HTTPS.
135
+ Durante las pruebas en modo sandbox, puedes operar en HTTP, pero para homologarte, deberás adquirir el certificado en caso de que no lo poseas.
136
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver más</a>"
137
+
138
+ "Use Mercado Pago success page","Usar succes page de Mercado Pago"
139
+ "If set this config with NO, magento success page will be used","Si esta configuración se setea en NO, se usará la success page de Magento"
140
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
app/locale/es_VE/MercadoPago_Core.csv CHANGED
@@ -126,4 +126,16 @@
126
  "Default issuer", "Cualquier otro banco"
127
 
128
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mlm/account/credentials"
129
- "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
 
 
 
 
 
 
 
 
 
 
 
 
126
  "Default issuer", "Cualquier otro banco"
127
 
128
  "Get your public_key in the following address: https://www.mercadopago.com/mlb/account/credentials","Obtén tu public_key en la siguiente dirección: https://www.mercadopago.com/mlm/account/credentials"
129
+ "Choose the status when payment was chargeback", "Elija el estado de los pedidos para pagos con status Chargeback"
130
+
131
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
132
+ During the sandbox mode tests, you can operate over HTTP,
133
+ but for homologation you'll need to acquire the certificate in case you don't have it.
134
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
135
+ "es requisito que cuentes con un certificado SSL, y que el formulario de pagos sea servido bajo una página HTTPS.
136
+ Durante las pruebas en modo sandbox, puedes operar en HTTP, pero para homologarte, deberás adquirir el certificado en caso de que no lo poseas.
137
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver más</a>"
138
+
139
+ "Use Mercado Pago success page","Usar succes page de Mercado Pago"
140
+ "If set this config with NO, magento success page will be used","Si esta configuración se setea en NO, se usará la success page de Magento"
141
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
app/locale/pt_BR/MercadoPago_Core.csv CHANGED
@@ -193,4 +193,15 @@
193
  "Mercado Pago - Custom Checkout: Invalid access token","Mercado Pago - Custom Checkout: Token de acesso inválido"
194
  "(estimated date %s)","(data estimada %s)"
195
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured","MercadoEnvios não está habilitado no país onde Mercado Pago está configurado"
196
- "Discount Mercado Pago","Desconto de Mercado Pago"
 
 
 
 
 
 
 
 
 
 
 
193
  "Mercado Pago - Custom Checkout: Invalid access token","Mercado Pago - Custom Checkout: Token de acesso inválido"
194
  "(estimated date %s)","(data estimada %s)"
195
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured","MercadoEnvios não está habilitado no país onde Mercado Pago está configurado"
196
+ "Discount Mercado Pago","Desconto de Mercado Pago"
197
+
198
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
199
+ During the sandbox mode tests, you can operate over HTTP,
200
+ but for homologation you'll need to acquire the certificate in case you don't have it.
201
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>",
202
+ "é um requisito que tenha um certificado SSL e que o formulário de pagamentos esteja sobre uma página HTTPS.
203
+ Durante os testes em modo sandbox, pode operar em HTTP, mas para a homologação, deverá adquirir o certificado caso não tenha.
204
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver mais</a>"
205
+ "Use Mercado Pago success page","Use página de sucesso Mercado Pago"
206
+ "If set this config with NO, magento success page will be used","Se definir essa configuração com NO, página de sucesso magento será usado"
207
+ "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Ative um método de envio pelo menos."
js/mercadopago/jquery-1.11.0.min.js CHANGED
File without changes
js/mercadopago/mercadopago.js CHANGED
@@ -223,7 +223,7 @@ var MercadoPagoCustom = (function () {
223
  } else {
224
  setTimeout(function () {
225
  setPaymentMethods()
226
- }, 1000);
227
  }
228
 
229
  defineInputs();
@@ -270,6 +270,9 @@ var MercadoPagoCustom = (function () {
270
  if (paymentMethodId != '') {
271
  var payment_method_id = TinyJ(self.selectors.paymentMethodId);
272
  payment_method_id.val(paymentMethodId);
 
 
 
273
  }
274
  }
275
 
@@ -368,7 +371,7 @@ var MercadoPagoCustom = (function () {
368
  excludeInputs.splice(indexColombia, 1);
369
  }
370
  }
371
- if (!this.issuerMandatory) {
372
  excludeInputs.push(self.selectors.issuer);
373
  }
374
 
@@ -533,7 +536,6 @@ var MercadoPagoCustom = (function () {
533
  var ccNumber = TinyJ(self.selectors.cardNumberInput).val();
534
  return ccNumber.replace(/[ .-]/g, '').slice(0, 6);
535
  }
536
- return;
537
  }
538
 
539
 
@@ -581,18 +583,23 @@ var MercadoPagoCustom = (function () {
581
  //hide loading
582
  hideLoading();
583
 
584
- if (status == http.status.OK) {
585
  if (response.length == 1) {
586
  var paymentMethodId = response[0].id;
587
  TinyJ(self.selectors.paymentMethodId).val(paymentMethodId);
 
 
588
  }
589
 
590
  var oneClickPay = TinyJ(self.selectors.oneClickPayment).val();
591
  var selector = oneClickPay == true ? self.selectors.cardId : self.selectors.cardNumberInput;
592
  if (response.length == 1) {
593
  TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, response[0].secure_thumbnail);
 
 
594
  }
595
 
 
596
  var bin = getBin();
597
  try {
598
  var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
@@ -607,23 +614,24 @@ var MercadoPagoCustom = (function () {
607
  });
608
 
609
  // check if the issuer is necessary to pay
610
- this.issuerMandatory;
611
- this.issuerMandatory = false;
612
  var additionalInfo = response[0].additional_info_needed;
613
 
614
  for (var i = 0; i < additionalInfo.length; i++) {
615
  if (additionalInfo[i] == self.selectors.issuerId) {
616
- this.issuerMandatory = true;
617
  }
618
  }
619
 
620
- showLogMercadoPago(String.format(self.messages.issuerMandatory, this.issuerMandatory));
621
 
622
  var issuer = TinyJ(self.selectors.issuer);
623
 
624
- if (this.issuerMandatory) {
625
- Mercadopago.getIssuers(response[0].id, showCardIssuers);
626
- issuer.change(setInstallmentsByIssuerId);
 
 
627
  } else {
628
  TinyJ(self.selectors.issuerMp).hide();
629
  issuer.hide();
@@ -643,27 +651,35 @@ var MercadoPagoCustom = (function () {
643
  showLogMercadoPago(self.messages.setIssuer);
644
  showLogMercadoPago(status);
645
  showLogMercadoPago(issuers);
 
 
 
646
 
647
- var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
648
- var messageDefaultIssuer = TinyJ(self.selectors.textDefaultIssuer).val();
649
-
650
- fragment = document.createDocumentFragment();
651
 
652
- var option = new Option(messageChoose + "...", '');
653
- fragment.appendChild(option);
654
 
655
- for (var i = 0; i < issuers.length; i++) {
656
- if (issuers[i].name != self.constants.default) {
657
- option = new Option(issuers[i].name, issuers[i].id);
658
- } else {
659
- option = new Option(messageDefaultIssuer, issuers[i].id);
 
 
660
  }
661
- fragment.appendChild(option);
662
- }
663
 
664
- TinyJ(self.selectors.issuer).empty().appendChild(fragment).enable().removeAttribute(self.constants.style);
665
- TinyJ(self.selectors.issuerMp).removeAttribute(self.constants.style);
666
- TinyJ(self.selectors.issuerMpLabel).removeAttribute(self.constants.style);
 
 
 
 
 
 
 
 
667
  defineInputs();
668
  };
669
 
@@ -696,7 +712,10 @@ var MercadoPagoCustom = (function () {
696
  var route = TinyJ(self.selectors.mercadoRoute).val();
697
  var baseUrl = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.baseUrl).val();
698
  var discountAmount = parseFloat(TinyJ(self.selectors.customDiscountAmount).val());
699
-
 
 
 
700
  if (route != self.constants.checkout) {
701
  showLogMercadoPago(self.messages.usingMagentoCustomCheckout);
702
 
@@ -768,37 +787,8 @@ var MercadoPagoCustom = (function () {
768
  TinyJ(option).attribute(self.constants.cost, payerCosts[i].total_amount);
769
  }
770
  selectorInstallments.enable();
771
-
772
-
773
- setTimeout(function () {
774
- var siteId = TinyJ(self.selectors.siteId).val();
775
- if (siteId == self.constants.mexico) {
776
-
777
- var issuers = TinyJ(self.selectors.issuer);
778
- var issuerExist = false;
779
- try {
780
- issuersOptions = issuers.getElem(self.constants.option);
781
- for (i = 0; i < issuersOptions.length; ++i) {
782
- if (issuersOptions[i].val() == response[0].issuer.id) {
783
- issuers.val(response[0].issuer.id);
784
- issuerExist = true;
785
- }
786
- }
787
- }
788
- catch (err) {
789
- //nothing is needed here right now
790
- }
791
-
792
- if (issuerExist === false) {
793
- var option = new Option(response[0].issuer.name, response[0].issuer.id);
794
- issuers.appendChild(option);
795
- }
796
-
797
- showLogMercadoPago(String.format(self.messages.issuerSet, response[0].issuer));
798
- }
799
- }, 100);
800
  } else {
801
- showMessageErrorForm(self.selectors.errorMethodMinAmount);
802
  }
803
  }
804
 
@@ -826,9 +816,14 @@ var MercadoPagoCustom = (function () {
826
  var submit = true;
827
  var dataInputs = defineInputs();
828
 
 
 
 
829
  for (var x = 0; x < dataInputs.length; x++) {
830
  if (TinyJ(dataInputs[x]).val() == "" || TinyJ(dataInputs[x]).val() == -1) {
831
- submit = false;
 
 
832
  }
833
  }
834
 
223
  } else {
224
  setTimeout(function () {
225
  setPaymentMethods()
226
+ }, 3000);
227
  }
228
 
229
  defineInputs();
270
  if (paymentMethodId != '') {
271
  var payment_method_id = TinyJ(self.selectors.paymentMethodId);
272
  payment_method_id.val(paymentMethodId);
273
+ if (issuerMandatory) {
274
+ Mercadopago.getIssuers(paymentMethodId, showCardIssuers);
275
+ }
276
  }
277
  }
278
 
371
  excludeInputs.splice(indexColombia, 1);
372
  }
373
  }
374
+ if (!issuerMandatory) {
375
  excludeInputs.push(self.selectors.issuer);
376
  }
377
 
536
  var ccNumber = TinyJ(self.selectors.cardNumberInput).val();
537
  return ccNumber.replace(/[ .-]/g, '').slice(0, 6);
538
  }
 
539
  }
540
 
541
 
583
  //hide loading
584
  hideLoading();
585
 
586
+ if (status == http.status.OK && response != undefined) {
587
  if (response.length == 1) {
588
  var paymentMethodId = response[0].id;
589
  TinyJ(self.selectors.paymentMethodId).val(paymentMethodId);
590
+ } else {
591
+ var paymentMethodId = TinyJ(self.selectors.paymentMethodId).val();
592
  }
593
 
594
  var oneClickPay = TinyJ(self.selectors.oneClickPayment).val();
595
  var selector = oneClickPay == true ? self.selectors.cardId : self.selectors.cardNumberInput;
596
  if (response.length == 1) {
597
  TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, response[0].secure_thumbnail);
598
+ } else if (oneClickPay != 0) {
599
+ TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, TinyJ(selector).getSelectedOption().attribute('secure_thumb'));
600
  }
601
 
602
+
603
  var bin = getBin();
604
  try {
605
  var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
614
  });
615
 
616
  // check if the issuer is necessary to pay
617
+ issuerMandatory = false;
 
618
  var additionalInfo = response[0].additional_info_needed;
619
 
620
  for (var i = 0; i < additionalInfo.length; i++) {
621
  if (additionalInfo[i] == self.selectors.issuerId) {
622
+ issuerMandatory = true;
623
  }
624
  }
625
 
626
+ showLogMercadoPago(String.format(self.messages.issuerMandatory, issuerMandatory));
627
 
628
  var issuer = TinyJ(self.selectors.issuer);
629
 
630
+ if (issuerMandatory) {
631
+ if (paymentMethodId != '') {
632
+ Mercadopago.getIssuers(paymentMethodId, showCardIssuers);
633
+ issuer.change(setInstallmentsByIssuerId);
634
+ }
635
  } else {
636
  TinyJ(self.selectors.issuerMp).hide();
637
  issuer.hide();
651
  showLogMercadoPago(self.messages.setIssuer);
652
  showLogMercadoPago(status);
653
  showLogMercadoPago(issuers);
654
+ if (issuers.length > 0) {
655
+ var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
656
+ var messageDefaultIssuer = TinyJ(self.selectors.textDefaultIssuer).val();
657
 
658
+ var fragment = document.createDocumentFragment();
 
 
 
659
 
660
+ var option = new Option(messageChoose + "...", '');
661
+ fragment.appendChild(option);
662
 
663
+ for (var i = 0; i < issuers.length; i++) {
664
+ if (issuers[i].name != self.constants.default) {
665
+ option = new Option(issuers[i].name, issuers[i].id);
666
+ } else {
667
+ option = new Option(messageDefaultIssuer, issuers[i].id);
668
+ }
669
+ fragment.appendChild(option);
670
  }
 
 
671
 
672
+ TinyJ(self.selectors.issuer).empty().appendChild(fragment).enable().removeAttribute(self.constants.style);
673
+ TinyJ(self.selectors.issuerMp).removeAttribute(self.constants.style);
674
+ TinyJ(self.selectors.issuerMpLabel).removeAttribute(self.constants.style);
675
+ } else {
676
+ TinyJ(self.selectors.issuer).empty();
677
+ TinyJ(self.selectors.issuer).hide();
678
+ TinyJ(self.selectors.issuerMp).hide();
679
+ TinyJ(self.selectors.issuerMpLabel).hide();
680
+
681
+
682
+ }
683
  defineInputs();
684
  };
685
 
712
  var route = TinyJ(self.selectors.mercadoRoute).val();
713
  var baseUrl = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.baseUrl).val();
714
  var discountAmount = parseFloat(TinyJ(self.selectors.customDiscountAmount).val());
715
+ var paymentMethodId = TinyJ(self.selectors.paymentMethodId).val();
716
+ if (paymentMethodId != '') {
717
+ options['payment_method_id'] = paymentMethodId;
718
+ }
719
  if (route != self.constants.checkout) {
720
  showLogMercadoPago(self.messages.usingMagentoCustomCheckout);
721
 
787
  TinyJ(option).attribute(self.constants.cost, payerCosts[i].total_amount);
788
  }
789
  selectorInstallments.enable();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  } else {
791
+ showMessageErrorForm(self.selectors.paymenMethodNotFound);
792
  }
793
  }
794
 
816
  var submit = true;
817
  var dataInputs = defineInputs();
818
 
819
+ var issuers = TinyJ(self.selectors.issuer);
820
+ var issuersFlag = (issuers && issuers.getElem() != null && issuers.getElem().length > 0);
821
+
822
  for (var x = 0; x < dataInputs.length; x++) {
823
  if (TinyJ(dataInputs[x]).val() == "" || TinyJ(dataInputs[x]).val() == -1) {
824
+ if (!(dataInputs[x] == "#issuer" && !issuersFlag)) {
825
+ submit = false;
826
+ }
827
  }
828
  }
829
 
js/mercadopago/mercadopago_osc.js CHANGED
@@ -228,12 +228,9 @@ var MercadoPagoCustom = (function () {
228
 
229
  if (siteId != self.constants.mexico) {
230
  Mercadopago.getIdentificationTypes();
231
- } else {
232
- var methods = getPaymentMethods();
233
- setPaymentMethodsInfo(methods);
234
- TinyJ(self.selectors.paymentMethodSelect).change(setPaymentMethodId);
235
  }
236
- if (siteId == self.constants.colombia) {
 
237
  setTimeout(function () {
238
  setPaymentMethods()
239
  }, 5000);
@@ -282,12 +279,21 @@ var MercadoPagoCustom = (function () {
282
  });
283
  }
284
 
 
 
 
 
 
 
285
  function setPaymentMethodId(event) {
286
  var paymentMethodSelector = TinyJ(self.selectors.paymentMethodSelect);
287
  var paymentMethodId = paymentMethodSelector.val();
288
  if (paymentMethodId != '') {
289
  var payment_method_id = TinyJ(self.selectors.paymentMethodId);
290
  payment_method_id.val(paymentMethodId);
 
 
 
291
  }
292
  }
293
 
@@ -646,16 +652,20 @@ var MercadoPagoCustom = (function () {
646
  //hide loading
647
  hideLoading();
648
 
649
- if (status == http.status.OK) {
650
  if (response.length == 1) {
651
  var paymentMethodId = response[0].id;
652
  TinyJ(self.selectors.paymentMethodId).val(paymentMethodId);
 
 
653
  }
654
 
655
  var oneClickPay = TinyJ(self.selectors.oneClickPayment).val();
656
  var selector = oneClickPay == true ? self.selectors.cardId : self.selectors.cardNumberInput;
657
  if (response.length == 1) {
658
  TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, response[0].secure_thumbnail);
 
 
659
  }
660
 
661
  var bin = getBin();
@@ -673,24 +683,25 @@ var MercadoPagoCustom = (function () {
673
  });
674
 
675
  // check if the issuer is necessary to pay
676
- this.issuerMandatory;
677
- this.issuerMandatory = false;
678
  var additionalInfo = response[0].additional_info_needed;
679
 
680
  for (var i = 0; i < additionalInfo.length; i++) {
681
  if (additionalInfo[i] == self.selectors.issuerId) {
682
- this.issuerMandatory = true;
683
  }
684
  }
685
  ;
686
 
687
- showLogMercadoPago(String.format(self.messages.issuerMandatory, this.issuerMandatory));
688
 
689
  var issuer = TinyJ(self.selectors.issuer);
690
 
691
- if (this.issuerMandatory) {
692
- Mercadopago.getIssuers(response[0].id, showCardIssuers);
693
- issuer.change(setInstallmentsByIssuerId);
 
 
694
  } else {
695
  TinyJ(self.selectors.issuerMp).hide();
696
  issuer.hide();
@@ -698,9 +709,7 @@ var MercadoPagoCustom = (function () {
698
  }
699
 
700
  } else {
701
-
702
- showMessageErrorForm(self.selectors.paymenMethodNotFound);
703
-
704
  }
705
 
706
  defineInputs();
@@ -710,27 +719,33 @@ var MercadoPagoCustom = (function () {
710
  showLogMercadoPago(self.messages.setIssuer);
711
  showLogMercadoPago(status);
712
  showLogMercadoPago(issuers);
 
 
 
713
 
714
- var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
715
- var messageDefaultIssuer = TinyJ(self.selectors.textDefaultIssuer).val();
716
-
717
- fragment = document.createDocumentFragment();
718
 
719
- var option = new Option(messageChoose + "...", '');
720
- fragment.appendChild(option);
721
 
722
- for (var i = 0; i < issuers.length; i++) {
723
- if (issuers[i].name != self.constants.default) {
724
- option = new Option(issuers[i].name, issuers[i].id);
725
- } else {
726
- option = new Option(messageDefaultIssuer, issuers[i].id);
 
 
727
  }
728
- fragment.appendChild(option);
729
- }
730
 
731
- TinyJ(self.selectors.issuer).empty().appendChild(fragment).enable().removeAttribute(self.constants.style);
732
- TinyJ(self.selectors.issuerMp).removeAttribute(self.constants.style);
733
- TinyJ(self.selectors.issuerMpLabel).removeAttribute(self.constants.style);
 
 
 
 
 
 
734
  defineInputs();
735
  };
736
 
@@ -763,7 +778,10 @@ var MercadoPagoCustom = (function () {
763
  var route = TinyJ(self.selectors.mercadoRoute).val();
764
  var baseUrl = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.baseUrl).val();
765
  var discountAmount = parseFloat(TinyJ(self.selectors.customDiscountAmount).val());
766
-
 
 
 
767
  if (route != self.constants.checkout) {
768
  showLogMercadoPago(self.messages.usingMagentoCustomCheckout);
769
 
@@ -845,35 +863,8 @@ var MercadoPagoCustom = (function () {
845
 
846
  checkCreateCardToken();
847
 
848
- setTimeout(function () {
849
- var siteId = TinyJ(self.selectors.siteId).val();
850
- if (siteId == self.constants.mexico) {
851
-
852
- var issuers = TinyJ(self.selectors.issuer);
853
- var issuerExist = false;
854
- try {
855
- issuersOptions = issuers.getElem(self.constants.option);
856
- for (i = 0; i < issuersOptions.length; ++i) {
857
- if (issuersOptions[i].val() == response[0].issuer.id) {
858
- issuers.val(response[0].issuer.id);
859
- issuerExist = true;
860
- }
861
- }
862
- }
863
- catch (err) {
864
- //nothing is needed here right now
865
- }
866
-
867
- if (issuerExist === false) {
868
- var option = new Option(response[0].issuer.name, response[0].issuer.id);
869
- issuers.appendChild(option);
870
- }
871
-
872
- showLogMercadoPago(String.format(self.messages.issuerSet, response[0].issuer));
873
- }
874
- }, 100);
875
  } else {
876
- showMessageErrorForm(self.selectors.errorMethodMinAmount);
877
  }
878
  }
879
 
@@ -913,9 +904,14 @@ var MercadoPagoCustom = (function () {
913
  }
914
  }
915
 
 
 
 
916
  var docNumber = TinyJ(self.selectors.docNumber).val();
917
  if (docNumber != '' && !checkDocNumber(docNumber)) {
918
- submit = false;
 
 
919
  }
920
 
921
  if (submit) {
@@ -1176,4 +1172,5 @@ var MercadoPagoCustom = (function () {
1176
  enableLog: enableLog,
1177
  isLogEnabled: isLogEnabled
1178
  };
1179
- })();
 
228
 
229
  if (siteId != self.constants.mexico) {
230
  Mercadopago.getIdentificationTypes();
 
 
 
 
231
  }
232
+
233
+ if (siteId == self.constants.colombia || siteId == self.constants.mexico) {
234
  setTimeout(function () {
235
  setPaymentMethods()
236
  }, 5000);
279
  });
280
  }
281
 
282
+ function setPaymentMethods() {
283
+ var methods = getPaymentMethods();
284
+ setPaymentMethodsInfo(methods);
285
+ TinyJ(self.selectors.paymentMethodSelect).change(setPaymentMethodId);
286
+ }
287
+
288
  function setPaymentMethodId(event) {
289
  var paymentMethodSelector = TinyJ(self.selectors.paymentMethodSelect);
290
  var paymentMethodId = paymentMethodSelector.val();
291
  if (paymentMethodId != '') {
292
  var payment_method_id = TinyJ(self.selectors.paymentMethodId);
293
  payment_method_id.val(paymentMethodId);
294
+ if (issuerMandatory) {
295
+ Mercadopago.getIssuers(paymentMethodId, showCardIssuers);
296
+ }
297
  }
298
  }
299
 
652
  //hide loading
653
  hideLoading();
654
 
655
+ if (status == http.status.OK && response != undefined) {
656
  if (response.length == 1) {
657
  var paymentMethodId = response[0].id;
658
  TinyJ(self.selectors.paymentMethodId).val(paymentMethodId);
659
+ } else {
660
+ var paymentMethodId = TinyJ(self.selectors.paymentMethodId).val();
661
  }
662
 
663
  var oneClickPay = TinyJ(self.selectors.oneClickPayment).val();
664
  var selector = oneClickPay == true ? self.selectors.cardId : self.selectors.cardNumberInput;
665
  if (response.length == 1) {
666
  TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, response[0].secure_thumbnail);
667
+ } else if (oneClickPay != 0) {
668
+ TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, TinyJ(selector).getSelectedOption().attribute('secure_thumb'));
669
  }
670
 
671
  var bin = getBin();
683
  });
684
 
685
  // check if the issuer is necessary to pay
686
+ issuerMandatory = false;
 
687
  var additionalInfo = response[0].additional_info_needed;
688
 
689
  for (var i = 0; i < additionalInfo.length; i++) {
690
  if (additionalInfo[i] == self.selectors.issuerId) {
691
+ issuerMandatory = true;
692
  }
693
  }
694
  ;
695
 
696
+ showLogMercadoPago(String.format(self.messages.issuerMandatory, issuerMandatory));
697
 
698
  var issuer = TinyJ(self.selectors.issuer);
699
 
700
+ if (issuerMandatory) {
701
+ if (paymentMethodId != '') {
702
+ Mercadopago.getIssuers(paymentMethodId, showCardIssuers);
703
+ issuer.change(setInstallmentsByIssuerId);
704
+ }
705
  } else {
706
  TinyJ(self.selectors.issuerMp).hide();
707
  issuer.hide();
709
  }
710
 
711
  } else {
712
+ showLogMercadoPago(String.format(self.messages.issuerMandatory, issuerMandatory));
 
 
713
  }
714
 
715
  defineInputs();
719
  showLogMercadoPago(self.messages.setIssuer);
720
  showLogMercadoPago(status);
721
  showLogMercadoPago(issuers);
722
+ if (issuers.length > 0) {
723
+ var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
724
+ var messageDefaultIssuer = TinyJ(self.selectors.textDefaultIssuer).val();
725
 
726
+ var fragment = document.createDocumentFragment();
 
 
 
727
 
728
+ var option = new Option(messageChoose + "...", '');
729
+ fragment.appendChild(option);
730
 
731
+ for (var i = 0; i < issuers.length; i++) {
732
+ if (issuers[i].name != self.constants.default) {
733
+ option = new Option(issuers[i].name, issuers[i].id);
734
+ } else {
735
+ option = new Option(messageDefaultIssuer, issuers[i].id);
736
+ }
737
+ fragment.appendChild(option);
738
  }
 
 
739
 
740
+ TinyJ(self.selectors.issuer).empty().appendChild(fragment).enable().removeAttribute(self.constants.style);
741
+ TinyJ(self.selectors.issuerMp).removeAttribute(self.constants.style);
742
+ TinyJ(self.selectors.issuerMpLabel).removeAttribute(self.constants.style);
743
+ } else {
744
+ TinyJ(self.selectors.issuer).empty();
745
+ TinyJ(self.selectors.issuer).hide();
746
+ TinyJ(self.selectors.issuerMp).hide();
747
+ TinyJ(self.selectors.issuerMpLabel).hide();
748
+ }
749
  defineInputs();
750
  };
751
 
778
  var route = TinyJ(self.selectors.mercadoRoute).val();
779
  var baseUrl = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.baseUrl).val();
780
  var discountAmount = parseFloat(TinyJ(self.selectors.customDiscountAmount).val());
781
+ var paymentMethodId = TinyJ(self.selectors.paymentMethodId).val();
782
+ if (paymentMethodId != '') {
783
+ options['payment_method_id'] = paymentMethodId;
784
+ }
785
  if (route != self.constants.checkout) {
786
  showLogMercadoPago(self.messages.usingMagentoCustomCheckout);
787
 
863
 
864
  checkCreateCardToken();
865
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
866
  } else {
867
+ showMessageErrorForm(self.selectors.paymenMethodNotFound);
868
  }
869
  }
870
 
904
  }
905
  }
906
 
907
+ var issuers = TinyJ(self.selectors.issuer);
908
+ var issuersFlag = (issuers && issuers.getElem() != null && issuers.getElem().length > 0);
909
+
910
  var docNumber = TinyJ(self.selectors.docNumber).val();
911
  if (docNumber != '' && !checkDocNumber(docNumber)) {
912
+ if (!(dataInputs[x] == "#issuer" && !issuersFlag)) {
913
+ submit = false;
914
+ }
915
  }
916
 
917
  if (submit) {
1172
  enableLog: enableLog,
1173
  isLogEnabled: isLogEnabled
1174
  };
1175
+ })
1176
+ ();
js/mercadopago/tiny.min.js CHANGED
File without changes
js/mercadopago/tinyJ.js CHANGED
File without changes
lib/MercadoPago/Lib/Api.php CHANGED
File without changes
lib/MercadoPago/Lib/RestClient.php CHANGED
File without changes
package.xml CHANGED
@@ -1,66 +1,173 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MercadoPagoTransparent</name>
4
- <version>0.0.4</version>
5
- <stability>stable</stability>
6
- <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>MercadoPago payment extension for Magento: receive payments with our customizable checkout</summary>
10
- <description>"Credit Card Customized Checkout&#xD;
11
- This feature will allow merchants to have a customized checkout for credit card payment. Thus, it will be possible to customize its look and feel, customers won&#x2019;t be redirected away to complete the payment, and it will also reduce the checkout steps improving conversion rates.&#xD;
12
- &#xD;
13
- Available for Argentina, Brazil, Colombia, Mexico and Venezuela&#xD;
14
- &#xD;
15
- Customized Bar Code Payment&#xD;
16
- This feature allows merchants to have a customized bar code payment. It reduces the checkout steps improving conversion rates. The bar code payment will have merchant's logo.&#xD;
17
- &#xD;
18
- Available for Argentina, Brazil, Colombia, Mexico and Venezuela&#xD;
19
- &#xD;
20
- Standard Checkout&#xD;
21
- This feature allows merchants to have a standard checkout. It includes all payment methods (i.e. all credit cards, bar code payment, account money) and all window types (i.e. redirect, iframe, modal, blank and popup). Customization is not allowed.&#xD;
22
- &#xD;
23
- Available for Argentina, Brazil, Chile, Colombia, Mexico and Venezuela&#xD;
24
- &#xD;
25
- OneClick Pay &#xD;
26
- This feature allows to store credit card information for the customer, so that the next time there is no need to enter all the card details. Customers will just need to re-enter the security code of the credit card they want to use."</description>
27
- <notes>"MercadoPago v2.1.2&#xD;
28
- &#xD;
29
- New internal module file structure&#xD;
30
- &#xD;
31
- - Javascript code refactored&#xD;
32
- &#xD;
33
- - New plugin configuration layout&#xD;
34
- &#xD;
35
- - Added Customers &amp; Cards feature&#xD;
36
- &#xD;
37
- - Magento orders now contain subtotals related to MP coupons and financing cost.&#xD;
38
- &#xD;
39
- - Document type and card token validation on checkout&#xD;
40
- &#xD;
41
- - Venezuela added as available country.&#xD;
42
- &#xD;
43
- - Compatibility with OSC extensions innovarti and ideasa&#xD;
44
- &#xD;
45
- MercadoEnvios 0.1.0&#xD;
46
- &#xD;
47
- - New module available for Argentina, Brazil and Mexico only with Standard Checkout&#xD;
48
- &#xD;
49
- - Package size and weight attributes can be mapped with magento attributes, and its units can be converted through admin panel.&#xD;
50
- &#xD;
51
- - Different shipping methods per country can be enabled/disabled.&#xD;
52
- &#xD;
53
- - Shipping cost is calculated and shown in cart page and checkout.&#xD;
54
- &#xD;
55
- - Free shipping option is available.&#xD;
56
- &#xD;
57
- - Tracking information order can be accessed through order details admin section or my account.&#xD;
58
- &#xD;
59
- - Shipping label can be printed through order details admin section."</notes>
60
- <authors><author><name>Developers MercadoPago Brasil</name><user>developers_mercadopago</user><email>developers@mercadopago.com.br</email></author></authors>
61
- <date>2016-03-31</date>
62
- <time>21:27:23</time>
63
- <contents><target name="magecommunity"><dir name="MercadoPago"><dir name="Core"><dir name="Block"><file name="AbstractForm.php" hash="37bbd650b14574dee9f1296bf67ffd10"/><file name="AbstractSuccess.php" hash="6aa920d8b886d22410f50b9625847699"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="af39cd4e8086b008f00bc987303e907a"/></dir></dir></dir></dir><dir name="Custom"><file name="Form.php" hash="733c5dccf752493b9fe24938433ff9fd"/><file name="Info.php" hash="51771218b04b7a41d83adec76e393311"/><file name="Success.php" hash="2ab918e6b2415018d780b1a58d5b6d04"/></dir><dir name="Customticket"><file name="Form.php" hash="6580496bc71be11e4c572e1e143557cf"/><file name="Info.php" hash="f23e8a204e431e95a7bb0e9b409c1df4"/><file name="Success.php" hash="325fc24f1c0d220a95abe238ec583ee5"/></dir><file name="Discount.php" hash="a17b7f08dd57c31d27e57b3acbe03188"/><dir name="Sales"><dir name="Order"><dir name="Totals"><dir name="Discount"><file name="Coupon.php" hash="4bd99d8954d154971b8b51b4318b5b1c"/></dir><dir name="Finance"><file name="Cost.php" hash="750c3c7ca6465439eff098f6ae912b6c"/></dir></dir></dir></dir><dir name="Standard"><file name="Form.php" hash="e6845e293d0c0ca1a6ac04acf79edd1e"/><file name="Info.php" hash="db81d01579b66fbd8251883967768320"/><file name="Pay.php" hash="8ebb3cd8ef5df082343cfe33eadf17e0"/><file name="Success.php" hash="409dd3e16db4ebd5bd22599b7271062c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="ad91fcd07914aa07844303d8fb058b8d"/><dir name="Message"><file name="Abstract.php" hash="1f4f37e4a2cd0d1a18dff6f3e96ca84d"/></dir><file name="Response.php" hash="f247edf929e2d3c3fcfe7e7ea62629de"/><file name="StatusDetailMessage.php" hash="f56549a427452d4e67351274032885db"/><file name="StatusMessage.php" hash="3a7860b8dc843f8f9620852113fc5093"/><file name="StatusOrderMessage.php" hash="f17c394be7b8a795ee05342109c93fe4"/></dir><dir name="Model"><dir name="Api"><file name="Exception.php" hash="8093747fa6e2244c3f59a188911d47c3"/><dir name="V0"><file name="Exception.php" hash="026642775cab4873176aaf28493a9159"/></dir><dir name="V1"><file name="Exception.php" hash="022c7e5ff52d04a91990bdb230f97e73"/></dir></dir><file name="Core.php" hash="6c1e1a0b5f1c45d434a29b4d41de9e9d"/><dir name="Custom"><dir name="Finance"><dir name="Cost"><file name="Creditmemo.php" hash="4e75bb8d2c34e9758a27d9e9db3f6b36"/><file name="Invoice.php" hash="d8123b798f25c119739b9ac16817619c"/></dir><file name="Cost.php" hash="9fab08c5253d19b4106ef9070580f42e"/></dir><file name="Payment.php" hash="d6ffc621ce27ec6e96b3145bdd0d669c"/></dir><file name="CustomPayment.php" hash="d624d2b5bb16232be4c48dacd07b5d11"/><dir name="CustomTicket"><file name="Payment.php" hash="15a619e31be96f0cff76de029fc94c52"/></dir><dir name="Discount"><dir name="Coupon"><file name="Creditmemo.php" hash="87dc7aaac390633ddf87c27e3d097130"/><file name="Invoice.php" hash="a586d210a2b8b57a8dffe9fdb69b5363"/></dir><file name="Coupon.php" hash="54d8cbfb2fd73db87fbe3f93e483a8d8"/></dir><file name="Observer.php" hash="4cdf23a05a1652b8e67c92e8e59557f7"/><dir name="Source"><file name="CategoryId.php" hash="5728ee8c2bb1f41e10103c4ff4b939cb"/><file name="Country.php" hash="93b2efcbefc6e5ea925ca74a88af93f4"/><file name="Installments.php" hash="7c7efe8ef187ff1e2ab00bf7dbcc8cab"/><dir name="Order"><file name="Status.php" hash="4b0b5fadd551b0bc360ae53d99768cda"/></dir><file name="PaymentMethods.php" hash="c92ef487943fadd611ecad44d4d6c083"/><file name="TypeCheckout.php" hash="36496d11ce7fbb1d87f27eb705525b61"/></dir><dir name="Standard"><file name="Payment.php" hash="fe42f97ad53bf14db164350fd08617af"/></dir></dir><dir name="controllers"><file name="ApiController.php" hash="2901e45bb90b472bc81b0353c4acb824"/><file name="NotificationsController.php" hash="7b949c4c48081479db1e65882bd217c7"/><file name="PayController.php" hash="bfa751fb97ffd2d81bbffcc564d7cd0c"/><file name="SuccessController.php" hash="59da945d27a8b8b0ae102bd374415e9b"/></dir><dir name="etc"><file name="config.xml" hash="ec4c7f03e4e1dda852a46ec258913709"/><file name="system.xml" hash="0c474b71b67510d172753d3ba7703bc5"/></dir><dir name="sql"><dir name="mercadopago_setup"><file name="install-2.1.0.php" hash="12ecf80fa3ceaf2e4065bda76cf07a4d"/><file name="upgrade-2.1.0-2.1.1.php" hash="abf330b2171e90fc25f0cfe668bd051d"/><file name="upgrade-2.1.1-2.1.2.php" hash="805656e780e56feb6567c6c310bd9b7b"/></dir></dir></dir><dir name="MercadoEnvios"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Carrier.php" hash="f8a32cf354e44f90e7ce9e64017438f9"/><file name="Mapping.php" hash="b00a1ff552b99b744d29365570b33257"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7733f94af70fe579cf15a9b9820cb83d"/><file name="ItemData.php" hash="ec05bfdc7839e3d1af6089fd0ec17e83"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Attribute"><dir name="Validation"><file name="Mapping.php" hash="9cfa77a4c45541a7dc2034ac7624ec01"/></dir></dir><dir name="Source"><dir name="Shipping"><file name="FreeMethod.php" hash="e8740f8d1b3a67c8cee79b77e40cf7db"/><file name="Method.php" hash="ca97b54ee9883c302ef871a8d3ce5fd0"/></dir></dir></dir><file name="Observer.php" hash="5957f95082a0e266799042b1ee1802bd"/><dir name="Shipping"><dir name="Carrier"><file name="MercadoEnvios.php" hash="508cb199e8b98b0dbbae6fd27923b26b"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="0b87ade9a5cf02b276c571d0e585b138"/><file name="system.xml" hash="17b5096fb89d95e8c05345ee96cc4e7d"/></dir></dir><dir name="OneStepCheckout"><dir name="Block"><dir name="Custom"><file name="Form.php" hash="c3c4d2230eddeca0e49098161b5d5617"/></dir><dir name="Customticket"><file name="Form.php" hash="9deffc44f4ae97765ba02a4885dbe7e5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c0a0af8a83dc71a0ccf1a5f1a3235c8a"/></dir><dir name="Model"><file name="Observer.php" hash="2cfb65eada297e55f59cc490507bd4e3"/></dir><dir name="etc"><file name="config.xml" hash="9e77435b615d9a66379102527a85287f"/><file name="system.xml" hash="0285d96e5edfd8c65773f1d395734a5c"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mercadopago"><file name="array_dropdown.phtml" hash="84c83c98f33de9530517adeb391011ab"/><dir name="custom"><file name="info.phtml" hash="c1a6c2f8725f5e3c49acefdce87d6ba3"/></dir><dir name="custom_ticket"><file name="info.phtml" hash="1c9a896cbd7d2539c2d142fa579f2d90"/></dir><dir name="standard"><file name="info.phtml" hash="c1a6c2f8725f5e3c49acefdce87d6ba3"/></dir></dir></dir><dir name="layout"><file name="mercadopago.xml" hash="3c49e00ad8174bde8e10eb7ac4a72348"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mercadopago"><file name="clean.phtml" hash="fc92035839e69f52192eb9c3063a6864"/><dir name="custom"><file name="form.phtml" hash="b659c97b38dc9b5b9f7ed20c615225b6"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="success.phtml" hash="614035e4ff43696920090860c42de887"/></dir><dir name="custom_ticket"><file name="form.phtml" hash="763c1c6ef5f86a6c1cfffc62de5779d4"/><file name="info.phtml" hash="ab580075fca55962463cbb17628b736d"/><file name="success.phtml" hash="6f2e63745368af0e0b6987274022d14a"/></dir><file name="discount.phtml" hash="310ed2fcc7620c97002e4af155c5aecc"/><dir name="onestepcheckout"><dir name="custom"><file name="form.phtml" hash="179df6e2db3765c254f080dfd2d39646"/></dir></dir><dir name="standard"><file name="form.phtml" hash="089687bb6550b9cd36dbb8b15b6cb493"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="pay.phtml" hash="3e3b83363e355778b98908847a56ab28"/><file name="success.phtml" hash="1cf80826a9c896ff3d4abf68ab579d34"/></dir></dir></dir><dir name="layout"><file name="mercadopago.xml" hash="473e1f06bf5cf3d1793819d9ab72064f"/></dir></dir></dir></dir></target><target name="magelib"><dir name="MercadoPago"><dir name="Lib"><file name="Api.php" hash="83c779aded928366abe82ea54a3fab6c"/><file name="RestClient.php" hash="13d49937d6ba8b7e245179c74a762940"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="mercadopago"><dir name="images"><file name="cards.jpg" hash="53b06cbec7b20d95cdcaaf3b49bd2aa5"/><file name="logo.png" hash="460a0815c67a23da265f42c8bab0842a"/><file name="mercadoenvios.png" hash="006cd6ddfa8e5a19354942f79b659b5e"/></dir><file name="styles.css" hash="cac25e698c010f73dc3af01ef3377320"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="mercadopago"><dir name="css"><file name="style-success.css" hash="2780801704d278d22aff40cf333f4cf4"/><file name="style.css" hash="5d034d69a742236f658e969c1a1a7e07"/></dir><dir name="images"><file name="loading.gif" hash="5c43434f066c2fbc4714c768b8f83853"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="mercadopago"><file name="jquery-1.11.0.min.js" hash="52d16e147b5346147d0f3269cd4d0f80"/><file name="mercadopago.js" hash="5e0ac973773787c704add38fce02d582"/><file name="mercadopago_osc.js" hash="12c556d552612e3706dcbe22ff96bf5b"/><file name="tiny.min.js" hash="71bce92ef942b0ac15683f94e1f3e3a5"/><file name="tinyJ.js" hash="3318ec214b9a21fe954ce5675de013f3"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MercadoPago_Core.xml" hash="0770f2e1dd0110c2c13a330d3411fd68"/><file name="MercadoPago_MercadoEnvios.xml" hash="f7e8607c78d8b39075eb8f7700691a44"/><file name="MercadoPago_OneStepCheckout.xml" hash="9e05c392d8f00c9604ac9ad748977489"/></dir></target><target name="magelocale"><dir name="en_US"><file name="MercadoPago_Core.csv" hash="35cb0e856ef1af496e3ebf068f53d248"/></dir><dir name="es_AR"><file name="MercadoPago_Core.csv" hash="c0364c2897611efa166269adc440de77"/></dir><dir name="es_CL"><file name="MercadoPago_Core.csv" hash="ddfb3f0ff551fbf3350e1321d6d0bd3e"/></dir><dir name="es_CO"><file name="MercadoPago_Core.csv" hash="7057e0579c38432fa14f2446742f650a"/></dir><dir name="es_ES"><file name="MercadoPago_Core.csv" hash="11251df16d82efb3490bbc14a7d97c35"/></dir><dir name="es_MX"><file name="MercadoPago_Core.csv" hash="dcfd9c8d0573a15ecaeb52fca9518883"/></dir><dir name="es_VE"><file name="MercadoPago_Core.csv" hash="5586a0b0fe01d82e3a55ece73d09ff13"/></dir><dir name="pt_BR"><file name="MercadoPago_Core.csv" hash="77bd45ae846221de01c0cda4c8fe5b3c"/></dir></target></contents>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  <compatible/>
65
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
66
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MercadoPagoTransparent</name>
4
+ <version>2.2.0</version>
5
+ <stability>devel</stability>
6
+ <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>MercadoPago payment extension for Magento: receive payments with our customizable checkout</summary>
10
+ <description>&lt;b&gt;Credit Card Customized Checkout&lt;/b&gt;&#xD;
11
+ &#xD;
12
+ &lt;p&gt;&#xD;
13
+ This feature will allow merchants to have a customized checkout for credit card payment. Thus, it will be possible to customize its look and feel, customers won&#x2019;t be redirected away to complete the payment, and it will also reduce the checkout steps improving conversion rates.&#xD;
14
+ &lt;/p&gt;&#xD;
15
+ &lt;p&gt;&#xD;
16
+ Available for &lt;i&gt;Argentina&lt;/i&gt;, &lt;i&gt;Brazil&lt;/i&gt;, &lt;i&gt;Colombia&lt;/i&gt;, &lt;i&gt;Mexico&lt;/i&gt; and &lt;i&gt;Venezuela&lt;/i&gt;&#xD;
17
+ &lt;/p&gt;&#xD;
18
+ &#xD;
19
+ &lt;b&gt;Customized Bar Code Payment&lt;/b&gt;&#xD;
20
+ &#xD;
21
+ &lt;p&gt;&#xD;
22
+ This feature allows merchants to have a customized bar code payment. It reduces the checkout steps improving conversion rates. The bar code payment will have merchant's logo.&#xD;
23
+ &lt;/p&gt;&#xD;
24
+ &lt;p&gt;&#xD;
25
+ Available for &lt;i&gt;Argentina&lt;/i&gt;, &lt;i&gt;Brazil&lt;/i&gt;, &lt;i&gt;Colombia&lt;/i&gt;, &lt;i&gt;Mexico&lt;/i&gt; and &lt;i&gt;Venezuela&lt;/i&gt;&#xD;
26
+ &lt;/p&gt;&#xD;
27
+ &#xD;
28
+ &lt;b&gt;Standard Checkout&lt;/b&gt;&#xD;
29
+ &#xD;
30
+ &lt;p&gt;&#xD;
31
+ This feature allows merchants to have a standard checkout. It includes all payment methods (i.e. all credit cards, bar code payment, account money) and all window types (i.e. redirect, iframe, modal, blank and popup). Customization is not allowed.&#xD;
32
+ &lt;/p&gt;&#xD;
33
+ &lt;p&gt;&#xD;
34
+ Available for &lt;i&gt;Argentina&lt;/i&gt;, &lt;i&gt;Brazil&lt;/i&gt;, &lt;i&gt;Chile&lt;/i&gt;, &lt;i&gt;Colombia&lt;/i&gt;, &lt;i&gt;Mexico&lt;/i&gt; and &lt;i&gt;Venezuela&lt;/i&gt;&#xD;
35
+ &lt;/p&gt;&#xD;
36
+ &#xD;
37
+ &lt;b&gt;OneClick Pay&lt;/b&gt;&#xD;
38
+ &#xD;
39
+ &lt;p&gt;&#xD;
40
+ This feature allows to store credit card information for the customer, so that the next time there is no need to enter all the card details. Customers will just need to re-enter the security code of the credit card they want to use.&#xD;
41
+ &lt;/p&gt;&#xD;
42
+ &#xD;
43
+ &lt;b&gt; Compatibility with OSC extensions &lt;/b&gt;&#xD;
44
+ &lt;p&gt;&#xD;
45
+ This feature allows easy integration with two of the most used One Step Checkout extensions in the market: &lt;br /&gt;&lt;br /&gt;&#xD;
46
+ &#xD;
47
+ - Inovarti OSC&lt;br /&gt;&#xD;
48
+ - Idecheckoutvm&lt;br /&gt;&#xD;
49
+ &lt;/p&gt;&#xD;
50
+ &#xD;
51
+ &lt;b&gt;Shipment integration&lt;/b&gt;&#xD;
52
+ &lt;p&gt;&#xD;
53
+ This feature allows to setup and integrate with MercadoEnvios shipment method as another shipment option for customers. It includes the possibility to print the shipping label directly from the Magento Admin Panel. Free shipping is also available.&#xD;
54
+ &lt;/p&gt;&#xD;
55
+ &lt;p&gt;&#xD;
56
+ Available for &lt;i&gt;Argentina&lt;/i&gt;, &lt;i&gt;Brazil&lt;/i&gt; and &lt;i&gt;Mexico&lt;/i&gt; only with &lt;u&gt;Standard Checkout&lt;/u&gt;&#xD;
57
+ &lt;/p&gt;&#xD;
58
+ &#xD;
59
+ &lt;b&gt;Setup MercadoPago&lt;/b&gt;&#xD;
60
+ &lt;ol&gt;&#xD;
61
+ &lt;li&gt;Go to System &gt; Configuration &gt; Sales &gt; Payment Methods. Select Mercado Pago - Global Configuration.&lt;/li&gt;&#xD;
62
+ &#xD;
63
+ &lt;li&gt;Set your Country to the same where your account was created on, and save config. Note: If you change the Country where your account was created you need save configuration in order to refresh the excluded payment methods.&lt;/li&gt;&#xD;
64
+ &#xD;
65
+ &lt;li&gt;Other general configurations: &lt;br /&gt;&#xD;
66
+ &lt;b&gt;Category of your store&lt;/b&gt;: Sets up the category of the store.&lt;br /&gt;&#xD;
67
+ &lt;b&gt;Choose the status of approved orders&lt;/b&gt;: Sets up the order status when payments are approved.&lt;br /&gt;&#xD;
68
+ &lt;b&gt;Choose the status of refunded orders&lt;/b&gt;: Sets up the order status when payments are refunded.&lt;br /&gt;&#xD;
69
+ &lt;b&gt;Choose the status when payment is pending&lt;/b&gt;: Sets up the order status when payments are pending.&lt;br /&gt;&#xD;
70
+ &lt;b&gt;Choose the status when client open a mediation&lt;/b&gt;: Sets up the order status when client opens a mediation.&lt;br /&gt;&#xD;
71
+ &lt;b&gt;Choose the status when payment was reject&lt;/b&gt;: Sets up the order status when payments are rejected.&lt;br /&gt;&#xD;
72
+ &lt;b&gt;Choose the status when payment was canceled&lt;/b&gt;: Sets up the order status when payments are canceled.&lt;br /&gt;&#xD;
73
+ &lt;b&gt;Choose the status when payment was chargeback&lt;/b&gt;: Sets up the order status when payments are chargeback.&lt;br /&gt;&#xD;
74
+ &lt;b&gt;Logs&lt;/b&gt;: Enables/disables system logs.&lt;br /&gt;&#xD;
75
+ &lt;b&gt;Debug Mode&lt;/b&gt;: If enabled, displays the raw response from the API instead of a friendly message.&lt;br /&gt;&#xD;
76
+ &lt;b&gt;Onestepcheckout Active&lt;/b&gt; (Only available if MercadoPago_OneStepCheckout Module is installed): Enables/disables compatibility with one step checkout modules.&lt;br /&gt;&#xD;
77
+ &lt;/li&gt;&#xD;
78
+ &lt;/ol&gt;&#xD;
79
+ &#xD;
80
+ &#xD;
81
+ &lt;b&gt;Custom Checkout Payment Solution&lt;/b&gt;&#xD;
82
+ &lt;ol&gt;&#xD;
83
+ &lt;li&gt;Go to System &gt; Configuration &gt; Sales &gt; Payment Methods. Select Mercado Pago - Custom Checkout. &lt;/li&gt;&#xD;
84
+ &lt;li&gt;Set your Public Key and Access Token.&#x2028; In order to get them check the following links according to the country you are opperating in:&lt;br /&gt;&#xD;
85
+ Argentina: &lt;a href="https://www.mercadopago.com/mla/account/credentials"&gt;https://www.mercadopago.com/mla/account/credentials&lt;/a&gt;&lt;br /&gt;&#xD;
86
+ Brazil: &lt;a href="https://www.mercadopago.com/mlb/account/credentials"&gt;https://www.mercadopago.com/mlb/account/credentials&lt;/a&gt;&lt;br /&gt;&#xD;
87
+ Chile: &lt;a href="https://www.mercadopago.com/mlc/account/credentials"&gt;https://www.mercadopago.com/mlc/account/credentials&lt;/a&gt;&lt;br /&gt;&#xD;
88
+ Colombia: &lt;a href="https://www.mercadopago.com/mco/account/credentials"&gt;https://www.mercadopago.com/mco/herramientas/aplicaciones&lt;/a&gt;&lt;br /&gt;&#xD;
89
+ exico: &lt;a href="https://www.mercadopago.com/mlm/account/credentials"&gt;https://www.mercadopago.com/mlm/account/credentials&lt;/a&gt;&lt;br /&gt;&#xD;
90
+ Venezuela: &lt;a href="https://www.mercadopago.com/mlv/account/credentials"&gt;https://www.mercadopago.com/mlv/account/credentials&lt;/a&gt;&lt;br /&gt;&#xD;
91
+ &lt;/li&gt;&#xD;
92
+ &lt;/ol&gt;&#xD;
93
+ &#xD;
94
+ &lt;p&gt;&#xD;
95
+ If you want to enable credit card solution, check the configurations under Checkout Custom - Credit Card: &lt;br /&gt;&lt;br /&gt;&#xD;
96
+ &lt;b&gt;Enabled&lt;/b&gt;: Enables/disables this payment solution.&lt;br /&gt;&#xD;
97
+ &lt;b&gt;Payment Title&lt;/b&gt;: Sets the payment title.&lt;br /&gt;&#xD;
98
+ &lt;b&gt;Statement Descriptor&lt;/b&gt;: Sets the label as the customer will see the charge for amount in his/her bill.&lt;br /&gt;&#xD;
99
+ &lt;b&gt;Binary Mode&lt;/b&gt;: When set to true, the payment can only be approved or rejected. Otherwise in_process status is added.&lt;br /&gt;&#xD;
100
+ &lt;b&gt;Banner Checkout&lt;/b&gt;: Sets the URL for the banner image in the payment method selection in the checkout process.&lt;br /&gt;&#xD;
101
+ &lt;b&gt;Checkout Position&lt;/b&gt;: The position of the payment solution in the checkout process.&lt;br /&gt;&#xD;
102
+ &lt;b&gt;Marketing - Coupon Mercado Pago&lt;/b&gt;: Enables/disables the coupon form.&lt;br /&gt;&#xD;
103
+ &lt;/p&gt;&#xD;
104
+ &#xD;
105
+ &lt;p&gt;&#xD;
106
+ If you want to enable ticket solution, check the configurations under Checkout Custom - Ticket:&lt;br /&gt;&lt;br /&gt;&#xD;
107
+ &lt;b&gt;Enabled&lt;/b&gt;: Enables/disables this payment solution.&lt;br /&gt;&#xD;
108
+ &lt;b&gt;Payment Title&lt;/b&gt;: Sets the payment title.&lt;br /&gt;&#xD;
109
+ &lt;b&gt;Banner Checkout&lt;/b&gt;: Sets the URL for the banner image in the payment method selection in the checkout process.&lt;br /&gt;&#xD;
110
+ &lt;b&gt;Checkout Position&lt;/b&gt;: The position of the payment solution in the checkout process.&lt;br /&gt;&#xD;
111
+ &lt;b&gt;Marketing - Coupon Mercado Pago&lt;/b&gt;: Enables/disables the coupon form.&lt;br /&gt;&#xD;
112
+ &lt;/p&gt;&#xD;
113
+ &#xD;
114
+ &lt;b&gt;Standard Checkout Payment Solution&lt;/b&gt;&#xD;
115
+ &#xD;
116
+ &lt;ol&gt;&#xD;
117
+ &lt;li&gt;Go to System &gt; Configuration &gt; Sales &gt; Payment Methods. Select Mercado Pago - Classic Checkout.Go to System &gt; Configuration &gt; Sales &gt; Payment Methods. Select Mercado Pago - Classic Checkout.&lt;/li&gt;&#xD;
118
+ &lt;li&gt;&#xD;
119
+ Enable the solution and set your Client Id and Client Secret. Get them in the following address: &#xD;
120
+ Argentina: &lt;a href="https://www.mercadopago.com/mla/herramientas/aplicaciones"&gt;https://www.mercadopago.com/mla/herramientas/aplicaciones&lt;/a&gt;&lt;br /&gt;&#xD;
121
+ Brazil: &lt;a href="https://www.mercadopago.com/mlb/ferramentas/aplicacoes"&gt;https://www.mercadopago.com/mlb/ferramentas/aplicacoes&lt;/a&gt;&lt;br /&gt;&#xD;
122
+ Chile: &lt;a href="https://www.mercadopago.com/mlc/herramientas/aplicaciones"&gt;https://www.mercadopago.com/mlc/herramientas/aplicaciones&lt;/a&gt;&lt;br /&gt;&#xD;
123
+ Colombia: &lt;a href="https://www.mercadopago.com/mco/herramientas/aplicaciones"&gt;https://www.mercadopago.com/mco/herramientas/aplicaciones&lt;/a&gt;&lt;br /&gt;&#xD;
124
+ Mexico: &lt;a href="https://www.mercadopago.com/mlm/herramientas/aplicaciones"&gt;https://www.mercadopago.com/mlm/herramientas/aplicaciones&lt;/a&gt;&lt;br /&gt;&#xD;
125
+ Venezuela: &lt;a href="https://www.mercadopago.com/mlv/herramientas/aplicaciones"&gt;https://www.mercadopago.com/mlv/herramientas/aplicaciones&lt;/a&gt;&lt;br /&gt;&#xD;
126
+ &lt;/li&gt;&#xD;
127
+ &lt;li&gt;&#xD;
128
+ Check the additional configurations: &lt;br /&gt;&#xD;
129
+ &lt;b&gt;Payment Title&lt;/b&gt;: Sets the payment title.&lt;br /&gt;&#xD;
130
+ &lt;b&gt;Banner Checkout&lt;/b&gt;: Sets the URL for the banner image in the payment method selection in the checkout process.&lt;br /&gt;&#xD;
131
+ &lt;b&gt;Checkout Position&lt;/b&gt;: The position of the payment solution in the checkout process.&lt;br /&gt;&#xD;
132
+ &lt;b&gt;Type Checkout&lt;/b&gt;: Sets the type of checkout, the options are:&lt;br /&gt;&#xD;
133
+ &lt;i&gt;Iframe&lt;/i&gt;: Opens a Magento URL with a iframe as the content.&lt;br /&gt;&#xD;
134
+ &lt;i&gt;Redirect&lt;/i&gt;: Redirects to Mercado Pago URL.&lt;br /&gt;&#xD;
135
+ &lt;i&gt;Lightbox&lt;/i&gt;: Similar to Iframe option but opens a lightbox instead of an iframe. &lt;br /&gt;&#xD;
136
+ &lt;/li&gt;&#xD;
137
+ &lt;/ol&gt;&#xD;
138
+ &#xD;
139
+ &#xD;
140
+ &lt;b&gt;MercadoEnvios&lt;/b&gt;&#xD;
141
+ &#xD;
142
+ &lt;p&gt;In order to setup MercadoEnvios follow these instructions: &#xD;
143
+ &lt;ol&gt;&#xD;
144
+ &lt;li&gt;Setup MercadoPago Standard Checkout. &lt;/li&gt;&#xD;
145
+ &lt;li&gt;Go to System &gt; Configuration &gt; Sales &gt; Shipping Methods &gt; MercadoEnvios. &lt;/li&gt;&#xD;
146
+ &lt;li&gt;&#xD;
147
+ Setup the plugin: &lt;br /&gt;&#xD;
148
+ &lt;b&gt;Enabled&lt;/b&gt;: Enables/disables this MercadoEnvios solution.&lt;br /&gt;&#xD;
149
+ &lt;b&gt;Title&lt;/b&gt;: Sets up the shipping method label displayed in the shipping section in checkout process.&lt;br /&gt;&#xD;
150
+ &lt;b&gt;Product attributes mapping&lt;/b&gt;: Maps the system attributes with the dimensions and weight. Also allows to set up the attribute unit.&lt;br /&gt;&#xD;
151
+ &lt;b&gt;Available shipping methods&lt;/b&gt;: Sets up the shipping options visible in the checkout process.&lt;br /&gt;&#xD;
152
+ &lt;b&gt;Free Method&lt;/b&gt;: Sets up the method to use as free shipping.&lt;br /&gt;&#xD;
153
+ &lt;b&gt;Free Shipping with Minimum Order Amount&lt;/b&gt;: Enables/disables the order minimum for free shipping to be available.&lt;br /&gt;&#xD;
154
+ &lt;b&gt;Show method if not applicable&lt;/b&gt;: If enabled, the shipping method is displayed when it's not available.&lt;br /&gt;&#xD;
155
+ &lt;b&gt;Displayed Error Message&lt;/b&gt;: Sets up the text to be displayed when the shipping method is not available.&lt;br /&gt;&#xD;
156
+ &lt;b&gt;Debug Mode&lt;/b&gt;: If enabled, displays the raw response from the API instead of a friendly message.&lt;br /&gt;&#xD;
157
+ &lt;b&gt;Sort order&lt;/b&gt;: Sets up the sort order to be displayed in the shipping step in checkout process.&lt;br /&gt;&#xD;
158
+ &lt;/li&gt;&#xD;
159
+ &lt;/ol&gt;&#xD;
160
+ &lt;/p&gt;&#xD;
161
+ </description>
162
+ <notes>- Fix issue with multiple notifications&#xD;
163
+ - Fix issue with approved tickets notifications&#xD;
164
+ - Change logic for shipments calculation&#xD;
165
+ - Add option include/exclude financing cost from the orders&#xD;
166
+ - Fix other minor issues</notes>
167
+ <authors><author><name>MercadoPago</name><user>MercadoPago</user><email>developer@mercadopago.com.br</email></author></authors>
168
+ <date>2016-06-08</date>
169
+ <time>19:30:51</time>
170
+ <contents><target name="magecommunity"><dir name="MercadoPago"><dir><dir name="Core"><dir name="Block"><file name="AbstractForm.php" hash="37bbd650b14574dee9f1296bf67ffd10"/><file name="AbstractSuccess.php" hash="6aa920d8b886d22410f50b9625847699"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="5ecbfb51b488a3e3211dfaec5d8c0efe"/></dir></dir></dir></dir><dir name="Custom"><file name="Form.php" hash="733c5dccf752493b9fe24938433ff9fd"/><file name="Info.php" hash="51771218b04b7a41d83adec76e393311"/><file name="Success.php" hash="2ab918e6b2415018d780b1a58d5b6d04"/></dir><dir name="Customticket"><file name="Form.php" hash="6580496bc71be11e4c572e1e143557cf"/><file name="Info.php" hash="f23e8a204e431e95a7bb0e9b409c1df4"/><file name="Success.php" hash="325fc24f1c0d220a95abe238ec583ee5"/></dir><file name="Discount.php" hash="a17b7f08dd57c31d27e57b3acbe03188"/><dir name="Sales"><dir name="Order"><dir name="Totals"><dir name="Discount"><file name="Coupon.php" hash="4bd99d8954d154971b8b51b4318b5b1c"/></dir><dir name="Finance"><file name="Cost.php" hash="750c3c7ca6465439eff098f6ae912b6c"/></dir></dir></dir></dir><dir name="Standard"><file name="Form.php" hash="e6845e293d0c0ca1a6ac04acf79edd1e"/><file name="Info.php" hash="db81d01579b66fbd8251883967768320"/><file name="Pay.php" hash="8ebb3cd8ef5df082343cfe33eadf17e0"/><file name="Success.php" hash="409dd3e16db4ebd5bd22599b7271062c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9d885a9cc09e291eaa1cc31d587be611"/><dir name="Message"><file name="Abstract.php" hash="1f4f37e4a2cd0d1a18dff6f3e96ca84d"/></dir><file name="Response.php" hash="f247edf929e2d3c3fcfe7e7ea62629de"/><file name="StatusDetailMessage.php" hash="f56549a427452d4e67351274032885db"/><file name="StatusMessage.php" hash="3a7860b8dc843f8f9620852113fc5093"/><file name="StatusOrderMessage.php" hash="f17c394be7b8a795ee05342109c93fe4"/></dir><dir name="Model"><dir name="Api"><file name="Exception.php" hash="8093747fa6e2244c3f59a188911d47c3"/><dir name="V0"><file name="Exception.php" hash="026642775cab4873176aaf28493a9159"/></dir><dir name="V1"><file name="Exception.php" hash="022c7e5ff52d04a91990bdb230f97e73"/></dir></dir><file name="Core.php" hash="9c31aba9695d4d1137f59a3f05ad0b80"/><dir name="Custom"><dir name="Finance"><dir name="Cost"><file name="Creditmemo.php" hash="4e75bb8d2c34e9758a27d9e9db3f6b36"/><file name="Invoice.php" hash="d8123b798f25c119739b9ac16817619c"/></dir><file name="Cost.php" hash="9fab08c5253d19b4106ef9070580f42e"/></dir><file name="Payment.php" hash="aab8fd3fc058c1fde9a75f1c3367df7a"/></dir><file name="CustomPayment.php" hash="bc92b4a75716d1fab5c30ae2240c127d"/><dir name="CustomTicket"><file name="Payment.php" hash="b5a003f1e646d25bb5b5b527634600a9"/></dir><dir name="Discount"><dir name="Coupon"><file name="Creditmemo.php" hash="87dc7aaac390633ddf87c27e3d097130"/><file name="Invoice.php" hash="a586d210a2b8b57a8dffe9fdb69b5363"/></dir><file name="Coupon.php" hash="54d8cbfb2fd73db87fbe3f93e483a8d8"/></dir><file name="Observer.php" hash="17a28a9a435e52313e32a4eb8dc4a8e8"/><dir name="Source"><file name="CategoryId.php" hash="5728ee8c2bb1f41e10103c4ff4b939cb"/><file name="Country.php" hash="93b2efcbefc6e5ea925ca74a88af93f4"/><file name="Installments.php" hash="7c7efe8ef187ff1e2ab00bf7dbcc8cab"/><dir name="Order"><file name="Status.php" hash="4b0b5fadd551b0bc360ae53d99768cda"/></dir><file name="PaymentMethods.php" hash="7c9809f0485a59f4a430dbcd9e351145"/><file name="TypeCheckout.php" hash="36496d11ce7fbb1d87f27eb705525b61"/></dir><dir name="Standard"><file name="Payment.php" hash="8d83831d8225e183a5f0ec641e099ae8"/></dir></dir><dir name="controllers"><file name="ApiController.php" hash="2901e45bb90b472bc81b0353c4acb824"/><file name="NotificationsController.php" hash="296713860c1f6c43167cdddea775c44f"/><file name="PayController.php" hash="bfa751fb97ffd2d81bbffcc564d7cd0c"/><file name="SuccessController.php" hash="3a7eeede5d6bdb1f770b019bb2c71af6"/></dir><dir name="etc"><file name="config.xml" hash="147411e7fb1c3521d351abb3af8afc32"/><file name="system.xml" hash="9978d82377aed7c6a3f943f89c12ad9f"/></dir><dir name="sql"><dir name="mercadopago_setup"><file name="install-2.1.0.php" hash="12ecf80fa3ceaf2e4065bda76cf07a4d"/><file name="upgrade-2.1.0-2.1.1.php" hash="abf330b2171e90fc25f0cfe668bd051d"/><file name="upgrade-2.1.1-2.1.2.php" hash="805656e780e56feb6567c6c310bd9b7b"/></dir></dir></dir><dir name="MercadoEnvios"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Carrier.php" hash="f8a32cf354e44f90e7ce9e64017438f9"/><file name="Mapping.php" hash="b00a1ff552b99b744d29365570b33257"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="CarrierData.php" hash="4532a9efcec29f1106569e4a63ab2a1b"/><file name="Data.php" hash="6b997724247f93ed51031254e5884989"/><file name="ItemData.php" hash="ec05bfdc7839e3d1af6089fd0ec17e83"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Attribute"><dir name="Validation"><file name="Mapping.php" hash="9cfa77a4c45541a7dc2034ac7624ec01"/></dir></dir><dir name="Source"><dir name="Shipping"><file name="FreeMethod.php" hash="e8740f8d1b3a67c8cee79b77e40cf7db"/><file name="Method.php" hash="f0dde5407e7b8efb31c6e71065138800"/><dir name="Print"><file name="Mode.php" hash="70f65b1c619863cbabe81086a13d1896"/></dir></dir></dir></dir><file name="Observer.php" hash="832bea83bb1930666dfcfc4fbcd61a54"/><dir name="Shipping"><dir name="Carrier"><file name="MercadoEnvios.php" hash="ffa13a64f24cb02ff52512b6b3212e3d"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="4500ab15c34b3bd2ddf5385e751984e6"/><file name="system.xml" hash="03bf9f1b99e2db15a8365f8ecf12cc31"/></dir></dir><dir name="OneStepCheckout"><dir name="Block"><dir name="Custom"><file name="Form.php" hash="34033d6813650d77c75c8c3e9a9cd88a"/></dir><dir name="Customticket"><file name="Form.php" hash="9deffc44f4ae97765ba02a4885dbe7e5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c0a0af8a83dc71a0ccf1a5f1a3235c8a"/></dir><dir name="Model"><file name="Observer.php" hash="2cfb65eada297e55f59cc490507bd4e3"/></dir><dir name="etc"><file name="config.xml" hash="851b80b4d234473a059df7525945bd1b"/><file name="system.xml" hash="0285d96e5edfd8c65773f1d395734a5c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mercadopago.xml" hash="3c49e00ad8174bde8e10eb7ac4a72348"/></dir><dir name="template"><dir name="mercadopago"><file name="array_dropdown.phtml" hash="84c83c98f33de9530517adeb391011ab"/><dir name="custom"><file name="info.phtml" hash="c1a6c2f8725f5e3c49acefdce87d6ba3"/></dir><dir name="custom_ticket"><file name="info.phtml" hash="1c9a896cbd7d2539c2d142fa579f2d90"/></dir><dir name="standard"><file name="info.phtml" hash="c1a6c2f8725f5e3c49acefdce87d6ba3"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mercadopago.xml" hash="473e1f06bf5cf3d1793819d9ab72064f"/></dir><dir name="template"><dir name="mercadopago"><file name="clean.phtml" hash="fc92035839e69f52192eb9c3063a6864"/><dir name="custom"><file name="form.phtml" hash="962ab03a2d47c1495623bdbd787122d2"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="success.phtml" hash="614035e4ff43696920090860c42de887"/></dir><dir name="custom_ticket"><file name="form.phtml" hash="763c1c6ef5f86a6c1cfffc62de5779d4"/><file name="info.phtml" hash="ab580075fca55962463cbb17628b736d"/><file name="success.phtml" hash="6f2e63745368af0e0b6987274022d14a"/></dir><file name="discount.phtml" hash="310ed2fcc7620c97002e4af155c5aecc"/><dir name="onestepcheckout"><dir name="custom"><file name="form.phtml" hash="b5b363ae0814816a6c7a416d9ed7dd16"/></dir></dir><dir name="standard"><file name="form.phtml" hash="089687bb6550b9cd36dbb8b15b6cb493"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="pay.phtml" hash="3e3b83363e355778b98908847a56ab28"/><file name="success.phtml" hash="1cf80826a9c896ff3d4abf68ab579d34"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="MercadoPago_Core.csv" hash="c9ef509e6285928195787f6c393fa1b4"/></dir><dir name="es_AR"><file name="MercadoPago_Core.csv" hash="a25b190f8051d3041240a19f65404a61"/></dir><dir name="es_CL"><file name="MercadoPago_Core.csv" hash="9410f5fd291807b737f302627ee4f149"/></dir><dir name="es_CO"><file name="MercadoPago_Core.csv" hash="6f2937031991436f3653df27e8cd0241"/></dir><dir name="es_ES"><file name="MercadoPago_Core.csv" hash="9d8b8df4d5507352910c69032d392844"/></dir><dir name="es_MX"><file name="MercadoPago_Core.csv" hash="446c5a20320c5f562bb81d0b31088cfb"/></dir><dir name="es_VE"><file name="MercadoPago_Core.csv" hash="db3ca60c5518afcfaaf8c7c630d15f12"/></dir><dir name="pt_BR"><file name="MercadoPago_Core.csv" hash="d96a1558aace434cd42e0594bc697e6f"/></dir></target><target name="mageweb"><dir name="js"><dir name="mercadopago"><file name="jquery-1.11.0.min.js" hash="52d16e147b5346147d0f3269cd4d0f80"/><file name="mercadopago.js" hash="ae8b99b1740a3133500d07a16ced5add"/><file name="mercadopago_osc.js" hash="ffa5957d037299812ccb4d08ef5799ec"/><file name="tiny.min.js" hash="71bce92ef942b0ac15683f94e1f3e3a5"/><file name="tinyJ.js" hash="3318ec214b9a21fe954ce5675de013f3"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="mercadopago"><dir name="images"><file name="cards.jpg" hash="53b06cbec7b20d95cdcaaf3b49bd2aa5"/><file name="logo.png" hash="460a0815c67a23da265f42c8bab0842a"/><file name="mercadoenvios.png" hash="006cd6ddfa8e5a19354942f79b659b5e"/></dir><file name="styles.css" hash="cac25e698c010f73dc3af01ef3377320"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="mercadopago"><dir name="css"><file name="style-success.css" hash="2780801704d278d22aff40cf333f4cf4"/><file name="style.css" hash="5d034d69a742236f658e969c1a1a7e07"/></dir><dir name="images"><file name="loading.gif" hash="5c43434f066c2fbc4714c768b8f83853"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="MercadoPago"><dir name="Lib"><file name="Api.php" hash="83c779aded928366abe82ea54a3fab6c"/><file name="RestClient.php" hash="13d49937d6ba8b7e245179c74a762940"/></dir></dir></target></contents>
171
  <compatible/>
172
+ <dependencies><required><php><min>5.4.0</min><max>5.5.0</max></php></required></dependencies>
173
  </package>
skin/adminhtml/default/default/mercadopago/images/cards.jpg CHANGED
File without changes
skin/adminhtml/default/default/mercadopago/images/logo.png CHANGED
File without changes
skin/adminhtml/default/default/mercadopago/images/mercadoenvios.png CHANGED
File without changes
skin/adminhtml/default/default/mercadopago/styles.css CHANGED
File without changes
skin/frontend/base/default/mercadopago/css/style-success.css CHANGED
File without changes
skin/frontend/base/default/mercadopago/css/style.css CHANGED
File without changes
skin/frontend/base/default/mercadopago/images/loading.gif CHANGED
File without changes