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(authentication): Add Oss calling SaaS functionality for modular authentication (#12690)

Sahkal Poddar95a3617a06e6
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index a3cd4df6da..277d7b9811 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -37662,9 +37662,11 @@
"nullable": true
},
"acquirer_country_code": {
- "type": "string",
- "description": "Acquirer country code",
- "example": "US",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
"nullable": true
},
"profile_id": {
@@ -37786,8 +37788,11 @@
"nullable": true
},
"acquirer_country_code": {
- "type": "string",
- "example": "US",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
"nullable": true
},
"is_default": {
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index be100bce6f..127a280efd 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -1044,7 +1044,3 @@ ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list
"28" = { description = "Retry after 6 days", recommended_action = "retry_after_6_days" }
"29" = { description = "Retry after 8 days", recommended_action = "retry_after_8_days" }
"30" = { description = "Retry after 10 days", recommended_action = "retry_after_10_days" }
-
-[micro_services.authentication_service]
-base_url = "http://localhost:8080"
-api_key = "api-key"
\ No newline at end of file
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 6101c17943..8b92253fdf 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -1052,7 +1052,3 @@ ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list
"28" = { description = "Retry after 6 days", recommended_action = "retry_after_6_days" }
"29" = { description = "Retry after 8 days", recommended_action = "retry_after_8_days" }
"30" = { description = "Retry after 10 days", recommended_action = "retry_after_10_days" }
-
-[micro_services.authentication_service]
-base_url = "https://api.hyperswitch.io"
-api_key = "api-key"
\ No newline at end of file
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index d141346cf3..4e11e6ee0b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -1063,7 +1063,3 @@ ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list
"28" = { description = "Retry after 6 days", recommended_action = "retry_after_6_days" }
"29" = { description = "Retry after 8 days", recommended_action = "retry_after_8_days" }
"30" = { description = "Retry after 10 days", recommended_action = "retry_after_10_days" }
-
-[micro_services.authentication_service]
-base_url = "http://localhost:8080"
-api_key = "api-key"
\ No newline at end of file
diff --git a/config/development.toml b/config/development.toml
index 486e63fb57..d426b8eea4 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1577,7 +1577,3 @@ backup_file_path = "./config/superposition_seed.toml" # Path to a local file for
payment_methods_base_url = "http://localhost:8082"
payment_methods_prefix = "v2"
use_legacy_locker = false
-
-[micro_services.authentication_service]
-base_url = "http://localhost:8080"
-api_key = "api-key"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 57aef49bfa..ed1fd4afe6 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1443,7 +1443,3 @@ backup_file_path = "./config/superposition_seed.toml" # Path to a local file for
"28" = { description = "Retry after 6 days", recommended_action = "retry_after_6_days" }
"29" = { description = "Retry after 8 days", recommended_action = "retry_after_8_days" }
"30" = { description = "Retry after 10 days", recommended_action = "retry_after_10_days" }
-
-[micro_services.authentication_service]
-base_url = "http://localhost:8080"
-api_key = "api-key"
diff --git a/crates/api_models/src/profile_acquirer.rs b/crates/api_models/src/profile_acquirer.rs
index 2dabfa325e..85abdd3e96 100644
--- a/crates/api_models/src/profile_acquirer.rs
+++ b/crates/api_models/src/profile_acquirer.rs
@@ -22,8 +22,8 @@ pub struct ProfileAcquirerCreate {
#[schema(value_type= Option<f64>,example = 0.01)]
pub acquirer_fraud_rate: Option<f64>,
/// Acquirer country code
- #[schema(value_type= Option<String>,example = "US")]
- pub acquirer_country_code: Option<String>,
+ #[schema(value_type= Option<CountryAlpha2>,example = "US")]
+ pub acquirer_country_code: Option<common_enums::CountryAlpha2>,
/// Parent profile id to link the acquirer account with
#[schema(value_type= String,example = "pro_ky0yNyOXXlA5hF8JzE5q")]
pub profile_id: common_utils::id_type::ProfileId,
@@ -167,8 +167,8 @@ pub struct ProfileAcquirerUpdate {
pub acquirer_ica: Option<String>,
#[schema(value_type = Option<f64>, example = "0.02")]
pub acquirer_fraud_rate: Option<f64>,
- #[schema(value_type = Option<String>, example = "US")]
- pub acquirer_country_code: Option<String>,
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub acquirer_country_code: Option<common_enums::CountryAlpha2>,
/// Whether this configuration bucket is the default fallback for the profile.
pub is_default: Option<bool>,
}
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 3ee7ebade6..a3e38b645b 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -171,6 +171,7 @@ pub struct PaymentAttempt {
pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
pub network_transaction_link_id: Option<String>,
pub sender_payment_instrument_id: Option<String>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
#[diesel(deserialize_as = RequiredFromNullable<storage_enums::PaymentMethod>)]
pub payment_method_type_v2: storage_enums::PaymentMethod,
pub connector_payment_id: Option<ConnectorTransactionId>,
@@ -308,6 +309,7 @@ pub struct PaymentAttempt {
pub network_transaction_link_id: Option<String>,
/// A connector-specific identifier representing the stored payment instrument
pub sender_payment_instrument_id: Option<String>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
}
#[cfg(feature = "v1")]
@@ -422,6 +424,7 @@ pub struct PaymentAttemptNew {
pub unified_message: Option<String>,
pub net_amount: MinorUnit,
pub external_three_ds_authentication_attempted: Option<bool>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
pub authentication_connector: Option<String>,
pub authentication_id: Option<id_type::AuthenticationId>,
pub fingerprint_id: Option<String>,
@@ -560,6 +563,7 @@ pub struct PaymentAttemptNew {
pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
pub network_transaction_link_id: Option<String>,
pub sender_payment_instrument_id: Option<String>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
}
#[cfg(feature = "v1")]
@@ -628,6 +632,7 @@ pub enum PaymentAttemptUpdate {
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
payment_method_id: Option<String>,
external_three_ds_authentication_attempted: Option<bool>,
+ external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
authentication_connector: Option<String>,
authentication_id: Option<id_type::AuthenticationId>,
payment_method_billing_address_id: Option<String>,
@@ -778,6 +783,7 @@ pub enum PaymentAttemptUpdate {
AuthenticationUpdate {
status: storage_enums::AttemptStatus,
external_three_ds_authentication_attempted: Option<bool>,
+ external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
authentication_connector: Option<String>,
authentication_id: Option<id_type::AuthenticationId>,
updated_by: String,
@@ -1031,6 +1037,7 @@ pub struct PaymentAttemptUpdateInternal {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
// external_three_ds_authentication_attempted: Option<bool>,
+ // external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
// authentication_connector: Option<String>,
// authentication_id: Option<String>,
// fingerprint_id: Option<String>,
@@ -1121,6 +1128,7 @@ impl PaymentAttemptUpdateInternal {
net_amount: source.net_amount,
external_three_ds_authentication_attempted: source
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: source.external_threeds_authentication_type,
authentication_connector: source.authentication_connector,
authentication_id: source.authentication_id,
fingerprint_id: source.fingerprint_id,
@@ -1219,6 +1227,7 @@ pub struct PaymentAttemptUpdateInternal {
pub unified_code: Option<Option<String>>,
pub unified_message: Option<Option<String>>,
pub external_three_ds_authentication_attempted: Option<bool>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
pub authentication_connector: Option<String>,
pub authentication_id: Option<id_type::AuthenticationId>,
pub fingerprint_id: Option<String>,
@@ -1429,6 +1438,7 @@ impl PaymentAttemptUpdate {
unified_code,
unified_message,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
payment_method_billing_address_id,
@@ -1509,6 +1519,8 @@ impl PaymentAttemptUpdate {
unified_message: unified_message.unwrap_or(source.unified_message),
external_three_ds_authentication_attempted: external_three_ds_authentication_attempted
.or(source.external_three_ds_authentication_attempted),
+ external_threeds_authentication_type: external_threeds_authentication_type
+ .or(source.external_threeds_authentication_type),
authentication_connector: authentication_connector.or(source.authentication_connector),
authentication_id: authentication_id.or(source.authentication_id),
payment_method_billing_address_id: payment_method_billing_address_id
@@ -2891,6 +2903,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
client_source: None,
@@ -2966,6 +2979,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3024,6 +3038,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
surcharge_amount,
tax_amount,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
payment_method_billing_address_id,
@@ -3067,6 +3082,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
surcharge_amount,
tax_amount,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
payment_method_billing_address_id,
@@ -3162,6 +3178,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3242,6 +3259,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3322,6 +3340,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3402,6 +3421,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3479,6 +3499,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3598,6 +3619,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
tax_amount: None,
merchant_connector_id: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
tokenization,
@@ -3700,6 +3722,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_data: None,
encoded_data: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3773,6 +3796,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3860,6 +3884,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -3953,6 +3978,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4043,6 +4069,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4122,6 +4149,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4201,6 +4229,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4291,6 +4320,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4368,6 +4398,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4407,6 +4438,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
PaymentAttemptUpdate::AuthenticationUpdate {
status,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
updated_by,
@@ -4414,6 +4446,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
status: Some(status),
modified_at: common_utils::date_time::now(),
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
updated_by,
@@ -4541,6 +4574,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_data: None,
encoded_data: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4619,6 +4653,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_data: None,
encoded_data: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -4703,6 +4738,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code: None,
unified_message: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index e9e34c635d..0cf3a5d0ca 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1215,6 +1215,8 @@ diesel::table! {
network_transaction_link_id -> Nullable<Varchar>,
#[max_length = 255]
sender_payment_instrument_id -> Nullable<Varchar>,
+ #[max_length = 64]
+ external_threeds_authentication_type -> Nullable<Varchar>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 5042d49dc4..0443531dcc 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1156,6 +1156,8 @@ diesel::table! {
network_transaction_link_id -> Nullable<Varchar>,
#[max_length = 255]
sender_payment_instrument_id -> Nullable<Varchar>,
+ #[max_length = 64]
+ external_threeds_authentication_type -> Nullable<Varchar>,
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 b4fdbe4df2..3ec205e2e6 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -327,6 +327,7 @@ impl PaymentAttemptBatchNew {
installment_data: None,
external_surcharge_details: None,
sender_payment_instrument_id: None,
+ external_threeds_authentication_type: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index c4d942352c..0d1ee80eb9 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -777,6 +777,7 @@ pub struct PaymentAttempt {
/// Whether external 3DS authentication was attempted for this payment.
/// This is based on the configuration of the merchant in the business profile
pub external_three_ds_authentication_attempted: Option<bool>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
/// The connector that was used for external authentication
pub authentication_connector: Option<String>,
/// The foreign key reference to the authentication details
@@ -964,6 +965,7 @@ impl PaymentAttempt {
encoded_data: None,
merchant_connector_id: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -1057,6 +1059,7 @@ impl PaymentAttempt {
encoded_data: None,
merchant_connector_id: Some(request.merchant_connector_id.clone()),
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -1158,6 +1161,7 @@ impl PaymentAttempt {
encoded_data: None,
merchant_connector_id: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -1282,6 +1286,7 @@ impl PaymentAttempt {
encoded_data: None,
merchant_connector_id: request.payment_merchant_connector_id.clone(),
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
@@ -1386,6 +1391,7 @@ pub struct PaymentAttempt {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub external_three_ds_authentication_attempted: Option<bool>,
+ pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
pub authentication_connector: Option<String>,
pub authentication_id: Option<id_type::AuthenticationId>,
pub mandate_data: Option<MandateDetails>,
@@ -1981,6 +1987,7 @@ pub enum PaymentAttemptUpdate {
updated_by: String,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
external_three_ds_authentication_attempted: Option<bool>,
+ external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
authentication_connector: Option<String>,
authentication_id: Option<id_type::AuthenticationId>,
payment_method_billing_address_id: Option<String>,
@@ -2146,6 +2153,7 @@ pub enum PaymentAttemptUpdate {
AuthenticationUpdate {
status: storage_enums::AttemptStatus,
external_three_ds_authentication_attempted: Option<bool>,
+ external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
authentication_connector: Option<String>,
authentication_id: Option<id_type::AuthenticationId>,
updated_by: String,
@@ -2308,6 +2316,7 @@ impl PaymentAttemptUpdate {
merchant_connector_id: connector_id,
payment_method_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
payment_method_billing_address_id,
@@ -2348,6 +2357,7 @@ impl PaymentAttemptUpdate {
merchant_connector_id: connector_id,
payment_method_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
payment_method_billing_address_id,
@@ -2697,12 +2707,14 @@ impl PaymentAttemptUpdate {
Self::AuthenticationUpdate {
status,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
updated_by,
} => DieselPaymentAttemptUpdate::AuthenticationUpdate {
status,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
updated_by,
@@ -2944,6 +2956,7 @@ impl behaviour::Conversion for PaymentAttempt {
net_amount: Some(self.net_amount.get_total_amount()),
external_three_ds_authentication_attempted: self
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: self.external_threeds_authentication_type,
authentication_connector: self.authentication_connector,
authentication_id: self.authentication_id,
mandate_data: self.mandate_data.map(Into::into),
@@ -3080,6 +3093,8 @@ impl behaviour::Conversion for PaymentAttempt {
unified_message: storage_model.unified_message,
external_three_ds_authentication_attempted: storage_model
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: storage_model
+ .external_threeds_authentication_type,
authentication_connector: storage_model.authentication_connector,
authentication_id: storage_model.authentication_id,
mandate_data: storage_model.mandate_data.map(Into::into),
@@ -3191,6 +3206,7 @@ impl behaviour::Conversion for PaymentAttempt {
net_amount: Some(self.net_amount.get_total_amount()),
external_three_ds_authentication_attempted: self
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: self.external_threeds_authentication_type,
authentication_connector: self.authentication_connector,
authentication_id: self.authentication_id,
mandate_data: self.mandate_data.map(Into::into),
@@ -3276,6 +3292,7 @@ impl behaviour::Conversion for PaymentAttempt {
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
fingerprint_id,
@@ -3362,6 +3379,7 @@ impl behaviour::Conversion for PaymentAttempt {
.and_then(|details| details.unified_message.clone()),
net_amount,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
fingerprint_id,
@@ -3517,6 +3535,8 @@ impl behaviour::Conversion for PaymentAttempt {
merchant_connector_id: storage_model.merchant_connector_id,
external_three_ds_authentication_attempted: storage_model
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: storage_model
+ .external_threeds_authentication_type,
authentication_connector: storage_model.authentication_connector,
authentication_id: storage_model.authentication_id,
fingerprint_id: storage_model.fingerprint_id,
@@ -3581,6 +3601,7 @@ impl behaviour::Conversion for PaymentAttempt {
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
fingerprint_id,
@@ -3664,6 +3685,7 @@ impl behaviour::Conversion for PaymentAttempt {
.and_then(|details| details.unified_message.clone()),
net_amount: amount_details.net_amount,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
fingerprint_id,
diff --git a/crates/payment_methods/src/configs.rs b/crates/payment_methods/src/configs.rs
index 8b198b2500..cbe7c412ca 100644
--- a/crates/payment_methods/src/configs.rs
+++ b/crates/payment_methods/src/configs.rs
@@ -13,7 +13,7 @@ pub struct MicroServicesConfig {
pub payment_methods_base_url: ModularPaymentMethodServiceUrl,
pub payment_methods_prefix: ModularPaymentMethodServicePrefix,
pub use_legacy_locker: bool,
- pub authentication_service: AuthenticationServiceConfig,
+ pub authentication_service: Option<AuthenticationServiceConfig>,
}
/// Configuration for the authentication microservice.
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 192564ef2e..019edc099d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4981,20 +4981,9 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.authentication_id
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("missing authentication_id in payment_attempt")?;
- let key_manager_state = &(state).into();
- let authentication = state
- .store
- .find_authentication_by_merchant_id_authentication_id(
- platform.get_processor().get_account().get_id(),
- &authentication_id,
- platform.get_processor().get_key_store(),
- key_manager_state,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::AuthenticationNotFound {
- id: authentication_id.get_string_repr().to_string(),
- })?;
+
// Fetching merchant_connector_account to check if pull_mechanism is enabled for 3ds connector
+
let authentication_merchant_connector_account = helpers::get_merchant_connector_account(
state,
platform.get_processor(),
@@ -5017,8 +5006,30 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.get_metadata()
.map(|metadata| metadata.expose()),
);
+
+ let payment_external_authentication_type =
+ if helpers::is_merchant_eligible_authentication_service(platform.get_processor(), state)
+ .await?
+ {
+ payment_attempt.external_threeds_authentication_type
+ } else {
+ let key_manager_state = &(state).into();
+ let authentication = state
+ .store
+ .find_authentication_by_merchant_id_authentication_id(
+ platform.get_processor().get_account().get_id(),
+ &authentication_id,
+ platform.get_processor().get_key_store(),
+ key_manager_state,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::AuthenticationNotFound {
+ id: authentication_id.get_string_repr().to_string(),
+ })?;
+ authentication.authentication_type
+ };
let response = if is_pull_mechanism_enabled
- || authentication.authentication_type
+ || payment_external_authentication_type
!= Some(common_enums::DecoupledAuthenticationType::Challenge)
{
let payment_confirm_req = api::PaymentsRequest {
@@ -12531,25 +12542,25 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("missing authentication_id in payment_attempt")?;
- let auth_config = &state.conf.micro_services.authentication_service;
-
- let req_identifier = router_env::RequestIdentifier::new("x-request-id");
- let client = crate::core::authentication_client::AuthenticationServiceClient::new(
- auth_config,
- &req_identifier,
- )
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to create auth client")?;
-
let authenticate_req = api_models::authentication::AuthenticationAuthenticateRequest {
- authentication_id,
+ authentication_id: authentication_id.clone(),
client_secret: None,
sdk_information: req.sdk_information.clone(),
device_channel: req.device_channel,
threeds_method_comp_ind: req.threeds_method_comp_ind,
};
+ // If micro service is enabled we do api call else do internal function call
+ let response = if let Some(auth_config) =
+ &state.conf.micro_services.authentication_service
+ {
+ let req_identifier = router_env::RequestIdentifier::new("x-request-id");
+ let client = crate::core::authentication_client::AuthenticationServiceClient::new(
+ auth_config,
+ &req_identifier,
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to create auth client")?;
- let response =
crate::core::authentication_client::AuthenticationAuthenticateFlow::call(
&state,
&client,
@@ -12557,7 +12568,54 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to call authentication authenticate flow")?;
+ .attach_printable("Failed to call authentication authenticate flow")?
+ } else {
+ crate::core::unified_authentication_service::authentication_authenticate_core(
+ state.clone(),
+ platform.clone(),
+ authenticate_req,
+ services::api::AuthFlow::Client,
+ )
+ .await?
+ .get_json_body()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "Failed to get json body from authentication authenticate response",
+ )?
+ };
+
+ let attempt_update = storage::PaymentAttemptUpdate::AuthenticationUpdate {
+ status: payment_attempt.status,
+ external_three_ds_authentication_attempted: Some(true),
+ external_threeds_authentication_type: response
+ .transaction_status
+ .as_ref()
+ .and_then(|transaction_status| {
+ match transaction_status {
+ common_enums::TransactionStatus::ChallengeRequired
+ | common_enums::TransactionStatus::ChallengeRequiredDecoupledAuthentication => {
+ Some(common_enums::DecoupledAuthenticationType::Challenge)
+ }
+ common_enums::TransactionStatus::Success => {
+ Some(common_enums::DecoupledAuthenticationType::Frictionless)
+ }
+ _ => None,
+ }
+ }),
+ authentication_connector: response.authentication_connector.map(|c| c.to_string()),
+ authentication_id: Some(response.authentication_id.clone()),
+ updated_by: storage_scheme.to_string(),
+ };
+
+ db.update_payment_attempt_with_attempt_id(
+ payment_attempt.clone(),
+ attempt_update,
+ storage_scheme,
+ platform.get_processor().get_key_store(),
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+ .attach_printable("Error while updating the payment_attempt")?;
authentication::AuthenticationResponse {
trans_status: response
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index c8ca0de917..81d93b528d 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -5385,6 +5385,8 @@ impl AttemptType {
net_amount: old_payment_attempt.net_amount,
external_three_ds_authentication_attempted: old_payment_attempt
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: old_payment_attempt
+ .external_threeds_authentication_type,
authentication_connector: None,
authentication_id: None,
mandate_data: old_payment_attempt.mandate_data,
@@ -8494,22 +8496,27 @@ pub async fn get_payment_external_authentication_flow_during_confirm<F: Clone>(
.get_metadata()
.as_ref()
.and_then(|metadata| {
- metadata
- .peek()
- .clone()
- .parse_value::<authentication::types::AcquirerDetails>("AcquirerDetails")
- .change_context(errors::ApiErrorResponse::PreconditionFailed {
- message:
- "acquirer_bin and acquirer_merchant_id not found in Payment Connector's Metadata"
- .to_string(),
- })
- .inspect_err(|err| {
- logger::error!(
- "Failed to parse acquirer details from Payment Connector's Metadata: {:?}",
- err
- );
- })
- .ok()
+ let metadata_val = metadata.peek();
+ metadata_val
+ .get("acquirer_details")
+ .cloned()
+ .or_else(|| metadata_val.get("acquirer_bin").map(|_| metadata_val.clone()))
+ .and_then(|val| {
+ val.parse_value::<authentication::types::AcquirerDetails>(
+ "AcquirerDetails",
+ )
+ .change_context(errors::ApiErrorResponse::PreconditionFailed {
+ message: "acquirer_bin and acquirer_merchant_id not found in Payment Connector's Metadata"
+ .to_string(),
+ })
+ .inspect_err(|err| {
+ logger::error!(
+ "Failed to parse acquirer details from Payment Connector's Metadata: {:?}",
+ err
+ );
+ })
+ .ok()
+ })
}) {
Some(details) => Some(details),
None => {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index ea576f8004..a5ed714ddd 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -1956,35 +1956,19 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
field_name: "currency",
}).attach_printable("Currency missing")?;
- let req_identifier = router_env::RequestIdentifier::new("x-request-id");
- let client = crate::core::authentication_client::AuthenticationServiceClient::new(
- auth_config,
- &req_identifier,
- ).change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to create auth client")?;
-
let auth_req = api_models::authentication::AuthenticationCreateRequest {
- authentication_id: None,
- profile_id: None,
- amount: payment_data.payment_intent.amount,
- authentication_connector: Some(authentication_connector),
- currency,
- return_url: Some(return_url),
- force_3ds_challenge: payment_data.payment_intent.force_3ds_challenge,
- psd2_sca_exemption_type: payment_data.payment_intent.psd2_sca_exemption_type,
- profile_acquirer_id: None,
- acquirer_details: Some(authentication_acquirer_details),
- customer_details: None,
- };
-
- let auth_create_resp = crate::core::authentication_client::AuthenticationCreateFlow::call(
- state,
- &client,
- auth_req,
- ).await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to call authentication create flow")?;
- payment_data.payment_attempt.authentication_id = Some(auth_create_resp.authentication_id.clone());
+ authentication_id: None,
+ profile_id: None,
+ amount: payment_data.payment_intent.amount,
+ authentication_connector: Some(authentication_connector),
+ currency,
+ return_url: Some(return_url),
+ force_3ds_challenge: payment_data.payment_intent.force_3ds_challenge,
+ psd2_sca_exemption_type: payment_data.payment_intent.psd2_sca_exemption_type,
+ profile_acquirer_id: None,
+ acquirer_details: Some(authentication_acquirer_details),
+ customer_details: None,
+ };
let pm_data: api_models::payments::PaymentMethodData = match payment_data.payment_method_data.clone() {
Some(hyperswitch_domain_models::payment_method_data::PaymentMethodData::Card(card)) => {
@@ -2028,25 +2012,68 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
.attach_printable("payment_method not found in payment_attempt")?,
payment_method_type: payment_data.payment_attempt.payment_method_type,
client_secret: None,
- profile_id: payment_data.payment_intent.profile_id.clone(),
+ profile_id: None,
billing: domain_address,
shipping,
browser_information: browser_info.clone(),
email: email.clone(),
};
- let elig_resp = crate::core::authentication_client::AuthenticationEligibilityFlow::call(
- state,
- &client,
- (
+ // If micro service is enabled we do api call else do internal function call
+ if let Some(auth_config) = auth_config {
+ let req_identifier = router_env::RequestIdentifier::new("x-request-id");
+ let client = crate::core::authentication_client::AuthenticationServiceClient::new(
+ auth_config,
+ &req_identifier,
+ ).change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to create auth client")?;
+
+ let auth_create_resp = crate::core::authentication_client::AuthenticationCreateFlow::call(
+ state,
+ &client,
+ auth_req,
+ ).await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to call authentication create flow")?;
+
+ payment_data.payment_attempt.authentication_id = Some(auth_create_resp.authentication_id.clone());
+
+ let elig_resp = crate::core::authentication_client::AuthenticationEligibilityFlow::call(
+ state,
+ &client,
+ (
+ eligibility_req,
+ auth_create_resp.authentication_id.get_string_repr().to_owned(),
+ ),
+ ).await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to call authentication eligibility flow")?;
+
+ (auth_create_resp, elig_resp)
+ } else {
+ let auth_create_resp = crate::core::unified_authentication_service::authentication_create_core(
+ state.clone(),
+ platform.clone(),
+ auth_req
+ ).await?
+ .get_json_body()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to get json body from authentication create response")?;
+
+ payment_data.payment_attempt.authentication_id = Some(auth_create_resp.authentication_id.clone());
+
+ let elig_resp = crate::core::unified_authentication_service::authentication_eligibility_core(
+ state.clone(),
+ platform.clone(),
eligibility_req,
- auth_create_resp.authentication_id.get_string_repr().to_owned(),
- ),
- ).await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to call authentication eligibility flow")?;
+ auth_create_resp.authentication_id.clone(),
+ ).await?
+ .get_json_body()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to get json body from authentication eligibility response")?;
- (auth_create_resp, elig_resp)
+ (auth_create_resp, elig_resp)
+ }
};
if eligibility_response.is_separate_authn_required()
@@ -2110,8 +2137,14 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
);
let sync_response = if !payment_data.payment_attempt.status.is_terminal_status() && is_pull_mechanism_enabled {
- {
- let auth_config = &state.conf.micro_services.authentication_service;
+ let sync_req = api_models::authentication::AuthenticationSyncRequest {
+ client_secret: None,
+ payment_method_details: None,
+ authentication_id: authentication_id.clone(),
+ };
+
+ // If micro service is enabled we do api call else do internal function call
+ if let Some(auth_config) = &state.conf.micro_services.authentication_service {
let req_identifier = router_env::RequestIdentifier::new("x-request-id");
let client = crate::core::authentication_client::AuthenticationServiceClient::new(
auth_config,
@@ -2120,12 +2153,6 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to create auth client")?;
- let sync_req = api_models::authentication::AuthenticationSyncRequest {
- client_secret: None,
- payment_method_details: None,
- authentication_id: authentication_id.clone(),
- };
-
crate::core::authentication_client::AuthenticationSyncFlow::call(
state,
&client,
@@ -2133,7 +2160,17 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
).await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to call authentication sync flow")?
-
+ } else {
+ crate::core::unified_authentication_service::authentication_sync_core(
+ state.clone(),
+ platform.clone(),
+ services::api::AuthFlow::Merchant,
+ sync_req,
+ )
+ .await?
+ .get_json_body()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to get json body from authentication sync response")?
}
} else {
return Err(errors::ApiErrorResponse::InternalServerError).attach_printable("Pull mechanism disabled or terminal status during post-authentication sync")?;
@@ -2148,18 +2185,17 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
)
);
- let tokenized_data = if updated_authentication_status.is_success() {
- Some(crate::core::payment_methods::vault::get_tokenized_data(state, authentication_id.get_string_repr(), false, platform.get_provider().get_key_store().key.get_inner()).await?)
- } else {
- None
- };
+ let cryptogram = sync_response.authentication_details.and_then(|authentication_details| authentication_details.three_ds_data.and_then(|data| data.authentication_cryptogram)).ok_or(errors::ApiErrorResponse::MissingRequiredField{field_name:"authentication_cryptogram"})?;
- let authentication_store = hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore {
- cavv: tokenized_data.map(|tokenized_data| hyperswitch_masking::Secret::new(tokenized_data.value1)),
- authentication:authentication_domain_model
- };
+ let authentication_store =
+ hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore {
+ cavv: match cryptogram {
+ api_models::authentication::Cryptogram::Cavv { authentication_cryptogram } => Some(authentication_cryptogram),
+ },
+ authentication:authentication_domain_model
+ };
- payment_data.authentication = Some(authentication_store.clone());
+ payment_data.authentication = Some(authentication_store);
//If authentication is not successful, skip the payment connector flows and mark the payment as failure
if updated_authentication_status != api_models::enums::AuthenticationStatus::Success
{
@@ -2602,6 +2638,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
let (
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
) = match payment_data.authentication.as_ref() {
@@ -2611,6 +2648,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.authentication
.is_separate_authn_required(),
),
+ authentication_store.authentication.authentication_type,
authentication_store
.authentication
.authentication_connector
@@ -2622,7 +2660,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.clone(),
),
),
- None => (None, None, None),
+ None => (None, None, None, None),
};
let card_discovery = payment_data.get_card_discovery_for_card_payment_method();
@@ -2657,6 +2695,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
updated_by: storage_scheme.to_string(),
merchant_connector_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type,
authentication_connector,
authentication_id,
payment_method_billing_address_id,
diff --git a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
index 695c414531..a38951572b 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
@@ -420,6 +420,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsRequest>
updated_by: storage_scheme.to_string(),
merchant_connector_id,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
payment_method_billing_address_id: payment_data
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index d1b3ae4292..f0228e16f3 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1653,6 +1653,7 @@ impl PaymentCreate {
.as_ref()
.and_then(|inner| inner.mandate_type.clone().map(Into::into)),
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
mandate_data,
payment_method_billing_address_id,
net_amount: hyperswitch_domain_models::payments::payment_attempt::NetAmount::from_payments_request(
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 331a3deaa9..e17a79b961 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -2871,26 +2871,28 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
);
payment_data.payment_attempt = payment_attempt;
- let key_manager_state: KeyManagerState = state.into();
- payment_data.authentication = match payment_data.authentication {
- Some(mut authentication_store) => {
- let authentication_update = hyperswitch_domain_models::authentication::AuthenticationUpdate::PostAuthorizationUpdate {
+ if !(payments_helpers::is_merchant_eligible_authentication_service(processor, state).await?) {
+ let key_manager_state: KeyManagerState = state.into();
+ payment_data.authentication = match payment_data.authentication {
+ Some(mut authentication_store) => {
+ let authentication_update = hyperswitch_domain_models::authentication::AuthenticationUpdate::PostAuthorizationUpdate {
authentication_lifecycle_status: enums::AuthenticationLifecycleStatus::Used,
};
- let updated_authentication = state
- .store
- .update_authentication_by_merchant_id_authentication_id(
- authentication_store.authentication,
- authentication_update,
- processor.get_key_store(),
- &key_manager_state,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- authentication_store.authentication = updated_authentication;
- Some(authentication_store)
- }
- None => None,
+ let updated_authentication = state
+ .store
+ .update_authentication_by_merchant_id_authentication_id(
+ authentication_store.authentication,
+ authentication_update,
+ processor.get_key_store(),
+ &key_manager_state,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ authentication_store.authentication = updated_authentication;
+ Some(authentication_store)
+ }
+ None => None,
+ };
};
let amount_captured = get_total_amount_captured(
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index de394ba687..690cc8cb83 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -840,6 +840,7 @@ pub fn make_new_auto_retry_payment_attempt(
unified_code: Default::default(),
unified_message: Default::default(),
external_three_ds_authentication_attempted: Default::default(),
+ external_threeds_authentication_type: Default::default(),
authentication_connector: Default::default(),
authentication_id: Default::default(),
mandate_data: Default::default(),
diff --git a/crates/router/src/core/profile_acquirer.rs b/crates/router/src/core/profile_acquirer.rs
index 39e27f8703..393c41427a 100644
--- a/crates/router/src/core/profile_acquirer.rs
+++ b/crates/router/src/core/profile_acquirer.rs
@@ -44,7 +44,11 @@ pub async fn create_profile_acquirer(
acquirer_bin: Some(request.acquirer_bin.clone()),
acquirer_ica: request.acquirer_ica.clone(),
acquirer_fraud_rate: request.acquirer_fraud_rate,
- acquirer_country_code: request.acquirer_country_code.clone(),
+ acquirer_country_code: request.acquirer_country_code.map(|code| {
+ common_enums::Country::from_alpha2(code)
+ .to_numeric()
+ .to_string()
+ }),
};
// Initialize the new bucket as a Vec containing its first AcquirerConfig entry.
@@ -259,6 +263,12 @@ fn upsert_acquirer_config_in_bucket(
acquirer_country_code: None,
});
+ let request_acquirer_country_code = request.acquirer_country_code.map(|code| {
+ common_enums::Country::from_alpha2(code)
+ .to_numeric()
+ .to_string()
+ });
+
let upserted_config = common_types::domain::AcquirerConfig {
acquirer_assigned_merchant_id: request
.acquirer_assigned_merchant_id
@@ -268,10 +278,7 @@ fn upsert_acquirer_config_in_bucket(
acquirer_bin: request.acquirer_bin.clone().or(base.acquirer_bin),
acquirer_ica: request.acquirer_ica.clone().or(base.acquirer_ica),
acquirer_fraud_rate: request.acquirer_fraud_rate.or(base.acquirer_fraud_rate),
- acquirer_country_code: request
- .acquirer_country_code
- .clone()
- .or(base.acquirer_country_code),
+ acquirer_country_code: request_acquirer_country_code.or(base.acquirer_country_code),
network: base.network,
};
diff --git a/crates/router/src/core/split_payments.rs b/crates/router/src/core/split_payments.rs
index e81a10abb4..389a224b6d 100644
--- a/crates/router/src/core/split_payments.rs
+++ b/crates/router/src/core/split_payments.rs
@@ -566,6 +566,7 @@ pub async fn create_domain_model_for_split_payment(
encoded_data: None,
merchant_connector_id: None,
external_three_ds_authentication_attempted: None,
+ external_threeds_authentication_type: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rs
index cd82e8de63..7a52440368 100644
--- a/crates/router/src/services/kafka/payment_attempt.rs
+++ b/crates/router/src/services/kafka/payment_attempt.rs
@@ -261,6 +261,7 @@ impl<'a> KafkaPaymentAttempt<'a> {
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: _,
authentication_connector,
authentication_id,
fingerprint_id,
diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rs
index e549dcc3b0..2c6ecece51 100644
--- a/crates/router/src/services/kafka/payment_attempt_event.rs
+++ b/crates/router/src/services/kafka/payment_attempt_event.rs
@@ -263,6 +263,7 @@ impl<'a> KafkaPaymentAttemptEvent<'a> {
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: _,
authentication_connector,
authentication_id,
fingerprint_id,
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 23288159c0..747bd65ffe 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -208,6 +208,7 @@ mod tests {
unified_code: Default::default(),
unified_message: Default::default(),
external_three_ds_authentication_attempted: Default::default(),
+ external_threeds_authentication_type: Default::default(),
authentication_connector: Default::default(),
authentication_id: Default::default(),
mandate_data: Default::default(),
@@ -331,6 +332,7 @@ mod tests {
unified_code: Default::default(),
unified_message: Default::default(),
external_three_ds_authentication_attempted: Default::default(),
+ external_threeds_authentication_type: Default::default(),
authentication_connector: Default::default(),
authentication_id: Default::default(),
mandate_data: Default::default(),
@@ -468,6 +470,7 @@ mod tests {
unified_code: Default::default(),
unified_message: Default::default(),
external_three_ds_authentication_attempted: Default::default(),
+ external_threeds_authentication_type: Default::default(),
authentication_connector: Default::default(),
authentication_id: Default::default(),
mandate_data: Default::default(),
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 7c4db326f7..06b16ae9bf 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -214,6 +214,8 @@ impl PaymentAttemptInterface for MockDb {
unified_message: payment_attempt.unified_message,
external_three_ds_authentication_attempted: payment_attempt
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: payment_attempt
+ .external_threeds_authentication_type,
authentication_connector: payment_attempt.authentication_connector,
authentication_id: payment_attempt.authentication_id,
mandate_data: payment_attempt.mandate_data,
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 87c162aec0..cfe09000e0 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -767,6 +767,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
unified_message: payment_attempt.unified_message.clone(),
external_three_ds_authentication_attempted: payment_attempt
.external_three_ds_authentication_attempted,
+ external_threeds_authentication_type: payment_attempt
+ .external_threeds_authentication_type,
authentication_connector: payment_attempt.authentication_connector.clone(),
authentication_id: payment_attempt.authentication_id.clone(),
mandate_data: payment_attempt.mandate_data.clone(),
diff --git a/migrations/2026-06-10-110840_add-authentication-type-to-payment-attempt/down.sql b/migrations/2026-06-10-110840_add-authentication-type-to-payment-attempt/down.sql
new file mode 100644
index 0000000000..40bb912bf7
--- /dev/null
+++ b/migrations/2026-06-10-110840_add-authentication-type-to-payment-attempt/down.sql
@@ -0,0 +1 @@
+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS external_threeds_authentication_type;
diff --git a/migrations/2026-06-10-110840_add-authentication-type-to-payment-attempt/up.sql b/migrations/2026-06-10-110840_add-authentication-type-to-payment-attempt/up.sql
new file mode 100644
index 0000000000..d73c5751d2
--- /dev/null
+++ b/migrations/2026-06-10-110840_add-authentication-type-to-payment-attempt/up.sql
@@ -0,0 +1 @@
+ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS external_threeds_authentication_type VARCHAR(64);