Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [4.2.3]
### Fixed
- Fix AltaPay callback redirect layout rendering.

## [4.2.2]
### Added
- Fixed compatibility issues with PHP 8.1.
Expand Down
43 changes: 38 additions & 5 deletions Controller/Index/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,41 @@
namespace SDM\Altapay\Controller\Index;

use Magento\Framework\App\ResponseInterface;
use SDM\Altapay\Controller\Index;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\Request\InvalidRequestException;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Controller\Result\RawFactory;
use Magento\Framework\View\LayoutFactory;

class Redirect extends Index implements CsrfAwareActionInterface
class Redirect extends Action implements CsrfAwareActionInterface
{
/**
* @var LayoutFactory
*/
protected $layoutFactory;

/**
* @var RawFactory
*/
protected $resultRawFactory;

/**
* Redirect constructor.
* @param Context $context
* @param LayoutFactory $layoutFactory
* @param RawFactory $resultRawFactory
*/
public function __construct(
Context $context,
LayoutFactory $layoutFactory,
RawFactory $resultRawFactory
) {
parent::__construct($context);
$this->layoutFactory = $layoutFactory;
$this->resultRawFactory = $resultRawFactory;
}

/**
* Dispatch request
Expand All @@ -40,11 +68,16 @@ public function validateForCsrf(RequestInterface $request): ?bool
{
return true;
}

public function execute()
{
$this->writeLog();
$layout = $this->layoutFactory->create();

$block = $layout->createBlock(\SDM\Altapay\Block\Callback\Redirect::class)
->setTemplate('SDM_Altapay::callback_redirect.phtml');

$result = $this->resultRawFactory->create();
$result->setContents($block->toHtml());

return $this->pageFactory->create();
return $result;
}
}
2 changes: 1 addition & 1 deletion Model/Handler/OrderLinesHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,6 @@ public function totalCompensationAmount($orderLines, $total)
$orderLinesTotal += $orderLinePriceWithTax - ($orderLinePriceWithTax * ($orderLine->discount / 100));
}

return round(($total - $orderLinesTotal), 3);
return (round($total * 100) - round($orderLinesTotal * 100)) / 100;
}
}
2 changes: 1 addition & 1 deletion Setup/Patch/Data/MaskedPanUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ public static function getDependencies()
*/
public static function getVersion()
{
return '4.2.2';
return '4.2.3';
}
}
4 changes: 2 additions & 2 deletions Test/integration-tests/cypress/e2e/PageObjects/objects.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Order {
}
cy.get('#creditCardNumberInput').type('4111111111111111')
cy.get('#emonth').select('12')
cy.get('#eyear').select('2025')
cy.get('#eyear').select('2030')
cy.get('#cvcInput').type('123')
cy.get('#cardholderNameInput').type('testname')
cy.get('body').then(($p) => {
Expand Down Expand Up @@ -139,7 +139,7 @@ class Order {
cy.get('._active > .payment-method-content > :nth-child(5) > div.primary > .action').click().wait(3000)
cy.get('#creditCardNumberInput').type('4111111111111111')
cy.get('#emonth').type('01')
cy.get('#eyear').type('2023')
cy.get('#eyear').type('2030')
cy.get('#cvcInput').type('123')
cy.get('#cardholderNameInput').type('testname')
cy.get('#pensioCreditCardPaymentSubmitButton').click().wait(6000)
Expand Down
2 changes: 1 addition & 1 deletion Test/integration-tests/cypress/e2e/examples/payment.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Payments', function () {
cy.visit(payment_link)
cy.get('#creditCardNumberInput').type('4111111111111111')
cy.get('#emonth').select('12')
cy.get('#eyear').select('2025')
cy.get('#eyear').select('2030')
cy.get('#cvcInput').type('123')
cy.get('#cardholderNameInput').type('testname')
cy.get('#pensioCreditCardPaymentSubmitButton').click().wait(3000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Order {
}
cy.get('#creditCardNumberInput').type('4111111111111111')
cy.get('#emonth').select('12')
cy.get('#eyear').select('2025')
cy.get('#eyear').select('2030')
cy.get('#cvcInput').type('123')
cy.get('#cardholderNameInput').type('testname')
cy.get('body').then(($p) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Payments', function () {
cy.visit(payment_link)
cy.get('#creditCardNumberInput').type('4111111111111111')
cy.get('#emonth').select('12')
cy.get('#eyear').select('2025')
cy.get('#eyear').select('2030')
cy.get('#cvcInput').type('123')
cy.get('#cardholderNameInput').type('testname')
cy.get('#pensioCreditCardPaymentSubmitButton').click().wait(3000)
Expand Down
Loading
Loading