Skip to content

Commit

Permalink
Merge pull request #331 from mercadopago/release/6.7.3
Browse files Browse the repository at this point in the history
Release v6.7.3
  • Loading branch information
DouglasCorreiaMeli authored May 3, 2023
2 parents cc2e641 + 7953766 commit e6b98ff
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 62 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## [6.7.3] - 2023-05-02

### Added
- Test compatibility with WooCommerce v7.6
- Test compatibility with WordPress v6.2

### Changed
- process_nonce_validation was removed from process_payment

### Fixed
- Fix http_user_agent log using wp_is_mobile() instead regex

## [6.7.2] - 2023-03-20

### Added
Expand Down
11 changes: 11 additions & 0 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
CHANGELOG:
== Changelog ==

= v6.7.3 (02/05/2023) =
* Added
- Test compatibility with WooCommerce v7.6
- Test compatibility with WordPress v6.2

* Changed
- process_nonce_validation was removed from process_payment

* Fixed
- Fix http_user_agent log using wp_is_mobile() instead regex

= v6.7.2 (20/03/2023) =
* Added
- Add new fields in update-metadata
Expand Down
9 changes: 1 addition & 8 deletions includes/module/class-wc-woomercadopago-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,7 @@ public static function is_wc_new_version() {
* @return bool
*/
public static function is_mobile() {
$mobile = false;

$user_agent = $_SERVER['HTTP_USER_AGENT']; //phpcs:ignore
if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i', $user_agent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $user_agent, 0, 4 ) ) ) {
$mobile = true;
}

return $mobile;
return wp_is_mobile();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WC_WooMercadoPago_Constants {
const PRODUCT_ID_DESKTOP = 'BT7OF5FEOO6G01NJK3QG';
const PRODUCT_ID_MOBILE = 'BT7OFH09QS3001K5A0H0';
const PLATAFORM_ID = 'bo2hnr2ic4p001kbgpt0';
const VERSION = '6.7.2';
const VERSION = '6.7.3';
const MIN_PHP = 7.0;
const API_MP_BASE_URL = 'https://api.mercadopago.com';
const DATE_EXPIRATION = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public function payment_fields() {
*/
public function process_payment( $order_id ) {
// phpcs:ignore WordPress.Security.NonceVerification
if ( ! isset( $_POST['mercadopago_custom']) || ! $this->validate_nonce_process() ) {
if ( ! isset( $_POST['mercadopago_custom']) ) {
return $this->process_result_fail(
__FUNCTION__,
__( 'A problem was occurred when processing your payment. Please, try again.', 'woocommerce-mercadopago' ),
Expand Down
24 changes: 0 additions & 24 deletions includes/payments/class-wc-woomercadopago-payment-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,28 +1405,4 @@ public function get_valid_installments( $installments ) {
return $installments;
}

/**
* Check if a nonce is valid
*
* @return bool
*/
public function validate_nonce_process() {
$user = wp_get_current_user();
$uid = (int) $user->ID;

if ( $uid !== $this->prior_uid && WC()->checkout()->is_registration_required() ) {
return true;
}

if ( isset($_POST['woocommerce-process-checkout-nonce']) && wp_verify_nonce( sanitize_key( $_POST['woocommerce-process-checkout-nonce'] ), 'woocommerce-process_checkout' ) ) {
return true;
}

if ( isset($_POST['woocommerce-pay-nonce']) && wp_verify_nonce( sanitize_key( $_POST['woocommerce-pay-nonce'] ), 'woocommerce-pay' ) ) {
return true;
}

$this->log->write_log(__FUNCTION__, 'Security nonce check failed.');
return false;
}
}
14 changes: 0 additions & 14 deletions includes/payments/class-wc-woomercadopago-pix-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,20 +387,6 @@ public function payment_fields() {
* @return array|string[]
*/
public function process_payment( $order_id ) {
// phpcs:ignore WordPress.Security.NonceVerification
if ( ! $this->validate_nonce_process() ) {

wc_add_notice(
'<p>' .
__( 'A problem occurred when processing your payment. Please try again.', 'woocommerce-mercadopago' ) .
'</p>',
'error'
);
return array(
'result' => 'fail',
'redirect' => '',
);
}
// phpcs:ignore WordPress.Security.NonceVerification
$pix_checkout = map_deep($_POST, 'sanitize_text_field');
$this->log->write_log( __FUNCTION__, 'Payment via Pix POST: ' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public function payment_fields() {
*/
public function process_payment( $order_id ) {
// phpcs:ignore WordPress.Security.NonceVerification
if ( ! isset( $_POST['mercadopago_ticket'] ) || ! $this->validate_nonce_process() ) {
if ( ! isset( $_POST['mercadopago_ticket'] ) ) {
return $this->process_result_fail(
__FUNCTION__,
__( 'A problem was occurred when processing your payment. Please, try again.', 'woocommerce-mercadopago' ),
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "6.7.2",
"version": "6.7.3",
"name": "cart-woocommerce",
"description": "Gateway de pagamento Mercado Pago para WooCommerce",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit0a5a7a084d9028d156e27fdcaff06f78::getLoader();
return ComposerAutoloaderInit1e5a2c4f52c8ae56d2633f82ae6b5e19::getLoader();
8 changes: 4 additions & 4 deletions packages/sdk/vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit0a5a7a084d9028d156e27fdcaff06f78
class ComposerAutoloaderInit1e5a2c4f52c8ae56d2633f82ae6b5e19
{
private static $loader;

Expand All @@ -24,12 +24,12 @@ public static function getLoader()

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit0a5a7a084d9028d156e27fdcaff06f78', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1e5a2c4f52c8ae56d2633f82ae6b5e19', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit0a5a7a084d9028d156e27fdcaff06f78', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1e5a2c4f52c8ae56d2633f82ae6b5e19', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0a5a7a084d9028d156e27fdcaff06f78::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit1e5a2c4f52c8ae56d2633f82ae6b5e19::getInitializer($loader));

$loader->register(true);

Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit0a5a7a084d9028d156e27fdcaff06f78
class ComposerStaticInit1e5a2c4f52c8ae56d2633f82ae6b5e19
{
public static $prefixLengthsPsr4 = array (
'M' =>
Expand Down Expand Up @@ -80,9 +80,9 @@ class ComposerStaticInit0a5a7a084d9028d156e27fdcaff06f78
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0a5a7a084d9028d156e27fdcaff06f78::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0a5a7a084d9028d156e27fdcaff06f78::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0a5a7a084d9028d156e27fdcaff06f78::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit1e5a2c4f52c8ae56d2633f82ae6b5e19::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1e5a2c4f52c8ae56d2633f82ae6b5e19::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1e5a2c4f52c8ae56d2633f82ae6b5e19::$classMap;

}, null, ClassLoader::class);
}
Expand Down
13 changes: 12 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: ecommerce, mercadopago, woocommerce
Requires at least: 5.6
Tested up to: 6.1
Requires PHP: 7.0
Stable tag: 6.7.2
Stable tag: 6.7.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -136,6 +136,17 @@ Check out our <a href="https://www.mercadopago.com.br/developers/pt/plugins_sdks

== Changelog ==

= v6.7.3 (02/05/2023) =
* Features
- Test compatibility with WooCommerce v7.6
- Test compatibility with WordPress v6.2

* Changes
- process_nonce_validation was removed from process_payment

* Fixes
- Fix http_user_agent log using wp_is_mobile() instead regex

= v6.7.2 (20/03/2023) =
* Features
- Add new fields in update-metadata
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-mercadopago.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Mercado Pago payments for WooCommerce
* Plugin URI: https://github.com/mercadopago/cart-woocommerce
* Description: Configure the payment options and accept payments with cards, ticket and money of Mercado Pago account.
* Version: 6.7.2
* Version: 6.7.3
* Author: Mercado Pago
* Author URI: https://developers.mercadopago.com/
* Text Domain: woocommerce-mercadopago
Expand Down

0 comments on commit e6b98ff

Please sign in to comment.