-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathCheckoutRedirect.php
53 lines (45 loc) · 1.59 KB
/
CheckoutRedirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Mollie\Payment\Multishipping;
use Magento\Framework\ObjectManagerInterface;
use Magento\Multishipping\Model\Checkout\Type\Multishipping\State;
class CheckoutRedirect
{
/**
* @var ObjectManagerInterface
*/
private $objectManager;
/**
* @var \Magento\Framework\App\Response\RedirectInterface
*/
private $redirect;
/**
* @var \Magento\Framework\App\ResponseInterface
*/
private $response;
public function __construct(
ObjectManagerInterface $objectManager,
\Magento\Framework\App\Response\RedirectInterface $redirect,
\Magento\Framework\App\ResponseInterface $response
) {
$this->objectManager = $objectManager;
$this->redirect = $redirect;
$this->response = $response;
}
/**
* Normally it is forbidden to use the object manager, but the use case here is justified: This code is used in
* one the most critical parts of this extension: When a user has paid and is redirected from Mollie back to the
* webshop. The Multishipping module is rarely used and often replaced. So we are only invoking the multishipping
* code on the moment we really need this.
*/
public function redirect()
{
$state = $this->objectManager->create(State::class);
$state->setCompleteStep(State::STEP_OVERVIEW);
$state->setActiveStep(State::STEP_SUCCESS);
$this->redirect->redirect($this->response, 'multishipping/checkout/success?utm_nooverride=1');
}
}