diff --git a/.github/workflows/pull_request_template.md b/.github/pull_request_template.md similarity index 100% rename from .github/workflows/pull_request_template.md rename to .github/pull_request_template.md diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 2b6f469f..00000000 --- a/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "esversion": 6 -} diff --git a/CHANGELOG.md b/CHANGELOG.md index 147337c9..0a775264 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.17.0] - 2024-04-01 + +### Added +- Visualization of installments with interest on the order confirmation screen for the buyer +- New payment method: PSE (Only Colombia) + +### Changed +- Using `mp-plugins/php-sdk` to make payment calls to the Mercado Pago API + ## [4.16.0] - 2024-05-02 ### Changed @@ -24,24 +33,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - 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 -- Identification to payment-methods requests -- Secure Fields to card form - -### Updated -- Dependencies versions - -## [4.13.0] - 2023-09-01 - -### Changed -- Changed header authorization to use access token instead of public key - -### Fixed -- Fixed decimal value when creating Pro checkout preference -- Updated copyright to 2023 - ## [4.12.0] - 2022-16-11 ### Changed diff --git a/README.md b/README.md index 5f454518..da57daa8 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@
-# Prestashop 1.6.x & 1.7.x - Mercado Pago Module (v4.16.0) +# Prestashop 1.7.x & 8.1.x - Mercado Pago Module (v4.17.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. +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 ## :warning: Attention / Atención / Atenção diff --git a/composer.json b/composer.json index bc7b54cb..c6ce782c 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "require": { "squizlabs/php_codesniffer": "3.5.6", "friendsofphp/php-cs-fixer": "2.16.4", - "guzzlehttp/guzzle": "^7.4" + "guzzlehttp/guzzle": "^7.4", + "mp-plugins/php-sdk": "2.7.0" }, "scripts": { "phpcs": [ diff --git a/composer.lock b/composer.lock index eb866ba4..9f1ad495 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fea1960d12dbc8496a1e763b43b3c667", + "content-hash": "68accb12cbc149efc12b405d9e551559", "packages": [ { "name": "composer/semver", @@ -65,11 +65,6 @@ "validation", "versioning" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/1.7.2" - }, "funding": [ { "url": "https://packagist.com", @@ -129,11 +124,6 @@ "Xdebug", "performance" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.6" - }, "funding": [ { "url": "https://packagist.com", @@ -216,10 +206,6 @@ "docblock", "parser" ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.2" - }, "time": "2021-08-05T19:00:23+00:00" }, { @@ -278,10 +264,6 @@ "parser", "php" ], - "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.3" - }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -387,10 +369,6 @@ } ], "description": "A tool to automatically fix PHP code style", - "support": { - "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.16.4" - }, "funding": [ { "url": "https://github.com/keradus", @@ -503,10 +481,6 @@ "rest", "web service" ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.5" - }, "funding": [ { "url": "https://github.com/GrahamCampbell", @@ -587,10 +561,6 @@ "keywords": [ "promise" ], - "support": { - "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.1" - }, "funding": [ { "url": "https://github.com/GrahamCampbell", @@ -702,10 +672,6 @@ "uri", "url" ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.0" - }, "funding": [ { "url": "https://github.com/GrahamCampbell", @@ -722,6 +688,49 @@ ], "time": "2022-06-20T21:43:11+00:00" }, + { + "name": "mp-plugins/php-sdk", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/mercadopago/pp-php-sdk.git", + "reference": "07ee6738d0f73d8af5585a67e281ce647afb199a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mercadopago/pp-php-sdk/zipball/07ee6738d0f73d8af5585a67e281ce647afb199a", + "reference": "07ee6738d0f73d8af5585a67e281ce647afb199a", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7" + }, + "require-dev": { + "phpunit/phpunit": "9.5.27", + "squizlabs/php_codesniffer": "3.7.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "MercadoPago\\PP\\Sdk\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "proprietary" + ], + "authors": [ + { + "name": "Mercado Pago SMB", + "email": "pp_smb@mercadolivre.com" + } + ], + "description": "Mercado Pago Plugins PHP-SDK", + "time": "2024-03-25T19:45:14+00:00" + }, { "name": "php-cs-fixer/diff", "version": "v1.3.1", @@ -771,10 +780,7 @@ "keywords": [ "diff" ], - "support": { - "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" - }, + "abandoned": true, "time": "2020-10-14T08:39:05+00:00" }, { @@ -821,9 +827,6 @@ "psr", "psr-6" ], - "support": { - "source": "https://github.com/php-fig/cache/tree/master" - }, "time": "2016-08-06T20:24:11+00:00" }, { @@ -868,10 +871,6 @@ "container-interop", "psr" ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" - }, "time": "2021-11-05T16:50:12+00:00" }, { @@ -918,10 +917,6 @@ "psr", "psr-14" ], - "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" - }, "time": "2019-01-08T18:20:26+00:00" }, { @@ -971,9 +966,6 @@ "psr", "psr-18" ], - "support": { - "source": "https://github.com/php-fig/http-client/tree/master" - }, "time": "2020-06-29T06:28:15+00:00" }, { @@ -1026,9 +1018,6 @@ "request", "response" ], - "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" - }, "time": "2019-04-30T12:38:16+00:00" }, { @@ -1079,9 +1068,6 @@ "request", "response" ], - "support": { - "source": "https://github.com/php-fig/http-message/tree/master" - }, "time": "2016-08-06T14:39:51+00:00" }, { @@ -1129,9 +1115,6 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, "time": "2021-05-03T11:20:27+00:00" }, { @@ -1172,10 +1155,6 @@ } ], "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, "time": "2019-03-08T08:55:37+00:00" }, { @@ -1183,12 +1162,12 @@ "version": "3.5.6", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, @@ -1227,11 +1206,20 @@ "phpcs", "standards" ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], "time": "2020-08-10T04:50:15+00:00" }, { @@ -1314,9 +1302,6 @@ "console", "terminal" ], - "support": { - "source": "https://github.com/symfony/console/tree/v5.4.7" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1381,9 +1366,6 @@ ], "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1466,9 +1448,6 @@ ], "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1545,9 +1524,6 @@ "interoperability", "standards" ], - "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1609,9 +1585,6 @@ ], "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.7" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1672,9 +1645,6 @@ ], "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.3" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1741,9 +1711,6 @@ "configuration", "options" ], - "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1823,9 +1790,6 @@ "polyfill", "portable" ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1904,9 +1868,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1988,9 +1949,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2071,9 +2029,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2139,9 +2094,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2215,9 +2167,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2294,9 +2243,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2377,9 +2323,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2439,9 +2382,6 @@ ], "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v5.4.7" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2522,9 +2462,6 @@ "interoperability", "standards" ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2584,9 +2521,6 @@ ], "description": "Provides a way to profile code", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2670,9 +2604,6 @@ "utf-8", "utf8" ], - "support": { - "source": "https://github.com/symfony/string/tree/v5.4.3" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2698,5 +2629,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "1.1.0" } diff --git a/controllers/front/custom.php b/controllers/front/custom.php index 1ef111df..cb6de69d 100644 --- a/controllers/front/custom.php +++ b/controllers/front/custom.php @@ -66,8 +66,8 @@ public function postProcess() //order confirmation redirect $old_cart = new Cart($this->context->cart->id); - $order = Order::getOrderByCartId($old_cart->id); - $order = new Order($order); + $orderId = Order::getIdByCartId($old_cart->id); + $order = new Order($orderId); $uri = __PS_BASE_URI__ . 'index.php?controller=order-confirmation'; $uri .= '&id_cart=' . $order->id_cart; diff --git a/controllers/front/pix.php b/controllers/front/pix.php index f7e2a859..1c4e3461 100644 --- a/controllers/front/pix.php +++ b/controllers/front/pix.php @@ -100,8 +100,8 @@ public function createOrder($payment, $cart, $preference) $preference->disableCartRule(); $oldCart = new Cart($cart->id); - $order = Order::getOrderByCartId($oldCart->id); - $order = new Order($order); + $orderId = Order::getIdByCartId($oldCart->id); + $order = new Order($orderId); return $order; } diff --git a/controllers/front/pse.php b/controllers/front/pse.php new file mode 100644 index 00000000..589b848e --- /dev/null +++ b/controllers/front/pse.php @@ -0,0 +1,143 @@ + + * @copyright 2007-2024 PrestaShop SA + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + * + * Don't forget to prefix your containers with your own identifier + * to avoid any conflicts with others containers. + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +require_once MP_ROOT_URL . '/includes/module/preference/PsePreference.php'; +require_once MP_ROOT_URL . '/includes/module/notification/WebhookNotification.php'; +require_once MP_ROOT_URL . '/includes/module/checkouts/PseCheckout.php'; + +class MercadoPagoPseModuleFrontController extends ModuleFrontController +{ + public function __construct() + { + parent::__construct(); + } + + /** + * Default function of Prestashop for init the controller + * + * @return void + * @throws Exception + */ + public function postProcess() + { + $preference = new PsePreference(new PseCheckout(), $this->context->cart); + $pseFormData = Tools::getValue('mercadopago_pse'); + $payerData = array( + 'entity_type' => $pseFormData['personType'], + 'document_type' => $pseFormData['documentType'], + 'document_number' => $pseFormData['documentNumber'], + 'financial_institution' => $pseFormData['financialInstitution'] + ); + + try { + $preference->verifyModuleParameters(); + $payment = $preference->createPayment($payerData, $this->getCallbackPath($this->context->cart)); + + if (!is_array($payment)) return $this->handleWithPaymentError($preference, $payment, null); + + $preference->saveCreatePreferenceData( + $this->context->cart, + $payment['notification_url'], + ); + + $this->createOrder($payment, $this->context->cart); + $preference->deactivateDiscount(); + + Tools::redirect($payment['transaction_details']['external_resource_url']); + } catch (Exception $err) { + $this->handleWithPaymentError($preference, null, $err); + } + } + + /** + * @param array $payment + * @param object $cart + * + * @return void + */ + private function createOrder($payment, $cart) + { + $notification = new WebhookNotification($payment['id'], $payment); + + $notification->createCustomOrder($cart); + } + + /** + * @param object $cart + * + * @return string + */ + private function getCallbackPath($cart) { + $path = '?id_cart=' . $cart->id; + $path .= '&key=' . $cart->secure_key; + $path .= '&id_order=' . $cart->id; + $path .= '&id_module=' . $this->module->id; + $path .= '&payment_status=pending'; + $path .= '&checkout_type=pse'; + + return $path; + } + + /** + * @param PsePreference $preference + * @param array $paymentResponse + * @param Exception $err + * + * @return void + */ + private function handleWithPaymentError($preference, $paymentResponse, $err) + { + if (is_string($paymentResponse)) { + $message = MPApi::validateMessageApi($paymentResponse) || 'Somenthing went wrong during PSE payment creation'; + + $this->redirectToErrorPage($preference, Tools::displayError($message)); + return; + } + + MPLog::generate('Exception Message: ' . $err->getMessage()); + $this->redirectToErrorPage($preference, Tools::displayError()); + } + + /** + * @param Preference $preference + * @param string $errorMessage + * + * @return void + */ + private function redirectToErrorPage($preference, $errorMessage) + { + $this->context->cookie->__set('redirect_message', $errorMessage); + $preference->deleteCartRule(); + Tools::redirect('index.php?controller=order&step=3&typeReturn=failure'); + } +} diff --git a/controllers/front/standardvalidation.php b/controllers/front/standardvalidation.php index 832f757e..de5b8b82 100644 --- a/controllers/front/standardvalidation.php +++ b/controllers/front/standardvalidation.php @@ -115,8 +115,8 @@ public function createOrder($cart, $transaction_id) $notification = new IpnNotification($transaction_id, $merchant_order); $notification = $notification->createStandardOrder($cart); - $order = Order::getOrderByCartId($cart->id); - $order = new Order($order); + $orderId = Order::getIdByCartId($cart->id); + $order = new Order($orderId); return $order; } diff --git a/controllers/front/ticket.php b/controllers/front/ticket.php index 3bc1213a..3458749e 100644 --- a/controllers/front/ticket.php +++ b/controllers/front/ticket.php @@ -72,8 +72,8 @@ public function postProcess() //order confirmation redirect $old_cart = new Cart($this->context->cart->id); - $order = Order::getOrderByCartId($old_cart->id); - $order = new Order($order); + $orderId = Order::getIdByCartId($old_cart->id); + $order = new Order($orderId); $uri = __PS_BASE_URI__ . 'index.php?controller=order-confirmation'; $uri .= '&id_cart=' . $order->id_cart; diff --git a/includes/MPApi.php b/includes/MPApi.php index 40e3c03f..4bed867c 100644 --- a/includes/MPApi.php +++ b/includes/MPApi.php @@ -27,10 +27,13 @@ * to avoid any conflicts with others containers. */ + if (!defined('_PS_VERSION_')) { exit; } +require_once MP_ROOT_URL . '/includes/module/settings/CoreSdkSettings.php'; + class MPApi { public function __construct() @@ -168,6 +171,7 @@ public function paymentsDefaultData($value) 'config' => 'MERCADOPAGO_PAYMENT_' . Tools::strtoupper($value['id']), 'financial_institutions' => isset($value['financial_institutions']) ? $value['financial_institutions'] : [], 'payment_places' => isset($value['payment_places']) ? $value['payment_places'] : [], + 'allowed_identification_types' => isset($value['allowed_identification_types']) ? $value['allowed_identification_types'] : [], ); } @@ -180,19 +184,17 @@ public function paymentsDefaultData($value) */ public function getPaymentStandard($transaction_id) { - $transaction_id = preg_replace('/[^\d]/', '', $transaction_id); - $access_token = $this->getAccessToken(); - $response = MPRestCli::get('/v1/payments/' . (int) $transaction_id, ["Authorization: Bearer " . $access_token]); - - //in case of failures - if ($response['status'] > 202) { - MPLog::generate('API get_payment_standard error: ' . $response['response']['message'], 'error'); - return false; + try { + $transaction_id = preg_replace('/[^\d]/', '', $transaction_id); + $sdk = CoreSdkSettings::getInstance(); + $paymentModule = $sdk->getPaymentInstance(); + return json_decode(json_encode($paymentModule->read(array( + "id" => $transaction_id + ))), true); + } catch (\Throwable $th) { + MPLog::generate('SDK get_payment_standard error: ' . $th->getMessage(), 'error'); + return false; } - - //response treatment - $result = $response['response']; - return $result; } /** @@ -204,19 +206,15 @@ public function getPaymentStandard($transaction_id) */ public function getMerchantOrder($id) { - $id = preg_replace('/[^\d]/', '', $id); - $access_token = $this->getAccessToken(); - $response = MPRestCli::get('/merchant_orders/' . (int) $id, ["Authorization: Bearer " . $access_token]); - - //in case of failures - if ($response['status'] > 202) { - MPLog::generate('API get_merchant_orders error: ' . $response['response']['message'], 'error'); + try { + $id = preg_replace('/[^\d]/', '', $id); + $sdk = CoreSdkSettings::getInstance(); + $merchantOrderModule = $sdk->getMerchantOrderInstance(); + return json_decode(json_encode($merchantOrderModule->getMerchantOrder($id)), true); + } catch (\Throwable $th) { + MPLog::generate('SDK get_merchant_orders error: ' . $response['response']['message'], 'error'); return false; } - - //response treatment - $result = $response['response']; - return $result; } /** @@ -228,19 +226,17 @@ public function getMerchantOrder($id) */ public function getPreference($id) { - $id = preg_replace('/[^\w-]/', '', $id); - $access_token = $this->getAccessToken(); - $response = MPRestCli::get('/checkout/preferences/' . $id, ["Authorization: Bearer " . $access_token]); - - //in case of failures - if ($response['status'] > 202) { - MPLog::generate('API get_checkout_preferences error: ' . $response['response']['message'], 'error'); - return false; + try { + $id = preg_replace('/[^\w-]/', '', $id); + $sdk = CoreSdkSettings::getInstance(); + $preferenceModule = $sdk->getPreferenceInstance(); + return json_decode(json_encode($preferenceModule->read(array( + "id" => $id + )))); + } catch (\Throwable $th) { + MPLog::generate('SDK get_checkout_preferences error: ' . $th->getMessage(), 'error'); + return false; } - - //response treatment - $result = $response['response']; - return $result; } /** @@ -250,28 +246,17 @@ public function getPreference($id) */ public function createPreference($preference) { - $access_token = $this->getAccessToken(); - $headers = [ - "platform:desktop", - "type:prestashop", - "so:1.0.0", - "Authorization: Bearer " . $access_token - ]; - $response = MPRestCli::post( - '/ppcore/prod/transaction/v1/preferences', - $preference, - $headers - ); + try { + $sdk = CoreSdkSettings::getInstance(); + $preferenceModule = $sdk->getPreferenceInstance(); - //in case of failures - if ($response['status'] > 202) { - MPLog::generate('API create_preferences error: ' . $response['response']['message'], 'error'); - return false; - } + $preferenceModule->setEntity($preference); - //response treatment - $result = $response['response']; - return $result; + return $preferenceModule->save(); + } catch (\Throwable $th) { + MPLog::generate('API create_preference error: ' . $th->getMessage(), 'error'); + return $th->getMessage(); + } } /** @@ -281,28 +266,17 @@ public function createPreference($preference) */ public function createPayment($preference) { - $access_token = $this->getAccessToken(); - $headers = [ - "platform:desktop", - "type:prestashop", - "so:1.0.0", - "Authorization: Bearer " . $access_token - ]; - $response = MPRestCli::post( - '/ppcore/prod/transaction/v1/payments', - $preference, - $headers - ); - - //in case of failures - if ($response['status'] > 202) { - MPLog::generate('API create_custom_payment error: ' . $response['response']['message'], 'error'); - return $response['response']['message']; + try { + $sdk = CoreSdkSettings::getInstance(); + $paymentModule = $sdk->getPaymentInstance(); + + $paymentModule->setEntity($preference); + + return $paymentModule->save(); + } catch (\Throwable $th) { + MPLog::generate('API create_custom_payment error: ' . $th->getMessage(), 'error'); + return $th->getMessage(); } - - //response treatment - $result = $response['response']; - return $result; } /** diff --git a/includes/module/checkouts/PseCheckout.php b/includes/module/checkouts/PseCheckout.php new file mode 100644 index 00000000..fa5f611a --- /dev/null +++ b/includes/module/checkouts/PseCheckout.php @@ -0,0 +1,186 @@ + + * @copyright 2007-2024 PrestaShop SA + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + * + * Don't forget to prefix your containers with your own identifier + * to avoid any conflicts with others containers. + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +class PseCheckout +{ + const PSE_CHECKOUT_NAME = 'MERCADOPAGO_PSE_CHECKOUT'; + + const PSE_CHECKOUT_DISCOUNT_NAME = 'MERCADOPAGO_PSE_DISCOUNT'; + + const PAYMENT_METHOD_NAME = 'pse'; + + const CHECKOUT_TYPE = 'custom'; + + /** + * @var MPUseful + */ + public $utility; + + /** + * @var string + */ + public $assetsExtMin; + + public function __construct() + { + $this->assetsExtMin = !_PS_MODE_DEV_ ? '.min' : ''; + $this->utility = MPUseful::getInstance(); + } + + /** + * @param array $paymentMethods From Core P&P Payment Methods API + * @param array $pluginInfos Some properties about plugin + * + * @return array + * @throws PrestaShopException + */ + public function getPseTemplateData($paymentMethods, $pluginInfos) + { + $site_id = $this->getSiteId(); + $redirect = $pluginInfos['redirect_link']; + $termsUrl = $this->utility->getTermsAndPoliciesLink($site_id); + $moduleDir = $pluginInfos['module_dir']; + $templateData = array( + "payment_method_info" => $this->getPsePaymentMethod($paymentMethods), + "site_id" => $site_id, + "version" => MP_VERSION, + "redirect" => $redirect, + "module_dir" => $moduleDir, + "terms_url" => $termsUrl, + "assets_ext_min" => $this->assetsExtMin, + "discount" => $this->getDiscount() + ); + + return array_merge($templateData, array("module_dir" => $moduleDir)); + } + + /** + * Display checkout only MCO + * + * @param string $country ex.: MCO, MLB, etc.. + * + * @return bool + */ + public function isAvailableToCountry($country) + { + return Tools::strtolower($country) == 'mco'; + } + + /** + * If PSE discount is setted on admin, return the banner + * + * @return string + */ + public function getDiscountBanner() + { + $discount = $this->getDiscount(); + + if ($discount > 0) { + return '(' . $discount . '% OFF)'; + } + + return ''; + } + + /** + * Get site id + * + * @return string + */ + private function getSiteId() + { + return Configuration::get('MERCADOPAGO_SITE_ID'); + } + + /** + * Get discount value + * + * @return int + */ + public function getDiscount() { + $discount = Configuration::get(self::PSE_CHECKOUT_DISCOUNT_NAME); + + return is_numeric($discount) && $discount > 0 ? $discount : 0; + } + + /** + * Only filter PSE payment method + * + * @param array $paymentMethods from Core P&P Payment Methods API + * + * @return array + */ + private function getPsePaymentMethod($paymentMethods) + { + if (empty($paymentMethods)) { + return array(); + } + + $checkoutPaymentMethods = array_filter($paymentMethods, function($paymentMethod) { + return Tools::strtolower($paymentMethod['id']) == 'pse'; + }); + + if (empty($checkoutPaymentMethods)) { + return array(); + } + + $psePaymentMethod = array_shift($checkoutPaymentMethods); + + return array( + "id" => $psePaymentMethod['id'], + "name" => $psePaymentMethod['name'], + "person_types" => $this->getPersonTypes(), + "financial_institutions" => $psePaymentMethod['financial_institutions'], + "allowed_identification_types" => $psePaymentMethod['allowed_identification_types'], + ); + } + + /** + * Person types allowed in PSE (Equivalent to PF and PJ in Brazil) + * + * @return array + */ + private function getPersonTypes() + { + return array( + array( + "id" => "individual", + "name" => "Individual", + ), + array( + "id" => "association", + "name" => "Association", + ), + ); + } +} diff --git a/includes/module/notification/AbstractNotification.php b/includes/module/notification/AbstractNotification.php index c32bd7d1..fd0f5c2e 100644 --- a/includes/module/notification/AbstractNotification.php +++ b/includes/module/notification/AbstractNotification.php @@ -141,7 +141,7 @@ public function createOrder($cart, $custom_create_order = false) false ); - $this->order_id = Order::getOrderByCartId($cart->id); + $this->order_id = Order::getIdByCartId($cart->id); $order = new Order($this->order_id); $payments = $order->getOrderPaymentCollection(); diff --git a/includes/module/notification/IpnNotification.php b/includes/module/notification/IpnNotification.php index ab089779..64ff29e0 100644 --- a/includes/module/notification/IpnNotification.php +++ b/includes/module/notification/IpnNotification.php @@ -133,7 +133,7 @@ public function getCheckoutType() $preference = $this->mercadopago->getPreference($this->merchant_order['preference_id']); $checkout = 'pro'; - $checkoutType = isset($preference['metadata']['checkout_type']) ? $preference['metadata']['checkout_type'] : false; + $checkoutType = isset($preference->metadata->checkout_type) ? $preference->metadata->checkout_type : false; if ($checkoutType && $checkoutType === 'wallet_button') { $checkout = 'wallet_button'; @@ -150,7 +150,7 @@ public function getCheckoutType() */ public function getOrderId($cart) { - $orderId = Order::getOrderByCartId($cart->id); + $orderId = Order::getIdByCartId($cart->id); $this->order_id = $orderId; return $orderId; diff --git a/includes/module/notification/WebhookNotification.php b/includes/module/notification/WebhookNotification.php index f39a9dc7..751e0272 100644 --- a/includes/module/notification/WebhookNotification.php +++ b/includes/module/notification/WebhookNotification.php @@ -57,7 +57,7 @@ public function receiveNotification($cart) $this->verifyWebhook($cart); $this->total = $this->getTotal($cart, $this->checkout); - $orderId = Order::getOrderByCartId($cart->id); + $orderId = Order::getIdByCartId($cart->id); if ($orderId != 0) { $this->verifyCustomPayment(); diff --git a/includes/module/preference/AbstractPreference.php b/includes/module/preference/AbstractPreference.php index 389327a6..1dc9c894 100644 --- a/includes/module/preference/AbstractPreference.php +++ b/includes/module/preference/AbstractPreference.php @@ -31,6 +31,8 @@ exit; } +require_once MP_ROOT_URL . '/includes/module/checkouts/PseCheckout.php'; + abstract class AbstractPreference { public $module; @@ -615,6 +617,10 @@ public function getMercadoPagoSettings() $this->settings['MERCADOPAGO_PIX_DISCOUNT'] = Configuration::get('MERCADOPAGO_PIX_DISCOUNT'); $this->settings['MERCADOPAGO_PIX_EXPIRATION'] = Configuration::get('MERCADOPAGO_PIX_EXPIRATION'); + //pse checkout + $this->settings[PseCheckout::PSE_CHECKOUT_NAME] = Configuration::get(PseCheckout::PSE_CHECKOUT_NAME); + $this->settings[PseCheckout::PSE_CHECKOUT_DISCOUNT_NAME] = Configuration::get(PseCheckout::PSE_CHECKOUT_DISCOUNT_NAME); + return $this->settings; } diff --git a/includes/module/preference/CustomPreference.php b/includes/module/preference/CustomPreference.php index b8f655d6..efe558cd 100644 --- a/includes/module/preference/CustomPreference.php +++ b/includes/module/preference/CustomPreference.php @@ -76,10 +76,9 @@ public function createPreference($cart, $custom_info) //Generate preference $this->generateLogs($preference, 'custom'); - $preferenceEncoded = json_encode($preference); - + //Create preference - $createPreference = $this->mercadopago->createPayment($preferenceEncoded); + $createPreference = $this->mercadopago->createPayment($preference); MPLog::generate('Cart id ' . $cart->id . ' - Custom Preference created successfully'); return $createPreference; diff --git a/includes/module/preference/PixPreference.php b/includes/module/preference/PixPreference.php index 09d6107d..6d572cbe 100644 --- a/includes/module/preference/PixPreference.php +++ b/includes/module/preference/PixPreference.php @@ -57,9 +57,8 @@ public function createPreference() $payload['transaction_amount'] = $this->getAmount(); $this->generateLogs($payload, 'pix'); - $payloadToJson = json_encode($payload); - $createPreference = $this->mercadopago->createPayment($payloadToJson); + $createPreference = $this->mercadopago->createPayment($payload); MPLog::generate('Cart ID ' . $this->cart->id . ' - Pix Preference created successfully'); return $createPreference; @@ -120,6 +119,9 @@ public function buildPixPreferencePayload() 'payer' => $this->getCustomerData(), 'metadata' => $this->getInternalMetadata($this->cart), 'additional_info' => $this->getAdditionalInfo(), + 'point_of_interaction' => [ + 'type' => 'CHECKOUT', + ] ]; return array_merge($payloadParent, $payloadAdditional); diff --git a/includes/module/preference/PsePreference.php b/includes/module/preference/PsePreference.php new file mode 100644 index 00000000..45f3af49 --- /dev/null +++ b/includes/module/preference/PsePreference.php @@ -0,0 +1,223 @@ + + * @copyright 2007-2024 PrestaShop SA + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + * + * Don't forget to prefix your containers with your own identifier + * to avoid any conflicts with others containers. + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +require_once MP_ROOT_URL . '/includes/module/preference/AbstractPreference.php'; +require_once MP_ROOT_URL . '/includes/module/checkouts/PseCheckout.php'; + +class PsePreference extends AbstractPreference +{ + /** + * @var PseCheckout + */ + public $pseCheckout; + + /** + * @var object + */ + public $cart; + + public function __construct($pseCheckout, $cart) + { + parent::__construct(); + + $this->pseCheckout = $pseCheckout; + $this->cart = $cart; + $this->checkout = $pseCheckout::CHECKOUT_TYPE; + } + + /** + * @param array $payerData from checkout screen + * @param string $callbackPath + * + * @return array + */ + public function createPayment($payerData, $callbackPath) + { + $payload = $this->buildPayload($payerData, $callbackPath); + + $this->applyDiscountByCart($this->cart); + + $payload['transaction_amount'] = $this->getAmount(); + + $this->generateLogs($payload, $this->pseCheckout::PAYMENT_METHOD_NAME); + + $createdPayment = $this->mercadopago->createPayment($payload); + MPLog::generate('Cart ID ' . $this->cart->id . ' - PSE payment created successfully'); + + return $createdPayment; + } + + /** + * @return void + */ + private function applyDiscountByCart($cart) + { + $discount = $this->pseCheckout->getDiscount(); + + if ($this->pseCheckout->getDiscount()) { + parent::setCartRule($cart, $discount); + MPLog::generate( + 'Mercado Pago custom discount applied to cart ' . $cart->id + ); + } + } + + /** + * @return void + */ + public function deactivateDiscount() + { + if ($this->pseCheckout->getDiscount()) { + parent::disableCartRule(); + } + } + + /** + * @return void + */ + public function removeDiscount() + { + if ($this->pseCheckout->getDiscount()) { + parent::deleteCartRule(); + } + } + + /** + * @param array $payerData + * @param string $callbackPath + * + * @return array + */ + public function buildPayload($payerData, $callbackPath) + { + $payloadParent = $this->getCommonPreference($this->cart); + $buildedPayerObject = $this->buildPayerObject($payerData); + + $payloadAdditional = [ + 'notification_url' => $this->getNotificationUrl($this->cart) . '&topic=payment' . '&method=pse', + 'callback_url' => Context::getContext()->link->getPageLink("order-confirmation", true) . $callbackPath, + 'description' => $this->getPreferenceDescription($this->cart), + 'payment_method_id' => $this->pseCheckout::PAYMENT_METHOD_NAME, + 'payer' => $buildedPayerObject, + 'metadata' => $this->buildMetadataObject($this->cart), + 'additional_info' => $this->buildAdditionalInfoObject($buildedPayerObject), + 'transaction_details' => array( + 'financial_institution' => $payerData['financial_institution'] + ) + ]; + + return array_merge($payloadParent, $payloadAdditional); + } + + /** + * @return array + */ + private function buildPayerObject($payerData) + { + $customerFields = Context::getContext()->customer->getFields(); + $payerInfoFromCart = new Address((int) $this->cart->id_address_invoice); + + $customerData = array( + 'email' => $customerFields['email'], + 'first_name' => $customerFields['firstname'], + 'last_name' => $customerFields['lastname'], + 'entity_type' => $payerData['entity_type'], + 'identification' => array( + 'type' => $payerData['document_type'], + 'number' => $payerData['document_number'], + ), + 'phone' => array( + 'area_code' => '-', + 'number' => $payerInfoFromCart->phone, + ), + 'address' => array( + 'zip_code' => $payerInfoFromCart->postcode, + 'street_name' => $payerInfoFromCart->address1 . ' - ' . + $payerInfoFromCart->address2 . ' - ' . + $payerInfoFromCart->city . ' - ' . + $payerInfoFromCart->country, + 'street_number' => '', + 'city' => $payerInfoFromCart->city, + 'federal_unit' => '', + ) + ); + + return $customerData; + } + + /** + * @return array + */ + private function buildMetadataObject($cart) + { + $internalMetadataParent = parent::getInternalMetadata($cart); + + $internalMetadataAdditional = [ + 'checkout' => $this->pseCheckout::CHECKOUT_TYPE, + 'checkout_type' => $this->pseCheckout::PAYMENT_METHOD_NAME, + ]; + + return array_merge($internalMetadataParent, $internalMetadataAdditional); + } + + /** + * @param array $payer builded from buildPayerObject + * + * @return array + */ + private function buildAdditionalInfoObject($payer) + { + $isCustomCheckout = $this->pseCheckout::CHECKOUT_TYPE === 'custom'; + + $additionalInfo = array( + 'ip_address' => $_SERVER['REMOTE_ADDR'], + 'payer' => $payer, + 'shipments' => $this->getShipmentAddress($this->cart), + 'items' => $this->getCartItems( + $this->cart, + $isCustomCheckout, + $this->pseCheckout->getDiscount() + ), + ); + + return $additionalInfo; + } + + /** + * @return float + */ + public function getAmount() + { + return $this->cart->getOrderTotal(); + } +} diff --git a/includes/module/preference/StandardPreference.php b/includes/module/preference/StandardPreference.php index e5e57740..89710446 100644 --- a/includes/module/preference/StandardPreference.php +++ b/includes/module/preference/StandardPreference.php @@ -52,9 +52,8 @@ public function createPreference($cart) $payload = $this->buildPreferencePayload($cart); $this->generateLogs($payload, $cart); - $payloadToJson = json_encode($payload); - $createPreference = $this->mercadopago->createPreference($payloadToJson); + $createPreference = $this->mercadopago->createPreference($payload); MPLog::generate('Cart id ' . $cart->id . ' - Standard Preference created successfully'); return $createPreference; diff --git a/includes/module/preference/TicketPreference.php b/includes/module/preference/TicketPreference.php index 8e59c86e..c045dbe7 100644 --- a/includes/module/preference/TicketPreference.php +++ b/includes/module/preference/TicketPreference.php @@ -110,10 +110,9 @@ public function createPreference($cart, $ticket_info) //Generate preference $this->generateLogs($preference, 'ticket'); - $preferenceEncoded = json_encode($preference); //Create preference - $createPreference = $this->mercadopago->createPayment($preferenceEncoded); + $createPreference = $this->mercadopago->createPayment($preference); MPLog::generate('Cart id ' . $cart->id . ' - Ticket Preference created successfully'); return $createPreference; diff --git a/includes/module/preference/WalletButtonPreference.php b/includes/module/preference/WalletButtonPreference.php index d60f6a5b..746afcb8 100644 --- a/includes/module/preference/WalletButtonPreference.php +++ b/includes/module/preference/WalletButtonPreference.php @@ -52,9 +52,8 @@ public function createPreference($cart) $payload = $this->buildPreferencePayload($cart, Configuration::get('MERCADOPAGO_CUSTOM_DISCOUNT')); $this->generateLogs($payload, $cart); - $payloadToJson = json_encode($payload); - $createPreference = $this->mercadopago->createPreference($payloadToJson); + $createPreference = $this->mercadopago->createPreference($payload); MPLog::generate('Cart id ' . $cart->id . ' - Wallet Button Preference created successfully'); return $createPreference; diff --git a/includes/module/settings/CoreSdkSettings.php b/includes/module/settings/CoreSdkSettings.php new file mode 100644 index 00000000..486b8e16 --- /dev/null +++ b/includes/module/settings/CoreSdkSettings.php @@ -0,0 +1,95 @@ + +* @copyright 2007-2023 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +* +* Don't forget to prefix your containers with your own identifier +* to avoid any conflicts with others containers. +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} + +use MercadoPago\PP\Sdk\Sdk; + +class CoreSdkSettings +{ + static $instance = null; + + const PRODUCT_ID = 'BC32CCRU643001OI39AG'; + const PLATFORM_ID = 'BP1EEMU0A3M001J8OJUG'; + + private function __construct() + { + $accessToken = $this->getAccessToken(); + $publicKey = $this->getPublicKey(); + $integratorId = Configuration::get('MERCADOPAGO_INTEGRATOR_ID') ?? ''; + $instance = new Sdk($accessToken, CoreSdkSettings::PLATFORM_ID, CoreSdkSettings::PRODUCT_ID, $integratorId, $publicKey); + CoreSdkSettings::$instance = $instance; + } + + /** + * Get getInstance + * + * @return Sdk + */ + public static function getInstance() : Sdk { + try { + if (CoreSdkSettings::$instance == null) { + new CoreSdkSettings(); + } + return CoreSdkSettings::$instance; + } catch (\Throwable $th) { + throw new Exception($th->getMessage()); + } + } + + /** + * Get access token + * + * @return string + */ + private function getAccessToken() + { + if (Configuration::get('MERCADOPAGO_PROD_STATUS') == true) { + return Configuration::get('MERCADOPAGO_ACCESS_TOKEN'); + } + + return Configuration::get('MERCADOPAGO_SANDBOX_ACCESS_TOKEN'); + } + + /** + * Get public key + * + * @return string + */ + private function getPublicKey() + { + if (Configuration::get('MERCADOPAGO_PROD_STATUS') == true) { + return Configuration::get('MERCADOPAGO_PUBLIC_KEY'); + } + + return Configuration::get('MERCADOPAGO_SANDBOX_PUBLIC_KEY'); + } +} diff --git a/includes/module/settings/PseSettings.php b/includes/module/settings/PseSettings.php new file mode 100644 index 00000000..1c297bb8 --- /dev/null +++ b/includes/module/settings/PseSettings.php @@ -0,0 +1,123 @@ + + * @copyright 2007-2024 PrestaShop SA + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + * + * Don't forget to prefix your containers with your own identifier + * to avoid any conflicts with others containers. + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +require_once MP_ROOT_URL . '/includes/module/settings/AbstractSettings.php'; +require_once MP_ROOT_URL . '/includes/module/checkouts/PseCheckout.php'; + +class PseSettings extends AbstractSettings +{ + public function __construct() + { + parent::__construct(); + $this->submit = 'submitMercadopagoPse'; + $this->values = $this->getFormValues(); + $this->form = $this->generateForm(); + $this->process = $this->verifyPostProcess(); + } + + /** + * Generate inputs form + * + * @return array + */ + public function generateForm() + { + $title = $this->module->l('Basic Configuration', 'PseSettings'); + $fields = array(); + + if ($this->module->isEnabledPaymentMethod('pse')) { + $fields = array( + array( + 'type' => 'switch', + 'label' => $this->module->l('Payments via PSE', 'PseSettings'), + 'name' => 'MERCADOPAGO_PSE_CHECKOUT', + 'desc' => $this->module->l('By deactivating it, you will disable PSE payments from Mercado Pago Transparent Checkout.', 'PseSettings'), + 'is_bool' => true, + 'values' => array( + array( + 'id' => 'MERCADOPAGO_PSE_CHECKOUT_ON', + 'value' => true, + 'label' => $this->module->l('Active', 'PseSettings') + ), + array( + 'id' => 'MERCADOPAGO_PSE_CHECKOUT_OFF', + 'value' => false, + 'label' => $this->module->l('Inactive', 'PseSettings') + ) + ), + ), + array( + 'col' => 2, + 'suffix' => '%', + 'type' => 'text', + 'name' => PseCheckout::PSE_CHECKOUT_DISCOUNT_NAME, + 'label' => $this->module->l('Discount for purchase', 'PseSettings'), + 'desc' => $this->module->l('Offer a special discount to encourage your ', 'PseSettings') . + $this->module->l('customers to make the purchase with Mercado Pago.', 'PseSettings'), + ), + ); + } + + return $this->buildForm($title, $fields); + } + + /** + * Save form data + * + * @return void + */ + public function postFormProcess() + { + $this->validate = ([ + PseCheckout::PSE_CHECKOUT_DISCOUNT_NAME => 'percentage', + ]); + + parent::postFormProcess(); + MPLog::generate('PSE checkout configuration saved successfully'); + } + + /** + * Set values for the form inputs + * + * @return array + */ + public function getFormValues() + { + $formValues = array( + PseCheckout::PSE_CHECKOUT_NAME => Configuration::get(PseCheckout::PSE_CHECKOUT_NAME), + PseCheckout::PSE_CHECKOUT_DISCOUNT_NAME => Configuration::get(PseCheckout::PSE_CHECKOUT_DISCOUNT_NAME), + ); + + return $formValues; + } +} diff --git a/mercadopago.php b/mercadopago.php old mode 100644 new mode 100755 index fcadccb9..4300a279 --- a/mercadopago.php +++ b/mercadopago.php @@ -24,7 +24,7 @@ * International Registered Trademark & Property of MercadoPago */ -define('MP_VERSION', '4.16.0'); +define('MP_VERSION', '4.17.0'); define('MP_ROOT_URL', dirname(__FILE__)); if (!defined('_PS_VERSION_')) { @@ -51,6 +51,7 @@ class Mercadopago extends PaymentModule public $ticketCheckout; public $standardCheckout; public $pixCheckout; + public $pseCheckout; public $confirmUninstall; public $ps_versions_compliancy; public $ps_version; @@ -73,7 +74,7 @@ public function __construct() $this->bootstrap = true; //Always update, because prestashop doesn't accept version coming from another variable (MP_VERSION) - $this->version = '4.16.0'; + $this->version = '4.17.0'; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); parent::__construct(); @@ -89,6 +90,7 @@ public function __construct() $this->customCheckout = new CustomCheckout($this); $this->ticketCheckout = new TicketCheckout($this); $this->pixCheckout = new PixCheckout($this); + $this->pseCheckout = new PseCheckout($this); } @@ -116,6 +118,7 @@ public function loadFiles() include_once MP_ROOT_URL . '/includes/module/checkouts/CustomCheckout.php'; include_once MP_ROOT_URL . '/includes/module/checkouts/TicketCheckout.php'; include_once MP_ROOT_URL . '/includes/module/checkouts/PixCheckout.php'; + include_once MP_ROOT_URL . '/includes/module/checkouts/PseCheckout.php'; } /** @@ -195,6 +198,7 @@ public function getContent() $ticket = ""; $standard = ""; $pix = ""; + $pse = ""; $this->loadSettings(); new RatingSettings(); @@ -231,12 +235,14 @@ public function getContent() $custom = new CustomSettings(); $ticket = new TicketSettings(); $pix = new PixSettings(); + $pse = new PseSettings(); $store = $this->renderForm($store->submit, $store->values, $store->form); $standard = $this->renderForm($standard->submit, $standard->values, $standard->form); $custom = $this->renderForm($custom->submit, $custom->values, $custom->form); $ticket = $this->renderForm($ticket->submit, $ticket->values, $ticket->form); $pix = $this->renderForm($pix->submit, $pix->values, $pix->form); + $pse = $this->renderForm($pse->submit, $pse->values, $pse->form); $pix_enabled = $this->isEnabledPaymentMethod('pix'); $country_id = $this->getSiteIdByCredentials($access_token); @@ -275,6 +281,7 @@ public function getContent() 'custom_form' => $custom, 'ticket_form' => $ticket, 'pix_form' => $pix, + 'pse_form' => $pse, ) )->fetch($this->local_path . 'views/templates/admin/configure.tpl'); @@ -297,6 +304,8 @@ public function loadSettings() include_once MP_ROOT_URL . '/includes/module/settings/CredentialsSettings.php'; include_once MP_ROOT_URL . '/includes/module/settings/LocalizationSettings.php'; include_once MP_ROOT_URL . '/includes/module/settings/HomologationSettings.php'; + include_once MP_ROOT_URL . '/includes/module/settings/PseSettings.php'; + require_once MP_ROOT_URL . '/includes/module/settings/CoreSdkSettings.php'; } /** @@ -419,6 +428,7 @@ public function hookHeader() { $this->context->controller->addCSS($this->_path . 'views/css/front' . $this->assets_ext_min . '.css'); $this->context->controller->addCSS($this->_path . 'views/css/pixFront' . $this->assets_ext_min . '.css'); + $this->context->controller->addCSS($this->_path . 'views/css/pse' . $this->assets_ext_min . '.css'); $this->context->controller->addJS($this->_path . 'views/js/front' . $this->assets_ext_min . '.js'); } @@ -470,11 +480,14 @@ public function loadPayments($params, $version) 'MERCADOPAGO_CUSTOM_CHECKOUT' => 'getCustomCheckout', 'MERCADOPAGO_TICKET_CHECKOUT' => 'getTicketCheckout', 'MERCADOPAGO_PIX_CHECKOUT' => 'getPixCheckout', + 'MERCADOPAGO_PSE_CHECKOUT' => 'getPseCheckout', ); foreach ($checkouts as $checkout => $method) { if ($this->isActiveCheckout($checkout) && $this->isAvailableToCountry($checkout, $country)) { $paymentOptions[] = $this->{$method}($cart, $version); + } else { + $this->disableCheckout($checkout); } } @@ -497,15 +510,30 @@ public function isActiveCheckout($checkout) */ public function isAvailableToCountry($checkout, $country) { - if ($checkout !== 'MERCADOPAGO_PIX_CHECKOUT') { + $checkoutsWithCountryRestriction = array( + 'MERCADOPAGO_PIX_CHECKOUT', + PseCheckout::PSE_CHECKOUT_NAME + ); + + if (!in_array($checkout, $checkoutsWithCountryRestriction)) { return true; } - if ($country === 'mlb' && $this->isEnabledPaymentMethod('pix')) { + if ( + $country === 'mlb' + && $checkout === 'MERCADOPAGO_PIX_CHECKOUT' + && $this->isEnabledPaymentMethod('pix') + ) { return true; } - $this->disableCheckout($checkout); + if ( + $this->pseCheckout->isAvailableToCountry($country) + && $checkout === PseCheckout::PSE_CHECKOUT_NAME + && $this->isEnabledPaymentMethod(PseCheckout::PAYMENT_METHOD_NAME) + ) { + return true; + } return false; } @@ -660,6 +688,29 @@ public function getPixCheckout($cart, $version) return $pixCheckout; } + /** + * @param $cart + * @param $version + * @return PaymentOption | string + */ + public function getPseCheckout($cart, $version) + { + $pluginInfos = array( + 'redirect_link' => $this->context->link->getModuleLink($this->name, PseCheckout::PAYMENT_METHOD_NAME), + 'module_dir' => $this->path, + ); + $paymentMethods = $this->mercadopago->getPaymentMethods(); + $templateData = $this->pseCheckout->getPseTemplateData($paymentMethods, $pluginInfos); + $infoTemplate = $this->context->smarty->assign($templateData) + ->fetch('module:mercadopago/views/templates/hook/seven/pse.tpl'); + $psePaymentOption = new PrestaShop\PrestaShop\Core\Payment\PaymentOption(); + $psePaymentOption->setForm($infoTemplate) + ->setCallToActionText($this->l('PSE') . ' ' . $this->pseCheckout->getDiscountBanner()) + ->setLogo(_MODULE_DIR_ . 'mercadopago/views/img/mpinfo_checkout.png'); + + return $psePaymentOption; + } + /** * Check currency * @@ -711,6 +762,13 @@ public function getPaymentReturn($payment, $params) { $order = array_key_exists('objOrder', $params) ? $params['objOrder'] : null; $products = !is_null($order) ? $order->getProducts() : null; + $mp_currency = $this->context->currency->iso_code; + if (isset($payment['transaction_details']['total_paid_amount']) && isset($payment['transaction_amount']) && isset($payment['transaction_details']['installment_amount'])) { + $cost_of_installments = $payment['transaction_details']['total_paid_amount'] - $payment['transaction_amount']; + $cost_of_installments_formated = $this->context->currentLocale->formatPrice($cost_of_installments, $mp_currency); + $total_paid_amount = $this->context->currentLocale->formatPrice($payment['transaction_details']['total_paid_amount'], $mp_currency); + $installment_amount = $this->context->currentLocale->formatPrice($payment['transaction_details']['installment_amount'], $mp_currency); + } $this->context->smarty->assign( array( @@ -718,6 +776,10 @@ public function getPaymentReturn($payment, $params) 'payment' => $payment, 'order_products' => $products, 'pix_expiration' => $this->getPixExpiration(), + 'cost_of_installments' => isset($cost_of_installments) ? $cost_of_installments : null, + 'cost_of_installments_formated' => isset($cost_of_installments_formated) ? $cost_of_installments_formated : null, + 'total_paid_amount' => isset($total_paid_amount) ? $total_paid_amount : null, + 'installment_amount' => isset($installment_amount) ? $installment_amount : null, ) ); @@ -759,11 +821,13 @@ public function hookDisplayOrderConfirmation($params) { $order = isset($params['order']) ? $params['order'] : $params['objOrder']; $checkout_type = Tools::getIsset('checkout_type') ? Tools::getValue('checkout_type') : null; + $mp_currency = $this->context->currency->iso_code; + $total_paid_amount = $this->context->currentLocale->formatPrice($order->total_paid, $mp_currency); $this->context->smarty->assign( array( 'checkout_type' => $checkout_type, - 'total_paid_amount' => $order->total_paid, + 'total_paid_amount' => $total_paid_amount, ) ); diff --git a/package-lock.json b/package-lock.json index ba27003d..00baed2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "fury_prestashop-mercadopago", - "version": "4.16.0", + "version": "4.17.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "4.16.0", + "version": "4.17.0", "devDependencies": { "husky": "^7.0.0", "jshint": "^2.13.4", diff --git a/package.json b/package.json index 7ff7b105..bc1f4a06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "main": "scripts.js", - "version": "4.16.0", + "version": "4.17.0", "description": "Gateway de pagamento Mercado Pago para PrestaShop", "repository": { "type": "git", diff --git a/translations/ag.php b/translations/ag.php old mode 100644 new mode 100755 index 16b72630..3eb707d0 --- a/translations/ag.php +++ b/translations/ag.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; diff --git a/translations/br.php b/translations/br.php old mode 100644 new mode 100755 index 3723a13c..420afbd6 --- a/translations/br.php +++ b/translations/br.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'Ou pague usando o código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Acesse o seu banco ou app de pagamentos e escolha pagar via Pix com código QR. Depois, escaneie o seguinte código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'O Pix possui limite diário de transferência. Consulte o seu banco para mais informações.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALHES DO PAGAMENTO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Custo do parcelamento:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total parcelado:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%sx de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Pague %s via Pix para garantir a compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Conferir código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Use seus cartões salvos'; diff --git a/translations/cb.php b/translations/cb.php old mode 100644 new mode 100755 index 16b72630..ce9695ff --- a/translations/cb.php +++ b/translations/cb.php @@ -21,6 +21,7 @@ $_MODULE['<{mercadopago}prestashop>mercadopago_f4818b8be3fb0dcad10b46475db2efa1'] = ' Paga con tarjetas de crédito y débito'; $_MODULE['<{mercadopago}prestashop>mercadopago_5edffb5efe684d534217bad198adeece'] = 'Paga con medios de pago en efectivo'; $_MODULE['<{mercadopago}prestashop>mercadopago_125ecb74bf3c3ae52c703a59dcf9bed7'] = 'Pix'; +$_MODULE['<{mercadopago}prestashop>mercadopago_6f0862d55fca52dbe032fa0b99e9c6b5'] = 'PSE'; $_MODULE['<{mercadopago}prestashop>mercadopago_640fd0cc0ffa0316ae087652871f4486'] = 'minutos'; $_MODULE['<{mercadopago}prestashop>mercadopago_896c55cc5e46fab38ce9f51ebf7bfcd3'] = 'hora'; $_MODULE['<{mercadopago}prestashop>mercadopago_73cdddd7730abfc13a55efb9f5685a3b'] = 'horas'; @@ -76,6 +77,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; @@ -120,6 +125,18 @@ $_MODULE['<{mercadopago}prestashop>pix_7b143404ebb39b4ea802fa8e565850af'] = 'Consulta a tu banco para más información.'; $_MODULE['<{mercadopago}prestashop>pix_534f563349a6429842acd523b5db6ec6'] = 'Al continuar, aceptas nuestros '; $_MODULE['<{mercadopago}prestashop>pix_97abaa921b2270031573362f57aad4a4'] = 'Términos y Condiciones'; +$_MODULE['<{mercadopago}prestashop>pse_14ac53fc9837f6a25b5813e4510af6b6'] = 'Selecciona dónde quieres pagar'; +$_MODULE['<{mercadopago}prestashop>pse_1f7e8174cfea2d9ee7233f39a1f9463f'] = 'Tipo de persona'; +$_MODULE['<{mercadopago}prestashop>pse_56e32c068a590b5d2d55c953cee3ce81'] = 'Selecciona un tipo de persona'; +$_MODULE['<{mercadopago}prestashop>pse_eb13f92390a930aa5da721f4292529fb'] = 'Seleccione un tipo de persona'; +$_MODULE['<{mercadopago}prestashop>pse_e2a7e3d7bdc43c68bbc0a9fea4149ea7'] = 'Documento Titular'; +$_MODULE['<{mercadopago}prestashop>pse_1ef80c01ee8c4ca602bd53735252b613'] = 'Selecciona un tipo de documento'; +$_MODULE['<{mercadopago}prestashop>pse_303225b7d9b63078d1d8b94f6d83cb2f'] = 'Número de documento del titular'; +$_MODULE['<{mercadopago}prestashop>pse_5d8a36c4c9eb5569d946320ff14ca4ec'] = 'Introduzca un número de documento válido'; +$_MODULE['<{mercadopago}prestashop>pse_0322bb7029cf578f616a30d5dd133f4b'] = 'Institución financiera'; +$_MODULE['<{mercadopago}prestashop>pse_becc65a62921a3ce04629e1f124ea420'] = 'Seleccione una institución financiera'; +$_MODULE['<{mercadopago}prestashop>pse_534f563349a6429842acd523b5db6ec6'] = 'Al continuar, aceptas nuestra'; +$_MODULE['<{mercadopago}prestashop>pse_97abaa921b2270031573362f57aad4a4'] = 'Términos y condiciones'; $_MODULE['<{mercadopago}prestashop>ticket_5edffb5efe684d534217bad198adeece'] = 'Paga con medios de pago en efectivo'; $_MODULE['<{mercadopago}prestashop>ticket_49ee3087348e8d44e1feda1917443987'] = 'Nombre'; $_MODULE['<{mercadopago}prestashop>ticket_377e99e7404b414341a9621f7fb3f906'] = 'Finalizar'; @@ -197,6 +214,7 @@ $_MODULE['<{mercadopago}prestashop>template_1_e05dacc06bcd12a1dbc7340983ac5a03'] = 'Checkout personalizado'; $_MODULE['<{mercadopago}prestashop>template_1_055e6bd0167d88d8c87ed8e4db5b7108'] = 'Ticket checkout'; $_MODULE['<{mercadopago}prestashop>template_1_125ecb74bf3c3ae52c703a59dcf9bed7'] = 'Pix'; +$_MODULE['<{mercadopago}prestashop>template_1_44f9d719e9270b44b525ba0390b48d93'] = 'PSE checkout'; $_MODULE['<{mercadopago}prestashop>template_1_34e8683b67ce338dc5d22bd0c1958458'] = 'Prueba tu tienda'; $_MODULE['<{mercadopago}prestashop>template_1_295a38ad46665a436f94cc11ba5033ff'] = '¿Todo configurado? Prueba tu tienda'; $_MODULE['<{mercadopago}prestashop>template_1_a2d1c5986e732ef32d7d7ec6e1c02ffb'] = 'Visita tu tienda y simula pagos para revisar que todo esté bien.'; @@ -279,6 +297,11 @@ $_MODULE['<{mercadopago}prestashop>standard_configuration_24e9fd6116bb8c7c0f060273672067e2'] = 'Selecciona pagos personales'; $_MODULE['<{mercadopago}prestashop>standard_configuration_c70ec5b31b31ecef0efd3ea40e33909f'] = 'Configuración avanzada'; $_MODULE['<{mercadopago}prestashop>standard_configuration_18b934da2943766913dc95ae10cd11d9'] = 'Activa otras herramientas de nuestro módulo listas para usar.'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_7e3c0f9991ae9abe60ee5e022ae42159'] = 'Experiencia de pago dentro de tu tienda.'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_6e7cc3c1db795bffb2de3a237442e047'] = 'Tus clientes pagan como invitados sin salir de tu tienda.'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_9816529bd797ea2cf8c0dfe7b13b9dd2'] = 'Tu cliente realizará su compra de forma rápida, sencilla y segura con estas configuraciones:'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_c70ec5b31b31ecef0efd3ea40e33909f'] = 'Configuración avanzada'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_18b934da2943766913dc95ae10cd11d9'] = 'Activa otras herramientas en nuestro módulo listas para usar.'; $_MODULE['<{mercadopago}prestashop>ticket_configuration_2cf04dc84eb55a15d6557f1f30eb63ad'] = 'Ofrece pagos en efectivo.'; $_MODULE['<{mercadopago}prestashop>ticket_configuration_7e3c0f9991ae9abe60ee5e022ae42159'] = 'Experiencia de pago dentro de tu tienda.'; $_MODULE['<{mercadopago}prestashop>ticket_configuration_6e7cc3c1db795bffb2de3a237442e047'] = 'Tus clientes pagan como invitados sin salir de tu tienda.'; @@ -390,6 +413,14 @@ $_MODULE['<{mercadopago}prestashop>storesettings_67a10b694ba920e2ad489d7637b78db4'] = 'Con este número identificamos todas tus transacciones '; $_MODULE['<{mercadopago}prestashop>storesettings_4a792eeaee7dfa3703cfb05e4940ad1b'] = 'y sabemos cuántas ventas procesamos con tu cuenta. '; $_MODULE['<{mercadopago}prestashop>ratingsettings_5ecdf7c8fed5fa55b341b963ae70790f'] = '¡Gracias por calificarnos! '; +$_MODULE['<{mercadopago}prestashop>psesettings_263485bdc392a068c22db476bfb5d0f2'] = 'Configuración Básica'; +$_MODULE['<{mercadopago}prestashop>psesettings_d8f69a6340b9852cf5f11473f0b5ce4f'] = 'Pagos por PSE'; +$_MODULE['<{mercadopago}prestashop>psesettings_fcf063fd3c127822a5247d0d5f6262ae'] = 'Al desactivarlo, deshabilitarás los pagos PSE desde Caja Transparente de Mercado Pago.'; +$_MODULE['<{mercadopago}prestashop>psesettings_4d3d769b812b6faa6b76e1a8abaece2d'] = 'Activa'; +$_MODULE['<{mercadopago}prestashop>psesettings_3cab03c00dbd11bc3569afa0748013f0'] = 'Inactiva'; +$_MODULE['<{mercadopago}prestashop>psesettings_5143ec2136ffd545e7aafcc9c0ce50f5'] = 'Descuento por compra'; +$_MODULE['<{mercadopago}prestashop>psesettings_f2a22ca66322e56b52de81d06834c1e4'] = 'Ofrece un descuento especial para incentivar tu'; +$_MODULE['<{mercadopago}prestashop>psesettings_474aceb7275c706995d816dc90bdf45d'] = 'clientes a realizar la compra con Mercado Pago.'; $_MODULE['<{mercadopago}prestashop>customsettings_263485bdc392a068c22db476bfb5d0f2'] = 'Configuración Básica'; $_MODULE['<{mercadopago}prestashop>customsettings_49c557074b8d2bdb3ad51b3e0a7de714'] = ' Activar checkout'; $_MODULE['<{mercadopago}prestashop>customsettings_d8bf0bd06048ac8cb87266046772cd15'] = 'Activa la experiencia de Mercado Pago en el checkout de tu tienda.'; diff --git a/translations/ch.php b/translations/ch.php old mode 100644 new mode 100755 index 16b72630..3eb707d0 --- a/translations/ch.php +++ b/translations/ch.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; diff --git a/translations/es.php b/translations/es.php old mode 100644 new mode 100755 index 16b72630..df6a066c --- a/translations/es.php +++ b/translations/es.php @@ -21,6 +21,7 @@ $_MODULE['<{mercadopago}prestashop>mercadopago_f4818b8be3fb0dcad10b46475db2efa1'] = ' Paga con tarjetas de crédito y débito'; $_MODULE['<{mercadopago}prestashop>mercadopago_5edffb5efe684d534217bad198adeece'] = 'Paga con medios de pago en efectivo'; $_MODULE['<{mercadopago}prestashop>mercadopago_125ecb74bf3c3ae52c703a59dcf9bed7'] = 'Pix'; +$_MODULE['<{mercadopago}prestashop>mercadopago_6f0862d55fca52dbe032fa0b99e9c6b5'] = 'PSE'; $_MODULE['<{mercadopago}prestashop>mercadopago_640fd0cc0ffa0316ae087652871f4486'] = 'minutos'; $_MODULE['<{mercadopago}prestashop>mercadopago_896c55cc5e46fab38ce9f51ebf7bfcd3'] = 'hora'; $_MODULE['<{mercadopago}prestashop>mercadopago_73cdddd7730abfc13a55efb9f5685a3b'] = 'horas'; @@ -76,6 +77,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; @@ -120,6 +125,18 @@ $_MODULE['<{mercadopago}prestashop>pix_7b143404ebb39b4ea802fa8e565850af'] = 'Consulta a tu banco para más información.'; $_MODULE['<{mercadopago}prestashop>pix_534f563349a6429842acd523b5db6ec6'] = 'Al continuar, aceptas nuestros '; $_MODULE['<{mercadopago}prestashop>pix_97abaa921b2270031573362f57aad4a4'] = 'Términos y Condiciones'; +$_MODULE['<{mercadopago}prestashop>pse_14ac53fc9837f6a25b5813e4510af6b6'] = 'Selecciona dónde quieres pagar'; +$_MODULE['<{mercadopago}prestashop>pse_1f7e8174cfea2d9ee7233f39a1f9463f'] = 'Tipo de persona'; +$_MODULE['<{mercadopago}prestashop>pse_56e32c068a590b5d2d55c953cee3ce81'] = 'Selecciona un tipo de persona'; +$_MODULE['<{mercadopago}prestashop>pse_eb13f92390a930aa5da721f4292529fb'] = 'Seleccione un tipo de persona'; +$_MODULE['<{mercadopago}prestashop>pse_e2a7e3d7bdc43c68bbc0a9fea4149ea7'] = 'Documento titular'; +$_MODULE['<{mercadopago}prestashop>pse_1ef80c01ee8c4ca602bd53735252b613'] = 'Seleccione un tipo de documento'; +$_MODULE['<{mercadopago}prestashop>pse_303225b7d9b63078d1d8b94f6d83cb2f'] = 'Número de documento del titular'; +$_MODULE['<{mercadopago}prestashop>pse_5d8a36c4c9eb5569d946320ff14ca4ec'] = 'Introduzca un número de documento válido'; +$_MODULE['<{mercadopago}prestashop>pse_0322bb7029cf578f616a30d5dd133f4b'] = 'Institución financiera'; +$_MODULE['<{mercadopago}prestashop>pse_becc65a62921a3ce04629e1f124ea420'] = 'Seleccione una institución financiera'; +$_MODULE['<{mercadopago}prestashop>pse_534f563349a6429842acd523b5db6ec6'] = 'Al continuar, aceptas nuestra'; +$_MODULE['<{mercadopago}prestashop>pse_97abaa921b2270031573362f57aad4a4'] = 'Términos y condiciones'; $_MODULE['<{mercadopago}prestashop>ticket_5edffb5efe684d534217bad198adeece'] = 'Paga con medios de pago en efectivo'; $_MODULE['<{mercadopago}prestashop>ticket_49ee3087348e8d44e1feda1917443987'] = 'Nombre'; $_MODULE['<{mercadopago}prestashop>ticket_377e99e7404b414341a9621f7fb3f906'] = 'Finalizar'; @@ -197,6 +214,7 @@ $_MODULE['<{mercadopago}prestashop>template_1_e05dacc06bcd12a1dbc7340983ac5a03'] = 'Checkout personalizado'; $_MODULE['<{mercadopago}prestashop>template_1_055e6bd0167d88d8c87ed8e4db5b7108'] = 'Ticket checkout'; $_MODULE['<{mercadopago}prestashop>template_1_125ecb74bf3c3ae52c703a59dcf9bed7'] = 'Pix'; +$_MODULE['<{mercadopago}prestashop>template_1_44f9d719e9270b44b525ba0390b48d93'] = 'PSE Checkout'; $_MODULE['<{mercadopago}prestashop>template_1_34e8683b67ce338dc5d22bd0c1958458'] = 'Prueba tu tienda'; $_MODULE['<{mercadopago}prestashop>template_1_295a38ad46665a436f94cc11ba5033ff'] = '¿Todo configurado? Prueba tu tienda'; $_MODULE['<{mercadopago}prestashop>template_1_a2d1c5986e732ef32d7d7ec6e1c02ffb'] = 'Visita tu tienda y simula pagos para revisar que todo esté bien.'; @@ -279,6 +297,11 @@ $_MODULE['<{mercadopago}prestashop>standard_configuration_24e9fd6116bb8c7c0f060273672067e2'] = 'Selecciona pagos personales'; $_MODULE['<{mercadopago}prestashop>standard_configuration_c70ec5b31b31ecef0efd3ea40e33909f'] = 'Configuración avanzada'; $_MODULE['<{mercadopago}prestashop>standard_configuration_18b934da2943766913dc95ae10cd11d9'] = 'Activa otras herramientas de nuestro módulo listas para usar.'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_7e3c0f9991ae9abe60ee5e022ae42159'] = 'Experiencia de pago dentro de tu tienda.'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_6e7cc3c1db795bffb2de3a237442e047'] = 'Tus clientes pagan como invitados sin salir de tu tienda.'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_9816529bd797ea2cf8c0dfe7b13b9dd2'] = 'Tu cliente realizará su compra de forma rápida, sencilla y segura con estas configuraciones:'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_c70ec5b31b31ecef0efd3ea40e33909f'] = 'Configuración avanzada'; +$_MODULE['<{mercadopago}prestashop>pse_configuration_18b934da2943766913dc95ae10cd11d9'] = 'Activa otras herramientas en nuestro módulo listas para usar.'; $_MODULE['<{mercadopago}prestashop>ticket_configuration_2cf04dc84eb55a15d6557f1f30eb63ad'] = 'Ofrece pagos en efectivo.'; $_MODULE['<{mercadopago}prestashop>ticket_configuration_7e3c0f9991ae9abe60ee5e022ae42159'] = 'Experiencia de pago dentro de tu tienda.'; $_MODULE['<{mercadopago}prestashop>ticket_configuration_6e7cc3c1db795bffb2de3a237442e047'] = 'Tus clientes pagan como invitados sin salir de tu tienda.'; @@ -390,6 +413,14 @@ $_MODULE['<{mercadopago}prestashop>storesettings_67a10b694ba920e2ad489d7637b78db4'] = 'Con este número identificamos todas tus transacciones '; $_MODULE['<{mercadopago}prestashop>storesettings_4a792eeaee7dfa3703cfb05e4940ad1b'] = 'y sabemos cuántas ventas procesamos con tu cuenta. '; $_MODULE['<{mercadopago}prestashop>ratingsettings_5ecdf7c8fed5fa55b341b963ae70790f'] = '¡Gracias por calificarnos! '; +$_MODULE['<{mercadopago}prestashop>psesettings_263485bdc392a068c22db476bfb5d0f2'] = 'Configuracion basica'; +$_MODULE['<{mercadopago}prestashop>psesettings_d8f69a6340b9852cf5f11473f0b5ce4f'] = 'Pagos vía PSE'; +$_MODULE['<{mercadopago}prestashop>psesettings_fcf063fd3c127822a5247d0d5f6262ae'] = 'Al desactivarlo, deshabilitarás los pagos PSE desde Caja Transparente de Mercado Pago.'; +$_MODULE['<{mercadopago}prestashop>psesettings_4d3d769b812b6faa6b76e1a8abaece2d'] = 'Activo'; +$_MODULE['<{mercadopago}prestashop>psesettings_3cab03c00dbd11bc3569afa0748013f0'] = 'Inactivo'; +$_MODULE['<{mercadopago}prestashop>psesettings_5143ec2136ffd545e7aafcc9c0ce50f5'] = 'Descuento por compra'; +$_MODULE['<{mercadopago}prestashop>psesettings_f2a22ca66322e56b52de81d06834c1e4'] = 'Ofrece un descuento especial para incentivar tu'; +$_MODULE['<{mercadopago}prestashop>psesettings_474aceb7275c706995d816dc90bdf45d'] = 'clientes a realizar la compra con Mercado Pago.'; $_MODULE['<{mercadopago}prestashop>customsettings_263485bdc392a068c22db476bfb5d0f2'] = 'Configuración Básica'; $_MODULE['<{mercadopago}prestashop>customsettings_49c557074b8d2bdb3ad51b3e0a7de714'] = ' Activar checkout'; $_MODULE['<{mercadopago}prestashop>customsettings_d8bf0bd06048ac8cb87266046772cd15'] = 'Activa la experiencia de Mercado Pago en el checkout de tu tienda.'; diff --git a/translations/mx.php b/translations/mx.php old mode 100644 new mode 100755 index 16b72630..3eb707d0 --- a/translations/mx.php +++ b/translations/mx.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; diff --git a/translations/pe.php b/translations/pe.php old mode 100644 new mode 100755 index 16b72630..3eb707d0 --- a/translations/pe.php +++ b/translations/pe.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; diff --git a/translations/uy.php b/translations/uy.php old mode 100644 new mode 100755 index 16b72630..3eb707d0 --- a/translations/uy.php +++ b/translations/uy.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; diff --git a/translations/ve.php b/translations/ve.php old mode 100644 new mode 100755 index 16b72630..3eb707d0 --- a/translations/ve.php +++ b/translations/ve.php @@ -76,6 +76,10 @@ $_MODULE['<{mercadopago}prestashop>payment_return_0c8d796851f81c120a0b2399065c45ee'] = 'O pagá usando el código QR'; $_MODULE['<{mercadopago}prestashop>payment_return_8a65009c23d57db0bf421df9b3b0b3c1'] = 'Ingresá tu banco o app de pagos y elegí pagar con Pix con código QR. Después, escaneá el siguiente código:'; $_MODULE['<{mercadopago}prestashop>payment_return_139df29331cbecb963285f57edb447be'] = 'Pix tiene límite diario de transferencias. Consulta a tu banco para más información.'; +$_MODULE['<{mercadopago}prestashop>payment_return_23832a8aff5179873681c27abe8d9627'] = 'DETALLES DEL PAGO:'; +$_MODULE['<{mercadopago}prestashop>payment_return_8e80ad06d379865a1d48ddac6b11ac43'] = 'Coste de las cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_3759398c2f035600df9b8775704f2caf'] = 'Total con cuotas:'; +$_MODULE['<{mercadopago}prestashop>payment_return_44f8e735d2811a666f000f6afbbcc176'] = '(%s cuotas de %s)'; $_MODULE['<{mercadopago}prestashop>order_confirmation_78c678f5cd66862b22483c66d4a1957a'] = 'Paga %s vía Pix para garantizar la compra.'; $_MODULE['<{mercadopago}prestashop>order_confirmation_7380891db8bece452e94dddd099cf2ad'] = 'Consultar código Pix.'; $_MODULE['<{mercadopago}prestashop>custom_8705ccdee4a8a284b7b302dd3472d25b'] = 'Usa tus tarjetas guardadas'; diff --git a/views/css/front.css b/views/css/front.css old mode 100644 new mode 100755 index 499ac082..0c1efd87 --- a/views/css/front.css +++ b/views/css/front.css @@ -486,6 +486,17 @@ body#checkout section.checkout-step .payment-options label { height: 100%; } +.mp-credit-card-box-text { + font-size: 16px; + line-height: 29px; +} + +.mp-credit-card-box-text-bold { + font-size: 16px; + line-height: 29px; + font-weight: bold; +} + .mp-erro-febraban, .mp-erro-efetivo-mlu { font-family: sans-serif !important; diff --git a/views/css/front.min.css b/views/css/front.min.css old mode 100644 new mode 100755 index d82edc9e..860e03b6 --- a/views/css/front.min.css +++ b/views/css/front.min.css @@ -1 +1 @@ -html{scroll-behavior:smooth}.mp-pd-0{padding:0!important}.mp-px-0{padding-left:0!important;padding-right:0!important}.mp-py-20{padding-top:20px!important;padding-bottom:20px!important}.mp-pr-0{padding-right:0!important}.mp-pt-0{padding-top:0!important}.mp-pt-5{padding-top:5px!important}.mp-pt-10{padding-top:10px!important}.mp-pt-15{padding-top:15px!important}.mp-pt-20{padding-top:20px!important}.mp-pt-25{padding-top:25px!important}.mp-pb-5{padding-bottom:5px!important}.mp-pb-10{padding-bottom:10px!important}.mp-pb-15{padding-bottom:15px!important}.mp-pb-20{padding-bottom:20px!important}.mp-pb-30{padding-bottom:30px!important}.mp-pl-0{padding-left:0!important}.mp-pl-10{padding-left:10px!important}.mp-pl-15{padding-left:15px!important}.mp-hg-100{height:100%!important}.mp-hg-500{height:500px!important}.mp-fl-left{float:left!important}.mp-pointer{cursor:pointer!important}.mp-small{padding-left:2px}.mp-margin-0{margin:0!important}body#checkout section.checkout-step .payment-options label{text-align:left!important}.mp-title-checkout{padding:5px 0 0}.submp-title-checkout{padding:20px 0 0;margin:0 0 5px!important;text-transform:uppercase;font-family:sans-serif!important}.mp-badge-checkout{padding:5px 10px;margin-left:5px;display:inline-block;background-color:#2ec74b;color:#fff;text-transform:none;border-radius:2px}.mp-img-tarjetas{padding:10px;max-height:40px;width:auto!important}.mp-redirect-checkout-six{display:block}.mp-redirect-checkout-six:hover{background-color:#eee}.mp-custom-checkout-six{display:block}.mp-frame-checkout-seven{padding:0 0 20px}.mp-frame-checkout-six{border:1px solid #ccc;border-radius:4px;padding:25px 20px 20px;margin:0 0 10px}.mp-title-checkout-six p{display:inline-block;margin:0;font-size:16px;font-weight:700;color:#000}.mp-title-checkout-six img{padding-right:10px}.submp-title-checkout-six{font-size:22px;font-weight:600;font-style:normal;font-stretch:normal;line-height:1.25;letter-spacing:normal;color:#04204c;padding:25px 0 0;margin:0}.submp-title-smart-checkout-six{font-size:22px;font-weight:600;font-style:normal;font-stretch:normal;line-height:1.25;letter-spacing:normal;color:#04204c;padding:25px 0 0;margin:0}.mp-redirect-frame{text-align:center;background-color:#f5f5f5;padding:25px 0 10px}.mp-redirect-frame img{max-width:160px!important}.mp-redirect-frame p{padding-top:15px!important;font-family:sans-serif!important;font-size:14px!important;font-weight:600!important;font-style:normal!important;font-stretch:normal!important;line-height:1.71!important;letter-spacing:normal!important;text-align:center!important;color:#333!important}.mp-subtitle-standard-checkout{padding:10px 0 0;margin:0 0 5px!important;text-transform:uppercase;font-family:sans-serif!important}#mercadopago-form-custom-coupon{padding-top:20px}.mp-frame-checkout-custom-seven{padding:10px 0 10px}.mp-form-control{padding:.5rem .5rem;background-color:#fff!important}.mp-form-control-error{border:2px solid #f04449!important}.mp-link-checkout-custom{color:#2fb5d2!important;font-size:14px;cursor:pointer;user-select:none}.mp-link-checkout-terms{color:#2fb5d2!important;cursor:pointer;user-select:none}.mp-link-checkout-custom .mp-link-checkout-terms :hover{color:#1a8196!important}.mp-checkout-form{padding:0 40px}.mp-frame-title{padding:10px 0 0}.mp-title-custom-checkout{padding:0 0 10px}.mp-required{color:#f04449!important;font-size:18px!important;font-weight:700;font-family:'Merriweather, Georgia'}.mp-checkbox{position:relative!important;margin-top:.15rem!important;margin-left:0!important;float:left;cursor:pointer}.mp-select{border-radius:0!important}.mp-all-required{color:#f04449!important;font-weight:700;font-size:13px}.mp-btn{width:100%}.mp-frame-payments{display:none;background-color:#f5f5f5;margin-top:10px;padding:10px 10px 10px}.mp-subtitle-payments{font-size:13px!important;font-family:sans-serif!important;color:#7a7a7a;font-weight:400;padding:0 0 0;margin:0 0 0!important;text-transform:uppercase}#container-issuers,#mp-card-holder-div,#mp-doc-div,#mp-doc-div-title,#mp-doc-number-div,#mp-doc-type-div,#mp_cnpj_label,#mp_socialname_label{display:none}.mp-text-tea{color:#797979;font-size:12px;font-weight:400;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal}.mp-text-cft{font-size:27px;font-weight:400;font-style:normal;font-stretch:normal;line-height:1.25;letter-spacing:normal;color:#868686}.mp-wallet-button-container{flex-direction:column;padding:24px 16px;height:auto;border:1px solid rgb(0 0 0 / 10%);border-radius:6px;margin-bottom:15px}.mp-wallet-button-container .mp-wallet-button-title{font-style:normal;font-weight:700;font-size:14px;line-height:20px;display:flex;align-items:center;color:rgb(0 0 0 / 90%)}.mp-wallet-button-container .mp-wallet-button-title img{max-width:100%!important;max-height:100%!important;position:inherit!important;float:none!important;margin:0!important}.mp-wallet-button-container .mp-wallet-button-title span{padding-left:8px}.mp-wallet-button-container .mp-wallet-button-description{font-style:normal;font-weight:400;font-size:14px;line-height:18px;display:flex;align-items:center;color:rgb(0 0 0 / 55%);margin:8px 0 16px}.mp-wallet-button-container .mp-wallet-button-button button{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:8px 12px;background:#009ee3;border-radius:4px;font-style:normal;font-weight:700;font-size:14px;line-height:16px;text-align:center;color:#fff;border:none;cursor:pointer;transition:all 0s ease-in-out}.mp-wallet-button-container .mp-wallet-button-button button:hover{color:#fff;background-color:#007eb5;transition:all 0s ease-in-out}#mercadopago-form-ticket-coupon{padding-bottom:15px}.mp-form-check{margin-bottom:0!important}.mp-text-ticket-tarjeta{font-weight:700;padding-left:10px}.mp-ticket-frame{height:500px;text-align:center;padding:15px 0}.mp-ticket-frame a{padding:10px 30px;margin:20px 0 15px}.mp-ticket-frame iframe{width:100%;height:100%}.mp-ticket-frame-six{height:600px;text-align:center;padding:15px 0}.mp-ticket-frame-six a{padding:10px 30px;margin:15px 0 15px}.mp-ticket-frame-six iframe{width:100%;height:100%}.mp-erro-efetivo-mlu,.mp-erro-febraban{font-family:sans-serif!important;font-weight:400!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#f04449!important;display:none;padding-top:5px;padding-left:2px}.mp-erro-form{font-family:sans-serif!important;font-weight:400!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#f04449!important;padding-top:5px;padding-left:2px;display:none}.mp-erro-input{border:1px red solid}.mp-sending-coupon{font-family:sans-serif!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#999!important;text-align:justify;display:none;padding-top:5px;padding-left:2px;font-weight:700!important}.mp-success-coupon{font-family:sans-serif!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#393!important;text-align:justify;display:none;padding-top:5px;padding-left:2px;font-weight:700!important}.mp-separate-promotion-link{padding:0 5px 0 5px!important}.mp-btn-primary{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:13px;font-weight:400;line-height:1.42857;text-align:center;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.mp-align-right{text-align:right!important}.mp-align-center{text-align:center!important}.mp-table{border:1px solid #aaa;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mp-mx-0{margin-left:0!important;margin-right:0!important}.mp-img-size{width:36px}.mp-form-item{display:flex;align-items:center;justify-content:flex-start}.mp-payment-methods-container{display:flex;align-items:center;flex-wrap:wrap;padding-top:12px;margin-left:-8px}.mp-payment-methods-container>div{margin:0 0 8px 8px}.mp-payment-method-logo-container{width:60px;height:40px;display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #e5e5e5;box-sizing:border-box;border-radius:4px;padding:4px}.mp-payment-method-logo-image{width:auto;height:auto;max-width:100%;max-height:100%!important;position:inherit!important;float:none!important;margin:0!important;font-size:10px;text-overflow:ellipsis;overflow:hidden}.mp-ticket-option-label{display:flex!important;align-items:center;justify-content:flex-start;padding-left:8px;margin:0!important;cursor:pointer}.mp-title-ticket-checkout{padding:0}@media (max-width:767.98px){.m-mp-pr-0{padding-right:0!important}.m-mp-pl-0{padding-left:0!important}.mp-redirect-frame{display:inline-block;margin-top:20px}.mp-m-col{padding-left:0!important;padding-right:0!important}.mp-fl-left{float:none!important}.mp-checkout-form{padding:0 25px 0 10px!important}.mp-m-dib{display:inline-block!important}.mp-m-px-0{padding-left:0!important;padding-right:0!important}.submp-title-checkout-six{margin:0 -15px 0 -15px!important}.mp-m-pt-10{padding-top:10px!important}.mp-ticket-frame-six a{display:block!important}.mp-btn-primary{width:100%!important}} \ No newline at end of file +html{scroll-behavior:smooth}.mp-pd-0{padding:0!important}.mp-px-0{padding-left:0!important;padding-right:0!important}.mp-py-20{padding-top:20px!important;padding-bottom:20px!important}.mp-pr-0{padding-right:0!important}.mp-pt-0{padding-top:0!important}.mp-pt-5{padding-top:5px!important}.mp-pt-10{padding-top:10px!important}.mp-pt-15{padding-top:15px!important}.mp-pt-20{padding-top:20px!important}.mp-pt-25{padding-top:25px!important}.mp-pb-5{padding-bottom:5px!important}.mp-pb-10{padding-bottom:10px!important}.mp-pb-15{padding-bottom:15px!important}.mp-pb-20{padding-bottom:20px!important}.mp-pb-30{padding-bottom:30px!important}.mp-pl-0{padding-left:0!important}.mp-pl-10{padding-left:10px!important}.mp-pl-15{padding-left:15px!important}.mp-hg-100{height:100%!important}.mp-hg-500{height:500px!important}.mp-fl-left{float:left!important}.mp-pointer{cursor:pointer!important}.mp-small{padding-left:2px}.mp-margin-0{margin:0!important}body#checkout section.checkout-step .payment-options label{text-align:left!important}.mp-title-checkout{padding:5px 0 0}.submp-title-checkout{padding:20px 0 0;margin:0 0 5px!important;text-transform:uppercase;font-family:sans-serif!important}.mp-badge-checkout{padding:5px 10px;margin-left:5px;display:inline-block;background-color:#2ec74b;color:#fff;text-transform:none;border-radius:2px}.mp-img-tarjetas{padding:10px;max-height:40px;width:auto!important}.mp-redirect-checkout-six{display:block}.mp-redirect-checkout-six:hover{background-color:#eee}.mp-custom-checkout-six{display:block}.mp-frame-checkout-seven{padding:0 0 20px}.mp-frame-checkout-six{border:1px solid #ccc;border-radius:4px;padding:25px 20px 20px;margin:0 0 10px}.mp-title-checkout-six p{display:inline-block;margin:0;font-size:16px;font-weight:700;color:#000}.mp-title-checkout-six img{padding-right:10px}.submp-title-checkout-six{font-size:22px;font-weight:600;font-style:normal;font-stretch:normal;line-height:1.25;letter-spacing:normal;color:#04204c;padding:25px 0 0;margin:0}.submp-title-smart-checkout-six{font-size:22px;font-weight:600;font-style:normal;font-stretch:normal;line-height:1.25;letter-spacing:normal;color:#04204c;padding:25px 0 0;margin:0}.mp-redirect-frame{text-align:center;background-color:#f5f5f5;padding:25px 0 10px}.mp-redirect-frame img{max-width:160px!important}.mp-redirect-frame p{padding-top:15px!important;font-family:sans-serif!important;font-size:14px!important;font-weight:600!important;font-style:normal!important;font-stretch:normal!important;line-height:1.71!important;letter-spacing:normal!important;text-align:center!important;color:#333!important}.mp-subtitle-standard-checkout{padding:10px 0 0;margin:0 0 5px!important;text-transform:uppercase;font-family:sans-serif!important}#mercadopago-form-custom-coupon{padding-top:20px}.mp-frame-checkout-custom-seven{padding:10px 0 10px}.mp-form-control{padding:.5rem .5rem;background-color:#fff!important}.mp-form-control-error{border:2px solid #f04449!important}.mp-link-checkout-custom{color:#2fb5d2!important;font-size:14px;cursor:pointer;user-select:none}.mp-link-checkout-terms{color:#2fb5d2!important;cursor:pointer;user-select:none}.mp-link-checkout-custom .mp-link-checkout-terms :hover{color:#1a8196!important}.mp-checkout-form{padding:0 40px}.mp-frame-title{padding:10px 0 0}.mp-title-custom-checkout{padding:0 0 10px}.mp-required{color:#f04449!important;font-size:18px!important;font-weight:700;font-family:'Merriweather, Georgia'}.mp-checkbox{position:relative!important;margin-top:.15rem!important;margin-left:0!important;float:left;cursor:pointer}.mp-select{border-radius:0!important}.mp-all-required{color:#f04449!important;font-weight:700;font-size:13px}.mp-btn{width:100%}.mp-frame-payments{display:none;background-color:#f5f5f5;margin-top:10px;padding:10px 10px 10px}.mp-subtitle-payments{font-size:13px!important;font-family:sans-serif!important;color:#7a7a7a;font-weight:400;padding:0 0 0;margin:0 0 0!important;text-transform:uppercase}#container-issuers,#mp-card-holder-div,#mp-doc-div,#mp-doc-div-title,#mp-doc-number-div,#mp-doc-type-div,#mp_cnpj_label,#mp_socialname_label{display:none}.mp-text-tea{color:#797979;font-size:12px;font-weight:400;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal}.mp-text-cft{font-size:27px;font-weight:400;font-style:normal;font-stretch:normal;line-height:1.25;letter-spacing:normal;color:#868686}.mp-wallet-button-container{flex-direction:column;padding:24px 16px;height:auto;border:1px solid rgb(0 0 0 / 10%);border-radius:6px;margin-bottom:15px}.mp-wallet-button-container .mp-wallet-button-title{font-style:normal;font-weight:700;font-size:14px;line-height:20px;display:flex;align-items:center;color:rgb(0 0 0 / 90%)}.mp-wallet-button-container .mp-wallet-button-title img{max-width:100%!important;max-height:100%!important;position:inherit!important;float:none!important;margin:0!important}.mp-wallet-button-container .mp-wallet-button-title span{padding-left:8px}.mp-wallet-button-container .mp-wallet-button-description{font-style:normal;font-weight:400;font-size:14px;line-height:18px;display:flex;align-items:center;color:rgb(0 0 0 / 55%);margin:8px 0 16px}.mp-wallet-button-container .mp-wallet-button-button button{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:8px 12px;background:#009ee3;border-radius:4px;font-style:normal;font-weight:700;font-size:14px;line-height:16px;text-align:center;color:#fff;border:none;cursor:pointer;transition:all 0s ease-in-out}.mp-wallet-button-container .mp-wallet-button-button button:hover{color:#fff;background-color:#007eb5;transition:all 0s ease-in-out}#mercadopago-form-ticket-coupon{padding-bottom:15px}.mp-form-check{margin-bottom:0!important}.mp-text-ticket-tarjeta{font-weight:700;padding-left:10px}.mp-ticket-frame{height:500px;text-align:center;padding:15px 0}.mp-ticket-frame a{padding:10px 30px;margin:20px 0 15px}.mp-ticket-frame iframe{width:100%;height:100%}.mp-ticket-frame-six{height:600px;text-align:center;padding:15px 0}.mp-ticket-frame-six a{padding:10px 30px;margin:15px 0 15px}.mp-ticket-frame-six iframe{width:100%;height:100%}.mp-credit-card-box-text{font-size:16px;line-height:29px}.mp-credit-card-box-text-bold{font-size:16px;line-height:29px;font-weight:700}.mp-erro-efetivo-mlu,.mp-erro-febraban{font-family:sans-serif!important;font-weight:400!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#f04449!important;display:none;padding-top:5px;padding-left:2px}.mp-erro-form{font-family:sans-serif!important;font-weight:400!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#f04449!important;padding-top:5px;padding-left:2px;display:none}.mp-erro-input{border:1px red solid}.mp-sending-coupon{font-family:sans-serif!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#999!important;text-align:justify;display:none;padding-top:5px;padding-left:2px;font-weight:700!important}.mp-success-coupon{font-family:sans-serif!important;font-style:normal;font-stretch:normal;line-height:1.29;letter-spacing:normal;color:#393!important;text-align:justify;display:none;padding-top:5px;padding-left:2px;font-weight:700!important}.mp-separate-promotion-link{padding:0 5px 0 5px!important}.mp-btn-primary{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:13px;font-weight:400;line-height:1.42857;text-align:center;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.mp-align-right{text-align:right!important}.mp-align-center{text-align:center!important}.mp-table{border:1px solid #aaa;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mp-mx-0{margin-left:0!important;margin-right:0!important}.mp-img-size{width:36px}.mp-form-item{display:flex;align-items:center;justify-content:flex-start}.mp-payment-methods-container{display:flex;align-items:center;flex-wrap:wrap;padding-top:12px;margin-left:-8px}.mp-payment-methods-container>div{margin:0 0 8px 8px}.mp-payment-method-logo-container{width:60px;height:40px;display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #e5e5e5;box-sizing:border-box;border-radius:4px;padding:4px}.mp-payment-method-logo-image{width:auto;height:auto;max-width:100%;max-height:100%!important;position:inherit!important;float:none!important;margin:0!important;font-size:10px;text-overflow:ellipsis;overflow:hidden}.mp-ticket-option-label{display:flex!important;align-items:center;justify-content:flex-start;padding-left:8px;margin:0!important;cursor:pointer}.mp-title-ticket-checkout{padding:0}@media (max-width:767.98px){.m-mp-pr-0{padding-right:0!important}.m-mp-pl-0{padding-left:0!important}.mp-redirect-frame{display:inline-block;margin-top:20px}.mp-m-col{padding-left:0!important;padding-right:0!important}.mp-fl-left{float:none!important}.mp-checkout-form{padding:0 25px 0 10px!important}.mp-m-dib{display:inline-block!important}.mp-m-px-0{padding-left:0!important;padding-right:0!important}.submp-title-checkout-six{margin:0 -15px 0 -15px!important}.mp-m-pt-10{padding-top:10px!important}.mp-ticket-frame-six a{display:block!important}.mp-btn-primary{width:100%!important}} \ No newline at end of file diff --git a/views/css/pse.css b/views/css/pse.css new file mode 100644 index 00000000..f99d9d7f --- /dev/null +++ b/views/css/pse.css @@ -0,0 +1,22 @@ +.mp-pse-checkout-container > div { + display: flex; + flex-direction: column; + gap: 5px; + margin-top: 20px; +} + +.mp-pse-checkout-subtitle { + margin-top: 20px; +} + +.mp-pse-checkout-container label { + padding-bottom: 5px; +} + +.mp-pse-checkout-required-field { + color: red; +} + +.mp-pse-advanced-config-subtitle { + padding-top: 20px; +} \ No newline at end of file diff --git a/views/css/pse.min.css b/views/css/pse.min.css new file mode 100644 index 00000000..3f7c3aa3 --- /dev/null +++ b/views/css/pse.min.css @@ -0,0 +1 @@ +.mp-pse-checkout-container>div{display:flex;flex-direction:column;gap:5px;margin-top:20px}.mp-pse-checkout-subtitle{margin-top:20px}.mp-pse-checkout-container label{padding-bottom:5px}.mp-pse-checkout-required-field{color:red}.mp-pse-advanced-config-subtitle{padding-top:20px} \ No newline at end of file diff --git a/views/js/back.min.js b/views/js/back.min.js index 29a9d88e..5551b708 100644 --- a/views/js/back.min.js +++ b/views/js/back.min.js @@ -25,4 +25,4 @@ * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ -function completeOnlineCheckbox(){for(var e=document.getElementById("checkmeon").checked,o=document.querySelectorAll(".payment-online-checkbox"),l=0;lRealiza pruebas antes de salir al mundo. Opera de dos formas:
Por defecto te dejamos el modo Sandbox activo para que hagas testeos antes de empezar a vender.
¿Todo va bien? Desactiva Sandbox al final de la configuración y abre paso a tus ventas online.
Atención: Crea una cuenta en Mercado Pago para obtener tus credenciales. Homologa tu cuenta en Mercado Pago para ir a Producción y cobrar en tu tienda.
Realiza pruebas antes de salir al mundo. Opera de dos formas:
Por defecto te dejamos el modo Sandbox activo para que hagas testeos antes de empezar a vender.
¿Todo va bien? Desactiva Sandbox al final de la configuración y abre paso a tus ventas online.
Atención: Crea una cuenta en Mercado Pago para obtener tus credenciales. Homologa tu cuenta en Mercado Pago para ir a Producción y cobrar en tu tienda.