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

feat(api): Adds support to change reveue_recovery_retry_algorithm_type using UpdateProfileAPI (V2) (#8858)

CHALLA NISHANTH BABU9c6f0b7cfff7
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index f203570636..50ba4dce61 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2999,6 +2999,11 @@ pub struct ProfileUpdate {
/// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
#[schema(value_type = Option<MerchantCountryCode>, example = "840")]
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+
+ /// Inidcates the state of revenue recovery algorithm type
+ #[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
+ pub revenue_recovery_retry_algorithm_type:
+ Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 1ea3973313..4408987266 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -1379,6 +1379,7 @@ pub struct ProfileGeneralUpdate {
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+ pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
}
#[cfg(feature = "v2")]
@@ -1459,6 +1460,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details,
merchant_category_code,
merchant_country_code,
+ revenue_recovery_retry_algorithm_type,
} = *update;
Self {
profile_name,
@@ -1505,7 +1507,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled,
merchant_business_country,
- revenue_recovery_retry_algorithm_type: None,
+ revenue_recovery_retry_algorithm_type,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled,
is_external_vault_enabled,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 8c6165c48e..7d625a7839 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -4081,6 +4081,8 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
}
};
+ let revenue_recovery_retry_algorithm_type = self.revenue_recovery_retry_algorithm_type;
+
Ok(domain::ProfileUpdate::Update(Box::new(
domain::ProfileGeneralUpdate {
profile_name: self.profile_name,
@@ -4130,6 +4132,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
.map(ForeignInto::foreign_into),
merchant_category_code: self.merchant_category_code,
merchant_country_code: self.merchant_country_code,
+ revenue_recovery_retry_algorithm_type,
},
)))
}