Skip to content

Commit

Permalink
Merge pull request #214 from Invertus/iframe-fail-redirect
Browse files Browse the repository at this point in the history
Iframe fail redirection adjustments
  • Loading branch information
MarijusCoding authored Oct 23, 2024
2 parents 845fe53 + 89ba3be commit 4b068c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions controllers/front/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ public function postProcess()
$order = new Order($this->getOrderId($cartId));
$secureKey = Tools::getValue('secureKey');
$selectedCard = Tools::getValue('selectedCard');

$paymentMethod = $order->id ? $order->payment : Tools::getValue('paymentMethod');
$cart = new Cart($cartId);

$failController = $this->getFailController($order);
$failController = $this->getFailController($paymentMethod);

if (!Validate::isLoadedObject($cart)) {
$this->warning[] = $this->module->l('An unknown error error occurred. Please contact support', self::FILE_NAME);
Expand Down Expand Up @@ -380,7 +379,7 @@ private function createAndValidateOrder($assertResponseBody, $transactionStatus,
}
}

private function getFailController($order)
private function getFailController($orderPayment)
{
/** @var \Invertus\SaferPay\Provider\PaymentTypeProvider $paymentTypeProvider */
$paymentTypeProvider = $this->module->getService(\Invertus\SaferPay\Provider\PaymentTypeProvider::class);
Expand All @@ -391,16 +390,16 @@ private function getFailController($order)
$logger->debug('Getting fail controller', [
'context' => [],
'controller' => self::FILE_NAME,
'order_payment' => $order->payment,
'order_payment' => $orderPayment,
]);

$paymentRedirectType = $paymentTypeProvider->get($order->payment);
$paymentRedirectType = $paymentTypeProvider->get($orderPayment);

if ($paymentRedirectType === PaymentType::IFRAME) {
$logger->debug('Fail controller is FAIL_IFRAME', [
'context' => [],
'controller' => self::FILE_NAME,
'order_payment' => $order->payment,
'order_payment' => $orderPayment,
]);

return ControllerName::FAIL_IFRAME;
Expand All @@ -409,7 +408,7 @@ private function getFailController($order)
$logger->debug('Fail controller is FAIL', [
'context' => [],
'controller' => self::FILE_NAME,
'order_payment' => $order->payment,
'order_payment' => $orderPayment,
]);

return ControllerName::FAIL;
Expand Down
1 change: 1 addition & 0 deletions src/Service/SaferPayInitialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function buildRequest(
'selectedCard' => $selectedCard,
'isBusinessLicence' => $isBusinessLicence,
'fieldToken' => $fieldToken,
'paymentMethod' => $paymentMethod,
],
true
);
Expand Down

0 comments on commit 4b068c7

Please sign in to comment.