Ejemplo n.º 1
0
 /**
  * @param Bill $bill
  * @return JsonResponse
  */
 public function payAction(Bill $bill)
 {
     try {
         $command = new PayBillCommand($bill);
         $this->commandBus->execute($command);
         return new JsonResponse(['bill' => $bill->getId(), 'has_been_paid' => $bill->hasBeenPaid()]);
     } catch (BillAlreadyPaidException $e) {
         throw new HttpException(409, $e->getMessage(), $e);
     }
 }