WooCommerce MercadoPago - Version 5.7.2

Version Description

Download this release

Release Info

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

Code changes from version 5.7.1 to 5.7.2

assets/js/mercadopago-settings/mercadopago_settings.js CHANGED
@@ -27,7 +27,7 @@ function mp_settings_accordion_start() {
27
  }
28
 
29
  function mp_get_requirements() {
30
- wp.ajax.post("mp_get_requirements", {}).done(function (response) {
31
  const requirements = {
32
  ssl: document.getElementById("mp-req-ssl"),
33
  gd_ext: document.getElementById("mp-req-gd"),
@@ -37,7 +37,7 @@ function mp_get_requirements() {
37
  for (let i in requirements) {
38
  let requirement = requirements[i];
39
  requirement.style = "";
40
- if (!response[i]) {
41
  requirement.classList.remove("mp-settings-icon-success");
42
  requirement.classList.add("mp-settings-icon-warning");
43
  }
@@ -51,14 +51,17 @@ function mp_validate_credentials() {
51
  .addEventListener("change", function () {
52
  var self = this;
53
 
54
- wp.ajax
55
- .post("mp_validate_credentials", {
56
- access_token: this.value,
57
- is_test: false,
58
- })
59
- .done(function (response) {
60
  self.classList.add("mp-credential-feedback-positive");
61
  self.classList.remove("mp-credential-feedback-negative");
 
 
 
 
 
62
  })
63
  .fail(function (error) {
64
  self.classList.remove("mp-credential-feedback-positive");
@@ -70,19 +73,20 @@ function mp_validate_credentials() {
70
  .addEventListener("change", function () {
71
  var self = this;
72
 
73
- wp.ajax
74
- .post("mp_validate_credentials", {
75
- access_token: this.value,
76
- is_test: true,
77
- })
78
- .done(function (response) {
79
- self.classList.add("mp-credential-feedback-positive");
80
- self.classList.remove("mp-credential-feedback-negative");
81
- })
82
- .fail(function (error) {
83
  self.classList.remove("mp-credential-feedback-positive");
84
  self.classList.add("mp-credential-feedback-negative");
85
- });
 
 
 
 
86
  });
87
 
88
  document
@@ -90,14 +94,17 @@ function mp_validate_credentials() {
90
  .addEventListener("change", function () {
91
  var self = this;
92
 
93
- wp.ajax
94
- .post("mp_validate_credentials", {
95
- public_key: this.value,
96
- is_test: true,
97
- })
98
  .done(function (response) {
99
- self.classList.add("mp-credential-feedback-positive");
100
- self.classList.remove("mp-credential-feedback-negative");
 
 
 
 
 
101
  })
102
  .fail(function (error) {
103
  self.classList.remove("mp-credential-feedback-positive");
@@ -110,14 +117,17 @@ function mp_validate_credentials() {
110
  .addEventListener("change", function () {
111
  var self = this;
112
 
113
- wp.ajax
114
- .post("mp_validate_credentials", {
115
- public_key: this.value,
116
- is_test: false,
117
- })
118
  .done(function (response) {
119
- self.classList.add("mp-credential-feedback-positive");
120
- self.classList.remove("mp-credential-feedback-negative");
 
 
 
 
 
121
  })
122
  .fail(function (error) {
123
  self.classList.remove("mp-credential-feedback-positive");
@@ -130,29 +140,33 @@ function mp_update_option_credentials() {
130
  const btn_credentials = document.getElementById("mp-btn-credentials");
131
 
132
  btn_credentials.addEventListener("click", function () {
133
- const credentials = {
134
- access_token_prod: document.getElementById("mp-access-token-prod").value,
135
- access_token_test: document.getElementById("mp-access-token-test").value,
136
- public_key_prod: document.getElementById("mp-public-key-prod").value,
137
- public_key_test: document.getElementById("mp-public-key-test").value,
138
- };
139
-
140
- wp.ajax
141
- .post("mp_update_option_credentials", credentials)
142
  .done(function (response) {
143
- mp_show_message(response, "success", "credentials");
144
- mp_validate_credentials_tips();
145
- setTimeout(() => {
146
- mp_go_to_next_step(
147
- "mp-step-1",
148
- "mp-step-2",
149
- "mp-credentials-arrow-up",
150
- "mp-store-info-arrow-up"
151
- );
152
- }, 3000);
 
 
 
 
153
  })
154
  .fail(function (error) {
155
- mp_show_message(error, "error", "credentials");
156
  });
157
  });
158
  }
@@ -160,33 +174,37 @@ function mp_update_option_credentials() {
160
  function mp_update_store_information() {
161
  button = document.getElementById("mp-store-info-save");
162
  button.addEventListener("click", function () {
163
- const store_information = {
164
- store_identificator: document.getElementById("mp-store-identificator")
165
  .value,
166
- store_category_id: document.getElementById("mp-store-category-id").value,
167
- store_categories: document.getElementById("mp-store-categories").value,
168
- store_url_ipn: document.querySelector("#mp-store-url-ipn").value,
169
- store_integrator_id: document.getElementById("mp-store-integrator-id")
170
  .value,
171
- store_debug_mode: document.querySelector("#mp-store-debug-mode:checked")
172
  ?.value,
173
- };
174
- wp.ajax
175
- .post("mp_update_store_information", store_information)
176
  .done(function (response) {
177
- mp_validate_store_tips();
178
- mp_show_message(response, "success", "store");
179
- setTimeout(() => {
180
- mp_go_to_next_step(
181
- "mp-step-2",
182
- "mp-step-3",
183
- "mp-store-info-arrow-up",
184
- "mp-payments-arrow-up"
185
- );
186
- }, 3000);
 
 
 
 
187
  })
188
  .fail(function (error) {
189
- mp_show_message(error, "error", "store");
190
  });
191
  });
192
  }
@@ -224,52 +242,57 @@ function mp_set_mode() {
224
  var mode_value = document.querySelector(
225
  'input[name="mp-test-prod"]:checked'
226
  ).value;
227
- wp.ajax
228
- .post("mp_store_mode", { input_mode_value: mode_value })
229
- .done(function (response) {
230
- var badge = document.getElementById("mp-mode-badge");
231
- var color_badge = document.getElementById("mp-orange-badge");
232
- var icon_badge = document.getElementById("mp-icon-badge");
233
- var text_badge = document.getElementById("mp-text-badge");
234
- var helper_test = document.getElementById("mp-helper-test");
235
- var helper_prod = document.getElementById("mp-helper-prod");
236
- text_badge.textContent = response;
237
-
238
- if (mode_value === "yes") {
239
- badge.classList.remove("mp-settings-prod-mode-alert");
240
- badge.classList.add("mp-settings-test-mode-alert");
241
 
242
- color_badge.classList.remove(
243
- "mp-settings-alert-payment-methods-green"
244
- );
245
- color_badge.classList.add("mp-settings-alert-payment-methods-orange");
246
-
247
- icon_badge.classList.remove("mp-settings-icon-success");
248
- icon_badge.classList.add("mp-settings-icon-warning");
249
-
250
- badge.textContent = "Loja em modo teste";
251
-
252
- helper_test.style.display = "block";
253
- helper_prod.style.display = "none";
254
-
255
- mp_show_message(response, "success", "test_mode");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  } else {
257
- badge.classList.remove("mp-settings-test-mode-alert");
258
- badge.classList.add("mp-settings-prod-mode-alert");
259
- badge.textContent = "Loja em modo vendas (Produção)";
260
-
261
- color_badge.classList.remove(
262
- "mp-settings-alert-payment-methods-orange"
263
- );
264
- color_badge.classList.add("mp-settings-alert-payment-methods-green");
265
-
266
- icon_badge.classList.remove("mp-settings-icon-warning");
267
- icon_badge.classList.add("mp-settings-icon-success");
268
-
269
- helper_test.style.display = "none";
270
- helper_prod.style.display = "block";
271
-
272
- mp_show_message(response, "success", "test_mode");
273
  }
274
  })
275
  .fail(function (error) {
@@ -279,11 +302,12 @@ function mp_set_mode() {
279
  }
280
 
281
  function mp_get_payment_properties() {
282
- wp.ajax
283
- .post("mp_get_payment_properties", {})
 
284
  .done(function (response) {
285
  const payment = document.getElementById("mp-payment");
286
- response.reverse().forEach((gateway) => {
287
  payment.insertAdjacentHTML("afterend", mp_payment_properties(gateway));
288
  mp_payment_properties(gateway);
289
  });
@@ -331,11 +355,16 @@ function mp_validate_credentials_tips() {
331
  var icon_credentials = document.getElementById(
332
  "mp-settings-icon-credentials"
333
  );
334
- wp.ajax
335
- .post("mp_validate_credentials_tips", {})
 
336
  .done(function (response) {
337
- icon_credentials.classList.remove("mp-settings-icon-credentials");
338
- icon_credentials.classList.add("mp-settings-icon-success");
 
 
 
 
339
  })
340
  .fail(function (error) {
341
  icon_credentials.classList.remove("mp-settings-icon-success");
@@ -344,11 +373,16 @@ function mp_validate_credentials_tips() {
344
 
345
  function mp_validate_store_tips() {
346
  var icon_store = document.getElementById("mp-settings-icon-store");
347
- wp.ajax
348
- .post("mp_validate_store_tips", {})
 
349
  .done(function (response) {
350
- icon_store.classList.remove("mp-settings-icon-store");
351
- icon_store.classList.add("mp-settings-icon-success");
 
 
 
 
352
  })
353
  .fail(function (error) {
354
  icon_store.classList.remove("mp-settings-icon-success");
@@ -357,11 +391,16 @@ function mp_validate_store_tips() {
357
 
358
  function mp_validate_payment_tips() {
359
  var icon_payment = document.getElementById("mp-settings-icon-payment");
360
- wp.ajax
361
- .post("mp_validate_payment_tips", {})
 
362
  .done(function (response) {
363
- icon_payment.classList.remove("mp-settings-icon-payment");
364
- icon_payment.classList.add("mp-settings-icon-success");
 
 
 
 
365
  })
366
  .fail(function (error) {
367
  icon_payment.classList.remove("mp-settings-icon-success");
27
  }
28
 
29
  function mp_get_requirements() {
30
+ jQuery.post(ajaxurl, { action: "mp_get_requirements" }, function(response) {
31
  const requirements = {
32
  ssl: document.getElementById("mp-req-ssl"),
33
  gd_ext: document.getElementById("mp-req-gd"),
37
  for (let i in requirements) {
38
  let requirement = requirements[i];
39
  requirement.style = "";
40
+ if (!response.data[i]) {
41
  requirement.classList.remove("mp-settings-icon-success");
42
  requirement.classList.add("mp-settings-icon-warning");
43
  }
51
  .addEventListener("change", function () {
52
  var self = this;
53
 
54
+ jQuery.post(ajaxurl, { access_token: this.value, is_test: false, action: "mp_validate_credentials"}, function(data) {
55
+ console.log('validated');
56
+ }).done(function (response) {
57
+ if (response.data.success) {
 
 
58
  self.classList.add("mp-credential-feedback-positive");
59
  self.classList.remove("mp-credential-feedback-negative");
60
+ } else {
61
+ self.classList.remove("mp-credential-feedback-positive");
62
+ self.classList.add("mp-credential-feedback-negative");
63
+ }
64
+
65
  })
66
  .fail(function (error) {
67
  self.classList.remove("mp-credential-feedback-positive");
73
  .addEventListener("change", function () {
74
  var self = this;
75
 
76
+ jQuery.post(ajaxurl, { access_token: this.value, is_test: true, action: "mp_validate_credentials"}, function(data) {
77
+ console.log('validated');
78
+ }).done(function (response) {
79
+ if (response.data.success) {
80
+ self.classList.add( "mp-credential-feedback-positive" );
81
+ self.classList.remove( "mp-credential-feedback-negative" );
82
+ } else {
 
 
 
83
  self.classList.remove("mp-credential-feedback-positive");
84
  self.classList.add("mp-credential-feedback-negative");
85
+ }
86
+ }).fail(function (error) {
87
+ self.classList.remove("mp-credential-feedback-positive");
88
+ self.classList.add("mp-credential-feedback-negative");
89
+ });
90
  });
91
 
92
  document
94
  .addEventListener("change", function () {
95
  var self = this;
96
 
97
+ jQuery.post(ajaxurl, { public_key: this.value, is_test: true, action: "mp_validate_credentials"}, function(data) {
98
+ console.log('validated');
99
+ })
 
 
100
  .done(function (response) {
101
+ if (response.data.success) {
102
+ self.classList.add( "mp-credential-feedback-positive" );
103
+ self.classList.remove( "mp-credential-feedback-negative" );
104
+ } else {
105
+ self.classList.remove("mp-credential-feedback-positive");
106
+ self.classList.add("mp-credential-feedback-negative");
107
+ }
108
  })
109
  .fail(function (error) {
110
  self.classList.remove("mp-credential-feedback-positive");
117
  .addEventListener("change", function () {
118
  var self = this;
119
 
120
+ jQuery.post(ajaxurl, { public_key: this.value, is_test: false, action: "mp_validate_credentials"}, function(data) {
121
+ console.log('validated');
122
+ })
 
 
123
  .done(function (response) {
124
+ if (response.data.success) {
125
+ self.classList.add( "mp-credential-feedback-positive" );
126
+ self.classList.remove( "mp-credential-feedback-negative" );
127
+ } else {
128
+ self.classList.remove("mp-credential-feedback-positive");
129
+ self.classList.add("mp-credential-feedback-negative");
130
+ }
131
  })
132
  .fail(function (error) {
133
  self.classList.remove("mp-credential-feedback-positive");
140
  const btn_credentials = document.getElementById("mp-btn-credentials");
141
 
142
  btn_credentials.addEventListener("click", function () {
143
+ jQuery.post( ajaxurl, {
144
+ access_token_prod: document.getElementById( "mp-access-token-prod" ).value,
145
+ access_token_test: document.getElementById( "mp-access-token-test" ).value,
146
+ public_key_prod: document.getElementById( "mp-public-key-prod" ).value,
147
+ public_key_test: document.getElementById( "mp-public-key-test" ).value,
148
+ action: "mp_update_option_credentials"
149
+ }, function ( data ) {
150
+
151
+ } )
152
  .done(function (response) {
153
+ if (response.success) {
154
+ mp_show_message(response.data, "success", "credentials");
155
+ mp_validate_credentials_tips();
156
+ setTimeout(() => {
157
+ mp_go_to_next_step(
158
+ "mp-step-1",
159
+ "mp-step-2",
160
+ "mp-credentials-arrow-up",
161
+ "mp-store-info-arrow-up"
162
+ );
163
+ }, 3000);
164
+ } else {
165
+ mp_show_message(error, "error", "credentials");
166
+ }
167
  })
168
  .fail(function (error) {
169
+ mp_show_message('error', "error", "credentials");
170
  });
171
  });
172
  }
174
  function mp_update_store_information() {
175
  button = document.getElementById("mp-store-info-save");
176
  button.addEventListener("click", function () {
177
+ jQuery.post( ajaxurl, {
178
+ store_identificator: document.getElementById( "mp-store-identificator" )
179
  .value,
180
+ store_category_id: document.getElementById( "mp-store-category-id" ).value,
181
+ store_categories: document.getElementById( "mp-store-categories" ).value,
182
+ store_url_ipn: document.querySelector( "#mp-store-url-ipn" ).value,
183
+ store_integrator_id: document.getElementById( "mp-store-integrator-id" )
184
  .value,
185
+ store_debug_mode: document.querySelector( "#mp-store-debug-mode:checked" )
186
  ?.value,
187
+ action: "mp_update_store_information"
188
+ }, function ( data ) {
189
+ } )
190
  .done(function (response) {
191
+ if (response.success) {
192
+ mp_validate_store_tips();
193
+ mp_show_message( response.data, "success", "store" );
194
+ setTimeout( () => {
195
+ mp_go_to_next_step(
196
+ "mp-step-2",
197
+ "mp-step-3",
198
+ "mp-store-info-arrow-up",
199
+ "mp-payments-arrow-up"
200
+ );
201
+ }, 3000 );
202
+ } else {
203
+ mp_show_message('error', "error", "store");
204
+ }
205
  })
206
  .fail(function (error) {
207
+ mp_show_message('error', "error", "store");
208
  });
209
  });
210
  }
242
  var mode_value = document.querySelector(
243
  'input[name="mp-test-prod"]:checked'
244
  ).value;
245
+ jQuery.post(ajaxurl, { input_mode_value: mode_value, action: "mp_store_mode"}, function(data) {
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
+ })
248
+ .done(function (response) {
249
+ if (response.data) {
250
+ var badge = document.getElementById( "mp-mode-badge" );
251
+ var color_badge = document.getElementById( "mp-orange-badge" );
252
+ var icon_badge = document.getElementById( "mp-icon-badge" );
253
+ var text_badge = document.getElementById( "mp-text-badge" );
254
+ var helper_test = document.getElementById( "mp-helper-test" );
255
+ var helper_prod = document.getElementById( "mp-helper-prod" );
256
+ text_badge.textContent = response.data;
257
+
258
+ if ( mode_value === "yes" ) {
259
+ badge.classList.remove( "mp-settings-prod-mode-alert" );
260
+ badge.classList.add( "mp-settings-test-mode-alert" );
261
+
262
+ color_badge.classList.remove(
263
+ "mp-settings-alert-payment-methods-green"
264
+ );
265
+ color_badge.classList.add( "mp-settings-alert-payment-methods-orange" );
266
+
267
+ icon_badge.classList.remove( "mp-settings-icon-success" );
268
+ icon_badge.classList.add( "mp-settings-icon-warning" );
269
+
270
+ badge.textContent = "Loja em modo teste";
271
+
272
+ helper_test.style.display = "block";
273
+ helper_prod.style.display = "none";
274
+
275
+ mp_show_message( response.data, "success", "test_mode" );
276
+ } else {
277
+ badge.classList.remove( "mp-settings-test-mode-alert" );
278
+ badge.classList.add( "mp-settings-prod-mode-alert" );
279
+ badge.textContent = "Loja em modo vendas (Produção)";
280
+
281
+ color_badge.classList.remove(
282
+ "mp-settings-alert-payment-methods-orange"
283
+ );
284
+ color_badge.classList.add( "mp-settings-alert-payment-methods-green" );
285
+
286
+ icon_badge.classList.remove( "mp-settings-icon-warning" );
287
+ icon_badge.classList.add( "mp-settings-icon-success" );
288
+
289
+ helper_test.style.display = "none";
290
+ helper_prod.style.display = "block";
291
+
292
+ mp_show_message( response.data, "success", "test_mode" );
293
+ }
294
  } else {
295
+ mp_show_message(error, "error", "test_mode");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
  })
298
  .fail(function (error) {
302
  }
303
 
304
  function mp_get_payment_properties() {
305
+ jQuery.post(ajaxurl, { action: "mp_get_payment_properties" }, function(data) {
306
+
307
+ })
308
  .done(function (response) {
309
  const payment = document.getElementById("mp-payment");
310
+ response.data.reverse().forEach((gateway) => {
311
  payment.insertAdjacentHTML("afterend", mp_payment_properties(gateway));
312
  mp_payment_properties(gateway);
313
  });
355
  var icon_credentials = document.getElementById(
356
  "mp-settings-icon-credentials"
357
  );
358
+ jQuery.post(ajaxurl, { action: "mp_validate_credentials_tips" }, function(data) {
359
+
360
+ })
361
  .done(function (response) {
362
+ if (response.success) {
363
+ icon_credentials.classList.remove( "mp-settings-icon-credentials" );
364
+ icon_credentials.classList.add( "mp-settings-icon-success" );
365
+ } else {
366
+ icon_credentials.classList.remove("mp-settings-icon-success");
367
+ }
368
  })
369
  .fail(function (error) {
370
  icon_credentials.classList.remove("mp-settings-icon-success");
373
 
374
  function mp_validate_store_tips() {
375
  var icon_store = document.getElementById("mp-settings-icon-store");
376
+ jQuery.post(ajaxurl, { action: "mp_validate_store_tips" }, function(data) {
377
+
378
+ })
379
  .done(function (response) {
380
+ if (response.success) {
381
+ icon_store.classList.remove("mp-settings-icon-store");
382
+ icon_store.classList.add("mp-settings-icon-success");
383
+ } else {
384
+ icon_store.classList.remove("mp-settings-icon-success");
385
+ }
386
  })
387
  .fail(function (error) {
388
  icon_store.classList.remove("mp-settings-icon-success");
391
 
392
  function mp_validate_payment_tips() {
393
  var icon_payment = document.getElementById("mp-settings-icon-payment");
394
+ jQuery.post(ajaxurl, { action: "mp_validate_payment_tips" }, function(data) {
395
+
396
+ })
397
  .done(function (response) {
398
+ if (response.success) {
399
+ icon_payment.classList.remove("mp-settings-icon-payment");
400
+ icon_payment.classList.add("mp-settings-icon-success");
401
+ } else {
402
+ icon_payment.classList.remove("mp-settings-icon-success");
403
+ }
404
  })
405
  .fail(function (error) {
406
  icon_payment.classList.remove("mp-settings-icon-success");
assets/js/mercadopago-settings/mercadopago_settings.min.js CHANGED
@@ -1 +1 @@
1
- function mp_settings_accordion_start(){var e,t=document.getElementsByClassName("mp-settings-title-align");for(e=0;e<t.length;e++)t[e].addEventListener("click",(function(){this.classList.toggle("active");for(var e=null,t=0;t<this.childNodes.length;t++)if(this.childNodes[t]?.classList?.contains("mp-settings-margin-left")){e=this.childNodes[t];break}e.childNodes[1].classList.toggle("mp-arrow-up");var s=this.nextElementSibling;"block"===s.style.display?s.style.display="none":s.style.display="block"}))}function mp_get_requirements(){wp.ajax.post("mp_get_requirements",{}).done((function(e){const t={ssl:document.getElementById("mp-req-ssl"),gd_ext:document.getElementById("mp-req-gd"),curl_ext:document.getElementById("mp-req-curl")};for(let s in t){let n=t[s];n.style="",e[s]||(n.classList.remove("mp-settings-icon-success"),n.classList.add("mp-settings-icon-warning"))}}))}function mp_validate_credentials(){document.getElementById("mp-access-token-prod").addEventListener("change",(function(){var e=this;wp.ajax.post("mp_validate_credentials",{access_token:this.value,is_test:!1}).done((function(t){e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))})),document.getElementById("mp-access-token-test").addEventListener("change",(function(){var e=this;wp.ajax.post("mp_validate_credentials",{access_token:this.value,is_test:!0}).done((function(t){e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))})),document.getElementById("mp-public-key-test").addEventListener("change",(function(){var e=this;wp.ajax.post("mp_validate_credentials",{public_key:this.value,is_test:!0}).done((function(t){e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))})),document.getElementById("mp-public-key-prod").addEventListener("change",(function(){var e=this;wp.ajax.post("mp_validate_credentials",{public_key:this.value,is_test:!1}).done((function(t){e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))}))}function mp_update_option_credentials(){document.getElementById("mp-btn-credentials").addEventListener("click",(function(){const e={access_token_prod:document.getElementById("mp-access-token-prod").value,access_token_test:document.getElementById("mp-access-token-test").value,public_key_prod:document.getElementById("mp-public-key-prod").value,public_key_test:document.getElementById("mp-public-key-test").value};wp.ajax.post("mp_update_option_credentials",e).done((function(e){mp_show_message(e,"success","credentials"),mp_validate_credentials_tips(),setTimeout((()=>{mp_go_to_next_step("mp-step-1","mp-step-2","mp-credentials-arrow-up","mp-store-info-arrow-up")}),3e3)})).fail((function(e){mp_show_message(e,"error","credentials")}))}))}function mp_update_store_information(){button=document.getElementById("mp-store-info-save"),button.addEventListener("click",(function(){const e={store_identificator:document.getElementById("mp-store-identificator").value,store_category_id:document.getElementById("mp-store-category-id").value,store_categories:document.getElementById("mp-store-categories").value,store_url_ipn:document.querySelector("#mp-store-url-ipn").value,store_integrator_id:document.getElementById("mp-store-integrator-id").value,store_debug_mode:document.querySelector("#mp-store-debug-mode:checked")?.value};wp.ajax.post("mp_update_store_information",e).done((function(e){mp_validate_store_tips(),mp_show_message(e,"success","store"),setTimeout((()=>{mp_go_to_next_step("mp-step-2","mp-step-3","mp-store-info-arrow-up","mp-payments-arrow-up")}),3e3)})).fail((function(e){mp_show_message(e,"error","store")}))}))}function mp_settings_accordion_options(){var e=document.getElementById("options"),t=document.getElementById("block-two");e.addEventListener("click",(function(){this.classList.toggle("active");var s=this.nextElementSibling;"block"===s.style.display?s.style.display="none":s.style.display="block",e.classList.contains("active")||t.classList.contains("mp-settings-flex-start")?(e.textContent="Ocultar opções avançadas",t.classList.remove("mp-settings-flex-start")):(t.classList.toggle("mp-settings-flex-start"),e.textContent="Ver opções avançadas")}))}function mp_set_mode(){document.getElementById("mp-store-mode-save").addEventListener("click",(function(){var e=document.querySelector('input[name="mp-test-prod"]:checked').value;wp.ajax.post("mp_store_mode",{input_mode_value:e}).done((function(t){var s=document.getElementById("mp-mode-badge"),n=document.getElementById("mp-orange-badge"),a=document.getElementById("mp-icon-badge"),i=document.getElementById("mp-text-badge"),o=document.getElementById("mp-helper-test"),c=document.getElementById("mp-helper-prod");i.textContent=t,"yes"===e?(s.classList.remove("mp-settings-prod-mode-alert"),s.classList.add("mp-settings-test-mode-alert"),n.classList.remove("mp-settings-alert-payment-methods-green"),n.classList.add("mp-settings-alert-payment-methods-orange"),a.classList.remove("mp-settings-icon-success"),a.classList.add("mp-settings-icon-warning"),s.textContent="Loja em modo teste",o.style.display="block",c.style.display="none",mp_show_message(t,"success","test_mode")):(s.classList.remove("mp-settings-test-mode-alert"),s.classList.add("mp-settings-prod-mode-alert"),s.textContent="Loja em modo vendas (Produção)",n.classList.remove("mp-settings-alert-payment-methods-orange"),n.classList.add("mp-settings-alert-payment-methods-green"),a.classList.remove("mp-settings-icon-warning"),a.classList.add("mp-settings-icon-success"),o.style.display="none",c.style.display="block",mp_show_message(t,"success","test_mode"))})).fail((function(e){mp_show_message(e,"error","test_mode")}))}))}function mp_get_payment_properties(){wp.ajax.post("mp_get_payment_properties",{}).done((function(e){const t=document.getElementById("mp-payment");e.reverse().forEach((e=>{t.insertAdjacentHTML("afterend",mp_payment_properties(e)),mp_payment_properties(e)}))})).fail((function(e){}))}function mp_payment_properties(e){var t="yes"==e.enabled?"mp-settings-badge-active":"mp-settings-badge-inactive",s="yes"==e.enabled?e.badge_translator.yes:e.badge_translator.no;return' <a href="'+e.link+'" class="mp-settings-link mp-settings-font-color"><div class="mp-block mp-block-flex mp-settings-payment-block mp-settings-margin-right mp-settings-align-div"> <div class="mp-settings-align-div"> <div class="mp-settings-icon '+e.icon+'"></div> <span class="mp-settings-subtitle-font-size mp-settings-margin-title-payment"> <b>'+e.title+"</b> - "+e.description+' </span> <span class="'+t+'" > '+s+'</span> </div> <div class="mp-settings-title-align"> <span class="mp-settings-text-payment">Configurar</span> <img class="mp-settings-icon-config"> </div> </div></a>'}function mp_validate_credentials_tips(){var e=document.getElementById("mp-settings-icon-credentials");wp.ajax.post("mp_validate_credentials_tips",{}).done((function(t){e.classList.remove("mp-settings-icon-credentials"),e.classList.add("mp-settings-icon-success")})).fail((function(t){e.classList.remove("mp-settings-icon-success")}))}function mp_validate_store_tips(){var e=document.getElementById("mp-settings-icon-store");wp.ajax.post("mp_validate_store_tips",{}).done((function(t){e.classList.remove("mp-settings-icon-store"),e.classList.add("mp-settings-icon-success")})).fail((function(t){e.classList.remove("mp-settings-icon-success")}))}function mp_validate_payment_tips(){var e=document.getElementById("mp-settings-icon-payment");wp.ajax.post("mp_validate_payment_tips",{}).done((function(t){e.classList.remove("mp-settings-icon-payment"),e.classList.add("mp-settings-icon-success")})).fail((function(t){e.classList.remove("mp-settings-icon-success")}))}function mp_show_message(e,t,s){const n=document.createElement("div");var a="",i="";switch(s){case"credentials":a=document.querySelector(".mp-message-credentials"),i=document.querySelector(".mp-heading-credentials");break;case"store":a=document.querySelector(".mp-message-store"),i=document.querySelector(".mp-heading-store");break;case"payment":a=document.querySelector(".mp-message-payment"),i=document.querySelector(".mp-heading-payment");break;case"test_mode":a=document.querySelector(".mp-message-test-mode"),i=document.querySelector(".mp-heading-test-mode");break;default:a="",i=""}n.className="error"===t?"mp-alert mp-alert-danger mp-text-center mp-card-body":"mp-alert mp-alert-success mp-text-center mp-card-body",n.appendChild(document.createTextNode(e)),a.insertBefore(n,i),setTimeout(clearMessage,3e3)}function clearMessage(){document.querySelector(".mp-alert").remove()}function mp_go_to_next_step(e,t,s,n){var a=document.getElementById(e),i=document.getElementById(t),o=document.getElementById(s),c=document.getElementById(n);a.style.display="none",i.style.display="block",o.classList.remove("mp-arrow-up"),c.classList.add("mp-arrow-up")}function mp_continue_to_next_step(){document.getElementById("mp-payment-method-continue").addEventListener("click",(function(){mp_go_to_next_step("mp-step-3","mp-step-4","mp-payments-arrow-up","mp-modes-arrow-up")}))}function mp_settings_screen_load(){mp_settings_accordion_start(),mp_settings_accordion_options(),mp_get_requirements(),mp_validate_credentials(),mp_update_option_credentials(),mp_update_store_information(),mp_set_mode(),mp_get_payment_properties(),mp_validate_credentials_tips(),mp_validate_store_tips(),mp_validate_payment_tips(),mp_continue_to_next_step()}
1
+ function mp_settings_accordion_start(){var e,t=document.getElementsByClassName("mp-settings-title-align");for(e=0;e<t.length;e++)t[e].addEventListener("click",(function(){this.classList.toggle("active");for(var e=null,t=0;t<this.childNodes.length;t++)if(this.childNodes[t]?.classList?.contains("mp-settings-margin-left")){e=this.childNodes[t];break}e.childNodes[1].classList.toggle("mp-arrow-up");var s=this.nextElementSibling;"block"===s.style.display?s.style.display="none":s.style.display="block"}))}function mp_get_requirements(){jQuery.post(ajaxurl,{action:"mp_get_requirements"},(function(e){const t={ssl:document.getElementById("mp-req-ssl"),gd_ext:document.getElementById("mp-req-gd"),curl_ext:document.getElementById("mp-req-curl")};for(let s in t){let n=t[s];n.style="",e.data[s]||(n.classList.remove("mp-settings-icon-success"),n.classList.add("mp-settings-icon-warning"))}}))}function mp_validate_credentials(){document.getElementById("mp-access-token-prod").addEventListener("change",(function(){var e=this;jQuery.post(ajaxurl,{access_token:this.value,is_test:!1,action:"mp_validate_credentials"},(function(e){console.log("validated")})).done((function(t){t.data.success?(e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")):(e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative"))})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))})),document.getElementById("mp-access-token-test").addEventListener("change",(function(){var e=this;jQuery.post(ajaxurl,{access_token:this.value,is_test:!0,action:"mp_validate_credentials"},(function(e){console.log("validated")})).done((function(t){t.data.success?(e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")):(e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative"))})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))})),document.getElementById("mp-public-key-test").addEventListener("change",(function(){var e=this;jQuery.post(ajaxurl,{public_key:this.value,is_test:!0,action:"mp_validate_credentials"},(function(e){console.log("validated")})).done((function(t){t.data.success?(e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")):(e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative"))})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))})),document.getElementById("mp-public-key-prod").addEventListener("change",(function(){var e=this;jQuery.post(ajaxurl,{public_key:this.value,is_test:!1,action:"mp_validate_credentials"},(function(e){console.log("validated")})).done((function(t){t.data.success?(e.classList.add("mp-credential-feedback-positive"),e.classList.remove("mp-credential-feedback-negative")):(e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative"))})).fail((function(t){e.classList.remove("mp-credential-feedback-positive"),e.classList.add("mp-credential-feedback-negative")}))}))}function mp_update_option_credentials(){document.getElementById("mp-btn-credentials").addEventListener("click",(function(){jQuery.post(ajaxurl,{access_token_prod:document.getElementById("mp-access-token-prod").value,access_token_test:document.getElementById("mp-access-token-test").value,public_key_prod:document.getElementById("mp-public-key-prod").value,public_key_test:document.getElementById("mp-public-key-test").value,action:"mp_update_option_credentials"},(function(e){})).done((function(e){e.success?(mp_show_message(e.data,"success","credentials"),mp_validate_credentials_tips(),setTimeout((()=>{mp_go_to_next_step("mp-step-1","mp-step-2","mp-credentials-arrow-up","mp-store-info-arrow-up")}),3e3)):mp_show_message(error,"error","credentials")})).fail((function(e){mp_show_message("error","error","credentials")}))}))}function mp_update_store_information(){button=document.getElementById("mp-store-info-save"),button.addEventListener("click",(function(){jQuery.post(ajaxurl,{store_identificator:document.getElementById("mp-store-identificator").value,store_category_id:document.getElementById("mp-store-category-id").value,store_categories:document.getElementById("mp-store-categories").value,store_url_ipn:document.querySelector("#mp-store-url-ipn").value,store_integrator_id:document.getElementById("mp-store-integrator-id").value,store_debug_mode:document.querySelector("#mp-store-debug-mode:checked")?.value,action:"mp_update_store_information"},(function(e){})).done((function(e){e.success?(mp_validate_store_tips(),mp_show_message(e.data,"success","store"),setTimeout((()=>{mp_go_to_next_step("mp-step-2","mp-step-3","mp-store-info-arrow-up","mp-payments-arrow-up")}),3e3)):mp_show_message("error","error","store")})).fail((function(e){mp_show_message("error","error","store")}))}))}function mp_settings_accordion_options(){var e=document.getElementById("options"),t=document.getElementById("block-two");e.addEventListener("click",(function(){this.classList.toggle("active");var s=this.nextElementSibling;"block"===s.style.display?s.style.display="none":s.style.display="block",e.classList.contains("active")||t.classList.contains("mp-settings-flex-start")?(e.textContent="Ocultar opções avançadas",t.classList.remove("mp-settings-flex-start")):(t.classList.toggle("mp-settings-flex-start"),e.textContent="Ver opções avançadas")}))}function mp_set_mode(){document.getElementById("mp-store-mode-save").addEventListener("click",(function(){var e=document.querySelector('input[name="mp-test-prod"]:checked').value;jQuery.post(ajaxurl,{input_mode_value:e,action:"mp_store_mode"},(function(e){})).done((function(t){if(t.data){var s=document.getElementById("mp-mode-badge"),n=document.getElementById("mp-orange-badge"),a=document.getElementById("mp-icon-badge"),i=document.getElementById("mp-text-badge"),o=document.getElementById("mp-helper-test"),c=document.getElementById("mp-helper-prod");i.textContent=t.data,"yes"===e?(s.classList.remove("mp-settings-prod-mode-alert"),s.classList.add("mp-settings-test-mode-alert"),n.classList.remove("mp-settings-alert-payment-methods-green"),n.classList.add("mp-settings-alert-payment-methods-orange"),a.classList.remove("mp-settings-icon-success"),a.classList.add("mp-settings-icon-warning"),s.textContent="Loja em modo teste",o.style.display="block",c.style.display="none",mp_show_message(t.data,"success","test_mode")):(s.classList.remove("mp-settings-test-mode-alert"),s.classList.add("mp-settings-prod-mode-alert"),s.textContent="Loja em modo vendas (Produção)",n.classList.remove("mp-settings-alert-payment-methods-orange"),n.classList.add("mp-settings-alert-payment-methods-green"),a.classList.remove("mp-settings-icon-warning"),a.classList.add("mp-settings-icon-success"),o.style.display="none",c.style.display="block",mp_show_message(t.data,"success","test_mode"))}else mp_show_message(error,"error","test_mode")})).fail((function(e){mp_show_message(e,"error","test_mode")}))}))}function mp_get_payment_properties(){jQuery.post(ajaxurl,{action:"mp_get_payment_properties"},(function(e){})).done((function(e){const t=document.getElementById("mp-payment");e.data.reverse().forEach((e=>{t.insertAdjacentHTML("afterend",mp_payment_properties(e)),mp_payment_properties(e)}))})).fail((function(e){}))}function mp_payment_properties(e){var t="yes"==e.enabled?"mp-settings-badge-active":"mp-settings-badge-inactive",s="yes"==e.enabled?e.badge_translator.yes:e.badge_translator.no;return' <a href="'+e.link+'" class="mp-settings-link mp-settings-font-color"><div class="mp-block mp-block-flex mp-settings-payment-block mp-settings-margin-right mp-settings-align-div"> <div class="mp-settings-align-div"> <div class="mp-settings-icon '+e.icon+'"></div> <span class="mp-settings-subtitle-font-size mp-settings-margin-title-payment"> <b>'+e.title+"</b> - "+e.description+' </span> <span class="'+t+'" > '+s+'</span> </div> <div class="mp-settings-title-align"> <span class="mp-settings-text-payment">Configurar</span> <img class="mp-settings-icon-config"> </div> </div></a>'}function mp_validate_credentials_tips(){var e=document.getElementById("mp-settings-icon-credentials");jQuery.post(ajaxurl,{action:"mp_validate_credentials_tips"},(function(e){})).done((function(t){t.success?(e.classList.remove("mp-settings-icon-credentials"),e.classList.add("mp-settings-icon-success")):e.classList.remove("mp-settings-icon-success")})).fail((function(t){e.classList.remove("mp-settings-icon-success")}))}function mp_validate_store_tips(){var e=document.getElementById("mp-settings-icon-store");jQuery.post(ajaxurl,{action:"mp_validate_store_tips"},(function(e){})).done((function(t){t.success?(e.classList.remove("mp-settings-icon-store"),e.classList.add("mp-settings-icon-success")):e.classList.remove("mp-settings-icon-success")})).fail((function(t){e.classList.remove("mp-settings-icon-success")}))}function mp_validate_payment_tips(){var e=document.getElementById("mp-settings-icon-payment");jQuery.post(ajaxurl,{action:"mp_validate_payment_tips"},(function(e){})).done((function(t){t.success?(e.classList.remove("mp-settings-icon-payment"),e.classList.add("mp-settings-icon-success")):e.classList.remove("mp-settings-icon-success")})).fail((function(t){e.classList.remove("mp-settings-icon-success")}))}function mp_show_message(e,t,s){const n=document.createElement("div");var a="",i="";switch(s){case"credentials":a=document.querySelector(".mp-message-credentials"),i=document.querySelector(".mp-heading-credentials");break;case"store":a=document.querySelector(".mp-message-store"),i=document.querySelector(".mp-heading-store");break;case"payment":a=document.querySelector(".mp-message-payment"),i=document.querySelector(".mp-heading-payment");break;case"test_mode":a=document.querySelector(".mp-message-test-mode"),i=document.querySelector(".mp-heading-test-mode");break;default:a="",i=""}n.className="error"===t?"mp-alert mp-alert-danger mp-text-center mp-card-body":"mp-alert mp-alert-success mp-text-center mp-card-body",n.appendChild(document.createTextNode(e)),a.insertBefore(n,i),setTimeout(clearMessage,3e3)}function clearMessage(){document.querySelector(".mp-alert").remove()}function mp_go_to_next_step(e,t,s,n){var a=document.getElementById(e),i=document.getElementById(t),o=document.getElementById(s),c=document.getElementById(n);a.style.display="none",i.style.display="block",o.classList.remove("mp-arrow-up"),c.classList.add("mp-arrow-up")}function mp_continue_to_next_step(){document.getElementById("mp-payment-method-continue").addEventListener("click",(function(){mp_go_to_next_step("mp-step-3","mp-step-4","mp-payments-arrow-up","mp-modes-arrow-up")}))}function mp_settings_screen_load(){mp_settings_accordion_start(),mp_settings_accordion_options(),mp_get_requirements(),mp_validate_credentials(),mp_update_option_credentials(),mp_update_store_information(),mp_set_mode(),mp_get_payment_properties(),mp_validate_credentials_tips(),mp_validate_store_tips(),mp_validate_payment_tips(),mp_continue_to_next_step()}
includes/module/class-wc-woomercadopago-configs.php CHANGED
@@ -397,7 +397,7 @@ class WC_WooMercadoPago_Configs {
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
 
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
 
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.1';
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.2';
25
  const MIN_PHP = 5.6;
26
  const API_MP_BASE_URL = 'https://api.mercadopago.com';
27
  const PAYMENT_GATEWAYS = array(
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.1
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -133,6 +133,10 @@ 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.1 (14/02/2022) =
137
  * Bug fixes
138
  - Adjusted js and css load of mercado pago pool
4
  Requires at least: 4.9.10
5
  Tested up to: 5.9
6
  Requires PHP: 5.6
7
+ Stable tag: 5.7.2
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.2 (14/02/2022) =
137
+ * Bug fixes
138
+ - Using Jquery from wp.ajax
139
+
140
  = v5.7.1 (14/02/2022) =
141
  * Bug fixes
142
  - Adjusted js and css load of mercado pago pool
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.1
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.2
7
  * Author: Mercado Pago
8
  * Author URI: https://developers.mercadopago.com/
9
  * Text Domain: woocommerce-mercadopago