From 602bd241c1ec479a2c6203adfa925f034ff2046e Mon Sep 17 00:00:00 2001 From: Mercado Pago Date: Mon, 29 Jul 2024 18:19:18 +0000 Subject: [PATCH] Release v7.6.3 --- .gitignore | 2 +- CHANGELOG.md | 12 +++++++++++ assets/js/checkouts/custom/mp-custom-page.js | 4 ++-- .../js/checkouts/custom/mp-custom-page.min.js | 2 +- changelog.log | 12 +++++++++++ composer.json | 4 ++-- composer.lock | 14 ++++++------- package.json | 2 +- qit-env.sample.yml | 6 ++++++ readme.txt | 7 ++++--- src/Dependencies.php | 4 ++-- src/Gateways/AbstractGateway.php | 6 ++++-- src/Helpers/Numbers.php | 16 +++++++++++++++ src/IO/Downloader.php | 20 +++++++++++++------ src/WoocommerceMercadoPago.php | 2 +- woocommerce-mercadopago.php | 4 ++-- 16 files changed, 87 insertions(+), 30 deletions(-) create mode 100644 qit-env.sample.yml diff --git a/.gitignore b/.gitignore index 25c7234f1..6f9bdc24d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ coverage woocommerce-mercadopago.zip -qit-env.json +qit-env.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index fa49a2447..fa93fc645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ 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). +## [7.6.3] - 2024-07-29 +### Fix: +- Fix the size of the card logos at checkout. +- Fix the problem of not showing the disclaimer about card fees for some countries. + +## [7.6.2] - 2024-07-16 +### Added: +- Added validation on user permissions to download plugin logs. +- Increased plugin wordpress tested version to the latest available. +### Fix: +- Addressed an issue where discount and commission calculations were not being shown correctly on order details. + ## [7.6.1] - 2024-06-26 ### Fix: - Addressed an funnel metrics issue diff --git a/assets/js/checkouts/custom/mp-custom-page.js b/assets/js/checkouts/custom/mp-custom-page.js index 32144d932..3d7140202 100644 --- a/assets/js/checkouts/custom/mp-custom-page.js +++ b/assets/js/checkouts/custom/mp-custom-page.js @@ -21,7 +21,7 @@ const CheckoutPage = { this.setBackground('fcCardNumberContainer', 'url(' + secureThumbnail + ') 98% 50% no-repeat #fff'); document .querySelector(CheckoutElements.fcCardNumberContainer) - .style.setProperty('background-size', 'auto 32px', 'important'); + .style.setProperty('background-size', 'auto', 'important'); }, findContainerField(field) { @@ -337,7 +337,7 @@ const CheckoutPage = { }, getBankInterestDisclaimerCountries(siteId) { - return siteId === 'mlc' || siteId === 'mco' || siteId === 'mpe'; + return siteId.toUpperCase() === 'MLC' || siteId.toUpperCase() === 'MCO' || siteId.toUpperCase() === 'MPE'; }, getInstallments(response, bankInterestDisclaimer) { diff --git a/assets/js/checkouts/custom/mp-custom-page.min.js b/assets/js/checkouts/custom/mp-custom-page.min.js index 45a0d08a1..4743da000 100644 --- a/assets/js/checkouts/custom/mp-custom-page.min.js +++ b/assets/js/checkouts/custom/mp-custom-page.min.js @@ -1 +1 @@ -const CheckoutPage={setElementDisplay(e,t){document.querySelector(CheckoutElements[e]).style.display=t},setText(e,t){document.querySelector(CheckoutElements[e]).innerHTML=t},setValue(e,t){document.querySelector(CheckoutElements[e]).value=t},setBackground(e,t){document.querySelector(CheckoutElements[e]).style.setProperty("background",t,"important")},setImageCard(e){this.setBackground("fcCardNumberContainer","url("+e+") 98% 50% no-repeat #fff"),document.querySelector(CheckoutElements.fcCardNumberContainer).style.setProperty("background-size","auto 32px","important")},findContainerField(e){let t="cardholderName"===e?`#form-checkout__${e}`:`#form-checkout__${e}-container`;return Object.keys(CheckoutElements).find((e=>CheckoutElements[e]===t))},setDisplayOfError(e,t,n,r="customContent"){let s=document.querySelector(CheckoutElements[r]).querySelector(CheckoutElements[e]);s&&("add"===t?s.classList.add(`${n}`):s.classList.remove(`${n}`))},setDisplayOfInputHelper(e,t,n="customContent"){let r=document.querySelector(CheckoutElements[n]).querySelector(`input-helper[input-id=${e}-helper]`);if(r){r.querySelector("div").style.display=t}},setCvvHint(e){var t=wc_mercadopago_custom_checkout_params.cvvText;t=`${e.length} ${t} `,t+=this.cvvLocationTranslate(e.card_location),this.setText("mpSecurityCodeInfo",t)},cvvLocationTranslate(e){let t=wc_mercadopago_custom_checkout_params.cvvHint.front,n=wc_mercadopago_custom_checkout_params.cvvHint.back;return"back"===e?n:t},additionalInfoHandler(e){e.cardholder_name?this.setElementDisplay("fcCardholderName","block"):this.setElementDisplay("fcCardholderName","none"),e.issuer?this.setElementDisplay("mpIssuerContainer","block"):this.setElementDisplay("mpIssuerContainer","none"),e.cardholder_identification_type&&e.cardholder_identification_number?this.setElementDisplay("mpDocumentContainer","block"):this.setElementDisplay("mpDocumentContainer","none")},getCountry:()=>wc_mercadopago_custom_checkout_params.site_id,changeCvvPlaceHolder(e){let t="";for(let n=0;nnew Intl.NumberFormat(wc_mercadopago_custom_checkout_params.intl,{currency:wc_mercadopago_custom_checkout_params.currency,style:"currency",currencyDisplay:"narrowSymbol"}).format(e),inputHelperName:e=>({cardNumber:CheckoutElements.mpCardNumber,cardholderName:CheckoutElements.mpCardholderName,expirationDate:CheckoutElements.mpExpirationDate,securityCode:CheckoutElements.mpSecurityCode,identificationNumber:CheckoutElements.mpIdentificationNumber}[e]),removeAdditionFields(){this.setElementDisplay("mpDocumentContainer","none"),this.setElementDisplay("mpInstallments","none"),this.setElementDisplay("mpIssuerContainer","none"),this.setDisplayOfInputHelper("installments","none"),this.setValue("cardInstallments","")},clearInstallmentsComponent(){const e=document.querySelector(CheckoutElements.mpInstallmentsContainer);e.classList.remove(CheckoutElements.mpInstallmentsContainer),e.firstElementChild&&e.removeChild(e.firstElementChild)},showInstallmentsComponent(e){const t=document.querySelector(CheckoutElements.mpInstallmentsContainer);t.classList.add(CheckoutElements.mpInstallmentsContainer),t.appendChild(e)},getHelperMessage(e){let t="input-helper[input-id="+this.inputHelperName(e)+"-helper]";return document.querySelector(t).querySelector("div[class=mp-helper-message]")},argentinaResolution(e){let t="";if("MLA"===this.getCountry())for(let n=0;n{e.querySelector("div").style.display="none"}))},clearInputs(){this.hideErrors(),this.setBackground("fcCardNumberContainer","no-repeat #fff"),this.setValue("fcCardholderName",""),this.setDisplayOfError("fcCardholderName","removed","mp-error"),this.setValue("fcCardExpirationDateContainer",""),this.setDisplayOfError("fcCardExpirationDateContainer","removed","mp-error"),this.setValue("fcSecurityNumberContainer",""),this.setDisplayOfError("fcSecurityNumberContainer","removed","mp-error"),this.setValue("fcIdentificationNumber",""),this.setElementDisplay("mpDocumentContainer","none"),this.setDisplayOfError("fcIdentificationNumberContainer","removed","mp-error"),this.clearInstallmentsComponent(),this.setElementDisplay("mpInstallments","none"),document.querySelector("input[data-cy=input-document]").value=""},verifyDocument(){let e=document.querySelector(CheckoutElements.fcIdentificationNumber),t=document.querySelector(CheckoutElements.mpDocumentContainer);return"none"===t.style.display||""===t.style.display||"-1"!==e.value&&""!==e.value&&"flex"!==document.querySelector("input-helper[input-id=mp-doc-number-helper]").querySelector("div").style.display},loadAdditionalInfo(e){const t={issuer:!1,cardholder_name:!1,cardholder_identification_type:!1,cardholder_identification_number:!1};for(let n=0;n{e.checked&&(t=e.getAttribute("datarate"))}));let r="",s="";if(null!=t){const e=t.split("|");r=e[0].replace("_"," "),s=e[1].replace("_"," "),"CFT 0,00%"===r&&"TEA 0,00%"===s&&(n="none",r="",s="")}document.querySelector(CheckoutElements.mpInputTaxCft).style.display=n,document.querySelector(CheckoutElements.mpTaxCftText).innerHTML=r,document.querySelector(CheckoutElements.mpTaxTeaText).innerHTML=s},setupTaxEvents(){const e=document.querySelector(CheckoutElements.customContent).getElementsByClassName("mp-input-table-label");for(var t=0;t{CheckoutPage.setDisplayOfError("fcInputTableContainer","remove","mp-error"),this.setDisplayOfInputHelper("mp-installments","none"),this.setValue("fcInstallments",n),this.setValue("cardInstallments",n)}))}},getBankInterestDisclaimerCountries:e=>"mlc"===e||"mco"===e||"mpe"===e,getInstallments(e,t){let n=[];const r=[];this.clearInstallmentsComponent(),n=e.payer_costs,n&&this.setElementDisplay("mpInstallments","block");for(let e=0;e{setTimeout((()=>{this.setupTaxEvents()}),300)})),"mla"===e&&this.clearTax()}}; \ No newline at end of file +const CheckoutPage={setElementDisplay(e,t){document.querySelector(CheckoutElements[e]).style.display=t},setText(e,t){document.querySelector(CheckoutElements[e]).innerHTML=t},setValue(e,t){document.querySelector(CheckoutElements[e]).value=t},setBackground(e,t){document.querySelector(CheckoutElements[e]).style.setProperty("background",t,"important")},setImageCard(e){this.setBackground("fcCardNumberContainer","url("+e+") 98% 50% no-repeat #fff"),document.querySelector(CheckoutElements.fcCardNumberContainer).style.setProperty("background-size","auto","important")},findContainerField(e){let t="cardholderName"===e?`#form-checkout__${e}`:`#form-checkout__${e}-container`;return Object.keys(CheckoutElements).find((e=>CheckoutElements[e]===t))},setDisplayOfError(e,t,n,r="customContent"){let s=document.querySelector(CheckoutElements[r]).querySelector(CheckoutElements[e]);s&&("add"===t?s.classList.add(`${n}`):s.classList.remove(`${n}`))},setDisplayOfInputHelper(e,t,n="customContent"){let r=document.querySelector(CheckoutElements[n]).querySelector(`input-helper[input-id=${e}-helper]`);if(r){r.querySelector("div").style.display=t}},setCvvHint(e){var t=wc_mercadopago_custom_checkout_params.cvvText;t=`${e.length} ${t} `,t+=this.cvvLocationTranslate(e.card_location),this.setText("mpSecurityCodeInfo",t)},cvvLocationTranslate(e){let t=wc_mercadopago_custom_checkout_params.cvvHint.front,n=wc_mercadopago_custom_checkout_params.cvvHint.back;return"back"===e?n:t},additionalInfoHandler(e){e.cardholder_name?this.setElementDisplay("fcCardholderName","block"):this.setElementDisplay("fcCardholderName","none"),e.issuer?this.setElementDisplay("mpIssuerContainer","block"):this.setElementDisplay("mpIssuerContainer","none"),e.cardholder_identification_type&&e.cardholder_identification_number?this.setElementDisplay("mpDocumentContainer","block"):this.setElementDisplay("mpDocumentContainer","none")},getCountry:()=>wc_mercadopago_custom_checkout_params.site_id,changeCvvPlaceHolder(e){let t="";for(let n=0;nnew Intl.NumberFormat(wc_mercadopago_custom_checkout_params.intl,{currency:wc_mercadopago_custom_checkout_params.currency,style:"currency",currencyDisplay:"narrowSymbol"}).format(e),inputHelperName:e=>({cardNumber:CheckoutElements.mpCardNumber,cardholderName:CheckoutElements.mpCardholderName,expirationDate:CheckoutElements.mpExpirationDate,securityCode:CheckoutElements.mpSecurityCode,identificationNumber:CheckoutElements.mpIdentificationNumber}[e]),removeAdditionFields(){this.setElementDisplay("mpDocumentContainer","none"),this.setElementDisplay("mpInstallments","none"),this.setElementDisplay("mpIssuerContainer","none"),this.setDisplayOfInputHelper("installments","none"),this.setValue("cardInstallments","")},clearInstallmentsComponent(){const e=document.querySelector(CheckoutElements.mpInstallmentsContainer);e.classList.remove(CheckoutElements.mpInstallmentsContainer),e.firstElementChild&&e.removeChild(e.firstElementChild)},showInstallmentsComponent(e){const t=document.querySelector(CheckoutElements.mpInstallmentsContainer);t.classList.add(CheckoutElements.mpInstallmentsContainer),t.appendChild(e)},getHelperMessage(e){let t="input-helper[input-id="+this.inputHelperName(e)+"-helper]";return document.querySelector(t).querySelector("div[class=mp-helper-message]")},argentinaResolution(e){let t="";if("MLA"===this.getCountry())for(let n=0;n{e.querySelector("div").style.display="none"}))},clearInputs(){this.hideErrors(),this.setBackground("fcCardNumberContainer","no-repeat #fff"),this.setValue("fcCardholderName",""),this.setDisplayOfError("fcCardholderName","removed","mp-error"),this.setValue("fcCardExpirationDateContainer",""),this.setDisplayOfError("fcCardExpirationDateContainer","removed","mp-error"),this.setValue("fcSecurityNumberContainer",""),this.setDisplayOfError("fcSecurityNumberContainer","removed","mp-error"),this.setValue("fcIdentificationNumber",""),this.setElementDisplay("mpDocumentContainer","none"),this.setDisplayOfError("fcIdentificationNumberContainer","removed","mp-error"),this.clearInstallmentsComponent(),this.setElementDisplay("mpInstallments","none"),document.querySelector("input[data-cy=input-document]").value=""},verifyDocument(){let e=document.querySelector(CheckoutElements.fcIdentificationNumber),t=document.querySelector(CheckoutElements.mpDocumentContainer);return"none"===t.style.display||""===t.style.display||"-1"!==e.value&&""!==e.value&&"flex"!==document.querySelector("input-helper[input-id=mp-doc-number-helper]").querySelector("div").style.display},loadAdditionalInfo(e){const t={issuer:!1,cardholder_name:!1,cardholder_identification_type:!1,cardholder_identification_number:!1};for(let n=0;n{e.checked&&(t=e.getAttribute("datarate"))}));let r="",s="";if(null!=t){const e=t.split("|");r=e[0].replace("_"," "),s=e[1].replace("_"," "),"CFT 0,00%"===r&&"TEA 0,00%"===s&&(n="none",r="",s="")}document.querySelector(CheckoutElements.mpInputTaxCft).style.display=n,document.querySelector(CheckoutElements.mpTaxCftText).innerHTML=r,document.querySelector(CheckoutElements.mpTaxTeaText).innerHTML=s},setupTaxEvents(){const e=document.querySelector(CheckoutElements.customContent).getElementsByClassName("mp-input-table-label");for(var t=0;t{CheckoutPage.setDisplayOfError("fcInputTableContainer","remove","mp-error"),this.setDisplayOfInputHelper("mp-installments","none"),this.setValue("fcInstallments",n),this.setValue("cardInstallments",n)}))}},getBankInterestDisclaimerCountries:e=>"MLC"===e.toUpperCase()||"MCO"===e.toUpperCase()||"MPE"===e.toUpperCase(),getInstallments(e,t){let n=[];const r=[];this.clearInstallmentsComponent(),n=e.payer_costs,n&&this.setElementDisplay("mpInstallments","block");for(let e=0;e{setTimeout((()=>{this.setupTaxEvents()}),300)})),"mla"===e&&this.clearTax()}}; \ No newline at end of file diff --git a/changelog.log b/changelog.log index 651bb4995..6ddf03a31 100644 --- a/changelog.log +++ b/changelog.log @@ -1,6 +1,18 @@ CHANGELOG: == Changelog == += v7.6.3 (29/07/2024) = +* Fixed: +- Fix the size of the card logos at checkout. +- Fix the problem of not showing the disclaimer about card fees for some countries. + += v7.6.2 (16/07/2024) = +* Added: +- Added validation on user permissions to download plugin logs. +- Increased plugin wordpress tested version to the latest available. +* Fixed: +- Addressed an issue where discount and commission calculations were not being shown correctly on order details. + = v7.6.1 (26/06/2024) = * Fix: - Addressed an funnel metrics issue diff --git a/composer.json b/composer.json index 7ca8c2c59..2aadf21e8 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "qit:comp": "./vendor/bin/qit run:phpcompatibility woocommerce-mercadopago --zip woocommerce-mercadopago.zip", "qit:sec": "./vendor/bin/qit run:security woocommerce-mercadopago --zip woocommerce-mercadopago.zip", "qit:api": "./vendor/bin/qit run:woo-api woocommerce-mercadopago --zip woocommerce-mercadopago.zip", - "qit:env-up": "./vendor/bin/qit env:up --config ./qit-env.json", + "qit:env-up": "./vendor/bin/qit --woo=8.9.0 env:up", "qit:env-down": "./vendor/bin/qit env:down" }, "require": { @@ -46,7 +46,7 @@ "require-dev": { "squizlabs/php_codesniffer": "^3.7", "phpmetrics/phpmetrics": "^2.8", - "woocommerce/qit-cli": "^0.5.0", + "woocommerce/qit-cli": "^0.5.3", "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "wp-coding-standards/wpcs": "^2.2.1" }, diff --git a/composer.lock b/composer.lock index ddcfd681c..81b6a340c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8b9aa5149854b2cb5986fcef018dd98f", + "content-hash": "13fcaf83d5496a4fa4e35c9150f0d908", "packages": [], "packages-dev": [ { @@ -291,16 +291,16 @@ }, { "name": "woocommerce/qit-cli", - "version": "0.5.0", + "version": "0.5.3", "source": { "type": "git", "url": "https://github.com/woocommerce/qit-cli.git", - "reference": "51e8732e33cd63156dee01c7b0ee02f0552e120b" + "reference": "a0dd5c0872a4ae540c79a625348cccfc34d255d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/qit-cli/zipball/51e8732e33cd63156dee01c7b0ee02f0552e120b", - "reference": "51e8732e33cd63156dee01c7b0ee02f0552e120b", + "url": "https://api.github.com/repos/woocommerce/qit-cli/zipball/a0dd5c0872a4ae540c79a625348cccfc34d255d5", + "reference": "a0dd5c0872a4ae540c79a625348cccfc34d255d5", "shasum": "" }, "require": { @@ -318,9 +318,9 @@ "description": "A command line interface for WooCommerce Quality Insights Toolkit (QIT).", "support": { "issues": "https://github.com/woocommerce/qit-cli/issues", - "source": "https://github.com/woocommerce/qit-cli/tree/0.5.0" + "source": "https://github.com/woocommerce/qit-cli/tree/0.5.3" }, - "time": "2024-05-10T16:48:42+00:00" + "time": "2024-06-17T22:14:51+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/package.json b/package.json index a88e68a10..c418072c5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "woocommerce-mercadopago", "description": "Woocommerce MercadoPago Payment Gateway", - "version": "7.6.1", + "version": "7.6.3", "main": "main.js", "repository": { "type": "git", diff --git a/qit-env.sample.yml b/qit-env.sample.yml new file mode 100644 index 000000000..45c36eebb --- /dev/null +++ b/qit-env.sample.yml @@ -0,0 +1,6 @@ +wp: 6.5.5 +php_version: 8.3 +themes: + - storefront +# plugins: +# - really-simple-ssl diff --git a/readme.txt b/readme.txt index 63327dbe9..42bdbd17c 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: Tags: ecommerce, mercadopago, woocommerce Requires at least: 6.3 -Tested up to: 6.5 +Tested up to: 6.6 Requires PHP: 7.4 -Stable tag: 7.6.1 +Stable tag: 7.6.3 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -137,6 +137,7 @@ Check out our