| @@ 13-50 (lines=38) @@ | ||
| 10 | use Symfony\Component\HttpFoundation\Request; |
|
| 11 | use Symfony\Component\HttpFoundation\Response; |
|
| 12 | ||
| 13 | final class ChoosePaymentMethodAction |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @var ViewHandlerInterface |
|
| 17 | */ |
|
| 18 | private $viewHandler; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @var CommandBus |
|
| 22 | */ |
|
| 23 | private $bus; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param ViewHandlerInterface $viewHandler |
|
| 27 | * @param CommandBus $bus |
|
| 28 | */ |
|
| 29 | public function __construct(ViewHandlerInterface $viewHandler, CommandBus $bus) |
|
| 30 | { |
|
| 31 | $this->viewHandler = $viewHandler; |
|
| 32 | $this->bus = $bus; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @param Request $request |
|
| 37 | * |
|
| 38 | * @return Response |
|
| 39 | */ |
|
| 40 | public function __invoke(Request $request) |
|
| 41 | { |
|
| 42 | $this->bus->handle(new ChoosePaymentMethod( |
|
| 43 | $request->attributes->get('token'), |
|
| 44 | $request->attributes->get('paymentId'), |
|
| 45 | $request->request->get('method') |
|
| 46 | )); |
|
| 47 | ||
| 48 | return $this->viewHandler->handle(View::create(null, Response::HTTP_NO_CONTENT)); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 12-49 (lines=38) @@ | ||
| 9 | use Symfony\Component\HttpFoundation\Request; |
|
| 10 | use Symfony\Component\HttpFoundation\Response; |
|
| 11 | ||
| 12 | final class ChooseShippingMethodAction |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @var ViewHandlerInterface |
|
| 16 | */ |
|
| 17 | private $viewHandler; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @var CommandBus |
|
| 21 | */ |
|
| 22 | private $bus; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @param ViewHandlerInterface $viewHandler |
|
| 26 | * @param CommandBus $bus |
|
| 27 | */ |
|
| 28 | public function __construct(ViewHandlerInterface $viewHandler, CommandBus $bus) |
|
| 29 | { |
|
| 30 | $this->viewHandler = $viewHandler; |
|
| 31 | $this->bus = $bus; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param Request $request |
|
| 36 | * |
|
| 37 | * @return Response |
|
| 38 | */ |
|
| 39 | public function __invoke(Request $request) |
|
| 40 | { |
|
| 41 | $this->bus->handle(new ChooseShippingMethod( |
|
| 42 | $request->attributes->get('token'), |
|
| 43 | $request->attributes->get('shippingId'), |
|
| 44 | $request->request->get('method') |
|
| 45 | )); |
|
| 46 | ||
| 47 | return $this->viewHandler->handle(View::create(null, Response::HTTP_NO_CONTENT)); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 18-45 (lines=28) @@ | ||
| 15 | use Symfony\Component\HttpFoundation\Response; |
|
| 16 | use Symfony\Component\Validator\Validator\ValidatorInterface; |
|
| 17 | ||
| 18 | final class RequestPasswordResettingAction |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var ViewHandlerInterface |
|
| 22 | */ |
|
| 23 | private $viewHandler; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @var CommandBus |
|
| 27 | */ |
|
| 28 | private $bus; |
|
| 29 | ||
| 30 | public function __construct( |
|
| 31 | ViewHandlerInterface $viewHandler, |
|
| 32 | CommandBus $bus |
|
| 33 | ) { |
|
| 34 | $this->viewHandler = $viewHandler; |
|
| 35 | $this->bus = $bus; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function __invoke(Request $request): Response |
|
| 39 | { |
|
| 40 | $this->bus->handle(new GenerateResetPasswordToken($request->request->get('email'))); |
|
| 41 | $this->bus->handle(new SendResetPasswordToken($request->request->get('email'))); |
|
| 42 | ||
| 43 | return $this->viewHandler->handle(View::create(null, Response::HTTP_NO_CONTENT)); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||