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(business_profile): add field in profile for manual retry (#9266)

Sakil Mostak9c11a6e66f7d
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index b1004f4c93..abe54a750e 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -28533,6 +28533,11 @@
"description": "Time interval (in hours) for polling the connector to check dispute statuses",
"example": 2,
"nullable": true
+ },
+ "is_manual_retry_enabled": {
+ "type": "boolean",
+ "description": "Indicates if manual retry for payment is enabled or not",
+ "nullable": true
}
},
"additionalProperties": false
@@ -28858,6 +28863,11 @@
"example": 2,
"nullable": true,
"minimum": 0
+ },
+ "is_manual_retry_enabled": {
+ "type": "boolean",
+ "description": "Indicates if manual retry for payment is enabled or not",
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 0f7ea4a83e..97dea34f0a 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2196,6 +2196,9 @@ pub struct ProfileCreate {
/// Time interval (in hours) for polling the connector to check dispute statuses
#[schema(value_type = Option<i32>, example = 2)]
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+
+ /// Indicates if manual retry for payment is enabled or not
+ pub is_manual_retry_enabled: Option<bool>,
}
#[nutype::nutype(
@@ -2538,6 +2541,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<u32>, example = 2)]
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+
+ /// Indicates if manual retry for payment is enabled or not
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v2")]
@@ -2878,6 +2884,9 @@ pub struct ProfileUpdate {
#[schema(value_type = Option<u32>, example = 2)]
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+
+ /// Indicates if manual retry for payment is enabled or not
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v2")]
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index a51887a94d..46ea87e47e 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -78,6 +78,7 @@ pub struct Profile {
pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@@ -136,6 +137,7 @@ pub struct ProfileNew {
pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@@ -194,6 +196,7 @@ pub struct ProfileUpdateInternal {
pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@@ -249,6 +252,7 @@ impl ProfileUpdateInternal {
merchant_category_code,
merchant_country_code,
dispute_polling_interval,
+ is_manual_retry_enabled,
} = self;
Profile {
profile_id: source.profile_id,
@@ -335,6 +339,7 @@ impl ProfileUpdateInternal {
merchant_category_code: merchant_category_code.or(source.merchant_category_code),
merchant_country_code: merchant_country_code.or(source.merchant_country_code),
dispute_polling_interval: dispute_polling_interval.or(source.dispute_polling_interval),
+ is_manual_retry_enabled: is_manual_retry_enabled.or(source.is_manual_retry_enabled),
}
}
}
@@ -399,6 +404,7 @@ pub struct Profile {
pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -703,6 +709,7 @@ impl ProfileUpdateInternal {
merchant_country_code: merchant_country_code.or(source.merchant_country_code),
dispute_polling_interval: None,
split_txns_enabled: split_txns_enabled.or(source.split_txns_enabled),
+ is_manual_retry_enabled: None,
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index c50499093c..d6dc2a85fc 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -253,6 +253,7 @@ diesel::table! {
#[max_length = 32]
merchant_country_code -> Nullable<Varchar>,
dispute_polling_interval -> Nullable<Int4>,
+ is_manual_retry_enabled -> Nullable<Bool>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 66b007a537..3be4d174ae 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -248,6 +248,7 @@ diesel::table! {
#[max_length = 32]
merchant_country_code -> Nullable<Varchar>,
dispute_polling_interval -> Nullable<Int4>,
+ is_manual_retry_enabled -> Nullable<Bool>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>,
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index de69e50013..f2f93ea5c9 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -84,6 +84,7 @@ pub struct Profile {
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@@ -140,6 +141,7 @@ pub struct ProfileSetter {
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@@ -203,6 +205,7 @@ impl From<ProfileSetter> for Profile {
merchant_category_code: value.merchant_category_code,
merchant_country_code: value.merchant_country_code,
dispute_polling_interval: value.dispute_polling_interval,
+ is_manual_retry_enabled: value.is_manual_retry_enabled,
}
}
}
@@ -268,6 +271,7 @@ pub struct ProfileGeneralUpdate {
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
+ pub is_manual_retry_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@@ -351,6 +355,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code,
dispute_polling_interval,
always_request_extended_authorization,
+ is_manual_retry_enabled,
} = *update;
Self {
@@ -404,6 +409,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code,
merchant_country_code,
dispute_polling_interval,
+ is_manual_retry_enabled,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -460,6 +466,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
@@ -513,6 +520,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -566,6 +574,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -619,6 +628,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -672,6 +682,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -725,6 +736,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
ProfileUpdate::AcquirerConfigMapUpdate {
acquirer_config_map,
@@ -778,6 +790,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_category_code: None,
merchant_country_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
},
}
}
@@ -851,6 +864,7 @@ impl super::behaviour::Conversion for Profile {
merchant_category_code: self.merchant_category_code,
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
+ is_manual_retry_enabled: self.is_manual_retry_enabled,
})
}
@@ -950,6 +964,7 @@ impl super::behaviour::Conversion for Profile {
merchant_category_code: item.merchant_category_code,
merchant_country_code: item.merchant_country_code,
dispute_polling_interval: item.dispute_polling_interval,
+ is_manual_retry_enabled: item.is_manual_retry_enabled,
})
}
.await
@@ -1016,6 +1031,7 @@ impl super::behaviour::Conversion for Profile {
merchant_category_code: self.merchant_category_code,
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
+ is_manual_retry_enabled: self.is_manual_retry_enabled,
})
}
}
@@ -2101,6 +2117,7 @@ impl super::behaviour::Conversion for Profile {
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: None,
split_txns_enabled: Some(self.split_txns_enabled),
+ is_manual_retry_enabled: None,
})
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index e289e63693..70e18b853c 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3476,6 +3476,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
merchant_category_code: self.merchant_category_code,
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
+ is_manual_retry_enabled: self.is_manual_retry_enabled,
}))
}
@@ -3972,6 +3973,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
merchant_category_code: self.merchant_category_code,
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
+ is_manual_retry_enabled: self.is_manual_retry_enabled,
},
)))
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index e821c08cad..d4bfb8b55c 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -1289,6 +1289,7 @@ mod tests {
is_pre_network_tokenization_enabled: false,
merchant_category_code: None,
dispute_polling_interval: None,
+ is_manual_retry_enabled: None,
});
let business_profile = state
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 8035959dd3..e86fbce57e 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -233,6 +233,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
merchant_category_code: item.merchant_category_code,
merchant_country_code: item.merchant_country_code,
dispute_polling_interval: item.dispute_polling_interval,
+ is_manual_retry_enabled: item.is_manual_retry_enabled,
})
}
}
@@ -490,5 +491,6 @@ pub async fn create_profile_from_merchant_account(
merchant_category_code: request.merchant_category_code,
merchant_country_code: request.merchant_country_code,
dispute_polling_interval: request.dispute_polling_interval,
+ is_manual_retry_enabled: request.is_manual_retry_enabled,
}))
}
diff --git a/migrations/2025-09-03-115802_add-is_manual_retry_enabled-to-business_profile/down.sql b/migrations/2025-09-03-115802_add-is_manual_retry_enabled-to-business_profile/down.sql
new file mode 100644
index 0000000000..bc33b68119
--- /dev/null
+++ b/migrations/2025-09-03-115802_add-is_manual_retry_enabled-to-business_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN is_manual_retry_enabled;
\ No newline at end of file
diff --git a/migrations/2025-09-03-115802_add-is_manual_retry_enabled-to-business_profile/up.sql b/migrations/2025-09-03-115802_add-is_manual_retry_enabled-to-business_profile/up.sql
new file mode 100644
index 0000000000..1210d4b149
--- /dev/null
+++ b/migrations/2025-09-03-115802_add-is_manual_retry_enabled-to-business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS is_manual_retry_enabled BOOLEAN;
\ No newline at end of file