From 8a76889764cd1a7b0b922e5ef6db8df41352a74c Mon Sep 17 00:00:00 2001 From: Rok Popov Ledinski Date: Mon, 3 Oct 2022 17:15:12 +0200 Subject: [PATCH] [PW-7261] Call to getAmount() failing in AdyenOrderPayment helper in develop branch --- Helper/AdyenOrderPayment.php | 2 +- Test/Unit/Helper/AdyenOrderPaymentTest.php | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Helper/AdyenOrderPayment.php b/Helper/AdyenOrderPayment.php index 67b03e89d..d2f5f20b3 100644 --- a/Helper/AdyenOrderPayment.php +++ b/Helper/AdyenOrderPayment.php @@ -267,7 +267,7 @@ private function compareAdyenOrderPaymentsAmount(Order $order, array $adyenOrder $orderAmountCurrency = $this->adyenChargedCurrencyHelper->getOrderAmountCurrency($order); foreach ($adyenOrderPayments as $adyenOrderPayment) { - $adyenOrderPaymentsTotal += $adyenOrderPayment->getAmount(); + $adyenOrderPaymentsTotal += $adyenOrderPayment[OrderPaymentInterface::AMOUNT]; } $adyenOrderPaymentsTotalCents = $this->adyenDataHelper->formatAmount($adyenOrderPaymentsTotal, $orderAmountCurrency->getCurrencyCode()); diff --git a/Test/Unit/Helper/AdyenOrderPaymentTest.php b/Test/Unit/Helper/AdyenOrderPaymentTest.php index 4405182a1..9b09a49b2 100644 --- a/Test/Unit/Helper/AdyenOrderPaymentTest.php +++ b/Test/Unit/Helper/AdyenOrderPaymentTest.php @@ -11,6 +11,7 @@ namespace Adyen\Payment\Tests\Unit\Helper; +use Adyen\Payment\Api\Data\OrderPaymentInterface; use Adyen\Payment\Helper\AdyenOrderPayment; use Adyen\Payment\Helper\ChargedCurrency; use Adyen\Payment\Helper\Data; @@ -85,9 +86,7 @@ public function testIsFullAmountFinalizedAutoCapture() 'getOrderAmountCurrency' => $orderAmountCurrency ]); - $adyenOrderPayment = $this->createConfiguredMock(AdyenPaymentModel::class, [ - 'getAmount' => 10.33 - ]); + $adyenOrderPayment = [OrderPaymentInterface::AMOUNT => 10.33]; $payment = $this->createConfiguredMock(Order\Payment::class, [ 'getEntityId' => 55 @@ -226,9 +225,7 @@ public function testIsFullAmountAuthorized() 'getEntityId' => 55 ]); - $adyenOrderPayment = $this->createConfiguredMock(\Adyen\Payment\Model\Order\Payment::class, [ - 'getAmount' => 10.33 - ]); + $adyenOrderPayment = [OrderPaymentInterface::AMOUNT => 10.33]; $order = $this->createConfiguredMock(Order::class, [ 'getPayment' => $payment