Skip to content

[Bug] PaymentStore does not clear pending transaction state on app restart — stale pending UI shown #627

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions