fix(RevenueRecovery): Skip record-back for failed invoices on auto-voiding billing connectors (#8548)

Co-authored-by: Aniket Burman <aniket.burman@Aniket-Burman-JDXHW2PH34.local>
Co-authored-by: Nishanth Challa <nishanth.challa@Nishanth-Challa-C0WGKCFHLF.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Aniket Burman <aniket.burman@192.168.1.3>
Co-authored-by: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com>
This commit is contained in:
Aniket Burman
2025-08-01 16:00:52 +05:30
committed by GitHub
parent e6268d6d5e
commit 82cf2cb146
3 changed files with 10 additions and 49 deletions

View File

@ -192,18 +192,6 @@ impl RevenueRecoveryPaymentsAttemptStatus {
db.as_scheduler()
.retry_process(process_tracker.clone(), schedule_time)
.await?;
} else {
// Record a failure transaction back to Billing Connector
// TODO: Add support for retrying failed outgoing recordback webhooks
record_back_to_billing_connector(
state,
&payment_attempt,
payment_intent,
&revenue_recovery_payment_data.billing_mca,
)
.await
.change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
.attach_printable("Failed to record back the billing connector")?;
}
}
Self::Processing => {
@ -504,17 +492,8 @@ impl Action {
.await
.change_context(errors::RecoveryError::ProcessTrackerFailure)
.attach_printable("Failed to update the process tracker")?;
// Record back to billing connector for terminal status
// TODO: Add support for retrying failed outgoing recordback webhooks
record_back_to_billing_connector(
state,
payment_attempt,
payment_intent,
&revenue_recovery_payment_data.billing_mca,
)
.await
.change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
.attach_printable("Failed to record back the billing connector")?;
Ok(())
}
Self::SuccessfulPayment(payment_attempt) => {
@ -702,18 +681,7 @@ impl Action {
}
Self::TerminalFailure(payment_attempt) => {
// Record a failure transaction back to Billing Connector
// TODO: Add support for retrying failed outgoing recordback webhooks
record_back_to_billing_connector(
state,
payment_attempt,
payment_intent,
&revenue_recovery_payment_data.billing_mca,
)
.await
.change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
.attach_printable("Failed to record back the billing connector")?;
// finish the current psync task
db.as_scheduler()
.finish_process_with_business_status(