Skip to content

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

fix(Connector): [WorldpayXML] XML format logs & card name in applepay (#12233)

Nithin N5944062d6558
diff --git a/crates/common_utils/src/request.rs b/crates/common_utils/src/request.rs
index ad62030749..3fe7e9191d 100644
--- a/crates/common_utils/src/request.rs
+++ b/crates/common_utils/src/request.rs
@@ -3,6 +3,35 @@ use reqwest::multipart::Form;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
+/// Default XML version
+pub const DEFAULT_XML_VERSION: &str = "1.0";
+/// Default XML encoding
+pub const DEFAULT_XML_ENCODING: &str = "UTF-8";
+
+/// Configuration for XML serialization
+#[derive(Debug, Clone)]
+pub struct XmlConfig {
+ /// XML version (e.g., "1.0")
+ pub xml_version: String,
+ /// XML encoding (e.g., "UTF-8")
+ pub xml_encoding: Option<String>,
+ /// XML standalone declaration
+ pub xml_standalone: Option<String>,
+ /// XML document type declaration
+ pub xml_doc_type: Option<String>,
+}
+
+impl Default for XmlConfig {
+ fn default() -> Self {
+ Self {
+ xml_version: DEFAULT_XML_VERSION.to_string(),
+ xml_encoding: Some(DEFAULT_XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: None,
+ }
+ }
+}
+
pub type Headers = std::collections::HashSet<(String, Maskable<String>)>;
#[derive(
@@ -59,7 +88,7 @@ impl std::fmt::Debug for RequestContent {
Self::Json(_) => "JsonRequestBody",
Self::FormUrlEncoded(_) => "FormUrlEncodedRequestBody",
Self::FormData(_) => "FormDataRequestBody",
- Self::Xml(_) => "XmlRequestBody",
+ Self::Xml(_, _) => "XmlRequestBody",
Self::RawBytes(_) => "RawBytesRequestBody",
})
}
@@ -74,7 +103,10 @@ pub enum RequestContent {
Box<dyn hyperswitch_masking::ErasedMaskSerialize + Send>,
),
),
- Xml(Box<dyn hyperswitch_masking::ErasedMaskSerialize + Send>),
+ Xml(
+ Box<dyn hyperswitch_masking::ErasedMaskSerialize + Send>,
+ Option<XmlConfig>,
+ ),
RawBytes(Vec<u8>),
}
@@ -83,7 +115,7 @@ impl RequestContent {
match self {
Self::Json(i) => serde_json::to_string(&i).unwrap_or_default().into(),
Self::FormUrlEncoded(i) => serde_urlencoded::to_string(i).unwrap_or_default().into(),
- Self::Xml(i) => quick_xml::se::to_string(&i).unwrap_or_default().into(),
+ Self::Xml(i, _) => quick_xml::se::to_string(&i).unwrap_or_default().into(),
Self::FormData((_, i)) => serde_json::to_string(i).unwrap_or_default().into(),
Self::RawBytes(_) => String::new().into(),
}
diff --git a/crates/external_services/src/http_client.rs b/crates/external_services/src/http_client.rs
index c003e5eb28..cd52b95516 100644
--- a/crates/external_services/src/http_client.rs
+++ b/crates/external_services/src/http_client.rs
@@ -1,5 +1,9 @@
use common_utils::{consts, errors::CustomResult, request::Request};
use hyperswitch_interfaces::{errors::HttpClientError, types::Proxy};
+use quick_xml::{
+ events::{BytesDecl, BytesText, Event},
+ Writer,
+};
use request::{HeaderExt, RequestBuilderExt};
use router_env::{instrument, logger, tracing};
/// client module
@@ -10,10 +14,54 @@ pub mod metrics;
pub mod request;
use std::{error::Error, time::Duration};
-use common_utils::request::RequestContent;
pub use common_utils::request::{ContentType, Method, RequestBuilder};
+use common_utils::request::{RequestContent, XmlConfig};
use error_stack::ResultExt;
+#[allow(missing_docs)]
+#[instrument(skip_all)]
+pub fn serialize_to_xml_bytes<T: serde::Serialize>(
+ item: &T,
+ config: Option<XmlConfig>,
+) -> Result<Vec<u8>, error_stack::Report<HttpClientError>> {
+ let mut xml_bytes = Vec::new();
+ let mut writer = Writer::new(std::io::Cursor::new(&mut xml_bytes));
+
+ if let Some(xml_config) = config {
+ let xml_version = xml_config.xml_version;
+ let xml_encoding = xml_config.xml_encoding.as_deref();
+ let xml_standalone = xml_config.xml_standalone.as_deref();
+ let xml_doc_type = xml_config.xml_doc_type.as_deref();
+
+ writer
+ .write_event(Event::Decl(BytesDecl::new(
+ xml_version.as_str(),
+ xml_encoding,
+ xml_standalone,
+ )))
+ .change_context(HttpClientError::BodySerializationFailed)
+ .attach_printable("Failed to write XML declaration")?;
+
+ if let Some(xml_doc_type_data) = xml_doc_type {
+ writer
+ .write_event(Event::DocType(BytesText::from_escaped(xml_doc_type_data)))
+ .change_context(HttpClientError::BodySerializationFailed)
+ .attach_printable("Failed to write XML DOCTYPE declaration")?;
+ }
+ }
+
+ let xml_body = quick_xml::se::to_string(item)
+ .change_context(HttpClientError::BodySerializationFailed)
+ .attach_printable("Failed to serialize XML body")?;
+
+ writer
+ .write_event(Event::Text(BytesText::from_escaped(xml_body)))
+ .change_context(HttpClientError::BodySerializationFailed)
+ .attach_printable("Failed to write XML body text")?;
+
+ Ok(xml_bytes)
+}
+
#[allow(missing_docs)]
#[instrument(skip_all)]
pub async fn send_request(
@@ -47,9 +95,8 @@ pub async fn send_request(
Some(RequestContent::Json(payload)) => client.json(&payload),
Some(RequestContent::FormData((form, _))) => client.multipart(form),
Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload),
- Some(RequestContent::Xml(payload)) => {
- let body = quick_xml::se::to_string(&payload)
- .change_context(HttpClientError::BodySerializationFailed)?;
+ Some(RequestContent::Xml(payload, config)) => {
+ let body = serialize_to_xml_bytes(&payload, config)?;
client.body(body).header("Content-Type", "application/xml")
}
Some(RequestContent::RawBytes(payload)) => client.body(payload),
@@ -62,9 +109,8 @@ pub async fn send_request(
Some(RequestContent::Json(payload)) => client.json(&payload),
Some(RequestContent::FormData((form, _))) => client.multipart(form),
Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload),
- Some(RequestContent::Xml(payload)) => {
- let body = quick_xml::se::to_string(&payload)
- .change_context(HttpClientError::BodySerializationFailed)?;
+ Some(RequestContent::Xml(payload, config)) => {
+ let body = serialize_to_xml_bytes(&payload, config)?;
client.body(body).header("Content-Type", "application/xml")
}
Some(RequestContent::RawBytes(payload)) => client.body(payload),
@@ -77,9 +123,8 @@ pub async fn send_request(
Some(RequestContent::Json(payload)) => client.json(&payload),
Some(RequestContent::FormData((form, _))) => client.multipart(form),
Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload),
- Some(RequestContent::Xml(payload)) => {
- let body = quick_xml::se::to_string(&payload)
- .change_context(HttpClientError::BodySerializationFailed)?;
+ Some(RequestContent::Xml(payload, config)) => {
+ let body = serialize_to_xml_bytes(&payload, config)?;
client.body(body).header("Content-Type", "application/xml")
}
Some(RequestContent::RawBytes(payload)) => client.body(payload),
diff --git a/crates/hyperswitch_connectors/src/connectors/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rs
index 2b0a97ab6d..2b01c4f70f 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku.rs
@@ -245,7 +245,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
let connector_router_data = boku::BokuRouterData::from((amount, req));
let connector_req = boku::BokuPaymentsRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Xml(Box::new(connector_req)))
+ Ok(RequestContent::Xml(Box::new(connector_req), None))
}
fn build_request(
@@ -333,7 +333,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Bok
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = boku::BokuPsyncRequest::try_from(req)?;
- Ok(RequestContent::Xml(Box::new(connector_req)))
+ Ok(RequestContent::Xml(Box::new(connector_req), None))
}
fn build_request(
@@ -506,7 +506,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Boku {
let connector_router_data = boku::BokuRouterData::from((refund_amount, req));
let connector_req = boku::BokuRefundRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Xml(Box::new(connector_req)))
+ Ok(RequestContent::Xml(Box::new(connector_req), None))
}
fn build_request(
@@ -591,7 +591,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Boku {
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = boku::BokuRsyncRequest::try_from(req)?;
- Ok(RequestContent::Xml(Box::new(connector_req)))
+ Ok(RequestContent::Xml(Box::new(connector_req), None))
}
fn build_request(
diff --git a/crates/hyperswitch_connectors/src/connectors/envoy.rs b/crates/hyperswitch_connectors/src/connectors/envoy.rs
index e78ddab843..ec59b6a18d 100644
--- a/crates/hyperswitch_connectors/src/connectors/envoy.rs
+++ b/crates/hyperswitch_connectors/src/connectors/envoy.rs
@@ -137,7 +137,7 @@ impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for Envoy
let connector_router_data = envoy::EnvoyRouterData::from((amount, req));
let payout_request = envoy::PayToBankAccountV3::try_from(&connector_router_data)?;
let soap_envelope = envoy::SoapEnvelope::new(payout_request);
- Ok(RequestContent::Xml(Box::new(soap_envelope)))
+ Ok(RequestContent::Xml(Box::new(soap_envelope), None))
}
fn build_request(
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
index c47c1ee3af..003df31730 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
@@ -6,7 +6,7 @@ use base64::Engine;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
- request::{Method, Request, RequestBuilder, RequestContent},
+ request::{Method, Request, RequestBuilder, RequestContent, XmlConfig},
types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
};
use error_stack::{report, ResultExt};
@@ -289,15 +289,20 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
worldpayxml::PaymentService::try_from(&connector_router_data)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
-
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(
+ worldpayxml::worldpayxml_constants::XML_ENCODING.to_string(),
+ ),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
_ => Err(errors::ConnectorError::FlowNotSupported {
flow: "Setup Mandate flow is not implemented for this payment method".to_string(),
@@ -397,14 +402,18 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -488,14 +497,18 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -587,14 +600,18 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -673,14 +690,18 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Wo
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -761,14 +782,18 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpa
let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((refund_amount, req));
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -846,14 +871,18 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayx
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -970,14 +999,18 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
let connector_req_object = worldpayxml::PaymentService::try_from(connector_router_data)?;
router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -1079,14 +1112,18 @@ impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for World
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -1173,14 +1210,18 @@ impl ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData> for Worldpay
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
@@ -1266,15 +1307,18 @@ impl ConnectorIntegration<PoCancel, PayoutsData, PayoutsResponseData> for Worldp
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
- let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayxml::worldpayxml_constants::XML_VERSION,
- Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
- None,
- Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
- )?;
-
- Ok(RequestContent::RawBytes(connector_req))
+ let xml_config = XmlConfig {
+ xml_version: worldpayxml::worldpayxml_constants::XML_VERSION.to_string(),
+ xml_encoding: Some(worldpayxml::worldpayxml_constants::XML_ENCODING.to_string()),
+ xml_standalone: None,
+ xml_doc_type: Some(
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE.to_string(),
+ ),
+ };
+ Ok(RequestContent::Xml(
+ Box::new(connector_req_object),
+ Some(xml_config),
+ ))
}
fn build_request(
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
index 934e46a638..821f93d30e 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
@@ -990,7 +990,7 @@ impl
year: expiry_year,
},
},
- card_holder_name: item.customer_name.clone(),
+ card_holder_name: None,
cryptogram: apple_pay_decrypt_data
.payment_data
.online_payment_cryptogram,
diff --git a/crates/hyperswitch_interfaces/src/api_client.rs b/crates/hyperswitch_interfaces/src/api_client.rs
index 9784543a0a..72a0c2f418 100644
--- a/crates/hyperswitch_interfaces/src/api_client.rs
+++ b/crates/hyperswitch_interfaces/src/api_client.rs
@@ -246,7 +246,7 @@ where
Some(request) => match request {
RequestContent::Json(i)
| RequestContent::FormUrlEncoded(i)
- | RequestContent::Xml(i) => i
+ | RequestContent::Xml(i, _) => i
.masked_serialize()
.unwrap_or(json!({ "error": "failed to mask serialize"})),
RequestContent::FormData((_, i)) => i
diff --git a/crates/router/src/core/webhooks/network_tokenization_incoming.rs b/crates/router/src/core/webhooks/network_tokenization_incoming.rs
index 9dbb5923eb..7ae7b442f8 100644
--- a/crates/router/src/core/webhooks/network_tokenization_incoming.rs
+++ b/crates/router/src/core/webhooks/network_tokenization_incoming.rs
@@ -129,7 +129,7 @@ impl NetworkTokenWebhookResponseExt for pm_types::PanMetadataUpdateBody {
platform: &domain::Platform,
) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let decrypted_data = self.decrypt_payment_method_data(payment_method)?;
- handle_metadata_update(
+ Box::pin(handle_metadata_update(
state,
&self.card,
payment_method
@@ -142,7 +142,7 @@ impl NetworkTokenWebhookResponseExt for pm_types::PanMetadataUpdateBody {
platform,
decrypted_data,
true,
- )
+ ))
.await
}
}
@@ -180,7 +180,7 @@ impl NetworkTokenWebhookResponseExt for pm_types::NetworkTokenMetaDataUpdateBody
platform: &domain::Platform,
) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let decrypted_data = self.decrypt_payment_method_data(payment_method)?;
- handle_metadata_update(
+ Box::pin(handle_metadata_update(
state,
&self.token,
payment_method
@@ -193,7 +193,7 @@ impl NetworkTokenWebhookResponseExt for pm_types::NetworkTokenMetaDataUpdateBody
platform,
decrypted_data,
true,
- )
+ ))
.await
}
}