Skip to content

Commit

Permalink
SL-133 iframe saving card fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjas1997 committed Dec 2, 2022
1 parent 1485c45 commit 11993d7
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/Service/TransactionFlow/SaferPayTransactionAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ 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);

$assertBody = $this->authorizationService->createObjectsFromAuthorizationResponse(
$authResponse,
$saferPayOrder->id,
$this->context->customer->id,
$order->id_customer,
$selectedCard
);

Expand All @@ -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);
}
}

0 comments on commit 11993d7

Please sign in to comment.