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(core/connector): [SANTANDER] Return `paid_at` date in `connector_response_metadata` from PSync response (#13485)
Sayak Bhattacharya8437dfd853dd
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 71640e36e5..49a6dfed16 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -42535,6 +42535,14 @@"properties": {"end_to_end_id": {"type": "string",+ "example": "E9040088820260710172800044983797",+ "nullable": true+ },+ "paid_at": {+ "type": "string",+ "format": "date-time",+ "description": "Actual timestamp when the payment was completed, as reported by Santander.",+ "example": "2025-07-20T14:35:00Z","nullable": true}},diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 7093d570ed..435e1996ab 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -30546,6 +30546,14 @@"properties": {"end_to_end_id": {"type": "string",+ "example": "E9040088820260710172800044983797",+ "nullable": true+ },+ "paid_at": {+ "type": "string",+ "format": "date-time",+ "description": "Actual timestamp when the payment was completed, as reported by Santander.",+ "example": "2025-07-20T14:35:00Z","nullable": true}},diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 2fa85b3a06..091fad5350 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -10065,8 +10065,16 @@ pub enum ConnectorMetadataResponse {#[smithy(namespace = "com.hyperswitch.smithy.types")]#[serde(deny_unknown_fields)]pub struct SantanderData {+ #[schema(value_type = Option<String>, example = "E9040088820260710172800044983797")]#[serde(skip_serializing_if = "Option::is_none")]pub end_to_end_id: Option<String>,+ /// Actual timestamp when the payment was completed, as reported by Santander.+ #[schema(value_type = Option<PrimitiveDateTime>, example = "2025-07-20T14:35:00Z")]+ #[serde(+ skip_serializing_if = "Option::is_none",+ with = "common_utils::custom_serde::iso8601::option"+ )]+ pub paid_at: Option<PrimitiveDateTime>,}impl ConnectorMetadata {diff --git a/crates/hyperswitch_connectors/src/connectors/santander/responses.rs b/crates/hyperswitch_connectors/src/connectors/santander/responses.rsindex 3f3c15295a..0e68d222fa 100644--- a/crates/hyperswitch_connectors/src/connectors/santander/responses.rs+++ b/crates/hyperswitch_connectors/src/connectors/santander/responses.rs@@ -412,7 +412,8 @@ pub struct SantanderPix {// Transaction amountpub valor: String,// Timestamp when the transaction occurred- pub horario: String,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub horario: PrimitiveDateTime,// Optional information provided by the payerpub info_pagador: Option<String>,}@@ -465,7 +466,8 @@ pub struct SantanderCobrSyncPix {/// Value informationpub valor: serde_json::Value,/// Timestamp when the Pix was processed- pub horario: String,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub horario: PrimitiveDateTime,/// Optional payer info#[serde(skip_serializing_if = "Option::is_none")]pub info_pagador: Option<String>,@@ -898,7 +900,8 @@ pub struct SantanderPaymentDetails {pub deduction_value: Option<StringMajorUnit>,pub rebate_value: Option<StringMajorUnit>,pub iof_value: Option<StringMajorUnit>,- pub date: Option<String>,+ #[serde(with = "common_utils::custom_serde::iso8601::option")]+ pub date: Option<PrimitiveDateTime>,#[serde(rename = "type")]pub bank_type: Option<String>,pub bank_code: Option<String>,@@ -975,7 +978,8 @@ pub struct SantanderPixAutomaticoAtualizacao {/// Status of the recurrence at the time of updatepub status: Option<RecurrenceStatus>,/// Date when the status update occurred- pub data: String,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub data: PrimitiveDateTime,}#[derive(Debug, Clone, Serialize, Deserialize)]@@ -1291,7 +1295,8 @@ pub struct RecurrenceStatusUpdate {/// Status of the recurrencepub status: Option<RecurrenceStatus>,/// Date/time of this status update- pub data: String,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub data: PrimitiveDateTime,}#[derive(Debug, Clone, Serialize, Deserialize)]diff --git a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rsindex 55bfda3766..edad086ae9 100644--- a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs@@ -1352,6 +1352,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, SantanderPaymentsSyncResponse, T, Payme.map(|pix| {let data = SantanderData {end_to_end_id: Some(pix.end_to_end_id.clone().expose()),+ paid_at: (attempt_status == AttemptStatus::Charged)+ .then_some(pix.horario),};serde_json::to_value(data).change_context(errors::ConnectorError::ParsingFailed)@@ -1395,23 +1397,70 @@ impl<F, T> TryFrom<ResponseRouterData<F, SantanderPaymentsSyncResponse, T, Payme}// Journey 1/2SantanderPaymentsSyncResponse::PixAutomaticoConsultAndActivateJourney(res) => {- let status = AttemptStatus::from(res.status);- // TODO : Make a write on connector_metadata to modify the ExpiryType as it may chance after approval of Recurrence+ let status = AttemptStatus::from(res.status.clone());+ let connector_metadata = if matches!(res.status, RecurrenceStatus::Aprovada) {+ res.atualizacao+ .iter()+ .find(|update| matches!(update.status, Some(RecurrenceStatus::Aprovada)))+ .map(|update| {+ let data = SantanderData {+ end_to_end_id: None,+ paid_at: Some(update.data),+ };+ serde_json::to_value(data)+ .change_context(errors::ConnectorError::ParsingFailed)+ })+ .transpose()?+ } else {+ None+ };+ let mut response = item.data.response.clone();+ if let Ok(PaymentsResponseData::TransactionResponse {+ connector_metadata: ref mut cm,+ ..+ }) = response+ {+ *cm = connector_metadata;+ }Ok(Self {status,- response: item.data.response,+ response,..item.data})}SantanderPaymentsSyncResponse::Boleto(res) => {- let attempt_status = res- .content- .first()+ let content = res.content.first();+ let attempt_status = content.map(|data| AttemptStatus::from(data.status.clone())).unwrap_or(AttemptStatus::AuthenticationPending);+ let connector_metadata = content+ .filter(|_| {+ matches!(+ attempt_status,+ AttemptStatus::Charged | AttemptStatus::PartialChargedAndChargeable+ )+ })+ .map(|data| {+ let paid_at = data.payment.date;+ let data = SantanderData {+ end_to_end_id: None,+ paid_at,+ };+ serde_json::to_value(data)+ .change_context(errors::ConnectorError::ParsingFailed)+ })+ .transpose()?;+ let mut response = item.data.response.clone();+ if let Ok(PaymentsResponseData::TransactionResponse {+ connector_metadata: ref mut cm,+ ..+ }) = response+ {+ *cm = connector_metadata;+ }Ok(Self {status: attempt_status,- response: item.data.response,+ response,..item.data})}@@ -1425,6 +1474,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, SantanderPaymentsSyncResponse, T, Payme.map(|pix| {let data = SantanderData {end_to_end_id: Some(pix.end_to_end_id.clone().expose()),+ paid_at: (attempt_status == AttemptStatus::Charged)+ .then_some(pix.horario),};serde_json::to_value(data).change_context(errors::ConnectorError::ParsingFailed)