mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-01 03:47:08 +00:00
5.5 - Precomputing the Order Amount
This commit is contained in:
@@ -29,15 +29,14 @@ class ConcertOrdersController extends Controller
|
||||
]);
|
||||
|
||||
try {
|
||||
|
||||
// Find some tickets
|
||||
$tickets = $concert->findTickets(request('ticket_quantity'));
|
||||
|
||||
// Charge the customer for the tickets
|
||||
$this->paymentGateway->charge(request('ticket_quantity') * $concert->ticket_price, request('payment_token'));
|
||||
$this->paymentGateway->charge($tickets->sum('price'), request('payment_token'));
|
||||
|
||||
// Create an order for those tickets
|
||||
$order = Order::forTickets($tickets, request('email'));
|
||||
$order = Order::forTickets($tickets, request('email'), $tickets->sum('price'));
|
||||
|
||||
return response()->json($order, 201);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user