Skip to content

Commit d64827f

Browse files
committed
Refactor order retrieval in cancel method for clarity
1 parent 2b7f867 commit d64827f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/Controller/ApiController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function cancel(Request $request): JsonApiResponse|Response
153153
$responseAsXml = new \SimpleXMLElement($response->getBody()->getContents());
154154
if ((string)$responseAsXml->Body?->Result === "Success") {
155155
$this->orderTransactionStateHandler->cancel(
156-
$order->getTransactions()?->first()->getId(), // todo get right transaction
156+
$order->getTransactions()?->first()->getId(),
157157
$context
158158
);
159159
}
@@ -168,8 +168,7 @@ private function getOrder(string $orderId, ?Context $context = null): ?OrderEnti
168168
$criteria->addAssociation('transactions')
169169
->addSorting(new FieldSorting('transactions.createdAt', FieldSorting::DESCENDING));
170170

171-
/** @var ?OrderEntity $order */
172-
$order = $this->orderRepository->search($criteria, $context)->first();
173-
return $order;
171+
/** @var ?OrderEntity */
172+
return $this->orderRepository->search($criteria, $context)->first();
174173
}
175174
}

0 commit comments

Comments
 (0)