Skip to content

Commit

Permalink
release/4.15.0 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelonader-meli authored Dec 28, 2023
1 parent d8ba9cd commit 032e11f
Show file tree
Hide file tree
Showing 73 changed files with 545 additions and 795 deletions.
14 changes: 14 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
<Files *.php>
order deny, allow
deny from all
</Files>
</IfModule>

# Apache 2.4
<IfModule mod_authz_core.c>
<Files *.php>
Require all denied
</Files>
</IfModule>
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ 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.15.0] - 2023-26-12

### Changed
- Changes the endpoints that the plugin calls to create payment, preferences and obtaining payment-methods.
- Changed endpoints:
- `v1/payments` to `/ppcore/prod/transaction/v1/payments`
- `checkout/preferences` to `/ppcore/prod/transaction/v1/preferences`
- `v1/bifrost/payment-methods` to `/ppcore/prod/payment-methods/v1/payment-methods`

### Fixed
- Updated copyright to 2023
- Added validation to ensure that PHP files are executed in the PrestaShop context
- Added .htaccess file in the root folder, to prevent someone from listing the files of the module, and direct execution of PHP file

## [4.14.0] - 2023-25-05

### Added
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.14.0)
# Prestashop 1.6.x & 1.7.x - Mercado Pago Module (v4.15.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
2 changes: 1 addition & 1 deletion bin/create-release-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ ! -d "$TMP_DIR" ]; then
fi

cd $BASE_DIR
cp -r !(*.md|composer.*|package*.json|mercadopago.zip|vendor|node_modules|phpcs.xml|scripts.js|bin) $TMP_DIR
cp -r !(*.md|composer.*|package*.json|mercadopago.zip|vendor|node_modules|phpcs.xml|scripts.js|bin) $TMP_DIR && cp -r .htaccess $TMP_DIR

if [ $? -ne 0 ]; then
echo "Error copying files"
Expand Down
55 changes: 27 additions & 28 deletions composer.lock

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

9 changes: 5 additions & 4 deletions controllers/front/custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/preference/CustomPreference.php';
require_once MP_ROOT_URL . '/includes/module/notification/WebhookNotification.php';

class MercadoPagoCustomModuleFrontController extends ModuleFrontController
{
public $mpuseful;

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

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

//order confirmation redirect
$old_cart = new Cart($this->context->cart->id);
$order = $this->mpuseful->getOrderIdByCartId($old_cart->id);
$order = Order::getOrderByCartId($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/notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/notification/IpnNotification.php';
require_once MP_ROOT_URL . '/includes/module/notification/WebhookNotification.php';

Expand All @@ -37,7 +41,6 @@ public function __construct()
parent::__construct();
$this->mercadopago = MPApi::getInstance();
}

/**
* Default function of Prestashop for init the controller
*
Expand Down
9 changes: 5 additions & 4 deletions controllers/front/pix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/preference/PixPreference.php';
require_once MP_ROOT_URL . '/includes/module/notification/WebhookNotification.php';

class MercadoPagoPixModuleFrontController extends ModuleFrontController
{
public $mpuseful;

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

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

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

return $order;
Expand Down
4 changes: 4 additions & 0 deletions controllers/front/standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/preference/StandardPreference.php';

class MercadoPagoStandardModuleFrontController extends ModuleFrontController
Expand Down
10 changes: 6 additions & 4 deletions controllers/front/standardvalidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/notification/IpnNotification.php';

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 All @@ -56,7 +58,7 @@ public function initContent()
if (isset($payment_ids) && $payment_ids != false && $payment_ids != 'null' && $typeReturn != 'failure') {
$payment_id = explode(',', $payment_ids)[0];
$this->redirectCheck($payment_id);

return;
}

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

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

return $order;
Expand Down
9 changes: 5 additions & 4 deletions controllers/front/ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/preference/TicketPreference.php';
require_once MP_ROOT_URL . '/includes/module/notification/WebhookNotification.php';

class MercadoPagoTicketModuleFrontController extends ModuleFrontController
{
public $mpuseful;

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

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

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

$uri = __PS_BASE_URI__ . 'index.php?controller=order-confirmation';
Expand Down
4 changes: 4 additions & 0 deletions controllers/front/walletbutton.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

require_once MP_ROOT_URL . '/includes/module/preference/WalletButtonPreference.php';

class MercadoPagoWalletButtonModuleFrontController extends ModuleFrontController
Expand Down
4 changes: 4 additions & 0 deletions includes/MPAbstractDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
* to avoid any conflicts with others containers.
*/

if (!defined('_PS_VERSION_')) {
exit;
}

abstract class MPAbstractDB
{
protected $table;
Expand Down
Loading

0 comments on commit 032e11f

Please sign in to comment.