fix: add quickpay daily spend limit - #1159
Draft
ovitrif wants to merge 45 commits into
Draft
Conversation
9 tasks
Greptile SummaryThis PR adds a persisted USD-denominated daily spending cap to QuickPay while preserving confirmation-free, PIN-free payments below both limits.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/repositories/QuickPayRepo.kt | Introduces persisted daily-spend calculation, atomic reservation, payment-hash binding, and day-aware release and clearing. |
| app/src/main/java/to/bitkit/viewmodels/QuickPayViewModel.kt | Reserves spend before submitting QuickPay, tracks pending payments, handles fee-inclusive success, and falls back to confirmation when reservation fails. |
| app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt | Integrates the daily-cap eligibility check and reconciles bound QuickPay reservations from global payment events. |
| app/src/main/java/to/bitkit/repositories/PendingPaymentRepo.kt | Caches the latest per-hash resolution so the pending screen can recover events received before initialization. |
| app/src/main/java/to/bitkit/ui/components/Slider.kt | Reworks the stepped slider layout, gesture handling, labels, and accessibility semantics for the new settings controls. |
| app/src/main/java/to/bitkit/ui/settings/quickPay/QuickPaySettingsScreen.kt | Adds the daily-limit multiplier control, resolved daily-limit copy, and vertically scrollable settings content. |
| app/src/main/java/to/bitkit/ui/sheets/SendSheet.kt | Replaces QuickPay with Confirm on reservation fallback and forwards fee-inclusive QuickPay amounts into success details. |
Sequence Diagram
sequenceDiagram
participant UI as Send Sheet
participant QVM as QuickPayViewModel
participant QPR as QuickPayRepo
participant LN as LightningRepo
participant PPR as PendingPaymentRepo
participant AVM as AppViewModel
UI->>QPR: canApply(amount)
alt Under transaction and daily limits
UI->>QVM: pay(data)
QVM->>QPR: tryReserve(amount)
alt Reservation succeeds
QVM->>LN: payInvoice(invoice)
LN-->>QVM: paymentHash
QVM->>QPR: remember(hash, reservation)
QVM->>PPR: track(hash)
alt Payment succeeds
LN-->>AVM: PaymentSuccessful
AVM->>QPR: clear(hash)
AVM->>PPR: resolve(Success)
else Payment fails
LN-->>AVM: PaymentFailed
AVM->>QPR: release(hash)
AVM->>PPR: resolve(Failure)
end
else Reservation fails
QVM-->>UI: FallBackToConfirm
UI->>UI: Replace QuickPay with Confirm
end
else Over a limit
UI->>UI: Open Confirm
end
Reviews (3): Last reviewed commit: "refactor: drop unused quickpay error par..." | Re-trigger Greptile
ovitrif
force-pushed
the
fix/require-payment-pin-for-quickpay
branch
from
August 15, 2026 18:28
0807618 to
2e4a4c0
Compare
ovitrif
force-pushed
the
cursor/fix-shop-quickpay-auth-86ae
branch
from
August 15, 2026 18:28
32b59a5 to
49ab192
Compare
ovitrif
force-pushed
the
fix/require-payment-pin-for-quickpay
branch
from
August 15, 2026 23:03
2e4a4c0 to
7b9ea19
Compare
4 tasks
ovitrif
force-pushed
the
fix/require-payment-pin-for-quickpay
branch
from
August 18, 2026 09:24
7b9ea19 to
f10f4e2
Compare
This was referenced Aug 18, 2026
ovitrif
dismissed
piotr-iohk’s stale review
August 20, 2026 16:29
challenged the dust argument as it drifts from the urgency of this patch
This comment was marked as outdated.
This comment was marked as outdated.
ben-kaufman
reviewed
Aug 20, 2026
ben-kaufman
reviewed
Aug 20, 2026
ben-kaufman
reviewed
Aug 20, 2026
ovitrif
marked this pull request as draft
August 20, 2026 19:17
ovitrif
marked this pull request as ready for review
August 21, 2026 08:14
ovitrif
requested review from
ben-kaufman and
jvsena42
and removed request for
ben-kaufman and
jvsena42
August 21, 2026 08:15
ovitrif
marked this pull request as draft
August 21, 2026 08:28
Collaborator
Author
|
drafted to look into issue flagged by greptile bot on iOS and see if fix needs porting here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1168
Builds on merged #1158 (base is
master).iOS port:
QuickPay stays PIN-free under limits (the point of QuickPay). A hard payment-PIN skip would remove that behavior, so this PR bounds auto-pay with a daily spend multiplier instead. Payments above the daily cap open Confirm, where PIN for payments still applies. Lock-time deferral remains in #1158.
Description
1,3,5,10,50; default5)threshold × multiplierin USD cents; spend rolls forward on the local calendar daysignalCompletion; keep spend on success; release matching-day failure onlyQuickPayRepois a thin facade overQuickPayCoordinator(sessions, in-flight ops, dispatch). Ledger persistence isQuickPaySpendStorein the same file.Preview
slider.mp4
1159-over-daily-cap-confirm-pin.mp4
QA Notes
Manual Tests
$copy updatesregression:Cold start / locked with PIN → scan stays deferred until unlock (fix: secure shop payments and locked links #1158), then follows the rules aboveAutomated Checks
QuickPayRepoTest.kt:reserveBoundsignalCompletionsuccess, failure, and idempotenceQuickPayViewModelTest.kt:AppViewModelSendFlowTest.kt:signalCompletionPendingPaymentRepoTest.ktSendPendingViewModelTest.ktQuickPaySettingsScreenTest.kt