Overview
src/store/slices/ payment-related store persists pendingTransactionId and isProcessingPayment: true across app restarts via Zustand persist. If the app crashes or is force-quit during a payment transaction, the user relaunches to see the payment processing spinner indefinitely. No timeout or recovery logic clears this stale state.
Specifications
Features:
- On app launch, if
isProcessingPayment === true, verify transaction status via /api/payments/:id/status
- If server reports
completed or failed, update local state accordingly
- If server unreachable, show 'Payment status unknown — tap to check' UI
isProcessingPayment never remains true for > 5 minutes without a status check
Tasks:
- In app init sequence, check persisted payment state
- If stale
isProcessingPayment, call checkTransactionStatus(pendingTransactionId)
- On 200: update subscription state and clear pending flags
- On 404/error: clear pending flags and show failed state
- Add unit test for stale state recovery on launch
Impacted Files:
- Payment store slice
src/services/appInit.ts or App.tsx
src/services/mobilePayments.ts
Acceptance Criteria
- App relaunched after payment crash checks transaction status within 5 seconds
- Stale
isProcessingPayment: true is resolved before home screen renders
- Payment spinner does not show indefinitely after crash
- Unit test covers completed, failed, and unreachable server states
Overview
src/store/slices/payment-related store persistspendingTransactionIdandisProcessingPayment: trueacross app restarts via Zustandpersist. If the app crashes or is force-quit during a payment transaction, the user relaunches to see the payment processing spinner indefinitely. No timeout or recovery logic clears this stale state.Specifications
Features:
isProcessingPayment === true, verify transaction status via/api/payments/:id/statuscompletedorfailed, update local state accordinglyisProcessingPaymentnever remainstruefor > 5 minutes without a status checkTasks:
isProcessingPayment, callcheckTransactionStatus(pendingTransactionId)Impacted Files:
src/services/appInit.tsorApp.tsxsrc/services/mobilePayments.tsAcceptance Criteria
isProcessingPayment: trueis resolved before home screen renders