From 93d60b04f46dc7705151e7e91357ecd96a3bc4b6 Mon Sep 17 00:00:00 2001 From: Luiz Fernando Rodrigues Tucillo Date: Fri, 19 Jan 2024 15:50:15 -0300 Subject: [PATCH] Release 1.6.1 --- CHANGELOG.md | 4 ++++ .../Request/AdditionalInfoPayerDataRequest.php | 16 ++++++++-------- .../DocumentIdentificationDataRequest.php | 2 +- composer.json | 2 +- composer.lock | 2 +- etc/module.xml | 2 +- view/frontend/web/js/view/payment/mp-sdk.js | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1778f2..e669122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ 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). +## [1.6.1] - 2024-01-15 +### Fixed +- Regular expression adjustment to accept alphanumeric in RUT type document. + ## [1.6.0] - 2024-01-03 ### Added - Added plugin version + site id information on admin diff --git a/Gateway/Request/AdditionalInfoPayerDataRequest.php b/Gateway/Request/AdditionalInfoPayerDataRequest.php index 46ec66e..81f20a6 100644 --- a/Gateway/Request/AdditionalInfoPayerDataRequest.php +++ b/Gateway/Request/AdditionalInfoPayerDataRequest.php @@ -247,10 +247,10 @@ public function build(array $buildSubject): array ); $typeDocument = $payment->getAdditionalInformation('payer_document_type'); - + $docIdentification = $this->documentIdentification->getFiscalNumber($payment, $orderAdapter); if ($docIdentification) { - $docIdentification = preg_replace('/[^0-9]/', '', $docIdentification); + $docIdentification = preg_replace('/[^0-9A-Za-z]/', '', $docIdentification); } $billingAddress = $orderAdapter->getBillingAddress(); @@ -262,12 +262,12 @@ public function build(array $buildSubject): array if ($customerId) { // Load customer model by customer ID $customer = $this->customerFactory->create()->load($customerId); - + $registrationDate = $customer->getCreatedAt(); // Get last order of the customer $lastOrder = $customer->getLastOrder(); - + if ($lastOrder) { // Get last order's creation date $lastPurchaseDate = $lastOrder->getCreatedAt(); @@ -295,8 +295,8 @@ public function build(array $buildSubject): array self::LAST_NAME => $payerLastName, self::REGISTRATION_DATE => $registrationDate, self::REGISTERED_USER => $customerId ? true : false, - self::DEVICE_ID => null, - self::PLATFORM_EMAIL => $platform_email, + self::DEVICE_ID => null, + self::PLATFORM_EMAIL => $platform_email, self::REGISTER_UPDATED_AT => null, self::USER_EMAIL => $user_email, self::AUTHENTICATION_TYPE => null, @@ -328,8 +328,8 @@ public function build(array $buildSubject): array ]; $result[AdditionalInfoDataRequest::ADDITIONAL_INFO][self::PAYER][self::MOBILE] = [ - self::PHONE_AREA_CODE => $phoneAreaCode, - self::PHONE_NUMBER => $phoneNumber, + self::PHONE_AREA_CODE => $phoneAreaCode, + self::PHONE_NUMBER => $phoneNumber, ]; $result[AdditionalInfoDataRequest::ADDITIONAL_INFO][self::PAYER][self::IDENTIFICATION] = [ diff --git a/Gateway/Request/DocumentIdentificationDataRequest.php b/Gateway/Request/DocumentIdentificationDataRequest.php index a193cce..fed4d2b 100644 --- a/Gateway/Request/DocumentIdentificationDataRequest.php +++ b/Gateway/Request/DocumentIdentificationDataRequest.php @@ -112,7 +112,7 @@ public function build(array $buildSubject) $docIdentification = $this->getFiscalNumber($payment, $orderAdapter); if ($docIdentification) { - $docIdentification = preg_replace('/[^0-9]/', '', $docIdentification); + $docIdentification = preg_replace('/[^0-9A-Za-z]/', '', $docIdentification); } if ($typeDocument) { diff --git a/composer.json b/composer.json index 42bd11c..fcdfae0 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mercadopago/adb-payment", "description": "MercadoPago - Payment for Adobe Commerce", - "version": "1.6.0", + "version": "1.6.1", "require": { "php": "~7.3.0||~7.4.0||~8.1.0||~8.2.0", "ext-json": "*", diff --git a/composer.lock b/composer.lock index b382f73..dbf0399 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": "e59bd40eb51564e624423a143a4a8f17", + "content-hash": "2a0a6fe254e95eecedfd567004ef52db", "packages": [ { "name": "mp-plugins/php-sdk", diff --git a/etc/module.xml b/etc/module.xml index b171233..72c8f42 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -8,7 +8,7 @@ */ --> - + diff --git a/view/frontend/web/js/view/payment/mp-sdk.js b/view/frontend/web/js/view/payment/mp-sdk.js index 4804d5d..cdce63f 100644 --- a/view/frontend/web/js/view/payment/mp-sdk.js +++ b/view/frontend/web/js/view/payment/mp-sdk.js @@ -273,7 +273,7 @@ define([ } if (self.mpPayerDocument()) { - self.mpPayerDocument(self.mpPayerDocument().replace(/\D/g, '')); + self.mpPayerDocument(self.mpPayerDocument().replace(/\W/g, '')); } fullScreenLoader.startLoader();