Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsantosd committed Sep 11, 2023
1 parent f6f38b6 commit 092d234
Show file tree
Hide file tree
Showing 46 changed files with 149 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/magento-coding-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: PHP Coding Standard Magento2
run: docker run --rm -v $PWD:/code:ro domw/phpcs phpcs --colors --standard=Magento2 --error-severity=1 -n ./
run: docker run --rm -v $PWD:/code:ro domw/phpcs phpcs --colors --standard=Magento2 --error-severity=1 -n ./
7 changes: 5 additions & 2 deletions .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: composer

- name: Verify PHP Installation
run: php -v

Expand All @@ -24,3 +24,6 @@ jobs:

- name: Validate Version
run: bash bin/validate-version.sh



2 changes: 1 addition & 1 deletion Block/Adminhtml/System/Config/GroupRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
if (!$this->configProviderCheckoutCredits->isActive()) {
return '';
return '';
}
return parent::render($element);
}
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.4.2] - 2023-09-11
### Fixed
- Adjust installments and finance cost calculation when applying the coupon
- Fixed two card flow


## [1.4.1] - 2023-07-18
### Added
- Added support for PHP 8.2 in composer
Expand Down
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/Request/AdditionalInfoDataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function build(array $buildSubject)
self::REFERRAL_URL => null,
self::DROP_SHIPPING => null,
self::DELIVERY_PROMISE => null,
self::CONTRATED_PLAN => null
self::CONTRATED_PLAN => null
];

return $result;
Expand Down
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-9]/', '', $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
2 changes: 1 addition & 1 deletion Gateway/Request/AdditionalInfoSellerDataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class AdditionalInfoSellerDataRequest implements BuilderInterface
* Country block name.
*/
public const COUNTRY = 'country';

/**
* State block name.
*/
Expand Down
6 changes: 3 additions & 3 deletions Gateway/Request/AdditionalInfoShippingsDataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ public function build(array $buildSubject): array
if ($shippingAddress) {

$result[AdditionalInfoDataRequest::ADDITIONAL_INFO][self::SHIPMENTS] = [
self::DELIVERY_PROMISE => null,
self::DELIVERY_PROMISE => null,
self::DROP_SHIPPING => null,
self::LOCAL_PICKUP => null,
self::EXPRESS_SHIPMENT => null,
self::SAFETY => null,
self::WITHDRAWN => null,
];

$result[AdditionalInfoDataRequest::ADDITIONAL_INFO][self::SHIPMENTS][self::RECEIVER_ADDRESS] = [
self::ZIP_CODE => preg_replace('/[^0-9]/', '', $shippingAddress->getPostcode()),
self::STREET_NAME => $this->config->getValueForAddress(
Expand All @@ -244,7 +244,7 @@ public function build(array $buildSubject): array

$result[AdditionalInfoDataRequest::ADDITIONAL_INFO][self::SHIPMENTS][self::TRACKING] = [
self::CODE_TRACKING => $trackNumber,
self::STATUS_TRACKING => null,
self::STATUS_TRACKING => null,
];
}

Expand Down
2 changes: 1 addition & 1 deletion Gateway/Request/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RefundRequest implements BuilderInterface
* Amount block name.
*/
public const PAYMENT = 'payment';

/**
* Amount block name.
*/
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Request/SponsorDataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function build(array $buildSubject): array
if (substr(strtolower($billingAddress->getEmail()), -strlen(self::TESTE_EMAIL_DOMAIN)) === self::TESTE_EMAIL_DOMAIN) {
$sponsorId = null;
}

return [
'sponsor_id' => $sponsorId,
];
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Request/TransactionAmountDataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function build(array $buildSubject)
$grandTotal = $orderAdapter->getGrandTotalAmount();

$order = $paymentDO->getOrder();

$storeId = $order->getStoreId();

$result[self::TRANSACTION_AMOUNT] = $this->config->formatPrice($grandTotal, $storeId);
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
2 changes: 1 addition & 1 deletion Gateway/Response/TxnIdTwoCcHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function handle(array $handlingSubject, array $response)
];

array_push($transactionInfo, $cardInfo);

$payment->setAdditionalInformation(
str_replace('%', $i,self::CARD_PAYMENT_ID),
$response[self::TRANSACTION_INFO][$i][self::PAYMENT_ID]
Expand Down
2 changes: 1 addition & 1 deletion Model/Api/FinanceCostManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FinanceCostManagement implements FinanceCostManagementInterface
* @var MpConfig
*/
protected $mpConfig;


/**
* FinanceCostManagement constructor.
Expand Down
8 changes: 4 additions & 4 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 @@ -218,7 +218,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
4 changes: 2 additions & 2 deletions Model/Ui/ConfigProviderCheckoutCredits.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function isActive()

/**
* Get images for payment method banner.
*
*
* @return array
*/
public function getImages()
Expand All @@ -197,7 +197,7 @@ public function getImages()

/**
* Get images for payment method banner.
*
*
* @return array
*/
public function getImagesByName($name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CheckoutCreditsAddChildTest extends TestCase
protected $stateMock;

public function setUp(): void
{
{
$this->checkoutCreditsAddChildPaymentMock = $this->getMockBuilder(CheckoutCreditsAddChildPayment::class)->disableOriginalConstructor()->getMock();
$this->stateMock = $this->getMockBuilder(State::class)->disableOriginalConstructor()->getMock();
$this->checkoutCreditsAddChild = new CheckoutCreditsAddChild
Expand All @@ -53,21 +53,21 @@ public function testExecute()

$orderId = 1;
$transactionId = 2;

$inputMock->expects($this->any())
->method('getArgument')
->withConsecutive([CheckoutCreditsAddChild::ORDER_ID], [CheckoutCreditsAddChild::CHILD])
->willReturnOnConsecutiveCalls($orderId, $transactionId);

$reflection = new ReflectionClass($this->checkoutCreditsAddChild);
$method = $reflection->getMethod('execute');
$method->setAccessible(true);
$method->invoke($this->checkoutCreditsAddChild, $inputMock, $outputMock);

$reflectionProperty = new ReflectionProperty($this->checkoutCreditsAddChild, 'state');
$reflectionProperty->setAccessible(true);
$stateValue = $reflectionProperty->getValue($this->checkoutCreditsAddChild);

$this->assertEquals($stateValue, $this->stateMock);
}

Expand All @@ -83,4 +83,4 @@ public function testConfigure()
$this->assertIsArray($this->checkoutCreditsAddChild->getDefinition()->getArguments());
$this->assertArrayHasKey(CheckoutCreditsAddChild::ORDER_ID, $this->checkoutCreditsAddChild->getDefinition()->getArguments());
}
}
}
2 changes: 1 addition & 1 deletion Tests/Unit/Gateway/Config/ConfigCheckoutCreditsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function testGetBannerTextHowToUse()
);

$result = $configCheckoutCredits->getBannerText($textId, $storeId);

$this->assertEquals('How to use it?', $result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function setUp(): void
'order' => $this->orderMock,
]);
}

public function testAddMethodWithException()
{
$orderId = 1;
Expand Down Expand Up @@ -93,4 +93,4 @@ public function testAddMethodWithException()

$this->model->add($orderId, $childTransaction);
}
}
}
Loading

0 comments on commit 092d234

Please sign in to comment.