/** * @param AcceptOrder $command * @throws OrderNotFoundException * @throws InvalidTransitionException */ public function handle(AcceptOrder $command) { $order = $this->orders->getById(new OrderId($command->orderId())); $order->accept(); }
/** * @param CreatePayment $command * @throws OrderNotFoundException */ public function handle(CreatePayment $command) { $order = $this->orders->getById(new OrderId($command->orderId())); $this->payments->add(new Payment(new PaymentId($command->paymentId()), $order)); }
/** * @param RefundOrder $command * @throws InvalidTransitionException * @throws OrderNotFoundException */ public function handle(RefundOrder $command) { $order = $this->orders->getById(new OrderId($command->orderId())); $order->refund(); }
/** * @param PrepareOrder $command * @throws InvalidTransitionException */ public function handle(PrepareOrder $command) { $order = $this->orders->getById(new OrderId($command->orderId())); $order->prepare(); }