Skip to content

Build offline payment queue with service-worker sync #246

Description

@Kingsman-99

Description

The app references a service worker (/sw.js) but there's no offline payment queueing — a payment attempted while offline simply fails. This issue adds an offline queue that auto-submits when connectivity returns.

Technical Context

Involves the service worker setup and a new src/lib/offlineQueue.ts. Failed-due-to-network payment attempts are queued (IndexedDB, not localStorage, since payloads may be larger) and a online event listener triggers automatic resubmission, integrating with NetworkStatus.tsx's existing connectivity detection.

Acceptance Criteria

  • Payment attempts failing specifically due to network unavailability (not contract rejection) are queued, not just error-toasted
  • NetworkStatus.tsx shows a count of queued pending payments when offline
  • On reconnection, queued payments auto-submit in original order; each result (success/failure) surfaces individually
  • Contract-level rejections (e.g. invoice already fully funded) are never queued — only true network failures
  • Unit tests: network-failure vs contract-rejection classification, auto-resubmit-on-reconnect ordering

Metadata

Metadata

Assignees

No one assigned

    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