mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	refactor(router): remove connector_account_details and connector_webhook_details in merchant_connector_account list response (#5457)
				
					
				
			This commit is contained in:
		 Sai Harsha Vardhan
					Sai Harsha Vardhan
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							db26d32d84
						
					
				
				
					commit
					45a149418f
				
			| @ -2509,7 +2509,7 @@ pub async fn retrieve_payment_connector( | ||||
| pub async fn list_payment_connectors( | ||||
|     state: SessionState, | ||||
|     merchant_id: id_type::MerchantId, | ||||
| ) -> RouterResponse<Vec<api_models::admin::MerchantConnectorResponse>> { | ||||
| ) -> RouterResponse<Vec<api_models::admin::MerchantConnectorListResponse>> { | ||||
|     let store = state.store.as_ref(); | ||||
|     let key_manager_state = &(&state).into(); | ||||
|     let key_store = store | ||||
|  | ||||
| @ -922,6 +922,70 @@ impl ForeignFrom<diesel_models::cards_info::CardInfo> for api_models::cards_info | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl TryFrom<domain::MerchantConnectorAccount> | ||||
|     for api_models::admin::MerchantConnectorListResponse | ||||
| { | ||||
|     type Error = error_stack::Report<errors::ApiErrorResponse>; | ||||
|     fn try_from(item: domain::MerchantConnectorAccount) -> Result<Self, Self::Error> { | ||||
|         let payment_methods_enabled = match item.payment_methods_enabled { | ||||
|             Some(val) => serde_json::Value::Array(val) | ||||
|                 .parse_value("PaymentMethods") | ||||
|                 .change_context(errors::ApiErrorResponse::InternalServerError)?, | ||||
|             None => None, | ||||
|         }; | ||||
|         let frm_configs = match item.frm_configs { | ||||
|             Some(frm_value) => { | ||||
|                 let configs_for_frm : Vec<api_models::admin::FrmConfigs> = frm_value | ||||
|                     .iter() | ||||
|                     .map(|config| { config | ||||
|                         .peek() | ||||
|                         .clone() | ||||
|                         .parse_value("FrmConfigs") | ||||
|                         .change_context(errors::ApiErrorResponse::InvalidDataFormat { | ||||
|                             field_name: "frm_configs".to_string(), | ||||
|                             expected_format: r#"[{ "gateway": "stripe", "payment_methods": [{ "payment_method": "card","payment_method_types": [{"payment_method_type": "credit","card_networks": ["Visa"],"flow": "pre","action": "cancel_txn"}]}]}]"#.to_string(), | ||||
|                         }) | ||||
|                     }) | ||||
|                     .collect::<Result<Vec<_>, _>>()?; | ||||
|                 Some(configs_for_frm) | ||||
|             } | ||||
|             None => None, | ||||
|         }; | ||||
|         let response = Self { | ||||
|             connector_type: item.connector_type, | ||||
|             connector_name: item.connector_name, | ||||
|             connector_label: item.connector_label, | ||||
|             merchant_connector_id: item.merchant_connector_id, | ||||
|             test_mode: item.test_mode, | ||||
|             disabled: item.disabled, | ||||
|             payment_methods_enabled, | ||||
|             metadata: item.metadata, | ||||
|             business_country: item.business_country, | ||||
|             business_label: item.business_label, | ||||
|             business_sub_label: item.business_sub_label, | ||||
|             frm_configs, | ||||
|             profile_id: item.profile_id, | ||||
|             applepay_verified_domains: item.applepay_verified_domains, | ||||
|             pm_auth_config: item.pm_auth_config, | ||||
|             status: item.status, | ||||
|             additional_merchant_data: item | ||||
|                 .additional_merchant_data | ||||
|                 .map(|data| { | ||||
|                     let data = data.into_inner(); | ||||
|                     serde_json::Value::parse_value::<router_types::AdditionalMerchantData>( | ||||
|                         data.expose(), | ||||
|                         "AdditionalMerchantData", | ||||
|                     ) | ||||
|                     .attach_printable("Unable to deserialize additional_merchant_data") | ||||
|                     .change_context(errors::ApiErrorResponse::InternalServerError) | ||||
|                 }) | ||||
|                 .transpose()? | ||||
|                 .map(api_models::admin::AdditionalMerchantData::foreign_from), | ||||
|         }; | ||||
|         Ok(response) | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl TryFrom<domain::MerchantConnectorAccount> for api_models::admin::MerchantConnectorResponse { | ||||
|     type Error = error_stack::Report<errors::ApiErrorResponse>; | ||||
|     fn try_from(item: domain::MerchantConnectorAccount) -> Result<Self, Self::Error> { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user