4.2 - Returning Order Details

This commit is contained in:
Adam Wathan
2016-11-16 18:16:55 -05:00
parent 709e87bf69
commit 0f6993c505
3 changed files with 32 additions and 1 deletions

View File

@@ -30,7 +30,9 @@ class ConcertOrdersController extends Controller
try {
$order = $concert->orderTickets(request('email'), request('ticket_quantity'));
$this->paymentGateway->charge(request('ticket_quantity') * $concert->ticket_price, request('payment_token'));
return response()->json([], 201);
return response()->json($order, 201);
} catch (PaymentFailedException $e) {
$order->cancel();
return response()->json([], 422);