mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	deps(api_models): put the errors module behind a feature flag (#815)
This commit is contained in:
		| @ -783,7 +783,7 @@ impl api::IncomingWebhook for Adyen { | ||||
|  | ||||
|     fn get_dispute_details( | ||||
|         &self, | ||||
|         request: &api_models::webhooks::IncomingWebhookRequestDetails<'_>, | ||||
|         request: &api::IncomingWebhookRequestDetails<'_>, | ||||
|     ) -> CustomResult<api::disputes::DisputePayload, errors::ConnectorError> { | ||||
|         let notif = get_webhook_object_from_body(request.body) | ||||
|             .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; | ||||
|  | ||||
| @ -722,7 +722,7 @@ impl api::IncomingWebhook for Trustpay { | ||||
|  | ||||
|     fn get_dispute_details( | ||||
|         &self, | ||||
|         request: &api_models::webhooks::IncomingWebhookRequestDetails<'_>, | ||||
|         request: &api::IncomingWebhookRequestDetails<'_>, | ||||
|     ) -> CustomResult<api::disputes::DisputePayload, errors::ConnectorError> { | ||||
|         let trustpay_response: trustpay::TrustpayWebhookResponse = request | ||||
|             .body | ||||
|  | ||||
| @ -301,7 +301,7 @@ async fn disputes_incoming_webhook_flow<W: api::OutgoingWebhookType>( | ||||
|     webhook_details: api::IncomingWebhookDetails, | ||||
|     source_verified: bool, | ||||
|     connector: &(dyn api::Connector + Sync), | ||||
|     request_details: &api_models::webhooks::IncomingWebhookRequestDetails<'_>, | ||||
|     request_details: &api::IncomingWebhookRequestDetails<'_>, | ||||
|     event_type: api_models::webhooks::IncomingWebhookEvent, | ||||
| ) -> CustomResult<(), errors::WebhooksFlowError> { | ||||
|     metrics::INCOMING_DISPUTE_WEBHOOK_METRIC.add(&metrics::CONTEXT, 1, &[]); | ||||
| @ -497,7 +497,7 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>( | ||||
|         .change_context(errors::ApiErrorResponse::InternalServerError) | ||||
|         .attach_printable("There was an error in parsing the query params")?; | ||||
|  | ||||
|     let mut request_details = api_models::webhooks::IncomingWebhookRequestDetails { | ||||
|     let mut request_details = api::IncomingWebhookRequestDetails { | ||||
|         method: req.method().clone(), | ||||
|         headers: req.headers(), | ||||
|         query_params: req.query_string().to_string(), | ||||
|  | ||||
| @ -1,7 +1,6 @@ | ||||
| pub use api_models::webhooks::{ | ||||
|     IncomingWebhookDetails, IncomingWebhookEvent, IncomingWebhookRequestDetails, | ||||
|     MerchantWebhookConfig, ObjectReferenceId, OutgoingWebhook, OutgoingWebhookContent, | ||||
|     OutgoingWebhookType, WebhookFlow, | ||||
|     IncomingWebhookDetails, IncomingWebhookEvent, MerchantWebhookConfig, ObjectReferenceId, | ||||
|     OutgoingWebhook, OutgoingWebhookContent, OutgoingWebhookType, WebhookFlow, | ||||
| }; | ||||
| use error_stack::ResultExt; | ||||
|  | ||||
| @ -13,6 +12,14 @@ use crate::{ | ||||
|     utils::crypto, | ||||
| }; | ||||
|  | ||||
| pub struct IncomingWebhookRequestDetails<'a> { | ||||
|     pub method: actix_web::http::Method, | ||||
|     pub headers: &'a actix_web::http::header::HeaderMap, | ||||
|     pub body: &'a [u8], | ||||
|     pub query_params: String, | ||||
|     pub query_params_json: &'a [u8], | ||||
| } | ||||
|  | ||||
| #[async_trait::async_trait] | ||||
| pub trait IncomingWebhook: ConnectorCommon + Sync { | ||||
|     fn get_webhook_body_decoding_algorithm( | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 ItsMeShashank
					ItsMeShashank