diff --git a/src/Components/RefundManager/Builder/RefundDataBuilder.php b/src/Components/RefundManager/Builder/RefundDataBuilder.php index 44107df98..253d6695f 100644 --- a/src/Components/RefundManager/Builder/RefundDataBuilder.php +++ b/src/Components/RefundManager/Builder/RefundDataBuilder.php @@ -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. diff --git a/src/Hydrator/RefundHydrator.php b/src/Hydrator/RefundHydrator.php index a16ff4b6d..52fdd947f 100644 --- a/src/Hydrator/RefundHydrator.php +++ b/src/Hydrator/RefundHydrator.php @@ -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;