Skip to content

feat(#905): build automated dunning management with configurable retry strategies - #1066

Open
Prozaks wants to merge 1 commit into
Smartdevs17:mainfrom
Prozaks:feat/issue-905-automated-dunning-management
Open

feat(#905): build automated dunning management with configurable retry strategies#1066
Prozaks wants to merge 1 commit into
Smartdevs17:mainfrom
Prozaks:feat/issue-905-automated-dunning-management

Conversation

@Prozaks

@Prozaks Prozaks commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Implements automated dunning management with configurable retry strategies.

Closes #905

Changes

backend/services/billing/dunningService.ts

  • Strategy resolution chain: A/B variant → failure-reason override → plan default → built-in
  • Four backoff policies: fixed, linear, exponential, exponential-with-jitter
  • Jitter decorrelates retry storms that follow a single upstream outage
  • recoveryRate now measured over closed outcomes only — in-flight dunning no longer depresses the metric
  • Added getStrategy(), listRecoveredDunning(); fixed recordSuccessfulCharge return type
  • Hard decline detection via retryable flag prevents futile retries
  • Fixed all compile errors: missing this.templates, this.recoveredEntries, this.getStrategy() references; correct stage reading from DunningConfiguration

backend/services/billing/interfaces.ts

  • Updated IDunningService interface with new method signatures
  • Added getStrategy(), listRecoveredDunning(), optional failureReason on startDunning

backend/services/billing/index.ts

  • Exported new BackoffPolicy type

Tests

  • backend/services/billing/__tests__/dunningService.test.ts: 394 lines covering all strategy paths and backoff policies

Documentation

  • docs/DUNNING_RETRY_STRATEGIES.md: configuration guide with examples

Acceptance Criteria

  • Feature implemented with full functionality
  • Unit tests added with >80% coverage
  • Integration tests for critical paths
  • No regression introduced
  • Documentation updated

Technical Scope

Covers: backend/services/billing/, contracts/subscription/src/

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Prozaks 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! 🚀

Learn more about application limits

…urable retry strategies

- DunningService: strategy resolution (A/B variant > failure-reason override >
  plan default > built-in), four backoff policies: fixed, linear, exponential,
  and exponential-with-jitter
- Jitter decorrelates retry storms following a single upstream outage
- recoveryRate now measured over closed outcomes only (in-flight dunning no
  longer depresses the rate)
- Add getStrategy(), listRecoveredDunning(), fix recordSuccessfulCharge return
- Fix all compile errors: this.templates, this.recoveredEntries,
  this.getStrategy() references resolved; DunningConfiguration stage
  reading corrected
- Add retryable flag for hard decline differentiation
- 394 lines of tests covering all strategy paths and backoff policies
- Add docs/DUNNING_RETRY_STRATEGIES.md with configuration guide

Closes Smartdevs17#905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build automated dunning management with configurable retry strategies

1 participant