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(core): add surcharge_connector_id and external_surcharge_details to payment models (#11996)

Swangi Kumariaceab74858a6
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 049f9e76a4..438b0059cc 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -20525,6 +20525,28 @@
}
}
},
+ "ExternalSurchargeDetails": {
+ "type": "object",
+ "description": "External surcharge details from InterPayments (stored as JSONB)",
+ "required": [
+ "external_surcharge_id",
+ "external_surcharge_amount",
+ "sale_notified"
+ ],
+ "properties": {
+ "external_surcharge_id": {
+ "type": "string",
+ "description": "sTxId from InterPayments (the last one received before confirm)"
+ },
+ "external_surcharge_amount": {
+ "$ref": "#/components/schemas/MinorUnit"
+ },
+ "sale_notified": {
+ "type": "boolean",
+ "description": "Whether /v1/ch/sale has been successfully called"
+ }
+ }
+ },
"ExternalThreeDsData": {
"type": "object",
"required": [
@@ -37366,6 +37388,14 @@
"description": "Merchant Connector id to be stored for billing_processor connector",
"nullable": true
},
+ "surcharge_connector_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SurchargeConnectorDetails"
+ }
+ ],
+ "nullable": true
+ },
"is_l2_l3_enabled": {
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
@@ -37748,6 +37778,14 @@
"description": "Merchant Connector id to be stored for billing_processor connector",
"nullable": true
},
+ "surcharge_connector_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SurchargeConnectorDetails"
+ }
+ ],
+ "nullable": true
+ },
"is_l2_l3_enabled": {
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
@@ -41536,6 +41574,16 @@
}
]
},
+ "SurchargeConnectorDetails": {
+ "type": "object",
+ "properties": {
+ "surcharge_connector_id": {
+ "type": "string",
+ "description": "The surcharge connector ID for calculating external surcharge",
+ "nullable": true
+ }
+ }
+ },
"SurchargeDetailsResponse": {
"type": "object",
"required": [
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 348ddfd092..55b3e74c39 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -14157,6 +14157,28 @@
}
}
},
+ "ExternalSurchargeDetails": {
+ "type": "object",
+ "description": "External surcharge details from InterPayments (stored as JSONB)",
+ "required": [
+ "external_surcharge_id",
+ "external_surcharge_amount",
+ "sale_notified"
+ ],
+ "properties": {
+ "external_surcharge_id": {
+ "type": "string",
+ "description": "sTxId from InterPayments (the last one received before confirm)"
+ },
+ "external_surcharge_amount": {
+ "$ref": "#/components/schemas/MinorUnit"
+ },
+ "sale_notified": {
+ "type": "boolean",
+ "description": "Whether /v1/ch/sale has been successfully called"
+ }
+ }
+ },
"ExternalThreeDsData": {
"type": "object",
"description": "Represents external 3DS authentication data used in the payment flow.",
@@ -27146,6 +27168,14 @@
"description": "Merchant Connector id to be stored for billing_processor connector",
"nullable": true
},
+ "surcharge_connector_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SurchargeConnectorDetails"
+ }
+ ],
+ "nullable": true
+ },
"is_l2_l3_enabled": {
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
@@ -27462,6 +27492,14 @@
"description": "Merchant Connector id to be stored for billing_processor connector",
"nullable": true
},
+ "surcharge_connector_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SurchargeConnectorDetails"
+ }
+ ],
+ "nullable": true
+ },
"is_l2_l3_enabled": {
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
@@ -30920,6 +30958,16 @@
"calculate"
]
},
+ "SurchargeConnectorDetails": {
+ "type": "object",
+ "properties": {
+ "surcharge_connector_id": {
+ "type": "string",
+ "description": "The surcharge connector ID for calculating external surcharge",
+ "nullable": true
+ }
+ }
+ },
"SurchargeDetailsResponse": {
"type": "object",
"required": [
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 4ad675124e..70c4802b36 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -341,6 +341,13 @@ pub struct ExternalVaultConnectorDetails {
pub vault_token_selector: Option<Vec<VaultTokenField>>,
}
+#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
+pub struct SurchargeConnectorDetails {
+ /// The surcharge connector ID for calculating external surcharge
+ #[schema(value_type = Option<String>)]
+ pub surcharge_connector_id: Option<id_type::MerchantConnectorAccountId>,
+}
+
#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct VaultTokenField {
/// Type of field to be tokenized in
@@ -2350,6 +2357,9 @@ pub struct ProfileCreate {
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
+ /// The surcharge connector details for calculating external surcharge
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -2522,6 +2532,9 @@ pub struct ProfileCreate {
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
+ /// The surcharge connector details for calculating external surcharge
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -2730,6 +2743,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
+ /// The surcharge connector details for calculating external surcharge
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -2915,6 +2931,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
+ /// The surcharge connector details for calculating external surcharge
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -3113,6 +3132,9 @@ pub struct ProfileUpdate {
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
+ /// The surcharge connector details for calculating external surcharge
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
+
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
@@ -3278,6 +3300,9 @@ pub struct ProfileUpdate {
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
+
+ /// The surcharge connector details for calculating external surcharge
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rs
index bbbe59038e..9bbf7a7de4 100644
--- a/crates/common_types/src/payments.rs
+++ b/crates/common_types/src/payments.rs
@@ -1564,3 +1564,26 @@ pub enum TokenSource {
/// Apple Pay
ApplePay,
}
+
+/// External surcharge details from InterPayments (stored as JSONB)
+#[derive(
+ Clone,
+ Debug,
+ serde::Deserialize,
+ Eq,
+ ToSchema,
+ PartialEq,
+ serde::Serialize,
+ diesel::AsExpression,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct ExternalSurchargeDetails {
+ /// sTxId from InterPayments (the last one received before confirm)
+ pub external_surcharge_id: String,
+ /// Surcharge amount in minor units
+ pub external_surcharge_amount: MinorUnit,
+ /// Whether /v1/ch/sale has been successfully called
+ pub sale_notified: bool,
+}
+
+impl_to_sql_from_sql_json!(ExternalSurchargeDetails);
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 938e26d5b9..6a52078fa3 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -87,6 +87,7 @@ pub struct Profile {
pub network_tokenization_credentials: Option<Encryption>,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[cfg(feature = "v1")]
@@ -153,6 +154,7 @@ pub struct ProfileNew {
pub network_tokenization_credentials: Option<Encryption>,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[cfg(feature = "v1")]
@@ -220,6 +222,7 @@ pub struct ProfileUpdateInternal {
pub network_tokenization_credentials: Option<Encryption>,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[cfg(feature = "v1")]
@@ -281,6 +284,7 @@ impl ProfileUpdateInternal {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id,
+ surcharge_connector_details,
network_tokenization_credentials,
payment_method_blocking,
default_fallback_routing,
@@ -379,6 +383,8 @@ impl ProfileUpdateInternal {
external_vault_connector_details: external_vault_connector_details
.or(source.external_vault_connector_details),
billing_processor_id: billing_processor_id.or(source.billing_processor_id),
+ surcharge_connector_details: surcharge_connector_details
+ .or(source.surcharge_connector_details),
network_tokenization_credentials: network_tokenization_credentials
.or(source.network_tokenization_credentials),
payment_method_blocking: payment_method_blocking.or(source.payment_method_blocking),
@@ -456,6 +462,7 @@ pub struct Profile {
pub network_tokenization_credentials: Option<Encryption>,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -530,6 +537,7 @@ pub struct ProfileNew {
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
pub frm_routing_algorithm_id: Option<String>,
@@ -598,6 +606,7 @@ pub struct ProfileUpdateInternal {
pub frm_routing_algorithm_id: Option<String>,
pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
pub should_collect_cvv_during_payment:
Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,
@@ -640,6 +649,7 @@ impl ProfileUpdateInternal {
tax_connector_id,
is_tax_connector_enabled,
billing_processor_id,
+ surcharge_connector_details,
routing_algorithm_id,
order_fulfillment_time,
order_fulfillment_time_origin,
@@ -768,6 +778,8 @@ impl ProfileUpdateInternal {
always_enable_overcapture: None,
is_l2_l3_enabled: None,
billing_processor_id: billing_processor_id.or(source.billing_processor_id),
+ surcharge_connector_details: surcharge_connector_details
+ .or(source.surcharge_connector_details),
network_tokenization_credentials: source.network_tokenization_credentials,
payment_method_blocking: None,
}
@@ -800,6 +812,14 @@ pub struct VaultTokenField {
common_utils::impl_to_sql_from_sql_json!(ExternalVaultConnectorDetails);
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
+#[diesel(sql_type = diesel::sql_types::Jsonb)]
+pub struct SurchargeConnectorDetails {
+ pub surcharge_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+}
+
+common_utils::impl_to_sql_from_sql_json!(SurchargeConnectorDetails);
+
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct CardTestingGuardConfig {
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 30a3299865..f4c1ca2b20 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -168,6 +168,7 @@ pub struct PaymentAttempt {
pub error_details: Option<ErrorDetails>,
pub retry_type: Option<storage_enums::RetryType>,
pub installment_data: Option<common_types::payments::InstallmentData>,
+ pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
#[diesel(deserialize_as = RequiredFromNullable<storage_enums::PaymentMethod>)]
pub payment_method_type_v2: storage_enums::PaymentMethod,
pub connector_payment_id: Option<ConnectorTransactionId>,
@@ -300,6 +301,8 @@ pub struct PaymentAttempt {
/// Indicates the type of retry for this payment attempt (None for initial attempt)
pub retry_type: Option<storage_enums::RetryType>,
pub installment_data: Option<common_types::payments::InstallmentData>,
+ /// External surcharge details from InterPayments (stored as JSONB)
+ pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
}
#[cfg(feature = "v1")]
@@ -453,6 +456,7 @@ pub struct PaymentAttemptNew {
pub encrypted_payment_method_data: Option<common_utils::encryption::Encryption>,
pub error_details: Option<ErrorDetails>,
pub retry_type: Option<storage_enums::RetryType>,
+ pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
}
#[cfg(feature = "v1")]
@@ -547,6 +551,7 @@ pub struct PaymentAttemptNew {
/// Indicates the type of retry for this payment attempt (None for initial attempt)
pub retry_type: Option<storage_enums::RetryType>,
pub installment_data: Option<common_types::payments::InstallmentData>,
+ pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
}
#[cfg(feature = "v1")]
@@ -1131,6 +1136,7 @@ impl PaymentAttemptUpdateInternal {
routing_result: source.routing_result,
authentication_applied: source.authentication_applied,
external_reference_id: source.external_reference_id,
+ external_surcharge_details: source.external_surcharge_details,
tax_on_surcharge: source.tax_on_surcharge,
payment_method_billing_address: source.payment_method_billing_address,
redirection_data: redirection_data.or(source.redirection_data),
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index d54b816f07..26d9849f28 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -321,6 +321,7 @@ diesel::table! {
network_tokenization_credentials -> Nullable<Bytea>,
payment_method_blocking -> Nullable<Jsonb>,
default_fallback_routing -> Nullable<Jsonb>,
+ surcharge_connector_details -> Nullable<Jsonb>,
}
}
@@ -1199,6 +1200,7 @@ diesel::table! {
#[max_length = 64]
retry_type -> Nullable<Varchar>,
installment_data -> Nullable<Jsonb>,
+ external_surcharge_details -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index d0915b4725..783142cf3c 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -316,6 +316,7 @@ diesel::table! {
network_tokenization_credentials -> Nullable<Bytea>,
payment_method_blocking -> Nullable<Jsonb>,
default_fallback_routing -> Nullable<Jsonb>,
+ surcharge_connector_details -> Nullable<Jsonb>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>,
@@ -1140,6 +1141,7 @@ diesel::table! {
#[max_length = 64]
retry_type -> Nullable<Varchar>,
installment_data -> Nullable<Jsonb>,
+ external_surcharge_details -> Nullable<Jsonb>,
payment_method_type_v2 -> Nullable<Varchar>,
#[max_length = 128]
connector_payment_id -> Nullable<Varchar>,
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index df62e70e8f..d699a4bfe9 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -322,6 +322,7 @@ impl PaymentAttemptBatchNew {
error_details: None,
retry_type: None,
installment_data: None,
+ external_surcharge_details: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 7a8f193b8d..0fcbc30e79 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -16,7 +16,7 @@ use diesel_models::business_profile::RevenueRecoveryAlgorithmData;
use diesel_models::business_profile::{
self as storage_types, AuthenticationConnectorDetails, BusinessPaymentLinkConfig,
BusinessPayoutLinkConfig, CardTestingGuardConfig, ExternalVaultConnectorDetails,
- PaymentMethodBlockingConfig, ProfileUpdateInternal, WebhookDetails,
+ PaymentMethodBlockingConfig, ProfileUpdateInternal, SurchargeConnectorDetails, WebhookDetails,
};
use error_stack::ResultExt;
use hyperswitch_masking::{ExposeInterface, PeekInterface, Secret};
@@ -91,6 +91,7 @@ pub struct Profile {
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub network_tokenization_credentials: OptionalEncryptableValue,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
@@ -252,6 +253,7 @@ pub struct ProfileSetter {
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub network_tokenization_credentials: OptionalEncryptableValue,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
@@ -323,6 +325,7 @@ impl From<ProfileSetter> for Profile {
always_enable_overcapture: value.always_enable_overcapture,
external_vault_details: value.external_vault_details,
billing_processor_id: value.billing_processor_id,
+ surcharge_connector_details: value.surcharge_connector_details,
network_tokenization_credentials: value.network_tokenization_credentials,
payment_method_blocking: value.payment_method_blocking,
default_fallback_routing: value.default_fallback_routing,
@@ -397,6 +400,7 @@ pub struct ProfileGeneralUpdate {
pub is_external_vault_enabled: Option<common_enums::ExternalVaultEnabled>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub network_tokenization_credentials: OptionalEncryptableValue,
pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
@@ -492,6 +496,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id,
+ surcharge_connector_details,
network_tokenization_credentials,
payment_method_blocking,
} = *update;
@@ -561,6 +566,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id,
+ surcharge_connector_details,
network_tokenization_credentials: network_tokenization_credentials
.map(Encryption::from),
payment_method_blocking,
@@ -626,6 +632,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: None,
payment_method_blocking: None,
@@ -688,6 +695,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: None,
payment_method_blocking: None,
@@ -750,6 +758,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: None,
payment_method_blocking: None,
@@ -812,6 +821,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: None,
payment_method_blocking: None,
@@ -875,6 +885,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: network_tokenization_credentials
.map(Encryption::from),
@@ -938,6 +949,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: None,
payment_method_blocking: None,
@@ -1000,6 +1012,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
network_tokenization_credentials: None,
payment_method_blocking: None,
@@ -1062,6 +1075,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled: None,
external_vault_connector_details: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
is_l2_l3_enabled: None,
payment_method_blocking: None,
default_fallback_routing,
@@ -1148,6 +1162,7 @@ impl Conversion for Profile {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id: self.billing_processor_id,
+ surcharge_connector_details: self.surcharge_connector_details,
network_tokenization_credentials: self
.network_tokenization_credentials
.map(|name| name.into()),
@@ -1298,6 +1313,7 @@ impl Conversion for Profile {
always_enable_overcapture: item.always_enable_overcapture,
external_vault_details,
billing_processor_id: item.billing_processor_id,
+ surcharge_connector_details: item.surcharge_connector_details,
network_tokenization_credentials,
payment_method_blocking: item.payment_method_blocking,
default_fallback_routing: item.default_fallback_routing,
@@ -1370,6 +1386,7 @@ impl Conversion for Profile {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id: self.billing_processor_id,
+ surcharge_connector_details: self.surcharge_connector_details,
network_tokenization_credentials: self
.network_tokenization_credentials
.map(|name| name.into()),
@@ -1438,6 +1455,7 @@ pub struct Profile {
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub split_txns_enabled: common_enums::SplitTxnsEnabled,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[cfg(feature = "v2")]
@@ -1497,6 +1515,7 @@ pub struct ProfileSetter {
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub split_txns_enabled: common_enums::SplitTxnsEnabled,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[cfg(feature = "v2")]
@@ -1561,6 +1580,7 @@ impl From<ProfileSetter> for Profile {
merchant_country_code: value.merchant_country_code,
split_txns_enabled: value.split_txns_enabled,
billing_processor_id: value.billing_processor_id,
+ surcharge_connector_details: value.surcharge_connector_details,
}
}
}
@@ -1812,6 +1832,7 @@ pub struct ProfileGeneralUpdate {
pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
}
#[cfg(feature = "v2")]
@@ -1895,6 +1916,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
revenue_recovery_retry_algorithm_type,
split_txns_enabled,
billing_processor_id,
+ surcharge_connector_details,
} = *update;
Self {
profile_name,
@@ -1951,6 +1973,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code,
split_txns_enabled,
billing_processor_id,
+ surcharge_connector_details,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -2010,6 +2033,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -2067,6 +2091,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -2124,6 +2149,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
@@ -2181,6 +2207,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -2238,6 +2265,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
@@ -2295,6 +2323,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
@@ -2352,6 +2381,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -2409,6 +2439,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
ProfileUpdate::RevenueRecoveryAlgorithmUpdate {
revenue_recovery_retry_algorithm_type,
@@ -2467,6 +2498,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
+ surcharge_connector_details: None,
},
}
}
@@ -2551,6 +2583,7 @@ impl Conversion for Profile {
is_l2_l3_enabled: None,
always_enable_overcapture: None,
billing_processor_id: self.billing_processor_id,
+ surcharge_connector_details: self.surcharge_connector_details,
network_tokenization_credentials: None,
payment_method_blocking: None,
})
@@ -2650,6 +2683,7 @@ impl Conversion for Profile {
merchant_country_code: item.merchant_country_code,
split_txns_enabled: item.split_txns_enabled.unwrap_or_default(),
billing_processor_id: item.billing_processor_id,
+ surcharge_connector_details: item.surcharge_connector_details,
})
}
.await
@@ -2723,6 +2757,7 @@ impl Conversion for Profile {
merchant_country_code: self.merchant_country_code,
split_txns_enabled: Some(self.split_txns_enabled),
billing_processor_id: self.billing_processor_id,
+ surcharge_connector_details: self.surcharge_connector_details,
payment_method_blocking: None,
})
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 0ea7337d36..8a8c15afb3 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -830,6 +830,8 @@ pub struct PaymentAttempt {
pub network_transaction_id: Option<String>,
/// stores the authorized amount in case of partial authorization
pub authorized_amount: Option<MinorUnit>,
+ /// External surcharge details from InterPayments
+ pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
}
impl PaymentAttempt {
@@ -995,6 +997,7 @@ impl PaymentAttempt {
connector_request_reference_id: None,
network_transaction_id: None,
authorized_amount: None,
+ external_surcharge_details: None,
})
}
@@ -1087,6 +1090,7 @@ impl PaymentAttempt {
connector_request_reference_id: None,
network_transaction_id: None,
authorized_amount: None,
+ external_surcharge_details: None,
})
}
@@ -1186,6 +1190,7 @@ impl PaymentAttempt {
connector_request_reference_id: None,
network_transaction_id: None,
authorized_amount: None,
+ external_surcharge_details: None,
})
}
@@ -1310,6 +1315,7 @@ impl PaymentAttempt {
connector_request_reference_id,
network_transaction_id: None,
authorized_amount: None,
+ external_surcharge_details: None,
})
}
@@ -1426,6 +1432,8 @@ pub struct PaymentAttempt {
pub retry_type: Option<storage_enums::RetryType>,
/// Installment data selected by the customer (number of installments and billing frequency)
pub installment_data: Option<common_types::payments::InstallmentData>,
+ /// External surcharge details from InterPayments (stored as JSONB)
+ pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
}
#[cfg(feature = "v1")]
@@ -2939,6 +2947,7 @@ impl behaviour::Conversion for PaymentAttempt {
authorized_amount: self.authorized_amount,
encrypted_payment_method_data: self.encrypted_payment_method_data.map(Encryption::from),
retry_type: self.retry_type,
+ external_surcharge_details: self.external_surcharge_details,
})
}
@@ -3072,6 +3081,7 @@ impl behaviour::Conversion for PaymentAttempt {
error_details: storage_model.error_details.map(Into::into),
retry_type: storage_model.retry_type,
installment_data: storage_model.installment_data,
+ external_surcharge_details: storage_model.external_surcharge_details,
})
}
.await
@@ -3172,6 +3182,7 @@ impl behaviour::Conversion for PaymentAttempt {
error_details: self.error_details.map(Into::into),
retry_type: self.retry_type,
installment_data: self.installment_data,
+ external_surcharge_details: self.external_surcharge_details,
})
}
}
@@ -3247,6 +3258,7 @@ impl behaviour::Conversion for PaymentAttempt {
connector_request_reference_id,
network_transaction_id,
authorized_amount,
+ external_surcharge_details,
} = self;
let AttemptAmountDetails {
@@ -3356,6 +3368,7 @@ impl behaviour::Conversion for PaymentAttempt {
error_details: None,
retry_type: None,
installment_data: None,
+ external_surcharge_details: None,
})
}
@@ -3469,6 +3482,7 @@ impl behaviour::Conversion for PaymentAttempt {
payment_method_subtype: storage_model.payment_method_subtype,
authentication_applied: storage_model.authentication_applied,
external_reference_id: storage_model.external_reference_id,
+ external_surcharge_details: storage_model.external_surcharge_details,
connector: storage_model.connector,
payment_method_billing_address,
connector_token_details: storage_model.connector_token_details,
@@ -3545,6 +3559,7 @@ impl behaviour::Conversion for PaymentAttempt {
connector_request_reference_id,
network_transaction_id,
authorized_amount,
+ external_surcharge_details: _,
} = self;
let card_network = payment_method_data
@@ -3638,6 +3653,7 @@ impl behaviour::Conversion for PaymentAttempt {
.and_then(|details| details.network_error_message.clone()),
processor_merchant_id: Some(processor_merchant_id),
created_by: created_by.map(|created_by| created_by.to_string()),
+ external_surcharge_details: None,
connector_request_reference_id,
network_details: None,
tokenization: None,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 4208172995..7daf300484 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -322,6 +322,7 @@ Never share your secret api keys. Keep them guarded and secure.
common_types::connector_webhook_configuration::WebhookConfigType,
common_types::payments::PaymentIntentStateMetadata,
common_types::payments::PostCaptureVoidResponse,
+ common_types::payments::ExternalSurchargeDetails,
api_models::enums::PaymentChannel,
api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteRequest,
api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteResponse,
@@ -367,6 +368,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::PaymentMethodBlockingConfig,
api_models::admin::CardBlockingConfig,
api_models::admin::WalletBlockingConfig,
+ api_models::admin::SurchargeConnectorDetails,
api_models::merchant_connector_webhook_management::ConnectorWebhookRegisterRequest,
api_models::merchant_connector_webhook_management::RegisterConnectorWebhookResponse,
api_models::merchant_connector_webhook_management::ConnectorWebhookResponse,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 06aeaa9455..961ef05af6 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -245,6 +245,7 @@ Never share your secret api keys. Keep them guarded and secure.
common_types::payments::StripeChargeResponseData,
common_types::payments::PaymentIntentStateMetadata,
common_types::payments::PostCaptureVoidResponse,
+ common_types::payments::ExternalSurchargeDetails,
common_types::three_ds_decision_rule_engine::ThreeDSDecisionRule,
common_types::three_ds_decision_rule_engine::ThreeDSDecision,
api_models::payments::CartesBancairesParams,
@@ -281,6 +282,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::BusinessPayoutLinkConfig,
api_models::admin::MerchantConnectorAccountFeatureMetadata,
api_models::admin::RevenueRecoveryMetadata,
+ api_models::admin::SurchargeConnectorDetails,
api_models::customers::CustomerRequest,
api_models::customers::CustomerUpdateRequest,
api_models::customers::CustomerDeleteResponse,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 5a4efdb26e..1543897d92 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3684,6 +3684,9 @@ impl ProfileCreateBridge for api::ProfileCreate {
network_tokenization_credentials,
payment_method_blocking: self.payment_method_blocking.map(ForeignInto::foreign_into),
default_fallback_routing: None,
+ surcharge_connector_details: self
+ .surcharge_connector_details
+ .map(ForeignInto::foreign_into),
}))
}
@@ -3841,6 +3844,9 @@ impl ProfileCreateBridge for api::ProfileCreate {
merchant_country_code: self.merchant_country_code,
split_txns_enabled: self.split_txns_enabled.unwrap_or_default(),
billing_processor_id: self.billing_processor_id,
+ surcharge_connector_details: self
+ .surcharge_connector_details
+ .map(ForeignInto::foreign_into),
}))
}
}
@@ -4209,6 +4215,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
payment_method_blocking: self
.payment_method_blocking
.map(ForeignInto::foreign_into),
+ surcharge_connector_details: self
+ .surcharge_connector_details
+ .map(ForeignInto::foreign_into),
},
)))
}
@@ -4360,6 +4369,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
revenue_recovery_retry_algorithm_type,
split_txns_enabled: self.split_txns_enabled,
billing_processor_id: self.billing_processor_id,
+ surcharge_connector_details: self
+ .surcharge_connector_details
+ .map(ForeignInto::foreign_into),
},
)))
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index ff5b475657..610787d3c5 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -5378,6 +5378,7 @@ impl AttemptType {
error_details: None,
retry_type: Some(enums::RetryType::ManualRetry),
installment_data: None,
+ external_surcharge_details: None,
}
}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 9769a89dfd..1e269822a6 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1704,6 +1704,7 @@ impl PaymentCreate {
error_details: None,
retry_type: None,
installment_data: None,
+ external_surcharge_details: None,
},
additional_pm_data,
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index a8a36687d5..82e057bdde 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -865,6 +865,7 @@ pub fn make_new_auto_retry_payment_attempt(
error_details: Default::default(),
retry_type: Some(storage_enums::RetryType::AutoRetry),
installment_data: Default::default(),
+ external_surcharge_details: Default::default(),
}
}
diff --git a/crates/router/src/core/split_payments.rs b/crates/router/src/core/split_payments.rs
index ee370a9f1e..e4c447bed1 100644
--- a/crates/router/src/core/split_payments.rs
+++ b/crates/router/src/core/split_payments.rs
@@ -595,5 +595,6 @@ pub async fn create_domain_model_for_split_payment(
connector_request_reference_id: None,
network_transaction_id: None,
authorized_amount: None,
+ external_surcharge_details: None,
})
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index fe87d2fde6..7d7f327297 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -1394,6 +1394,7 @@ mod tests {
authentication_product_ids: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
+ surcharge_connector_details: None,
is_clear_pan_retries_enabled: false,
force_3ds_challenge: false,
is_debit_routing_enabled: false,
diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rs
index 37e7935620..02d17eea69 100644
--- a/crates/router/src/services/kafka/payment_attempt.rs
+++ b/crates/router/src/services/kafka/payment_attempt.rs
@@ -286,6 +286,7 @@ impl<'a> KafkaPaymentAttempt<'a> {
connector_request_reference_id,
network_transaction_id: _,
authorized_amount: _,
+ external_surcharge_details: _,
} = attempt;
let (connector_payment_id, connector_payment_data) = connector_payment_id
diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rs
index 79ac64c751..99312dec6a 100644
--- a/crates/router/src/services/kafka/payment_attempt_event.rs
+++ b/crates/router/src/services/kafka/payment_attempt_event.rs
@@ -288,6 +288,7 @@ impl<'a> KafkaPaymentAttemptEvent<'a> {
connector_request_reference_id,
network_transaction_id: _,
authorized_amount: _,
+ external_surcharge_details: _,
} = attempt;
let (connector_payment_id, connector_payment_data) = connector_payment_id
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index cf60d2e9a7..e46fbb5768 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -267,6 +267,9 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
is_l2_l3_enabled: Some(item.is_l2_l3_enabled),
network_tokenization_credentials,
payment_method_blocking: item.payment_method_blocking.map(ForeignInto::foreign_into),
+ surcharge_connector_details: item
+ .surcharge_connector_details
+ .map(ForeignFrom::foreign_from),
})
}
}
@@ -357,6 +360,9 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
split_txns_enabled: item.split_txns_enabled,
revenue_recovery_retry_algorithm_type: item.revenue_recovery_retry_algorithm_type,
billing_processor_id: item.billing_processor_id,
+ surcharge_connector_details: item
+ .surcharge_connector_details
+ .map(ForeignInto::foreign_into),
})
}
}
@@ -543,5 +549,8 @@ pub async fn create_profile_from_merchant_account(
network_tokenization_credentials: None, // since credentials are at merchant level, they should not be in the profile, tracked in issue #15134
payment_method_blocking: None,
default_fallback_routing: None,
+ surcharge_connector_details: request
+ .surcharge_connector_details
+ .map(ForeignInto::foreign_into),
}))
}
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 788e29edf3..617e9f8818 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -245,6 +245,7 @@ mod tests {
error_details: Default::default(),
retry_type: Default::default(),
installment_data: Default::default(),
+ external_surcharge_details: Default::default(),
};
let store = state
@@ -365,6 +366,7 @@ mod tests {
error_details: Default::default(),
retry_type: Default::default(),
installment_data: Default::default(),
+ external_surcharge_details: Default::default(),
};
let store = state
.stores
@@ -499,6 +501,7 @@ mod tests {
error_details: Default::default(),
retry_type: Default::default(),
installment_data: Default::default(),
+ external_surcharge_details: Default::default(),
};
let store = state
.stores
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 0cf7a84507..5e3a8032fb 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -2201,6 +2201,26 @@ impl ForeignFrom<diesel_models::business_profile::VaultTokenField>
}
}
+impl ForeignFrom<api_models::admin::SurchargeConnectorDetails>
+ for diesel_models::business_profile::SurchargeConnectorDetails
+{
+ fn foreign_from(item: api_models::admin::SurchargeConnectorDetails) -> Self {
+ Self {
+ surcharge_connector_id: item.surcharge_connector_id,
+ }
+ }
+}
+
+impl ForeignFrom<diesel_models::business_profile::SurchargeConnectorDetails>
+ for api_models::admin::SurchargeConnectorDetails
+{
+ fn foreign_from(item: diesel_models::business_profile::SurchargeConnectorDetails) -> Self {
+ Self {
+ surcharge_connector_id: item.surcharge_connector_id,
+ }
+ }
+}
+
impl ForeignFrom<api_models::admin::CardTestingGuardConfig>
for diesel_models::business_profile::CardTestingGuardConfig
{
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 1a2e18646d..aa55ee48dc 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -250,6 +250,7 @@ impl PaymentAttemptInterface for MockDb {
error_details: payment_attempt.error_details,
retry_type: payment_attempt.retry_type,
installment_data: payment_attempt.installment_data,
+ external_surcharge_details: payment_attempt.external_surcharge_details,
};
payment_attempts.push(payment_attempt.clone());
Ok(payment_attempt)
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index ee2b3ee368..90dee9867c 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -848,6 +848,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.clone(),
retry_type: payment_attempt.retry_type,
installment_data: payment_attempt.installment_data.clone(),
+ external_surcharge_details: payment_attempt.external_surcharge_details.clone(),
};
let field = format!("pa_{}", created_attempt.attempt_id);
diff --git a/migrations/2026-04-24-153740_add_surcharge_connector_id_to_business_profile/down.sql b/migrations/2026-04-24-153740_add_surcharge_connector_id_to_business_profile/down.sql
new file mode 100644
index 0000000000..dc4ecdff60
--- /dev/null
+++ b/migrations/2026-04-24-153740_add_surcharge_connector_id_to_business_profile/down.sql
@@ -0,0 +1,2 @@
+-- Remove surcharge_connector_details from business_profile table
+ALTER TABLE business_profile DROP COLUMN IF EXISTS surcharge_connector_details;
diff --git a/migrations/2026-04-24-153740_add_surcharge_connector_id_to_business_profile/up.sql b/migrations/2026-04-24-153740_add_surcharge_connector_id_to_business_profile/up.sql
new file mode 100644
index 0000000000..d95a98143e
--- /dev/null
+++ b/migrations/2026-04-24-153740_add_surcharge_connector_id_to_business_profile/up.sql
@@ -0,0 +1,2 @@
+-- Add surcharge_connector_details to business_profile table
+ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS surcharge_connector_details JSONB;
diff --git a/migrations/2026-04-24-153741_add_external_surcharge_details_to_payment_attempt/down.sql b/migrations/2026-04-24-153741_add_external_surcharge_details_to_payment_attempt/down.sql
new file mode 100644
index 0000000000..7a650ed158
--- /dev/null
+++ b/migrations/2026-04-24-153741_add_external_surcharge_details_to_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+-- Remove external_surcharge_details from payment_attempt table
+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS external_surcharge_details;
diff --git a/migrations/2026-04-24-153741_add_external_surcharge_details_to_payment_attempt/up.sql b/migrations/2026-04-24-153741_add_external_surcharge_details_to_payment_attempt/up.sql
new file mode 100644
index 0000000000..ab11e8e9f1
--- /dev/null
+++ b/migrations/2026-04-24-153741_add_external_surcharge_details_to_payment_attempt/up.sql
@@ -0,0 +1,2 @@
+-- Add external_surcharge_details to payment_attempt table
+ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS external_surcharge_details JSONB;