Skip to content

Commit

Permalink
Merge pull request #16 from mercadopago/release/1.8.1
Browse files Browse the repository at this point in the history
Release 1.8.1
  • Loading branch information
mlafernandes authored Apr 25, 2024
2 parents cf185e6 + 644a987 commit 898d643
Show file tree
Hide file tree
Showing 83 changed files with 240 additions and 225 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
## 🔀 PRs relacionados
> - #123
> - #321
-->
-->
4 changes: 2 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Run Unit Test
id: unit-test
run:
run:
XDEBUG_MODE=coverage magento2/vendor/phpunit/phpunit/phpunit \
--configuration magento2/app/code/MercadoPago/AdbPayment/phpunit.xml \
--coverage-html coverage/ \
Expand All @@ -74,7 +74,7 @@ jobs:
- id: pr-files-list
name: Get Pull Request Files
uses: ruslandulina/[email protected]

- id: save-modified-pr-files-list
name: Save modified PR Files List to a file
run: echo "${{join(steps.pr-files-list.outputs.modified, ' ')}}" > modified-files-list.txt
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ vendor
.phpunit.result.cache
testdoc.txt
.idea
coverage/
coverage/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-added-large-files
4 changes: 2 additions & 2 deletions Api/Data/QuoteMpPaymentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getPaymentId();
* @return $this
*/
public function setPaymentId($paymentId);

/**
* Get 3DS External Resource URL
*
Expand Down Expand Up @@ -110,4 +110,4 @@ public function getThreeDsCreq();
* @return $this
*/
public function setThreeDsCreq($threeDsCreq);
}
}
2 changes: 1 addition & 1 deletion Api/PaymentStatusManagementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface PaymentStatusManagementInterface
*
* @param string $paymentId
* @param string $cartId
*
*
* @return mixed
*/
public function getPaymentStatus(
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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.8.1] - 2024-04-25
### Fixed
- Fix added existing value validation for the financial_institution field
- Update anotations references
- Add php version 8.3.0 in compose.json

## [1.8.0] - 2024-04-09
### Fixed
- Adjust 3ds modal sizing to be compliant with documentation
Expand Down
4 changes: 2 additions & 2 deletions Controller/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private function validateThreeDsResponse($response)
if($this->getMessage($response) === '3DS')
if ($response->getHeader('errorRedirectAction'))
$response->setHeader('errorRedirectAction', '', true);

return $response;
}

Expand All @@ -50,4 +50,4 @@ private function getMessage($response)

return $message;
}
}
}
2 changes: 1 addition & 1 deletion Gateway/Config/ConfigCheckoutCredits.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
/**
* @param String $textId
* @param String $storeId
*
*
* @return String
*/
public function getBannerText($textId, $storeId = null): string
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Http/Client/CreateOrderPaymentCustomClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,4 @@ public function placeRequest(TransferInterface $transferObject)

return $response;
}
}
}
14 changes: 7 additions & 7 deletions Gateway/Request/AdditionalInfoPayerDataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function build(array $buildSubject): array
);

$typeDocument = $payment->getAdditionalInformation('payer_document_type');

$docIdentification = $this->documentIdentification->getFiscalNumber($payment, $orderAdapter);
if ($docIdentification) {
$docIdentification = preg_replace('/[^0-9A-Za-z]/', '', $docIdentification);
Expand All @@ -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();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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] = [
Expand Down
14 changes: 7 additions & 7 deletions Gateway/Response/FetchPaymentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FetchPaymentHandler implements HandlerInterface
* Response Pay Status Refunded - Value.
*/
public const RESPONSE_STATUS_REFUNDED = 'refunded';

/**
* Response Pay Status Cancelled - Value.
*/
Expand All @@ -112,7 +112,7 @@ class FetchPaymentHandler implements HandlerInterface
* Response Payment Details - Value.
*/
public const PAYMENT_DETAILS = 'payments_details';

/**
* Response Total Amount - Value.
*/
Expand Down Expand Up @@ -147,7 +147,7 @@ class FetchPaymentHandler implements HandlerInterface
* Payment Installments - Payment Addtional Information.
*/
public const PAYMENT_INSTALLMENTS = 'payment_%_installments';

/**
* Payment Total Amount - Payment Addtional Information.
*/
Expand Down Expand Up @@ -291,13 +291,13 @@ private function createInvoice($order, $payment, $paidAmount)
* Get index of payment by payment id.
* @param $payment
* @param $paymentId
*
*
* @return int|null
*/
public function getIndexPayment(
$payment,
$paymentId
) {
) {
$i = 0;
while ($i < 2) {
if($payment->getAdditionalInformation(str_replace('%', $i, self::PAYMENT_ID)) == $paymentId){
Expand All @@ -313,7 +313,7 @@ public function getIndexPayment(
* @param $payment
* @param $index
* @param $mpPayment
*
*
* Return void.
*/
public function updatePaymentByIndex(
Expand Down Expand Up @@ -346,7 +346,7 @@ public function updatePaymentByIndex(
$cardTotalAmount,
$mpPayment[self::TOTAL_AMOUNT]
);

$payment->setAdditionalInformation(
$cardPaidAmount,
$mpPayment[self::PAID_AMOUNT]
Expand Down
10 changes: 6 additions & 4 deletions Gateway/Response/TxnIdBankTransferHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ public function setAddtionalInformation($payment, $response)

$transactionDetails = $response[self::TRANSACTION_DETAILS];

$payment->setAdditionalInformation(
self::FINANCIAL_INSTITUTION,
$transactionDetails[self::FINANCIAL_INSTITUTION]
);
if(isset($transactionDetails[self::FINANCIAL_INSTITUTION])){
$payment->setAdditionalInformation(
self::FINANCIAL_INSTITUTION,
$transactionDetails[self::FINANCIAL_INSTITUTION]
);
}

$payment->setAdditionalInformation(
self::EXTERNAL_RESOURCE_URL,
Expand Down
10 changes: 6 additions & 4 deletions Gateway/Response/TxnIdPaymentMethodsOffHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ public function setAddtionalInformation($payment, $response)

$transactionDetails = $response[self::TRANSACTION_DETAILS];

$payment->setAdditionalInformation(
self::FINANCIAL_INSTITUTION,
$transactionDetails[self::FINANCIAL_INSTITUTION]
);
if(isset($transactionDetails[self::FINANCIAL_INSTITUTION])){
$payment->setAdditionalInformation(
self::FINANCIAL_INSTITUTION,
$transactionDetails[self::FINANCIAL_INSTITUTION]
);
}

$payment->setAdditionalInformation(
self::EXTERNAL_RESOURCE_URL,
Expand Down
14 changes: 7 additions & 7 deletions Model/Console/Command/Adminstrative/FetchMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ class FetchMerchant extends AbstractModel
* Message error invalid credential.
*/
public const INVALID_CREDENTIAL = 'Your credentials are incorrect. Please double-check in your account your credentials are correct.';

/**
* Message error invalid credential to sendbox mode.
*/
public const INVALID_SANDBOX_MODE = 'Your credentials are incorrect. Production credentials have been filled in and should be used in production mode. Please check the credentials again.';

/**
* Message error invalid credential to production mode.
*/
public const INVALID_PRODUCTION_MODE = 'Your credentials are incorrect. Test credentials have been filled in and should be used in sandbox mode. Please check the credentials again.';

/**
* Enviroment production.
*/
Expand Down Expand Up @@ -263,7 +263,7 @@ public function hasValidationStatusToken(
if ($environment === self::ENVIRONMENT_PRODUCTION) {
$messageError = $this->verifyProductionMode($token, $publicKey);
}

if ($environment === self::ENVIRONMENT_SANDBOX) {
$messageError = $this->verifySandBoxMode($token, $publicKey);
}
Expand Down Expand Up @@ -306,7 +306,7 @@ public function verifyProductionMode($token, $publicKey)
if($token['response']['is_test']) {
return self::INVALID_PRODUCTION_MODE;
}

if($publicKey['response']['is_test']) {
return self::INVALID_PRODUCTION_MODE;
}
Expand Down Expand Up @@ -471,7 +471,7 @@ public function saveData(
bool $storeIdIsDefault,
string $scope = ScopeInterface::SCOPE_WEBSITES,
int $scopeId = 0

): array {
$environment = $this->mercadopagoConfig->getEnvironmentMode($scopeId, $scope);

Expand Down Expand Up @@ -520,7 +520,7 @@ public function clearData(
int $scopeId = 0
): array {
$environment = $this->mercadopagoConfig->getEnvironmentMode($scopeId, $scope);

$data = ['client_id' => null, 'client_secret' => null];

foreach ($data as $field => $value) {
Expand Down
6 changes: 3 additions & 3 deletions Model/Console/Command/Notification/FetchStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class FetchStatus extends AbstractModel
protected $logger;

/**
* @var OrderRepository
* @var OrderRepositoryInterface
*/
protected $orderRepository;

/**
* @param Logger $logger
* @param Order $order
* @param OrderRepositoryInterface $orderRepository
*/
public function __construct(
Logger $logger,
Expand Down Expand Up @@ -62,7 +62,7 @@ public function fetch($orderId, $notificationId = null)
if( isset($notificationId)){
$additionalData = (array('notificationId' => $notificationId));
$additionalData = (object)$additionalData;

$payment->setAdditionalData(json_encode($additionalData));
}

Expand Down
6 changes: 3 additions & 3 deletions Model/Notification/Refund/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function process(): array
];
continue;
}

if ($this->hasBeenRefunded($refundData)) {
unset($this->refundsData[$k]);
$results[] = [
Expand Down Expand Up @@ -196,7 +196,7 @@ private function refund(RefundData $refundData): array
$creditMemo->setBaseGrandTotal($refundData->getAmount());
$creditMemo->setGrandTotal($refundData->getAmount());
$creditMemo->addComment(__('Order refunded in Mercado Pago, refunded offline in the store.'));

$this->creditmemoService->refund($creditMemo, false);
$this->order->addCommentToStatusHistory(__('Order refunded.'));

Expand All @@ -212,7 +212,7 @@ private function refund(RefundData $refundData): array
} catch (\Exception $e) {
$this->logger->debug([
'refund_Id' => $refundData->getId(),
'exception' => $e->getMessage(),
'exception' => $e->getMessage(),
'stack' => $e->getTraceAsString()
]);
return [
Expand Down
2 changes: 1 addition & 1 deletion Model/Order/UpdatePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public function updateInformation(Order $order, array $mpNotification) {
$order->setPayment($payment);
$order->save();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ public function getMpListStatus();
*/
public function getAdobeOrderStatus();

}
}
4 changes: 2 additions & 2 deletions Model/Order/ValidateUpdateStatus/ValidateCancelledStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Magento\Sales\Model\Order;

class ValidateCancelledStatus extends ValidateOrderStatus {

/**
* MP Status list
*/
private array $cancelledCanUpdateStatus = [self::MP_STATUS_CANCELLED];

public function getMpListStatus(){
return $this->cancelledCanUpdateStatus;
}
Expand Down
Loading

0 comments on commit 898d643

Please sign in to comment.