| @@ 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 | ||
| @@ 14-51 (lines=38) @@ | ||
| 11 | use Symfony\Component\HttpFoundation\Request; |
|
| 12 | use Symfony\Component\HttpFoundation\Response; |
|
| 13 | ||
| 14 | final class CompleteOrderAction |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @var ViewHandlerInterface |
|
| 18 | */ |
|
| 19 | private $viewHandler; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @var CommandBus |
|
| 23 | */ |
|
| 24 | private $bus; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param ViewHandlerInterface $viewHandler |
|
| 28 | * @param CommandBus $bus |
|
| 29 | */ |
|
| 30 | public function __construct(ViewHandlerInterface $viewHandler, CommandBus $bus) |
|
| 31 | { |
|
| 32 | $this->viewHandler = $viewHandler; |
|
| 33 | $this->bus = $bus; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @param Request $request |
|
| 38 | * |
|
| 39 | * @return Response |
|
| 40 | */ |
|
| 41 | public function __invoke(Request $request) |
|
| 42 | { |
|
| 43 | $this->bus->handle(new CompleteOrder( |
|
| 44 | $request->attributes->get('token'), |
|
| 45 | $request->request->get('email'), |
|
| 46 | $request->request->get('notes') |
|
| 47 | )); |
|
| 48 | ||
| 49 | return $this->viewHandler->handle(View::create(null, Response::HTTP_NO_CONTENT)); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 12-48 (lines=37) @@ | ||
| 9 | use Symfony\Component\HttpFoundation\Request; |
|
| 10 | use Symfony\Component\HttpFoundation\Response; |
|
| 11 | ||
| 12 | final class AddCouponAction |
|
| 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 AddCoupon( |
|
| 42 | $request->attributes->get('token'), |
|
| 43 | $request->request->get('coupon') |
|
| 44 | )); |
|
| 45 | ||
| 46 | return $this->viewHandler->handle(View::create(null, Response::HTTP_NO_CONTENT)); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||