Fix POS Paystack double modal and keep checkout in-app.
Pass access_code into the payment sheet, launch Paystack Inline only, and hide Ladill chrome after Inline loads so register Card/MoMo shows a single payment interface.
This commit is contained in:
@@ -235,6 +235,7 @@ class RegisterController extends Controller
|
||||
|
||||
$result = $this->sales->initiatePayCheckout($sale, $merchant);
|
||||
$checkoutUrl = $result['checkout_url'] ?? null;
|
||||
$accessCode = $result['access_code'] ?? null;
|
||||
|
||||
$this->customerDisplays->pushPayment($location, $sale->fresh(['lines']), [
|
||||
'checkout_url' => $checkoutUrl,
|
||||
@@ -246,6 +247,7 @@ class RegisterController extends Controller
|
||||
if ($request->expectsJson() || $request->ajax()) {
|
||||
return response()->json([
|
||||
'checkout_url' => $checkoutUrl,
|
||||
'access_code' => $accessCode,
|
||||
'sale_id' => $sale->id,
|
||||
]);
|
||||
}
|
||||
@@ -253,6 +255,7 @@ class RegisterController extends Controller
|
||||
return redirect()
|
||||
->route('pos.sales.show', $sale)
|
||||
->with('checkout_url', $checkoutUrl)
|
||||
->with('access_code', $accessCode)
|
||||
->with('success', 'Payment sheet ready — customer screen shows the QR; till sheet is for the operator.');
|
||||
} catch (RuntimeException $e) {
|
||||
return back()->withInput()->with('error', $e->getMessage());
|
||||
|
||||
@@ -230,6 +230,7 @@ class TicketController extends Controller
|
||||
if ($request->expectsJson() || $request->ajax()) {
|
||||
return response()->json([
|
||||
'checkout_url' => $result['checkout_url'],
|
||||
'access_code' => $result['access_code'] ?? '',
|
||||
'sale_id' => $sale->id,
|
||||
]);
|
||||
}
|
||||
@@ -237,6 +238,7 @@ class TicketController extends Controller
|
||||
return redirect()
|
||||
->route('pos.tickets.show', $sale)
|
||||
->with('checkout_url', $result['checkout_url'])
|
||||
->with('access_code', $result['access_code'] ?? '')
|
||||
->with('success', 'Payment sheet ready — hand the device to the customer for card or MoMo.');
|
||||
} catch (RuntimeException $e) {
|
||||
return back()->with('error', $e->getMessage());
|
||||
|
||||
@@ -132,6 +132,7 @@ class MerchantGatewayService
|
||||
|
||||
return [
|
||||
'checkout_url' => (string) $checkout['checkout_url'],
|
||||
'access_code' => (string) ($checkout['access_code'] ?? ''),
|
||||
'reference' => (string) $checkout['reference'],
|
||||
'provider' => 'ladill_pay',
|
||||
];
|
||||
@@ -186,6 +187,7 @@ class MerchantGatewayService
|
||||
|
||||
return [
|
||||
'checkout_url' => $url,
|
||||
'access_code' => (string) ($response->json('data.access_code') ?? ''),
|
||||
'reference' => (string) ($response->json('data.reference') ?: $reference),
|
||||
'provider' => PaymentGatewaySetting::PROVIDER_PAYSTACK,
|
||||
];
|
||||
|
||||
@@ -362,7 +362,11 @@ class PosSaleService
|
||||
'payment_reference' => $checkout['reference'],
|
||||
])->save();
|
||||
|
||||
return ['payment' => $payment, 'checkout_url' => $checkout['checkout_url']];
|
||||
return [
|
||||
'payment' => $payment,
|
||||
'checkout_url' => $checkout['checkout_url'],
|
||||
'access_code' => (string) ($checkout['access_code'] ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
public function completePayPayment(string $reference): PosPayment
|
||||
@@ -577,6 +581,7 @@ class PosSaleService
|
||||
return [
|
||||
'sale' => $sale->fresh('lines'),
|
||||
'checkout_url' => $checkoutUrl,
|
||||
'access_code' => (string) ($checkout['access_code'] ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user