Skip to content

Commit

Permalink
Fixed: Uncaught Error: Call to a member function getReference() on array
Browse files Browse the repository at this point in the history
  • Loading branch information
aait committed Jun 24, 2021
1 parent 4672230 commit 460f331
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/SwedbankPay/Core/Library/Methods/Checkout.php
Expand Up @@ -500,7 +500,9 @@ public function captureCheckout($orderId, $amount = null, $vatAmount = 0, array
// Build items collection
$orderItems = new OrderItemsCollection();
foreach ($items as $item) {
/** @var OrderItemInterface $item */
if (is_array($item)) {
$item = new \SwedbankPay\Core\OrderItem($item);
}

$orderItem = new OrderItem();
$orderItem
Expand Down Expand Up @@ -725,11 +727,13 @@ public function refundCheckout($orderId, $amount = null, $vatAmount = 0, array $
$amount = 0;
$vatAmount = 0;
foreach ($items as $item) {
if (is_array($item)) {
$item = new \SwedbankPay\Core\OrderItem($item);
}

$amount += $item->getAmount();
$vatAmount += $item->getVatAmount();

/** @var OrderItemInterface $item */

$orderItem = new OrderItem();
$orderItem
->setReference($item->getReference())
Expand Down

0 comments on commit 460f331

Please sign in to comment.