'Created Billplz Bill', 'message' => 'You have successfully created a new Bill' ]; } /** @var CreatesBillplzBill */ private $createsBillplzBill; /** * CreateBookingLogic constructor. * @param CreatesBillplzBill $createsBillplzBill */ public function __construct(CreatesBillplzBill $createsBillplzBill) { $this->createsBillplzBill = $createsBillplzBill; } /** * @param Request $request * @return JsonResponse * @throws MalformedRequestException */ public function logic(Request $request) : JsonResponse { $billPlz = $this->createsBillplzBill->execute($request->user()->name, $request->user()->email, $request->input('description'), 200, $request->input('bankName')); if(!$billPlz) throw new MalformedRequestException('Unable to get correct response from billplz server.'); return $this->response(['data' => $billPlz]); } }