Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(router): add fallback to statement descriptor fields when billing descriptor is missing (#10271)

AkshayaFoiger1e5ce25968a9
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index c80c811df5..787d73e087 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -315,6 +315,23 @@ impl PaymentIntent {
.or_else(|| self.statement_descriptor_suffix.clone()),
reference: descriptor.reference.clone(),
})
+ .or_else(|| {
+ // Only build a fallback if at least one descriptor exists
+ if self.statement_descriptor_name.is_some()
+ || self.statement_descriptor_suffix.is_some()
+ {
+ Some(BillingDescriptor {
+ name: None,
+ city: None,
+ phone: None,
+ reference: None,
+ statement_descriptor: self.statement_descriptor_name.clone(),
+ statement_descriptor_suffix: self.statement_descriptor_suffix.clone(),
+ })
+ } else {
+ None
+ }
+ })
}
}