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(core/connector): [SANTANDER] Pix Automatico Fixes (#11701)

Sayak Bhattacharyab9ab125fc4e0
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 988615d84c..6b7fc33b1e 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -35535,7 +35535,7 @@
],
"nullable": true
},
- "exec_date": {
+ "mandate_execution_date": {
"type": "string",
"description": "Execution date for the mandate charge (maps to data_de_vencimento). Format: YYYY-MM-DD.\nIf not provided, defaults to current date + 1 day.",
"example": "2026-12-31",
@@ -39208,10 +39208,12 @@
"type": "object",
"properties": {
"amount": {
- "type": "string",
+ "type": "integer",
+ "format": "int64",
"description": "Maximum amount for each recurring charge",
- "example": "5.00",
- "nullable": true
+ "example": 6540,
+ "nullable": true,
+ "minimum": 0
},
"start_date": {
"type": "string",
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 5a5c1eca00..24426572fe 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -25747,7 +25747,7 @@
],
"nullable": true
},
- "exec_date": {
+ "mandate_execution_date": {
"type": "string",
"description": "Execution date for the mandate charge (maps to data_de_vencimento). Format: YYYY-MM-DD.\nIf not provided, defaults to current date + 1 day.",
"example": "2026-12-31",
@@ -28840,10 +28840,12 @@
"type": "object",
"properties": {
"amount": {
- "type": "string",
+ "type": "integer",
+ "format": "int64",
"description": "Maximum amount for each recurring charge",
- "example": "5.00",
- "nullable": true
+ "example": 6540,
+ "nullable": true,
+ "minimum": 0
},
"start_date": {
"type": "string",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 77a995c6e6..cf73daf56b 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -9945,6 +9945,47 @@ impl ConnectorMetadata {
})
})
}
+ pub fn get_mandatory_pix_automatico_maximum_permissible_mandate_amount(
+ self,
+ ) -> common_utils::errors::CustomResult<MinorUnit, ValidationError> {
+ let santander = self
+ .santander
+ .ok_or(ValidationError::MissingRequiredField {
+ field_name: "connector_metadata.santander".to_string(),
+ })?;
+
+ let pix_automatico =
+ santander
+ .pix_automatico
+ .ok_or(ValidationError::MissingRequiredField {
+ field_name: "connector_metadata.santander.pix_automatico".to_string(),
+ })?;
+
+ let cit_data = match pix_automatico {
+ SantanderPixAutomaticoData::Cit(cit) => cit,
+ SantanderPixAutomaticoData::Mit(_) => {
+ return Err(error_stack::report!(ValidationError::InvalidValue {
+ message: "Expected pix_automatico CIT variant, but got MIT".to_string(),
+ }))
+ }
+ };
+
+ let mandate_details =
+ cit_data
+ .mandate_details
+ .ok_or(ValidationError::MissingRequiredField {
+ field_name: "connector_metadata.santander.pix_automatico.cit.mandate_details"
+ .to_string(),
+ })?;
+
+ mandate_details.amount.ok_or(error_stack::report!(
+ ValidationError::MissingRequiredField {
+ field_name:
+ "connector_metadata.santander.pix_automatico.cit.mandate_details.amount"
+ .to_string(),
+ }
+ ))
+ }
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
@@ -13319,9 +13360,9 @@ pub struct SantanderPixAutomaticoReceiverDetails {
#[smithy(namespace = "com.hyperswitch.smithy.types")]
pub struct SantanderMandateDetails {
/// Maximum amount for each recurring charge
- #[schema(value_type = Option<String>, example = "5.00")]
- #[smithy(value_type = "Option<String>")]
- pub amount: Option<StringMajorUnit>,
+ #[schema(value_type = Option<u64>, example = 6540)]
+ #[smithy(value_type = "Option<MinorUnit>")]
+ pub amount: Option<MinorUnit>,
/// Start date for the recurring charges. Format: YYYY-MM-DD. If not provided, the mandate will be valid immediately.
#[schema(value_type = Option<String>, example="2026-12-31")]
#[serde(default, with = "common_utils::custom_serde::date_only_optional")]
@@ -13397,7 +13438,7 @@ pub struct PixAutomaticoMitData {
/// If not provided, defaults to current date + 1 day.
#[schema(value_type = Option<String>, example = "2026-12-31")]
#[serde(default, with = "common_utils::custom_serde::date_only_optional")]
- pub exec_date: Option<PrimitiveDateTime>,
+ pub mandate_execution_date: Option<PrimitiveDateTime>,
/// Whether to automatically adjust the due date to the next business day if it falls on a non-business day.
/// Maps to ajuste_dia_util in Santander API. Defaults to true if not provided.
#[smithy(value_type = "Option<bool>")]
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 8fb9ab440e..76bb6afaff 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -7164,18 +7164,6 @@ placeholder="Enter the merchant name"
required=true
type="Text"
-[[santander.metadata.pix_automatico_push]]
-name="client_id"
-label="Client ID"
-placeholder="Enter your Client Id"
-required=true
-type="Text"
-[[santander.metadata.pix_automatico_push]]
-name="client_secret"
-label="Client Secret"
-placeholder="Enter your Client Secret"
-required=true
-type="Text"
[[santander.metadata.pix_automatico_push]]
name="pix_key_type"
label="Chave Key Type"
@@ -7189,19 +7177,19 @@ label="Chave Key"
placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
-
-[[santander.metadata.pix_automatico_qr]]
+[[santander.metadata.pix_automatico_push]]
name="client_id"
label="Client ID"
placeholder="Enter your Client Id"
required=true
type="Text"
-[[santander.metadata.pix_automatico_qr]]
+[[santander.metadata.pix_automatico_push]]
name="client_secret"
label="Client Secret"
placeholder="Enter your Client Secret"
required=true
type="Text"
+
[[santander.metadata.pix_automatico_qr]]
name="pix_key_type"
label="Chave Key Type"
@@ -7215,6 +7203,18 @@ label="Chave Key"
placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
+[[santander.metadata.pix_automatico_qr]]
+name="client_id"
+label="Client ID"
+placeholder="Enter your Client Id"
+required=true
+type="Text"
+[[santander.metadata.pix_automatico_qr]]
+name="client_secret"
+label="Client Secret"
+placeholder="Enter your Client Secret"
+required=true
+type="Text"
[[santander.metadata.boleto]]
name="client_id"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index d109cd8847..95b2e6637a 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -6179,18 +6179,6 @@ placeholder="Enter the merchant name"
required=true
type="Text"
-[[santander.metadata.pix_automatico_push]]
-name="client_id"
-label="Client ID"
-placeholder="Enter your Client Id"
-required=true
-type="Text"
-[[santander.metadata.pix_automatico_push]]
-name="client_secret"
-label="Client Secret"
-placeholder="Enter your Client Secret"
-required=true
-type="Text"
[[santander.metadata.pix_automatico_push]]
name="pix_key_type"
label="Chave Key Type"
@@ -6204,19 +6192,19 @@ label="Chave Key"
placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
-
-[[santander.metadata.pix_automatico_qr]]
+[[santander.metadata.pix_automatico_push]]
name="client_id"
label="Client ID"
placeholder="Enter your Client Id"
required=true
type="Text"
-[[santander.metadata.pix_automatico_qr]]
+[[santander.metadata.pix_automatico_push]]
name="client_secret"
label="Client Secret"
placeholder="Enter your Client Secret"
required=true
type="Text"
+
[[santander.metadata.pix_automatico_qr]]
name="pix_key_type"
label="Chave Key Type"
@@ -6230,6 +6218,18 @@ label="Chave Key"
placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
+[[santander.metadata.pix_automatico_qr]]
+name="client_id"
+label="Client ID"
+placeholder="Enter your Client Id"
+required=true
+type="Text"
+[[santander.metadata.pix_automatico_qr]]
+name="client_secret"
+label="Client Secret"
+placeholder="Enter your Client Secret"
+required=true
+type="Text"
[[santander.metadata.boleto]]
name="client_id"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 8c85137c88..015325532d 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -7141,18 +7141,6 @@ placeholder="Enter the merchant name"
required=true
type="Text"
-[[santander.metadata.pix_automatico_push]]
-name="client_id"
-label="Client ID"
-placeholder="Enter your Client Id"
-required=true
-type="Text"
-[[santander.metadata.pix_automatico_push]]
-name="client_secret"
-label="Client Secret"
-placeholder="Enter your Client Secret"
-required=true
-type="Text"
[[santander.metadata.pix_automatico_push]]
name="pix_key_type"
label="Chave Key Type"
@@ -7166,19 +7154,19 @@ label="Chave Key"
placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
-
-[[santander.metadata.pix_automatico_qr]]
+[[santander.metadata.pix_automatico_push]]
name="client_id"
label="Client ID"
placeholder="Enter your Client Id"
required=true
type="Text"
-[[santander.metadata.pix_automatico_qr]]
+[[santander.metadata.pix_automatico_push]]
name="client_secret"
label="Client Secret"
placeholder="Enter your Client Secret"
required=true
type="Text"
+
[[santander.metadata.pix_automatico_qr]]
name="pix_key_type"
label="Chave Key Type"
@@ -7192,6 +7180,18 @@ label="Chave Key"
placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
+[[santander.metadata.pix_automatico_qr]]
+name="client_id"
+label="Client ID"
+placeholder="Enter your Client Id"
+required=true
+type="Text"
+[[santander.metadata.pix_automatico_qr]]
+name="client_secret"
+label="Client Secret"
+placeholder="Enter your Client Secret"
+required=true
+type="Text"
[[santander.metadata.boleto]]
name="client_id"
diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs
index f6cb6596a6..4ba855c8d7 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander.rs
@@ -754,8 +754,31 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
req.request.minor_amount,
req.request.currency,
)?;
-
- let connector_router_data = SantanderRouterData::from((amount, req));
+ let rec_amount_in_minor = req
+ .request
+ .connector_intent_metadata
+ .clone()
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "connector_intent_metadata",
+ })?
+ .get_mandatory_pix_automatico_maximum_permissible_mandate_amount()
+ .change_context(errors::ConnectorError::MissingRequiredField {
+ field_name:
+ "connector_metadata.santander.pix_automatico.cit.mandate_details.amount",
+ })?;
+ let rec_amount = convert_amount(
+ self.amount_converter,
+ rec_amount_in_minor,
+ req.request.currency,
+ )?;
+ let final_amount = if req.request.minor_amount.get_amount_as_i64()
+ < rec_amount_in_minor.get_amount_as_i64()
+ {
+ rec_amount
+ } else {
+ amount
+ };
+ let connector_router_data = SantanderRouterData::from((final_amount, req));
let connector_req = SantanderSetupMandateRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/santander/requests.rs b/crates/hyperswitch_connectors/src/connectors/santander/requests.rs
index 07e204d9df..62f69c99af 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander/requests.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander/requests.rs
@@ -200,7 +200,7 @@ pub struct SantanderPixAutomaticDestinationRequest {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticSolicitationRequest {
- pub id_rec: String,
+ pub id_rec: Secret<String>,
pub calendario: SantanderPixAutomaticCalendarRequest,
pub destinatario: SantanderPixAutomaticDestinationRequest,
}
@@ -550,7 +550,7 @@ pub struct SantanderPixAutomaticoCobrValor {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticoCobrRequest {
/// Recurring charge ID - must be 29 alphanumeric characters (RR + 27 chars)
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Additional information about the charge
#[serde(skip_serializing_if = "Option::is_none")]
pub info_adicional: Option<String>,
diff --git a/crates/hyperswitch_connectors/src/connectors/santander/responses.rs b/crates/hyperswitch_connectors/src/connectors/santander/responses.rs
index b4d169a73d..aede089785 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander/responses.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander/responses.rs
@@ -139,7 +139,7 @@ pub struct SantanderPixQRCodePaymentsResponse {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticoCobrResponse {
/// Recurring charge ID
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Transaction ID
pub txid: String,
/// Additional information
@@ -411,7 +411,7 @@ pub struct SantanderPix {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticoCobrSyncResponse {
/// Recurring charge ID (idRec)
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Transaction ID
pub txid: String,
/// Additional information
@@ -901,9 +901,9 @@ pub enum SantanderBoletoStatus {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticSolicitationResponse {
/// Unique identifier for the recurrence solicitation request
- pub id_solic_rec: String,
+ pub id_solic_rec: Secret<String>,
/// Unique identifier for the recurrence
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Calendar information for the recurrence (expiration, start, end, frequency)
pub calendario: SantanderPixAutomaticoCalendario,
/// Recipient/Destination information for the recurrence
@@ -957,7 +957,7 @@ pub struct SantanderPixAutomaticoAtualizacao {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticoRecPayload {
/// Unique identifier for the recurrence
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Link/relationship information between debtor and creditor
pub vinculo: SantanderPixAutomaticoVinculo,
/// Calendar information for the recurrence
@@ -1009,7 +1009,7 @@ pub struct SantanderPixAutomaticoRecebedor {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticRecResponse {
/// Unique identifier for the recurrence
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Link/relationship information between debtor and creditor
pub vinculo: SantanderPixAutomaticoVinculo,
/// Calendar information for the recurrence
@@ -1176,7 +1176,7 @@ pub struct SantanderPixAutomaticoValor {
#[serde(rename_all = "camelCase")]
pub struct SantanderSetupMandateResponse {
/// Recurrence ID
- pub id_rec: String,
+ pub id_rec: Secret<String>,
/// Information about the recurring object/service
pub vinculo: RecurrenceLinkResponse,
/// Calendar information for the recurrence
@@ -1256,7 +1256,7 @@ pub struct LocationResponse {
/// Creation timestamp
pub criacao: String,
/// Recurrence ID
- pub id_rec: String,
+ pub id_rec: Secret<String>,
}
/// Status update history entry for the recurrence
diff --git a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
index 778a7e8739..a53bb885ae 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
@@ -159,12 +159,12 @@ impl
.unwrap_or(AttemptStatus::Pending);
let resource_id =
ResponseId::ConnectorTransactionId(item.data.connector_request_reference_id.clone());
- let connector_response_reference_id = Some(item.response.id_rec.clone());
+ let connector_response_reference_id = Some(item.response.id_rec.clone().expose());
let mandate_reference = Some(MandateReference {
- connector_mandate_id: Some(item.response.id_rec.clone()),
+ connector_mandate_id: Some(item.response.id_rec.clone().expose()),
payment_method_id: None,
mandate_metadata: None,
- connector_mandate_request_reference_id: Some(item.response.id_solic_rec),
+ connector_mandate_request_reference_id: Some(item.response.id_solic_rec.expose()),
});
Ok(Self {
@@ -225,14 +225,14 @@ impl
None => None,
};
let mandate_reference = Box::new(Some(MandateReference {
- connector_mandate_id: Some(item.response.id_rec.clone()),
+ connector_mandate_id: Some(item.response.id_rec.clone().expose()),
payment_method_id: None,
mandate_metadata: None,
connector_mandate_request_reference_id: None,
}));
let resource_id =
ResponseId::ConnectorTransactionId(item.data.connector_request_reference_id.clone());
- let connector_response_reference_id = Some(item.response.id_rec.clone());
+ let connector_response_reference_id = Some(item.response.id_rec.clone().expose());
Ok(Self {
status,
@@ -782,9 +782,30 @@ impl
let santander_mca_metadata =
SantanderMetadataObject::try_from(&value.0.router_data.connector_meta_data)?;
- let pix_mca_metadata = santander_mca_metadata
- .pix
- .ok_or(errors::ConnectorError::NoConnectorMetaData)?;
+ let mca_chave = match value.0.router_data.payment_method_type {
+ Some(enums::PaymentMethodType::Pix) => Some(
+ santander_mca_metadata
+ .pix
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)
+ .attach_printable("Failed to get pix mca metadata")?
+ .pix_key_value,
+ ),
+ Some(enums::PaymentMethodType::PixAutomaticoPush) => Some(
+ santander_mca_metadata
+ .pix_automatico_push
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)
+ .attach_printable("Failed to get pix automatico push mca metadata")?
+ .pix_key_value,
+ ),
+ Some(enums::PaymentMethodType::PixAutomaticoQr) => Some(
+ santander_mca_metadata
+ .pix_automatico_qr
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)
+ .attach_printable("Failed to get pix automatico qr mca metadata")?
+ .pix_key_value,
+ ),
+ _ => None,
+ };
let customer_document_details = value
.0
@@ -890,7 +911,7 @@ impl
.feature_metadata
.clone()
.and_then(|data| data.get_pix_key_and_value().1)
- .or(Some(pix_mca_metadata.pix_key_value.clone()));
+ .or(mca_chave);
Ok(Self::PixQR(Box::new(SantanderPixQRPaymentRequest {
calendario: calendar,
@@ -973,8 +994,8 @@ impl TryFrom<&SantanderRouterData<&PaymentsAuthorizeRouterData>>
let id_rec = value.router_data.request.get_connector_mandate_id()?;
- // Use exec_date from MIT data if provided, otherwise default to current date + 1 day
- let due_date = match mit_data.exec_date {
+ // Use mandate_execution_date from MIT data if provided, otherwise default to current date + 1 day
+ let due_date = match mit_data.mandate_execution_date {
Some(exec_date) => format_as_date_only(Some(exec_date))?,
None => time::OffsetDateTime::now_utc()
.checked_add(time::Duration::days(1))
@@ -1014,7 +1035,7 @@ impl TryFrom<&SantanderRouterData<&PaymentsAuthorizeRouterData>>
});
Ok(Self {
- id_rec,
+ id_rec: id_rec.into(),
info_adicional,
calendario,
valor,
@@ -1263,7 +1284,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, SantanderPaymentsSyncResponse, T, Payme
mandate_reference: Box::new(None),
connector_metadata,
network_txn_id: None,
- connector_response_reference_id: Some(cobr_data.id_rec.clone()),
+ connector_response_reference_id: Some(cobr_data.id_rec.expose()),
incremental_authorization_allowed: None,
authentication_data: None,
charges: None,
@@ -1338,21 +1359,35 @@ impl<F, T> TryFrom<ResponseRouterData<F, SantanderPaymentsResponse, T, PaymentsR
..item.data
})
}
- _ => Ok(Self {
- status: AttemptStatus::from(pix_data.status.clone()),
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(pix_data.txid.clone()),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: get_qr_code_data(&item, &pix_data)?,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- authentication_data: None,
- charges: None,
- }),
- ..item.data
- }),
+ _ => {
+ let is_pmt_automatico = matches!(
+ item.data.payment_method_type,
+ Some(enums::PaymentMethodType::PixAutomaticoQr)
+ | Some(enums::PaymentMethodType::PixAutomaticoPush)
+ );
+ let connector_metadata = if !is_pmt_automatico {
+ get_qr_code_data(&item, &pix_data)?
+ } else {
+ None
+ };
+ Ok(Self {
+ status: AttemptStatus::from(pix_data.status.clone()),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ pix_data.txid.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ authentication_data: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
}
}
SantanderPaymentsResponse::Boleto(boleto_data) => {
@@ -1412,14 +1447,14 @@ impl<F, T> TryFrom<ResponseRouterData<F, SantanderPaymentsResponse, T, PaymentsR
resource_id: ResponseId::ConnectorTransactionId(cobr_data.txid.clone()),
redirection_data: Box::new(None),
mandate_reference: Box::new(Some(MandateReference {
- connector_mandate_id: Some(cobr_data.id_rec.clone()),
+ connector_mandate_id: Some(cobr_data.id_rec.clone().expose()),
payment_method_id: None,
mandate_metadata: None,
connector_mandate_request_reference_id: Some(cobr_data.txid.clone()),
})),
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: Some(cobr_data.id_rec.clone()),
+ connector_response_reference_id: Some(cobr_data.id_rec.clone().expose()),
incremental_authorization_allowed: None,
authentication_data: None,
charges: None,
@@ -2162,9 +2197,7 @@ impl
// either of valor or valor_minimo_recebedor can be passed at one time
let valor = Some(RecurrenceValue {
- valor_rec: mandate_details
- .and_then(|md| md.amount.clone())
- .or_else(|| Some(value.amount.clone())),
+ valor_rec: Some(value.amount.clone()),
valor_minimo_recebedor: None,
});
@@ -2242,6 +2275,12 @@ impl<F>
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
+ if !matches!(router_env::env::which(), router_env::env::Env::Production) {
+ router_env::logger::info!(
+ "Santander Recurrence Id: {:?}",
+ item.response.id_rec.clone().expose()
+ );
+ }
Ok(Self {
status: AttemptStatus::from(item.response.status.clone()),
response: Ok(PaymentsResponseData::TransactionResponse {
@@ -2250,7 +2289,7 @@ impl<F>
),
redirection_data: Box::new(None),
mandate_reference: Box::new(Some(MandateReference {
- connector_mandate_id: Some(item.response.id_rec.clone()),
+ connector_mandate_id: Some(item.response.id_rec.expose()),
payment_method_id: None,
mandate_metadata: None,
connector_mandate_request_reference_id: None,
@@ -2360,7 +2399,8 @@ impl TryFrom<&PaymentsPushNotificationRouterData> for SantanderPixAutomaticSolic
id_rec: item
.request
.get_connector_mandate_id()
- .ok_or(errors::ConnectorError::MissingConnectorMandateID)?,
+ .ok_or(errors::ConnectorError::MissingConnectorMandateID)?
+ .into(),
calendario: SantanderPixAutomaticCalendarRequest {
data_expiracao_solicitacao,
},
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 35b1f8ba15..dc3221562f 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -2422,27 +2422,44 @@ where
should_continue_further,
payment_data.get_payment_intent().payment_id,
);
- Box::pin(payments::payments_operation_core::<
- api_types::SetupMandate,
- _,
- _,
- _,
- payments::PaymentData<api_types::SetupMandate>,
- >(
- &state,
- req_state,
- &platform,
- profile_id,
- PaymentRecurrence,
- req,
- payments::CallConnectorAction::Trigger,
- None,
+ let (pd, _req, connector_status_code, ext_latency) =
+ Box::pin(payments::payments_operation_core::<
+ api_types::SetupMandate,
+ _,
+ _,
+ _,
+ payments::PaymentData<api_types::SetupMandate>,
+ >(
+ &state,
+ req_state,
+ &platform,
+ profile_id,
+ PaymentRecurrence,
+ req,
+ payments::CallConnectorAction::Trigger,
+ None,
+ auth_flow,
+ eligible_routable_connectors,
+ header_payload.clone(),
+ dimensions,
+ ))
+ .await?;
+ let total_ext_latency = match (external_latency, ext_latency) {
+ (Some(l1), Some(l2)) => Some(l1 + l2),
+ (Some(l), None) | (None, Some(l)) => Some(l),
+ (None, None) => None,
+ };
+ return payment_types::PaymentsResponse::generate_response(
+ pd,
auth_flow,
- eligible_routable_connectors,
- header_payload.clone(),
- dimensions,
- ))
- .await?;
+ &state.base_url,
+ operation,
+ &state.conf.connector_request_reference_id_config,
+ connector_status_code,
+ total_ext_latency,
+ header_payload.x_hs_latency,
+ &platform,
+ );
}
}