Skip to content

Commit

Permalink
[PW-7261] Call to getAmount() failing in AdyenOrderPayment helper in …
Browse files Browse the repository at this point in the history
…develop branch
  • Loading branch information
RokPopov committed Oct 3, 2022
1 parent 55c7235 commit 8a76889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Helper/AdyenOrderPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
9 changes: 3 additions & 6 deletions Test/Unit/Helper/AdyenOrderPaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8a76889

Please sign in to comment.