Two-step add-funds modal instead of wallet redirect on insufficient balance
Deploy Ladill QR Plus / deploy (push) Successful in 40s
Deploy Ladill QR Plus / deploy (push) Successful in 40s
When a user hits an action they can't afford (e.g. creating a QR code with 0/low balance), open an in-app two-step modal instead of bouncing them to the central wallet page. Step 1 explains pay-as-you-go billing + shows the action cost and current balance; step 2 takes an amount and starts a Paystack checkout via the central identity wallet-topup API, returning the user where they were. - service-topup-modal: rebuilt as two-step (billing explainer -> amount/pay) - IdentityClient::walletTopup + WalletTopupController + POST /wallet/topup - balanceGate.openTopup / qrCustomizer.redirectTopup now prefer the modal, falling back to the wallet page only when no modal is wired - qr-codes index + create render the modal and open it on insufficient balance Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
bbef00b2f0
commit
73faa20fff
@@ -15,6 +15,7 @@
|
||||
balance: @js((float) $wallet->spendableBalance()),
|
||||
price: @js((float) $pricePerQr),
|
||||
topupUrl: @js($topupUrl),
|
||||
topupModalId: 'qr',
|
||||
type: @js(old('type', $prefill['type'] ?? $defaultType ?? 'url')),
|
||||
})">
|
||||
|
||||
@@ -254,5 +255,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Two-step add-funds modal (insufficient balance opens this instead of redirecting to the wallet) --}}
|
||||
<x-user.service-topup-modal
|
||||
id="qr"
|
||||
title="Add funds"
|
||||
:topup-action="route('user.wallet.topup')"
|
||||
:price-per-action="(float) $pricePerQr"
|
||||
action-noun="QR code"
|
||||
:service-balance="(float) $wallet->spendableBalance()"
|
||||
service-balance-label="Wallet balance"
|
||||
:return-url="route('user.qr-codes.create')"
|
||||
:open-on-load="session('open_topup_modal') === 'qr'" />
|
||||
|
||||
</div>
|
||||
</x-user-layout>
|
||||
|
||||
Reference in New Issue
Block a user