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:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user