diff --git a/src/EbicsClient.php b/src/EbicsClient.php index 40d6497..2fe8be7 100644 --- a/src/EbicsClient.php +++ b/src/EbicsClient.php @@ -422,14 +422,6 @@ private function downloadTransaction(callable $requestClosure, ?callable $ackClo $lastSegment = $segment; } - if (null !== $ackClosure) { - $acknowledged = call_user_func_array($ackClosure, [$transaction]); - } else { - $acknowledged = true; - } - - $this->transferReceipt($transaction, $acknowledged); - $orderDataEncoded = $this->bufferFactory->create(); foreach ($transaction->getSegments() as $segment) { $orderDataEncoded->write($segment->getOrderData()); @@ -460,6 +452,14 @@ private function downloadTransaction(callable $requestClosure, ?callable $ackClo $transaction->setOrderData($orderData->readContent()); unset($orderData); + if (null !== $ackClosure) { + $acknowledged = call_user_func_array($ackClosure, [$transaction]); + } else { + $acknowledged = true; + } + + $this->transferReceipt($transaction, $acknowledged); + return $transaction; }