mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	feat(router): Create a merchant config for enable processor agnostic MIT (#4025)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
		| @ -273,9 +273,9 @@ pub async fn update_business_profile_active_algorithm_ref( | ||||
|  | ||||
| pub async fn get_merchant_connector_agnostic_mandate_config( | ||||
|     db: &dyn StorageInterface, | ||||
|     merchant_id: &str, | ||||
|     business_profile_id: &str, | ||||
| ) -> RouterResult<Vec<routing_types::DetailedConnectorChoice>> { | ||||
|     let key = get_pg_agnostic_mandate_config_key(merchant_id); | ||||
|     let key = get_pg_agnostic_mandate_config_key(business_profile_id); | ||||
|     let maybe_config = db.find_config_by_key(&key).await; | ||||
|  | ||||
|     match maybe_config { | ||||
| @ -312,29 +312,6 @@ pub async fn get_merchant_connector_agnostic_mandate_config( | ||||
|     } | ||||
| } | ||||
|  | ||||
| pub async fn update_merchant_connector_agnostic_mandate_config( | ||||
|     db: &dyn StorageInterface, | ||||
|     merchant_id: &str, | ||||
|     mandate_config: Vec<routing_types::DetailedConnectorChoice>, | ||||
| ) -> RouterResult<Vec<routing_types::DetailedConnectorChoice>> { | ||||
|     let key = get_pg_agnostic_mandate_config_key(merchant_id); | ||||
|     let mandate_config_str = mandate_config | ||||
|         .encode_to_string_of_json() | ||||
|         .change_context(errors::ApiErrorResponse::InternalServerError) | ||||
|         .attach_printable("unable to serialize pg agnostic mandate config during update")?; | ||||
|  | ||||
|     let config_update = configs::ConfigUpdate::Update { | ||||
|         config: Some(mandate_config_str), | ||||
|     }; | ||||
|  | ||||
|     db.update_config_by_key(&key, config_update) | ||||
|         .await | ||||
|         .change_context(errors::ApiErrorResponse::InternalServerError) | ||||
|         .attach_printable("error saving pg agnostic mandate config to db")?; | ||||
|  | ||||
|     Ok(mandate_config) | ||||
| } | ||||
|  | ||||
| pub async fn validate_connectors_in_routing_config( | ||||
|     db: &dyn StorageInterface, | ||||
|     key_store: &domain::MerchantKeyStore, | ||||
| @ -465,8 +442,8 @@ pub fn get_routing_dictionary_key(merchant_id: &str) -> String { | ||||
|  | ||||
| /// Provides the identifier for the specific merchant's agnostic_mandate_config | ||||
| #[inline(always)] | ||||
| pub fn get_pg_agnostic_mandate_config_key(merchant_id: &str) -> String { | ||||
|     format!("pg_agnostic_mandate_{merchant_id}") | ||||
| pub fn get_pg_agnostic_mandate_config_key(business_profile_id: &str) -> String { | ||||
|     format!("pg_agnostic_mandate_{business_profile_id}") | ||||
| } | ||||
|  | ||||
| /// Provides the identifier for the specific merchant's default_config | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shankar Singh C
					Shankar Singh C