示例#1
0
 /**
  * @param RejectPayment $command
  * @throws InvalidTransitionException
  */
 public function handle(RejectPayment $command)
 {
     $payment = $this->payments->getById(new PaymentId($command->paymentId()));
     $payment->reject();
 }
示例#2
0
 /**
  * @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));
 }