@@ -2,8 +2,10 @@ pub mod transformers;
22
33use std:: fmt:: Debug ;
44
5+ use crate :: with_error_response_body;
6+
57use common_enums:: CurrencyUnit ;
6- use common_utils:: { errors:: CustomResult , ext_traits:: ByteSliceExt } ;
8+ use common_utils:: { errors:: CustomResult , events , ext_traits:: ByteSliceExt } ;
79use domain_types:: {
810 connector_flow:: {
911 Accept , Authenticate , Authorize , Capture , CreateAccessToken , CreateOrder ,
@@ -32,7 +34,6 @@ use error_stack::ResultExt;
3234use hyperswitch_masking:: { Mask , Maskable } ;
3335use interfaces:: {
3436 api:: ConnectorCommon , connector_integration_v2:: ConnectorIntegrationV2 , connector_types,
35- events:: connector_api_logs:: ConnectorEvent ,
3637} ;
3738use serde:: Serialize ;
3839use transformers:: {
@@ -568,7 +569,7 @@ macros::create_all_prerequisites!(
568569 ) -> CustomResult <Vec <( String , Maskable <String >) >, errors:: ConnectorError > {
569570 let mut header = vec![ (
570571 headers:: CONTENT_TYPE . to_string( ) ,
571- "application/json" . to_string( ) . into( ) ,
572+ self . common_get_content_type ( ) . to_string( ) . into( ) ,
572573 ) ] ;
573574 let mut auth_header = self . get_auth_header( & req. connector_auth_type) ?;
574575 header. append( & mut auth_header) ;
@@ -626,7 +627,7 @@ impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> Conn
626627 fn build_error_response (
627628 & self ,
628629 res : Response ,
629- event_builder : Option < & mut ConnectorEvent > ,
630+ event_builder : Option < & mut events :: Event > ,
630631 ) -> CustomResult < ErrorResponse , errors:: ConnectorError > {
631632 let response: celero:: CeleroErrorResponse = if res. response . is_empty ( ) {
632633 celero:: CeleroErrorResponse :: default ( )
@@ -636,9 +637,7 @@ impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> Conn
636637 . change_context ( errors:: ConnectorError :: ResponseDeserializationFailed ) ?
637638 } ;
638639
639- if let Some ( i) = event_builder {
640- i. set_error_response_body ( & response) ;
641- }
640+ with_error_response_body ! ( event_builder, response) ;
642641
643642 let error_code = response
644643 . code
0 commit comments