WooCommerce MercadoPago - Version 5.7.1

Version Description

Download this release

Release Info

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

Code changes from version 5.7.0 to 5.7.1

includes/module/class-wc-woomercadopago-configs.php CHANGED
@@ -57,7 +57,7 @@ class WC_WooMercadoPago_Configs {
57
  $this->update_token();
58
  }
59
  }
60
- if ( empty( strtolower(get_option( '_site_id_v1' )) ) || empty( get_option( '_collector_id_v1' ) ) ) {
61
  WC_WooMercadoPago_Credentials::validate_credentials_v1();
62
  }
63
 
@@ -171,7 +171,7 @@ class WC_WooMercadoPago_Configs {
171
  * Saved Cards Notice
172
  *
173
  * @return false
174
- */
175
  public function saved_cards_notice() {
176
  if ( $this->must_not_show_saved_cards_notice() ) {
177
  return false;
@@ -300,57 +300,57 @@ class WC_WooMercadoPago_Configs {
300
  public function get_categories() {
301
  return array(
302
  'store_categories_id' =>
303
- array(
304
- 'art',
305
- 'baby',
306
- 'coupons',
307
- 'donations',
308
- 'computing',
309
- 'cameras',
310
- 'video games',
311
- 'television',
312
- 'car electronics',
313
- 'electronics',
314
- 'automotive',
315
- 'entertainment',
316
- 'fashion',
317
- 'games',
318
- 'home',
319
- 'musical',
320
- 'phones',
321
- 'services',
322
- 'learnings',
323
- 'tickets',
324
- 'travels',
325
- 'virtual goods',
326
- 'others',
327
- ),
328
  'store_categories_description' =>
329
- array(
330
- 'Collectibles & Art',
331
- 'Toys for Baby, Stroller, Stroller Accessories, Car Safety Seats',
332
- 'Coupons',
333
- 'Donations',
334
- 'Computers & Tablets',
335
- 'Cameras & Photography',
336
- 'Video Games & Consoles',
337
- 'LCD, LED, Smart TV, Plasmas, TVs',
338
- 'Car Audio, Car Alarm Systems & Security, Car DVRs, Car Video Players, Car PC',
339
- 'Audio & Surveillance, Video & GPS, Others',
340
- 'Parts & Accessories',
341
- 'Music, Movies & Series, Books, Magazines & Comics, Board Games & Toys',
342
- "Men's, Women's, Kids & baby, Handbags & Accessories, Health & Beauty, Shoes, Jewelry & Watches",
343
- 'Online Games & Credits',
344
- 'Home appliances. Home & Garden',
345
- 'Instruments & Gear',
346
- 'Cell Phones & Accessories',
347
- 'General services',
348
- 'Trainings, Conferences, Workshops',
349
- 'Tickets for Concerts, Sports, Arts, Theater, Family, Excursions tickets, Events & more',
350
- 'Plane tickets, Hotel vouchers, Travel vouchers',
351
- 'E-books, Music Files, Software, Digital Images, PDF Files and any item which can be electronically stored in a file, Mobile Recharge, DTH Recharge and any Online Recharge',
352
- 'Other categories',
353
- ),
354
  );
355
  }
356
 
@@ -358,6 +358,7 @@ class WC_WooMercadoPago_Configs {
358
  * Set payment
359
  *
360
  * @param array|null $methods Methods.
 
361
  * @return array
362
  */
363
  public function set_payment_gateway( $methods = null ) {
@@ -365,37 +366,40 @@ class WC_WooMercadoPago_Configs {
365
  if ( ! empty( $wp ) && isset( $wp->query_vars['wc-api'] ) ) {
366
  $api_request = wc_clean( $wp->query_vars['wc-api'] );
367
  if ( ! empty( $api_request ) && in_array(
368
- strtolower( $api_request ),
369
- array(
370
- 'wc_woomercadopago_basic_gateway',
371
- 'wc_woomercadopago_custom_gateway',
372
- 'wc_woomercadopago_ticket_gateway',
373
- 'wc_woomercadopago_pix_gateway',
374
- 'wc_woomercadopago_basicgateway',
375
- 'wc_woomercadopago_customgateway',
376
- 'wc_woomercadopago_ticketgateway',
377
- ),
378
- true
379
- ) ) {
380
  if ( ! preg_match( '/(_gateway)/i', $api_request ) ) {
381
  $api_request = preg_replace( '/gateway/i', '_Gateway', $api_request );
382
  }
383
  $methods[] = $api_request;
384
  }
 
385
  return $methods;
386
  }
387
 
388
- return $this->get_available_payment_methods();
389
  }
390
 
391
  /**
392
  * Get available payment methods
393
  *
 
 
394
  * @return array
395
  */
396
- public function get_available_payment_methods() {
397
  $wc_country = WC_WooMercadoPago_Module::get_woocommerce_default_country();
398
- $site_id = strtolower(get_option( '_site_id_v1', '' ));
399
 
400
  $methods[] = 'WC_WooMercadoPago_Basic_Gateway';
401
  $methods[] = 'WC_WooMercadoPago_Custom_Gateway';
57
  $this->update_token();
58
  }
59
  }
60
+ if ( empty( strtolower( get_option( '_site_id_v1' ) ) ) || empty( get_option( '_collector_id_v1' ) ) ) {
61
  WC_WooMercadoPago_Credentials::validate_credentials_v1();
62
  }
63
 
171
  * Saved Cards Notice
172
  *
173
  * @return false
174
+ */
175
  public function saved_cards_notice() {
176
  if ( $this->must_not_show_saved_cards_notice() ) {
177
  return false;
300
  public function get_categories() {
301
  return array(
302
  'store_categories_id' =>
303
+ array(
304
+ 'art',
305
+ 'baby',
306
+ 'coupons',
307
+ 'donations',
308
+ 'computing',
309
+ 'cameras',
310
+ 'video games',
311
+ 'television',
312
+ 'car electronics',
313
+ 'electronics',
314
+ 'automotive',
315
+ 'entertainment',
316
+ 'fashion',
317
+ 'games',
318
+ 'home',
319
+ 'musical',
320
+ 'phones',
321
+ 'services',
322
+ 'learnings',
323
+ 'tickets',
324
+ 'travels',
325
+ 'virtual goods',
326
+ 'others',
327
+ ),
328
  'store_categories_description' =>
329
+ array(
330
+ 'Collectibles & Art',
331
+ 'Toys for Baby, Stroller, Stroller Accessories, Car Safety Seats',
332
+ 'Coupons',
333
+ 'Donations',
334
+ 'Computers & Tablets',
335
+ 'Cameras & Photography',
336
+ 'Video Games & Consoles',
337
+ 'LCD, LED, Smart TV, Plasmas, TVs',
338
+ 'Car Audio, Car Alarm Systems & Security, Car DVRs, Car Video Players, Car PC',
339
+ 'Audio & Surveillance, Video & GPS, Others',
340
+ 'Parts & Accessories',
341
+ 'Music, Movies & Series, Books, Magazines & Comics, Board Games & Toys',
342
+ "Men's, Women's, Kids & baby, Handbags & Accessories, Health & Beauty, Shoes, Jewelry & Watches",
343
+ 'Online Games & Credits',
344
+ 'Home appliances. Home & Garden',
345
+ 'Instruments & Gear',
346
+ 'Cell Phones & Accessories',
347
+ 'General services',
348
+ 'Trainings, Conferences, Workshops',
349
+ 'Tickets for Concerts, Sports, Arts, Theater, Family, Excursions tickets, Events & more',
350
+ 'Plane tickets, Hotel vouchers, Travel vouchers',
351
+ 'E-books, Music Files, Software, Digital Images, PDF Files and any item which can be electronically stored in a file, Mobile Recharge, DTH Recharge and any Online Recharge',
352
+ 'Other categories',
353
+ ),
354
  );
355
  }
356
 
358
  * Set payment
359
  *
360
  * @param array|null $methods Methods.
361
+ *
362
  * @return array
363
  */
364
  public function set_payment_gateway( $methods = null ) {
366
  if ( ! empty( $wp ) && isset( $wp->query_vars['wc-api'] ) ) {
367
  $api_request = wc_clean( $wp->query_vars['wc-api'] );
368
  if ( ! empty( $api_request ) && in_array(
369
+ strtolower( $api_request ),
370
+ array(
371
+ 'wc_woomercadopago_basic_gateway',
372
+ 'wc_woomercadopago_custom_gateway',
373
+ 'wc_woomercadopago_ticket_gateway',
374
+ 'wc_woomercadopago_pix_gateway',
375
+ 'wc_woomercadopago_basicgateway',
376
+ 'wc_woomercadopago_customgateway',
377
+ 'wc_woomercadopago_ticketgateway',
378
+ ),
379
+ true
380
+ ) ) {
381
  if ( ! preg_match( '/(_gateway)/i', $api_request ) ) {
382
  $api_request = preg_replace( '/gateway/i', '_Gateway', $api_request );
383
  }
384
  $methods[] = $api_request;
385
  }
386
+
387
  return $methods;
388
  }
389
 
390
+ return $this->get_available_payment_methods( $methods );
391
  }
392
 
393
  /**
394
  * Get available payment methods
395
  *
396
+ * @param array|null $methods
397
+ *
398
  * @return array
399
  */
400
+ public function get_available_payment_methods( $methods ) {
401
  $wc_country = WC_WooMercadoPago_Module::get_woocommerce_default_country();
402
+ $site_id = strtolower( get_option( '_site_id_v1', '' ) );
403
 
404
  $methods[] = 'WC_WooMercadoPago_Basic_Gateway';
405
  $methods[] = 'WC_WooMercadoPago_Custom_Gateway';
includes/module/config/class-wc-woomercadopago-constants.php CHANGED
@@ -21,7 +21,7 @@ class WC_WooMercadoPago_Constants {
21
  const PRODUCT_ID_DESKTOP = 'BT7OF5FEOO6G01NJK3QG';
22
  const PRODUCT_ID_MOBILE = 'BT7OFH09QS3001K5A0H0';
23
  const PLATAFORM_ID = 'bo2hnr2ic4p001kbgpt0';
24
- const VERSION = '5.7.0';
25
  const MIN_PHP = 5.6;
26
  const API_MP_BASE_URL = 'https://api.mercadopago.com';
27
  const PAYMENT_GATEWAYS = array(
21
  const PRODUCT_ID_DESKTOP = 'BT7OF5FEOO6G01NJK3QG';
22
  const PRODUCT_ID_MOBILE = 'BT7OFH09QS3001K5A0H0';
23
  const PLATAFORM_ID = 'bo2hnr2ic4p001kbgpt0';
24
+ const VERSION = '5.7.1';
25
  const MIN_PHP = 5.6;
26
  const API_MP_BASE_URL = 'https://api.mercadopago.com';
27
  const PAYMENT_GATEWAYS = array(
includes/module/mercadopago-settings/class-wc-woomercadopago-mercadopago-settings.php CHANGED
@@ -43,7 +43,7 @@ class WC_WooMercadoPago_MercadoPago_Settings {
43
  * Load CSS
44
  */
45
  public function load_admin_style() {
46
- if ( is_admin() && ( WC_WooMercadoPago_Helper_Current_Url::validate_page('mercadopago-settings') || WC_WooMercadoPago_Helper_Current_Url::validate_section('woo-mercado-pago') ) ) {
47
  wp_register_style(
48
  'mercadopago_settings_admin_css',
49
  $this->get_url( '../../../assets/css/mercadopago-settings/mercadopago_settings', '.css' ),
@@ -58,7 +58,7 @@ class WC_WooMercadoPago_MercadoPago_Settings {
58
  * Load JavaScripts
59
  */
60
  public function load_admin_scripts() {
61
- if ( is_admin() && ( WC_WooMercadoPago_Helper_Current_Url::validate_page('mercadopago-settings') || WC_WooMercadoPago_Helper_Current_Url::validate_section('woo-mercado-pago') ) ) {
62
  wp_enqueue_script(
63
  'mercadopago_settings_javascript',
64
  $this->get_url( '../../../assets/js/mercadopago-settings/mercadopago_settings', '.js' ),
@@ -73,40 +73,43 @@ class WC_WooMercadoPago_MercadoPago_Settings {
73
  * Load Research JavaScripts
74
  */
75
  public function load_research_script() {
76
-
77
- global $woocommerce;
78
- wp_enqueue_script(
79
- 'mercadopago_research_javascript',
80
- 'https://http2.mlstatic.com/storage/v1/plugins/caronte/woocommerce.js?v=101',
81
- array(),
82
- WC_WooMercadoPago_Constants::VERSION,
83
- true
84
- );
85
- wp_localize_script(
86
- 'mercadopago_research_javascript',
87
- 'wc_mercadopago_params',
88
- array(
89
- 'site_id' => $this->options->get_site_id() ? strtoupper($this->options->get_site_id()) : 'MLA',
90
- 'platform_id' => WC_WooMercadoPago_Constants::PLATAFORM_ID,
91
- 'platform_version' => $woocommerce->version,
92
- 'plugin_version' => WC_WooMercadoPago_Constants::VERSION,
93
- 'public_key_element_id' => 'mp-public-key-prod',
94
- 'reference_element_id' => 'reference'
95
- )
96
- );
 
97
  }
98
 
99
  /**
100
  * Load Research Style
101
  */
102
  public function load_research_style() {
103
- wp_register_style(
104
- 'mercadopago_research_css',
105
- 'https://http2.mlstatic.com/storage/v1/plugins/caronte/woocommerce.css' ,
106
- false,
107
- WC_WooMercadoPago_Constants::VERSION
108
- );
109
- wp_enqueue_style( 'mercadopago_research_css' );
 
 
110
  }
111
 
112
  /**
@@ -150,15 +153,15 @@ class WC_WooMercadoPago_MercadoPago_Settings {
150
  * Register Mercado Pago Endpoints
151
  */
152
  public function register_endpoints() {
153
- add_action('wp_ajax_mp_get_requirements', array($this, 'mercadopago_get_requirements'));
154
- add_action('wp_ajax_mp_validate_credentials', array($this, 'mp_validate_credentials'));
155
- add_action('wp_ajax_mp_update_store_information', array($this, 'mp_update_store_info'));
156
- add_action('wp_ajax_mp_store_mode', array($this, 'mp_set_mode'));
157
- add_action('wp_ajax_mp_get_payment_properties', array($this, 'mp_get_payment_class_properties'));
158
- add_action('wp_ajax_mp_validate_store_tips', array($this, 'mp_validate_store_tips'));
159
- add_action('wp_ajax_mp_validate_credentials_tips', array($this, 'mp_validate_credentials_tips'));
160
- add_action('wp_ajax_mp_validate_payment_tips', array($this, 'mp_validate_payment_tips'));
161
- add_action('wp_ajax_mp_update_option_credentials', array( $this, 'mp_update_option_credentials' ));
162
  }
163
 
164
  /**
@@ -168,31 +171,31 @@ class WC_WooMercadoPago_MercadoPago_Settings {
168
  */
169
  public function mp_translation_admin_header() {
170
  $translation_header = array(
171
- 'title_head_part_one' => __('Accept ', 'woocommerce-mercadopago'),
172
- 'title_head_part_two' => __('payments on the spot ', 'woocommerce-mercadopago'),
173
- 'title_head_part_three' => __('with', 'woocommerce-mercadopago'),
174
- 'title_head_part_four' => __('the ', 'woocommerce-mercadopago'),
175
- 'title_head_part_six' => __('security ', 'woocommerce-mercadopago'),
176
- 'title_head_part_seven' => __('from Mercado Pago', 'woocommerce-mercadopago'),
177
- 'title_requirements' => __('Technical requirements', 'woocommerce-mercadopago'),
178
- 'ssl' => __('SSL', 'woocommerce-mercadopago'),
179
- 'gd_extensions' => __('GD Extensions', 'woocommerce-mercadopago'),
180
- 'curl' => __('Curl', 'woocommerce-mercadopago'),
181
- 'description_ssl' => __('Implementation responsible for transmitting data to Mercado Pago in a secure and encrypted way.', 'woocommerce-mercadopago'),
182
- 'description_gd_extensions' => __('These extensions are responsible for the implementation and operation of Pix in your store.', 'woocommerce-mercadopago'),
183
- 'description_curl' => __('It is an extension responsible for making payments via requests from the plugin to Mercado Pago.', 'woocommerce-mercadopago'),
184
- 'title_installments' => __('Collections and installments', 'woocommerce-mercadopago'),
185
- 'descripition_installments' => __('Choose ', 'woocommerce-mercadopago'),
186
- 'descripition_installments_one' => __('when you want to receive the money ', 'woocommerce-mercadopago'),
187
- 'descripition_installments_two' => __('from your sales and if you want to offer ', 'woocommerce-mercadopago'),
188
- 'descripition_installments_three' => __('interest-free installments ', 'woocommerce-mercadopago'),
189
- 'descripition_installments_four' => __('to your clients.', 'woocommerce-mercadopago'),
190
- 'button_installments' => __('Set deadlines and fees', 'woocommerce-mercadopago'),
191
- 'title_questions' => __('Questions? ', 'woocommerce-mercadopago'),
192
- 'descripition_questions_one' => __('Review the step-by-step of ', 'woocommerce-mercadopago'),
193
- 'descripition_questions_two' => __('how to integrate the Mercado Pago Plugin ', 'woocommerce-mercadopago'),
194
- 'descripition_questions_three' => __('on our webiste for developers.', 'woocommerce-mercadopago'),
195
- 'button_questions' => __('Plugin manual', 'woocommerce-mercadopago'),
196
  );
197
 
198
  return $translation_header;
@@ -222,6 +225,7 @@ class WC_WooMercadoPago_MercadoPago_Settings {
222
  'button_credentials' => __( 'Save and continue', 'woocommerce-mercadopago' ),
223
 
224
  );
 
225
  return $translation_credential;
226
  }
227
 
@@ -234,33 +238,34 @@ class WC_WooMercadoPago_MercadoPago_Settings {
234
 
235
  $translation_store = array(
236
 
237
- 'title_store' => __('2. Customize your business', 'woocommerce-mercadopago'),
238
- 'subtitle_store' => __('Fill out the following information to have a better experience and offer more information to your clients', 'woocommerce-mercadopago'),
239
- 'title_info_store' => __('Your store information', 'woocommerce-mercadopago'),
240
- 'subtitle_name_store' => __("Name of your store in your client's invoice", 'woocommerce-mercadopago'),
241
- 'placeholder_name_store' => __("Eg: Mary's store", 'woocommerce-mercadopago'),
242
- 'helper_name_store' => __('If this field is empty, the purchase will be identified as Mercado Pago.', 'woocommerce-mercadopago'),
243
- 'subtitle_activities_store' => __('Identification in Activities of Mercad Pago', 'woocommerce-mercadopago'),
244
- 'placeholder_activities_store' => __('Eg: Marystore', 'woocommerce-mercadopago'),
245
- 'helper_activities_store' => __('In Activities, you will view this term before the order number', 'woocommerce-mercadopago'),
246
- 'subtitle_category_store' => __('Store category', 'woocommerce-mercadopago'),
247
- 'placeholder_category_store' => __('Select', 'woocommerce-mercadopago'),
248
- 'helper_category_store' => __('Select ”Other” if you do not find the appropriate category.', 'woocommerce-mercadopago'),
249
- 'title_advanced_store' => __('Advanced integration options (optional)', 'woocommerce-mercadopago'),
250
- 'subtitle_advanced_store' => __('For further integration of your store with Mercado Pago (IPN, Certified Partners, Debug Mode)', 'woocommerce-mercadopago'),
251
- 'accordion_advanced_store' => __('View advanced options', 'woocommerce-mercadopago'),
252
- 'subtitle_url' => __('URL for IPN ', 'woocommerce-mercadopago'),
253
- 'placeholder_url' => __('Eg: https://examples.com/my-custom-ipn-url', 'woocommerce-mercadopago'),
254
- 'helper_url' => __('Add the URL to receive payments notifications. Find out more information in the ', 'woocommerce-mercadopago'),
255
- 'helper_url_link' => __('guides.', 'woocommerce-mercadopago'),
256
- 'subtitle_integrator' => __('integrator_id', 'woocommerce-mercadopago'),
257
- 'placeholder_integrator' => __('Eg: 14987126498', 'woocommerce-mercadopago'),
258
- 'helper_integrator' => __('If you are a Mercado Pago Certified Partner, make sure to add your integrator_id. If you do not have the code, please ', 'woocommerce-mercadopago'),
259
- 'helper_integrator_link' => __('request it now. ', 'woocommerce-mercadopago'),
260
- 'title_debug' => __('Debug and Log Mode', 'woocommerce-mercadopago'),
261
- 'subtitle_debug' => __("We record your store's actions in order to provide a better assistance.", 'woocommerce-mercadopago'),
262
- 'button_store' => __('Save and continue', 'woocommerce-mercadopago'),
263
  );
 
264
  return $translation_store;
265
 
266
  }
@@ -272,11 +277,12 @@ class WC_WooMercadoPago_MercadoPago_Settings {
272
  */
273
  public function mp_translation_admin_payment() {
274
  $translation_payment = array(
275
- 'title_payments' => __('3. Set payment methods', 'woocommerce-mercadopago'),
276
- 'subtitle_payments' => __('To view more options, please select a payment method below', 'woocommerce-mercadopago'),
277
- 'settings_payment' => __('Settings', 'woocommerce-mercadopago'),
278
- 'button_payment' => __('Continue', 'woocommerce-mercadopago'),
279
  );
 
280
  return $translation_payment;
281
 
282
  }
@@ -288,23 +294,24 @@ class WC_WooMercadoPago_MercadoPago_Settings {
288
  */
289
  public function mp_translation_admin_test_mode() {
290
  $translation_test_mode = array(
291
- 'title_test_mode' => __('4. Test your store before you sell', 'woocommerce-mercadopago'),
292
- 'subtitle_test_mode' => __('Test the experience in Test Mode and then enable the Sale Mode (Production) to sell.', 'woocommerce-mercadopago'),
293
- 'title_mode' => __('Choose how you want to operate your store:', 'woocommerce-mercadopago'),
294
- 'title_test' => __('Test Mode', 'woocommerce-mercadopago'),
295
- 'subtitle_test' => __('Mercado Pago Checkouts disabled for real collections. ', 'woocommerce-mercadopago'),
296
- 'subtitle_test_link' => __('Test Mode rules.', 'woocommerce-mercadopago'),
297
- 'title_prod' => __('Sale Mode (Production)', 'woocommerce-mercadopago'),
298
- 'subtitle_prod' => __('Mercado Pago Checkouts enabled for real collections.', 'woocommerce-mercadopago'),
299
- 'title_message_prod' => __('Mercado Pago payment methods in Production Mode', 'woocommerce-mercadopago'),
300
- 'subtitle_message_prod' => __('The clients can make real purchases in your store.', 'woocommerce-mercadopago'),
301
- 'title_message_test' => __('Mercado Pago payment methods in Test Mode', 'woocommerce-mercadopago'),
302
- 'subtitle_link_test' => __('Visit your store ', 'woocommerce-mercadopago'),
303
- 'subtitle_message_test' => __('to test purchases', 'woocommerce-mercadopago'),
304
- 'button_mode' => __('Save changes', 'woocommerce-mercadopago'),
305
- 'badge_test' => __('Store under test', 'woocommerce-mercadopago'),
306
- 'badge_mode' => __('Store in sale mode (Production)', 'woocommerce-mercadopago'),
307
  );
 
308
  return $translation_test_mode;
309
  }
310
 
@@ -486,16 +493,16 @@ class WC_WooMercadoPago_MercadoPago_Settings {
486
  }
487
 
488
  /**
489
- * Update Credentials for production
490
- */
491
  public function update_credential_production() {
492
 
493
  foreach ( WC_WooMercadoPago_Constants::PAYMENT_GATEWAYS as $gateway ) {
494
  $key = 'woocommerce_' . $gateway::get_id() . '_settings';
495
  $options = get_option( $key );
496
  if ( ! empty( $options ) ) {
497
- $old_credential_is_prod = array_key_exists('checkout_credential_prod', $options) && isset($options['checkout_credential_prod']) ? $options['checkout_credential_prod'] : 'no';
498
- $has_new_key = array_key_exists('checkbox_checkout_test_mode', $options) && isset($options['checkbox_checkout_test_mode']);
499
  $options['checkbox_checkout_test_mode'] = $has_new_key && 'deprecated' === $old_credential_is_prod
500
  ? $options['checkbox_checkout_test_mode']
501
  : ( 'yes' === $old_credential_is_prod ? 'no' : 'yes' );
@@ -507,8 +514,8 @@ class WC_WooMercadoPago_MercadoPago_Settings {
507
  }
508
 
509
  /**
510
- * Get payment class properties
511
- */
512
  public function mp_get_payment_class_properties() {
513
  try {
514
  $payments_gateways = WC_WooMercadoPago_Constants::PAYMENT_GATEWAYS;
43
  * Load CSS
44
  */
45
  public function load_admin_style() {
46
+ if ( is_admin() && ( WC_WooMercadoPago_Helper_Current_Url::validate_page( 'mercadopago-settings' ) || WC_WooMercadoPago_Helper_Current_Url::validate_section( 'woo-mercado-pago' ) ) ) {
47
  wp_register_style(
48
  'mercadopago_settings_admin_css',
49
  $this->get_url( '../../../assets/css/mercadopago-settings/mercadopago_settings', '.css' ),
58
  * Load JavaScripts
59
  */
60
  public function load_admin_scripts() {
61
+ if ( is_admin() && ( WC_WooMercadoPago_Helper_Current_Url::validate_page( 'mercadopago-settings' ) || WC_WooMercadoPago_Helper_Current_Url::validate_section( 'woo-mercado-pago' ) ) ) {
62
  wp_enqueue_script(
63
  'mercadopago_settings_javascript',
64
  $this->get_url( '../../../assets/js/mercadopago-settings/mercadopago_settings', '.js' ),
73
  * Load Research JavaScripts
74
  */
75
  public function load_research_script() {
76
+ if ( is_admin() && ( WC_WooMercadoPago_Helper_Current_Url::validate_page( 'mercadopago-settings' ) || WC_WooMercadoPago_Helper_Current_Url::validate_section( 'woo-mercado-pago' ) ) ) {
77
+ global $woocommerce;
78
+ wp_enqueue_script(
79
+ 'mercadopago_research_javascript',
80
+ 'https://http2.mlstatic.com/storage/v1/plugins/caronte/woocommerce.js?v=101',
81
+ array(),
82
+ WC_WooMercadoPago_Constants::VERSION,
83
+ true
84
+ );
85
+ wp_localize_script(
86
+ 'mercadopago_research_javascript',
87
+ 'wc_mercadopago_params',
88
+ array(
89
+ 'site_id' => $this->options->get_site_id() ? strtoupper( $this->options->get_site_id() ) : 'MLA',
90
+ 'platform_id' => WC_WooMercadoPago_Constants::PLATAFORM_ID,
91
+ 'platform_version' => $woocommerce->version,
92
+ 'plugin_version' => WC_WooMercadoPago_Constants::VERSION,
93
+ 'public_key_element_id' => 'mp-public-key-prod',
94
+ 'reference_element_id' => 'reference'
95
+ )
96
+ );
97
+ }
98
  }
99
 
100
  /**
101
  * Load Research Style
102
  */
103
  public function load_research_style() {
104
+ if ( is_admin() && ( WC_WooMercadoPago_Helper_Current_Url::validate_page( 'mercadopago-settings' ) || WC_WooMercadoPago_Helper_Current_Url::validate_section( 'woo-mercado-pago' ) ) ) {
105
+ wp_register_style(
106
+ 'mercadopago_research_css',
107
+ 'https://http2.mlstatic.com/storage/v1/plugins/caronte/woocommerce.css',
108
+ false,
109
+ WC_WooMercadoPago_Constants::VERSION
110
+ );
111
+ wp_enqueue_style( 'mercadopago_research_css' );
112
+ }
113
  }
114
 
115
  /**
153
  * Register Mercado Pago Endpoints
154
  */
155
  public function register_endpoints() {
156
+ add_action( 'wp_ajax_mp_get_requirements', array( $this, 'mercadopago_get_requirements' ) );
157
+ add_action( 'wp_ajax_mp_validate_credentials', array( $this, 'mp_validate_credentials' ) );
158
+ add_action( 'wp_ajax_mp_update_store_information', array( $this, 'mp_update_store_info' ) );
159
+ add_action( 'wp_ajax_mp_store_mode', array( $this, 'mp_set_mode' ) );
160
+ add_action( 'wp_ajax_mp_get_payment_properties', array( $this, 'mp_get_payment_class_properties' ) );
161
+ add_action( 'wp_ajax_mp_validate_store_tips', array( $this, 'mp_validate_store_tips' ) );
162
+ add_action( 'wp_ajax_mp_validate_credentials_tips', array( $this, 'mp_validate_credentials_tips' ) );
163
+ add_action( 'wp_ajax_mp_validate_payment_tips', array( $this, 'mp_validate_payment_tips' ) );
164
+ add_action( 'wp_ajax_mp_update_option_credentials', array( $this, 'mp_update_option_credentials' ) );
165
  }
166
 
167
  /**
171
  */
172
  public function mp_translation_admin_header() {
173
  $translation_header = array(
174
+ 'title_head_part_one' => __( 'Accept ', 'woocommerce-mercadopago' ),
175
+ 'title_head_part_two' => __( 'payments on the spot ', 'woocommerce-mercadopago' ),
176
+ 'title_head_part_three' => __( 'with', 'woocommerce-mercadopago' ),
177
+ 'title_head_part_four' => __( 'the ', 'woocommerce-mercadopago' ),
178
+ 'title_head_part_six' => __( 'security ', 'woocommerce-mercadopago' ),
179
+ 'title_head_part_seven' => __( 'from Mercado Pago', 'woocommerce-mercadopago' ),
180
+ 'title_requirements' => __( 'Technical requirements', 'woocommerce-mercadopago' ),
181
+ 'ssl' => __( 'SSL', 'woocommerce-mercadopago' ),
182
+ 'gd_extensions' => __( 'GD Extensions', 'woocommerce-mercadopago' ),
183
+ 'curl' => __( 'Curl', 'woocommerce-mercadopago' ),
184
+ 'description_ssl' => __( 'Implementation responsible for transmitting data to Mercado Pago in a secure and encrypted way.', 'woocommerce-mercadopago' ),
185
+ 'description_gd_extensions' => __( 'These extensions are responsible for the implementation and operation of Pix in your store.', 'woocommerce-mercadopago' ),
186
+ 'description_curl' => __( 'It is an extension responsible for making payments via requests from the plugin to Mercado Pago.', 'woocommerce-mercadopago' ),
187
+ 'title_installments' => __( 'Collections and installments', 'woocommerce-mercadopago' ),
188
+ 'descripition_installments' => __( 'Choose ', 'woocommerce-mercadopago' ),
189
+ 'descripition_installments_one' => __( 'when you want to receive the money ', 'woocommerce-mercadopago' ),
190
+ 'descripition_installments_two' => __( 'from your sales and if you want to offer ', 'woocommerce-mercadopago' ),
191
+ 'descripition_installments_three' => __( 'interest-free installments ', 'woocommerce-mercadopago' ),
192
+ 'descripition_installments_four' => __( 'to your clients.', 'woocommerce-mercadopago' ),
193
+ 'button_installments' => __( 'Set deadlines and fees', 'woocommerce-mercadopago' ),
194
+ 'title_questions' => __( 'Questions? ', 'woocommerce-mercadopago' ),
195
+ 'descripition_questions_one' => __( 'Review the step-by-step of ', 'woocommerce-mercadopago' ),
196
+ 'descripition_questions_two' => __( 'how to integrate the Mercado Pago Plugin ', 'woocommerce-mercadopago' ),
197
+ 'descripition_questions_three' => __( 'on our webiste for developers.', 'woocommerce-mercadopago' ),
198
+ 'button_questions' => __( 'Plugin manual', 'woocommerce-mercadopago' ),
199
  );
200
 
201
  return $translation_header;
225
  'button_credentials' => __( 'Save and continue', 'woocommerce-mercadopago' ),
226
 
227
  );
228
+
229
  return $translation_credential;
230
  }
231
 
238
 
239
  $translation_store = array(
240
 
241
+ 'title_store' => __( '2. Customize your business', 'woocommerce-mercadopago' ),
242
+ 'subtitle_store' => __( 'Fill out the following information to have a better experience and offer more information to your clients', 'woocommerce-mercadopago' ),
243
+ 'title_info_store' => __( 'Your store information', 'woocommerce-mercadopago' ),
244
+ 'subtitle_name_store' => __( "Name of your store in your client's invoice", 'woocommerce-mercadopago' ),
245
+ 'placeholder_name_store' => __( "Eg: Mary's store", 'woocommerce-mercadopago' ),
246
+ 'helper_name_store' => __( 'If this field is empty, the purchase will be identified as Mercado Pago.', 'woocommerce-mercadopago' ),
247
+ 'subtitle_activities_store' => __( 'Identification in Activities of Mercad Pago', 'woocommerce-mercadopago' ),
248
+ 'placeholder_activities_store' => __( 'Eg: Marystore', 'woocommerce-mercadopago' ),
249
+ 'helper_activities_store' => __( 'In Activities, you will view this term before the order number', 'woocommerce-mercadopago' ),
250
+ 'subtitle_category_store' => __( 'Store category', 'woocommerce-mercadopago' ),
251
+ 'placeholder_category_store' => __( 'Select', 'woocommerce-mercadopago' ),
252
+ 'helper_category_store' => __( 'Select ”Other” if you do not find the appropriate category.', 'woocommerce-mercadopago' ),
253
+ 'title_advanced_store' => __( 'Advanced integration options (optional)', 'woocommerce-mercadopago' ),
254
+ 'subtitle_advanced_store' => __( 'For further integration of your store with Mercado Pago (IPN, Certified Partners, Debug Mode)', 'woocommerce-mercadopago' ),
255
+ 'accordion_advanced_store' => __( 'View advanced options', 'woocommerce-mercadopago' ),
256
+ 'subtitle_url' => __( 'URL for IPN ', 'woocommerce-mercadopago' ),
257
+ 'placeholder_url' => __( 'Eg: https://examples.com/my-custom-ipn-url', 'woocommerce-mercadopago' ),
258
+ 'helper_url' => __( 'Add the URL to receive payments notifications. Find out more information in the ', 'woocommerce-mercadopago' ),
259
+ 'helper_url_link' => __( 'guides.', 'woocommerce-mercadopago' ),
260
+ 'subtitle_integrator' => __( 'integrator_id', 'woocommerce-mercadopago' ),
261
+ 'placeholder_integrator' => __( 'Eg: 14987126498', 'woocommerce-mercadopago' ),
262
+ 'helper_integrator' => __( 'If you are a Mercado Pago Certified Partner, make sure to add your integrator_id. If you do not have the code, please ', 'woocommerce-mercadopago' ),
263
+ 'helper_integrator_link' => __( 'request it now. ', 'woocommerce-mercadopago' ),
264
+ 'title_debug' => __( 'Debug and Log Mode', 'woocommerce-mercadopago' ),
265
+ 'subtitle_debug' => __( "We record your store's actions in order to provide a better assistance.", 'woocommerce-mercadopago' ),
266
+ 'button_store' => __( 'Save and continue', 'woocommerce-mercadopago' ),
267
  );
268
+
269
  return $translation_store;
270
 
271
  }
277
  */
278
  public function mp_translation_admin_payment() {
279
  $translation_payment = array(
280
+ 'title_payments' => __( '3. Set payment methods', 'woocommerce-mercadopago' ),
281
+ 'subtitle_payments' => __( 'To view more options, please select a payment method below', 'woocommerce-mercadopago' ),
282
+ 'settings_payment' => __( 'Settings', 'woocommerce-mercadopago' ),
283
+ 'button_payment' => __( 'Continue', 'woocommerce-mercadopago' ),
284
  );
285
+
286
  return $translation_payment;
287
 
288
  }
294
  */
295
  public function mp_translation_admin_test_mode() {
296
  $translation_test_mode = array(
297
+ 'title_test_mode' => __( '4. Test your store before you sell', 'woocommerce-mercadopago' ),
298
+ 'subtitle_test_mode' => __( 'Test the experience in Test Mode and then enable the Sale Mode (Production) to sell.', 'woocommerce-mercadopago' ),
299
+ 'title_mode' => __( 'Choose how you want to operate your store:', 'woocommerce-mercadopago' ),
300
+ 'title_test' => __( 'Test Mode', 'woocommerce-mercadopago' ),
301
+ 'subtitle_test' => __( 'Mercado Pago Checkouts disabled for real collections. ', 'woocommerce-mercadopago' ),
302
+ 'subtitle_test_link' => __( 'Test Mode rules.', 'woocommerce-mercadopago' ),
303
+ 'title_prod' => __( 'Sale Mode (Production)', 'woocommerce-mercadopago' ),
304
+ 'subtitle_prod' => __( 'Mercado Pago Checkouts enabled for real collections.', 'woocommerce-mercadopago' ),
305
+ 'title_message_prod' => __( 'Mercado Pago payment methods in Production Mode', 'woocommerce-mercadopago' ),
306
+ 'subtitle_message_prod' => __( 'The clients can make real purchases in your store.', 'woocommerce-mercadopago' ),
307
+ 'title_message_test' => __( 'Mercado Pago payment methods in Test Mode', 'woocommerce-mercadopago' ),
308
+ 'subtitle_link_test' => __( 'Visit your store ', 'woocommerce-mercadopago' ),
309
+ 'subtitle_message_test' => __( 'to test purchases', 'woocommerce-mercadopago' ),
310
+ 'button_mode' => __( 'Save changes', 'woocommerce-mercadopago' ),
311
+ 'badge_test' => __( 'Store under test', 'woocommerce-mercadopago' ),
312
+ 'badge_mode' => __( 'Store in sale mode (Production)', 'woocommerce-mercadopago' ),
313
  );
314
+
315
  return $translation_test_mode;
316
  }
317
 
493
  }
494
 
495
  /**
496
+ * Update Credentials for production
497
+ */
498
  public function update_credential_production() {
499
 
500
  foreach ( WC_WooMercadoPago_Constants::PAYMENT_GATEWAYS as $gateway ) {
501
  $key = 'woocommerce_' . $gateway::get_id() . '_settings';
502
  $options = get_option( $key );
503
  if ( ! empty( $options ) ) {
504
+ $old_credential_is_prod = array_key_exists( 'checkout_credential_prod', $options ) && isset( $options['checkout_credential_prod'] ) ? $options['checkout_credential_prod'] : 'no';
505
+ $has_new_key = array_key_exists( 'checkbox_checkout_test_mode', $options ) && isset( $options['checkbox_checkout_test_mode'] );
506
  $options['checkbox_checkout_test_mode'] = $has_new_key && 'deprecated' === $old_credential_is_prod
507
  ? $options['checkbox_checkout_test_mode']
508
  : ( 'yes' === $old_credential_is_prod ? 'no' : 'yes' );
514
  }
515
 
516
  /**
517
+ * Get payment class properties
518
+ */
519
  public function mp_get_payment_class_properties() {
520
  try {
521
  $payments_gateways = WC_WooMercadoPago_Constants::PAYMENT_GATEWAYS;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ecommerce, mercadopago, woocommerce
4
  Requires at least: 4.9.10
5
  Tested up to: 5.9
6
  Requires PHP: 5.6
7
- Stable tag: 5.7.0
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -133,6 +133,11 @@ Set up both the plugin and the checkouts you want to activate on your payment av
133
  Check out our <a href="https://www.mercadopago.com.br/developers/pt/plugins_sdks/plugins/official/woo-commerce/">official documentation</a> for more information on the specific fields to configure.
134
 
135
  == Changelog ==
 
 
 
 
 
136
  = v5.7.0 (14/02/2022) =
137
  * Features
138
  - Redesign Admin
4
  Requires at least: 4.9.10
5
  Tested up to: 5.9
6
  Requires PHP: 5.6
7
+ Stable tag: 5.7.1
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
133
  Check out our <a href="https://www.mercadopago.com.br/developers/pt/plugins_sdks/plugins/official/woo-commerce/">official documentation</a> for more information on the specific fields to configure.
134
 
135
  == Changelog ==
136
+ = v5.7.1 (14/02/2022) =
137
+ * Bug fixes
138
+ - Adjusted js and css load of mercado pago pool
139
+ - Repass all active gateways
140
+
141
  = v5.7.0 (14/02/2022) =
142
  * Features
143
  - Redesign Admin
woocommerce-mercadopago.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Mercado Pago payments for WooCommerce
4
  * Plugin URI: https://github.com/mercadopago/cart-woocommerce
5
  * Description: Configure the payment options and accept payments with cards, ticket and money of Mercado Pago account.
6
- * Version: 5.7.0
7
  * Author: Mercado Pago
8
  * Author URI: https://developers.mercadopago.com/
9
  * Text Domain: woocommerce-mercadopago
3
  * Plugin Name: Mercado Pago payments for WooCommerce
4
  * Plugin URI: https://github.com/mercadopago/cart-woocommerce
5
  * Description: Configure the payment options and accept payments with cards, ticket and money of Mercado Pago account.
6
+ * Version: 5.7.1
7
  * Author: Mercado Pago
8
  * Author URI: https://developers.mercadopago.com/
9
  * Text Domain: woocommerce-mercadopago