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

feat(connector): [SANTANDER] Accept Receiver Account Details from Merchant (#12185)

Sayak Bhattacharyae8a299a7335a
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 4e467f80b8..9a4f3b2722 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -36557,7 +36557,7 @@
{
"allOf": [
{
- "$ref": "#/components/schemas/PixAutomaticoPushDetails"
+ "$ref": "#/components/schemas/PixAutomaticoPushData"
},
{
"type": "object",
@@ -36574,36 +36574,53 @@
}
}
]
- }
- ],
- "discriminator": {
- "propertyName": "type"
- }
- },
- "PixAutomaticoCitData": {
- "type": "object",
- "description": "Data for Santander Pix Automatico CIT (Customer Initiated Transaction) - used during mandate setup",
- "properties": {
- "contract_id": {
- "type": "string",
- "description": "Contract ID to identify the recurring payment contract",
- "example": "pm_16503867",
- "nullable": true
},
- "retry_policy": {
- "type": "boolean",
- "description": "Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)",
- "example": true,
- "nullable": true
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PixAutomaticoQrData"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "pix_automatico_qr"
+ ]
+ }
+ }
+ }
+ ]
},
- "mandate_details": {
+ {
"allOf": [
{
- "$ref": "#/components/schemas/SantanderMandateDetails"
+ "$ref": "#/components/schemas/PixAutomaticoMitData"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "pix_automatico_mit"
+ ]
+ }
+ }
}
- ],
- "nullable": true
+ ]
}
+ ],
+ "description": "Represents the specific data for Santander Pix Automatico (recurring PIX payments)\nSplit into CIT (Customer Initiated Transaction) and MIT (Merchant Initiated Transaction) variants",
+ "discriminator": {
+ "propertyName": "type"
}
},
"PixAutomaticoMitData": {
@@ -36655,8 +36672,9 @@
}
}
},
- "PixAutomaticoPushDetails": {
+ "PixAutomaticoPushData": {
"type": "object",
+ "description": "Data for PixAutomaticoPush Payment Method Type CIT (Customer Initiated Transaction) - used during mandate setup",
"required": [
"time"
],
@@ -36667,6 +36685,40 @@
"description": "Time in seconds until which the push notification is valid",
"example": 3600,
"minimum": 0
+ },
+ "retry_policy": {
+ "type": "boolean",
+ "description": "Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)",
+ "example": true,
+ "nullable": true
+ },
+ "mandate_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SantanderMandateDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
+ "PixAutomaticoQrData": {
+ "type": "object",
+ "description": "Data for PixAutomaticoQr Payment Method Type CIT (Customer Initiated Transaction) - used during mandate setup + non 0$ mandate setup",
+ "properties": {
+ "retry_policy": {
+ "type": "boolean",
+ "description": "Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)",
+ "example": true,
+ "nullable": true
+ },
+ "mandate_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SantanderMandateDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -40397,14 +40449,6 @@
}
],
"nullable": true
- },
- "pix_automatico": {
- "allOf": [
- {
- "$ref": "#/components/schemas/SantanderPixAutomaticoData"
- }
- ],
- "nullable": true
}
}
},
@@ -40421,10 +40465,18 @@
"SantanderMandateDetails": {
"type": "object",
"properties": {
- "amount": {
+ "fixed_recurring_amount": {
"type": "integer",
"format": "int64",
- "description": "Maximum amount for each recurring charge",
+ "description": "Fixed amount for each recurring charge in minor units (e.g., cents). If not provided, the mandate will allow variable amounts.",
+ "example": 6540,
+ "nullable": true,
+ "minimum": 0
+ },
+ "min_recurring_amount": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Minimum amount for each recurring charge in minor units (e.g., cents). If not provided, there will be no minimum limit on the amount.",
"example": 6540,
"nullable": true,
"minimum": 0
@@ -40485,33 +40537,6 @@
}
}
},
- "SantanderPixAutomaticoData": {
- "oneOf": [
- {
- "type": "object",
- "required": [
- "cit"
- ],
- "properties": {
- "cit": {
- "$ref": "#/components/schemas/PixAutomaticoCitData"
- }
- }
- },
- {
- "type": "object",
- "required": [
- "mit"
- ],
- "properties": {
- "mit": {
- "$ref": "#/components/schemas/PixAutomaticoMitData"
- }
- }
- }
- ],
- "description": "Represents the specific data for Santander Pix Automatico (recurring PIX payments)\nSplit into CIT (Customer Initiated Transaction) and MIT (Merchant Initiated Transaction) variants"
- },
"SantanderPixAutomaticoReceiverDetails": {
"type": "object",
"description": "Represents the receiver details for Santander Pix Automatico recurring charges",
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 4692c5bd40..3875e02af6 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -26461,7 +26461,7 @@
{
"allOf": [
{
- "$ref": "#/components/schemas/PixAutomaticoPushDetails"
+ "$ref": "#/components/schemas/PixAutomaticoPushData"
},
{
"type": "object",
@@ -26478,36 +26478,53 @@
}
}
]
- }
- ],
- "discriminator": {
- "propertyName": "type"
- }
- },
- "PixAutomaticoCitData": {
- "type": "object",
- "description": "Data for Santander Pix Automatico CIT (Customer Initiated Transaction) - used during mandate setup",
- "properties": {
- "contract_id": {
- "type": "string",
- "description": "Contract ID to identify the recurring payment contract",
- "example": "pm_16503867",
- "nullable": true
},
- "retry_policy": {
- "type": "boolean",
- "description": "Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)",
- "example": true,
- "nullable": true
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PixAutomaticoQrData"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "pix_automatico_qr"
+ ]
+ }
+ }
+ }
+ ]
},
- "mandate_details": {
+ {
"allOf": [
{
- "$ref": "#/components/schemas/SantanderMandateDetails"
+ "$ref": "#/components/schemas/PixAutomaticoMitData"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "pix_automatico_mit"
+ ]
+ }
+ }
}
- ],
- "nullable": true
+ ]
}
+ ],
+ "description": "Represents the specific data for Santander Pix Automatico (recurring PIX payments)\nSplit into CIT (Customer Initiated Transaction) and MIT (Merchant Initiated Transaction) variants",
+ "discriminator": {
+ "propertyName": "type"
}
},
"PixAutomaticoMitData": {
@@ -26559,8 +26576,9 @@
}
}
},
- "PixAutomaticoPushDetails": {
+ "PixAutomaticoPushData": {
"type": "object",
+ "description": "Data for PixAutomaticoPush Payment Method Type CIT (Customer Initiated Transaction) - used during mandate setup",
"required": [
"time"
],
@@ -26571,6 +26589,40 @@
"description": "Time in seconds until which the push notification is valid",
"example": 3600,
"minimum": 0
+ },
+ "retry_policy": {
+ "type": "boolean",
+ "description": "Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)",
+ "example": true,
+ "nullable": true
+ },
+ "mandate_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SantanderMandateDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
+ "PixAutomaticoQrData": {
+ "type": "object",
+ "description": "Data for PixAutomaticoQr Payment Method Type CIT (Customer Initiated Transaction) - used during mandate setup + non 0$ mandate setup",
+ "properties": {
+ "retry_policy": {
+ "type": "boolean",
+ "description": "Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)",
+ "example": true,
+ "nullable": true
+ },
+ "mandate_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SantanderMandateDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -29656,14 +29708,6 @@
}
],
"nullable": true
- },
- "pix_automatico": {
- "allOf": [
- {
- "$ref": "#/components/schemas/SantanderPixAutomaticoData"
- }
- ],
- "nullable": true
}
}
},
@@ -29680,10 +29724,18 @@
"SantanderMandateDetails": {
"type": "object",
"properties": {
- "amount": {
+ "fixed_recurring_amount": {
"type": "integer",
"format": "int64",
- "description": "Maximum amount for each recurring charge",
+ "description": "Fixed amount for each recurring charge in minor units (e.g., cents). If not provided, the mandate will allow variable amounts.",
+ "example": 6540,
+ "nullable": true,
+ "minimum": 0
+ },
+ "min_recurring_amount": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Minimum amount for each recurring charge in minor units (e.g., cents). If not provided, there will be no minimum limit on the amount.",
"example": 6540,
"nullable": true,
"minimum": 0
@@ -29744,33 +29796,6 @@
}
}
},
- "SantanderPixAutomaticoData": {
- "oneOf": [
- {
- "type": "object",
- "required": [
- "cit"
- ],
- "properties": {
- "cit": {
- "$ref": "#/components/schemas/PixAutomaticoCitData"
- }
- }
- },
- {
- "type": "object",
- "required": [
- "mit"
- ],
- "properties": {
- "mit": {
- "$ref": "#/components/schemas/PixAutomaticoMitData"
- }
- }
- }
- ],
- "description": "Represents the specific data for Santander Pix Automatico (recurring PIX payments)\nSplit into CIT (Customer Initiated Transaction) and MIT (Merchant Initiated Transaction) variants"
- },
"SantanderPixAutomaticoReceiverDetails": {
"type": "object",
"description": "Represents the receiver details for Santander Pix Automatico recurring charges",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 55c6e054f2..94dc81a463 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -6929,7 +6929,7 @@ pub struct PollConfigResponse {
pub enum QrCodeInformation {
QrCodeUrl {
image_data_url: Url,
- qr_code_url: Url,
+ qr_code_url: Option<Url>,
display_to_timestamp: Option<i64>,
expiry_type: Option<common_enums::enums::ExpiryType>,
raw_qr_data: Option<String>,
@@ -10041,47 +10041,6 @@ 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)]
@@ -11547,12 +11506,78 @@ impl FeatureMetadata {
})
.and_then(|details| match details {
PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => Ok(push.time),
- _ => Err(ValidationError::InvalidValue {
- message: "pix_automatico_additional_details is not of type PixAutomaticoPush"
- .to_string(),
- }),
+ PixAutomaticoAdditionalDetails::PixAutomaticoQr(_) => {
+ Err(ValidationError::InvalidValue {
+ message: "Expected PixAutomaticoPush, found PixAutomaticoQr".to_string(),
+ })
+ }
+ PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
+ Err(ValidationError::InvalidValue {
+ message: "Expected CIT flow (PixAutomaticoPush), found MIT flow"
+ .to_string(),
+ })
+ }
})
}
+
+ /// Gets the optional fixed recurring mandate amount for Pix Automatico CIT flow
+ pub fn get_optional_fixed_recurring_mit_amount_for_pix_automatico(
+ &self,
+ ) -> common_utils::errors::CustomResult<Option<MinorUnit>, ValidationError> {
+ let pix_automatico = self.pix_automatico_additional_details.as_ref().ok_or(
+ ValidationError::MissingRequiredField {
+ field_name: "feature_metadata.pix_automatico_additional_details".to_string(),
+ },
+ )?;
+
+ let mandate_details = match pix_automatico {
+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => {
+ push.mandate_details.as_ref()
+ }
+ PixAutomaticoAdditionalDetails::PixAutomaticoQr(qr) => qr.mandate_details.as_ref(),
+ PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
+ return Err(error_stack::report!(ValidationError::InvalidValue {
+ message: "Expected CIT flow, found MIT flow".to_string(),
+ }))
+ }
+ };
+
+ let mandate_details = mandate_details.ok_or(ValidationError::MissingRequiredField {
+ field_name: "mandate_details".to_string(),
+ })?;
+
+ Ok(mandate_details.fixed_recurring_amount)
+ }
+
+ /// Gets the optional minimum recurring mandate amount for Pix Automatico CIT flow
+ pub fn get_optional_min_recurring_amount_for_pix_automatico(
+ &self,
+ ) -> common_utils::errors::CustomResult<Option<MinorUnit>, ValidationError> {
+ let pix_automatico = self.pix_automatico_additional_details.as_ref().ok_or(
+ ValidationError::MissingRequiredField {
+ field_name: "feature_metadata.pix_automatico_additional_details".to_string(),
+ },
+ )?;
+
+ let mandate_details = match pix_automatico {
+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => {
+ push.mandate_details.as_ref()
+ }
+ PixAutomaticoAdditionalDetails::PixAutomaticoQr(qr) => qr.mandate_details.as_ref(),
+ PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
+ return Err(error_stack::report!(ValidationError::InvalidValue {
+ message: "Expected CIT flow, found MIT flow".to_string(),
+ }))
+ }
+ };
+
+ let mandate_details = mandate_details.ok_or(ValidationError::MissingRequiredField {
+ field_name: "mandate_details".to_string(),
+ })?;
+
+ Ok(mandate_details.min_recurring_amount)
+ }
+
pub fn set_payment_revenue_recovery_metadata_using_api(
self,
payment_revenue_recovery_metadata: PaymentRevenueRecoveryMetadata,
@@ -11637,6 +11662,7 @@ pub struct FeatureMetadata {
#[smithy(value_type = "Option<FinixAdditionalDetails>")]
pub finix_additional_details: Option<FinixAdditionalDetails>,
}
+
#[cfg(feature = "v1")]
impl FeatureMetadata {
/// Helper to extract the optional covenant_code from boleto details
@@ -11652,8 +11678,19 @@ impl FeatureMetadata {
.ok_or(ValidationError::MissingRequiredField {
field_name: "feature_metadata.pix_automatico_additional_details".to_string(),
})
- .map(|details| match details {
- PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => push.time,
+ .and_then(|details| match details {
+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => Ok(push.time),
+ PixAutomaticoAdditionalDetails::PixAutomaticoQr(_) => {
+ Err(ValidationError::InvalidValue {
+ message: "Expected PixAutomaticoPush, found PixAutomaticoQr".to_string(),
+ })
+ }
+ PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
+ Err(ValidationError::InvalidValue {
+ message: "Expected CIT flow (PixAutomaticoPush), found MIT flow"
+ .to_string(),
+ })
+ }
})
}
pub fn merge(self, other: Option<Self>) -> Self {
@@ -11721,6 +11758,64 @@ impl FeatureMetadata {
.map(|details| matches!(details, PixAdditionalDetails::Scheduled(_)))
.unwrap_or(false)
}
+
+ /// Gets the optional fixed recurring mandate amount for Pix Automatico CIT flow
+ pub fn get_optional_fixed_recurring_mit_amount_for_pix_automatico(
+ &self,
+ ) -> common_utils::errors::CustomResult<Option<MinorUnit>, ValidationError> {
+ let pix_automatico = self.pix_automatico_additional_details.as_ref().ok_or(
+ ValidationError::MissingRequiredField {
+ field_name: "feature_metadata.pix_automatico_additional_details".to_string(),
+ },
+ )?;
+
+ let mandate_details = match pix_automatico {
+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => {
+ push.mandate_details.as_ref()
+ }
+ PixAutomaticoAdditionalDetails::PixAutomaticoQr(qr) => qr.mandate_details.as_ref(),
+ PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
+ return Err(error_stack::report!(ValidationError::InvalidValue {
+ message: "Expected CIT flow, found MIT flow".to_string(),
+ }))
+ }
+ };
+
+ let mandate_details = mandate_details.ok_or(ValidationError::MissingRequiredField {
+ field_name: "mandate_details".to_string(),
+ })?;
+
+ Ok(mandate_details.fixed_recurring_amount)
+ }
+
+ /// Gets the optional minimum recurring mandate amount for Pix Automatico CIT flow
+ pub fn get_optional_min_recurring_amount_for_pix_automatico(
+ &self,
+ ) -> common_utils::errors::CustomResult<Option<MinorUnit>, ValidationError> {
+ let pix_automatico = self.pix_automatico_additional_details.as_ref().ok_or(
+ ValidationError::MissingRequiredField {
+ field_name: "feature_metadata.pix_automatico_additional_details".to_string(),
+ },
+ )?;
+
+ let mandate_details = match pix_automatico {
+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => {
+ push.mandate_details.as_ref()
+ }
+ PixAutomaticoAdditionalDetails::PixAutomaticoQr(qr) => qr.mandate_details.as_ref(),
+ PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
+ return Err(error_stack::report!(ValidationError::InvalidValue {
+ message: "Expected CIT flow, found MIT flow".to_string(),
+ }))
+ }
+ };
+
+ let mandate_details = mandate_details.ok_or(ValidationError::MissingRequiredField {
+ field_name: "mandate_details".to_string(),
+ })?;
+
+ Ok(mandate_details.min_recurring_amount)
+ }
}
#[derive(Debug, Default, Clone, serde::Deserialize, serde::Serialize, ToSchema, PartialEq)]
@@ -11818,18 +11913,144 @@ pub struct ScheduledExpirationTime {
pub pix_key: Option<enums::PixKey>,
}
-#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+/// Represents the specific data for Santander Pix Automatico (recurring PIX payments)
+/// Split into CIT (Customer Initiated Transaction) and MIT (Merchant Initiated Transaction) variants
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum PixAutomaticoAdditionalDetails {
- /// Pix Automatico Push notification flow
- PixAutomaticoPush(PixAutomaticoPushDetails),
+ /// Customer Initiated Transaction - used during mandate setup for PixAutomaticoPush Payment Method Type
+ PixAutomaticoPush(PixAutomaticoPushData),
+ /// Customer Initiated Transaction - used during mandate setup + non 0$ mandate setup for PixAutomaticoQr Payment Method Type
+ PixAutomaticoQr(PixAutomaticoQrData),
+ /// Merchant Initiated Transaction - used during recurring charge creation
+ PixAutomaticoMit(PixAutomaticoMitData),
}
-#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
-pub struct PixAutomaticoPushDetails {
+/// Data for PixAutomaticoPush Payment Method Type CIT (Customer Initiated Transaction) - used during mandate setup
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub struct PixAutomaticoPushData {
/// Time in seconds until which the push notification is valid
#[schema(value_type = u32, example = 3600)]
pub time: u32,
+ /// Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)
+ #[smithy(value_type = "Option<bool>")]
+ #[schema(value_type = Option<bool>, example = true)]
+ pub retry_policy: Option<bool>,
+ /// Mandate details for the recurring charge
+ #[smithy(value_type = "Option<SantanderMandateDetails>")]
+ #[schema(value_type = Option<SantanderMandateDetails>)]
+ pub mandate_details: Option<SantanderMandateDetails>,
+}
+
+/// Data for PixAutomaticoQr Payment Method Type CIT (Customer Initiated Transaction) - used during mandate setup + non 0$ mandate setup
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub struct PixAutomaticoQrData {
+ /// Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)
+ #[smithy(value_type = "Option<bool>")]
+ #[schema(value_type = Option<bool>, example = true)]
+ pub retry_policy: Option<bool>,
+ /// Mandate details for the recurring charge
+ #[smithy(value_type = "Option<SantanderMandateDetails>")]
+ #[schema(value_type = Option<SantanderMandateDetails>)]
+ pub mandate_details: Option<SantanderMandateDetails>,
+}
+
+/// Data for Santander Pix Automatico MIT (Merchant Initiated Transaction) - used during recurring charge creation
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub struct PixAutomaticoMitData {
+ /// Receiver details for the recurring charge
+ #[smithy(value_type = "Option<SantanderPixAutomaticoReceiverDetails>")]
+ #[schema(value_type = Option<SantanderPixAutomaticoReceiverDetails>)]
+ pub receiver_details: Option<SantanderPixAutomaticoReceiverDetails>,
+ /// Execution date for the mandate charge (maps to data_de_vencimento). Format: YYYY-MM-DD.
+ /// 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 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>")]
+ #[schema(value_type = Option<bool>, example = true)]
+ pub auto_adjust_date: Option<bool>,
+}
+
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub struct SantanderMandateDetails {
+ /// Fixed amount for each recurring charge in minor units (e.g., cents). If not provided, the mandate will allow variable amounts.
+ #[schema(value_type = Option<u64>, example = 6540)]
+ #[smithy(value_type = "Option<MinorUnit>")]
+ pub fixed_recurring_amount: Option<MinorUnit>,
+ /// Minimum amount for each recurring charge in minor units (e.g., cents). If not provided, there will be no minimum limit on the amount.
+ #[schema(value_type = Option<u64>, example = 6540)]
+ #[smithy(value_type = "Option<MinorUnit>")]
+ pub min_recurring_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")]
+ pub start_date: Option<PrimitiveDateTime>,
+ /// End date for the recurring charges. Format: YYYY-MM-DD. If not provided, the mandate will be valid indefinitely.
+ #[schema(value_type = Option<String>, example="2026-12-31")]
+ #[serde(default, with = "common_utils::custom_serde::date_only_optional")]
+ pub end_date: Option<PrimitiveDateTime>,
+ /// Frequency of the recurring charges (e.g., weekly, monthly). If not provided, defaults to monthly.
+ #[schema(value_type = Option<SantanderMandatePeriodicity>, example = "weekly")]
+ #[smithy(value_type = "Option<SantanderMandatePeriodicity>")]
+ pub periodicity: Option<SantanderMandatePeriodicity>,
+}
+
+#[derive(
+ Debug, Default, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel,
+)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+#[serde(rename_all = "snake_case")]
+pub enum SantanderMandatePeriodicity {
+ /// Every week
+ Weekly,
+ /// Every month
+ #[default]
+ Monthly,
+ /// Every 3 months
+ Quarterly,
+ /// Every 6 months
+ Semiannually,
+ /// Every year
+ Annually,
+}
+
+/// Account type for Santander Pix Automatico recurring charges
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[serde(rename_all = "snake_case")]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub enum AccountType {
+ /// Checking account (Conta Corrente)
+ Current,
+ /// Savings account (Conta Poupança)
+ Savings,
+ /// Payment account (Conta Pagamento)
+ Payment,
+}
+
+/// Represents the receiver details for Santander Pix Automatico recurring charges
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub struct SantanderPixAutomaticoReceiverDetails {
+ /// Branch code (agencia) of the receiver's bank account
+ #[smithy(value_type = "Option<String>")]
+ #[schema(value_type = Option<String>, example = "0001")]
+ pub branch_code: Option<Secret<String>>,
+ /// Account number (conta) of the receiver
+ #[smithy(value_type = "Option<String>")]
+ #[schema(value_type = Option<String>, example = "130333323")]
+ pub account_number: Option<Secret<String>>,
+ /// Account type (tipoConta) - CORRENTE, POUPANCA, or PAGAMENTO
+ #[smithy(value_type = "Option<AccountType>")]
+ #[schema(value_type = Option<AccountType>)]
+ pub account_type: Option<AccountType>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, SmithyModel, PartialEq)]
@@ -13419,9 +13640,6 @@ pub struct SantanderConnectorMetadataData {
/// Boleto-specific data and rules for Santander payments
#[smithy(value_type = "Option<SantanderBoletoData>")]
pub boleto: Option<SantanderBoletoData>,
- /// Pix Automatico-specific data for Santander recurring payments
- #[smithy(value_type = "Option<SantanderPixAutomaticoData>")]
- pub pix_automatico: Option<SantanderPixAutomaticoData>,
}
/// Represents the specific data and rules related to Santander Boleto payments, including discounts, penalties, collection actions, payment constraints, beneficiary details, and document kind.
@@ -13452,127 +13670,6 @@ pub struct SantanderBoletoData {
pub document_kind: Option<common_enums::BoletoDocumentKind>,
}
-/// Account type for Santander Pix Automatico recurring charges
-#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
-#[serde(rename_all = "snake_case")]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-pub enum AccountType {
- /// Checking account (Conta Corrente)
- Current,
- /// Savings account (Conta Poupança)
- Savings,
- /// Payment account (Conta Pagamento)
- Payment,
-}
-
-/// Represents the receiver details for Santander Pix Automatico recurring charges
-#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-pub struct SantanderPixAutomaticoReceiverDetails {
- /// Branch code (agencia) of the receiver's bank account
- #[smithy(value_type = "Option<String>")]
- #[schema(value_type = Option<String>, example = "0001")]
- pub branch_code: Option<Secret<String>>,
- /// Account number (conta) of the receiver
- #[smithy(value_type = "Option<String>")]
- #[schema(value_type = Option<String>, example = "130333323")]
- pub account_number: Option<Secret<String>>,
- /// Account type (tipoConta) - CORRENTE, POUPANCA, or PAGAMENTO
- #[smithy(value_type = "Option<AccountType>")]
- #[schema(value_type = Option<AccountType>)]
- pub account_type: Option<AccountType>,
-}
-
-#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-pub struct SantanderMandateDetails {
- /// Maximum amount for each recurring charge
- #[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")]
- pub start_date: Option<PrimitiveDateTime>,
- /// End date for the recurring charges. Format: YYYY-MM-DD. If not provided, the mandate will be valid indefinitely.
- #[schema(value_type = Option<String>, example="2026-12-31")]
- #[serde(default, with = "common_utils::custom_serde::date_only_optional")]
- pub end_date: Option<PrimitiveDateTime>,
- /// Frequency of the recurring charges (e.g., weekly, monthly). If not provided, defaults to monthly.
- #[schema(value_type = Option<SantanderMandatePeriodicity>, example = "weekly")]
- #[smithy(value_type = "Option<SantanderMandatePeriodicity>")]
- pub periodicity: Option<SantanderMandatePeriodicity>,
-}
-
-#[derive(
- Debug, Default, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel,
-)]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-#[serde(rename_all = "snake_case")]
-pub enum SantanderMandatePeriodicity {
- /// Every week
- Weekly,
- /// Every month
- #[default]
- Monthly,
- /// Every 3 months
- Quarterly,
- /// Every 6 months
- Semiannually,
- /// Every year
- Annually,
-}
-
-/// Represents the specific data for Santander Pix Automatico (recurring PIX payments)
-/// Split into CIT (Customer Initiated Transaction) and MIT (Merchant Initiated Transaction) variants
-#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-#[serde(rename_all = "snake_case")]
-pub enum SantanderPixAutomaticoData {
- /// Customer Initiated Transaction - used during mandate setup
- Cit(PixAutomaticoCitData),
- /// Merchant Initiated Transaction - used during recurring charge creation
- Mit(PixAutomaticoMitData),
-}
-
-/// Data for Santander Pix Automatico CIT (Customer Initiated Transaction) - used during mandate setup
-#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-pub struct PixAutomaticoCitData {
- /// Contract ID to identify the recurring payment contract
- #[smithy(value_type = "Option<String>")]
- #[schema(value_type = Option<String>, example = "pm_16503867")]
- pub contract_id: Option<String>,
- /// Enable retry policy for failed payments (maps to PERMITE_3R_7D if true)
- #[smithy(value_type = "Option<bool>")]
- #[schema(value_type = Option<bool>, example = true)]
- pub retry_policy: Option<bool>,
- /// Mandate details for the recurring charge
- #[smithy(value_type = "Option<SantanderMandateDetails>")]
- #[schema(value_type = Option<SantanderMandateDetails>)]
- pub mandate_details: Option<SantanderMandateDetails>,
-}
-
-/// Data for Santander Pix Automatico MIT (Merchant Initiated Transaction) - used during recurring charge creation
-#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
-#[smithy(namespace = "com.hyperswitch.smithy.types")]
-pub struct PixAutomaticoMitData {
- /// Receiver details for the recurring charge
- #[smithy(value_type = "Option<SantanderPixAutomaticoReceiverDetails>")]
- #[schema(value_type = Option<SantanderPixAutomaticoReceiverDetails>)]
- pub receiver_details: Option<SantanderPixAutomaticoReceiverDetails>,
- /// Execution date for the mandate charge (maps to data_de_vencimento). Format: YYYY-MM-DD.
- /// 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 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>")]
- #[schema(value_type = Option<bool>, example = true)]
- pub auto_adjust_date: Option<bool>,
-}
-
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
#[smithy(namespace = "com.hyperswitch.smithy.types")]
/// Represents the end-recipient of a payout or fund transfer.
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 8ff8018ef2..e3e6d7dd8b 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -7326,6 +7326,18 @@ 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"
@@ -7340,18 +7352,37 @@ placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
[[santander.metadata.pix_automatico_push]]
+name="account_number"
+label="Account Number"
+placeholder="Enter your Account Number"
+required=false
+type="Text"
+[[santander.metadata.pix_automatico_push]]
+name="account_type"
+label="Account Type"
+placeholder="Enter your Account Type"
+required=false
+type="Select"
+options=["current", "savings", "payment"]
+[[santander.metadata.pix_automatico_push]]
+name="branch_code"
+label="Branch Code"
+placeholder="Enter your branch code"
+required=false
+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_push]]
+[[santander.metadata.pix_automatico_qr]]
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"
@@ -7366,16 +7397,23 @@ 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
+name="account_number"
+label="Account Number"
+placeholder="Enter your Account Number"
+required=false
type="Text"
[[santander.metadata.pix_automatico_qr]]
-name="client_secret"
-label="Client Secret"
-placeholder="Enter your Client Secret"
-required=true
+name="account_type"
+label="Account Type"
+placeholder="Enter your Account Type"
+required=false
+type="Select"
+options=["current", "savings", "payment"]
+[[santander.metadata.pix_automatico_qr]]
+name="branch_code"
+label="Branch Code"
+placeholder="Enter your branch code"
+required=false
type="Text"
[[santander.metadata.boleto]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index d2a821b94f..4f90af9f66 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -6343,6 +6343,17 @@ 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"
name="pix_key_type"
label="Chave Key Type"
placeholder="Enter your Chave/Pix Key Type"
@@ -6356,18 +6367,37 @@ placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
[[santander.metadata.pix_automatico_push]]
+name="account_number"
+label="Account Number"
+placeholder="Enter your Account Number"
+required=false
+type="Text"
+[[santander.metadata.pix_automatico_push]]
+name="account_type"
+label="Account Type"
+placeholder="Enter your Account Type"
+required=false
+type="Select"
+options=["current", "savings", "payment"]
+[[santander.metadata.pix_automatico_push]]
+name="branch_code"
+label="Branch Code"
+placeholder="Enter your branch code"
+required=false
+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_push]]
+[[santander.metadata.pix_automatico_qr]]
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"
@@ -6382,16 +6412,23 @@ 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
+name="account_number"
+label="Account Number"
+placeholder="Enter your Account Number"
+required=false
type="Text"
[[santander.metadata.pix_automatico_qr]]
-name="client_secret"
-label="Client Secret"
-placeholder="Enter your Client Secret"
-required=true
+name="account_type"
+label="Account Type"
+placeholder="Enter your Account Type"
+required=false
+type="Select"
+options=["current", "savings", "payment"]
+[[santander.metadata.pix_automatico_qr]]
+name="branch_code"
+label="Branch Code"
+placeholder="Enter your branch code"
+required=false
type="Text"
[[santander.metadata.boleto]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 9b315296ad..d434b7f3bf 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -7302,6 +7302,18 @@ 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"
@@ -7316,18 +7328,37 @@ placeholder="Enter your Chave/Pix Key"
required=true
type="Text"
[[santander.metadata.pix_automatico_push]]
+name="account_number"
+label="Account Number"
+placeholder="Enter your Account Number"
+required=false
+type="Text"
+[[santander.metadata.pix_automatico_push]]
+name="account_type"
+label="Account Type"
+placeholder="Enter your Account Type"
+required=false
+type="Select"
+options=["current", "savings", "payment"]
+[[santander.metadata.pix_automatico_push]]
+name="branch_code"
+label="Branch Code"
+placeholder="Enter your branch code"
+required=false
+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_push]]
+[[santander.metadata.pix_automatico_qr]]
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"
@@ -7342,16 +7373,23 @@ 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
+name="account_number"
+label="Account Number"
+placeholder="Enter your Account Number"
+required=false
type="Text"
[[santander.metadata.pix_automatico_qr]]
-name="client_secret"
-label="Client Secret"
-placeholder="Enter your Client Secret"
-required=true
+name="account_type"
+label="Account Type"
+placeholder="Enter your Account Type"
+required=false
+type="Select"
+options=["current", "savings", "payment"]
+[[santander.metadata.pix_automatico_qr]]
+name="branch_code"
+label="Branch Code"
+placeholder="Enter your branch code"
+required=false
type="Text"
[[santander.metadata.boleto]]
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index f23c8aa356..4b09669114 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -185,16 +185,76 @@ pub struct ScheduledExpirationTime {
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
+#[serde(tag = "type", rename_all = "snake_case")]
pub enum PixAutomaticoAdditionalDetails {
- /// Pix Automatico Push notification flow
- PixAutomaticoPush(PixAutomaticoPushDetails),
+ PixAutomaticoPush(PixAutomaticoPushData),
+ PixAutomaticoQr(PixAutomaticoQrData),
+ PixAutomaticoMit(PixAutomaticoMitData),
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
-pub struct PixAutomaticoPushDetails {
- /// Time in seconds until which the push notification is valid
+pub struct PixAutomaticoPushData {
pub time: u32,
+ pub retry_policy: Option<bool>,
+ pub mandate_details: Option<SantanderMandateDetails>,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+pub struct PixAutomaticoQrData {
+ pub retry_policy: Option<bool>,
+ pub mandate_details: Option<SantanderMandateDetails>,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+pub struct PixAutomaticoMitData {
+ pub receiver_details: Option<SantanderPixAutomaticoReceiverDetails>,
+ #[serde(default, with = "common_utils::custom_serde::date_only_optional")]
+ pub mandate_execution_date: Option<time::PrimitiveDateTime>,
+ pub auto_adjust_date: Option<bool>,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+pub struct SantanderMandateDetails {
+ pub fixed_recurring_amount: Option<MinorUnit>,
+ pub min_recurring_amount: Option<MinorUnit>,
+ #[serde(default, with = "common_utils::custom_serde::date_only_optional")]
+ pub start_date: Option<time::PrimitiveDateTime>,
+ #[serde(default, with = "common_utils::custom_serde::date_only_optional")]
+ pub end_date: Option<time::PrimitiveDateTime>,
+ pub periodicity: Option<SantanderMandatePeriodicity>,
+}
+
+#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+#[serde(rename_all = "snake_case")]
+pub enum SantanderMandatePeriodicity {
+ Weekly,
+ #[default]
+ Monthly,
+ Quarterly,
+ Semiannually,
+ Annually,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+#[serde(rename_all = "snake_case")]
+pub enum AccountType {
+ Current,
+ Savings,
+ Payment,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+pub struct SantanderPixAutomaticoReceiverDetails {
+ pub branch_code: Option<Secret<String>>,
+ pub account_number: Option<Secret<String>>,
+ pub account_type: Option<AccountType>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 9948942d4a..b0c879ddd0 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -5057,7 +5057,7 @@ pub fn get_qr_metadata(
{
let qr_code_info = QrCodeInformation::QrCodeUrl {
image_data_url,
- qr_code_url,
+ qr_code_url: Some(qr_code_url),
display_to_timestamp,
expiry_type: None,
raw_qr_data: None,
diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs
index 872fa8ba87..5689a26698 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander.rs
@@ -802,37 +802,39 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let amount = convert_amount(
- self.amount_converter,
- req.request.minor_amount,
- req.request.currency,
+ let feature_metadata = req.request.feature_metadata.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "feature_metadata",
+ },
)?;
- 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 fixed_rec_amount_in_minor = feature_metadata
+ .get_optional_fixed_recurring_mit_amount_for_pix_automatico()
+ .change_context(errors::ConnectorError::InvalidDataFormat {
+ field_name: "feature_metadata.pix_automatico_additional_details",
+ })?;
+ let min_rec_amount_in_minor = feature_metadata
+ .get_optional_min_recurring_amount_for_pix_automatico()
+ .change_context(errors::ConnectorError::InvalidDataFormat {
+ field_name: "feature_metadata.pix_automatico_additional_details",
})?;
- let rec_amount = convert_amount(
+ let fixed_rec_amount = fixed_rec_amount_in_minor
+ .map(|amount| convert_amount(self.amount_converter, amount, req.request.currency))
+ .transpose()?;
+ let min_rec_amount = min_rec_amount_in_minor
+ .map(|amount| convert_amount(self.amount_converter, amount, req.request.currency))
+ .transpose()?;
+ let amount = convert_amount(
self.amount_converter,
- rec_amount_in_minor,
+ req.request.minor_amount,
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)?;
+
+ let connector_router_data = SantanderRouterData::from((amount, req));
+ let connector_req = SantanderSetupMandateRequest::try_from((
+ &connector_router_data,
+ fixed_rec_amount,
+ min_rec_amount,
+ ))?;
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 fa10b9b60e..8d1ffef7a8 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander/requests.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander/requests.rs
@@ -1,3 +1,4 @@
+use api_models::payments::AccountType;
use common_utils::types::{FloatMajorUnit, StringMajorUnit};
use hyperswitch_masking::Secret;
use serde::{Deserialize, Serialize};
@@ -56,8 +57,8 @@ pub enum SantanderDiscountType {
pub struct SantanderMetadataObject {
pub pix: Option<PixMetadataObject>,
pub boleto: Option<BoletoMetadataObject>,
- pub pix_automatico_push: Option<PixAutomaticoMetadataObject>,
- pub pix_automatico_qr: Option<PixAutomaticoMetadataObject>,
+ pub pix_automatico_push: Option<PixAutomaticoPushMetadataObject>,
+ pub pix_automatico_qr: Option<PixAutomaticoQrMetadataObject>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -81,13 +82,27 @@ pub struct PixMetadataObject {
}
#[derive(Debug, Serialize, Deserialize)]
-pub struct PixAutomaticoMetadataObject {
+pub struct PixAutomaticoPushMetadataObject {
+ pub client_id: Secret<String>,
+ pub client_secret: Secret<String>,
+ pub account_number: Option<Secret<String>>,
+ pub branch_code: Option<Secret<String>>,
+ pub account_type: Option<AccountType>,
+ pub pix_key_type: responses::SantanderPixKeyType,
+ pub pix_key_value: Secret<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PixAutomaticoQrMetadataObject {
pub client_id: Secret<String>,
pub client_secret: Secret<String>,
- // might not be req for J1/J2, cross check
pub pix_key_value: Secret<String>,
- // might not be req for J1/J2, cross check
pub pix_key_type: responses::SantanderPixKeyType,
+ pub merchant_name: Option<String>,
+ pub merchant_city: Option<String>,
+ pub account_number: Option<Secret<String>>,
+ pub branch_code: Option<Secret<String>>,
+ pub account_type: Option<AccountType>,
}
pub struct SantanderRouterData<T> {
@@ -519,13 +534,12 @@ pub enum RetryPolicy {
#[serde(rename_all = "camelCase")]
pub struct SantanderPixAutomaticoRecebedor {
/// Branch code (agencia) of the receiver's account
- pub agencia: Secret<String>,
+ pub agencia: Option<Secret<String>>,
/// Account number (conta) of the receiver
pub conta: Secret<String>,
/// Account type (tipoConta) - CORRENTE, POUPANCA, or PAGAMENTO
- #[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "tipoConta")]
- pub tipo_conta: Option<SantanderAccountType>,
+ pub tipo_conta: SantanderAccountType,
}
/// Represents calendar information for recurring charge (cobr endpoint)
diff --git a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
index 79ecb81291..15950ba4eb 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
@@ -793,13 +793,6 @@ impl
.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
@@ -984,54 +977,152 @@ impl TryFrom<&SantanderRouterData<&PaymentsAuthorizeRouterData>>
let mit_data = value
.router_data
.request
- .connector_intent_metadata
+ .feature_metadata
.clone()
- .and_then(|m| m.santander)
- .and_then(|santander| santander.pix_automatico)
+ .and_then(|metadata| metadata.pix_automatico_additional_details)
.and_then(|pix_automatico| match pix_automatico {
- api_models::payments::SantanderPixAutomaticoData::Mit(mit) => Some(mit),
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoMit(mit) => {
+ Some(mit)
+ }
_ => None,
})
.ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "connector_metadata.santander.pix_automatico.mit",
+ field_name: "feature_metadata.pix_automatico_additional_details.mit",
})?;
- let receiver_details =
- mit_data
- .receiver_details
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "connector_metadata.santander.pix_automatico.mit.receiver_details",
- })?;
+ let santander_mca_metadata =
+ SantanderMetadataObject::try_from(&value.router_data.connector_meta_data)?;
+
+ // Priority: feature_metadata.receiver_details > connector_meta_data
+ // Use connector_meta_data based on payment_method_type
+ let (branch_code, account_number, account_type) = match mit_data.receiver_details {
+ Some(receiver_details) => {
+ let branch = receiver_details.branch_code.clone();
+ let account = receiver_details.account_number.clone();
+ let acc_type = receiver_details.account_type;
+
+ match value.router_data.request.payment_method_type {
+ Some(enums::PaymentMethodType::PixAutomaticoPush) => {
+ let push_metadata = santander_mca_metadata
+ .pix_automatico_push
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?;
+
+ // branch_code is optional
+ let final_branch = branch.or(push_metadata.branch_code);
+
+ let final_account = account.or(push_metadata.account_number).ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "account_number",
+ },
+ )?;
- let branch_code =
- receiver_details
- .branch_code
- .clone()
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name:
- "connector_metadata.santander.pix_automatico.mit.receiver_details.branch_code",
- })?;
+ let final_account_type = acc_type
+ .map(SantanderAccountType::from)
+ .or_else(|| push_metadata.account_type.map(SantanderAccountType::from))
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "account_type",
+ })?;
- let account_number = receiver_details
- .account_number
- .clone()
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name:
- "connector_metadata.santander.pix_automatico.mit.receiver_details.account_number",
- })?;
+ (final_branch, final_account, final_account_type)
+ }
+ Some(enums::PaymentMethodType::PixAutomaticoQr) => {
+ let qr_metadata = santander_mca_metadata
+ .pix_automatico_qr
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?;
- let account_type =
- receiver_details
- .account_type
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name:
- "connector_metadata.santander.pix_automatico.mit.receiver_details.account_type",
- })?;
+ // branch_code is optional
+ let final_branch = branch.or(qr_metadata.branch_code);
+
+ let final_account = account.or(qr_metadata.account_number).ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "account_number",
+ },
+ )?;
+
+ let final_account_type = acc_type
+ .map(SantanderAccountType::from)
+ .or_else(|| qr_metadata.account_type.map(SantanderAccountType::from))
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "account_type",
+ })?;
+
+ (final_branch, final_account, final_account_type)
+ }
+ _ => {
+ return Err(errors::ConnectorError::NotSupported {
+ message: format!(
+ "Payment method type {:?} is not supported for mandates",
+ value.router_data.request.payment_method_type
+ ),
+ connector: "Santander",
+ }
+ .into());
+ }
+ }
+ }
+ None => {
+ // If receiver_details doesn't exist, use connector_meta_data entirely
+ match value.router_data.request.payment_method_type {
+ Some(enums::PaymentMethodType::PixAutomaticoPush) => {
+ let push_metadata = santander_mca_metadata
+ .pix_automatico_push
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?;
+
+ // branch_code is optional
+ (
+ push_metadata.branch_code,
+ push_metadata.account_number.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "account_number",
+ },
+ )?,
+ push_metadata
+ .account_type
+ .map(SantanderAccountType::from)
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "account_type",
+ })?,
+ )
+ }
+ Some(enums::PaymentMethodType::PixAutomaticoQr) => {
+ let qr_metadata = santander_mca_metadata
+ .pix_automatico_qr
+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?;
+
+ // branch_code is optional
+ (
+ qr_metadata.branch_code,
+ qr_metadata.account_number.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "account_number",
+ },
+ )?,
+ qr_metadata
+ .account_type
+ .map(SantanderAccountType::from)
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "account_type",
+ })?,
+ )
+ }
+ _ => {
+ return Err(errors::ConnectorError::NotSupported {
+ message: format!(
+ "Payment method type {:?} is not supported for mandates",
+ value.router_data.request.payment_method_type
+ ),
+ connector: "Santander",
+ }
+ .into());
+ }
+ }
+ }
+ };
let recebedor = SantanderPixAutomaticoRecebedor {
agencia: branch_code,
conta: account_number,
- tipo_conta: Some(SantanderAccountType::from(account_type)),
+ tipo_conta: account_type,
};
let id_rec = value.router_data.request.get_connector_mandate_id()?;
@@ -1715,7 +1806,7 @@ fn convert_pix_data_to_value(
let qr_code_info = QrCodeInformation::QrCodeUrl {
image_data_url: image_data_url.clone(),
- qr_code_url: image_data_url,
+ qr_code_url: None,
display_to_timestamp: None,
expiry_type: variant,
raw_qr_data: Some(data),
@@ -2173,40 +2264,48 @@ fn get_boleto_additional_fields_from_connector_metadata(
}
impl
- TryFrom<
+ TryFrom<(
&SantanderRouterData<
&RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
>,
- > for SantanderSetupMandateRequest
+ Option<StringMajorUnit>,
+ Option<StringMajorUnit>,
+ )> for SantanderSetupMandateRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- value: &SantanderRouterData<
- &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
- >,
+ value: (
+ &SantanderRouterData<
+ &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+ >,
+ Option<StringMajorUnit>,
+ Option<StringMajorUnit>,
+ ),
) -> Result<Self, Self::Error> {
- let item = value.router_data;
- let santander_meta = item
+ let item = value.0.router_data;
+ let fixed_rec_amount = value.1;
+ let min_rec_amount = value.2;
+ let pix_automatico_meta = item
.request
- .connector_intent_metadata
+ .feature_metadata
.as_ref()
- .and_then(|metadata| metadata.santander.as_ref())
+ .and_then(|metadata| metadata.pix_automatico_additional_details.as_ref())
.ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "connector_metadata.santander",
+ field_name: "feature_metadata.pix_automatico_additional_details",
})?;
- let pix_automatico_meta = santander_meta.pix_automatico.as_ref().ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "pix_automatico metadata",
- },
- )?;
-
- let cit_data = match pix_automatico_meta {
- api_models::payments::SantanderPixAutomaticoData::Cit(cit) => cit,
- _ => {
+ let (retry_policy, mandate_details) = match pix_automatico_meta {
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => {
+ (&push.retry_policy, &push.mandate_details)
+ }
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoQr(qr) => {
+ (&qr.retry_policy, &qr.mandate_details)
+ }
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoMit(_) => {
return Err(errors::ConnectorError::MissingRequiredField {
- field_name: "connector_metadata.santander.pix_automatico.cit",
+ field_name:
+ "feature_metadata.pix_automatico_additional_details (expected CIT flow)",
})?;
}
};
@@ -2217,7 +2316,7 @@ impl
},
)?;
- let politica_retentativa = if cit_data.retry_policy.unwrap_or(false) {
+ let politica_retentativa = if retry_policy.unwrap_or(false) {
RetryPolicy::Permite3r7d
} else {
RetryPolicy::NaoPermite
@@ -2270,31 +2369,62 @@ impl
.as_ref()
.and_then(|token| token.parse::<i64>().ok());
- let mandate_details = cit_data.mandate_details.as_ref();
+ let current_date = time::OffsetDateTime::now_utc().date();
- let data_inicial = match mandate_details.and_then(|md| md.start_date) {
- Some(start_date) => format_as_date_only(Some(start_date))?,
- None => time::OffsetDateTime::now_utc()
- .date()
+ let data_inicial = match mandate_details.as_ref().and_then(|md| md.start_date) {
+ Some(start_date) => {
+ // Validate that start_date is not before current date
+ if start_date.date() < current_date {
+ return Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "mandate_details.start_date",
+ }
+ .into());
+ }
+ format_as_date_only(Some(start_date))?
+ }
+ None => current_date
.format(&time::macros::format_description!("[year]-[month]-[day]"))
.change_context(errors::ConnectorError::DateFormattingFailed)?,
};
let data_final = mandate_details
+ .as_ref()
.and_then(|md| md.end_date)
- .map(|end_date| format_as_date_only(Some(end_date)))
+ .map(|end_date| {
+ // Validate that end_date is not before current date
+ if end_date.date() < current_date {
+ return Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "mandate_details.end_date",
+ });
+ }
+ format_as_date_only(Some(end_date))
+ })
.transpose()?;
let periodicidade = mandate_details
+ .as_ref()
.and_then(|md| md.periodicity.as_ref())
.map(|p| Periodicidade::from(p.clone()))
.unwrap_or(Periodicidade::Semanal);
- // either of valor or valor_minimo_recebedor can be passed at one time
- let valor = Some(RecurrenceValue {
- valor_rec: Some(value.amount.clone()),
- valor_minimo_recebedor: None,
- });
+ // either of valor_rec or valor_minimo_recebedor can be passed at one time, not both
+ let valor = match (fixed_rec_amount, min_rec_amount.as_ref()) {
+ (Some(fixed_amount), None) => Some(RecurrenceValue {
+ valor_rec: Some(fixed_amount),
+ valor_minimo_recebedor: None,
+ }),
+ (None, Some(_)) => Some(RecurrenceValue {
+ valor_rec: None,
+ valor_minimo_recebedor: min_rec_amount,
+ }),
+ (None, None) => None,
+ (Some(_), Some(_)) => {
+ return Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "mandate_details.fixed_recurring_amount & mandate_details.min_recurring_amount cannot be present at the same time",
+ }
+ .into());
+ }
+ };
let is_immediate = item
.request
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index dcc8c99fbf..65d0fcd356 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -208,6 +208,98 @@ impl ApiModelToDieselModelConvertor<api_models::payments::FinixAdditionalDetails
}
}
+impl ApiModelToDieselModelConvertor<api_models::payments::SantanderMandatePeriodicity>
+ for diesel_models::types::SantanderMandatePeriodicity
+{
+ fn convert_from(from: api_models::payments::SantanderMandatePeriodicity) -> Self {
+ match from {
+ api_models::payments::SantanderMandatePeriodicity::Weekly => Self::Weekly,
+ api_models::payments::SantanderMandatePeriodicity::Monthly => Self::Monthly,
+ api_models::payments::SantanderMandatePeriodicity::Quarterly => Self::Quarterly,
+ api_models::payments::SantanderMandatePeriodicity::Semiannually => Self::Semiannually,
+ api_models::payments::SantanderMandatePeriodicity::Annually => Self::Annually,
+ }
+ }
+
+ fn convert_back(self) -> api_models::payments::SantanderMandatePeriodicity {
+ match self {
+ Self::Weekly => api_models::payments::SantanderMandatePeriodicity::Weekly,
+ Self::Monthly => api_models::payments::SantanderMandatePeriodicity::Monthly,
+ Self::Quarterly => api_models::payments::SantanderMandatePeriodicity::Quarterly,
+ Self::Semiannually => api_models::payments::SantanderMandatePeriodicity::Semiannually,
+ Self::Annually => api_models::payments::SantanderMandatePeriodicity::Annually,
+ }
+ }
+}
+
+impl ApiModelToDieselModelConvertor<api_models::payments::SantanderMandateDetails>
+ for diesel_models::types::SantanderMandateDetails
+{
+ fn convert_from(m: api_models::payments::SantanderMandateDetails) -> Self {
+ Self {
+ fixed_recurring_amount: m.fixed_recurring_amount,
+ min_recurring_amount: m.min_recurring_amount,
+ start_date: m.start_date,
+ end_date: m.end_date,
+ periodicity: m
+ .periodicity
+ .map(diesel_models::types::SantanderMandatePeriodicity::convert_from),
+ }
+ }
+
+ fn convert_back(self) -> api_models::payments::SantanderMandateDetails {
+ api_models::payments::SantanderMandateDetails {
+ fixed_recurring_amount: self.fixed_recurring_amount,
+ min_recurring_amount: self.min_recurring_amount,
+ start_date: self.start_date,
+ end_date: self.end_date,
+ periodicity: self.periodicity.map(|p| p.convert_back()),
+ }
+ }
+}
+
+impl ApiModelToDieselModelConvertor<api_models::payments::SantanderPixAutomaticoReceiverDetails>
+ for diesel_models::types::SantanderPixAutomaticoReceiverDetails
+{
+ fn convert_from(r: api_models::payments::SantanderPixAutomaticoReceiverDetails) -> Self {
+ Self {
+ branch_code: r.branch_code,
+ account_number: r.account_number,
+ account_type: r
+ .account_type
+ .map(diesel_models::types::AccountType::convert_from),
+ }
+ }
+
+ fn convert_back(self) -> api_models::payments::SantanderPixAutomaticoReceiverDetails {
+ api_models::payments::SantanderPixAutomaticoReceiverDetails {
+ branch_code: self.branch_code,
+ account_number: self.account_number,
+ account_type: self.account_type.map(|a| a.convert_back()),
+ }
+ }
+}
+
+impl ApiModelToDieselModelConvertor<api_models::payments::AccountType>
+ for diesel_models::types::AccountType
+{
+ fn convert_from(from: api_models::payments::AccountType) -> Self {
+ match from {
+ api_models::payments::AccountType::Current => Self::Current,
+ api_models::payments::AccountType::Savings => Self::Savings,
+ api_models::payments::AccountType::Payment => Self::Payment,
+ }
+ }
+
+ fn convert_back(self) -> api_models::payments::AccountType {
+ match self {
+ Self::Current => api_models::payments::AccountType::Current,
+ Self::Savings => api_models::payments::AccountType::Savings,
+ Self::Payment => api_models::payments::AccountType::Payment,
+ }
+ }
+}
+
impl ApiModelToDieselModelConvertor<api_models::payments::PixAdditionalDetails>
for diesel_models::types::PixAdditionalDetails
{
@@ -253,9 +345,30 @@ impl ApiModelToDieselModelConvertor<api_models::payments::PixAutomaticoAdditiona
{
fn convert_from(from: api_models::payments::PixAutomaticoAdditionalDetails) -> Self {
match from {
- api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoPush(v) => {
- Self::PixAutomaticoPush(diesel_models::types::PixAutomaticoPushDetails {
- time: v.time,
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => {
+ Self::PixAutomaticoPush(diesel_models::types::PixAutomaticoPushData {
+ time: push.time,
+ retry_policy: push.retry_policy,
+ mandate_details: push
+ .mandate_details
+ .map(diesel_models::types::SantanderMandateDetails::convert_from),
+ })
+ }
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoQr(qr) => {
+ Self::PixAutomaticoQr(diesel_models::types::PixAutomaticoQrData {
+ retry_policy: qr.retry_policy,
+ mandate_details: qr
+ .mandate_details
+ .map(diesel_models::types::SantanderMandateDetails::convert_from),
+ })
+ }
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoMit(mit) => {
+ Self::PixAutomaticoMit(diesel_models::types::PixAutomaticoMitData {
+ receiver_details: mit.receiver_details.map(
+ diesel_models::types::SantanderPixAutomaticoReceiverDetails::convert_from,
+ ),
+ mandate_execution_date: mit.mandate_execution_date,
+ auto_adjust_date: mit.auto_adjust_date,
})
}
}
@@ -263,9 +376,30 @@ impl ApiModelToDieselModelConvertor<api_models::payments::PixAutomaticoAdditiona
fn convert_back(self) -> api_models::payments::PixAutomaticoAdditionalDetails {
match self {
- Self::PixAutomaticoPush(v) => {
+ Self::PixAutomaticoPush(push) => {
api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoPush(
- api_models::payments::PixAutomaticoPushDetails { time: v.time },
+ api_models::payments::PixAutomaticoPushData {
+ time: push.time,
+ retry_policy: push.retry_policy,
+ mandate_details: push.mandate_details.map(|m| m.convert_back()),
+ },
+ )
+ }
+ Self::PixAutomaticoQr(qr) => {
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoQr(
+ api_models::payments::PixAutomaticoQrData {
+ retry_policy: qr.retry_policy,
+ mandate_details: qr.mandate_details.map(|m| m.convert_back()),
+ },
+ )
+ }
+ Self::PixAutomaticoMit(mit) => {
+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoMit(
+ api_models::payments::PixAutomaticoMitData {
+ receiver_details: mit.receiver_details.map(|r| r.convert_back()),
+ mandate_execution_date: mit.mandate_execution_date,
+ auto_adjust_date: mit.auto_adjust_date,
+ },
)
}
}
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 5d9e0ecb2b..5be2461f97 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -570,8 +570,10 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ApplepayConnectorMetadataRequest,
api_models::payments::SessionTokenInfo,
api_models::payments::PixAdditionalDetails,
- api_models::payments::PixAutomaticoPushDetails,
+ api_models::payments::PixAutomaticoPushData,
api_models::payments::PixAutomaticoAdditionalDetails,
+ api_models::payments::PixAutomaticoQrData,
+ api_models::payments::PixAutomaticoMitData,
api_models::payments::ImmediateExpirationTime,
api_models::payments::ScheduledExpirationTime,
api_models::payments::BoletoAdditionalDetails,
@@ -644,8 +646,6 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ClickToPaySessionResponse,
api_models::payments::SantanderConnectorMetadataData,
api_models::payments::SantanderBoletoData,
- api_models::payments::SantanderPixAutomaticoData,
- api_models::payments::PixAutomaticoCitData,
api_models::payments::PixAutomaticoMitData,
api_models::payments::SantanderPixAutomaticoReceiverDetails,
api_models::payments::BoletoPaymentTypeConstraints,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index ebf5756215..c820672d38 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -494,8 +494,10 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ApplepayConnectorMetadataRequest,
api_models::payments::SessionTokenInfo,
api_models::payments::PixAdditionalDetails,
- api_models::payments::PixAutomaticoPushDetails,
+ api_models::payments::PixAutomaticoPushData,
api_models::payments::PixAutomaticoAdditionalDetails,
+ api_models::payments::PixAutomaticoQrData,
+ api_models::payments::PixAutomaticoMitData,
api_models::payments::ImmediateExpirationTime,
api_models::payments::ScheduledExpirationTime,
api_models::payments::BoletoAdditionalDetails,
@@ -724,8 +726,6 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::Address,
api_models::payments::SantanderConnectorMetadataData,
api_models::payments::SantanderBoletoData,
- api_models::payments::SantanderPixAutomaticoData,
- api_models::payments::PixAutomaticoCitData,
api_models::payments::PixAutomaticoMitData,
api_models::payments::SantanderPixAutomaticoReceiverDetails,
api_models::payments::BoletoPaymentTypeConstraints,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 3b44103088..9d0c2bcb8a 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -4723,7 +4723,7 @@ impl ForeignFrom<api_models::payments::QrCodeInformation> for api_models::paymen
raw_qr_data,
} => Self::QrCodeInformation {
image_data_url: Some(image_data_url),
- qr_code_url: Some(qr_code_url),
+ qr_code_url,
display_to_timestamp,
border_color: None,
display_text: None,
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index fa814b083b..1de6c036a5 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -659,9 +659,14 @@ where
let existing_metadata = payment_intent.feature_metadata.as_ref();
- let mut feature_metadata = existing_metadata
- .and_then(|metadata| serde_json::from_value::<FeatureMetadata>(metadata.clone()).ok())
- .unwrap_or_default();
+ let mut feature_metadata = match existing_metadata {
+ Some(metadata) => serde_json::from_value::<FeatureMetadata>(metadata.clone())
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "Failed to deserialize existing feature metadata while updating gateway system",
+ )?,
+ None => FeatureMetadata::default(),
+ };
feature_metadata.gateway_system = Some(gateway_system);