Skip to content

Commit

Permalink
NTR: fix broken refund composition after metadata change
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Sep 21, 2023
1 parent b378a90 commit 072e0a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Components/RefundManager/Builder/RefundDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,13 @@ private function getRefundedQuantity(string $mollieLineItemId, \Mollie\Api\Resou
continue;
}

$metadata = RefundMetadata::fromArray($refund['metadata']);
$meta = $refund['metadata'];

if (is_string($meta)) {
$meta = json_decode($meta, true);
}

$metadata = RefundMetadata::fromArray($meta);

# if we do have a FULL item refund then
# we must NOT substract our item again.
Expand Down
2 changes: 1 addition & 1 deletion src/Hydrator/RefundHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function hydrate(Refund $refund, OrderEntity $order): array
$metaData = '';

if (property_exists($refund, 'metadata')) {
$metaData = (string)json_encode($refund->metadata);
$metaData = $refund->metadata;
}

$internalDescription = null;
Expand Down

0 comments on commit 072e0a6

Please sign in to comment.