mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
5.2 - Removing the Need to Cancel Orders
This commit is contained in:
@@ -30,16 +30,17 @@ class ConcertOrdersController extends Controller
|
||||
try {
|
||||
|
||||
// Find some tickets
|
||||
// Charge the customer for the tickets
|
||||
// Create an order for those tickets
|
||||
$tickets = $concert->findTickets(request('ticket_quantity'));
|
||||
|
||||
$order = $concert->orderTickets(request('email'), request('ticket_quantity'));
|
||||
// Charge the customer for the tickets
|
||||
$this->paymentGateway->charge(request('ticket_quantity') * $concert->ticket_price, request('payment_token'));
|
||||
|
||||
// Create an order for those tickets
|
||||
$order = $concert->createOrder(request('email'), $tickets);
|
||||
|
||||
return response()->json($order, 201);
|
||||
|
||||
} catch (PaymentFailedException $e) {
|
||||
$order->cancel();
|
||||
return response()->json([], 422);
|
||||
} catch (NotEnoughTicketsException $e) {
|
||||
return response()->json([], 422);
|
||||
|
||||
Reference in New Issue
Block a user