Present Paystack checkout in a responsive mobile sheet and desktop modal.
Deploy Ladill Mini / deploy (push) Successful in 55s
Deploy Ladill Mini / deploy (push) Successful in 55s
Standardize customer-facing Ladill Pay checkout shells across products, open them on all viewports, and escape iframe callbacks back to the product flow.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Public;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MiniPayment;
|
||||
use App\Models\QrCode;
|
||||
use App\Services\Mini\MiniPaymentService;
|
||||
use App\Support\LadillLink;
|
||||
@@ -50,19 +51,40 @@ class PaymentController extends Controller
|
||||
return redirect()->away($result['checkout_url']);
|
||||
}
|
||||
|
||||
public function callback(Request $request, string $shortCode): RedirectResponse|View
|
||||
public function callback(Request $request, string $shortCode): View
|
||||
{
|
||||
$reference = trim((string) $request->query('reference', ''));
|
||||
if ($reference === '') {
|
||||
return redirect()->away(LadillLink::url($shortCode))->with('error', 'Missing payment reference.');
|
||||
return view('public.payment-return', [
|
||||
'redirect' => LadillLink::url($shortCode),
|
||||
]);
|
||||
}
|
||||
|
||||
try {
|
||||
$payment = $this->payments->complete($reference);
|
||||
} catch (RuntimeException $e) {
|
||||
return redirect()->away(LadillLink::url($shortCode))->with('error', $e->getMessage());
|
||||
return view('public.payment-return', [
|
||||
'redirect' => LadillLink::url($shortCode),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('public.payment-return', [
|
||||
'redirect' => route('qr.public.payment.confirmed', [
|
||||
'shortCode' => $shortCode,
|
||||
'reference' => $payment->payment_reference,
|
||||
], absolute: true),
|
||||
]);
|
||||
}
|
||||
|
||||
public function confirmed(string $shortCode, string $reference): View
|
||||
{
|
||||
$payment = MiniPayment::query()
|
||||
->with('qrCode')
|
||||
->where('payment_reference', $reference)
|
||||
->where('status', MiniPayment::STATUS_PAID)
|
||||
->whereHas('qrCode', fn ($q) => $q->where('short_code', $shortCode))
|
||||
->firstOrFail();
|
||||
|
||||
return view('public.qr.payment-confirmed', [
|
||||
'payment' => $payment,
|
||||
'qrCode' => $payment->qrCode,
|
||||
|
||||
Reference in New Issue
Block a user