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 SCA exemption field (#6578)

Sakil Mostak2b8eb09a1604
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 095e386d98..2a5b1cfa31 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -18645,6 +18645,14 @@
}
}
},
+ "ScaExemptionType": {
+ "type": "string",
+ "description": "SCA Exemptions types available for authentication",
+ "enum": [
+ "low_value",
+ "transaction_risk_analysis"
+ ]
+ },
"SdkInformation": {
"type": "object",
"description": "SDK Information if request is from SDK",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 247b308bd6..e029bef945 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -17019,6 +17019,14 @@
"type": "boolean",
"description": "Whether to calculate tax for this payment intent",
"nullable": true
+ },
+ "psd2_sca_exemption_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ScaExemptionType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -17389,6 +17397,14 @@
"type": "boolean",
"description": "Whether to calculate tax for this payment intent",
"nullable": true
+ },
+ "psd2_sca_exemption_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ScaExemptionType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -18583,6 +18599,14 @@
"type": "boolean",
"description": "Whether to calculate tax for this payment intent",
"nullable": true
+ },
+ "psd2_sca_exemption_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ScaExemptionType"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -19616,6 +19640,14 @@
"type": "boolean",
"description": "Whether to calculate tax for this payment intent",
"nullable": true
+ },
+ "psd2_sca_exemption_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ScaExemptionType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -23284,6 +23316,14 @@
}
}
},
+ "ScaExemptionType": {
+ "type": "string",
+ "description": "SCA Exemptions types available for authentication",
+ "enum": [
+ "low_value",
+ "transaction_risk_analysis"
+ ]
+ },
"SdkInformation": {
"type": "object",
"description": "SDK Information if request is from SDK",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 98bc7b754a..06dd7dc796 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -859,6 +859,10 @@ pub struct PaymentsRequest {
/// Whether to calculate tax for this payment intent
pub skip_external_tax_calculation: Option<bool>,
+
+ /// Choose what kind of sca exemption is required for this payment
+ #[schema(value_type = Option<ScaExemptionType>)]
+ pub psd2_sca_exemption_type: Option<api_enums::ScaExemptionType>,
}
#[cfg(feature = "v1")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 23dbab7782..781b5e3710 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -20,7 +20,7 @@ pub mod diesel_exports {
DbMandateStatus as MandateStatus, DbPaymentMethodIssuerCode as PaymentMethodIssuerCode,
DbPaymentType as PaymentType, DbRefundStatus as RefundStatus,
DbRequestIncrementalAuthorization as RequestIncrementalAuthorization,
- DbWebhookDeliveryAttempt as WebhookDeliveryAttempt,
+ DbScaExemptionType as ScaExemptionType, DbWebhookDeliveryAttempt as WebhookDeliveryAttempt,
};
}
@@ -1668,6 +1668,29 @@ pub enum PaymentType {
RecurringMandate,
}
+/// SCA Exemptions types available for authentication
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Default,
+ Eq,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+)]
+#[router_derive::diesel_enum(storage_type = "db_enum")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum ScaExemptionType {
+ #[default]
+ LowValue,
+ TransactionRiskAnalysis,
+}
+
#[derive(
Clone,
Copy,
diff --git a/crates/diesel_models/src/enums.rs b/crates/diesel_models/src/enums.rs
index 77d167402e..5de048e32e 100644
--- a/crates/diesel_models/src/enums.rs
+++ b/crates/diesel_models/src/enums.rs
@@ -20,9 +20,9 @@ pub mod diesel_exports {
DbRefundStatus as RefundStatus, DbRefundType as RefundType,
DbRequestIncrementalAuthorization as RequestIncrementalAuthorization,
DbRoleScope as RoleScope, DbRoutingAlgorithmKind as RoutingAlgorithmKind,
- DbTotpStatus as TotpStatus, DbTransactionType as TransactionType,
- DbUserRoleVersion as UserRoleVersion, DbUserStatus as UserStatus,
- DbWebhookDeliveryAttempt as WebhookDeliveryAttempt,
+ DbScaExemptionType as ScaExemptionType, DbTotpStatus as TotpStatus,
+ DbTransactionType as TransactionType, DbUserRoleVersion as UserRoleVersion,
+ DbUserStatus as UserStatus, DbWebhookDeliveryAttempt as WebhookDeliveryAttempt,
};
}
pub use common_enums::*;
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 26cb0b8c8a..7826e2dadd 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -72,6 +72,7 @@ pub struct PaymentIntent {
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub payment_link_config: Option<PaymentLinkConfigRequestForPayments>,
pub id: common_utils::id_type::GlobalPaymentId,
+ pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
}
#[cfg(feature = "v1")]
@@ -136,6 +137,7 @@ pub struct PaymentIntent {
pub organization_id: common_utils::id_type::OrganizationId,
pub tax_details: Option<TaxDetails>,
pub skip_external_tax_calculation: Option<bool>,
+ pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq)]
@@ -352,6 +354,7 @@ pub struct PaymentIntentNew {
pub organization_id: common_utils::id_type::OrganizationId,
pub tax_details: Option<TaxDetails>,
pub skip_external_tax_calculation: Option<bool>,
+ pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
}
#[cfg(feature = "v2")]
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 6dddbb754d..d3e560fc04 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -932,6 +932,7 @@ diesel::table! {
organization_id -> Varchar,
tax_details -> Nullable<Jsonb>,
skip_external_tax_calculation -> Nullable<Bool>,
+ psd2_sca_exemption_type -> Nullable<ScaExemptionType>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index d44dd3317d..f6bab9071c 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -895,6 +895,7 @@ diesel::table! {
payment_link_config -> Nullable<Jsonb>,
#[max_length = 64]
id -> Varchar,
+ psd2_sca_exemption_type -> Nullable<ScaExemptionType>,
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 1bab8ae3b7..276035214a 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -99,6 +99,7 @@ pub struct PaymentIntent {
pub organization_id: id_type::OrganizationId,
pub tax_details: Option<TaxDetails>,
pub skip_external_tax_calculation: Option<bool>,
+ pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
}
impl PaymentIntent {
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 4f2053ec6f..d10dafe883 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -1283,6 +1283,7 @@ impl behaviour::Conversion for PaymentIntent {
customer_present: Some(customer_present.as_bool()),
payment_link_config,
routing_algorithm_id,
+ psd2_sca_exemption_type: None,
})
}
async fn convert_back(
@@ -1551,6 +1552,7 @@ impl behaviour::Conversion for PaymentIntent {
shipping_cost: self.shipping_cost,
tax_details: self.tax_details,
skip_external_tax_calculation: self.skip_external_tax_calculation,
+ psd2_sca_exemption_type: self.psd2_sca_exemption_type,
})
}
@@ -1638,6 +1640,7 @@ impl behaviour::Conversion for PaymentIntent {
is_payment_processor_token_flow: storage_model.is_payment_processor_token_flow,
organization_id: storage_model.organization_id,
skip_external_tax_calculation: storage_model.skip_external_tax_calculation,
+ psd2_sca_exemption_type: storage_model.psd2_sca_exemption_type,
})
}
.await
@@ -1700,6 +1703,7 @@ impl behaviour::Conversion for PaymentIntent {
shipping_cost: self.shipping_cost,
tax_details: self.tax_details,
skip_external_tax_calculation: self.skip_external_tax_calculation,
+ psd2_sca_exemption_type: self.psd2_sca_exemption_type,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 0863ab59b4..a3867ce3e6 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -86,6 +86,9 @@ pub struct RouterData<Flow, Request, Response> {
pub header_payload: Option<payments::HeaderPayload>,
pub connector_mandate_request_reference_id: Option<String>,
+
+ /// Contains the type of sca exemption required for the transaction
+ pub psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
}
// Different patterns of authentication.
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 6356b5f15b..ed6efea27f 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -254,6 +254,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::AcceptedCountries,
api_models::admin::AcceptedCurrencies,
api_models::enums::PaymentType,
+ api_models::enums::ScaExemptionType,
api_models::enums::PaymentMethod,
api_models::enums::PaymentMethodType,
api_models::enums::ConnectorType,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 17c0041693..4198e90882 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -199,6 +199,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::AcceptedCurrencies,
api_models::enums::ProductType,
api_models::enums::PaymentType,
+ api_models::enums::ScaExemptionType,
api_models::enums::PaymentMethod,
api_models::enums::PaymentMethodType,
api_models::enums::ConnectorType,
diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs
index 29508b5c0f..b4718a64de 100644
--- a/crates/router/src/core/authentication.rs
+++ b/crates/router/src/core/authentication.rs
@@ -39,6 +39,7 @@ pub async fn perform_authentication(
email: Option<common_utils::pii::Email>,
webhook_url: String,
three_ds_requestor_url: String,
+ psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
) -> CustomResult<api::authentication::AuthenticationResponse, ApiErrorResponse> {
let router_data = transformers::construct_authentication_router_data(
merchant_id,
@@ -60,6 +61,7 @@ pub async fn perform_authentication(
email,
webhook_url,
three_ds_requestor_url,
+ psd2_sca_exemption_type,
)?;
let response = Box::pin(utils::do_auth_connector_call(
state,
diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs
index 6b8a378a07..bcbd148171 100644
--- a/crates/router/src/core/authentication/transformers.rs
+++ b/crates/router/src/core/authentication/transformers.rs
@@ -43,6 +43,7 @@ pub fn construct_authentication_router_data(
email: Option<common_utils::pii::Email>,
webhook_url: String,
three_ds_requestor_url: String,
+ psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
) -> RouterResult<types::authentication::ConnectorAuthenticationRouterData> {
let router_request = types::authentication::ConnectorAuthenticationRequestData {
payment_method_data,
@@ -70,6 +71,7 @@ pub fn construct_authentication_router_data(
types::PaymentAddress::default(),
router_request,
&merchant_connector_account,
+ psd2_sca_exemption_type,
)
}
@@ -94,6 +96,7 @@ pub fn construct_post_authentication_router_data(
types::PaymentAddress::default(),
router_request,
&merchant_connector_account,
+ None,
)
}
@@ -119,6 +122,7 @@ pub fn construct_pre_authentication_router_data<F: Clone>(
types::PaymentAddress::default(),
router_request,
merchant_connector_account,
+ None,
)
}
@@ -129,6 +133,7 @@ pub fn construct_router_data<F: Clone, Req, Res>(
address: types::PaymentAddress,
request_data: Req,
merchant_connector_account: &payments_helpers::MerchantConnectorAccountType,
+ psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
) -> RouterResult<types::RouterData<F, Req, Res>> {
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
@@ -185,6 +190,7 @@ pub fn construct_router_data<F: Clone, Req, Res>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type,
})
}
diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
index af59c6c421..84ba1f26a5 100644
--- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
@@ -161,6 +161,7 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudC
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
index b2cc0d9a1b..92edc083e0 100644
--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
@@ -128,6 +128,7 @@ pub async fn construct_fulfillment_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs
index 6bf5688104..6e29d01c81 100644
--- a/crates/router/src/core/fraud_check/flows/record_return.rs
+++ b/crates/router/src/core/fraud_check/flows/record_return.rs
@@ -129,6 +129,7 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCh
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs
index bde91b3bda..cdab3e4dae 100644
--- a/crates/router/src/core/fraud_check/flows/sale_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs
@@ -137,6 +137,7 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResp
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
index 62d242d0e6..a66a47f709 100644
--- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
@@ -146,6 +146,7 @@ impl
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rs
index 294be04937..99af165762 100644
--- a/crates/router/src/core/mandate/utils.rs
+++ b/crates/router/src/core/mandate/utils.rs
@@ -81,6 +81,7 @@ pub async fn construct_mandate_revoke_router_data(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 5ac8f454c2..ada8160c6d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -6277,6 +6277,7 @@ pub async fn payment_external_authentication(
optional_customer.and_then(|customer| customer.email.map(pii::Email::from)),
webhook_url,
authentication_details.three_ds_requestor_url.clone(),
+ payment_intent.psd2_sca_exemption_type,
))
.await?;
Ok(services::ApplicationResponse::Json(
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5dc5ca3546..d4f5b3b49f 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3473,6 +3473,7 @@ mod tests {
shipping_cost: None,
tax_details: None,
skip_external_tax_calculation: None,
+ psd2_sca_exemption_type: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());
@@ -3542,6 +3543,7 @@ mod tests {
shipping_cost: None,
tax_details: None,
skip_external_tax_calculation: None,
+ psd2_sca_exemption_type: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())
@@ -3609,6 +3611,7 @@ mod tests {
shipping_cost: None,
tax_details: None,
skip_external_tax_calculation: None,
+ psd2_sca_exemption_type: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())
@@ -3931,6 +3934,7 @@ pub fn router_data_type_conversion<F1, F2, Req1, Req2, Res1, Res2>(
additional_merchant_data: router_data.additional_merchant_data,
header_payload: router_data.header_payload,
connector_mandate_request_reference_id: router_data.connector_mandate_request_reference_id,
+ psd2_sca_exemption_type: router_data.psd2_sca_exemption_type,
}
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 8c82c38be7..b56260b407 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -353,6 +353,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.setup_future_usage
.or(payment_intent.setup_future_usage);
+ payment_intent.psd2_sca_exemption_type = request
+ .psd2_sca_exemption_type
+ .or(payment_intent.psd2_sca_exemption_type);
+
let browser_info = request
.browser_info
.clone()
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 1f0884fe38..dcc2ba6a28 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1479,6 +1479,7 @@ impl PaymentCreate {
shipping_cost: request.shipping_cost,
tax_details: None,
skip_external_tax_calculation,
+ psd2_sca_exemption_type: request.psd2_sca_exemption_type,
})
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 2f1a0c333f..98491cab1d 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -271,6 +271,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.or(payment_intent.feature_metadata);
payment_intent.metadata = request.metadata.clone().or(payment_intent.metadata);
payment_intent.frm_metadata = request.frm_metadata.clone().or(payment_intent.frm_metadata);
+ payment_intent.psd2_sca_exemption_type = request
+ .psd2_sca_exemption_type
+ .or(payment_intent.psd2_sca_exemption_type);
Self::populate_payment_intent_with_request(&mut payment_intent, request);
let token = token.or_else(|| payment_attempt.payment_token.clone());
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 8a0983ecca..d9bd374ef1 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -168,6 +168,7 @@ where
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
@@ -370,6 +371,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -502,6 +504,7 @@ pub async fn construct_router_data_for_psync<'a>(
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -723,6 +726,7 @@ where
}),
header_payload,
connector_mandate_request_reference_id,
+ psd2_sca_exemption_type: payment_data.payment_intent.psd2_sca_exemption_type,
};
Ok(router_data)
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index fea112bc3b..167a4c5900 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -215,6 +215,7 @@ pub async fn construct_payout_router_data<'a, F>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -394,6 +395,7 @@ pub async fn construct_refund_router_data<'a, F>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -705,6 +707,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
@@ -801,6 +804,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
@@ -903,6 +907,7 @@ pub async fn construct_upload_file_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
@@ -1025,6 +1030,7 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
@@ -1124,6 +1130,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
@@ -1217,6 +1224,7 @@ pub async fn construct_retrieve_file_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index fff675503a..f1e84b2226 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -123,6 +123,7 @@ pub async fn construct_webhook_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
};
Ok(router_data)
}
diff --git a/crates/router/src/services/conversion_impls.rs b/crates/router/src/services/conversion_impls.rs
index 33c655eed7..6ac934cd2f 100644
--- a/crates/router/src/services/conversion_impls.rs
+++ b/crates/router/src/services/conversion_impls.rs
@@ -77,6 +77,7 @@ fn get_default_router_data<F, Req, Resp>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
}
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index bea009949f..467ae31f7c 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -948,6 +948,7 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)
connector_mandate_request_reference_id: data
.connector_mandate_request_reference_id
.clone(),
+ psd2_sca_exemption_type: data.psd2_sca_exemption_type,
}
}
}
@@ -1013,6 +1014,7 @@ impl<F1, F2>
additional_merchant_data: data.additional_merchant_data.clone(),
header_payload: data.header_payload.clone(),
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
}
}
}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index a472296d2a..c368a3fb37 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -118,6 +118,7 @@ impl VerifyConnectorData {
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
}
}
}
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index 8ffb0f2001..600d610e42 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -274,6 +274,7 @@ pub async fn generate_sample_data(
shipping_cost: None,
tax_details: None,
skip_external_tax_calculation: None,
+ psd2_sca_exemption_type: None,
};
let (connector_transaction_id, connector_transaction_data) =
ConnectorTransactionId::form_id_and_data(attempt_id.clone());
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 6f4855d1e2..10c8a3dd01 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -129,6 +129,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
}
}
@@ -199,6 +200,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
}
}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 52218b211a..3402b532fb 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -547,6 +547,7 @@ pub trait ConnectorActions: Connector {
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ psd2_sca_exemption_type: None,
}
}
diff --git a/migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/down.sql b/migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/down.sql
new file mode 100644
index 0000000000..f43aff7f56
--- /dev/null
+++ b/migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/down.sql
@@ -0,0 +1,4 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent DROP COLUMN psd2_sca_exemption_type;
+
+DROP TYPE "ScaExemptionType";
\ No newline at end of file
diff --git a/migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/up.sql b/migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/up.sql
new file mode 100644
index 0000000000..6fa361a480
--- /dev/null
+++ b/migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/up.sql
@@ -0,0 +1,6 @@
+CREATE TYPE "ScaExemptionType" AS ENUM (
+ 'low_value',
+ 'transaction_risk_analysis'
+);
+
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS psd2_sca_exemption_type "ScaExemptionType";
\ No newline at end of file