From a697806d5b4ad6de665f3cf7721267d1d996500d Mon Sep 17 00:00:00 2001
From: Fernando Lira
Date: Thu, 6 Jan 2022 10:03:12 -0300
Subject: [PATCH] v3.14.0 (#186)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(PPWP-377): unified calls
* fix(PPWP-377): unified calls
* fix(PPWP-377): unified calls
* fix(PPWP-377): unified calls
* fix(PPWP-377): unified calls
* added payment places method
* comments removed
* refactored access token validation
* fixed ternary if structure
* fixed instantiation of access token
* :bug: Fix the PR cover checker when there is no test (#189)
This fixes an issue that is workflow failure when the pull request does not contain tests and Added hotfix branch filter to check tests
* feat(PPWP-421): paycash front-end
* feat(PPWP-422): paycash admin
* fix(helper): 🐛 fixed float to int convertion
* feat(bin): ✨ new command sync with container
* improv: init tests
* improv: changing chmod command
* build: 📦 new patch version of mercardo pago for magento 2 v3.12.3
* getMercadoPagoPaymentMethods testing
* fix(ppwp-337): fixing exception testing
* testing config provider and api
* testing PaymentMethodsTicket
* feat(ppwp-377): testing custom config provider
* refactored constants
* refactored model test classes
* refactored helper test classes
* added annotation for Code Coverage Ignore
* fixed test variables
* fixed html structure of ticket
* feat(ppwp-377): adding metadata payment_option_id
* fixing data tests
* removed exception to access token
* hotfix(PLUG-1533): fixing refund error handling
* fixing pr coverage checker
* testing pr coverage checker
* fixing pr coverage checker
* hotfix: fixed js - undefined variable
* feat(PPWP-569): initial commit
* build: 📦 new minor version of mercardo pago for magento 2 v3.13.0
* build(v3.13.0): 📦 updated readme
* expiration date mask and validations
* PPWP-569: inserted translations for titles
* PPWP-569: added space between fields
* improv(PPWP-611): dinamically validating bank transfer on admin page
* implementing cache
* PPWP-611: payment unit tests
* PPWP-611: fixed abstractElementMock
* fix(wallet button): 🐛 create order even with cho pro disabled
* fixing cache
* separating cache values with constants
* PPWP-611: refactored test directory
* PPWP-570: added translation
* PPWP-569: inserted style in title
* PPWP-569: fixed cache for new installs
* PPWP-569: fixed cache for new installs
* feature(ppwp-630): new front-end definitions
* removing cache from bank_transfer validation
* fixing payment fieldset and removing debit text
* improv(ppwp-531): adding mlu to available lists
* adding payment methods validation using API
* removing old validation
* improving cache and applying rules to other checkouts
* fixing pix rules
* disabling invalid payments
* clearing config activation flag caching
* testing new methods
* fixing cache code coverage
* fixing observer code coverage
* fixing exception syntax
* code enhancement
* fixing prefix issue
* fix(ticket): 🐛 changed str_contains to strpos
* build(v3.14.0): 📦 updated version files and changelog
* build(v3.14.0): 📦 updated changelog
* fix: treating paymentId on disablePayment function
Co-authored-by: Gustavo Brito
Co-authored-by: sleaof
Co-authored-by: Douglas
---
CHANGELOG.md | 10 +
README.md | 2 +-
composer.json | 2 +-
.../System/Config/Fieldset/Payment.php | 168 ++++--
src/MercadoPago/Core/Helper/Cache.php | 3 +
src/MercadoPago/Core/Model/Basic/Payment.php | 140 +++--
.../Core/Model/CustomTicket/Payment.php | 4 +-
.../Core/Model/Preference/Wallet.php | 1 +
.../Core/Observer/ConfigObserver.php | 37 +-
src/MercadoPago/Core/composer.json | 2 +-
.../etc/adminhtml/system/custom_checkout.xml | 1 +
.../system/custom_checkout_ticket.xml | 1 +
src/MercadoPago/Core/etc/module.xml | 2 +-
src/MercadoPago/Core/i18n/es_AR.csv | 14 +-
src/MercadoPago/Core/i18n/es_CL.csv | 14 +-
src/MercadoPago/Core/i18n/es_CO.csv | 14 +-
src/MercadoPago/Core/i18n/es_MX.csv | 14 +-
src/MercadoPago/Core/i18n/es_PE.csv | 14 +-
src/MercadoPago/Core/i18n/es_UY.csv | 14 +-
src/MercadoPago/Core/i18n/pt_BR.csv | 14 +-
.../Core/view/frontend/web/css/MPv1.css | 16 +
.../Core/view/frontend/web/js/CreditCard.js | 39 +-
.../js/view/method-renderer/custom-method.js | 20 +-
.../web/template/payment/custom_method.html | 112 ++--
.../Test/Unit/Block/Fieldset/PaymentTest.php | 187 +++++++
.../Constants/ConfigProviderConstants.php | 111 ----
.../Test/Unit/Constants/PaymentMethods.php | 47 --
src/MercadoPago/Test/Unit/Helper/DataTest.php | 12 +-
.../Unit/Mock/PaymentMethodsConfigMock.php | 44 ++
.../PaymentResponseMock.php} | 510 +++++++++++++++++-
.../Unit/Model/BasicConfigProviderTest.php | 11 +-
.../Unit/Model/CustomConfigProviderTest.php | 8 +-
.../Unit/Model/PaymentMethodsTicketTest.php | 10 +-
33 files changed, 1172 insertions(+), 426 deletions(-)
create mode 100644 src/MercadoPago/Test/Unit/Block/Fieldset/PaymentTest.php
delete mode 100644 src/MercadoPago/Test/Unit/Constants/ConfigProviderConstants.php
delete mode 100644 src/MercadoPago/Test/Unit/Constants/PaymentMethods.php
create mode 100644 src/MercadoPago/Test/Unit/Mock/PaymentMethodsConfigMock.php
rename src/MercadoPago/Test/Unit/{Constants/Response.php => Mock/PaymentResponseMock.php} (68%)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 356896af..0cbe8a67 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,16 @@ 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).
+## [3.14.0] - 2022-01-04
+
+### Added
+- Improvements to credit card flow
+- Dynamically removing unavailable payment methods from admin
+
+### Fixed
+- Changed str_contains to srtpos
+- Wallet Button working without CHO PRO enabled
+
## [3.13.0] - 2021-12-01
### Added
diff --git a/README.md b/README.md
index 712362ec..3cf558b5 100755
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-# Magento 2 - Mercado Pago Module (v3.13.0)
+# Magento 2 - Mercado Pago Module (v3.14.0)
The Mercado Pago plugin for Magento 2 allows you to expand the functionalities of your online store and offer a unique payment experience for your customers.
diff --git a/composer.json b/composer.json
index a6876f7f..8fd09926 100755
--- a/composer.json
+++ b/composer.json
@@ -8,7 +8,7 @@
}
],
"type": "magento2-module",
- "version": "3.13.0",
+ "version": "3.14.0",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/src/MercadoPago/Core/Block/Adminhtml/System/Config/Fieldset/Payment.php b/src/MercadoPago/Core/Block/Adminhtml/System/Config/Fieldset/Payment.php
index 10fd1c6b..9efb836e 100644
--- a/src/MercadoPago/Core/Block/Adminhtml/System/Config/Fieldset/Payment.php
+++ b/src/MercadoPago/Core/Block/Adminhtml/System/Config/Fieldset/Payment.php
@@ -7,17 +7,29 @@
use Magento\Backend\Model\Auth\Session;
use Magento\Config\Block\System\Config\Form\Fieldset;
use Magento\Config\Model\ResourceModel\Config;
+use Magento\Framework\App\Cache\TypeListInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\View\Helper\Js;
use Magento\Store\Model\ScopeInterface;
use MercadoPago\Core\Helper\ConfigData;
+use MercadoPago\Core\Helper\Data;
+use MercadoPago\Core\Helper\Cache;
/**
* Config form FieldSet renderer
*/
class Payment extends Fieldset
{
+
+ /**
+ * checkout types
+ */
+ const CHECKOUT_CUSTOM_CARD = 'custom_checkout';
+ const CHECKOUT_CUSTOM_PIX= 'custom_checkout_pix';
+ const CHECKOUT_CUSTOM_TICKET = 'custom_checkout_ticket';
+ const CHECKOUT_CUSTOM_BANK_TRANSFER = 'custom_checkout_bank_transfer';
+
/**
* @var ScopeConfigInterface
*/
@@ -29,12 +41,30 @@ class Payment extends Fieldset
*/
protected $configResource;
+ /**
+ *
+ * @var TypeListInterface
+ */
+ protected $cacheTypeList;
+
/**
*
* @var Switcher
*/
protected $switcher;
+ /**
+ *
+ * @var Data
+ */
+ protected $coreHelper;
+
+ /**
+ *
+ * @var Cache
+ */
+ protected $cache;
+
/**
* @param Context $context
* @param Session $authSession
@@ -43,6 +73,9 @@ class Payment extends Fieldset
* @param Config $configResource
* @param Switcher $switcher
* @param array $data
+ * @param Data $coreHelper
+ * @param Cache $cache
+ * @param TypeLIstInterface $cacheTypeList
*/
public function __construct(
Context $context,
@@ -51,12 +84,18 @@ public function __construct(
ScopeConfigInterface $scopeConfig,
Config $configResource,
Switcher $switcher,
- array $data = []
+ array $data = [],
+ Data $coreHelper,
+ Cache $cache,
+ TypeLIstInterface $cacheTypeList
) {
parent::__construct($context, $authSession, $jsHelper, $data);
$this->scopeConfig = $scopeConfig;
$this->configResource = $configResource;
$this->switcher = $switcher;
+ $this->coreHelper = $coreHelper;
+ $this->cache = $cache;
+ $this->cacheTypeList = $cacheTypeList;
}
/**
@@ -68,39 +107,42 @@ public function render(AbstractElement $element)
//get id element
$paymentId = $element->getId();
- //get country (Site id for Mercado Pago)
- $siteId = strtoupper(
- $this->scopeConfig->getValue(
- ConfigData::PATH_SITE_ID,
- ScopeInterface::SCOPE_STORE
- )
- );
-
- //check is bank transfer
- if ($this->hideBankTransfer($paymentId, $siteId)) {
- return "";
- }
-
- //check is pix
- if ($this->hidePix($paymentId, $siteId)) {
+ //check available payment methods
+ if ($this->hideInvalidCheckoutOptions($paymentId)) {
+ $this->disablePayment($paymentId);
return "";
}
return parent::render($element);
}
+ public function getPaymentMethods()
+ {
+ $accessToken = $this->coreHelper->getAccessToken();
+
+ $paymentMethods = $this->coreHelper->getMercadoPagoPaymentMethods($accessToken);
+
+ return $paymentMethods;
+ }
+
/**
- * @param $paymentActivePath
+ * Disables the given payment if it is currently active
+ *
+ * @param $paymentId
*/
- protected function disablePayment($paymentActivePath)
+ protected function disablePayment($paymentId)
{
+ $paymentIdWithoutPrefix = implode('_', array_slice(explode('_', $paymentId), 4));
+
+ $paymentActivePath = $this->getPaymentPath($paymentIdWithoutPrefix);
+
$statusPaymentMethod = $this->scopeConfig->isSetFlag(
$paymentActivePath,
ScopeInterface::SCOPE_STORE
);
//check is active for disable
- if ($statusPaymentMethod) {
+ if ($paymentActivePath && $statusPaymentMethod) {
$value = 0;
if ($this->switcher->getWebsiteId() == 0) {
@@ -113,41 +155,93 @@ protected function disablePayment($paymentActivePath)
$this->switcher->getWebsiteId()
);
}
+ $this->cacheTypeList->cleanType(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
}
}
/**
* @param $paymentId
- * @param $siteId
* @return bool
*/
- protected function hideBankTransfer($paymentId, $siteId)
+ protected function hideInvalidCheckoutOptions($paymentId)
{
- if (strpos($paymentId, 'custom_checkout_bank_transfer') !== false) {
- //hide payment method if not Chile or Colombia
- if ($siteId !== "MLC" && $siteId !== "MCO") {
- $this->disablePayment(ConfigData::PATH_CUSTOM_BANK_TRANSFER_ACTIVE);
- return true;
- }
+ if (!$this->coreHelper->getAccessToken()) {
+ return true;
+ }
+
+ $cacheKey = Cache::VALID_PAYMENT_METHODS;
+ $validCheckoutOptions = json_decode($this->cache->getFromCache($cacheKey));
+ if (!$validCheckoutOptions) {
+ $validCheckoutOptions = $this->getAvailableCheckoutOptions();
+ $this->cache->saveCache($cacheKey, json_encode($validCheckoutOptions));
}
+
+ $paymentIdWithoutPrefix = implode('_', array_slice(explode('_', $paymentId), 4));
- return false;
+ return !in_array($paymentIdWithoutPrefix, $validCheckoutOptions);
}
/**
- * @param $paymentId
- * @param $siteId
- * @return bool
+ * Get available checkout options based on payment methods of the used credentials
+ *
+ * @param string $accessToken
+ * @return array
*/
- protected function hidePix($paymentId, $siteId)
+ public function getAvailableCheckoutOptions()
{
- if (strpos($paymentId, 'custom_checkout_pix') !== false) {
- if ($siteId !== "MLB") {
- $this->disablePayment(ConfigData::PATH_CUSTOM_PIX_ACTIVE);
- return true;
+ try {
+ $availableCheckouts = array();
+ $paymentMethods = $this->getPaymentMethods();
+
+ foreach ($paymentMethods['response'] as $paymentMethod) {
+ switch (strtolower($paymentMethod['payment_type_id'])) {
+ case 'credit_card':
+ case 'debid_card':
+ case 'prepaid_card':
+ if (!in_array(self::CHECKOUT_CUSTOM_CARD, $availableCheckouts)) {
+ $availableCheckouts[] = self::CHECKOUT_CUSTOM_CARD;
+ }
+ break;
+
+ case 'atm':
+ case 'ticket':
+ if (!in_array(self::CHECKOUT_CUSTOM_TICKET, $availableCheckouts)) {
+ $availableCheckouts[] = self::CHECKOUT_CUSTOM_TICKET;
+ }
+ break;
+
+ case 'bank_transfer':
+ if (!in_array(self::CHECKOUT_CUSTOM_PIX, $availableCheckouts) && strtolower($paymentMethod['id']) === 'pix') {
+ $availableCheckouts[] = self::CHECKOUT_CUSTOM_PIX;
+ }
+ if (!in_array(self::CHECKOUT_CUSTOM_BANK_TRANSFER, $availableCheckouts) && strtolower($paymentMethod['id']) !== 'pix') {
+ $availableCheckouts[] = self::CHECKOUT_CUSTOM_BANK_TRANSFER;
+ }
+ break;
+ }
}
+
+ return $availableCheckouts;
+ } catch (\Exception $e) {
+ $this->coreHelper->log('Payment Fieldset getAvailableCheckoutOptions error: ' . $e->getMessage());
+ return [];
}
+ }
- return false;
+ public function getPaymentPath($paymentId)
+ {
+ switch ($paymentId) {
+ case (self::CHECKOUT_CUSTOM_CARD):
+ return ConfigData::PATH_CUSTOM_ACTIVE;
+
+ case (self::CHECKOUT_CUSTOM_TICKET):
+ return ConfigData::PATH_CUSTOM_TICKET_ACTIVE;
+
+ case (self::CHECKOUT_CUSTOM_PIX):
+ return ConfigData::PATH_CUSTOM_PIX_ACTIVE;
+
+ case (self::CHECKOUT_CUSTOM_BANK_TRANSFER):
+ return ConfigData::PATH_CUSTOM_BANK_TRANSFER_ACTIVE;
+ }
}
}
diff --git a/src/MercadoPago/Core/Helper/Cache.php b/src/MercadoPago/Core/Helper/Cache.php
index b46cb3d2..51f29a52 100644
--- a/src/MercadoPago/Core/Helper/Cache.php
+++ b/src/MercadoPago/Core/Helper/Cache.php
@@ -8,11 +8,14 @@
/**
* Class Cache
* @package MercadoPago\Core\Helper
+ *
+ * @codeCoverageIgnore
*/
class Cache
{
const PREFIX_KEY = 'MP_';
const IS_VALID_AT = 'IS_VALID_ACCESS_TOKEN';
+ const VALID_PAYMENT_METHODS = 'VALID_PAYMENT_METHODS';
/**
* @var CacheInterface
diff --git a/src/MercadoPago/Core/Model/Basic/Payment.php b/src/MercadoPago/Core/Model/Basic/Payment.php
index 34b281d8..7867530c 100644
--- a/src/MercadoPago/Core/Model/Basic/Payment.php
+++ b/src/MercadoPago/Core/Model/Basic/Payment.php
@@ -24,60 +24,83 @@
/**
* Class Payment
+ *
* @package MercadoPago\Core\Model\Basic
*/
class Payment extends AbstractMethod
{
- const CODE = 'mercadopago_basic';
+ const CODE = 'mercadopago_basic';
const ACTION_URL = 'mercadopago/basic/pay';
/**
* Self fields
*/
protected $_scopeConfig;
+
protected $_helperData;
+
protected $_helperImage;
+
protected $_checkoutSession;
+
protected $_customerSession;
+
protected $_orderFactory;
+
protected $_urlBuilder;
+
protected $_basic;
/**
* Overrides fields
*/
protected $_code = self::CODE;
+
protected $_isGateway = true;
+
protected $_canOrder = true;
+
protected $_canAuthorize = true;
+
protected $_canCapture = true;
+
protected $_canCapturePartial = true;
+
protected $_canRefund = true;
+
protected $_canRefundInvoicePartial = true;
+
protected $_canVoid = true;
+
protected $_canUseInternal = false;
+
protected $_canFetchTransactionInfo = true;
+
protected $_canReviewPayment = true;
+
protected $_infoBlockType = 'MercadoPago\Core\Block\Info';
+
protected $_isInitializeNeeded = true;
+
/**
* Payment constructor.
- * @param dataHelper $helperData
- * @param Image $helperImage
- * @param Session $checkoutSession
- * @param customerSession $customerSession
- * @param OrderFactory $orderFactory
- * @param UrlInterface $urlBuilder
- * @param Context $context
- * @param Registry $registry
+ *
+ * @param dataHelper $helperData
+ * @param Image $helperImage
+ * @param Session $checkoutSession
+ * @param customerSession $customerSession
+ * @param OrderFactory $orderFactory
+ * @param UrlInterface $urlBuilder
+ * @param Context $context
+ * @param Registry $registry
* @param ExtensionAttributesFactory $extensionFactory
- * @param AttributeValueFactory $customAttributeFactory
- * @param Data $paymentData
- * @param ScopeConfigInterface $scopeConfig
- * @param Logger $logger
- * @param Basic $basic
- * @param array $data
+ * @param AttributeValueFactory $customAttributeFactory
+ * @param Data $paymentData
+ * @param ScopeConfigInterface $scopeConfig
+ * @param Logger $logger
+ * @param Basic $basic
+ * @param array $data
*/
public function __construct(
dataHelper $helperData,
@@ -94,7 +117,7 @@ public function __construct(
ScopeConfigInterface $scopeConfig,
Logger $logger,
Basic $basic,
- array $data = []
+ array $data=[]
) {
parent::__construct(
$context,
@@ -109,15 +132,17 @@ public function __construct(
$data
);
- $this->_helperData = $helperData;
- $this->_helperImage = $helperImage;
+ $this->_helperData = $helperData;
+ $this->_helperImage = $helperImage;
$this->_checkoutSession = $checkoutSession;
$this->_customerSession = $customerSession;
- $this->_orderFactory = $orderFactory;
- $this->_urlBuilder = $urlBuilder;
- $this->_scopeConfig = $scopeConfig;
- $this->_basic = $basic;
- }
+ $this->_orderFactory = $orderFactory;
+ $this->_urlBuilder = $urlBuilder;
+ $this->_scopeConfig = $scopeConfig;
+ $this->_basic = $basic;
+
+ }//end __construct()
+
/**
* @return array
@@ -134,47 +159,53 @@ public function postPago()
$init_point = $payment['init_point'];
$array_assign = [
- "init_point" => $init_point,
- "status" => 201
+ 'init_point' => $init_point,
+ 'status' => 201,
];
- $this->_helperData->log("Array preference ok", 'mercadopago-basic.log');
+ $this->_helperData->log('Array preference ok', 'mercadopago-basic.log');
} else {
- $message = "Processing error in the payment gateway. Please contact the administrator.";
+ $message = 'Processing error in the payment gateway. Please contact the administrator.';
if ($response['status'] == 500) {
- $message = "Error on process of payment data. Please contact the administrator.";
+ $message = 'Error on process of payment data. Please contact the administrator.';
}
$array_assign = [
- "message" => __($message),
- "json" => json_encode($response),
- "status" => 400
+ 'message' => __($message),
+ 'json' => json_encode($response),
+ 'status' => 400,
];
$this->_helperData->log($message, 'mercadopago-basic.log');
- }
+ }//end if
+
return $array_assign;
} catch (Exception $e) {
- $this->_helperData->log('Fatal Error: Model Basic Payment PostPago:' . $e->getMessage(), 'mercadopago-basic.log');
+ $this->_helperData->log('Fatal Error: Model Basic Payment PostPago:'.$e->getMessage(), 'mercadopago-basic.log');
return [];
- }
- }
+ }//end try
+
+ }//end postPago()
+
/**
- * @param $params
- * @param $order
- * @param $shippingAddress
+ * @param $params
+ * @param $order
+ * @param $shippingAddress
* @return mixed
*/
protected function _getParamShipment($params, $order, $shippingAddress)
{
$paramsShipment = $params->getParams();
if (empty($paramsShipment)) {
- $paramsShipment = $params->getData();
- $paramsShipment['cost'] = (float)$order->getBaseShippingAmount();
+ $paramsShipment = $params->getData();
+ $paramsShipment['cost'] = (float) $order->getBaseShippingAmount();
$paramsShipment['mode'] = 'custom';
}
+
$paramsShipment['receiver_address'] = $this->getReceiverAddress($shippingAddress);
return $paramsShipment;
- }
+
+ }//end _getParamShipment()
+
/**
* @return string
@@ -182,25 +213,35 @@ protected function _getParamShipment($params, $order, $shippingAddress)
public function getActionUrl()
{
return $this->_urlBuilder->getUrl(self::ACTION_URL);
- }
+
+ }//end getActionUrl()
+
/**
- * @param CartInterface|null $quote
- * @return bool
+ * @param CartInterface|null $quote
+ * @return boolean
*/
- public function isAvailable(CartInterface $quote = null)
+ public function isAvailable(CartInterface $quote=null)
{
$isActive = $this->_scopeConfig->getValue(
\MercadoPago\Core\Helper\ConfigData::PATH_BASIC_ACTIVE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
+ if ($quote instanceof CartInterface
+ && $quote->getPayment()->getAdditionalInformation('purpose') === 'wallet_purchase'
+ ) {
+ return true;
+ }
+
if (empty($isActive)) {
return false;
}
return parent::isAvailable($quote);
- }
+
+ }//end isAvailable()
+
/**
* @return string
@@ -214,5 +255,8 @@ public function getOrderPlaceRedirectUrl()
$successUrl = $successPage ? 'mercadopago/checkout/page' : 'checkout/onepage/success';
return $this->_urlBuilder->getUrl($successUrl, ['_secure' => true]);
- }
-}
+
+ }//end getOrderPlaceRedirectUrl()
+
+
+}//end class
diff --git a/src/MercadoPago/Core/Model/CustomTicket/Payment.php b/src/MercadoPago/Core/Model/CustomTicket/Payment.php
index 9e667d6f..36935975 100644
--- a/src/MercadoPago/Core/Model/CustomTicket/Payment.php
+++ b/src/MercadoPago/Core/Model/CustomTicket/Payment.php
@@ -79,8 +79,8 @@ public function initialize($paymentAction, $stateObject)
$preference = $this->_coreModel->makeDefaultPreferencePaymentV1($payment_info, $quote, $order);
$payment_method = $payment->getAdditionalInformation("payment_method");
- $payment_method_id = str_contains($payment_method, '|') ? explode('|', $payment_method)[0] : $payment_method;
- $payment_option_id = str_contains($payment_method, '|') ? explode('|', $payment_method)[1] : '';
+ $payment_method_id = strpos($payment_method, '|') ? explode('|', $payment_method)[0] : $payment_method;
+ $payment_option_id = strpos($payment_method, '|') ? explode('|', $payment_method)[1] : '';
$preference['payment_method_id'] = $payment_method_id;
diff --git a/src/MercadoPago/Core/Model/Preference/Wallet.php b/src/MercadoPago/Core/Model/Preference/Wallet.php
index 80c9ad0e..b1b0dd9a 100644
--- a/src/MercadoPago/Core/Model/Preference/Wallet.php
+++ b/src/MercadoPago/Core/Model/Preference/Wallet.php
@@ -261,6 +261,7 @@ protected function createOrderByPaymentWithQuote($payment)
$quoteId = $payment['metadata']['quote_id'];
$quote = $this->quoteRepository->get($quoteId);
+ $quote->getPayment()->setAdditionalInformation('purpose', 'wallet_purchase');
$quote->getPayment()->importData(['method' => 'mercadopago_basic']);
$orderId = $this->quoteManagement->placeOrder($quote->getId());
diff --git a/src/MercadoPago/Core/Observer/ConfigObserver.php b/src/MercadoPago/Core/Observer/ConfigObserver.php
index d29d360d..6ffc96ba 100644
--- a/src/MercadoPago/Core/Observer/ConfigObserver.php
+++ b/src/MercadoPago/Core/Observer/ConfigObserver.php
@@ -18,6 +18,8 @@
* Class ConfigObserver
*
* @package MercadoPago\Core\Observer
+ *
+ * @codeCoverageIgnore
*/
class ConfigObserver implements ObserverInterface
{
@@ -47,16 +49,6 @@ class ConfigObserver implements ObserverInterface
]
];
- /**
- * @var array
- */
- private $available_transparent_credit_cart = ['MLA', 'MLB', 'MLM', 'MLV', 'MLC', 'MCO', 'MPE'];
-
- /**
- * @var array
- */
- private $available_transparent_ticket = ['MLA', 'MLB', 'MLM', 'MLV', 'MLC', 'MCO', 'MPE'];
-
/**
*
*/
@@ -138,35 +130,10 @@ public function execute(Observer $observer)
{
$this->validateAccessToken();
$this->setUserInfo();
- $this->availableCheckout();
$this->checkBanner('mercadopago_custom');
$this->checkBanner('mercadopago_customticket');
}
- /**
- * Disables custom checkout if selected country is not available
- */
- public function availableCheckout()
- {
- $country = $this->country;
-
- if ($country == "") {
- $country = $this->_scopeConfig->getValue(
- ConfigData::PATH_SITE_ID,
- ScopeInterface::SCOPE_WEBSITE,
- $this->_scopeCode
- );
- }
-
- if (!in_array(strtoupper($country), $this->available_transparent_credit_cart)) {
- $this->_saveWebsiteConfig(ConfigData::PATH_CUSTOM_ACTIVE, 0);
- }
-
- if (!in_array(strtoupper($country), $this->available_transparent_ticket)) {
- $this->_saveWebsiteConfig(ConfigData::PATH_CUSTOM_TICKET_ACTIVE, 0);
- }
- }
-
/**
* Check if banner checkout img needs to be updated based on selected country
*
diff --git a/src/MercadoPago/Core/composer.json b/src/MercadoPago/Core/composer.json
index 24729e0d..bc931c56 100644
--- a/src/MercadoPago/Core/composer.json
+++ b/src/MercadoPago/Core/composer.json
@@ -2,7 +2,7 @@
"name": "mercadopago/core",
"description": "Mercado Pago Magento 2 Plugin",
"type": "magento2-module",
- "version": "3.13.0",
+ "version": "3.14.0",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout.xml b/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout.xml
index 25fbb594..8c4ae4d9 100644
--- a/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout.xml
+++ b/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout.xml
@@ -1,6 +1,7 @@
+ MercadoPago\Core\Block\Adminhtml\System\Config\Fieldset\Payment
diff --git a/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout_ticket.xml b/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout_ticket.xml
index 95c80e7f..9a0d4562 100644
--- a/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout_ticket.xml
+++ b/src/MercadoPago/Core/etc/adminhtml/system/custom_checkout_ticket.xml
@@ -1,6 +1,7 @@
+ MercadoPago\Core\Block\Adminhtml\System\Config\Fieldset\Payment
diff --git a/src/MercadoPago/Core/etc/module.xml b/src/MercadoPago/Core/etc/module.xml
index cc136e4e..959339dc 100644
--- a/src/MercadoPago/Core/etc/module.xml
+++ b/src/MercadoPago/Core/etc/module.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/src/MercadoPago/Core/i18n/es_AR.csv b/src/MercadoPago/Core/i18n/es_AR.csv
index ebf28668..95c56652 100644
--- a/src/MercadoPago/Core/i18n/es_AR.csv
+++ b/src/MercadoPago/Core/i18n/es_AR.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilitar la cancelación automática de pagos en Mercado Pago cuando una orden es cancelada. El pago sólo será cancelado cuando el estado del pago sea pending o in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Tarjetas de Credito y Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Tarjetas de Credito y Débito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","Es necesario que tenga un certificado SSL y el formulario de entrega se proporcione dentro de una página HTTPS. Durante las pruebas de nivel de vida de Sandbox, se puede utilizar con HTTP, pero es la homologación que tendrá que adquirir el certificado en caso de que no lo tiene."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por defecto el módulo de Mercado Pago configurará un banner con los métodos disponibles de acuerdo a su país, si desea personalizarlo basta cambiar la url de la imagen."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferencia Bancaria - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferencia Bancaria"
"Enabled","Habilitado"
"Payment Title","Título del metodo de pago"
@@ -98,15 +100,20 @@
"Other Bank","Otro Banco"
"Choose","Elige"
"Payment Method","Métodos de Pago"
-"Credit card number","Numero de tarjeta"
+"Add your card details","Ingresa los datos de tu tarjeta"
+"Card number","Número de la tarjeta"
"Expiration month","Mes de Expiración"
"Expiration year","Año de Expiración"
+"Expiration date","Fecha de Vencimiento"
"Year","Año"
"Month","Mes"
-"Card holder name","Nombre del Titular"
+"Card holder full name","Nombre completo del titular de la tarjeta"
"Security code","Código de seguridad"
+"The last 3 digits in the back of the card","Los últimos 3 dígitos del reverso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número del documento"
"Issuer","Bancos"
"Installments","Cuotas"
"Your Card","Tarjetas guardadas"
@@ -119,6 +126,7 @@
"Parameter cardNumber can not be null/empty","Ingresa una numero de tarjeta válido"
"Invalid Expiration Date","Ingresa una fecha de expiración válida"
"Parameter cardholderName can not be null/empty","Ingresa un nombre válido"
+"Invalid card holder full name","Ingresa un nombre completo válido."
"Invalid Card Holder Name","Ingresa un nombre válido."
"Parameter securityCode can not be null/empty","Ingresa un código de seguridad válido"
"Parameter docType can not be null/empty","Ingresa un tipo de documento válido"
@@ -441,7 +449,7 @@
"Pay without having to enter more data, in", "Paga sin cargar más datos, de forma"
"instalments and securely.", "financiada y segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "O completa todos los datos de tu tarjeta:"
+"Or add your card details:", "O ingresa los datos de tu tarjeta:"
"Payment processed by Mercado Pago", "Pago procesado por Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Lo sentimos, no pudimos finalizar el pago con la billetera Mercado Pago"
"Sorry, we can't process the payment id not found", "Lo sentimos, no pudimos procesar el id de pago no encontrado"
diff --git a/src/MercadoPago/Core/i18n/es_CL.csv b/src/MercadoPago/Core/i18n/es_CL.csv
index ebf28668..95c56652 100644
--- a/src/MercadoPago/Core/i18n/es_CL.csv
+++ b/src/MercadoPago/Core/i18n/es_CL.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilitar la cancelación automática de pagos en Mercado Pago cuando una orden es cancelada. El pago sólo será cancelado cuando el estado del pago sea pending o in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Tarjetas de Credito y Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Tarjetas de Credito y Débito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","Es necesario que tenga un certificado SSL y el formulario de entrega se proporcione dentro de una página HTTPS. Durante las pruebas de nivel de vida de Sandbox, se puede utilizar con HTTP, pero es la homologación que tendrá que adquirir el certificado en caso de que no lo tiene."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por defecto el módulo de Mercado Pago configurará un banner con los métodos disponibles de acuerdo a su país, si desea personalizarlo basta cambiar la url de la imagen."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferencia Bancaria - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferencia Bancaria"
"Enabled","Habilitado"
"Payment Title","Título del metodo de pago"
@@ -98,15 +100,20 @@
"Other Bank","Otro Banco"
"Choose","Elige"
"Payment Method","Métodos de Pago"
-"Credit card number","Numero de tarjeta"
+"Add your card details","Ingresa los datos de tu tarjeta"
+"Card number","Número de la tarjeta"
"Expiration month","Mes de Expiración"
"Expiration year","Año de Expiración"
+"Expiration date","Fecha de Vencimiento"
"Year","Año"
"Month","Mes"
-"Card holder name","Nombre del Titular"
+"Card holder full name","Nombre completo del titular de la tarjeta"
"Security code","Código de seguridad"
+"The last 3 digits in the back of the card","Los últimos 3 dígitos del reverso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número del documento"
"Issuer","Bancos"
"Installments","Cuotas"
"Your Card","Tarjetas guardadas"
@@ -119,6 +126,7 @@
"Parameter cardNumber can not be null/empty","Ingresa una numero de tarjeta válido"
"Invalid Expiration Date","Ingresa una fecha de expiración válida"
"Parameter cardholderName can not be null/empty","Ingresa un nombre válido"
+"Invalid card holder full name","Ingresa un nombre completo válido."
"Invalid Card Holder Name","Ingresa un nombre válido."
"Parameter securityCode can not be null/empty","Ingresa un código de seguridad válido"
"Parameter docType can not be null/empty","Ingresa un tipo de documento válido"
@@ -441,7 +449,7 @@
"Pay without having to enter more data, in", "Paga sin cargar más datos, de forma"
"instalments and securely.", "financiada y segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "O completa todos los datos de tu tarjeta:"
+"Or add your card details:", "O ingresa los datos de tu tarjeta:"
"Payment processed by Mercado Pago", "Pago procesado por Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Lo sentimos, no pudimos finalizar el pago con la billetera Mercado Pago"
"Sorry, we can't process the payment id not found", "Lo sentimos, no pudimos procesar el id de pago no encontrado"
diff --git a/src/MercadoPago/Core/i18n/es_CO.csv b/src/MercadoPago/Core/i18n/es_CO.csv
index ebf28668..95c56652 100644
--- a/src/MercadoPago/Core/i18n/es_CO.csv
+++ b/src/MercadoPago/Core/i18n/es_CO.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilitar la cancelación automática de pagos en Mercado Pago cuando una orden es cancelada. El pago sólo será cancelado cuando el estado del pago sea pending o in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Tarjetas de Credito y Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Tarjetas de Credito y Débito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","Es necesario que tenga un certificado SSL y el formulario de entrega se proporcione dentro de una página HTTPS. Durante las pruebas de nivel de vida de Sandbox, se puede utilizar con HTTP, pero es la homologación que tendrá que adquirir el certificado en caso de que no lo tiene."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por defecto el módulo de Mercado Pago configurará un banner con los métodos disponibles de acuerdo a su país, si desea personalizarlo basta cambiar la url de la imagen."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferencia Bancaria - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferencia Bancaria"
"Enabled","Habilitado"
"Payment Title","Título del metodo de pago"
@@ -98,15 +100,20 @@
"Other Bank","Otro Banco"
"Choose","Elige"
"Payment Method","Métodos de Pago"
-"Credit card number","Numero de tarjeta"
+"Add your card details","Ingresa los datos de tu tarjeta"
+"Card number","Número de la tarjeta"
"Expiration month","Mes de Expiración"
"Expiration year","Año de Expiración"
+"Expiration date","Fecha de Vencimiento"
"Year","Año"
"Month","Mes"
-"Card holder name","Nombre del Titular"
+"Card holder full name","Nombre completo del titular de la tarjeta"
"Security code","Código de seguridad"
+"The last 3 digits in the back of the card","Los últimos 3 dígitos del reverso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número del documento"
"Issuer","Bancos"
"Installments","Cuotas"
"Your Card","Tarjetas guardadas"
@@ -119,6 +126,7 @@
"Parameter cardNumber can not be null/empty","Ingresa una numero de tarjeta válido"
"Invalid Expiration Date","Ingresa una fecha de expiración válida"
"Parameter cardholderName can not be null/empty","Ingresa un nombre válido"
+"Invalid card holder full name","Ingresa un nombre completo válido."
"Invalid Card Holder Name","Ingresa un nombre válido."
"Parameter securityCode can not be null/empty","Ingresa un código de seguridad válido"
"Parameter docType can not be null/empty","Ingresa un tipo de documento válido"
@@ -441,7 +449,7 @@
"Pay without having to enter more data, in", "Paga sin cargar más datos, de forma"
"instalments and securely.", "financiada y segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "O completa todos los datos de tu tarjeta:"
+"Or add your card details:", "O ingresa los datos de tu tarjeta:"
"Payment processed by Mercado Pago", "Pago procesado por Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Lo sentimos, no pudimos finalizar el pago con la billetera Mercado Pago"
"Sorry, we can't process the payment id not found", "Lo sentimos, no pudimos procesar el id de pago no encontrado"
diff --git a/src/MercadoPago/Core/i18n/es_MX.csv b/src/MercadoPago/Core/i18n/es_MX.csv
index ebf28668..95c56652 100644
--- a/src/MercadoPago/Core/i18n/es_MX.csv
+++ b/src/MercadoPago/Core/i18n/es_MX.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilitar la cancelación automática de pagos en Mercado Pago cuando una orden es cancelada. El pago sólo será cancelado cuando el estado del pago sea pending o in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Tarjetas de Credito y Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Tarjetas de Credito y Débito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","Es necesario que tenga un certificado SSL y el formulario de entrega se proporcione dentro de una página HTTPS. Durante las pruebas de nivel de vida de Sandbox, se puede utilizar con HTTP, pero es la homologación que tendrá que adquirir el certificado en caso de que no lo tiene."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por defecto el módulo de Mercado Pago configurará un banner con los métodos disponibles de acuerdo a su país, si desea personalizarlo basta cambiar la url de la imagen."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferencia Bancaria - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferencia Bancaria"
"Enabled","Habilitado"
"Payment Title","Título del metodo de pago"
@@ -98,15 +100,20 @@
"Other Bank","Otro Banco"
"Choose","Elige"
"Payment Method","Métodos de Pago"
-"Credit card number","Numero de tarjeta"
+"Add your card details","Ingresa los datos de tu tarjeta"
+"Card number","Número de la tarjeta"
"Expiration month","Mes de Expiración"
"Expiration year","Año de Expiración"
+"Expiration date","Fecha de Vencimiento"
"Year","Año"
"Month","Mes"
-"Card holder name","Nombre del Titular"
+"Card holder full name","Nombre completo del titular de la tarjeta"
"Security code","Código de seguridad"
+"The last 3 digits in the back of the card","Los últimos 3 dígitos del reverso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número del documento"
"Issuer","Bancos"
"Installments","Cuotas"
"Your Card","Tarjetas guardadas"
@@ -119,6 +126,7 @@
"Parameter cardNumber can not be null/empty","Ingresa una numero de tarjeta válido"
"Invalid Expiration Date","Ingresa una fecha de expiración válida"
"Parameter cardholderName can not be null/empty","Ingresa un nombre válido"
+"Invalid card holder full name","Ingresa un nombre completo válido."
"Invalid Card Holder Name","Ingresa un nombre válido."
"Parameter securityCode can not be null/empty","Ingresa un código de seguridad válido"
"Parameter docType can not be null/empty","Ingresa un tipo de documento válido"
@@ -441,7 +449,7 @@
"Pay without having to enter more data, in", "Paga sin cargar más datos, de forma"
"instalments and securely.", "financiada y segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "O completa todos los datos de tu tarjeta:"
+"Or add your card details:", "O ingresa los datos de tu tarjeta:"
"Payment processed by Mercado Pago", "Pago procesado por Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Lo sentimos, no pudimos finalizar el pago con la billetera Mercado Pago"
"Sorry, we can't process the payment id not found", "Lo sentimos, no pudimos procesar el id de pago no encontrado"
diff --git a/src/MercadoPago/Core/i18n/es_PE.csv b/src/MercadoPago/Core/i18n/es_PE.csv
index ebf28668..95c56652 100644
--- a/src/MercadoPago/Core/i18n/es_PE.csv
+++ b/src/MercadoPago/Core/i18n/es_PE.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilitar la cancelación automática de pagos en Mercado Pago cuando una orden es cancelada. El pago sólo será cancelado cuando el estado del pago sea pending o in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Tarjetas de Credito y Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Tarjetas de Credito y Débito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","Es necesario que tenga un certificado SSL y el formulario de entrega se proporcione dentro de una página HTTPS. Durante las pruebas de nivel de vida de Sandbox, se puede utilizar con HTTP, pero es la homologación que tendrá que adquirir el certificado en caso de que no lo tiene."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por defecto el módulo de Mercado Pago configurará un banner con los métodos disponibles de acuerdo a su país, si desea personalizarlo basta cambiar la url de la imagen."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferencia Bancaria - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferencia Bancaria"
"Enabled","Habilitado"
"Payment Title","Título del metodo de pago"
@@ -98,15 +100,20 @@
"Other Bank","Otro Banco"
"Choose","Elige"
"Payment Method","Métodos de Pago"
-"Credit card number","Numero de tarjeta"
+"Add your card details","Ingresa los datos de tu tarjeta"
+"Card number","Número de la tarjeta"
"Expiration month","Mes de Expiración"
"Expiration year","Año de Expiración"
+"Expiration date","Fecha de Vencimiento"
"Year","Año"
"Month","Mes"
-"Card holder name","Nombre del Titular"
+"Card holder full name","Nombre completo del titular de la tarjeta"
"Security code","Código de seguridad"
+"The last 3 digits in the back of the card","Los últimos 3 dígitos del reverso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número del documento"
"Issuer","Bancos"
"Installments","Cuotas"
"Your Card","Tarjetas guardadas"
@@ -119,6 +126,7 @@
"Parameter cardNumber can not be null/empty","Ingresa una numero de tarjeta válido"
"Invalid Expiration Date","Ingresa una fecha de expiración válida"
"Parameter cardholderName can not be null/empty","Ingresa un nombre válido"
+"Invalid card holder full name","Ingresa un nombre completo válido."
"Invalid Card Holder Name","Ingresa un nombre válido."
"Parameter securityCode can not be null/empty","Ingresa un código de seguridad válido"
"Parameter docType can not be null/empty","Ingresa un tipo de documento válido"
@@ -441,7 +449,7 @@
"Pay without having to enter more data, in", "Paga sin cargar más datos, de forma"
"instalments and securely.", "financiada y segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "O completa todos los datos de tu tarjeta:"
+"Or add your card details:", "O ingresa los datos de tu tarjeta:"
"Payment processed by Mercado Pago", "Pago procesado por Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Lo sentimos, no pudimos finalizar el pago con la billetera Mercado Pago"
"Sorry, we can't process the payment id not found", "Lo sentimos, no pudimos procesar el id de pago no encontrado"
diff --git a/src/MercadoPago/Core/i18n/es_UY.csv b/src/MercadoPago/Core/i18n/es_UY.csv
index ebf28668..95c56652 100644
--- a/src/MercadoPago/Core/i18n/es_UY.csv
+++ b/src/MercadoPago/Core/i18n/es_UY.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilitar la cancelación automática de pagos en Mercado Pago cuando una orden es cancelada. El pago sólo será cancelado cuando el estado del pago sea pending o in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Tarjetas de Credito y Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Tarjetas de Credito y Débito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","Es necesario que tenga un certificado SSL y el formulario de entrega se proporcione dentro de una página HTTPS. Durante las pruebas de nivel de vida de Sandbox, se puede utilizar con HTTP, pero es la homologación que tendrá que adquirir el certificado en caso de que no lo tiene."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por defecto el módulo de Mercado Pago configurará un banner con los métodos disponibles de acuerdo a su país, si desea personalizarlo basta cambiar la url de la imagen."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferencia Bancaria - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferencia Bancaria"
"Enabled","Habilitado"
"Payment Title","Título del metodo de pago"
@@ -98,15 +100,20 @@
"Other Bank","Otro Banco"
"Choose","Elige"
"Payment Method","Métodos de Pago"
-"Credit card number","Numero de tarjeta"
+"Add your card details","Ingresa los datos de tu tarjeta"
+"Card number","Número de la tarjeta"
"Expiration month","Mes de Expiración"
"Expiration year","Año de Expiración"
+"Expiration date","Fecha de Vencimiento"
"Year","Año"
"Month","Mes"
-"Card holder name","Nombre del Titular"
+"Card holder full name","Nombre completo del titular de la tarjeta"
"Security code","Código de seguridad"
+"The last 3 digits in the back of the card","Los últimos 3 dígitos del reverso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número del documento"
"Issuer","Bancos"
"Installments","Cuotas"
"Your Card","Tarjetas guardadas"
@@ -119,6 +126,7 @@
"Parameter cardNumber can not be null/empty","Ingresa una numero de tarjeta válido"
"Invalid Expiration Date","Ingresa una fecha de expiración válida"
"Parameter cardholderName can not be null/empty","Ingresa un nombre válido"
+"Invalid card holder full name","Ingresa un nombre completo válido."
"Invalid Card Holder Name","Ingresa un nombre válido."
"Parameter securityCode can not be null/empty","Ingresa un código de seguridad válido"
"Parameter docType can not be null/empty","Ingresa un tipo de documento válido"
@@ -441,7 +449,7 @@
"Pay without having to enter more data, in", "Paga sin cargar más datos, de forma"
"instalments and securely.", "financiada y segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "O completa todos los datos de tu tarjeta:"
+"Or add your card details:", "O ingresa los datos de tu tarjeta:"
"Payment processed by Mercado Pago", "Pago procesado por Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Lo sentimos, no pudimos finalizar el pago con la billetera Mercado Pago"
"Sorry, we can't process the payment id not found", "Lo sentimos, no pudimos procesar el id de pago no encontrado"
diff --git a/src/MercadoPago/Core/i18n/pt_BR.csv b/src/MercadoPago/Core/i18n/pt_BR.csv
index 5f3ebc2f..c67692d5 100644
--- a/src/MercadoPago/Core/i18n/pt_BR.csv
+++ b/src/MercadoPago/Core/i18n/pt_BR.csv
@@ -21,6 +21,7 @@
"Enable automatic cancellation of Payment in the Mercado Pago when an order is canceled. Payment is only canceled when payment is pending or in_process.","Habilita o cancelamento automatico de pagamentos no Mercado Pago quando a orden é cancelada. O pagamento só será cancelado quando o status do pagamento for pending ou in_process."
"==================== CUSTOM CHECKOUT CONFIGURATION PAGE =====================","================================================"
+"Credit and Debit Card - Mercado Pago","Cartão de Crédito e Débito - Mercado Pago"
"Custom Checkout - Credit and Debit Card","Custom Checkout - Cartão de Crédito"
"Enabled","Habilitado"
"It is a requirement that you have a SSL certificate, and the payment form to be provided under an HTTPS page. During the sandbox mode tests, you can operate over HTTP, but for homologation you'll need to acquire the certificate in case you don't have it.","É um requisito que tenha um certificado SSL e que o formulário de pagamentos esteja sobre uma página HTTPS. Durante os testes em modo sandbox o ambiente poderá ser HTTP, mas para a homologação, deverá adquirir o certificado."
@@ -52,6 +53,7 @@
"By default the module of Mercado Pago will configure a banner with the methods available according to your country, in case you want to customize it simply change the url of the image.","Por padrão, o módulo do Mercado Pago irá configurar um banner com os métodos disponíveis de acordo com o seu país, se você quiser personalizá-lo, basta alterar o URL da imagem."
"==================== v3.1.0 CUSTOM CHECKOUT BANK TRANSFER PAGE =====================","================================================"
+"Bank Transfer - Mercado Pago","Transferência Bancária - Mercado Pago"
"Custom Checkout - Bank Transfer","Custom Checkout - Transferência Bancária"
"Enabled","Habilitado"
"Payment Title","Titulo do Método de Pagamento"
@@ -103,15 +105,20 @@
"Other Bank","Outro Banco"
"Choose","Escolha"
"Payment Method","Métodos de Pagamento"
-"Credit card number","Número do Cartão"
+"Add your card details","Insira os dados do seu cartão"
+"Card number","Número do cartão"
"Expiration month","Mês de Expiração"
"Expiration year","Ano de Expiração"
+"Expiration date","Data de Vencimento"
"Year","Ano"
"Month","Mês"
-"Card holder name","Nome do Titular"
+"Card holder full name","Nome completo do titular do cartão"
"Security code","Código de Segurança"
+"The last 3 digits in the back of the card","Os últimos 3 dígitos no verso"
"Document Type","Tipo"
+"ID","Documento"
"Document number","Documento"
+"Number of the payer ID","Número do documento"
"Issuer","Bancos"
"Installments","Parcelas"
"Your Card","Cartões Salvos"
@@ -124,6 +131,7 @@
"Parameter cardNumber can not be null/empty","Numero do cartão de crédito inválido"
"Invalid Expiration Date","Data de expiração inválida"
"Parameter cardholderName can not be null/empty","Titular do cartão inválido"
+"Invalid card holder full name","Insira um nome completo válido."
"Invalid Card Holder Name","Titular do cartão inválido"
"Parameter securityCode can not be null/empty","Código de segurança inválido"
"Parameter docType can not be null/empty","Tipo de documento inválido"
@@ -427,7 +435,7 @@ Cannot operate between users from different countries.", "Não é possível oper
"Pay without having to enter more data, in", "Pague sem precisar adicionar mais dados,"
"instalments and securely.", "de forma parcelada e segura."
"Pay with Mercado Pago", "Pagar com Mercado Pago"
-"Or enter all your card details:", "Ou preencha todos os dados do seu cartão:"
+"Or add your card details:", "Ou insira os dados do seu cartão:"
"Payment processed by Mercado Pago", "Pagamento processado pelo Mercado Pago"
"Sorry, we can't finish Mercado Pago Wallet Payment", "Desculpa, não conseguimos finalizar o pagamento com a carteira Mercado Pago"
"Sorry, we can't process the payment id not found", "Desculpa, não conseguimos processar o id do pagamento não foi encontrado"
diff --git a/src/MercadoPago/Core/view/frontend/web/css/MPv1.css b/src/MercadoPago/Core/view/frontend/web/css/MPv1.css
index 5d596164..aa0db56b 100644
--- a/src/MercadoPago/Core/view/frontend/web/css/MPv1.css
+++ b/src/MercadoPago/Core/view/frontend/web/css/MPv1.css
@@ -94,6 +94,14 @@
margin: 5px 0;
}
+.mp-margin-top-0 {
+ margin-top: 0;
+}
+
+.mp-margin-bottom-0 {
+ margin-bottom: 0;
+}
+
.mp-box-inputs label {
text-transform: uppercase;
font-size: 11px;
@@ -102,6 +110,14 @@
display: block;
}
+.mp-box-inputs small {
+ font-size: 11px;
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ margin: 0;
+ display: block;
+ color: rgba(0, 0, 0, 0.55);
+}
+
.mp-box-inputs label em {
color: red;
}
diff --git a/src/MercadoPago/Core/view/frontend/web/js/CreditCard.js b/src/MercadoPago/Core/view/frontend/web/js/CreditCard.js
index e5e4f9ac..0c0003ea 100644
--- a/src/MercadoPago/Core/view/frontend/web/js/CreditCard.js
+++ b/src/MercadoPago/Core/view/frontend/web/js/CreditCard.js
@@ -13,6 +13,17 @@
}
});
}
+
+ window.setChangeEventExpirationDate = function () {
+ document.getElementById('mpCardExpirationDate').addEventListener('change', function (e) {
+ var card_expiration_date = document.getElementById('mpCardExpirationDate').value;
+ var card_expiration_month = card_expiration_date.split('/')[0] | '';
+ var card_expiration_year = card_expiration_date.split('/')[1] | '';
+
+ document.getElementById('mpCardExpirationMonth').value = ('0' + card_expiration_month).slice(-2);
+ document.getElementById('mpCardExpirationYear').value = card_expiration_year;
+ });
+ }
window.setChangeEventOnInstallments = function (siteId, payer_costs) {
if (siteId === 'MLA') {
@@ -75,7 +86,9 @@
document.getElementById('mp-doc-number-div').style.display = 'none';
}
- if (!additionalInfoNeeded.cardholder_identification_type && !additionalInfoNeeded.cardholder_identification_number) {
+ if (additionalInfoNeeded.cardholder_identification_type && additionalInfoNeeded.cardholder_identification_number) {
+ document.getElementById('mp-doc-div').style.display = 'block';
+ } else {
document.getElementById('mp-doc-div').style.display = 'none';
}
}
@@ -83,10 +96,7 @@
window.clearInputs = function () {
hideErrors();
document.getElementById('mpCardNumber').style.background = 'no-repeat #fff';
- document.getElementById('mpCardExpirationMonth').value = '';
- document.getElementById('mpCardExpirationMonthSelect').value = '';
- document.getElementById('mpCardExpirationYear').value = '';
- document.getElementById('mpCardExpirationYearSelect').value = '';
+ document.getElementById('mpCardExpirationDate').value = '';
document.getElementById('mpDocNumber').value = '';
document.getElementById('mpSecurityCode').value = '';
document.getElementById('mpCardholderName').value = '';
@@ -98,8 +108,7 @@
var formInputs = form.querySelectorAll('[data-checkout]');
var fixedInputs = [
'mpCardNumber',
- 'mpCardExpirationMonthSelect',
- 'mpCardExpirationYearSelect',
+ 'mpCardExpirationDate',
'mpSecurityCode',
'mpInstallments'
];
@@ -176,13 +185,7 @@
if (span !== undefined) {
span.style.display = 'block';
-
- if (code === '301') {
- form.querySelector('#mpCardExpirationYearSelect').classList.add('mp-form-control-error');
- form.querySelector('#mpCardExpirationMonthSelect').classList.add('mp-form-control-error');
- } else {
- form.querySelector(span.getAttribute('data-main')).classList.add('mp-form-control-error');
- }
+ form.querySelector(span.getAttribute('data-main')).classList.add('mp-form-control-error');
}
}
@@ -208,6 +211,14 @@
}
}
+ window.handleInstallments = function (payment_type_id) {
+ if (payment_type_id === 'debit_card') {
+ document.getElementById('mpInstallments').setAttribute("disabled","disabled");
+ } else {
+ document.getElementById('mpInstallments').removeAttribute("disabled");
+ }
+ }
+
/**
* Show taxes resolution 51/2017 for MLA
*/
diff --git a/src/MercadoPago/Core/view/frontend/web/js/view/method-renderer/custom-method.js b/src/MercadoPago/Core/view/frontend/web/js/view/method-renderer/custom-method.js
index 336a7848..bb5f754c 100644
--- a/src/MercadoPago/Core/view/frontend/web/js/view/method-renderer/custom-method.js
+++ b/src/MercadoPago/Core/view/frontend/web/js/view/method-renderer/custom-method.js
@@ -51,6 +51,7 @@ define(
initApp: function () {
if (window.checkoutConfig.payment[this.getCode()] !== undefined) {
setChangeEventOnCardNumber();
+ setChangeEventExpirationDate();
// Initialize SDK v2
mp = new MercadoPago(this.getPublicKey());
@@ -79,9 +80,6 @@ define(
onIdentificationTypesReceived: (error, identificationTypes) => {
if (error) return console.warn('IdentificationTypes handling error: ', error);
},
- onIssuersReceived: (error, issuers) => {
- if (error) return console.warn('Issuers handling error: ', error);
- },
onInstallmentsReceived: (error, installments) => {
if (error) {
return console.warn('Installments handling error: ', error)
@@ -106,6 +104,7 @@ define(
clearInputs();
setImageCard(paymentMethods[0].thumbnail);
+ handleInstallments(paymentMethods[0].payment_type_id);
loadAdditionalInfo(paymentMethods[0].additional_info_needed);
additionalInfoHandler();
},
@@ -114,20 +113,6 @@ define(
}
},
- changeMonthInput: function () {
- var monthInput = document.getElementById("mpCardExpirationMonth");
- var monthSelect = document.getElementById("mpCardExpirationMonthSelect");
-
- monthInput.value = ('0' + monthSelect.value).slice(-2);
- },
-
- changeYearInput: function () {
- var yearInput = document.getElementById("mpCardExpirationYear");
- var yearSelect = document.getElementById("mpCardExpirationYearSelect");
-
- yearInput.value = yearSelect.value;
- },
-
toogleWalletButton: function () {
var existsScriptTag = document.querySelector('#wallet_purchase');
var existsSubmit = document.querySelector('.mercadopago-button');
@@ -355,7 +340,6 @@ define(
'site_id': this.getCountry(),
'token': formData.token,
'payment_method_id': formData.paymentMethodId,
- 'issuer_id': formData.issuerId,
'gateway_mode': this.getMpGatewayMode(),
}
};
diff --git a/src/MercadoPago/Core/view/frontend/web/template/payment/custom_method.html b/src/MercadoPago/Core/view/frontend/web/template/payment/custom_method.html
index c8d75bac..5384a80a 100644
--- a/src/MercadoPago/Core/view/frontend/web/template/payment/custom_method.html
+++ b/src/MercadoPago/Core/view/frontend/web/template/payment/custom_method.html
@@ -81,14 +81,19 @@
>