fix(#183): implement subscription dunning management#492
Open
rindicomfort wants to merge 2 commits into
Open
Conversation
|
@rindicomfort Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…tion
- Add src/store/dunningStore.ts: Zustand persisted store backed by
AsyncStorage with full dunning lifecycle:
- startDunning: creates a new DunningEntry at the retry stage
- recordPaymentAttempt(success): advances stage on failure using
configurable retry schedule (days 1, 3, 7, 14); removes entry on
success (payment recovered)
- escalateToSupport: moves to suspend stage, pauses automated
retries, logs in_app communication for human review
- overrideDunning: customer-service manual resolution (resolved /
waived / cancelled)
- pauseDunning / resumeDunning / overrideStage: operational controls
- configurePlan: per-plan DunningConfiguration override
- getAnalytics: live breakdown by stage + recovery rate
- Export RETRY_SCHEDULE_DAYS = [1, 3, 7, 14] for UI consumption
- Export useDunningStore from src/store/index.ts
- Add DunningDashboard route to RootStackParamList
- Add src/screens/DunningDashboard.tsx:
- Analytics bar: active count, per-stage breakdown, recovery %
- Retry schedule chips showing days 1 / 3 / 7 / 14
- Filter chips: All / Retrying / Warning / Suspended / Cancelled
- FlatList of DunningEntry cards with stage badge, failed-attempt
count, next-action countdown, and paused indicator
- Bottom-sheet detail panel per entry:
- Full info rows (stage, attempts, timestamps, status)
- Notification log (channel, stage, timestamp)
- Stage override chips (retry / warn / suspend / cancel)
- Actions: Pause/Resume, Manual Payment Override, Escalate to
Support, Mark Resolved, Waive & Remove
- Register DunningDashboard in AppNavigator (SettingsStack)
10b1ed1 to
e5a1ccf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #183
Implements a comprehensive dunning (failed-payment recovery) system with automated retry scheduling, tiered notifications, escalation to human review, manual override, and a React Native dashboard.
Files
src/store/dunningStore.ts(new)Zustand store persisted to AsyncStorage (
subtrackr-dunning):startDunningDunningEntryat theretrystagerecordPaymentAttempt(id, success)escalateToSupportsuspend, pauses retries, logsin_appcomm for human reviewoverrideDunningresolved / waived / cancelledpauseDunning / resumeDunningoverrideStageconfigurePlanDunningConfigurationoverridegetAnalyticsRetry schedule (days): 1 → 3 → 7 → 14 (exported as
RETRY_SCHEDULE_DAYS)Notification tiers: email → push → in_app (SMS-ready via config channels)
Grace period: configurable
suspendAfterDays/cancelAfterDaysinDunningConfigurationsrc/screens/DunningDashboard.tsx(new)React Native dashboard:
Supporting changes
src/store/index.ts— exportsuseDunningStoresrc/navigation/types.ts— addsDunningDashboardroutesrc/navigation/AppNavigator.tsx— registersDunningDashboardscreenAcceptance Criteria
DunningSequence: retry_schedule, notification tiers, escalation triggersuspendAfterDays)