mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-31 13:46:45 +00:00
3.4 - Finishing the Feature Test
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Concert;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Billing\PaymentGateway;
|
||||
use App\Billing\PaymentFailedException;
|
||||
use App\Exceptions\NotEnoughTicketsException;
|
||||
|
||||
class ConcertOrdersController extends Controller
|
||||
{
|
||||
@@ -27,12 +28,13 @@ class ConcertOrdersController extends Controller
|
||||
]);
|
||||
|
||||
try {
|
||||
$this->paymentGateway->charge(request('ticket_quantity') * $concert->ticket_price, request('payment_token'));
|
||||
$order = $concert->orderTickets(request('email'), request('ticket_quantity'));
|
||||
|
||||
$this->paymentGateway->charge(request('ticket_quantity') * $concert->ticket_price, request('payment_token'));
|
||||
return response()->json([], 201);
|
||||
} catch (PaymentFailedException $e) {
|
||||
return response()->json([], 422);
|
||||
} catch (NotEnoughTicketsException $e) {
|
||||
return response()->json([], 422);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user