handle() public method

public handle ( Dumplie\SharedKernel\Application\Command\Command $command )
$command Dumplie\SharedKernel\Application\Command\Command
 /**
  * @param OrderId $orderId
  * @return PaymentId
  */
 public function createPaymentFor(OrderId $orderId) : PaymentId
 {
     $paymentId = PaymentId::generate();
     $command = new CreatePayment((string) $orderId, (string) $paymentId);
     $this->commandBus->handle($command);
     return $paymentId;
 }
Ejemplo n.º 2
0
 /**
  * @param string $currency
  * @param array $skuCodes
  *
  * @return CartId
  */
 public function createNewCartWithProducts(string $currency = 'EUR', array $skuCodes = []) : CartId
 {
     $cartId = CartId::generate();
     $command = new CreateCart((string) $cartId, $currency);
     $this->commandBus->handle($command);
     foreach ($skuCodes as $sku) {
         $addToCartCommand = new AddToCart($sku, 1, (string) $cartId);
         $this->commandBus->handle($addToCartCommand);
     }
     return $cartId;
 }