Frame POS checkout sheet for till operators.
Deploy Ladill POS / deploy (push) Successful in 1m16s

Use operator-facing copy and merchant email so Card/MoMo checkout is for staff handing the screen to a customer, not self-serve buyers.
This commit is contained in:
isaacclad
2026-07-15 13:23:29 +00:00
parent 69ec45eea6
commit 7c20cf705a
6 changed files with 64 additions and 25 deletions
@@ -186,7 +186,7 @@ class RegisterController extends Controller
return redirect()
->route('pos.sales.show', $sale)
->with('checkout_url', $result['checkout_url'])
->with('success', 'Complete the payment to finish this sale.');
->with('success', 'Payment sheet ready — hand the device to the customer for card or MoMo.');
} catch (RuntimeException $e) {
return back()->withInput()->with('error', $e->getMessage());
}
@@ -237,7 +237,7 @@ class TicketController extends Controller
return redirect()
->route('pos.tickets.show', $sale)
->with('checkout_url', $result['checkout_url'])
->with('success', 'Complete the payment to settle this ticket.');
->with('success', 'Payment sheet ready — hand the device to the customer for card or MoMo.');
} catch (RuntimeException $e) {
return back()->with('error', $e->getMessage());
}
+17 -4
View File
@@ -300,15 +300,22 @@ class PosSaleService
'status' => PosPayment::STATUS_PENDING,
]);
// Till-operator checkout: gateways require an email; use the merchant
// account (not a walk-up customer) so the register can complete Card/MoMo.
$operatorEmail = trim((string) ($merchant->email ?? ''));
if ($operatorEmail === '' || ! str_contains($operatorEmail, '@')) {
$operatorEmail = 'seller+'.($merchant->public_id ?? 'pos').'@checkout.ladill.local';
}
$reference = 'POSP-'.strtoupper(Str::random(16));
$checkout = $this->gateway->initializeCheckout(
$merchant,
$amount,
(string) ($sale->currency ?? 'GHS'),
(string) (trim((string) ($merchant->email ?? '')) !== '' ? $merchant->email : ('seller+'.($merchant->public_id ?? 'pos').'@checkout.ladill.local')),
$operatorEmail,
route('pos.payments.callback'),
$reference,
['title' => 'Ticket '.$sale->reference.' payment', 'pos_sale_id' => $sale->id, 'pos_payment_id' => $payment->id],
['title' => 'Ticket '.$sale->reference.' payment', 'pos_sale_id' => $sale->id, 'pos_payment_id' => $payment->id, 'channel' => 'pos_till'],
);
$payment->forceFill([
@@ -502,14 +509,20 @@ class PosSaleService
$amount = (int) $sale->total_minor;
}
// Till-operator checkout: use merchant email (register staff), not a guest.
$operatorEmail = trim((string) ($merchant->email ?? ''));
if ($operatorEmail === '' || ! str_contains($operatorEmail, '@')) {
$operatorEmail = 'seller+'.($merchant->public_id ?? 'pos').'@checkout.ladill.local';
}
$checkout = $this->gateway->initializeCheckout(
$merchant,
$amount,
(string) ($sale->currency ?? 'GHS'),
(string) (trim((string) ($merchant->email ?? '')) !== '' ? $merchant->email : ('seller+'.($merchant->public_id ?? 'pos').'@checkout.ladill.local')),
$operatorEmail,
$callbackUrl,
$reference,
['title' => 'POS '.$sale->reference, 'pos_sale_id' => $sale->id, 'pos_reference' => $sale->reference],
['title' => 'POS '.$sale->reference, 'pos_sale_id' => $sale->id, 'pos_reference' => $sale->reference, 'channel' => 'pos_till'],
);
$checkoutUrl = $checkout['checkout_url'];