diff --git a/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php b/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php index cbc31d86..8f626b8d 100755 --- a/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php +++ b/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php @@ -83,7 +83,10 @@ public function __construct( */ public function authorize($orderId, $saveCard, $selectedCard) { - $saferPayOrder = $this->getSaferPayOrder($orderId); + $order = new Order($orderId); + + $saferPayOrderId = $this->orderRepository->getIdByOrderId($orderId); + $saferPayOrder = new SaferPayOrder($saferPayOrderId); $authRequest = $this->authRequestCreator->create($saferPayOrder->token, $saveCard); $authResponse = $this->authorizationService->authorize($authRequest); @@ -91,7 +94,7 @@ public function authorize($orderId, $saveCard, $selectedCard) $assertBody = $this->authorizationService->createObjectsFromAuthorizationResponse( $authResponse, $saferPayOrder->id, - $this->context->customer->id, + $order->id_customer, $selectedCard ); @@ -100,16 +103,4 @@ public function authorize($orderId, $saveCard, $selectedCard) return $assertBody; } - - /** - * @param $orderId - * - * @return false|SaferPayOrder - */ - private function getSaferPayOrder($orderId) - { - $saferPayOrderId = $this->orderRepository->getIdByOrderId($orderId); - - return new SaferPayOrder($saferPayOrderId); - } }