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): external authentication related schema changes for existing tables (#3904)

Hrithikeshc09b2b3a2ae9
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 529482441c..a5a2db4f60 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -244,16 +244,6 @@ pub enum FrmConnectors {
Riskified,
}
-#[cfg(feature = "frm")]
-impl From<FrmConnectors> for RoutableConnectors {
- fn from(value: FrmConnectors) -> Self {
- match value {
- FrmConnectors::Signifyd => Self::Signifyd,
- FrmConnectors::Riskified => Self::Riskified,
- }
- }
-}
-
#[derive(
Clone,
Copy,
diff --git a/crates/data_models/src/payments.rs b/crates/data_models/src/payments.rs
index 713003d666..1682fbaf5b 100644
--- a/crates/data_models/src/payments.rs
+++ b/crates/data_models/src/payments.rs
@@ -55,4 +55,5 @@ pub struct PaymentIntent {
pub authorization_count: Option<i32>,
pub fingerprint_id: Option<String>,
pub session_expiry: Option<PrimitiveDateTime>,
+ pub request_external_three_ds_authentication: Option<bool>,
}
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index f8af02857f..356970fda0 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -159,6 +159,9 @@ pub struct PaymentAttempt {
pub merchant_connector_id: Option<String>,
pub unified_code: Option<String>,
pub unified_message: Option<String>,
+ pub external_three_ds_authentication_attempted: Option<bool>,
+ pub authentication_connector: Option<String>,
+ pub authentication_id: Option<String>,
pub mandate_data: Option<MandateDetails>,
pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
@@ -239,6 +242,9 @@ pub struct PaymentAttemptNew {
pub merchant_connector_id: Option<String>,
pub unified_code: Option<String>,
pub unified_message: Option<String>,
+ pub external_three_ds_authentication_attempted: Option<bool>,
+ pub authentication_connector: Option<String>,
+ pub authentication_id: Option<String>,
pub mandate_data: Option<MandateDetails>,
pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
@@ -312,6 +318,9 @@ pub enum PaymentAttemptUpdate {
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
merchant_connector_id: Option<String>,
+ external_three_ds_authentication_attempted: Option<bool>,
+ authentication_connector: Option<String>,
+ authentication_id: Option<String>,
payment_method_billing_address_id: Option<String>,
fingerprint_id: Option<String>,
},
@@ -409,6 +418,13 @@ pub enum PaymentAttemptUpdate {
amount: i64,
amount_capturable: i64,
},
+ AuthenticationUpdate {
+ status: storage_enums::AttemptStatus,
+ external_three_ds_authentication_attempted: Option<bool>,
+ authentication_connector: Option<String>,
+ authentication_id: Option<String>,
+ updated_by: String,
+ },
}
impl ForeignIDRef for PaymentAttempt {
diff --git a/crates/data_models/src/payments/payment_intent.rs b/crates/data_models/src/payments/payment_intent.rs
index b2fafeb92a..83b266c347 100644
--- a/crates/data_models/src/payments/payment_intent.rs
+++ b/crates/data_models/src/payments/payment_intent.rs
@@ -112,6 +112,7 @@ pub struct PaymentIntentNew {
pub authorization_count: Option<i32>,
pub fingerprint_id: Option<String>,
pub session_expiry: Option<PrimitiveDateTime>,
+ pub request_external_three_ds_authentication: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -167,6 +168,7 @@ pub enum PaymentIntentUpdate {
updated_by: String,
fingerprint_id: Option<String>,
session_expiry: Option<PrimitiveDateTime>,
+ request_external_three_ds_authentication: Option<bool>,
},
PaymentAttemptAndAttemptCountUpdate {
active_attempt_id: String,
@@ -233,6 +235,7 @@ pub struct PaymentIntentUpdateInternal {
pub authorization_count: Option<i32>,
pub fingerprint_id: Option<String>,
pub session_expiry: Option<PrimitiveDateTime>,
+ pub request_external_three_ds_authentication: Option<bool>,
}
impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
@@ -258,6 +261,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
updated_by,
fingerprint_id,
session_expiry,
+ request_external_three_ds_authentication,
} => Self {
amount: Some(amount),
currency: Some(currency),
@@ -279,6 +283,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
updated_by,
fingerprint_id,
session_expiry,
+ request_external_three_ds_authentication,
..Default::default()
},
PaymentIntentUpdate::MetadataUpdate {
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index ad66eb7f6f..d5d4f5d805 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -34,6 +34,7 @@ pub struct BusinessProfile {
pub applepay_verified_domains: Option<Vec<String>>,
pub payment_link_config: Option<serde_json::Value>,
pub session_expiry: Option<i64>,
+ pub authentication_connector_details: Option<serde_json::Value>,
}
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
@@ -59,6 +60,7 @@ pub struct BusinessProfileNew {
pub applepay_verified_domains: Option<Vec<String>>,
pub payment_link_config: Option<serde_json::Value>,
pub session_expiry: Option<i64>,
+ pub authentication_connector_details: Option<serde_json::Value>,
}
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
@@ -81,6 +83,7 @@ pub struct BusinessProfileUpdateInternal {
pub applepay_verified_domains: Option<Vec<String>>,
pub payment_link_config: Option<serde_json::Value>,
pub session_expiry: Option<i64>,
+ pub authentication_connector_details: Option<serde_json::Value>,
}
impl From<BusinessProfileNew> for BusinessProfile {
@@ -105,6 +108,7 @@ impl From<BusinessProfileNew> for BusinessProfile {
applepay_verified_domains: new.applepay_verified_domains,
payment_link_config: new.payment_link_config,
session_expiry: new.session_expiry,
+ authentication_connector_details: new.authentication_connector_details,
}
}
}
@@ -128,6 +132,7 @@ impl BusinessProfileUpdateInternal {
applepay_verified_domains,
payment_link_config,
session_expiry,
+ authentication_connector_details,
} = self;
BusinessProfile {
profile_name: profile_name.unwrap_or(source.profile_name),
@@ -148,6 +153,7 @@ impl BusinessProfileUpdateInternal {
applepay_verified_domains,
payment_link_config,
session_expiry,
+ authentication_connector_details,
..source
}
}
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index fa76697f55..284d078252 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -64,6 +64,9 @@ pub struct PaymentAttempt {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
+ pub external_three_ds_authentication_attempted: Option<bool>,
+ pub authentication_connector: Option<String>,
+ pub authentication_id: Option<String>,
pub mandate_data: Option<storage_enums::MandateDetails>,
pub fingerprint_id: Option<String>,
pub payment_method_billing_address_id: Option<String>,
@@ -141,6 +144,9 @@ pub struct PaymentAttemptNew {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
+ pub external_three_ds_authentication_attempted: Option<bool>,
+ pub authentication_connector: Option<String>,
+ pub authentication_id: Option<String>,
pub mandate_data: Option<storage_enums::MandateDetails>,
pub fingerprint_id: Option<String>,
pub payment_method_billing_address_id: Option<String>,
@@ -220,6 +226,9 @@ pub enum PaymentAttemptUpdate {
fingerprint_id: Option<String>,
updated_by: String,
merchant_connector_id: Option<String>,
+ external_three_ds_authentication_attempted: Option<bool>,
+ authentication_connector: Option<String>,
+ authentication_id: Option<String>,
payment_method_billing_address_id: Option<String>,
},
VoidUpdate {
@@ -316,6 +325,13 @@ pub enum PaymentAttemptUpdate {
amount: i64,
amount_capturable: i64,
},
+ AuthenticationUpdate {
+ status: storage_enums::AttemptStatus,
+ external_three_ds_authentication_attempted: Option<bool>,
+ authentication_connector: Option<String>,
+ authentication_id: Option<String>,
+ updated_by: String,
+ },
}
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
@@ -358,6 +374,9 @@ pub struct PaymentAttemptUpdateInternal {
encoded_data: Option<String>,
unified_code: Option<Option<String>>,
unified_message: Option<Option<String>>,
+ external_three_ds_authentication_attempted: Option<bool>,
+ authentication_connector: Option<String>,
+ authentication_id: Option<String>,
fingerprint_id: Option<String>,
payment_method_billing_address_id: Option<String>,
}
@@ -420,6 +439,9 @@ impl PaymentAttemptUpdate {
encoded_data,
unified_code,
unified_message,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
fingerprint_id,
} = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source);
@@ -463,6 +485,10 @@ impl PaymentAttemptUpdate {
encoded_data: encoded_data.or(source.encoded_data),
unified_code: unified_code.unwrap_or(source.unified_code),
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),
+ 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
.or(source.payment_method_billing_address_id),
fingerprint_id: fingerprint_id.or(source.fingerprint_id),
@@ -543,6 +569,9 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
merchant_connector_id,
surcharge_amount,
tax_amount,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
fingerprint_id,
} => Self {
@@ -567,6 +596,9 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
merchant_connector_id: merchant_connector_id.map(Some),
surcharge_amount,
tax_amount,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
fingerprint_id,
..Default::default()
@@ -782,6 +814,20 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
amount_capturable: Some(amount_capturable),
..Default::default()
},
+ PaymentAttemptUpdate::AuthenticationUpdate {
+ status,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
+ updated_by,
+ } => Self {
+ status: Some(status),
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
+ updated_by,
+ ..Default::default()
+ },
}
}
}
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index b14554e303..d1711c8ba0 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -57,6 +57,7 @@ pub struct PaymentIntent {
pub authorization_count: Option<i32>,
pub session_expiry: Option<PrimitiveDateTime>,
pub fingerprint_id: Option<String>,
+ pub request_external_three_ds_authentication: Option<bool>,
}
#[derive(
@@ -109,6 +110,7 @@ pub struct PaymentIntentNew {
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub session_expiry: Option<PrimitiveDateTime>,
pub fingerprint_id: Option<String>,
+ pub request_external_three_ds_authentication: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -164,6 +166,7 @@ pub enum PaymentIntentUpdate {
updated_by: String,
session_expiry: Option<PrimitiveDateTime>,
fingerprint_id: Option<String>,
+ request_external_three_ds_authentication: Option<bool>,
},
PaymentAttemptAndAttemptCountUpdate {
active_attempt_id: String,
@@ -231,6 +234,7 @@ pub struct PaymentIntentUpdateInternal {
pub authorization_count: Option<i32>,
pub session_expiry: Option<PrimitiveDateTime>,
pub fingerprint_id: Option<String>,
+ pub request_external_three_ds_authentication: Option<bool>,
}
impl PaymentIntentUpdate {
@@ -265,6 +269,7 @@ impl PaymentIntentUpdate {
authorization_count,
session_expiry,
fingerprint_id,
+ request_external_three_ds_authentication,
} = self.into();
PaymentIntent {
amount: amount.unwrap_or(source.amount),
@@ -300,6 +305,8 @@ impl PaymentIntentUpdate {
authorization_count: authorization_count.or(source.authorization_count),
fingerprint_id: fingerprint_id.or(source.fingerprint_id),
session_expiry: session_expiry.or(source.session_expiry),
+ request_external_three_ds_authentication: request_external_three_ds_authentication
+ .or(source.request_external_three_ds_authentication),
..source
}
}
@@ -328,6 +335,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
updated_by,
session_expiry,
fingerprint_id,
+ request_external_three_ds_authentication,
} => Self {
amount: Some(amount),
currency: Some(currency),
@@ -349,6 +357,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
updated_by,
session_expiry,
fingerprint_id,
+ request_external_three_ds_authentication,
..Default::default()
},
PaymentIntentUpdate::MetadataUpdate {
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 49ba814709..59efc2cd32 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -162,6 +162,7 @@ diesel::table! {
applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,
payment_link_config -> Nullable<Jsonb>,
session_expiry -> Nullable<Int8>,
+ authentication_connector_details -> Nullable<Jsonb>,
}
}
@@ -724,6 +725,11 @@ diesel::table! {
#[max_length = 1024]
unified_message -> Nullable<Varchar>,
net_amount -> Nullable<Int8>,
+ external_three_ds_authentication_attempted -> Nullable<Bool>,
+ #[max_length = 64]
+ authentication_connector -> Nullable<Varchar>,
+ #[max_length = 64]
+ authentication_id -> Nullable<Varchar>,
mandate_data -> Nullable<Jsonb>,
#[max_length = 64]
fingerprint_id -> Nullable<Varchar>,
@@ -796,6 +802,7 @@ diesel::table! {
session_expiry -> Nullable<Timestamp>,
#[max_length = 64]
fingerprint_id -> Nullable<Varchar>,
+ request_external_three_ds_authentication -> Nullable<Bool>,
}
}
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index 67f6cceca1..93beeff57d 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -67,6 +67,9 @@ pub struct PaymentAttemptBatchNew {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
+ pub external_three_ds_authentication_attempted: Option<bool>,
+ pub authentication_connector: Option<String>,
+ pub authentication_id: Option<String>,
pub mandate_data: Option<MandateDetails>,
pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
@@ -123,6 +126,10 @@ impl PaymentAttemptBatchNew {
unified_code: self.unified_code,
unified_message: self.unified_message,
net_amount: self.net_amount,
+ external_three_ds_authentication_attempted: self
+ .external_three_ds_authentication_attempted,
+ authentication_connector: self.authentication_connector,
+ authentication_id: self.authentication_id,
mandate_data: self.mandate_data,
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 218877afb7..c2ed8e1c75 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1657,6 +1657,7 @@ pub async fn update_business_profile(
applepay_verified_domains: request.applepay_verified_domains,
payment_link_config,
session_expiry: request.session_expiry.map(i64::from),
+ authentication_connector_details: None,
};
let updated_business_profile = db
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index d711bca7ab..d158a4bc94 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2685,6 +2685,7 @@ mod tests {
common_utils::date_time::now()
.saturating_add(time::Duration::seconds(consts::DEFAULT_SESSION_EXPIRY)),
),
+ request_external_three_ds_authentication: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());
@@ -2740,6 +2741,7 @@ mod tests {
common_utils::date_time::now()
.saturating_add(time::Duration::seconds(consts::DEFAULT_SESSION_EXPIRY)),
),
+ request_external_three_ds_authentication: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())
@@ -2794,6 +2796,7 @@ mod tests {
common_utils::date_time::now()
.saturating_add(time::Duration::seconds(consts::DEFAULT_SESSION_EXPIRY)),
),
+ request_external_three_ds_authentication: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())
@@ -3211,6 +3214,10 @@ impl AttemptType {
unified_code: None,
unified_message: None,
net_amount: old_payment_attempt.amount,
+ external_three_ds_authentication_attempted: old_payment_attempt
+ .external_three_ds_authentication_attempted,
+ authentication_connector: None,
+ authentication_id: None,
mandate_data: old_payment_attempt.mandate_data,
// New payment method billing address can be passed for a retry
payment_method_billing_address_id: None,
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 5c47c3f323..111f1bed29 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -846,6 +846,9 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
merchant_connector_id,
surcharge_amount,
tax_amount,
+ external_three_ds_authentication_attempted: None,
+ authentication_connector: None,
+ authentication_id: None,
payment_method_billing_address_id,
fingerprint_id: m_fingerprint_id,
},
@@ -896,6 +899,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
updated_by: m_storage_scheme,
fingerprint_id: None,
session_expiry,
+ request_external_three_ds_authentication: None,
},
storage_scheme,
)
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 11ab21b891..3ba7092aea 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -805,6 +805,7 @@ impl PaymentCreate {
.mandate_data
.as_ref()
.and_then(|inner| inner.mandate_type.clone().map(Into::into)),
+ external_three_ds_authentication_attempted: None,
mandate_data,
payment_method_billing_address_id,
..storage::PaymentAttemptNew::default()
@@ -903,6 +904,7 @@ impl PaymentCreate {
authorization_count: None,
fingerprint_id: None,
session_expiry: Some(session_expiry),
+ request_external_three_ds_authentication: None,
})
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index cd73df26ff..080667f4b4 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -658,6 +658,9 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
updated_by: storage_scheme.to_string(),
fingerprint_id: None,
session_expiry,
+ request_external_three_ds_authentication: payment_data
+ .payment_intent
+ .request_external_three_ds_authentication,
},
storage_scheme,
)
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index e1edf7b4a6..febd1cd86d 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -262,6 +262,7 @@ pub async fn update_business_profile_active_algorithm_ref(
is_recon_enabled: None,
payment_link_config: None,
session_expiry: None,
+ authentication_connector_details: None,
};
db.update_business_profile_by_profile_id(current_business_profile, business_profile_update)
.await
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 595f08c18b..dd7f462e1c 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -158,6 +158,7 @@ impl ForeignTryFrom<(domain::MerchantAccount, BusinessProfileCreate)>
.session_expiry
.map(i64::from)
.or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)),
+ authentication_connector_details: None,
})
}
}
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index 3fa2a10629..8a09900c95 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -218,6 +218,7 @@ pub async fn generate_sample_data(
authorization_count: Default::default(),
fingerprint_id: None,
session_expiry: Some(session_expiry),
+ request_external_three_ds_authentication: None,
};
let payment_attempt = PaymentAttemptBatchNew {
attempt_id: attempt_id.clone(),
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 7ae41f79c6..acec82e172 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -147,6 +147,10 @@ impl PaymentAttemptInterface for MockDb {
merchant_connector_id: payment_attempt.merchant_connector_id,
unified_code: payment_attempt.unified_code,
unified_message: payment_attempt.unified_message,
+ external_three_ds_authentication_attempted: payment_attempt
+ .external_three_ds_authentication_attempted,
+ authentication_connector: payment_attempt.authentication_connector,
+ authentication_id: payment_attempt.authentication_id,
mandate_data: payment_attempt.mandate_data,
payment_method_billing_address_id: payment_attempt.payment_method_billing_address_id,
fingerprint_id: payment_attempt.fingerprint_id,
diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs
index 3f892ed9fa..03e6539f16 100644
--- a/crates/storage_impl/src/mock_db/payment_intent.rs
+++ b/crates/storage_impl/src/mock_db/payment_intent.rs
@@ -111,6 +111,7 @@ impl PaymentIntentInterface for MockDb {
authorization_count: new.authorization_count,
fingerprint_id: new.fingerprint_id,
session_expiry: new.session_expiry,
+ request_external_three_ds_authentication: new.request_external_three_ds_authentication,
};
payment_intents.push(payment_intent.clone());
Ok(payment_intent)
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index e7c6ad01ef..f2e1fbf16c 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -398,6 +398,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
unified_code: payment_attempt.unified_code.clone(),
unified_message: payment_attempt.unified_message.clone(),
+ external_three_ds_authentication_attempted: payment_attempt
+ .external_three_ds_authentication_attempted,
+ authentication_connector: payment_attempt.authentication_connector.clone(),
+ authentication_id: payment_attempt.authentication_id.clone(),
mandate_data: payment_attempt.mandate_data.clone(),
payment_method_billing_address_id: payment_attempt
.payment_method_billing_address_id
@@ -1125,6 +1129,10 @@ impl DataModelExt for PaymentAttempt {
merchant_connector_id: self.merchant_connector_id,
unified_code: self.unified_code,
unified_message: self.unified_message,
+ external_three_ds_authentication_attempted: self
+ .external_three_ds_authentication_attempted,
+ authentication_connector: self.authentication_connector,
+ authentication_id: self.authentication_id,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
@@ -1183,6 +1191,10 @@ impl DataModelExt for PaymentAttempt {
merchant_connector_id: storage_model.merchant_connector_id,
unified_code: storage_model.unified_code,
unified_message: storage_model.unified_message,
+ external_three_ds_authentication_attempted: storage_model
+ .external_three_ds_authentication_attempted,
+ authentication_connector: storage_model.authentication_connector,
+ authentication_id: storage_model.authentication_id,
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
@@ -1243,6 +1255,10 @@ impl DataModelExt for PaymentAttemptNew {
merchant_connector_id: self.merchant_connector_id,
unified_code: self.unified_code,
unified_message: self.unified_message,
+ external_three_ds_authentication_attempted: self
+ .external_three_ds_authentication_attempted,
+ authentication_connector: self.authentication_connector,
+ authentication_id: self.authentication_id,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
@@ -1299,6 +1315,10 @@ impl DataModelExt for PaymentAttemptNew {
merchant_connector_id: storage_model.merchant_connector_id,
unified_code: storage_model.unified_code,
unified_message: storage_model.unified_message,
+ external_three_ds_authentication_attempted: storage_model
+ .external_three_ds_authentication_attempted,
+ authentication_connector: storage_model.authentication_connector,
+ authentication_id: storage_model.authentication_id,
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
@@ -1407,6 +1427,9 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
amount,
@@ -1430,6 +1453,9 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
},
Self::VoidUpdate {
@@ -1593,6 +1619,19 @@ impl DataModelExt for PaymentAttemptUpdate {
amount,
amount_capturable,
},
+ Self::AuthenticationUpdate {
+ status,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
+ updated_by,
+ } => DieselPaymentAttemptUpdate::AuthenticationUpdate {
+ status,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
+ updated_by,
+ },
}
}
@@ -1681,6 +1720,9 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
} => Self::ConfirmUpdate {
amount,
@@ -1704,6 +1746,9 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
payment_method_billing_address_id,
},
DieselPaymentAttemptUpdate::VoidUpdate {
@@ -1878,6 +1923,19 @@ impl DataModelExt for PaymentAttemptUpdate {
amount,
amount_capturable,
},
+ DieselPaymentAttemptUpdate::AuthenticationUpdate {
+ status,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
+ updated_by,
+ } => Self::AuthenticationUpdate {
+ status,
+ external_three_ds_authentication_attempted,
+ authentication_connector,
+ authentication_id,
+ updated_by,
+ },
}
}
}
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 1dc0b1f90f..40627d1eeb 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -103,6 +103,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
authorization_count: new.authorization_count,
fingerprint_id: new.fingerprint_id.clone(),
session_expiry: new.session_expiry,
+ request_external_three_ds_authentication: new
+ .request_external_three_ds_authentication,
};
let redis_entry = kv::TypedSql {
op: kv::DBOperation::Insert {
@@ -779,6 +781,7 @@ impl DataModelExt for PaymentIntentNew {
authorization_count: self.authorization_count,
fingerprint_id: self.fingerprint_id,
session_expiry: self.session_expiry,
+ request_external_three_ds_authentication: self.request_external_three_ds_authentication,
}
}
@@ -824,6 +827,8 @@ impl DataModelExt for PaymentIntentNew {
authorization_count: storage_model.authorization_count,
fingerprint_id: storage_model.fingerprint_id,
session_expiry: storage_model.session_expiry,
+ request_external_three_ds_authentication: storage_model
+ .request_external_three_ds_authentication,
}
}
}
@@ -874,6 +879,7 @@ impl DataModelExt for PaymentIntent {
authorization_count: self.authorization_count,
fingerprint_id: self.fingerprint_id,
session_expiry: self.session_expiry,
+ request_external_three_ds_authentication: self.request_external_three_ds_authentication,
}
}
@@ -920,6 +926,8 @@ impl DataModelExt for PaymentIntent {
authorization_count: storage_model.authorization_count,
fingerprint_id: storage_model.fingerprint_id,
session_expiry: storage_model.session_expiry,
+ request_external_three_ds_authentication: storage_model
+ .request_external_three_ds_authentication,
}
}
}
@@ -1006,6 +1014,7 @@ impl DataModelExt for PaymentIntentUpdate {
updated_by,
fingerprint_id,
session_expiry,
+ request_external_three_ds_authentication,
} => DieselPaymentIntentUpdate::Update {
amount,
currency,
@@ -1026,6 +1035,7 @@ impl DataModelExt for PaymentIntentUpdate {
updated_by,
fingerprint_id,
session_expiry,
+ request_external_three_ds_authentication,
},
Self::PaymentAttemptAndAttemptCountUpdate {
active_attempt_id,
diff --git a/migrations/2024-01-22-114747_add_authentication_fields_to_attempt/down.sql b/migrations/2024-01-22-114747_add_authentication_fields_to_attempt/down.sql
new file mode 100644
index 0000000000..39a23faf57
--- /dev/null
+++ b/migrations/2024-01-22-114747_add_authentication_fields_to_attempt/down.sql
@@ -0,0 +1,5 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_attempt
+DROP COLUMN IF EXISTS external_three_ds_authentication_attempted,
+DROP COLUMN IF EXISTS authentication_connector,
+DROP COLUMN IF EXISTS authentication_id;
\ No newline at end of file
diff --git a/migrations/2024-01-22-114747_add_authentication_fields_to_attempt/up.sql b/migrations/2024-01-22-114747_add_authentication_fields_to_attempt/up.sql
new file mode 100644
index 0000000000..6b5509553b
--- /dev/null
+++ b/migrations/2024-01-22-114747_add_authentication_fields_to_attempt/up.sql
@@ -0,0 +1,5 @@
+-- Your SQL goes here
+ALTER TABLE payment_attempt
+ADD COLUMN IF NOT EXISTS external_three_ds_authentication_attempted BOOLEAN default false,
+ADD COLUMN IF NOT EXISTS authentication_connector VARCHAR(64),
+ADD COLUMN IF NOT EXISTS authentication_id VARCHAR(64);
\ No newline at end of file
diff --git a/migrations/2024-02-07-075631_add_request_external_authentication_in_intent/down.sql b/migrations/2024-02-07-075631_add_request_external_authentication_in_intent/down.sql
new file mode 100644
index 0000000000..4c29c5ec0f
--- /dev/null
+++ b/migrations/2024-02-07-075631_add_request_external_authentication_in_intent/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent DROP COLUMN IF EXISTS request_external_three_ds_authentication;
\ No newline at end of file
diff --git a/migrations/2024-02-07-075631_add_request_external_authentication_in_intent/up.sql b/migrations/2024-02-07-075631_add_request_external_authentication_in_intent/up.sql
new file mode 100644
index 0000000000..8832cf5e78
--- /dev/null
+++ b/migrations/2024-02-07-075631_add_request_external_authentication_in_intent/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS request_external_three_ds_authentication BOOLEAN;
diff --git a/migrations/2024-03-01-111007_add_authentication_details_in_business_profile/down.sql b/migrations/2024-03-01-111007_add_authentication_details_in_business_profile/down.sql
new file mode 100644
index 0000000000..4576e4754e
--- /dev/null
+++ b/migrations/2024-03-01-111007_add_authentication_details_in_business_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS authentication_connector_details;
\ No newline at end of file
diff --git a/migrations/2024-03-01-111007_add_authentication_details_in_business_profile/up.sql b/migrations/2024-03-01-111007_add_authentication_details_in_business_profile/up.sql
new file mode 100644
index 0000000000..93cfe330cc
--- /dev/null
+++ b/migrations/2024-03-01-111007_add_authentication_details_in_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS authentication_connector_details JSONB NULL;