MercadoPagoTransparent - Version 2.6.3

Version Notes

Added Uruguay support
Added cron for order status updates
Added translations
Bug fixing

Download this release

Release Info

Developer MercadoPago
Extension MercadoPagoTransparent
Version 2.6.3
Comparing to
See all releases


Code changes from version 2.4.1 to 2.6.3

Files changed (45) hide show
  1. app/code/community/MercadoPago/Core/Block/Calculator/CalculatorForm.php +61 -0
  2. app/code/community/MercadoPago/Core/Block/Calculator/CalculatorLink.php +65 -0
  3. app/code/community/MercadoPago/Core/Block/Recurring/Form.php +12 -0
  4. app/code/community/MercadoPago/Core/Block/Recurring/Info.php +25 -0
  5. app/code/community/MercadoPago/Core/Block/Recurring/Pay.php +12 -0
  6. app/code/community/MercadoPago/Core/Block/Recurring/Success.php +12 -0
  7. app/code/community/MercadoPago/Core/Helper/Data.php +57 -9
  8. app/code/community/MercadoPago/Core/Helper/Response.php +4 -0
  9. app/code/community/MercadoPago/Core/Helper/StatusUpdate.php +149 -30
  10. app/code/community/MercadoPago/Core/Model/Core.php +40 -11
  11. app/code/community/MercadoPago/Core/Model/Cron/Order.php +97 -0
  12. app/code/community/MercadoPago/Core/Model/Custom/Payment.php +93 -19
  13. app/code/community/MercadoPago/Core/Model/CustomTicket/Payment.php +3 -1
  14. app/code/community/MercadoPago/Core/Model/Observer.php +104 -57
  15. app/code/community/MercadoPago/Core/Model/Recurring/Payment.php +303 -0
  16. app/code/community/MercadoPago/Core/Model/Source/Country.php +1 -0
  17. app/code/community/MercadoPago/Core/Model/Source/ListPages.php +28 -0
  18. app/code/community/MercadoPago/Core/Model/Source/Order/Status.php +2 -2
  19. app/code/community/MercadoPago/Core/controllers/CalculatorPaymentController.php +11 -0
  20. app/code/community/MercadoPago/Core/controllers/NotificationsController.php +126 -59
  21. app/code/community/MercadoPago/Core/controllers/RecurringPaymentController.php +27 -0
  22. app/code/community/MercadoPago/Core/etc/config.xml +40 -1
  23. app/code/community/MercadoPago/Core/etc/jstranslator.xml +17 -0
  24. app/code/community/MercadoPago/Core/etc/system.xml +272 -52
  25. app/code/community/MercadoPago/MercadoEnvios/etc/config.xml +1 -1
  26. app/code/community/MercadoPago/MercadoEnvios/etc/system.xml +1 -1
  27. app/code/community/MercadoPago/OneStepCheckout/etc/config.xml +1 -1
  28. app/code/community/MercadoPago/OneStepCheckout/etc/system.xml +1 -1
  29. app/design/frontend/base/default/layout/mercadopago.xml +39 -0
  30. app/design/frontend/base/default/template/mercadopago/calculator/calculatorForm.phtml +110 -0
  31. app/design/frontend/base/default/template/mercadopago/calculator/calculatorLink.phtml +12 -0
  32. app/design/frontend/base/default/template/mercadopago/custom/form.phtml +78 -79
  33. app/design/frontend/base/default/template/mercadopago/custom/secondCard.phtml +147 -0
  34. app/design/frontend/base/default/template/mercadopago/custom/success.phtml +11 -3
  35. app/design/frontend/base/default/template/mercadopago/custom_ticket/success.phtml +6 -0
  36. app/design/frontend/base/default/template/mercadopago/standard/success.phtml +7 -1
  37. app/locale/en_US/MercadoPago_Core.csv +7 -1
  38. app/locale/es_AR/MercadoPago_Core.csv +200 -22
  39. js/mercadopago/mercadopago.js +758 -25
  40. js/mercadopago/mercadopago_calculator.js +263 -0
  41. package.xml +8 -5
  42. skin/frontend/base/default/mercadopago/css/style-calculator.css +276 -0
  43. skin/frontend/base/default/mercadopago/css/style-success.css +27 -3
  44. skin/frontend/base/default/mercadopago/css/style.css +267 -36
  45. skin/frontend/base/default/mercadopago/images/logo.png +0 -0
app/code/community/MercadoPago/Core/Block/Calculator/CalculatorForm.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Block_Calculator_CalculatorForm
4
+ extends Mage_Core_Block_Template
5
+ {
6
+
7
+ const CALCULATOR_JS = 'mercadopago/mercadopago_calculator.js';
8
+
9
+ /**
10
+ * @var $helperData MercadoPago_Core_Helper_Data
11
+ */
12
+ protected $_helperData;
13
+
14
+ protected function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->setTemplate('mercadopago/calculator/calculatorForm.phtml');
18
+ $this->_helperData = Mage::helper('mercadopago/data');
19
+ }
20
+
21
+ protected function getCalculatorJs()
22
+ {
23
+ return (Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS, true) . self::CALCULATOR_JS);
24
+ }
25
+
26
+ protected function getTinyUrl()
27
+ {
28
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS, true) . 'mercadopago/tiny.min.js';
29
+ }
30
+
31
+ protected function getTinyJUrl()
32
+ {
33
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS, true) . 'mercadopago/tinyJ.js';
34
+ }
35
+
36
+ protected function getPublicKey()
37
+ {
38
+ return Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_PUBLIC_KEY);
39
+ }
40
+
41
+ /**
42
+ * return the Payment methods token configured
43
+ *
44
+ * @return string
45
+ */
46
+ protected function getPaymentMethods()
47
+ {
48
+ return $this->_helperData->getMercadoPagoPaymentMethods(Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN));
49
+ }
50
+
51
+ /**
52
+ * return the current value of amount
53
+ *
54
+ * @return mixed|bool
55
+ */
56
+ protected function getAmount()
57
+ {
58
+ return $this->getRequest()->getParam('currentAmount');
59
+ }
60
+
61
+ }
app/code/community/MercadoPago/Core/Block/Calculator/CalculatorLink.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Block_Calculator_CalculatorLink
4
+ extends Mage_Core_Block_Template
5
+ {
6
+
7
+ const PAGE_PDP = 'product.info.calculator';
8
+ const PAGE_CART = 'checkout.cart.calculator';
9
+
10
+ /**
11
+ * @var $helperData MercadoPago_Core_Helper_Data
12
+ */
13
+ protected $_helperData;
14
+
15
+ protected function _construct()
16
+ {
17
+ parent::_construct();
18
+ $this->_helperData = Mage::helper('mercadopago/data');
19
+ }
20
+
21
+
22
+ /**
23
+ * Check if the access token is valid, if the API is not down and if the configuration is enabled
24
+ *
25
+ * @return bool
26
+ */
27
+ protected function isAvailableCalculator(){
28
+
29
+ $isValidAccessToken = $this->_helperData->isValidAccessToken(Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN));
30
+ $pk = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_PUBLIC_KEY);
31
+ return ($isValidAccessToken & !empty($pk) & $this->_helperData->isAvailableCalculator());
32
+
33
+ }
34
+
35
+ /**
36
+ * @param $nameLayoutConteiner string
37
+ * @return bool
38
+ */
39
+ protected function isPageToShow($nameLayoutConteiner){
40
+
41
+ $valueConfig = $this->_helperData->getPagesToShow();
42
+ $pages = explode(',', $valueConfig);
43
+
44
+ return in_array($nameLayoutConteiner, $pages);
45
+ }
46
+
47
+ /**
48
+ * @param $nameLayoutConteiner string
49
+ * @return bool
50
+ */
51
+ protected function inPagePDP($nameLayoutConteiner){
52
+
53
+ return $nameLayoutConteiner === self::PAGE_PDP;
54
+ }
55
+
56
+ /**
57
+ * @param $nameLayoutConteiner string
58
+ * @return bool
59
+ */
60
+ protected function inPageCheckoutCart($nameLayoutConteiner){
61
+
62
+ return $nameLayoutConteiner === self::PAGE_CART;
63
+ }
64
+
65
+ }
app/code/community/MercadoPago/Core/Block/Recurring/Form.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Block_Recurring_Form
4
+ extends Mage_Payment_Block_Form_Cc
5
+ {
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+
10
+ $this->setTemplate('mercadopago/standard/form.phtml');
11
+ }
12
+ }
app/code/community/MercadoPago/Core/Block/Recurring/Info.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Block_Recurring_Info
4
+ extends Mage_Payment_Block_Info_Cc
5
+ {
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->setTemplate('mercadopago/standard/info.phtml');
10
+ }
11
+
12
+
13
+ public function getOrder()
14
+ {
15
+ return $this->getInfo();
16
+ }
17
+
18
+ public function getInfoPayment()
19
+ {
20
+ $orderId = $this->getInfo()->getOrder()->getIncrementId();
21
+ $infoPayments = Mage::getModel('mercadopago/core')->getInfoPaymentByOrder($orderId);
22
+
23
+ return $infoPayments;
24
+ }
25
+ }
app/code/community/MercadoPago/Core/Block/Recurring/Pay.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Block_Recurring_Pay
4
+ extends Mage_Core_Block_Template
5
+ {
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+
10
+ $this->setTemplate('mercadopago/standard/pay.phtml');
11
+ }
12
+ }
app/code/community/MercadoPago/Core/Block/Recurring/Success.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Block_Recurring_Success
4
+ extends MercadoPago_Core_Block_AbstractSuccess
5
+ {
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->setTemplate('mercadopago/standard/success.phtml');
10
+ }
11
+
12
+ }
app/code/community/MercadoPago/Core/Helper/Data.php CHANGED
@@ -27,6 +27,14 @@ class MercadoPago_Core_Helper_Data
27
  const PLATFORM_DESKTOP = 'Desktop';
28
  const TYPE = 'magento';
29
 
 
 
 
 
 
 
 
 
30
  protected $_apiInstance;
31
 
32
  protected $_website;
@@ -73,12 +81,15 @@ class MercadoPago_Core_Helper_Data
73
  public function isValidAccessToken($accessToken)
74
  {
75
  $mp = Mage::helper('mercadopago')->getApiInstance($accessToken);
76
- $response = $mp->get("/v1/payment_methods");
77
- if ($response['status'] == 401 || $response['status'] == 400) {
 
 
 
 
 
78
  return false;
79
  }
80
-
81
- return true;
82
  }
83
 
84
  public function isValidClientCredentials($clientId, $clientSecret)
@@ -136,6 +147,7 @@ class MercadoPago_Core_Helper_Data
136
  if (!Mage::getStoreConfigFlag('payment/mercadopago/financing_cost')) {
137
  $order->setGrandTotal($order->getGrandTotal() - $balance);
138
  $order->setBaseGrandTotal($order->getBaseGrandTotal() - $balance);
 
139
  return;
140
  }
141
 
@@ -152,11 +164,11 @@ class MercadoPago_Core_Helper_Data
152
  */
153
  public function setPayerInfo(&$payment)
154
  {
155
- $payment["trunc_card"] = "xxxx xxxx xxxx " . $payment['card']["last_four_digits"];
156
- $payment["cardholder_name"] = $payment['card']["cardholder"]["name"];
157
- $payment['payer_first_name'] = $payment['payer']['first_name'];
158
- $payment['payer_last_name'] = $payment['payer']['last_name'];
159
- $payment['payer_email'] = $payment['payer']['email'];
160
 
161
  return $payment;
162
  }
@@ -212,4 +224,40 @@ class MercadoPago_Core_Helper_Data
212
  return $this->_website;
213
  }
214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
27
  const PLATFORM_DESKTOP = 'Desktop';
28
  const TYPE = 'magento';
29
 
30
+ //calculator
31
+ const XML_PATH_CALCULATOR_AVAILABLE = 'payment/mercadopago/calculalator_available';
32
+ const XML_PATH_CALCULATOR_PAGES = 'payment/mercadopago/show_in_pages';
33
+
34
+ const STATUS_ACTIVE = 'active';
35
+ const PAYMENT_TYPE_CREDIT_CARD = 'credit_card';
36
+
37
+
38
  protected $_apiInstance;
39
 
40
  protected $_website;
81
  public function isValidAccessToken($accessToken)
82
  {
83
  $mp = Mage::helper('mercadopago')->getApiInstance($accessToken);
84
+ try{
85
+ $response = $mp->get("/v1/payment_methods");
86
+ if ($response['status'] == 401 || $response['status'] == 400) {
87
+ return false;
88
+ }
89
+ return true;
90
+ } catch (\Exception $e){
91
  return false;
92
  }
 
 
93
  }
94
 
95
  public function isValidClientCredentials($clientId, $clientSecret)
147
  if (!Mage::getStoreConfigFlag('payment/mercadopago/financing_cost')) {
148
  $order->setGrandTotal($order->getGrandTotal() - $balance);
149
  $order->setBaseGrandTotal($order->getBaseGrandTotal() - $balance);
150
+
151
  return;
152
  }
153
 
164
  */
165
  public function setPayerInfo(&$payment)
166
  {
167
+ $payment["trunc_card"] = (isset($payment['card']["last_four_digits"])) ? "xxxx xxxx xxxx " . $payment['card']["last_four_digits"] : '';
168
+ $payment["cardholder_name"] = (isset($payment['card']["cardholder"]["name"])) ? $payment['card']["cardholder"]["name"] : '';
169
+ $payment['payer_first_name'] = (isset($payment['payer']['first_name'])) ? $payment['payer']['first_name'] : '';
170
+ $payment['payer_last_name'] = (isset($payment['payer']['last_name'])) ? $payment['payer']['last_name'] : '';
171
+ $payment['payer_email'] = (isset($payment['payer']['email'])) ? $payment['payer']['email'] : '';
172
 
173
  return $payment;
174
  }
224
  return $this->_website;
225
  }
226
 
227
+ /**
228
+ *
229
+ * @return boolean
230
+ */
231
+ public function isAvailableCalculator()
232
+ {
233
+ return Mage::getStoreConfig(self::XML_PATH_CALCULATOR_AVAILABLE);
234
+ }
235
+
236
+ /**
237
+ *
238
+ * @return mixed
239
+ */
240
+ public function getPagesToShow()
241
+ {
242
+ return Mage::getStoreConfig(self::XML_PATH_CALCULATOR_PAGES);
243
+ }
244
+
245
+ /**
246
+ * return the list of payment methods or null
247
+ *
248
+ * @param mixed|null $accessToken
249
+ *
250
+ * @return mixed
251
+ */
252
+ public function getMercadoPagoPaymentMethods($accessToken)
253
+ {
254
+ $mp = Mage::helper('mercadopago')->getApiInstance($accessToken);
255
+ $response = $mp->get("/v1/payment_methods");
256
+ if ($response['status'] == 401 || $response['status'] == 400) {
257
+ return false;
258
+ }
259
+
260
+ return $response['response'];
261
+ }
262
+
263
  }
app/code/community/MercadoPago/Core/Helper/Response.php CHANGED
@@ -34,6 +34,10 @@ class MercadoPago_Core_Helper_Response
34
  const INFO_MERCHANT_ORDER_NOT_FOUND = 'Merchant Order not found';
35
  const INFO_STATUS_NOT_FINAL = 'Status not final';
36
  const INFO_EXTERNAL_REFERENCE_NOT_FOUND = 'External reference not found';
 
 
 
 
37
 
38
 
39
  }
34
  const INFO_MERCHANT_ORDER_NOT_FOUND = 'Merchant Order not found';
35
  const INFO_STATUS_NOT_FINAL = 'Status not final';
36
  const INFO_EXTERNAL_REFERENCE_NOT_FOUND = 'External reference not found';
37
+ const INFO_ORDER_CANCELED = 'The order is canceled';
38
+
39
+ const TOPIC_RECURRING_PAYMENT = 'preapproval';
40
+ const TOPIC_PAYMENT = 'payment';
41
 
42
 
43
  }
app/code/community/MercadoPago/Core/Helper/StatusUpdate.php CHANGED
@@ -21,24 +21,41 @@ class MercadoPago_Core_Helper_StatusUpdate
21
  return $this->_statusUpdatedFlag;
22
  }
23
 
24
- public function setStatusUpdated($notificationData, $order)
25
  {
26
  $this->_order = $order;
27
  $status = $notificationData['status'];
28
  $statusDetail = $notificationData['status_detail'];
29
  $currentStatus = $this->_order->getPayment()->getAdditionalInformation('status');
30
  $currentStatusDetail = $this->_order->getPayment()->getAdditionalInformation('status_detail');
 
 
 
 
 
 
 
 
 
31
  if ($status == $currentStatus && $statusDetail == $currentStatusDetail) {
32
  $this->_statusUpdatedFlag = true;
33
  }
34
  }
35
 
 
 
 
 
 
 
 
36
  protected function _updateStatus($status, $message, $statusDetail)
37
  {
38
- if ($this->_order->getState() !== Mage_Sales_Model_Order::STATE_COMPLETE) {
 
39
  $statusOrder = $this->getStatusOrder($status, $statusDetail);
40
 
41
- if (isset($statusOrder)) {
42
  $this->_order->setState($this->_getAssignedState($statusOrder));
43
  $this->_order->addStatusToHistory($statusOrder, $message, true);
44
  $this->_order->sendOrderUpdateEmail(true, $message);
@@ -72,7 +89,8 @@ class MercadoPago_Core_Helper_StatusUpdate
72
  }
73
  }
74
 
75
- protected function _createCreditmemo ($data) {
 
76
  /**
77
  * @var $creditmemo Mage_Sales_Model_Order_Creditmemo
78
  */
@@ -116,11 +134,45 @@ class MercadoPago_Core_Helper_StatusUpdate
116
  }
117
  }
118
 
119
- public function update($payment, $message) {
120
- $status = $payment['status'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  $statusDetail = $payment['status_detail'];
 
 
 
 
122
 
123
- if ($status == 'approved') {
124
  Mage::helper('mercadopago')->setOrderSubtotals($payment, $this->_order);
125
  $this->_createInvoice($this->_order, $message);
126
  //Associate card to customer
@@ -130,40 +182,31 @@ class MercadoPago_Core_Helper_StatusUpdate
130
  }
131
  }
132
 
 
 
 
 
 
 
133
  if (isset($payment['amount_refunded']) && $payment['amount_refunded'] > 0) {
134
  $this->_generateCreditMemo($payment);
135
  } elseif ($status == 'cancelled') {
136
  Mage::register('mercadopago_cancellation', true);
137
  $this->_order->cancel();
138
- }
139
- else {
140
  //if state is not complete updates according to setting
141
  $this->_updateStatus($status, $message, $statusDetail);
142
  }
 
143
  return $this->_order->save();
144
  }
145
 
146
- public function setStatusOrder($payment)
147
  {
148
- $helper = Mage::helper('mercadopago');
149
-
150
- $status = $this->getStatus($payment);
151
- $message = $this->getMessage($status, $payment);
152
- if ($this->isStatusUpdated() && isset ($payment['amount_refunded']) && !($payment['amount_refunded'] > 0)) {
153
- return ['body' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
154
- }
155
-
156
- try {
157
- $statusSave = $this->update($payment, $message);
158
-
159
- $helper->log("Update order", 'mercadopago.log', $statusSave->getData());
160
- $helper->log($message, 'mercadopago.log');
161
-
162
- return ['body' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
163
- } catch (Exception $e) {
164
- $helper->log("error in set order status: " . $e, 'mercadopago.log');
165
-
166
- return ['body' => $e, 'code' => MercadoPago_Core_Helper_Response::HTTP_BAD_REQUEST];
167
  }
168
  }
169
 
@@ -193,7 +236,7 @@ class MercadoPago_Core_Helper_StatusUpdate
193
 
194
  public function getStatusOrder($status, $statusDetail)
195
  {
196
- switch ($status) {
197
  case 'approved': {
198
  $status = Mage::getStoreConfig('payment/mercadopago/order_status_approved');
199
 
@@ -308,4 +351,80 @@ class MercadoPago_Core_Helper_StatusUpdate
308
  }
309
  }
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  }
21
  return $this->_statusUpdatedFlag;
22
  }
23
 
24
+ public function setStatusUpdated($notificationData, $order, $isPayment = false)
25
  {
26
  $this->_order = $order;
27
  $status = $notificationData['status'];
28
  $statusDetail = $notificationData['status_detail'];
29
  $currentStatus = $this->_order->getPayment()->getAdditionalInformation('status');
30
  $currentStatusDetail = $this->_order->getPayment()->getAdditionalInformation('status_detail');
31
+ if ($isPayment) {
32
+ $currentStatus = $this->_getMulticardLastValue($currentStatus);
33
+ $currentStatusDetail = $this->_getMulticardLastValue($currentStatusDetail);
34
+ }
35
+ if (!is_null($order->getPayment()) && $order->getPayment()->getAdditionalInformation('is_second_card_used')) {
36
+ $this->_statusUpdatedFlag = false;
37
+
38
+ return;
39
+ }
40
  if ($status == $currentStatus && $statusDetail == $currentStatusDetail) {
41
  $this->_statusUpdatedFlag = true;
42
  }
43
  }
44
 
45
+ protected function _getMulticardLastValue($value)
46
+ {
47
+ $statuses = explode('|', $value);
48
+
49
+ return str_replace(' ', '', array_pop($statuses));
50
+ }
51
+
52
  protected function _updateStatus($status, $message, $statusDetail)
53
  {
54
+ if ($this->_order->getState() !== Mage_Sales_Model_Order::STATE_COMPLETE
55
+ ) {
56
  $statusOrder = $this->getStatusOrder($status, $statusDetail);
57
 
58
+ if (isset($statusOrder) && ($this->_order->getStatus() !== $statusOrder)) {
59
  $this->_order->setState($this->_getAssignedState($statusOrder));
60
  $this->_order->addStatusToHistory($statusOrder, $message, true);
61
  $this->_order->sendOrderUpdateEmail(true, $message);
89
  }
90
  }
91
 
92
+ protected function _createCreditmemo($data)
93
+ {
94
  /**
95
  * @var $creditmemo Mage_Sales_Model_Order_Creditmemo
96
  */
134
  }
135
  }
136
 
137
+ public function setStatusOrder($payment)
138
+ {
139
+ $helper = Mage::helper('mercadopago');
140
+ $status = $this->getStatus($payment);
141
+
142
+ $message = $this->getMessage($status, $payment);
143
+ if ($this->isStatusUpdated()) {
144
+ if (!(isset($payment['amount_refunded']) && ($payment['amount_refunded'] > 0))) {
145
+ if (!(isset($payment['refunds']) && count($payment['refunds']) > 0)) {
146
+ if ($this->_order->getPayment()->getAdditionalInformation('is_second_card_used')) {
147
+ //if status is updated, there are no refunds and no custom payments with two cards.
148
+ return ['body' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ try {
155
+ $statusSave = $this->update($payment, $message);
156
+
157
+ $helper->log("Update order", 'mercadopago.log', $statusSave->getData());
158
+ $helper->log($message, 'mercadopago.log');
159
+
160
+ return ['body' => $message, 'code' => MercadoPago_Core_Helper_Response::HTTP_OK];
161
+ } catch (Exception $e) {
162
+ $helper->log("error in set order status: " . $e, 'mercadopago.log');
163
+
164
+ return ['body' => $e, 'code' => MercadoPago_Core_Helper_Response::HTTP_BAD_REQUEST];
165
+ }
166
+ }
167
+
168
+ public function update($payment, $message)
169
+ {
170
  $statusDetail = $payment['status_detail'];
171
+ $status = $payment['status'];
172
+ $infoPayments = $this->_order->getPayment()->getAdditionalInformation();
173
+ if ($this->_getMulticardLastValue($status) == 'approved') {
174
+ $this->_handleTwoCards($payment, $infoPayments);
175
 
 
176
  Mage::helper('mercadopago')->setOrderSubtotals($payment, $this->_order);
177
  $this->_createInvoice($this->_order, $message);
178
  //Associate card to customer
182
  }
183
  }
184
 
185
+ if (isset($infoPayments['first_payment_id']) &&
186
+ !($infoPayments['first_payment_status'] == 'approved' && $infoPayments['second_payment_status'] == 'approved')
187
+ ) {
188
+ return $this->_order->save();
189
+ }
190
+
191
  if (isset($payment['amount_refunded']) && $payment['amount_refunded'] > 0) {
192
  $this->_generateCreditMemo($payment);
193
  } elseif ($status == 'cancelled') {
194
  Mage::register('mercadopago_cancellation', true);
195
  $this->_order->cancel();
196
+ } else {
 
197
  //if state is not complete updates according to setting
198
  $this->_updateStatus($status, $message, $statusDetail);
199
  }
200
+
201
  return $this->_order->save();
202
  }
203
 
204
+ protected function _handleTwoCards(&$payment, $infoPayments)
205
  {
206
+ if (isset($infoPayments['is_second_card_used']) && $infoPayments['is_second_card_used'] === "true") {
207
+ $payment['total_paid_amount'] = $infoPayments['total_paid_amount'];
208
+ $payment['transaction_amount'] = $infoPayments['transaction_amount'];
209
+ $payment['status'] = $infoPayments['status'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  }
211
  }
212
 
236
 
237
  public function getStatusOrder($status, $statusDetail)
238
  {
239
+ switch ($this->_getMulticardLastValue($status)) {
240
  case 'approved': {
241
  $status = Mage::getStoreConfig('payment/mercadopago/order_status_approved');
242
 
351
  }
352
  }
353
 
354
+ /**
355
+ * @param $data
356
+ * @param $payment
357
+ * @param $logFile
358
+ *
359
+ * Update $data with the information in the payment.
360
+ * if it has more than one payment, the information is concatenated by separating the data with a '|'
361
+ *
362
+ * @return mixed
363
+ */
364
+ public function formatArrayPayment($data, $payment, $logFile)
365
+ {
366
+ Mage::helper('mercadopago')->log("Format Array", $logFile);
367
+
368
+ $fields = [
369
+ "status",
370
+ "status_detail",
371
+ "payment_id_detail",
372
+ "id",
373
+ "payment_method_id",
374
+ "transaction_amount",
375
+ "total_paid_amount",
376
+ "coupon_amount",
377
+ "installments",
378
+ "shipping_cost",
379
+ "amount_refunded"
380
+ ];
381
+
382
+ foreach ($fields as $field) {
383
+ if (isset($payment[$field])) {
384
+ if (isset($data[$field])) {
385
+ $data[$field] .= " | " . $payment[$field];
386
+ } else {
387
+ $data[$field] = $payment[$field];
388
+ }
389
+ }
390
+ }
391
+ $data = $this->_updateAtributesData($data, $payment);
392
+
393
+ $data['external_reference'] = $payment['external_reference'];
394
+ $data['payer_first_name'] = $payment['payer']['first_name'];
395
+ $data['payer_last_name'] = $payment['payer']['last_name'];
396
+ $data['payer_email'] = $payment['payer']['email'];
397
+
398
+ return $data;
399
+ }
400
+
401
+ protected function _updateAtributesData($data, $payment){
402
+ if (isset($payment["last_four_digits"])) {
403
+ if (isset($data["trunc_card"])) {
404
+ $data["trunc_card"] .= " | " . "xxxx xxxx xxxx " . $payment["last_four_digits"];
405
+ } else {
406
+ $data["trunc_card"] = "xxxx xxxx xxxx " . $payment["last_four_digits"];
407
+ }
408
+ }
409
+
410
+ if (isset($payment['cardholder']['name'])) {
411
+ if (isset($data["cardholder_name"])) {
412
+ $data["cardholder_name"] .= " | " . $payment["cardholder"]["name"];
413
+ } else {
414
+ $data["cardholder_name"] = $payment["cardholder"]["name"];
415
+ }
416
+ }
417
+
418
+ if (isset($payment['statement_descriptor'])) {
419
+ $data['statement_descriptor'] = $payment['statement_descriptor'];
420
+ }
421
+
422
+ if (isset($payment['merchant_order_id'])) {
423
+ $data['merchant_order_id'] = $payment['merchant_order_id'];
424
+ }
425
+
426
+ return $data;
427
+ }
428
+
429
+
430
  }
app/code/community/MercadoPago/Core/Model/Core.php CHANGED
@@ -26,7 +26,7 @@ class MercadoPago_Core_Model_Core
26
  protected $_canOrder = true;
27
  protected $_canRefund = true;
28
  protected $_canVoid = true;
29
- protected $_canUseInternal = true;
30
  protected $_canUseCheckout = true;
31
  protected $_canUseForMultishipping = true;
32
  protected $_canFetchTransactionInfo = true;
@@ -103,6 +103,8 @@ class MercadoPago_Core_Model_Core
103
  ["field" => "status_detail", "title" => "Payment Detail: %s"],
104
  ["field" => "activation_uri", "title" => "Generate Ticket"],
105
  ["field" => "payment_id_detail", "title" => "Mercado Pago Payment Id: %s"],
 
 
106
  ];
107
 
108
  foreach ($fields as $field) {
@@ -255,7 +257,11 @@ class MercadoPago_Core_Model_Core
255
 
256
  $preference['notification_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "mercadopago/notifications/custom";
257
  $preference['description'] = Mage::helper('mercadopago')->__("Order # %s in store %s", $orderId, Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true));
258
- $preference['transaction_amount'] = (float)$this->getAmount();
 
 
 
 
259
 
260
  $preference['external_reference'] = $orderId;
261
  $preference['payer']['email'] = $customerInfo['email'];
@@ -478,15 +484,10 @@ class MercadoPago_Core_Model_Core
478
  'trunc_card',
479
  'id'
480
  ];
481
-
482
- foreach ($additionalFields as $field) {
483
- if (isset($data[$field])) {
484
- $paymentOrder->setAdditionalInformation($field, $data[$field]);
485
- }
486
- }
487
-
488
- if (isset($data['payment_method_id'])) {
489
- $paymentOrder->setAdditionalInformation('payment_method', $data['payment_method_id']);
490
  }
491
 
492
  $paymentStatus = $paymentOrder->save();
@@ -502,6 +503,23 @@ class MercadoPago_Core_Model_Core
502
  }
503
  }
504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  protected function _saveTransaction($data, $paymentOrder)
506
  {
507
  try {
@@ -516,4 +534,15 @@ class MercadoPago_Core_Model_Core
516
  }
517
  }
518
 
 
 
 
 
 
 
 
 
 
 
 
519
  }
26
  protected $_canOrder = true;
27
  protected $_canRefund = true;
28
  protected $_canVoid = true;
29
+ protected $_canUseInternal = false;
30
  protected $_canUseCheckout = true;
31
  protected $_canUseForMultishipping = true;
32
  protected $_canFetchTransactionInfo = true;
103
  ["field" => "status_detail", "title" => "Payment Detail: %s"],
104
  ["field" => "activation_uri", "title" => "Generate Ticket"],
105
  ["field" => "payment_id_detail", "title" => "Mercado Pago Payment Id: %s"],
106
+ ["field" => "id", "title" => "Collection Id: %s"],
107
+
108
  ];
109
 
110
  foreach ($fields as $field) {
257
 
258
  $preference['notification_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "mercadopago/notifications/custom";
259
  $preference['description'] = Mage::helper('mercadopago')->__("Order # %s in store %s", $orderId, Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true));
260
+ if (isset($paymentInfo['transaction_amount'])) {
261
+ $preference['transaction_amount'] = (float)$paymentInfo['transaction_amount'];
262
+ } else {
263
+ $preference['transaction_amount'] = (float)$this->getAmount();
264
+ }
265
 
266
  $preference['external_reference'] = $orderId;
267
  $preference['payer']['email'] = $customerInfo['email'];
484
  'trunc_card',
485
  'id'
486
  ];
487
+
488
+ $infoPayments = $paymentOrder->getAdditionalInformation();
489
+ if (!isset($infoPayments['first_payment_id'])) {
490
+ $paymentOrder = $this->_addAdditionalInformationToPaymentOrder($data, $additionalFields, $paymentOrder);
 
 
 
 
 
491
  }
492
 
493
  $paymentStatus = $paymentOrder->save();
503
  }
504
  }
505
 
506
+ protected function _addAdditionalInformationToPaymentOrder($data, $additionalFields, $paymentOrder){
507
+ foreach ($additionalFields as $field) {
508
+ if (isset($data[$field])) {
509
+ $paymentOrder->setAdditionalInformation($field, $data[$field]);
510
+ }
511
+ }
512
+
513
+ if (isset($data['payment_method_id'])) {
514
+ $paymentOrder->setAdditionalInformation('payment_method', $data['payment_method_id']);
515
+ }
516
+
517
+ if (isset($data['merchant_order_id'])) {
518
+ $paymentOrder->setAdditionalInformation('merchant_order_id', $data['merchant_order_id']);
519
+ }
520
+ return $paymentOrder;
521
+ }
522
+
523
  protected function _saveTransaction($data, $paymentOrder)
524
  {
525
  try {
534
  }
535
  }
536
 
537
+ public function getRecurringPayment($id)
538
+ {
539
+ if (!$this->_clientId || !$this->_clientSecret) {
540
+ $this->_clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
541
+ $this->_clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
542
+ }
543
+ $mp = Mage::helper('mercadopago')->getApiInstance($this->_clientId, $this->_clientSecret);
544
+
545
+ return $mp->get_preapproval_payment($id);
546
+ }
547
+
548
  }
app/code/community/MercadoPago/Core/Model/Cron/Order.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Model_Cron_Order
4
+ {
5
+ /**
6
+ * @var $_statusHelper MercadoPago_Core_Helper_StatusUpdate
7
+ */
8
+ protected $_statusHelper;
9
+
10
+ const LOG_FILE = 'mercadopago-order-synchronized.log';
11
+
12
+ public function updateOrderStatus(){
13
+ $this->_statusHelper = Mage::helper('mercadopago/statusUpdate');
14
+ $helper = Mage::helper('mercadopago');
15
+ $hours = Mage::getStoreConfig('payment/mercadopago/number_of_hours');
16
+
17
+ // filter to date:
18
+ $fromDate = date('Y-m-d H:i:s', strtotime('-'.$hours. ' hours'));
19
+ $toDate = date('Y-m-d H:i:s', strtotime("now"));
20
+
21
+ $collection = Mage::getModel('sales/order')->getCollection()
22
+ ->join(
23
+ array('payment' => 'sales/order_payment'),
24
+ 'main_table.entity_id=payment.parent_id',
25
+ array('payment_method' => 'payment.method')
26
+ )->addFieldToFilter('payment.method', array('in' => array(
27
+ 'mercadopago_custom',
28
+ 'mercadopago_customticket',
29
+ 'mercadopago_standard'))
30
+ )->addFieldToFilter('status', array('nin' => array(
31
+ 'canceled',
32
+ 'complete'))
33
+ )->addFieldToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
34
+ ;
35
+
36
+ // For all Orders to analyze
37
+ foreach($collection as $orderByPayment){
38
+ $order = $orderByPayment;
39
+ $paymentOrder = $order->getPayment();
40
+ $infoPayments = $paymentOrder->getAdditionalInformation();
41
+
42
+ if (isset($infoPayments['merchant_order_id']) && $order->getStatus() !== 'complete') {
43
+
44
+
45
+ $merchantOrderId = $infoPayments['merchant_order_id'];
46
+ $response = Mage::getModel('mercadopago/core')->getMerchantOrder($merchantOrderId);
47
+
48
+ if ($response['status'] == 201 || $response['status'] == 200) {
49
+ $merchantOrderData = $response['response'];
50
+
51
+ $paymentData = $this->getDataPayments($merchantOrderData);
52
+ $statusFinal = $this->_statusHelper->getStatusFinal($paymentData['status'], $merchantOrderData);
53
+ $statusDetail = $infoPayments['status_detail'];
54
+
55
+ $statusOrder = $this->_statusHelper->getStatusOrder($statusFinal, $statusDetail);
56
+ if (isset($statusOrder) && ($order->getStatus() !== $statusOrder)) {
57
+ $this->_updateOrder($order, $statusOrder, $paymentOrder);
58
+
59
+ }
60
+ } else{
61
+ $helper->log('Error updating status order using cron whit the merchantOrder num: '. $merchantOrderId .'mercadopago.log');
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ protected function _updateOrder($order, $statusOrder, $paymentOrder){
68
+ $order->setState($this->_statusHelper->_getAssignedState($statusOrder));
69
+ $order->addStatusToHistory($statusOrder, $this->_statusHelper->getMessage($statusOrder, $statusOrder), true);
70
+ $order->sendOrderUpdateEmail(true, $this->_statusHelper->getMessage($statusOrder, $paymentOrder));
71
+ $order->save();
72
+ }
73
+
74
+ protected function getDataPayments($merchantOrderData)
75
+ {
76
+ $data = array();
77
+ foreach ($merchantOrderData['payments'] as $payment) {
78
+ $data = $this->getFormattedPaymentData($payment['id'], $data);
79
+ }
80
+
81
+ return $data;
82
+ }
83
+
84
+ protected function getFormattedPaymentData($paymentId, $data = [])
85
+ {
86
+ $core = Mage::getModel('mercadopago/core');
87
+
88
+ $response = $core->getPayment($paymentId);
89
+ if ($response['status'] == 400 || $response['status'] == 401) {
90
+ return [];
91
+ }
92
+ $payment = $response['response']['collection'];
93
+
94
+ return $this->_statusHelper->formatArrayPayment($data, $payment, self::LOG_FILE);
95
+ }
96
+
97
+ }
app/code/community/MercadoPago/Core/Model/Custom/Payment.php CHANGED
@@ -42,24 +42,89 @@ class MercadoPago_Core_Model_Custom_Payment
42
  Mage::throwException(Mage::helper('mercadopago')->__('Verify the form data or wait until the validation of the payment data'));
43
  }
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('payment_id_detail', $payment['id']);
52
- $this->getInfoInstance()->setAdditionalInformation('status_detail', $payment['status_detail']);
53
- $stateObject->setState(Mage::helper('mercadopago/statusUpdate')->_getAssignedState('pending_payment'));
54
- $stateObject->setStatus('pending_payment');
55
- $stateObject->setIsNotified(false);
56
-
57
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  return false;
61
  }
62
 
 
 
 
 
 
 
 
 
63
  protected function cleanFieldsOcp($info)
64
  {
65
  foreach (self::$exclude_inputs_opc as $field) {
@@ -131,7 +196,7 @@ class MercadoPago_Core_Model_Custom_Payment
131
  return $payment_info;
132
  }
133
 
134
- public function preparePostPayment()
135
  {
136
  Mage::helper('mercadopago')->log("Credit Card -> init prepare post payment", self::LOG_FILE);
137
  $core = Mage::getModel('mercadopago/core');
@@ -142,11 +207,22 @@ class MercadoPago_Core_Model_Custom_Payment
142
  $payment = $order->getPayment();
143
  $payment_info = $this->getPaymentInfo($payment);
144
 
 
 
 
 
145
  $preference = $core->makeDefaultPreferencePaymentV1($payment_info);
146
 
147
- $preference['installments'] = (int)$payment->getAdditionalInformation("installments");
148
- $preference['payment_method_id'] = $payment->getAdditionalInformation("payment_method");
149
- $preference['token'] = $payment->getAdditionalInformation("token");
 
 
 
 
 
 
 
150
 
151
  if ($payment->getAdditionalInformation("issuer_id") != "") {
152
  $preference['issuer_id'] = (int)$payment->getAdditionalInformation("issuer_id");
@@ -164,8 +240,6 @@ class MercadoPago_Core_Model_Custom_Payment
164
  /* POST /v1/payments */
165
  $response = $core->postPaymentV1($preference);
166
 
167
- $order->save();
168
-
169
  return $response;
170
  }
171
 
42
  Mage::throwException(Mage::helper('mercadopago')->__('Verify the form data or wait until the validation of the payment data'));
43
  }
44
 
45
+ $useTwoCards = $this->getInfoInstance()->getAdditionalInformation('is_second_card_used');
46
+
47
+ if ($useTwoCards === "true") {
48
+ $usingSecondCardInfo['first_card']['amount'] = $this->getInfoInstance()->getAdditionalInformation('first_card_amount');
49
+ $usingSecondCardInfo['first_card']['installments'] = $this->getInfoInstance()->getAdditionalInformation('installments');
50
+ $usingSecondCardInfo['first_card']['payment_method_id'] = $this->getInfoInstance()->getAdditionalInformation('payment_method');
51
+ $usingSecondCardInfo['first_card']['token'] = $this->getInfoInstance()->getAdditionalInformation('token');
52
+
53
+ $usingSecondCardInfo['second_card']['amount'] = $this->getInfoInstance()->getAdditionalInformation('second_card_amount');
54
+ $usingSecondCardInfo['second_card']['installments'] = $this->getInfoInstance()->getAdditionalInformation('second_card_installments');
55
+ $usingSecondCardInfo['second_card']['payment_method_id'] = $this->getInfoInstance()->getAdditionalInformation('second_card_payment_method_id');
56
+ $usingSecondCardInfo['second_card']['token'] = $this->getInfoInstance()->getAdditionalInformation('second_card_token');
57
+
58
+ $responseFirstCard = $this->preparePostPayment($usingSecondCardInfo['first_card']);
59
+ if (isset($responseFirstCard) && ($responseFirstCard['response']['status'] == 'approved') ) {
60
+ $paymentFirstCard = $responseFirstCard['response'];
61
+ $responseSecondCard = $this->preparePostPayment($usingSecondCardInfo['second_card']);
62
+
63
+ if (isset($responseSecondCard) && ($responseSecondCard['response']['status'] == 'approved') ) {
64
+ $paymentSecondCard = $responseSecondCard['response'];
65
+ $this->getInfoInstance()->setAdditionalInformation('status', $paymentFirstCard['status'] . ' | ' . $paymentSecondCard['status']);
66
+ $this->getInfoInstance()->setAdditionalInformation('payment_id_detail', $paymentFirstCard['id'] . ' | ' . $paymentSecondCard['id']);
67
+ $this->getInfoInstance()->setAdditionalInformation('status_detail', $paymentFirstCard['status_detail'] . ' | ' . $paymentSecondCard['status_detail']);
68
+ $this->getInfoInstance()->setAdditionalInformation('installments', $paymentFirstCard['installments'] . ' | ' . $paymentSecondCard['installments']);
69
+ $this->getInfoInstance()->setAdditionalInformation('payment_method', $paymentFirstCard['payment_method_id'] . ' | ' . $paymentSecondCard['payment_method_id']);
70
+ $this->getInfoInstance()->setAdditionalInformation('first_payment_id', $paymentFirstCard['id']);
71
+ $this->getInfoInstance()->setAdditionalInformation('first_payment_status', $paymentFirstCard['status']);
72
+ $this->getInfoInstance()->setAdditionalInformation('first_payment_status_detail', $paymentFirstCard['status_detail']);
73
+ $this->getInfoInstance()->setAdditionalInformation('second_payment_id', $paymentSecondCard['id']);
74
+ $this->getInfoInstance()->setAdditionalInformation('second_payment_status', $paymentSecondCard['status']);
75
+ $this->getInfoInstance()->setAdditionalInformation('second_payment_status_detail', $paymentSecondCard['status_detail']);
76
+ $this->getInfoInstance()->setAdditionalInformation('total_paid_amount', $paymentFirstCard['transaction_details']['total_paid_amount'] . '|' . $paymentSecondCard['transaction_details']['total_paid_amount']);
77
+ $this->getInfoInstance()->setAdditionalInformation('transaction_amount', $paymentFirstCard['transaction_amount'] . '|' . $paymentSecondCard['transaction_amount']);
78
+ $stateObject->setState(Mage::helper('mercadopago/statusUpdate')->_getAssignedState('pending_payment'));
79
+ $stateObject->setStatus('pending_payment');
80
+ $stateObject->setIsNotified(false);
81
+ $this->saveOrder();
82
+ return true;
83
+ } else {
84
+ //second card payment failed, refund for first card
85
+ $accessToken = Mage::getStoreConfig(self::XML_PATH_ACCESS_TOKEN);
86
+ $mp = Mage::helper('mercadopago')->getApiInstance($accessToken);
87
+ $id = $paymentFirstCard['id'];
88
+ $refundResponse = $mp->post("/v1/payments/$id/refunds?access_token=$accessToken");
89
+ Mage::helper('mercadopago')->log("info form", self::LOG_FILE, $refundResponse);
90
+ return false;
91
+ }
92
+ } else {
93
+ return false;
94
+ }
95
+
96
+
97
+ } else {
98
+
99
+ $response = $this->preparePostPayment();
100
+
101
+ if ($response) {
102
+ $payment = $response['response'];
103
+ //set status
104
+ $this->getInfoInstance()->setAdditionalInformation('status', $payment['status']);
105
+ $this->getInfoInstance()->setAdditionalInformation('payment_id_detail', $payment['id']);
106
+ $this->getInfoInstance()->setAdditionalInformation('status_detail', $payment['status_detail']);
107
+ $stateObject->setState(Mage::helper('mercadopago/statusUpdate')->_getAssignedState('pending_payment'));
108
+ $stateObject->setStatus('pending_payment');
109
+ $stateObject->setIsNotified(false);
110
+
111
+ $this->saveOrder();
112
+
113
+ return true;
114
+ }
115
  }
116
 
117
  return false;
118
  }
119
 
120
+ protected function saveOrder() {
121
+ $quote = $this->_getQuote();
122
+ $order_id = $quote->getReservedOrderId();
123
+ $order = $this->_getOrder($order_id);
124
+ $order->save();
125
+ }
126
+
127
+
128
  protected function cleanFieldsOcp($info)
129
  {
130
  foreach (self::$exclude_inputs_opc as $field) {
196
  return $payment_info;
197
  }
198
 
199
+ public function preparePostPayment($usingSecondCardInfo = null)
200
  {
201
  Mage::helper('mercadopago')->log("Credit Card -> init prepare post payment", self::LOG_FILE);
202
  $core = Mage::getModel('mercadopago/core');
207
  $payment = $order->getPayment();
208
  $payment_info = $this->getPaymentInfo($payment);
209
 
210
+ if (isset($usingSecondCardInfo)) {
211
+ $payment_info['transaction_amount'] = $usingSecondCardInfo ['amount'];
212
+ }
213
+
214
  $preference = $core->makeDefaultPreferencePaymentV1($payment_info);
215
 
216
+ if (isset($usingSecondCardInfo)) {
217
+ $preference['installments'] = (int)$usingSecondCardInfo['installments'];
218
+ $preference['payment_method_id'] = $usingSecondCardInfo['payment_method_id'];
219
+ $preference['token'] = $usingSecondCardInfo['token'];
220
+ } else {
221
+ $preference['installments'] = (int)$payment->getAdditionalInformation("installments");
222
+ $preference['payment_method_id'] = $payment->getAdditionalInformation("payment_method");
223
+ $preference['token'] = $payment->getAdditionalInformation("token");
224
+ }
225
+
226
 
227
  if ($payment->getAdditionalInformation("issuer_id") != "") {
228
  $preference['issuer_id'] = (int)$payment->getAdditionalInformation("issuer_id");
240
  /* POST /v1/payments */
241
  $response = $core->postPaymentV1($preference);
242
 
 
 
243
  return $response;
244
  }
245
 
app/code/community/MercadoPago/Core/Model/CustomTicket/Payment.php CHANGED
@@ -36,7 +36,7 @@ class MercadoPago_Core_Model_CustomTicket_Payment
36
 
37
  if ($response !== false) {
38
  $this->getInfoInstance()->setAdditionalInformation('activation_uri', $response['response']['transaction_details']['external_resource_url']);
39
-
40
  return true;
41
  }
42
 
@@ -58,6 +58,8 @@ class MercadoPago_Core_Model_CustomTicket_Payment
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
  }
36
 
37
  if ($response !== false) {
38
  $this->getInfoInstance()->setAdditionalInformation('activation_uri', $response['response']['transaction_details']['external_resource_url']);
39
+ $this->getInfoInstance()->setAdditionalInformation('payment_id_detail', $response['response']['id']);
40
  return true;
41
  }
42
 
58
  $info = $this->getInfoInstance();
59
  $info->setAdditionalInformation('payment_method', $infoForm['payment_method_ticket']);
60
 
61
+
62
+
63
  if (isset($infoForm['coupon_code'])) {
64
  $info->setAdditionalInformation('coupon_code', $infoForm['coupon_code']);
65
  }
app/code/community/MercadoPago/Core/Model/Observer.php CHANGED
@@ -66,6 +66,8 @@ class MercadoPago_Core_Model_Observer
66
 
67
  $this->validateClientCredentials();
68
 
 
 
69
  $this->setSponsor();
70
 
71
  $this->availableCheckout();
@@ -133,7 +135,7 @@ class MercadoPago_Core_Model_Observer
133
  $user = $mp->get("/users/me");
134
  Mage::helper('mercadopago')->log("API Users response", self::LOG_FILE, $user);
135
 
136
- if ($user['status'] == 200 && !in_array("test_user", $user['response']['tags'])) {
137
  $sponsors = [
138
  'MLA' => 186172525,
139
  'MLB' => 186175129,
@@ -142,15 +144,16 @@ class MercadoPago_Core_Model_Observer
142
  'MLC' => 206959756,
143
  'MLV' => 206960619,
144
  'MPE' => 217178514,
 
145
  ];
146
  $countryCode = $user['response']['site_id'];
147
-
148
  if (isset($sponsors[$countryCode])) {
149
  $sponsorId = $sponsors[$countryCode];
150
  } else {
151
  $sponsorId = "";
152
  }
153
-
154
  Mage::helper('mercadopago')->log("Sponsor id set", self::LOG_FILE, $sponsorId);
155
  }
156
  $this->_saveWebsiteConfig('payment/mercadopago/sponsor_id', $sponsorId);
@@ -191,44 +194,55 @@ class MercadoPago_Core_Model_Observer
191
  public function salesOrderBeforeCancel (Varien_Event_Observer $observer) {
192
  $orderID = (int) $observer->getEvent()->getControllerAction()->getRequest()->getParam('order_id');
193
  $order = Mage::getModel('sales/order')->load($orderID);
194
- if ($order->getExternalRequest()) {
 
 
 
195
  return;
196
  }
197
  $orderStatus = $order->getData('status');
198
  $orderPaymentStatus = $order->getPayment()->getData('additional_information')['status'];
199
 
200
- $paymentID = $order->getPayment()->getData('additional_information')['id'];
201
- $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
202
 
203
- $isValidBasicData = $this->checkCancelationBasicData ($paymentID, $paymentMethod);
204
- $isValidaData = $this->checkCancelationData ($orderStatus, $orderPaymentStatus);
205
 
206
- if ($isValidBasicData && $isValidaData) {
207
- $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
208
- $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
209
 
210
- $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
211
- $response = null;
 
 
 
 
212
 
213
- $access_token = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
 
 
214
 
215
- if ($paymentMethod == 'mercadopago_standard') {
216
- $response = $mp->cancel_payment($paymentID);
217
- } else {
218
- $data = [
219
- "status" => 'cancelled',
220
- ];
221
- $response = $mp->put("/v1/payments/$paymentID?access_token=$access_token", $data);
222
- }
223
 
224
- if ($response['status'] == 200) {
225
- Mage::register('mercadopago_cancellation', true);
226
- $this->_getSession()->addSuccess(__('Cancellation made by Mercado Pago'));
227
- } else {
228
- $this->_getSession()->addError(__('Failed to make the cancellation by Mercado Pago'));
229
- $this->_getSession()->addError($response['status'] . ' ' . $response['response']['message']);
230
- $this->throwCancelationException();
231
- }
 
 
 
 
 
 
 
 
 
 
232
  }
233
  }
234
 
@@ -239,13 +253,13 @@ class MercadoPago_Core_Model_Observer
239
  }
240
 
241
  if (!($paymentMethod == 'mercadopago_standard' || $paymentMethod == 'mercadopago_custom')) {
242
- $this->_getSession()->addError(__('Order payment wasn\'t made by Mercado Pago. The cancellation will be made through Magento'));
243
  return false;
244
  }
245
 
246
  $refundAvailable = Mage::getStoreConfig('payment/mercadopago/refund_available');
247
  if (!$refundAvailable) {
248
- $this->_getSession()->addError(__('Mercado Pago cancellations are disabled. The cancellation will be made through Magento'));
249
  return false;
250
  }
251
 
@@ -273,7 +287,9 @@ class MercadoPago_Core_Model_Observer
273
  }
274
 
275
  protected function throwCancelationException () {
276
- Mage::register('cancel_exception', true);
 
 
277
  }
278
 
279
  protected function _getSession() {
@@ -306,15 +322,17 @@ class MercadoPago_Core_Model_Observer
306
  {
307
  $creditMemo = $observer->getData('creditmemo');
308
  $order = $creditMemo->getOrder();
309
- if ($order->getExternalRequest()) {
 
 
 
310
  return; // si la peticion de crear un credit memo viene de mercado pago, no hace falta mandar el request nuevamente
311
  }
312
 
313
  $orderStatus = $order->getData('status');
314
  $orderPaymentStatus = $order->getPayment()->getData('additional_information')['status'];
315
  $payment = $order->getPayment();
316
- $paymentID = $order->getPayment()->getData('additional_information')['payment_id_detail'];
317
- $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
318
  $orderStatusHistory = $order->getAllStatusHistory();
319
  $isCreditCardPayment = ($order->getPayment()->getData('additional_information')['installments'] != null ? true : false);
320
 
@@ -326,17 +344,18 @@ class MercadoPago_Core_Model_Observer
326
  }
327
  }
328
  $isValidBasicData = $this->checkRefundBasicData ($paymentMethod, $paymentDate);
329
- $isValidaData = $this->checkRefundData ($isCreditCardPayment,
330
- $orderStatus,
331
- $orderPaymentStatus,
332
- $paymentDate,
333
- $order);
334
-
335
- $isTotalRefund = $payment->getAmountPaid() == $payment->getAmountRefunded();
336
- if ($isValidBasicData && $isValidaData) {
337
- $this->sendRefundRequest($order, $creditMemo, $paymentMethod, $isTotalRefund, $paymentID);
 
 
338
  }
339
-
340
  }
341
 
342
  protected function checkRefundBasicData ($paymentMethod, $paymentDate) {
@@ -348,12 +367,12 @@ class MercadoPago_Core_Model_Observer
348
  }
349
 
350
  if (!($paymentMethod == 'mercadopago_standard' || $paymentMethod == 'mercadopago_custom')) {
351
- $this->_getSession()->addError(__('Order payment wasn\'t made by Mercado Pago. The refund will be made through Magento'));
352
  return false;
353
  }
354
 
355
  if (!$refundAvailable) {
356
- $this->_getSession()->addError(__('Mercado Pago refunds are disabled. The refund will be made through Magento'));
357
  return false;
358
  }
359
 
@@ -405,15 +424,15 @@ class MercadoPago_Core_Model_Observer
405
  return $isValidaData;
406
  }
407
 
408
- protected function sendRefundRequest ($order, $creditMemo, $paymentMethod, $isTotalRefund, $paymentID) {
409
- $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
410
- $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
411
 
412
- $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
413
  $response = null;
414
  $amount = $creditMemo->getGrandTotal();
415
- $access_token = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
416
  if ($paymentMethod == 'mercadopago_standard') {
 
 
 
 
417
  if ($isTotalRefund) {
418
  $response = $mp->refund_payment($paymentID);
419
  $order->setMercadoPagoRefundType('total');
@@ -427,16 +446,19 @@ class MercadoPago_Core_Model_Observer
427
  "amount" => $amount,
428
  "metadata" => $metadata,
429
  ];
430
- $response = $mp->post("/collections/$paymentID/refunds?access_token=$access_token", $params);
431
  }
432
  } else {
 
 
 
433
  if ($isTotalRefund) {
434
- $response = $mp->post("/v1/payments/$paymentID/refunds?access_token=$access_token");
435
  } else {
436
  $params = [
437
  "amount" => $amount,
438
  ];
439
- $response = $mp->post("/v1/payments/$paymentID/refunds?access_token=$access_token", $params);
440
  }
441
  }
442
 
@@ -453,7 +475,7 @@ class MercadoPago_Core_Model_Observer
453
  protected function throwRefundException () {
454
  Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Refund not made'));
455
  }
456
-
457
  private function daysSince($date)
458
  {
459
  $now = Mage::getModel('core/date')->timestamp(time());
@@ -476,4 +498,29 @@ class MercadoPago_Core_Model_Observer
476
  }
477
  }
478
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  }
66
 
67
  $this->validateClientCredentials();
68
 
69
+ $this->validateRecurringClientCredentials();
70
+
71
  $this->setSponsor();
72
 
73
  $this->availableCheckout();
135
  $user = $mp->get("/users/me");
136
  Mage::helper('mercadopago')->log("API Users response", self::LOG_FILE, $user);
137
 
138
+ if ($user['status'] == 200 && !in_array("test_user", $user['response']['tags']) && strpos($accessToken, 'TEST') === FALSE) {
139
  $sponsors = [
140
  'MLA' => 186172525,
141
  'MLB' => 186175129,
144
  'MLC' => 206959756,
145
  'MLV' => 206960619,
146
  'MPE' => 217178514,
147
+ 'MPU' => 247028139,
148
  ];
149
  $countryCode = $user['response']['site_id'];
150
+
151
  if (isset($sponsors[$countryCode])) {
152
  $sponsorId = $sponsors[$countryCode];
153
  } else {
154
  $sponsorId = "";
155
  }
156
+
157
  Mage::helper('mercadopago')->log("Sponsor id set", self::LOG_FILE, $sponsorId);
158
  }
159
  $this->_saveWebsiteConfig('payment/mercadopago/sponsor_id', $sponsorId);
194
  public function salesOrderBeforeCancel (Varien_Event_Observer $observer) {
195
  $orderID = (int) $observer->getEvent()->getControllerAction()->getRequest()->getParam('order_id');
196
  $order = Mage::getModel('sales/order')->load($orderID);
197
+
198
+ $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
199
+
200
+ if ($order->getExternalRequest() || !$this->_isMercadoPago($paymentMethod)) {
201
  return;
202
  }
203
  $orderStatus = $order->getData('status');
204
  $orderPaymentStatus = $order->getPayment()->getData('additional_information')['status'];
205
 
206
+ $paymentID = $order->getPayment()->getData('additional_information')['payment_id_detail'];
 
207
 
208
+ if (!($orderPaymentStatus == null || $paymentID == null)) {
 
209
 
210
+ $isValidBasicData = $this->checkCancelationBasicData($paymentID, $paymentMethod);
211
+ if ($isValidBasicData) {
212
+ $isValidaData = $this->checkCancelationData($orderStatus, $orderPaymentStatus);
213
 
214
+ if ($isValidBasicData && $isValidaData) {
215
+ $this->_sendCancellationRequest($paymentMethod, $paymentID);
216
+ }
217
+ }
218
+ }
219
+ }
220
 
221
+ protected function _sendCancellationRequest ($paymentMethod, $paymentID) {
222
+ $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
223
+ $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
224
 
225
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
226
+ $response = null;
 
 
 
 
 
 
227
 
228
+ $access_token = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
229
+
230
+ if ($paymentMethod == 'mercadopago_standard') {
231
+ $response = $mp->cancel_payment($paymentID);
232
+ } else {
233
+ $data = [
234
+ "status" => 'cancelled',
235
+ ];
236
+ $response = $mp->put("/v1/payments/$paymentID?access_token=$access_token", $data);
237
+ }
238
+
239
+ if ($response['status'] == 200) {
240
+ Mage::register('mercadopago_cancellation', true);
241
+ $this->_getSession()->addSuccess(__('Cancellation made by Mercado Pago'));
242
+ } else {
243
+ $this->_getSession()->addError(__('Failed to make the cancellation by Mercado Pago'));
244
+ $this->_getSession()->addError($response['status'] . ' ' . $response['response']['message']);
245
+ $this->throwCancelationException();
246
  }
247
  }
248
 
253
  }
254
 
255
  if (!($paymentMethod == 'mercadopago_standard' || $paymentMethod == 'mercadopago_custom')) {
256
+ $this->_getSession()->addWarning(__('Order payment wasn\'t made by Mercado Pago. The cancellation will be made through Magento'));
257
  return false;
258
  }
259
 
260
  $refundAvailable = Mage::getStoreConfig('payment/mercadopago/refund_available');
261
  if (!$refundAvailable) {
262
+ $this->_getSession()->addWarning(__('Mercado Pago cancellations are disabled. The cancellation will be made through Magento'));
263
  return false;
264
  }
265
 
287
  }
288
 
289
  protected function throwCancelationException () {
290
+ if (Mage::registry('cancel_exception') != null) {
291
+ Mage::register('cancel_exception', true);
292
+ }
293
  }
294
 
295
  protected function _getSession() {
322
  {
323
  $creditMemo = $observer->getData('creditmemo');
324
  $order = $creditMemo->getOrder();
325
+
326
+ $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
327
+
328
+ if ($order->getExternalRequest() || !$this->_isMercadoPago($paymentMethod)) {
329
  return; // si la peticion de crear un credit memo viene de mercado pago, no hace falta mandar el request nuevamente
330
  }
331
 
332
  $orderStatus = $order->getData('status');
333
  $orderPaymentStatus = $order->getPayment()->getData('additional_information')['status'];
334
  $payment = $order->getPayment();
335
+
 
336
  $orderStatusHistory = $order->getAllStatusHistory();
337
  $isCreditCardPayment = ($order->getPayment()->getData('additional_information')['installments'] != null ? true : false);
338
 
344
  }
345
  }
346
  $isValidBasicData = $this->checkRefundBasicData ($paymentMethod, $paymentDate);
347
+ if ($isValidBasicData) {
348
+ $isValidaData = $this->checkRefundData ($isCreditCardPayment,
349
+ $orderStatus,
350
+ $orderPaymentStatus,
351
+ $paymentDate,
352
+ $order);
353
+
354
+ $isTotalRefund = $payment->getAmountPaid() == $payment->getAmountRefunded();
355
+ if ($isValidBasicData && $isValidaData) {
356
+ $this->sendRefundRequest($order, $creditMemo, $paymentMethod, $isTotalRefund);
357
+ }
358
  }
 
359
  }
360
 
361
  protected function checkRefundBasicData ($paymentMethod, $paymentDate) {
367
  }
368
 
369
  if (!($paymentMethod == 'mercadopago_standard' || $paymentMethod == 'mercadopago_custom')) {
370
+ $this->_getSession()->addWarning(__('Order payment wasn\'t made by Mercado Pago. The refund will be made through Magento'));
371
  return false;
372
  }
373
 
374
  if (!$refundAvailable) {
375
+ $this->_getSession()->addWarning(__('Mercado Pago refunds are disabled. The refund will be made through Magento'));
376
  return false;
377
  }
378
 
424
  return $isValidaData;
425
  }
426
 
427
+ protected function sendRefundRequest ($order, $creditMemo, $paymentMethod, $isTotalRefund) {
 
 
428
 
 
429
  $response = null;
430
  $amount = $creditMemo->getGrandTotal();
 
431
  if ($paymentMethod == 'mercadopago_standard') {
432
+ $paymentID = $order->getPayment()->getData('additional_information')['id'];
433
+ $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
434
+ $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
435
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
436
  if ($isTotalRefund) {
437
  $response = $mp->refund_payment($paymentID);
438
  $order->setMercadoPagoRefundType('total');
446
  "amount" => $amount,
447
  "metadata" => $metadata,
448
  ];
449
+ $response = $mp->post('/collections/' . $paymentID . '/refunds?access_token=' . $mp->get_access_token(), $params);
450
  }
451
  } else {
452
+ $paymentID = $order->getPayment()->getData('additional_information')['payment_id_detail'];
453
+ $accessToken = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_ACCESS_TOKEN);
454
+ $mp = Mage::helper('mercadopago')->getApiInstance($accessToken);
455
  if ($isTotalRefund) {
456
+ $response = $mp->post("/v1/payments/$paymentID/refunds?access_token=$accessToken", []);
457
  } else {
458
  $params = [
459
  "amount" => $amount,
460
  ];
461
+ $response = $mp->post("/v1/payments/$paymentID/refunds?access_token=$accessToken", $params);
462
  }
463
  }
464
 
475
  protected function throwRefundException () {
476
  Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Refund not made'));
477
  }
478
+
479
  private function daysSince($date)
480
  {
481
  $now = Mage::getModel('core/date')->timestamp(time());
498
  }
499
  }
500
  }
501
+
502
+ public function checkoutSubmitAllAfter (Varien_Event_Observer $observer) {
503
+ $recurringProfiles = $observer->getRecurringProfiles();
504
+ if (isset($recurringProfiles) && count($recurringProfiles) > 0) {
505
+ $checkoutSession = Mage::getSingleton('checkout/session');
506
+ $checkoutSession->setRedirectUrl(Mage::getUrl('mercadopago/recurringPayment'));
507
+ }
508
+ }
509
+
510
+ protected function validateRecurringClientCredentials()
511
+ {
512
+ $clientId = Mage::getStoreConfig('payment/mercadopago_recurring/client_id');
513
+ $clientSecret = Mage::getStoreConfig('payment/mercadopago_recurring/client_secret');
514
+ if (!empty($clientId) && !empty($clientSecret)) {
515
+ if (!Mage::helper('mercadopago')->isValidClientCredentials($clientId, $clientSecret)) {
516
+ Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Recurring Payment Checkout: Invalid client id or client secret'));
517
+ }
518
+ }
519
+ }
520
+
521
+ protected function _isMercadoPago($paymentMethod)
522
+ {
523
+ return ($paymentMethod == 'mercadopago_standard' || $paymentMethod == 'mercadopago_custom');
524
+ }
525
+
526
  }
app/code/community/MercadoPago/Core/Model/Recurring/Payment.php ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_Model_Recurring_Payment
4
+ extends Mage_Payment_Model_Method_Abstract
5
+ implements Mage_Payment_Model_Recurring_Profile_MethodInterface
6
+ {
7
+ protected $_formBlockType = 'mercadopago/recurring_form';
8
+ protected $_infoBlockType = 'mercadopago/recurring_info';
9
+
10
+ protected $_code = 'mercadopago_recurring';
11
+
12
+ protected $_isGateway = true;
13
+ protected $_canOrder = true;
14
+ protected $_canAuthorize = true;
15
+
16
+ const LOG_FILE = 'mercadopago-recurring.log';
17
+
18
+ public function isAvailable($quote = null)
19
+ {
20
+ $parent = parent::isAvailable($quote);
21
+ $clientId = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_ID);
22
+ $clientSecret = Mage::getStoreConfig(MercadoPago_Core_Helper_Data::XML_PATH_CLIENT_SECRET);
23
+ $standard = (!empty($clientId) && !empty($clientSecret));
24
+
25
+ if (!$parent || !$standard) {
26
+ return false;
27
+ }
28
+
29
+ if ($quote != null) {
30
+ $enabled = Mage::getStoreConfig('payment/mercadopago_recurring/active');
31
+ if ($enabled) {
32
+ $items = $quote->getAllItems();
33
+ foreach ($items as $item) {
34
+ if (!$item->getIsNominal()) {
35
+ return false;
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ return Mage::helper('mercadopago')->isValidClientCredentials($clientId, $clientSecret);
42
+
43
+ }
44
+
45
+ public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
46
+ {
47
+ $core = Mage::getModel('mercadopago/core');
48
+ $response = $core->getRecurringPayment($profile->getReferenceId());
49
+ if ($response['status'] == 201 || $response['status'] == 200) {
50
+ return true;
51
+ }
52
+ return false;
53
+ }
54
+
55
+ /**
56
+ * Submit to the gateway
57
+ *
58
+ * @param Mage_Payment_Model_Recurring_Profile $profile
59
+ * @param Mage_Payment_Model_Info $paymentInfo
60
+ */
61
+ public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
62
+ {
63
+ if ($profile == null || $paymentInfo == null) {
64
+ return;
65
+ }
66
+
67
+ $date = new DateTime($profile->getStartDatetime());
68
+ $date->modify('+3 minute');
69
+ $startDate = $date->format("Y-m-d\TH:i:s.mO");
70
+
71
+ $daysModifier = 1;
72
+ $end = null;
73
+ $periodUnit = null;
74
+ $periodFrequency = null;
75
+ switch ($profile->getPeriodUnit()) {
76
+ case Mage_Payment_Model_Recurring_Profile::PERIOD_UNIT_DAY:
77
+ $periodUnit = 'days';
78
+ $periodFrequency = $profile->getPeriodFrequency();
79
+ break;
80
+ case Mage_Payment_Model_Recurring_Profile::PERIOD_UNIT_WEEK:
81
+ $periodUnit = 'days';
82
+ $periodFrequency = $profile->getPeriodFrequency() * 7;
83
+ $daysModifier = 7;
84
+ break;
85
+ case Mage_Payment_Model_Recurring_Profile::PERIOD_UNIT_SEMI_MONTH:
86
+ $periodUnit = 'days';
87
+ $periodFrequency = $profile->getPeriodFrequency() * 14;
88
+ $daysModifier = 14;
89
+ break;
90
+ case Mage_Payment_Model_Recurring_Profile::PERIOD_UNIT_MONTH:
91
+ $periodUnit = 'months';
92
+ $periodFrequency = $profile->getPeriodFrequency();
93
+ $end = $date->modify('+' . $profile->getPeriodMaxCycles() . ' ' . $periodUnit);
94
+ break;
95
+ case Mage_Payment_Model_Recurring_Profile::PERIOD_UNIT_YEAR:
96
+ $periodUnit = 'days';
97
+ $periodFrequency = $profile->getPeriodFrequency() * 365;
98
+ $daysModifier = 365;
99
+ break;
100
+ }
101
+
102
+ if (!isset($end)) {
103
+ $end = $date->modify('+' . $profile->getPeriodMaxCycles() * $daysModifier . ' ' . $periodUnit);
104
+ }
105
+ $end->modify('-3 minute');
106
+
107
+ $endDate = $end->format("Y-m-d\TH:i:s.mO");
108
+
109
+ $backUrl = Mage::getStoreConfig('payment/mercadopago_recurring/back_url');
110
+
111
+ $preapprovalData = array(
112
+ "payer_email" => $profile->getOrderInfo()['customer_email'],
113
+ "back_url" => $backUrl,
114
+ "reason" => $profile->getScheduleDescription(),
115
+ "external_reference" => $profile->getId(),
116
+ "auto_recurring" => array(
117
+ "frequency" => $periodFrequency,
118
+ "frequency_type" => $periodUnit,
119
+ "transaction_amount" => $profile->getBillingAmount() + $profile->getShippingAmount(),
120
+ "currency_id" => $profile->getCurrencyCode(),
121
+ "start_date" => $startDate,
122
+ "end_date" => $endDate
123
+ )
124
+ );
125
+
126
+ $this->_sendPreapprovalPaymentRequest($profile, $preapprovalData);
127
+ }
128
+
129
+ protected function _sendPreapprovalPaymentRequest($profile, $preapproval_data) {
130
+ $clientId = Mage::getStoreConfig('payment/mercadopago_recurring/client_id');
131
+ $clientSecret = Mage::getStoreConfig('payment/mercadopago_recurring/client_secret');
132
+
133
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
134
+ $sandbox = Mage::getStoreConfig('payment/mercadopago_recurring/sandbox_mode');
135
+
136
+ if ($sandbox) {
137
+ $mp->sandbox_mode(true);
138
+ }
139
+
140
+ $response = $mp->create_preapproval_payment($preapproval_data);
141
+ if ($response['status'] == 201 || $response['status'] == 200) {
142
+ if ($sandbox) {
143
+ $redirectUrl = $response['response']['sandbox_init_point'];
144
+ } else {
145
+ $redirectUrl = $response['response']['init_point'];
146
+ }
147
+ Mage::getSingleton('customer/session')->setInitPoint($redirectUrl);
148
+ $profile->setData('reference_id', $response['response']['id']);
149
+ $profile->setData('schedule_description', $redirectUrl);
150
+ $profile->setData('external_reference', $response['response']['id']);
151
+ } else {
152
+ Mage::throwException(Mage::helper('mercadopago')->__('Mercado Pago - Recurring Profile not created')
153
+ . "\n" . $response['response']['message']);
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Fetch details
159
+ *
160
+ * @param string $referenceId
161
+ * @param Varien_Object $result
162
+ */
163
+ public function getRecurringProfileDetails($referenceId, Varien_Object $result)
164
+ {
165
+ $core = Mage::getModel('mercadopago/core');
166
+ $response = $core->getRecurringPayment($referenceId);
167
+ $value = $response ['response']['status'];
168
+ switch ($value) {
169
+ case 'authorized':
170
+ $result->setIsProfileActive(true);
171
+ break;
172
+ case 'pending':
173
+ $result->setIsProfilePending(true);
174
+ break;
175
+ case 'cancelled':
176
+ $result->setIsProfileCanceled(true);
177
+ break;
178
+ case 'paused':
179
+ $result->setIsProfileSuspended(true);
180
+ break;
181
+ case 'expired':
182
+ $result->setIsProfileExpired(true);
183
+ break;
184
+ }
185
+
186
+ $profile = Mage::registry('current_recurring_profile');
187
+ $productId = $profile->getOrderItemInfo()['product_id'];
188
+ $product = Mage::getModel('catalog/product')->load($productId);
189
+
190
+ $actualAmount = $profile->getBillingAmount() + $profile->getShippingAmount();
191
+ $newAmount = $response ['response']['auto_recurring']['transaction_amount'];
192
+
193
+ if ($actualAmount != $newAmount) {
194
+ $billingAmount = $newAmount - $profile->getShippingAmount();
195
+ $profile->setBillingAmount($billingAmount);
196
+ }
197
+
198
+ $isAdmin = Mage::app()->getStore()->isAdmin();
199
+ if ($isAdmin) {
200
+ $this->getUpdateFromAdmin($product, $profile, $newAmount, $referenceId);
201
+ }
202
+ }
203
+
204
+ protected function getUpdateFromAdmin ($product, $profile, $newAmount, $referenceId) {
205
+ $localAmount = $product->getPrice() + $profile->getShippingAmount();
206
+ if ($localAmount != $newAmount) {
207
+ $clientId = Mage::getStoreConfig('payment/mercadopago_recurring/client_id');
208
+ $clientSecret = Mage::getStoreConfig('payment/mercadopago_recurring/client_secret');
209
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
210
+ $response = $mp->update_preapproval_payment($referenceId, ["auto_recurring" => ["transaction_amount" => $localAmount]]);
211
+ if ($response['status'] == 201 || $response['status'] == 200) {
212
+ $profile->setBillingAmount($localAmount);
213
+ $this->_getSession()->addSuccess(__('Recurring Profile updated by Mercado Pago'));
214
+ } else {
215
+ $this->_getSession()->addError(__('Failed to update the recurring profile by Mercado Pago'));
216
+ $this->_getSession()->addError($response['response']['message']);
217
+ }
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Check whether can get recurring profile details
223
+ *
224
+ * @return bool
225
+ */
226
+ public function canGetRecurringProfileDetails()
227
+ {
228
+ return true;
229
+ }
230
+
231
+ /**
232
+ * Update data
233
+ *
234
+ * @param Mage_Payment_Model_Recurring_Profile $profile
235
+ */
236
+ public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
237
+ {
238
+ $clientId = Mage::getStoreConfig('payment/mercadopago_recurring/client_id');
239
+ $clientSecret = Mage::getStoreConfig('payment/mercadopago_recurring/client_secret');
240
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
241
+ $core = Mage::getModel('mercadopago/core');
242
+ $response = $core->getRecurringPayment($profile->getReferenceId());
243
+ $newAmount = $response ['response']['auto_recurring']['transaction_amount'];
244
+ $id = $profile->getData('schedule_description');
245
+ $response = $mp->update_preapproval_payment($id, ["auto_recurring" => ["transaction_amount" => $newAmount]]);
246
+ if ($response['status'] == 201 || $response['status'] == 200) {
247
+ $this->_getSession()->addSuccess(__('Recurring Profile updated by Mercado Pago'));
248
+ } else {
249
+ Mage::throwException(Mage::helper('mercadopago')->__('Failed to update the recurring profile by Mercado Pago'));
250
+ }
251
+ }
252
+
253
+ /**
254
+ * Manage status
255
+ *
256
+ * @param Mage_Payment_Model_Recurring_Profile $profile
257
+ */
258
+ public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
259
+ {
260
+ $clientId = Mage::getStoreConfig('payment/mercadopago_recurring/client_id');
261
+ $clientSecret = Mage::getStoreConfig('payment/mercadopago_recurring/client_secret');
262
+ $mp = Mage::helper('mercadopago')->getApiInstance($clientId, $clientSecret);
263
+ $sandbox = Mage::getStoreConfig('payment/mercadopago_recurring/sandbox_mode');
264
+ if ($sandbox) {
265
+ $mp->sandbox_mode(true);
266
+ }
267
+ $action = null;
268
+ switch ($profile->getNewState()) {
269
+ case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED: $action = 'cancelled'; break;
270
+ case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED: $action = 'paused'; break;
271
+ case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE: $action = 'authorized'; break;
272
+ }
273
+
274
+ $id = explode('=' , $profile->getData('schedule_description'))[1];
275
+ $response = $mp->update_preapproval_payment($id, ["status" => $action]);
276
+ if ($response['status'] == 201 || $response['status'] == 200) {
277
+ $this->_getSession()->addSuccess(__('Recurring Profile updated by Mercado Pago'));
278
+ } else {
279
+ $this->_getSession()->addError(__('Failed to update the recurring profile by Mercado Pago'));
280
+ $this->_getSession()->addError($response['status'] . ' ' . $response['response']['message']);
281
+ }
282
+ }
283
+
284
+ protected function _getSession() {
285
+
286
+ return Mage::getSingleton('core/session');
287
+ }
288
+
289
+ public function getRecurringPaymentData ()
290
+ {
291
+ $initPoint = Mage::getSingleton('customer/session')->getInitPoint();
292
+ $arrayAssign = [
293
+ "init_point" => $initPoint,
294
+ "type_checkout" => $this->getConfigData('type_checkout'),
295
+ "iframe_width" => $this->getConfigData('iframe_width'),
296
+ "iframe_height" => $this->getConfigData('iframe_height'),
297
+ "banner_checkout" => $this->getConfigData('banner_checkout'),
298
+ "status" => 201
299
+ ];
300
+
301
+ return $arrayAssign;
302
+ }
303
+ }
app/code/community/MercadoPago/Core/Model/Source/Country.php CHANGED
@@ -27,6 +27,7 @@ class MercadoPago_Core_Model_Source_Country
27
  $country[] = ['value' => "mlc", 'label' => Mage::helper('mercadopago')->__("Chile"), 'code' => 'CL'];
28
  $country[] = ['value' => "mlv", 'label' => Mage::helper('mercadopago')->__("Venezuela"), 'code' => 'VE'];
29
  $country[] = ['value' => "mpe", 'label' => Mage::helper('mercadopago')->__("Perú"), 'code' => 'PE'];
 
30
 
31
  //force order by key
32
  ksort($country);
27
  $country[] = ['value' => "mlc", 'label' => Mage::helper('mercadopago')->__("Chile"), 'code' => 'CL'];
28
  $country[] = ['value' => "mlv", 'label' => Mage::helper('mercadopago')->__("Venezuela"), 'code' => 'VE'];
29
  $country[] = ['value' => "mpe", 'label' => Mage::helper('mercadopago')->__("Perú"), 'code' => 'PE'];
30
+ $country[] = ['value' => "mlu", 'label' => Mage::helper('mercadopago')->__("Uruguay"), 'code' => 'UY'];
31
 
32
  //force order by key
33
  ksort($country);
app/code/community/MercadoPago/Core/Model/Source/ListPages.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL).
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @copyright Copyright (c) MercadoPago [http://www.mercadopago.com]
12
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
13
+ */
14
+ class MercadoPago_Core_Model_Source_ListPages
15
+ extends Mage_Payment_Model_Method_Abstract
16
+ {
17
+ public function toOptionArray()
18
+ {
19
+ $pages = [];
20
+ $pages[] = ['value' => "product.info.calculator", 'label' => Mage::helper('mercadopago')->__("Product Detail Page")];
21
+ $pages[] = ['value' => "checkout.cart.calculator", 'label' => Mage::helper('mercadopago')->__("Basket page")];
22
+
23
+ //force order by key
24
+ ksort($pages);
25
+
26
+ return $pages;
27
+ }
28
+ }
app/code/community/MercadoPago/Core/Model/Source/Order/Status.php CHANGED
@@ -9,8 +9,8 @@ class MercadoPago_Core_Model_Source_Order_Status extends Mage_Adminhtml_Model_Sy
9
  Mage_Sales_Model_Order::STATE_NEW,
10
  Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
11
  Mage_Sales_Model_Order::STATE_PROCESSING,
12
- //Mage_Sales_Model_Order::STATE_COMPLETE,
13
- //Mage_Sales_Model_Order::STATE_CLOSED,
14
  Mage_Sales_Model_Order::STATE_CANCELED,
15
  Mage_Sales_Model_Order::STATE_HOLDED,
16
  );
9
  Mage_Sales_Model_Order::STATE_NEW,
10
  Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
11
  Mage_Sales_Model_Order::STATE_PROCESSING,
12
+ Mage_Sales_Model_Order::STATE_COMPLETE,
13
+ Mage_Sales_Model_Order::STATE_CLOSED,
14
  Mage_Sales_Model_Order::STATE_CANCELED,
15
  Mage_Sales_Model_Order::STATE_HOLDED,
16
  );
app/code/community/MercadoPago/Core/controllers/CalculatorPaymentController.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MercadoPago_Core_CalculatorPaymentController
4
+ extends Mage_Core_Controller_Front_Action
5
+ {
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+ }
app/code/community/MercadoPago/Core/controllers/NotificationsController.php CHANGED
@@ -30,13 +30,36 @@ class MercadoPago_Core_NotificationsController
30
 
31
  const LOG_FILE = 'mercadopago-notification.log';
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  public function standardAction()
35
  {
36
  $this->_requestData = $this->getRequest()->getParams();
37
  //notification received
38
  $this->_helper = Mage::helper('mercadopago');
39
- $this->_core = Mage::getModel('mercadopago/core');
40
  $this->_statusHelper = Mage::helper('mercadopago/statusUpdate');
41
  $this->_shipmentData = '';
42
 
@@ -47,27 +70,46 @@ class MercadoPago_Core_NotificationsController
47
  }
48
  switch ($this->_getRequestData('topic')) {
49
  case 'merchant_order':
50
- if (!$this->_handleMerchantOrder()) {
51
  return;
52
  }
53
  break;
54
  case 'payment':
55
  $this->_paymentData = $this->_getFormattedPaymentData($this->_getRequestData('id'));
56
- $this->_statusFinal = $this->_paymentData['status'];
 
 
 
 
 
 
 
57
  break;
58
  default:
59
  $this->_responseLog();
60
 
61
  return;
62
  }
 
63
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_paymentData["external_reference"]);
 
 
 
 
 
 
 
64
  if (!$this->_orderExists()) {
65
  return;
66
  }
67
 
 
 
 
 
 
68
  $this->_helper->log('Update Order', self::LOG_FILE);
69
- $this->_statusHelper->setStatusUpdated($this->_paymentData, $this->_order);
70
- $this->_core->updateOrder($this->_order, $this->_paymentData);
71
  $this->_dispatchBeforeSetEvent();
72
 
73
  if ($this->_statusFinal != false) {
@@ -87,13 +129,12 @@ class MercadoPago_Core_NotificationsController
87
  {
88
  $request = $this->getRequest();
89
  $this->_helper = Mage::helper('mercadopago');
90
- $this->_core = Mage::getModel('mercadopago/core');
91
  $this->_statusHelper = Mage::helper('mercadopago/statusUpdate');
92
  $this->_helper->log('Custom Received notification', self::LOG_FILE, $request->getParams());
93
  $dataId = $request->getParam('data_id');
94
  $type = $request->getParam('type');
95
  if (!empty($dataId) && $type == 'payment') {
96
- $response = $this->_core->getPaymentV1($dataId);
97
  $this->_helper->log('Return payment', self::LOG_FILE, $response);
98
 
99
  if ($this->_isValidResponse($response)) {
@@ -101,12 +142,12 @@ class MercadoPago_Core_NotificationsController
101
 
102
  $payment = $this->_helper->setPayerInfo($payment);
103
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($payment['external_reference']);
104
- if (!$this->_orderExists()) {
105
  return;
106
  }
107
  $this->_helper->log('Update Order', self::LOG_FILE);
108
  $this->_statusHelper->setStatusUpdated($payment, $this->_order);
109
- $this->_core->updateOrder($this->_order, $payment);
110
  $setStatusResponse = $this->_statusHelper->setStatusOrder($payment);
111
  $this->_setResponse($setStatusResponse['body'], $setStatusResponse['code']);
112
  $this->_helper->log('Http code', self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
@@ -120,9 +161,9 @@ class MercadoPago_Core_NotificationsController
120
  $this->_helper->log('Http code', self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
121
  }
122
 
123
- protected function _handleMerchantOrder()
124
  {
125
- $merchantOrder = $this->_core->getMerchantOrder($this->_getRequestData('id'));
126
  $this->_helper->log('Return merchant_order', self::LOG_FILE, $merchantOrder);
127
  if (!$this->_isValidMerchantOrder($merchantOrder)) {
128
  $this->_helper->log(MercadoPago_Core_Helper_Response::INFO_MERCHANT_ORDER_NOT_FOUND, self::LOG_FILE, $this->_requestData);
@@ -150,10 +191,13 @@ class MercadoPago_Core_NotificationsController
150
 
151
  protected function _getFormattedPaymentData($paymentId, $data = [])
152
  {
153
- $response = $this->_core->getPayment($paymentId);
 
 
 
154
  $payment = $response['response']['collection'];
155
 
156
- return $this->formatArrayPayment($data, $payment);
157
  }
158
 
159
  protected function _responseLog()
@@ -183,7 +227,8 @@ class MercadoPago_Core_NotificationsController
183
  return false;
184
  }
185
 
186
- protected function _isValidResponse($response) {
 
187
  return ($response['status'] == 200 || $response['status'] == 201);
188
  }
189
 
@@ -238,61 +283,83 @@ class MercadoPago_Core_NotificationsController
238
  return isset($this->_requestData[$key]) ? $this->_requestData[$key] : null;
239
  }
240
 
241
-
242
- public function formatArrayPayment($data, $payment)
 
 
243
  {
244
- Mage::helper('mercadopago')->log("Format Array", self::LOG_FILE);
245
-
246
- $fields = [
247
- "status",
248
- "status_detail",
249
- "payment_id_detail",
250
- "id",
251
- "payment_method_id",
252
- "transaction_amount",
253
- "total_paid_amount",
254
- "coupon_amount",
255
- "installments",
256
- "shipping_cost",
257
- "amount_refunded",
258
- ];
259
-
260
- foreach ($fields as $field) {
261
- if (isset($payment[$field])) {
262
- if (isset($data[$field])) {
263
- $data[$field] .= " | " . $payment[$field];
264
- } else {
265
- $data[$field] = $payment[$field];
266
- }
267
- }
268
  }
269
 
270
- if (isset($payment["last_four_digits"])) {
271
- if (isset($data["trunc_card"])) {
272
- $data["trunc_card"] .= " | " . "xxxx xxxx xxxx " . $payment["last_four_digits"];
273
- } else {
274
- $data["trunc_card"] = "xxxx xxxx xxxx " . $payment["last_four_digits"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  }
 
 
276
  }
277
 
278
- if (isset($payment['cardholder']['name'])) {
279
- if (isset($data["cardholder_name"])) {
280
- $data["cardholder_name"] .= " | " . $payment["cardholder"]["name"];
281
- } else {
282
- $data["cardholder_name"] = $payment["cardholder"]["name"];
283
- }
284
  }
285
 
286
- if (isset($payment['statement_descriptor'])) {
287
- $data['statement_descriptor'] = $payment['statement_descriptor'];
288
- }
289
 
290
- $data['external_reference'] = $payment['external_reference'];
291
- $data['payer_first_name'] = $payment['payer']['first_name'];
292
- $data['payer_last_name'] = $payment['payer']['last_name'];
293
- $data['payer_email'] = $payment['payer']['email'];
294
 
295
- return $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
 
298
  }
30
 
31
  const LOG_FILE = 'mercadopago-notification.log';
32
 
33
+ protected function getCore() {
34
+ if (empty($this->_core)) {
35
+ $this->_core = Mage::getModel('mercadopago/core');
36
+ }
37
+ return $this->_core;
38
+ }
39
+
40
+ public function indexAction()
41
+ {
42
+ $params = $this->getRequest()->getParams();
43
+ Mage::helper('mercadopago')->log('Received notification', self::LOG_FILE, $params);
44
+ if (isset($params['topic'])) {
45
+ switch($params['topic']) {
46
+ case MercadoPago_Core_Helper_Response::TOPIC_RECURRING_PAYMENT: {
47
+ $this->_forward('recurring');
48
+ break;
49
+ }
50
+ case MercadoPago_Core_Helper_Response::TOPIC_PAYMENT: {
51
+ $this->_forward('recurringPayment');
52
+ break;
53
+ }
54
+ }
55
+ }
56
+ }
57
 
58
  public function standardAction()
59
  {
60
  $this->_requestData = $this->getRequest()->getParams();
61
  //notification received
62
  $this->_helper = Mage::helper('mercadopago');
 
63
  $this->_statusHelper = Mage::helper('mercadopago/statusUpdate');
64
  $this->_shipmentData = '';
65
 
70
  }
71
  switch ($this->_getRequestData('topic')) {
72
  case 'merchant_order':
73
+ if (!$this->_handleMerchantOrder($this->_getRequestData('id'))) {
74
  return;
75
  }
76
  break;
77
  case 'payment':
78
  $this->_paymentData = $this->_getFormattedPaymentData($this->_getRequestData('id'));
79
+ if (empty($this->_paymentData)) {
80
+
81
+ return;
82
+ }
83
+ if (!$this->_handleMerchantOrder($this->_paymentData['merchant_order_id'])) {
84
+
85
+ return;
86
+ }
87
  break;
88
  default:
89
  $this->_responseLog();
90
 
91
  return;
92
  }
93
+
94
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_paymentData["external_reference"]);
95
+ if ($this->_order->getStatus() == 'canceled') {
96
+ $this->_helper->log(MercadoPago_Core_Helper_Response::INFO_ORDER_CANCELED, self::LOG_FILE, $this->_requestData);
97
+ $this->_setResponse(MercadoPago_Core_Helper_Response::INFO_ORDER_CANCELED, MercadoPago_Core_Helper_Response::HTTP_BAD_REQUEST);
98
+
99
+ return;
100
+ }
101
+ $this->_statusHelper->setStatusUpdated($this->_paymentData, $this->_order);
102
  if (!$this->_orderExists()) {
103
  return;
104
  }
105
 
106
+ $this->_postStandardAction();
107
+ }
108
+
109
+ protected function _postStandardAction()
110
+ {
111
  $this->_helper->log('Update Order', self::LOG_FILE);
112
+ $this->getCore()->updateOrder($this->_order, $this->_paymentData);
 
113
  $this->_dispatchBeforeSetEvent();
114
 
115
  if ($this->_statusFinal != false) {
129
  {
130
  $request = $this->getRequest();
131
  $this->_helper = Mage::helper('mercadopago');
 
132
  $this->_statusHelper = Mage::helper('mercadopago/statusUpdate');
133
  $this->_helper->log('Custom Received notification', self::LOG_FILE, $request->getParams());
134
  $dataId = $request->getParam('data_id');
135
  $type = $request->getParam('type');
136
  if (!empty($dataId) && $type == 'payment') {
137
+ $response = $this->getCore()->getPaymentV1($dataId);
138
  $this->_helper->log('Return payment', self::LOG_FILE, $response);
139
 
140
  if ($this->_isValidResponse($response)) {
142
 
143
  $payment = $this->_helper->setPayerInfo($payment);
144
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($payment['external_reference']);
145
+ if (!$this->_orderExists() || $this->_order->getStatus() == 'canceled') {
146
  return;
147
  }
148
  $this->_helper->log('Update Order', self::LOG_FILE);
149
  $this->_statusHelper->setStatusUpdated($payment, $this->_order);
150
+ $this->getCore()->updateOrder($this->_order, $payment);
151
  $setStatusResponse = $this->_statusHelper->setStatusOrder($payment);
152
  $this->_setResponse($setStatusResponse['body'], $setStatusResponse['code']);
153
  $this->_helper->log('Http code', self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
161
  $this->_helper->log('Http code', self::LOG_FILE, $this->getResponse()->getHttpResponseCode());
162
  }
163
 
164
+ protected function _handleMerchantOrder($id)
165
  {
166
+ $merchantOrder = $this->getCore()->getMerchantOrder($id);
167
  $this->_helper->log('Return merchant_order', self::LOG_FILE, $merchantOrder);
168
  if (!$this->_isValidMerchantOrder($merchantOrder)) {
169
  $this->_helper->log(MercadoPago_Core_Helper_Response::INFO_MERCHANT_ORDER_NOT_FOUND, self::LOG_FILE, $this->_requestData);
191
 
192
  protected function _getFormattedPaymentData($paymentId, $data = [])
193
  {
194
+ $response = $this->getCore()->getPayment($paymentId);
195
+ if (!$this->_isValidResponse($response)) {
196
+ return [];
197
+ }
198
  $payment = $response['response']['collection'];
199
 
200
+ return $this->_statusHelper->formatArrayPayment($data, $payment, self::LOG_FILE);
201
  }
202
 
203
  protected function _responseLog()
227
  return false;
228
  }
229
 
230
+ protected function _isValidResponse($response)
231
+ {
232
  return ($response['status'] == 200 || $response['status'] == 201);
233
  }
234
 
283
  return isset($this->_requestData[$key]) ? $this->_requestData[$key] : null;
284
  }
285
 
286
+ /**
287
+ * @var $profile Mage_Sales_Model_Recurring_Profile
288
+ */
289
+ public function recurringAction()
290
  {
291
+ $params = $this->getRequest()->getParams();
292
+ if (isset($params['preapproval_id'])) {
293
+ $preapprovalId = $params['preapproval_id'];
294
+ } elseif (isset($params['id'])) {
295
+ $preapprovalId = $params['id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
 
298
+ $response = $this->getCore()->getRecurringPayment($preapprovalId);
299
+
300
+ $profileId = $response ['response']['external_reference'];
301
+ $newState = $response ['response']['status'];
302
+ $newAmount = $response ['response']['auto_recurring']['transaction_amount'];
303
+
304
+ $profile = Mage::getModel('sales/recurring_profile')->load($profileId);
305
+ $actualState = $profile->getState();
306
+ $actualAmount = $profile->getBillingAmount() + $profile->getShippingAmount();
307
+
308
+ if ($actualState != $newState) {
309
+ $state = null;
310
+ switch ($newState) {
311
+ case 'cancelled' :
312
+ $state = Mage_Sales_Model_Recurring_Profile::STATE_CANCELED;
313
+ break;
314
+ case 'paused' :
315
+ $state = Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED;
316
+ break;
317
+ case 'authorized' :
318
+ $state = Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE;
319
+ break;
320
  }
321
+ $profile->setState($state);
322
+ $profile->save();
323
  }
324
 
325
+ if ($actualAmount != $newAmount) {
326
+ $billingAmount = $newAmount - $profile->getShippingAmount();
327
+ $profile->setBillingAmount($billingAmount);
328
+ $profile->save();
 
 
329
  }
330
 
331
+ return $this->_redirect();
 
 
332
 
333
+ }
 
 
 
334
 
335
+ public function recurringPaymentAction() {
336
+ $params = $this->getRequest()->getParams();
337
+ if (!isset($params['id'])) {
338
+ return;
339
+ }
340
+ $paymentData = $this->getCore()->getPayment($params['id']);
341
+ if (empty($paymentData) || ($paymentData['status'] != 200 && $paymentData['status'] != 201)) {
342
+ return;
343
+ }
344
+ Mage::helper('mercadopago')->log('Recurring PaymentAction Data', self::LOG_FILE, $paymentData);
345
+ $paymentData=$paymentData['response']['collection'];
346
+ if ($paymentData['operation_type'] == 'recurring_payment' && $paymentData['status'] == 'approved') {
347
+ $profile = Mage::getModel('sales/recurring_profile')->load($paymentData['external_reference']);
348
+ if ($profile->getId()) {
349
+ $item = new Varien_Object();
350
+ $item->setData($profile->getOrderItemInfo());
351
+ $item->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
352
+ $order = $profile->createOrder($item)->save();
353
+ $statusHelper = Mage::helper('mercadopago/statusUpdate');
354
+ if ($order->getId()) {
355
+ $paymentData = Mage::helper('mercadopago')->setPayerInfo($paymentData);
356
+ $statusHelper->setStatusUpdated($paymentData, $order);
357
+ $this->getCore()->updateOrder($order, $paymentData);
358
+ Mage::helper('mercadopago/statusUpdate')->setStatusOrder($paymentData);
359
+ $profile->addOrderRelation($order->getId());
360
+ }
361
+ }
362
+ }
363
  }
364
 
365
  }
app/code/community/MercadoPago/Core/controllers/RecurringPaymentController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class MercadoPago_Core_RecurringPaymentController
5
+ extends Mage_Core_Controller_Front_Action
6
+ {
7
+ public function indexAction()
8
+ {
9
+ $recurring = Mage::getModel('mercadopago/recurring_payment');
10
+
11
+ $arrayAssign = $recurring->getRecurringPaymentData();
12
+
13
+ $this->loadLayout();
14
+
15
+ $block = Mage::app()->getLayout()->createBlock('mercadopago/recurring_pay');
16
+
17
+ $block->assign($arrayAssign);
18
+
19
+ $this->getLayout()->getBlock('content')->append($block);
20
+ $this->_initLayoutMessages('core/session');
21
+
22
+ $root = $this->getLayout()->getBlock('root');
23
+ $root->setTemplate("mercadopago/clean.phtml");
24
+
25
+ $this->renderLayout();
26
+ }
27
+ }
app/code/community/MercadoPago/Core/etc/config.xml CHANGED
@@ -18,7 +18,7 @@
18
  <config>
19
  <modules>
20
  <MercadoPago_Core>
21
- <version>2.4.1</version>
22
  </MercadoPago_Core>
23
  </modules>
24
 
@@ -102,6 +102,15 @@
102
  </observer>
103
  </observers>
104
  </sales_order_creditmemo_save_after>
 
 
 
 
 
 
 
 
 
105
  </events>
106
  <sales>
107
  <quote>
@@ -212,6 +221,8 @@
212
  <use_successpage_mp>1</use_successpage_mp>
213
  <logs>0</logs>
214
  <debug_mode>0</debug_mode>
 
 
215
  </mercadopago>
216
 
217
  <mercadopago_custom>
@@ -255,7 +266,35 @@
255
  <sandbox_mode>0</sandbox_mode>
256
  </mercadopago_standard>
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  </payment>
259
  </default>
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  </config>
18
  <config>
19
  <modules>
20
  <MercadoPago_Core>
21
+ <version>2.5.3</version>
22
  </MercadoPago_Core>
23
  </modules>
24
 
102
  </observer>
103
  </observers>
104
  </sales_order_creditmemo_save_after>
105
+
106
+ <checkout_submit_all_after>
107
+ <observers>
108
+ <observer>
109
+ <class>MercadoPago_Core_Model_Observer</class>
110
+ <method>checkoutSubmitAllAfter</method>
111
+ </observer>
112
+ </observers>
113
+ </checkout_submit_all_after>
114
  </events>
115
  <sales>
116
  <quote>
221
  <use_successpage_mp>1</use_successpage_mp>
222
  <logs>0</logs>
223
  <debug_mode>0</debug_mode>
224
+ <calculalator_available>0</calculalator_available>
225
+ <time_between_verifications>*/5 * * * *</time_between_verifications>
226
  </mercadopago>
227
 
228
  <mercadopago_custom>
266
  <sandbox_mode>0</sandbox_mode>
267
  </mercadopago_standard>
268
 
269
+ <mercadopago_recurring>
270
+ <active>0</active>
271
+ <model>mercadopago/recurring_payment</model>
272
+ <title>Mercado Pago - Recurring Payments Checkout</title>
273
+ <allowspecific>0</allowspecific>
274
+ <banner_checkout>http://imgmp.mlstatic.com/org-img/MLB/MP/BANNERS/tipo2_468X60.jpg</banner_checkout>
275
+ <sort_order>-1</sort_order>
276
+ <type_checkout>iframe</type_checkout>
277
+ <auto_return>1</auto_return>
278
+ <iframe_width>900</iframe_width>
279
+ <iframe_height>700</iframe_height>
280
+ <sandbox_mode>0</sandbox_mode>
281
+ </mercadopago_recurring>
282
+
283
  </payment>
284
  </default>
285
 
286
+ <crontab>
287
+ <jobs>
288
+ <order_status_inspector>
289
+ <schedule>
290
+ <!--<cron_expr>*/5 * * * *</cron_expr>-->
291
+ <config_path>payment/mercadopago/time_between_verifications</config_path>
292
+ </schedule>
293
+ <run>
294
+ <model>mercadopago/cron_order::updateOrderStatus</model>
295
+ </run>
296
+ </order_status_inspector>
297
+ </jobs>
298
+ </crontab>
299
+
300
  </config>
app/code/community/MercadoPago/Core/etc/jstranslator.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <jstranslator>
2
+ <choose_an_option translate="message" module="core">
3
+ <message>Choose an option</message>
4
+ </choose_an_option>
5
+
6
+ <other_banks translate="message" module="core">
7
+ <message>Other banks</message>
8
+ </other_banks>
9
+
10
+ <until translate="message" module="core">
11
+ <message>Until </message>
12
+ </until>
13
+
14
+ <payments_without_interest translate="message" module="core">
15
+ <message> payments without interest</message>
16
+ </payments_without_interest>
17
+ </jstranslator>
app/code/community/MercadoPago/Core/etc/system.xml CHANGED
@@ -46,51 +46,71 @@
46
  <show_in_website>1</show_in_website>
47
  <show_in_store>0</show_in_store>
48
  </category_id>
49
- <order_status_approved translate="label">
50
- <label>Choose the status of approved orders</label>
51
- <comment>To manage the status available go to System > Order Statuses</comment>
52
  <frontend_type>select</frontend_type>
53
- <source_model>mercadopago/source_order_status</source_model>
54
  <sort_order>70</sort_order>
55
  <show_in_default>1</show_in_default>
56
  <show_in_website>1</show_in_website>
57
- <show_in_store>1</show_in_store>
58
- </order_status_approved>
59
- <refund_available translate="label">
60
- <label>Refund Available</label>
 
 
61
  <frontend_type>select</frontend_type>
62
  <source_model>adminhtml/system_config_source_yesno</source_model>
63
- <sort_order>75</sort_order>
 
 
 
 
 
 
 
 
 
64
  <show_in_default>1</show_in_default>
65
  <show_in_website>1</show_in_website>
66
  <show_in_store>1</show_in_store>
67
- </refund_available>
68
- <maximum_partial_refunds translate="label comment">
69
- <label>Maximum amount of partial refunds on the same order</label>
 
 
70
  <frontend_type>text</frontend_type>
71
- <sort_order>76</sort_order>
72
  <show_in_default>1</show_in_default>
73
  <show_in_website>1</show_in_website>
74
  <show_in_store>1</show_in_store>
75
- <frontend_class>validate-number-range number-range-1-20</frontend_class>
76
- <comment>It must be a number between 1 and 20</comment>
77
- </maximum_partial_refunds>
78
- <order_status_refunded translate="label">
79
- <label>Choose the status of refunded orders</label>
 
 
 
 
 
 
 
 
80
  <comment>To manage the status available go to System > Order Statuses</comment>
81
  <frontend_type>select</frontend_type>
82
  <source_model>mercadopago/source_order_status</source_model>
83
- <sort_order>80</sort_order>
84
  <show_in_default>1</show_in_default>
85
  <show_in_website>1</show_in_website>
86
  <show_in_store>1</show_in_store>
87
- </order_status_refunded>
88
  <order_status_in_process translate="label">
89
  <label>Choose the status when payment is pending</label>
90
  <comment>To manage the status available go to System > Order Statuses</comment>
91
  <frontend_type>select</frontend_type>
92
  <source_model>mercadopago/source_order_status</source_model>
93
- <sort_order>90</sort_order>
94
  <show_in_default>1</show_in_default>
95
  <show_in_website>1</show_in_website>
96
  <show_in_store>1</show_in_store>
@@ -100,7 +120,7 @@
100
  <comment>To manage the status available go to System > Order Statuses</comment>
101
  <frontend_type>select</frontend_type>
102
  <source_model>mercadopago/source_order_status</source_model>
103
- <sort_order>100</sort_order>
104
  <show_in_default>1</show_in_default>
105
  <show_in_website>1</show_in_website>
106
  <show_in_store>1</show_in_store>
@@ -110,7 +130,7 @@
110
  <comment>To manage the status available go to System > Order Statuses</comment>
111
  <frontend_type>select</frontend_type>
112
  <source_model>mercadopago/source_order_status</source_model>
113
- <sort_order>110</sort_order>
114
  <show_in_default>1</show_in_default>
115
  <show_in_website>1</show_in_website>
116
  <show_in_store>1</show_in_store>
@@ -130,13 +150,13 @@
130
  <comment>To manage the status available go to System > Order Statuses</comment>
131
  <frontend_type>select</frontend_type>
132
  <source_model>mercadopago/source_order_status</source_model>
133
- <sort_order>130</sort_order>
134
  <show_in_default>1</show_in_default>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
137
  </order_status_chargeback>
138
- <order_status_partially_refunded translate="label">
139
- <label>Choose the status when payment was partially refunded</label>
140
  <comment>To manage the status available go to System > Order Statuses</comment>
141
  <frontend_type>select</frontend_type>
142
  <source_model>mercadopago/source_order_status</source_model>
@@ -144,32 +164,67 @@
144
  <show_in_default>1</show_in_default>
145
  <show_in_website>1</show_in_website>
146
  <show_in_store>1</show_in_store>
147
- </order_status_partially_refunded>
148
- <use_successpage_mp translate="label comment">
149
- <label>Use Mercado Pago success page</label>
 
 
 
 
 
 
 
 
150
  <frontend_type>select</frontend_type>
151
  <source_model>adminhtml/system_config_source_yesno</source_model>
152
- <sort_order>135</sort_order>
153
  <show_in_default>1</show_in_default>
154
  <show_in_website>1</show_in_website>
155
- <show_in_store>0</show_in_store>
156
- <comment>If set this config with NO, magento success page will be used</comment>
157
- </use_successpage_mp>
 
 
 
 
 
 
 
 
 
158
  <maximum_days_refund translate="label comment">
159
  <label>Maximum amount of days until refund is not accepted</label>
160
  <frontend_type>text</frontend_type>
161
- <sort_order>136</sort_order>
162
  <show_in_default>1</show_in_default>
163
  <show_in_website>1</show_in_website>
164
  <show_in_store>0</show_in_store>
165
  <frontend_class>validate-number-range number-range-1-90</frontend_class>
166
  <comment>It must be a number between 1 and 90</comment>
167
  </maximum_days_refund>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  <logs translate="label">
169
  <label>Logs</label>
170
  <frontend_type>select</frontend_type>
171
  <source_model>adminhtml/system_config_source_yesno</source_model>
172
- <sort_order>140</sort_order>
173
  <show_in_default>1</show_in_default>
174
  <show_in_website>1</show_in_website>
175
  <show_in_store>0</show_in_store>
@@ -179,22 +234,40 @@
179
  <label>Debug Mode</label>
180
  <frontend_type>select</frontend_type>
181
  <source_model>adminhtml/system_config_source_yesno</source_model>
182
- <sort_order>150</sort_order>
183
  <show_in_default>1</show_in_default>
184
  <show_in_website>1</show_in_website>
185
  <show_in_store>0</show_in_store>
186
  <comment>Enable to display actual error messages to frontend users (not recommended on production environment)</comment>
187
  </debug_mode>
188
- <financing_cost translate="label">
189
- <label>Calculate Financing Cost</label>
 
 
 
 
 
 
 
 
190
  <frontend_type>select</frontend_type>
191
  <source_model>adminhtml/system_config_source_yesno</source_model>
192
- <sort_order>150</sort_order>
193
  <show_in_default>1</show_in_default>
194
- <show_in_website>0</show_in_website>
195
  <show_in_store>0</show_in_store>
196
- <comment></comment>
197
- </financing_cost>
 
 
 
 
 
 
 
 
 
 
198
  </fields>
199
  </mercadopago>
200
 
@@ -213,7 +286,7 @@
213
  <show_in_website>1</show_in_website>
214
  <show_in_store>0</show_in_store>
215
  </public_key>
216
- <access_token translate="label">
217
  <label>Access Token</label>
218
  <frontend_type>text</frontend_type>
219
  <sort_order>10</sort_order>
@@ -249,13 +322,23 @@
249
  <show_in_default>1</show_in_default>
250
  <show_in_website>1</show_in_website>
251
  <show_in_store>0</show_in_store>
252
- <comment>
253
- <![CDATA[It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
254
  During the sandbox mode tests, you can operate over HTTP,
255
  but for homologation you'll need to acquire the certificate in case you don't have it.
256
- <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>]]>
 
257
  </comment>
258
  </active>
 
 
 
 
 
 
 
 
 
259
  <title translate="label">
260
  <label>Payment Title</label>
261
  <frontend_type>text</frontend_type>
@@ -264,7 +347,7 @@
264
  <show_in_website>1</show_in_website>
265
  <show_in_store>0</show_in_store>
266
  </title>
267
- <statement_descriptor translate="label">
268
  <label>Statement Descriptor</label>
269
  <frontend_type>text</frontend_type>
270
  <sort_order>40</sort_order>
@@ -337,7 +420,7 @@
337
  <show_in_default>1</show_in_default>
338
  <show_in_website>1</show_in_website>
339
  <show_in_store>0</show_in_store>
340
- <comment>For the operation of the Checkout Custom Ticket is necessary to configure the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in 'Mercado Pago - Configuration'</comment>
341
  </active>
342
  <title translate="label">
343
  <label>Payment Title</label>
@@ -404,7 +487,7 @@
404
  <show_in_store>1</show_in_store>
405
  <sort_order>20</sort_order>
406
  <fields>
407
- <active translate="label">
408
  <label>Enabled</label>
409
  <frontend_type>select</frontend_type>
410
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -412,7 +495,7 @@
412
  <show_in_default>1</show_in_default>
413
  <show_in_website>1</show_in_website>
414
  <show_in_store>0</show_in_store>
415
- <comment>For the operation of the Checkout Standard is necessary to configure the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in 'Mercado Pago - Configuration'</comment>
416
  </active>
417
  <client_id translate="label">
418
  <label>Client Id</label>
@@ -512,7 +595,7 @@
512
  <show_in_store>0</show_in_store>
513
  <frontend_class>validate-number</frontend_class>
514
  </iframe_height>
515
- <sandbox_mode translate="label">
516
  <label>Sandbox Mode</label>
517
  <frontend_type>select</frontend_type>
518
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -522,7 +605,7 @@
522
  <show_in_store>0</show_in_store>
523
  <comment>Enable to test checkout with real credit cards. For further information check this link: <![CDATA[<a href="https://www.mercadopago.com.ar/developers/en/solutions/payments/basic-checkout/test/basic-sandbox/" target="_blank">Basic Checkout Sandbox</a>]]></comment>
524
  </sandbox_mode>
525
- <communication translate="label">
526
  <label>Custom Message</label>
527
  <frontend_type>textarea</frontend_type>
528
  <sort_order>170</sort_order>
@@ -535,6 +618,143 @@
535
  </mercadopago_standard>
536
  </fields>
537
  </mercadopago_standard_checkout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  </groups>
539
  </payment>
540
  </sections>
46
  <show_in_website>1</show_in_website>
47
  <show_in_store>0</show_in_store>
48
  </category_id>
49
+ <use_successpage_mp translate="label comment">
50
+ <label>Use Mercado Pago success page</label>
 
51
  <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
  <sort_order>70</sort_order>
54
  <show_in_default>1</show_in_default>
55
  <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ <comment>If set this config with NO, magento success page will be used</comment>
58
+ </use_successpage_mp>
59
+ <!-- OneStepcheckout Active configuration - sort_order=65 -->
60
+ <financing_cost translate="label">
61
+ <label>Calculate Financing Cost</label>
62
  <frontend_type>select</frontend_type>
63
  <source_model>adminhtml/system_config_source_yesno</source_model>
64
+ <sort_order>80</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>0</show_in_website>
67
+ <show_in_store>0</show_in_store>
68
+ <comment></comment>
69
+ </financing_cost>
70
+ <time_between_verifications translate="label comment">
71
+ <label>Time between verifications</label>
72
+ <frontend_type>text</frontend_type>
73
+ <sort_order>83</sort_order>
74
  <show_in_default>1</show_in_default>
75
  <show_in_website>1</show_in_website>
76
  <show_in_store>1</show_in_store>
77
+ </time_between_verifications>
78
+ <number_of_hours translate="label comment">
79
+ <label>Number of hours</label>
80
+ <comment>Try to update all the orders created 'Amount of hours' before time to the moment to execute the cron</comment>
81
+ <!--<comment><![CDATA[<strong style="color:red">Warning!</strong> bla bla bla]]></comment>-->
82
  <frontend_type>text</frontend_type>
83
+ <sort_order>85</sort_order>
84
  <show_in_default>1</show_in_default>
85
  <show_in_website>1</show_in_website>
86
  <show_in_store>1</show_in_store>
87
+ <can_be_empty>0</can_be_empty>
88
+ <frontend_class>required-entry validate-digits</frontend_class>
89
+ </number_of_hours>
90
+
91
+ <heading_order_status translate="label">
92
+ <label>Order Status Options</label>
93
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
94
+ <sort_order>95</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ </heading_order_status>
98
+ <order_status_approved translate="label">
99
+ <label>Choose the status of approved orders</label>
100
  <comment>To manage the status available go to System > Order Statuses</comment>
101
  <frontend_type>select</frontend_type>
102
  <source_model>mercadopago/source_order_status</source_model>
103
+ <sort_order>100</sort_order>
104
  <show_in_default>1</show_in_default>
105
  <show_in_website>1</show_in_website>
106
  <show_in_store>1</show_in_store>
107
+ </order_status_approved>
108
  <order_status_in_process translate="label">
109
  <label>Choose the status when payment is pending</label>
110
  <comment>To manage the status available go to System > Order Statuses</comment>
111
  <frontend_type>select</frontend_type>
112
  <source_model>mercadopago/source_order_status</source_model>
113
+ <sort_order>105</sort_order>
114
  <show_in_default>1</show_in_default>
115
  <show_in_website>1</show_in_website>
116
  <show_in_store>1</show_in_store>
120
  <comment>To manage the status available go to System > Order Statuses</comment>
121
  <frontend_type>select</frontend_type>
122
  <source_model>mercadopago/source_order_status</source_model>
123
+ <sort_order>110</sort_order>
124
  <show_in_default>1</show_in_default>
125
  <show_in_website>1</show_in_website>
126
  <show_in_store>1</show_in_store>
130
  <comment>To manage the status available go to System > Order Statuses</comment>
131
  <frontend_type>select</frontend_type>
132
  <source_model>mercadopago/source_order_status</source_model>
133
+ <sort_order>115</sort_order>
134
  <show_in_default>1</show_in_default>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
150
  <comment>To manage the status available go to System > Order Statuses</comment>
151
  <frontend_type>select</frontend_type>
152
  <source_model>mercadopago/source_order_status</source_model>
153
+ <sort_order>125</sort_order>
154
  <show_in_default>1</show_in_default>
155
  <show_in_website>1</show_in_website>
156
  <show_in_store>1</show_in_store>
157
  </order_status_chargeback>
158
+ <order_status_refunded translate="label">
159
+ <label>Choose the status of refunded orders</label>
160
  <comment>To manage the status available go to System > Order Statuses</comment>
161
  <frontend_type>select</frontend_type>
162
  <source_model>mercadopago/source_order_status</source_model>
164
  <show_in_default>1</show_in_default>
165
  <show_in_website>1</show_in_website>
166
  <show_in_store>1</show_in_store>
167
+ </order_status_refunded>
168
+
169
+ <heading_refund translate="label">
170
+ <label>Refund Options</label>
171
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
172
+ <sort_order>145</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ </heading_refund>
176
+ <refund_available translate="label">
177
+ <label>Refund Available</label>
178
  <frontend_type>select</frontend_type>
179
  <source_model>adminhtml/system_config_source_yesno</source_model>
180
+ <sort_order>150</sort_order>
181
  <show_in_default>1</show_in_default>
182
  <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ </refund_available>
185
+ <maximum_partial_refunds translate="label comment">
186
+ <label>Maximum amount of partial refunds on the same order</label>
187
+ <frontend_type>text</frontend_type>
188
+ <sort_order>155</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ <frontend_class>validate-number-range number-range-1-20</frontend_class>
193
+ <comment>It must be a number between 1 and 20</comment>
194
+ </maximum_partial_refunds>
195
  <maximum_days_refund translate="label comment">
196
  <label>Maximum amount of days until refund is not accepted</label>
197
  <frontend_type>text</frontend_type>
198
+ <sort_order>160</sort_order>
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
  <frontend_class>validate-number-range number-range-1-90</frontend_class>
203
  <comment>It must be a number between 1 and 90</comment>
204
  </maximum_days_refund>
205
+ <order_status_partially_refunded translate="label">
206
+ <label>Choose the status when payment was partially refunded</label>
207
+ <comment>To manage the status available go to System > Order Statuses</comment>
208
+ <frontend_type>select</frontend_type>
209
+ <source_model>mercadopago/source_order_status</source_model>
210
+ <sort_order>165</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </order_status_partially_refunded>
215
+
216
+ <heading_developer translate="label">
217
+ <label>Developer Options</label>
218
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
219
+ <sort_order>195</sort_order>
220
+ <show_in_default>1</show_in_default>
221
+ <show_in_website>1</show_in_website>
222
+ </heading_developer>
223
  <logs translate="label">
224
  <label>Logs</label>
225
  <frontend_type>select</frontend_type>
226
  <source_model>adminhtml/system_config_source_yesno</source_model>
227
+ <sort_order>200</sort_order>
228
  <show_in_default>1</show_in_default>
229
  <show_in_website>1</show_in_website>
230
  <show_in_store>0</show_in_store>
234
  <label>Debug Mode</label>
235
  <frontend_type>select</frontend_type>
236
  <source_model>adminhtml/system_config_source_yesno</source_model>
237
+ <sort_order>205</sort_order>
238
  <show_in_default>1</show_in_default>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>0</show_in_store>
241
  <comment>Enable to display actual error messages to frontend users (not recommended on production environment)</comment>
242
  </debug_mode>
243
+
244
+ <heading_calculator translate="label">
245
+ <label>Payments Calculator</label>
246
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
247
+ <sort_order>235</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ </heading_calculator>
251
+ <calculalator_available translate="label">
252
+ <label>Enable Mercado Pago Installments Calculator</label>
253
  <frontend_type>select</frontend_type>
254
  <source_model>adminhtml/system_config_source_yesno</source_model>
255
+ <sort_order>240</sort_order>
256
  <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
  <show_in_store>0</show_in_store>
259
+ <comment>if set to YES, Calculator will appear on the selected pages</comment>
260
+ </calculalator_available>
261
+ <show_in_pages translate="label">
262
+ <label>Show Calculator on selected pages</label>
263
+ <frontend_type>multiselect</frontend_type>
264
+ <source_model>mercadopago/source_listPages</source_model>
265
+ <sort_order>245</sort_order>
266
+ <show_in_default>1</show_in_default>
267
+ <show_in_website>1</show_in_website>
268
+ <show_in_store>1</show_in_store>
269
+ <can_be_empty>1</can_be_empty>
270
+ </show_in_pages>
271
  </fields>
272
  </mercadopago>
273
 
286
  <show_in_website>1</show_in_website>
287
  <show_in_store>0</show_in_store>
288
  </public_key>
289
+ <access_token translate="label comment">
290
  <label>Access Token</label>
291
  <frontend_type>text</frontend_type>
292
  <sort_order>10</sort_order>
322
  <show_in_default>1</show_in_default>
323
  <show_in_website>1</show_in_website>
324
  <show_in_store>0</show_in_store>
325
+ <comment><![CDATA[
326
+ It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
327
  During the sandbox mode tests, you can operate over HTTP,
328
  but for homologation you'll need to acquire the certificate in case you don't have it.
329
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>
330
+ ]]>
331
  </comment>
332
  </active>
333
+ <allow_2_cards_payment translate="label">
334
+ <label>Allow Payment with 2 Cards</label>
335
+ <frontend_type>select</frontend_type>
336
+ <source_model>adminhtml/system_config_source_yesno</source_model>
337
+ <sort_order>15</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>0</show_in_store>
341
+ </allow_2_cards_payment>
342
  <title translate="label">
343
  <label>Payment Title</label>
344
  <frontend_type>text</frontend_type>
347
  <show_in_website>1</show_in_website>
348
  <show_in_store>0</show_in_store>
349
  </title>
350
+ <statement_descriptor translate="label comment">
351
  <label>Statement Descriptor</label>
352
  <frontend_type>text</frontend_type>
353
  <sort_order>40</sort_order>
420
  <show_in_default>1</show_in_default>
421
  <show_in_website>1</show_in_website>
422
  <show_in_store>0</show_in_store>
423
+ <comment>It is necessary to configure the Public Key and Access Token for its proper functioning</comment>
424
  </active>
425
  <title translate="label">
426
  <label>Payment Title</label>
487
  <show_in_store>1</show_in_store>
488
  <sort_order>20</sort_order>
489
  <fields>
490
+ <active translate="label comment">
491
  <label>Enabled</label>
492
  <frontend_type>select</frontend_type>
493
  <source_model>adminhtml/system_config_source_yesno</source_model>
495
  <show_in_default>1</show_in_default>
496
  <show_in_website>1</show_in_website>
497
  <show_in_store>0</show_in_store>
498
+ <comment>It is necessary to configure necessary the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in this section for its proper functioning</comment>
499
  </active>
500
  <client_id translate="label">
501
  <label>Client Id</label>
595
  <show_in_store>0</show_in_store>
596
  <frontend_class>validate-number</frontend_class>
597
  </iframe_height>
598
+ <sandbox_mode translate="label comment">
599
  <label>Sandbox Mode</label>
600
  <frontend_type>select</frontend_type>
601
  <source_model>adminhtml/system_config_source_yesno</source_model>
605
  <show_in_store>0</show_in_store>
606
  <comment>Enable to test checkout with real credit cards. For further information check this link: <![CDATA[<a href="https://www.mercadopago.com.ar/developers/en/solutions/payments/basic-checkout/test/basic-sandbox/" target="_blank">Basic Checkout Sandbox</a>]]></comment>
607
  </sandbox_mode>
608
+ <communication translate="label comment">
609
  <label>Custom Message</label>
610
  <frontend_type>textarea</frontend_type>
611
  <sort_order>170</sort_order>
618
  </mercadopago_standard>
619
  </fields>
620
  </mercadopago_standard_checkout>
621
+ <mercadopago_recurring_checkout translate="label" module="mercadopago">
622
+ <label>Mercado Pago - Recurring Payments Checkout</label>
623
+ <sort_order>200</sort_order>
624
+ <show_in_default>1</show_in_default>
625
+ <show_in_website>1</show_in_website>
626
+ <show_in_store>0</show_in_store>
627
+ <fields>
628
+ <mercadopago_recurring type="group" translate="label comment">
629
+ <label>Checkout Recurring Payments</label>
630
+ <frontend_type>text</frontend_type>
631
+ <frontend_model>mercadopago/adminhtml_system_config_fieldset_payment</frontend_model>
632
+ <show_in_default>1</show_in_default>
633
+ <show_in_website>1</show_in_website>
634
+ <show_in_store>1</show_in_store>
635
+ <sort_order>20</sort_order>
636
+ <comment>This payment method is used only for recurring profiles.</comment>
637
+ <fields>
638
+ <active translate="label">
639
+ <label>Enabled</label>
640
+ <frontend_type>select</frontend_type>
641
+ <source_model>adminhtml/system_config_source_yesno</source_model>
642
+ <sort_order>1</sort_order>
643
+ <show_in_default>1</show_in_default>
644
+ <show_in_website>1</show_in_website>
645
+ <show_in_store>1</show_in_store>
646
+ <comment>"It is necessary to configure necessary the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in this section for its proper functioning</comment>
647
+ </active>
648
+ <client_id translate="label">
649
+ <label>Client Id</label>
650
+ <frontend_type>text</frontend_type>
651
+ <sort_order>15</sort_order>
652
+ <show_in_default>1</show_in_default>
653
+ <show_in_website>1</show_in_website>
654
+ <show_in_store>0</show_in_store>
655
+ </client_id>
656
+ <client_secret translate="label">
657
+ <label>Client Secret</label>
658
+ <frontend_type>text</frontend_type>
659
+ <sort_order>17</sort_order>
660
+ <show_in_default>1</show_in_default>
661
+ <show_in_website>1</show_in_website>
662
+ <show_in_store>0</show_in_store>
663
+ </client_secret>
664
+ <title translate="label">
665
+ <label>Payment Title</label>
666
+ <frontend_type>text</frontend_type>
667
+ <sort_order>20</sort_order>
668
+ <show_in_default>1</show_in_default>
669
+ <show_in_website>1</show_in_website>
670
+ <show_in_store>0</show_in_store>
671
+ </title>
672
+ <banner_checkout translate="label">
673
+ <label>Banner Checkout</label>
674
+ <frontend_type>text</frontend_type>
675
+ <sort_order>30</sort_order>
676
+ <show_in_default>1</show_in_default>
677
+ <show_in_website>1</show_in_website>
678
+ <show_in_store>0</show_in_store>
679
+ </banner_checkout>
680
+ <sort_order translate="label">
681
+ <label>Checkout Position</label>
682
+ <frontend_type>text</frontend_type>
683
+ <sort_order>40</sort_order>
684
+ <show_in_default>1</show_in_default>
685
+ <show_in_website>1</show_in_website>
686
+ <show_in_store>0</show_in_store>
687
+ <frontend_class>validate-number</frontend_class>
688
+ </sort_order>
689
+ <type_checkout>
690
+ <label>Type Checkout</label>
691
+ <frontend_type>select</frontend_type>
692
+ <source_model>mercadopago/source_typeCheckout</source_model>
693
+ <sort_order>50</sort_order>
694
+ <show_in_default>1</show_in_default>
695
+ <show_in_website>1</show_in_website>
696
+ <show_in_store>1</show_in_store>
697
+ </type_checkout>
698
+ <auto_return translate="label">
699
+ <label>Auto Redirect</label>
700
+ <frontend_type>select</frontend_type>
701
+ <source_model>adminhtml/system_config_source_yesno</source_model>
702
+ <sort_order>60</sort_order>
703
+ <show_in_default>1</show_in_default>
704
+ <show_in_website>1</show_in_website>
705
+ <show_in_store>0</show_in_store>
706
+ <comment>Auto-redirect the buyer when finishing the payment.</comment>
707
+ </auto_return>
708
+ <back_url translate="label">
709
+ <label>Back Url</label>
710
+ <frontend_type>text</frontend_type>
711
+ <sort_order>20</sort_order>
712
+ <show_in_default>1</show_in_default>
713
+ <show_in_website>1</show_in_website>
714
+ <show_in_store>0</show_in_store>
715
+ <comment>URL to redirect the user when the pre-approval is authorized</comment>
716
+ </back_url>
717
+ <sandbox_mode translate="label">
718
+ <label>Sandbox Mode</label>
719
+ <frontend_type>select</frontend_type>
720
+ <source_model>adminhtml/system_config_source_yesno</source_model>
721
+ <sort_order>40</sort_order>
722
+ <show_in_default>1</show_in_default>
723
+ <show_in_website>1</show_in_website>
724
+ <show_in_store>1</show_in_store>
725
+ <comment>Enable to test checkout with real credit cards</comment>
726
+ </sandbox_mode>
727
+ <iframe_width translate="label">
728
+ <label>Width Checkout Iframe</label>
729
+ <frontend_type>text</frontend_type>
730
+ <sort_order>100</sort_order>
731
+ <show_in_default>1</show_in_default>
732
+ <show_in_website>1</show_in_website>
733
+ <show_in_store>0</show_in_store>
734
+ <frontend_class>validate-number</frontend_class>
735
+ </iframe_width>
736
+ <iframe_height translate="label">
737
+ <label>Height Checkout Iframe</label>
738
+ <frontend_type>text</frontend_type>
739
+ <sort_order>110</sort_order>
740
+ <show_in_default>1</show_in_default>
741
+ <show_in_website>1</show_in_website>
742
+ <show_in_store>0</show_in_store>
743
+ <frontend_class>validate-number</frontend_class>
744
+ </iframe_height>
745
+ <communication translate="label">
746
+ <label>Custom Message</label>
747
+ <frontend_type>textarea</frontend_type>
748
+ <sort_order>170</sort_order>
749
+ <show_in_default>1</show_in_default>
750
+ <show_in_website>1</show_in_website>
751
+ <show_in_store>0</show_in_store>
752
+ <comment>Custom message to display in checkout</comment>
753
+ </communication>
754
+ </fields>
755
+ </mercadopago_recurring>
756
+ </fields>
757
+ </mercadopago_recurring_checkout>
758
  </groups>
759
  </payment>
760
  </sections>
app/code/community/MercadoPago/MercadoEnvios/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <MercadoPago_MercadoEnvios>
5
- <version>2.4.1</version>
6
  </MercadoPago_MercadoEnvios>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <MercadoPago_MercadoEnvios>
5
+ <version>2.5.3</version>
6
  </MercadoPago_MercadoEnvios>
7
  </modules>
8
  <frontend>
app/code/community/MercadoPago/MercadoEnvios/etc/system.xml CHANGED
@@ -20,7 +20,7 @@
20
  <show_in_store>1</show_in_store>
21
  <sort_order>0</sort_order>
22
  <fields>
23
- <active translate="label">
24
  <label>Enabled</label>
25
  <frontend_type>select</frontend_type>
26
  <source_model>adminhtml/system_config_source_yesno</source_model>
20
  <show_in_store>1</show_in_store>
21
  <sort_order>0</sort_order>
22
  <fields>
23
+ <active translate="label comment">
24
  <label>Enabled</label>
25
  <frontend_type>select</frontend_type>
26
  <source_model>adminhtml/system_config_source_yesno</source_model>
app/code/community/MercadoPago/OneStepCheckout/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <MercadoPago_OneStepCheckout>
5
- <version>2.4.1</version>
6
  </MercadoPago_OneStepCheckout>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <MercadoPago_OneStepCheckout>
5
+ <version>2.5.3</version>
6
  </MercadoPago_OneStepCheckout>
7
  </modules>
8
  <global>
app/code/community/MercadoPago/OneStepCheckout/etc/system.xml CHANGED
@@ -10,7 +10,7 @@
10
  <label>Onestepcheckout Active</label>
11
  <frontend_type>select</frontend_type>
12
  <source_model>adminhtml/system_config_source_yesno</source_model>
13
- <sort_order>200</sort_order>
14
  <show_in_default>1</show_in_default>
15
  <show_in_website>1</show_in_website>
16
  <show_in_store>0</show_in_store>
10
  <label>Onestepcheckout Active</label>
11
  <frontend_type>select</frontend_type>
12
  <source_model>adminhtml/system_config_source_yesno</source_model>
13
+ <sort_order>65</sort_order>
14
  <show_in_default>1</show_in_default>
15
  <show_in_website>1</show_in_website>
16
  <show_in_store>0</show_in_store>
app/design/frontend/base/default/layout/mercadopago.xml CHANGED
@@ -100,4 +100,43 @@
100
  <update handle="mercadopago_add_creditmemo_total" />
101
  </sales_guest_printcreditmemo>
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  </layout>
100
  <update handle="mercadopago_add_creditmemo_total" />
101
  </sales_guest_printcreditmemo>
102
 
103
+ <checkout_cart_index>
104
+ <reference name="head">
105
+ <action method="addCss"><stylesheet>mercadopago/css/style.css</stylesheet></action>
106
+ <action method="addCss"><stylesheet>mercadopago/css/style-calculator.css</stylesheet></action>
107
+ </reference>
108
+ <reference name="checkout.cart.methods">
109
+ <block type="mercadopago/calculator_calculatorLink" name="checkout.cart.calculator" as="calculator" template="mercadopago/calculator/calculatorLink.phtml">
110
+ <block type="mercadopago/calculator_calculatorForm" name="mercadopago_calculator_form" template="mercadopago/calculator/calculatorForm.phtml" />
111
+ </block>
112
+ </reference>
113
+ </checkout_cart_index>
114
+
115
+ <catalog_product_view>
116
+ <reference name="head">
117
+ <action method="addCss"><stylesheet>mercadopago/css/style.css</stylesheet></action>
118
+ <action method="addCss"><stylesheet>mercadopago/css/style-calculator.css</stylesheet></action>
119
+ </reference>
120
+ <reference name="product.info.extrahint">
121
+ <block type="mercadopago/calculator_calculatorLink" name="product.info.calculator" as="calculator" template="mercadopago/calculator/calculatorLink.phtml">
122
+ <block type="mercadopago/calculator_calculatorForm" name="mercadopago_calculator_form" template="mercadopago/calculator/calculatorForm.phtml" />
123
+ </block>
124
+ </reference>
125
+ </catalog_product_view>
126
+
127
+ <!--mercadopago_calculatorpayment_index translate="label">
128
+ <label>Shipment Tracking Popup</label>
129
+ <reference name="root">
130
+ <action method="setTemplate"><template>page/popup.phtml</template></action>
131
+ </reference>
132
+ <reference name="head">
133
+ <action method="addCss">
134
+ <stylesheet>mercadopago/css/style-calculator.css</stylesheet>
135
+ </action>
136
+ </reference>
137
+ <reference name="content">
138
+ <block type="mercadopago/calculator_calculatorForm" name="mercadopago_calculator_form" template="mercadopago/calculator/calculatorForm.phtml" />
139
+ </reference>
140
+ </mercadopago_calculatorpayment_index-->
141
+
142
  </layout>
app/design/frontend/base/default/template/mercadopago/calculator/calculatorForm.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ const STATUS_ACTIVE = 'active';
4
+ const PAYMENT_TYPE_CREDIT_CARD = 'credit_card';
5
+
6
+ $list = $this->getPaymentMethods();
7
+ $pk = $this->getPublicKey();
8
+
9
+ ?>
10
+ <div id="mercadopago-popup" class="mercadopago-popup" style="display: none;">
11
+ <div class="mercadopago-popup-overlay" onclick="MercadoPagoCustom.hidePopup()"></div>
12
+ <main role="main">
13
+ <div class="btn-close-popup" onclick="MercadoPagoCustom.hidePopup()">X</div>
14
+ <?php if (!empty($list) & !empty($pk)) : ?>
15
+ <section id="id-order-profile-app-wrapper" class="order-profile-app-wrapper" data-component="paymentCalculator">
16
+ <div class="loading-overlay"> </div>
17
+ <div class="payment-titles">
18
+ <!-- 'Pagar con Mercado Pago'-->
19
+ <h2 class="title-border-line"><?php echo $this->__('Pay with MercadoPago')?></h2>
20
+ <!-- 'Tarjeta de crédito'-->
21
+ <h3 id="title-payment-cards"><?php echo $this->__('Payment cards')?></h3>
22
+ </div>
23
+
24
+ <div class="columns">
25
+ <div class="cards-column">
26
+ <ul id="op-payment-cards-list">
27
+ <?php foreach ($list as $i) { ?>
28
+ <?php if ($i['status'] === STATUS_ACTIVE & $i['payment_type_id'] === PAYMENT_TYPE_CREDIT_CARD): ?>
29
+ <li id="<?php echo $i['id']; ?>-li">
30
+ <label for="<?php echo $i['id']; ?>">
31
+ <input id="<?php echo $i['id']; ?>" type="radio" name="paymentMethods" value="<?php echo $i['id']; ?>" />
32
+ <img src="<?php echo $i['thumbnail']; ?>" alt="<?php echo $i['id']; ?>"/>
33
+ </label>
34
+ </li>
35
+ <?php endif; ?>
36
+ <?php } ?>
37
+ </ul>
38
+ </div>
39
+
40
+ <div class="data-column">
41
+ <div id="paymentCost" class="op-section-actions price-conditions ">
42
+ <div id="op-bank-select">
43
+ <label for="issuerSelect"><?php echo $this->__('Bank')?></label>
44
+ <select id="issuerSelect"></select>
45
+ </div>
46
+
47
+ <div class="op-installments" id="finalPrice" data-state="visible">
48
+ <label for="installmentSelect"><?php echo $this->__('Pay')?></label>
49
+ <select id="installmentSelect" name="installmentSelect" class="installmentSelect"></select>
50
+ <span id="installmentX">x</span>
51
+ <div class="op-price-box">
52
+ <span id="installmentsPrice" class="op-price ch-price"></span>
53
+ <strong id="installmentsInterestFreeText" class="op-installments-free-text stand-out">
54
+ <!-- remove if interest free -->
55
+ <?php echo $this->__('Interest-free')?>
56
+ </strong>
57
+ </div>
58
+ </div>
59
+ </div>
60
+
61
+ <div class="op-submit">
62
+ <input id="selectPayment" type="button" class="ch-btn ch-btn-small button" value="Aceptar" onclick="MercadoPagoCustom.hidePopup()">
63
+ </div>
64
+
65
+ <div id="costTransparentPrices" data-state="visible">
66
+ <div class="op-installments-primary-options">
67
+ <span id="installmentCFT">CTF:</span>
68
+ </div>
69
+
70
+ <div class="op-installments-secondary-options">
71
+ <div class="op-installments-section">
72
+ <span class="op-installments-title">PTF:</span>
73
+ <span id="installmentPTF"></span>
74
+ </div>
75
+ <div class="op-installments-section">
76
+ <span class="op-installments-title"></span>
77
+ <span id="installmentTEA">TEA:</span>
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </section>
84
+ <?php else : ?>
85
+ <h2> <?php echo $this->__('XXXXXXXX')?> </h2>
86
+ <?php endif; ?>
87
+ </main>
88
+
89
+ <script type="text/javascript">
90
+ var PublicKeyMercadoPagoCustom = '<?php echo $pk; ?>';
91
+ var AllPaymentMethods = '<?php echo json_encode($list); ?>';
92
+ <?php
93
+ // get the current amount
94
+ $isProductPage = Mage::registry('current_product');
95
+ if ( $isProductPage ) {
96
+ $currentAmount = Mage::registry('current_product')->getFinalPrice();;
97
+ } else/*if( $isCartPage )*/ {
98
+ $currentAmount = Mage::helper('checkout/cart')->getQuote()->getGrandTotal();
99
+ }
100
+ ?>
101
+ var Amount = '<?php echo $currentAmount; ?>';
102
+ </script>
103
+ <script type="text/javascript" src= <?php echo $this->getCalculatorJs(); ?>> </script>
104
+ <script type="text/javascript" src= <?php echo $this->getTinyJUrl(); ?>> </script>
105
+ <script src="https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js"></script>
106
+ <script type="text/javascript" src= <?php echo $this->getTinyUrl(); ?>> </script>
107
+ <script>
108
+ MercadoPagoCustom.getInstance();
109
+ </script>
110
+ </div>
app/design/frontend/base/default/template/mercadopago/calculator/calculatorLink.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $link_to_calculator = Mage::getBaseUrl().'mercadopago/calculatorPayment';
3
+ if( $this->isAvailableCalculator() & $this->isPageToShow($this->getNameInLayout()) ): ?>
4
+ <div id="mercadopago_calculator_link">
5
+ <a href="javascript:void(0)" onclick="MercadoPagoCustom.showPopup()">
6
+ <?php echo $this->__('Calculate your payments ')?>
7
+ </a>
8
+ <p><?php echo $this->__('with ')?></p>
9
+ <img id="meli-logo" src="<?php echo $this->getSkinUrl('mercadopago/images/logo.png') ?>" alt="MercadoPago"/>
10
+ </div>
11
+ <?php echo $this->getChildHtml('mercadopago_calculator_form') ?>
12
+ <?php endif; ?>
app/design/frontend/base/default/template/mercadopago/custom/form.phtml CHANGED
@@ -5,6 +5,7 @@ $_code = $this->getMethodCode();
5
  $grant_total = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
6
  $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true);
7
  $logEnabled= Mage::getStoreConfigFlag('payment/mercadopago/logs');
 
8
  $route = $this->getRequest()->getRequestedRouteName();
9
  $customer = $this->getCustomerAndCards();
10
  ?>
@@ -18,9 +19,10 @@ $customer = $this->getCustomerAndCards();
18
 
19
  <fieldset>
20
  <div id="mercadopago_checkout_custom">
 
 
 
21
  <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
22
-
23
-
24
  <?php
25
  if ($coupon_mercadopago):
26
  $block = $this->getLayout()->createBlock('mercadopago/discount')->setCode($_code);
@@ -32,143 +34,141 @@ $customer = $this->getCustomerAndCards();
32
  <?php
33
  endif;
34
  ?>
 
 
 
 
 
 
35
 
36
- <?php if ($customer !== false && isset($customer['cards']) && count($customer['cards']) > 0): ?>
37
- <li>
38
  <ul id="mercadopago_checkout_custom_ocp">
39
  <li id="cardId__mp">
40
-
41
- <div><a id="use_other_card_mp" class="action_ocp"><?php echo $this->__('Use other card'); ?></a></div>
42
-
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"]; ?>" payment_method_id="<?php echo $card["payment_method"]["id"]; ?>">
47
-
48
- <?php echo $card["payment_method"]["name"].' '; ?><?php echo $this->__('ended in'); ?><?php echo ' '.$card["last_four_digits"]; ?>
49
- </option>
50
- <?php } ?>
51
- </select>
52
-
53
- <input type="hidden" name="payment[<?php echo $_code; ?>][customer_id]" value="<?php echo $customer['id']; ?>">
54
-
55
  </li>
56
 
57
  <li id="securityCodeOCP__mp">
58
- <label for="securityCode"><?php echo $this->__('CVV'); ?></label>
59
  <input type="text" id="securityCodeOCP" class="required-entry" data-checkout="securityCode" maxlength="4" data-element-id="#securityCodeOCP__mp"/>
60
-
61
  <p class="message-error error-E302 error-224 validation-advice"><?php echo $this->__('CVV is invalid.'); ?></p>
 
62
  </li>
63
  </ul>
64
- </li>
65
 
66
- <script>
67
  MercadoPagoCustom.getInstance().initOCP();
68
- </script>
69
- <?php endif; ?>
 
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
-
82
  <p class="message-error error-payment-method-not-found error-E301 error-205 validation-advice"><?php echo $this->__('Card number is invalid.'); ?></p>
83
-
84
  <p class="message-error error-payment-method-min-amount validation-advice"><?php echo $this->__('Cannot pay this amount with this payment_method_id.'); ?></p>
85
-
86
  </li>
87
 
88
  <li id="issuer__mp">
89
  <label for="issuer"><?php echo $this->__('Banks'); ?></label>
90
- <select id="issuer" name="payment[<?php echo $_code; ?>][issuer_id]" data-checkout="issuer" data-element-id="#issuer__mp">
91
-
92
- </select>
93
-
94
  <p class="message-error error-220 validation-advice"><?php echo $this->__('Select issuer'); ?></p>
95
  </li>
96
 
97
  <li id="expiration_date__mp">
98
- <div id="box_month">
99
- <label for="cardExpirationMonth"><?php echo $this->__('Month'); ?></label>
100
- <select id="cardExpirationMonth" data-checkout="cardExpirationMonth" class="mp-validate-cc-exp" name="payment[<?php echo $_code; ?>][card_expiration_month]" data-element-id="#expiration_date__mp">
101
- <?php foreach ($this->getCcMonths() as $m => $v): ?>
102
- <option value="<?php echo $m ? $m : ''; ?>"><?php echo $v; ?></option>
103
- <?php endforeach ?>
104
- </select>
105
-
106
- <p class="message-error error-325 error-208 validation-advice"><?php echo $this->__('Month is invalid.'); ?></p>
107
- </div>
108
-
109
- <div id="box_year">
110
- <label for="cardExpirationYear"><?php echo $this->__('Year'); ?></label>
111
- <select id="cardExpirationYear" data-checkout="cardExpirationYear" name="payment[<?php echo $_code; ?>][card_expiration_year]" data-element-id="#expiration_date__mp">
112
- <?php foreach ($this->getCcYears() as $y => $v): ?>
113
- <option value="<?php echo $y ? $y : ''; ?>"><?php echo $v; ?></option>
114
- <?php endforeach ?>
115
- </select>
116
-
117
- <p class="message-error error-326 error-209 validation-advice"><?php echo $this->__('Year is invalid.'); ?></p>
118
  </div>
119
  </li>
120
 
121
  <li id="cardholderName__mp">
122
  <label for="cardholderName"><?php echo $this->__('Card Holder Name'); ?></label>
123
  <input type="text" id="cardholderName" data-checkout="cardholderName" name="payment[<?php echo $_code; ?>][card_holder_name]" data-element-id="#cardholderName__mp"/>
124
-
125
  <p class="message-error error-316 validation-advice"><?php echo $this->__('Card Holder Name is invalid.'); ?></p>
126
  </li>
127
 
128
  <li id="securityCode__mp">
129
  <label for="securityCode"><?php echo $this->__('CVV'); ?></label>
130
  <input type="text" id="securityCode" data-checkout="securityCode" maxlength="4" data-element-id="#securityCode__mp" class="required-entry"/>
131
-
132
  <p class="message-error error-E302 error-224 validation-advice"><?php echo $this->__('CVV is invalid.'); ?></p>
 
133
  </li>
134
 
135
  <li id="doc_type__mp">
136
- <label for="docType"><?php echo $this->__('Document Type'); ?></label>
137
  <select id="docType" data-checkout="docType" data-element-id="#doc_type__mp" name="payment[<?php echo $_code; ?>][doc_type]"></select>
138
-
139
  <p class="message-error error-322 error-212 validation-advice"><?php echo $this->__('Document Type is invalid.'); ?></p>
140
  </li>
141
 
142
  <li id="doc_number__mp">
143
- <label for="docNumber"><?php echo $this->__('Document Number'); ?></label>
144
  <input type="text" id="docNumber" class="mp-validate-docnumber" data-checkout="docNumber" name="payment[<?php echo $_code; ?>][doc_number]" data-element-id="#doc_number__mp"/>
145
-
146
  <p class="message-error error-324 error-213 error-214 validation-advice"><?php echo $this->__('Document Number is invalid.'); ?></p>
147
  </li>
148
-
149
  </ul>
150
- </li>
151
-
152
- <li id="installments__mp">
153
- <label for="installments"><?php echo $this->__('Installments'); ?></label>
154
- <select id="installments" name="payment[<?php echo $_code; ?>][installments]" data-element-id="#installments__mp" class="validate-select"></select>
155
 
156
- <p class="message-error error-installment-not-work validation-advice"><?php echo $this->__('It was not possible to calculate the installments, click here and try again.'); ?></p>
 
 
 
 
 
 
157
 
158
- <p class="message-error error-011 validation-advice"><?php echo $this->__('An error has occurred. Please refresh the page.'); ?></p>
 
 
 
 
159
 
160
- <p class="message-error error-other validation-advice"><?php echo $this->__('Please validate your data.'); ?></p>
161
 
162
- </li>
163
  <li>
164
- <div id="mercadopago-loading">
165
- <img src="<?php echo $this->getSkinUrl('mercadopago/images/loading.gif'); ?>" alt="loading"/>
166
- </div>
167
  </li>
168
 
169
- <li>
 
 
 
 
 
170
  <?php if ($this->getMethod()->getConfigData('communication') != ""): ?>
171
- <p class="communication"><?php echo $this->getMethod()->getConfigData('communication') ?></p>
172
  <?php endif; ?>
173
  <?php if ($this->getMethod()->getConfigData('banner_checkout') != ""): ?>
174
  <img src="<?php echo $this->getMethod()->getConfigData('banner_checkout'); ?>" class="banner_checkout_mp"/>
@@ -181,14 +181,13 @@ $customer = $this->getCustomerAndCards();
181
  <input type="hidden" class="mercadopago-text-currency" value="<?php echo $this->__('$'); ?>">
182
  <input type="hidden" class="mercadopago-text-choice" value="<?php echo $this->__('Choice'); ?>">
183
  <input type="hidden" class="mercadopago-text-default-issuer" value="<?php echo $this->__('Default issuer'); ?>">
184
- <input type="hidden" class="mercadopago-text-installment" value="<?php echo $this->__('Enter the card number'); ?>">
185
  <input type="hidden" class="mercado_base_url" value="<?php echo $base_url; ?>">
186
  <input type="hidden" class="mercado_route" value="<?php echo $route; ?>">
187
  <input type="hidden" name="payment[<?php echo $_code; ?>][token]" type="text" value="" class="token"/>
188
  <input type="hidden" name="payment[<?php echo $_code; ?>][payment_method_id]" type="text" value="" class="payment_method_id"/>
189
-
190
  <input type="hidden" id="one_click_pay_mp" name="payment[<?php echo $_code; ?>][one_click_pay]" value="<?php echo count($customer['cards']) > 0 ? 1 : 0; ?>">
191
- </li>
192
  </ul>
193
  </div>
194
- </fieldset>
5
  $grant_total = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
6
  $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true);
7
  $logEnabled= Mage::getStoreConfigFlag('payment/mercadopago/logs');
8
+ $twoCardsEnabled = Mage::getStoreConfigFlag('payment/mercadopago_custom/allow_2_cards_payment');
9
  $route = $this->getRequest()->getRequestedRouteName();
10
  $customer = $this->getCustomerAndCards();
11
  ?>
19
 
20
  <fieldset>
21
  <div id="mercadopago_checkout_custom">
22
+ <div id="mercadopago-loading">
23
+ <img src="<?php echo $this->getSkinUrl('mercadopago/images/loading.gif'); ?>" alt="loading"/>
24
+ </div>
25
  <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
 
 
26
  <?php
27
  if ($coupon_mercadopago):
28
  $block = $this->getLayout()->createBlock('mercadopago/discount')->setCode($_code);
34
  <?php
35
  endif;
36
  ?>
37
+ <li class="card-form first-card">
38
+ <div id="first_card_amount_fields" class="show_second_card">
39
+ <h3><?php echo $this->__('1st Card'); ?></h3>
40
+ <label for="firstCard"><?php echo $this->__('Amount'); ?></label>
41
+ <input type="text" id="first_card_amount" class="required-entry" max="<?php echo $grant_total; ?>" />
42
+ </div>
43
 
44
+ <?php if ($customer !== false && isset($customer['cards']) && count($customer['cards']) > 0): ?>
 
45
  <ul id="mercadopago_checkout_custom_ocp">
46
  <li id="cardId__mp">
47
+ <a id="use_other_card_mp" class="action_ocp button"><?php echo $this->__('Use other card'); ?></a>
48
+ <div class="form">
49
+ <label id="payment_label" for="cardNumber"><?php echo $this->__('Payment Method: '); ?></label>
50
+ <select id="cardId" name="payment[<?php echo $_code; ?>][cardId]" data-checkout="cardId" data-element-id="#cardId__mp" class="full-width">
51
+ <?php foreach ($customer['cards'] as $card) { ?>
52
+ <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"]; ?>" payment_method_id="<?php echo $card["payment_method"]["id"]; ?>">
53
+
54
+ <?php echo $card["payment_method"]["name"].' '; ?><?php echo $this->__('ended in'); ?><?php echo ' '.$card["last_four_digits"]; ?>
55
+ </option>
56
+ <?php } ?>
57
+ </select>
58
+ <input type="hidden" name="payment[<?php echo $_code; ?>][customer_id]" value="<?php echo $customer['id']; ?>">
59
+ </div>
 
 
60
  </li>
61
 
62
  <li id="securityCodeOCP__mp">
63
+ <label id="security_label" for="securityCode"><?php echo $this->__('CVV'); ?></label>
64
  <input type="text" id="securityCodeOCP" class="required-entry" data-checkout="securityCode" maxlength="4" data-element-id="#securityCodeOCP__mp"/>
 
65
  <p class="message-error error-E302 error-224 validation-advice"><?php echo $this->__('CVV is invalid.'); ?></p>
66
+ <span class="ch-form-hint"><?php echo $this->__('Last 3 numbers on back side.'); ?></span>
67
  </li>
68
  </ul>
 
69
 
70
+ <script>
71
  MercadoPagoCustom.getInstance().initOCP();
72
+ </script>
73
+ <div class="hide"><a id="return_list_card_mp" class="action_ocp button"><?php echo $this->__('Return to cards list'); ?></a></div>
74
+ <?php endif; ?>
75
 
 
76
  <ul id="mercadopago_checkout_custom_card">
77
+
78
  <li id="paymentMethod__mp">
79
  <label for="paymentMethod"><?php echo $this->__('Payment Method'); ?></label>
80
  <select id="paymentMethod" data-checkout="paymentMethod" name="payment[<?php echo $_code; ?>][paymentMethod]" data-element-id="#paymentMethod__mp" class="validate-select"></select>
81
  </li>
82
+
83
  <li id="cardNumber__mp">
84
  <label for="cardNumber"><?php echo $this->__('Card Number'); ?></label>
85
  <input type="text" id="cardNumber" data-checkout="cardNumber" data-element-id="#cardNumber__mp"/>
 
86
  <p class="message-error error-payment-method-not-found error-E301 error-205 validation-advice"><?php echo $this->__('Card number is invalid.'); ?></p>
 
87
  <p class="message-error error-payment-method-min-amount validation-advice"><?php echo $this->__('Cannot pay this amount with this payment_method_id.'); ?></p>
 
88
  </li>
89
 
90
  <li id="issuer__mp">
91
  <label for="issuer"><?php echo $this->__('Banks'); ?></label>
92
+ <select id="issuer" name="payment[<?php echo $_code; ?>][issuer_id]" data-checkout="issuer" data-element-id="#issuer__mp"></select>
 
 
 
93
  <p class="message-error error-220 validation-advice"><?php echo $this->__('Select issuer'); ?></p>
94
  </li>
95
 
96
  <li id="expiration_date__mp">
97
+ <label><?php echo $this->__('Expiration Date'); ?></label>
98
+ <div class="expiration-date-box">
99
+ <div id="box_month">
100
+ <select id="cardExpirationMonth" data-checkout="cardExpirationMonth" class="mp-validate-cc-exp" name="payment[<?php echo $_code; ?>][card_expiration_month]" data-element-id="#expiration_date__mp">
101
+ <?php foreach ($this->getCcMonths() as $m => $v): ?>
102
+ <option value="<?php echo $m ? $m : ''; ?>"><?php echo $v; ?></option>
103
+ <?php endforeach ?>
104
+ </select>
105
+ <p class="message-error error-325 error-208 validation-advice"><?php echo $this->__('Month is invalid.'); ?></p>
106
+ </div>
107
+
108
+ <div id="box_year">
109
+ <select id="cardExpirationYear" data-checkout="cardExpirationYear" name="payment[<?php echo $_code; ?>][card_expiration_year]" data-element-id="#expiration_date__mp">
110
+ <?php foreach ($this->getCcYears() as $y => $v): ?>
111
+ <option value="<?php echo $y ? $y : ''; ?>"><?php echo $v; ?></option>
112
+ <?php endforeach ?>
113
+ </select>
114
+ <p class="message-error error-326 error-209 validation-advice"><?php echo $this->__('Year is invalid.'); ?></p>
115
+ </div>
 
116
  </div>
117
  </li>
118
 
119
  <li id="cardholderName__mp">
120
  <label for="cardholderName"><?php echo $this->__('Card Holder Name'); ?></label>
121
  <input type="text" id="cardholderName" data-checkout="cardholderName" name="payment[<?php echo $_code; ?>][card_holder_name]" data-element-id="#cardholderName__mp"/>
 
122
  <p class="message-error error-316 validation-advice"><?php echo $this->__('Card Holder Name is invalid.'); ?></p>
123
  </li>
124
 
125
  <li id="securityCode__mp">
126
  <label for="securityCode"><?php echo $this->__('CVV'); ?></label>
127
  <input type="text" id="securityCode" data-checkout="securityCode" maxlength="4" data-element-id="#securityCode__mp" class="required-entry"/>
 
128
  <p class="message-error error-E302 error-224 validation-advice"><?php echo $this->__('CVV is invalid.'); ?></p>
129
+ <span class="ch-form-hint"><?php echo $this->__('Last 3 numbers on back side.'); ?></span>
130
  </li>
131
 
132
  <li id="doc_type__mp">
133
+ <label for="docNumber"><?php echo $this->__('Document'); ?></label>
134
  <select id="docType" data-checkout="docType" data-element-id="#doc_type__mp" name="payment[<?php echo $_code; ?>][doc_type]"></select>
 
135
  <p class="message-error error-322 error-212 validation-advice"><?php echo $this->__('Document Type is invalid.'); ?></p>
136
  </li>
137
 
138
  <li id="doc_number__mp">
 
139
  <input type="text" id="docNumber" class="mp-validate-docnumber" data-checkout="docNumber" name="payment[<?php echo $_code; ?>][doc_number]" data-element-id="#doc_number__mp"/>
 
140
  <p class="message-error error-324 error-213 error-214 validation-advice"><?php echo $this->__('Document Number is invalid.'); ?></p>
141
  </li>
 
142
  </ul>
 
 
 
 
 
143
 
144
+ <div id="installments__mp">
145
+ <label for="installments"><?php echo $this->__('Installments'); ?></label>
146
+ <select id="installments" name="payment[<?php echo $_code; ?>][installments]" data-element-id="#installments__mp" class="validate-select full-width"></select>
147
+ <p class="message-error error-installment-not-work validation-advice"><?php echo $this->__('It was not possible to calculate the installments, click here and try again.'); ?></p>
148
+ <p class="message-error error-011 validation-advice"><?php echo $this->__('An error has occurred. Please refresh the page.'); ?></p>
149
+ <p class="message-error error-other validation-advice"><?php echo $this->__('Please validate your data.'); ?></p>
150
+ </div>
151
 
152
+ <div class="legal-info">
153
+ <p class="tea-info tea-info-first-card">TEA: 0,00%</p>
154
+ <p class="cft-info cft-info-first-card">CFT: 0,00%</p>
155
+ </div>
156
+ </li>
157
 
158
+ <?php echo $this->setTemplate('mercadopago/custom/secondCard.phtml')->toHtml(); ?>
159
 
 
160
  <li>
161
+ <a id="show_second_card" class="action_ocp button <?php if (!$twoCardsEnabled): echo "show_second_card_button"?><?php endif;?>"><?php echo $this->__('Use 2 Cards'); ?></a>
 
 
162
  </li>
163
 
164
+ <div class="total_buy">
165
+ <label> <?php echo $this->__('Total amount: '); ?> </label>
166
+ <span class="total_buy_price"> $<?php echo $grant_total; ?>.-</span>
167
+ </div>
168
+
169
+ <div class="banner_custom">
170
  <?php if ($this->getMethod()->getConfigData('communication') != ""): ?>
171
+ <p class="communication banner_checkout_mp"><?php echo $this->getMethod()->getConfigData('communication') ?></p>
172
  <?php endif; ?>
173
  <?php if ($this->getMethod()->getConfigData('banner_checkout') != ""): ?>
174
  <img src="<?php echo $this->getMethod()->getConfigData('banner_checkout'); ?>" class="banner_checkout_mp"/>
181
  <input type="hidden" class="mercadopago-text-currency" value="<?php echo $this->__('$'); ?>">
182
  <input type="hidden" class="mercadopago-text-choice" value="<?php echo $this->__('Choice'); ?>">
183
  <input type="hidden" class="mercadopago-text-default-issuer" value="<?php echo $this->__('Default issuer'); ?>">
184
+ <input type="hidden" class="mercadopago-text-installment" value="<?php echo $this->__('Select Installments'); ?>">
185
  <input type="hidden" class="mercado_base_url" value="<?php echo $base_url; ?>">
186
  <input type="hidden" class="mercado_route" value="<?php echo $route; ?>">
187
  <input type="hidden" name="payment[<?php echo $_code; ?>][token]" type="text" value="" class="token"/>
188
  <input type="hidden" name="payment[<?php echo $_code; ?>][payment_method_id]" type="text" value="" class="payment_method_id"/>
 
189
  <input type="hidden" id="one_click_pay_mp" name="payment[<?php echo $_code; ?>][one_click_pay]" value="<?php echo count($customer['cards']) > 0 ? 1 : 0; ?>">
190
+ </div>
191
  </ul>
192
  </div>
193
+ </fieldset>
app/design/frontend/base/default/template/mercadopago/custom/secondCard.phtml ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $country = Mage::getStoreConfig('payment/mercadopago/country');
3
+ $coupon_mercadopago = Mage::getStoreConfig('payment/mercadopago_custom/coupon_mercadopago');
4
+ $_code = $this->getMethodCode();
5
+ $grant_total = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
6
+ $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true);
7
+ $logEnabled= Mage::getStoreConfigFlag('payment/mercadopago/logs');
8
+ $route = $this->getRequest()->getRequestedRouteName();
9
+ $customer = $this->getCustomerAndCards();
10
+ ?>
11
+
12
+ <li id="second_card_fieldset">
13
+ <div id="mercadopago_checkout_custom_second_card">
14
+ <ul id="second_card_payment_form_<?php echo $_code ?>" class="show_second_card card-form second-card">
15
+ <a data-toggle="tooltip" title="Back to only one card" id="hide_second_card" class="action_ocp button" >X</a>
16
+
17
+ <li id="secondCardAmount">
18
+ <h3><?php echo $this->__('2nd Card'); ?></h3>
19
+ <label for="secondCard"><?php echo $this->__('Remaining Amount'); ?></label>
20
+ <span id="second_card_amount_holder">$<input type="text" id="second_card_amount" class="required-entry" readonly/></span>
21
+ </li>
22
+
23
+ <?php if ($customer !== false && isset($customer['cards']) && count($customer['cards']) > 0): ?>
24
+ <li id="second_card_payment">
25
+ <ul id="second_card_mercadopago_checkout_custom_ocp">
26
+ <li id="second_card_cardId__mp">
27
+ <a id="second_card_use_other_card_mp" class="action_ocp button"><?php echo $this->__('Use other card'); ?></a>
28
+ <div class="form">
29
+ <label for="second_card_cardNumber"><?php echo $this->__('Payment Method'); ?></label>
30
+ <select id="second_card_cardId" name="payment[<?php echo $_code; ?>][cardId]" data-checkout="cardId" data-element-id="#second_card_cardId__mp" class="full-width">
31
+ <?php foreach ($customer['cards'] as $card) { ?>
32
+ <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"]; ?>" payment_method_id="<?php echo $card["payment_method"]["id"]; ?>">
33
+ <?php echo $card["payment_method"]["name"].' '; ?><?php echo $this->__('ended in'); ?><?php echo ' '.$card["last_four_digits"]; ?>
34
+ </option>
35
+ <?php } ?>
36
+ </select>
37
+ <input type="hidden" name="payment[<?php echo $_code; ?>][customer_id]" value="<?php echo $customer['id']; ?>">
38
+ </div>
39
+ </li>
40
+
41
+ <li id="second_card_securityCodeOCP__mp">
42
+ <label for="second_card_securityCode"><?php echo $this->__('CVV'); ?></label>
43
+ <input type="text" id="second_card_securityCodeOCP" class="required-entry" data-checkout="securityCode" maxlength="4" data-element-id="#second_card_securityCodeOCP__mp"/>
44
+ <p class="message-error error-E302 error-224 validation-advice"><?php echo $this->__('CVV is invalid.'); ?></p>
45
+ <span class="ch-form-hint"><?php echo $this->__('Last 3 numbers on back side.'); ?></span>
46
+ </li>
47
+ </ul>
48
+ </li>
49
+ <a id="second_card_return_list_card_mp" class="action_ocp button"><?php echo $this->__('Return to cards list'); ?></a>
50
+ <?php endif; ?>
51
+
52
+ <ul id="second_card_mercadopago_checkout_custom_card">
53
+
54
+ <li id="second_card_paymentMethod__mp">
55
+ <label for="second_card_paymentMethod"><?php echo $this->__('Payment Method'); ?></label>
56
+ <select id="second_card_paymentMethod" data-checkout="paymentMethod" name="payment[<?php echo $_code; ?>][second_card_paymentMethod]" data-element-id="#second_card_paymentMethod__mp" class="validate-select"></select>
57
+ </li>
58
+
59
+ <li id="second_card_cardNumber__mp">
60
+ <label for="second_card_cardNumber"><?php echo $this->__('Card Number'); ?></label>
61
+ <input type="text" id="second_card_cardNumber" data-checkout="cardNumber" data-element-id="#second_card_cardNumber__mp"/>
62
+ <p class="message-error second_card_error-payment-method-not-found error-E301 error-205 validation-advice"><?php echo $this->__('Card number is invalid.'); ?></p>
63
+ <p class="message-error second_card_error-payment-method-min-amount validation-advice"><?php echo $this->__('Cannot pay this amount with this payment_method_id.'); ?></p>
64
+ </li>
65
+
66
+ <li id="second_card_issuer__mp">
67
+ <label for="second_card_issuer"><?php echo $this->__('Banks'); ?></label>
68
+ <select id="second_card_issuer" name="payment[<?php echo $_code; ?>][issuer_id]" data-checkout="issuer" data-element-id="#second_card_issuer__mp"></select>
69
+ <p class="message-error second_card_error-220 validation-advice"><?php echo $this->__('Select issuer'); ?></p>
70
+ </li>
71
+
72
+ <li id="second_card_expiration_date__mp">
73
+ <label><?php echo $this->__('Expiration Date'); ?></label>
74
+ <div class="expiration-date-box">
75
+ <div id="second_card_box_month">
76
+ <select id="second_card_cardExpirationMonth" data-checkout="cardExpirationMonth" class="mp-validate-cc-exp" name="payment[<?php echo $_code; ?>][card_expiration_month]" data-element-id="#second_card_expiration_date__mp">
77
+ <?php foreach ($this->getCcMonths() as $m => $v): ?>
78
+ <option value="<?php echo $m ? $m : ''; ?>"><?php echo $v; ?></option>
79
+ <?php endforeach ?>
80
+ </select>
81
+ <p class="message-error second_card_error-325 second_card_error-208 validation-advice"><?php echo $this->__('Month is invalid.'); ?></p>
82
+ </div>
83
+
84
+ <div id="second_card_box_year">
85
+ <select id="second_card_cardExpirationYear" data-checkout="cardExpirationYear" name="payment[<?php echo $_code; ?>][card_expiration_year]" data-element-id="#second_card_expiration_date__mp">
86
+ <?php foreach ($this->getCcYears() as $y => $v): ?>
87
+ <option value="<?php echo $y ? $y : ''; ?>"><?php echo $v; ?></option>
88
+ <?php endforeach ?>
89
+ </select>
90
+ <p class="message-error second_card_error-326 second_card_error-209 validation-advice"><?php echo $this->__('Year is invalid.'); ?></p>
91
+ </div>
92
+ </div>
93
+ </li>
94
+
95
+ <li id="second_card_cardholderName__mp">
96
+ <label for="second_card_cardholderName"><?php echo $this->__('Card Holder Name'); ?></label>
97
+ <input type="text" id="second_card_cardholderName" data-checkout="cardholderName" name="payment[<?php echo $_code; ?>][card_holder_name]" data-element-id="#second_card_cardholderName__mp"/>
98
+ <p class="message-error error-316 validation-advice"><?php echo $this->__('Card Holder Name is invalid.'); ?></p>
99
+ </li>
100
+
101
+ <li id="second_card_securityCode__mp">
102
+ <label for="second_card_securityCode"><?php echo $this->__('CVV'); ?></label>
103
+ <input type="text" id="second_card_securityCode" data-checkout="securityCode" maxlength="4" data-element-id="#second_card_securityCode__mp" class="required-entry"/>
104
+ <p class="message-error second_card_error-E302 second_card_error-224 validation-advice"><?php echo $this->__('CVV is invalid.'); ?></p>
105
+ <span class="ch-form-hint"><?php echo $this->__('Last 3 numbers on back side.'); ?></span>
106
+ </li>
107
+
108
+ <li id="second_card_doc_type__mp">
109
+ <label for="second_card_docNumber"><?php echo $this->__('Document'); ?></label>
110
+ <select id="second_card_docType" data-checkout="docType" data-element-id="#second_card_doc_type__mp" name="payment[<?php echo $_code; ?>][doc_type]"></select>
111
+ <p class="message-error error-322 error-212 validation-advice"><?php echo $this->__('Document Type is invalid.'); ?></p>
112
+ </li>
113
+
114
+ <li id="second_card_doc_number__mp">
115
+ <input type="text" id="second_card_docNumber" class="mp-validate-docnumber" data-checkout="docNumber" name="payment[<?php echo $_code; ?>][doc_number]" data-element-id="#second_card_doc_number__mp"/>
116
+ <p class="message-error error-324 error-213 error-214 validation-advice"><?php echo $this->__('Document Number is invalid.'); ?></p>
117
+ </li>
118
+ </ul>
119
+
120
+ <li id="second_card_installments__mp">
121
+ <label for="second_card_installments"><?php echo $this->__('Installments'); ?></label>
122
+ <select id="second_card_installments" name="payment[<?php echo $_code; ?>][second_card_installments]" data-element-id="#second_card_installments__mp" class="validate-select full-width"></select>
123
+ <p class="message-error second_card_error-installment-not-work validation-advice"><?php echo $this->__('It was not possible to calculate the installments, click here and try again.'); ?></p>
124
+ <p class="message-error second_card_error-011 validation-advice"><?php echo $this->__('An error has occurred. Please refresh the page.'); ?></p>
125
+ <p class="message-error second_card_error-other validation-advice"><?php echo $this->__('Please validate your data.'); ?></p>
126
+ </li>
127
+
128
+ <div class="legal-info">
129
+ <p class="tea-info tea-info-second-card">TEA: 0,00%</p>
130
+ <p class="cft-info cft-info-second-card">CFT: 0,00%</p>
131
+ </div>
132
+
133
+ <input type="hidden" class="second_card_mercadopago-text-installment" value="<?php echo $this->__('Select Installments'); ?>">
134
+ <input type="hidden" id="second_card_one_click_pay_mp" name="payment[<?php echo $_code; ?>][one_click_pay]" value="<?php echo count($customer['cards']) > 0 ? 1 : 0; ?>">
135
+ <input type="hidden" name="payment[<?php echo $_code; ?>][second_card_token]" type="text" value="" class="second_card_token"/>
136
+ <input type="hidden" name="payment[<?php echo $_code; ?>][second_card_payment_method_id]" type="text" value="" class="second_card_payment_method_id"/>
137
+ <input type="hidden" name="payment[<?php echo $_code; ?>][is_second_card_used]" type="text" value="false" class="is_second_card_used"/>
138
+ <input type="hidden" name="payment[<?php echo $_code; ?>][first_card_amount]" type="text" value=0 class="first_card_amount"/>
139
+ <input type="hidden" name="payment[<?php echo $_code; ?>][second_card_amount]" type="text" value=0 class="second_card_amount"/>
140
+ </ul>
141
+ </div>
142
+ </li>
143
+
144
+ <div class="second_card_total_buy">
145
+ <label> <?php echo $this->__('Total amount: '); ?> </label>
146
+ <span class="second_card_total_buy_price"> $<?php echo $grant_total; ?>.-</span>
147
+ </div>
app/design/frontend/base/default/template/mercadopago/custom/success.phtml CHANGED
@@ -32,9 +32,11 @@
32
 
33
  <h5 class="mercadopago-title-info-payment"><?php echo $this->__('Payment information'); ?></h5>
34
 
35
- <?php foreach($info_payment as $info): ?>
36
- <p><?php echo $info['text']; ?></p>
37
- <?php endforeach; ?>
 
 
38
 
39
  <?php endif; ?>
40
  </div>
@@ -42,3 +44,9 @@
42
  <div id="logo-mercadopago">
43
  <img src="https://secure.mlstatic.com/components/resources/mp/desktop/css/assets/desktop-logo-mercadopago.png" />
44
  </div>
 
 
 
 
 
 
32
 
33
  <h5 class="mercadopago-title-info-payment"><?php echo $this->__('Payment information'); ?></h5>
34
 
35
+ <div id="payment-info-text">
36
+ <?php foreach($info_payment as $info): ?>
37
+ <p><?php echo $this->__($info['text']); ?></p>
38
+ <?php endforeach; ?>
39
+ </div>
40
 
41
  <?php endif; ?>
42
  </div>
44
  <div id="logo-mercadopago">
45
  <img src="https://secure.mlstatic.com/components/resources/mp/desktop/css/assets/desktop-logo-mercadopago.png" />
46
  </div>
47
+ <div class="buttons-set">
48
+ <div class="button-success">
49
+ <button type="button" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue Shopping')) ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
50
+ </div>
51
+ </div>
52
+
app/design/frontend/base/default/template/mercadopago/custom_ticket/success.phtml CHANGED
@@ -35,3 +35,9 @@
35
  <div id="logo-mercadopago">
36
  <img src="https://secure.mlstatic.com/components/resources/mp/desktop/css/assets/desktop-logo-mercadopago.png" />
37
  </div>
 
 
 
 
 
 
35
  <div id="logo-mercadopago">
36
  <img src="https://secure.mlstatic.com/components/resources/mp/desktop/css/assets/desktop-logo-mercadopago.png" />
37
  </div>
38
+
39
+ <div class="buttons-set">
40
+ <div class="button-success">
41
+ <button type="button" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue Shopping')) ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
42
+ </div>
43
+ </div>
app/design/frontend/base/default/template/mercadopago/standard/success.phtml CHANGED
@@ -34,7 +34,7 @@
34
  <h5 class="mercadopago-title-info-payment"><?php echo $this->__('Payment information'); ?></h5>
35
 
36
  <?php foreach($info_payment as $info): ?>
37
- <p><?php echo $info['text']; ?></p>
38
  <?php endforeach; ?>
39
  <?php endif ?>
40
  </div>
@@ -42,3 +42,9 @@
42
  <div id="logo-mercadopago">
43
  <img src="https://secure.mlstatic.com/components/resources/mp/desktop/css/assets/desktop-logo-mercadopago.png" />
44
  </div>
 
 
 
 
 
 
34
  <h5 class="mercadopago-title-info-payment"><?php echo $this->__('Payment information'); ?></h5>
35
 
36
  <?php foreach($info_payment as $info): ?>
37
+ <p><?php echo $this->__($info['text']); ?></p>
38
  <?php endforeach; ?>
39
  <?php endif ?>
40
  </div>
42
  <div id="logo-mercadopago">
43
  <img src="https://secure.mlstatic.com/components/resources/mp/desktop/css/assets/desktop-logo-mercadopago.png" />
44
  </div>
45
+
46
+ <div class="buttons-set">
47
+ <div class="button-success">
48
+ <button type="button" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue Shopping')) ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
49
+ </div>
50
+ </div>
app/locale/en_US/MercadoPago_Core.csv CHANGED
@@ -40,6 +40,7 @@
40
  "Banks","Banks"
41
 
42
  "Enter the card number","Enter the card number"
 
43
  "Validating Data","Validating Data"
44
  "An error has occurred. Please refresh the page.","An error has occurred. Please refresh the page."
45
  "Card number is invalid.","Card number is invalid."
@@ -197,4 +198,9 @@
197
  "Mercado Pago - Refund not made","Mercado Pago - Refund not made"
198
  "Order payment wasn't made by Mercado Pago. The refund will be made through Magento", "Order payment wasn't made by Mercado Pago. The refund will be made through Magento"
199
  "Mercado Pago refunds are disabled. The refund will be made through Magento","Mercado Pago refunds are disabled. The refund will be made through Magento"
200
- "No payment is recorded. You can't make a refund on a unpaid order","No payment is recorded. You can't make a refund on a unpaid order"
 
 
 
 
 
40
  "Banks","Banks"
41
 
42
  "Enter the card number","Enter the card number"
43
+ "Select Installments","Select Installments"
44
  "Validating Data","Validating Data"
45
  "An error has occurred. Please refresh the page.","An error has occurred. Please refresh the page."
46
  "Card number is invalid.","Card number is invalid."
198
  "Mercado Pago - Refund not made","Mercado Pago - Refund not made"
199
  "Order payment wasn't made by Mercado Pago. The refund will be made through Magento", "Order payment wasn't made by Mercado Pago. The refund will be made through Magento"
200
  "Mercado Pago refunds are disabled. The refund will be made through Magento","Mercado Pago refunds are disabled. The refund will be made through Magento"
201
+ "No payment is recorded. You can't make a refund on a unpaid order","No payment is recorded. You can't make a refund on a unpaid order"
202
+ "Mercado Pago - Recurring Profile not created","Mercado Pago - Recurring Profile not created"
203
+ "Failed to update the recurring profile by Mercado Pago","Failed to update the recurring profile by Mercado Pago"
204
+ "Recurring Profile updated by Mercado Pago","Recurring Profile updated by Mercado Pago"
205
+ "Mercado Pago - Recurring Payment Checkout: Invalid client id or client secret","Mercado Pago - Recurring Payment Checkout: Invalid client id or client secret"
206
+ "This payment method is used only for recurring profiles.","This payment method is used only for recurring profiles."
app/locale/es_AR/MercadoPago_Core.csv CHANGED
@@ -1,24 +1,135 @@
1
- "Enabled","Activo"
2
 
3
- "Mercado Pago - Configuration", "Mercado Pago - Configuración"
4
- "Credit Card - Mercado Pago","Tarjetas de crédito - Mercado Pago"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- "Mercado Pago Custom - Credit Card","Mercado Pago Custom - Tarjeta de Crédito"
7
- "Payment Title","Título"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  "Category of your store","Categoria de la tienda"
 
 
 
9
  "Choose the status of approved orders","Elija el estado de los pedidos para pagos Aprobados"
10
  "Choose the status of refunded orders","Elija el estado de los pedidos para pagos Devueltos"
11
  "Choose the status when payment is pending","Elija el estado de los pedidos para pagos Pendientes"
12
  "Choose the status when client open a mediation","Elija el estado de los pedidos para pagos en Disputa"
13
  "Choose the status when payment was reject","Elija el estado de los pedidos para pagos Rechazados"
14
  "Choose the status when payment was canceled","Elija el estado de los pedidos para pagos Cancelados"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  "Checkout Position","Posición en el Checkout"
16
  "To manage the status available go to System > Order Statuses","Para gerenciar los estados disponibles vaya a 'System > Order Statuses'"
17
 
18
  "Mercado Pago Custom - Ticket","Mercado Pago Custom - Tickets de pago"
19
 
20
  "Mercado Pago Standard - Credit Card, Ticket and Account Money","Mercado Pago Standard - Tarjetas, Tickets y Dinero en Cuenta"
21
- "Country","País"
22
  "Type Checkout","Tipo de Checkout"
23
  "Auto Redirect","Auto-Redireccionar"
24
  "Exclude Payment Methods","Excluir Medios de Pago"
@@ -27,19 +138,20 @@
27
  "Height Checkout Iframe","Alto de la zona del Checkout (Iframe)"
28
  "Auto-redirect the buyer when finishing the payment.","Auto-Redireccionar al comprador al finalizar el pago."
29
  "Select payment methods not accepted","Seleccione los medios de pago no aceptados"
30
- "For the operation of the Checkout Custom Ticket is necessary to configure the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in 'Mercado Pago - Configuration'","Para el funcionamento del Checkout Custom - Tickets de pago, es necesario configurar las Credenciales 'CLIENT_ID' y 'CLIENT_SECRET' en 'Mercado Pago - Configuración'"
31
- "For the operation of the Checkout Standard is necessary to configure the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in 'Mercado Pago - Configuration'","Para el funcionamento del Checkout Standard, es necesario configurar las Credenciales 'CLIENT_ID' y 'CLIENT_SECRET' en 'Mercado Pago - Configuración'"
32
 
33
  "Card Number","Número de Tarjeta"
34
  "Month","Mes"
35
  "Year","Año"
36
  "Card Holder Name","Titular de la Tarjeta"
 
37
  "Document Number","Número de Documento"
38
  "CVV","Código de Seguridad"
39
  "Installments","Cuotas"
40
  "Banks","Bancos"
41
 
42
  "Enter the card number","Digite el número de tarjeta"
 
43
  "Validating Data","Validando datos"
44
  "An error has occurred. Please refresh the page.","Ocurrio un error. Por favor, actualice la página."
45
  "Card number is invalid.","Número de Tarjeta inválido."
@@ -60,19 +172,40 @@
60
  "Statement Descriptor: %s","Identificación en la Factura de la Tarjeta de Crédito: %s"
61
  "Payment Id (Mercado Pago): %s","Número de Pago (Mercado Pago): %s"
62
  "Payment Status: %s (%s)","Estado del Pago: %s (%s)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  "Click on the link to generate the ticket","Clique en el link para mostrar el ticket de pago"
65
  "Generate Ticket","Generar ticket de pago"
66
 
67
  "Payment Method","Medio de pago"
68
 
69
- "Generate the ticket and pay it wherever you want.","Genere el ticket de pago y pague"
70
- "Will be approved within 2 business days.","Será aprobado en hasta 2 días hábiles"
71
 
72
 
73
 
74
  "Thank you for your purchase!","Gracias por su compra!"
75
- "Your order %s has been successfully generated.","Su pedido con el numero %s fué generado con éxito."
76
  "Done, your payment was accredited!","¡Listo, se acreditó tu pago!"
77
  "We are processing the payment.","Estamos procesando el pago."
78
  "In less than 2 business days we will tell you by e-mail if it is accredited or if we need more information.","Estamos procesando el pago. En menos de 2 días hábiles te avisaremos por e-mail si se acreditó o si necesitamos más información."
@@ -84,7 +217,7 @@
84
  "Check the security code.","Revisa el código de seguridad."
85
  "We could not process your payment.","No pudimos procesar tu pago."
86
 
87
- "You must authorize to %s the payment of $ %s to Mercado Pago.","Debes llamar y autorizar ante %s el pago de $ %s a Mercado Pago"
88
  "Call %s to activate your card.<br/>The phone is on the back of your card.","Llama a %s para que active tu tarjeta.<br/>El teléfono está al dorso de tu tarjeta."
89
  "We could not process your payment.","No pudimos procesar tu pago."
90
  "You already made a payment by that value.<br/>If you need to repay, use another card or other payment method.","Ya hiciste un pago por ese valor.<br/>Si necesitas volver a pagar usa otra tarjeta u otro medio de pago."
@@ -162,7 +295,7 @@
162
  "Use other card","Utilizar otra tarjeta"
163
  "Return to cards list","Volver a lista de tarjetas"
164
  "Mercado Pago - Classic Checkout: Invalid client id or client secret","Mercado Pago - Classic Checkout: El id de cliente o la clave secreta, son inválidas"
165
- "Mercado Pago - Custom Checkout: Invalid access token", "Mercado Pago - Custom Checkout: El token de acceso es inválido"
166
  "(estimated date %s)","(fecha estimada %s)"
167
 
168
  "Cannot repeat Magento Product size attributes","No puede repetir los atributos de tamaño de producto de magento"
@@ -171,14 +304,6 @@
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"
@@ -203,4 +328,57 @@
203
  "Mercado Pago - Refund not made","Mercado Pago - Devolución no efectuada"
204
  "Order payment wasn't made by Mercado Pago. The refund will be made through Magento","El pago de la orden no fue realizado mediante Mercado Pago. La devolución se hará a traves de Magento"
205
  "Mercado Pago refunds are disabled. The refund will be made through Magento","Las devoluciones de Mercado Pago están deshabilitadas. La devolución se hará a traves de Magento"
206
- "No payment is recorded. You can't make a refund on a unpaid order","No se registra ningún pago. No se pueden hacer devoluciones en ordenes sin pagar"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "//<---- MercadoEnvios---->","//<---- MercadoEnvios---->"
2
 
3
+ "MercadoEnvios - Configuration","MercadoEnvios - Configuración"
4
+ "Enable to edit specific values","Habilitar para editar valores específicos"
5
+ "Title","Titulo"
6
+ "Product attributes mapping","Mapeo de los atributos de los productos"
7
+ "Available shipping methods","Métodos de Envío Disponibles"
8
+ "Allow Specific Country","Permitir un país específico"
9
+ "Specific Country","País específico"
10
+ "Free Method","Método gratis"
11
+ "Free Shipping with Minimum Order Amount","Envío gratuito con un importe minimo en la orden"
12
+ "Minimum Order Amount for Free Shipping","Importe mínimo de la orden para realizar el envío gratuito"
13
+ "Show method if not applicable","Mostrar el método si no es aplicable"
14
+ "Displayed Error Message","Mensaje de error a mostrar"
15
+ "Log","Log"
16
+ "Debug Mode","Modo de depuración"
17
+ "Sort order","Posición"
18
+ "Shipping label download option","Opción para la descarga de las etiquetas de envío"
19
+ "Enabled","Habilitado"
20
 
21
+ "Product Attribute","Atributo de los Productos"
22
+ "Attribute Unit","Unidad del Atributo"
23
+ "Length","Largo"
24
+ "Width","Ancho"
25
+ "Height","Alto"
26
+ "Weight","Ancho"
27
+
28
+
29
+ "//XXXXXXX MercadoPago XXXXXXX","//XXXXXXX MercadoPago XXXXXXX"
30
+
31
+
32
+ "Mercado Pago - Global Configuration","Mercado Pago - Configuración Global"
33
+ "Onestepcheckout Active","Checkout de un solo paso Activado"
34
+
35
+
36
+ "Country","País"
37
  "Category of your store","Categoria de la tienda"
38
+
39
+ "Calculate Financing Cost", "Calcular el costo de financiamiento"
40
+ "Order Status Options","Opciones de estado de los pedidos"
41
  "Choose the status of approved orders","Elija el estado de los pedidos para pagos Aprobados"
42
  "Choose the status of refunded orders","Elija el estado de los pedidos para pagos Devueltos"
43
  "Choose the status when payment is pending","Elija el estado de los pedidos para pagos Pendientes"
44
  "Choose the status when client open a mediation","Elija el estado de los pedidos para pagos en Disputa"
45
  "Choose the status when payment was reject","Elija el estado de los pedidos para pagos Rechazados"
46
  "Choose the status when payment was canceled","Elija el estado de los pedidos para pagos Cancelados"
47
+
48
+ "Refund Options","Opciones de reembolso"
49
+ "Refund Available","Reembolso disponible"
50
+ "Maximum amount of partial refunds on the same order","Cantidad máxima de reembolsos parciales en la misma orden"
51
+ "Maximum amount of days until refund is not accepted","Cantidad máxima de días hasta que no se acepte el reembolso"
52
+ "Choose the status when payment was partially refunded","Elija el estado de los pedidos cuando el pago se reembolsó parcialmente"
53
+
54
+ "Developer Options","Opciones de desarrollador"
55
+ "Logs","Logs"
56
+ "Debug Mode","Modo de depuración"
57
+ "Enable to display actual error messages to frontend users (not recommended on production environment)","Habilitar para mostrar los mensajes de error de los usuarios frontend (no se recomienda en el ambiente de producción)"
58
+
59
+
60
+ "Mercado Pago - Custom Checkout","Mercado Pago - Checkout personalizado"
61
+ "Public Key","Clave pública"
62
+ "Access Token","Token de acceso"
63
+ "<span>Click to get your Access Token for: </span>
64
+ <a href="https://www.mercadopago.com/mla/account/credentials" target="_blank">Argentina</a>
65
+ <a href="https://www.mercadopago.com/mlb/account/credentials" target="_blank">Brazil</a><br>
66
+ <a href="https://www.mercadopago.com/mco/account/credentials" target="_blank">Colombia</a>
67
+ <a href="https://www.mercadopago.com/mlm/account/credentials" target="_blank">Mexico</a>
68
+ <a href="https://www.mercadopago.com/mlv/account/credentials" target="_blank">Venezuela</a>
69
+ <a href="https://www.mercadopago.com/mlc/account/credentials" target="_blank">Chile</a>
70
+ <a href="https://www.mercadopago.com/mpe/account/credentials" target="_blank">Peru</a>","
71
+ <span>Haga clic para obtener su token de acceso para: </span>
72
+ <a href="https://www.mercadopago.com/mla/account/credentials" target="_blank">Argentina</a>
73
+ <a href="https://www.mercadopago.com/mlb/account/credentials" target="_blank">Brazil</a><br>
74
+ <a href="https://www.mercadopago.com/mco/account/credentials" target="_blank">Colombia</a>
75
+ <a href="https://www.mercadopago.com/mlm/account/credentials" target="_blank">Mexico</a>
76
+ <a href="https://www.mercadopago.com/mlv/account/credentials" target="_blank">Venezuela</a>
77
+ <a href="https://www.mercadopago.com/mlc/account/credentials" target="_blank">Chile</a>
78
+ <a href="https://www.mercadopago.com/mpe/account/credentials" target="_blank">Peru</a>"
79
+
80
+
81
+ "Checkout Custom - Credit Card","Tarjeta de crédito - Checkout personalizado"
82
+ "It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page.
83
+ During the sandbox mode tests, you can operate over HTTP,
84
+ but for homologation you'll need to acquire the certificate in case you don't have it.
85
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Learn More</a>","
86
+ Es un requisito que usted cuente con un certificado SSL, y que el formulario de pago sea proporcionado bajo una página HTTPS.
87
+ Durante las pruebas en modo de prueba 'Sandbox', se puede operar a través de HTTP,
88
+ Pero para la homologación necesitará adquirir el certificado en caso de que no lo posea.
89
+ <a href="https://www.mercadopago.com.ar/developers/solutions/payments/custom-checkout/appliance-requirements/" target="_blank">Ver más</a>"
90
+ "Allow Payment with 2 Cards","Habilitar pago con 2 tarjetas"
91
+ "Statement Descriptor","Identificación de la Tarjeta de Crédito en la Factura"
92
+ "Check availability for your country","Verificar la disponibilidad en su país"
93
+
94
+ "Binary Mode","Modo binario"
95
+ "Banner Checkout","Banner Checkout"
96
+ "Marketing - Coupon Mercado Pago","Cupon Mercado Pago - Marketing"
97
+ "Custom Message","Mensaje personalizado"
98
+ "Custom message to display in checkout","Mensaje a mostrar en el checkout"
99
+
100
+
101
+ "Checkout Custom - Ticket","Ticket - Checkout personalizado"
102
+
103
+
104
+ "Mercado Pago - Classic Checkout","Mercado Pago - Checkout clásico"
105
+ "Checkout Classic","Checkout clásico"
106
+ "Sandbox Mode","Modo Sandbox (ambiente de prueba)"
107
+ "Enable to test checkout with real credit cards. For further information check this link: <a href="https://www.mercadopago.com.ar/developers/en/solutions/payments/basic-checkout/test/basic-sandbox/" target="_blank">Basic Checkout Sandbox</a>","Habilitar para probar el checkout con tarjetas de crédito reales. Ver más: <a href="https://www.mercadopago.com.ar/developers/es/solutions/payments/basic-checkout/test/basic-sandbox/" target="_blank">Sandbox de Checkout básico</a>"
108
+
109
+
110
+ "Mercado Pago - Recurring Payments Checkout","Mercado Pago - Checkout de pagos recurrentes"
111
+
112
+ "It is necessary to configure the Public Key and Access Token for its proper functioning","Es necesario configurar la Clave pública y el Token de Acceso para su correcto funcionamiento"
113
+ "It is necessary to configure necessary the Credentials 'CLIENT_ID' and 'CLIENT_SECRET' in this section for its proper functioning","Es necesario configurar las credenciales 'CLIENT_ID' y 'CLIENT_SECRET' dentro de esta sección para su correcto funcionamiento"
114
+
115
+
116
+ "Back Url","URL de redirección"
117
+ "URL to redirect the user when the pre-approval is authorized","URL para redirigir al usuario cuando la aprobación previa se autoriza"
118
+ "Enable to test checkout with real credit cards","Habilitar para probar el checkout con tarjetas de crédito reales"
119
+
120
+
121
+ "Credit Card - Mercado Pago","Tarjetas de crédito - Mercado Pago"
122
+
123
+ "Mercado Pago Custom - Credit Card","Mercado Pago Custom - Tarjeta de Crédito"
124
+ "Payment Title","Título"
125
+
126
  "Checkout Position","Posición en el Checkout"
127
  "To manage the status available go to System > Order Statuses","Para gerenciar los estados disponibles vaya a 'System > Order Statuses'"
128
 
129
  "Mercado Pago Custom - Ticket","Mercado Pago Custom - Tickets de pago"
130
 
131
  "Mercado Pago Standard - Credit Card, Ticket and Account Money","Mercado Pago Standard - Tarjetas, Tickets y Dinero en Cuenta"
132
+
133
  "Type Checkout","Tipo de Checkout"
134
  "Auto Redirect","Auto-Redireccionar"
135
  "Exclude Payment Methods","Excluir Medios de Pago"
138
  "Height Checkout Iframe","Alto de la zona del Checkout (Iframe)"
139
  "Auto-redirect the buyer when finishing the payment.","Auto-Redireccionar al comprador al finalizar el pago."
140
  "Select payment methods not accepted","Seleccione los medios de pago no aceptados"
141
+
 
142
 
143
  "Card Number","Número de Tarjeta"
144
  "Month","Mes"
145
  "Year","Año"
146
  "Card Holder Name","Titular de la Tarjeta"
147
+ "Document Type", "Tipo de documento"
148
  "Document Number","Número de Documento"
149
  "CVV","Código de Seguridad"
150
  "Installments","Cuotas"
151
  "Banks","Bancos"
152
 
153
  "Enter the card number","Digite el número de tarjeta"
154
+ "Select Installments","Elija las cuotas"
155
  "Validating Data","Validando datos"
156
  "An error has occurred. Please refresh the page.","Ocurrio un error. Por favor, actualice la página."
157
  "Card number is invalid.","Número de Tarjeta inválido."
172
  "Statement Descriptor: %s","Identificación en la Factura de la Tarjeta de Crédito: %s"
173
  "Payment Id (Mercado Pago): %s","Número de Pago (Mercado Pago): %s"
174
  "Payment Status: %s (%s)","Estado del Pago: %s (%s)"
175
+ "Payment Status: ","Estado del Pago: "
176
+ "Payment Detail: ","Detalle del Pago: "
177
+ "Mercado Pago Payment Id: %s","Id transacción Mercado Pago: %s"
178
+
179
+
180
+ "Mercado Pago Payment Id: %s","Id transacción Mercado Pago: %s"
181
+ "Payment Status: approved","Estado del Pago: Aprobado"
182
+ "Payment Detail: accredited","Detalle del Pago: acreditado"
183
+ "Payment Detail: pending_contingency","Detalle del Pago: pendiente"
184
+ "Payment Detail: cc_rejected_call_for_authorize","Detalle del Pago: Tarjeta de crédito rechazada. Llamar para autorizar."
185
+ "Payment Detail: cc_rejected_insufficient_amount","Detalle del Pago: Tarjeta de crédito rechazada por monto insuficiente."
186
+ "Payment Detail: cc_rejected_bad_filled_security_code","Detalle del Pago: Tarjeta de crédito rechazada por código de seguridad."
187
+ "Payment Detail: cc_rejected_bad_filled_other","Detalle del Pago: Tarjeta de crédito rechazada por error en formulario."
188
+ "Payment Detail: cc_rejected_other_reason","Detalle del Pago: Rechazo general"
189
+ "Payment Detail: cc_rejected_bad_filled_date","Detalle del Pago: Tarjeta de crédito rechazada por fecha de expiración."
190
+
191
+
192
+ "Payment Status: in_process", "Estado del Pago: en proceso"
193
+ "Payment Status: rejected", "Estado del Pago: rechazado"
194
+
195
+
196
 
197
  "Click on the link to generate the ticket","Clique en el link para mostrar el ticket de pago"
198
  "Generate Ticket","Generar ticket de pago"
199
 
200
  "Payment Method","Medio de pago"
201
 
202
+ "Generate the ticket and pay it wherever you want.","Genere el ticket de pago y pague."
203
+ "Will be approved within 2 business days.","Se aprobará dentro de 2 días hábiles."
204
 
205
 
206
 
207
  "Thank you for your purchase!","Gracias por su compra!"
208
+ "Your order %s has been successfully generated.","Su pedido con el número %s fue generado con éxito."
209
  "Done, your payment was accredited!","¡Listo, se acreditó tu pago!"
210
  "We are processing the payment.","Estamos procesando el pago."
211
  "In less than 2 business days we will tell you by e-mail if it is accredited or if we need more information.","Estamos procesando el pago. En menos de 2 días hábiles te avisaremos por e-mail si se acreditó o si necesitamos más información."
217
  "Check the security code.","Revisa el código de seguridad."
218
  "We could not process your payment.","No pudimos procesar tu pago."
219
 
220
+ "You must authorize to %s the payment of $ %s to Mercado Pago.","Debes llamar y autorizar ante %s el pago de $ %s a Mercado Pago."
221
  "Call %s to activate your card.<br/>The phone is on the back of your card.","Llama a %s para que active tu tarjeta.<br/>El teléfono está al dorso de tu tarjeta."
222
  "We could not process your payment.","No pudimos procesar tu pago."
223
  "You already made a payment by that value.<br/>If you need to repay, use another card or other payment method.","Ya hiciste un pago por ese valor.<br/>Si necesitas volver a pagar usa otra tarjeta u otro medio de pago."
295
  "Use other card","Utilizar otra tarjeta"
296
  "Return to cards list","Volver a lista de tarjetas"
297
  "Mercado Pago - Classic Checkout: Invalid client id or client secret","Mercado Pago - Classic Checkout: El id de cliente o la clave secreta, son inválidas"
298
+ "Mercado Pago - Custom Checkout: Invalid access token", "Checkout personalizado - Mercado Pago: El token de acceso es inválido"
299
  "(estimated date %s)","(fecha estimada %s)"
300
 
301
  "Cannot repeat Magento Product size attributes","No puede repetir los atributos de tamaño de producto de magento"
304
  "MercadoEnvios is not enabled in the country where Mercado Pago is configured", "MercadoEnvios no está disponible en el país configurado para Mercado Pago"
305
  "Discount Mercado Pago","Descuento de Mercado Pago"
306
 
 
 
 
 
 
 
 
 
307
  "Use Mercado Pago success page","Usar succes page de Mercado Pago"
308
  "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"
309
  "MercadoEnvíos - Please enable a shipping method at least","MercadoEnvíos - Por favor habilita un método de envío al menos"
328
  "Mercado Pago - Refund not made","Mercado Pago - Devolución no efectuada"
329
  "Order payment wasn't made by Mercado Pago. The refund will be made through Magento","El pago de la orden no fue realizado mediante Mercado Pago. La devolución se hará a traves de Magento"
330
  "Mercado Pago refunds are disabled. The refund will be made through Magento","Las devoluciones de Mercado Pago están deshabilitadas. La devolución se hará a traves de Magento"
331
+ "No payment is recorded. You can't make a refund on a unpaid order","No se registra ningún pago. No se pueden hacer devoluciones en ordenes sin pagar"
332
+ "Mercado Pago - Recurring Profile not created","Mercado Pago - Perfíl Recurrente no creado"
333
+ "Failed to update the recurring profile by Mercado Pago","Error al actualizar el Perfil Recurrente mediante Mercado Pago"
334
+ "Recurring Profile updated by Mercado Pago","Perfil Recurrente actualizado mediante Mercado Pago"
335
+ "Mercado Pago - Recurring Payment Checkout: Invalid client id or client secret","Mercado Pago - Recurring Payment Checkout: El id de cliente o la clave secreta, son inválidas"
336
+ "This payment method is used only for recurring profiles.","Este método de pago es usado solo para perfiles recurrentes"
337
+ "Payment information", "Información de pago"
338
+
339
+
340
+ "Payments Calculator","Calculador de Cuotas"
341
+ "Enable Mercado Pago Installments Calculator","Habilitar Calculadora de Cuotas de Mercado Pago"
342
+ "if set to YES, Calculator will appear on the selected pages","Si está configuración se setea en YES, la calculadora aparecerá en las páginas seleccionadas"
343
+ "Show Calculator on selected pages", "Mostrar calculadora en las siguientes páginas seleccionadas"
344
+
345
+ "Calculate your payments ", "Calculá tus Cuotas"
346
+ "with ", "con "
347
+ "my string.", "Elige una opción"
348
+ "Pay with MercadoPago", "Pagar con MercadoPago"
349
+ "Choose an option", "Eligir una opcion"
350
+ "Other banks","Otros bancos"
351
+ "Until ", "Hasta "
352
+ " payments without interest"," cuotas sin interés"
353
+ "Interest-free", "Sin Interés"
354
+ "Pay", "Pagas"
355
+ "Banck", "Banco"
356
+ "Pay with MercadoPago","Pagar con Mercado Pago"
357
+ "Payment cards", "Tarjeta de crédito"
358
+
359
+ "Credit Card - Mercado Pago ", "Tarjeta de Credito - Mercado Pago "
360
+ "ended in","terminada en"
361
+ "1st Card","1er Tarjeta"
362
+ "2nd Card","2da Tarjeta"
363
+ "Amount","Importe"
364
+ "Remaining Amount","Importe restante"
365
+ "Last 3 numbers on back side.","Los últimos 3 números que están al dorso."
366
+ "Choice... ","Seleccione..."
367
+ "Choice","Seleccione"
368
+ " Total amount: ","Importe Total"
369
+ "Expiration Date","Fecha de vencimiento"
370
+ "Document","Documento"
371
+ "Installments","Cuotas"
372
+ "It was not possible to calculate the installments, click here and try again.","No fue posible calcular las cuotas, haga clic aquí e inténtelo de nuevo."
373
+
374
+ "Payment Method: ","Medios de Pago: "
375
+ "Select issuer","Seleccionar emisor"
376
+ "Default issuer","Emisor predeterminado"
377
+ "Continue Shopping","Seguir comprando"
378
+ "Use 2 Cards","Utilizar 2 Tarjetas"
379
+ "Close","Cerrar"
380
+ "Configure","Configurar"
381
+
382
+ "Time between verifications","Tiempo entre verificaciones"
383
+ "Amount of hours","Cantidad de horas"
384
+ "Try to update all the orders created "amount of hours" before time to the moment to execute the cron","Verifica e intenta actualizar todas las ordenes creadas 'cantidad de horas' antes de la hora en la que se ejecuta el cron"
js/mercadopago/mercadopago.js CHANGED
@@ -1,6 +1,7 @@
1
  var MercadoPagoCustom = (function () {
2
 
3
  var instance = null;
 
4
  var http = {
5
  status: {
6
  OK: 200,
@@ -82,7 +83,7 @@ var MercadoPagoCustom = (function () {
82
  checkoutCustom: '#mercadopago_checkout_custom',
83
  checkoutTicket: '#mercadopago_checkout_custom_ticket',
84
  siteId: '#mercadopago_checkout_custom .site_id',
85
- cardNumberInput: 'input[data-checkout="cardNumber"]',
86
  installmentsDontWork: '.error-installment-not-work',
87
  mercadopagoCustomOpt: '#p_method_mercadopago_custom',
88
  cardExpYear: '#cardExpirationYear',
@@ -107,7 +108,7 @@ var MercadoPagoCustom = (function () {
107
  oneClickPayment: '#mercadopago_checkout_custom #one_click_pay_mp',
108
  installmentText: '#mercadopago_checkout_custom .mercadopago-text-installment',
109
  paymentMethod: '#paymentMethod',
110
- paymentMethodSelect: 'select[data-checkout="paymentMethod"]',
111
  paymentMethodId: '#mercadopago_checkout_custom .payment_method_id',
112
  paymenMethodNotFound: '.error-payment-method-not-found',
113
  mercadoPagoTextChoice: '#mercadopago_checkout_custom .mercadopago-text-choice',
@@ -122,7 +123,8 @@ var MercadoPagoCustom = (function () {
122
  customDiscountAmount: '#mercadopago_checkout_custom .mercadopago-discount-amount',
123
  discountAmount: '.mercadopago-discount-amount',
124
  token: '#mercadopago_checkout_custom .token',
125
- errorFormat: '.error-{0}',
 
126
  couponActionApply: '.mercadopago-coupon-action-apply',
127
  couponActionRemove: '.mercadopago-coupon-action-remove',
128
  ticketActionApply: '#mercadopago_checkout_custom_ticket .mercadopago-coupon-action-apply',
@@ -137,7 +139,45 @@ var MercadoPagoCustom = (function () {
137
  discountOkTotalAmount: '.mercadopago-message-coupon .discount-ok .total-amount',
138
  discountOkTotalAmountDiscount: '.mercadopago-message-coupon .discount-ok .total-amount-discount',
139
  discountOkTerms: '.mercadopago-message-coupon .discount-ok .mercadopago-coupon-terms',
140
- inputCouponDiscount: '#input-coupon-discount'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  },
143
  url: {
@@ -219,20 +259,26 @@ var MercadoPagoCustom = (function () {
219
  //Show site
220
  showLogMercadoPago(String.format(self.messages.siteId, siteId));
221
 
 
 
222
  if (siteId != self.constants.mexico) {
 
223
  Mercadopago.getIdentificationTypes();
224
  } else {
225
  setTimeout(function () {
226
- setPaymentMethods()
 
227
  }, 3000);
228
  }
229
 
230
  defineInputs();
231
 
232
  TinyJ(self.selectors.cardNumberInput).keyup(guessingPaymentMethod);
 
233
  TinyJ(self.selectors.cardNumberInput).keyup(clearOptions);
234
  TinyJ(self.selectors.cardNumberInput).change(guessingPaymentMethod);
235
  TinyJ(self.selectors.installmentsDontWork).click(guessingPaymentMethod);
 
236
  TinyJ(self.selectors.installments).change(setTotalAmount);
237
 
238
  releaseEventCreateCardToken();
@@ -257,12 +303,30 @@ var MercadoPagoCustom = (function () {
257
  var currentTime = new Date();
258
  var currentMonth = currentTime.getMonth() + 1;
259
  var currentYear = currentTime.getFullYear();
260
- if (ccExpMonth < currentMonth && ccExpYear == currentYear) {
261
- return false;
262
- }
263
- return true;
264
  });
265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  }
267
 
268
  function setPaymentMethodId(event) {
@@ -277,6 +341,18 @@ var MercadoPagoCustom = (function () {
277
  }
278
  }
279
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  function getPaymentMethods() {
281
  var allMethods = Mercadopago.getPaymentMethods();
282
  var allowedMethods = [];
@@ -298,6 +374,11 @@ var MercadoPagoCustom = (function () {
298
  TinyJ(self.selectors.paymentMethodSelect).change(setPaymentMethodId);
299
  }
300
 
 
 
 
 
 
301
  function checkDocNumber(v) {
302
  var flagReturn = true;
303
  Mercadopago.getIdentificationTypes(function (status, identificationsTypes) {
@@ -319,18 +400,42 @@ var MercadoPagoCustom = (function () {
319
  function initMercadoPagoOCP() {
320
  showLogMercadoPago(self.messages.initOCP);
321
  TinyJ(self.selectors.cardId).change(cardsHandler);
322
-
323
  var returnListCard = TinyJ(self.selectors.returnToCardList);
 
 
 
 
 
324
  TinyJ(self.selectors.useOtherCard).click(actionUseOneClickPayOrNo);
 
325
  returnListCard.click(actionUseOneClickPayOrNo);
326
-
327
  TinyJ(self.selectors.installments).change(setTotalAmount);
328
 
 
 
 
329
  returnListCard.hide();
330
  }
331
 
 
 
 
 
 
 
 
332
  function setTotalAmount() {
333
- TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.totalAmount).val(TinyJ(this).getSelectedOption().attribute(self.constants.cost));
 
 
 
 
 
 
 
 
 
334
  }
335
 
336
  function defineInputs() {
@@ -377,6 +482,9 @@ var MercadoPagoCustom = (function () {
377
  }
378
 
379
  for (var x = 0; x < dataCheckout.length; x++) {
 
 
 
380
  var $id = "#" + dataCheckout[x].id();
381
 
382
  var elPai = dataCheckout[x].attribute(self.constants.dataElementId);
@@ -401,6 +509,78 @@ var MercadoPagoCustom = (function () {
401
 
402
  }
403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  function setPaymentMethodsInfo(methods) {
405
  hideLoading();
406
 
@@ -418,6 +598,23 @@ var MercadoPagoCustom = (function () {
418
  }
419
  }
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
 
422
  function setRequiredFields(required) {
423
  if (required) {
@@ -441,6 +638,29 @@ var MercadoPagoCustom = (function () {
441
  }
442
  }
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  function actionUseOneClickPayOrNo() {
445
  showLogMercadoPago(self.messages.ocpUser);
446
 
@@ -459,8 +679,8 @@ var MercadoPagoCustom = (function () {
459
  setRequiredFields(false);
460
  TinyJ(self.selectors.returnToCardList).hide();
461
  }
462
-
463
  defineInputs();
 
464
  clearOptions();
465
  Mercadopago.clearSession();
466
 
@@ -469,11 +689,113 @@ var MercadoPagoCustom = (function () {
469
  checkCreateCardToken();
470
 
471
  //update payment_id
 
 
 
472
  guessingPaymentMethod(event.type = self.constants.keyup);
473
 
474
 
475
  }
476
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  function clearOptions() {
478
  showLogMercadoPago(self.messages.clearOpts);
479
 
@@ -499,6 +821,31 @@ var MercadoPagoCustom = (function () {
499
  }
500
  }
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  function cardsHandler() {
503
  showLogMercadoPago(self.messages.cardHandler);
504
  clearOptions();
@@ -518,6 +865,32 @@ var MercadoPagoCustom = (function () {
518
  Mercadopago.getPaymentMethod({"bin": _bin}, setPaymentMethodInfo);
519
  TinyJ(self.selectors.issuer).val('');
520
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  }
522
  }
523
 
@@ -541,6 +914,25 @@ var MercadoPagoCustom = (function () {
541
  }
542
  }
543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
 
545
  function guessingPaymentMethod(event) {
546
  showLogMercadoPago(self.messages.guessingPayment);
@@ -570,10 +962,43 @@ var MercadoPagoCustom = (function () {
570
  "amount": amount
571
  }, setPaymentMethodInfo);
572
  }
573
- }, 100);
574
  }
575
  };
576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  function setPaymentMethodInfo(status, response) {
578
  showLogMercadoPago(self.messages.setPaymentInfo);
579
  showLogMercadoPago(status);
@@ -606,7 +1031,11 @@ var MercadoPagoCustom = (function () {
606
 
607
  var bin = getBin();
608
  try {
609
- var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
 
 
 
 
610
  } catch (e) {
611
  var amount = TinyJ(self.selectors.checkoutTicket).getElem(self.selectors.amount).val();
612
  }
@@ -651,6 +1080,83 @@ var MercadoPagoCustom = (function () {
651
  defineInputs();
652
  };
653
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  function showCardIssuers(status, issuers) {
655
  showLogMercadoPago(self.messages.setIssuer);
656
  showLogMercadoPago(status);
@@ -687,11 +1193,53 @@ var MercadoPagoCustom = (function () {
687
  defineInputs();
688
  };
689
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690
  function setInstallmentsByIssuerId(status, response) {
691
  showLogMercadoPago(self.messages.setInstallment);
692
 
693
  var issuerId = TinyJ(self.selectors.issuer).val();
694
- var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
 
 
 
 
 
 
695
 
696
  if (issuerId === '-1') {
697
  return;
@@ -768,6 +1316,65 @@ var MercadoPagoCustom = (function () {
768
 
769
  }
770
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
  function setInstallmentInfo(status, response) {
772
  showLogMercadoPago(self.messages.setInstallmentInfo);
773
  showLogMercadoPago(status);
@@ -778,6 +1385,50 @@ var MercadoPagoCustom = (function () {
778
 
779
  selectorInstallments.empty();
780
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  if (response.length > 0) {
782
  var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
783
 
@@ -785,10 +1436,20 @@ var MercadoPagoCustom = (function () {
785
  payerCosts = response[0].payer_costs;
786
 
787
  selectorInstallments.appendChild(option);
 
 
 
 
 
788
  for (var i = 0; i < payerCosts.length; i++) {
789
  option = new Option(payerCosts[i].recommended_message || payerCosts[i].installments, payerCosts[i].installments);
790
  selectorInstallments.appendChild(option);
791
  TinyJ(option).attribute(self.constants.cost, payerCosts[i].total_amount);
 
 
 
 
 
792
  }
793
  selectorInstallments.enable();
794
  } else {
@@ -801,17 +1462,33 @@ var MercadoPagoCustom = (function () {
801
  showLogMercadoPago(self.messages.releaseCardTokenEvent);
802
 
803
  var dataCheckout = TinyJ(self.selectors.dataCheckout);
 
804
 
805
  if (Array.isArray(dataCheckout)) {
806
  for (var x = 0; x < dataCheckout.length; x++) {
807
- dataCheckout[x].focusout(checkCreateCardToken);
808
- dataCheckout[x].change(checkCreateCardToken);
 
 
 
 
 
809
  }
810
  } else {
811
  dataCheckout.focusout(checkCreateCardToken);
812
  dataCheckout.change(checkCreateCardToken);
813
  }
814
 
 
 
 
 
 
 
 
 
 
 
815
  }
816
 
817
  function checkCreateCardToken() {
@@ -840,10 +1517,42 @@ var MercadoPagoCustom = (function () {
840
  var oneClickPay = TinyJ(self.selectors.oneClickPayment).val();
841
  var selector = TinyJ(self.selectors.oneClickPayment).val() == true ? self.selectors.ocp : self.selectors.customCard;
842
  showLoading();
 
843
  Mercadopago.createToken(TinyJ(selector).getElem(), sdkResponseHandler);
844
  }
845
  }
846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  function sdkResponseHandler(status, response) {
848
  showLogMercadoPago(self.messages.responseCardToken);
849
  showLogMercadoPago(status);
@@ -855,6 +1564,7 @@ var MercadoPagoCustom = (function () {
855
 
856
  if (status == http.status.OK || status == http.status.CREATED) {
857
  var form = TinyJ(self.selectors.token).val(response.id);
 
858
  showLogMercadoPago(response);
859
 
860
  } else {
@@ -867,6 +1577,29 @@ var MercadoPagoCustom = (function () {
867
  }
868
  };
869
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
870
 
871
  function hideMessageError() {
872
  showLogMercadoPago(self.messages.hideErrors);
@@ -880,17 +1613,17 @@ var MercadoPagoCustom = (function () {
880
  }
881
  }
882
 
883
- function showMessageErrorForm(elError) {
884
  showLogMercadoPago(self.messages.showingError);
885
- showLogMercadoPago(elError);
886
 
887
- var elMessage = TinyJ(elError);
888
- if (Array.isArray(elMessage)) {
889
- for (var x = 0; x < elMessage.length; x++) {
890
- elMessage[x].show();
891
  }
892
  } else {
893
- elMessage.show();
894
  }
895
 
896
  }
1
  var MercadoPagoCustom = (function () {
2
 
3
  var instance = null;
4
+ var isSecondCardUsed = false;
5
  var http = {
6
  status: {
7
  OK: 200,
83
  checkoutCustom: '#mercadopago_checkout_custom',
84
  checkoutTicket: '#mercadopago_checkout_custom_ticket',
85
  siteId: '#mercadopago_checkout_custom .site_id',
86
+ cardNumberInput: '#cardNumber__mp input[data-checkout="cardNumber"]',
87
  installmentsDontWork: '.error-installment-not-work',
88
  mercadopagoCustomOpt: '#p_method_mercadopago_custom',
89
  cardExpYear: '#cardExpirationYear',
108
  oneClickPayment: '#mercadopago_checkout_custom #one_click_pay_mp',
109
  installmentText: '#mercadopago_checkout_custom .mercadopago-text-installment',
110
  paymentMethod: '#paymentMethod',
111
+ paymentMethodSelect: '#mercadopago_checkout_custom #paymentMethod',
112
  paymentMethodId: '#mercadopago_checkout_custom .payment_method_id',
113
  paymenMethodNotFound: '.error-payment-method-not-found',
114
  mercadoPagoTextChoice: '#mercadopago_checkout_custom .mercadopago-text-choice',
123
  customDiscountAmount: '#mercadopago_checkout_custom .mercadopago-discount-amount',
124
  discountAmount: '.mercadopago-discount-amount',
125
  token: '#mercadopago_checkout_custom .token',
126
+ errorFormat: '#mercadopago_checkout_custom .error-{0}',
127
+ errorFormatSecondCard: '#second_card_mercadopago_checkout_custom .error-{0}',
128
  couponActionApply: '.mercadopago-coupon-action-apply',
129
  couponActionRemove: '.mercadopago-coupon-action-remove',
130
  ticketActionApply: '#mercadopago_checkout_custom_ticket .mercadopago-coupon-action-apply',
139
  discountOkTotalAmount: '.mercadopago-message-coupon .discount-ok .total-amount',
140
  discountOkTotalAmountDiscount: '.mercadopago-message-coupon .discount-ok .total-amount-discount',
141
  discountOkTerms: '.mercadopago-message-coupon .discount-ok .mercadopago-coupon-terms',
142
+ inputCouponDiscount: '#input-coupon-discount',
143
+ checkoutCustomSecondCard: '#mercadopago_checkout_custom_second_card',
144
+ showSecondCard: '#show_second_card',
145
+ hideSecondCard: '#hide_second_card',
146
+ secondCard: '#second_card_payment_form_mercadopago_custom',
147
+ firstCardAmount: '#first_card_amount',
148
+ secondCardAmount: '#second_card_amount',
149
+ firstCardAmountFields:'#first_card_amount_fields',
150
+ secondCardReturnToCardList: '#second_card_return_list_card_mp',
151
+ secondCardCustomCard: '#second_card_mercadopago_checkout_custom_card',
152
+ secondCardUseOtherCard: '#second_card_use_other_card_mp',
153
+ secondCardOneClickPayment: '#second_card_one_click_pay_mp',
154
+ secondCardCardId: '#second_card_cardId',
155
+ cardNumberSecondCard: '#second_card_cardNumber',
156
+ cardHolderSecondCard: '#second_card_cardholderName',
157
+ docNumberSecondCard: '#second_card_docNumber',
158
+ cardExpirationMonthSecondCard: '#second_card_cardExpirationMonth',
159
+ cardExpYearSecondCard: '#second_card_cardExpirationYear',
160
+ docTypeSecondCard: '#second_card_docType',
161
+ securityCodeOCPSecondCard: '#second_card_securityCodeOCP',
162
+ securityCodeSecondCard: '#second_card_securityCode',
163
+ paymentMethodSecondCard: '#second_card_paymentMethod',
164
+ issuerSecondCard: '#second_card_issuer',
165
+ cardNumberInputSecondCard: '#second_card_cardNumber__mp input[data-checkout="cardNumber"]',
166
+ issuerMpSecondCard: '#second_card_issuer__mp',
167
+ issuerMpLabelSecondCard: '#second_card_issuer__mp label',
168
+ secondCardInstallmentText: '.second_card_mercadopago-text-installment',
169
+ secondCardInstallments: '#second_card_installments',
170
+ ocpSecondCard: '#second_card_mercadopago_checkout_custom_ocp',
171
+ dataCheckoutSecondCard: '[data-checkout]',
172
+ tokenSecondCard: '#mercadopago_checkout_custom_second_card .second_card_token',
173
+ paymentMethodIdSecondCard: '.second_card_payment_method_id',
174
+ isSecondCardUsed: ".is_second_card_used",
175
+ amountFirstCard: ".first_card_amount",
176
+ amountSecondCard: ".second_card_amount",
177
+ firstCardTotalBuy: ".total_buy",
178
+ secondCardTotalBuy: ".second_card_total_buy",
179
+ secondCardPayment: "#second_card_payment",
180
+ paymentMethodSelectSecondCard: '#second_card_paymentMethod'
181
 
182
  },
183
  url: {
259
  //Show site
260
  showLogMercadoPago(String.format(self.messages.siteId, siteId));
261
 
262
+ TinyJ(self.selectors.docType).on('DOMNodeInserted', addOptionsToSecondCardDocType);
263
+
264
  if (siteId != self.constants.mexico) {
265
+ TinyJ(self.selectors.docType).show();
266
  Mercadopago.getIdentificationTypes();
267
  } else {
268
  setTimeout(function () {
269
+ setPaymentMethods();
270
+ setPaymentMethodsSecondCard();
271
  }, 3000);
272
  }
273
 
274
  defineInputs();
275
 
276
  TinyJ(self.selectors.cardNumberInput).keyup(guessingPaymentMethod);
277
+
278
  TinyJ(self.selectors.cardNumberInput).keyup(clearOptions);
279
  TinyJ(self.selectors.cardNumberInput).change(guessingPaymentMethod);
280
  TinyJ(self.selectors.installmentsDontWork).click(guessingPaymentMethod);
281
+
282
  TinyJ(self.selectors.installments).change(setTotalAmount);
283
 
284
  releaseEventCreateCardToken();
303
  var currentTime = new Date();
304
  var currentMonth = currentTime.getMonth() + 1;
305
  var currentYear = currentTime.getFullYear();
306
+ return !(ccExpMonth < currentMonth && ccExpYear == currentYear);
 
 
 
307
  });
308
 
309
+ ////Second card
310
+ var showSecondCard = TinyJ(self.selectors.showSecondCard);
311
+ showSecondCard.click(actionShowSecondCard);
312
+ var hideSecondCard = TinyJ(self.selectors.hideSecondCard);
313
+ hideSecondCard.click(actionHideSecondCard);
314
+
315
+ var halfAmount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.totalAmount).val()/2;
316
+ TinyJ(self.selectors.firstCardAmount).val(halfAmount);
317
+ TinyJ(self.selectors.secondCardAmount).val(halfAmount);
318
+ TinyJ(self.selectors.amountFirstCard).val(halfAmount);
319
+ TinyJ(self.selectors.amountSecondCard).val(halfAmount);
320
+
321
+ TinyJ(self.selectors.firstCardAmount).focusout(changeAmountHandler);
322
+ actionHideSecondCard();
323
+ }
324
+
325
+ function initSecondCard() {
326
+ defineInputsSecondCard();
327
+ TinyJ(self.selectors.cardNumberInputSecondCard).keyup(guessingPaymentMethodSecondCard);
328
+ TinyJ(self.selectors.amountFirstCard).focusout(guessingPaymentMethodSecondCard);
329
+ TinyJ(self.selectors.secondCardInstallments).change(setTotalAmount);
330
  }
331
 
332
  function setPaymentMethodId(event) {
341
  }
342
  }
343
 
344
+ function setPaymentMethodIdSecondCard(event) {
345
+ var paymentMethodSelector = TinyJ(self.selectors.paymentMethodSelectSecondCard);
346
+ var paymentMethodId = paymentMethodSelector.val();
347
+ if (paymentMethodId != '') {
348
+ var payment_method_id = TinyJ(self.selectors.paymentMethodIdSecondCard);
349
+ payment_method_id.val(paymentMethodId);
350
+ if (issuerMandatory) {
351
+ Mercadopago.getIssuers(paymentMethodId, showCardIssuersSecondCard);
352
+ }
353
+ }
354
+ }
355
+
356
  function getPaymentMethods() {
357
  var allMethods = Mercadopago.getPaymentMethods();
358
  var allowedMethods = [];
374
  TinyJ(self.selectors.paymentMethodSelect).change(setPaymentMethodId);
375
  }
376
 
377
+ function setPaymentMethodsSecondCard() {
378
+ var methods = getPaymentMethods();
379
+ setPaymentMethodsInfoSecondCard(methods);
380
+ TinyJ(self.selectors.paymentMethodSelectSecondCard).change(setPaymentMethodIdSecondCard);
381
+ }
382
  function checkDocNumber(v) {
383
  var flagReturn = true;
384
  Mercadopago.getIdentificationTypes(function (status, identificationsTypes) {
400
  function initMercadoPagoOCP() {
401
  showLogMercadoPago(self.messages.initOCP);
402
  TinyJ(self.selectors.cardId).change(cardsHandler);
 
403
  var returnListCard = TinyJ(self.selectors.returnToCardList);
404
+ var secondCardReturnListCard = TinyJ(self.selectors.secondCardReturnToCardList);
405
+ var showSecondCard = TinyJ(self.selectors.showSecondCard);
406
+ var hideSecondCard = TinyJ(self.selectors.hideSecondCard);
407
+
408
+
409
  TinyJ(self.selectors.useOtherCard).click(actionUseOneClickPayOrNo);
410
+ TinyJ(self.selectors.secondCardUseOtherCard).click(actionUseOneClickPayOrNoSecondCard);
411
  returnListCard.click(actionUseOneClickPayOrNo);
412
+ secondCardReturnListCard.click(actionUseOneClickPayOrNoSecondCard);
413
  TinyJ(self.selectors.installments).change(setTotalAmount);
414
 
415
+ TinyJ(self.selectors.secondCardCardId).change(cardsHandlerSecondCard);
416
+ secondCardReturnListCard.hide();
417
+ //secondCardCustomCard.hide();
418
  returnListCard.hide();
419
  }
420
 
421
+ function addOptionsToSecondCardDocType() {
422
+ var first = document.getElementById('docType');
423
+ var options = first.innerHTML;
424
+ var second = document.getElementById('second_card_docType');
425
+ second.innerHTML = options;
426
+ }
427
+
428
  function setTotalAmount() {
429
+ var value = 0;
430
+ if (isSecondCardUsed) {
431
+ value = TinyJ(self.selectors.secondCardInstallments).getSelectedOption().attribute(self.constants.cost);
432
+ TinyJ('.tea-info-second-card').html(TinyJ(self.selectors.secondCardInstallments).getSelectedOption().attribute('tea'));
433
+ TinyJ('.cft-info-second-card').html(TinyJ(self.selectors.secondCardInstallments).getSelectedOption().attribute('cft'));
434
+ }
435
+ value = Number(value) + Number(TinyJ(self.selectors.installments).getSelectedOption().attribute(self.constants.cost));
436
+ TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.totalAmount).val(value);
437
+ TinyJ('.tea-info-first-card').html(TinyJ(self.selectors.installments).getSelectedOption().attribute('tea'));
438
+ TinyJ('.cft-info-first-card').html(TinyJ(self.selectors.installments).getSelectedOption().attribute('cft'));
439
  }
440
 
441
  function defineInputs() {
482
  }
483
 
484
  for (var x = 0; x < dataCheckout.length; x++) {
485
+ if ((dataCheckout[x].getElem().id).indexOf("second") >= 0) {
486
+ continue;
487
+ }
488
  var $id = "#" + dataCheckout[x].id();
489
 
490
  var elPai = dataCheckout[x].attribute(self.constants.dataElementId);
509
 
510
  }
511
 
512
+ function defineInputsSecondCard() {
513
+ //showLogMercadoPago(self.messages.defineInputs);
514
+
515
+ var siteId = TinyJ(self.selectors.siteId).val();
516
+ var oneClickPay = TinyJ(self.selectors.secondCardOneClickPayment).val();
517
+ //var dataCheckout = TinyJ(self.selectors.dataCheckout);
518
+ var dataCheckout = TinyJ(self.selectors.dataCheckout);
519
+ var excludeInputs = [self.selectors.secondCardCardId, self.selectors.securityCodeOCPSecondCard, self.selectors.paymentMethodSecondCard];
520
+ var dataInputs = [];
521
+ var disabledInputs = [];
522
+
523
+ if (oneClickPay == true) {
524
+
525
+ excludeInputs = [
526
+ self.selectors.cardNumberSecondCard, self.selectors.issuerSecondCard, self.selectors.cardExpirationMonthSecondCard, self.selectors.cardExpYearSecondCard,
527
+ self.selectors.cardHolderSecondCard, self.selectors.docTypeSecondCard, self.selectors.docNumberSecondCard, self.selectors.securityCodeSecondCard, self.selectors.paymentMethodSecondCard
528
+ ];
529
+
530
+ } else if (siteId == self.constants.brazil) {
531
+
532
+ excludeInputs.push(self.selectors.issuerSecondCard);
533
+ excludeInputs.push(self.selectors.docTypeSecondCard)
534
+
535
+ } else if (siteId == self.constants.mexico) {
536
+
537
+ excludeInputs.push(self.selectors.docTypeSecondCard);
538
+ excludeInputs.push(self.selectors.docNumberSecondCard);
539
+ disabledInputs.push(self.selectors.issuerSecondCard);
540
+
541
+ var index = excludeInputs.indexOf(self.selectors.paymentMethodSecondCard);
542
+ if (index > -1) {
543
+ excludeInputs.splice(index, 1);
544
+ }
545
+
546
+ } else if (siteId == self.constants.colombia || siteId == self.constants.peru) {
547
+ var indexColombia = excludeInputs.indexOf(self.selectors.paymentMethodSecondCard);
548
+ if (indexColombia > -1) {
549
+ excludeInputs.splice(indexColombia, 1);
550
+ }
551
+ }
552
+ if (!issuerMandatory) {
553
+ excludeInputs.push(self.selectors.issuerSecondCard);
554
+ }
555
+
556
+ for (var x = 0; x < dataCheckout.length; x++) {
557
+ if ((dataCheckout[x].getElem().id).indexOf("second") < 0) {
558
+ continue;
559
+ }
560
+ var $id = "#" + dataCheckout[x].id();
561
+
562
+ var elPai = dataCheckout[x].attribute(self.constants.dataElementId);
563
+
564
+
565
+ if (excludeInputs.indexOf($id) == -1) {
566
+ TinyJ(elPai).removeAttribute(self.constants.style);
567
+ dataInputs.push($id);
568
+ if (disabledInputs.indexOf($id) != -1) {
569
+ TinyJ(self.selectors.checkoutCustomSecondCard).getElem($id).disabled = "disabled";
570
+ }
571
+ } else {
572
+ TinyJ(elPai).hide();
573
+ }
574
+ }
575
+
576
+
577
+ //Show inputs
578
+ showLogMercadoPago(dataInputs);
579
+
580
+ return dataInputs;
581
+
582
+ }
583
+
584
  function setPaymentMethodsInfo(methods) {
585
  hideLoading();
586
 
598
  }
599
  }
600
 
601
+ function setPaymentMethodsInfoSecondCard(methods) {
602
+ hideLoading();
603
+
604
+ var selectorPaymentMethods = TinyJ(self.selectors.paymentMethodSecondCard);
605
+
606
+ selectorPaymentMethods.empty();
607
+ var message_choose = document.querySelector(".mercadopago-text-choice").value;
608
+ var option = new Option(message_choose + "... ", '');
609
+ selectorPaymentMethods.appendChild(option);
610
+ if (methods.length > 0) {
611
+ for (var i = 0; i < methods.length; i++) {
612
+ option = new Option(methods[i].name, methods[i].id);
613
+ selectorPaymentMethods.appendChild(option);
614
+ }
615
+ }
616
+ }
617
+
618
 
619
  function setRequiredFields(required) {
620
  if (required) {
638
  }
639
  }
640
 
641
+ function setRequiredFieldsSecondCard(required) {
642
+ if (required) {
643
+ TinyJ(self.selectors.cardNumberSecondCard).addClass(self.constants.requireEntry);
644
+ TinyJ(self.selectors.cardHolderSecondCard).addClass(self.constants.requireEntry);
645
+ TinyJ(self.selectors.docNumberSecondCard).addClass(self.constants.requireEntry);
646
+ TinyJ(self.selectors.cardExpirationMonthSecondCard).addClass(self.constants.validateSelect);
647
+ TinyJ(self.selectors.cardExpYearSecondCard).addClass(self.constants.validateSelect);
648
+ TinyJ(self.selectors.docTypeSecondCard).addClass(self.constants.validateSelect);
649
+ TinyJ(self.selectors.securityCodeOCPSecondCard).removeClass(self.constants.requireEntry);
650
+ TinyJ(self.selectors.securityCodeSecondCard).addClass(self.constants.requireEntry);
651
+ } else {
652
+ TinyJ(self.selectors.cardNumberSecondCard).removeClass(self.constants.requireEntry);
653
+ TinyJ(self.selectors.cardHolderSecondCard).removeClass(self.constants.requireEntry);
654
+ TinyJ(self.selectors.docNumberSecondCard).removeClass(self.constants.requireEntry);
655
+ TinyJ(self.selectors.securityCodeSecondCard).removeClass(self.constants.requireEntry);
656
+ TinyJ(self.selectors.securityCodeOCPSecondCard).addClass(self.constants.requireEntry);
657
+ TinyJ(self.selectors.cardExpirationMonthSecondCard).removeClass(self.constants.validateSelect);
658
+ TinyJ(self.selectors.cardExpYearSecondCard).removeClass(self.constants.validateSelect);
659
+ TinyJ(self.selectors.docTypeSecondCard).removeClass(self.constants.validateSelect);
660
+ }
661
+ }
662
+
663
+
664
  function actionUseOneClickPayOrNo() {
665
  showLogMercadoPago(self.messages.ocpUser);
666
 
679
  setRequiredFields(false);
680
  TinyJ(self.selectors.returnToCardList).hide();
681
  }
 
682
  defineInputs();
683
+
684
  clearOptions();
685
  Mercadopago.clearSession();
686
 
689
  checkCreateCardToken();
690
 
691
  //update payment_id
692
+ if (typeof event == 'undefined'){
693
+ var event = {};
694
+ }
695
  guessingPaymentMethod(event.type = self.constants.keyup);
696
 
697
 
698
  }
699
 
700
+ function actionUseOneClickPayOrNoSecondCard() {
701
+ //showLogMercadoPago(self.messages.ocpUser);
702
+
703
+ initSecondCard();
704
+
705
+ var ocp = TinyJ(self.selectors.secondCardOneClickPayment).val();
706
+ console.log(ocp);
707
+
708
+ //showLogMercadoPago(String.format(self.messages.ocpActivatedFormat, ocp));
709
+
710
+ if (ocp == true) {
711
+ TinyJ(self.selectors.secondCardOneClickPayment).val(0);
712
+ TinyJ(self.selectors.secondCardCardId).disable();
713
+ setRequiredFieldsSecondCard(true);
714
+ TinyJ(self.selectors.secondCardReturnToCardList).show();
715
+ TinyJ(self.selectors.secondCardPayment).hide();
716
+
717
+ } else {
718
+ TinyJ(self.selectors.secondCardOneClickPayment).val(1);
719
+ TinyJ(self.selectors.secondCardCardId).enable();
720
+ setRequiredFieldsSecondCard(false);
721
+ TinyJ(self.selectors.secondCardReturnToCardList).hide();
722
+ TinyJ(self.selectors.secondCardPayment).show();
723
+ }
724
+
725
+ defineInputsSecondCard();
726
+ clearOptionsSecondCard();
727
+ Mercadopago.clearSession();
728
+ hideMessageError();
729
+
730
+ checkCreateCardTokenSecondCard();
731
+
732
+ //update payment_id
733
+
734
+ if (typeof event == 'undefined'){
735
+ var event = {};
736
+ }
737
+ guessingPaymentMethod(event.type = self.constants.keyup);
738
+ guessingPaymentMethodSecondCard(event.type = self.constants.keyup);
739
+ cardsHandlerSecondCard();
740
+ }
741
+
742
+ function actionShowSecondCard() {
743
+ TinyJ(self.selectors.secondCard).show();
744
+ TinyJ(self.selectors.firstCardAmountFields).show();
745
+ TinyJ(self.selectors.showSecondCard).hide();
746
+ isSecondCardUsed = true;
747
+ TinyJ(self.selectors.isSecondCardUsed).val(true);
748
+ TinyJ(self.selectors.firstCardTotalBuy).hide();
749
+ TinyJ(self.selectors.secondCardTotalBuy).show();
750
+ cardsHandler();
751
+ cardsHandlerSecondCard();
752
+ if (typeof event == 'undefined'){
753
+ var event = {};
754
+ }
755
+ guessingPaymentMethod(event.type = self.constants.keyup);
756
+ initSecondCard();
757
+ }
758
+
759
+ function actionHideSecondCard() {
760
+ TinyJ(self.selectors.secondCard).hide();
761
+ TinyJ(self.selectors.firstCardAmountFields).hide();
762
+ TinyJ(self.selectors.showSecondCard).show();
763
+ isSecondCardUsed = false;
764
+ TinyJ(self.selectors.isSecondCardUsed).val(false);
765
+ TinyJ(self.selectors.secondCardTotalBuy).hide();
766
+ TinyJ(self.selectors.firstCardTotalBuy).show();
767
+ cardsHandler();
768
+ if (typeof event == 'undefined'){
769
+ var event = {};
770
+ }
771
+ guessingPaymentMethod(event.type = self.constants.keyup);
772
+ }
773
+
774
+ function changeAmountHandler() {
775
+
776
+ var $formPayment = TinyJ(self.selectors.checkoutCustom);
777
+ var amount = $formPayment.getElem(self.selectors.amount).val();
778
+
779
+ var firstCardAmount = TinyJ(self.selectors.firstCardAmount).val();
780
+
781
+ if (parseFloat(firstCardAmount) < parseFloat(amount)) {
782
+ var secondCardAmount = amount - firstCardAmount;
783
+ TinyJ(self.selectors.secondCardAmount).val(secondCardAmount);
784
+ TinyJ(self.selectors.amountFirstCard).val(firstCardAmount);
785
+ TinyJ(self.selectors.amountSecondCard).val(secondCardAmount);
786
+ }
787
+ else {
788
+ alert ('First card amount exceeds total amount to pay');
789
+ TinyJ(self.selectors.secondCardAmount).val(amount/2);
790
+ TinyJ(self.selectors.firstCardAmount).val(amount/2);
791
+ TinyJ(self.selectors.amountFirstCard).val(amount/2);
792
+ TinyJ(self.selectors.amountSecondCard).val(amount/2);
793
+ }
794
+
795
+ cardsHandler();
796
+ cardsHandlerSecondCard();
797
+ }
798
+
799
  function clearOptions() {
800
  showLogMercadoPago(self.messages.clearOpts);
801
 
821
  }
822
  }
823
 
824
+ function clearOptionsSecondCard() {
825
+ //showLogMercadoPago(self.messages.clearOpts);
826
+
827
+ var bin = getBinSecondCard();
828
+ if (bin != undefined && (bin.length == 0 || TinyJ(self.selectors.cardNumberInputSecondCard).val() == '')) {
829
+ var messageInstallment = TinyJ(self.selectors.secondCardInstallmentText).val();
830
+
831
+ var issuer = TinyJ(self.selectors.issuerSecondCard);
832
+ issuer.hide();
833
+ issuer.empty();
834
+
835
+ TinyJ(self.selectors.issuerMpSecondCard).hide();
836
+ TinyJ(self.selectors.issuerMpLabelSecondCard).hide();
837
+
838
+ var selectorInstallments = TinyJ(self.selectors.secondCardInstallments);
839
+ var fragment = document.createDocumentFragment();
840
+ option = new Option(messageInstallment, '');
841
+
842
+ selectorInstallments.empty();
843
+ fragment.appendChild(option);
844
+ selectorInstallments.appendChild(fragment);
845
+ selectorInstallments.disable();
846
+ }
847
+ }
848
+
849
  function cardsHandler() {
850
  showLogMercadoPago(self.messages.cardHandler);
851
  clearOptions();
865
  Mercadopago.getPaymentMethod({"bin": _bin}, setPaymentMethodInfo);
866
  TinyJ(self.selectors.issuer).val('');
867
  }
868
+ } else {
869
+ guessingPaymentMethod(event.type = self.constants.keyup);
870
+ }
871
+ }
872
+
873
+ function cardsHandlerSecondCard() {
874
+ //showLogMercadoPago(self.messages.cardHandler);
875
+ clearOptionsSecondCard();
876
+ var cardSelector;
877
+ try {
878
+ cardSelector = TinyJ(self.selectors.secondCardCardId);
879
+ }
880
+ catch (err) {
881
+ return;
882
+ }
883
+ var oneClickPay = TinyJ(self.selectors.secondCardOneClickPayment).val();
884
+
885
+ if (oneClickPay == true) {
886
+ var selectedCard = cardSelector.getSelectedOption();
887
+ if (selectedCard.val() != "-1") {
888
+ var _bin = selectedCard.attribute(self.constants.firstSixDigits);
889
+ Mercadopago.getPaymentMethod({"bin": _bin}, setPaymentMethodInfoSecondCard);
890
+ TinyJ(self.selectors.issuerSecondCard).val('');
891
+ }
892
+ } else {
893
+ guessingPaymentMethodSecondCard(event.type = self.constants.keyup);
894
  }
895
  }
896
 
914
  }
915
  }
916
 
917
+ function getBinSecondCard() {
918
+ //showLogMercadoPago(self.messages.getBin);
919
+
920
+ var oneClickPay = TinyJ(self.selectors.secondCardOneClickPayment).val();
921
+ if (oneClickPay == true) {
922
+ try {
923
+ var cardSelector = TinyJ(self.selectors.secondCardCardId).getSelectedOption();
924
+ }
925
+ catch (err) {
926
+ return;
927
+ }
928
+ if (cardSelector.val() != "-1") {
929
+ return cardSelector.attribute(self.constants.firstSixDigits);
930
+ }
931
+ } else {
932
+ var ccNumber = TinyJ(self.selectors.cardNumberInputSecondCard).val();
933
+ return ccNumber.replace(/[ .-]/g, '').slice(0, 6);
934
+ }
935
+ }
936
 
937
  function guessingPaymentMethod(event) {
938
  showLogMercadoPago(self.messages.guessingPayment);
962
  "amount": amount
963
  }, setPaymentMethodInfo);
964
  }
965
+ }, 1000);
966
  }
967
  };
968
 
969
+ function guessingPaymentMethodSecondCard(event) {
970
+ showLogMercadoPago(self.messages.guessingPayment);
971
+
972
+ //hide all errors
973
+ hideMessageError();
974
+
975
+ var bin = getBinSecondCard();
976
+ try {
977
+ var amount = TinyJ(self.selectors.checkoutCustomSecondCard).getElem(self.selectors.secondCardAmount).val();
978
+ } catch (e) {
979
+ var amount = TinyJ(self.selectors.checkoutTicket).getElem(self.selectors.secondCardAmount).val();
980
+ }
981
+
982
+ if (event.type == self.constants.keyup) {
983
+ if (bin != undefined && bin.length == 6) {
984
+ Mercadopago.getPaymentMethod({
985
+ "bin": bin,
986
+ "amount": amount
987
+ }, setPaymentMethodInfoSecondCard);
988
+ }
989
+ } else {
990
+ setTimeout(function () {
991
+ if (bin != undefined && bin.length >= 6) {
992
+ Mercadopago.getPaymentMethod({
993
+ "bin": bin,
994
+ "amount": amount
995
+ }, setPaymentMethodInfoSecondCard);
996
+ }
997
+ }, 3000);
998
+ }
999
+ };
1000
+
1001
+
1002
  function setPaymentMethodInfo(status, response) {
1003
  showLogMercadoPago(self.messages.setPaymentInfo);
1004
  showLogMercadoPago(status);
1031
 
1032
  var bin = getBin();
1033
  try {
1034
+ if (isSecondCardUsed) {
1035
+ var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.firstCardAmount).val();
1036
+ } else {
1037
+ var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
1038
+ }
1039
  } catch (e) {
1040
  var amount = TinyJ(self.selectors.checkoutTicket).getElem(self.selectors.amount).val();
1041
  }
1080
  defineInputs();
1081
  };
1082
 
1083
+ function setPaymentMethodInfoSecondCard(status, response) {
1084
+
1085
+ showLogMercadoPago(self.messages.setPaymentInfo);
1086
+ showLogMercadoPago(status);
1087
+ showLogMercadoPago(response);
1088
+
1089
+ var siteId = TinyJ(self.selectors.siteId).val();
1090
+ if (siteId == self.constants.colombia || siteId == self.constants.peru) {
1091
+ setPaymentMethodsSecondCard();
1092
+ }
1093
+ //hide loading
1094
+ hideLoading();
1095
+
1096
+ if (status == http.status.OK && response != undefined) {
1097
+ if (response.length == 1) {
1098
+ var paymentMethodId = response[0].id;
1099
+ TinyJ(self.selectors.paymentMethodIdSecondCard).val(paymentMethodId);
1100
+ } else {
1101
+ var paymentMethodId = TinyJ(self.selectors.paymentMethodIdSecondCard).val();
1102
+ }
1103
+
1104
+ var oneClickPay = TinyJ(self.selectors.secondCardOneClickPayment).val();
1105
+ var selector = oneClickPay == true ? self.selectors.secondCardCardId : self.selectors.cardNumberInputSecondCard;
1106
+ if (response.length == 1) {
1107
+ TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, response[0].secure_thumbnail);
1108
+ } else if (oneClickPay != 0) {
1109
+ TinyJ(self.selectors.paymentMethodIdSecondCard).val(TinyJ(selector).getSelectedOption().attribute('second_card_payment_method_id'));
1110
+ TinyJ(selector).getElem().style.background = String.format(self.constants.backgroundUrlFormat, TinyJ(selector).getSelectedOption().attribute('secure_thumb'));
1111
+ }
1112
+
1113
+ var bin = getBinSecondCard();
1114
+ try {
1115
+ var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.secondCardAmount).val();
1116
+ } catch (e) {
1117
+ var amount = TinyJ(self.selectors.checkoutTicket).getElem(self.selectors.amount).val();
1118
+ }
1119
+
1120
+ //get installments
1121
+ getInstallmentsSecondCard({
1122
+ "bin": bin,
1123
+ "amount": amount
1124
+ });
1125
+
1126
+ // check if the issuer is necessary to pay
1127
+ issuerMandatory = false;
1128
+ var additionalInfo = response[0].additional_info_needed;
1129
+
1130
+ for (var i = 0; i < additionalInfo.length; i++) {
1131
+ if (additionalInfo[i] == self.selectors.issuerId) {
1132
+ issuerMandatory = true;
1133
+ }
1134
+ }
1135
+
1136
+ showLogMercadoPago(String.format(self.messages.issuerMandatory, issuerMandatory));
1137
+
1138
+ var issuer = TinyJ(self.selectors.issuerSecondCard);
1139
+
1140
+ if (issuerMandatory) {
1141
+ if (paymentMethodId != '') {
1142
+ Mercadopago.getIssuers(paymentMethodId, showCardIssuersSecondCard);
1143
+ issuer.change(setInstallmentsByIssuerId);
1144
+ }
1145
+ } else {
1146
+ TinyJ(self.selectors.issuerMpSecondCard).hide();
1147
+ issuer.hide();
1148
+ issuer.getElem().options.length = 0;
1149
+ }
1150
+
1151
+ } else {
1152
+
1153
+ showMessageErrorForm(self.selectors.paymenMethodNotFound);
1154
+
1155
+ }
1156
+
1157
+ defineInputsSecondCard();
1158
+ };
1159
+
1160
  function showCardIssuers(status, issuers) {
1161
  showLogMercadoPago(self.messages.setIssuer);
1162
  showLogMercadoPago(status);
1193
  defineInputs();
1194
  };
1195
 
1196
+ function showCardIssuersSecondCard(status, issuers) {
1197
+ showLogMercadoPago(self.messages.setIssuer);
1198
+ showLogMercadoPago(status);
1199
+ showLogMercadoPago(issuers);
1200
+ if (issuers.length > 0) {
1201
+ var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
1202
+ var messageDefaultIssuer = TinyJ(self.selectors.textDefaultIssuer).val();
1203
+
1204
+ var fragment = document.createDocumentFragment();
1205
+
1206
+ var option = new Option(messageChoose + "...", '');
1207
+ fragment.appendChild(option);
1208
+
1209
+ for (var i = 0; i < issuers.length; i++) {
1210
+ if (issuers[i].name != self.constants.default) {
1211
+ option = new Option(issuers[i].name, issuers[i].id);
1212
+ } else {
1213
+ option = new Option(messageDefaultIssuer, issuers[i].id);
1214
+ }
1215
+ fragment.appendChild(option);
1216
+ }
1217
+
1218
+ TinyJ(self.selectors.issuerSecondCard).empty().appendChild(fragment).enable().removeAttribute(self.constants.style);
1219
+ TinyJ(self.selectors.issuerMpSecondCard).removeAttribute(self.constants.style);
1220
+ TinyJ(self.selectors.issuerMpLabelSecondCard).removeAttribute(self.constants.style);
1221
+ } else {
1222
+ TinyJ(self.selectors.issuerSecondCard).empty();
1223
+ TinyJ(self.selectors.issuerSecondCard).hide();
1224
+ TinyJ(self.selectors.issuerMpSecondCard).hide();
1225
+ TinyJ(self.selectors.issuerMpLabelSecondCard).hide();
1226
+
1227
+
1228
+ }
1229
+ defineInputsSecondCard();
1230
+ };
1231
+
1232
  function setInstallmentsByIssuerId(status, response) {
1233
  showLogMercadoPago(self.messages.setInstallment);
1234
 
1235
  var issuerId = TinyJ(self.selectors.issuer).val();
1236
+ //var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
1237
+
1238
+ if (isSecondCardUsed) {
1239
+ var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.firstCardAmount).val();
1240
+ } else {
1241
+ var amount = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val();
1242
+ }
1243
 
1244
  if (issuerId === '-1') {
1245
  return;
1316
 
1317
  }
1318
 
1319
+ function getInstallmentsSecondCard(options) {
1320
+
1321
+ hideMessageError();
1322
+ showLoading();
1323
+
1324
+ var route = TinyJ(self.selectors.mercadoRoute).val();
1325
+ var baseUrl = TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.baseUrl).val();
1326
+ var discountAmount = parseFloat(TinyJ(self.selectors.customDiscountAmount).val());
1327
+ var paymentMethodId = TinyJ(self.selectors.paymentMethodIdSecondCard).val();
1328
+ if (paymentMethodId != '') {
1329
+ options['payment_method_id'] = paymentMethodId;
1330
+ }
1331
+ if (route != self.constants.checkout) {
1332
+ showLogMercadoPago(self.messages.usingMagentoCustomCheckout);
1333
+
1334
+ tiny.ajax(baseUrl + self.url.amount, {
1335
+ method: http.method.GET,
1336
+ timeout: 5000,
1337
+ success: function (response, status, xhr) {
1338
+ showLogMercadoPago(self.messages.getAmountSuccess);
1339
+ showLogMercadoPago(status);
1340
+ showLogMercadoPago(response);
1341
+
1342
+ TinyJ(self.selectors.checkoutCustom).getElem(self.selectors.amount).val(response.amount);
1343
+
1344
+ options.amount = parseFloat(response.amount) - discountAmount;
1345
+
1346
+ showLogMercadoPago(String.format(self.messages.installmentAmount, response.amount));
1347
+ showLogMercadoPago(String.format(self.messages.customDiscountAmount, discountAmount));
1348
+ showLogMercadoPago(String.format(self.messages.finalAmount, options.amount));
1349
+
1350
+ Mercadopago.getInstallments(options, setInstallmentInfoSecondCard);
1351
+ },
1352
+ error: function (status, response) {
1353
+ showLogMercadoPago(self.messages.getAmountError);
1354
+ showLogMercadoPago(status);
1355
+ showLogMercadoPago(response);
1356
+
1357
+ //hide loading
1358
+ hideLoading();
1359
+
1360
+ }
1361
+ });
1362
+ }
1363
+ else {
1364
+
1365
+ showLogMercadoPago(self.messages.usingMagentoStdCheckout);
1366
+
1367
+ options.amount = parseFloat(options.amount) - discountAmount;
1368
+
1369
+ showLogMercadoPago(String.format(self.messages.installmentAmount, options.amount));
1370
+ showLogMercadoPago(String.format(self.messages.customDiscountAmount, discountAmount));
1371
+ showLogMercadoPago(String.format(self.messages.finalAmount, options.amount));
1372
+
1373
+ Mercadopago.getInstallments(options, setInstallmentInfoSecondCard);
1374
+ }
1375
+
1376
+ }
1377
+
1378
  function setInstallmentInfo(status, response) {
1379
  showLogMercadoPago(self.messages.setInstallmentInfo);
1380
  showLogMercadoPago(status);
1385
 
1386
  selectorInstallments.empty();
1387
 
1388
+ if (response.length > 0) {
1389
+ var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
1390
+
1391
+ var option = new Option(messageChoose + "... ", '');
1392
+ payerCosts = response[0].payer_costs;
1393
+ var hasCftInfo = payerCosts[0]['labels'].length > 0;
1394
+ if (!hasCftInfo) {
1395
+ TinyJ('.tea-info-first-card').hide();
1396
+ TinyJ('.cft-info-first-card').hide();
1397
+ }
1398
+
1399
+ selectorInstallments.appendChild(option);
1400
+
1401
+ for (var i = 0; i < payerCosts.length; i++) {
1402
+ option = new Option(payerCosts[i].recommended_message || payerCosts[i].installments, payerCosts[i].installments);
1403
+ selectorInstallments.appendChild(option);
1404
+ TinyJ(option).attribute(self.constants.cost, payerCosts[i].total_amount);
1405
+ if (hasCftInfo) {
1406
+ var financeValues = payerCosts[i]['labels'].find(
1407
+ function(str) {
1408
+ return str.indexOf('CFT') > -1;
1409
+ }
1410
+ );
1411
+ var finance = financeValues.split('|');
1412
+ TinyJ(option).attribute('cft', finance[0].replace('_', ': '));
1413
+ TinyJ(option).attribute('tea', finance[1].replace('_', ': '));
1414
+ }
1415
+ }
1416
+ selectorInstallments.enable();
1417
+ } else {
1418
+ showMessageErrorForm(self.selectors.paymenMethodNotFound);
1419
+ }
1420
+ }
1421
+
1422
+ function setInstallmentInfoSecondCard(status, response) {
1423
+ showLogMercadoPago(self.messages.setInstallmentInfo);
1424
+ showLogMercadoPago(status);
1425
+ showLogMercadoPago(response);
1426
+ hideLoading();
1427
+
1428
+ var selectorInstallments = TinyJ(self.selectors.secondCardInstallments);
1429
+
1430
+ selectorInstallments.empty();
1431
+
1432
  if (response.length > 0) {
1433
  var messageChoose = TinyJ(self.selectors.mercadoPagoTextChoice).val();
1434
 
1436
  payerCosts = response[0].payer_costs;
1437
 
1438
  selectorInstallments.appendChild(option);
1439
+ var hasCftInfo = payerCosts[0]['labels'].length > 0;
1440
+ if (!hasCftInfo) {
1441
+ TinyJ('.tea-info-second-card').hide();
1442
+ TinyJ('.cft-info-second-card').hide();
1443
+ }
1444
  for (var i = 0; i < payerCosts.length; i++) {
1445
  option = new Option(payerCosts[i].recommended_message || payerCosts[i].installments, payerCosts[i].installments);
1446
  selectorInstallments.appendChild(option);
1447
  TinyJ(option).attribute(self.constants.cost, payerCosts[i].total_amount);
1448
+ if (hasCftInfo) {
1449
+ var finance = payerCosts[i]['labels'][0].split('|');
1450
+ TinyJ(option).attribute('cft', finance[0].replace('_', ': '));
1451
+ TinyJ(option).attribute('tea', finance[1].replace('_', ': '));
1452
+ }
1453
  }
1454
  selectorInstallments.enable();
1455
  } else {
1462
  showLogMercadoPago(self.messages.releaseCardTokenEvent);
1463
 
1464
  var dataCheckout = TinyJ(self.selectors.dataCheckout);
1465
+ var dataCheckoutSecondCard = TinyJ(self.selectors.dataCheckoutSecondCard);
1466
 
1467
  if (Array.isArray(dataCheckout)) {
1468
  for (var x = 0; x < dataCheckout.length; x++) {
1469
+ if ((dataCheckout[x].getElem().id).indexOf("second") >= 0) {
1470
+ dataCheckout[x].focusout(checkCreateCardTokenSecondCard);
1471
+ dataCheckout[x].change(checkCreateCardTokenSecondCard);
1472
+ } else {
1473
+ dataCheckout[x].focusout(checkCreateCardToken);
1474
+ dataCheckout[x].change(checkCreateCardToken);
1475
+ }
1476
  }
1477
  } else {
1478
  dataCheckout.focusout(checkCreateCardToken);
1479
  dataCheckout.change(checkCreateCardToken);
1480
  }
1481
 
1482
+ if (Array.isArray(dataCheckoutSecondCard)) {
1483
+ for (var y = 0; y < dataCheckoutSecondCard.length; y++) {
1484
+ //dataCheckoutSecondCard[y].focusout(checkCreateCardTokenSecondCard);
1485
+ //dataCheckoutSecondCard[y].change(checkCreateCardTokenSecondCard);
1486
+ }
1487
+ } else {
1488
+ //dataCheckoutSecondCard.focusout(checkCreateCardTokenSecondCard);
1489
+ //dataCheckoutSecondCard.change(checkCreateCardTokenSecondCard);
1490
+ }
1491
+
1492
  }
1493
 
1494
  function checkCreateCardToken() {
1517
  var oneClickPay = TinyJ(self.selectors.oneClickPayment).val();
1518
  var selector = TinyJ(self.selectors.oneClickPayment).val() == true ? self.selectors.ocp : self.selectors.customCard;
1519
  showLoading();
1520
+ console.log(TinyJ(selector).getElem());
1521
  Mercadopago.createToken(TinyJ(selector).getElem(), sdkResponseHandler);
1522
  }
1523
  }
1524
 
1525
+ function checkCreateCardTokenSecondCard() {
1526
+
1527
+ var submit = true;
1528
+ var dataInputs = defineInputsSecondCard();
1529
+
1530
+ var issuers = TinyJ(self.selectors.issuerSecondCard);
1531
+ var issuersFlag = (issuers && issuers.getElem() != null && issuers.getElem().length > 0);
1532
+
1533
+ for (var x = 0; x < dataInputs.length; x++) {
1534
+ if (TinyJ(dataInputs[x]).val() == "" || TinyJ(dataInputs[x]).val() == -1) {
1535
+ if (!(dataInputs[x] == "#second_card_issuer" && !issuersFlag)) {
1536
+ submit = false;
1537
+ }
1538
+ }
1539
+ }
1540
+
1541
+ var docNumber = TinyJ(self.selectors.docNumberSecondCard).val();
1542
+ if (docNumber != '' && !checkDocNumber(docNumber)) {
1543
+ submit = false;
1544
+ }
1545
+
1546
+ if (submit) {
1547
+ var oneClickPay = TinyJ(self.selectors.secondCardOneClickPayment).val();
1548
+ var selector = TinyJ(self.selectors.secondCardOneClickPayment).val() == true ? self.selectors.ocpSecondCard : self.selectors.secondCardCustomCard;
1549
+ showLoading();
1550
+ console.log(TinyJ(selector).getElem());
1551
+ Mercadopago.clearSession();
1552
+ Mercadopago.createToken(TinyJ(selector).getElem(), sdkResponseHandlerSecondCard);
1553
+ }
1554
+ }
1555
+
1556
  function sdkResponseHandler(status, response) {
1557
  showLogMercadoPago(self.messages.responseCardToken);
1558
  showLogMercadoPago(status);
1564
 
1565
  if (status == http.status.OK || status == http.status.CREATED) {
1566
  var form = TinyJ(self.selectors.token).val(response.id);
1567
+ console.log(response.id);
1568
  showLogMercadoPago(response);
1569
 
1570
  } else {
1577
  }
1578
  };
1579
 
1580
+ function sdkResponseHandlerSecondCard(status, response) {
1581
+ showLogMercadoPago(self.messages.responseCardToken);
1582
+ showLogMercadoPago(status);
1583
+ showLogMercadoPago(response);
1584
+ //hide all errors
1585
+ hideMessageError();
1586
+ hideLoading();
1587
+
1588
+ if (status == http.status.OK || status == http.status.CREATED) {
1589
+ var form = TinyJ(self.selectors.tokenSecondCard).val(response.id);
1590
+ console.log(response.id);
1591
+ showLogMercadoPago(response);
1592
+
1593
+ } else {
1594
+
1595
+ for (var x = 0; x < Object.keys(response.cause).length; x++) {
1596
+ var error = response.cause[x];
1597
+ showMessageErrorForm(String.format(self.selectors.errorFormatSecondCard, error.code));
1598
+ }
1599
+
1600
+ }
1601
+ };
1602
+
1603
 
1604
  function hideMessageError() {
1605
  showLogMercadoPago(self.messages.hideErrors);
1613
  }
1614
  }
1615
 
1616
+ function showMessageErrorForm(error) {
1617
  showLogMercadoPago(self.messages.showingError);
1618
+ showLogMercadoPago(error);
1619
 
1620
+ var messageText = TinyJ(error);
1621
+ if (Array.isArray(messageText)) {
1622
+ for (var x = 0; x < messageText.length; x++) {
1623
+ messageText[x].show();
1624
  }
1625
  } else {
1626
+ messageText.show();
1627
  }
1628
 
1629
  }
js/mercadopago/mercadopago_calculator.js ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var MercadoPagoCustom = (function () {
2
+
3
+ var instance = null;
4
+ var paymentMethodList = [];
5
+ var paymentMethodOrded = {};
6
+ var methodsConsulted = {};
7
+ var self = {
8
+ messages: {
9
+ hideLoading: 'Hide loading...'
10
+ },
11
+ constants: {
12
+ undefined: 'undefined',
13
+ codeCft: 'CFT',
14
+ codeRecommended: 'recommended_installment',
15
+ loading: 'loading',
16
+ atributeInstallments: 'installments',
17
+ atributeDataRate: 'data-installment-rate',
18
+ atributeDataPrice: 'data-price',
19
+ atributeDataCft: 'data-installment-cft',
20
+ atributeDataTea: 'data-installment-tea',
21
+ atributeDataPtf: 'data-installment-ptf',
22
+ atributeSelected: 'selected',
23
+ },
24
+ selectors: {
25
+ popup: '#mercadopago-popup',
26
+ sectionPaymentCalculator: '#id-order-profile-app-wrapper',
27
+ paymentCardsList: '#op-payment-cards-list',
28
+ paymentCardLi: '#op-payment-cards-list li',
29
+ paymentCardSelected: '#op-payment-cards-list input:checked',
30
+ opBankSelect: '#op-bank-select',
31
+ issuerSelect: "#issuerSelect",
32
+ optionDefault: '#issuerSelect optgroup option',
33
+ installmentSelect: "#installmentSelect",
34
+ installmentsPrice: "#installmentsPrice",
35
+ installmentPTF: "#installmentPTF",
36
+ installmentTEA: "#installmentTEA",
37
+ installmentCFT: "#installmentCFT",
38
+ installmentsInterestFreeText: "#installmentsInterestFreeText"
39
+ },
40
+ url: {
41
+ },
42
+ enableLog: true
43
+ };
44
+
45
+ function getInstance() {
46
+ if (!instance) {
47
+ instance = new Initializelibrary();
48
+ }
49
+ return instance;
50
+ }
51
+
52
+ function showPopup() {
53
+ TinyJ(self.selectors.popup).show();
54
+ }
55
+
56
+ function hidePopup() {
57
+ TinyJ(self.selectors.popup).hide();
58
+ }
59
+
60
+ function Initializelibrary() {
61
+ if (typeof PublicKeyMercadoPagoCustom != self.constants.undefined) {
62
+ Mercadopago.setPublishableKey(PublicKeyMercadoPagoCustom);
63
+ }
64
+
65
+ // getAllPaymentMethods();
66
+
67
+ TinyJ(self.selectors.paymentCardsList).change(getSelectedCard);
68
+ TinyJ(self.selectors.issuerSelect).change(setPaymentCost);
69
+ TinyJ(self.selectors.installmentSelect).change(setInformationCost);
70
+ }
71
+
72
+ function getSelectedCard() {
73
+ // add class loading
74
+ TinyJ(self.selectors.sectionPaymentCalculator).addClass(self.constants.loading);
75
+
76
+ // add class to <li>
77
+ TinyJ(self.selectors.paymentCardLi).each(function(obj, key) {
78
+ obj.removeClass('selected');
79
+ });
80
+ var liId = TinyJ(self.selectors.paymentCardSelected).val();
81
+ TinyJ('#'+liId+'-li').addClass('selected'); // <li class="selected">
82
+
83
+ //show options
84
+ var paymentCardSelected = getSelectedRadio();
85
+ // begin clear price and installment select
86
+ TinyJ(self.selectors.installmentSelect).empty();
87
+ TinyJ(self.selectors.installmentsPrice).empty();
88
+ // end clear price and installment select
89
+
90
+ getPaymentMethods(paymentCardSelected);
91
+ }
92
+
93
+ function getSelectedRadio() {
94
+ return TinyJ(self.selectors.paymentCardSelected).val();
95
+ }
96
+
97
+ function getPaymentMethods( creditCardId ) {
98
+ if ((methodsConsulted.hasOwnProperty(creditCardId))) {
99
+ paymentMethodList = methodsConsulted[creditCardId];
100
+ sortPaymentMethods();
101
+ } else {
102
+ Mercadopago.getInstallments({'payment_method_id': creditCardId, 'amount': Amount},responseHandler);
103
+ }
104
+ }
105
+
106
+ function responseHandler( status, response) {
107
+ paymentMethodList = response;
108
+ methodsConsulted[response[0].payment_method_id] = response;
109
+ sortPaymentMethods();
110
+ }
111
+
112
+ function sortPaymentMethods() {
113
+ paymentMethodOrded = {};
114
+
115
+ TinyJ(self.selectors.opBankSelect).show();
116
+ var selectorPaymentMethods = TinyJ(self.selectors.issuerSelect);
117
+ selectorPaymentMethods.empty();
118
+
119
+ // var m = Translator.translate('Eligir una opcion');
120
+ //add first option
121
+
122
+ // TRASLATE Choose an option
123
+ var option = new Option('Eligir una opcion', '');
124
+ selectorPaymentMethods.appendChild(option);
125
+
126
+ //swerch in all banks
127
+ for (var bank = 0; bank< paymentMethodList.length; bank++ ){
128
+ var payerCost = paymentMethodList[bank].payer_costs.length-1;
129
+ var end = false;
130
+
131
+ //serch in all installments
132
+ while ( payerCost >= 0 && !end){
133
+
134
+ //serch the first elment with installment rate in 0
135
+ // or is the last element
136
+ if ((paymentMethodList[bank].payer_costs[payerCost].installment_rate == '0') || (payerCost == 0) ){
137
+ end = true;
138
+ var installments = paymentMethodList[bank].payer_costs[payerCost].installments;
139
+ if (paymentMethodOrded[installments]){
140
+ paymentMethodOrded[installments].push({'bank': bank, 'installments': installments, 'bank_name': paymentMethodList[bank].issuer.name})
141
+ } else{
142
+ paymentMethodOrded[installments] = [];
143
+ paymentMethodOrded[installments].push({'bank': bank, 'installments': installments, 'bank_name': paymentMethodList[bank].issuer.name})
144
+ }
145
+
146
+ }
147
+ payerCost--;
148
+ }
149
+ }
150
+ var keys = [];
151
+ for (var key in paymentMethodOrded){
152
+ keys.push(key);
153
+ }
154
+
155
+ for (var i= keys.length-1; i>=0; i--){
156
+ // generate groups
157
+ if ( i === 0) {
158
+ // Other banks
159
+ var label = 'Otros bancos';
160
+ }else {
161
+ // 'Until '
162
+ // ' payments without interest'
163
+ var label = "Hasta "+ keys[i] + " cuotas sin interés";
164
+ }
165
+
166
+ var oGroup = document.createElement('optgroup');
167
+ oGroup.label = label ;
168
+ for ( var bank=0; bank<paymentMethodOrded[keys[i]].length; bank++){
169
+ var method = paymentMethodOrded[keys[i]][bank];
170
+ option = new Option(method.bank_name,method.bank);
171
+ TinyJ(option).attribute(self.constants.atributeInstallments, method.installments);
172
+ oGroup.appendChild(option);
173
+ }
174
+ selectorPaymentMethods.appendChild(oGroup);
175
+ }
176
+
177
+ if (paymentMethodList.length == 1){
178
+ // hide bank select
179
+ TinyJ(self.selectors.opBankSelect).hide();
180
+ TinyJ(self.selectors.optionDefault).attribute(self.constants.atributeSelected, '');
181
+ setPaymentCost();
182
+ }
183
+ // remove class loading
184
+ TinyJ(self.selectors.sectionPaymentCalculator).removeClass(self.constants.loading);
185
+ }
186
+
187
+ //Set Payment Cost
188
+ function setPaymentCost() {
189
+ var selectorPaymentOptions = TinyJ(self.selectors.installmentSelect);
190
+ selectorPaymentOptions.empty();
191
+
192
+ var paymentMetodhSelected = TinyJ(self.selectors.issuerSelect).getSelectedOption().val();
193
+
194
+ var paymentOptions = paymentMethodList[paymentMetodhSelected].payer_costs;
195
+
196
+ for (var i=0; i < paymentOptions.length; i++){
197
+ var option = new Option(paymentOptions[i].installments, i);
198
+
199
+ //split information fron price
200
+ var value = paymentOptions[i].installment_amount;
201
+ var price = value.toString().split('.');
202
+ if (price.length > 1){
203
+ if (price[1].length == 1) { // ie: 10.5 to 10.50
204
+ price[1] += '0';
205
+ }
206
+ TinyJ(option).attribute(self.constants.atributeDataPrice, "$" + price[0] + "<sup>" + price[1] + "</sup>");
207
+ }
208
+ else {
209
+ TinyJ(option).attribute(self.constants.atributeDataPrice, "$" + price[0]);
210
+ }
211
+
212
+ TinyJ(option).attribute(self.constants.atributeDataRate, paymentOptions[i].installment_rate);
213
+
214
+ var totalAmount = paymentOptions[i].total_amount.toString(),
215
+ totalAmountSplit =totalAmount.split('.');
216
+ if ((totalAmountSplit.length > 1) && (totalAmountSplit[1].length == 1)) { // ie: 10.5 to 10.50
217
+ totalAmount += '0';
218
+ }
219
+ TinyJ(option).attribute(self.constants.atributeDataPtf, totalAmount);
220
+
221
+ var labels = paymentOptions[i].labels;
222
+ //split information from cft and ptf field.
223
+ var finance = [];
224
+ for (var j=0; j<labels.length; j++) {
225
+ if (labels[j].match(self.constants.codeCft)){
226
+ finance = labels[j].split('|');
227
+ //in this case, i need to show de CFT and TEA number
228
+ TinyJ(option).attribute(self.constants.atributeDataCft, finance[0].replace('_', ': '));
229
+ TinyJ(option).attribute(self.constants.atributeDataTea, finance[1].replace('_', ': '));
230
+
231
+ } else if (labels[j].match(self.constants.codeRecommended)){
232
+ //in this case, this is an option recomended.
233
+ TinyJ(option).attribute(self.constants.atributeSelected, '');
234
+ }
235
+ }
236
+ selectorPaymentOptions.appendChild(option);
237
+ setInformationCost();
238
+ }
239
+ }
240
+
241
+ function setInformationCost(){
242
+ var selectorPaymentOptions = TinyJ(self.selectors.installmentSelect).getSelectedOption();
243
+
244
+ TinyJ(self.selectors.installmentsPrice).html(selectorPaymentOptions.attribute(self.constants.atributeDataPrice));
245
+ TinyJ(self.selectors.installmentCFT).html(selectorPaymentOptions.attribute(self.constants.atributeDataCft));
246
+ TinyJ(self.selectors.installmentTEA).html(selectorPaymentOptions.attribute(self.constants.atributeDataTea));
247
+
248
+ if( selectorPaymentOptions.attribute(self.constants.atributeDataRate) > 0 ){
249
+ //Hide message
250
+ TinyJ(self.selectors.installmentsInterestFreeText).hide();
251
+ } else {
252
+ TinyJ(self.selectors.installmentsInterestFreeText).show();
253
+ }
254
+
255
+ TinyJ(self.selectors.installmentPTF).html("$"+selectorPaymentOptions.attribute(self.constants.atributeDataPtf));
256
+ }
257
+
258
+ return {
259
+ getInstance: getInstance,
260
+ showPopup: showPopup,
261
+ hidePopup: hidePopup
262
+ };
263
+ })();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MercadoPagoTransparent</name>
4
- <version>2.4.1</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
@@ -159,11 +159,14 @@
159
  &lt;/ol&gt;&#xD;
160
  &lt;/p&gt;&#xD;
161
  </description>
162
- <notes>- Bug fixes</notes>
 
 
 
163
  <authors><author><name>MercadoPago</name><user>MercadoPago</user><email>developer@mercadopago.com.br</email></author></authors>
164
- <date>2016-10-26</date>
165
- <time>17:58:01</time>
166
- <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="84fdf10e464cebbc89f5204f15d68f94"/><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="7cf8b32dfb95d965b7f2c14973267311"/></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="6c49a13805e54e74aca2974b78cbce90"/><dir name="Message"><file name="Abstract.php" hash="1f4f37e4a2cd0d1a18dff6f3e96ca84d"/></dir><file name="Response.php" hash="9112e209d80caa9450e6657af6c87d73"/><file name="StatusDetailMessage.php" hash="f56549a427452d4e67351274032885db"/><file name="StatusMessage.php" hash="3a7860b8dc843f8f9620852113fc5093"/><file name="StatusOrderMessage.php" hash="f17c394be7b8a795ee05342109c93fe4"/><file name="StatusUpdate.php" hash="c891c38b7633e3c0e370201a7ecaa39b"/></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="6d5a55d6b6ca446e9733ec6614a2171e"/><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="6f01dc5598553c6896359c05a3927bac"/></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="34633d51c4ab9838c77b515fda04492f"/><dir name="Source"><file name="CategoryId.php" hash="5728ee8c2bb1f41e10103c4ff4b939cb"/><file name="Country.php" hash="b3f85128ffa2e89cb89f6cfa8a135527"/><file name="Installments.php" hash="7c7efe8ef187ff1e2ab00bf7dbcc8cab"/><dir name="Order"><file name="Status.php" hash="cd483124b6d28bb6d01433063f03bc43"/></dir><file name="PaymentMethods.php" hash="d799c877f358c2218e0a65a085c0427b"/><file name="TypeCheckout.php" hash="36496d11ce7fbb1d87f27eb705525b61"/></dir><dir name="Standard"><file name="Payment.php" hash="7d324b53cf5a6abdde78d5f2bb27e270"/></dir></dir><dir name="controllers"><file name="ApiController.php" hash="2901e45bb90b472bc81b0353c4acb824"/><file name="NotificationsController.php" hash="da55bedfc48ebedd5915b964c3d43a4b"/><file name="PayController.php" hash="bfa751fb97ffd2d81bbffcc564d7cd0c"/><file name="SuccessController.php" hash="e11c8e7e02bf70319de810914eb30383"/></dir><dir name="etc"><file name="config.xml" hash="3856a8c15c39ce787f38d195e7d52712"/><file name="system.xml" hash="9c17fae3dbd1dcfa608f5f2f9f5591ed"/></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="7e405906299a7b94cc286f68357207a1"/></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="988d72c51b8d1ea2d1b17452e7926f32"/><dir name="Shipping"><dir name="Carrier"><file name="MercadoEnvios.php" hash="ffa13a64f24cb02ff52512b6b3212e3d"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="0c361fdda37ea6f4e9b309069d66a6b5"/><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="34788313e4d78a8609a1020929096427"/><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="05c898162fe729ba29b8b2785dd74396"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="success.phtml" hash="ed6f1db738127611d07c392f021c4dd4"/></dir><dir name="custom_ticket"><file name="form.phtml" hash="ffee68c42d8bdfdd983466c504ec57f5"/><file name="info.phtml" hash="ab580075fca55962463cbb17628b736d"/><file name="success.phtml" hash="61630da5d09584ccb191ba2f04d2c602"/></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="d5ea2d68325978b7c559599c47bb4237"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="pay.phtml" hash="3e3b83363e355778b98908847a56ab28"/><file name="success.phtml" hash="d9723992677c2ad20d6a67e1c0b3972e"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="MercadoPago_Core.csv" hash="06584b616ecc1601298dc701c0f1731f"/></dir><dir name="es_AR"><file name="MercadoPago_Core.csv" hash="47588d5b89d95c8b6ab56055a8783513"/></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="729b8df328557cccc688484bcadd5db6"/><file name="mercadopago_osc.js" hash="190e0d2aaf0e0957be4a1ea8cc68b1b5"/><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="315a7bd12147d5cf2baecfc289640c25"/></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="7149abfb4a2e07522fd99d2a3934c894"/><file name="RestClient.php" hash="13d49937d6ba8b7e245179c74a762940"/></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></contents>
167
  <compatible/>
168
  <dependencies><required><php><min>5.4.0</min><max>5.5.37</max></php></required></dependencies>
169
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MercadoPagoTransparent</name>
4
+ <version>2.6.3</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
159
  &lt;/ol&gt;&#xD;
160
  &lt;/p&gt;&#xD;
161
  </description>
162
+ <notes>Added Uruguay support&#xD;
163
+ Added cron for order status updates&#xD;
164
+ Added translations&#xD;
165
+ Bug fixing</notes>
166
  <authors><author><name>MercadoPago</name><user>MercadoPago</user><email>developer@mercadopago.com.br</email></author></authors>
167
+ <date>2017-03-16</date>
168
+ <time>21:30:31</time>
169
+ <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="Calculator"><file name="CalculatorForm.php" hash="bf36b45b88a3689fe9cbc4a8eee8f282"/><file name="CalculatorLink.php" hash="9b44aa734910d9207a290a8039f4870d"/></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="84fdf10e464cebbc89f5204f15d68f94"/><file name="Info.php" hash="f23e8a204e431e95a7bb0e9b409c1df4"/><file name="Success.php" hash="325fc24f1c0d220a95abe238ec583ee5"/></dir><file name="Discount.php" hash="a17b7f08dd57c31d27e57b3acbe03188"/><dir name="Recurring"><file name="Form.php" hash="92fd8e52f8cf52ea40d7a500d16c0286"/><file name="Info.php" hash="bad1e825f1dccbabf8802539fcbd180c"/><file name="Pay.php" hash="33d1cb94bd944f11cf9c8e217086057b"/><file name="Success.php" hash="e069c3c6be1bf2f15b5192dee0d95e44"/></dir><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="7cf8b32dfb95d965b7f2c14973267311"/></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="e33e668cf38d57171725aa185eb398d7"/><dir name="Message"><file name="Abstract.php" hash="1f4f37e4a2cd0d1a18dff6f3e96ca84d"/></dir><file name="Response.php" hash="3b4cb87e25993ba952b100751aadd9ce"/><file name="StatusDetailMessage.php" hash="f56549a427452d4e67351274032885db"/><file name="StatusMessage.php" hash="3a7860b8dc843f8f9620852113fc5093"/><file name="StatusOrderMessage.php" hash="f17c394be7b8a795ee05342109c93fe4"/><file name="StatusUpdate.php" hash="a0b4d72ac37cf1da6daf2d24cbe79393"/></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="894bac0d79687f448f82304d1c062e47"/><dir name="Cron"><file name="Order.php" hash="04693bdab8260f8f038bb72540a711d1"/></dir><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="617b6475f10a870160a07e97c0555352"/></dir><file name="CustomPayment.php" hash="bc92b4a75716d1fab5c30ae2240c127d"/><dir name="CustomTicket"><file name="Payment.php" hash="648402a89b301774f5864c703884f8d9"/></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="edbf09cc1ee2b63bf9bc2d21aed02ad6"/><dir name="Recurring"><file name="Payment.php" hash="372ffa6bec87328e9642602e1ee062da"/></dir><dir name="Source"><file name="CategoryId.php" hash="5728ee8c2bb1f41e10103c4ff4b939cb"/><file name="Country.php" hash="d55e621726633f3c765192c51da55e44"/><file name="Installments.php" hash="7c7efe8ef187ff1e2ab00bf7dbcc8cab"/><file name="ListPages.php" hash="6bbef05a62beb54573065d61a5efa60e"/><dir name="Order"><file name="Status.php" hash="a367d9b6bfe1e35268f04f0257612725"/></dir><file name="PaymentMethods.php" hash="d799c877f358c2218e0a65a085c0427b"/><file name="TypeCheckout.php" hash="36496d11ce7fbb1d87f27eb705525b61"/></dir><dir name="Standard"><file name="Payment.php" hash="7d324b53cf5a6abdde78d5f2bb27e270"/></dir></dir><dir name="controllers"><file name="ApiController.php" hash="2901e45bb90b472bc81b0353c4acb824"/><file name="CalculatorPaymentController.php" hash="87ff9536177530e294abf4b9853735bf"/><file name="NotificationsController.php" hash="fe0fcc8339b4dc01856a0adcb8f51b39"/><file name="PayController.php" hash="bfa751fb97ffd2d81bbffcc564d7cd0c"/><file name="RecurringPaymentController.php" hash="14baee15f6cec92db59075d49ba534e5"/><file name="SuccessController.php" hash="e11c8e7e02bf70319de810914eb30383"/></dir><dir name="etc"><file name="config.xml" hash="69b1dbe9a2e5172a75a361434d62fa52"/><file name="jstranslator.xml" hash="75f60813a72e33e999a15a02dc7e152e"/><file name="system.xml" hash="a9163aa3e81d9f2f6e2fc327f92bc78f"/></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="7e405906299a7b94cc286f68357207a1"/></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="988d72c51b8d1ea2d1b17452e7926f32"/><dir name="Shipping"><dir name="Carrier"><file name="MercadoEnvios.php" hash="ffa13a64f24cb02ff52512b6b3212e3d"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="680fc0737ab4d89658e1084e9431878e"/><file name="system.xml" hash="dd4d92f75a34954cdf13b5913f438a33"/></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="e2d9d8157b6eff3760cde5f83d5acc05"/><file name="system.xml" hash="5dc985a1a6219700248e59678a6c7ba8"/></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="7fd9a20a48223f10708543c59a4d7eb7"/></dir><dir name="template"><dir name="mercadopago"><dir name="calculator"><file name="calculatorForm.phtml" hash="f534542c9235cec5bb3480594fac4ed8"/><file name="calculatorLink.phtml" hash="3e99a37084c7252faedf6e6ec0a7e37d"/></dir><file name="clean.phtml" hash="fc92035839e69f52192eb9c3063a6864"/><dir name="custom"><file name="form.phtml" hash="981b6663132d79c32c2cc02dd33d650d"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="secondCard.phtml" hash="7ec27b4a932891162c7a010a94d6389f"/><file name="success.phtml" hash="aad02aca4abe256e3c628580b0e7642c"/></dir><dir name="custom_ticket"><file name="form.phtml" hash="ffee68c42d8bdfdd983466c504ec57f5"/><file name="info.phtml" hash="ab580075fca55962463cbb17628b736d"/><file name="success.phtml" hash="17a8e81b84431e61bbf2d5d45740da91"/></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="d5ea2d68325978b7c559599c47bb4237"/><file name="info.phtml" hash="70a72da32d8d0a952bb6bf3e21df1100"/><file name="pay.phtml" hash="3e3b83363e355778b98908847a56ab28"/><file name="success.phtml" hash="07a248b28e8465861d2b6ab7e43cbf45"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="MercadoPago_Core.csv" hash="2b70b9e9af320dc6fab96edee71283e7"/></dir><dir name="es_AR"><file name="MercadoPago_Core.csv" hash="8a188e51bbb2aba4f4c5901858680f5d"/></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="56fbba55012372b29d6052d8a70234d4"/><file name="mercadopago_calculator.js" hash="05c76965e58be631fb3a1f5ffe25bdde"/><file name="mercadopago_osc.js" hash="190e0d2aaf0e0957be4a1ea8cc68b1b5"/><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-calculator.css" hash="bf0ceced0fe34d9394b779fff081d86c"/><file name="style-success.css" hash="6e7b8fd0bf1b17a5804b5466e9cd4b89"/><file name="style.css" hash="bb9daeef706eb11a0e8e49eabe03a563"/></dir><dir name="images"><file name="loading.gif" hash="5c43434f066c2fbc4714c768b8f83853"/><file name="logo.png" hash="460a0815c67a23da265f42c8bab0842a"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="MercadoPago"><dir name="Lib"><file name="Api.php" hash="7149abfb4a2e07522fd99d2a3934c894"/><file name="RestClient.php" hash="13d49937d6ba8b7e245179c74a762940"/></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></contents>
170
  <compatible/>
171
  <dependencies><required><php><min>5.4.0</min><max>5.5.37</max></php></required></dependencies>
172
  </package>
skin/frontend/base/default/mercadopago/css/style-calculator.css ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mercadopago-popup {
2
+ position: relative;
3
+ z-index: 9999;
4
+ }
5
+
6
+ .mercadopago-popup-overlay {
7
+ background: gray;
8
+ bottom: 0;
9
+ left: 0;
10
+ opacity: 0.5;
11
+ position: fixed;
12
+ right: 0;
13
+ top: 0;
14
+ z-index: 9991;
15
+ }
16
+
17
+ .mercadopago-popup main {
18
+ background: white;
19
+ -webkit-border-radius: 5px;
20
+ -moz-border-radius: 5px;
21
+ -ms-border-radius: 5px;
22
+ -o-border-radius: 5px;
23
+ border-radius: 5px;
24
+ -webkit-box-shadow: 0 0 5px 0 rgba(0,0,0,0.5);
25
+ -moz-box-shadow: 0 0 5px 0 rgba(0,0,0,0.5);
26
+ box-shadow: 0 0 5px 0 rgba(0,0,0,0.5);
27
+ left: 50%;
28
+ max-height: 80%;
29
+ overflow: auto;
30
+ padding: 15px 20px 10px;
31
+ position: fixed;
32
+ text-align: left;
33
+ top: 10%;
34
+ transform: translateX(-50%);
35
+ width: 500px;
36
+ z-index: 9992;
37
+ }
38
+
39
+ .mercadopago-popup .btn-close-popup {
40
+ cursor: pointer;
41
+ padding: 0 5px;
42
+ position: absolute;
43
+ right: 10px;
44
+ top: 10px;
45
+ }
46
+
47
+ .order-profile-app-wrapper .loading-overlay {
48
+ background: gray;
49
+ bottom: 0;
50
+ display: none;
51
+ left: 0;
52
+ opacity: 0.5;
53
+ position: fixed;
54
+ right: 0;
55
+ top: 0;
56
+ z-index: 999;
57
+ }
58
+
59
+ .order-profile-app-wrapper.loading .loading-overlay {
60
+ display: block;
61
+ }
62
+
63
+ .mercadopago-popup h3 {
64
+ color: #3399cc;
65
+ }
66
+
67
+ .columns {
68
+ display: table;
69
+ }
70
+
71
+ .cards-column,
72
+ .data-column {
73
+ display: table-cell;
74
+ vertical-align: top;
75
+ }
76
+
77
+ .cards-column {
78
+ min-width: 110px;
79
+ }
80
+
81
+ .data-column {
82
+ background: #F7F7F7;
83
+ padding: 0 20px;
84
+ position: relative;
85
+ width: 100%;
86
+ }
87
+
88
+ #op-payment-cards-list li {
89
+ display: block;
90
+ border-bottom: 1px solid #F7F7F7;
91
+ }
92
+
93
+ #op-payment-cards-list li:first-child {
94
+ border-top: 1px solid #F7F7F7;
95
+ }
96
+
97
+ #op-payment-cards-list li.selected {
98
+ background: #F7F7F7;
99
+ }
100
+
101
+ #op-payment-cards-list li label {
102
+ cursor: pointer;
103
+ padding: 5px;
104
+ width: 100%;
105
+ }
106
+
107
+ #op-payment-cards-list li input,
108
+ #op-payment-cards-list li img {
109
+ cursor: pointer;
110
+ display: inline-block;
111
+ vertical-align: middle;
112
+ }
113
+
114
+ #paymentCost {}
115
+
116
+ #paymentCost label {
117
+ display: inline-block;
118
+ width: 45px;
119
+ }
120
+
121
+ #op-bank-select {
122
+
123
+ }
124
+
125
+ #op-bank-select select {
126
+ display: inline-block;
127
+ margin-right: -2px;
128
+ width: 260px;
129
+ }
130
+
131
+ #op-bank-select,
132
+ .op-installments {
133
+ border-bottom: 1px solid #FFFFFF;
134
+ overflow: hidden;
135
+ padding: 20px 0;
136
+ }
137
+
138
+ #installmentSelect {
139
+ min-width: 40px;
140
+ }
141
+
142
+ #installmentsPrice {
143
+ color: #3399cc;
144
+ font-size: 24px;
145
+ font-weight: bold;
146
+ line-height: 14px;
147
+ }
148
+
149
+ #installmentsPrice sup {
150
+ font-size: 14px;
151
+ top: -8px;
152
+ }
153
+
154
+ .op-installments > * {
155
+ display: inline-block;
156
+ vertical-align: middle;
157
+ }
158
+
159
+ .op-price,
160
+ .op-installments-free-text {
161
+ float: left;
162
+ }
163
+
164
+ .op-installments-free-text {
165
+ font-family: Raleway, Arial;
166
+ margin-left: 10px;
167
+ }
168
+
169
+ .op-submit {
170
+ padding: 10px 0;
171
+ text-align: right;
172
+ }
173
+
174
+ #costTransparentPrices {
175
+ bottom: 15px;
176
+ color: #999999;
177
+ display: inline-block;
178
+ font-family: Arial;
179
+ line-height: 1;
180
+ position: absolute;
181
+ }
182
+
183
+ .op-installments-primary-options {
184
+ float: left;
185
+ font-size: 30px;
186
+ margin-right: 10px;
187
+ }
188
+
189
+ .op-installments-secondary-options {
190
+ float: left;
191
+ font-family: Arial;
192
+ font-size: 11px;
193
+ }
194
+
195
+ .op-installments-secondary-options .op-installments-section {
196
+ margin: 3px 0;
197
+ }
198
+
199
+ @media screen and (max-width: 767px) {
200
+ .mercadopago-popup main {
201
+ max-height: 90%;
202
+ padding: 15px 10px 10px;
203
+ top: 5%;
204
+ width: 310px;
205
+ }
206
+
207
+ .mercadopago-popup .btn-close-popup {
208
+ right: 5px;
209
+ top: 5px;
210
+ }
211
+
212
+ .mercadopago-popup h2 {
213
+ font-size: 18px;
214
+ }
215
+
216
+ .mercadopago-popup h3 {
217
+ font-size: 14px;
218
+ }
219
+
220
+ .cards-column {
221
+ min-width: 85px;
222
+ }
223
+
224
+ .data-column {
225
+ padding: 0 10px;
226
+ }
227
+
228
+ #paymentCost label {
229
+ padding-bottom: 5px;
230
+ width: 100%;
231
+ }
232
+
233
+ #op-bank-select select {
234
+ width: 100%;
235
+ }
236
+
237
+ .pay-box label {
238
+ width: 100%;
239
+ }
240
+
241
+ .op-installments {
242
+ border-bottom: none;
243
+ }
244
+
245
+ .op-price-box {
246
+ margin: 5px 0 -5px;
247
+ width: 120px;
248
+ }
249
+
250
+ .op-price,
251
+ .op-installments-free-text {
252
+ float: none;
253
+ margin-left: 0;
254
+ }
255
+
256
+ .op-submit {
257
+ padding: 0;
258
+ }
259
+
260
+ .op-submit .button {
261
+ width: 100%;
262
+ }
263
+
264
+ .op-installments-secondary-options {
265
+ float: none;
266
+ }
267
+
268
+ .op-installments-secondary-options .op-installments-section {
269
+ display: inline-block;
270
+ }
271
+
272
+ .op-installments-secondary-options .op-installments-section:first-child:after {
273
+ content: '/';
274
+ display: inline-block;
275
+ }
276
+ }
skin/frontend/base/default/mercadopago/css/style-success.css CHANGED
@@ -1,4 +1,9 @@
1
  /* Styles for success page */
 
 
 
 
 
2
 
3
  .mercadopago-title{
4
  margin: 0 0 10px 0;
@@ -46,11 +51,30 @@
46
 
47
  #logo-mercadopago{
48
  width: 100px;
 
49
  margin: 20px 0;
50
- float: left;
 
 
51
  }
52
-
53
  #logo-mercadopago img{
54
- float: left;
55
  width: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  }
1
  /* Styles for success page */
2
+ #box-mercadopago, #logo-mercadopago{
3
+ padding: 0;
4
+ text-align: center;
5
+ }
6
+
7
 
8
  .mercadopago-title{
9
  margin: 0 0 10px 0;
51
 
52
  #logo-mercadopago{
53
  width: 100px;
54
+ /*
55
  margin: 20px 0;
56
+ */
57
+ /*float: left;*/
58
+ margin: 20px auto;
59
  }
 
60
  #logo-mercadopago img{
61
+ /* float: left;*/
62
  width: 100%;
63
+ }
64
+
65
+
66
+ #payment-info-text p{
67
+ text-transform: capitalize;
68
+ line-height: 22px;
69
+ }
70
+
71
+ p + #btn-boleto-mercadopago{
72
+ margin-top: 15px;
73
+ }
74
+
75
+ #logo-mercadopago + .buttons-set{
76
+ text-align: center!important;
77
+ }
78
+ .button-success > button{
79
+ float: none!important;
80
  }
skin/frontend/base/default/mercadopago/css/style.css CHANGED
@@ -4,21 +4,103 @@
4
  *
5
  */
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  #mercadopago_checkout_custom ul li{
8
- float: left;
9
  width: 100%;
10
  }
11
 
12
- #mercadopago_checkout_custom ul li label{
13
- width: 100%;
 
 
 
 
 
14
  float: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
- #mercadopago_checkout_custom ul li input, #mercadopago_checkout_custom ul li select{
18
- height: 20px;
 
 
19
  }
20
 
21
- #cardId{
 
 
 
 
 
22
  background-position: 93% 50% !important;
23
  height: 25px !important;
24
  background-color: #fff !important;
@@ -29,53 +111,154 @@
29
  width: 225px;
30
  background-color: #fff !important;
31
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- #cardholderName{
34
  width: 160px;
35
  }
36
 
37
- #securityCode, #securityCodeOCP{
38
- width: 53px;
 
 
 
39
  }
40
 
41
- #securityCodeOCP__mp{
42
- margin: 0 0 -10px;
43
  }
44
 
45
- #docNumber{
46
- width: 106px;
 
 
 
 
 
 
47
  }
48
 
49
- #box_month, #box_year{
50
- width: 130px;
51
  float: left;
52
  }
53
 
54
- #box_month select, #box_year select{
55
- width: 130px;
56
  }
57
 
58
- #box_month{
 
 
 
 
59
  margin: 0 5px 0 0;
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  .message-error{
64
  display: none;
65
  }
66
 
67
-
68
  #mercadopago_checkout_custom_ticket .form-mercadopago{
69
  padding-left: 0px;
70
  }
71
 
72
  .action_ocp{
73
  cursor: pointer;
74
- width: 160px;
75
  }
76
 
77
- #return_list_card_mp{
78
- display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  /*
@@ -106,8 +289,6 @@
106
  margin: 40px 0 0 0;
107
  }
108
 
109
-
110
-
111
  .btn-boleto{
112
  font-family: 'Lato',sans-serif;
113
  font-weight: 400;
@@ -131,16 +312,19 @@
131
  font-size: 20px;
132
  }
133
 
134
- /*
135
- *
136
- *
137
- */
138
-
139
  #standard_banner_checkout{
140
  width: 100%;
141
  float: left;
142
  }
143
 
 
 
 
 
 
 
 
 
144
 
145
  @media screen and (max-width: 500px) {
146
  .banner_checkout_mp{
@@ -185,14 +369,12 @@
185
  }
186
  }
187
 
188
-
189
-
190
- #mercadopago-loading{
191
- display: none;
192
- margin: -5px 0 10px 0;
193
- float: left;
194
- width: 100%;
195
  }
 
196
  .msg-status{
197
  display: none;
198
  }
@@ -271,6 +453,55 @@
271
  }
272
 
273
  .banner_checkout_mp {
 
274
  max-width:100%;
275
  max-height:100%;
276
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  *
5
  */
6
 
7
+ #payment_form_mercadopago_custom{
8
+ margin: 20px;
9
+ padding: 0;
10
+ position: relative;
11
+ }
12
+
13
+ #mercadopago_checkout_custom {
14
+ position: relative;
15
+ }
16
+
17
+ #mercadopago-loading {
18
+ display: none;
19
+ position: absolute;
20
+ top: 50%;
21
+ left: 50%;
22
+ transform: translateX(-50%);
23
+ }
24
+
25
  #mercadopago_checkout_custom ul li{
26
+ overflow: hidden;
27
  width: 100%;
28
  }
29
 
30
+ #mercadopago_checkout_custom .card-form {
31
+ border: 1px solid #cccccc;
32
+ overflow: hidden;
33
+ padding: 15px;
34
+ }
35
+
36
+ #mercadopago_checkout_custom .card-form.first-card {
37
  float: left;
38
+ width: 49.2%;
39
+ }
40
+
41
+ #mercadopago_checkout_custom #second_card_fieldset {
42
+ float: right;
43
+ position: relative;
44
+ width: 49.2%;
45
+ }
46
+
47
+ #mercadopago_checkout_custom ul li label{
48
+ padding: 5px 0;
49
+ font-size: 14px;
50
+ }
51
+
52
+ #mercadopago_checkout_custom ul li input,
53
+ #mercadopago_checkout_custom ul li select{
54
+ background-color: #FFFFFF;
55
+ height: 25px;
56
+ }
57
+
58
+ #mercadopago_checkout_custom ul li select.full-width {
59
+ display: block;
60
+ }
61
+
62
+ #first_card_amount_fields,
63
+ #secondCardAmount {
64
+ margin-bottom: 10px;
65
+ white-space: nowrap;
66
+ }
67
+
68
+ #first_card_amount {
69
+ width: 120px;
70
+ }
71
+
72
+ #cardId {
73
+ background-position: 93% 50% !important;
74
+ }
75
+
76
+ .total_buy{
77
+ margin-left: 10px;
78
+ }
79
+
80
+ .total_buy_price{
81
+ font-size: 14px;
82
+ padding-top: 6px;
83
+ display: inline-block;
84
+ color: #900;
85
+ }
86
+
87
+ .second_card_total_buy {
88
+ clear: both;
89
+ margin-left: 10px;
90
  }
91
 
92
+ .second_card_total_buy span{
93
+ font-size: 14px;
94
+ display: inline-block;
95
+ color: #900;
96
  }
97
 
98
+ .ch-form-hint{
99
+ color: #999;
100
+ font-size: 12px;
101
+ }
102
+
103
+ #second_card_cardId{
104
  background-position: 93% 50% !important;
105
  height: 25px !important;
106
  background-color: #fff !important;
111
  width: 225px;
112
  background-color: #fff !important;
113
  }
114
+ #second_card_cardNumber{
115
+ background-position: 98% 50% !important;
116
+ width: 225px;
117
+ background-color: #fff !important;
118
+ }
119
+
120
+ #second_card_amount{
121
+ border: none;
122
+ color: #900;
123
+ display: inline-block;
124
+ font-size: 14px;
125
+ padding: 0;
126
+ white-space: nowrap;
127
+ width: 90px;
128
+ }
129
+
130
+ #second_card_amount_holder{
131
+ font-size: 14px;
132
+ color: #900;
133
+ }
134
+
135
+ #hide_second_card{
136
+ float:right;
137
+ }
138
 
139
+ #cardholderName, #second_card_cardholderName{
140
  width: 160px;
141
  }
142
 
143
+ #securityCode, #securityCodeOCP, #second_card_securityCodeOCP, #second_card_securityCode{
144
+ width: 53px !important;
145
+ }
146
+ #second_card_securityCodeOCP__mp{
147
+ margin-bottom: 6px;
148
  }
149
 
150
+ #second_card_payment {
151
+ margin: 0;
152
  }
153
 
154
+ #cardExpirationMonth, #cardExpirationMonthLabel, #cardExpirationYearLabel, #cardExpirationYear{
155
+ display: inline-block;
156
+ }
157
+
158
+ .expiration-date-box {
159
+ display: inline-block;
160
+ margin-top: -2px;
161
+ vertical-align: top;
162
  }
163
 
164
+ #box_month, #second_card_box_month, #box_year, #second_card_box_year{
 
165
  float: left;
166
  }
167
 
168
+ #box_month select, #second_card_box_month select{
169
+ width: 140px;
170
  }
171
 
172
+ #box_year select, #second_card_box_year select{
173
+ width: 80px;
174
+ }
175
+
176
+ #box_month, #second_card_box_month{
177
  margin: 0 5px 0 0;
178
  }
179
 
180
+ #docType, #second_card_docType{
181
+ display: inline-block !important;
182
+ }
183
+
184
+ #mercadopago_checkout_custom_card {
185
+ overflow: hidden;
186
+ }
187
+
188
+ #doc_type__mp, #second_card_doc_type__mp {
189
+ margin-right: 5px;
190
+ padding-bottom: 1px;
191
+ width: auto !important;
192
+ }
193
+
194
+ #doc_number__mp, #second_card_doc_number__mp {
195
+ margin: 35px 0 0;
196
+ padding-bottom: 1px;
197
+ width: auto !important;
198
+ }
199
+
200
+ #doc_type__mp, #doc_number__mp, #second_card_doc_type__mp, #second_card_doc_number__mp {
201
+ float: left;
202
+ }
203
+
204
+ #doc_type__mp label, #second_card_doc_type__mp label {
205
+ display: block;
206
+ }
207
+
208
+ #doc_type__mp select, #second_card_doc_type__mp select {
209
+ width: 80px;
210
+ }
211
+
212
+ #doc_number__mp input, #second_card_doc_number__mp input {
213
+ width: 100px;
214
+ }
215
 
216
  .message-error{
217
  display: none;
218
  }
219
 
 
220
  #mercadopago_checkout_custom_ticket .form-mercadopago{
221
  padding-left: 0px;
222
  }
223
 
224
  .action_ocp{
225
  cursor: pointer;
226
+ width: 180px;
227
  }
228
 
229
+ #mercadopago_checkout_custom .button {
230
+ margin-bottom: 10px;
231
+ }
232
+
233
+ #mercadopago_checkout_custom #hide_second_card {
234
+ position: absolute;
235
+ top: 15px;
236
+ right: 15px;
237
+ width: 25px;
238
+ }
239
+
240
+ #use_other_card_mp:hover, #show_second_card:hover, #show_second_card:hover, #second_card_use_other_card_mp:hover {
241
+ text-decoration: none;
242
+ }
243
+
244
+ .second_card_total_buy_price, .total_buy_price {
245
+ padding: 3px 10px;
246
+ font-weight: 600;
247
+ text-decoration: underline;
248
+ vertical-align: middle;
249
+ }
250
+
251
+ .second_card_total_buy label {
252
+ font-weight: bold;
253
+ }
254
+
255
+ #hide_second_card {
256
+ padding: 3px 6px;
257
+ line-height: 1;
258
+ }
259
+
260
+ #hide_second_card:hover {
261
+ text-decoration: none;
262
  }
263
 
264
  /*
289
  margin: 40px 0 0 0;
290
  }
291
 
 
 
292
  .btn-boleto{
293
  font-family: 'Lato',sans-serif;
294
  font-weight: 400;
312
  font-size: 20px;
313
  }
314
 
 
 
 
 
 
315
  #standard_banner_checkout{
316
  width: 100%;
317
  float: left;
318
  }
319
 
320
+ @media screen and (max-width: 680px) {
321
+ #mercadopago_checkout_custom .card-form.first-card,
322
+ #mercadopago_checkout_custom #second_card_fieldset {
323
+ float: none;
324
+ width: 100%;
325
+ }
326
+ }
327
+
328
 
329
  @media screen and (max-width: 500px) {
330
  .banner_checkout_mp{
369
  }
370
  }
371
 
372
+ @media screen and (max-width: 360px) {
373
+ #payment_form_mercadopago_custom {
374
+ margin: 0;
375
+ }
 
 
 
376
  }
377
+
378
  .msg-status{
379
  display: none;
380
  }
453
  }
454
 
455
  .banner_checkout_mp {
456
+ margin: 21px 0 -8px;
457
  max-width:100%;
458
  max-height:100%;
459
  }
460
+
461
+ .show_second_card {
462
+ display: none;
463
+ }
464
+
465
+ .show_second_card_button {
466
+ display: none !important;
467
+ }
468
+
469
+ .legal-info {
470
+ margin-top: 10px;
471
+ }
472
+
473
+ .tea-info,
474
+ .cft-info {
475
+ color: #A0A0A0;
476
+ margin: 0 !important;
477
+ padding: 0 5px;
478
+ }
479
+
480
+ .cft-info {
481
+ font-size: 35px;
482
+ line-height: 1;
483
+ }
484
+
485
+ .onstepcheckout-mercadopago #doc_number__mp {
486
+ margin-top: 31px;
487
+ }
488
+
489
+ .onstepcheckout-mercadopago #installments__mp {
490
+ padding-bottom: 1px;
491
+ }
492
+
493
+ .onstepcheckout-mercadopago #payment_form_mercadopago_custom > li {
494
+ margin: 0;
495
+ }
496
+
497
+ #mercadopago_calculator_link {
498
+ display: block;
499
+ margin: 5px 0 15px;
500
+ }
501
+
502
+ #mercadopago_calculator_link a,
503
+ #mercadopago_calculator_link p,
504
+ #mercadopago_calculator_link img {
505
+ display: inline-block;
506
+ vertical-align: middle;
507
+ }
skin/frontend/base/default/mercadopago/images/logo.png ADDED
Binary file