Skip to content

fix(revenue_recovery): return actionable webhook errors - #13719

Open
NISHANTH1221 wants to merge 9 commits into
mainfrom
codex/recovery-webhook-error-responses
Open

fix(revenue_recovery): return actionable webhook errors#13719
NISHANTH1221 wants to merge 9 commits into
mainfrom
codex/recovery-webhook-error-responses

Conversation

@NISHANTH1221

Copy link
Copy Markdown
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Returns actionable responses for revenue recovery webhook failures that cannot succeed on retry.

  • Converts revenue recovery domain errors into specific webhook API errors.
  • Returns an authentication error for failed source verification.
  • Returns an unprocessable response for invalid invoice or transaction data.
  • Identifies missing payment MCA mappings and billing retry-threshold configuration.
  • Returns a failed precondition when the invoice no longer permits recording an attempt.
  • Preserves processing failures for transient internal and downstream errors.
  • Uses the invoice-sync error context when the billing invoice sync response fails.

Stack Dependency

Depends on #13718.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

The incoming webhook handler previously converted every revenue recovery error into a generic 5xx response. Chargebee would therefore retry malformed payloads, missing merchant configuration, and terminal invoice-state failures even though replaying the same event could not resolve them.

Mapping non-retryable failures to specific 4xx responses stops futile webhook retries and exposes the configuration or state that must be corrected. Transient failures remain retryable.

How did you test it?

  • cargo +nightly fmt --all -- --check
  • cargo check --package router --no-default-features --features release,v2,redis-rs
  • git diff --check origin/main..HEAD

Validation was run on the complete stacked branch.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

Related Issue

Closes #13717

@NISHANTH1221
NISHANTH1221 requested review from a team as code owners August 14, 2026 10:26
@NISHANTH1221 NISHANTH1221 added the S-test-ready Status: This PR is ready for cypress-tests label Aug 14, 2026
@NISHANTH1221 NISHANTH1221 self-assigned this Aug 14, 2026
@github-actions github-actions Bot removed the S-test-ready Status: This PR is ready for cypress-tests label Aug 14, 2026
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.

fix(revenue_recovery): return actionable webhook errors

1 participant