From 11993d75c169e332258fb508c37ea150ebe271f5 Mon Sep 17 00:00:00 2001 From: tomjas1997 Date: Fri, 2 Dec 2022 12:01:18 +0200 Subject: [PATCH] SL-133 iframe saving card fix --- .../SaferPayTransactionAuthorization.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) 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); - } }