Version Description
Download this release
Release Info
| Developer | mercadopago |
| Plugin | |
| Version | 4.0.2-Beta |
| Comparing to | |
| See all releases | |
Code changes from version 4.0.1-Beta to 4.0.2-Beta
- includes/module/WC_WooMercadoPago_Module.php +11 -5
- includes/module/preference/WC_WooMercadoPago_PreferenceAbstract.php +1 -0
- includes/module/preference/WC_WooMercadoPago_PreferenceCustom.php +0 -1
- includes/module/preference/WC_WooMercadoPago_PreferenceTicket.php +0 -1
- includes/payments/WC_WooMercadoPago_PaymentAbstract.php +3 -2
- readme.txt +1 -1
- templates/checkout/custom_checkout.php +1 -1
includes/module/WC_WooMercadoPago_Module.php
CHANGED
|
@@ -61,6 +61,9 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 61 |
*/
|
| 62 |
public static function getMpInstance($payment = null)
|
| 63 |
{
|
|
|
|
|
|
|
|
|
|
| 64 |
$credentials = new WC_WooMercadoPago_Credentials($payment);
|
| 65 |
$validateCredentialsType = $credentials->validateCredentialsType();
|
| 66 |
if ($validateCredentialsType == WC_WooMercadoPago_Credentials::TYPE_ACCESS_TOKEN) {
|
|
@@ -70,6 +73,10 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 70 |
if ($validateCredentialsType == WC_WooMercadoPago_Credentials::TYPE_ACCESS_CLIENT) {
|
| 71 |
$mp = new MP(self::get_module_version(), $credentials->clientId, $credentials->clientSecret);
|
| 72 |
$mp->setPaymentClass($payment);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
if (!isset($mp)) {
|
|
@@ -99,7 +106,7 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 99 |
if (!isset(self::$mpInstancePayment[$class])) {
|
| 100 |
self::$mpInstancePayment[$class] = self::getMpInstance($payment);
|
| 101 |
$mp = self::$mpInstancePayment[$class];
|
| 102 |
-
if(!empty($mp)){
|
| 103 |
return $mp;
|
| 104 |
}
|
| 105 |
}
|
|
@@ -156,7 +163,6 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 156 |
include_once dirname(__FILE__) . '/preference/WC_WooMercadoPago_PreferenceBasic.php';
|
| 157 |
include_once dirname(__FILE__) . '/preference/WC_WooMercadoPago_PreferenceCustom.php';
|
| 158 |
include_once dirname(__FILE__) . '/preference/WC_WooMercadoPago_PreferenceTicket.php';
|
| 159 |
-
|
| 160 |
}
|
| 161 |
|
| 162 |
/**
|
|
@@ -293,7 +299,7 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 293 |
return $new_link;
|
| 294 |
}
|
| 295 |
|
| 296 |
-
return (array)$links;
|
| 297 |
}
|
| 298 |
|
| 299 |
// ============================================================
|
|
@@ -401,7 +407,7 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 401 |
if (isset($currency_obj['response'])) {
|
| 402 |
$currency_obj = $currency_obj['response'];
|
| 403 |
if (isset($currency_obj['ratio'])) {
|
| 404 |
-
return ((float)$currency_obj['ratio']);
|
| 405 |
}
|
| 406 |
}
|
| 407 |
}
|
|
@@ -577,7 +583,7 @@ class WC_WooMercadoPago_Module extends WC_WooMercadoPago_Configs
|
|
| 577 |
public static function build_log_path_string($gateway_id, $gateway_name)
|
| 578 |
{
|
| 579 |
return '<a href="' . esc_url(admin_url('admin.php?page=wc-status&tab=logs&log_file=' .
|
| 580 |
-
|
| 581 |
$gateway_name . '</a>';
|
| 582 |
}
|
| 583 |
|
| 61 |
*/
|
| 62 |
public static function getMpInstance($payment = null)
|
| 63 |
{
|
| 64 |
+
if (!empty($payment)) {
|
| 65 |
+
$payment->clienteid_credential_production = false;
|
| 66 |
+
}
|
| 67 |
$credentials = new WC_WooMercadoPago_Credentials($payment);
|
| 68 |
$validateCredentialsType = $credentials->validateCredentialsType();
|
| 69 |
if ($validateCredentialsType == WC_WooMercadoPago_Credentials::TYPE_ACCESS_TOKEN) {
|
| 73 |
if ($validateCredentialsType == WC_WooMercadoPago_Credentials::TYPE_ACCESS_CLIENT) {
|
| 74 |
$mp = new MP(self::get_module_version(), $credentials->clientId, $credentials->clientSecret);
|
| 75 |
$mp->setPaymentClass($payment);
|
| 76 |
+
if (!empty($payment)) {
|
| 77 |
+
$payment->sandbox = false;
|
| 78 |
+
$payment->clienteid_credential_production = true;
|
| 79 |
+
}
|
| 80 |
}
|
| 81 |
|
| 82 |
if (!isset($mp)) {
|
| 106 |
if (!isset(self::$mpInstancePayment[$class])) {
|
| 107 |
self::$mpInstancePayment[$class] = self::getMpInstance($payment);
|
| 108 |
$mp = self::$mpInstancePayment[$class];
|
| 109 |
+
if (!empty($mp)) {
|
| 110 |
return $mp;
|
| 111 |
}
|
| 112 |
}
|
| 163 |
include_once dirname(__FILE__) . '/preference/WC_WooMercadoPago_PreferenceBasic.php';
|
| 164 |
include_once dirname(__FILE__) . '/preference/WC_WooMercadoPago_PreferenceCustom.php';
|
| 165 |
include_once dirname(__FILE__) . '/preference/WC_WooMercadoPago_PreferenceTicket.php';
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
/**
|
| 299 |
return $new_link;
|
| 300 |
}
|
| 301 |
|
| 302 |
+
return (array) $links;
|
| 303 |
}
|
| 304 |
|
| 305 |
// ============================================================
|
| 407 |
if (isset($currency_obj['response'])) {
|
| 408 |
$currency_obj = $currency_obj['response'];
|
| 409 |
if (isset($currency_obj['ratio'])) {
|
| 410 |
+
return ((float) $currency_obj['ratio']);
|
| 411 |
}
|
| 412 |
}
|
| 413 |
}
|
| 583 |
public static function build_log_path_string($gateway_id, $gateway_name)
|
| 584 |
{
|
| 585 |
return '<a href="' . esc_url(admin_url('admin.php?page=wc-status&tab=logs&log_file=' .
|
| 586 |
+
esc_attr($gateway_id) . '-' . sanitize_file_name(wp_hash($gateway_id)) . '.log')) . '">' .
|
| 587 |
$gateway_name . '</a>';
|
| 588 |
}
|
| 589 |
|
includes/module/preference/WC_WooMercadoPago_PreferenceAbstract.php
CHANGED
|
@@ -76,6 +76,7 @@ abstract class WC_WooMercadoPago_PreferenceAbstract extends WC_Payment_Gateway
|
|
| 76 |
'binary_mode' => $this->get_binary_mode(),
|
| 77 |
'external_reference' => $this->get_external_reference(),
|
| 78 |
'notification_url' => $this->get_notification_url(),
|
|
|
|
| 79 |
);
|
| 80 |
return $preference;
|
| 81 |
}
|
| 76 |
'binary_mode' => $this->get_binary_mode(),
|
| 77 |
'external_reference' => $this->get_external_reference(),
|
| 78 |
'notification_url' => $this->get_notification_url(),
|
| 79 |
+
'statement_descriptor' => $this->payment->getOption('mp_statement_descriptor', 'Mercado Pago'),
|
| 80 |
);
|
| 81 |
return $preference;
|
| 82 |
}
|
includes/module/preference/WC_WooMercadoPago_PreferenceCustom.php
CHANGED
|
@@ -34,7 +34,6 @@ class WC_WooMercadoPago_PreferenceCustom extends WC_WooMercadoPago_PreferenceAbs
|
|
| 34 |
$this->preference['issuer_id'] = (integer)$this->checkout['issuer'];
|
| 35 |
}
|
| 36 |
}
|
| 37 |
-
$this->preference['statement_descriptor'] = $this->payment->getOption('mp_statement_descriptor', 'Mercado Pago');
|
| 38 |
$this->preference['additional_info']['items'] = $this->items;
|
| 39 |
$this->preference['additional_info']['payer'] = $this->get_payer_custom();
|
| 40 |
$this->preference['additional_info']['shipments'] = $this->shipments_receiver_address();
|
| 34 |
$this->preference['issuer_id'] = (integer)$this->checkout['issuer'];
|
| 35 |
}
|
| 36 |
}
|
|
|
|
| 37 |
$this->preference['additional_info']['items'] = $this->items;
|
| 38 |
$this->preference['additional_info']['payer'] = $this->get_payer_custom();
|
| 39 |
$this->preference['additional_info']['shipments'] = $this->shipments_receiver_address();
|
includes/module/preference/WC_WooMercadoPago_PreferenceTicket.php
CHANGED
|
@@ -24,7 +24,6 @@ class WC_WooMercadoPago_PreferenceTicket extends WC_WooMercadoPago_PreferenceAbs
|
|
| 24 |
$this->preference['transaction_amount'] = $this->get_transaction_amount();
|
| 25 |
$this->preference['description'] = implode(', ', $this->list_of_items);
|
| 26 |
$this->preference['payment_method_id'] = $this->checkout['paymentMethodId'];
|
| 27 |
-
$this->preference['statement_descriptor'] = $this->payment->getOption('mp_statement_descriptor', 'Mercado Pago');
|
| 28 |
$this->preference['payer']['email'] = $this->get_email();
|
| 29 |
|
| 30 |
if ($this->site_data[$this->site_id]['currency'] == 'BRL') {
|
| 24 |
$this->preference['transaction_amount'] = $this->get_transaction_amount();
|
| 25 |
$this->preference['description'] = implode(', ', $this->list_of_items);
|
| 26 |
$this->preference['payment_method_id'] = $this->checkout['paymentMethodId'];
|
|
|
|
| 27 |
$this->preference['payer']['email'] = $this->get_email();
|
| 28 |
|
| 29 |
if ($this->site_data[$this->site_id]['currency'] == 'BRL') {
|
includes/payments/WC_WooMercadoPago_PaymentAbstract.php
CHANGED
|
@@ -77,6 +77,7 @@ class WC_WooMercadoPago_PaymentAbstract extends WC_Payment_Gateway
|
|
| 77 |
public $type_payments;
|
| 78 |
public $activated_payment;
|
| 79 |
public $homolog_validate;
|
|
|
|
| 80 |
|
| 81 |
/**
|
| 82 |
* WC_WooMercadoPago_PaymentAbstract constructor.
|
|
@@ -90,7 +91,7 @@ class WC_WooMercadoPago_PaymentAbstract extends WC_Payment_Gateway
|
|
| 90 |
$this->mp_access_token_prod = $this->getOption('_mp_access_token_prod');
|
| 91 |
$this->checkout_country = get_option('checkout_country', '');
|
| 92 |
$this->wc_country = get_option('woocommerce_default_country', '');
|
| 93 |
-
$this->checkout_credential_token_production = $this->getOption('checkout_credential_production', 'no');
|
| 94 |
$this->description = $this->getOption('description');
|
| 95 |
$this->mp_category_id = $this->getOption('_mp_category_id', 0);
|
| 96 |
$this->store_identificator = $this->getOption('_mp_store_identificator', 'WC-');
|
|
@@ -624,7 +625,7 @@ class WC_WooMercadoPago_PaymentAbstract extends WC_Payment_Gateway
|
|
| 624 |
'title' => __('Producción', 'woocommerce-mercadopago'),
|
| 625 |
'type' => 'select',
|
| 626 |
'description' => __('Elige “SÍ” solo cuando estés listo para vender. Cambia a NO para activar el modo Pruebas.', 'woocommerce-mercadopago'),
|
| 627 |
-
'default' => $this->getOption('checkout_credential_production', 'no'),
|
| 628 |
'options' => array(
|
| 629 |
'no' => __('No', 'woocommerce-mercadopago'),
|
| 630 |
'yes' => __('Sí', 'woocommerce-mercadopago')
|
| 77 |
public $type_payments;
|
| 78 |
public $activated_payment;
|
| 79 |
public $homolog_validate;
|
| 80 |
+
public $clienteid_credential_production;
|
| 81 |
|
| 82 |
/**
|
| 83 |
* WC_WooMercadoPago_PaymentAbstract constructor.
|
| 91 |
$this->mp_access_token_prod = $this->getOption('_mp_access_token_prod');
|
| 92 |
$this->checkout_country = get_option('checkout_country', '');
|
| 93 |
$this->wc_country = get_option('woocommerce_default_country', '');
|
| 94 |
+
$this->checkout_credential_token_production = $this->getOption('checkout_credential_production', get_option('checkout_credential_production', 'no'));
|
| 95 |
$this->description = $this->getOption('description');
|
| 96 |
$this->mp_category_id = $this->getOption('_mp_category_id', 0);
|
| 97 |
$this->store_identificator = $this->getOption('_mp_store_identificator', 'WC-');
|
| 625 |
'title' => __('Producción', 'woocommerce-mercadopago'),
|
| 626 |
'type' => 'select',
|
| 627 |
'description' => __('Elige “SÍ” solo cuando estés listo para vender. Cambia a NO para activar el modo Pruebas.', 'woocommerce-mercadopago'),
|
| 628 |
+
'default' => $this->id == 'woo-mercado-pago-basic' && $this->clienteid_credential_production ? 'yes' : $this->getOption('checkout_credential_production', 'no'),
|
| 629 |
'options' => array(
|
| 630 |
'no' => __('No', 'woocommerce-mercadopago'),
|
| 631 |
'yes' => __('Sí', 'woocommerce-mercadopago')
|
readme.txt
CHANGED
|
@@ -111,7 +111,7 @@ Check out our <a href="https://www.mercadopago.com.br/developers/pt/plugins_sdks
|
|
| 111 |
|
| 112 |
== Changelog ==
|
| 113 |
|
| 114 |
-
= v4.0.0
|
| 115 |
* Feature All
|
| 116 |
- Performance improvement
|
| 117 |
- Code refactoring
|
| 111 |
|
| 112 |
== Changelog ==
|
| 113 |
|
| 114 |
+
= v4.0.0 (02/08/2019) =
|
| 115 |
* Feature All
|
| 116 |
- Performance improvement
|
| 117 |
- Code refactoring
|
templates/checkout/custom_checkout.php
CHANGED
|
@@ -56,7 +56,7 @@ if (!defined('ABSPATH')) {
|
|
| 56 |
|
| 57 |
<div class="col-md-12">
|
| 58 |
<div class="frame-tarjetas">
|
| 59 |
-
<p class="subtitle-custom-checkout
|
| 60 |
|
| 61 |
<!-- saved cards -->
|
| 62 |
<div id="mercadopago-form-customer-and-card">
|
| 56 |
|
| 57 |
<div class="col-md-12">
|
| 58 |
<div class="frame-tarjetas">
|
| 59 |
+
<p class="subtitle-custom-checkout"><?= __('Ingresa los datos de tu tarjeta', 'woocommerce-mercadopago') ?></p>
|
| 60 |
|
| 61 |
<!-- saved cards -->
|
| 62 |
<div id="mercadopago-form-customer-and-card">
|
