From 2b8eb09a16040957ac369c48e6095c343207f0d3 Mon Sep 17 00:00:00 2001 From: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:24:19 +0530 Subject: [PATCH] feat(core): add SCA exemption field (#6578) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- api-reference-v2/openapi_spec.json | 8 ++++ api-reference/openapi_spec.json | 40 +++++++++++++++++++ crates/api_models/src/payments.rs | 4 ++ crates/common_enums/src/enums.rs | 25 +++++++++++- crates/diesel_models/src/enums.rs | 6 +-- crates/diesel_models/src/payment_intent.rs | 3 ++ crates/diesel_models/src/schema.rs | 1 + crates/diesel_models/src/schema_v2.rs | 1 + .../hyperswitch_domain_models/src/payments.rs | 1 + .../src/payments/payment_intent.rs | 4 ++ .../src/router_data.rs | 3 ++ crates/openapi/src/openapi.rs | 1 + crates/openapi/src/openapi_v2.rs | 1 + crates/router/src/core/authentication.rs | 2 + .../src/core/authentication/transformers.rs | 6 +++ .../core/fraud_check/flows/checkout_flow.rs | 1 + .../fraud_check/flows/fulfillment_flow.rs | 1 + .../core/fraud_check/flows/record_return.rs | 1 + .../src/core/fraud_check/flows/sale_flow.rs | 1 + .../fraud_check/flows/transaction_flow.rs | 1 + crates/router/src/core/mandate/utils.rs | 1 + crates/router/src/core/payments.rs | 1 + crates/router/src/core/payments/helpers.rs | 4 ++ .../payments/operations/payment_confirm.rs | 4 ++ .../payments/operations/payment_create.rs | 1 + .../payments/operations/payment_update.rs | 3 ++ .../router/src/core/payments/transformers.rs | 4 ++ crates/router/src/core/utils.rs | 8 ++++ crates/router/src/core/webhooks/utils.rs | 1 + .../router/src/services/conversion_impls.rs | 1 + crates/router/src/types.rs | 2 + .../router/src/types/api/verify_connector.rs | 1 + crates/router/src/utils/user/sample_data.rs | 1 + crates/router/tests/connectors/aci.rs | 2 + crates/router/tests/connectors/utils.rs | 1 + .../down.sql | 4 ++ .../up.sql | 6 +++ 37 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/down.sql create mode 100644 migrations/2024-11-14-084429_add_sca_exemption_field_to_payment_intent/up.sql diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 095e386d981a..2a5b1cfa3107 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 247b308bd65e..e029bef94534 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 98bc7b754a46..06dd7dc79696 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, + + /// Choose what kind of sca exemption is required for this payment + #[schema(value_type = Option)] + pub psd2_sca_exemption_type: Option, } #[cfg(feature = "v1")] diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs index 23dbab778256..781b5e3710a7 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 77d167402ef0..5de048e32ef9 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 26cb0b8c8a84..7826e2dadd25 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, pub payment_link_config: Option, pub id: common_utils::id_type::GlobalPaymentId, + pub psd2_sca_exemption_type: Option, } #[cfg(feature = "v1")] @@ -136,6 +137,7 @@ pub struct PaymentIntent { pub organization_id: common_utils::id_type::OrganizationId, pub tax_details: Option, pub skip_external_tax_calculation: Option, + pub psd2_sca_exemption_type: Option, } #[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, pub skip_external_tax_calculation: Option, + pub psd2_sca_exemption_type: Option, } #[cfg(feature = "v2")] diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 6dddbb754d54..d3e560fc048c 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, skip_external_tax_calculation -> Nullable, + psd2_sca_exemption_type -> Nullable, } } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index d44dd3317d3f..f6bab9071cd0 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, #[max_length = 64] id -> Varchar, + psd2_sca_exemption_type -> Nullable, } } diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs index 1bab8ae3b76c..276035214a42 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, pub skip_external_tax_calculation: Option, + pub psd2_sca_exemption_type: Option, } 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 4f2053ec6f99..d10dafe883a7 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 0863ab59b45f..a3867ce3e62a 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 { pub header_payload: Option, pub connector_mandate_request_reference_id: Option, + + /// Contains the type of sca exemption required for the transaction + pub psd2_sca_exemption_type: Option, } // Different patterns of authentication. diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index 6356b5f15bee..ed6efea27f83 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 17c004169336..4198e90882e5 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 29508b5c0f55..b4718a64de5a 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, webhook_url: String, three_ds_requestor_url: String, + psd2_sca_exemption_type: Option, ) -> CustomResult { 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 6b8a378a0701..bcbd1481711d 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, webhook_url: String, three_ds_requestor_url: String, + psd2_sca_exemption_type: Option, ) -> RouterResult { 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( types::PaymentAddress::default(), router_request, merchant_connector_account, + None, ) } @@ -129,6 +133,7 @@ pub fn construct_router_data( address: types::PaymentAddress, request_data: Req, merchant_connector_account: &payments_helpers::MerchantConnectorAccountType, + psd2_sca_exemption_type: Option, ) -> RouterResult> { let test_mode: Option = merchant_connector_account.is_test_mode_on(); let auth_type: types::ConnectorAuthType = merchant_connector_account @@ -185,6 +190,7 @@ pub fn construct_router_data( 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 af59c6c42159..84ba1f26a5d1 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( 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 6bf5688104b8..6e29d01c81fb 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( 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 8c82c38be714..b56260b407eb 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 GetTracker, 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 1f0884fe3849..dcc2ba6a289a 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 2f1a0c333fa6..98491cab1db8 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 GetTracker, 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 8a0983eccab0..d9bd374ef1a9 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 fea112bc3b8b..167a4c590068 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 fff675503ad4..f1e84b2226a7 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 33c655eed78a..6ac934cd2fd7 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( 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 bea009949f94..467ae31f7cf1 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -948,6 +948,7 @@ impl ForeignFrom<(&RouterData, 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 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 a472296d2a75..c368a3fb37d0 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 8ffb0f2001fb..600d610e428d 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 6f4855d1e22a..10c8a3dd012d 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() -> types::RefundsRouterData { 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 52218b211ac1..3402b532fbfb 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 000000000000..f43aff7f567d --- /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 000000000000..6fa361a48022 --- /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