@@ -3,6 +3,7 @@
|
||||
namespace Modules\Payment\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Modules\Booking\Models\Booking;
|
||||
@@ -15,9 +16,13 @@ class PaymentController extends Controller
|
||||
private InitiatePaymentAction $initiatePaymentAction,
|
||||
) {}
|
||||
|
||||
public function initiate(Booking $booking): JsonResponse
|
||||
public function initiate(Request $request, Booking $booking): JsonResponse
|
||||
{
|
||||
Gate::authorize('pay', $booking);
|
||||
$openid = $request->attributes->get('fastapi_openid');
|
||||
|
||||
if ($openid === null) {
|
||||
Gate::authorize('create', Booking::class);
|
||||
}
|
||||
|
||||
$payment = $this->initiatePaymentAction->handle($booking);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user