Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(events): Connector response masking in clickhouse (#3566)
AkshayaFoiger5fb3c001b5dc
diff --git a/.cargo/config.toml b/.cargo/config.tomlindex 5b27955262..c372e06f92 100644--- a/.cargo/config.toml+++ b/.cargo/config.toml@@ -1,6 +1,7 @@[target.'cfg(all())']rustflags = ["-Funsafe_code",+ "-Aclippy::option_map_unit_fn","-Wclippy::as_conversions","-Wclippy::expect_used","-Wclippy::index_refutable_slice",diff --git a/add_connector.md b/add_connector.mdindex 7fc3dcb27d..93a9c8d7b9 100644--- a/add_connector.md+++ b/add_connector.md@@ -9,14 +9,13 @@ This is a guide to contributing new connector to Router. This guide includes ins- Understanding of the Connector APIs which you wish to integrate with Router- Setup of Router repository and running it on local- Access to API credentials for testing the Connector API (you can quickly sign up for sandbox/uat credentials by visiting the website of the connector you wish to integrate)-- Ensure that you have the nightly toolchain installed because the connector template script includes code formatting.+- Ensure that you have the nightly toolchain installed because the connector template script includes code formatting.- Install it using `rustup`:-- ```bash- rustup toolchain install nightly- ```+Install it using `rustup`:+```bash+ rustup toolchain install nightly+```In Router, there are Connectors and Payment Methods, examples of both are shown below from which the difference is apparent.@@ -28,7 +27,7 @@ A connector is an integration to fulfill payments. Related use cases could be an- Fraud and Risk management platform (like Signifyd, Riskified etc.,)- Payment network (Visa, Master)- Payment authentication services (Cardinal etc.,)-Currently, the router is compatible with 'Payment Processors' and 'Fraud and Risk Management' platforms. Support for additional categories will be expanded in the near future.+ Currently, the router is compatible with 'Payment Processors' and 'Fraud and Risk Management' platforms. Support for additional categories will be expanded in the near future.### What is a Payment Method ?@@ -127,11 +126,13 @@ Let's define `PaymentSource`For request types that involve an amount, the implementation of `TryFrom<&ConnectorRouterData<&T>>` is required:```rust-impl TryFrom<&CheckoutRouterData<&T>> for PaymentsRequest+impl TryFrom<&CheckoutRouterData<&T>> for PaymentsRequest```-else++else+```rust-impl TryFrom<T> for PaymentsRequest+impl TryFrom<T> for PaymentsRequest```where `T` is a generic type which can be `types::PaymentsAuthorizeRouterData`, `types::PaymentsCaptureRouterData`, etc.@@ -214,6 +215,7 @@ impl ForeignFrom<(CheckoutPaymentStatus, Option<Balances>)> for enums::AttemptSt}}```+If you're converting ConnectorPaymentStatus to AttemptStatus without any additional conditions, you can employ the `impl From<ConnectorPaymentStatus> for enums::AttemptStatus`.Note: A payment intent can have multiple payment attempts. `enums::AttemptStatus` represents the status of a payment attempt.@@ -334,26 +336,27 @@ Some recommended fields that needs to be set on connector request and response```rustreference: item.router_data.connector_request_reference_id.clone(),```+- **connector_response_reference_id :** Merchants might face ambiguity when deciding which ID to use in the connector dashboard for payment identification. It is essential to populate the connector_response_reference_id with the appropriate reference ID, allowing merchants to recognize the transaction. This field can be linked to either `merchant_reference` or `connector_transaction_id`, depending on the field that the connector dashboard search functionality supports.```rustconnector_response_reference_id: item.response.reference.or(Some(item.response.id))```-- **resource_id :** The connector assigns an identifier to a payment attempt, referred to as `connector_transaction_id`. This identifier is represented as an enum variant for the `resource_id`. If the connector does not provide a `connector_transaction_id`, the resource_id is set to `NoResponseId`.+- **resource_id :** The connector assigns an identifier to a payment attempt, referred to as `connector_transaction_id`. This identifier is represented as an enum variant for the `resource_id`. If the connector does not provide a `connector_transaction_id`, the resource_id is set to `NoResponseId`.```rustresource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),```+- **redirection_data :** For the implementation of a redirection flow (3D Secure, bank redirects, etc.), assign the redirection link to the `redirection_data`.-```rust+```rustlet redirection_data = item.response.links.redirect.map(|href| {services::RedirectForm::from((href.redirection_url, services::Method::Get))});```-And finally the error type implementation```rust@@ -379,100 +382,110 @@ The following trait implementations are mandatoryWithin the `ConnectorCommon` trait, you'll find the following methods :- - `id` method corresponds directly to the connector name.- ```rust- fn id(&self) -> &'static str {- "checkout"- }- ```- - `get_currency_unit` method anticipates you to [specify the accepted currency unit](#set-the-currency-unit) for the connector.- ```rust- fn get_currency_unit(&self) -> api::CurrencyUnit {- api::CurrencyUnit::Minor- }- ```- - `common_get_content_type` method requires you to provide the accepted content type for the connector API.- ```rust- fn common_get_content_type(&self) -> &'static str {- "application/json"- }- ```- - `get_auth_header` method accepts common HTTP Authorization headers that are accepted in all `ConnectorIntegration` flows.- ```rust- fn get_auth_header(- &self,- auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {- let auth: checkout::CheckoutAuthType = auth_type- .try_into()- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(- headers::AUTHORIZATION.to_string(),- format!("Bearer {}", auth.api_secret.peek()).into_masked(),- )])- }- ```+- `id` method corresponds directly to the connector name.- - `base_url` method is for fetching the base URL of connector's API. Base url needs to be consumed from configs.- ```rust- fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {- connectors.checkout.base_url.as_ref()- }- ```- - `build_error_response` method is common error response handling for a connector if it is same in all cases+```rust+ fn id(&self) -> &'static str {+ "checkout"+ }+```- ```rust- fn build_error_response(- &self,- res: types::Response,- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: checkout::ErrorResponse = if res.response.is_empty() {- let (error_codes, error_type) = if res.status_code == 401 {- (- Some(vec!["Invalid api key".to_string()]),- Some("invalid_api_key".to_string()),- )- } else {- (None, None)- };- checkout::ErrorResponse {- request_id: None,- error_codes,- error_type,- }- } else {- res.response- .parse_struct("ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?- };+- `get_currency_unit` method anticipates you to [specify the accepted currency unit](#set-the-currency-unit) for the connector.- router_env::logger::info!(error_response=?response);- let errors_list = response.error_codes.clone().unwrap_or_default();- let option_error_code_message = conn_utils::get_error_code_error_message_based_on_priority(- self.clone(),- errors_list- .into_iter()- .map(|errors| errors.into())- .collect(),- );- Ok(types::ErrorResponse {- status_code: res.status_code,- code: option_error_code_message- .clone()- .map(|error_code_message| error_code_message.error_code)- .unwrap_or(consts::NO_ERROR_CODE.to_string()),- message: option_error_code_message- .map(|error_code_message| error_code_message.error_message)- .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),- reason: response- .error_codes- .map(|errors| errors.join(" & "))- .or(response.error_type),- attempt_status: None,- connector_transaction_id: None,- })- }- ```+```rust+ fn get_currency_unit(&self) -> api::CurrencyUnit {+ api::CurrencyUnit::Minor+ }+```++- `common_get_content_type` method requires you to provide the accepted content type for the connector API.++```rust+ fn common_get_content_type(&self) -> &'static str {+ "application/json"+ }+```++- `get_auth_header` method accepts common HTTP Authorization headers that are accepted in all `ConnectorIntegration` flows.++```rust+ fn get_auth_header(+ &self,+ auth_type: &types::ConnectorAuthType,+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {+ let auth: checkout::CheckoutAuthType = auth_type+ .try_into()+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ format!("Bearer {}", auth.api_secret.peek()).into_masked(),+ )])+ }+```++- `base_url` method is for fetching the base URL of connector's API. Base url needs to be consumed from configs.++```rust+ fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {+ connectors.checkout.base_url.as_ref()+ }+```++- `build_error_response` method is common error response handling for a connector if it is same in all cases++```rust+ fn build_error_response(+ &self,+ res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,+ ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {+ let response: checkout::ErrorResponse = if res.response.is_empty() {+ let (error_codes, error_type) = if res.status_code == 401 {+ (+ Some(vec!["Invalid api key".to_string()]),+ Some("invalid_api_key".to_string()),+ )+ } else {+ (None, None)+ };+ checkout::ErrorResponse {+ request_id: None,+ error_codes,+ error_type,+ }+ } else {+ res.response+ .parse_struct("ErrorResponse")+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?+ };++ router_env::logger::info!(error_response=?response);+ let errors_list = response.error_codes.clone().unwrap_or_default();+ let option_error_code_message = conn_utils::get_error_code_error_message_based_on_priority(+ self.clone(),+ errors_list+ .into_iter()+ .map(|errors| errors.into())+ .collect(),+ );+ Ok(types::ErrorResponse {+ status_code: res.status_code,+ code: option_error_code_message+ .clone()+ .map(|error_code_message| error_code_message.error_code)+ .unwrap_or(consts::NO_ERROR_CODE.to_string()),+ message: option_error_code_message+ .map(|error_code_message| error_code_message.error_message)+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),+ reason: response+ .error_codes+ .map(|errors| errors.join(" & "))+ .or(response.error_type),+ attempt_status: None,+ connector_transaction_id: None,+ })+ }+```**ConnectorIntegration :** For every api endpoint contains the url, using request transform and response transform and headers.Within the `ConnectorIntegration` trait, you'll find the following methods implemented(below mentioned is example for authorized flow):@@ -488,6 +501,7 @@ Within the `ConnectorIntegration` trait, you'll find the following methods impleOk(format!("{}{}", self.base_url(connectors), "payments"))}```+- `get_headers` method accepts HTTP headers that are accepted for authorize flow. In this context, it is utilized from the `ConnectorCommonExt` trait, as the connector adheres to common headers across various flows.```rust@@ -525,6 +539,7 @@ Within the `ConnectorIntegration` trait, you'll find the following methods imple```- `build_request` method assembles the API request by providing the method, URL, headers, and request body as parameters.+```rustfn build_request(&self,@@ -552,17 +567,22 @@ Within the `ConnectorIntegration` trait, you'll find the following methods imple))}```+- `handle_response` method calls transformers where connector response data is transformed into hyperswitch response.+```rustfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: checkout::PaymentsResponse = res.response.parse_struct("PaymentIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -571,18 +591,22 @@ Within the `ConnectorIntegration` trait, you'll find the following methods imple.change_context(errors::ConnectorError::ResponseHandlingFailed)}```+- `get_error_response` method to manage error responses. As the handling of checkout errors remains consistent across various flows, we've incorporated it from the `build_error_response` method within the `ConnectorCommon` trait.+```rustfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}```+**ConnectorCommonExt :** An enhanced trait for `ConnectorCommon` that enables functions with a generic type. This trait includes the `build_headers` method, responsible for constructing both the common headers and the Authorization headers (retrieved from the `get_auth_header` method), returning them as a vector.-```rust+```rustwhereSelf: ConnectorIntegration<Flow, Request, Response>,{@@ -604,11 +628,11 @@ Within the `ConnectorIntegration` trait, you'll find the following methods imple**Payment :** This trait includes several other traits and is meant to represent the functionality related to payments.-**PaymentAuthorize :** This trait extends the `api::ConnectorIntegration `trait with specific types related to payment authorization.+**PaymentAuthorize :** This trait extends the `api::ConnectorIntegration `trait with specific types related to payment authorization.-**PaymentCapture :** This trait extends the `api::ConnectorIntegration `trait with specific types related to manual payment capture.+**PaymentCapture :** This trait extends the `api::ConnectorIntegration `trait with specific types related to manual payment capture.-**PaymentSync :** This trait extends the `api::ConnectorIntegration `trait with specific types related to payment retrieve.+**PaymentSync :** This trait extends the `api::ConnectorIntegration `trait with specific types related to payment retrieve.**Refund :** This trait includes several other traits and is meant to represent the functionality related to Refunds.@@ -616,7 +640,6 @@ Within the `ConnectorIntegration` trait, you'll find the following methods imple**RefundSync :** This trait extends the `api::ConnectorIntegration `trait with specific types related to refunds retrieve.-And the below derive traits- **Debug**@@ -629,9 +652,10 @@ Refer to other connector code for trait implementations. Mostly the rust compileFeel free to connect with us in case of any queries and if you want to confirm the status mapping.### **Set the currency Unit**+The `get_currency_unit` function, part of the ConnectorCommon trait, enables connectors to specify their accepted currency unit as either `Base` or `Minor`. For instance, Paypal designates its currency in the base unit (for example, USD), whereas Hyperswitch processes amounts in the minor unit (for example, cents). If a connector accepts amounts in the base unit, conversion is required, as illustrated.-``` rust+```rustimpl<T>TryFrom<(&types::api::CurrencyUnit,@@ -722,8 +746,9 @@ Prior to executing tests in the shell, ensure that the API keys are configured i```rustexport CONNECTOR_AUTH_FILE_PATH="/hyperswitch/crates/router/tests/connectors/sample_auth.toml"- cargo test --package router --test connectors -- checkout --test-threads=1+ cargo test --package router --test connectors -- checkout --test-threads=1```+All tests should pass and add appropriate tests for connector specific payment flows.### **Build payment request and response from json schema**diff --git a/connector-template/mod.rs b/connector-template/mod.rsindex c64ce43196..987f6a8742 100644--- a/connector-template/mod.rs+++ b/connector-template/mod.rs@@ -5,6 +5,7 @@ use error_stack::{ResultExt, IntoReport};use masking::ExposeInterface;use crate::{+ events::connector_api_logs::ConnectorEvent,configs::settings,utils::{self, BytesExt},core::{@@ -95,12 +96,16 @@ impl ConnectorCommon for {{project-name | downcase | pascal_case}} {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: {{project-name | downcase}}::{{project-name | downcase | pascal_case}}ErrorResponse = res.response.parse_struct("{{project-name | downcase | pascal_case}}ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.code,@@ -194,9 +199,12 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData,errors::ConnectorError> {let response: {{project-name | downcase}}::{{project-name | downcase | pascal_case}}PaymentsResponse = res.response.parse_struct("{{project-name | downcase | pascal_case}} PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -204,8 +212,8 @@ impl})}- fn get_error_response(&self, res: Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {- self.build_error_response(res)+ fn get_error_response(&self, res: Response, event_builder: Option<&mut ConnectorEvent>) -> CustomResult<ErrorResponse,errors::ConnectorError> {+ self.build_error_response(res, event_builder)}}@@ -251,24 +259,28 @@ implfn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: {{project-name | downcase}}:: {{project-name | downcase | pascal_case}}PaymentsResponse = res.response.parse_struct("{{project-name | downcase}} PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),http_code: res.status_code,})}-+fn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -328,12 +340,15 @@ implfn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: {{project-name | downcase }}::{{project-name | downcase | pascal_case}}PaymentsResponse = res.response.parse_struct("{{project-name | downcase | pascal_case}} PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -344,8 +359,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -401,9 +417,12 @@ implfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>,errors::ConnectorError> {let response: {{project-name| downcase}}::RefundResponse = res.response.parse_struct("{{project-name | downcase}} RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -411,8 +430,8 @@ impl})}- fn get_error_response(&self, res: Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {- self.build_error_response(res)+ fn get_error_response(&self, res: Response, event_builder: Option<&mut ConnectorEvent>) -> CustomResult<ErrorResponse,errors::ConnectorError> {+ self.build_error_response(res, event_builder)}}@@ -449,9 +468,12 @@ implfn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData,errors::ConnectorError,> {let response: {{project-name | downcase}}::RefundResponse = res.response.parse_struct("{{project-name | downcase}} RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -459,8 +481,8 @@ impl})}- fn get_error_response(&self, res: Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {- self.build_error_response(res)+ fn get_error_response(&self, res: Response, event_builder: Option<&mut ConnectorEvent>) -> CustomResult<ErrorResponse,errors::ConnectorError> {+ self.build_error_response(res, event_builder)}}diff --git a/crates/analytics/docs/clickhouse/cluster_setup/README.md b/crates/analytics/docs/clickhouse/cluster_setup/README.mddeleted file mode 100644index cd5f2dfeb0..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/README.md+++ /dev/null@@ -1,347 +0,0 @@-# Tutorial for set up clickhouse server---## Single server with docker---- Run server--```-docker run -d --name clickhouse-server -p 9000:9000 --ulimit nofile=262144:262144 yandex/clickhouse-server--```--- Run client--```-docker run -it --rm --link clickhouse-server:clickhouse-server yandex/clickhouse-client --host clickhouse-server-```--Now you can see if it success setup or not.---## Setup Cluster---This part we will setup--- 1 cluster, with 3 shards-- Each shard has 2 replica server-- Use ReplicatedMergeTree & Distributed table to setup our table.---### Cluster--Let's see our docker-compose.yml first.--```-version: '3'--services:- clickhouse-zookeeper:- image: zookeeper- ports:- - "2181:2181"- - "2182:2182"- container_name: clickhouse-zookeeper- hostname: clickhouse-zookeeper-- clickhouse-01:- image: yandex/clickhouse-server- hostname: clickhouse-01- container_name: clickhouse-01- ports:- - 9001:9000- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-01.xml:/etc/clickhouse-server/config.d/macros.xml- # - ./data/server-01:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-02:- image: yandex/clickhouse-server- hostname: clickhouse-02- container_name: clickhouse-02- ports:- - 9002:9000- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-02.xml:/etc/clickhouse-server/config.d/macros.xml- # - ./data/server-02:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-03:- image: yandex/clickhouse-server- hostname: clickhouse-03- container_name: clickhouse-03- ports:- - 9003:9000- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-03.xml:/etc/clickhouse-server/config.d/macros.xml- # - ./data/server-03:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-04:- image: yandex/clickhouse-server- hostname: clickhouse-04- container_name: clickhouse-04- ports:- - 9004:9000- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-04.xml:/etc/clickhouse-server/config.d/macros.xml- # - ./data/server-04:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-05:- image: yandex/clickhouse-server- hostname: clickhouse-05- container_name: clickhouse-05- ports:- - 9005:9000- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-05.xml:/etc/clickhouse-server/config.d/macros.xml- # - ./data/server-05:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-06:- image: yandex/clickhouse-server- hostname: clickhouse-06- container_name: clickhouse-06- ports:- - 9006:9000- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-06.xml:/etc/clickhouse-server/config.d/macros.xml- # - ./data/server-06:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-networks:- default:- external:- name: clickhouse-net-```---We have 6 clickhouse server container and one zookeeper container.---**To enable replication ZooKeeper is required. ClickHouse will take care of data consistency on all replicas and run restore procedure after failure automatically. It's recommended to deploy ZooKeeper cluster to separate servers.**--**ZooKeeper is not a requirement — in some simple cases you can duplicate the data by writing it into all the replicas from your application code. This approach is not recommended — in this case ClickHouse is not able to guarantee data consistency on all replicas. This remains the responsibility of your application.**---Let's see config file.--`./config/clickhouse_config.xml` is the default config file in docker, we copy it out and add this line--```- <!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.- By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.- Values for substitutions are specified in /yandex/name_of_substitution elements in that file.- -->- <include_from>/etc/clickhouse-server/metrika.xml</include_from>-```---So lets see `clickhouse_metrika.xml`--```-<yandex>- <clickhouse_remote_servers>- <cluster_1>- <shard>- <weight>1</weight>- <internal_replication>true</internal_replication>- <replica>- <host>clickhouse-01</host>- <port>9000</port>- </replica>- <replica>- <host>clickhouse-06</host>- <port>9000</port>- </replica>- </shard>- <shard>- <weight>1</weight>- <internal_replication>true</internal_replication>- <replica>- <host>clickhouse-02</host>- <port>9000</port>- </replica>- <replica>- <host>clickhouse-03</host>- <port>9000</port>- </replica>- </shard>- <shard>- <weight>1</weight>- <internal_replication>true</internal_replication>-- <replica>- <host>clickhouse-04</host>- <port>9000</port>- </replica>- <replica>- <host>clickhouse-05</host>- <port>9000</port>- </replica>- </shard>- </cluster_1>- </clickhouse_remote_servers>- <zookeeper-servers>- <node index="1">- <host>clickhouse-zookeeper</host>- <port>2181</port>- </node>- </zookeeper-servers>- <networks>- <ip>::/0</ip>- </networks>- <clickhouse_compression>- <case>- <min_part_size>10000000000</min_part_size>- <min_part_size_ratio>0.01</min_part_size_ratio>- <method>lz4</method>- </case>- </clickhouse_compression>-</yandex>-```--and macros.xml, each instances has there own macros settings, like server 1:--```-<yandex>- <macros>- <replica>clickhouse-01</replica>- <shard>01</shard>- <layer>01</layer>- </macros>-</yandex>-```---**Make sure your macros settings is equal to remote server settings in metrika.xml**--So now you can start the server.--```-docker network create clickhouse-net-docker-compose up -d-```--Conn to server and see if the cluster settings fine;--```-docker run -it --rm --network="clickhouse-net" --link clickhouse-01:clickhouse-server yandex/clickhouse-client --host clickhouse-server-```--```sql-clickhouse-01 :) select * from system.clusters;--SELECT *-FROM system.clusters--┌─cluster─────────────────────┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name─────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐-│ cluster_1 │ 1 │ 1 │ 1 │ clickhouse-01 │ 172.21.0.4 │ 9000 │ 1 │ default │ │-│ cluster_1 │ 1 │ 1 │ 2 │ clickhouse-06 │ 172.21.0.5 │ 9000 │ 1 │ default │ │-│ cluster_1 │ 2 │ 1 │ 1 │ clickhouse-02 │ 172.21.0.8 │ 9000 │ 0 │ default │ │-│ cluster_1 │ 2 │ 1 │ 2 │ clickhouse-03 │ 172.21.0.6 │ 9000 │ 0 │ default │ │-│ cluster_1 │ 3 │ 1 │ 1 │ clickhouse-04 │ 172.21.0.7 │ 9000 │ 0 │ default │ │-│ cluster_1 │ 3 │ 1 │ 2 │ clickhouse-05 │ 172.21.0.3 │ 9000 │ 0 │ default │ │-│ test_shard_localhost │ 1 │ 1 │ 1 │ localhost │ 127.0.0.1 │ 9000 │ 1 │ default │ │-│ test_shard_localhost_secure │ 1 │ 1 │ 1 │ localhost │ 127.0.0.1 │ 9440 │ 0 │ default │ │-└─────────────────────────────┴───────────┴──────────────┴─────────────┴───────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘-```--If you see this, it means cluster's settings work well(but not conn fine).---### Replica Table--So now we have a cluster and replica settings. For clickhouse, we need to create ReplicatedMergeTree Table as a local table in every server.--```sql-CREATE TABLE ttt (id Int32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/ttt', '{replica}') PARTITION BY id ORDER BY id-```--and Create Distributed Table conn to local table--```sql-CREATE TABLE ttt_all as ttt ENGINE = Distributed(cluster_1, default, ttt, rand());-```---### Insert and test--gen some data and test.---```-# docker exec into client server 1 and-for ((idx=1;idx<=100;++idx)); do clickhouse-client --host clickhouse-server --query "Insert into default.ttt_all values ($idx)"; done;-```--For Distributed table.--```-select count(*) from ttt_all;-```--For loacl table.--```-select count(*) from ttt;-```---## Authentication--Please see config/users.xml---- Conn-```bash-docker run -it --rm --network="clickhouse-net" --link clickhouse-01:clickhouse-server yandex/clickhouse-client --host clickhouse-server -u user1 --password 123456-```--## Source--- https://clickhouse.yandex/docs/en/operations/table_engines/replication/#creating-replicated-tablesdiff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/clickhouse_config.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/clickhouse_config.xmldeleted file mode 100644index 94c854dc27..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/clickhouse_config.xml+++ /dev/null@@ -1,370 +0,0 @@-<?xml version="1.0"?>-<yandex>- <logger>- <!-- Possible levels: https://github.com/pocoproject/poco/blob/develop/Foundation/include/Poco/Logger.h#L105 -->- <level>error</level>- <size>1000M</size>- <console>1</console>- <count>10</count>- <!-- <console>1</console> --> <!-- Default behavior is autodetection (log to console if not daemon mode and is tty) -->- </logger>- <!--display_name>production</display_name--> <!-- It is the name that will be shown in the client -->- <http_port>8123</http_port>- <tcp_port>9000</tcp_port>-- <!-- For HTTPS and SSL over native protocol. -->- <!--- <https_port>8443</https_port>- <tcp_port_secure>9440</tcp_port_secure>- -->-- <!-- Used with https_port and tcp_port_secure. Full ssl options list: https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h#L71 -->- <openSSL>- <server> <!-- Used for https server AND secure tcp port -->- <!-- openssl req -subj "/CN=localhost" -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/clickhouse-server/server.key -out /etc/clickhouse-server/server.crt -->- <certificateFile>/etc/clickhouse-server/server.crt</certificateFile>- <privateKeyFile>/etc/clickhouse-server/server.key</privateKeyFile>- <!-- openssl dhparam -out /etc/clickhouse-server/dhparam.pem 4096 -->- <dhParamsFile>/etc/clickhouse-server/dhparam.pem</dhParamsFile>- <verificationMode>none</verificationMode>- <loadDefaultCAFile>true</loadDefaultCAFile>- <cacheSessions>true</cacheSessions>- <disableProtocols>sslv2,sslv3</disableProtocols>- <preferServerCiphers>true</preferServerCiphers>- </server>-- <client> <!-- Used for connecting to https dictionary source -->- <loadDefaultCAFile>true</loadDefaultCAFile>- <cacheSessions>true</cacheSessions>- <disableProtocols>sslv2,sslv3</disableProtocols>- <preferServerCiphers>true</preferServerCiphers>- <!-- Use for self-signed: <verificationMode>none</verificationMode> -->- <invalidCertificateHandler>- <!-- Use for self-signed: <name>AcceptCertificateHandler</name> -->- <name>RejectCertificateHandler</name>- </invalidCertificateHandler>- </client>- </openSSL>-- <!-- Default root page on http[s] server. For example load UI from https://tabix.io/ when opening http://localhost:8123 -->- <!--- <http_server_default_response><![CDATA[<html ng-app="SMI2"><head><base href="http://ui.tabix.io/"></head><body><div ui-view="" class="content-ui"></div><script src="http://loader.tabix.io/master.js"></script></body></html>]]></http_server_default_response>- -->-- <!-- Port for communication between replicas. Used for data exchange. -->- <interserver_http_port>9009</interserver_http_port>-- <!-- Hostname that is used by other replicas to request this server.- If not specified, than it is determined analogous to 'hostname -f' command.- This setting could be used to switch replication to another network interface.- -->- <!--- <interserver_http_host>example.yandex.ru</interserver_http_host>- -->-- <!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. -->- <!-- <listen_host>::</listen_host> -->- <!-- Same for hosts with disabled ipv6: -->- <!-- <listen_host>0.0.0.0</listen_host> -->-- <!-- Default values - try listen localhost on ipv4 and ipv6: -->- <!--- <listen_host>::1</listen_host>- <listen_host>127.0.0.1</listen_host>- -->- <!-- Don't exit if ipv6 or ipv4 unavailable, but listen_host with this protocol specified -->- <!-- <listen_try>0</listen_try> -->-- <!-- Allow listen on same address:port -->- <!-- <listen_reuse_port>0</listen_reuse_port> -->-- <!-- <listen_backlog>64</listen_backlog> -->-- <max_connections>4096</max_connections>- <keep_alive_timeout>3</keep_alive_timeout>-- <!-- Maximum number of concurrent queries. -->- <max_concurrent_queries>100</max_concurrent_queries>-- <!-- Set limit on number of open files (default: maximum). This setting makes sense on Mac OS X because getrlimit() fails to retrieve- correct maximum value. -->- <!-- <max_open_files>262144</max_open_files> -->-- <!-- Size of cache of uncompressed blocks of data, used in tables of MergeTree family.- In bytes. Cache is single for server. Memory is allocated only on demand.- Cache is used when 'use_uncompressed_cache' user setting turned on (off by default).- Uncompressed cache is advantageous only for very short queries and in rare cases.- -->- <uncompressed_cache_size>8589934592</uncompressed_cache_size>-- <!-- Approximate size of mark cache, used in tables of MergeTree family.- In bytes. Cache is single for server. Memory is allocated only on demand.- You should not lower this value.- -->- <mark_cache_size>5368709120</mark_cache_size>--- <!-- Path to data directory, with trailing slash. -->- <path>/var/lib/clickhouse/</path>-- <!-- Path to temporary data for processing hard queries. -->- <tmp_path>/var/lib/clickhouse/tmp/</tmp_path>-- <!-- Directory with user provided files that are accessible by 'file' table function. -->- <user_files_path>/var/lib/clickhouse/user_files/</user_files_path>-- <!-- Path to configuration file with users, access rights, profiles of settings, quotas. -->- <users_config>users.xml</users_config>-- <!-- Default profile of settings. -->- <default_profile>default</default_profile>-- <!-- System profile of settings. This settings are used by internal processes (Buffer storage, Distributed DDL worker and so on). -->- <!-- <system_profile>default</system_profile> -->-- <!-- Default database. -->- <default_database>default</default_database>-- <!-- Server time zone could be set here.-- Time zone is used when converting between String and DateTime types,- when printing DateTime in text formats and parsing DateTime from text,- it is used in date and time related functions, if specific time zone was not passed as an argument.-- Time zone is specified as identifier from IANA time zone database, like UTC or Africa/Abidjan.- If not specified, system time zone at server startup is used.-- Please note, that server could display time zone alias instead of specified name.- Example: W-SU is an alias for Europe/Moscow and Zulu is an alias for UTC.- -->- <!-- <timezone>Europe/Moscow</timezone> -->-- <!-- You can specify umask here (see "man umask"). Server will apply it on startup.- Number is always parsed as octal. Default umask is 027 (other users cannot read logs, data files, etc; group can only read).- -->- <!-- <umask>022</umask> -->-- <!-- Configuration of clusters that could be used in Distributed tables.- https://clickhouse.yandex/docs/en/table_engines/distributed/- -->- <remote_servers incl="clickhouse_remote_servers" >- <!-- Test only shard config for testing distributed storage -->- <test_shard_localhost>- <shard>- <replica>- <host>localhost</host>- <port>9000</port>- </replica>- </shard>- </test_shard_localhost>- <test_shard_localhost_secure>- <shard>- <replica>- <host>localhost</host>- <port>9440</port>- <secure>1</secure>- </replica>- </shard>- </test_shard_localhost_secure>- </remote_servers>--- <!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.- By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.- Values for substitutions are specified in /yandex/name_of_substitution elements in that file.- -->- <include_from>/etc/clickhouse-server/metrika.xml</include_from>- <!-- ZooKeeper is used to store metadata about replicas, when using Replicated tables.- Optional. If you don't use replicated tables, you could omit that.-- See https://clickhouse.yandex/docs/en/table_engines/replication/- -->- <zookeeper incl="zookeeper-servers" optional="true" />-- <!-- Substitutions for parameters of replicated tables.- Optional. If you don't use replicated tables, you could omit that.-- See https://clickhouse.yandex/docs/en/table_engines/replication/#creating-replicated-tables- -->- <macros incl="macros" optional="true" />--- <!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->- <builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>--- <!-- Maximum session timeout, in seconds. Default: 3600. -->- <max_session_timeout>3600</max_session_timeout>-- <!-- Default session timeout, in seconds. Default: 60. -->- <default_session_timeout>60</default_session_timeout>-- <!-- Sending data to Graphite for monitoring. Several sections can be defined. -->- <!--- interval - send every X second- root_path - prefix for keys- hostname_in_path - append hostname to root_path (default = true)- metrics - send data from table system.metrics- events - send data from table system.events- asynchronous_metrics - send data from table system.asynchronous_metrics- -->- <!--- <graphite>- <host>localhost</host>- <port>42000</port>- <timeout>0.1</timeout>- <interval>60</interval>- <root_path>one_min</root_path>- <hostname_in_path>true</hostname_in_path>-- <metrics>true</metrics>- <events>true</events>- <asynchronous_metrics>true</asynchronous_metrics>- </graphite>- <graphite>- <host>localhost</host>- <port>42000</port>- <timeout>0.1</timeout>- <interval>1</interval>- <root_path>one_sec</root_path>-- <metrics>true</metrics>- <events>true</events>- <asynchronous_metrics>false</asynchronous_metrics>- </graphite>- -->--- <!-- Query log. Used only for queries with setting log_queries = 1. -->- <query_log>- <!-- What table to insert data. If table is not exist, it will be created.- When query log structure is changed after system update,- then old table will be renamed and new table will be created automatically.- -->- <database>system</database>- <table>query_log</table>- <!--- PARTITION BY expr https://clickhouse.yandex/docs/en/table_engines/custom_partitioning_key/- Example:- event_date- toMonday(event_date)- toYYYYMM(event_date)- toStartOfHour(event_time)- -->- <partition_by>toYYYYMM(event_date)</partition_by>- <!-- Interval of flushing data. -->- <flush_interval_milliseconds>7500</flush_interval_milliseconds>- </query_log>--- <!-- Uncomment if use part_log- <part_log>- <database>system</database>- <table>part_log</table>-- <flush_interval_milliseconds>7500</flush_interval_milliseconds>- </part_log>- -->--- <!-- Parameters for embedded dictionaries, used in Yandex.Metrica.- See https://clickhouse.yandex/docs/en/dicts/internal_dicts/- -->-- <!-- Path to file with region hierarchy. -->- <!-- <path_to_regions_hierarchy_file>/opt/geo/regions_hierarchy.txt</path_to_regions_hierarchy_file> -->-- <!-- Path to directory with files containing names of regions -->- <!-- <path_to_regions_names_files>/opt/geo/</path_to_regions_names_files> -->--- <!-- Configuration of external dictionaries. See:- https://clickhouse.yandex/docs/en/dicts/external_dicts/- -->- <dictionaries_config>*_dictionary.xml</dictionaries_config>-- <!-- Uncomment if you want data to be compressed 30-100% better.- Don't do that if you just started using ClickHouse.- -->- <compression incl="clickhouse_compression">- <!--- <!- - Set of variants. Checked in order. Last matching case wins. If nothing matches, lz4 will be used. - ->- <case>-- <!- - Conditions. All must be satisfied. Some conditions may be omitted. - ->- <min_part_size>10000000000</min_part_size> <!- - Min part size in bytes. - ->- <min_part_size_ratio>0.01</min_part_size_ratio> <!- - Min size of part relative to whole table size. - ->-- <!- - What compression method to use. - ->- <method>zstd</method>- </case>- -->- </compression>-- <!-- Allow to execute distributed DDL queries (CREATE, DROP, ALTER, RENAME) on cluster.- Works only if ZooKeeper is enabled. Comment it if such functionality isn't required. -->- <distributed_ddl>- <!-- Path in ZooKeeper to queue with DDL queries -->- <path>/clickhouse/task_queue/ddl</path>-- <!-- Settings from this profile will be used to execute DDL queries -->- <!-- <profile>default</profile> -->- </distributed_ddl>-- <!-- Settings to fine tune MergeTree tables. See documentation in source code, in MergeTreeSettings.h -->- <!--- <merge_tree>- <max_suspicious_broken_parts>5</max_suspicious_broken_parts>- </merge_tree>- -->-- <!-- Protection from accidental DROP.- If size of a MergeTree table is greater than max_table_size_to_drop (in bytes) than table could not be dropped with any DROP query.- If you want do delete one table and don't want to restart clickhouse-server, you could create special file <clickhouse-path>/flags/force_drop_table and make DROP once.- By default max_table_size_to_drop is 50GB; max_table_size_to_drop=0 allows to DROP any tables.- The same for max_partition_size_to_drop.- Uncomment to disable protection.- -->- <!-- <max_table_size_to_drop>0</max_table_size_to_drop> -->- <!-- <max_partition_size_to_drop>0</max_partition_size_to_drop> -->-- <!-- Example of parameters for GraphiteMergeTree table engine -->- <graphite_rollup_example>- <pattern>- <regexp>click_cost</regexp>- <function>any</function>- <retention>- <age>0</age>- <precision>3600</precision>- </retention>- <retention>- <age>86400</age>- <precision>60</precision>- </retention>- </pattern>- <default>- <function>max</function>- <retention>- <age>0</age>- <precision>60</precision>- </retention>- <retention>- <age>3600</age>- <precision>300</precision>- </retention>- <retention>- <age>86400</age>- <precision>3600</precision>- </retention>- </default>- </graphite_rollup_example>-- <!-- Directory in <clickhouse-path> containing schema files for various input formats.- The directory will be created if it doesn't exist.- -->- <format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>-- <!-- Uncomment to disable ClickHouse internal DNS caching. -->- <!-- <disable_internal_dns_cache>1</disable_internal_dns_cache> -->-</yandex>-diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/clickhouse_metrika.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/clickhouse_metrika.xmldeleted file mode 100644index b58ffc34bc..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/clickhouse_metrika.xml+++ /dev/null@@ -1,60 +0,0 @@-<yandex>- <clickhouse_remote_servers>- <cluster_1>- <shard>- <weight>1</weight>- <internal_replication>true</internal_replication>- <replica>- <host>clickhouse-01</host>- <port>9000</port>- </replica>- <replica>- <host>clickhouse-06</host>- <port>9000</port>- </replica>- </shard>- <shard>- <weight>1</weight>- <internal_replication>true</internal_replication>- <replica>- <host>clickhouse-02</host>- <port>9000</port>- </replica>- <replica>- <host>clickhouse-03</host>- <port>9000</port>- </replica>- </shard>- <shard>- <weight>1</weight>- <internal_replication>true</internal_replication>-- <replica>- <host>clickhouse-04</host>- <port>9000</port>- </replica>- <replica>- <host>clickhouse-05</host>- <port>9000</port>- </replica>- </shard>- </cluster_1>- </clickhouse_remote_servers>- <zookeeper-servers>- <node index="1">- <host>clickhouse-zookeeper</host>- <port>2181</port>- </node>- </zookeeper-servers>- <networks>- <ip>::/0</ip>- </networks>- <clickhouse_compression>- <case>- <min_part_size>10000000000</min_part_size>- <min_part_size_ratio>0.01</min_part_size_ratio>- <method>lz4</method>- </case>- </clickhouse_compression>-</yandex>-diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-01.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-01.xmldeleted file mode 100644index 75df1c5916..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-01.xml+++ /dev/null@@ -1,9 +0,0 @@-<yandex>- <macros>- <replica>clickhouse-01</replica>- <shard>01</shard>- <layer>01</layer>- <installation>data</installation>- <cluster>cluster_1</cluster>- </macros>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-02.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-02.xmldeleted file mode 100644index 67e4a545b3..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-02.xml+++ /dev/null@@ -1,9 +0,0 @@-<yandex>- <macros>- <replica>clickhouse-02</replica>- <shard>02</shard>- <layer>01</layer>- <installation>data</installation>- <cluster>cluster_1</cluster>- </macros>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-03.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-03.xmldeleted file mode 100644index e9278191b8..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-03.xml+++ /dev/null@@ -1,9 +0,0 @@-<yandex>- <macros>- <replica>clickhouse-03</replica>- <shard>02</shard>- <layer>01</layer>- <installation>data</installation>- <cluster>cluster_1</cluster>- </macros>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-04.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-04.xmldeleted file mode 100644index 033c0ad115..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-04.xml+++ /dev/null@@ -1,9 +0,0 @@-<yandex>- <macros>- <replica>clickhouse-04</replica>- <shard>03</shard>- <layer>01</layer>- <installation>data</installation>- <cluster>cluster_1</cluster>- </macros>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-05.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-05.xmldeleted file mode 100644index c63314c5ac..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-05.xml+++ /dev/null@@ -1,9 +0,0 @@-<yandex>- <macros>- <replica>clickhouse-05</replica>- <shard>03</shard>- <layer>01</layer>- <installation>data</installation>- <cluster>cluster_1</cluster>- </macros>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-06.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-06.xmldeleted file mode 100644index 4b01bda994..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/macros/macros-06.xml+++ /dev/null@@ -1,9 +0,0 @@-<yandex>- <macros>- <replica>clickhouse-06</replica>- <shard>01</shard>- <layer>01</layer>- <installation>data</installation>- <cluster>cluster_1</cluster>- </macros>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/config/users.xml b/crates/analytics/docs/clickhouse/cluster_setup/config/users.xmldeleted file mode 100644index e1b8de78e3..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/config/users.xml+++ /dev/null@@ -1,117 +0,0 @@-<?xml version="1.0"?>-<yandex>- <!-- Profiles of settings. -->- <profiles>- <!-- Default settings. -->- <default>- <!-- Maximum memory usage for processing single query, in bytes. -->- <max_memory_usage>10000000000</max_memory_usage>-- <!-- Use cache of uncompressed blocks of data. Meaningful only for processing many of very short queries. -->- <use_uncompressed_cache>0</use_uncompressed_cache>-- <!-- How to choose between replicas during distributed query processing.- random - choose random replica from set of replicas with minimum number of errors- nearest_hostname - from set of replicas with minimum number of errors, choose replica- with minimum number of different symbols between replica's hostname and local hostname- (Hamming distance).- in_order - first live replica is chosen in specified order.- -->- <load_balancing>random</load_balancing>- </default>-- <!-- Profile that allows only read queries. -->- <readonly>- <readonly>1</readonly>- </readonly>- </profiles>-- <!-- Users and ACL. -->- <users>- <user1>- <password>123456</password>- <networks incl="networks" replace="replace">- <ip>::/0</ip>- </networks>- <profile>default</profile>- <quota>default</quota>- </user1>- <!-- If user name was not specified, 'default' user is used. -->- <default>- <!-- Password could be specified in plaintext or in SHA256 (in hex format).-- If you want to specify password in plaintext (not recommended), place it in 'password' element.- Example: <password>qwerty</password>.- Password could be empty.-- If you want to specify SHA256, place it in 'password_sha256_hex' element.- Example: <password_sha256_hex>65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5</password_sha256_hex>-- How to generate decent password:- Execute: PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'- In first line will be password and in second - corresponding SHA256.- -->- <password></password>-- <!-- List of networks with open access.-- To open access from everywhere, specify:- <ip>::/0</ip>-- To open access only from localhost, specify:- <ip>::1</ip>- <ip>127.0.0.1</ip>-- Each element of list has one of the following forms:- <ip> IP-address or network mask. Examples: 213.180.204.3 or 10.0.0.1/8 or 10.0.0.1/255.255.255.0- 2a02:6b8::3 or 2a02:6b8::3/64 or 2a02:6b8::3/ffff:ffff:ffff:ffff::.- <host> Hostname. Example: server01.yandex.ru.- To check access, DNS query is performed, and all received addresses compared to peer address.- <host_regexp> Regular expression for host names. Example, ^server\d\d-\d\d-\d\.yandex\.ru$- To check access, DNS PTR query is performed for peer address and then regexp is applied.- Then, for result of PTR query, another DNS query is performed and all received addresses compared to peer address.- Strongly recommended that regexp is ends with $- All results of DNS requests are cached till server restart.- -->- <networks incl="networks" replace="replace">- <ip>::/0</ip>- </networks>-- <!-- Settings profile for user. -->- <profile>default</profile>-- <!-- Quota for user. -->- <quota>default</quota>- </default>-- <!-- Example of user with readonly access. -->- <readonly>- <password></password>- <networks incl="networks" replace="replace">- <ip>::1</ip>- <ip>127.0.0.1</ip>- </networks>- <profile>readonly</profile>- <quota>default</quota>- </readonly>- </users>-- <!-- Quotas. -->- <quotas>- <!-- Name of quota. -->- <default>- <!-- Limits for time interval. You could specify many intervals with different limits. -->- <interval>- <!-- Length of interval. -->- <duration>3600</duration>-- <!-- No limits. Just calculate resource usage for time interval. -->- <queries>0</queries>- <errors>0</errors>- <result_rows>0</result_rows>- <read_rows>0</read_rows>- <execution_time>0</execution_time>- </interval>- </default>- </quotas>-</yandex>diff --git a/crates/analytics/docs/clickhouse/cluster_setup/docker-compose.yml b/crates/analytics/docs/clickhouse/cluster_setup/docker-compose.ymldeleted file mode 100644index 96d7618b47..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/docker-compose.yml+++ /dev/null@@ -1,198 +0,0 @@-version: '3'--networks:- ckh_net:--services:- clickhouse-zookeeper:- image: zookeeper- ports:- - "2181:2181"- - "2182:2182"- container_name: clickhouse-zookeeper- hostname: clickhouse-zookeeper- networks:- - ckh_net-- clickhouse-01:- image: clickhouse/clickhouse-server- hostname: clickhouse-01- container_name: clickhouse-01- networks:- - ckh_net- ports:- - 9001:9000- - 8124:8123- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-01.xml:/etc/clickhouse-server/config.d/macros.xml- - ./config/users.xml:/etc/clickhouse-server/users.xml- # - ./data/server-01:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-02:- image: clickhouse/clickhouse-server- hostname: clickhouse-02- container_name: clickhouse-02- networks:- - ckh_net- ports:- - 9002:9000- - 8125:8123- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-02.xml:/etc/clickhouse-server/config.d/macros.xml- - ./config/users.xml:/etc/clickhouse-server/users.xml- # - ./data/server-02:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-03:- image: clickhouse/clickhouse-server- hostname: clickhouse-03- container_name: clickhouse-03- networks:- - ckh_net- ports:- - 9003:9000- - 8126:8123- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-03.xml:/etc/clickhouse-server/config.d/macros.xml- - ./config/users.xml:/etc/clickhouse-server/users.xml- # - ./data/server-03:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-04:- image: clickhouse/clickhouse-server- hostname: clickhouse-04- container_name: clickhouse-04- networks:- - ckh_net- ports:- - 9004:9000- - 8127:8123- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-04.xml:/etc/clickhouse-server/config.d/macros.xml- - ./config/users.xml:/etc/clickhouse-server/users.xml- # - ./data/server-04:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-05:- image: clickhouse/clickhouse-server- hostname: clickhouse-05- container_name: clickhouse-05- networks:- - ckh_net- ports:- - 9005:9000- - 8128:8123- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-05.xml:/etc/clickhouse-server/config.d/macros.xml- - ./config/users.xml:/etc/clickhouse-server/users.xml- # - ./data/server-05:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- clickhouse-06:- image: clickhouse/clickhouse-server- hostname: clickhouse-06- container_name: clickhouse-06- networks:- - ckh_net- ports:- - 9006:9000- - 8129:8123- volumes:- - ./config/clickhouse_config.xml:/etc/clickhouse-server/config.xml- - ./config/clickhouse_metrika.xml:/etc/clickhouse-server/metrika.xml- - ./config/macros/macros-06.xml:/etc/clickhouse-server/config.d/macros.xml- - ./config/users.xml:/etc/clickhouse-server/users.xml- # - ./data/server-06:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144- depends_on:- - "clickhouse-zookeeper"-- kafka0:- image: confluentinc/cp-kafka:7.0.5- hostname: kafka0- container_name: kafka0- ports:- - 9092:9092- - 9093- - 9997- - 29092- environment:- KAFKA_BROKER_ID: 1- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT- KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka0:29092,PLAINTEXT_HOST://localhost:9092- KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0- KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1- KAFKA_PROCESS_ROLES: 'broker,controller'- KAFKA_NODE_ID: 1- KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka0:29093'- KAFKA_LISTENERS: 'PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092'- KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'- KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'- JMX_PORT: 9997- KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka0 -Dcom.sun.management.jmxremote.rmi.port=9997- volumes:- - ./kafka-script.sh:/tmp/update_run.sh- command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'"- networks:- ckh_net:- aliases:- - hyper-c1-kafka-brokers.kafka-cluster.svc.cluster.local--- # Kafka UI for debugging kafka queues- kafka-ui:- container_name: kafka-ui- image: provectuslabs/kafka-ui:latest- ports:- - 8090:8080- depends_on:- - kafka0- networks:- - ckh_net- environment:- KAFKA_CLUSTERS_0_NAME: local- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka0:29092- KAFKA_CLUSTERS_0_JMXPORT: 9997-diff --git a/crates/analytics/docs/clickhouse/cluster_setup/kafka-script.sh b/crates/analytics/docs/clickhouse/cluster_setup/kafka-script.shdeleted file mode 100755index 023c832b4e..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/kafka-script.sh+++ /dev/null@@ -1,11 +0,0 @@-# This script is required to run kafka cluster (without zookeeper)-#!/bin/sh--# Docker workaround: Remove check for KAFKA_ZOOKEEPER_CONNECT parameter-sed -i '/KAFKA_ZOOKEEPER_CONNECT/d' /etc/confluent/docker/configure--# Docker workaround: Ignore cub zk-ready-sed -i 's/cub zk-ready/echo ignore zk-ready/' /etc/confluent/docker/ensure--# KRaft required step: Format the storage directory with a new cluster ID-echo "kafka-storage format --ignore-formatted -t $(kafka-storage random-uuid) -c /etc/kafka/kafka.properties" >> /etc/confluent/docker/ensure\ No newline at end of filediff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sqldeleted file mode 100644index ad0fe6d778..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sql+++ /dev/null@@ -1,242 +0,0 @@-CREATE TABLE hyperswitch.api_events_queue on cluster '{cluster}' (- `merchant_id` String,- `payment_id` Nullable(String),- `refund_id` Nullable(String),- `payment_method_id` Nullable(String),- `payment_method` Nullable(String),- `payment_method_type` Nullable(String),- `customer_id` Nullable(String),- `user_id` Nullable(String),- `request_id` String,- `flow_type` LowCardinality(String),- `api_name` LowCardinality(String),- `request` String,- `response` String,- `status_code` UInt32,- `url_path` LowCardinality(Nullable(String)),- `event_type` LowCardinality(Nullable(String)),- `created_at` DateTime CODEC(T64, LZ4),- `latency` Nullable(UInt128),- `user_agent` Nullable(String),- `ip_addr` Nullable(String),- `dispute_id` Nullable(String)-) ENGINE = Kafka SETTINGS kafka_broker_list = 'hyper-c1-kafka-brokers.kafka-cluster.svc.cluster.local:9092',-kafka_topic_list = 'hyperswitch-api-log-events',-kafka_group_name = 'hyper-c1',-kafka_format = 'JSONEachRow',-kafka_handle_error_mode = 'stream';---CREATE TABLE hyperswitch.api_events_clustered on cluster '{cluster}' (- `merchant_id` String,- `payment_id` Nullable(String),- `refund_id` Nullable(String),- `payment_method_id` Nullable(String),- `payment_method` Nullable(String),- `payment_method_type` Nullable(String),- `customer_id` Nullable(String),- `user_id` Nullable(String),- `request_id` Nullable(String),- `flow_type` LowCardinality(String),- `api_name` LowCardinality(String),- `request` String,- `response` String,- `status_code` UInt32,- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `latency` Nullable(UInt128),- `user_agent` Nullable(String),- `ip_addr` Nullable(String),- INDEX flowIndex flow_type TYPE bloom_filter GRANULARITY 1,- INDEX apiIndex api_name TYPE bloom_filter GRANULARITY 1,- INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1-) ENGINE = ReplicatedMergeTree(- '/clickhouse/{installation}/{cluster}/tables/{shard}/hyperswitch/api_events_clustered',- '{replica}'-)-PARTITION BY toStartOfDay(created_at)-ORDER BY- (created_at, merchant_id, flow_type, status_code, api_name)-TTL created_at + toIntervalMonth(6)-;---CREATE TABLE hyperswitch.api_events_dist on cluster '{cluster}' (- `merchant_id` String,- `payment_id` Nullable(String),- `refund_id` Nullable(String),- `payment_method_id` Nullable(String),- `payment_method` Nullable(String),- `payment_method_type` Nullable(String),- `customer_id` Nullable(String),- `user_id` Nullable(String),- `request_id` Nullable(String),- `flow_type` LowCardinality(String),- `api_name` LowCardinality(String),- `request` String,- `response` String,- `status_code` UInt32,- `url_path` LowCardinality(Nullable(String)),- `event_type` LowCardinality(Nullable(String)),- `inserted_at` DateTime64(3),- `created_at` DateTime64(3),- `latency` Nullable(UInt128),- `user_agent` Nullable(String),- `ip_addr` Nullable(String),- `dispute_id` Nullable(String)-) ENGINE = Distributed('{cluster}', 'hyperswitch', 'api_events_clustered', rand());--CREATE MATERIALIZED VIEW hyperswitch.api_events_mv on cluster '{cluster}' TO hyperswitch.api_events_dist (- `merchant_id` String,- `payment_id` Nullable(String),- `refund_id` Nullable(String),- `payment_method_id` Nullable(String),- `payment_method` Nullable(String),- `payment_method_type` Nullable(String),- `customer_id` Nullable(String),- `user_id` Nullable(String),- `request_id` Nullable(String),- `flow_type` LowCardinality(String),- `api_name` LowCardinality(String),- `request` String,- `response` String,- `status_code` UInt32,- `url_path` LowCardinality(Nullable(String)),- `event_type` LowCardinality(Nullable(String)),- `inserted_at` DateTime64(3),- `created_at` DateTime64(3),- `latency` Nullable(UInt128),- `user_agent` Nullable(String),- `ip_addr` Nullable(String),- `dispute_id` Nullable(String)-) AS-SELECT- merchant_id,- payment_id,- refund_id,- payment_method_id,- payment_method,- payment_method_type,- customer_id,- user_id,- request_id,- flow_type,- api_name,- request,- response,- status_code,- url_path,- event_type,- now() as inserted_at,- created_at,- latency,- user_agent,- ip_addr-FROM- hyperswitch.api_events_queue-WHERE length(_error) = 0;---CREATE MATERIALIZED VIEW hyperswitch.api_events_parse_errors on cluster '{cluster}'-(- `topic` String,- `partition` Int64,- `offset` Int64,- `raw` String,- `error` String-)-ENGINE = MergeTree-ORDER BY (topic, partition, offset)-SETTINGS index_granularity = 8192 AS-SELECT- _topic AS topic,- _partition AS partition,- _offset AS offset,- _raw_message AS raw,- _error AS error-FROM hyperswitch.api_events_queue-WHERE length(_error) > 0-;---ALTER TABLE hyperswitch.api_events_clustered on cluster '{cluster}' ADD COLUMN `url_path` LowCardinality(Nullable(String));-ALTER TABLE hyperswitch.api_events_clustered on cluster '{cluster}' ADD COLUMN `event_type` LowCardinality(Nullable(String));-ALTER TABLE hyperswitch.api_events_clustered on cluster '{cluster}' ADD COLUMN `dispute_id` Nullable(String);--CREATE TABLE hyperswitch.api_audit_log ON CLUSTER '{cluster}' (- `merchant_id` LowCardinality(String),- `payment_id` String,- `refund_id` Nullable(String),- `payment_method_id` Nullable(String),- `payment_method` Nullable(String),- `payment_method_type` Nullable(String),- `user_id` Nullable(String),- `request_id` Nullable(String),- `flow_type` LowCardinality(String),- `api_name` LowCardinality(String),- `request` String,- `response` String,- `status_code` UInt32,- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `latency` Nullable(UInt128),- `user_agent` Nullable(String),- `ip_addr` Nullable(String),- `url_path` LowCardinality(Nullable(String)),- `event_type` LowCardinality(Nullable(String)),- `customer_id` LowCardinality(Nullable(String))-) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/hyperswitch/api_audit_log', '{replica}' ) PARTITION BY merchant_id-ORDER BY (merchant_id, payment_id)-TTL created_at + toIntervalMonth(18)-SETTINGS index_granularity = 8192---CREATE MATERIALIZED VIEW hyperswitch.api_audit_log_mv ON CLUSTER `{cluster}` TO hyperswitch.api_audit_log(- `merchant_id` LowCardinality(String),- `payment_id` String,- `refund_id` Nullable(String),- `payment_method_id` Nullable(String),- `payment_method` Nullable(String),- `payment_method_type` Nullable(String),- `customer_id` Nullable(String),- `user_id` Nullable(String),- `request_id` Nullable(String),- `flow_type` LowCardinality(String),- `api_name` LowCardinality(String),- `request` String,- `response` String,- `status_code` UInt32,- `url_path` LowCardinality(Nullable(String)),- `event_type` LowCardinality(Nullable(String)),- `inserted_at` DateTime64(3),- `created_at` DateTime64(3),- `latency` Nullable(UInt128),- `user_agent` Nullable(String),- `ip_addr` Nullable(String),- `dispute_id` Nullable(String)-) AS-SELECT- merchant_id,- multiIf(payment_id IS NULL, '', payment_id) AS payment_id,- refund_id,- payment_method_id,- payment_method,- payment_method_type,- customer_id,- user_id,- request_id,- flow_type,- api_name,- request,- response,- status_code,- url_path,- api_event_type AS event_type,- now() AS inserted_at,- created_at,- latency,- user_agent,- ip_addr,- dispute_id-FROM hyperswitch.api_events_queue-WHERE length(_error) = 0\ No newline at end of filediff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/payment_attempts.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/payment_attempts.sqldeleted file mode 100644index 3a6281ae90..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/payment_attempts.sql+++ /dev/null@@ -1,217 +0,0 @@-CREATE TABLE hyperswitch.payment_attempt_queue on cluster '{cluster}' (- `payment_id` String,- `merchant_id` String,- `attempt_id` String,- `status` LowCardinality(String),- `amount` Nullable(UInt32),- `currency` LowCardinality(Nullable(String)),- `connector` LowCardinality(Nullable(String)),- `save_to_locker` Nullable(Bool),- `error_message` Nullable(String),- `offer_amount` Nullable(UInt32),- `surcharge_amount` Nullable(UInt32),- `tax_amount` Nullable(UInt32),- `payment_method_id` Nullable(String),- `payment_method` LowCardinality(Nullable(String)),- `payment_method_type` LowCardinality(Nullable(String)),- `connector_transaction_id` Nullable(String),- `capture_method` LowCardinality(Nullable(String)),- `capture_on` Nullable(DateTime) CODEC(T64, LZ4),- `confirm` Bool,- `authentication_type` LowCardinality(Nullable(String)),- `cancellation_reason` Nullable(String),- `amount_to_capture` Nullable(UInt32),- `mandate_id` Nullable(String),- `browser_info` Nullable(String),- `error_code` Nullable(String),- `connector_metadata` Nullable(String),- `payment_experience` Nullable(String),- `created_at` DateTime CODEC(T64, LZ4),- `last_synced` Nullable(DateTime) CODEC(T64, LZ4),- `modified_at` DateTime CODEC(T64, LZ4),- `sign_flag` Int8-) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',-kafka_topic_list = 'hyperswitch-payment-attempt-events',-kafka_group_name = 'hyper-c1',-kafka_format = 'JSONEachRow',-kafka_handle_error_mode = 'stream';---CREATE TABLE hyperswitch.payment_attempt_dist on cluster '{cluster}' (- `payment_id` String,- `merchant_id` String,- `attempt_id` String,- `status` LowCardinality(String),- `amount` Nullable(UInt32),- `currency` LowCardinality(Nullable(String)),- `connector` LowCardinality(Nullable(String)),- `save_to_locker` Nullable(Bool),- `error_message` Nullable(String),- `offer_amount` Nullable(UInt32),- `surcharge_amount` Nullable(UInt32),- `tax_amount` Nullable(UInt32),- `payment_method_id` Nullable(String),- `payment_method` LowCardinality(Nullable(String)),- `payment_method_type` LowCardinality(Nullable(String)),- `connector_transaction_id` Nullable(String),- `capture_method` Nullable(String),- `capture_on` Nullable(DateTime) CODEC(T64, LZ4),- `confirm` Bool,- `authentication_type` LowCardinality(Nullable(String)),- `cancellation_reason` Nullable(String),- `amount_to_capture` Nullable(UInt32),- `mandate_id` Nullable(String),- `browser_info` Nullable(String),- `error_code` Nullable(String),- `connector_metadata` Nullable(String),- `payment_experience` Nullable(String),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `last_synced` Nullable(DateTime) CODEC(T64, LZ4),- `modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `sign_flag` Int8-) ENGINE = Distributed('{cluster}', 'hyperswitch', 'payment_attempt_clustered', cityHash64(attempt_id));----CREATE MATERIALIZED VIEW hyperswitch.payment_attempt_mv on cluster '{cluster}' TO hyperswitch.payment_attempt_dist (- `payment_id` String,- `merchant_id` String,- `attempt_id` String,- `status` LowCardinality(String),- `amount` Nullable(UInt32),- `currency` LowCardinality(Nullable(String)),- `connector` LowCardinality(Nullable(String)),- `save_to_locker` Nullable(Bool),- `error_message` Nullable(String),- `offer_amount` Nullable(UInt32),- `surcharge_amount` Nullable(UInt32),- `tax_amount` Nullable(UInt32),- `payment_method_id` Nullable(String),- `payment_method` LowCardinality(Nullable(String)),- `payment_method_type` LowCardinality(Nullable(String)),- `connector_transaction_id` Nullable(String),- `capture_method` Nullable(String),- `confirm` Bool,- `authentication_type` LowCardinality(Nullable(String)),- `cancellation_reason` Nullable(String),- `amount_to_capture` Nullable(UInt32),- `mandate_id` Nullable(String),- `browser_info` Nullable(String),- `error_code` Nullable(String),- `connector_metadata` Nullable(String),- `payment_experience` Nullable(String),- `created_at` DateTime64(3),- `capture_on` Nullable(DateTime64(3)),- `last_synced` Nullable(DateTime64(3)),- `modified_at` DateTime64(3),- `inserted_at` DateTime64(3),- `sign_flag` Int8-) AS-SELECT- payment_id,- merchant_id,- attempt_id,- status,- amount,- currency,- connector,- save_to_locker,- error_message,- offer_amount,- surcharge_amount,- tax_amount,- payment_method_id,- payment_method,- payment_method_type,- connector_transaction_id,- capture_method,- confirm,- authentication_type,- cancellation_reason,- amount_to_capture,- mandate_id,- browser_info,- error_code,- connector_metadata,- payment_experience,- created_at,- capture_on,- last_synced,- modified_at,- now() as inserted_at,- sign_flag-FROM- hyperswitch.payment_attempt_queue-WHERE length(_error) = 0;---CREATE TABLE hyperswitch.payment_attempt_clustered on cluster '{cluster}' (- `payment_id` String,- `merchant_id` String,- `attempt_id` String,- `status` LowCardinality(String),- `amount` Nullable(UInt32),- `currency` LowCardinality(Nullable(String)),- `connector` LowCardinality(Nullable(String)),- `save_to_locker` Nullable(Bool),- `error_message` Nullable(String),- `offer_amount` Nullable(UInt32),- `surcharge_amount` Nullable(UInt32),- `tax_amount` Nullable(UInt32),- `payment_method_id` Nullable(String),- `payment_method` LowCardinality(Nullable(String)),- `payment_method_type` LowCardinality(Nullable(String)),- `connector_transaction_id` Nullable(String),- `capture_method` Nullable(String),- `capture_on` Nullable(DateTime) CODEC(T64, LZ4),- `confirm` Bool,- `authentication_type` LowCardinality(Nullable(String)),- `cancellation_reason` Nullable(String),- `amount_to_capture` Nullable(UInt32),- `mandate_id` Nullable(String),- `browser_info` Nullable(String),- `error_code` Nullable(String),- `connector_metadata` Nullable(String),- `payment_experience` Nullable(String),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `last_synced` Nullable(DateTime) CODEC(T64, LZ4),- `modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `sign_flag` Int8,- INDEX connectorIndex connector TYPE bloom_filter GRANULARITY 1,- INDEX paymentMethodIndex payment_method TYPE bloom_filter GRANULARITY 1,- INDEX authenticationTypeIndex authentication_type TYPE bloom_filter GRANULARITY 1,- INDEX currencyIndex currency TYPE bloom_filter GRANULARITY 1,- INDEX statusIndex status TYPE bloom_filter GRANULARITY 1-) ENGINE = ReplicatedCollapsingMergeTree(- '/clickhouse/{installation}/{cluster}/tables/{shard}/hyperswitch/payment_attempt_clustered',- '{replica}',- sign_flag-)-PARTITION BY toStartOfDay(created_at)-ORDER BY- (created_at, merchant_id, attempt_id)-TTL created_at + toIntervalMonth(6)-;--CREATE MATERIALIZED VIEW hyperswitch.payment_attempt_parse_errors on cluster '{cluster}'-(- `topic` String,- `partition` Int64,- `offset` Int64,- `raw` String,- `error` String-)-ENGINE = MergeTree-ORDER BY (topic, partition, offset)-SETTINGS index_granularity = 8192 AS-SELECT- _topic AS topic,- _partition AS partition,- _offset AS offset,- _raw_message AS raw,- _error AS error-FROM hyperswitch.payment_attempt_queue-WHERE length(_error) > 0-;\ No newline at end of filediff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/payment_intents.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/payment_intents.sqldeleted file mode 100644index eb2d83140e..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/payment_intents.sql+++ /dev/null@@ -1,165 +0,0 @@-CREATE TABLE hyperswitch.payment_intents_queue on cluster '{cluster}' (- `payment_id` String,- `merchant_id` String,- `status` LowCardinality(String),- `amount` UInt32,- `currency` LowCardinality(Nullable(String)),- `amount_captured` Nullable(UInt32),- `customer_id` Nullable(String),- `description` Nullable(String),- `return_url` Nullable(String),- `connector_id` LowCardinality(Nullable(String)),- `statement_descriptor_name` Nullable(String),- `statement_descriptor_suffix` Nullable(String),- `setup_future_usage` LowCardinality(Nullable(String)),- `off_session` Nullable(Bool),- `client_secret` Nullable(String),- `active_attempt_id` String,- `business_country` String,- `business_label` String,- `modified_at` DateTime,- `created_at` DateTime,- `last_synced` Nullable(DateTime) CODEC(T64, LZ4),- `sign_flag` Int8-) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',-kafka_topic_list = 'hyperswitch-payment-intent-events',-kafka_group_name = 'hyper-c1',-kafka_format = 'JSONEachRow',-kafka_handle_error_mode = 'stream';--CREATE TABLE hyperswitch.payment_intents_dist on cluster '{cluster}' (- `payment_id` String,- `merchant_id` String,- `status` LowCardinality(String),- `amount` UInt32,- `currency` LowCardinality(Nullable(String)),- `amount_captured` Nullable(UInt32),- `customer_id` Nullable(String),- `description` Nullable(String),- `return_url` Nullable(String),- `connector_id` LowCardinality(Nullable(String)),- `statement_descriptor_name` Nullable(String),- `statement_descriptor_suffix` Nullable(String),- `setup_future_usage` LowCardinality(Nullable(String)),- `off_session` Nullable(Bool),- `client_secret` Nullable(String),- `active_attempt_id` String,- `business_country` LowCardinality(String),- `business_label` String,- `modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `last_synced` Nullable(DateTime) CODEC(T64, LZ4),- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `sign_flag` Int8-) ENGINE = Distributed('{cluster}', 'hyperswitch', 'payment_intents_clustered', cityHash64(payment_id));--CREATE TABLE hyperswitch.payment_intents_clustered on cluster '{cluster}' (- `payment_id` String,- `merchant_id` String,- `status` LowCardinality(String),- `amount` UInt32,- `currency` LowCardinality(Nullable(String)),- `amount_captured` Nullable(UInt32),- `customer_id` Nullable(String),- `description` Nullable(String),- `return_url` Nullable(String),- `connector_id` LowCardinality(Nullable(String)),- `statement_descriptor_name` Nullable(String),- `statement_descriptor_suffix` Nullable(String),- `setup_future_usage` LowCardinality(Nullable(String)),- `off_session` Nullable(Bool),- `client_secret` Nullable(String),- `active_attempt_id` String,- `business_country` LowCardinality(String),- `business_label` String,- `modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `last_synced` Nullable(DateTime) CODEC(T64, LZ4),- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `sign_flag` Int8,- INDEX connectorIndex connector_id TYPE bloom_filter GRANULARITY 1,- INDEX currencyIndex currency TYPE bloom_filter GRANULARITY 1,- INDEX statusIndex status TYPE bloom_filter GRANULARITY 1-) ENGINE = ReplicatedCollapsingMergeTree(- '/clickhouse/{installation}/{cluster}/tables/{shard}/hyperswitch/payment_intents_clustered',- '{replica}',- sign_flag-)-PARTITION BY toStartOfDay(created_at)-ORDER BY- (created_at, merchant_id, payment_id)-TTL created_at + toIntervalMonth(6)-;--CREATE MATERIALIZED VIEW hyperswitch.payment_intent_mv on cluster '{cluster}' TO hyperswitch.payment_intents_dist (- `payment_id` String,- `merchant_id` String,- `status` LowCardinality(String),- `amount` UInt32,- `currency` LowCardinality(Nullable(String)),- `amount_captured` Nullable(UInt32),- `customer_id` Nullable(String),- `description` Nullable(String),- `return_url` Nullable(String),- `connector_id` LowCardinality(Nullable(String)),- `statement_descriptor_name` Nullable(String),- `statement_descriptor_suffix` Nullable(String),- `setup_future_usage` LowCardinality(Nullable(String)),- `off_session` Nullable(Bool),- `client_secret` Nullable(String),- `active_attempt_id` String,- `business_country` LowCardinality(String),- `business_label` String,- `modified_at` DateTime64(3),- `created_at` DateTime64(3),- `last_synced` Nullable(DateTime64(3)),- `inserted_at` DateTime64(3),- `sign_flag` Int8-) AS-SELECT- payment_id,- merchant_id,- status,- amount,- currency,- amount_captured,- customer_id,- description,- return_url,- connector_id,- statement_descriptor_name,- statement_descriptor_suffix,- setup_future_usage,- off_session,- client_secret,- active_attempt_id,- business_country,- business_label,- modified_at,- created_at,- last_synced,- now() as inserted_at,- sign_flag-FROM hyperswitch.payment_intents_queue-WHERE length(_error) = 0;--CREATE MATERIALIZED VIEW hyperswitch.payment_intent_parse_errors on cluster '{cluster}'-(- `topic` String,- `partition` Int64,- `offset` Int64,- `raw` String,- `error` String-)-ENGINE = MergeTree-ORDER BY (topic, partition, offset)-SETTINGS index_granularity = 8192 AS-SELECT- _topic AS topic,- _partition AS partition,- _offset AS offset,- _raw_message AS raw,- _error AS error-FROM hyperswitch.payment_intents_queue-WHERE length(_error) > 0-;diff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/refund_analytics.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/refund_analytics.sqldeleted file mode 100644index bf5f6e0e24..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/refund_analytics.sql+++ /dev/null@@ -1,173 +0,0 @@-CREATE TABLE hyperswitch.refund_queue on cluster '{cluster}' (- `internal_reference_id` String,- `refund_id` String,- `payment_id` String,- `merchant_id` String,- `connector_transaction_id` String,- `connector` LowCardinality(Nullable(String)),- `connector_refund_id` Nullable(String),- `external_reference_id` Nullable(String),- `refund_type` LowCardinality(String),- `total_amount` Nullable(UInt32),- `currency` LowCardinality(String),- `refund_amount` Nullable(UInt32),- `refund_status` LowCardinality(String),- `sent_to_gateway` Bool,- `refund_error_message` Nullable(String),- `refund_arn` Nullable(String),- `attempt_id` String,- `description` Nullable(String),- `refund_reason` Nullable(String),- `refund_error_code` Nullable(String),- `created_at` DateTime,- `modified_at` DateTime,- `sign_flag` Int8-) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',-kafka_topic_list = 'hyperswitch-refund-events',-kafka_group_name = 'hyper-c1',-kafka_format = 'JSONEachRow',-kafka_handle_error_mode = 'stream';--CREATE TABLE hyperswitch.refund_dist on cluster '{cluster}' (- `internal_reference_id` String,- `refund_id` String,- `payment_id` String,- `merchant_id` String,- `connector_transaction_id` String,- `connector` LowCardinality(Nullable(String)),- `connector_refund_id` Nullable(String),- `external_reference_id` Nullable(String),- `refund_type` LowCardinality(String),- `total_amount` Nullable(UInt32),- `currency` LowCardinality(String),- `refund_amount` Nullable(UInt32),- `refund_status` LowCardinality(String),- `sent_to_gateway` Bool,- `refund_error_message` Nullable(String),- `refund_arn` Nullable(String),- `attempt_id` String,- `description` Nullable(String),- `refund_reason` Nullable(String),- `refund_error_code` Nullable(String),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `sign_flag` Int8-) ENGINE = Distributed('{cluster}', 'hyperswitch', 'refund_clustered', cityHash64(refund_id));----CREATE TABLE hyperswitch.refund_clustered on cluster '{cluster}' (- `internal_reference_id` String,- `refund_id` String,- `payment_id` String,- `merchant_id` String,- `connector_transaction_id` String,- `connector` LowCardinality(Nullable(String)),- `connector_refund_id` Nullable(String),- `external_reference_id` Nullable(String),- `refund_type` LowCardinality(String),- `total_amount` Nullable(UInt32),- `currency` LowCardinality(String),- `refund_amount` Nullable(UInt32),- `refund_status` LowCardinality(String),- `sent_to_gateway` Bool,- `refund_error_message` Nullable(String),- `refund_arn` Nullable(String),- `attempt_id` String,- `description` Nullable(String),- `refund_reason` Nullable(String),- `refund_error_code` Nullable(String),- `created_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),- `sign_flag` Int8,- INDEX connectorIndex connector TYPE bloom_filter GRANULARITY 1,- INDEX refundTypeIndex refund_type TYPE bloom_filter GRANULARITY 1,- INDEX currencyIndex currency TYPE bloom_filter GRANULARITY 1,- INDEX statusIndex refund_status TYPE bloom_filter GRANULARITY 1-) ENGINE = ReplicatedCollapsingMergeTree(- '/clickhouse/{installation}/{cluster}/tables/{shard}/hyperswitch/refund_clustered',- '{replica}',- sign_flag-)-PARTITION BY toStartOfDay(created_at)-ORDER BY- (created_at, merchant_id, refund_id)-TTL created_at + toIntervalMonth(6)-;--CREATE MATERIALIZED VIEW hyperswitch.kafka_parse_refund on cluster '{cluster}' TO hyperswitch.refund_dist (- `internal_reference_id` String,- `refund_id` String,- `payment_id` String,- `merchant_id` String,- `connector_transaction_id` String,- `connector` LowCardinality(Nullable(String)),- `connector_refund_id` Nullable(String),- `external_reference_id` Nullable(String),- `refund_type` LowCardinality(String),- `total_amount` Nullable(UInt32),- `currency` LowCardinality(String),- `refund_amount` Nullable(UInt32),- `refund_status` LowCardinality(String),- `sent_to_gateway` Bool,- `refund_error_message` Nullable(String),- `refund_arn` Nullable(String),- `attempt_id` String,- `description` Nullable(String),- `refund_reason` Nullable(String),- `refund_error_code` Nullable(String),- `created_at` DateTime64(3),- `modified_at` DateTime64(3),- `inserted_at` DateTime64(3),- `sign_flag` Int8-) AS-SELECT- internal_reference_id,- refund_id,- payment_id,- merchant_id,- connector_transaction_id,- connector,- connector_refund_id,- external_reference_id,- refund_type,- total_amount,- currency,- refund_amount,- refund_status,- sent_to_gateway,- refund_error_message,- refund_arn,- attempt_id,- description,- refund_reason,- refund_error_code,- created_at,- modified_at,- now() as inserted_at,- sign_flag-FROM hyperswitch.refund_queue-WHERE length(_error) = 0;--CREATE MATERIALIZED VIEW hyperswitch.refund_parse_errors on cluster '{cluster}'-(- `topic` String,- `partition` Int64,- `offset` Int64,- `raw` String,- `error` String-)-ENGINE = MergeTree-ORDER BY (topic, partition, offset)-SETTINGS index_granularity = 8192 AS-SELECT- _topic AS topic,- _partition AS partition,- _offset AS offset,- _raw_message AS raw,- _error AS error-FROM hyperswitch.refund_queue-WHERE length(_error) > 0-;\ No newline at end of filediff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/sdk_events.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/sdk_events.sqldeleted file mode 100644index 37766392bc..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/sdk_events.sql+++ /dev/null@@ -1,156 +0,0 @@-CREATE TABLE hyperswitch.sdk_events_queue on cluster '{cluster}' (- `payment_id` Nullable(String),- `merchant_id` String,- `remote_ip` Nullable(String),- `log_type` LowCardinality(Nullable(String)),- `event_name` LowCardinality(Nullable(String)),- `first_event` LowCardinality(Nullable(String)),- `latency` Nullable(UInt32),- `timestamp` String,- `browser_name` LowCardinality(Nullable(String)),- `browser_version` Nullable(String),- `platform` LowCardinality(Nullable(String)),- `source` LowCardinality(Nullable(String)),- `category` LowCardinality(Nullable(String)),- `version` LowCardinality(Nullable(String)),- `value` Nullable(String),- `component` LowCardinality(Nullable(String)),- `payment_method` LowCardinality(Nullable(String)),- `payment_experience` LowCardinality(Nullable(String))-) ENGINE = Kafka SETTINGS- kafka_broker_list = 'hyper-c1-kafka-brokers.kafka-cluster.svc.cluster.local:9092',- kafka_topic_list = 'hyper-sdk-logs',- kafka_group_name = 'hyper-c1',- kafka_format = 'JSONEachRow',- kafka_handle_error_mode = 'stream';--CREATE TABLE hyperswitch.sdk_events_clustered on cluster '{cluster}' (- `payment_id` Nullable(String),- `merchant_id` String,- `remote_ip` Nullable(String),- `log_type` LowCardinality(Nullable(String)),- `event_name` LowCardinality(Nullable(String)),- `first_event` Bool DEFAULT 1,- `browser_name` LowCardinality(Nullable(String)),- `browser_version` Nullable(String),- `platform` LowCardinality(Nullable(String)),- `source` LowCardinality(Nullable(String)),- `category` LowCardinality(Nullable(String)),- `version` LowCardinality(Nullable(String)),- `value` Nullable(String),- `component` LowCardinality(Nullable(String)),- `payment_method` LowCardinality(Nullable(String)),- `payment_experience` LowCardinality(Nullable(String)) DEFAULT '',- `created_at` DateTime64(3) DEFAULT now64() CODEC(T64, LZ4),- `inserted_at` DateTime64(3) DEFAULT now64() CODEC(T64, LZ4),- `latency` Nullable(UInt32) DEFAULT 0,- INDEX paymentMethodIndex payment_method TYPE bloom_filter GRANULARITY 1,- INDEX eventIndex event_name TYPE bloom_filter GRANULARITY 1,- INDEX platformIndex platform TYPE bloom_filter GRANULARITY 1,- INDEX logTypeIndex log_type TYPE bloom_filter GRANULARITY 1,- INDEX categoryIndex category TYPE bloom_filter GRANULARITY 1,- INDEX sourceIndex source TYPE bloom_filter GRANULARITY 1,- INDEX componentIndex component TYPE bloom_filter GRANULARITY 1,- INDEX firstEventIndex first_event TYPE bloom_filter GRANULARITY 1-) ENGINE = ReplicatedMergeTree(- '/clickhouse/{installation}/{cluster}/tables/{shard}/hyperswitch/sdk_events_clustered', '{replica}'-)-PARTITION BY- toStartOfDay(created_at)-ORDER BY- (created_at, merchant_id)-TTL- toDateTime(created_at) + toIntervalMonth(6)-SETTINGS- index_granularity = 8192-;--CREATE TABLE hyperswitch.sdk_events_dist on cluster '{cluster}' (- `payment_id` Nullable(String),- `merchant_id` String,- `remote_ip` Nullable(String),- `log_type` LowCardinality(Nullable(String)),- `event_name` LowCardinality(Nullable(String)),- `first_event` Bool DEFAULT 1,- `browser_name` LowCardinality(Nullable(String)),- `browser_version` Nullable(String),- `platform` LowCardinality(Nullable(String)),- `source` LowCardinality(Nullable(String)),- `category` LowCardinality(Nullable(String)),- `version` LowCardinality(Nullable(String)),- `value` Nullable(String),- `component` LowCardinality(Nullable(String)),- `payment_method` LowCardinality(Nullable(String)),- `payment_experience` LowCardinality(Nullable(String)) DEFAULT '',- `created_at` DateTime64(3) DEFAULT now64() CODEC(T64, LZ4),- `inserted_at` DateTime64(3) DEFAULT now64() CODEC(T64, LZ4),- `latency` Nullable(UInt32) DEFAULT 0-) ENGINE = Distributed(- '{cluster}', 'hyperswitch', 'sdk_events_clustered', rand()-);--CREATE MATERIALIZED VIEW hyperswitch.sdk_events_mv on cluster '{cluster}' TO hyperswitch.sdk_events_dist (- `payment_id` Nullable(String),- `merchant_id` String,- `remote_ip` Nullable(String),- `log_type` LowCardinality(Nullable(String)),- `event_name` LowCardinality(Nullable(String)),- `first_event` Bool,- `latency` Nullable(UInt32),- `browser_name` LowCardinality(Nullable(String)),- `browser_version` Nullable(String),- `platform` LowCardinality(Nullable(String)),- `source` LowCardinality(Nullable(String)),- `category` LowCardinality(Nullable(String)),- `version` LowCardinality(Nullable(String)),- `value` Nullable(String),- `component` LowCardinality(Nullable(String)),- `payment_method` LowCardinality(Nullable(String)),- `payment_experience` LowCardinality(Nullable(String)),- `created_at` DateTime64(3)-) AS-SELECT- payment_id,- merchant_id,- remote_ip,- log_type,- event_name,- multiIf(first_event = 'true', 1, 0) AS first_event,- latency,- browser_name,- browser_version,- platform,- source,- category,- version,- value,- component,- payment_method,- payment_experience,- toDateTime64(timestamp, 3) AS created_at-FROM- hyperswitch.sdk_events_queue-WHERE length(_error) = 0-;--CREATE MATERIALIZED VIEW hyperswitch.sdk_parse_errors on cluster '{cluster}' (- `topic` String,- `partition` Int64,- `offset` Int64,- `raw` String,- `error` String-) ENGINE = MergeTree- ORDER BY (topic, partition, offset)-SETTINGS- index_granularity = 8192 AS-SELECT- _topic AS topic,- _partition AS partition,- _offset AS offset,- _raw_message AS raw,- _error AS error-FROM- hyperswitch.sdk_events_queue-WHERE- length(_error) > 0-;diff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/seed_scripts.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/seed_scripts.sqldeleted file mode 100644index 202b94ac60..0000000000--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/seed_scripts.sql+++ /dev/null@@ -1 +0,0 @@-create database hyperswitch on cluster '{cluster}';\ No newline at end of filediff --git a/crates/analytics/docs/clickhouse/scripts/connector_events.sql b/crates/analytics/docs/clickhouse/scripts/connector_events.sqlindex 4a53f9edb0..47bbd7aec0 100644--- a/crates/analytics/docs/clickhouse/scripts/connector_events.sql+++ b/crates/analytics/docs/clickhouse/scripts/connector_events.sql@@ -6,6 +6,7 @@ CREATE TABLE connector_events_queue (`flow` LowCardinality(String),`request` String,`response` Nullable(String),+ `masked_response` Nullable(String),`error` Nullable(String),`status_code` UInt32,`created_at` DateTime64(3),@@ -28,22 +29,23 @@ CREATE TABLE connector_events_dist (`flow` LowCardinality(String),`request` String,`response` Nullable(String),+ `masked_response` Nullable(String),`error` Nullable(String),`status_code` UInt32,`created_at` DateTime64(3),- `inserted_at` DateTime64(3),+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),`latency` UInt128,`method` LowCardinality(String),`refund_id` Nullable(String),`dispute_id` Nullable(String),- INDEX flowIndex flowTYPE bloom_filter GRANULARITY 1,+ INDEX flowIndex flow TYPE bloom_filter GRANULARITY 1,INDEX connectorIndex connector_name TYPE bloom_filter GRANULARITY 1,INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1) ENGINE = MergeTreePARTITION BY toStartOfDay(created_at)ORDER BY- (created_at, merchant_id, flow_type, status_code, api_flow)-TTL created_at + toIntervalMonth(6)+ (created_at, merchant_id, connector_name, flow)+TTL inserted_at + toIntervalMonth(6);CREATE MATERIALIZED VIEW connector_events_mv TO connector_events_dist (@@ -54,6 +56,7 @@ CREATE MATERIALIZED VIEW connector_events_mv TO connector_events_dist (`flow` LowCardinality(String),`request` String,`response` Nullable(String),+ `masked_response` Nullable(String),`error` Nullable(String),`status_code` UInt32,`created_at` DateTime64(3),@@ -70,6 +73,7 @@ SELECTflow,request,response,+ masked_response,error,status_code,created_at,diff --git a/crates/analytics/src/connector_events/events.rs b/crates/analytics/src/connector_events/events.rsindex 47044811a8..0a13074d72 100644--- a/crates/analytics/src/connector_events/events.rs+++ b/crates/analytics/src/connector_events/events.rs@@ -62,6 +62,7 @@ pub struct ConnectorEventsResult {pub request_id: Option<String>,pub flow: String,pub request: String,+ #[serde(rename = "masked_response")]pub response: Option<String>,pub error: Option<String>,pub status_code: u16,diff --git a/crates/router/src/connector/aci.rs b/crates/router/src/connector/aci.rsindex bbb88209b2..b20b27f022 100644--- a/crates/router/src/connector/aci.rs+++ b/crates/router/src/connector/aci.rs@@ -11,6 +11,7 @@ use super::utils::PaymentsAuthorizeRequestData;use crate::{configs::settings,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -58,11 +59,14 @@ impl ConnectorCommon for Aci {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: aci::AciErrorResponse = res.response.parse_struct("AciErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::ErrorResponse {status_code: res.status_code,code: response.result.code,@@ -221,6 +225,7 @@ implfn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError>where@@ -231,6 +236,8 @@ implres.response.parse_struct("AciPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -242,8 +249,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -335,12 +343,15 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: aci::AciPaymentsResponse =res.response.parse_struct("AciPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -352,8 +363,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -422,12 +434,15 @@ implfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: aci::AciPaymentsResponse =res.response.parse_struct("AciPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -439,8 +454,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -522,12 +538,16 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: aci::AciRefundResponse = res.response.parse_struct("AciRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -538,8 +558,9 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rsindex 92c7e164c4..ed56fc5f52 100644--- a/crates/router/src/connector/aci/transformers.rs+++ b/crates/router/src/connector/aci/transformers.rs@@ -653,7 +653,7 @@ impl FromStr for AciPaymentStatus {}}-#[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq)]+#[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq, Serialize)]#[serde(rename_all = "camelCase")]pub struct AciPaymentsResponse {id: String,@@ -666,7 +666,7 @@ pub struct AciPaymentsResponse {pub(super) redirect: Option<AciRedirectionData>,}-#[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq)]+#[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq, Serialize)]#[serde(rename_all = "camelCase")]pub struct AciErrorResponse {ndc: String,@@ -675,7 +675,7 @@ pub struct AciErrorResponse {pub(super) result: ResultCode,}-#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]+#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]#[serde(rename_all = "camelCase")]pub struct AciRedirectionData {method: Option<services::Method>,@@ -683,13 +683,13 @@ pub struct AciRedirectionData {url: Url,}-#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]+#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]pub struct Parameters {name: String,value: String,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq, Eq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]#[serde(rename_all = "camelCase")]pub struct ResultCode {pub(super) code: String,@@ -697,7 +697,7 @@ pub struct ResultCode {pub(super) parameter_errors: Option<Vec<ErrorParameters>>,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq, Eq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]pub struct ErrorParameters {pub(super) name: String,pub(super) value: Option<String>,@@ -824,7 +824,7 @@ impl From<AciRefundStatus> for enums::RefundStatus {}#[allow(dead_code)]-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AciRefundResponse {id: String,diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rsindex fa9a5617ff..554de564b6 100644--- a/crates/router/src/connector/adyen.rs+++ b/crates/router/src/connector/adyen.rs@@ -16,6 +16,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -61,11 +62,16 @@ impl ConnectorCommon for Adyen {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: adyen::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response.error_code,@@ -207,6 +213,7 @@ implfn handle_response(&self,data: &types::SetupMandateRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<@@ -225,6 +232,8 @@ impl.response.parse_struct("AdyenPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from((types::ResponseRouterData {response,@@ -240,19 +249,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: adyen::ErrorResponse = res- .response- .parse_struct("ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- Ok(types::ErrorResponse {- status_code: res.status_code,- code: response.error_code,- message: response.message,- reason: None,- attempt_status: None,- connector_transaction_id: None,- })+ self.build_error_response(res, event_builder)}}@@ -338,13 +337,15 @@ implfn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: adyen::AdyenCaptureResponse = res.response.parse_struct("AdyenCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -355,19 +356,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: adyen::ErrorResponse = res- .response- .parse_struct("adyen::ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- Ok(types::ErrorResponse {- status_code: res.status_code,- code: response.error_code,- message: response.message,- reason: None,- attempt_status: None,- connector_transaction_id: None,- })+ self.build_error_response(res, event_builder)}}@@ -488,6 +479,7 @@ implfn handle_response(&self,data: &types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {logger::debug!(payment_sync_response=?res);@@ -495,6 +487,8 @@ impl.response.parse_struct("AdyenPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);let is_multiple_capture_sync = match data.request.sync_type {types::SyncRequestType::MultipleCaptureSync(_) => true,types::SyncRequestType::SinglePaymentSync => false,@@ -515,19 +509,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: adyen::ErrorResponse = res- .response- .parse_struct("ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- Ok(types::ErrorResponse {- status_code: res.status_code,- code: response.error_code,- message: response.message,- reason: None,- attempt_status: None,- connector_transaction_id: None,- })+ self.build_error_response(res, event_builder)}fn get_multiple_capture_sync_method(@@ -615,12 +599,15 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: adyen::AdyenPaymentResponse = res.response.parse_struct("AdyenPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from((types::ResponseRouterData {response,@@ -637,19 +624,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: adyen::ErrorResponse = res- .response- .parse_struct("ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- Ok(types::ErrorResponse {- status_code: res.status_code,- code: response.error_code,- message: response.message,- reason: None,- attempt_status: None,- connector_transaction_id: None,- })+ self.build_error_response(res, event_builder)}}@@ -724,12 +701,15 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: adyen::AdyenBalanceResponse = res.response.parse_struct("AdyenBalanceResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);let currency = match data.request.currency {Some(currency) => currency,@@ -769,8 +749,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -840,12 +821,15 @@ implfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: adyen::AdyenCancelResponse = res.response.parse_struct("AdyenCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -857,19 +841,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: adyen::ErrorResponse = res- .response- .parse_struct("ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- Ok(types::ErrorResponse {- status_code: res.status_code,- code: response.error_code,- message: response.message,- reason: None,- attempt_status: None,- connector_transaction_id: None,- })+ self.build_error_response(res, event_builder)}}@@ -950,12 +924,15 @@ impl services::ConnectorIntegration<api::PoCancel, types::PayoutsData, types::Pafn handle_response(&self,data: &types::PayoutsRouterData<api::PoCancel>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoCancel>, errors::ConnectorError> {let response: adyen::AdyenPayoutResponse = res.response.parse_struct("AdyenPayoutResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -966,8 +943,9 @@ impl services::ConnectorIntegration<api::PoCancel, types::PayoutsData, types::Pafn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1039,12 +1017,15 @@ impl services::ConnectorIntegration<api::PoCreate, types::PayoutsData, types::Pafn handle_response(&self,data: &types::PayoutsRouterData<api::PoCreate>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoCreate>, errors::ConnectorError> {let response: adyen::AdyenPayoutResponse = res.response.parse_struct("AdyenPayoutResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1055,8 +1036,9 @@ impl services::ConnectorIntegration<api::PoCreate, types::PayoutsData, types::Pafn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1133,12 +1115,15 @@ implfn handle_response(&self,data: &types::PayoutsRouterData<api::PoEligibility>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoEligibility>, errors::ConnectorError> {let response: adyen::AdyenPayoutResponse = res.response.parse_struct("AdyenPayoutResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1149,8 +1134,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1239,12 +1225,15 @@ impl services::ConnectorIntegration<api::PoFulfill, types::PayoutsData, types::Pfn handle_response(&self,data: &types::PayoutsRouterData<api::PoFulfill>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoFulfill>, errors::ConnectorError> {let response: adyen::AdyenPayoutResponse = res.response.parse_struct("AdyenPayoutResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1255,8 +1244,9 @@ impl services::ConnectorIntegration<api::PoFulfill, types::PayoutsData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1336,12 +1326,15 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: adyen::AdyenRefundResponse = res.response.parse_struct("AdyenRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1353,19 +1346,9 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- let response: adyen::ErrorResponse = res- .response- .parse_struct("ErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- Ok(types::ErrorResponse {- status_code: res.status_code,- code: response.error_code,- message: response.message,- reason: None,- attempt_status: None,- connector_transaction_id: None,- })+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rsindex 0d8343b0c8..a79826e2f1 100644--- a/crates/router/src/connector/adyen/transformers.rs+++ b/crates/router/src/connector/adyen/transformers.rs@@ -208,7 +208,7 @@ pub struct AdyenBalanceRequest<'a> {pub merchant_account: Secret<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AdyenBalanceResponse {pub psp_reference: String,@@ -297,7 +297,7 @@ pub struct AdyenThreeDS {pub result_code: Option<String>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum AdyenPaymentResponse {Response(Box<Response>),@@ -328,7 +328,7 @@ pub struct RedirectionErrorResponse {refusal_reason: String,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RedirectionResponse {result_code: AdyenStatus,@@ -337,7 +337,7 @@ pub struct RedirectionResponse {refusal_reason_code: Option<String>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PresentToShopperResponse {psp_reference: Option<String>,@@ -347,7 +347,7 @@ pub struct PresentToShopperResponse {refusal_reason_code: Option<String>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct QrCodeResponseResponse {result_code: AdyenStatus,@@ -1077,14 +1077,14 @@ pub struct AdyenCancelRequest {reference: String,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AdyenCancelResponse {psp_reference: String,status: CancelStatus,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum CancelStatus {Received,diff --git a/crates/router/src/connector/airwallex.rs b/crates/router/src/connector/airwallex.rsindex 19d69b688c..103c5852ac 100644--- a/crates/router/src/connector/airwallex.rs+++ b/crates/router/src/connector/airwallex.rs@@ -18,6 +18,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers, logger, routes,services::{self,@@ -83,6 +84,7 @@ impl ConnectorCommon for Airwallex {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {logger::debug!(payu_error_response=?res);let response: airwallex::AirwallexErrorResponse = res@@ -90,6 +92,9 @@ impl ConnectorCommon for Airwallex {.parse_struct("Airwallex ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.code,@@ -205,6 +210,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {logger::debug!(access_token_response=?res);@@ -213,6 +219,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("airwallex AirwallexAuthUpdateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -225,9 +234,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- logger::debug!(access_token_error_response=?res);- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -292,13 +301,17 @@ implfn handle_response(&self,data: &types::PaymentsInitRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsInitRouterData, errors::ConnectorError> {let response: airwallex::AirwallexPaymentsResponse = res.response.parse_struct("airwallex AirwallexPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(nuvei_session_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -311,8 +324,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -420,13 +434,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: airwallex::AirwallexPaymentsResponse = res.response.parse_struct("AirwallexPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(airwallexpayments_create_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -439,8 +455,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -496,6 +513,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {logger::debug!(payment_sync_response=?res);@@ -503,6 +521,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("airwallex AirwallexPaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::PaymentsSyncRouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -514,8 +534,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -584,12 +605,15 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: airwallex::AirwallexPaymentsResponse = res.response.parse_struct("AirwallexPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -601,8 +625,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -669,13 +694,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: airwallex::AirwallexPaymentsResponse = res.response.parse_struct("Airwallex PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(airwallexpayments_create_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -688,8 +715,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -743,13 +771,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: airwallex::AirwallexPaymentsResponse = res.response.parse_struct("Airwallex PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(airwallexpayments_create_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -780,8 +810,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -853,6 +884,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {logger::debug!(target: "router::connector::airwallex", response=?res);@@ -860,6 +892,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.response.parse_struct("airwallex RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -872,8 +906,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -923,6 +958,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {logger::debug!(target: "router::connector::airwallex", response=?res);@@ -930,6 +966,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("airwallex RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -942,8 +980,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rsindex 2de7f6fe00..692458715f 100644--- a/crates/router/src/connector/airwallex/transformers.rs+++ b/crates/router/src/connector/airwallex/transformers.rs@@ -259,7 +259,7 @@ fn get_wallet_details(Ok(wallet_details)}-#[derive(Deserialize)]+#[derive(Deserialize, Debug, Serialize)]pub struct AirwallexAuthUpdateResponse {#[serde(with = "common_utils::custom_serde::iso8601")]expires_at: PrimitiveDateTime,@@ -368,7 +368,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for AirwallexPaymentsCancelReques}// PaymentsResponse-#[derive(Debug, Clone, Default, Deserialize, PartialEq)]+#[derive(Debug, Clone, Default, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum AirwallexPaymentStatus {Succeeded,@@ -413,7 +413,7 @@ pub enum AirwallexNextActionStage {WaitingUserInfoInput,}-#[derive(Debug, Clone, Deserialize, PartialEq)]+#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct AirwallexRedirectFormData {#[serde(rename = "JWT")]jwt: Option<String>,@@ -424,7 +424,7 @@ pub struct AirwallexRedirectFormData {version: Option<String>,}-#[derive(Debug, Clone, Deserialize, PartialEq)]+#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct AirwallexPaymentsNextAction {url: Url,method: services::Method,@@ -432,7 +432,7 @@ pub struct AirwallexPaymentsNextAction {stage: AirwallexNextActionStage,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct AirwallexPaymentsResponse {status: AirwallexPaymentStatus,//Unique identifier for the PaymentIntent@@ -443,7 +443,7 @@ pub struct AirwallexPaymentsResponse {next_action: Option<AirwallexPaymentsNextAction>,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct AirwallexPaymentsSyncResponse {status: AirwallexPaymentStatus,//Unique identifier for the PaymentIntentdiff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rsindex 0686ee6a3b..e8ef9195d0 100644--- a/crates/router/src/connector/authorizedotnet.rs+++ b/crates/router/src/connector/authorizedotnet.rs@@ -15,6 +15,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self, request, ConnectorIntegration, ConnectorValidation},types::{@@ -196,6 +197,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {use bytes::Buf;@@ -209,7 +211,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymelet response: authorizedotnet::AuthorizedotnetPaymentsResponse = intermediate_response.parse_struct("AuthorizedotnetPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -220,8 +223,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -279,6 +283,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {use bytes::Buf;@@ -292,7 +297,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRelet response: authorizedotnet::AuthorizedotnetSyncResponse = intermediate_response.parse_struct("AuthorizedotnetSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -303,8 +309,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -378,6 +385,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {use bytes::Buf;@@ -391,6 +399,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Plet response: authorizedotnet::AuthorizedotnetPaymentsResponse = intermediate_response.parse_struct("AuthorizedotnetPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -401,8 +411,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -459,6 +470,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {use bytes::Buf;@@ -472,7 +484,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRlet response: authorizedotnet::AuthorizedotnetVoidResponse = intermediate_response.parse_struct("AuthorizedotnetPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -483,8 +496,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -554,6 +568,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {use bytes::Buf;@@ -567,7 +582,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponlet response: authorizedotnet::AuthorizedotnetRefundResponse = intermediate_response.parse_struct("AuthorizedotnetRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -578,8 +594,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -644,6 +661,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundsRouterData<api::RSync>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::RSync>, errors::ConnectorError> {use bytes::Buf;@@ -657,6 +675,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponselet response: authorizedotnet::AuthorizedotnetSyncResponse = intermediate_response.parse_struct("AuthorizedotnetSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -667,8 +687,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -742,6 +763,7 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {use bytes::Buf;@@ -755,7 +777,8 @@ impllet response: authorizedotnet::AuthorizedotnetPaymentsResponse = intermediate_response.parse_struct("AuthorizedotnetPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -766,8 +789,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- get_error_response(res)+ get_error_response(res, event_builder)}}@@ -873,11 +897,15 @@ fn get_error_response(status_code,..}: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: authorizedotnet::AuthorizedotnetPaymentsResponse = response.parse_struct("AuthorizedotnetPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+match response.transaction_response {Some(authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponse(payment_response,diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rsindex 96cf3b6ffc..3377457f38 100644--- a/crates/router/src/connector/authorizedotnet/transformers.rs+++ b/crates/router/src/connector/authorizedotnet/transformers.rs@@ -388,7 +388,7 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCaptureRouterData>>}}-#[derive(Debug, Clone, Default, serde::Deserialize)]+#[derive(Debug, Clone, Default, serde::Deserialize, serde::Serialize)]pub enum AuthorizedotnetPaymentStatus {#[serde(rename = "1")]Approved,@@ -403,7 +403,7 @@ pub enum AuthorizedotnetPaymentStatus {RequiresAction,}-#[derive(Debug, Clone, serde::Deserialize)]+#[derive(Debug, Clone, serde::Deserialize, Serialize)]pub enum AuthorizedotnetRefundStatus {#[serde(rename = "1")]Approved,@@ -448,27 +448,27 @@ pub struct ResponseMessages {pub message: Vec<ResponseMessage>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ErrorMessage {pub error_code: String,pub error_text: String,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum TransactionResponse {AuthorizedotnetTransactionResponse(Box<AuthorizedotnetTransactionResponse>),AuthorizedotnetTransactionResponseError(Box<AuthorizedotnetTransactionResponseError>),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "PascalCase")]pub struct AuthorizedotnetTransactionResponseError {_supplemental_data_qualification_indicator: i64,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AuthorizedotnetTransactionResponse {response_code: AuthorizedotnetPaymentStatus,@@ -480,7 +480,7 @@ pub struct AuthorizedotnetTransactionResponse {secure_acceptance: Option<SecureAcceptance>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RefundResponse {response_code: AuthorizedotnetRefundStatus,@@ -492,27 +492,27 @@ pub struct RefundResponse {pub errors: Option<Vec<ErrorMessage>>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "PascalCase")]pub struct SecureAcceptance {secure_acceptance_url: Option<url::Url>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AuthorizedotnetPaymentsResponse {pub transaction_response: Option<TransactionResponse>,pub messages: ResponseMessages,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AuthorizedotnetVoidResponse {pub transaction_response: Option<VoidResponse>,pub messages: ResponseMessages,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct VoidResponse {response_code: AuthorizedotnetVoidStatus,@@ -523,7 +523,7 @@ pub struct VoidResponse {pub errors: Option<Vec<ErrorMessage>>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub enum AuthorizedotnetVoidStatus {#[serde(rename = "1")]Approved,@@ -773,7 +773,7 @@ impl From<AuthorizedotnetRefundStatus> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AuthorizedotnetRefundResponse {pub transaction_response: RefundResponse,diff --git a/crates/router/src/connector/bambora.rs b/crates/router/src/connector/bambora.rsindex 37c6ae6cd6..df078e895d 100644--- a/crates/router/src/connector/bambora.rs+++ b/crates/router/src/connector/bambora.rs@@ -18,7 +18,8 @@ use crate::{errors::{self, CustomResult},payments,},- headers, logger,+ events::connector_api_logs::ConnectorEvent,+ headers,services::{self,request::{self, Mask},@@ -85,12 +86,16 @@ impl ConnectorCommon for Bambora {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bambora::BamboraErrorResponse = res.response.parse_struct("BamboraErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.code.to_string(),@@ -215,12 +220,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: bambora::BamboraResponse = res.response.parse_struct("bambora PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from((types::ResponseRouterData {response,@@ -235,8 +243,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -299,19 +308,23 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: bambora::BamboraResponse = res.response.parse_struct("bambora PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from((types::ResponseRouterData {response,@@ -384,13 +397,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: bambora::BamboraResponse = res.response.parse_struct("Bambora PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(bamborapayments_create_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from((types::ResponseRouterData {response,@@ -405,8 +420,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -478,13 +494,16 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: bambora::BamboraResponse = res.response.parse_struct("PaymentIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(bamborapayments_create_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from((types::ResponseRouterData {response,@@ -499,8 +518,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -569,12 +589,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: bambora::RefundResponse = res.response.parse_struct("bambora RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RefundsRouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -586,8 +609,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -637,12 +661,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: bambora::RefundResponse = res.response.parse_struct("bambora RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -654,8 +681,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -774,13 +802,16 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: bambora::BamboraResponse = res.response.parse_struct("Bambora PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(bamborapayments_create_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from((types::ResponseRouterData {response,@@ -795,7 +826,8 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rsindex 8f18ca272d..d2c99bbaca 100644--- a/crates/router/src/connector/bambora/transformers.rs+++ b/crates/router/src/connector/bambora/transformers.rs@@ -272,14 +272,14 @@ whereOk(res)}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BamboraResponse {NormalTransaction(Box<BamboraPaymentsResponse>),ThreeDsResponse(Box<Bambora3DsResponse>),}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct BamboraPaymentsResponse {#[serde(deserialize_with = "str_or_i32")]id: String,@@ -309,7 +309,7 @@ pub struct BamboraPaymentsResponse {risk_score: Option<f32>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct Bambora3DsResponse {#[serde(rename = "3d_session_data")]three_d_session_data: String,@@ -332,7 +332,7 @@ pub struct CardResponse {pub(crate) cres: Option<common_utils::pii::SecretSerdeValue>,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct CardData {name: Option<String>,expiry_month: Option<String>,@@ -466,7 +466,7 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct RefundResponse {#[serde(deserialize_with = "str_or_i32")]pub id: String,diff --git a/crates/router/src/connector/bankofamerica.rs b/crates/router/src/connector/bankofamerica.rsindex 589852c6b5..8a72e65f97 100644--- a/crates/router/src/connector/bankofamerica.rs+++ b/crates/router/src/connector/bankofamerica.rs@@ -18,6 +18,7 @@ use crate::{connector::{utils as connector_utils, utils::RefundsRequestData},consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -197,12 +198,16 @@ impl ConnectorCommon for Bankofamerica {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaErrorResponse = res.response.parse_struct("BankOfAmerica ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_message = if res.status_code == 401 {consts::CONNECTOR_UNAUTHORIZED_ERROR} else {@@ -390,12 +395,15 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaPreProcessingResponse = res.response.parse_struct("BankOfAmerica AuthEnrollmentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -406,8 +414,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -488,6 +497,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {if data.is_three_ds() && data.request.is_card() {@@ -495,6 +505,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Bankofamerica AuthSetupResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -505,6 +517,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Bankofamerica PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -516,18 +530,24 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaServerErrorResponse = res.response.parse_struct("BankOfAmericaServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+let attempt_status = match response.reason {Some(reason) => match reason {transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure),@@ -612,12 +632,15 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaPaymentsResponse = res.response.parse_struct("BankOfAmerica PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -628,18 +651,24 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaServerErrorResponse = res.response.parse_struct("BankOfAmericaServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+let attempt_status = match response.reason {Some(reason) => match reason {transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure),@@ -713,12 +742,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaTransactionResponse = res.response.parse_struct("BankOfAmerica PaymentSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -729,8 +761,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -800,12 +833,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaPaymentsResponse = res.response.parse_struct("BankOfAmerica PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -816,19 +852,24 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaServerErrorResponse = res.response.parse_struct("BankOfAmericaServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+Ok(ErrorResponse {status_code: res.status_code,reason: response.status.clone(),@@ -915,12 +956,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaPaymentsResponse = res.response.parse_struct("BankOfAmerica PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -931,19 +975,24 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaServerErrorResponse = res.response.parse_struct("BankOfAmericaServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+Ok(ErrorResponse {status_code: res.status_code,reason: response.status.clone(),@@ -1022,12 +1071,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaRefundResponse = res.response.parse_struct("bankofamerica RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1038,8 +1090,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1092,12 +1145,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: bankofamerica::BankOfAmericaRsyncResponse = res.response.parse_struct("bankofamerica RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1108,8 +1164,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rsindex 0b8158c10a..de53b991d8 100644--- a/crates/router/src/connector/bankofamerica/transformers.rs+++ b/crates/router/src/connector/bankofamerica/transformers.rs@@ -427,13 +427,13 @@ pub struct ClientProcessorInformation {avs: Option<Avs>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientRiskInformation {rules: Option<Vec<ClientRiskInformationRules>>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct ClientRiskInformationRules {name: String,}@@ -825,7 +825,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>>}}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum BankofamericaPaymentStatus {Authorized,@@ -886,7 +886,7 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaConsumerAuthInformationResponse {access_token: String,@@ -894,7 +894,7 @@ pub struct BankOfAmericaConsumerAuthInformationResponse {reference_id: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientAuthSetupInfoResponse {id: String,@@ -902,21 +902,21 @@ pub struct ClientAuthSetupInfoResponse {consumer_authentication_information: BankOfAmericaConsumerAuthInformationResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum BankOfAmericaAuthSetupResponse {ClientAuthSetupInfo(ClientAuthSetupInfoResponse),ErrorInformation(BankOfAmericaErrorInformationResponse),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum BankOfAmericaPaymentsResponse {ClientReferenceInformation(BankOfAmericaClientReferenceResponse),ErrorInformation(BankOfAmericaErrorInformationResponse),}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaClientReferenceResponse {id: String,@@ -927,14 +927,14 @@ pub struct BankOfAmericaClientReferenceResponse {error_information: Option<BankOfAmericaErrorInformation>,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaErrorInformationResponse {id: String,error_information: BankOfAmericaErrorInformation,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]pub struct BankOfAmericaErrorInformation {reason: Option<String>,message: Option<String>,@@ -1310,7 +1310,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsCompleteAuthorizeRouterDat}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum BankOfAmericaAuthEnrollmentStatus {PendingAuthentication,@@ -1334,7 +1334,7 @@ pub struct BankOfAmericaThreeDSMetadata {three_ds_data: BankOfAmericaConsumerAuthValidateResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaConsumerAuthInformationEnrollmentResponse {access_token: Option<String>,@@ -1344,7 +1344,7 @@ pub struct BankOfAmericaConsumerAuthInformationEnrollmentResponse {validate_response: BankOfAmericaConsumerAuthValidateResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientAuthCheckInfoResponse {id: String,@@ -1354,7 +1354,7 @@ pub struct ClientAuthCheckInfoResponse {error_information: Option<BankOfAmericaErrorInformation>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum BankOfAmericaPreProcessingResponse {ClientAuthCheckInfo(Box<ClientAuthCheckInfoResponse>),@@ -1644,14 +1644,14 @@ impl<F>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum BankOfAmericaTransactionResponse {ApplicationInformation(BankOfAmericaApplicationInfoResponse),ErrorInformation(BankOfAmericaErrorInformationResponse),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaApplicationInfoResponse {id: String,@@ -1660,7 +1660,7 @@ pub struct BankOfAmericaApplicationInfoResponse {error_information: Option<BankOfAmericaErrorInformation>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ApplicationInformation {status: BankofamericaPaymentStatus,@@ -1879,7 +1879,7 @@ impl From<BankofamericaRefundStatus> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaRefundResponse {id: String,@@ -1903,7 +1903,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, BankOfAmericaRefundR}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum BankofamericaRefundStatus {Succeeded,@@ -1913,13 +1913,13 @@ pub enum BankofamericaRefundStatus {Voided,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RsyncApplicationInformation {status: BankofamericaRefundStatus,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaRsyncResponse {id: String,@@ -1945,7 +1945,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, BankOfAmericaRsyncResp}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaStandardErrorResponse {pub error_information: Option<ErrorInformation>,@@ -1955,7 +1955,7 @@ pub struct BankOfAmericaStandardErrorResponse {pub details: Option<Vec<Details>>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BankOfAmericaServerErrorResponse {pub status: Option<String>,@@ -1963,7 +1963,7 @@ pub struct BankOfAmericaServerErrorResponse {pub reason: Option<Reason>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum Reason {SystemError,@@ -1971,32 +1971,32 @@ pub enum Reason {ServiceTimeout,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct BankOfAmericaAuthenticationErrorResponse {pub response: AuthenticationErrorInformation,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum BankOfAmericaErrorResponse {AuthenticationError(BankOfAmericaAuthenticationErrorResponse),StandardError(BankOfAmericaStandardErrorResponse),}-#[derive(Debug, Deserialize, Clone)]+#[derive(Debug, Deserialize, Clone, Serialize)]#[serde(rename_all = "camelCase")]pub struct Details {pub field: String,pub reason: String,}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]pub struct ErrorInformation {pub message: String,pub reason: String,}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]pub struct AuthenticationErrorInformation {pub rmsg: String,}diff --git a/crates/router/src/connector/bitpay.rs b/crates/router/src/connector/bitpay.rsindex 4a8108d04b..61e8cb03a2 100644--- a/crates/router/src/connector/bitpay.rs+++ b/crates/router/src/connector/bitpay.rs@@ -12,6 +12,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -109,10 +110,14 @@ impl ConnectorCommon for Bitpay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: bitpay::BitpayErrorResponse =res.response.parse_struct("BitpayErrorResponse").switch()?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response@@ -226,12 +231,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: bitpay::BitpayPaymentsResponse = res.response.parse_struct("Bitpay PaymentsAuthorizeResponse").switch()?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -242,8 +250,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -300,12 +309,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: bitpay::BitpayPaymentsResponse = res.response.parse_struct("bitpay PaymentsSyncResponse").switch()?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -316,8 +328,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/bitpay/transformers.rs b/crates/router/src/connector/bitpay/transformers.rsindex 0ddf2dbf91..148a5a4563 100644--- a/crates/router/src/connector/bitpay/transformers.rs+++ b/crates/router/src/connector/bitpay/transformers.rs@@ -266,7 +266,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct BitpayErrorResponse {pub error: String,pub code: Option<String>,diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rsindex e54d8320d0..824a073136 100644--- a/crates/router/src/connector/bluesnap.rs+++ b/crates/router/src/connector/bluesnap.rs@@ -24,6 +24,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -96,13 +97,16 @@ impl ConnectorCommon for Bluesnap {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {logger::debug!(bluesnap_error_response=?res);let response: bluesnap::BluesnapErrors = res.response.parse_struct("BluesnapErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);let response_error_message = match response {bluesnap::BluesnapErrors::Payment(error_response) => {@@ -307,12 +311,14 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: bluesnap::BluesnapPaymentsResponse = res.response.parse_struct("BluesnapPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -325,8 +331,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -399,19 +406,22 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: bluesnap::BluesnapPaymentsResponse = res.response.parse_struct("BluesnapPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -487,12 +497,14 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: bluesnap::BluesnapPaymentsResponse = res.response.parse_struct("Bluesnap BluesnapPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -505,8 +517,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -572,13 +585,15 @@ impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::Paymefn handle_response(&self,data: &types::PaymentsSessionRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSessionRouterData, errors::ConnectorError> {let response: bluesnap::BluesnapWalletTokenResponse = res.response.parse_struct("BluesnapWalletTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(connector_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -589,8 +604,9 @@ impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -681,6 +697,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {match (data.is_three_ds() && data.request.is_card(), res.headers) {@@ -692,6 +709,13 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.last().ok_or(errors::ConnectorError::ResponseHandlingFailed)?.to_string();++ let response =+ serde_json::json!({"payment_fields_token": payment_fields_token.clone()});++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::RouterData {status: enums::AttemptStatus::AuthenticationPending,response: Ok(types::PaymentsResponseData::TransactionResponse {@@ -713,6 +737,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("BluesnapPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -726,8 +751,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -799,12 +825,14 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: bluesnap::BluesnapPaymentsResponse = res.response.parse_struct("BluesnapPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -817,8 +845,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -891,12 +920,14 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: bluesnap::RefundResponse = res.response.parse_struct("bluesnap RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -909,8 +940,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -974,12 +1006,14 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: bluesnap::BluesnapPaymentsResponse = res.response.parse_struct("bluesnap BluesnapPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -992,8 +1026,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rsindex e98b98e874..f1c27d7274 100644--- a/crates/router/src/connector/bluesnap/transformers.rs+++ b/crates/router/src/connector/bluesnap/transformers.rs@@ -926,14 +926,14 @@ impl<F> TryFrom<&BluesnapRouterData<&types::RefundsRouterData<F>>> for BluesnapR}}-#[derive(Debug, Clone, Default, Deserialize)]+#[derive(Debug, Clone, Default, Deserialize, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum BluesnapRefundStatus {Success,#[default]Pending,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RefundResponse {refund_transaction_id: i32,@@ -1122,13 +1122,13 @@ pub struct ErrorDetails {pub error_name: Option<String>,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BluesnapErrorResponse {pub message: Vec<ErrorDetails>,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BluesnapAuthErrorResponse {pub error_code: String,@@ -1136,7 +1136,7 @@ pub struct BluesnapAuthErrorResponse {pub error_name: Option<String>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BluesnapErrors {Payment(BluesnapErrorResponse),diff --git a/crates/router/src/connector/boku.rs b/crates/router/src/connector/boku.rsindex 39566e08d4..7b470593e7 100644--- a/crates/router/src/connector/boku.rs+++ b/crates/router/src/connector/boku.rs@@ -15,6 +15,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers, logger,routes::metrics,services::{@@ -117,6 +118,7 @@ impl ConnectorCommon for Boku {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response_data: Result<boku::BokuErrorResponse, Report<errors::ConnectorError>> = res.response@@ -124,15 +126,19 @@ impl ConnectorCommon for Boku {.change_context(errors::ConnectorError::ResponseDeserializationFailed);match response_data {- Ok(response) => Ok(ErrorResponse {- status_code: res.status_code,- code: response.code,- message: response.message,- reason: response.reason,- attempt_status: None,- connector_transaction_id: None,- }),- Err(_) => get_xml_deserialized(res),+ Ok(response) => {+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+ Ok(ErrorResponse {+ status_code: res.status_code,+ code: response.code,+ message: response.message,+ reason: response.reason,+ attempt_status: None,+ connector_transaction_id: None,+ })+ }+ Err(_) => get_xml_deserialized(res, event_builder),}}}@@ -252,6 +258,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response_data = String::from_utf8(res.response.to_vec())@@ -262,7 +269,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.parse_xml::<boku::BokuResponse>().into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -273,8 +281,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -336,6 +345,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response_data = String::from_utf8(res.response.to_vec())@@ -346,7 +356,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.parse_xml::<boku::BokuResponse>().into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -357,8 +368,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -416,6 +428,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response_data = String::from_utf8(res.response.to_vec())@@ -426,7 +439,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme.parse_xml::<boku::BokuResponse>().into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -437,8 +451,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -504,12 +519,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: boku::RefundResponse = res.response.parse_struct("boku RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -520,8 +540,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -581,12 +602,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: boku::BokuRsyncResponse = res.response.parse_struct("boku BokuRsyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -597,8 +621,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -638,7 +663,10 @@ fn get_country_url(}// validate xml format for the error-fn get_xml_deserialized(res: Response) -> CustomResult<ErrorResponse, errors::ConnectorError> {+fn get_xml_deserialized(+ res: Response,+ event_builder: Option<&mut ConnectorEvent>,+) -> CustomResult<ErrorResponse, errors::ConnectorError> {metrics::RESPONSE_DESERIALIZATION_FAILURE.add(&metrics::CONTEXT,1,@@ -649,6 +677,9 @@ fn get_xml_deserialized(res: Response) -> CustomResult<ErrorResponse, errors::Co.into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response_data));+ router_env::logger::info!(connector_response=?response_data);+// check for whether the response is in xml formatmatch roxmltree::Document::parse(&response_data) {// in case of unexpected response but in xml formatdiff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rsindex 6d830f8511..5f36225fd4 100644--- a/crates/router/src/connector/boku/transformers.rs+++ b/crates/router/src/connector/boku/transformers.rs@@ -225,14 +225,14 @@ pub struct BokuMetaData {pub(super) country: String,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub enum BokuResponse {BeginSingleChargeResponse(BokuPaymentsResponse),QueryChargeResponse(BokuPsyncResponse),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub struct BokuPaymentsResponse {charge_status: String, // xml parse only string to fields@@ -240,26 +240,26 @@ pub struct BokuPaymentsResponse {hosted: Option<HostedUrlResponse>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub struct HostedUrlResponse {redirect_url: Option<Url>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename = "query-charge-response")]#[serde(rename_all = "kebab-case")]pub struct BokuPsyncResponse {charges: ChargeResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub struct ChargeResponseData {charge: SingleChargeResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub struct SingleChargeResponseData {charge_status: String,@@ -368,7 +368,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for BokuRefundRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename = "refund-charge-response")]pub struct RefundResponse {charge_id: String,@@ -424,20 +424,20 @@ impl TryFrom<&types::RefundSyncRouterData> for BokuRsyncRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename = "query-refund-response")]#[serde(rename_all = "kebab-case")]pub struct BokuRsyncResponse {refunds: RefundResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub struct RefundResponseData {refund: SingleRefundResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "kebab-case")]pub struct SingleRefundResponseData {refund_status: String, // quick-xml only parse string as a fielddiff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rsindex 4f2686abb1..629a966103 100644--- a/crates/router/src/connector/braintree.rs+++ b/crates/router/src/connector/braintree.rs@@ -20,6 +20,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -103,12 +104,16 @@ impl ConnectorCommon for Braintree {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: Result<braintree::ErrorResponse, Report<common_utils::errors::ParsingError>> =res.response.parse_struct("Braintree Error Response");match response {Ok(braintree::ErrorResponse::BraintreeApiErrorResponse(response)) => {+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_object = response.api_error_response.errors;let error = error_object.errors.first().or(error_object.transaction@@ -135,15 +140,21 @@ impl ConnectorCommon for Braintree {connector_transaction_id: None,})}- Ok(braintree::ErrorResponse::BraintreeErrorResponse(response)) => Ok(ErrorResponse {- status_code: res.status_code,- code: consts::NO_ERROR_CODE.to_string(),- message: consts::NO_ERROR_MESSAGE.to_string(),- reason: Some(response.errors),- attempt_status: None,- connector_transaction_id: None,- }),+ Ok(braintree::ErrorResponse::BraintreeErrorResponse(response)) => {+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);++ Ok(ErrorResponse {+ status_code: res.status_code,+ code: consts::NO_ERROR_CODE.to_string(),+ message: consts::NO_ERROR_MESSAGE.to_string(),+ reason: Some(response.errors),+ attempt_status: None,+ connector_transaction_id: None,+ })+ }Err(error_msg) => {+ event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));logger::error!(deserialization_error =? error_msg);utils::handle_json_response_deserialization_failure(res, "braintree".to_owned())}@@ -256,8 +267,9 @@ impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_request_body(@@ -272,12 +284,15 @@ impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::Paymefn handle_response(&self,data: &types::PaymentsSessionRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSessionRouterData, errors::ConnectorError> {let response: braintree::BraintreeSessionTokenResponse = res.response.parse_struct("braintree SessionTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -355,6 +370,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -364,6 +380,8 @@ impl.response.parse_struct("BraintreeTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -374,8 +392,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -505,12 +524,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: braintree_graphql_transformers::BraintreeCaptureResponse = res.response.parse_struct("Braintree PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -521,8 +543,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -646,6 +669,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let connector_api_version = &data.connector_api_version;@@ -655,6 +679,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("Braintree PaymentSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -666,6 +692,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("Braintree PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -678,8 +706,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -796,6 +825,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let connector_api_version = &data.connector_api_version;@@ -806,6 +836,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Braintree PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -817,6 +849,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Braintree AuthResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -829,6 +863,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Braintree PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -841,8 +877,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -947,6 +984,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let connector_api_version = &data.connector_api_version;@@ -956,6 +994,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR.response.parse_struct("Braintree VoidResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -967,6 +1007,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR.response.parse_struct("Braintree PaymentsVoidResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -979,8 +1021,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1103,6 +1146,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let connector_api_version = &data.connector_api_version;@@ -1112,6 +1156,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.response.parse_struct("Braintree RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1123,6 +1169,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.response.parse_struct("Braintree RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1135,8 +1183,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1221,6 +1270,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>,@@ -1233,6 +1283,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("Braintree RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1244,6 +1296,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("Braintree RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1255,8 +1309,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1626,6 +1681,7 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {match connector_utils::PaymentsCompleteAuthorizeRequestData::is_auto_capture(&data.request)?@@ -1635,6 +1691,7 @@ impl.response.parse_struct("Braintree PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -1647,6 +1704,8 @@ impl.response.parse_struct("Braintree AuthResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1659,7 +1718,8 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs b/crates/router/src/connector/braintree/braintree_graphql_transformers.rsindex e0baf034f7..436cd8dfa3 100644--- a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs+++ b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs@@ -182,12 +182,12 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>>}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct AuthResponse {data: DataAuthResponse,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeAuthResponse {AuthResponse(Box<AuthResponse>),@@ -195,26 +195,26 @@ pub enum BraintreeAuthResponse {ErrorResponse(Box<ErrorResponse>),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeCompleteAuthResponse {AuthResponse(Box<AuthResponse>),ErrorResponse(Box<ErrorResponse>),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct TransactionAuthChargeResponseBody {id: String,status: BraintreePaymentStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct DataAuthResponse {authorize_credit_card: AuthChargeCreditCard,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct AuthChargeCreditCard {transaction: TransactionAuthChargeResponseBody,}@@ -351,7 +351,7 @@ fn get_error_response<T>(// }// }-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum BraintreePaymentStatus {Authorized,@@ -369,13 +369,13 @@ pub enum BraintreePaymentStatus {SubmittedForSettlement,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct ErrorDetails {pub message: String,pub extensions: Option<AdditionalErrorDetails>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AdditionalErrorDetails {pub legacy_code: Option<String>,@@ -553,12 +553,12 @@ impl<F>}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct PaymentsResponse {data: DataResponse,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreePaymentsResponse {PaymentsResponse(Box<PaymentsResponse>),@@ -566,14 +566,14 @@ pub enum BraintreePaymentsResponse {ErrorResponse(Box<ErrorResponse>),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeCompleteChargeResponse {PaymentsResponse(Box<PaymentsResponse>),ErrorResponse(Box<ErrorResponse>),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct DataResponse {charge_credit_card: AuthChargeCreditCard,@@ -633,7 +633,7 @@ impl<F> TryFrom<BraintreeRouterData<&types::RefundsRouterData<F>>> for Braintree}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum BraintreeRefundStatus {SettlementPending,@@ -654,30 +654,30 @@ impl From<BraintreeRefundStatus> for enums::RefundStatus {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct BraintreeRefundTransactionBody {pub id: String,pub status: BraintreeRefundStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct BraintreeRefundTransaction {pub refund: BraintreeRefundTransactionBody,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BraintreeRefundResponseData {pub refund_transaction: BraintreeRefundTransaction,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RefundResponse {pub data: BraintreeRefundResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeRefundResponse {RefundResponse(Box<RefundResponse>),@@ -733,38 +733,38 @@ impl TryFrom<&types::RefundSyncRouterData> for BraintreeRSyncRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RSyncNodeData {id: String,status: BraintreeRefundStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RSyncEdgeData {node: RSyncNodeData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RefundData {edges: Vec<RSyncEdgeData>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RSyncSearchData {refunds: RefundData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RSyncResponseData {search: RSyncSearchData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct RSyncResponse {data: RSyncResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeRSyncResponse {RSyncResponse(Box<RSyncResponse>),@@ -897,51 +897,51 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest {}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct TokenizePaymentMethodData {id: String,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TokenizeCreditCardData {payment_method: TokenizePaymentMethodData,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientToken {client_token: Secret<String>,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TokenizeCreditCard {tokenize_credit_card: TokenizeCreditCardData,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientTokenData {create_client_token: ClientToken,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct ClientTokenResponse {data: ClientTokenData,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct TokenResponse {data: TokenizeCreditCard,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct ErrorResponse {errors: Vec<ErrorDetails>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeTokenResponse {TokenResponse(Box<TokenResponse>),@@ -1020,29 +1020,29 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCaptureRouterData>> for Braint}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CaptureResponseTransactionBody {id: String,status: BraintreePaymentStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CaptureTransactionData {transaction: CaptureResponseTransactionBody,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CaptureResponseData {capture_transaction: CaptureTransactionData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CaptureResponse {data: CaptureResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeCaptureResponse {CaptureResponse(Box<CaptureResponse>),@@ -1112,29 +1112,29 @@ impl TryFrom<&types::PaymentsCancelRouterData> for BraintreeCancelRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CancelResponseTransactionBody {id: String,status: BraintreePaymentStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CancelTransactionData {reversal: CancelResponseTransactionBody,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CancelResponseData {reverse_transaction: CancelTransactionData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CancelResponse {data: CancelResponseData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreeCancelResponse {CancelResponse(Box<CancelResponse>),@@ -1194,40 +1194,40 @@ impl TryFrom<&types::PaymentsSyncRouterData> for BraintreePSyncRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct NodeData {id: String,status: BraintreePaymentStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct EdgeData {node: NodeData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct TransactionData {edges: Vec<EdgeData>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct SearchData {transactions: TransactionData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct PSyncResponseData {search: SearchData,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum BraintreePSyncResponse {PSyncResponse(Box<PSyncResponse>),ErrorResponse(Box<ErrorResponse>),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct PSyncResponse {data: PSyncResponseData,}diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rsindex f4bd62add3..8846753117 100644--- a/crates/router/src/connector/braintree/transformers.rs+++ b/crates/router/src/connector/braintree/transformers.rs@@ -178,7 +178,7 @@ impl TryFrom<&types::ConnectorAuthType> for BraintreeAuthType {}}-#[derive(Debug, Default, Clone, Deserialize, Eq, PartialEq)]+#[derive(Debug, Default, Clone, Deserialize, Eq, PartialEq, Serialize)]#[serde(rename_all = "snake_case")]pub enum BraintreePaymentStatus {Succeeded,@@ -272,25 +272,25 @@ impl<F, T>}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BraintreePaymentsResponse {transaction: TransactionResponse,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientToken {pub value: String,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BraintreeSessionTokenResponse {pub client_token: ClientToken,}-#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq, Serialize)]#[serde(rename_all = "camelCase")]pub struct TransactionResponse {id: String,@@ -299,42 +299,42 @@ pub struct TransactionResponse {status: BraintreePaymentStatus,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BraintreeApiErrorResponse {pub api_error_response: ApiErrorResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ErrorsObject {pub errors: Vec<ErrorObject>,pub transaction: Option<TransactionError>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TransactionError {pub errors: Vec<ErrorObject>,pub credit_card: Option<CreditCardError>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CreditCardError {pub errors: Vec<ErrorObject>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ErrorObject {pub code: String,pub message: String,}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct BraintreeErrorResponse {pub errors: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]#[serde(untagged)]@@ -343,7 +343,7 @@ pub enum ErrorResponse {BraintreeErrorResponse(Box<BraintreeErrorResponse>),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ApiErrorResponse {pub message: String,pub errors: ErrorsObject,@@ -378,7 +378,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for BraintreeRefundRequest {}#[allow(dead_code)]-#[derive(Debug, Default, Deserialize, Clone)]+#[derive(Debug, Default, Deserialize, Clone, Serialize)]pub enum RefundStatus {Succeeded,Failed,@@ -396,7 +396,7 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct RefundResponse {pub id: String,pub status: RefundStatus,diff --git a/crates/router/src/connector/cashtocode.rs b/crates/router/src/connector/cashtocode.rsindex 5a628f775b..127451f383 100644--- a/crates/router/src/connector/cashtocode.rs+++ b/crates/router/src/connector/cashtocode.rs@@ -12,6 +12,7 @@ use super::utils as connector_utils;use crate::{configs::settings::{self},core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -109,11 +110,16 @@ impl ConnectorCommon for Cashtocode {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: cashtocode::CashtocodeErrorResponse = res.response.parse_struct("CashtocodeErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error.to_string(),@@ -249,12 +255,16 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: cashtocode::CashtocodePaymentsResponse = res.response.parse_struct("Cashtocode PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -265,8 +275,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -277,12 +288,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: transformers::CashtocodePaymentsSyncResponse = res.response.parse_struct("CashtocodePaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -293,8 +307,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/cashtocode/transformers.rs b/crates/router/src/connector/cashtocode/transformers.rsindex 8a92956756..6e930d5cb4 100644--- a/crates/router/src/connector/cashtocode/transformers.rs+++ b/crates/router/src/connector/cashtocode/transformers.rs@@ -168,7 +168,7 @@ impl From<CashtocodePaymentStatus> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize, Clone)]+#[derive(Debug, Deserialize, Clone, Serialize)]pub struct CashtocodeErrors {pub message: String,pub path: String,@@ -176,20 +176,20 @@ pub struct CashtocodeErrors {pub event_type: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CashtocodePaymentsResponse {CashtoCodeError(CashtocodeErrorResponse),CashtoCodeData(CashtocodePaymentsResponseData),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CashtocodePaymentsResponseData {pub pay_url: url::Url,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CashtocodePaymentsSyncResponse {pub transaction_id: String,@@ -319,7 +319,7 @@ impl<F, T>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CashtocodeErrorResponse {pub error: serde_json::Value,pub error_description: String,diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rsindex 382737a28f..ea2c4fefd3 100644--- a/crates/router/src/connector/checkout.rs+++ b/crates/router/src/connector/checkout.rs@@ -19,6 +19,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -89,6 +90,7 @@ impl ConnectorCommon for Checkout {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: checkout::ErrorResponse = if res.response.is_empty() {let (error_codes, error_type) = if res.status_code == 401 {@@ -110,7 +112,9 @@ impl ConnectorCommon for Checkout {.change_context(errors::ConnectorError::ResponseDeserializationFailed)?};- router_env::logger::info!(error_response=?response);+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let errors_list = response.error_codes.clone().unwrap_or_default();let option_error_code_message = conn_utils::get_error_code_error_message_based_on_priority(self.clone(),@@ -237,6 +241,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -246,8 +251,8 @@ impl.response.parse_struct("CheckoutTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);-types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -259,8 +264,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -362,14 +368,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: checkout::PaymentCaptureResponse = res.response.parse_struct("CaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);-types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -381,8 +388,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -436,6 +444,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError>where@@ -449,6 +458,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("checkout::PaymentsResponseEnum").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -462,6 +472,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -482,8 +493,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -549,12 +561,14 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: checkout::PaymentsResponse = res.response.parse_struct("PaymentIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -567,8 +581,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -624,14 +639,18 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let mut response: checkout::PaymentVoidResponse = res.response.parse_struct("PaymentVoidResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);+response.status = res.status_code;+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -643,8 +662,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -717,12 +737,14 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: checkout::RefundResponse = res.response.parse_struct("checkout::RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);let response = checkout::CheckoutRefundResponse {response,@@ -740,8 +762,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -785,6 +808,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundsRouterData<api::RSync>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::RSync>, errors::ConnectorError> {let refund_action_id = data.request.get_connector_refund_id()?;@@ -793,6 +817,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("checkout::CheckoutRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);let response = response@@ -811,8 +837,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -870,6 +897,7 @@ implfn handle_response(&self,data: &types::AcceptDisputeRouterData,+ _event_builder: Option<&mut ConnectorEvent>,_res: types::Response,) -> CustomResult<types::AcceptDisputeRouterData, errors::ConnectorError> {Ok(types::AcceptDisputeRouterData {@@ -884,8 +912,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -983,6 +1012,7 @@ impl ConnectorIntegration<api::Upload, types::UploadFileRequestData, types::Uplofn handle_response(&self,data: &types::UploadFileRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<api::Upload, types::UploadFileRequestData, types::UploadFileResponse>,@@ -992,6 +1022,7 @@ impl ConnectorIntegration<api::Upload, types::UploadFileRequestData, types::Uplo.response.parse_struct("Checkout FileUploadResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);Ok(types::UploadFileRouterData {response: Ok(types::UploadFileResponse {@@ -1004,8 +1035,9 @@ impl ConnectorIntegration<api::Upload, types::UploadFileRequestData, types::Uplofn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1077,6 +1109,7 @@ implfn handle_response(&self,data: &types::SubmitEvidenceRouterData,+ _event_builder: Option<&mut ConnectorEvent>,_res: types::Response,) -> CustomResult<types::SubmitEvidenceRouterData, errors::ConnectorError> {Ok(types::SubmitEvidenceRouterData {@@ -1091,8 +1124,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1148,6 +1182,7 @@ implfn handle_response(&self,data: &types::DefendDisputeRouterData,+ _event_builder: Option<&mut ConnectorEvent>,_res: types::Response,) -> CustomResult<types::DefendDisputeRouterData, errors::ConnectorError> {Ok(types::DefendDisputeRouterData {@@ -1162,8 +1197,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rsindex 6e7656c38a..f96bd50ffc 100644--- a/crates/router/src/connector/checkout/transformers.rs+++ b/crates/router/src/connector/checkout/transformers.rs@@ -152,7 +152,7 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest {}}-#[derive(Debug, Eq, PartialEq, Deserialize)]+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct CheckoutTokenResponse {token: Secret<String>,}@@ -555,7 +555,7 @@ pub struct PaymentsResponse {response_summary: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum PaymentsResponseEnum {ActionResponse(Vec<ActionResponse>),@@ -723,7 +723,7 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponseEnum>>pub struct PaymentVoidRequest {reference: String,}-#[derive(Clone, Default, Debug, Eq, PartialEq, Deserialize)]+#[derive(Clone, Default, Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct PaymentVoidResponse {#[serde(skip)]pub(super) status: u16,@@ -816,7 +816,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsCaptureRouterData>> for Payment}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct PaymentCaptureResponse {pub action_id: String,pub reference: Option<String>,@@ -885,7 +885,7 @@ impl<F> TryFrom<&CheckoutRouterData<&types::RefundsRouterData<F>>> for RefundReq}}#[allow(dead_code)]-#[derive(Deserialize, Debug)]+#[derive(Deserialize, Debug, Serialize)]pub struct RefundResponse {action_id: String,reference: String,@@ -943,14 +943,14 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, CheckoutRefundResponse}}-#[derive(Debug, Default, Eq, PartialEq, Deserialize)]+#[derive(Debug, Default, Eq, PartialEq, Deserialize, Serialize)]pub struct ErrorResponse {pub request_id: Option<String>,pub error_type: Option<String>,pub error_codes: Option<Vec<String>>,}-#[derive(Deserialize, Debug, PartialEq)]+#[derive(Deserialize, Debug, PartialEq, Serialize)]pub enum ActionType {Authorization,Void,@@ -962,7 +962,7 @@ pub enum ActionType {CardVerification,}-#[derive(Deserialize, Debug)]+#[derive(Deserialize, Debug, Serialize)]pub struct ActionResponse {#[serde(rename = "id")]pub action_id: String,@@ -1278,7 +1278,7 @@ pub fn construct_file_upload_request(Ok(multipart)}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct FileUploadResponse {#[serde(rename = "id")]pub file_id: String,diff --git a/crates/router/src/connector/coinbase.rs b/crates/router/src/connector/coinbase.rsindex 76f88b6632..1886b65117 100644--- a/crates/router/src/connector/coinbase.rs+++ b/crates/router/src/connector/coinbase.rs@@ -13,6 +13,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -97,12 +98,16 @@ impl ConnectorCommon for Coinbase {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: coinbase::CoinbaseErrorResponse = res.response.parse_struct("CoinbaseErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error.error_type,@@ -229,12 +234,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: coinbase::CoinbasePaymentsResponse = res.response.parse_struct("Coinbase PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -246,8 +254,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -300,12 +309,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: coinbase::CoinbasePaymentsResponse = res.response.parse_struct("coinbase PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -317,8 +329,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/coinbase/transformers.rs b/crates/router/src/connector/coinbase/transformers.rsindex b1435e50df..5b3b6f6327 100644--- a/crates/router/src/connector/coinbase/transformers.rs+++ b/crates/router/src/connector/coinbase/transformers.rs@@ -234,7 +234,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CoinbaseErrorData {#[serde(rename = "type")]pub error_type: String,@@ -242,7 +242,7 @@ pub struct CoinbaseErrorData {pub code: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CoinbaseErrorResponse {pub error: CoinbaseErrorData,}diff --git a/crates/router/src/connector/cryptopay.rs b/crates/router/src/connector/cryptopay.rsindex 8727461ba3..af33ae21d7 100644--- a/crates/router/src/connector/cryptopay.rs+++ b/crates/router/src/connector/cryptopay.rs@@ -20,6 +20,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -160,12 +161,16 @@ impl ConnectorCommon for Cryptopay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: cryptopay::CryptopayErrorResponse = res.response.parse_struct("CryptopayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error.code,@@ -273,12 +278,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: cryptopay::CryptopayPaymentsResponse = res.response.parse_struct("Cryptopay PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -289,8 +297,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -353,12 +362,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: cryptopay::CryptopayPaymentsResponse = res.response.parse_struct("cryptopay PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -369,8 +381,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rsindex 7970656d6e..5597af94e3 100644--- a/crates/router/src/connector/cybersource.rs+++ b/crates/router/src/connector/cybersource.rs@@ -18,6 +18,7 @@ use crate::{connector::{utils as connector_utils, utils::RefundsRequestData},consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -114,12 +115,16 @@ impl ConnectorCommon for Cybersource {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: cybersource::CybersourceErrorResponse = res.response.parse_struct("Cybersource ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_message = if res.status_code == 401 {consts::CONNECTOR_UNAUTHORIZED_ERROR} else {@@ -357,12 +362,15 @@ implfn handle_response(&self,data: &types::SetupMandateRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::SetupMandateRouterData, errors::ConnectorError> {let response: cybersource::CybersourceSetupMandatesResponse = res.response.parse_struct("CybersourceSetupMandatesResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -373,8 +381,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -428,9 +437,11 @@ implfn handle_response(&self,data: &types::MandateRevokeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::MandateRevokeRouterData, errors::ConnectorError> {if matches!(res.status_code, 204) {+ event_builder.map(|i| i.set_response_body(&serde_json::json!({"mandate_status": common_enums::MandateStatus::Revoked.to_string()})));Ok(types::MandateRevokeRouterData {response: Ok(types::MandateRevokeResponseData {mandate_status: common_enums::MandateStatus::Revoked,@@ -444,6 +455,13 @@ impl.change_context(errors::ConnectorError::ResponseHandlingFailed)?;let response_string = response_value.to_string();+ event_builder.map(|i| {+ i.set_response_body(+ &serde_json::json!({"response_string": response_string.clone()}),+ )+ });+ router_env::logger::info!(connector_response=?response_string);+Ok(types::MandateRevokeRouterData {response: Err(types::ErrorResponse {code: consts::NO_ERROR_CODE.to_string(),@@ -460,8 +478,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>@@ -563,12 +582,15 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: cybersource::CybersourcePreProcessingResponse = res.response.parse_struct("Cybersource AuthEnrollmentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -579,8 +601,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -649,6 +672,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>,@@ -658,6 +682,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme.response.parse_struct("Cybersource PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -667,19 +693,24 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: cybersource::CybersourceServerErrorResponse = res.response.parse_struct("CybersourceServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,reason: response.status.clone(),@@ -747,12 +778,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: cybersource::CybersourceTransactionResponse = res.response.parse_struct("Cybersource PaymentSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -762,8 +796,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -851,6 +886,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {if data.is_three_ds()@@ -861,6 +897,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Cybersource AuthSetupResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -871,6 +909,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Cybersource PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -882,18 +922,24 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: cybersource::CybersourceServerErrorResponse = res.response.parse_struct("CybersourceServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+let attempt_status = match response.reason {Some(reason) => match reason {transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure),@@ -981,12 +1027,15 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: cybersource::CybersourcePaymentsResponse = res.response.parse_struct("Cybersource PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -997,18 +1046,24 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: cybersource::CybersourceServerErrorResponse = res.response.parse_struct("CybersourceServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+let attempt_status = match response.reason {Some(reason) => match reason {transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure),@@ -1099,12 +1154,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: cybersource::CybersourcePaymentsResponse = res.response.parse_struct("Cybersource PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1115,19 +1173,24 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: cybersource::CybersourceServerErrorResponse = res.response.parse_struct("CybersourceServerErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|event| event.set_response_body(&response));+ router_env::logger::info!(error_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,reason: response.status.clone(),@@ -1210,12 +1273,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundExecuteRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundExecuteRouterData, errors::ConnectorError> {let response: cybersource::CybersourceRefundResponse = res.response.parse_struct("Cybersource RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1225,8 +1291,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1276,12 +1343,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: cybersource::CybersourceRsyncResponse = res.response.parse_struct("Cybersource RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1291,8 +1361,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1373,6 +1444,7 @@ implfn handle_response(&self,data: &types::PaymentsIncrementalAuthorizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<@@ -1386,6 +1458,8 @@ impl.response.parse_struct("Cybersource PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from((types::ResponseRouterData {response,@@ -1399,8 +1473,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rsindex 324fe77d0b..646fe179da 100644--- a/crates/router/src/connector/cybersource/transformers.rs+++ b/crates/router/src/connector/cybersource/transformers.rs@@ -1303,7 +1303,7 @@ impl TryFrom<&types::ConnectorAuthType> for CybersourceAuthType {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum CybersourcePaymentStatus {Authorized,@@ -1325,7 +1325,7 @@ pub enum CybersourcePaymentStatus {//PartialAuthorized, not being consumed yet.}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum CybersourceIncrementalAuthorizationStatus {Authorized,@@ -1380,14 +1380,14 @@ impl From<CybersourceIncrementalAuthorizationStatus> for common_enums::Authoriza}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourcePaymentsResponse {ClientReferenceInformation(CybersourceClientReferenceResponse),ErrorInformation(CybersourceErrorInformationResponse),}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceClientReferenceResponse {id: String,@@ -1399,14 +1399,14 @@ pub struct CybersourceClientReferenceResponse {error_information: Option<CybersourceErrorInformation>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceErrorInformationResponse {id: String,error_information: CybersourceErrorInformation,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceConsumerAuthInformationResponse {access_token: String,@@ -1414,7 +1414,7 @@ pub struct CybersourceConsumerAuthInformationResponse {reference_id: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientAuthSetupInfoResponse {id: String,@@ -1422,21 +1422,21 @@ pub struct ClientAuthSetupInfoResponse {consumer_authentication_information: CybersourceConsumerAuthInformationResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourceAuthSetupResponse {ClientAuthSetupInfo(ClientAuthSetupInfoResponse),ErrorInformation(CybersourceErrorInformationResponse),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourcePaymentsIncrementalAuthorizationResponse {status: CybersourceIncrementalAuthorizationStatus,error_information: Option<CybersourceErrorInformation>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourceSetupMandatesResponse {ClientReferenceInformation(CybersourceClientReferenceResponse),@@ -1462,24 +1462,24 @@ pub struct Avs {code_raw: Option<String>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientRiskInformation {rules: Option<Vec<ClientRiskInformationRules>>,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct ClientRiskInformationRules {name: String,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceTokenInformation {payment_instrument: CybersoucrePaymentInstrument,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CybersourceErrorInformation {reason: Option<String>,message: Option<String>,@@ -1908,7 +1908,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum CybersourceAuthEnrollmentStatus {PendingAuthentication,@@ -1932,7 +1932,7 @@ pub struct CybersourceThreeDSMetadata {three_ds_data: CybersourceConsumerAuthValidateResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceConsumerAuthInformationEnrollmentResponse {access_token: Option<String>,@@ -1942,7 +1942,7 @@ pub struct CybersourceConsumerAuthInformationEnrollmentResponse {validate_response: CybersourceConsumerAuthValidateResponse,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ClientAuthCheckInfoResponse {id: String,@@ -1952,7 +1952,7 @@ pub struct ClientAuthCheckInfoResponse {error_information: Option<CybersourceErrorInformation>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourcePreProcessingResponse {ClientAuthCheckInfo(Box<ClientAuthCheckInfoResponse>),@@ -2335,14 +2335,14 @@ impl<F, T>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourceTransactionResponse {ApplicationInformation(CybersourceApplicationInfoResponse),ErrorInformation(CybersourceErrorInformationResponse),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceApplicationInfoResponse {id: String,@@ -2351,7 +2351,7 @@ pub struct CybersourceApplicationInfoResponse {error_information: Option<CybersourceErrorInformation>,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ApplicationInformation {status: CybersourcePaymentStatus,@@ -2474,7 +2474,7 @@ impl From<CybersourceRefundStatus> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum CybersourceRefundStatus {Succeeded,@@ -2484,7 +2484,7 @@ pub enum CybersourceRefundStatus {Voided,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceRefundResponse {id: String,@@ -2508,13 +2508,13 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, CybersourceRefundRes}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RsyncApplicationInformation {status: CybersourceRefundStatus,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceRsyncResponse {id: String,@@ -2540,7 +2540,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, CybersourceRsyncRespon}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceStandardErrorResponse {pub error_information: Option<ErrorInformation>,@@ -2550,13 +2550,13 @@ pub struct CybersourceStandardErrorResponse {pub details: Option<Vec<Details>>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceNotAvailableErrorResponse {pub errors: Vec<CybersourceNotAvailableErrorObject>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceNotAvailableErrorObject {#[serde(rename = "type")]@@ -2564,7 +2564,7 @@ pub struct CybersourceNotAvailableErrorObject {pub message: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CybersourceServerErrorResponse {pub status: Option<String>,@@ -2572,7 +2572,7 @@ pub struct CybersourceServerErrorResponse {pub reason: Option<Reason>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum Reason {SystemError,@@ -2580,12 +2580,12 @@ pub enum Reason {ServiceTimeout,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CybersourceAuthenticationErrorResponse {pub response: AuthenticationErrorInformation,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourceErrorResponse {AuthenticationError(CybersourceAuthenticationErrorResponse),@@ -2594,20 +2594,20 @@ pub enum CybersourceErrorResponse {StandardError(CybersourceStandardErrorResponse),}-#[derive(Debug, Deserialize, Clone)]+#[derive(Debug, Deserialize, Clone, Serialize)]#[serde(rename_all = "camelCase")]pub struct Details {pub field: String,pub reason: String,}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]pub struct ErrorInformation {pub message: String,pub reason: String,}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]pub struct AuthenticationErrorInformation {pub rmsg: String,}diff --git a/crates/router/src/connector/dlocal.rs b/crates/router/src/connector/dlocal.rsindex 1e6fc7561e..5487fd68a5 100644--- a/crates/router/src/connector/dlocal.rs+++ b/crates/router/src/connector/dlocal.rs@@ -17,6 +17,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -120,12 +121,16 @@ impl ConnectorCommon for Dlocal {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: dlocal::DlocalErrorResponse = res.response.parse_struct("Dlocal ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i: &mut ConnectorEvent| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.code.to_string(),@@ -259,6 +264,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {logger::debug!(dlocal_payments_authorize_response=?res);@@ -266,6 +272,10 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.response.parse_struct("Dlocal PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -278,8 +288,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -329,13 +340,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {logger::debug!(dlocal_payment_sync_response=?res);@@ -343,6 +356,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("Dlocal PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -407,6 +422,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {logger::debug!(dlocal_payments_capture_response=?res);@@ -414,6 +430,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme.response.parse_struct("Dlocal PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -426,8 +444,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -477,6 +496,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {logger::debug!(dlocal_payments_cancel_response=?res);@@ -484,6 +504,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR.response.parse_struct("Dlocal PaymentsCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -496,8 +519,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -559,6 +583,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {logger::debug!(dlocal_refund_response=?res);@@ -566,6 +591,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponres.response.parse_struct("Dlocal RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -578,8 +605,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -627,6 +655,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {logger::debug!(dlocal_refund_sync_response=?res);@@ -634,6 +663,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("Dlocal RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -646,8 +677,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rsindex 28d9eaedf0..85b87f26c5 100644--- a/crates/router/src/connector/dummyconnector.rs+++ b/crates/router/src/connector/dummyconnector.rs@@ -11,6 +11,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -101,12 +102,16 @@ impl<const T: u8> ConnectorCommon for DummyConnector<T> {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: transformers::DummyConnectorErrorResponse = res.response.parse_struct("DummyConnectorErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error.code,@@ -235,13 +240,15 @@ impl<const T: u8>fn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: transformers::PaymentsResponse = res.response.parse_struct("DummyConnector PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- println!("handle_response: {:#?}", response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -253,8 +260,9 @@ impl<const T: u8>fn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -313,12 +321,15 @@ impl<const T: u8>fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: transformers::PaymentsResponse = res.response.parse_struct("dummyconnector PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -330,8 +341,9 @@ impl<const T: u8>fn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -387,12 +399,15 @@ impl<const T: u8>fn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: transformers::PaymentsResponse = res.response.parse_struct("transformers PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -404,8 +419,9 @@ impl<const T: u8>fn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -473,12 +489,15 @@ impl<const T: u8> ConnectorIntegration<api::Execute, types::RefundsData, types::fn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: transformers::RefundResponse = res.response.parse_struct("transformers RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -490,8 +509,9 @@ impl<const T: u8> ConnectorIntegration<api::Execute, types::RefundsData, types::fn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -541,12 +561,15 @@ impl<const T: u8> ConnectorIntegration<api::RSync, types::RefundsData, types::Refn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: transformers::RefundResponse = res.response.parse_struct("transformers RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -558,8 +581,9 @@ impl<const T: u8> ConnectorIntegration<api::RSync, types::RefundsData, types::Refn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/fiserv.rs b/crates/router/src/connector/fiserv.rsindex 0bd8211562..5cbfee5194 100644--- a/crates/router/src/connector/fiserv.rs+++ b/crates/router/src/connector/fiserv.rs@@ -17,6 +17,7 @@ use crate::{connector::utils as connector_utils,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -129,12 +130,16 @@ impl ConnectorCommon for Fiserv {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: fiserv::ErrorResponse = res.response.parse_struct("Fiserv ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let fiserv::ErrorResponse { error, details } = response;Ok(error@@ -290,12 +295,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: fiserv::FiservPaymentsResponse = res.response.parse_struct("Fiserv PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -308,8 +316,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -373,13 +382,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: fiserv::FiservSyncResponse = res.response.parse_struct("Fiserv PaymentSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -392,8 +403,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -452,12 +464,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: fiserv::FiservPaymentsResponse = res.response.parse_struct("Fiserv Payment Response").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -481,8 +498,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -564,12 +582,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: fiserv::FiservPaymentsResponse = res.response.parse_struct("Fiserv PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -582,8 +603,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -649,6 +671,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {logger::debug!(target: "router::connector::fiserv", response=?res);@@ -656,6 +679,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponres.response.parse_struct("fiserv RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -667,8 +692,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -728,6 +754,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {logger::debug!(target: "router::connector::fiserv", response=?res);@@ -736,6 +763,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("Fiserv Refund Response").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -748,8 +777,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/fiserv/transformers.rs b/crates/router/src/connector/fiserv/transformers.rsindex 00109f8920..e2511dc8d5 100644--- a/crates/router/src/connector/fiserv/transformers.rs+++ b/crates/router/src/connector/fiserv/transformers.rs@@ -257,14 +257,14 @@ impl TryFrom<&types::PaymentsCancelRouterData> for FiservCancelRequest {}}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ErrorResponse {pub details: Option<Vec<ErrorDetails>>,pub error: Option<Vec<ErrorDetails>>,}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ErrorDetails {#[serde(rename = "type")]diff --git a/crates/router/src/connector/forte.rs b/crates/router/src/connector/forte.rsindex f23907232c..f179e8a8cc 100644--- a/crates/router/src/connector/forte.rs+++ b/crates/router/src/connector/forte.rs@@ -17,6 +17,7 @@ use crate::{},consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -116,11 +117,16 @@ impl ConnectorCommon for Forte {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: forte::ForteErrorResponse = res.response.parse_struct("Forte ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let message = response.response.response_desc;let code = response.response@@ -248,12 +254,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: forte::FortePaymentsResponse = res.response.parse_struct("Forte AuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -264,8 +275,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -318,12 +330,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: forte::FortePaymentsSyncResponse = res.response.parse_struct("forte PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -334,8 +351,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -400,12 +418,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: forte::ForteCaptureResponse = res.response.parse_struct("Forte PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -416,8 +439,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>@@ -479,12 +503,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: forte::ForteCancelResponse = res.response.parse_struct("forte CancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -495,8 +524,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -558,12 +588,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: forte::RefundResponse = res.response.parse_struct("forte RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -574,8 +609,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -625,12 +661,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: forte::RefundSyncResponse = res.response.parse_struct("forte RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -641,8 +682,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/forte/transformers.rs b/crates/router/src/connector/forte/transformers.rsindex 4c770eb788..83bcb2c551 100644--- a/crates/router/src/connector/forte/transformers.rs+++ b/crates/router/src/connector/forte/transformers.rs@@ -151,7 +151,7 @@ impl TryFrom<&types::ConnectorAuthType> for ForteAuthType {}}// PaymentsResponse-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum FortePaymentStatus {Complete,@@ -188,7 +188,7 @@ impl ForeignFrom<(ForteResponseCode, ForteAction)> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CardResponse {pub name_on_card: Secret<String>,pub last_4_account_number: String,@@ -196,7 +196,7 @@ pub struct CardResponse {pub card_type: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub enum ForteResponseCode {A01,A05,@@ -218,7 +218,7 @@ impl From<ForteResponseCode> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ResponseStatus {pub environment: String,pub response_type: String,@@ -237,7 +237,7 @@ pub enum ForteAction {Verify,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct FortePaymentsResponse {pub transaction_id: String,pub location_id: String,@@ -286,7 +286,7 @@ impl<F, T>//PsyncResponse-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct FortePaymentsSyncResponse {pub transaction_id: String,pub location_id: String,@@ -356,7 +356,7 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for ForteCaptureRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CaptureResponseStatus {pub environment: String,pub response_type: String,@@ -365,7 +365,7 @@ pub struct CaptureResponseStatus {pub authorization_code: String,}// Capture Response-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ForteCaptureResponse {pub transaction_id: String,pub original_transaction_id: String,@@ -423,7 +423,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for ForteCancelRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CancelResponseStatus {pub response_type: String,pub response_code: ForteResponseCode,@@ -431,7 +431,7 @@ pub struct CancelResponseStatus {pub authorization_code: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ForteCancelResponse {pub transaction_id: String,pub location_id: String,@@ -495,7 +495,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for ForteRefundRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum RefundStatus {Complete,@@ -523,7 +523,7 @@ impl From<ForteResponseCode> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct RefundResponse {pub transaction_id: String,pub original_transaction_id: String,@@ -550,7 +550,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct RefundSyncResponse {status: RefundStatus,transaction_id: String,@@ -573,7 +573,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundSyncResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ErrorResponseStatus {pub environment: String,pub response_type: Option<String>,@@ -581,7 +581,7 @@ pub struct ErrorResponseStatus {pub response_desc: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ForteErrorResponse {pub response: ErrorResponseStatus,}diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rsindex 76954217ee..620805eb3e 100644--- a/crates/router/src/connector/globalpay.rs+++ b/crates/router/src/connector/globalpay.rs@@ -25,6 +25,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -93,12 +94,16 @@ impl ConnectorCommon for Globalpay {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: transformers::GlobalpayErrorResponse = res.response.parse_struct("Globalpay ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error_code,@@ -196,6 +201,7 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res@@ -203,6 +209,9 @@ impl.parse_struct("Globalpay PaymentsResponse").switch()?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -214,8 +223,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -282,6 +292,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {let response: GlobalpayRefreshTokenResponse = res@@ -289,6 +300,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("Globalpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -301,12 +315,16 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: GlobalpayRefreshTokenErrorResponse = res.response.parse_struct("Globalpay ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error_code,@@ -415,12 +433,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res.response.parse_struct("Globalpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -433,8 +454,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -487,19 +509,25 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res.response.parse_struct("globalpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let is_multiple_capture_sync = match data.request.sync_type {types::SyncRequestType::MultipleCaptureSync(_) => true,types::SyncRequestType::SinglePaymentSync => false,@@ -581,12 +609,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res.response.parse_struct("Globalpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -599,8 +630,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -670,12 +702,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res.response.parse_struct("Globalpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -688,8 +723,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -755,12 +791,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res.response.parse_struct("globalpay RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -772,8 +813,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -823,12 +865,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: GlobalpayPaymentsResponse = res.response.parse_struct("globalpay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -841,8 +886,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/globalpay/response.rs b/crates/router/src/connector/globalpay/response.rsindex 7416d6f716..201297c399 100644--- a/crates/router/src/connector/globalpay/response.rs+++ b/crates/router/src/connector/globalpay/response.rs@@ -70,13 +70,13 @@ pub struct Action {pub action_type: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GlobalpayRefreshTokenResponse {pub token: Secret<String>,pub seconds_to_expire: i64,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GlobalpayRefreshTokenErrorResponse {pub error_code: String,pub detailed_error_description: String,diff --git a/crates/router/src/connector/globepay.rs b/crates/router/src/connector/globepay.rsindex 8f8b01de8e..d480e35cfc 100644--- a/crates/router/src/connector/globepay.rs+++ b/crates/router/src/connector/globepay.rs@@ -18,6 +18,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self, request, ConnectorIntegration, ConnectorValidation},types::{@@ -114,12 +115,16 @@ impl ConnectorCommon for Globepay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: globepay::GlobepayErrorResponse = res.response.parse_struct("GlobepayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.return_code.to_string(),@@ -237,12 +242,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: globepay::GlobepayPaymentsResponse = res.response.parse_struct("Globepay PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -253,8 +263,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -305,12 +316,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: globepay::GlobepaySyncResponse = res.response.parse_struct("globepay PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -321,8 +337,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -409,12 +426,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: globepay::GlobepayRefundResponse = res.response.parse_struct("Globalpay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -425,8 +447,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -476,12 +499,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: globepay::GlobepayRefundResponse = res.response.parse_struct("Globalpay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -492,8 +520,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/globepay/transformers.rs b/crates/router/src/connector/globepay/transformers.rsindex a874fc21d2..5cb22890b7 100644--- a/crates/router/src/connector/globepay/transformers.rs+++ b/crates/router/src/connector/globepay/transformers.rs@@ -102,7 +102,7 @@ impl TryFrom<&types::ConnectorAuthType> for GlobepayAuthType {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum GlobepayPaymentStatus {Success,@@ -123,7 +123,7 @@ pub struct GlobepayConnectorMetadata {image_data_url: url::Url,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GlobepayPaymentsResponse {result_code: Option<GlobepayPaymentStatus>,order_id: Option<String>,@@ -132,7 +132,7 @@ pub struct GlobepayPaymentsResponse {return_msg: Option<String>,}-#[derive(Debug, Deserialize, PartialEq, strum::Display)]+#[derive(Debug, Deserialize, PartialEq, strum::Display, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum GlobepayReturnCode {Success,@@ -210,7 +210,7 @@ impl<F, T>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GlobepaySyncResponse {pub result_code: Option<GlobepayPaymentPsyncStatus>,pub order_id: Option<String>,@@ -218,7 +218,7 @@ pub struct GlobepaySyncResponse {pub return_msg: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum GlobepayPaymentPsyncStatus {Paying,@@ -313,7 +313,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for GlobepayRefundRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub enum GlobepayRefundStatus {Waiting,CreateFailed,@@ -335,7 +335,7 @@ impl From<GlobepayRefundStatus> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GlobepayRefundResponse {pub result_code: Option<GlobepayRefundStatus>,pub refund_id: Option<String>,@@ -379,7 +379,7 @@ impl<T> TryFrom<types::RefundsResponseRouterData<T, GlobepayRefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GlobepayErrorResponse {pub return_msg: String,pub return_code: GlobepayReturnCode,diff --git a/crates/router/src/connector/gocardless.rs b/crates/router/src/connector/gocardless.rsindex 542caa73ff..720a13611c 100644--- a/crates/router/src/connector/gocardless.rs+++ b/crates/router/src/connector/gocardless.rs@@ -12,6 +12,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -104,11 +105,16 @@ impl ConnectorCommon for Gocardless {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: gocardless::GocardlessErrorResponse = res.response.parse_struct("GocardlessErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_iter = response.error.errors.iter();let mut error_reason: Vec<String> = Vec::new();for error in error_iter {@@ -185,6 +191,7 @@ implfn handle_response(&self,data: &types::ConnectorCustomerRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RouterData<@@ -203,6 +210,10 @@ impl.response.parse_struct("GocardlessCustomerResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -213,8 +224,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -274,6 +286,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -285,6 +298,10 @@ impl.response.parse_struct("GocardlessBankAccountResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -295,8 +312,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -395,12 +413,17 @@ implfn handle_response(&self,data: &types::SetupMandateRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::SetupMandateRouterData, errors::ConnectorError> {let response: gocardless::GocardlessMandateResponse = res.response.parse_struct("GocardlessMandateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -411,8 +434,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -480,12 +504,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: gocardless::GocardlessPaymentsResponse = res.response.parse_struct("GocardlessPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -496,8 +525,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -549,12 +579,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: gocardless::GocardlessPaymentsResponse = res.response.parse_struct("GocardlessPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -565,8 +600,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -640,12 +676,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: gocardless::RefundResponse = res.response.parse_struct("gocardless RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -656,8 +697,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rsindex 249dae370b..d3703bc6bf 100644--- a/crates/router/src/connector/gocardless/transformers.rs+++ b/crates/router/src/connector/gocardless/transformers.rs@@ -172,12 +172,12 @@ fn get_region(}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct GocardlessCustomerResponse {customers: Customers,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct Customers {id: Secret<String>,}@@ -391,12 +391,12 @@ impl From<BankType> for AccountType {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct GocardlessBankAccountResponse {customer_bank_accounts: CustomerBankAccountResponse,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct CustomerBankAccountResponse {pub id: Secret<String>,}@@ -540,12 +540,12 @@ impl TryFrom<&BankDebitData> for GocardlessScheme {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct GocardlessMandateResponse {mandates: MandateResponse,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct MandateResponse {id: String,}@@ -817,7 +817,7 @@ impl<F> TryFrom<&GocardlessRouterData<&types::RefundsRouterData<F>>> for Gocardl}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct RefundResponse {id: String,}@@ -839,12 +839,12 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>}}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]pub struct GocardlessErrorResponse {pub error: GocardlessError,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]pub struct GocardlessError {pub message: String,pub code: u16,@@ -853,7 +853,7 @@ pub struct GocardlessError {pub error_type: String,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]pub struct Error {pub field: Option<String>,pub message: String,diff --git a/crates/router/src/connector/helcim.rs b/crates/router/src/connector/helcim.rsindex 0b2cac5d76..5e03e5046a 100644--- a/crates/router/src/connector/helcim.rs+++ b/crates/router/src/connector/helcim.rs@@ -13,6 +13,7 @@ use crate::{configs::settings,consts::NO_ERROR_CODE,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -123,11 +124,16 @@ impl ConnectorCommon for Helcim {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: helcim::HelcimErrorResponse = res.response.parse_struct("HelcimErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_string = match response {transformers::HelcimErrorResponse::Payment(response) => match response.errors {transformers::HelcimErrorTypes::StringType(error) => error,@@ -229,12 +235,15 @@ implfn handle_response(&self,data: &types::SetupMandateRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::SetupMandateRouterData, errors::ConnectorError> {let response: helcim::HelcimPaymentsResponse = res.response.parse_struct("Helcim PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -244,8 +253,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -315,12 +325,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: helcim::HelcimPaymentsResponse = res.response.parse_struct("Helcim PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -331,8 +346,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -394,12 +410,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: helcim::HelcimPaymentsResponse = res.response.parse_struct("helcim PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -410,8 +431,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}// fn get_multiple_capture_sync_method(@@ -482,12 +504,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: helcim::HelcimPaymentsResponse = res.response.parse_struct("Helcim PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -498,8 +525,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -556,12 +584,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: helcim::HelcimPaymentsResponse = res.response.parse_struct("HelcimPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -573,8 +606,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -636,12 +670,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: helcim::RefundResponse =res.response.parse_struct("helcim RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -652,8 +691,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -713,12 +753,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: helcim::RefundResponse = res.response.parse_struct("helcim RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -729,8 +774,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/helcim/transformers.rs b/crates/router/src/connector/helcim/transformers.rsindex 5e076be651..fba46bd721 100644--- a/crates/router/src/connector/helcim/transformers.rs+++ b/crates/router/src/connector/helcim/transformers.rs@@ -299,14 +299,14 @@ impl TryFrom<&types::ConnectorAuthType> for HelcimAuthType {}}// PaymentsResponse-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum HelcimPaymentStatus {Approved,Declined,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum HelcimTransactionType {Purchase,@@ -339,7 +339,7 @@ impl From<HelcimPaymentsResponse> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct HelcimPaymentsResponse {status: HelcimPaymentStatus,@@ -689,12 +689,12 @@ impl<F> TryFrom<&HelcimRouterData<&types::RefundsRouterData<F>>> for HelcimRefun}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum HelcimRefundTransactionType {Refund,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RefundResponse {status: HelcimPaymentStatus,@@ -748,19 +748,19 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}}-#[derive(Debug, strum::Display, Deserialize)]+#[derive(Debug, strum::Display, Deserialize, Serialize)]#[serde(untagged)]pub enum HelcimErrorTypes {StringType(String),JsonType(serde_json::Value),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct HelcimPaymentsErrorResponse {pub errors: HelcimErrorTypes,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum HelcimErrorResponse {Payment(HelcimPaymentsErrorResponse),diff --git a/crates/router/src/connector/iatapay.rs b/crates/router/src/connector/iatapay.rsindex c5ac0f4383..c049520de2 100644--- a/crates/router/src/connector/iatapay.rs+++ b/crates/router/src/connector/iatapay.rs@@ -14,6 +14,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -113,12 +114,16 @@ impl ConnectorCommon for Iatapay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: iatapay::IatapayErrorResponse = res.response.parse_struct("IatapayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error,@@ -207,6 +212,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {let response: iatapay::IatapayAuthUpdateResponse = res@@ -214,6 +220,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("iatapay IatapayAuthUpdateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -224,12 +233,16 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: iatapay::IatapayAccessTokenErrorResponse = res.response.parse_struct("Iatapay AccessTokenErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error,@@ -327,12 +340,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: IatapayPaymentsResponse = res.response.parse_struct("Iatapay PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -344,8 +360,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -397,12 +414,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: IatapayPaymentsResponse = res.response.parse_struct("iatapay PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -414,8 +434,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -506,12 +527,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: iatapay::RefundResponse = res.response.parse_struct("iatapay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -523,8 +547,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -575,12 +600,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: iatapay::RefundResponse = res.response.parse_struct("iatapay RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -592,8 +620,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rsindex 4557fda039..55778af882 100644--- a/crates/router/src/connector/iatapay/transformers.rs+++ b/crates/router/src/connector/iatapay/transformers.rs@@ -60,7 +60,7 @@ impl<T>})}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct IatapayAuthUpdateResponse {pub access_token: Secret<String>,pub token_type: String,@@ -507,7 +507,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct IatapayErrorResponse {pub status: u16,pub error: String,@@ -515,7 +515,7 @@ pub struct IatapayErrorResponse {pub reason: Option<String>,}-#[derive(Deserialize, Debug)]+#[derive(Deserialize, Debug, Serialize)]pub struct IatapayAccessTokenErrorResponse {pub error: String,pub path: String,diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rsindex 5361a63682..8b7ab0da7f 100644--- a/crates/router/src/connector/klarna.rs+++ b/crates/router/src/connector/klarna.rs@@ -11,6 +11,7 @@ use crate::{connector::utils as connector_utils,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -61,11 +62,16 @@ impl ConnectorCommon for Klarna {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: klarna::KlarnaErrorResponse = res.response.parse_struct("KlarnaErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+// KlarnaErrorResponse will either have error_messages or error_message field Ref: https://docs.klarna.com/api/errors/let reason = response.error_messages@@ -186,12 +192,17 @@ implfn handle_response(&self,data: &types::PaymentsSessionRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSessionRouterData, errors::ConnectorError> {let response: klarna::KlarnaSessionResponse = res.response.parse_struct("KlarnaSessionResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -203,8 +214,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -463,12 +475,17 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: klarna::KlarnaPaymentsResponse = res.response.parse_struct("KlarnaPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -480,8 +497,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rsindex 0816dd82ec..c12f8ed1b1 100644--- a/crates/router/src/connector/klarna/transformers.rs+++ b/crates/router/src/connector/klarna/transformers.rs@@ -48,7 +48,7 @@ pub struct KlarnaPaymentsRequest {merchant_reference1: String,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct KlarnaPaymentsResponse {order_id: String,fraud_status: KlarnaFraudStatus,@@ -64,7 +64,7 @@ pub struct KlarnaSessionRequest {order_lines: Vec<OrderLines>,}-#[derive(Deserialize)]+#[derive(Deserialize, Serialize, Debug)]pub struct KlarnaSessionResponse {pub client_token: String,pub session_id: String,@@ -225,7 +225,7 @@ impl From<KlarnaFraudStatus> for enums::AttemptStatus {}}-#[derive(Deserialize)]+#[derive(Deserialize, Serialize, Debug)]pub struct KlarnaErrorResponse {pub error_code: String,pub error_messages: Option<Vec<String>>,diff --git a/crates/router/src/connector/mollie.rs b/crates/router/src/connector/mollie.rsindex cee4225d86..e6bbd68837 100644--- a/crates/router/src/connector/mollie.rs+++ b/crates/router/src/connector/mollie.rs@@ -14,6 +14,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -87,11 +88,16 @@ impl ConnectorCommon for Mollie {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: mollie::ErrorResponse = res.response.parse_struct("MollieErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: response.status,code: response@@ -178,6 +184,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -187,6 +194,10 @@ impl.response.parse_struct("MollieTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -197,8 +208,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -284,12 +296,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: mollie::MolliePaymentsResponse = res.response.parse_struct("MolliePaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -300,8 +317,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -358,12 +376,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: mollie::MolliePaymentsResponse = res.response.parse_struct("mollie PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -374,8 +397,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -473,12 +497,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: mollie::RefundResponse = res.response.parse_struct("MollieRefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -489,8 +518,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -543,12 +573,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: mollie::RefundResponse = res.response.parse_struct("MollieRefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -559,8 +594,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rsindex 0fcb14d2cf..af1159cd2c 100644--- a/crates/router/src/connector/mollie/transformers.rs+++ b/crates/router/src/connector/mollie/transformers.rs@@ -388,7 +388,7 @@ fn get_address_details(Ok(address_details)}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct MolliePaymentsResponse {pub resource: String,@@ -625,7 +625,7 @@ impl<T> TryFrom<types::RefundsResponseRouterData<T, RefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ErrorResponse {pub status: u16,pub title: Option<String>,diff --git a/crates/router/src/connector/multisafepay.rs b/crates/router/src/connector/multisafepay.rsindex 8290a00661..da3a87454c 100644--- a/crates/router/src/connector/multisafepay.rs+++ b/crates/router/src/connector/multisafepay.rs@@ -10,6 +10,7 @@ use transformers as multisafepay;use crate::{configs::settings,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -74,11 +75,16 @@ impl ConnectorCommon for Multisafepay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: multisafepay::MultisafepayErrorResponse = res.response.parse_struct("MultisafepayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error_code.to_string(),@@ -208,13 +214,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: multisafepay::MultisafepayAuthResponse = res@@ -222,6 +230,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.parse_struct("multisafepay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -316,6 +327,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: multisafepay::MultisafepayAuthResponse = res@@ -323,6 +335,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.parse_struct("MultisafepayPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -335,8 +350,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -413,12 +429,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: multisafepay::MultisafepayRefundResponse = res.response.parse_struct("multisafepay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -431,8 +450,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -485,12 +505,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: multisafepay::MultisafepayRefundResponse = res.response.parse_struct("multisafepay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -503,8 +526,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/nexinets.rs b/crates/router/src/connector/nexinets.rsindex 1f4a7f41f6..4457a0986f 100644--- a/crates/router/src/connector/nexinets.rs+++ b/crates/router/src/connector/nexinets.rs@@ -13,6 +13,7 @@ use crate::{utils::{to_connector_meta, PaymentsSyncRequestData},},core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -100,12 +101,16 @@ impl ConnectorCommon for Nexinets {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: nexinets::NexinetsErrorResponse = res.response.parse_struct("NexinetsErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let errors = response.errors;let mut message = String::new();let mut static_message = String::new();@@ -247,12 +252,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: nexinets::NexinetsPreAuthOrDebitResponse = res.response.parse_struct("Nexinets PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -263,8 +273,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -322,12 +333,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: nexinets::NexinetsPaymentResponse = res.response.parse_struct("nexinets NexinetsPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -338,8 +354,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -405,12 +422,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: nexinets::NexinetsPaymentResponse = res.response.parse_struct("NexinetsPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -421,8 +443,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -485,12 +508,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: nexinets::NexinetsPaymentResponse = res.response.parse_struct("NexinetsPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -501,8 +529,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -567,12 +596,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: nexinets::NexinetsRefundResponse = res.response.parse_struct("nexinets RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -583,8 +617,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -638,12 +673,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: nexinets::NexinetsRefundResponse = res.response.parse_struct("nexinets RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -654,8 +694,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/nexinets/transformers.rs b/crates/router/src/connector/nexinets/transformers.rsindex 698b2709a6..07488271ae 100644--- a/crates/router/src/connector/nexinets/transformers.rs+++ b/crates/router/src/connector/nexinets/transformers.rs@@ -211,7 +211,7 @@ impl TryFrom<&types::ConnectorAuthType> for NexinetsAuthType {}}// PaymentsResponse-#[derive(Debug, Deserialize, Clone)]+#[derive(Debug, Deserialize, Clone, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum NexinetsPaymentStatus {Success,@@ -275,7 +275,7 @@ impl TryFrom<&api_models::enums::BankNames> for NexinetsBIC {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NexinetsPreAuthOrDebitResponse {order_id: String,@@ -285,7 +285,7 @@ pub struct NexinetsPreAuthOrDebitResponse {redirect_url: Option<Url>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NexinetsTransaction {pub transaction_id: String,@@ -386,7 +386,7 @@ pub struct NexinetsCaptureOrVoidRequest {pub currency: enums::Currency,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NexinetsOrder {pub order_id: String,@@ -412,7 +412,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NexinetsCaptureOrVoidRequest}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NexinetsPaymentResponse {pub transaction_id: String,@@ -483,7 +483,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for NexinetsRefundRequest {}// Type definition for Refund Response-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NexinetsRefundResponse {pub transaction_id: String,@@ -494,7 +494,7 @@ pub struct NexinetsRefundResponse {}#[allow(dead_code)]-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum RefundStatus {Success,@@ -504,7 +504,7 @@ pub enum RefundStatus {InProgress,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum RefundType {Refund,@@ -554,7 +554,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, NexinetsRefundResponse}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct NexinetsErrorResponse {pub status: u16,pub code: u16,@@ -562,7 +562,7 @@ pub struct NexinetsErrorResponse {pub errors: Vec<OrderErrorDetails>,}-#[derive(Debug, Deserialize, Clone)]+#[derive(Debug, Deserialize, Clone, Serialize)]pub struct OrderErrorDetails {pub code: u16,pub message: String,diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rsindex 0550908649..a7c920a5f9 100644--- a/crates/router/src/connector/nmi.rs+++ b/crates/router/src/connector/nmi.rs@@ -12,6 +12,7 @@ use super::utils as connector_utils;use crate::{configs::settings,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,services::{self, request, ConnectorIntegration, ConnectorValidation},types::{self,@@ -69,11 +70,16 @@ impl ConnectorCommon for Nmi {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: nmi::StandardResponse = res.response.parse_struct("StandardResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {message: response.responsetext.to_owned(),status_code: res.status_code,@@ -181,11 +187,14 @@ implfn handle_response(&self,data: &types::SetupMandateRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::SetupMandateRouterData, errors::ConnectorError> {let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -196,8 +205,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -265,11 +275,14 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: nmi::NmiVaultResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -280,8 +293,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -343,11 +357,14 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -358,8 +375,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -428,11 +446,14 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: nmi::NmiCompleteResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -443,8 +464,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -496,10 +518,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {+ let response = nmi::SyncResponse::try_from(res.response.to_vec())?;++ event_builder.map(|i| i.set_response_body(&response));+types::RouterData::try_from(types::ResponseRouterData {- response: res.clone(),+ response,data: data.clone(),http_code: res.status_code,})@@ -508,8 +535,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -569,11 +597,14 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -584,8 +615,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -637,11 +669,14 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -652,8 +687,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -711,11 +747,14 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -726,8 +765,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -777,10 +817,16 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundsRouterData<api::RSync>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::RSync>, errors::ConnectorError> {+ let response = nmi::NmiRefundSyncResponse::try_from(res.response.to_vec())?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {- response: res.clone(),+ response,data: data.clone(),http_code: res.status_code,})@@ -789,8 +835,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rsindex 65acb5832b..c6d763fe56 100644--- a/crates/router/src/connector/nmi/transformers.rs+++ b/crates/router/src/connector/nmi/transformers.rs@@ -137,7 +137,7 @@ fn get_card_details(}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct NmiVaultResponse {pub response: Response,pub responsetext: String,@@ -305,7 +305,7 @@ impl TryFrom<&NmiRouterData<&types::PaymentsCompleteAuthorizeRouterData>> for Nm}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct NmiCompleteResponse {pub response: Response,pub responsetext: String,@@ -707,7 +707,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NmiCancelRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub enum Response {#[serde(alias = "1")]Approved,@@ -717,7 +717,7 @@ pub enum Response {Error,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct StandardResponse {pub response: Response,pub responsetext: String,@@ -898,15 +898,14 @@ pub enum NmiStatus {Unknown,}-impl TryFrom<types::PaymentsSyncResponseRouterData<types::Response>>- for types::PaymentsSyncRouterData+impl<F, T> TryFrom<types::ResponseRouterData<F, SyncResponse, T, types::PaymentsResponseData>>+ for types::RouterData<F, T, types::PaymentsResponseData>{type Error = Error;fn try_from(- item: types::PaymentsSyncResponseRouterData<types::Response>,+ item: types::ResponseRouterData<F, SyncResponse, T, types::PaymentsResponseData>,) -> Result<Self, Self::Error> {- let response = SyncResponse::try_from(item.response.response.to_vec())?;- match response.transaction {+ match item.response.transaction {Some(trn) => Ok(Self {status: enums::AttemptStatus::from(NmiStatus::from(trn.condition)),response: Ok(types::PaymentsResponseData::TransactionResponse {@@ -1050,19 +1049,18 @@ impl TryFrom<&types::RefundSyncRouterData> for NmiSyncRequest {}}-impl TryFrom<types::RefundsResponseRouterData<api::RSync, types::Response>>+impl TryFrom<types::RefundsResponseRouterData<api::RSync, NmiRefundSyncResponse>>for types::RefundsRouterData<api::RSync>{- type Error = Error;+ type Error = Report<errors::ConnectorError>;fn try_from(- item: types::RefundsResponseRouterData<api::RSync, types::Response>,+ item: types::RefundsResponseRouterData<api::RSync, NmiRefundSyncResponse>,) -> Result<Self, Self::Error> {- let response = NmiRefundSyncResponse::try_from(item.response.response.to_vec())?;let refund_status =- enums::RefundStatus::from(NmiStatus::from(response.transaction.condition));+ enums::RefundStatus::from(NmiStatus::from(item.response.transaction.condition));Ok(Self {response: Ok(types::RefundsResponseData {- connector_refund_id: response.transaction.order_id,+ connector_refund_id: item.response.transaction.order_id,refund_status,}),..item.data@@ -1110,14 +1108,14 @@ pub struct SyncResponse {pub transaction: Option<SyncTransactionResponse>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct RefundSyncBody {order_id: String,condition: String,}-#[derive(Debug, Deserialize)]-struct NmiRefundSyncResponse {+#[derive(Debug, Deserialize, Serialize)]+pub struct NmiRefundSyncResponse {transaction: RefundSyncBody,}diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rsindex 6e1959b46d..56f3c7101b 100644--- a/crates/router/src/connector/noon.rs+++ b/crates/router/src/connector/noon.rs@@ -18,6 +18,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -127,20 +128,26 @@ impl ConnectorCommon for Noon {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: Result<noon::NoonErrorResponse, Report<common_utils::errors::ParsingError>> =res.response.parse_struct("NoonErrorResponse");match response {- Ok(noon_error_response) => Ok(ErrorResponse {- status_code: res.status_code,- code: consts::NO_ERROR_CODE.to_string(),- message: noon_error_response.class_description,- reason: Some(noon_error_response.message),- attempt_status: None,- connector_transaction_id: None,- }),+ Ok(noon_error_response) => {+ event_builder.map(|i| i.set_error_response_body(&noon_error_response));+ router_env::logger::info!(connector_response=?noon_error_response);+ Ok(ErrorResponse {+ status_code: res.status_code,+ code: consts::NO_ERROR_CODE.to_string(),+ message: noon_error_response.class_description,+ reason: Some(noon_error_response.message),+ attempt_status: None,+ connector_transaction_id: None,+ })+ }Err(error_message) => {+ event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));logger::error!(deserialization_error =? error_message);utils::handle_json_response_deserialization_failure(res, "noon".to_owned())}@@ -262,12 +269,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: noon::NoonPaymentsResponse = res.response.parse_struct("Noon PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -278,8 +290,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -328,12 +341,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: noon::NoonPaymentsResponse = res.response.parse_struct("noon PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -344,8 +362,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -404,12 +423,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: noon::NoonPaymentsResponse = res.response.parse_struct("Noon PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -420,8 +444,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -477,12 +502,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: noon::NoonPaymentsResponse = res.response.parse_struct("Noon PaymentsCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -493,8 +523,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -553,12 +584,17 @@ implfn handle_response(&self,data: &types::MandateRevokeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::MandateRevokeRouterData, errors::ConnectorError> {let response: noon::NoonRevokeMandateResponse = res.response.parse_struct("Noon NoonRevokeMandateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -568,8 +604,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -625,12 +662,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: noon::RefundResponse = res.response.parse_struct("noon RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -641,8 +683,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -689,6 +732,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: noon::RefundSyncResponse = res@@ -696,6 +740,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.parse_struct("noon RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -707,8 +754,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rsindex 5818c10eea..2f5f342d7a 100644--- a/crates/router/src/connector/noon/transformers.rs+++ b/crates/router/src/connector/noon/transformers.rs@@ -707,22 +707,22 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for NoonPaymentsActionRequest {})}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub enum NoonRevokeStatus {Cancelled,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct NoonCancelSubscriptionObject {status: NoonRevokeStatus,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct NoonRevokeMandateResult {subscription: NoonCancelSubscriptionObject,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct NoonRevokeMandateResponse {result: NoonRevokeMandateResult,}@@ -757,7 +757,7 @@ impl<F>}}-#[derive(Debug, Default, Deserialize, Clone)]+#[derive(Debug, Default, Deserialize, Clone, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum RefundStatus {Success,@@ -776,19 +776,19 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NoonPaymentsTransactionResponse {id: String,status: RefundStatus,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct NoonRefundResponseResult {transaction: NoonPaymentsTransactionResponse,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct RefundResponse {result: NoonRefundResponseResult,}@@ -810,7 +810,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>}}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NoonRefundResponseTransactions {id: String,@@ -818,12 +818,12 @@ pub struct NoonRefundResponseTransactions {transaction_reference: Option<String>,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct NoonRefundSyncResponseResult {transactions: Vec<NoonRefundResponseTransactions>,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct RefundSyncResponse {result: NoonRefundSyncResponseResult,}@@ -927,7 +927,7 @@ impl From<NoonWebhookObject> for NoonPaymentsResponse {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct NoonErrorResponse {pub result_code: u32,diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rsindex 35de293443..5939676631 100644--- a/crates/router/src/connector/nuvei.rs+++ b/crates/router/src/connector/nuvei.rs@@ -18,6 +18,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self, request, ConnectorIntegration, ConnectorValidation},types::{@@ -195,12 +196,17 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -212,8 +218,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -272,12 +279,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::PaymentsCancelRouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -289,8 +299,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -354,19 +365,25 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -434,12 +451,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -451,8 +473,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -592,12 +615,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -609,8 +637,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -678,10 +707,15 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeSessionTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeSessionTokenRouterData, errors::ConnectorError> {let response: nuvei::NuveiSessionResponse =res.response.parse_struct("NuveiSessionResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -692,8 +726,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -754,12 +789,17 @@ impl ConnectorIntegration<InitPayment, types::PaymentsAuthorizeData, types::Paymfn handle_response(&self,data: &types::PaymentsInitRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsInitRouterData, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -771,8 +811,9 @@ impl ConnectorIntegration<InitPayment, types::PaymentsAuthorizeData, types::Paymfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -831,12 +872,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: nuvei::NuveiPaymentsResponse = res.response.parse_struct("NuveiPaymentsResponse").switch()?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -848,8 +894,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/opayo.rs b/crates/router/src/connector/opayo.rsindex 0ab5785a44..7285ce49fc 100644--- a/crates/router/src/connector/opayo.rs+++ b/crates/router/src/connector/opayo.rs@@ -12,6 +12,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -97,12 +98,16 @@ impl ConnectorCommon for Opayo {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: opayo::OpayoErrorResponse =res.response.parse_struct("OpayoErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.code,@@ -220,12 +225,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: opayo::OpayoPaymentsResponse = res.response.parse_struct("Opayo PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -236,8 +246,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -282,12 +293,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: opayo::OpayoPaymentsResponse = res.response.parse_struct("opayo PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -298,8 +314,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -357,12 +374,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: opayo::OpayoPaymentsResponse = res.response.parse_struct("Opayo PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -373,8 +395,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -436,12 +459,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: opayo::RefundResponse = res.response.parse_struct("opayo RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -452,8 +480,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -496,12 +525,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: opayo::RefundResponse = res.response.parse_struct("opayo RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -512,8 +546,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/opennode.rs b/crates/router/src/connector/opennode.rsindex 1eafa67fdd..1bd7461b66 100644--- a/crates/router/src/connector/opennode.rs+++ b/crates/router/src/connector/opennode.rs@@ -11,6 +11,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -99,12 +100,16 @@ impl ConnectorCommon for Opennode {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: opennode::OpennodeErrorResponse = res.response.parse_struct("OpennodeErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: consts::NO_ERROR_CODE.to_string(),@@ -224,12 +229,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: opennode::OpennodePaymentsResponse = res.response.parse_struct("Opennode PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -241,8 +251,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -295,12 +306,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: opennode::OpennodePaymentsResponse = res.response.parse_struct("opennode PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -312,8 +328,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/opennode/transformers.rs b/crates/router/src/connector/opennode/transformers.rsindex 7670166fab..3267caf60d 100644--- a/crates/router/src/connector/opennode/transformers.rs+++ b/crates/router/src/connector/opennode/transformers.rs@@ -252,7 +252,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}//TODO: Fill the struct with respective fields-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct OpennodeErrorResponse {pub message: String,}diff --git a/crates/router/src/connector/payeezy.rs b/crates/router/src/connector/payeezy.rsindex 442bbaca31..6f6a366ee4 100644--- a/crates/router/src/connector/payeezy.rs+++ b/crates/router/src/connector/payeezy.rs@@ -16,6 +16,7 @@ use crate::{connector::utils as connector_utils,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -104,12 +105,16 @@ impl ConnectorCommon for Payeezy {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: payeezy::PayeezyErrorResponse = res.response.parse_struct("payeezy ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_messages: Vec<String> = response.error.messages@@ -240,12 +245,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: payeezy::PayeezyPaymentsResponse = res.response.parse_struct("Payeezy PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -257,8 +267,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -343,12 +354,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: payeezy::PayeezyPaymentsResponse = res.response.parse_struct("Payeezy PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -360,8 +376,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -438,12 +455,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: payeezy::PayeezyPaymentsResponse = res.response.parse_struct("payeezy Response").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -455,8 +477,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -528,6 +551,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {// Parse the response into a payeezy::RefundResponse@@ -536,6 +560,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.parse_struct("payeezy RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+// Create a new instance of types::RefundsRouterData based on the response, input data, and HTTP codelet response_data = types::ResponseRouterData {response,@@ -551,8 +578,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rsindex c633fd3d99..e8801e3222 100644--- a/crates/router/src/connector/payeezy/transformers.rs+++ b/crates/router/src/connector/payeezy/transformers.rs@@ -298,7 +298,7 @@ impl TryFrom<&types::ConnectorAuthType> for PayeezyAuthType {}// PaymentsResponse-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum PayeezyPaymentStatus {Approved,@@ -308,7 +308,7 @@ pub enum PayeezyPaymentStatus {NotProcessed,}-#[derive(Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct PayeezyPaymentsResponse {pub correlation_id: String,pub transaction_status: PayeezyPaymentStatus,@@ -327,7 +327,7 @@ pub struct PayeezyPaymentsResponse {pub reference: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct PaymentsStoredCredentials {cardbrand_original_transaction_id: String,}@@ -502,7 +502,7 @@ impl<F> TryFrom<&PayeezyRouterData<&types::RefundsRouterData<F>>> for PayeezyRef// Type definition for Refund Response-#[derive(Debug, Deserialize, Default)]+#[derive(Debug, Deserialize, Default, Serialize)]#[serde(rename_all = "lowercase")]pub enum RefundStatus {Approved,@@ -522,7 +522,7 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Deserialize)]+#[derive(Deserialize, Debug, Serialize)]pub struct RefundResponse {pub correlation_id: String,pub transaction_status: RefundStatus,@@ -556,18 +556,18 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct Message {pub code: String,pub description: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct PayeezyError {pub messages: Vec<Message>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct PayeezyErrorResponse {pub transaction_status: String,#[serde(rename = "Error")]diff --git a/crates/router/src/connector/payme.rs b/crates/router/src/connector/payme.rsindex 40f4c646e5..d84c87f2e4 100644--- a/crates/router/src/connector/payme.rs+++ b/crates/router/src/connector/payme.rs@@ -16,6 +16,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self, request, ConnectorIntegration, ConnectorValidation},types::{@@ -80,11 +81,16 @@ impl ConnectorCommon for Payme {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: payme::PaymeErrorResponse =res.response.parse_struct("PaymeErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let status_code = match res.status_code {500..=511 => 200,_ => res.status_code,@@ -182,6 +188,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -192,6 +199,9 @@ impl.parse_struct("Payme CaptureBuyerResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -202,16 +212,18 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -288,12 +300,17 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: payme::GenerateSaleResponse = res.response.parse_struct("Payme GenerateSaleResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -304,16 +321,18 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -416,12 +435,17 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: payme::PaymePaySaleResponse = res.response.parse_struct("Payme PaymePaySaleResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -432,15 +456,17 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -522,12 +548,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: payme::PaymePaySaleResponse = res.response.parse_struct("Payme PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -538,16 +569,18 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -604,6 +637,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,@@ -618,6 +652,10 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.response.parse_struct("PaymePaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -628,9 +666,10 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -695,12 +734,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: payme::PaymePaySaleResponse = res.response.parse_struct("Payme PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -711,16 +755,18 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -798,12 +844,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: payme::PaymeRefundResponse = res.response.parse_struct("PaymeRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -814,16 +865,18 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -877,6 +930,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>,@@ -891,6 +945,10 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("GetSalesResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -901,16 +959,18 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn get_5xx_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// we are always getting 500 in error scenarios- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rsindex a7b21ce292..77dcb6429c 100644--- a/crates/router/src/connector/payme/transformers.rs+++ b/crates/router/src/connector/payme/transformers.rs@@ -119,7 +119,7 @@ pub struct CaptureBuyerRequest {card: PaymeCard,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct CaptureBuyerResponse {buyer_key: String,}@@ -156,7 +156,7 @@ pub struct ThreeDsSettings {active: bool,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct GenerateSaleResponse {payme_sale_id: String,}@@ -858,19 +858,19 @@ impl From<SaleStatus> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum PaymePaymentsResponse {PaymePaySaleResponse(PaymePaySaleResponse),SaleQueryResponse(SaleQueryResponse),}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]pub struct SaleQueryResponse {items: Vec<SaleQuery>,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]pub struct SaleQuery {sale_status: SaleStatus,sale_payme_id: String,@@ -978,7 +978,7 @@ impl TryFrom<SaleStatus> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct PaymeRefundResponse {sale_status: SaleStatus,payme_transaction_id: String,diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rsindex 742c563407..38d8b783d5 100644--- a/crates/router/src/connector/paypal.rs+++ b/crates/router/src/connector/paypal.rs@@ -21,6 +21,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -59,6 +60,7 @@ impl Paypal {pub fn get_order_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {//Handled error response separately for Orders as the end point is different for Orders - (Authorize) and Payments - (Capture, void, refund, rsync).//Error response have different fields for Orders and Payments.@@ -67,6 +69,9 @@ impl Paypal {.parse_struct("Paypal ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_reason = response.details.map(|order_errors| {order_errors.iter()@@ -207,12 +212,16 @@ impl ConnectorCommon for Paypal {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: paypal::PaypalPaymentErrorResponse = res.response.parse_struct("Paypal ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error_reason = response.details.map(|error_details| {@@ -345,6 +354,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {let response: paypal::PaypalAuthUpdateResponse = res@@ -352,6 +362,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("Paypal PaypalAuthUpdateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -362,12 +375,16 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: paypal::PaypalAccessTokenErrorResponse = res.response.parse_struct("Paypal AccessTokenErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error,@@ -464,6 +481,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: PaypalAuthResponse =@@ -473,6 +491,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pmatch response {PaypalAuthResponse::PaypalOrdersResponse(response) => {+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -480,6 +501,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P})}PaypalAuthResponse::PaypalRedirectResponse(response) => {+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -487,6 +510,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P})}PaypalAuthResponse::PaypalThreeDsResponse(response) => {+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -499,8 +524,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.get_order_error_response(res)+ self.get_order_error_response(res, event_builder)}}@@ -560,6 +586,7 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: paypal::PaypalPreProcessingResponse = res@@ -567,6 +594,9 @@ impl.parse_struct("paypal PaypalPreProcessingResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+match response {// if card supports 3DS check for liabilitypaypal::PaypalPreProcessingResponse::PaypalLiabilityResponse(liability_response) => {@@ -676,8 +706,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -741,12 +772,15 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: paypal::PaypalOrdersResponse = res.response.parse_struct("paypal PaypalOrdersResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -757,8 +791,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -847,12 +882,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: paypal::PaypalSyncResponse = res.response.parse_struct("paypal SyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -863,8 +901,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -938,12 +977,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: paypal::PaypalCaptureResponse = res.response.parse_struct("Paypal PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -954,8 +996,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1009,12 +1052,15 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: paypal::PaypalPaymentsCancelResponse = res.response.parse_struct("PaymentCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1024,8 +1070,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1097,12 +1144,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: paypal::RefundResponse =res.response.parse_struct("paypal RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1113,8 +1163,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1160,12 +1211,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: paypal::RefundSyncResponse = res.response.parse_struct("paypal RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1176,8 +1230,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -1268,12 +1323,15 @@ implfn handle_response(&self,data: &types::VerifyWebhookSourceRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::VerifyWebhookSourceRouterData, errors::ConnectorError> {let response: paypal::PaypalSourceVerificationResponse = res.response.parse_struct("paypal PaypalSourceVerificationResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1283,8 +1341,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rsindex 1447cf75be..a584fe9816 100644--- a/crates/router/src/connector/paypal/transformers.rs+++ b/crates/router/src/connector/paypal/transformers.rs@@ -762,7 +762,7 @@ impl TryFrom<&types::RefreshTokenRouterData> for PaypalAuthUpdateRequest {}}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct PaypalAuthUpdateResponse {pub access_token: Secret<String>,pub token_type: String,@@ -1063,7 +1063,7 @@ pub enum PaypalAuthResponse {}// Note: Don't change order of deserialization of variant, priority is in descending order-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum PaypalSyncResponse {PaypalOrdersSyncResponse(PaypalOrdersResponse),@@ -1742,7 +1742,7 @@ pub struct PaypalPaymentErrorResponse {pub details: Option<Vec<ErrorDetails>>,}-#[derive(Deserialize, Debug)]+#[derive(Deserialize, Debug, Serialize)]pub struct PaypalAccessTokenErrorResponse {pub error: String,pub error_description: String,diff --git a/crates/router/src/connector/payu.rs b/crates/router/src/connector/payu.rsindex c44b4d5d6f..bd850cf1e8 100644--- a/crates/router/src/connector/payu.rs+++ b/crates/router/src/connector/payu.rs@@ -12,6 +12,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -86,12 +87,16 @@ impl ConnectorCommon for Payu {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: payu::PayuErrorResponse = res.response.parse_struct("Payu ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.status.status_code,@@ -202,12 +207,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: payu::PayuPaymentsCancelResponse = res.response.parse_struct("PaymentCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -218,8 +228,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -289,6 +300,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {let response: payu::PayuAuthUpdateResponse = res@@ -296,6 +308,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("payu PayuAuthUpdateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -308,12 +323,16 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: payu::PayuAccessTokenErrorResponse = res.response.parse_struct("Payu AccessTokenErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error,@@ -377,12 +396,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: payu::PayuPaymentsSyncResponse = res.response.parse_struct("payu OrderResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -395,8 +417,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -462,12 +485,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: payu::PayuPaymentsCaptureResponse = res.response.parse_struct("payu CaptureResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -480,8 +506,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -560,12 +587,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: payu::PayuPaymentsResponse = res.response.parse_struct("PayuPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -578,8 +608,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -645,12 +676,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: payu::RefundResponse = res.response.parse_struct("payu RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -663,8 +697,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -713,12 +748,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: payu::RefundSyncResponse =res.response.parse_struct("payu RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -731,8 +769,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/payu/transformers.rs b/crates/router/src/connector/payu/transformers.rsindex 6edc570eb4..e3ad6f8b42 100644--- a/crates/router/src/connector/payu/transformers.rs+++ b/crates/router/src/connector/payu/transformers.rs@@ -172,7 +172,7 @@ impl From<PayuPaymentStatus> for enums::AttemptStatus {}}-#[derive(Debug, Clone, Deserialize, PartialEq)]+#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "camelCase")]pub struct PayuPaymentsResponse {pub status: PayuPaymentStatusData,@@ -230,7 +230,7 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for PayuPaymentsCaptureRequest {}}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct PayuPaymentsCaptureResponse {status: PayuPaymentStatusData,}@@ -283,7 +283,7 @@ impl TryFrom<&types::RefreshTokenRouterData> for PayuAuthUpdateRequest {})}}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct PayuAuthUpdateResponse {pub access_token: Secret<String>,pub token_type: String,@@ -394,7 +394,7 @@ pub struct PayuProductData {listing_date: Option<String>,}-#[derive(Debug, Clone, Deserialize, PartialEq)]+#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "camelCase")]pub struct PayuOrderResponseData {order_id: String,@@ -428,7 +428,7 @@ pub struct PayuOrderResponseBuyerData {customer_id: Option<String>,}-#[derive(Debug, Clone, Deserialize, PartialEq)]+#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]#[serde(tag = "type", rename_all = "SCREAMING_SNAKE_CASE")]pub enum PayuOrderResponsePayMethod {CardToken,@@ -442,7 +442,7 @@ pub struct PayuOrderResponseProperty {value: String,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct PayuPaymentsSyncResponse {orders: Vec<PayuOrderResponseData>,status: PayuPaymentStatusData,@@ -542,7 +542,7 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Default, Debug, Clone, Eq, PartialEq, Deserialize)]+#[derive(Default, Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PayuRefundResponseData {refund_id: String,@@ -555,7 +555,7 @@ pub struct PayuRefundResponseData {status_date_time: Option<String>,}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RefundResponse {refund: PayuRefundResponseData,@@ -579,7 +579,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct RefundSyncResponse {refunds: Vec<PayuRefundResponseData>,}@@ -617,7 +617,7 @@ pub struct PayuErrorResponse {pub status: PayuErrorData,}-#[derive(Deserialize, Debug)]+#[derive(Deserialize, Debug, Serialize)]pub struct PayuAccessTokenErrorResponse {pub error: String,pub error_description: String,diff --git a/crates/router/src/connector/placetopay.rs b/crates/router/src/connector/placetopay.rsindex ef51f1d6e4..ab33bf1039 100644--- a/crates/router/src/connector/placetopay.rs+++ b/crates/router/src/connector/placetopay.rs@@ -10,6 +10,7 @@ use crate::{configs::settings,connector::utils::{self},core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -89,12 +90,16 @@ impl ConnectorCommon for Placetopay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: placetopay::PlacetopayErrorResponse = res.response.parse_struct("PlacetopayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.status.reason.to_owned(),@@ -220,12 +225,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: placetopay::PlacetopayPaymentsResponse = res.response.parse_struct("Placetopay PlacetopayPaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -236,8 +246,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -294,12 +305,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: placetopay::PlacetopayPaymentsResponse = res.response.parse_struct("placetopay PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -310,8 +326,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -370,12 +387,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: placetopay::PlacetopayPaymentsResponse = res.response.parse_struct("Placetopay PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -386,8 +408,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -444,12 +467,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: placetopay::PlacetopayPaymentsResponse = res.response.parse_struct("Placetopay PaymentCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -460,8 +488,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -519,12 +548,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: placetopay::PlacetopayRefundResponse = res.response.parse_struct("placetopay PlacetopayRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -535,8 +569,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -593,12 +628,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: placetopay::PlacetopayRefundResponse = res.response.parse_struct("placetopay PlacetopayRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -609,8 +649,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/placetopay/transformers.rs b/crates/router/src/connector/placetopay/transformers.rsindex dfdd3f904d..f1c054b960 100644--- a/crates/router/src/connector/placetopay/transformers.rs+++ b/crates/router/src/connector/placetopay/transformers.rs@@ -204,7 +204,7 @@ impl TryFrom<&types::ConnectorAuthType> for PlacetopayAuthType {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum PlacetopayStatus {Ok,@@ -216,7 +216,7 @@ pub enum PlacetopayStatus {PendingProcess,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PlacetopayStatusResponse {status: PlacetopayStatus,@@ -234,7 +234,7 @@ impl From<PlacetopayStatus> for enums::AttemptStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PlacetopayPaymentsResponse {status: PlacetopayStatusResponse,@@ -315,14 +315,14 @@ impl From<PlacetopayRefundStatus> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PlacetopayRefundResponse {status: PlacetopayRefundStatus,internal_reference: u64,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum PlacetopayRefundStatus {Refunded,@@ -390,13 +390,13 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, PlacetopayRefundRespon}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PlacetopayErrorResponse {pub status: PlacetopayError,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PlacetopayError {pub status: PlacetopayErrorStatus,@@ -404,7 +404,7 @@ pub struct PlacetopayError {pub reason: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum PlacetopayErrorStatus {Failed,diff --git a/crates/router/src/connector/powertranz.rs b/crates/router/src/connector/powertranz.rsindex 654128bb3f..5023f6b743 100644--- a/crates/router/src/connector/powertranz.rs+++ b/crates/router/src/connector/powertranz.rs@@ -16,6 +16,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -112,9 +113,12 @@ impl ConnectorCommon for Powertranz {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// For error scenerios connector respond with 200 http status code and error response object in response// For http status code other than 200 they send empty response back+ event_builder.map(|i: &mut ConnectorEvent| i.set_error_response_body(&serde_json::json!({"error_response": std::str::from_utf8(&res.response).unwrap_or("")})));+Ok(ErrorResponse {status_code: res.status_code,code: consts::NO_ERROR_CODE.to_string(),@@ -240,12 +244,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: powertranz::PowertranzBaseResponse = res.response.parse_struct("Powertranz PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -256,8 +265,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -327,12 +337,17 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: powertranz::PowertranzBaseResponse = res.response.parse_struct("Powertranz PaymentsCompleteAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -343,8 +358,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -409,12 +425,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: powertranz::PowertranzBaseResponse = res.response.parse_struct("Powertranz PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -425,8 +446,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -461,12 +483,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::RouterData<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: powertranz::PowertranzBaseResponse = res.response.parse_struct("powertranz CancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -495,8 +522,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -554,12 +582,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: powertranz::PowertranzBaseResponse = res.response.parse_struct("powertranz RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -570,8 +603,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rsindex 8dc3688da9..54849f8bf1 100644--- a/crates/router/src/connector/powertranz/transformers.rs+++ b/crates/router/src/connector/powertranz/transformers.rs@@ -247,7 +247,7 @@ impl TryFrom<&types::ConnectorAuthType> for PowertranzAuthType {}// Common struct used in Payment, Capture, Void, Refund-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "PascalCase")]pub struct PowertranzBaseResponse {transaction_type: u8,@@ -475,7 +475,7 @@ pub struct PowertranzErrorResponse {pub errors: Vec<Error>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "PascalCase")]pub struct Error {pub code: String,diff --git a/crates/router/src/connector/prophetpay.rs b/crates/router/src/connector/prophetpay.rsindex fc14f37a2b..04b3e7b6d6 100644--- a/crates/router/src/connector/prophetpay.rs+++ b/crates/router/src/connector/prophetpay.rs@@ -12,6 +12,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -107,11 +108,16 @@ impl ConnectorCommon for Prophetpay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: serde_json::Value = res.response.parse_struct("ProphetPayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: consts::NO_ERROR_CODE.to_string(),@@ -228,6 +234,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError>where@@ -238,6 +245,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.parse_struct("prophetpay ProphetpayTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -248,8 +258,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -325,6 +336,7 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError>where@@ -334,6 +346,10 @@ impl.response.parse_struct("prophetpay ProphetpayResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -344,8 +360,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -406,12 +423,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: prophetpay::ProphetpaySyncResponse = res.response.parse_struct("prophetpay PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -422,8 +444,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -500,8 +523,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res,event_builder)}*/}@@ -569,6 +593,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: prophetpay::ProphetpayRefundResponse = res@@ -576,6 +601,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.parse_struct("prophetpay ProphetpayRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -586,8 +614,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -648,12 +677,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: prophetpay::ProphetpayRefundSyncResponse = res.response.parse_struct("prophetpay ProphetpayRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -664,8 +698,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/prophetpay/transformers.rs b/crates/router/src/connector/prophetpay/transformers.rsindex 23cffa3da2..b3b641b6d2 100644--- a/crates/router/src/connector/prophetpay/transformers.rs+++ b/crates/router/src/connector/prophetpay/transformers.rs@@ -169,7 +169,7 @@ impl TryFrom<&ProphetpayRouterData<&types::PaymentsAuthorizeRouterData>>}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ProphetpayTokenResponse {hosted_tokenize_id: String,@@ -366,7 +366,7 @@ impl TryFrom<&types::PaymentsSyncRouterData> for ProphetpaySyncRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ProphetpayCompleteAuthResponse {pub success: bool,@@ -438,7 +438,7 @@ impl<F>}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ProphetpaySyncResponse {success: bool,@@ -601,7 +601,7 @@ impl<F> TryFrom<&ProphetpayRouterData<&types::RefundsRouterData<F>>> for Prophet}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ProphetpayRefundResponse {pub success: bool,@@ -646,7 +646,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, ProphetpayRefundResp}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ProphetpayRefundSyncResponse {pub success: bool,diff --git a/crates/router/src/connector/rapyd.rs b/crates/router/src/connector/rapyd.rsindex 5272a8ab21..389893b552 100644--- a/crates/router/src/connector/rapyd.rs+++ b/crates/router/src/connector/rapyd.rs@@ -15,6 +15,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -86,6 +87,7 @@ impl ConnectorCommon for Rapyd {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: Result<rapyd::RapydPaymentsResponse,@@ -93,15 +95,20 @@ impl ConnectorCommon for Rapyd {> = res.response.parse_struct("Rapyd ErrorResponse");match response {- Ok(response_data) => Ok(ErrorResponse {- status_code: res.status_code,- code: response_data.status.error_code,- message: response_data.status.status.unwrap_or_default(),- reason: response_data.status.message,- attempt_status: None,- connector_transaction_id: None,- }),+ Ok(response_data) => {+ event_builder.map(|i| i.set_error_response_body(&response_data));+ router_env::logger::info!(connector_response=?response_data);+ Ok(ErrorResponse {+ status_code: res.status_code,+ code: response_data.status.error_code,+ message: response_data.status.status.unwrap_or_default(),+ reason: response_data.status.message,+ attempt_status: None,+ connector_transaction_id: None,+ })+ }Err(error_msg) => {+ event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));logger::error!(deserialization_error =? error_msg);utils::handle_json_response_deserialization_failure(res, "rapyd".to_owned())}@@ -239,12 +246,15 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: rapyd::RapydPaymentsResponse = res.response.parse_struct("Rapyd PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -257,8 +267,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -358,12 +369,15 @@ implfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: rapyd::RapydPaymentsResponse = res.response.parse_struct("Rapyd PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -376,8 +390,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -454,19 +469,23 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: rapyd::RapydPaymentsResponse = res.response.parse_struct("Rapyd PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -558,6 +577,7 @@ implfn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: rapyd::RapydPaymentsResponse = res@@ -565,6 +585,9 @@ impl.parse_struct("RapydPaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -588,8 +611,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -687,12 +711,15 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: rapyd::RefundResponse = res.response.parse_struct("rapyd RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -705,8 +732,9 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -717,12 +745,15 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refunfn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: rapyd::RefundResponse = res.response.parse_struct("rapyd RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),diff --git a/crates/router/src/connector/riskified.rs b/crates/router/src/connector/riskified.rsindex 29d57ee28c..72a9f6dbdb 100644--- a/crates/router/src/connector/riskified.rs+++ b/crates/router/src/connector/riskified.rs@@ -22,6 +22,7 @@ use crate::{};#[cfg(feature = "frm")]use crate::{+ events::connector_api_logs::ConnectorEvent,types::{api::fraud_check as frm_api, fraud_check as frm_types, ErrorResponse, Response},utils::BytesExt,};@@ -108,11 +109,16 @@ impl ConnectorCommon for Riskified {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: riskified::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,attempt_status: None,@@ -184,12 +190,15 @@ implfn handle_response(&self,data: &frm_types::FrmCheckoutRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmCheckoutRouterData, errors::ConnectorError> {let response: riskified::RiskifiedPaymentsResponse = res.response.parse_struct("RiskifiedPaymentsResponse Checkout").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);<frm_types::FrmCheckoutRouterData>::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -199,8 +208,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -312,6 +322,7 @@ implfn handle_response(&self,data: &frm_types::FrmTransactionRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmTransactionRouterData, errors::ConnectorError> {let response: riskified::RiskifiedTransactionResponse = res@@ -319,6 +330,9 @@ impl.parse_struct("RiskifiedPaymentsResponse Transaction").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+match response {riskified::RiskifiedTransactionResponse::FailedResponse(response_data) => {<frm_types::FrmTransactionRouterData>::try_from(types::ResponseRouterData {@@ -339,8 +353,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -406,6 +421,7 @@ implfn handle_response(&self,data: &frm_types::FrmFulfillmentRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmFulfillmentRouterData, errors::ConnectorError> {let response: riskified::RiskifiedFulfilmentResponse = res@@ -413,6 +429,9 @@ impl.parse_struct("RiskifiedFulfilmentResponse fulfilment").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+frm_types::FrmFulfillmentRouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -423,8 +442,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/shift4.rs b/crates/router/src/connector/shift4.rsindex c38fac56ef..352ec4787a 100644--- a/crates/router/src/connector/shift4.rs+++ b/crates/router/src/connector/shift4.rs@@ -15,6 +15,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers, routes,services::{self,@@ -85,12 +86,16 @@ impl ConnectorCommon for Shift4 {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: shift4::ErrorResponse = res.response.parse_struct("Shift4 ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response@@ -269,12 +274,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: shift4::Shift4NonThreeDsResponse = res.response.parse_struct("Shift4NonThreeDsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -286,8 +296,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -346,19 +357,25 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: shift4::Shift4NonThreeDsResponse = res.response.parse_struct("Shift4NonThreeDsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -403,12 +420,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: shift4::Shift4NonThreeDsResponse = res.response.parse_struct("Shift4NonThreeDsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -434,8 +456,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -514,12 +537,17 @@ implfn handle_response(&self,data: &types::PaymentsInitRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsInitRouterData, errors::ConnectorError> {let response: shift4::Shift4ThreeDsResponse = res.response.parse_struct("Shift4ThreeDsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -531,8 +559,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -596,12 +625,17 @@ implfn handle_response(&self,data: &types::PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {let response: shift4::Shift4NonThreeDsResponse = res.response.parse_struct("Shift4NonThreeDsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -613,8 +647,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -670,12 +705,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: shift4::RefundResponse = res.response.parse_struct("RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::ResponseRouterData {response,data: data.clone(),@@ -688,8 +728,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -737,12 +778,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: shift4::RefundResponse =res.response.parse_struct("shift4 RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -755,8 +799,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rsindex 949082f425..97c19c49af 100644--- a/crates/router/src/connector/shift4/transformers.rs+++ b/crates/router/src/connector/shift4/transformers.rs@@ -555,7 +555,7 @@ pub struct Shift4WebhookObjectResource {pub data: serde_json::Value,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct Shift4NonThreeDsResponse {pub id: String,pub currency: String,@@ -566,7 +566,7 @@ pub struct Shift4NonThreeDsResponse {pub flow: Option<FlowResponse>,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct Shift4ThreeDsResponse {pub enrolled: bool,pub version: Option<String>,@@ -575,7 +575,7 @@ pub struct Shift4ThreeDsResponse {pub token: Token,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct Token {pub id: String,pub created: i64,@@ -593,7 +593,7 @@ pub struct Token {pub three_d_secure_info: ThreeDSecureInfo,}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]pub struct ThreeDSecureInfo {pub amount: i64,pub currency: String,@@ -605,7 +605,7 @@ pub struct ThreeDSecureInfo {pub authentication_flow: Option<SecretSerdeValue>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct FlowResponse {pub next_action: Option<NextAction>,@@ -613,13 +613,13 @@ pub struct FlowResponse {pub return_url: Option<Url>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct Redirect {pub redirect_url: Option<Url>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "lowercase")]pub enum NextAction {Redirect,@@ -810,12 +810,12 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]pub struct ErrorResponse {pub error: ApiErrorResponse,}-#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq, Serialize)]pub struct ApiErrorResponse {pub code: Option<String>,pub message: String,diff --git a/crates/router/src/connector/signifyd.rs b/crates/router/src/connector/signifyd.rsindex 544dfd137d..7d19df1222 100644--- a/crates/router/src/connector/signifyd.rs+++ b/crates/router/src/connector/signifyd.rs@@ -19,6 +19,7 @@ use crate::{};#[cfg(feature = "frm")]use crate::{+ events::connector_api_logs::ConnectorEvent,types::{api::fraud_check as frm_api, fraud_check as frm_types, ErrorResponse, Response},utils::BytesExt,};@@ -76,11 +77,16 @@ impl ConnectorCommon for Signifyd {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: signifyd::SignifydErrorResponse = res.response.parse_struct("SignifydErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: crate::consts::NO_ERROR_CODE.to_string(),@@ -251,12 +257,17 @@ implfn handle_response(&self,data: &frm_types::FrmSaleRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmSaleRouterData, errors::ConnectorError> {let response: signifyd::SignifydPaymentsResponse = res.response.parse_struct("SignifydPaymentsResponse Sale").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+<frm_types::FrmSaleRouterData>::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -266,8 +277,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -335,12 +347,15 @@ implfn handle_response(&self,data: &frm_types::FrmCheckoutRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmCheckoutRouterData, errors::ConnectorError> {let response: signifyd::SignifydPaymentsResponse = res.response.parse_struct("SignifydPaymentsResponse Checkout").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);<frm_types::FrmCheckoutRouterData>::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -350,8 +365,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -421,12 +437,15 @@ implfn handle_response(&self,data: &frm_types::FrmTransactionRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmTransactionRouterData, errors::ConnectorError> {let response: signifyd::SignifydPaymentsResponse = res.response.parse_struct("SignifydPaymentsResponse Transaction").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);<frm_types::FrmTransactionRouterData>::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -436,8 +455,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -507,12 +527,15 @@ implfn handle_response(&self,data: &frm_types::FrmFulfillmentRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmFulfillmentRouterData, errors::ConnectorError> {let response: signifyd::FrmFullfillmentSignifydApiResponse = res.response.parse_struct("FrmFullfillmentSignifydApiResponse Sale").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);frm_types::FrmFulfillmentRouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -522,8 +545,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -593,12 +617,15 @@ implfn handle_response(&self,data: &frm_types::FrmRecordReturnRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<frm_types::FrmRecordReturnRouterData, errors::ConnectorError> {let response: signifyd::SignifydPaymentsRecordReturnResponse = res.response.parse_struct("SignifydPaymentsResponse Transaction").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);<frm_types::FrmRecordReturnRouterData>::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -608,8 +635,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/signifyd/transformers/api.rs b/crates/router/src/connector/signifyd/transformers/api.rsindex 66d6f0e48c..b738ec00fc 100644--- a/crates/router/src/connector/signifyd/transformers/api.rs+++ b/crates/router/src/connector/signifyd/transformers/api.rs@@ -211,7 +211,7 @@ impl<F, T>}}-#[derive(Debug, Deserialize, PartialEq)]+#[derive(Debug, Deserialize, PartialEq, Serialize)]pub struct SignifydErrorResponse {pub messages: Vec<String>,pub errors: serde_json::Value,diff --git a/crates/router/src/connector/square.rs b/crates/router/src/connector/square.rsindex e210a851df..ea6bd42ffe 100644--- a/crates/router/src/connector/square.rs+++ b/crates/router/src/connector/square.rs@@ -17,6 +17,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -96,12 +97,16 @@ impl ConnectorCommon for Square {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: square::SquareErrorResponse = res.response.parse_struct("SquareErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let mut reason_list = Vec::new();for error_iter in response.errors.iter() {if let Some(error) = error_iter.detail.clone() {@@ -289,6 +294,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -299,6 +305,9 @@ impl.parse_struct("SquareTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -308,8 +317,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -378,6 +388,7 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeSessionTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeSessionTokenRouterData, errors::ConnectorError> {let response: square::SquareSessionResponse = res@@ -385,6 +396,9 @@ impl.parse_struct("SquareSessionResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -395,8 +409,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -458,12 +473,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: square::SquarePaymentsResponse = res.response.parse_struct("SquarePaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -474,8 +494,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -529,12 +550,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: square::SquarePaymentsResponse = res.response.parse_struct("SquarePaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -545,8 +571,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -603,12 +630,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: square::SquarePaymentsResponse = res.response.parse_struct("SquarePaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -619,8 +651,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -669,12 +702,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: square::SquarePaymentsResponse = res.response.parse_struct("SquarePaymentsVoidResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -685,8 +723,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -742,12 +781,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: square::RefundResponse = res.response.parse_struct("SquareRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -758,8 +802,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -806,6 +851,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: square::RefundResponse = res@@ -813,6 +859,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.parse_struct("SquareRefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -823,8 +872,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/square/transformers.rs b/crates/router/src/connector/square/transformers.rsindex 7343ef58bb..e159b1d8ad 100644--- a/crates/router/src/connector/square/transformers.rs+++ b/crates/router/src/connector/square/transformers.rs@@ -200,7 +200,7 @@ impl TryFrom<&types::TokenizationRouterData> for SquareTokenRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct SquareSessionResponse {session_id: String,@@ -225,7 +225,7 @@ impl<F, T>}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct SquareTokenResponse {card_nonce: Secret<String>,}@@ -373,7 +373,7 @@ pub struct SquarePaymentsResponseDetails {amount_money: SquarePaymentsAmountData,reference_id: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct SquarePaymentsResponse {payment: SquarePaymentsResponseDetails,}@@ -456,7 +456,7 @@ pub struct SquareRefundResponseDetails {status: RefundStatus,id: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct RefundResponse {refund: SquareRefundResponseDetails,}diff --git a/crates/router/src/connector/stax.rs b/crates/router/src/connector/stax.rsindex 75bb8e6818..db090cdf78 100644--- a/crates/router/src/connector/stax.rs+++ b/crates/router/src/connector/stax.rs@@ -14,6 +14,7 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -98,6 +99,7 @@ impl ConnectorCommon for Stax {fn build_error_response(&self,res: Response,+ _event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {Ok(ErrorResponse {status_code: res.status_code,@@ -194,6 +196,7 @@ implfn handle_response(&self,data: &types::ConnectorCustomerRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::ConnectorCustomerRouterData, errors::ConnectorError>where@@ -204,6 +207,9 @@ impl.parse_struct("StaxCustomerResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -214,8 +220,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -277,6 +284,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -287,6 +295,9 @@ impl.parse_struct("StaxTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -297,8 +308,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -400,12 +412,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: stax::StaxPaymentsResponse = res.response.parse_struct("StaxPaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -416,8 +433,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -471,12 +489,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: stax::StaxPaymentsResponse = res.response.parse_struct("StaxPaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -487,8 +510,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -557,12 +581,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: stax::StaxPaymentsResponse = res.response.parse_struct("StaxPaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -573,8 +602,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -623,12 +653,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: stax::StaxPaymentsResponse = res.response.parse_struct("StaxPaymentsVoidResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -639,8 +674,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -714,12 +750,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: stax::RefundResponse = res.response.parse_struct("StaxRefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -730,8 +771,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -778,12 +820,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: stax::RefundResponse = res.response.parse_struct("StaxRefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -794,8 +841,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rsindex 596ea1145e..a9bb68d558 100644--- a/crates/router/src/connector/stax/transformers.rs+++ b/crates/router/src/connector/stax/transformers.rs@@ -167,7 +167,7 @@ impl TryFrom<&types::ConnectorCustomerRouterData> for StaxCustomerRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct StaxCustomerResponse {id: Secret<String>,}@@ -277,7 +277,7 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct StaxTokenResponse {id: Secret<String>,}@@ -298,19 +298,19 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, StaxTokenResponse, T, types::Pay}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "snake_case")]pub enum StaxPaymentResponseTypes {Charge,PreAuth,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct StaxChildCapture {id: String,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct StaxPaymentsResponse {success: bool,id: String,@@ -406,14 +406,14 @@ impl<F> TryFrom<&StaxRouterData<&types::RefundsRouterData<F>>> for StaxRefundReq}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ChildTransactionsInResponse {id: String,success: bool,created_at: String,total: f64,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct RefundResponse {id: String,success: bool,diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rsindex c151c5af45..01848f704e 100644--- a/crates/router/src/connector/stripe.rs+++ b/crates/router/src/connector/stripe.rs@@ -17,7 +17,8 @@ use crate::{errors::{self, CustomResult},payments,},- headers, logger,+ events::connector_api_logs::ConnectorEvent,+ headers,services::{self,request::{self, Mask},@@ -177,13 +178,16 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: stripe::StripeSourceResponse = res.response.parse_struct("StripeSourceResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -196,12 +200,16 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -299,6 +307,7 @@ implfn handle_response(&self,data: &types::ConnectorCustomerRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::ConnectorCustomerRouterData, errors::ConnectorError>where@@ -308,7 +317,9 @@ impl.response.parse_struct("StripeCustomerResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -321,12 +332,15 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::ErrorResponse {status_code: res.status_code,@@ -421,6 +435,7 @@ implfn handle_response(&self,data: &types::TokenizationRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::TokenizationRouterData, errors::ConnectorError>where@@ -430,7 +445,9 @@ impl.response.parse_struct("StripeTokenResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -443,12 +460,15 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::ErrorResponse {status_code: res.status_code,@@ -551,6 +571,7 @@ implfn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError>where@@ -561,7 +582,10 @@ impl.response.parse_struct("PaymentIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -573,12 +597,15 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::ErrorResponse {status_code: res.status_code,@@ -673,6 +700,7 @@ implfn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError>where@@ -686,7 +714,10 @@ impl.response.parse_struct("SetupIntentSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -698,7 +729,10 @@ impl.response.parse_struct("PaymentIntentSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -714,12 +748,14 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::ErrorResponse {status_code: res.status_code,@@ -843,18 +879,57 @@ implfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {match &data.request.payment_method_data {api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => {- stripe::get_bank_transfer_authorize_response(data, res, bank_transfer_data.deref())+ match bank_transfer_data.deref() {+ api_models::payments::BankTransferData::AchBankTransfer { .. }+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => {+ let response: stripe::ChargesResponse = res+ .response+ .parse_struct("ChargesResponse")+ .change_context(+ errors::ConnectorError::ResponseDeserializationFailed,+ )?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);++ types::RouterData::try_from(types::ResponseRouterData {+ response,+ data: data.clone(),+ http_code: res.status_code,+ })+ }+ _ => {+ let response: stripe::PaymentIntentResponse = res+ .response+ .parse_struct("PaymentIntentResponse")+ .change_context(+ errors::ConnectorError::ResponseDeserializationFailed,+ )?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);++ types::RouterData::try_from(types::ResponseRouterData {+ response,+ data: data.clone(),+ http_code: res.status_code,+ })+ }+ }}_ => {let response: stripe::PaymentIntentResponse = res.response.parse_struct("PaymentIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -869,12 +944,14 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -970,13 +1047,17 @@ implfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: stripe::PaymentIntentResponse = res.response.parse_struct("PaymentIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -988,12 +1069,16 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -1110,6 +1195,7 @@ impltypes::SetupMandateRequestData,types::PaymentsResponseData,>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<@@ -1128,7 +1214,10 @@ impl.response.parse_struct("SetupIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1140,12 +1229,16 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -1239,13 +1332,17 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: stripe::RefundResponse =res.response.parse_struct("Stripe RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1257,12 +1354,16 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reffn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -1340,6 +1441,7 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refunfn handle_response(&self,data: &types::RefundsRouterData<api::RSync>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>,@@ -1349,7 +1451,10 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refunres.response.parse_struct("Stripe RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -1361,12 +1466,16 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refunfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -1488,6 +1597,7 @@ implfn handle_response(&self,data: &types::UploadFileRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<api::Upload, types::UploadFileRequestData, types::UploadFileResponse>,@@ -1497,7 +1607,8 @@ impl.response.parse_struct("Stripe FileUploadResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::UploadFileRouterData {response: Ok(types::UploadFileResponse {provider_file_id: response.file_id,@@ -1509,12 +1620,16 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -1592,6 +1707,7 @@ implfn handle_response(&self,data: &types::RetrieveFileRouterData,+ _event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<@@ -1602,6 +1718,7 @@ implerrors::ConnectorError,> {let response = res.response;+ router_env::logger::info!(connector_response=?response);Ok(types::RetrieveFileRouterData {response: Ok(types::RetrieveFileResponse {file_data: response.to_vec(),@@ -1613,12 +1730,15 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: response@@ -1719,13 +1839,15 @@ implfn handle_response(&self,data: &types::SubmitEvidenceRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::SubmitEvidenceRouterData, errors::ConnectorError> {let response: stripe::DisputeObj = res.response.parse_struct("Stripe DisputeObj").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::info!(connector_response=?response);+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::SubmitEvidenceRouterData {response: Ok(types::SubmitEvidenceResponse {dispute_status: api_models::enums::DisputeStatus::DisputeChallenged,@@ -1738,12 +1860,16 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: stripe::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::ErrorResponse {status_code: res.status_code,code: responsediff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rsindex 3558d6e487..6a89232d4e 100644--- a/crates/router/src/connector/stripe/transformers.rs+++ b/crates/router/src/connector/stripe/transformers.rs@@ -3,7 +3,7 @@ use std::{collections::HashMap, ops::Deref};use api_models::{self, enums as api_enums, payments};use common_utils::{errors::CustomResult,- ext_traits::{ByteSliceExt, BytesExt},+ ext_traits::ByteSliceExt,pii::{self, Email},request::RequestContent,};@@ -186,7 +186,7 @@ pub struct TokenRequest {pub token_data: StripePaymentMethodData,}-#[derive(Debug, Eq, PartialEq, Deserialize)]+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct StripeTokenResponse {pub id: String,pub object: String,@@ -201,7 +201,7 @@ pub struct CustomerRequest {pub source: Option<String>,}-#[derive(Debug, Eq, PartialEq, Deserialize)]+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct StripeCustomerResponse {pub id: String,pub description: Option<String>,@@ -220,7 +220,7 @@ pub struct ChargesRequest {pub meta_data: Option<HashMap<String, String>>,}-#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]pub struct ChargesResponse {pub id: String,pub amount: u64,@@ -2085,7 +2085,7 @@ impl From<StripePaymentStatus> for enums::AttemptStatus {}}-#[derive(Debug, Default, Eq, PartialEq, Deserialize)]+#[derive(Debug, Default, Eq, PartialEq, Deserialize, Serialize)]pub struct PaymentIntentResponse {pub id: String,pub object: String,@@ -2182,7 +2182,7 @@ pub struct LastPaymentError {decline_code: Option<String>,}-#[derive(Deserialize, Debug)]+#[derive(Deserialize, Debug, Serialize)]pub struct PaymentIntentSyncResponse {#[serde(flatten)]payment_intent_fields: PaymentIntentResponse,@@ -2190,20 +2190,20 @@ pub struct PaymentIntentSyncResponse {pub latest_charge: Option<StripeChargeEnum>,}-#[derive(Deserialize, Debug, Clone)]+#[derive(Deserialize, Debug, Clone, Serialize)]#[serde(untagged)]pub enum StripeChargeEnum {ChargeId(String),ChargeObject(StripeCharge),}-#[derive(Deserialize, Clone, Debug)]+#[derive(Deserialize, Clone, Debug, Serialize)]pub struct StripeCharge {pub id: String,pub payment_method_details: Option<StripePaymentMethodDetailsResponse>,}-#[derive(Deserialize, Clone, Debug)]+#[derive(Deserialize, Clone, Debug, Serialize)]pub struct StripeBankRedirectDetails {#[serde(rename = "generated_sepa_debit")]attached_payment_method: Option<String>,@@ -2217,7 +2217,7 @@ impl Deref for PaymentIntentSyncResponse {}}-#[derive(Deserialize, Clone, Debug)]+#[derive(Deserialize, Clone, Debug, Serialize)]#[serde(rename_all = "snake_case", tag = "type")]pub enum StripePaymentMethodDetailsResponse {//only ideal, sofort and bancontact is supported by stripe for recurring payment in bank redirect@@ -2302,7 +2302,7 @@ impl From<SetupIntentResponse> for PaymentIntentResponse {}}-#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]pub struct SetupIntentResponse {pub id: String,pub object: String,@@ -2627,7 +2627,7 @@ impl ForeignFrom<Option<LatestAttempt>> for Option<String> {}}-#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]#[serde(rename_all = "snake_case", remote = "Self")]pub enum StripeNextActionResponse {CashappHandleRedirectOrDisplayQrCode(StripeCashappQrResponse),@@ -2686,6 +2686,27 @@ impl<'de> Deserialize<'de> for StripeNextActionResponse {}}+impl Serialize for StripeNextActionResponse {+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>+ where+ S: serde::Serializer,+ {+ match *self {+ Self::CashappHandleRedirectOrDisplayQrCode(ref i) => {+ serde::Serialize::serialize(i, serializer)+ }+ Self::RedirectToUrl(ref i) => serde::Serialize::serialize(i, serializer),+ Self::AlipayHandleRedirect(ref i) => serde::Serialize::serialize(i, serializer),+ Self::VerifyWithMicrodeposits(ref i) => serde::Serialize::serialize(i, serializer),+ Self::WechatPayDisplayQrCode(ref i) => serde::Serialize::serialize(i, serializer),+ Self::DisplayBankTransferInstructions(ref i) => {+ serde::Serialize::serialize(i, serializer)+ }+ Self::NoNextActionBody => serde::Serialize::serialize("NoNextActionBody", serializer),+ }+ }+}+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct StripeRedirectToUrlResponse {return_url: String,@@ -2701,7 +2722,7 @@ pub struct WechatPayRedirectToQr {image_data_url: Url,}-#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct StripeVerifyWithMicroDepositsResponse {hosted_verification_url: Url,}@@ -3013,13 +3034,13 @@ pub struct MitExemption {pub network_transaction_id: Secret<String>,}-#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]#[serde(untagged)]pub enum LatestAttempt {PaymentIntentAttempt(LatestPaymentAttempt),SetupAttempt(String),}-#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]pub struct LatestPaymentAttempt {pub payment_method_options: Option<StripePaymentMethodOptions>,}@@ -3588,40 +3609,6 @@ pub fn get_bank_transfer_request_data(}}-pub fn get_bank_transfer_authorize_response(- data: &types::PaymentsAuthorizeRouterData,- res: types::Response,- bank_transfer_data: &api_models::payments::BankTransferData,-) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {- match bank_transfer_data {- api_models::payments::BankTransferData::AchBankTransfer { .. }- | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => {- let response: ChargesResponse = res- .response- .parse_struct("ChargesResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- types::RouterData::try_from(types::ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }- _ => {- let response: PaymentIntentResponse = res- .response- .parse_struct("PaymentIntentResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- types::RouterData::try_from(types::ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }- }-}-pub fn construct_file_upload_request(file_upload_router_data: types::UploadFileRouterData,) -> CustomResult<reqwest::multipart::Form, errors::ConnectorError> {@@ -3636,7 +3623,7 @@ pub fn construct_file_upload_request(Ok(multipart)}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct FileUploadResponse {#[serde(rename = "id")]pub file_id: String,@@ -3768,7 +3755,7 @@ impl TryFrom<&types::SubmitEvidenceRouterData> for Evidence {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct DisputeObj {#[serde(rename = "id")]pub dispute_id: String,diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rsindex 61ee2e2659..18775dd398 100644--- a/crates/router/src/connector/trustpay.rs+++ b/crates/router/src/connector/trustpay.rs@@ -21,6 +21,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -109,6 +110,7 @@ impl ConnectorCommon for Trustpay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: Result<trustpay::TrustpayErrorResponse,@@ -117,6 +119,8 @@ impl ConnectorCommon for Trustpay {match response {Ok(response_data) => {+ event_builder.map(|i| i.set_error_response_body(&response_data));+ router_env::logger::info!(connector_response=?response_data);let error_list = response_data.errors.clone().unwrap_or_default();let option_error_code_message = get_error_code_error_message_based_on_priority(self.clone(),@@ -147,6 +151,7 @@ impl ConnectorCommon for Trustpay {})}Err(error_msg) => {+ event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));logger::error!(deserialization_error =? error_msg);utils::handle_json_response_deserialization_failure(res, "trustpay".to_owned())}@@ -279,12 +284,17 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {let response: trustpay::TrustpayAuthUpdateResponse = res.response.parse_struct("trustpay TrustpayAuthUpdateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -296,11 +306,16 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: trustpay::TrustpayAccessTokenErrorResponse = res.response.parse_struct("Trustpay AccessTokenErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.result_info.result_code.to_string(),@@ -371,19 +386,25 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: trustpay::TrustpayPaymentsResponse = res.response.parse_struct("trustpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -480,12 +501,17 @@ implfn handle_response(&self,data: &types::PaymentsPreProcessingRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsPreProcessingRouterData, errors::ConnectorError> {let response: trustpay::TrustpayCreateIntentResponse = res.response.parse_struct("TrustpayCreateIntentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -497,8 +523,9 @@ implfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -590,12 +617,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: trustpay::TrustpayPaymentsResponse = res.response.parse_struct("trustpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -607,8 +639,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -690,12 +723,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: trustpay::RefundResponse = res.response.parse_struct("trustpay RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -707,8 +745,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -767,12 +806,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: trustpay::RefundResponse = res.response.parse_struct("trustpay RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -784,8 +828,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rsindex c266753423..71286bda3f 100644--- a/crates/router/src/connector/trustpay/transformers.rs+++ b/crates/router/src/connector/trustpay/transformers.rs@@ -946,7 +946,7 @@ pub struct ResultInfo {pub correlation_id: Option<String>,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, Serialize, PartialEq)]pub struct TrustpayAuthUpdateResponse {pub access_token: Option<Secret<String>>,pub token_type: Option<String>,@@ -955,7 +955,7 @@ pub struct TrustpayAuthUpdateResponse {pub result_info: ResultInfo,}-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "PascalCase")]pub struct TrustpayAccessTokenErrorResponse {pub result_info: ResultInfo,@@ -1038,7 +1038,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsPreProcessingRouterData>>}}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TrustpayCreateIntentResponse {// TrustPay's authorization secrets used by client@@ -1050,14 +1050,14 @@ pub struct TrustpayCreateIntentResponse {pub instance_id: String,}-#[derive(Clone, Debug, Deserialize)]+#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub enum InitResultData {AppleInitResultData(TrustpayApplePayResponse),GoogleInitResultData(TrustpayGooglePayResponse),}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct GooglePayTransactionInfo {pub country_code: api_models::enums::CountryAlpha2,@@ -1066,14 +1066,14 @@ pub struct GooglePayTransactionInfo {pub total_price: String,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct GooglePayMerchantInfo {pub merchant_name: String,pub merchant_id: String,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct GooglePayAllowedPaymentMethods {#[serde(rename = "type")]@@ -1082,14 +1082,14 @@ pub struct GooglePayAllowedPaymentMethods {pub tokenization_specification: GpayTokenizationSpecification,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct GpayTokenParameters {pub gateway: String,pub gateway_merchant_id: String,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct GpayTokenizationSpecification {#[serde(rename = "type")]@@ -1097,14 +1097,14 @@ pub struct GpayTokenizationSpecification {pub parameters: GpayTokenParameters,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct GpayAllowedMethodsParameters {pub allowed_auth_methods: Vec<String>,pub allowed_card_networks: Vec<String>,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TrustpayGooglePayResponse {pub merchant_info: GooglePayMerchantInfo,@@ -1112,14 +1112,14 @@ pub struct TrustpayGooglePayResponse {pub transaction_info: GooglePayTransactionInfo,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct SdkSecretInfo {pub display: Secret<String>,pub payment: Secret<String>,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TrustpayApplePayResponse {pub country_code: api_models::enums::CountryAlpha2,@@ -1129,7 +1129,7 @@ pub struct TrustpayApplePayResponse {pub total: ApplePayTotalInfo,}-#[derive(Clone, Default, Debug, Deserialize)]+#[derive(Clone, Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ApplePayTotalInfo {pub label: String,diff --git a/crates/router/src/connector/tsys.rs b/crates/router/src/connector/tsys.rsindex 8c19f9f823..8117bc8901 100644--- a/crates/router/src/connector/tsys.rs+++ b/crates/router/src/connector/tsys.rs@@ -11,6 +11,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -189,12 +190,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: tsys::TsysPaymentsResponse = res.response.parse_struct("Tsys PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -205,8 +211,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -266,12 +273,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: tsys::TsysSyncResponse = res.response.parse_struct("tsys PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -282,8 +294,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -345,12 +358,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: tsys::TsysPaymentsResponse = res.response.parse_struct("Tsys PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -361,8 +379,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -420,12 +439,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: tsys::TsysPaymentsResponse = res.response.parse_struct("PaymentCancelResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -435,8 +459,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -495,12 +520,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: tsys::RefundResponse = res.response.parse_struct("tsys RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -511,8 +541,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -570,12 +601,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: tsys::TsysSyncResponse = res.response.parse_struct("tsys RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -586,8 +622,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/tsys/transformers.rs b/crates/router/src/connector/tsys/transformers.rsindex dd700d11bc..a01576bbb2 100644--- a/crates/router/src/connector/tsys/transformers.rs+++ b/crates/router/src/connector/tsys/transformers.rs@@ -111,14 +111,14 @@ impl TryFrom<&types::ConnectorAuthType> for TsysAuthType {}// PaymentsResponse-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum TsysPaymentStatus {Pass,Fail,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum TsysTransactionStatus {Approved,@@ -142,7 +142,7 @@ impl From<TsysTransactionDetails> for enums::AttemptStatus {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TsysErrorResponse {pub status: TsysPaymentStatus,@@ -150,7 +150,7 @@ pub struct TsysErrorResponse {pub response_message: String,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TsysTransactionDetails {#[serde(rename = "transactionID")]@@ -159,7 +159,7 @@ pub struct TsysTransactionDetails {transaction_status: TsysTransactionStatus,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TsysPaymentsSyncResponse {pub status: TsysPaymentStatus,@@ -168,7 +168,7 @@ pub struct TsysPaymentsSyncResponse {pub transaction_details: TsysTransactionDetails,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TsysResponse {pub status: TsysPaymentStatus,@@ -178,14 +178,14 @@ pub struct TsysResponse {pub transaction_id: String,}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(untagged)]pub enum TsysResponseTypes {SuccessResponse(TsysResponse),ErrorResponse(TsysErrorResponse),}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[allow(clippy::enum_variant_names)]pub enum TsysPaymentsResponse {AuthResponse(TsysResponseTypes),@@ -195,13 +195,13 @@ pub enum TsysPaymentsResponse {}fn get_error_response(- connector_error_response: TsysErrorResponse,+ connector_response: TsysErrorResponse,status_code: u16,) -> types::ErrorResponse {types::ErrorResponse {- code: connector_error_response.response_code,- message: connector_error_response.response_message.clone(),- reason: Some(connector_error_response.response_message),+ code: connector_response.response_code,+ message: connector_response.response_message.clone(),+ reason: Some(connector_response.response_message),status_code,attempt_status: None,connector_transaction_id: None,@@ -260,8 +260,8 @@ impl<F, T>Ok(get_payments_response(auth_response)),enums::AttemptStatus::Authorized,),- TsysResponseTypes::ErrorResponse(connector_error_response) => (- Err(get_error_response(connector_error_response, item.http_code)),+ TsysResponseTypes::ErrorResponse(connector_response) => (+ Err(get_error_response(connector_response, item.http_code)),enums::AttemptStatus::AuthorizationFailed,),},@@ -270,8 +270,8 @@ impl<F, T>Ok(get_payments_response(sale_response)),enums::AttemptStatus::Charged,),- TsysResponseTypes::ErrorResponse(connector_error_response) => (- Err(get_error_response(connector_error_response, item.http_code)),+ TsysResponseTypes::ErrorResponse(connector_response) => (+ Err(get_error_response(connector_response, item.http_code)),enums::AttemptStatus::Failure,),},@@ -280,8 +280,8 @@ impl<F, T>Ok(get_payments_response(capture_response)),enums::AttemptStatus::Charged,),- TsysResponseTypes::ErrorResponse(connector_error_response) => (- Err(get_error_response(connector_error_response, item.http_code)),+ TsysResponseTypes::ErrorResponse(connector_response) => (+ Err(get_error_response(connector_response, item.http_code)),enums::AttemptStatus::CaptureFailed,),},@@ -290,8 +290,8 @@ impl<F, T>Ok(get_payments_response(void_response)),enums::AttemptStatus::Voided,),- TsysResponseTypes::ErrorResponse(connector_error_response) => (- Err(get_error_response(connector_error_response, item.http_code)),+ TsysResponseTypes::ErrorResponse(connector_response) => (+ Err(get_error_response(connector_response, item.http_code)),enums::AttemptStatus::VoidFailed,),},@@ -340,14 +340,14 @@ impl TryFrom<&types::PaymentsSyncRouterData> for TsysSyncRequest {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum SearchResponseTypes {SuccessResponse(TsysPaymentsSyncResponse),ErrorResponse(TsysErrorResponse),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "PascalCase")]pub struct TsysSyncResponse {search_transaction_response: SearchResponseTypes,@@ -366,8 +366,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, TsysSyncResponse, T, types::PaymOk(get_payments_sync_response(&search_response)),enums::AttemptStatus::from(search_response.transaction_details),),- SearchResponseTypes::ErrorResponse(connector_error_response) => (- Err(get_error_response(connector_error_response, item.http_code)),+ SearchResponseTypes::ErrorResponse(connector_response) => (+ Err(get_error_response(connector_response, item.http_code)),item.data.status,),};@@ -498,7 +498,7 @@ impl From<TsysTransactionDetails> for enums::RefundStatus {}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "PascalCase")]pub struct RefundResponse {return_response: TsysResponseTypes,@@ -517,8 +517,8 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>connector_refund_id: return_response.transaction_id,refund_status: enums::RefundStatus::from(return_response.status),}),- TsysResponseTypes::ErrorResponse(connector_error_response) => {- Err(get_error_response(connector_error_response, item.http_code))+ TsysResponseTypes::ErrorResponse(connector_response) => {+ Err(get_error_response(connector_response, item.http_code))}};Ok(Self {@@ -557,8 +557,8 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, TsysSyncResponse>>refund_status: enums::RefundStatus::from(search_response.transaction_details),})}- SearchResponseTypes::ErrorResponse(connector_error_response) => {- Err(get_error_response(connector_error_response, item.http_code))+ SearchResponseTypes::ErrorResponse(connector_response) => {+ Err(get_error_response(connector_response, item.http_code))}};Ok(Self {diff --git a/crates/router/src/connector/volt.rs b/crates/router/src/connector/volt.rsindex f125f90d93..4a08bc1ad6 100644--- a/crates/router/src/connector/volt.rs+++ b/crates/router/src/connector/volt.rs@@ -12,6 +12,7 @@ use super::utils;use crate::{configs::settings,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -112,12 +113,16 @@ impl ConnectorCommon for Volt {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: volt::VoltErrorResponse = res.response.parse_struct("VoltErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let reason = match &response.exception.error_list {Some(error_list) => error_list.iter()@@ -207,6 +212,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn handle_response(&self,data: &types::RefreshTokenRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {let response: volt::VoltAuthUpdateResponse = res@@ -214,6 +220,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("Volt VoltAuthUpdateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -224,6 +233,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {// auth error have different structure than common errorlet response: volt::VoltAuthErrorResponse = res@@ -231,6 +241,9 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t.parse_struct("VoltAuthErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.code.to_string(),@@ -328,12 +341,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: volt::VoltPaymentsResponse = res.response.parse_struct("Volt PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -344,8 +362,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -398,12 +417,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: volt::VoltPaymentsResponseData = res.response.parse_struct("volt PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -414,8 +438,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -473,12 +498,17 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {let response: volt::VoltPaymentsResponse = res.response.parse_struct("Volt PaymentsCaptureResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -489,8 +519,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -561,12 +592,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: volt::RefundResponse = res.response.parse_struct("volt RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -577,8 +613,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/volt/transformers.rs b/crates/router/src/connector/volt/transformers.rsindex b1d77f3416..ccb482d5b7 100644--- a/crates/router/src/connector/volt/transformers.rs+++ b/crates/router/src/connector/volt/transformers.rs@@ -185,7 +185,7 @@ impl TryFrom<&types::RefreshTokenRouterData> for VoltAuthUpdateRequest {}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]pub struct VoltAuthUpdateResponse {pub access_token: Secret<String>,pub token_type: String,@@ -451,7 +451,7 @@ impl<F> TryFrom<&VoltRouterData<&types::RefundsRouterData<F>>> for VoltRefundReq}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct RefundResponse {id: String,}@@ -598,7 +598,7 @@ pub struct VoltErrorResponse {pub exception: VoltErrorException,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct VoltAuthErrorResponse {pub code: u64,pub message: String,diff --git a/crates/router/src/connector/wise.rs b/crates/router/src/connector/wise.rsindex 66ccf22c10..152786b46a 100644--- a/crates/router/src/connector/wise.rs+++ b/crates/router/src/connector/wise.rs@@ -13,6 +13,7 @@ use self::transformers as wise;use crate::{configs::settings,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -82,11 +83,16 @@ impl ConnectorCommon for Wise {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: wise::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let default_status = response.status.unwrap_or_default().to_string();match response.errors {Some(errs) => {@@ -278,12 +284,17 @@ impl services::ConnectorIntegration<api::PoCancel, types::PayoutsData, types::Pafn handle_response(&self,data: &types::PayoutsRouterData<api::PoCancel>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoCancel>, errors::ConnectorError> {let response: wise::WisePayoutResponse = res.response.parse_struct("WisePayoutResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -294,11 +305,16 @@ impl services::ConnectorIntegration<api::PoCancel, types::PayoutsData, types::Pafn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {let response: wise::ErrorResponse = res.response.parse_struct("ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let def_res = response.status.unwrap_or_default().to_string();let errors = response.errors.unwrap_or_default();let (code, message) = if let Some(e) = errors.first() {@@ -374,12 +390,17 @@ impl services::ConnectorIntegration<api::PoQuote, types::PayoutsData, types::Payfn handle_response(&self,data: &types::PayoutsRouterData<api::PoQuote>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoQuote>, errors::ConnectorError> {let response: wise::WisePayoutQuoteResponse = res.response.parse_struct("WisePayoutQuoteResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -390,8 +411,9 @@ impl services::ConnectorIntegration<api::PoQuote, types::PayoutsData, types::Payfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -449,12 +471,17 @@ implfn handle_response(&self,data: &types::PayoutsRouterData<api::PoRecipient>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoRecipient>, errors::ConnectorError> {let response: wise::WiseRecipientCreateResponse = res.response.parse_struct("WiseRecipientCreateResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -465,8 +492,9 @@ implfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -560,12 +588,17 @@ impl services::ConnectorIntegration<api::PoCreate, types::PayoutsData, types::Pafn handle_response(&self,data: &types::PayoutsRouterData<api::PoCreate>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoCreate>, errors::ConnectorError> {let response: wise::WisePayoutResponse = res.response.parse_struct("WisePayoutResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -576,8 +609,9 @@ impl services::ConnectorIntegration<api::PoCreate, types::PayoutsData, types::Pafn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -667,12 +701,17 @@ impl services::ConnectorIntegration<api::PoFulfill, types::PayoutsData, types::Pfn handle_response(&self,data: &types::PayoutsRouterData<api::PoFulfill>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PayoutsRouterData<api::PoFulfill>, errors::ConnectorError> {let response: wise::WiseFulfillResponse = res.response.parse_struct("WiseFulfillResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -683,8 +722,9 @@ impl services::ConnectorIntegration<api::PoFulfill, types::PayoutsData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/wise/transformers.rs b/crates/router/src/connector/wise/transformers.rsindex b213c62212..82ae59205b 100644--- a/crates/router/src/connector/wise/transformers.rs+++ b/crates/router/src/connector/wise/transformers.rs@@ -3,9 +3,7 @@ use api_models::payouts::PayoutMethodData;#[cfg(feature = "payouts")]use common_utils::pii::Email;use masking::Secret;-use serde::Deserialize;-#[cfg(feature = "payouts")]-use serde::Serialize;+use serde::{Deserialize, Serialize};type Error = error_stack::Report<errors::ConnectorError>;@@ -40,7 +38,7 @@ impl TryFrom<&types::ConnectorAuthType> for WiseAuthType {}// Wise error response-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ErrorResponse {pub timestamp: Option<String>,pub errors: Option<Vec<SubError>>,@@ -51,7 +49,7 @@ pub struct ErrorResponse {pub path: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct SubError {pub code: String,pub message: String,@@ -140,7 +138,7 @@ pub struct WiseAddressDetails {#[allow(dead_code)]#[cfg(feature = "payouts")]-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct WiseRecipientCreateResponse {id: i64,@@ -179,7 +177,7 @@ pub enum WisePayOutOption {#[allow(dead_code)]#[cfg(feature = "payouts")]-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct WisePayoutQuoteResponse {source_amount: f64,@@ -196,7 +194,7 @@ pub struct WisePayoutQuoteResponse {}#[cfg(feature = "payouts")]-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum WiseRateType {#[default]@@ -225,7 +223,7 @@ pub struct WiseTransferDetails {#[allow(dead_code)]#[cfg(feature = "payouts")]-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct WisePayoutResponse {id: i64,@@ -265,7 +263,7 @@ pub enum FundType {#[allow(dead_code)]#[cfg(feature = "payouts")]-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct WiseFulfillResponse {status: WiseStatus,diff --git a/crates/router/src/connector/worldline.rs b/crates/router/src/connector/worldline.rsindex a1ca8a110b..e46062a312 100644--- a/crates/router/src/connector/worldline.rs+++ b/crates/router/src/connector/worldline.rs@@ -16,6 +16,7 @@ use crate::{configs::settings::Connectors,consts,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers, logger,services::{self,@@ -122,11 +123,16 @@ impl ConnectorCommon for Worldline {fn build_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: worldline::ErrorResponse = res.response.parse_struct("Worldline ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+let error = response.errors.into_iter().next().unwrap_or_default();Ok(ErrorResponse {status_code: res.status_code,@@ -247,13 +253,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {let response: worldline::PaymentResponse = res.response.parse_struct("Worldline PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- logger::debug!(payments_cancel_response=?response);++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -265,8 +275,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -326,13 +337,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {logger::debug!(payment_sync_response=?res);@@ -341,6 +354,10 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.parse_struct("Worldline Payment").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;response.capture_method = data.request.capture_method.unwrap_or_default();++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -429,6 +446,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymetypes::PaymentsCaptureData,types::PaymentsResponseData,>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RouterData<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>,@@ -445,6 +463,10 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme.parse_struct("Worldline PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;response.payment.capture_method = enums::CaptureMethod::Manual;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -456,8 +478,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -540,6 +563,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {logger::debug!(payment_authorize_response=?res);@@ -548,6 +572,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P.parse_struct("Worldline PaymentResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;response.payment.capture_method = data.request.capture_method.unwrap_or_default();+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -560,8 +586,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -625,6 +652,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {logger::debug!(target: "router::connector::worldline", response=?res);@@ -632,6 +660,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.response.parse_struct("Worldline RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -644,8 +674,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -701,6 +732,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: types::Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {logger::debug!(target: "router::connector::worldline", response=?res);@@ -708,6 +740,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse.response.parse_struct("Worldline RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);types::ResponseRouterData {response,data: data.clone(),@@ -720,8 +754,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rsindex a21c88a2ce..1eb22fc52d 100644--- a/crates/router/src/connector/worldline/transformers.rs+++ b/crates/router/src/connector/worldline/transformers.rs@@ -528,7 +528,7 @@ impl TryFrom<&types::ConnectorAuthType> for WorldlineAuthType {}}-#[derive(Debug, Clone, Default, Deserialize, PartialEq)]+#[derive(Debug, Clone, Default, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum PaymentStatus {Captured,@@ -573,7 +573,7 @@ impl ForeignFrom<(PaymentStatus, enums::CaptureMethod)> for enums::AttemptStatus/// capture_method is not part of response from connector./// This is used to decide payment status while converting connector response to RouterData./// To keep this try_from logic generic in case of AUTHORIZE, SYNC and CAPTURE flows capture_method will be set from RouterData request.-#[derive(Default, Debug, Clone, Deserialize, PartialEq)]+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]pub struct Payment {pub id: String,pub status: PaymentStatus,@@ -607,20 +607,20 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, Payment, T, PaymentsResponseData}}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct PaymentResponse {pub payment: Payment,pub merchant_action: Option<MerchantAction>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct MerchantAction {pub redirect_data: RedirectData,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct RedirectData {#[serde(rename = "redirectURL")]pub redirect_url: Url,@@ -688,7 +688,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for WorldlineRefundRequest {}#[allow(dead_code)]-#[derive(Debug, Default, Deserialize, Clone)]+#[derive(Debug, Default, Deserialize, Clone, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum RefundStatus {Cancelled,@@ -708,7 +708,7 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Default, Debug, Clone, Deserialize)]+#[derive(Default, Debug, Clone, Deserialize, Serialize)]pub struct RefundResponse {id: String,status: RefundStatus,@@ -750,7 +750,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>}}-#[derive(Default, Debug, Deserialize, PartialEq)]+#[derive(Default, Debug, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "camelCase")]pub struct Error {pub code: Option<String>,@@ -758,7 +758,7 @@ pub struct Error {pub message: Option<String>,}-#[derive(Default, Debug, Deserialize, PartialEq)]+#[derive(Default, Debug, Deserialize, PartialEq, Serialize)]#[serde(rename_all = "camelCase")]pub struct ErrorResponse {pub error_id: Option<String>,diff --git a/crates/router/src/connector/worldpay.rs b/crates/router/src/connector/worldpay.rsindex d4ac530172..fa534a8806 100644--- a/crates/router/src/connector/worldpay.rs+++ b/crates/router/src/connector/worldpay.rs@@ -15,6 +15,7 @@ use crate::{configs::settings,connector::utils as connector_utils,core::errors::{self, CustomResult},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -84,11 +85,16 @@ impl ConnectorCommon for Worldpay {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: WorldpayErrorResponse = res.response.parse_struct("WorldpayErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(ErrorResponse {status_code: res.status_code,code: response.error_name,@@ -201,6 +207,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn handle_response(&self,data: &types::PaymentsCancelRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError>where@@ -214,6 +221,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR.response.parse_struct("Worldpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::PaymentsCancelRouterData {status: enums::AttemptStatus::Voided,response: Ok(types::PaymentsResponseData::TransactionResponse {@@ -235,8 +244,9 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsRfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -298,13 +308,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}fn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: WorldpayEventResponse =@@ -312,6 +324,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe.parse_struct("Worldpay EventResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+Ok(types::PaymentsSyncRouterData {status: enums::AttemptStatus::from(response.last_event),response: Ok(types::PaymentsResponseData::TransactionResponse {@@ -364,6 +379,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn handle_response(&self,data: &types::PaymentsCaptureRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {match res.status_code {@@ -372,6 +388,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme.response.parse_struct("Worldpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::PaymentsCaptureRouterData {status: enums::AttemptStatus::Charged,response: Ok(types::PaymentsResponseData::TransactionResponse {@@ -406,8 +424,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -486,12 +505,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: WorldpayPaymentsResponse = res.response.parse_struct("Worldpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -503,8 +527,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -571,6 +596,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {match res.status_code {@@ -579,6 +605,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon.response.parse_struct("Worldpay PaymentsResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::RefundExecuteRouterData {response: Ok(types::RefundsResponseData {connector_refund_id: ResponseIdStr::try_from(response.links)?.id,@@ -594,8 +622,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -642,12 +671,15 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: WorldpayEventResponse =res.response.parse_struct("Worldpay EventResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(types::RefundSyncRouterData {response: Ok(types::RefundsResponseData {connector_refund_id: data.request.refund_id.clone(),@@ -660,8 +692,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rsindex 0d5634c40c..537e97cb57 100644--- a/crates/router/src/connector/zen.rs+++ b/crates/router/src/connector/zen.rs@@ -16,6 +16,7 @@ use crate::{errors::{self, CustomResult},payments,},+ events::connector_api_logs::ConnectorEvent,headers,services::{self,@@ -104,12 +105,15 @@ impl ConnectorCommon for Zen {fn build_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {let response: zen::ZenErrorResponse = res.response.parse_struct("Zen ErrorResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- router_env::logger::info!(error_response=?response);++ event_builder.map(|i| i.set_error_response_body(&response));+ router_env::logger::info!(connector_response=?response);Ok(ErrorResponse {status_code: res.status_code,@@ -265,12 +269,14 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn handle_response(&self,data: &types::PaymentsAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {let response: zen::ZenPaymentsResponse = res.response.parse_struct("Zen PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -282,8 +288,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Pfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -334,12 +341,14 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn handle_response(&self,data: &types::PaymentsSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {let response: zen::ZenPaymentsResponse = res.response.parse_struct("zen PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);types::RouterData::try_from(types::ResponseRouterData {response,@@ -351,8 +360,9 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -455,13 +465,16 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn handle_response(&self,data: &types::RefundsRouterData<api::Execute>,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {let response: zen::RefundResponse = res.response.parse_struct("zen RefundResponse").change_context(errors::ConnectorError::RequestEncodingFailed)?;+ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -472,8 +485,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponfn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}@@ -522,13 +536,17 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn handle_response(&self,data: &types::RefundSyncRouterData,+ event_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {let response: zen::RefundResponse = res.response.parse_struct("zen RefundSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);+types::RouterData::try_from(types::ResponseRouterData {response,data: data.clone(),@@ -539,8 +557,9 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponsefn get_error_response(&self,res: Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ self.build_error_response(res, event_builder)}}diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rsindex 0adae0d00b..ebea61304a 100644--- a/crates/router/src/connector/zen/transformers.rs+++ b/crates/router/src/connector/zen/transformers.rs@@ -819,7 +819,7 @@ impl TryFrom<&api_models::payments::GiftCardData> for ZenPaymentsRequest {}// PaymentsResponse-#[derive(Debug, Default, Deserialize, Clone, strum::Display)]+#[derive(Debug, Default, Deserialize, Clone, strum::Display, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum ZenPaymentStatus {Authorized,@@ -849,7 +849,7 @@ impl ForeignTryFrom<(ZenPaymentStatus, Option<ZenActions>)> for enums::AttemptSt}}-#[derive(Debug, Clone, Deserialize)]+#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct ApiResponse {status: ZenPaymentStatus,@@ -860,14 +860,14 @@ pub struct ApiResponse {reject_reason: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum ZenPaymentsResponse {ApiResponse(ApiResponse),CheckoutResponse(CheckoutResponse),}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct CheckoutResponse {redirect_url: url::Url,@@ -1034,7 +1034,7 @@ impl<F> TryFrom<&ZenRouterData<&types::RefundsRouterData<F>>> for ZenRefundReque}}-#[derive(Debug, Default, Deserialize)]+#[derive(Debug, Default, Deserialize, Serialize)]#[serde(rename_all = "UPPERCASE")]pub enum RefundStatus {Authorized,@@ -1054,7 +1054,7 @@ impl From<RefundStatus> for enums::RefundStatus {}}-#[derive(Default, Debug, Deserialize)]+#[derive(Default, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct RefundResponse {id: String,@@ -1169,13 +1169,13 @@ pub enum ZenWebhookTxnType {Unknown,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ZenErrorResponse {pub error: Option<ZenErrorBody>,pub message: Option<String>,}-#[derive(Debug, Deserialize, Clone)]+#[derive(Debug, Deserialize, Clone, Serialize)]pub struct ZenErrorBody {pub message: String,pub code: String,diff --git a/crates/router/src/events/connector_api_logs.rs b/crates/router/src/events/connector_api_logs.rsindex 4d3aadc3c4..31ee4a2d98 100644--- a/crates/router/src/events/connector_api_logs.rs+++ b/crates/router/src/events/connector_api_logs.rs@@ -1,6 +1,7 @@use common_utils::request::Method;use router_env::tracing_actix_web::RequestId;use serde::Serialize;+use serde_json::json;use time::OffsetDateTime;use super::{EventType, RawEvent};@@ -10,7 +11,8 @@ pub struct ConnectorEvent {connector_name: String,flow: String,request: String,- response: Option<String>,+ masked_response: Option<String>,+ error: Option<String>,url: String,method: String,payment_id: String,@@ -29,7 +31,6 @@ impl ConnectorEvent {connector_name: String,flow: &str,request: serde_json::Value,- response: Option<String>,url: String,method: Method,payment_id: String,@@ -48,7 +49,8 @@ impl ConnectorEvent {.unwrap_or(flow).to_string(),request: request.to_string(),- response,+ masked_response: None,+ error: None,url,method: method.to_string(),payment_id,@@ -63,6 +65,28 @@ impl ConnectorEvent {status_code,}}++ pub fn set_response_body<T: Serialize>(&mut self, response: &T) {+ match masking::masked_serialize(response) {+ Ok(masked) => {+ self.masked_response = Some(masked.to_string());+ }+ Err(er) => self.set_error(json!({"error": er.to_string()})),+ }+ }++ pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {+ match masking::masked_serialize(response) {+ Ok(masked) => {+ self.error = Some(masked.to_string());+ }+ Err(er) => self.set_error(json!({"error": er.to_string()})),+ }+ }++ pub fn set_error(&mut self, error: serde_json::Value) {+ self.error = Some(error.to_string());+ }}impl TryFrom<ConnectorEvent> for RawEvent {diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex 28405c001e..fbaaec6224 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -184,6 +184,7 @@ pub trait ConnectorIntegration<T, Req, Resp>: ConnectorIntegrationAny<T, Req, Refn handle_response(&self,data: &types::RouterData<T, Req, Resp>,+ event_builder: Option<&mut ConnectorEvent>,_res: types::Response,) -> CustomResult<types::RouterData<T, Req, Resp>, errors::ConnectorError>where@@ -191,20 +192,25 @@ pub trait ConnectorIntegration<T, Req, Resp>: ConnectorIntegrationAny<T, Req, ReReq: Clone,Resp: Clone,{+ event_builder.map(|e| e.set_error(json!({"error": "Not Implemented"})));Ok(data.clone())}fn get_error_response(&self,- _res: types::Response,+ res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {+ event_builder.map(|event| event.set_error(json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));Ok(ErrorResponse::get_not_implemented())}fn get_5xx_error_response(&self,res: types::Response,+ event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {+ event_builder.map(|event| event.set_error(json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));let error_message = match res.status_code {500 => "internal_server_error",501 => "not_implemented",@@ -288,8 +294,7 @@ whereresponse: res.into(),status_code: 200,};-- connector_integration.handle_response(req, response)+ connector_integration.handle_response(req, None, response)}payments::CallConnectorAction::Avoid => Ok(router_data),payments::CallConnectorAction::StatusUpdate {@@ -379,21 +384,10 @@ where.map_or_else(|value| value.status_code, |value| value.status_code)}).unwrap_or_default();- let connector_event = ConnectorEvent::new(+ let mut connector_event = ConnectorEvent::new(req.connector.clone(),std::any::type_name::<T>(),masked_request_body,- response- .as_ref()- .map(|response| {- response- .as_ref()- .map_or_else(|value| value, |value| value)- .response- .escape_ascii()- .to_string()- })- .ok(),request_url,request_method,req.payment_id.clone(),@@ -405,22 +399,13 @@ wherestatus_code,);- match connector_event.try_into() {- Ok(event) => {- state.event_handler().log_event(event);- }- Err(err) => {- logger::error!(error=?err, "Error Logging Connector Event");- }- }-match response {Ok(body) => {let response = match body {Ok(body) => {let connector_http_status_code = Some(body.status_code);- let mut data = connector_integration- .handle_response(req, body)+ match connector_integration+ .handle_response(req, Some(&mut connector_event), body).map_err(|error| {if error.current_context()== &errors::ConnectorError::ResponseDeserializationFailed@@ -435,14 +420,40 @@ where)}error- })?;- data.connector_http_status_code = connector_http_status_code;- // Add up multiple external latencies in case of multiple external calls within the same request.- data.external_latency = Some(- data.external_latency- .map_or(external_latency, |val| val + external_latency),- );- data+ }) {+ Ok(mut data) => {++ match connector_event.try_into() {+ Ok(event) => {+ state.event_handler().log_event(event);+ }+ Err(err) => {+ logger::error!(error=?err, "Error Logging Connector Event");+ }+ };+ data.connector_http_status_code = connector_http_status_code;+ // Add up multiple external latencies in case of multiple external calls within the same request.+ data.external_latency = Some(+ data.external_latency+ .map_or(external_latency, |val| val + external_latency),+ );+ Ok(data)+ },+ Err(err) => {++ connector_event.set_error(json!({"error": err.to_string()}));++ match connector_event.try_into() {+ Ok(event) => {+ state.event_handler().log_event(event);+ }+ Err(err) => {+ logger::error!(error=?err, "Error Logging Connector Event");+ }+ }+ Err(err)+ },+ }?}Err(body) => {router_data.connector_http_status_code = Some(body.status_code);@@ -459,13 +470,30 @@ wherereq.connector.clone(),)],);+let error = match body.status_code {500..=511 => {- connector_integration.get_5xx_error_response(body)?+ let error_res = connector_integration+ .get_5xx_error_response(+ body,+ Some(&mut connector_event),+ )?;+ match connector_event.try_into() {+ Ok(event) => {+ state.event_handler().log_event(event);+ }+ Err(err) => {+ logger::error!(error=?err, "Error Logging Connector Event");+ }+ };+ error_res}_ => {- let error_res =- connector_integration.get_error_response(body)?;+ let error_res = connector_integration+ .get_error_response(+ body,+ Some(&mut connector_event),+ )?;if let Some(status) = error_res.attempt_status {router_data.status = status;};@@ -481,6 +509,15 @@ whereOk(response)}Err(error) => {+ connector_event.set_error(json!({"error": error.to_string()}));+ match connector_event.try_into() {+ Ok(event) => {+ state.event_handler().log_event(event);+ }+ Err(err) => {+ logger::error!(error=?err, "Error Logging Connector Event");+ }+ };if error.current_context().is_upstream_timeout() {let error_response = ErrorResponse {code: consts::REQUEST_TIMEOUT_ERROR_CODE.to_string(),diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rsindex b60153eaf1..db6cb8236b 100644--- a/crates/router/src/types/api.rs+++ b/crates/router/src/types/api.rs@@ -39,6 +39,7 @@ use crate::{errors::{self, CustomResult},payments::types as payments_types,},+ events::connector_api_logs::ConnectorEvent,services::{request, ConnectorIntegration, ConnectorRedirectResponse, ConnectorValidation},types::{self, api::enums as api_enums},};@@ -129,6 +130,7 @@ pub trait ConnectorCommon {fn build_error_response(&self,res: types::Response,+ _event_builder: Option<&mut ConnectorEvent>,) -> CustomResult<ErrorResponse, errors::ConnectorError> {Ok(ErrorResponse {status_code: res.status_code,diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rsindex c03f492e8b..e4c347187c 100644--- a/crates/router/src/types/api/verify_connector.rs+++ b/crates/router/src/types/api/verify_connector.rs@@ -161,7 +161,7 @@ pub trait VerifyConnector {dyn types::api::Connector + Sync: ConnectorIntegration<F, R1, R2>,{let error = connector- .get_error_response(error_response)+ .get_error_response(error_response, None).change_context(errors::ApiErrorResponse::InternalServerError)?;Err(errors::ApiErrorResponse::InvalidRequestData {message: error.reason.unwrap_or(error.message),@@ -177,7 +177,7 @@ pub trait VerifyConnector {dyn types::api::Connector + Sync: ConnectorIntegration<F, R1, R2>,{let error = connector- .get_error_response(error_response)+ .get_error_response(error_response, None).change_context(errors::ApiErrorResponse::InternalServerError)?;Err(errors::ApiErrorResponse::InvalidRequestData {message: error.reason.unwrap_or(error.message),diff --git a/crates/router/src/types/api/verify_connector/paypal.rs b/crates/router/src/types/api/verify_connector/paypal.rsindex 33e848f909..721562bd4a 100644--- a/crates/router/src/types/api/verify_connector/paypal.rs+++ b/crates/router/src/types/api/verify_connector/paypal.rs@@ -35,7 +35,7 @@ impl VerifyConnector for connector::Paypal {Ok(res) => Some(connector_data.connector- .handle_response(&router_data, res)+ .handle_response(&router_data, None, res).change_context(errors::ApiErrorResponse::InternalServerError)?.response.map_err(|_| errors::ApiErrorResponse::InternalServerError.into()),diff --git a/crates/router/src/types/api/verify_connector/stripe.rs b/crates/router/src/types/api/verify_connector/stripe.rsindex ece9fa15a1..3fc55291d9 100644--- a/crates/router/src/types/api/verify_connector/stripe.rs+++ b/crates/router/src/types/api/verify_connector/stripe.rs@@ -19,7 +19,7 @@ impl VerifyConnector for connector::Stripe {dyn types::api::Connector + Sync: ConnectorIntegration<F, R1, R2>,{let error = connector- .get_error_response(error_response)+ .get_error_response(error_response, None).change_context(errors::ApiErrorResponse::InternalServerError)?;match (env::which(), error.code.as_str()) {// In situations where an attempt is made to process a payment using a