Collect MoMo MSISDN and open waiting page on Pay.
Deploy Ladill Mini / deploy (push) Successful in 42s
Deploy Ladill Mini / deploy (push) Successful in 42s
Payment QR was still Paystack-only: no customer_phone and mobile iframe sheet. Require MoMo number, pass it to Ladill Pay, and full-page redirect for mtn_momo waiting URLs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -25,8 +25,8 @@ class MiniPaymentService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array{amount: float} $data
|
||||
* @return array{payment: MiniPayment, checkout_url: string}
|
||||
* @param array{amount: float, customer_phone?: string} $data
|
||||
* @return array{payment: MiniPayment, checkout_url: string, provider: string}
|
||||
*/
|
||||
public function initiate(QrCode $qrCode, array $data): array
|
||||
{
|
||||
@@ -39,6 +39,11 @@ class MiniPaymentService
|
||||
throw new RuntimeException('Enter an amount greater than zero.');
|
||||
}
|
||||
|
||||
$customerPhone = trim((string) ($data['customer_phone'] ?? ''));
|
||||
if ($customerPhone === '') {
|
||||
throw new RuntimeException('Enter your MoMo number to pay.');
|
||||
}
|
||||
|
||||
$qrCode->loadMissing('user');
|
||||
$amountMinor = (int) round($amountGhs * 100);
|
||||
$reference = 'MINP-'.strtoupper(Str::random(16));
|
||||
@@ -52,7 +57,7 @@ class MiniPaymentService
|
||||
'currency' => $qrCode->content()['currency'] ?? 'GHS',
|
||||
'payer_name' => null,
|
||||
'payer_email' => null,
|
||||
'payer_phone' => null,
|
||||
'payer_phone' => $customerPhone,
|
||||
'payer_note' => null,
|
||||
'status' => MiniPayment::STATUS_PENDING,
|
||||
'payment_reference' => null,
|
||||
@@ -64,6 +69,7 @@ class MiniPaymentService
|
||||
'source_service' => 'mini',
|
||||
'source_ref' => (string) $qrCode->id,
|
||||
'callback_url' => LadillLink::path($qrCode->short_code, 'pay/callback'),
|
||||
'customer_phone' => $customerPhone,
|
||||
'line_items' => [
|
||||
[
|
||||
'name' => $businessName,
|
||||
@@ -93,6 +99,7 @@ class MiniPaymentService
|
||||
return [
|
||||
'payment' => $payment->fresh(),
|
||||
'checkout_url' => $checkoutUrl,
|
||||
'provider' => (string) ($payOrder['provider'] ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user