Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.14.0 #69

Merged
merged 44 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2900b30
build(deps): bump terser from 4.8.0 to 4.8.1
dependabot[bot] Jul 20, 2022
0385a34
build(deps): bump minimatch from 3.0.4 to 3.0.8
dependabot[bot] Nov 12, 2022
ac9fc2c
build(deps): bump json5 from 2.2.0 to 2.2.3
dependabot[bot] Jan 7, 2023
66ed262
Merge pull request #274 from mercadopago/main
cleitonaguiarandrade Jan 11, 2023
8a64337
Merge pull request #275 from PluginAndPartners/main
AlberAlmeida Feb 1, 2023
d073e12
PSW-612 - Added iframe to cardform and updated related HTML form tags
AlberAlmeida Feb 1, 2023
cd2ad40
PSW-616 - Updated CSS for new form divs
AlberAlmeida Feb 1, 2023
8365534
PSW-613 - Updated form errors handling fuctions
AlberAlmeida Feb 1, 2023
6a9e598
[feat] - Updated form date to use either 2 or 4 digits
AlberAlmeida Feb 1, 2023
484c23d
[feat] - Removed unsused CVV length validation
AlberAlmeida Feb 1, 2023
7f0b8ae
PSW 614 - Updated error messages and identifications
AlberAlmeida Feb 1, 2023
9dd450b
[feat] - Removed unused CVV validation
AlberAlmeida Feb 2, 2023
399d92b
PSW-613 - Fixed broken functions and validations
AlberAlmeida Feb 2, 2023
8d3daf0
PSW-615 - Updated translations
AlberAlmeida Feb 2, 2023
6f635e3
PSW-614 - Updated error mesages and identifications for version 1.6
AlberAlmeida Feb 2, 2023
7c3702a
[feat] - Fixed some lint errors
AlberAlmeida Feb 2, 2023
1709ccf
[feat] - Linted custom card js
AlberAlmeida Feb 2, 2023
bfaafec
[feat] - Updated front css
AlberAlmeida Feb 2, 2023
50d83c9
[feat] - Added jshindrc to use esversion 6 in phpcs
AlberAlmeida Feb 2, 2023
eeb9208
[feat] - Applied pre commit script
AlberAlmeida Feb 2, 2023
697da55
[feat] - Updated fuction to get cart id
AlberAlmeida Feb 6, 2023
0c2fc9f
[feat] - Removed duplicated and conflicting function to clear form fi…
AlberAlmeida Feb 6, 2023
4814ddc
[feat] - Ran pre-commit script
AlberAlmeida Feb 7, 2023
34846db
[feat] - Removed call to previously removed function
AlberAlmeida Feb 7, 2023
ebe5444
[feat] - Ran pre-commit script
AlberAlmeida Feb 7, 2023
735b429
[feat] - Fixed error message
AlberAlmeida Feb 8, 2023
fc0ec94
[feat] - Added a method to handle get card id
AlberAlmeida Feb 14, 2023
b0b95cc
PSW-657 - Added product-id to bifrost requests
AlberAlmeida Feb 14, 2023
df9b2c1
[feat] Adjusted form divs height for v1.6
AlberAlmeida Feb 14, 2023
915bb39
Merge pull request #243 from PluginAndPartners/dependabot/npm_and_yar…
AlberAlmeida May 25, 2023
9fac34f
Merge pull request #258 from PluginAndPartners/dependabot/npm_and_yar…
AlberAlmeida May 25, 2023
239b588
build(deps): bump guzzlehttp/psr7 from 2.4.0 to 2.5.0
dependabot[bot] May 25, 2023
9231730
Merge pull request #265 from PluginAndPartners/dependabot/npm_and_yar…
AlberAlmeida May 25, 2023
6271795
Merge pull request #276 from PluginAndPartners/feature/PSW-584
AlberAlmeida May 25, 2023
86a8dc8
Merge branch 'develop' into feature/PSW-657
AlberAlmeida May 25, 2023
de2cbde
Merge pull request #277 from PluginAndPartners/feature/PSW-657
AlberAlmeida May 25, 2023
b22b5ce
Merge pull request #278 from PluginAndPartners/dependabot/composer/gu…
AlberAlmeida May 25, 2023
1ae7e63
Merge pull request #279 from PluginAndPartners/develop
AlberAlmeida May 25, 2023
d6edd59
[fix] - Updated versions and changelog
AlberAlmeida May 25, 2023
b299d29
Merge pull request #280 from PluginAndPartners/fix/update-plugin-version
AlberAlmeida May 25, 2023
6f099c1
[fix] - Updated indicated version
AlberAlmeida May 30, 2023
2ebdd8b
[fix] - Added index file and removed blank line
AlberAlmeida May 30, 2023
3d0a903
Merge pull request #281 from PluginAndPartners/fix/module-version
AlberAlmeida Jun 1, 2023
f8a968f
Merge pull request #282 from PluginAndPartners/release/4.14.0
AlberAlmeida Jun 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ 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).

## [4.14.0] - 2023-25-05

### Added
- Identification to payment-methods requests
- Secure Fields to card form

### Updated
- Dependencies versions

## [4.13.0] - 2023-09-01

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

# Prestashop 1.6.x & 1.7.x - Mercado Pago Module (v4.13.0)
# Prestashop 1.6.x & 1.7.x - Mercado Pago Module (v4.14.0)

With the official module of Mercado Pago you will have an integration, hundreds of solutions and thousands of sales. Maximize your conversions and make your customers return to your store by increasing their confidence in the shopping experience.

Expand Down
55 changes: 28 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion controllers/front/custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@

class MercadoPagoCustomModuleFrontController extends ModuleFrontController
{
public $mpuseful;

public function __construct()
{
parent::__construct();
$this->mpuseful = MPUseful::getInstance();
}

/**
Expand Down Expand Up @@ -62,7 +65,7 @@ public function postProcess()

//order confirmation redirect
$old_cart = new Cart($this->context->cart->id);
$order = Order::getOrderByCartId($old_cart->id);
$order = $this->mpuseful->getOrderIdByCartId($old_cart->id);
$order = new Order($order);

$uri = __PS_BASE_URI__ . 'index.php?controller=order-confirmation';
Expand Down
5 changes: 4 additions & 1 deletion controllers/front/pix.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@

class MercadoPagoPixModuleFrontController extends ModuleFrontController
{
public $mpuseful;

public function __construct()
{
parent::__construct();
$this->mpuseful = MPUseful::getInstance();
}

/**
Expand Down Expand Up @@ -96,7 +99,7 @@ public function createOrder($payment, $cart, $preference)
$preference->disableCartRule();

$oldCart = new Cart($cart->id);
$order = Order::getOrderByCartId($oldCart->id);
$order = $this->mpuseful->getOrderIdByCartId($oldCart->id);
$order = new Order($order);

return $order;
Expand Down
4 changes: 3 additions & 1 deletion controllers/front/standardvalidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
class MercadoPagoStandardValidationModuleFrontController extends ModuleFrontController
{
public $mp_transaction;
public $mpuseful;

public function __construct()
{
parent::__construct();
$this->mercadopago = MPApi::getInstance();
$this->mp_transaction = new MPTransaction();
$this->mpuseful = MPUseful::getInstance();
}

/**
Expand Down Expand Up @@ -111,7 +113,7 @@ public function createOrder($cart, $transaction_id)
$notification = new IpnNotification($transaction_id, $merchant_order);
$notification = $notification->createStandardOrder($cart);

$order = Order::getOrderByCartId($cart->id);
$order = $this->mpuseful->getOrderIdByCartId($cart->id);
$order = new Order($order);

return $order;
Expand Down
5 changes: 4 additions & 1 deletion controllers/front/ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@

class MercadoPagoTicketModuleFrontController extends ModuleFrontController
{
public $mpuseful;

public function __construct()
{
parent::__construct();
$this->mpuseful = MPUseful::getInstance();
}

/**
Expand Down Expand Up @@ -68,7 +71,7 @@ public function postProcess()

//order confirmation redirect
$old_cart = new Cart($this->context->cart->id);
$order = Order::getOrderByCartId($old_cart->id);
$order = $this->mpuseful->getOrderIdByCartId($old_cart->id);
$order = new Order($order);

$uri = __PS_BASE_URI__ . 'index.php?controller=order-confirmation';
Expand Down
6 changes: 4 additions & 2 deletions includes/MPApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ public function getCredentialsWrapper($access_token)
public function getPaymentMethods()
{
$access_token = $this->getAccessToken();
$response = MPRestCli::get('/v1/bifrost/payment-methods', ["Authorization: Bearer " . $access_token]);

$response = MPRestCli::get('/v1/bifrost/payment-methods', [
"Authorization: Bearer " . $access_token,
"x-product-id: " . MPRestCli::PRODUCT_ID
]);

//in case of failures
if ($response['status'] > 202) {
Expand Down
16 changes: 16 additions & 0 deletions includes/MPUseful.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,20 @@ public function getDiscountByCheckoutType($checkout)
return 0.00;
}
}

/**
* Handles call to get order id in different Prestashop versions
*
* @param int $id_cart Cart id
*
* @return int $id_order
*/
public function getOrderIdByCartId($cartId)
{
if (method_exists(Order::class, 'getIdByCartId')) {
return Order::getIdByCartId($cartId);
} else {
return Order::getOrderByCartId($cartId);
}
}
}
2 changes: 1 addition & 1 deletion includes/module/notification/AbstractNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function createOrder($cart, $custom_create_order = false)
false
);

$this->order_id = Order::getOrderByCartId($cart->id);
$this->order_id = $this->mpuseful->getOrderIdByCartId($cart->id);
$order = new Order($this->order_id);

$payments = $order->getOrderPaymentCollection();
Expand Down
4 changes: 3 additions & 1 deletion includes/module/notification/IpnNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class IpnNotification extends AbstractNotification
public $merchant_order;
public $preference;
public $isWalletButton;
public $mpuseful;

public function __construct($transaction_id, $merchant_order)
{
Expand All @@ -44,6 +45,7 @@ public function __construct($transaction_id, $merchant_order)
$this->isWalletButton = $this->checkout === 'wallet_button';
$this->preference = $this->getCheckoutPreference();
$this->mp_transaction_amount = $merchant_order['total_amount'];
$this->mpuseful = MPUseful::getInstance();
}

/**
Expand Down Expand Up @@ -146,7 +148,7 @@ public function getCheckoutType()
*/
public function getOrderId($cart)
{
$orderId = Order::getOrderByCartId($cart->id);
$orderId = $this->mpuseful->getOrderIdByCartId($cart->id);
$this->order_id = $orderId;

return $orderId;
Expand Down
4 changes: 3 additions & 1 deletion includes/module/notification/WebhookNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
class WebhookNotification extends AbstractNotification
{
public $payment;
public $mpuseful;

public function __construct($transaction_id, $payment)
{
Expand All @@ -40,6 +41,7 @@ public function __construct($transaction_id, $payment)
$this->payment = $payment;
$this->checkout = $payment['metadata']['checkout_type'];
$this->mp_transaction_amount = $payment['transaction_amount'];
$this->mpuseful = MPUseful::getInstance();
}

/**
Expand All @@ -53,7 +55,7 @@ public function receiveNotification($cart)
$this->verifyWebhook($cart);

$this->total = $this->getTotal($cart, $this->checkout);
$orderId = Order::getOrderByCartId($cart->id);
$orderId = $this->mpuseful->getOrderIdByCartId($cart->id);

if ($orderId != 0) {
$this->verifyCustomPayment();
Expand Down
4 changes: 2 additions & 2 deletions mercadopago.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* International Registered Trademark & Property of MercadoPago
*/

define('MP_VERSION', '4.13.0');
define('MP_VERSION', '4.14.0');
define('MP_ROOT_URL', dirname(__FILE__));

if (!defined('_PS_VERSION_')) {
Expand Down Expand Up @@ -73,7 +73,7 @@ public function __construct()
$this->bootstrap = true;

//Always update, because prestashop doesn't accept version coming from another variable (MP_VERSION)
$this->version = '4.13.0';
$this->version = '4.14.0';
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);

parent::__construct();
Expand Down
Loading