WooCommerce MercadoPago - Version 3.0.9

Version Description

Download this release

Release Info

Developer mercadopago
Plugin Icon 128x128 WooCommerce MercadoPago
Version 3.0.9
Comparing to
See all releases

Code changes from version 3.0.8 to 3.0.9

includes/WC_WooMercadoPago_BasicGateway.php CHANGED
@@ -752,10 +752,9 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
752
  substr( $product_content, 0, 230 ) . '...' :
753
  $product_content
754
  ) ),
755
- 'picture_url' => sizeof( $order->get_items() > 1 ) ?
756
  plugins_url( 'assets/images/cart.png', plugin_dir_path( __FILE__ ) ) :
757
- wp_get_attachment_url( $product->get_image_id()
758
- ),
759
  'category_id' => get_option( '_mp_category_name', 'others' ),
760
  'quantity' => 1,
761
  'unit_price' => ( $this->site_data['currency'] == 'COP' || $this->site_data['currency'] == 'CLP' ) ?
752
  substr( $product_content, 0, 230 ) . '...' :
753
  $product_content
754
  ) ),
755
+ 'picture_url' => sizeof( $order->get_items() ) > 1 ?
756
  plugins_url( 'assets/images/cart.png', plugin_dir_path( __FILE__ ) ) :
757
+ wp_get_attachment_url( $product->get_image_id() ),
 
758
  'category_id' => get_option( '_mp_category_name', 'others' ),
759
  'quantity' => 1,
760
  'unit_price' => ( $this->site_data['currency'] == 'COP' || $this->site_data['currency'] == 'CLP' ) ?
includes/WC_WooMercadoPago_CustomGateway.php CHANGED
@@ -31,7 +31,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
31
  $locale = get_locale();
32
  $locale = ( strpos( $locale, '_' ) !== false && strlen( $locale ) == 5 ) ? explode( '_', $locale ) : array('','');
33
  $this->mp->set_locale( $locale[1] );
34
-
35
  // WooCommerce fields.
36
  $this->id = 'woo-mercado-pago-custom';
37
  $this->supports = array( 'products', 'refunds' );
@@ -57,7 +57,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
57
  $this->coupon_mode = $this->get_option( 'coupon_mode', 'no' );
58
  $this->binary_mode = $this->get_option( 'binary_mode', 'no' );
59
  $this->gateway_discount = $this->get_option( 'gateway_discount', 0 );
60
-
61
  // Logging and debug.
62
  $_mp_debug_mode = get_option( '_mp_debug_mode', '' );
63
  if ( ! empty ( $_mp_debug_mode ) ) {
@@ -474,7 +474,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
474
  }
475
 
476
  public function payment_fields() {
477
-
478
  wp_enqueue_script( 'wc-credit-card-form' );
479
 
480
  $amount = $this->get_order_total();
@@ -680,15 +680,14 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
680
  array_push( $items, array(
681
  'id' => $item['product_id'],
682
  'title' => html_entity_decode( $product_title ) . ' x ' . $item['qty'],
683
- 'description' => sanitize_file_name( html_entity_decode(
684
  strlen( $product_content ) > 230 ?
685
  substr( $product_content, 0, 230 ) . '...' :
686
  $product_content
687
  ) ),
688
- 'picture_url' => sizeof( $order->get_items() > 1 ) ?
689
  plugins_url( 'assets/images/cart.png', plugin_dir_path( __FILE__ ) ) :
690
- wp_get_attachment_url( $product->get_image_id()
691
- ),
692
  'category_id' => get_option( '_mp_category_name', 'others' ),
693
  'quantity' => 1,
694
  'unit_price' => ( $this->site_data['currency'] == 'COP' || $this->site_data['currency'] == 'CLP' ) ?
@@ -898,7 +897,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
898
  $this->write_log(
899
  __FUNCTION__,
900
  'payment link generated with success from mercado pago, with structure as follow: ' .
901
- json_encode( $checkout_info, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE )
902
  );
903
  // TODO: Verify sandbox availability.
904
  //if ( 'yes' == $this->sandbox ) {
31
  $locale = get_locale();
32
  $locale = ( strpos( $locale, '_' ) !== false && strlen( $locale ) == 5 ) ? explode( '_', $locale ) : array('','');
33
  $this->mp->set_locale( $locale[1] );
34
+
35
  // WooCommerce fields.
36
  $this->id = 'woo-mercado-pago-custom';
37
  $this->supports = array( 'products', 'refunds' );
57
  $this->coupon_mode = $this->get_option( 'coupon_mode', 'no' );
58
  $this->binary_mode = $this->get_option( 'binary_mode', 'no' );
59
  $this->gateway_discount = $this->get_option( 'gateway_discount', 0 );
60
+
61
  // Logging and debug.
62
  $_mp_debug_mode = get_option( '_mp_debug_mode', '' );
63
  if ( ! empty ( $_mp_debug_mode ) ) {
474
  }
475
 
476
  public function payment_fields() {
477
+
478
  wp_enqueue_script( 'wc-credit-card-form' );
479
 
480
  $amount = $this->get_order_total();
680
  array_push( $items, array(
681
  'id' => $item['product_id'],
682
  'title' => html_entity_decode( $product_title ) . ' x ' . $item['qty'],
683
+ 'description' => sanitize_file_name( html_entity_decode(
684
  strlen( $product_content ) > 230 ?
685
  substr( $product_content, 0, 230 ) . '...' :
686
  $product_content
687
  ) ),
688
+ 'picture_url' => sizeof( $order->get_items() ) > 1 ?
689
  plugins_url( 'assets/images/cart.png', plugin_dir_path( __FILE__ ) ) :
690
+ wp_get_attachment_url( $product->get_image_id() ),
 
691
  'category_id' => get_option( '_mp_category_name', 'others' ),
692
  'quantity' => 1,
693
  'unit_price' => ( $this->site_data['currency'] == 'COP' || $this->site_data['currency'] == 'CLP' ) ?
897
  $this->write_log(
898
  __FUNCTION__,
899
  'payment link generated with success from mercado pago, with structure as follow: ' .
900
+ json_encode( $checkout_info, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE )
901
  );
902
  // TODO: Verify sandbox availability.
903
  //if ( 'yes' == $this->sandbox ) {
includes/WC_WooMercadoPago_TicketGateway.php CHANGED
@@ -717,10 +717,9 @@ class WC_WooMercadoPago_TicketGateway extends WC_Payment_Gateway {
717
  substr( $product_content, 0, 230 ) . '...' :
718
  $product_content
719
  ) ),
720
- 'picture_url' => sizeof( $order->get_items() > 1 ) ?
721
  plugins_url( 'assets/images/cart.png', plugin_dir_path( __FILE__ ) ) :
722
- wp_get_attachment_url( $product->get_image_id()
723
- ),
724
  'category_id' => get_option( '_mp_category_name', 'others' ),
725
  'quantity' => 1,
726
  'unit_price' => ( $this->site_data['currency'] == 'COP' || $this->site_data['currency'] == 'CLP' ) ?
717
  substr( $product_content, 0, 230 ) . '...' :
718
  $product_content
719
  ) ),
720
+ 'picture_url' => sizeof( $order->get_items() ) > 1 ?
721
  plugins_url( 'assets/images/cart.png', plugin_dir_path( __FILE__ ) ) :
722
+ wp_get_attachment_url( $product->get_image_id() ),
 
723
  'category_id' => get_option( '_mp_category_name', 'others' ),
724
  'quantity' => 1,
725
  'unit_price' => ( $this->site_data['currency'] == 'COP' || $this->site_data['currency'] == 'CLP' ) ?
includes/sdk/lib/mercadopago.php CHANGED
@@ -12,7 +12,7 @@ $GLOBALS['LIB_LOCATION'] = dirname( __FILE__ );
12
 
13
  class MP {
14
 
15
- private $version = '3.0.8';
16
  private $client_id;
17
  private $client_secret;
18
  private $ll_access_token;
@@ -49,7 +49,7 @@ class MP {
49
  MPRestClient::set_email( $email );
50
  MeliRestClient::set_email( $email );
51
  }
52
-
53
  public function set_locale( $country_code ) {
54
  MPRestClient::set_locale( $country_code );
55
  MeliRestClient::set_locale( $country_code );
@@ -840,7 +840,7 @@ class MPRestClient {
840
 
841
  // Set parameters and url
842
  if ( isset( $request['params'] ) && is_array( $request['params'] ) ) {
843
- if ( count( $request['params'] > 0 ) ) {
844
  $request['uri'] .= ( strpos( $request['uri'], '?' ) === false ) ? '?' : '&';
845
  $request['uri'] .= self::build_query( $request['params'] );
846
  }
@@ -1004,7 +1004,7 @@ class MPRestClient {
1004
  public static function set_email( $email ) {
1005
  self::$email_admin = $email;
1006
  }
1007
-
1008
  public static function set_locale( $country_code ) {
1009
  self::$site_locale = $country_code;
1010
  }
@@ -1084,7 +1084,7 @@ class MeliRestClient {
1084
 
1085
  // Set parameters and url
1086
  if ( isset( $request['params'] ) && is_array( $request['params'] ) ) {
1087
- if ( count( $request['params'] > 0 ) ) {
1088
  $request['uri'] .= ( strpos( $request['uri'], '?' ) === false ) ? '?' : '&';
1089
  $request['uri'] .= self::build_query( $request['params'] );
1090
  }
@@ -1247,7 +1247,7 @@ class MeliRestClient {
1247
  public static function set_email( $email ) {
1248
  self::$email_admin = $email;
1249
  }
1250
-
1251
  public static function set_locale( $country_code ) {
1252
  self::$site_locale = $country_code;
1253
  }
12
 
13
  class MP {
14
 
15
+ private $version = '3.0.9';
16
  private $client_id;
17
  private $client_secret;
18
  private $ll_access_token;
49
  MPRestClient::set_email( $email );
50
  MeliRestClient::set_email( $email );
51
  }
52
+
53
  public function set_locale( $country_code ) {
54
  MPRestClient::set_locale( $country_code );
55
  MeliRestClient::set_locale( $country_code );
840
 
841
  // Set parameters and url
842
  if ( isset( $request['params'] ) && is_array( $request['params'] ) ) {
843
+ if ( count( $request['params'] ) > 0 ) {
844
  $request['uri'] .= ( strpos( $request['uri'], '?' ) === false ) ? '?' : '&';
845
  $request['uri'] .= self::build_query( $request['params'] );
846
  }
1004
  public static function set_email( $email ) {
1005
  self::$email_admin = $email;
1006
  }
1007
+
1008
  public static function set_locale( $country_code ) {
1009
  self::$site_locale = $country_code;
1010
  }
1084
 
1085
  // Set parameters and url
1086
  if ( isset( $request['params'] ) && is_array( $request['params'] ) ) {
1087
+ if ( count( $request['params'] ) > 0 ) {
1088
  $request['uri'] .= ( strpos( $request['uri'], '?' ) === false ) ? '?' : '&';
1089
  $request['uri'] .= self::build_query( $request['params'] );
1090
  }
1247
  public static function set_email( $email ) {
1248
  self::$email_admin = $email;
1249
  }
1250
+
1251
  public static function set_locale( $country_code ) {
1252
  self::$site_locale = $country_code;
1253
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ecommerce, mercadopago, woocommerce
4
  Requires at least: 4.8
5
  Tested up to: 4.8
6
  Requires PHP: 5.6
7
- Stable tag: 3.0.8
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -215,6 +215,11 @@ Features: LatAm Basic Checkout support. Great for merchants who want to get goin
215
 
216
  == Changelog ==
217
 
 
 
 
 
 
218
  = v3.0.8 (05/01/2018) =
219
  * Improvements
220
  - Increased support and handling to older PHP;
4
  Requires at least: 4.8
5
  Tested up to: 4.8
6
  Requires PHP: 5.6
7
+ Stable tag: 3.0.9
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
215
 
216
  == Changelog ==
217
 
218
+ = v3.0.9 (16/01/2018) =
219
+ * Bug fixes
220
+ - Fixed a bug in the URL of product image;
221
+ - Fix count error in sdk (credits to xchwarze).
222
+
223
  = v3.0.8 (05/01/2018) =
224
  * Improvements
225
  - Increased support and handling to older PHP;
woocommerce-mercadopago.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce MercadoPago
4
  * Plugin URI: https://github.com/mercadopago/cart-woocommerce
5
  * Description: This is the <strong>oficial</strong> module of Mercado Pago for WooCommerce plugin. This module enables WooCommerce to use Mercado Pago as a payment Gateway for purchases made in your e-commerce store.
6
- * Version: 3.0.8
7
  * Author: Mercado Pago
8
  * Author URI: https://www.mercadopago.com.br/developers/
9
  * Text Domain: woocommerce-mercadopago
@@ -105,7 +105,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
105
  // ============================================================
106
 
107
  // General constants.
108
- const VERSION = '3.0.8';
109
  const MIN_PHP = 5.6;
110
 
111
  // Arrays to hold configurations for LatAm environment.
@@ -189,7 +189,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
189
 
190
  // First of all, verify if WooCommerce is already installed.
191
  if ( class_exists( 'WC_Payment_Gateway' ) ) {
192
-
193
  // Adds each Mercado Pago gateway as available payment method.
194
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_BasicGateway.php';
195
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_CustomGateway.php';
@@ -857,7 +857,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
857
  '</table>';
858
  return $subscription_js . $subscription_meta_box;
859
  }
860
-
861
  /**
862
  * Check if product dimensions are well defined
863
  */
3
  * Plugin Name: WooCommerce MercadoPago
4
  * Plugin URI: https://github.com/mercadopago/cart-woocommerce
5
  * Description: This is the <strong>oficial</strong> module of Mercado Pago for WooCommerce plugin. This module enables WooCommerce to use Mercado Pago as a payment Gateway for purchases made in your e-commerce store.
6
+ * Version: 3.0.9
7
  * Author: Mercado Pago
8
  * Author URI: https://www.mercadopago.com.br/developers/
9
  * Text Domain: woocommerce-mercadopago
105
  // ============================================================
106
 
107
  // General constants.
108
+ const VERSION = '3.0.9';
109
  const MIN_PHP = 5.6;
110
 
111
  // Arrays to hold configurations for LatAm environment.
189
 
190
  // First of all, verify if WooCommerce is already installed.
191
  if ( class_exists( 'WC_Payment_Gateway' ) ) {
192
+
193
  // Adds each Mercado Pago gateway as available payment method.
194
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_BasicGateway.php';
195
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_CustomGateway.php';
857
  '</table>';
858
  return $subscription_js . $subscription_meta_box;
859
  }
860
+
861
  /**
862
  * Check if product dimensions are well defined
863
  */