Repository navigation
fix: pay first onchain subscription period in one swipe - #1422
Conversation
|
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
92c274c to
06e58ea
Compare
d6855b0 to
3e7f59d
Compare
3e7f59d to
650bbe2
Compare
650bbe2 to
0f0b4c3
Compare
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Drops the Lightning-only condition from SendUiState.shouldAutomaticallyPay, so the first on-chain subscription period is paid from the Review swipe, and keeps the Review & Subscribe layout on screen while it sends. Reviewed 0f0b4c3, full tier, reasoned from the code and CI: on the Bitkit track an auto review does not build an Android branch here.
What I checked, and 4 candidates I ruled out
Read in full: SendConfirmScreen.kt (screen and SendConfirmContent), SubscriptionsScreen.kt review path, the SendConfirm route in SendSheet.kt, onStartInitialSubscriptionPayment, onSwipeToPay, handleSanityChecks and acceptSubscriptionAndStartPayment in AppViewModel.kt
CI: CI and Lint green (build, testDevDebugUnitTest, detekt); the e2e shards were still running at review time
Ruled out
- On-chain auto-pay firing before the fee is known:
handleSanityCheckscomputes the fee itself throughlightningRepo.calculateTotalFeeand still raises the fee-over-50% and fee-over-$10 warnings, so the on-chain checks run on the automatic path too. - Overlay hiding the warning or biometric prompt:
AutoPayOverlaysits underBiometricsViewand the sanityAppAlertDialog, and dismissing a warning still sendsCancelInitialSubscriptionPayment. - Hardware wallet paying without the device:
shouldAutomaticallyPaystill requireshardwareWalletId == null, covered byinitial hardware subscription payment requires confirmation. - Overlay matching the wrong subscription: the lookup in
SendSheet.ktkeys on bothpaymentRequestIdandcounterparty, the same pairPaykitSubscriptionIduses; no match falls back to the existing spinner.
Merge confidence: 4/5, no findings and the change is covered by AppViewModelSendFlowTest.kt, but the e2e shards were still pending and the branch was not built here.
0f0b4c3 to
0a3c71b
Compare
|
Two independent reviews, nothing blocking a merge. worth doing, does not block
nits
|
0a3c71b to
bb06844
Compare
|
Went through the review; all four points are addressed.
|
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Re-reviewed the full PR at d60477987 after the comparison base changed since the saved assessment. No coverage baseline was supplied, so inherited coverage is empty and this pass covers the diff from merge base ff0ca52ee.
No new actionable code findings.
Accepting a subscription starts its first on-chain payment from the Review swipe after coin preselection and a positive fee estimate finish. The fee-ratio warning and the broadcast both use those preselected coins. A missing or zero fee, or automatic selection that produced no coins, leaves the regular send confirmation open. Manual coin selection opens the picker and then keeps that confirmation for a second swipe. A hardware wallet still stops there for signing. The fee-ratio warning runs when no USD rate is available; the over-$100 amount check and the over-$10 fee check still need a rate.
The fee-coin concern on 02420758 is addressed here: the automatic start joins the on-chain refresh job before the sanity checks. The missing-rate skip on this revision's discussion is addressed in d60477987.
Compared with bitkit-ios#881 at 83f77dd4 for this flow. The single swipe, the fee gate, the second swipe after manual coin selection, and the fee-ratio check without a USD rate agree.
CI, including testDevDebugUnitTest, lint, and end-to-end passed on this revision. AppViewModelSendFlowTest.kt and SendConfirmScreenTest.kt were inspected and not executed in this review. Device testing: not performed in this review. The author's manual coin-selection recording was made before the rebase onto this base.
The sheet still closes and reopens during the handoff to payment (#1467), and the payment bell still waits until the on-chain proof completes (#1458). Those paths are unchanged in this diff.
Non-blocking consistency suggestions
The paying overlay keeps the subscription card's chevron when the card has no click handler, so it still looks tappable during the send.
Suggested additional test cases
- Android, dev regtest, automatic coin selection, payer with on-chain savings only. Accept a subscription whose first on-chain fee is more than half the amount. The fee warning appears before broadcast, and cancelling it does not broadcast.
- Android, dev regtest, manual coin selection, payer with on-chain savings only and no usable Lightning balance. Accept a 5,000 sat subscription whose first period is due on acceptance. The coin picker opens, the regular confirmation then requires a swipe, the clock review stays away while that payment sends, and the broadcast spends the coins that were selected.
Ready for device testing.
piotr-iohk
left a comment
There was a problem hiding this comment.
Approved at d6047798 after the current code re-review and regtest device retests.
- Normal first on-chain subscription payment: one swipe, loading review, then Subscribed; one 5,000-sat payment plus a 209-sat fee.
- Manual coin selection: picker → choose coins → Continue → regular confirmation → second swipe → the same confirmation stays visible while paying → Subscribed. Logs confirm only the selected 172,945-sat coin was spent, for 5,000 sats plus a 141-sat fee.
The high-fee warning was not exercised on a device. Sheet-handoff flicker and bell-completion timing remain tracked separately in #1467 and #1458.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d604779 to
f729fab
Compare
piotr-iohk
left a comment
There was a problem hiding this comment.
Re-approved at f729fab8. The subscription payment-code patches are unchanged from the tested d6047798; the rebase adds a journey-document update.
Regtest retests on d6047798 covered normal first on-chain payment with one swipe through Subscribed, and manual coin selection with a second swipe on the regular confirmation. Logs confirmed the manual payment spent only the selected coin.
The sheet-handoff fix now inherited from #1469 has not been device-retested here.
|
@piotr-iohk on the non-blocking suggestion that the paying overlay keeps the card's chevron: not changed.
The remaining suggested case (fee above half the amount, warning before broadcast, cancel does not broadcast) is covered by |
Closes #1468
Stacked on #1421.
This PR makes accepting a subscription a single swipe when the first payment is paid on-chain, matching the Subscriptions flow in Figma and the existing Lightning behaviour.
Description
Swipe To Subscribe & Payon the Review sheet only subscribed, then the send confirmation opened with a secondSwipe To Subscribe & Payto pay. Figma shows one swipe from Review & Subscribe to Subscribed, and its flow notes do not limit that to Lightning.SendUiState.shouldAutomaticallyPayno longer requires the Lightning pay method, so the first payment due on acceptance starts by itself for on-chain savings too.First billing period ends … Each period is charged in full.line, which is not in the Figma frame. It was added in ef50785 to disclose that a short first period is charged in full.Swipe To Subscribe, as in Figma, whether or not a first payment is due. It used to readSwipe To Subscribe & Paywhen one was.fix: confirm initial subscription fees, feat: add Paykit subscriptions #1186): the network fee for the first on-chain payment is no longer shown before it is paid.Out of Scope
bitkit-ios: ported in fix: pay first onchain subscription period in one swipe bitkit-ios#881.SubscriptionsScreen.kt: the FigmaAutomatically pay this subscriptionswitch. Follow-up tracked in Subscriptions: unbuilt controls and the swipe colour rule #1276 (item 3): neither platform has an auto-pay setting yet, so later periods are still paid by hand from the Subscription Payment Due notification, and a working switch needs the same background payment path as the item below.AppViewModel.kt: the Review sheet closes and the Send sheet opens during the handoff to payment, which now reads as a flicker of one layout.showSheetsequences it that way on purpose since 0d9dc5d. Tracked in Review & Subscribe sheet closes and reopens before the first subscription payment #1467.SendConfirmScreen.kt: showing the on-chain fee somewhere in the single-swipe flow; Figma has no fee display in this section.AppViewModel.kt: sending the first payment in the background so the swipe only waits for the Paykit request. Follow-up, noted in Subscriptions: unbuilt controls and the swipe colour rule #1276: the payment still runs through the Send sheet state, its PIN/biometric check, the send warnings and the First Payment Failed screen. On the current base the whole wait from swipe to Subscribed is about 83 s on the emulator; it was about five minutes before the Paykit runtime updates.Design
Preview
Pixel 9 emulator, dev build on regtest, payer with on-chain savings only, proposal sent from a second emulator. After: 5,000 sats plus a 141 sat fee left the wallet with one swipe.
Recording of the single swipe on the current base. The wait between the swipe and Subscribed took 83 seconds on the emulator and is sped up 8x; the first and last nine seconds are real time.
subscription_single_swipe_v5.mp4
QA Notes
Journeys
review-and-subscribe.xml— with the first period due on acceptance and on-chain savings only, one swipe keeps the Review and Subscribe layout with the swipe loading and ends on Subscribed with no second swipecancellation-during-confirmation.xml— the first period is now paid on acceptance, so the journey advances the subscription clock and cancels while the next unpaid period is on the send confirmation; not driven on a deviceManual Tests
N/A
Automated Checks
AppViewModelSendFlowTest.kt— an initial on-chain subscription payment starts automatically, stops at the fee warning when the fee is over half the amount, checks the fee of the preselected coins, requires confirmation when the fee is unknown, requires confirmation after manual coin selection, shows the fee warning without a USD rate, and a hardware wallet one still requires confirmationSendConfirmScreenTest.kt— while the first payment is sent the Review & Subscribe layout stays with a settled swipe, and a bare progress indicator shows only when the subscription is missingjust compile,just test,just lint— pass locally;SendConfirmScreenTest.ktcompiles but was not run on a device