Skip to content

Commit

Permalink
v1.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsantosd committed Mar 7, 2024
1 parent ec27fff commit 43e8494
Show file tree
Hide file tree
Showing 12 changed files with 232 additions and 153 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## [1.6.3] - 2024-03-07
### Changed
- Adjusting Iframe creation with 3Ds.
- PSJ/PCJ adequacy in online payment.
- Adding the checkout_type of type two_cards to the metadata

### Fixed
- Adding a translation fix in FetchPaymentHandler

## [1.6.2] - 2024-01-29
### Changed
- Get document types from payment methods to PSE.
Expand Down
56 changes: 56 additions & 0 deletions Gateway/Request/MetadataTwoCcPaymentDataRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Copyright © MercadoPago. All rights reserved.
*
* @author Mercado Pago
* @license See LICENSE for license details.
*/

namespace MercadoPago\AdbPayment\Gateway\Request;

use InvalidArgumentException;
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
use Magento\Payment\Gateway\Request\BuilderInterface;

/**
* Gateway requests for Payment Metadata by Two Cards.
*/
class MetadataTwoCcPaymentDataRequest implements BuilderInterface
{
/**
* Checkout block name.
*/
public const CHECKOUT = 'checkout';

/**
* Checkout Type block name.
*/
public const CHECKOUT_TYPE = 'checkout_type';

/**
* Build.
*
* @param array $buildSubject
*/
public function build(array $buildSubject)
{
if (!isset($buildSubject['payment'])
|| !$buildSubject['payment'] instanceof PaymentDataObjectInterface
) {
throw new InvalidArgumentException('Payment data object should be provided');
}
$result = [];

$result[MetadataPaymentDataRequest::METADATA] = [
self::CHECKOUT => 'custom',
self::CHECKOUT_TYPE => 'two_cards',
];

$result[MetadataPaymentDataRequest::METADATA][MetadataPaymentDataRequest::CPP_EXTRA] = [
self::CHECKOUT => 'custom',
self::CHECKOUT_TYPE => 'two_cards',
];

return $result;
}
}
16 changes: 8 additions & 8 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 @@ -280,7 +280,7 @@ private function createInvoice($order, $payment, $paidAmount)
$invoice->setSubtotal($paidAmount);
$invoice->setBaseSubtotal($paidAmount);

$invoice->addComment(_('Captured by collector from Mercado Pago API'));
$invoice->addComment(__('Captured by collector from Mercado Pago API'));

$order->addRelatedObject($invoice);
$payment->setCreatedInvoice($invoice);
Expand All @@ -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
2 changes: 1 addition & 1 deletion bin/install-mg2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mv magento2-2.4.5-p1 magento2
cd magento2

echo "Installing..."
composer require mp-plugins/php-sdk
composer require mp-plugins/php-sdk:1.12.0
composer update
composer install

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "mercadopago/adb-payment",
"description": "MercadoPago - Payment for Adobe Commerce",
"version": "1.6.2",
"version": "1.6.3",
"require": {
"php": "~7.3.0||~7.4.0||~8.1.0||~8.2.0",
"ext-json": "*",
"ext-gd": "*",
"ext-zip": "*",
"mp-plugins/php-sdk": "~1.7"
"mp-plugins/php-sdk": "1.12.*"
},
"type": "magento2-module",
"authors": [
Expand Down
Loading

0 comments on commit 43e8494

Please sign in to comment.