Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #195 from PluginAndPartners/main
Browse files Browse the repository at this point in the history
Release 3.17.1
  • Loading branch information
katelucena-meli authored Aug 15, 2022
2 parents b04f03a + 6f229cf commit 40cde6a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.17.1] - 2022-08-16

### Fixed
- Inserted logic to force cardform to remount after updating grand total in checkout

## [3.17.0] - 2022-07-04

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</a>
</p>

# Magento 2 - Mercado Pago Module (v3.17.0)
# Magento 2 - Mercado Pago Module (v3.17.1)

The Mercado Pago plugin for Magento 2 allows you to expand the functionalities of your online store and offer a unique payment experience for your customers.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
],
"type": "magento2-module",
"version": "3.17.0",
"version": "3.17.1",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion src/MercadoPago/Core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mercadopago/core",
"description": "Mercado Pago Magento 2 Plugin",
"type": "magento2-module",
"version": "3.17.0",
"version": "3.17.1",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion src/MercadoPago/Core/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MercadoPago_Core" setup_version="3.17.0">
<module name="MercadoPago_Core" setup_version="3.17.1">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
22 changes: 17 additions & 5 deletions src/MercadoPago/Core/view/frontend/web/js/CreditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

var mp = null;
var mpCardForm = null;

var mpRemountCardForm = false;

window.initCardForm = function (pk, quote, processMode, country, customMethod) {
mp = new MercadoPago(pk);
Expand Down Expand Up @@ -34,9 +34,15 @@
onFormUnmounted: error => {
if (error) return console.warn('FormMounted handling error: ', error);
fullClearInputs()
setTimeout(() => {
initCardForm(pk, quote, processMode, country, customMethod)
}, 5000);

if (mpRemountCardForm) {
initCardForm(pk, quote, processMode, country, customMethod);
mpRemountCardForm = false;
} else {
setTimeout(() => {
initCardForm(pk, quote, processMode, country, customMethod)
}, 5000);
}
},
onIdentificationTypesReceived: (error, identificationTypes) => {
if (error) return console.warn('IdentificationTypes handling error: ', error);
Expand Down Expand Up @@ -73,6 +79,11 @@
});
}

window.mpRemountCardForm = function () {
mpRemountCardForm = true;
mpCardForm.unmount();
}

window.mpDeleteCardForm = function () {
mpCardForm.unmount()
}
Expand Down Expand Up @@ -194,7 +205,8 @@
window.fullClearInputs = function () {
clearInputs()
document.getElementById('mpCardNumber').value = '';
document.getElementById("mpInstallments").value = ''
document.getElementById("mpInstallments").value = '';
document.getElementById("mpInstallments").innerHTML = '';
}

window.validateFixedInputs = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ define(
) {
'use strict';



return Component.extend({
defaults: {
template: 'MercadoPago_Core/payment/custom_method'
Expand All @@ -49,6 +47,7 @@ define(

initApp: function () {
if (window.checkoutConfig.payment[this.getCode()] !== undefined) {
quote.totals.subscribe(this.totalsObserver.bind(this));
setChangeEventOnCardNumber();
setChangeEventExpirationDate();
initCardForm(
Expand All @@ -61,6 +60,13 @@ define(
}
},

totalsObserver: function() {
if (quote.totals().base_grand_total !== this.priceOnSelect) {
this.priceOnSelect = quote.totals().base_grand_total;
mpRemountCardForm();
}
},

toogleWalletButton: function () {
var existsScriptTag = document.querySelector('#wallet_purchase');
var existsSubmit = document.querySelector('.mercadopago-button');
Expand Down

0 comments on commit 40cde6a

Please sign in to comment.