Skip to content

fix: add quickpay daily spend limit - #1159

Open
ovitrif wants to merge 25 commits into
masterfrom
fix/require-payment-pin-for-quickpay
Open

fix: add quickpay daily spend limit#1159
ovitrif wants to merge 25 commits into
masterfrom
fix/require-payment-pin-for-quickpay

Conversation

@ovitrif

@ovitrif ovitrif commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

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

  • Keep QuickPay confirmation-free and PIN-free while under the per-tx threshold and daily cap
  • Add a daily limit multiplier on QuickPay settings (1, 3, 5, 10, 50; default 5)
  • Daily cap is threshold × multiplier in USD cents; spend rolls forward on the local calendar day
  • Reserve QuickPay spend in USD cents before payInvoice; remember the reservation before pending-track; keep on Success/Pending, release on confirmed failure
  • Over the daily cap → Confirm (payment PIN only if that setting is on)
  • Unlock/lock scan deferral from fix: secure shop payments and locked links #1158
  • Slider: labels included in layout bounds; tap settles from the current value (no jump back to the first on-screen value)

Preview

QuickPay Settings Over Cap → Confirm + PIN
slider.mp4
1159-over-daily-cap-confirm-pin.mp4
Screenshot

QA Notes

  • Unit: AppViewModelSendFlowTest.kt, CacheStoreTest.kt, QuickPayViewModelTest.kt
  • Settings → QuickPay: enable QuickPay, set threshold and daily multiplier; confirm the resolved daily $ copy updates
  • Unlocked, under per-tx and daily cap, with PIN for payments on → QuickPay (no payment PIN)
  • Exhaust or exceed the daily cap → Confirm; payment PIN if enabled
  • Cold start / locked with PIN → scan stays deferred until unlock (fix: secure shop payments and locked links #1158), then follows the rules above
  • Slider tap between steps: knob animates from the current value to the closest step (no flash to the value from first open)

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a persisted, configurable daily spending cap for PIN-free QuickPay and routes over-cap payments through the normal confirmation flow.

  • Stores the daily multiplier, calendar-day spend, and payment-hash reservations.
  • Reserves spend before submitting a payment and reconciles reservations on success, pending resolution, or failure.
  • Updates QuickPay settings and slider behavior, including layout, accessibility, and RTL handling.
  • Adds unit and UI coverage for daily-cap accounting, payment lifecycle behavior, and slider mapping.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains in the eligible follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
app/src/main/java/to/bitkit/repositories/QuickPayRepo.kt Introduces persisted calendar-day spend accounting, cap checks, and hash-bound reservation lifecycle operations.
app/src/main/java/to/bitkit/viewmodels/QuickPayViewModel.kt Integrates spend reservation with payment submission and success, pending, failure, and confirmation-fallback outcomes.
app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt Delegates QuickPay eligibility to the repository and reconciles reservations from asynchronous payment events.
app/src/main/java/to/bitkit/ui/components/Slider.kt Reworks the discrete slider to include labels in layout bounds and support current-value animation, accessibility semantics, and RTL input.
app/src/main/java/to/bitkit/ui/settings/quickPay/QuickPaySettingsScreen.kt Adds the daily-limit multiplier control and resolved daily-dollar copy to the scrollable QuickPay settings screen.
app/src/main/java/to/bitkit/data/CacheStore.kt Adds serialized QuickPay day-spend and payment-reservation state with backward-compatible defaults.
app/src/main/java/to/bitkit/data/SettingsStore.kt Persists the configurable QuickPay daily-limit multiplier with a default value of five.

Sequence Diagram

sequenceDiagram
    participant User
    participant App as AppViewModel
    participant QP as QuickPayViewModel
    participant Repo as QuickPayRepo
    participant Store as CacheStore
    participant LN as LightningRepo

    User->>App: Scan Lightning payment
    App->>Repo: canApply(amount)
    alt Under transaction threshold and daily cap
        App->>QP: Open QuickPay
        QP->>Repo: tryReserve(amount)
        Repo->>Store: Persist daily spend
        QP->>LN: payInvoice(invoice)
        Repo->>Store: Bind reservation to payment hash
        alt Payment succeeds
            QP->>Repo: clear(hash)
            QP-->>User: Show success
        else Payment remains pending
            QP-->>User: Show pending
        else Payment fails
            QP->>Repo: release(hash)
            Repo->>Store: Restore reserved spend
            QP-->>User: Show failure
        end
    else Over threshold or daily cap
        App-->>User: Open Confirm flow
    end
Loading

Reviews (2): Last reviewed commit: "fix: keep quickpay events and spend in s..." | Re-trigger Greptile

@ovitrif ovitrif changed the title fix: require payment pin for quickpay fix: add quickpay daily spend limit Aug 15, 2026
Comment thread app/src/main/java/to/bitkit/ui/components/Slider.kt Fixed
@ovitrif
ovitrif force-pushed the fix/require-payment-pin-for-quickpay branch from 0807618 to 2e4a4c0 Compare August 15, 2026 18:28
@ovitrif
ovitrif force-pushed the cursor/fix-shop-quickpay-auth-86ae branch from 32b59a5 to 49ab192 Compare August 15, 2026 18:28
@ovitrif ovitrif self-assigned this Aug 15, 2026
Base automatically changed from cursor/fix-shop-quickpay-auth-86ae to master August 15, 2026 23:02
@ovitrif
ovitrif force-pushed the fix/require-payment-pin-for-quickpay branch from 2e4a4c0 to 7b9ea19 Compare August 15, 2026 23:03
ben-kaufman

This comment was marked as resolved.

@ovitrif
ovitrif force-pushed the fix/require-payment-pin-for-quickpay branch from e4a57bd to 4761c75 Compare August 18, 2026 14:44
ben-kaufman

This comment was marked as resolved.

@ovitrif
ovitrif requested a review from ben-kaufman August 18, 2026 18:43
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/CacheStoreTest.kt Fixed
@jvsena42

This comment was marked as resolved.

# Conflicts:
#	app/src/main/java/to/bitkit/repositories/PendingPaymentRepo.kt
#	app/src/main/java/to/bitkit/ui/screens/wallets/send/SendPendingScreen.kt
#	app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt
#	app/src/main/java/to/bitkit/viewmodels/QuickPayViewModel.kt
#	app/src/test/java/to/bitkit/viewmodels/AppViewModelSendFlowTest.kt
@jvsena42

This comment was marked as resolved.

@ovitrif

ovitrif commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

could update on design figma.com/design/ltqvnKiejWj0JQiqtDf2JJ/Bitkit-Wallet?node-id=40364-134558&m=dev

Was planning to tag @aldertnl here, but I also added comment with screenshots to Figma 👍🏻 .

Comment thread app/src/main/java/to/bitkit/data/CacheStore.kt Outdated
@ovitrif

ovitrif commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

Drafted to fix the issues surfaced in the latest iOS review round.

@ovitrif
ovitrif marked this pull request as draft August 19, 2026 13:58
@ovitrif ovitrif removed this from the 2.5.0 milestone Aug 19, 2026
@ovitrif
ovitrif marked this pull request as ready for review August 19, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: add quickpay daily spend limit

4 participants