diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json index 00b5183c28..ac27acf5b3 100644 --- a/api-reference/v1/openapi_spec_v1.json +++ b/api-reference/v1/openapi_spec_v1.json @@ -29198,6 +29198,11 @@ "type": "string", "description": "Merchant Connector id to be stored for billing_processor connector", "nullable": true + }, + "is_l2_l3_enabled": { + "type": "boolean", + "description": "Flag to enable Level 2 and Level 3 processing data for card transactions", + "nullable": true } }, "additionalProperties": false @@ -29555,6 +29560,11 @@ "type": "string", "description": "Merchant Connector id to be stored for billing_processor connector", "nullable": true + }, + "is_l2_l3_enabled": { + "type": "boolean", + "description": "Flag to enable Level 2 and Level 3 processing data for card transactions", + "nullable": true } } }, diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json index d56065e6dc..ca554a988b 100644 --- a/api-reference/v2/openapi_spec_v2.json +++ b/api-reference/v2/openapi_spec_v2.json @@ -22776,6 +22776,11 @@ "type": "string", "description": "Merchant Connector id to be stored for billing_processor connector", "nullable": true + }, + "is_l2_l3_enabled": { + "type": "boolean", + "description": "Flag to enable Level 2 and Level 3 processing data for card transactions", + "nullable": true } }, "additionalProperties": false @@ -23083,6 +23088,11 @@ "type": "string", "description": "Merchant Connector id to be stored for billing_processor connector", "nullable": true + }, + "is_l2_l3_enabled": { + "type": "boolean", + "description": "Flag to enable Level 2 and Level 3 processing data for card transactions", + "nullable": true } } }, diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 08b3a08f61..f1fc3d971e 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -2214,6 +2214,10 @@ pub struct ProfileCreate { /// Merchant Connector id to be stored for billing_processor connector #[schema(value_type = Option)] pub billing_processor_id: Option, + + /// Flag to enable Level 2 and Level 3 processing data for card transactions + #[schema(value_type = Option)] + pub is_l2_l3_enabled: Option, } #[nutype::nutype( @@ -2375,6 +2379,10 @@ pub struct ProfileCreate { /// Merchant Connector id to be stored for billing_processor connector #[schema(value_type = Option)] pub billing_processor_id: Option, + + /// Flag to enable Level 2 and Level 3 processing data for card transactions + #[schema(value_type = Option)] + pub is_l2_l3_enabled: Option, } #[cfg(feature = "v1")] @@ -2579,6 +2587,10 @@ pub struct ProfileResponse { /// Merchant Connector id to be stored for billing_processor connector #[schema(value_type = Option)] pub billing_processor_id: Option, + + /// Flag to enable Level 2 and Level 3 processing data for card transactions + #[schema(value_type = Option)] + pub is_l2_l3_enabled: Option, } #[cfg(feature = "v2")] @@ -2753,6 +2765,10 @@ pub struct ProfileResponse { /// Merchant Connector id to be stored for billing_processor connector #[schema(value_type = Option)] pub billing_processor_id: Option, + + /// Flag to enable Level 2 and Level 3 processing data for card transactions + #[schema(value_type = Option)] + pub is_l2_l3_enabled: Option, } #[cfg(feature = "v1")] @@ -2947,6 +2963,10 @@ pub struct ProfileUpdate { /// Merchant Connector id to be stored for billing_processor connector #[schema(value_type = Option)] pub billing_processor_id: Option, + + /// Flag to enable Level 2 and Level 3 processing data for card transactions + #[schema(value_type = Option)] + pub is_l2_l3_enabled: Option, } #[cfg(feature = "v2")] diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs index d0e4492712..854bf12f0f 100644 --- a/crates/diesel_models/src/business_profile.rs +++ b/crates/diesel_models/src/business_profile.rs @@ -83,6 +83,7 @@ pub struct Profile { pub billing_processor_id: Option, pub is_external_vault_enabled: Option, pub external_vault_connector_details: Option, + pub is_l2_l3_enabled: Option, } #[cfg(feature = "v1")] @@ -145,6 +146,7 @@ pub struct ProfileNew { pub billing_processor_id: Option, pub is_external_vault_enabled: Option, pub external_vault_connector_details: Option, + pub is_l2_l3_enabled: Option, } #[cfg(feature = "v1")] @@ -181,6 +183,7 @@ pub struct ProfileUpdateInternal { pub always_collect_shipping_details_from_wallet_connector: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: Option, + pub is_l2_l3_enabled: Option, pub dynamic_routing_algorithm: Option, pub is_network_tokenization_enabled: Option, pub is_auto_retries_enabled: Option, @@ -243,6 +246,7 @@ impl ProfileUpdateInternal { always_collect_shipping_details_from_wallet_connector, tax_connector_id, is_tax_connector_enabled, + is_l2_l3_enabled, dynamic_routing_algorithm, is_network_tokenization_enabled, is_auto_retries_enabled, @@ -320,6 +324,7 @@ impl ProfileUpdateInternal { .or(source.always_collect_shipping_details_from_wallet_connector), tax_connector_id: tax_connector_id.or(source.tax_connector_id), is_tax_connector_enabled: is_tax_connector_enabled.or(source.is_tax_connector_enabled), + is_l2_l3_enabled: is_l2_l3_enabled.or(source.is_l2_l3_enabled), version: source.version, dynamic_routing_algorithm: dynamic_routing_algorithm .or(source.dynamic_routing_algorithm), @@ -431,6 +436,7 @@ pub struct Profile { pub billing_processor_id: Option, pub is_external_vault_enabled: Option, pub external_vault_connector_details: Option, + pub is_l2_l3_enabled: Option, pub routing_algorithm_id: Option, pub order_fulfillment_time: Option, pub order_fulfillment_time_origin: Option, @@ -519,6 +525,7 @@ pub struct ProfileNew { pub is_iframe_redirection_enabled: Option, pub is_external_vault_enabled: Option, pub external_vault_connector_details: Option, + pub is_l2_l3_enabled: Option, pub split_txns_enabled: Option, } @@ -580,6 +587,7 @@ pub struct ProfileUpdateInternal { pub is_iframe_redirection_enabled: Option, pub is_external_vault_enabled: Option, pub external_vault_connector_details: Option, + pub is_l2_l3_enabled: Option, pub split_txns_enabled: Option, } @@ -639,6 +647,7 @@ impl ProfileUpdateInternal { merchant_category_code, merchant_country_code, split_txns_enabled, + is_l2_l3_enabled, } = self; Profile { id: source.id, @@ -738,6 +747,7 @@ impl ProfileUpdateInternal { split_txns_enabled: split_txns_enabled.or(source.split_txns_enabled), is_manual_retry_enabled: None, always_enable_overcapture: None, + is_l2_l3_enabled: None, billing_processor_id: billing_processor_id.or(source.billing_processor_id), } } diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index daf84015cf..7d4e1609e4 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -261,6 +261,7 @@ diesel::table! { billing_processor_id -> Nullable, is_external_vault_enabled -> Nullable, external_vault_connector_details -> Nullable, + is_l2_l3_enabled -> Nullable, } } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index e21c1fa101..11533805ce 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -256,6 +256,7 @@ diesel::table! { billing_processor_id -> Nullable, is_external_vault_enabled -> Nullable, external_vault_connector_details -> Nullable, + is_l2_l3_enabled -> Nullable, #[max_length = 64] routing_algorithm_id -> Nullable, order_fulfillment_time -> Nullable, diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs index f0c656c38a..eec8a8e740 100644 --- a/crates/hyperswitch_domain_models/src/business_profile.rs +++ b/crates/hyperswitch_domain_models/src/business_profile.rs @@ -62,6 +62,7 @@ pub struct Profile { pub always_collect_shipping_details_from_wallet_connector: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: bool, + pub is_l2_l3_enabled: bool, pub version: common_enums::ApiVersion, pub dynamic_routing_algorithm: Option, pub is_network_tokenization_enabled: bool, @@ -222,6 +223,7 @@ pub struct ProfileSetter { pub always_collect_shipping_details_from_wallet_connector: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: bool, + pub is_l2_l3_enabled: bool, pub dynamic_routing_algorithm: Option, pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: bool, @@ -288,6 +290,7 @@ impl From for Profile { .always_collect_shipping_details_from_wallet_connector, tax_connector_id: value.tax_connector_id, is_tax_connector_enabled: value.is_tax_connector_enabled, + is_l2_l3_enabled: value.is_l2_l3_enabled, version: common_types::consts::API_VERSION, dynamic_routing_algorithm: value.dynamic_routing_algorithm, is_network_tokenization_enabled: value.is_network_tokenization_enabled, @@ -360,6 +363,7 @@ pub struct ProfileGeneralUpdate { Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: Option, + pub is_l2_l3_enabled: Option, pub dynamic_routing_algorithm: Option, pub is_network_tokenization_enabled: Option, pub is_auto_retries_enabled: Option, @@ -448,6 +452,7 @@ impl From for ProfileUpdateInternal { always_collect_shipping_details_from_wallet_connector, tax_connector_id, is_tax_connector_enabled, + is_l2_l3_enabled, dynamic_routing_algorithm, is_network_tokenization_enabled, is_auto_retries_enabled, @@ -512,6 +517,7 @@ impl From for ProfileUpdateInternal { always_collect_shipping_details_from_wallet_connector, tax_connector_id, is_tax_connector_enabled, + is_l2_l3_enabled, dynamic_routing_algorithm, is_network_tokenization_enabled, is_auto_retries_enabled, @@ -598,6 +604,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, ProfileUpdate::DynamicRoutingAlgorithmUpdate { dynamic_routing_algorithm, @@ -656,6 +663,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, ProfileUpdate::ExtendedCardInfoUpdate { is_extended_card_info_enabled, @@ -714,6 +722,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, ProfileUpdate::ConnectorAgnosticMitUpdate { is_connector_agnostic_mit_enabled, @@ -772,6 +781,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, ProfileUpdate::NetworkTokenizationUpdate { is_network_tokenization_enabled, @@ -830,6 +840,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, ProfileUpdate::CardTestingSecretKeyUpdate { card_testing_secret_key, @@ -888,6 +899,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, ProfileUpdate::AcquirerConfigMapUpdate { acquirer_config_map, @@ -946,6 +958,7 @@ impl From for ProfileUpdateInternal { is_external_vault_enabled: None, external_vault_connector_details: None, billing_processor_id: None, + is_l2_l3_enabled: None, }, } } @@ -1001,6 +1014,7 @@ impl Conversion for Profile { .always_collect_shipping_details_from_wallet_connector, tax_connector_id: self.tax_connector_id, is_tax_connector_enabled: Some(self.is_tax_connector_enabled), + is_l2_l3_enabled: Some(self.is_l2_l3_enabled), version: self.version, dynamic_routing_algorithm: self.dynamic_routing_algorithm, is_network_tokenization_enabled: self.is_network_tokenization_enabled, @@ -1124,6 +1138,7 @@ impl Conversion for Profile { outgoing_webhook_custom_http_headers, tax_connector_id: item.tax_connector_id, is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false), + is_l2_l3_enabled: item.is_l2_l3_enabled.unwrap_or(false), version: item.version, dynamic_routing_algorithm: item.dynamic_routing_algorithm, is_network_tokenization_enabled: item.is_network_tokenization_enabled, @@ -1198,6 +1213,7 @@ impl Conversion for Profile { .always_collect_shipping_details_from_wallet_connector, tax_connector_id: self.tax_connector_id, is_tax_connector_enabled: Some(self.is_tax_connector_enabled), + is_l2_l3_enabled: Some(self.is_l2_l3_enabled), version: self.version, is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: Some(self.is_auto_retries_enabled), @@ -1727,6 +1743,7 @@ impl From for ProfileUpdateInternal { should_collect_cvv_during_payment: None, tax_connector_id: None, is_tax_connector_enabled: None, + is_l2_l3_enabled: None, is_network_tokenization_enabled, is_auto_retries_enabled: None, max_auto_retries_enabled: None, @@ -1785,6 +1802,7 @@ impl From for ProfileUpdateInternal { should_collect_cvv_during_payment: None, tax_connector_id: None, is_tax_connector_enabled: None, + is_l2_l3_enabled: None, is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, @@ -1841,6 +1859,7 @@ impl From for ProfileUpdateInternal { should_collect_cvv_during_payment: None, tax_connector_id: None, is_tax_connector_enabled: None, + is_l2_l3_enabled: None, is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, @@ -1876,6 +1895,7 @@ impl From for ProfileUpdateInternal { is_recon_enabled: None, applepay_verified_domains: None, payment_link_config: None, + is_l2_l3_enabled: None, session_expiry: None, authentication_connector_details: None, payout_link_config: None, @@ -1931,6 +1951,7 @@ impl From for ProfileUpdateInternal { metadata: None, is_recon_enabled: None, applepay_verified_domains: None, + is_l2_l3_enabled: None, payment_link_config: None, session_expiry: None, authentication_connector_details: None, @@ -1981,6 +2002,7 @@ impl From for ProfileUpdateInternal { modified_at: now, return_url: None, enable_payment_response_hash: None, + is_l2_l3_enabled: None, payment_response_hash_key: None, redirect_to_merchant_with_http_post: None, webhook_details: None, @@ -2070,6 +2092,7 @@ impl From for ProfileUpdateInternal { max_auto_retries_enabled: None, is_click_to_pay_enabled: None, authentication_product_ids: None, + is_l2_l3_enabled: None, three_ds_decision_manager_config: None, card_testing_guard_config: None, card_testing_secret_key: None, @@ -2129,6 +2152,7 @@ impl From for ProfileUpdateInternal { three_ds_decision_manager_config: Some(three_ds_decision_manager_config), card_testing_guard_config: None, card_testing_secret_key: None, + is_l2_l3_enabled: None, is_clear_pan_retries_enabled: None, is_debit_routing_enabled: None, merchant_business_country: None, @@ -2187,6 +2211,7 @@ impl From for ProfileUpdateInternal { card_testing_secret_key: card_testing_secret_key.map(Encryption::from), is_clear_pan_retries_enabled: None, is_debit_routing_enabled: None, + is_l2_l3_enabled: None, merchant_business_country: None, revenue_recovery_retry_algorithm_type: None, revenue_recovery_retry_algorithm_data: None, @@ -2226,6 +2251,7 @@ impl From for ProfileUpdateInternal { always_collect_billing_details_from_wallet_connector: None, always_collect_shipping_details_from_wallet_connector: None, routing_algorithm_id: None, + is_l2_l3_enabled: None, payout_routing_algorithm_id: None, order_fulfillment_time: None, order_fulfillment_time_origin: None, @@ -2335,6 +2361,7 @@ impl Conversion for Profile { dispute_polling_interval: None, split_txns_enabled: Some(self.split_txns_enabled), is_manual_retry_enabled: None, + is_l2_l3_enabled: None, always_enable_overcapture: None, billing_processor_id: self.billing_processor_id, }) @@ -2503,6 +2530,7 @@ impl Conversion for Profile { is_external_vault_enabled: self.is_external_vault_enabled, external_vault_connector_details: self.external_vault_connector_details, merchant_category_code: self.merchant_category_code, + is_l2_l3_enabled: None, merchant_country_code: self.merchant_country_code, split_txns_enabled: Some(self.split_txns_enabled), billing_processor_id: self.billing_processor_id, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 9652bfdd52..ad7e8e1fae 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -3523,6 +3523,7 @@ impl ProfileCreateBridge for api::ProfileCreate { .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("error while generating external vault details")?, billing_processor_id: self.billing_processor_id, + is_l2_l3_enabled: self.is_l2_l3_enabled.unwrap_or(false), })) } @@ -4027,6 +4028,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate { .external_vault_connector_details .map(ForeignInto::foreign_into), billing_processor_id: self.billing_processor_id, + is_l2_l3_enabled: self.is_l2_l3_enabled, }, ))) } diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 903dfa58d6..0fbf9927b3 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -7993,6 +7993,7 @@ where pub threeds_method_comp_ind: Option, pub whole_connector_response: Option>, pub is_manual_retry_enabled: Option, + pub is_l2_l3_enabled: bool, } #[derive(Clone, serde::Serialize, Debug)] diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs index 77764e1abe..37abdc4d9c 100644 --- a/crates/router/src/core/payments/operations/payment_approve.rs +++ b/crates/router/src/core/payments/operations/payment_approve.rs @@ -205,6 +205,7 @@ impl GetTracker, api::PaymentsCaptureR threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs index e6e645cfa6..4b004fad2a 100644 --- a/crates/router/src/core/payments/operations/payment_cancel.rs +++ b/crates/router/src/core/payments/operations/payment_cancel.rs @@ -216,6 +216,7 @@ impl GetTracker, api::PaymentsCancelRe threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs index c02c0d7fa8..33890876bf 100644 --- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs +++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs @@ -199,6 +199,7 @@ impl GetTracker, api::PaymentsCancelPo threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs index 51eef70f5a..24a32fc0c7 100644 --- a/crates/router/src/core/payments/operations/payment_capture.rs +++ b/crates/router/src/core/payments/operations/payment_capture.rs @@ -271,6 +271,7 @@ impl GetTracker, api::Paymen threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs index 793b3c1d3c..94a1bb70fa 100644 --- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs +++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs @@ -364,6 +364,7 @@ impl GetTracker, api::PaymentsRequest> threeds_method_comp_ind: request.threeds_method_comp_ind.clone(), whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: business_profile.is_l2_l3_enabled, }; let customer_details = Some(CustomerDetails { diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs index d0e08ee0c8..293cfb2cda 100644 --- a/crates/router/src/core/payments/operations/payment_confirm.rs +++ b/crates/router/src/core/payments/operations/payment_confirm.rs @@ -832,6 +832,7 @@ impl GetTracker, api::PaymentsRequest> threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: business_profile.is_manual_retry_enabled, + is_l2_l3_enabled: business_profile.is_l2_l3_enabled, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index 854659a61f..18873c346a 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -630,6 +630,7 @@ impl GetTracker, api::PaymentsRequest> threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: business_profile.is_l2_l3_enabled, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs index d4f9703bd8..da4c5211c0 100644 --- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs +++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs @@ -177,6 +177,7 @@ impl GetTracker, api::PaymentsPostSess threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { operation: Box::new(self), diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs index 28f0c05e68..f40b90c667 100644 --- a/crates/router/src/core/payments/operations/payment_reject.rs +++ b/crates/router/src/core/payments/operations/payment_reject.rs @@ -203,6 +203,7 @@ impl GetTracker, PaymentsCancelRequest threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs index 0e36d1485e..125957f70b 100644 --- a/crates/router/src/core/payments/operations/payment_session.rs +++ b/crates/router/src/core/payments/operations/payment_session.rs @@ -226,6 +226,7 @@ impl GetTracker, api::PaymentsSessionR threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs index c782494b56..af50f42408 100644 --- a/crates/router/src/core/payments/operations/payment_start.rs +++ b/crates/router/src/core/payments/operations/payment_start.rs @@ -213,6 +213,7 @@ impl GetTracker, api::PaymentsStartReq threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs index 31d86bfcec..5ab7fe34f7 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -554,6 +554,7 @@ async fn get_tracker_for_sync< threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: business_profile.is_manual_retry_enabled, + is_l2_l3_enabled: business_profile.is_l2_l3_enabled, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index cfd5734662..f741eb48f1 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -522,6 +522,7 @@ impl GetTracker, api::PaymentsRequest> threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: business_profile.is_l2_l3_enabled, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rs index 265b4da26b..47622f657c 100644 --- a/crates/router/src/core/payments/operations/payment_update_metadata.rs +++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs @@ -163,6 +163,7 @@ impl GetTracker, api::PaymentsUpdateMe threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { operation: Box::new(self), diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs index 3528b491a2..44fcf23e5a 100644 --- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs +++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs @@ -182,6 +182,7 @@ impl threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs index 5a3e44f053..9d9cfb82ec 100644 --- a/crates/router/src/core/payments/operations/tax_calculation.rs +++ b/crates/router/src/core/payments/operations/tax_calculation.rs @@ -192,6 +192,7 @@ impl threeds_method_comp_ind: None, whole_connector_response: None, is_manual_retry_enabled: None, + is_l2_l3_enabled: false, }; let get_trackers_response = operations::GetTrackerResponse { operation: Box::new(self), diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 53876336f0..51730d485f 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -1747,57 +1747,58 @@ where .collect::, _>>() }) .transpose()?; - let l2_l3_data = state.conf.l2_l3_data_config.enabled.then(|| { - let shipping_address = unified_address.get_shipping(); - let billing_address = unified_address.get_payment_billing(); - let merchant_tax_registration_id = merchant_context - .get_merchant_account() - .get_merchant_tax_registration_id(); + let l2_l3_data = + (state.conf.l2_l3_data_config.enabled && payment_data.is_l2_l3_enabled).then(|| { + let shipping_address = unified_address.get_shipping(); + let billing_address = unified_address.get_payment_billing(); + let merchant_tax_registration_id = merchant_context + .get_merchant_account() + .get_merchant_tax_registration_id(); - types::L2L3Data { - order_date: payment_data.payment_intent.order_date, - tax_status: payment_data.payment_intent.tax_status, - customer_tax_registration_id: customer.as_ref().and_then(|c| { - c.tax_registration_id + types::L2L3Data { + order_date: payment_data.payment_intent.order_date, + tax_status: payment_data.payment_intent.tax_status, + customer_tax_registration_id: customer.as_ref().and_then(|c| { + c.tax_registration_id + .as_ref() + .map(|e| e.clone().into_inner()) + }), + order_details: order_details.clone(), + discount_amount: payment_data.payment_intent.discount_amount, + shipping_cost: payment_data.payment_intent.shipping_cost, + shipping_amount_tax: payment_data.payment_intent.shipping_amount_tax, + duty_amount: payment_data.payment_intent.duty_amount, + order_tax_amount: payment_data + .payment_attempt + .net_amount + .get_order_tax_amount(), + merchant_order_reference_id: payment_data + .payment_intent + .merchant_order_reference_id + .clone(), + customer_id: payment_data.payment_intent.customer_id.clone(), + shipping_origin_zip: shipping_address + .and_then(|addr| addr.address.as_ref()) + .and_then(|details| details.origin_zip.clone()), + shipping_state: shipping_address .as_ref() - .map(|e| e.clone().into_inner()) - }), - order_details: order_details.clone(), - discount_amount: payment_data.payment_intent.discount_amount, - shipping_cost: payment_data.payment_intent.shipping_cost, - shipping_amount_tax: payment_data.payment_intent.shipping_amount_tax, - duty_amount: payment_data.payment_intent.duty_amount, - order_tax_amount: payment_data - .payment_attempt - .net_amount - .get_order_tax_amount(), - merchant_order_reference_id: payment_data - .payment_intent - .merchant_order_reference_id - .clone(), - customer_id: payment_data.payment_intent.customer_id.clone(), - shipping_origin_zip: shipping_address - .and_then(|addr| addr.address.as_ref()) - .and_then(|details| details.origin_zip.clone()), - shipping_state: shipping_address - .as_ref() - .and_then(|addr| addr.address.as_ref()) - .and_then(|details| details.state.clone()), - shipping_country: shipping_address - .as_ref() - .and_then(|addr| addr.address.as_ref()) - .and_then(|details| details.country), - shipping_destination_zip: shipping_address - .as_ref() - .and_then(|addr| addr.address.as_ref()) - .and_then(|details| details.zip.clone()), - billing_address_city: billing_address - .as_ref() - .and_then(|addr| addr.address.as_ref()) - .and_then(|details| details.city.clone()), - merchant_tax_registration_id, - } - }); + .and_then(|addr| addr.address.as_ref()) + .and_then(|details| details.state.clone()), + shipping_country: shipping_address + .as_ref() + .and_then(|addr| addr.address.as_ref()) + .and_then(|details| details.country), + shipping_destination_zip: shipping_address + .as_ref() + .and_then(|addr| addr.address.as_ref()) + .and_then(|details| details.zip.clone()), + billing_address_city: billing_address + .as_ref() + .and_then(|addr| addr.address.as_ref()) + .and_then(|details| details.city.clone()), + merchant_tax_registration_id, + } + }); crate::logger::debug!("unified address details {:?}", unified_address); let router_data = types::RouterData { diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs index 10c1b8ddb2..f7d2e4bec0 100644 --- a/crates/router/src/db/events.rs +++ b/crates/router/src/db/events.rs @@ -1290,6 +1290,7 @@ mod tests { always_enable_overcapture: None, external_vault_details: domain::ExternalVaultDetails::Skip, billing_processor_id: None, + is_l2_l3_enabled: false, }); let business_profile = state diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs index eedac7c401..004b04f0c3 100644 --- a/crates/router/src/types/api/admin.rs +++ b/crates/router/src/types/api/admin.rs @@ -241,6 +241,7 @@ impl ForeignTryFrom for ProfileResponse { external_vault_connector_details: external_vault_connector_details .map(ForeignFrom::foreign_from), billing_processor_id: item.billing_processor_id, + is_l2_l3_enabled: Some(item.is_l2_l3_enabled), }) } } @@ -322,6 +323,7 @@ impl ForeignTryFrom for ProfileResponse { merchant_business_country: item.merchant_business_country, is_iframe_redirection_enabled: item.is_iframe_redirection_enabled, is_external_vault_enabled: item.is_external_vault_enabled, + is_l2_l3_enabled: None, external_vault_connector_details: item .external_vault_connector_details .map(ForeignInto::foreign_into), @@ -511,5 +513,6 @@ pub async fn create_profile_from_merchant_account( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("error while generating external_vault_details")?, billing_processor_id: request.billing_processor_id, + is_l2_l3_enabled: request.is_l2_l3_enabled.unwrap_or(false), })) } diff --git a/migrations/2025-10-06-093228_add_l2_l3_to_business_profile/down.sql b/migrations/2025-10-06-093228_add_l2_l3_to_business_profile/down.sql new file mode 100644 index 0000000000..e7c9b7e695 --- /dev/null +++ b/migrations/2025-10-06-093228_add_l2_l3_to_business_profile/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE business_profile DROP COLUMN IF EXISTS is_l2_l3_enabled; diff --git a/migrations/2025-10-06-093228_add_l2_l3_to_business_profile/up.sql b/migrations/2025-10-06-093228_add_l2_l3_to_business_profile/up.sql new file mode 100644 index 0000000000..3acb8b0c05 --- /dev/null +++ b/migrations/2025-10-06-093228_add_l2_l3_to_business_profile/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_l2_l3_enabled BOOLEAN;