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
fix(connector): [Payshield] Use payment attempt creation time for FRM requests (#14190)
Saptak Duttac1cb0edb8cbe
diff --git a/crates/hyperswitch_connectors/src/connectors/absa_sanlam.rs b/crates/hyperswitch_connectors/src/connectors/absa_sanlam.rsindex c2567e8c9f..0436cec3d4 100644--- a/crates/hyperswitch_connectors/src/connectors/absa_sanlam.rs+++ b/crates/hyperswitch_connectors/src/connectors/absa_sanlam.rs@@ -443,6 +443,7 @@ impl ConnectorSpecifications for AbsaSanlam {.merchant_connector_id.as_ref().map(|id| id.get_string_repr().to_owned()),+ created_at: payment_attempt.created_at,};serde_json::to_value(metadata).change_context(errors::ConnectorError::RequestEncodingFailed)diff --git a/crates/hyperswitch_connectors/src/connectors/absa_sanlam/transformers.rs b/crates/hyperswitch_connectors/src/connectors/absa_sanlam/transformers.rsindex f2b0b5c110..c00e96b2b4 100644--- a/crates/hyperswitch_connectors/src/connectors/absa_sanlam/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/absa_sanlam/transformers.rs@@ -16,6 +16,7 @@ use crate::{types::ResponseRouterData, utils};pub struct AbsaSanlamFrmMetadata {pub profile_id: String,pub connector_id: Option<String>,+ pub created_at: time::PrimitiveDateTime,}pub struct AbsaSanlamAuthType {diff --git a/crates/hyperswitch_connectors/src/connectors/sanlam_payshield/transformers.rs b/crates/hyperswitch_connectors/src/connectors/sanlam_payshield/transformers.rsindex 2b70347c6b..32e1688d33 100644--- a/crates/hyperswitch_connectors/src/connectors/sanlam_payshield/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/sanlam_payshield/transformers.rs@@ -36,6 +36,7 @@ impl TryFrom<&ConnectorAuthType> for SanlamPayshieldAuthType {pub struct SanlamPayshieldFrmMetadata {pub profile_id: String,pub connector_id: Option<String>,+ pub created_at: time::PrimitiveDateTime,}#[derive(Debug, Serialize)]@@ -79,6 +80,7 @@ impl TryFrom<&FrmCheckoutRouterData> for SanlamPayshieldCheckoutRequest {let SanlamPayshieldFrmMetadata {profile_id,connector_id,+ created_at,} = data.request.gateway_metadata@@ -111,6 +113,14 @@ impl TryFrom<&FrmCheckoutRouterData> for SanlamPayshieldCheckoutRequest {)),}?;+ let created_at = created_at+ .assume_utc()+ .to_offset(time::macros::offset!(+2))+ .format(time::macros::format_description!(+ "[year]-[month]-[day]T[hour]:[minute]:[second][offset_hour sign:mandatory]:[offset_minute]"+ ))+ .change_context(ConnectorError::RequestEncodingFailed)?;+Ok(Self {request_id: data.connector_request_reference_id.clone(),profile_id,@@ -121,26 +131,13 @@ impl TryFrom<&FrmCheckoutRouterData> for SanlamPayshieldCheckoutRequest {amount_in_cents: data.request.amount.to_string(),currency: currency.to_string(),payment_method_type,- created_at: get_current_time()?,+ created_at,},metadata: data.frm_metadata.clone(),})}}-fn get_current_time() -> Result<String, error_stack::Report<ConnectorError>> {- let format = time::macros::format_description!(- "[year]-[month]-[day]T[hour]:[minute]:[second][offset_hour sign:mandatory]:[offset_minute]"- );-- let time = time::OffsetDateTime::now_utc()- .to_offset(time::macros::offset!(+2))- .format(&format)- .change_context(ConnectorError::RequestEncodingFailed)?;-- Ok(time)-}-#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct SanlamPayshieldCheckoutResponse {