mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	refactor(merchant_id): create domain type for merchant_id (#5408)
				
					
				
			Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
		| @ -285,7 +285,7 @@ async fn trigger_webhook_to_merchant( | ||||
|         1, | ||||
|         &[metrics::KeyValue::new( | ||||
|             MERCHANT_ID, | ||||
|             business_profile.merchant_id.clone(), | ||||
|             business_profile.merchant_id.get_string_repr().to_owned(), | ||||
|         )], | ||||
|     ); | ||||
|     logger::debug!(outgoing_webhook_response=?response); | ||||
| @ -435,7 +435,7 @@ fn raise_webhooks_analytics_event( | ||||
|     state: SessionState, | ||||
|     trigger_webhook_result: CustomResult<(), errors::WebhooksFlowError>, | ||||
|     content: Option<api::OutgoingWebhookContent>, | ||||
|     merchant_id: String, | ||||
|     merchant_id: common_utils::id_type::MerchantId, | ||||
|     event: domain::Event, | ||||
| ) { | ||||
|     let error = if let Err(error) = trigger_webhook_result { | ||||
| @ -649,7 +649,7 @@ enum ScheduleWebhookRetry { | ||||
| async fn update_event_if_client_error( | ||||
|     state: SessionState, | ||||
|     merchant_key_store: domain::MerchantKeyStore, | ||||
|     merchant_id: &str, | ||||
|     merchant_id: &common_utils::id_type::MerchantId, | ||||
|     event_id: &str, | ||||
|     error_message: String, | ||||
| ) -> CustomResult<domain::Event, errors::WebhooksFlowError> { | ||||
| @ -698,7 +698,7 @@ async fn update_event_if_client_error( | ||||
| async fn api_client_error_handler( | ||||
|     state: SessionState, | ||||
|     merchant_key_store: domain::MerchantKeyStore, | ||||
|     merchant_id: &str, | ||||
|     merchant_id: &common_utils::id_type::MerchantId, | ||||
|     event_id: &str, | ||||
|     client_error: error_stack::Report<errors::ApiClientError>, | ||||
|     delivery_attempt: enums::WebhookDeliveryAttempt, | ||||
| @ -739,7 +739,7 @@ async fn api_client_error_handler( | ||||
| async fn update_event_in_storage( | ||||
|     state: SessionState, | ||||
|     merchant_key_store: domain::MerchantKeyStore, | ||||
|     merchant_id: &str, | ||||
|     merchant_id: &common_utils::id_type::MerchantId, | ||||
|     event_id: &str, | ||||
|     response: reqwest::Response, | ||||
| ) -> CustomResult<domain::Event, errors::WebhooksFlowError> { | ||||
| @ -812,17 +812,20 @@ async fn update_event_in_storage( | ||||
|         .change_context(errors::WebhooksFlowError::WebhookEventUpdationFailed) | ||||
| } | ||||
|  | ||||
| fn increment_webhook_outgoing_received_count(merchant_id: &str) { | ||||
| fn increment_webhook_outgoing_received_count(merchant_id: &common_utils::id_type::MerchantId) { | ||||
|     metrics::WEBHOOK_OUTGOING_RECEIVED_COUNT.add( | ||||
|         &metrics::CONTEXT, | ||||
|         1, | ||||
|         &[metrics::KeyValue::new(MERCHANT_ID, merchant_id.to_owned())], | ||||
|         &[metrics::KeyValue::new( | ||||
|             MERCHANT_ID, | ||||
|             merchant_id.get_string_repr().to_owned(), | ||||
|         )], | ||||
|     ) | ||||
| } | ||||
|  | ||||
| async fn success_response_handler( | ||||
|     state: SessionState, | ||||
|     merchant_id: &str, | ||||
|     merchant_id: &common_utils::id_type::MerchantId, | ||||
|     process_tracker: Option<storage::ProcessTracker>, | ||||
|     business_status: &'static str, | ||||
| ) -> CustomResult<(), errors::WebhooksFlowError> { | ||||
| @ -843,7 +846,7 @@ async fn success_response_handler( | ||||
|  | ||||
| async fn error_response_handler( | ||||
|     state: SessionState, | ||||
|     merchant_id: &str, | ||||
|     merchant_id: &common_utils::id_type::MerchantId, | ||||
|     delivery_attempt: enums::WebhookDeliveryAttempt, | ||||
|     status_code: u16, | ||||
|     log_message: &'static str, | ||||
| @ -852,7 +855,10 @@ async fn error_response_handler( | ||||
|     metrics::WEBHOOK_OUTGOING_NOT_RECEIVED_COUNT.add( | ||||
|         &metrics::CONTEXT, | ||||
|         1, | ||||
|         &[metrics::KeyValue::new(MERCHANT_ID, merchant_id.to_owned())], | ||||
|         &[metrics::KeyValue::new( | ||||
|             MERCHANT_ID, | ||||
|             merchant_id.get_string_repr().to_owned(), | ||||
|         )], | ||||
|     ); | ||||
|  | ||||
|     let error = report!(errors::WebhooksFlowError::NotReceivedByMerchant); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Narayan Bhat
					Narayan Bhat