Skip to content

Commit

Permalink
Merge pull request #240 from PluginAndPartners/master
Browse files Browse the repository at this point in the history
Release v4.1.1
  • Loading branch information
GiovanniCavallari authored Jan 10, 2020
2 parents bc983fb + 4d62555 commit d266670
Show file tree
Hide file tree
Showing 32 changed files with 70 additions and 65 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [4.1.1] - 2020-01-10

### Added
- [PPP-155] Currency Conversion in Checkout Mercado Pago added

### Changed
- [PPP-154] Currency Conversion for CHO Custom ON and OFF fixed
- [PPP-156] Shipping Cost in the creation of Preferences fixed
- [PPP-156] ME2 shipping mode in the creation of Preferences removed
- [PPP-44] Checkout Mercado Pago class instance fixed when the first configurations are saved


## [4.1.0] - 2020-01-06

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
</a></p>

<p align="center">
<img src="https://img.shields.io/badge/plugin-V4.1.0-blue" alt="version">
<img src="https://img.shields.io/badge/plugin-V4.1.1-blue" alt="version">
<img src="https://img.shields.io/wordpress/plugin/dt/woocommerce-mercadopago" alt="download">
<img src="https://img.shields.io/github/license/mercadopago/cart-woocommerce" alt="license">
</p>
Expand Down
10 changes: 10 additions & 0 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
CHANGELOG:
== Changelog ==
= v4.1.1 (10/01/2020) =
* Feature
- Currency Conversion in Checkout Mercado Pago added

* Bug fixes
- Currency Conversion for CHO Custom ON and OFF fixed
- Shipping Cost in the creation of Preferences fixed
- ME2 shipping mode in the creation of Preferences removed
- Checkout Mercado Pago class instance fixed when the first configurations are saved

= v4.1.0 (06/01/2020) =
* Feature
- Updated plugin name from "WooCommerce Mercado Pago" to "Mercado Pago payments for WooCommerce".
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_AR.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:10-0300\n"
"PO-Revision-Date: 2020-01-10 16:09-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_CL.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:11-0300\n"
"PO-Revision-Date: 2020-01-10 16:09-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_CO.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_CO.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:11-0300\n"
"PO-Revision-Date: 2020-01-10 16:09-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_ES.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:11-0300\n"
"PO-Revision-Date: 2020-01-10 16:09-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_MX.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_MX.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:11-0300\n"
"PO-Revision-Date: 2020-01-10 16:10-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_PE.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_PE.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:11-0300\n"
"PO-Revision-Date: 2020-01-10 16:10-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_UY.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_UY.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:12-0300\n"
"PO-Revision-Date: 2020-01-10 16:10-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-es_VE.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-es_VE.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:12-0300\n"
"PO-Revision-Date: 2020-01-10 16:10-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
Binary file modified i18n/languages/woocommerce-mercadopago-pt_BR.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/languages/woocommerce-mercadopago-pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Mercado Pago payments for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-09-05T23:48:06-04:00\n"
"PO-Revision-Date: 2019-12-23 17:12-0300\n"
"PO-Revision-Date: 2020-01-10 16:10-0300\n"
"X-Generator: Poedit 2.2.4\n"
"X-Domain: woocommerce-mercadopago\n"
"Last-Translator: \n"
Expand Down
2 changes: 1 addition & 1 deletion i18n/languages/woocommerce-mercadopago.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.0\n"
"Project-Id-Version: Mercado Pago payments for WooCommerce 4.1.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-mercadopago\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion includes/module/config/WC_WooMercadoPago_Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WC_WooMercadoPago_Constants
{
const PRODUCT_ID = 'BC32CPFTRPP001U8NHRG';
const PLATAFORM_ID = 'bo2hnr2ic4p001kbgpt0';
const VERSION = '4.1.0';
const VERSION = '4.1.1';
const MIN_PHP = 5.6;
const API_MP_BASE_URL = 'https://api.mercadopago.com';
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function __construct($payment, $order, $requestCheckout = null)
if (!$this->test_user_v1 && !$this->sandbox) {
$this->preference['sponsor_id'] = $this->get_sponsor_id();
}

if (sizeof($this->order->get_items()) > 0) {
$this->items = $this->get_items_build_array();
}
Expand Down Expand Up @@ -162,7 +163,7 @@ public function get_items_build_array()
$line_amount = $item['line_total'] + $item['line_tax'];
$discount_by_gateway = (float)$line_amount * ($this->gateway_discount / 100);
$commission_by_gateway = (float)$line_amount * ($this->commission / 100);
$item_amount = $line_amount - $discount_by_gateway + $commission_by_gateway;
$item_amount = $this->calculate_price($line_amount - $discount_by_gateway + $commission_by_gateway);
$this->order_total += $item_amount;

// Add the item.
Expand All @@ -178,7 +179,7 @@ public function get_items_build_array()
plugins_url('assets/images/cart.png', plugin_dir_path(__FILE__)) : wp_get_attachment_url($product->get_image_id()),
'category_id' => get_option('_mp_category_id', 'others'),
'quantity' => 1,
'unit_price' => $this->calculate_price($item_amount),
'unit_price' => $item_amount,
'currency_id' => $this->site_data[$this->site_id]['currency']
));
}
Expand All @@ -191,12 +192,15 @@ public function get_items_build_array()
*/
public function ship_cost_item()
{
$ship_cost = $this->calculate_price($this->ship_cost);
$this->order_total += $ship_cost;

return array(
'title' => method_exists($this->order, 'get_id') ? $this->order->get_shipping_method() : $this->order->shipping_method,
'description' => __('Shipping service used by the store.', 'woocommerce-mercadopago'),
'category_id' => get_option('_mp_category_id', 'others'),
'quantity' => 1,
'unit_price' => $this->calculate_price($this->ship_cost),
'unit_price' => $ship_cost,
);
}

Expand Down Expand Up @@ -300,7 +304,7 @@ public function get_preference()
*/
public function get_transaction_amount()
{
return $this->calculate_price($this->order_total);
return $this->order_total;
}

/**
Expand Down Expand Up @@ -353,9 +357,9 @@ public function get_internal_metadata()
$w = WC_WooMercadoPago_Module::woocommerce_instance();
$internal_metadata = array(
"platform" => WC_WooMercadoPago_Constants::PLATAFORM_ID,
"plataform_version" => $w->version,
"platform_version" => $w->version,
"module_version" => WC_WooMercadoPago_Constants::VERSION,
"site" => get_option('_site_id_v1'),
"site_id" => get_option('_site_id_v1'),
"sponsor_id" => $this->get_sponsor_id(),
"collector" => end($seller),
"test_mode" => $test_mode,
Expand Down
29 changes: 0 additions & 29 deletions includes/module/preference/WC_WooMercadoPago_PreferenceBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public function __construct($payment, $order)
$this->preference['back_urls'] = $this->get_back_urls();
$this->preference['shipments'] = $this->shipments_receiver_address();

if ($this->ship_cost > 0) {
$this->shipment_info();
}

$this->preference['payment_methods'] = $this->get_payment_methods($this->ex_payments, $this->installments);
$this->preference['auto_return'] = $this->auto_return();

Expand Down Expand Up @@ -126,31 +122,6 @@ public function auto_return()
return;
}

/**
* Shipment Info
*/
public function shipment_info()
{
$this->preference['shipments']['mode'] = 'me2';
foreach ($this->order->get_shipping_methods() as $shipping) {
$this->preference['shipments']['dimensions'] = $shipping['dimensions'];
$this->preference['shipments']['default_shipping_method'] = (int)$shipping['shipping_method_id'];
$this->preference['shipments']['free_methods'] = array();
// Get shipping method id.
$prepare_method_id = explode(':', $shipping['method_id']);
// Get instance_id.
$shipping_id = $prepare_method_id[count($prepare_method_id) - 1];
// TODO: Refactor to Get zone by instance_id.
$shipping_zone = WC_Shipping_Zones::get_zone_by('instance_id', $shipping_id);
foreach ($shipping_zone->get_shipping_methods() as $key => $shipping_object) {
if ($shipping_object->get_option('free_shipping') == 'yes') {
$shipping_method_id = $shipping_object->get_shipping_method_id($this->site_data['site_id']);
$this->preference['shipments']['free_methods'][] = array('id' => (int)$shipping_method_id);
}
}
}
}

/**
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function get_internal_metadata_custom()
{
$internal_metadata = array(
"checkout" => "custom",
"checkout_type" => "credit_cart",
"checkout_type" => "credit_card",
);

return $internal_metadata;
Expand Down
3 changes: 2 additions & 1 deletion includes/payments/WC_WooMercadoPago_BasicGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct()
$this->form_fields = $this->getFormFields('Basic');
$this->hook = new WC_WooMercadoPago_Hook_Basic($this);
$this->notification = new WC_WooMercadoPago_Notification_IPN($this);
$this->currency_convertion = false;
$this->currency_convertion = true;
}

/**
Expand Down Expand Up @@ -152,6 +152,7 @@ public function get_fields_sequence()
'checkout_payments_subtitle',
'checkout_payments_description',
'enabled',
WC_WooMercadoPago_Helpers_CurrencyConverter::CONFIG_KEY,
'installments',
// advanced settings
'checkout_payments_advanced_title',
Expand Down
3 changes: 1 addition & 2 deletions includes/payments/WC_WooMercadoPago_CustomGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct()
$this->field_forms_order = $this->get_fields_sequence();
parent::__construct();
$this->form_fields = $this->getFormFields('Custom');
$this->customer = isset($this->logged_user_email) ? $this->mp->get_or_create_customer($this->logged_user_email) : null;
$this->customer = $this->getOrCreateCustomer();
$this->hook = new WC_WooMercadoPago_Hook_Custom($this);
$this->notification = new WC_WooMercadoPago_Notification_Webhook($this);
$this->currency_convertion = true;
Expand Down Expand Up @@ -64,7 +64,6 @@ public function getFormFields($label)
$form_fields['checkout_custom_payments_title'] = $this->field_checkout_custom_payments_title();
$form_fields['checkout_payments_subtitle'] = $this->field_checkout_payments_subtitle();
$form_fields['binary_mode'] = $this->field_binary_mode();
$form_fields[WC_WooMercadoPago_Helpers_CurrencyConverter::CONFIG_KEY] = $this->field_currency_conversion($this);
$form_fields['checkout_custom_payments_advanced_title'] = $this->field_checkout_custom_payments_advanced_title();
$form_fields['coupon_mode'] = $this->field_coupon_mode();
}
Expand Down
1 change: 1 addition & 0 deletions includes/payments/WC_WooMercadoPago_PaymentAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ public function getFormFields($label)
$form_fields['checkout_ready_title'] = $this->field_checkout_ready_title();
$form_fields['checkout_ready_description'] = $this->field_checkout_ready_description();
$form_fields['checkout_ready_description_link'] = $this->field_checkout_ready_description_link();
$form_fields[WC_WooMercadoPago_Helpers_CurrencyConverter::CONFIG_KEY] = $this->field_currency_conversion($this);
}
}

Expand Down
1 change: 0 additions & 1 deletion includes/payments/WC_WooMercadoPago_TicketGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public function getFormFields($label)
$form_fields['coupon_mode'] = $this->field_coupon_mode();
$form_fields['stock_reduce_mode'] = $this->field_stock_reduce_mode();
$form_fields['date_expiration'] = $this->field_date_expiration();
$form_fields[WC_WooMercadoPago_Helpers_CurrencyConverter::CONFIG_KEY] = $this->field_currency_conversion($this);
foreach ($this->field_ticket_payments() as $key => $value) {
$form_fields[$key] = $value;
}
Expand Down
Loading

0 comments on commit d266670

Please sign in to comment.