diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 603c0f769347..dc76ea3d33c6 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -867,6 +867,16 @@ pub struct PaymentsRequest { /// Choose what kind of sca exemption is required for this payment #[schema(value_type = Option)] pub psd2_sca_exemption_type: Option, + + /// Service details for external authentication + pub service_details: Option, +} + +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] +pub struct ServiceDetails { + pub merchant_transaction_id: Option, + pub correlation_id: Option, + pub x_src_flow_id: Option, } #[cfg(feature = "v1")] diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs index 0310e60ebbd8..3f1020e03693 100644 --- a/crates/diesel_models/src/authentication.rs +++ b/crates/diesel_models/src/authentication.rs @@ -47,6 +47,7 @@ pub struct Authentication { pub ds_trans_id: Option, pub directory_server_id: Option, pub acquirer_country_code: Option, + pub service_details: Option, } impl Authentication { @@ -94,6 +95,7 @@ pub struct AuthenticationNew { pub ds_trans_id: Option, pub directory_server_id: Option, pub acquirer_country_code: Option, + pub service_details: Option, } #[derive(Debug)] @@ -186,6 +188,7 @@ pub struct AuthenticationUpdateInternal { pub ds_trans_id: Option, pub directory_server_id: Option, pub acquirer_country_code: Option, + pub service_details: Option, } impl Default for AuthenticationUpdateInternal { @@ -219,6 +222,7 @@ impl Default for AuthenticationUpdateInternal { ds_trans_id: Default::default(), directory_server_id: Default::default(), acquirer_country_code: Default::default(), + service_details: Default::default(), } } } @@ -254,6 +258,7 @@ impl AuthenticationUpdateInternal { ds_trans_id, directory_server_id, acquirer_country_code, + service_details, } = self; Authentication { connector_authentication_id: connector_authentication_id @@ -288,6 +293,7 @@ impl AuthenticationUpdateInternal { ds_trans_id: ds_trans_id.or(source.ds_trans_id), directory_server_id: directory_server_id.or(source.directory_server_id), acquirer_country_code: acquirer_country_code.or(source.acquirer_country_code), + service_details: service_details.or(source.service_details), ..source } } diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 936428bd46c5..4324266e4545 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -120,6 +120,7 @@ diesel::table! { directory_server_id -> Nullable, #[max_length = 64] acquirer_country_code -> Nullable, + service_details -> Nullable, } } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index 3686cfc55500..fccae9a6f4c9 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -121,6 +121,7 @@ diesel::table! { directory_server_id -> Nullable, #[max_length = 64] acquirer_country_code -> Nullable, + service_details -> Nullable, } } @@ -204,12 +205,6 @@ diesel::table! { #[max_length = 64] tax_connector_id -> Nullable, is_tax_connector_enabled -> Nullable, - version -> ApiVersion, - dynamic_routing_algorithm -> Nullable, - is_network_tokenization_enabled -> Bool, - is_auto_retries_enabled -> Nullable, - max_auto_retries_enabled -> Nullable, - is_click_to_pay_enabled -> Bool, #[max_length = 64] routing_algorithm_id -> Nullable, order_fulfillment_time -> Nullable, @@ -222,6 +217,12 @@ diesel::table! { should_collect_cvv_during_payment -> Bool, #[max_length = 64] id -> Varchar, + version -> ApiVersion, + dynamic_routing_algorithm -> Nullable, + is_network_tokenization_enabled -> Bool, + is_auto_retries_enabled -> Nullable, + max_auto_retries_enabled -> Nullable, + is_click_to_pay_enabled -> Bool, } } @@ -806,9 +807,6 @@ diesel::table! { organization_id -> Varchar, #[max_length = 32] card_network -> Nullable, - shipping_cost -> Nullable, - order_tax_amount -> Nullable, - connector_mandate_detail -> Nullable, payment_method_type_v2 -> Varchar, #[max_length = 128] connector_payment_id -> Nullable, @@ -825,6 +823,9 @@ diesel::table! { connector_payment_data -> Nullable, #[max_length = 64] id -> Varchar, + shipping_cost -> Nullable, + order_tax_amount -> Nullable, + connector_mandate_detail -> Nullable, } } @@ -877,7 +878,6 @@ diesel::table! { organization_id -> Varchar, tax_details -> Nullable, skip_external_tax_calculation -> Nullable, - psd2_sca_exemption_type -> Nullable, #[max_length = 64] merchant_reference_id -> Nullable, billing_address -> Nullable, @@ -899,6 +899,7 @@ diesel::table! { payment_link_config -> Nullable, #[max_length = 64] id -> Varchar, + psd2_sca_exemption_type -> Nullable, } } @@ -958,12 +959,6 @@ diesel::table! { payment_method_billing_address -> Nullable, #[max_length = 64] updated_by -> Nullable, - version -> ApiVersion, - #[max_length = 128] - network_token_requestor_reference_id -> Nullable, - #[max_length = 64] - network_token_locker_id -> Nullable, - network_token_payment_method_data -> Nullable, #[max_length = 64] locker_fingerprint_id -> Nullable, #[max_length = 64] @@ -972,6 +967,12 @@ diesel::table! { payment_method_subtype -> Nullable, #[max_length = 64] id -> Varchar, + version -> ApiVersion, + #[max_length = 128] + network_token_requestor_reference_id -> Nullable, + #[max_length = 64] + network_token_locker_id -> Nullable, + network_token_payment_method_data -> Nullable, } } diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs index 01cc6a89562d..21c2ae20e2ca 100644 --- a/crates/router/src/core/authentication/utils.rs +++ b/crates/router/src/core/authentication/utils.rs @@ -219,6 +219,7 @@ pub async fn create_new_authentication( ds_trans_id: None, directory_server_id: None, acquirer_country_code: None, + service_details: None, }; state .store diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 1dd9400b8bc4..8a1829d5c3cc 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -4249,6 +4249,7 @@ where pub poll_config: Option, pub tax_data: Option, pub session_id: Option, + pub service_details: Option, } #[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 2bc18122b227..1311f39a61d4 100644 --- a/crates/router/src/core/payments/operations/payment_approve.rs +++ b/crates/router/src/core/payments/operations/payment_approve.rs @@ -194,6 +194,7 @@ impl GetTracker, api::PaymentsCaptureRequest> poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 8d7361cd257e..d1bffb5145a0 100644 --- a/crates/router/src/core/payments/operations/payment_cancel.rs +++ b/crates/router/src/core/payments/operations/payment_cancel.rs @@ -203,6 +203,7 @@ impl GetTracker, api::PaymentsCancelRequest> poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 2451cbcd8e9d..d554f25c6b58 100644 --- a/crates/router/src/core/payments/operations/payment_capture.rs +++ b/crates/router/src/core/payments/operations/payment_capture.rs @@ -254,6 +254,7 @@ impl GetTracker, api::PaymentsCaptu poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 8c003f54adf4..6016ae8db63d 100644 --- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs +++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs @@ -346,6 +346,7 @@ impl GetTracker, api::PaymentsRequest> for Co poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 4b4091b1c3a6..24186e08a343 100644 --- a/crates/router/src/core/payments/operations/payment_confirm.rs +++ b/crates/router/src/core/payments/operations/payment_confirm.rs @@ -810,6 +810,7 @@ impl GetTracker, api::PaymentsRequest> for Pa poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 30891e76e86f..ea32b643ef29 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -612,6 +612,7 @@ impl GetTracker, api::PaymentsRequest> for Pa poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 846f739e0823..94e5ad10854e 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 @@ -165,6 +165,7 @@ impl GetTracker, api::PaymentsPostSessionToke poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 23531d2342dc..1c2a0c123db7 100644 --- a/crates/router/src/core/payments/operations/payment_reject.rs +++ b/crates/router/src/core/payments/operations/payment_reject.rs @@ -190,6 +190,7 @@ impl GetTracker, PaymentsCancelRequest> for P poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 1bc11854ad03..95b2aa3798df 100644 --- a/crates/router/src/core/payments/operations/payment_session.rs +++ b/crates/router/src/core/payments/operations/payment_session.rs @@ -212,6 +212,7 @@ impl GetTracker, api::PaymentsSessionRequest> poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 cad5dcfbd676..e78a201cb186 100644 --- a/crates/router/src/core/payments/operations/payment_start.rs +++ b/crates/router/src/core/payments/operations/payment_start.rs @@ -197,6 +197,7 @@ impl GetTracker, api::PaymentsStartRequest> f poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 a3a826ccd0e9..a60374b307a9 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -506,6 +506,7 @@ async fn get_tracker_for_sync< poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 98491cab1db8..8f6f49c8e6b1 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -490,6 +490,7 @@ impl GetTracker, api::PaymentsRequest> for Pa poll_config: None, tax_data: None, session_id: None, + service_details: None, }; let get_trackers_response = operations::GetTrackerResponse { 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 1ddaf0b6abf9..f8c1f0c6082b 100644 --- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs +++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs @@ -171,6 +171,7 @@ impl poll_config: None, tax_data: None, session_id: None, + service_details: None, }; 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 c615e2eb1744..fdde2bff96cb 100644 --- a/crates/router/src/core/payments/operations/tax_calculation.rs +++ b/crates/router/src/core/payments/operations/tax_calculation.rs @@ -178,6 +178,7 @@ impl GetTracker, api::PaymentsDynamicTaxCalcu poll_config: None, tax_data: Some(tax_data), session_id: request.session_id.clone(), + service_details: None, }; let get_trackers_response = operations::GetTrackerResponse { operation: Box::new(self), diff --git a/crates/router/src/db/authentication.rs b/crates/router/src/db/authentication.rs index 1307c53338de..af3da68e6ae5 100644 --- a/crates/router/src/db/authentication.rs +++ b/crates/router/src/db/authentication.rs @@ -150,6 +150,7 @@ impl AuthenticationInterface for MockDb { ds_trans_id: authentication.ds_trans_id, directory_server_id: authentication.directory_server_id, acquirer_country_code: authentication.acquirer_country_code, + service_details: authentication.service_details, }; authentications.push(authentication.clone()); Ok(authentication) diff --git a/migrations/2024-12-05-115544_add-service-details/down.sql b/migrations/2024-12-05-115544_add-service-details/down.sql new file mode 100644 index 000000000000..1c42146adfc1 --- /dev/null +++ b/migrations/2024-12-05-115544_add-service-details/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE authentication DROP COLUMN IF EXISTS service_details; \ No newline at end of file diff --git a/migrations/2024-12-05-115544_add-service-details/up.sql b/migrations/2024-12-05-115544_add-service-details/up.sql new file mode 100644 index 000000000000..3555647a987e --- /dev/null +++ b/migrations/2024-12-05-115544_add-service-details/up.sql @@ -0,0 +1,4 @@ +-- Your SQL goes here +ALTER TABLE authentication +ADD COLUMN IF NOT EXISTS service_details JSONB +DEFAULT NULL; \ No newline at end of file