checkout_id direkt an das Backend, damit der Server die Session via Paddle‑API finalisiert (auch wenn der Webhook nicht greift). Dadurch sollte “Zahlung wird verarbeitet” nicht mehr hängen bleiben.
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Checkout;
|
|
|
|
use App\Models\CheckoutSession;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CheckoutSessionConfirmRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
$session = $this->route('session');
|
|
|
|
if (! $session instanceof CheckoutSession) {
|
|
return false;
|
|
}
|
|
|
|
$user = $this->user();
|
|
|
|
if (! $user) {
|
|
return false;
|
|
}
|
|
|
|
return (int) $session->user_id === (int) $user->id;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'transaction_id' => ['nullable', 'string', 'required_without:checkout_id'],
|
|
'checkout_id' => ['nullable', 'string', 'required_without:transaction_id'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'transaction_id.required_without' => 'Transaction ID oder Checkout ID fehlt.',
|
|
'checkout_id.required_without' => 'Checkout ID oder Transaction ID fehlt.',
|
|
];
|
|
}
|
|
}
|