mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-27 16:45:21 +00:00
28 lines
679 B
PHP
28 lines
679 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Concert;
|
|
use Illuminate\Http\Request;
|
|
use App\Billing\PaymentGateway;
|
|
|
|
class ConcertOrdersController extends Controller
|
|
{
|
|
private $paymentGateway;
|
|
|
|
public function __construct(PaymentGateway $paymentGateway)
|
|
{
|
|
$this->paymentGateway = $paymentGateway;
|
|
}
|
|
|
|
public function store($concertId)
|
|
{
|
|
$concert = Concert::find($concertId);
|
|
$ticketQuantity = request('ticket_quantity');
|
|
$amount = $ticketQuantity * $concert->ticket_price;
|
|
$token = request('payment_token');
|
|
$this->paymentGateway->charge($amount, $token);
|
|
return response()->json([], 201);
|
|
}
|
|
}
|