Skip to content

Commit

Permalink
Merge branch 'main' into ECP-9542
Browse files Browse the repository at this point in the history
  • Loading branch information
khushboo-singhvi authored Feb 4, 2025
2 parents 41f13e9 + ebadb3a commit 26d5d68
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
playwright:
image: mcr.microsoft.com/playwright:v1.49.1
image: mcr.microsoft.com/playwright:v1.50.1
shm_size: 1gb
ipc: host
cap_add:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:

- name: Archive test result artifacts
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html-report
path: test-report
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

use Adyen\Payment\Logger\AdyenLogger;
use Exception;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Filesystem\DirectoryList;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\ResultFactory;
Expand All @@ -30,7 +28,7 @@ class DownloadApplePayDomainAssociationFile extends Action
const WELL_KNOWN_PATH = '.well-known';

public function __construct(
private readonly Context $context,
Context $context,
private readonly DirectoryList $directoryList,
private readonly File $fileIo,
private readonly AdyenLogger $adyenLogger
Expand All @@ -39,10 +37,9 @@ public function __construct(
}

/**
* @return ResultInterface|ResponseInterface
* @throws FileSystemException
* @return ResultInterface
*/
public function execute(): ResultInterface|ResponseInterface
public function execute(): ResultInterface
{
$redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$redirect->setUrl($this->_redirect->getRefererUrl());
Expand Down
6 changes: 4 additions & 2 deletions Helper/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,11 @@ public function isFullInvoiceAmountManuallyCaptured(InvoiceModel $invoice): bool
}
}

$invoiceChargedCurrency = $this->chargedCurrencyHelper->getInvoiceAmountCurrency($invoice);

$invoiceAmountCents = $this->adyenDataHelper->formatAmount(
$invoice->getGrandTotal(),
$invoice->getOrderCurrencyCode()
$invoiceChargedCurrency->getAmount(),
$invoiceChargedCurrency->getCurrencyCode()
);

$invoiceCapturedAmountCents = $this->adyenDataHelper->formatAmount(
Expand Down
22 changes: 21 additions & 1 deletion Test/Unit/Helper/InvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ public function testHandleCaptureWebhook()
$adyenAmountCurrencyMock->method('getAmount')->willReturn(10);
$adyenAmountCurrencyMock->method('getCurrencyCode')->willReturn('EUR');

$invoiceAmountCurrency = $this->createMock(AdyenAmountCurrency::class);

$chargedCurrencyMock = $this->createMock(ChargedCurrency::class);
$chargedCurrencyMock->method('getOrderAmountCurrency')->willReturn($adyenAmountCurrencyMock);
$chargedCurrencyMock->method('getInvoiceAmountCurrency')->willReturn($invoiceAmountCurrency);

$invoiceHelper = $this->createInvoiceHelper(
$contextMock,
Expand Down Expand Up @@ -277,6 +280,17 @@ public function testIsFullInvoiceAmountManuallyCaptured()
],
]);

$invoiceAmountCurrency = $this->createMock(AdyenAmountCurrency::class);
$invoiceAmountCurrency->expects($this->once())
->method('getAmount')
->willReturn(1000);
$invoiceAmountCurrency->expects($this->once())
->method('getCurrencyCode')
->willReturn('EUR');

$chargedCurrencyMock = $this->createMock(ChargedCurrency::class);
$chargedCurrencyMock->method('getInvoiceAmountCurrency')->willReturn($invoiceAmountCurrency);

$invoiceHelper = $this->createInvoiceHelper(
null,
null,
Expand All @@ -286,7 +300,13 @@ public function testIsFullInvoiceAmountManuallyCaptured()
null,
null,
null,
$adyenInvoiceCollectionMock
$adyenInvoiceCollectionMock,
null,
null,
null,
null,
null,
$chargedCurrencyMock
);

$invoiceMock = $this->createConfiguredMock(InvoiceModel::class, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@ define(
request = state.data;
}

request.cancelled = true;

adyenPaymentService.paymentDetails(request, self.orderId).done(function() {
$.mage.redirect(
window.checkoutConfig.payment.adyen.successPage
Expand Down

0 comments on commit 26d5d68

Please sign in to comment.