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(revenue_recovery): add revenue recovery config to v2 profile (#15109)

balakrishnad84e2e299b45
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index e5345881b3..d250228272 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -30543,6 +30543,14 @@
],
"nullable": true
},
+ "revenue_recovery_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RevenueRecoveryConfig"
+ }
+ ],
+ "nullable": true
+ },
"is_l2_l3_enabled": {
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
@@ -30867,6 +30875,14 @@
],
"nullable": true
},
+ "revenue_recovery_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RevenueRecoveryConfig"
+ }
+ ],
+ "nullable": true
+ },
"is_l2_l3_enabled": {
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
@@ -32916,6 +32932,59 @@
"cascading"
]
},
+ "RevenueRecoveryConfig": {
+ "type": "object",
+ "description": "Revenue recovery retry configuration for a profile",
+ "required": [
+ "max_retry_count",
+ "billing_connector_retry_threshold"
+ ],
+ "properties": {
+ "max_retry_count": {
+ "type": "integer",
+ "format": "int32",
+ "description": "The maximum number of retries allowed for an invoice. Once this limit is reached, no further retries will be attempted.",
+ "example": "15",
+ "minimum": 0
+ },
+ "billing_connector_retry_threshold": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Maximum number of `billing connector` retries before revenue recovery can start executing retries.",
+ "example": "10",
+ "minimum": 0
+ },
+ "max_hybrid_cascading_retry_count": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Number of cascading (static) retries an invoice may use under the hybrid static + adaptive\nscheme.",
+ "example": "5",
+ "minimum": 0
+ },
+ "grace_period_days": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Grace period, in days from the invoice's billing start, within which retries are allowed.\nDefaults to 30 days when not provided.",
+ "default": 30,
+ "example": "30",
+ "minimum": 0
+ },
+ "enable_partial_authorization": {
+ "type": "boolean",
+ "description": "Allow partial authorization for recovered payments. A value passed in the recovery\npayments API request takes priority over this. Defaults to `false` when not provided.",
+ "default": false,
+ "example": false
+ },
+ "max_hard_decline_retries": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Number of retries allowed on an invoice after a hard decline. Defaults to 0 when not\nprovided.",
+ "default": 0,
+ "example": "0",
+ "minimum": 0
+ }
+ }
+ },
"RevenueRecoveryMetadata": {
"type": "object",
"description": "Revenue recovery metadata for merchant connector account",
@@ -32960,6 +33029,14 @@
"default": false,
"example": false
},
+ "max_hard_decline_retries": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Number of retries allowed on an invoice after a hard decline. Defaults to 0 when not\nprovided.",
+ "default": 0,
+ "example": "0",
+ "minimum": 0
+ },
"billing_account_reference": {
"type": "integer",
"format": "int32",
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index cb2f4a8cec..dc39052796 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -1401,12 +1401,49 @@ pub struct RevenueRecoveryMetadata {
#[serde(default)]
#[schema(default = false, example = false)]
pub enable_partial_authorization: bool,
+ /// Number of retries allowed on an invoice after a hard decline. Defaults to 0 when not
+ /// provided.
+ #[serde(default)]
+ #[schema(value_type = u16, default = 0, example = "0")]
+ pub max_hard_decline_retries: u16,
/// Billing account reference id is payment gateway id at billing connector end.
/// Merchants need to provide a mapping between these merchant connector account and the corresponding account reference IDs for each `billing connector`.
#[schema(value_type = u16, example = r#"{ "mca_vDSg5z6AxnisHq5dbJ6g": "stripe_123", "mca_vDSg5z6AumisHqh4x5m1": "adyen_123" }"#)]
pub billing_account_reference: HashMap<id_type::MerchantConnectorAccountId, String>,
}
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
+/// Revenue recovery retry configuration for a profile
+pub struct RevenueRecoveryConfig {
+ /// The maximum number of retries allowed for an invoice. Once this limit is reached, no further retries will be attempted.
+ #[schema(value_type = u16, example = "15")]
+ pub max_retry_count: u16,
+ /// Maximum number of `billing connector` retries before revenue recovery can start executing retries.
+ #[schema(value_type = u16, example = "10")]
+ pub billing_connector_retry_threshold: u16,
+ /// Number of cascading (static) retries an invoice may use under the hybrid static + adaptive
+ /// scheme.
+ #[serde(default)]
+ #[schema(value_type = u16, example = "5")]
+ pub max_hybrid_cascading_retry_count: u16,
+ /// Grace period, in days from the invoice's billing start, within which retries are allowed.
+ /// Defaults to 30 days when not provided.
+ #[serde(default = "default_grace_period_days")]
+ #[schema(value_type = u16, default = 30, example = "30")]
+ pub grace_period_days: u16,
+ /// Allow partial authorization for recovered payments. A value passed in the recovery
+ /// payments API request takes priority over this. Defaults to `false` when not provided.
+ #[serde(default)]
+ #[schema(default = false, example = false)]
+ pub enable_partial_authorization: bool,
+ /// Number of retries allowed on an invoice after a hard decline. Defaults to 0 when not
+ /// provided.
+ #[serde(default)]
+ #[schema(value_type = u16, default = 0, example = "0")]
+ pub max_hard_decline_retries: u16,
+}
+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum MerchantAccountData {
@@ -2784,6 +2821,9 @@ pub struct ProfileCreate {
/// The surcharge connector details for calculating external surcharge
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+ /// Revenue recovery retry configuration for this profile
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -3193,6 +3233,9 @@ pub struct ProfileResponse {
/// The surcharge connector details for calculating external surcharge
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+ /// Revenue recovery retry configuration for this profile
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -3568,6 +3611,9 @@ pub struct ProfileUpdate {
/// The surcharge connector details for calculating external surcharge
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+
+ /// Revenue recovery retry configuration for this profile
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index a04c911140..8633a59f65 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -337,6 +337,7 @@ pub struct Profile {
pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
impl Profile {
@@ -417,6 +418,7 @@ pub struct ProfileNew {
pub is_l2_l3_enabled: Option<bool>,
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[cfg(feature = "v2")]
@@ -483,6 +485,7 @@ pub struct ProfileUpdateInternal {
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
pub apple_pay_certificates: Option<serde_json::Value>,
pub apple_pay_certificates_encrypted: Option<Encryption>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
@@ -699,6 +702,27 @@ pub struct RevenueRecoveryAlgorithmData {
common_utils::impl_to_sql_from_sql_json!(RevenueRecoveryAlgorithmData);
+fn default_grace_period_days() -> u16 {
+ 30
+}
+
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
+#[diesel(sql_type = diesel::sql_types::Jsonb)]
+pub struct RevenueRecoveryConfig {
+ pub max_retry_count: u16,
+ pub billing_connector_retry_threshold: u16,
+ #[serde(default)]
+ pub max_hybrid_cascading_retry_count: u16,
+ #[serde(default = "default_grace_period_days")]
+ pub grace_period_days: u16,
+ #[serde(default)]
+ pub enable_partial_authorization: bool,
+ #[serde(default)]
+ pub max_hard_decline_retries: u16,
+}
+
+common_utils::impl_to_sql_from_sql_json!(RevenueRecoveryConfig);
+
/// Configuration for payment method blocking based on card attributes
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index 2e1d885ad6..f8758e85b1 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -345,6 +345,9 @@ pub struct RevenueRecoveryMetadata {
/// Whether payments recovered through this billing connector allow partial authorization.
#[serde(default)]
pub enable_partial_authorization: bool,
+ /// Number of retries allowed on an invoice after a hard decline. Defaults to 0 when not set.
+ #[serde(default)]
+ pub max_hard_decline_retries: u16,
/// Billing account reference id is payment gateway id at billing connector end.
/// Merchants need to provide a mapping between these merchant connector account and the corresponding
/// account reference IDs for each `billing connector`.
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index b64d56099d..d9d389dfde 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -333,6 +333,7 @@ diesel::table! {
revenue_recovery_retry_algorithm_data -> Nullable<Jsonb>,
#[max_length = 16]
split_txns_enabled -> Nullable<Varchar>,
+ revenue_recovery_config -> Nullable<Jsonb>,
}
}
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index e7f276bf1c..d4f08c2030 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -8,13 +8,13 @@ use common_utils::{
ext_traits::{OptionExt, ValueExt},
pii,
};
-#[cfg(feature = "v2")]
-use diesel_models::business_profile::RevenueRecoveryAlgorithmData;
use diesel_models::business_profile::{
AuthenticationConnectorDetails, BusinessPaymentLinkConfig, BusinessPayoutLinkConfig,
CardTestingGuardConfig, ExternalVaultConnectorDetails, PaymentMethodBlockingConfig,
SurchargeConnectorDetails, WebhookDetails,
};
+#[cfg(feature = "v2")]
+use diesel_models::business_profile::{RevenueRecoveryAlgorithmData, RevenueRecoveryConfig};
use error_stack::ResultExt;
use hyperswitch_masking::{ExposeInterface, Secret};
use router_env::logger;
@@ -692,6 +692,7 @@ pub struct Profile {
pub is_manual_retry_enabled: Option<bool>,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[cfg(feature = "v2")]
@@ -752,6 +753,7 @@ pub struct ProfileSetter {
pub split_txns_enabled: common_enums::SplitTxnsEnabled,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[cfg(feature = "v2")]
@@ -818,6 +820,7 @@ impl From<ProfileSetter> for Profile {
is_manual_retry_enabled: None,
billing_processor_id: value.billing_processor_id,
surcharge_connector_details: value.surcharge_connector_details,
+ revenue_recovery_config: value.revenue_recovery_config,
}
}
}
@@ -882,6 +885,7 @@ pub struct ProfileDbBuilder {
pub is_manual_retry_enabled: Option<bool>,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[cfg(feature = "v2")]
@@ -948,6 +952,7 @@ impl From<ProfileDbBuilder> for Profile {
is_manual_retry_enabled: value.is_manual_retry_enabled,
billing_processor_id: value.billing_processor_id,
surcharge_connector_details: value.surcharge_connector_details,
+ revenue_recovery_config: value.revenue_recovery_config,
}
}
}
@@ -1321,6 +1326,7 @@ pub struct ProfileGeneralUpdate {
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+ pub revenue_recovery_config: Option<RevenueRecoveryConfig>,
}
#[cfg(feature = "v2")]
diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
index 416fa19662..4847a701aa 100644
--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
@@ -409,6 +409,8 @@ pub struct RevenueRecoveryMetadata {
pub grace_period_days: u16,
#[serde(default)]
pub enable_partial_authorization: bool,
+ #[serde(default)]
+ pub max_hard_decline_retries: u16,
pub mca_reference: AccountReferenceMap,
}
@@ -864,6 +866,7 @@ impl From<MerchantConnectorAccountFeatureMetadata>
.max_hybrid_cascading_retry_count,
grace_period_days: recovery_metadata.grace_period_days,
enable_partial_authorization: recovery_metadata.enable_partial_authorization,
+ max_hard_decline_retries: recovery_metadata.max_hard_decline_retries,
billing_account_reference: DieselBillingAccountReference(
recovery_metadata.mca_reference.recovery_to_billing,
),
@@ -891,6 +894,7 @@ impl From<DieselMerchantConnectorAccountFeatureMetadata>
.max_hybrid_cascading_retry_count,
grace_period_days: recovery_metadata.grace_period_days,
enable_partial_authorization: recovery_metadata.enable_partial_authorization,
+ max_hard_decline_retries: recovery_metadata.max_hard_decline_retries,
mca_reference: AccountReferenceMap {
recovery_to_billing: recovery_metadata.billing_account_reference.0,
billing_to_recovery,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 0e87ebfd7d..5613341c66 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -299,6 +299,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::BusinessPayoutLinkConfig,
api_models::admin::MerchantConnectorAccountFeatureMetadata,
api_models::admin::RevenueRecoveryMetadata,
+ api_models::admin::RevenueRecoveryConfig,
api_models::admin::SurchargeConnectorDetails,
api_models::customers::CustomerRequest,
api_models::customers::CustomerUpdateRequest,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 23fdd43619..38736e4d04 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3969,6 +3969,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
surcharge_connector_details: self
.surcharge_connector_details
.map(ForeignInto::foreign_into),
+ revenue_recovery_config: self.revenue_recovery_config.map(ForeignInto::foreign_into),
}))
}
}
@@ -4594,6 +4595,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
surcharge_connector_details: self
.surcharge_connector_details
.map(ForeignInto::foreign_into),
+ revenue_recovery_config: self
+ .revenue_recovery_config
+ .map(ForeignInto::foreign_into),
},
)))
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 941881286a..aeffaa4fdc 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -1624,6 +1624,7 @@ impl ForeignFrom<&domain::MerchantConnectorAccountFeatureMetadata>
grace_period_days: revenue_recovery_metadata.grace_period_days,
enable_partial_authorization: revenue_recovery_metadata
.enable_partial_authorization,
+ max_hard_decline_retries: revenue_recovery_metadata.max_hard_decline_retries,
billing_account_reference: revenue_recovery_metadata
.mca_reference
.recovery_to_billing
@@ -1658,6 +1659,7 @@ impl ForeignTryFrom<&api_models::admin::MerchantConnectorAccountFeatureMetadata>
grace_period_days: revenue_recovery_metadata.grace_period_days,
enable_partial_authorization: revenue_recovery_metadata
.enable_partial_authorization,
+ max_hard_decline_retries: revenue_recovery_metadata.max_hard_decline_retries,
mca_reference,
})
})
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index bd7ed24850..2846bcd883 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -388,6 +388,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
surcharge_connector_details: item
.surcharge_connector_details
.map(ForeignInto::foreign_into),
+ revenue_recovery_config: item.revenue_recovery_config.map(ForeignInto::foreign_into),
})
}
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 6b3f9a3d7b..67246f222c 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -2466,6 +2466,38 @@ impl ForeignFrom<diesel_models::business_profile::SurchargeConnectorDetails>
}
}
+#[cfg(feature = "v2")]
+impl ForeignFrom<api_models::admin::RevenueRecoveryConfig>
+ for diesel_models::business_profile::RevenueRecoveryConfig
+{
+ fn foreign_from(item: api_models::admin::RevenueRecoveryConfig) -> Self {
+ Self {
+ max_retry_count: item.max_retry_count,
+ billing_connector_retry_threshold: item.billing_connector_retry_threshold,
+ max_hybrid_cascading_retry_count: item.max_hybrid_cascading_retry_count,
+ grace_period_days: item.grace_period_days,
+ enable_partial_authorization: item.enable_partial_authorization,
+ max_hard_decline_retries: item.max_hard_decline_retries,
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
+impl ForeignFrom<diesel_models::business_profile::RevenueRecoveryConfig>
+ for api_models::admin::RevenueRecoveryConfig
+{
+ fn foreign_from(item: diesel_models::business_profile::RevenueRecoveryConfig) -> Self {
+ Self {
+ max_retry_count: item.max_retry_count,
+ billing_connector_retry_threshold: item.billing_connector_retry_threshold,
+ max_hybrid_cascading_retry_count: item.max_hybrid_cascading_retry_count,
+ grace_period_days: item.grace_period_days,
+ enable_partial_authorization: item.enable_partial_authorization,
+ max_hard_decline_retries: item.max_hard_decline_retries,
+ }
+ }
+}
+
impl ForeignFrom<api_models::admin::CardTestingGuardConfig>
for diesel_models::business_profile::CardTestingGuardConfig
{
diff --git a/crates/storage_impl/src/business_profile.rs b/crates/storage_impl/src/business_profile.rs
index a392d5fa64..2c2efca9df 100644
--- a/crates/storage_impl/src/business_profile.rs
+++ b/crates/storage_impl/src/business_profile.rs
@@ -1776,6 +1776,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
split_txns_enabled,
billing_processor_id,
surcharge_connector_details,
+ revenue_recovery_config,
} = *update;
Self {
profile_name,
@@ -1835,6 +1836,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config,
}
}
domain::ProfileUpdate::RoutingAlgorithmUpdate {
@@ -1897,6 +1899,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -1957,6 +1960,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -2017,6 +2021,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
@@ -2077,6 +2082,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -2137,6 +2143,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
@@ -2197,6 +2204,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
@@ -2257,6 +2265,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -2317,6 +2326,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::RevenueRecoveryAlgorithmUpdate {
revenue_recovery_retry_algorithm_type,
@@ -2378,6 +2388,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates: None,
apple_pay_certificates_encrypted: None,
+ revenue_recovery_config: None,
},
domain::ProfileUpdate::ApplePayCertificateCacheUpdate {
apple_pay_certificates,
@@ -2439,6 +2450,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
surcharge_connector_details: None,
apple_pay_certificates,
apple_pay_certificates_encrypted,
+ revenue_recovery_config: None,
},
}
}
@@ -2525,6 +2537,7 @@ impl Conversion for domain::Profile {
always_enable_overcapture: None,
billing_processor_id: self.billing_processor_id,
surcharge_connector_details: self.surcharge_connector_details,
+ revenue_recovery_config: self.revenue_recovery_config,
network_tokenization_credentials: None,
payment_method_blocking: None,
apple_pay_certificates: None,
@@ -2632,6 +2645,7 @@ impl Conversion for domain::Profile {
is_manual_retry_enabled: item.is_manual_retry_enabled,
billing_processor_id: item.billing_processor_id,
surcharge_connector_details: item.surcharge_connector_details,
+ revenue_recovery_config: item.revenue_recovery_config,
}
.into(),
)
@@ -2708,6 +2722,7 @@ impl Conversion for domain::Profile {
split_txns_enabled: Some(self.split_txns_enabled),
billing_processor_id: self.billing_processor_id,
surcharge_connector_details: self.surcharge_connector_details,
+ revenue_recovery_config: self.revenue_recovery_config,
payment_method_blocking: None,
})
}
diff --git a/v2_compatible_migrations/2026-10-30-000001_add_revenue_recovery_config_in_business_profile/down.sql b/v2_compatible_migrations/2026-10-30-000001_add_revenue_recovery_config_in_business_profile/down.sql
new file mode 100644
index 0000000000..f93d922c86
--- /dev/null
+++ b/v2_compatible_migrations/2026-10-30-000001_add_revenue_recovery_config_in_business_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS revenue_recovery_config;
diff --git a/v2_compatible_migrations/2026-10-30-000001_add_revenue_recovery_config_in_business_profile/up.sql b/v2_compatible_migrations/2026-10-30-000001_add_revenue_recovery_config_in_business_profile/up.sql
new file mode 100644
index 0000000000..e0c86977a7
--- /dev/null
+++ b/v2_compatible_migrations/2026-10-30-000001_add_revenue_recovery_config_in_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS revenue_recovery_config JSONB;