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 uas framework support (#6743)

Sahkal Poddar9466ced89407
diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs
index 0310e60ebb..5d0e58c562 100644
--- a/crates/diesel_models/src/authentication.rs
+++ b/crates/diesel_models/src/authentication.rs
@@ -152,6 +152,10 @@ pub enum AuthenticationUpdate {
PostAuthorizationUpdate {
authentication_lifecycle_status: common_enums::AuthenticationLifecycleStatus,
},
+ AuthenticationStatusUpdate {
+ trans_status: common_enums::TransactionStatus,
+ authentication_status: common_enums::AuthenticationStatus,
+ },
}
#[derive(Clone, Debug, Eq, PartialEq, AsChangeset, Serialize, Deserialize)]
@@ -418,6 +422,14 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
connector_metadata,
..Default::default()
},
+ AuthenticationUpdate::AuthenticationStatusUpdate {
+ trans_status,
+ authentication_status,
+ } => Self {
+ trans_status: Some(trans_status),
+ authentication_status: Some(authentication_status),
+ ..Default::default()
+ },
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index a3867ce3e6..b070c6bc84 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -87,6 +87,7 @@ pub struct RouterData<Flow, Request, Response> {
pub connector_mandate_request_reference_id: Option<String>,
+ pub authentication_id: Option<String>,
/// Contains the type of sca exemption required for the transaction
pub psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
}
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2.rs b/crates/hyperswitch_domain_models/src/router_data_v2.rs
index 9e3a7f255a..acc7343cb1 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2.rs
@@ -8,7 +8,7 @@ pub use flow_common_types::FrmFlowData;
pub use flow_common_types::PayoutFlowData;
pub use flow_common_types::{
AccessTokenFlowData, DisputesFlowData, ExternalAuthenticationFlowData, FilesFlowData,
- MandateRevokeFlowData, PaymentFlowData, RefundFlowData, WebhookSourceVerifyData,
+ MandateRevokeFlowData, PaymentFlowData, RefundFlowData, UasFlowData, WebhookSourceVerifyData,
};
use crate::router_data::{ConnectorAuthType, ErrorResponse};
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index b2dea40082..85028a3bd7 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -149,3 +149,9 @@ pub struct FilesFlowData {
pub connector_meta_data: Option<pii::SecretSerdeValue>,
pub connector_request_reference_id: String,
}
+
+#[derive(Debug, Clone)]
+pub struct UasFlowData {
+ pub authenticate_by: String,
+ pub source_authentication_id: String,
+}
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index b14e27e845..7a45faf026 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -1,5 +1,6 @@
pub mod authentication;
pub mod fraud_check;
+pub mod unified_authentication_service;
use api_models::payments::{AdditionalPaymentData, RequestSurchargeDetails};
use common_utils::{
consts, errors,
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs b/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
new file mode 100644
index 0000000000..cbca353b10
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
@@ -0,0 +1,58 @@
+use masking::Secret;
+
+#[derive(Clone, serde::Deserialize, Debug, serde::Serialize)]
+pub struct UasPreAuthenticationRequestData {
+ pub service_details: Option<ServiceDetails>,
+ pub transaction_details: Option<TransactionDetails>,
+}
+
+#[derive(Clone, serde::Deserialize, Debug, serde::Serialize)]
+pub struct ServiceDetails {
+ pub service_session_ids: Option<ServiceSessionIds>,
+}
+
+#[derive(Clone, serde::Deserialize, Debug, serde::Serialize)]
+pub struct ServiceSessionIds {
+ pub correlation_id: Option<String>,
+ pub merchant_transaction_id: Option<String>,
+ pub x_src_flow_id: Option<String>,
+}
+
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone)]
+pub struct TransactionDetails {
+ pub amount: common_utils::types::MinorUnit,
+ pub currency: common_enums::Currency,
+}
+
+#[derive(Clone, Debug)]
+pub struct UasPostAuthenticationRequestData;
+
+#[derive(Debug, Clone)]
+pub enum UasAuthenticationResponseData {
+ PreAuthentication {},
+ PostAuthentication {
+ authentication_details: PostAuthenticationDetails,
+ },
+}
+
+#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
+pub struct PostAuthenticationDetails {
+ pub eci: Option<String>,
+ pub token_details: TokenDetails,
+ pub dynamic_data_details: Option<DynamicData>,
+}
+
+#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
+pub struct TokenDetails {
+ pub payment_token: cards::CardNumber,
+ pub payment_account_reference: String,
+ pub token_expiration_month: Secret<String>,
+ pub token_expiration_year: Secret<String>,
+}
+
+#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
+pub struct DynamicData {
+ pub dynamic_data_value: Option<Secret<String>>,
+ pub dynamic_data_type: String,
+ pub ds_trans_id: Option<String>,
+}
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index a2da338419..f6fe1d85b5 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -52,3 +52,5 @@ pub mod verification;
#[cfg(feature = "olap")]
pub mod verify_connector;
pub mod webhooks;
+
+pub mod unified_authentication_service;
diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs
index c4b35d5279..da6252d542 100644
--- a/crates/router/src/core/authentication/transformers.rs
+++ b/crates/router/src/core/authentication/transformers.rs
@@ -190,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,
+ authentication_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 84ba1f26a5..b07268ae66 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
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 92edc083e0..8b837d7b22 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,
+ authentication_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 6e29d01c81..d05f728002 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
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 cdab3e4dae..683a153ff1 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
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 a66a47f709..da73267bd0 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rs
index 99af165762..f2db3228db 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index dcbafa5aa9..7912eb090d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4327,7 +4327,7 @@ pub fn if_not_create_change_operation<'a, Op, F>(
current: &'a Op,
) -> BoxedOperation<'a, F, api::PaymentsRequest, PaymentData<F>>
where
- F: Send + Clone,
+ F: Send + Clone + Sync,
Op: Operation<F, api::PaymentsRequest, Data = PaymentData<F>> + Send + Sync,
&'a Op: Operation<F, api::PaymentsRequest, Data = PaymentData<F>>,
PaymentStatus: Operation<F, api::PaymentsRequest, Data = PaymentData<F>>,
diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs
index 286680062f..8725470e25 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -2226,3 +2226,114 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Zsl,
connector::Plaid
);
+
+macro_rules! default_imp_for_new_connector_integration_uas {
+ ($($path:ident::$connector:ident),*) => {
+ $( impl api::UnifiedAuthenticationServiceV2 for $path::$connector {}
+ impl api::UasPreAuthenticationV2 for $path::$connector {}
+ impl api::UasPostAuthenticationV2 for $path::$connector {}
+ impl
+ services::ConnectorIntegrationV2<
+ api::PreAuthenticate,
+ types::UasFlowData,
+ types::UasPreAuthenticationRequestData,
+ types::UasAuthenticationResponseData,
+ > for $path::$connector
+ {}
+ impl
+ services::ConnectorIntegrationV2<
+ api::PostAuthenticate,
+ types::UasFlowData,
+ types::UasPostAuthenticationRequestData,
+ types::UasAuthenticationResponseData,
+ > for $path::$connector
+ {}
+ )*
+ };
+}
+
+default_imp_for_new_connector_integration_uas!(
+ connector::Aci,
+ connector::Adyen,
+ connector::Adyenplatform,
+ connector::Airwallex,
+ connector::Amazonpay,
+ connector::Authorizedotnet,
+ connector::Bambora,
+ connector::Bamboraapac,
+ connector::Bankofamerica,
+ connector::Billwerk,
+ connector::Bitpay,
+ connector::Bluesnap,
+ connector::Boku,
+ connector::Braintree,
+ connector::Cashtocode,
+ connector::Checkout,
+ connector::Cryptopay,
+ connector::Coinbase,
+ connector::Cybersource,
+ connector::Datatrans,
+ connector::Deutschebank,
+ connector::Digitalvirgo,
+ connector::Dlocal,
+ connector::Ebanx,
+ connector::Elavon,
+ connector::Fiserv,
+ connector::Fiservemea,
+ connector::Forte,
+ connector::Fiuu,
+ connector::Globalpay,
+ connector::Globepay,
+ connector::Gocardless,
+ connector::Gpayments,
+ connector::Helcim,
+ connector::Iatapay,
+ connector::Inespay,
+ connector::Itaubank,
+ connector::Jpmorgan,
+ connector::Klarna,
+ connector::Mifinity,
+ connector::Mollie,
+ connector::Multisafepay,
+ connector::Netcetera,
+ connector::Nexinets,
+ connector::Nexixpay,
+ connector::Nmi,
+ connector::Nomupay,
+ connector::Noon,
+ connector::Novalnet,
+ connector::Nuvei,
+ connector::Opayo,
+ connector::Opennode,
+ connector::Paybox,
+ connector::Payeezy,
+ connector::Payme,
+ connector::Payone,
+ connector::Paypal,
+ connector::Payu,
+ connector::Placetopay,
+ connector::Powertranz,
+ connector::Prophetpay,
+ connector::Rapyd,
+ connector::Razorpay,
+ connector::Redsys,
+ connector::Riskified,
+ connector::Signifyd,
+ connector::Square,
+ connector::Stax,
+ connector::Stripe,
+ connector::Shift4,
+ connector::Taxjar,
+ connector::Trustpay,
+ connector::Threedsecureio,
+ connector::Thunes,
+ connector::Tsys,
+ connector::Volt,
+ connector::Wellsfargo,
+ connector::Wise,
+ connector::Worldline,
+ connector::Worldpay,
+ connector::Zen,
+ connector::Zsl,
+ connector::Plaid
+);
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 00001e0e6c..9ce0ccb449 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -2610,6 +2610,232 @@ default_imp_for_post_session_tokens!(
connector::Wise
);
+macro_rules! default_imp_for_uas_pre_authentication {
+ ($($path:ident::$connector:ident),*) => {
+ $( impl api::UnifiedAuthenticationService for $path::$connector {}
+ impl api::UasPreAuthentication for $path::$connector {}
+ impl
+ services::ConnectorIntegration<
+ api::PreAuthenticate,
+ types::UasPreAuthenticationRequestData,
+ types::UasAuthenticationResponseData
+ > for $path::$connector
+ {}
+ )*
+ };
+}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> api::UasPreAuthentication for connector::DummyConnector<T> {}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> api::UnifiedAuthenticationService for connector::DummyConnector<T> {}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+ services::ConnectorIntegration<
+ api::PreAuthenticate,
+ types::UasPreAuthenticationRequestData,
+ types::UasAuthenticationResponseData,
+ > for connector::DummyConnector<T>
+{
+}
+
+default_imp_for_uas_pre_authentication!(
+ connector::Adyenplatform,
+ connector::Aci,
+ connector::Adyen,
+ connector::Airwallex,
+ connector::Amazonpay,
+ connector::Authorizedotnet,
+ connector::Bambora,
+ connector::Bamboraapac,
+ connector::Bankofamerica,
+ connector::Billwerk,
+ connector::Bitpay,
+ connector::Bluesnap,
+ connector::Boku,
+ connector::Braintree,
+ connector::Cashtocode,
+ connector::Checkout,
+ connector::Cryptopay,
+ connector::Coinbase,
+ connector::Cybersource,
+ connector::Datatrans,
+ connector::Deutschebank,
+ connector::Digitalvirgo,
+ connector::Dlocal,
+ connector::Ebanx,
+ connector::Elavon,
+ connector::Fiserv,
+ connector::Fiservemea,
+ connector::Fiuu,
+ connector::Forte,
+ connector::Globalpay,
+ connector::Globepay,
+ connector::Gocardless,
+ connector::Gpayments,
+ connector::Helcim,
+ connector::Iatapay,
+ connector::Itaubank,
+ connector::Jpmorgan,
+ connector::Klarna,
+ connector::Mifinity,
+ connector::Netcetera,
+ connector::Mollie,
+ connector::Multisafepay,
+ connector::Nexinets,
+ connector::Nexixpay,
+ connector::Nmi,
+ connector::Nomupay,
+ connector::Noon,
+ connector::Novalnet,
+ connector::Nuvei,
+ connector::Opayo,
+ connector::Opennode,
+ connector::Paybox,
+ connector::Payeezy,
+ connector::Payme,
+ connector::Payone,
+ connector::Paypal,
+ connector::Payu,
+ connector::Placetopay,
+ connector::Plaid,
+ connector::Powertranz,
+ connector::Prophetpay,
+ connector::Rapyd,
+ connector::Razorpay,
+ connector::Riskified,
+ connector::Shift4,
+ connector::Signifyd,
+ connector::Square,
+ connector::Stax,
+ connector::Stripe,
+ connector::Threedsecureio,
+ connector::Taxjar,
+ connector::Trustpay,
+ connector::Tsys,
+ connector::Volt,
+ connector::Wellsfargo,
+ connector::Wellsfargopayout,
+ connector::Wise,
+ connector::Worldline,
+ connector::Worldpay,
+ connector::Zen,
+ connector::Zsl,
+ connector::Inespay,
+ connector::Redsys,
+ connector::UnifiedAuthenticationService
+);
+
+macro_rules! default_imp_for_uas_post_authentication {
+ ($($path:ident::$connector:ident),*) => {
+ $( impl api::UasPostAuthentication for $path::$connector {}
+ impl
+ services::ConnectorIntegration<
+ api::PostAuthenticate,
+ types::UasPostAuthenticationRequestData,
+ types::UasAuthenticationResponseData
+ > for $path::$connector
+ {}
+ )*
+ };
+}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> api::UasPostAuthentication for connector::DummyConnector<T> {}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+ services::ConnectorIntegration<
+ api::PostAuthenticate,
+ types::UasPostAuthenticationRequestData,
+ types::UasAuthenticationResponseData,
+ > for connector::DummyConnector<T>
+{
+}
+
+default_imp_for_uas_post_authentication!(
+ connector::Adyenplatform,
+ connector::Aci,
+ connector::Adyen,
+ connector::Airwallex,
+ connector::Amazonpay,
+ connector::Authorizedotnet,
+ connector::Bambora,
+ connector::Bamboraapac,
+ connector::Bankofamerica,
+ connector::Billwerk,
+ connector::Bitpay,
+ connector::Bluesnap,
+ connector::Boku,
+ connector::Braintree,
+ connector::Cashtocode,
+ connector::Checkout,
+ connector::Cryptopay,
+ connector::Coinbase,
+ connector::Cybersource,
+ connector::Datatrans,
+ connector::Deutschebank,
+ connector::Digitalvirgo,
+ connector::Dlocal,
+ connector::Ebanx,
+ connector::Elavon,
+ connector::Fiserv,
+ connector::Fiservemea,
+ connector::Fiuu,
+ connector::Forte,
+ connector::Globalpay,
+ connector::Globepay,
+ connector::Gpayments,
+ connector::Gocardless,
+ connector::Helcim,
+ connector::Iatapay,
+ connector::Itaubank,
+ connector::Jpmorgan,
+ connector::Klarna,
+ connector::Mifinity,
+ connector::Netcetera,
+ connector::Mollie,
+ connector::Multisafepay,
+ connector::Nexinets,
+ connector::Nexixpay,
+ connector::Nmi,
+ connector::Nomupay,
+ connector::Noon,
+ connector::Novalnet,
+ connector::Nuvei,
+ connector::Opayo,
+ connector::Opennode,
+ connector::Paybox,
+ connector::Payeezy,
+ connector::Payme,
+ connector::Payone,
+ connector::Paypal,
+ connector::Payu,
+ connector::Placetopay,
+ connector::Plaid,
+ connector::Powertranz,
+ connector::Prophetpay,
+ connector::Rapyd,
+ connector::Razorpay,
+ connector::Riskified,
+ connector::Shift4,
+ connector::Signifyd,
+ connector::Square,
+ connector::Stax,
+ connector::Stripe,
+ connector::Threedsecureio,
+ connector::Taxjar,
+ connector::Trustpay,
+ connector::Tsys,
+ connector::Volt,
+ connector::Wellsfargo,
+ connector::Wellsfargopayout,
+ connector::Wise,
+ connector::Worldline,
+ connector::Worldpay,
+ connector::Zen,
+ connector::Zsl,
+ connector::Inespay,
+ connector::Redsys,
+ connector::UnifiedAuthenticationService
+);
/// Determines whether a capture API call should be made for a payment attempt
/// This function evaluates whether an authorized payment should proceed with a capture API call
/// based on various payment parameters. It's primarily used in two-step (auth + capture) payment flows for CaptureMethod SequentialAutomatic
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 61b47df325..6265ac3f18 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3964,6 +3964,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,
+ authentication_id: router_data.authentication_id,
psd2_sca_exemption_type: router_data.psd2_sca_exemption_type,
}
}
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index f957b939ac..a7e60274d1 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -295,6 +295,18 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
Ok(())
}
+ async fn call_unified_authentication_service_if_eligible<'a>(
+ &'a self,
+ _state: &SessionState,
+ _payment_data: &mut D,
+ _should_continue_confirm_transaction: &mut bool,
+ _connector_call_type: &ConnectorCallType,
+ _merchant_account: &domain::Profile,
+ _key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<(), errors::ApiErrorResponse> {
+ Ok(())
+ }
+
#[allow(clippy::too_many_arguments)]
async fn payments_dynamic_tax_calculation<'a>(
&'a self,
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 97832a0818..b3d2985bf8 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -32,7 +32,7 @@ type PaymentApproveOperation<'a, F> =
BoxedOperation<'a, F, api::PaymentsCaptureRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
for PaymentApprove
{
#[instrument(skip_all)]
@@ -209,7 +209,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureRequest> for PaymentApprove {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
+ for PaymentApprove
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -268,7 +270,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureRequest> for
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsCaptureRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsCaptureRequest, PaymentData<F>>
for PaymentApprove
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index ef6570abf8..a40ecf0242 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -33,7 +33,9 @@ type PaymentCancelOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsCancelRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for PaymentCancel {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
+ for PaymentCancel
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -218,7 +220,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for PaymentCancel {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
+ for PaymentCancel
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -286,7 +290,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsCancelRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsCancelRequest, PaymentData<F>>
for PaymentCancel
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 2451cbcd8e..d9068b402c 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -32,7 +32,7 @@ type PaymentCaptureOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsCaptureRequest, payments::PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest>
for PaymentCapture
{
#[instrument(skip_all)]
@@ -269,7 +269,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptu
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest>
+impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest>
for PaymentCapture
{
#[instrument(skip_all)]
@@ -326,8 +326,8 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRe
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsCaptureRequest, payments::PaymentData<F>>
- for PaymentCapture
+impl<F: Send + Clone + Sync>
+ ValidateRequest<F, api::PaymentsCaptureRequest, payments::PaymentData<F>> for PaymentCapture
{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
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 b296d6c305..f4f5813c1b 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -35,7 +35,9 @@ type CompleteAuthorizeOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for CompleteAuthorize {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
+ for CompleteAuthorize
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -369,7 +371,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for CompleteAuthorize {
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for CompleteAuthorize {
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -458,7 +460,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for Comple
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for CompleteAuthorize {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for CompleteAuthorize {
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -504,7 +506,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Comple
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>>
for CompleteAuthorize
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 67829f1fb7..c3fe518ff5 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -38,6 +38,10 @@ use crate::{
self, helpers, operations, populate_surcharge_details, CustomerDetails, PaymentAddress,
PaymentData,
},
+ unified_authentication_service::{
+ self,
+ types::{ClickToPay, UnifiedAuthenticationService, CTP_MASTERCARD},
+ },
utils as core_utils,
},
routes::{app::ReqState, SessionState},
@@ -59,7 +63,9 @@ pub struct PaymentConfirm;
type PaymentConfirmOperation<'b, F> = BoxedOperation<'b, F, api::PaymentsRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
+ for PaymentConfirm
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -827,7 +833,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentConfirm {
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentConfirm {
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -1027,6 +1033,93 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for Paymen
Ok(())
}
+ #[allow(clippy::too_many_arguments)]
+ async fn call_unified_authentication_service_if_eligible<'a>(
+ &'a self,
+ state: &SessionState,
+ payment_data: &mut PaymentData<F>,
+ _should_continue_confirm_transaction: &mut bool,
+ _connector_call_type: &ConnectorCallType,
+ business_profile: &domain::Profile,
+ key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<(), errors::ApiErrorResponse> {
+ let is_click_to_pay_enabled = true; // fetch from business profile
+
+ if let Some(payment_method) = payment_data.payment_attempt.payment_method {
+ if payment_method == storage_enums::PaymentMethod::Card && is_click_to_pay_enabled {
+ let connector_name = CTP_MASTERCARD; // since the above checks satisfies the connector should be click to pay hence hardcoded the connector name
+ let connector_mca = helpers::get_merchant_connector_account(
+ state,
+ &business_profile.merchant_id,
+ None,
+ key_store,
+ business_profile.get_id(),
+ connector_name,
+ None,
+ )
+ .await?;
+
+ let authentication_id =
+ common_utils::generate_id_with_default_len(consts::AUTHENTICATION_ID_PREFIX);
+
+ let payment_method = payment_data.payment_attempt.payment_method.ok_or(
+ errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "payment_method",
+ },
+ )?;
+
+ let connector_transaction_id = connector_mca
+ .clone()
+ .get_mca_id()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "Error while finding mca_id from merchant_connector_account",
+ )?;
+
+ ClickToPay::pre_authentication(
+ state,
+ key_store,
+ business_profile,
+ payment_data,
+ &connector_mca,
+ connector_name,
+ &authentication_id,
+ payment_method,
+ )
+ .await?;
+
+ payment_data.payment_attempt.authentication_id = Some(authentication_id.clone());
+
+ let network_token = ClickToPay::post_authentication(
+ state,
+ key_store,
+ business_profile,
+ payment_data,
+ &connector_mca,
+ connector_name,
+ payment_method,
+ )
+ .await?;
+
+ payment_data.payment_method_data =
+ network_token.map(domain::PaymentMethodData::NetworkToken);
+
+ unified_authentication_service::create_new_authentication(
+ state,
+ payment_data.payment_attempt.merchant_id.clone(),
+ connector_name.to_string(),
+ business_profile.get_id().clone(),
+ Some(payment_data.payment_intent.get_id().clone()),
+ connector_transaction_id,
+ &authentication_id,
+ )
+ .await?;
+ }
+ }
+
+ Ok(())
+ }
+
#[instrument(skip_all)]
async fn guard_payment_against_blocklist<'a>(
&'a self,
@@ -1111,7 +1204,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for Paymen
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -1137,7 +1230,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -1540,7 +1633,9 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>> for PaymentConfirm {
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>>
+ for PaymentConfirm
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 05c9010256..f6c47de376 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -71,7 +71,7 @@ type BoxedConfirmOperation<'b, F> =
// TODO: change the macro to include changes for v2
// TODO: PaymentData in the macro should be an input
-impl<F: Send + Clone> Operation<F, PaymentsConfirmIntentRequest> for &PaymentIntentConfirm {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsConfirmIntentRequest> for &PaymentIntentConfirm {
type Data = PaymentConfirmData<F>;
fn to_validate_request(
&self,
@@ -99,7 +99,7 @@ impl<F: Send + Clone> Operation<F, PaymentsConfirmIntentRequest> for &PaymentInt
}
}
#[automatically_derived]
-impl<F: Send + Clone> Operation<F, PaymentsConfirmIntentRequest> for PaymentIntentConfirm {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsConfirmIntentRequest> for PaymentIntentConfirm {
type Data = PaymentConfirmData<F>;
fn to_validate_request(
&self,
@@ -125,7 +125,7 @@ impl<F: Send + Clone> Operation<F, PaymentsConfirmIntentRequest> for PaymentInte
}
}
-impl<F: Send + Clone> ValidateRequest<F, PaymentsConfirmIntentRequest, PaymentConfirmData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, PaymentsConfirmIntentRequest, PaymentConfirmData<F>>
for PaymentIntentConfirm
{
#[instrument(skip_all)]
@@ -145,7 +145,7 @@ impl<F: Send + Clone> ValidateRequest<F, PaymentsConfirmIntentRequest, PaymentCo
}
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntentRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntentRequest>
for PaymentIntentConfirm
{
#[instrument(skip_all)]
@@ -259,7 +259,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntent
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, PaymentsConfirmIntentRequest, PaymentConfirmData<F>>
+impl<F: Clone + Send + Sync> Domain<F, PaymentsConfirmIntentRequest, PaymentConfirmData<F>>
for PaymentIntentConfirm
{
async fn get_customer_details<'a>(
@@ -348,7 +348,7 @@ impl<F: Clone + Send> Domain<F, PaymentsConfirmIntentRequest, PaymentConfirmData
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntentRequest>
+impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntentRequest>
for PaymentIntentConfirm
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 3bd5b9abcd..6b9a4a7671 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -67,7 +67,7 @@ type PaymentCreateOperation<'a, F> = BoxedOperation<'a, F, api::PaymentsRequest,
/// The `get_trackers` function for `PaymentsCreate` is an entrypoint for new payments
/// This will create all the entities required for a new payment from the request
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentCreate {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentCreate {
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -628,7 +628,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentCreate {
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentCreate {
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -816,7 +816,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for Paymen
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentCreate {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentCreate {
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -940,7 +940,9 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>> for PaymentCreate {
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>>
+ for PaymentCreate
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index 988e040f37..372d106eb9 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -29,7 +29,7 @@ use crate::{
#[derive(Debug, Clone, Copy)]
pub struct PaymentIntentCreate;
-impl<F: Send + Clone> Operation<F, PaymentsCreateIntentRequest> for &PaymentIntentCreate {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsCreateIntentRequest> for &PaymentIntentCreate {
type Data = payments::PaymentIntentData<F>;
fn to_validate_request(
&self,
@@ -55,7 +55,7 @@ impl<F: Send + Clone> Operation<F, PaymentsCreateIntentRequest> for &PaymentInte
}
}
-impl<F: Send + Clone> Operation<F, PaymentsCreateIntentRequest> for PaymentIntentCreate {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsCreateIntentRequest> for PaymentIntentCreate {
type Data = payments::PaymentIntentData<F>;
fn to_validate_request(
&self,
@@ -85,7 +85,8 @@ type PaymentsCreateIntentOperation<'b, F> =
BoxedOperation<'b, F, PaymentsCreateIntentRequest, payments::PaymentIntentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsCreateIntentRequest>
+impl<F: Send + Clone + Sync>
+ GetTracker<F, payments::PaymentIntentData<F>, PaymentsCreateIntentRequest>
for PaymentIntentCreate
{
#[instrument(skip_all)]
@@ -168,7 +169,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsCrea
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsCreateIntentRequest>
+impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsCreateIntentRequest>
for PaymentIntentCreate
{
#[instrument(skip_all)]
@@ -213,7 +214,7 @@ impl<F: Send + Clone>
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, PaymentsCreateIntentRequest, payments::PaymentIntentData<F>>
+impl<F: Clone + Send + Sync> Domain<F, PaymentsCreateIntentRequest, payments::PaymentIntentData<F>>
for PaymentIntentCreate
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index f66186c7c5..14eb9c2d8b 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -53,7 +53,7 @@ type BoxedConfirmOperation<'b, F> =
// TODO: change the macro to include changes for v2
// TODO: PaymentData in the macro should be an input
-impl<F: Send + Clone> Operation<F, PaymentsRetrieveRequest> for &PaymentGet {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsRetrieveRequest> for &PaymentGet {
type Data = PaymentStatusData<F>;
fn to_validate_request(
&self,
@@ -77,7 +77,7 @@ impl<F: Send + Clone> Operation<F, PaymentsRetrieveRequest> for &PaymentGet {
}
}
#[automatically_derived]
-impl<F: Send + Clone> Operation<F, PaymentsRetrieveRequest> for PaymentGet {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsRetrieveRequest> for PaymentGet {
type Data = PaymentStatusData<F>;
fn to_validate_request(
&self,
@@ -101,7 +101,7 @@ impl<F: Send + Clone> Operation<F, PaymentsRetrieveRequest> for PaymentGet {
}
}
-impl<F: Send + Clone> ValidateRequest<F, PaymentsRetrieveRequest, PaymentStatusData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, PaymentsRetrieveRequest, PaymentStatusData<F>>
for PaymentGet
{
#[instrument(skip_all)]
@@ -121,7 +121,9 @@ impl<F: Send + Clone> ValidateRequest<F, PaymentsRetrieveRequest, PaymentStatusD
}
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentStatusData<F>, PaymentsRetrieveRequest> for PaymentGet {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentStatusData<F>, PaymentsRetrieveRequest>
+ for PaymentGet
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -196,7 +198,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentStatusData<F>, PaymentsRetrieveReques
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, PaymentsRetrieveRequest, PaymentStatusData<F>> for PaymentGet {
+impl<F: Clone + Send + Sync> Domain<F, PaymentsRetrieveRequest, PaymentStatusData<F>>
+ for PaymentGet
+{
async fn get_customer_details<'a>(
&'a self,
state: &SessionState,
@@ -284,7 +288,9 @@ impl<F: Clone + Send> Domain<F, PaymentsRetrieveRequest, PaymentStatusData<F>> f
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentStatusData<F>, PaymentsRetrieveRequest> for PaymentGet {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentStatusData<F>, PaymentsRetrieveRequest>
+ for PaymentGet
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index 344f10434b..16b44436c1 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -22,7 +22,7 @@ use crate::{
#[derive(Debug, Clone, Copy)]
pub struct PaymentGetIntent;
-impl<F: Send + Clone> Operation<F, PaymentsGetIntentRequest> for &PaymentGetIntent {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsGetIntentRequest> for &PaymentGetIntent {
type Data = payments::PaymentIntentData<F>;
fn to_validate_request(
&self,
@@ -47,7 +47,7 @@ impl<F: Send + Clone> Operation<F, PaymentsGetIntentRequest> for &PaymentGetInte
}
}
-impl<F: Send + Clone> Operation<F, PaymentsGetIntentRequest> for PaymentGetIntent {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsGetIntentRequest> for PaymentGetIntent {
type Data = payments::PaymentIntentData<F>;
fn to_validate_request(
&self,
@@ -76,7 +76,7 @@ type PaymentsGetIntentOperation<'b, F> =
BoxedOperation<'b, F, PaymentsGetIntentRequest, payments::PaymentIntentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsGetIntentRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, PaymentsGetIntentRequest>
for PaymentGetIntent
{
#[instrument(skip_all)]
@@ -111,7 +111,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsGetI
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsGetIntentRequest>
+impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsGetIntentRequest>
for PaymentGetIntent
{
#[instrument(skip_all)]
@@ -137,7 +137,8 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsGetInten
}
}
-impl<F: Send + Clone> ValidateRequest<F, PaymentsGetIntentRequest, payments::PaymentIntentData<F>>
+impl<F: Send + Clone + Sync>
+ ValidateRequest<F, PaymentsGetIntentRequest, payments::PaymentIntentData<F>>
for PaymentGetIntent
{
#[instrument(skip_all)]
@@ -155,7 +156,7 @@ impl<F: Send + Clone> ValidateRequest<F, PaymentsGetIntentRequest, payments::Pay
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, PaymentsGetIntentRequest, payments::PaymentIntentData<F>>
+impl<F: Clone + Send + Sync> Domain<F, PaymentsGetIntentRequest, payments::PaymentIntentData<F>>
for PaymentGetIntent
{
#[instrument(skip_all)]
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 846f739e08..7c30d9c5b7 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
@@ -32,7 +32,7 @@ type PaymentPostSessionTokensOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsPostSessionTokensRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsPostSessionTokensRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSessionTokensRequest>
for PaymentPostSessionTokens
{
#[instrument(skip_all)]
@@ -179,7 +179,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsPostSessionToke
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsPostSessionTokensRequest, PaymentData<F>>
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsPostSessionTokensRequest, PaymentData<F>>
for PaymentPostSessionTokens
{
#[instrument(skip_all)]
@@ -241,7 +241,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsPostSessionTokensRequest, PaymentDa
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsPostSessionTokensRequest>
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsPostSessionTokensRequest>
for PaymentPostSessionTokens
{
#[instrument(skip_all)]
@@ -264,7 +264,8 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsPostSessionTokensRe
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsPostSessionTokensRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync>
+ ValidateRequest<F, api::PaymentsPostSessionTokensRequest, PaymentData<F>>
for PaymentPostSessionTokens
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index c747c7d984..df9544dfb4 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -30,7 +30,9 @@ pub struct PaymentReject;
type PaymentRejectOperation<'b, F> = BoxedOperation<'b, F, PaymentsCancelRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsCancelRequest> for PaymentReject {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest>
+ for PaymentReject
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -205,7 +207,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsCancelRequest> for P
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> for PaymentReject {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> for PaymentReject {
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -280,7 +282,9 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> for Payme
}
}
-impl<F: Send + Clone> ValidateRequest<F, PaymentsCancelRequest, PaymentData<F>> for PaymentReject {
+impl<F: Send + Clone + Sync> ValidateRequest<F, PaymentsCancelRequest, PaymentData<F>>
+ for PaymentReject
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index ebc663aaf3..a9a64c6880 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -31,7 +31,7 @@ type PaymentSessionOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsSessionRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
for PaymentSession
{
#[instrument(skip_all)]
@@ -227,7 +227,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest> for PaymentSession {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
+ for PaymentSession
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -267,7 +269,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest> for
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsSessionRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsSessionRequest, PaymentData<F>>
for PaymentSession
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index ee490408cb..6072681c2f 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -48,7 +48,7 @@ impl ValidateStatusForOperation for PaymentSessionIntent {
}
}
-impl<F: Send + Clone> Operation<F, PaymentsSessionRequest> for &PaymentSessionIntent {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsSessionRequest> for &PaymentSessionIntent {
type Data = payments::PaymentIntentData<F>;
fn to_validate_request(
&self,
@@ -66,7 +66,7 @@ impl<F: Send + Clone> Operation<F, PaymentsSessionRequest> for &PaymentSessionIn
}
}
-impl<F: Send + Clone> Operation<F, PaymentsSessionRequest> for PaymentSessionIntent {
+impl<F: Send + Clone + Sync> Operation<F, PaymentsSessionRequest> for PaymentSessionIntent {
type Data = payments::PaymentIntentData<F>;
fn to_validate_request(
&self,
@@ -88,7 +88,7 @@ type PaymentsCreateIntentOperation<'b, F> =
BoxedOperation<'b, F, PaymentsSessionRequest, payments::PaymentIntentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsSessionRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, PaymentsSessionRequest>
for PaymentSessionIntent
{
#[instrument(skip_all)]
@@ -131,7 +131,8 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsSess
}
}
-impl<F: Send + Clone> ValidateRequest<F, PaymentsSessionRequest, payments::PaymentIntentData<F>>
+impl<F: Send + Clone + Sync>
+ ValidateRequest<F, PaymentsSessionRequest, payments::PaymentIntentData<F>>
for PaymentSessionIntent
{
#[instrument(skip_all)]
@@ -149,7 +150,7 @@ impl<F: Send + Clone> ValidateRequest<F, PaymentsSessionRequest, payments::Payme
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, PaymentsSessionRequest, payments::PaymentIntentData<F>>
+impl<F: Clone + Send + Sync> Domain<F, PaymentsSessionRequest, payments::PaymentIntentData<F>>
for PaymentSessionIntent
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index edcb0282bd..3285914aff 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -30,7 +30,9 @@ type PaymentSessionOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsStartRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> for PaymentStart {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest>
+ for PaymentStart
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -212,7 +214,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest> for PaymentStart {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest> for PaymentStart {
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -233,7 +235,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest> for P
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsStartRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsStartRequest, PaymentData<F>>
for PaymentStart
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index ab3a70aa1b..e2c9a4d7a3 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -31,7 +31,7 @@ pub struct PaymentStatus;
type PaymentStatusOperation<'b, F, R> = BoxedOperation<'b, F, R, PaymentData<F>>;
-impl<F: Send + Clone> Operation<F, api::PaymentsRequest> for PaymentStatus {
+impl<F: Send + Clone + Sync> Operation<F, api::PaymentsRequest> for PaymentStatus {
type Data = PaymentData<F>;
fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsRequest, PaymentData<F>>> {
Ok(self)
@@ -43,7 +43,7 @@ impl<F: Send + Clone> Operation<F, api::PaymentsRequest> for PaymentStatus {
Ok(self)
}
}
-impl<F: Send + Clone> Operation<F, api::PaymentsRequest> for &PaymentStatus {
+impl<F: Send + Clone + Sync> Operation<F, api::PaymentsRequest> for &PaymentStatus {
type Data = PaymentData<F>;
fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsRequest, PaymentData<F>>> {
Ok(*self)
@@ -57,7 +57,7 @@ impl<F: Send + Clone> Operation<F, api::PaymentsRequest> for &PaymentStatus {
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentStatus {
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentStatus {
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -137,7 +137,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for Paymen
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentStatus {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentStatus {
async fn update_trackers<'b>(
&'b self,
_state: &'b SessionState,
@@ -161,7 +161,9 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest> for PaymentStatus {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest>
+ for PaymentStatus
+{
async fn update_trackers<'b>(
&'b self,
_state: &'b SessionState,
@@ -185,7 +187,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest> fo
}
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest>
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest>
for PaymentStatus
{
#[instrument(skip_all)]
@@ -519,7 +521,7 @@ async fn get_tracker_for_sync<
Ok(get_trackers_response)
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRetrieveRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRetrieveRequest, PaymentData<F>>
for PaymentStatus
{
fn validate_request<'b>(
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 61a52e7dfb..1fba79968b 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -45,7 +45,7 @@ pub struct PaymentUpdate;
type PaymentUpdateOperation<'a, F> = BoxedOperation<'a, F, api::PaymentsRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentUpdate {
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentUpdate {
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -505,7 +505,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentUpdate {
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for PaymentUpdate {
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -692,7 +692,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest, PaymentData<F>> for Paymen
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentUpdate {
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentUpdate {
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[instrument(skip_all)]
async fn update_trackers<'b>(
@@ -955,7 +955,9 @@ impl ForeignTryFrom<domain::Customer> for CustomerData {
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>> for PaymentUpdate {
+impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>>
+ for PaymentUpdate
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b 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 1b7acc796e..a629938936 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -34,7 +34,7 @@ type PaymentIncrementalAuthorizationOperation<'b, F> =
BoxedOperation<'b, F, PaymentsIncrementalAuthorizationRequest, payments::PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone>
+impl<F: Send + Clone + Sync>
GetTracker<F, payments::PaymentData<F>, PaymentsIncrementalAuthorizationRequest>
for PaymentIncrementalAuthorization
{
@@ -186,7 +186,8 @@ impl<F: Send + Clone>
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, PaymentsIncrementalAuthorizationRequest>
+impl<F: Clone + Sync>
+ UpdateTracker<F, payments::PaymentData<F>, PaymentsIncrementalAuthorizationRequest>
for PaymentIncrementalAuthorization
{
#[instrument(skip_all)]
@@ -278,7 +279,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, PaymentsIncrementalAut
}
}
-impl<F: Send + Clone>
+impl<F: Send + Clone + Sync>
ValidateRequest<F, PaymentsIncrementalAuthorizationRequest, payments::PaymentData<F>>
for PaymentIncrementalAuthorization
{
@@ -304,7 +305,8 @@ impl<F: Send + Clone>
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, PaymentsIncrementalAuthorizationRequest, payments::PaymentData<F>>
+impl<F: Clone + Send + Sync>
+ Domain<F, PaymentsIncrementalAuthorizationRequest, payments::PaymentData<F>>
for PaymentIncrementalAuthorization
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 712dff35c7..dbfed35a44 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -36,7 +36,8 @@ type PaymentSessionUpdateOperation<'b, F> =
BoxedOperation<'b, F, api::PaymentsDynamicTaxCalculationRequest, PaymentData<F>>;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalculationRequest>
+impl<F: Send + Clone + Sync>
+ GetTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalculationRequest>
for PaymentSessionUpdate
{
#[instrument(skip_all)]
@@ -192,7 +193,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalcu
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsDynamicTaxCalculationRequest, PaymentData<F>>
+impl<F: Clone + Send + Sync> Domain<F, api::PaymentsDynamicTaxCalculationRequest, PaymentData<F>>
for PaymentSessionUpdate
{
#[instrument(skip_all)]
@@ -364,7 +365,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsDynamicTaxCalculationRequest, Payme
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalculationRequest>
+impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalculationRequest>
for PaymentSessionUpdate
{
#[instrument(skip_all)]
@@ -442,7 +443,8 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalculati
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsDynamicTaxCalculationRequest, PaymentData<F>>
+impl<F: Send + Clone + Sync>
+ ValidateRequest<F, api::PaymentsDynamicTaxCalculationRequest, PaymentData<F>>
for PaymentSessionUpdate
{
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 0f248d6cc3..1a635b097e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -167,6 +167,7 @@ where
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id,
+ authentication_id: None,
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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
@@ -503,6 +505,7 @@ pub async fn construct_router_data_for_psync<'a>(
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
@@ -650,6 +653,7 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(
header_payload,
connector_mandate_request_reference_id: None,
psd2_sca_exemption_type: None,
+ authentication_id: None,
};
Ok(router_data)
@@ -847,6 +851,7 @@ where
}),
header_payload,
connector_mandate_request_reference_id,
+ authentication_id: None,
psd2_sca_exemption_type: payment_data.payment_intent.psd2_sca_exemption_type,
};
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
new file mode 100644
index 0000000000..bd08ea7fe6
--- /dev/null
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -0,0 +1,187 @@
+pub mod transformers;
+pub mod types;
+pub mod utils;
+
+use diesel_models::authentication::{Authentication, AuthenticationNew};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+ errors::api_error_response::ApiErrorResponse,
+ router_request_types::unified_authentication_service::{
+ UasAuthenticationResponseData, UasPostAuthenticationRequestData,
+ UasPreAuthenticationRequestData,
+ },
+};
+
+use super::{errors::RouterResult, payments::helpers::MerchantConnectorAccountType};
+use crate::{
+ core::{
+ errors::utils::StorageErrorExt,
+ payments::PaymentData,
+ unified_authentication_service::types::{
+ ClickToPay, UnifiedAuthenticationService, UNIFIED_AUTHENTICATION_SERVICE,
+ },
+ },
+ db::domain,
+ routes::SessionState,
+ types::api,
+};
+
+#[cfg(feature = "v1")]
+#[async_trait::async_trait]
+impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
+ async fn pre_authentication(
+ state: &SessionState,
+ _key_store: &domain::MerchantKeyStore,
+ _business_profile: &domain::Profile,
+ payment_data: &PaymentData<F>,
+ merchant_connector_account: &MerchantConnectorAccountType,
+ connector_name: &str,
+ authentication_id: &str,
+ payment_method: common_enums::PaymentMethod,
+ ) -> RouterResult<()> {
+ let pre_authentication_data =
+ UasPreAuthenticationRequestData::try_from(payment_data.clone())?;
+
+ let pre_auth_router_data: api::unified_authentication_service::UasPreAuthenticationRouterData = utils::construct_uas_router_data(
+ connector_name.to_string(),
+ payment_method,
+ payment_data.payment_attempt.merchant_id.clone(),
+ None,
+ pre_authentication_data,
+ merchant_connector_account,
+ Some(authentication_id.to_owned()),
+ )?;
+
+ utils::do_auth_connector_call(
+ state,
+ UNIFIED_AUTHENTICATION_SERVICE.to_string(),
+ pre_auth_router_data,
+ )
+ .await?;
+
+ Ok(())
+ }
+
+ async fn post_authentication(
+ state: &SessionState,
+ _key_store: &domain::MerchantKeyStore,
+ _business_profile: &domain::Profile,
+ payment_data: &PaymentData<F>,
+ merchant_connector_account: &MerchantConnectorAccountType,
+ connector_name: &str,
+ payment_method: common_enums::PaymentMethod,
+ ) -> RouterResult<Option<hyperswitch_domain_models::payment_method_data::NetworkTokenData>>
+ {
+ let post_authentication_data = UasPostAuthenticationRequestData;
+ let authentication_id = payment_data
+ .payment_attempt
+ .authentication_id
+ .clone()
+ .ok_or(ApiErrorResponse::InternalServerError)
+ .attach_printable("Missing authentication id in payment attempt")?;
+
+ let post_auth_router_data: api::unified_authentication_service::UasPostAuthenticationRouterData = utils::construct_uas_router_data(
+ connector_name.to_string(),
+ payment_method,
+ payment_data.payment_attempt.merchant_id.clone(),
+ None,
+ post_authentication_data,
+ merchant_connector_account,
+ Some(authentication_id.clone()),
+ )?;
+
+ let response = utils::do_auth_connector_call(
+ state,
+ UNIFIED_AUTHENTICATION_SERVICE.to_string(),
+ post_auth_router_data,
+ )
+ .await?;
+
+ let network_token = match response.response.clone() {
+ Ok(UasAuthenticationResponseData::PostAuthentication {
+ authentication_details,
+ }) => Some(
+ hyperswitch_domain_models::payment_method_data::NetworkTokenData {
+ token_number: authentication_details.token_details.payment_token,
+ token_exp_month: authentication_details.token_details.token_expiration_month,
+ token_exp_year: authentication_details.token_details.token_expiration_year,
+ token_cryptogram: None,
+ card_issuer: None,
+ card_network: None,
+ card_type: None,
+ card_issuing_country: None,
+ bank_code: None,
+ nick_name: None,
+ },
+ ),
+ _ => None,
+ };
+
+ Ok(network_token)
+ }
+
+ fn confirmation(
+ _state: &SessionState,
+ _key_store: &domain::MerchantKeyStore,
+ _business_profile: &domain::Profile,
+ _merchant_connector_account: &MerchantConnectorAccountType,
+ ) -> RouterResult<()> {
+ Ok(())
+ }
+}
+
+pub async fn create_new_authentication(
+ state: &SessionState,
+ merchant_id: common_utils::id_type::MerchantId,
+ authentication_connector: String,
+ profile_id: common_utils::id_type::ProfileId,
+ payment_id: Option<common_utils::id_type::PaymentId>,
+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+ authentication_id: &str,
+) -> RouterResult<Authentication> {
+ let new_authorization = AuthenticationNew {
+ authentication_id: authentication_id.to_owned(),
+ merchant_id,
+ authentication_connector,
+ connector_authentication_id: None,
+ payment_method_id: "".to_string(),
+ authentication_type: None,
+ authentication_status: common_enums::AuthenticationStatus::Started,
+ authentication_lifecycle_status: common_enums::AuthenticationLifecycleStatus::Unused,
+ error_message: None,
+ error_code: None,
+ connector_metadata: None,
+ maximum_supported_version: None,
+ threeds_server_transaction_id: None,
+ cavv: None,
+ authentication_flow_type: None,
+ message_version: None,
+ eci: None,
+ trans_status: None,
+ acquirer_bin: None,
+ acquirer_merchant_id: None,
+ three_ds_method_data: None,
+ three_ds_method_url: None,
+ acs_url: None,
+ challenge_request: None,
+ acs_reference_number: None,
+ acs_trans_id: None,
+ acs_signed_content: None,
+ profile_id,
+ payment_id,
+ merchant_connector_id,
+ ds_trans_id: None,
+ directory_server_id: None,
+ acquirer_country_code: None,
+ };
+ state
+ .store
+ .insert_authentication(new_authorization)
+ .await
+ .to_duplicate_response(ApiErrorResponse::GenericDuplicateError {
+ message: format!(
+ "Authentication with authentication_id {} already exists",
+ authentication_id
+ ),
+ })
+}
diff --git a/crates/router/src/core/unified_authentication_service/transformers.rs b/crates/router/src/core/unified_authentication_service/transformers.rs
new file mode 100644
index 0000000000..cf3cb6f1f6
--- /dev/null
+++ b/crates/router/src/core/unified_authentication_service/transformers.rs
@@ -0,0 +1,36 @@
+use error_stack::Report;
+use hyperswitch_domain_models::{
+ errors::api_error_response::ApiErrorResponse,
+ router_request_types::unified_authentication_service::{
+ ServiceDetails, ServiceSessionIds, TransactionDetails, UasPreAuthenticationRequestData,
+ },
+};
+
+use crate::core::payments::PaymentData;
+
+#[cfg(feature = "v1")]
+impl<F: Clone + Sync> TryFrom<PaymentData<F>> for UasPreAuthenticationRequestData {
+ type Error = Report<ApiErrorResponse>;
+ fn try_from(payment_data: PaymentData<F>) -> Result<Self, Self::Error> {
+ let service_details = ServiceDetails {
+ service_session_ids: Some(ServiceSessionIds {
+ merchant_transaction_id: None,
+ correlation_id: None,
+ x_src_flow_id: None,
+ }),
+ };
+ let currency = payment_data.payment_attempt.currency.ok_or(
+ ApiErrorResponse::MissingRequiredField {
+ field_name: "currency",
+ },
+ )?;
+
+ let amount = payment_data.payment_attempt.net_amount.get_order_amount();
+ let transaction_details = TransactionDetails { amount, currency };
+
+ Ok(Self {
+ service_details: Some(service_details),
+ transaction_details: Some(transaction_details),
+ })
+ }
+}
diff --git a/crates/router/src/core/unified_authentication_service/types.rs b/crates/router/src/core/unified_authentication_service/types.rs
new file mode 100644
index 0000000000..6fc73ec6cd
--- /dev/null
+++ b/crates/router/src/core/unified_authentication_service/types.rs
@@ -0,0 +1,52 @@
+use crate::{
+ core::{
+ errors::RouterResult,
+ payments::{helpers::MerchantConnectorAccountType, PaymentData},
+ },
+ db::domain,
+ routes::SessionState,
+};
+
+pub const CTP_MASTERCARD: &str = "ctp_mastercard";
+
+pub const UNIFIED_AUTHENTICATION_SERVICE: &str = "unified_authentication_service";
+
+pub const IRRELEVANT_ATTEMPT_ID_IN_AUTHENTICATION_FLOW: &str =
+ "irrelevant_attempt_id_in_AUTHENTICATION_flow";
+
+pub const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_AUTHENTICATION_FLOW: &str =
+ "irrelevant_connector_request_reference_id_in_AUTHENTICATION_flow";
+
+pub struct ClickToPay;
+
+#[async_trait::async_trait]
+pub trait UnifiedAuthenticationService<F: Clone + Sync> {
+ #[allow(clippy::too_many_arguments)]
+ async fn pre_authentication(
+ _state: &SessionState,
+ _key_store: &domain::MerchantKeyStore,
+ _business_profile: &domain::Profile,
+ _payment_data: &PaymentData<F>,
+ _merchant_connector_account: &MerchantConnectorAccountType,
+ _connector_name: &str,
+ _authentication_id: &str,
+ _payment_method: common_enums::PaymentMethod,
+ ) -> RouterResult<()>;
+
+ async fn post_authentication(
+ _state: &SessionState,
+ _key_store: &domain::MerchantKeyStore,
+ _business_profile: &domain::Profile,
+ _payment_data: &PaymentData<F>,
+ _merchant_connector_account: &MerchantConnectorAccountType,
+ _connector_name: &str,
+ _payment_method: common_enums::PaymentMethod,
+ ) -> RouterResult<Option<hyperswitch_domain_models::payment_method_data::NetworkTokenData>>;
+
+ fn confirmation(
+ _state: &SessionState,
+ _key_store: &domain::MerchantKeyStore,
+ _business_profile: &domain::Profile,
+ _merchant_connector_account: &MerchantConnectorAccountType,
+ ) -> RouterResult<()>;
+}
diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs
new file mode 100644
index 0000000000..e0d1025104
--- /dev/null
+++ b/crates/router/src/core/unified_authentication_service/utils.rs
@@ -0,0 +1,172 @@
+use std::marker::PhantomData;
+
+use common_enums::enums::PaymentMethod;
+use common_utils::ext_traits::ValueExt;
+use diesel_models::authentication::{Authentication, AuthenticationUpdate};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+ errors::api_error_response::ApiErrorResponse,
+ payment_address::PaymentAddress,
+ router_data::{ConnectorAuthType, ErrorResponse, RouterData},
+ router_data_v2::UasFlowData,
+ router_request_types::unified_authentication_service::UasAuthenticationResponseData,
+};
+use masking::ExposeOptionInterface;
+
+use super::types::{
+ IRRELEVANT_ATTEMPT_ID_IN_AUTHENTICATION_FLOW,
+ IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_AUTHENTICATION_FLOW,
+};
+use crate::{
+ core::{
+ errors::{utils::ConnectorErrorExt, RouterResult},
+ payments,
+ unified_authentication_service::MerchantConnectorAccountType,
+ },
+ services::{self, execute_connector_processing_step},
+ types::api,
+ SessionState,
+};
+
+pub async fn update_trackers<F: Clone, Req>(
+ state: &SessionState,
+ router_data: RouterData<F, Req, UasAuthenticationResponseData>,
+ authentication: Authentication,
+) -> RouterResult<Authentication> {
+ let authentication_update = match router_data.response {
+ Ok(response) => match response {
+ UasAuthenticationResponseData::PreAuthentication {} => {
+ AuthenticationUpdate::AuthenticationStatusUpdate {
+ trans_status: common_enums::TransactionStatus::InformationOnly,
+ authentication_status: common_enums::AuthenticationStatus::Pending,
+ }
+ }
+ UasAuthenticationResponseData::PostAuthentication {
+ authentication_details,
+ } => AuthenticationUpdate::PostAuthenticationUpdate {
+ authentication_status: common_enums::AuthenticationStatus::Success,
+ trans_status: common_enums::TransactionStatus::Success,
+ authentication_value: authentication_details
+ .dynamic_data_details
+ .and_then(|data| data.dynamic_data_value.expose_option()),
+ eci: authentication_details.eci,
+ },
+ },
+ Err(error) => AuthenticationUpdate::ErrorUpdate {
+ connector_authentication_id: error.connector_transaction_id,
+ authentication_status: common_enums::AuthenticationStatus::Failed,
+ error_message: error
+ .reason
+ .map(|reason| format!("message: {}, reason: {}", error.message, reason))
+ .or(Some(error.message)),
+ error_code: Some(error.code),
+ },
+ };
+
+ state
+ .store
+ .update_authentication_by_merchant_id_authentication_id(
+ authentication,
+ authentication_update,
+ )
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Error while updating authentication for uas")
+}
+
+pub async fn do_auth_connector_call<F, Req, Res>(
+ state: &SessionState,
+ authentication_connector_name: String,
+ router_data: RouterData<F, Req, Res>,
+) -> RouterResult<RouterData<F, Req, Res>>
+where
+ Req: std::fmt::Debug + Clone + 'static,
+ Res: std::fmt::Debug + Clone + 'static,
+ F: std::fmt::Debug + Clone + 'static,
+ dyn api::Connector + Sync: services::api::ConnectorIntegration<F, Req, Res>,
+ dyn api::ConnectorV2 + Sync: services::api::ConnectorIntegrationV2<F, UasFlowData, Req, Res>,
+{
+ let connector_data =
+ api::AuthenticationConnectorData::get_connector_by_name(&authentication_connector_name)?;
+ let connector_integration: services::BoxedUnifiedAuthenticationServiceInterface<F, Req, Res> =
+ connector_data.connector.get_connector_integration();
+ let router_data = execute_connector_processing_step(
+ state,
+ connector_integration,
+ &router_data,
+ payments::CallConnectorAction::Trigger,
+ None,
+ )
+ .await
+ .to_payment_failed_response()?;
+ Ok(router_data)
+}
+
+pub fn construct_uas_router_data<F: Clone, Req, Res>(
+ authentication_connector_name: String,
+ payment_method: PaymentMethod,
+ merchant_id: common_utils::id_type::MerchantId,
+ address: Option<PaymentAddress>,
+ request_data: Req,
+ merchant_connector_account: &MerchantConnectorAccountType,
+ authentication_id: Option<String>,
+) -> RouterResult<RouterData<F, Req, Res>> {
+ let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
+ let auth_type: ConnectorAuthType = merchant_connector_account
+ .get_connector_account_details()
+ .parse_value("ConnectorAuthType")
+ .change_context(ApiErrorResponse::InternalServerError)?;
+ Ok(RouterData {
+ flow: PhantomData,
+ merchant_id,
+ customer_id: None,
+ connector_customer: None,
+ connector: authentication_connector_name,
+ payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("authentication")
+ .get_string_repr()
+ .to_owned(),
+ attempt_id: IRRELEVANT_ATTEMPT_ID_IN_AUTHENTICATION_FLOW.to_owned(),
+ status: common_enums::AttemptStatus::default(),
+ payment_method,
+ connector_auth_type: auth_type,
+ description: None,
+ return_url: None,
+ address: address.unwrap_or_default(),
+ auth_type: common_enums::AuthenticationType::default(),
+ connector_meta_data: merchant_connector_account.get_metadata(),
+ connector_wallets_details: merchant_connector_account.get_connector_wallets_details(),
+ amount_captured: None,
+ minor_amount_captured: None,
+ access_token: None,
+ session_token: None,
+ reference_id: None,
+ payment_method_token: None,
+ recurring_mandate_payment_data: None,
+ preprocessing_id: None,
+ payment_method_balance: None,
+ connector_api_version: None,
+ request: request_data,
+ response: Err(ErrorResponse::default()),
+ connector_request_reference_id:
+ IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_AUTHENTICATION_FLOW.to_owned(),
+ #[cfg(feature = "payouts")]
+ payout_method_data: None,
+ #[cfg(feature = "payouts")]
+ quote_id: None,
+ test_mode,
+ connector_http_status_code: None,
+ external_latency: None,
+ apple_pay_flow: None,
+ frm_metadata: None,
+ dispute_id: None,
+ refund_id: None,
+ payment_method_status: None,
+ connector_response: None,
+ integrity_check: Ok(()),
+ additional_merchant_data: None,
+ header_payload: None,
+ connector_mandate_request_reference_id: None,
+ authentication_id,
+ psd2_sca_exemption_type: None,
+ })
+}
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 56e5bc2b08..1f214f48ff 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
@@ -396,6 +397,7 @@ pub async fn construct_refund_router_data<'a, F>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
@@ -704,6 +706,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -904,6 +908,7 @@ pub async fn construct_upload_file_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -1027,6 +1032,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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -1127,6 +1133,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
@@ -1221,6 +1228,7 @@ pub async fn construct_retrieve_file_router_data<'a>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_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 f1e84b2226..f86ed910e4 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index cfff235856..f746aa28fd 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -103,6 +103,9 @@ pub type BoxedAccessTokenConnectorIntegrationInterface<T, Req, Resp> =
pub type BoxedFilesConnectorIntegrationInterface<T, Req, Resp> =
BoxedConnectorIntegrationInterface<T, common_types::FilesFlowData, Req, Resp>;
+pub type BoxedUnifiedAuthenticationServiceInterface<T, Req, Resp> =
+ BoxedConnectorIntegrationInterface<T, common_types::UasFlowData, Req, Resp>;
+
/// Handle the flow by interacting with connector module
/// `connector_request` is applicable only in case if the `CallConnectorAction` is `Trigger`
/// In other cases, It will be created if required, even if it is not passed
diff --git a/crates/router/src/services/conversion_impls.rs b/crates/router/src/services/conversion_impls.rs
index 6ac934cd2f..3902ef624d 100644
--- a/crates/router/src/services/conversion_impls.rs
+++ b/crates/router/src/services/conversion_impls.rs
@@ -1,3 +1,4 @@
+use error_stack::ResultExt;
#[cfg(feature = "frm")]
use hyperswitch_domain_models::router_data_v2::flow_common_types::FrmFlowData;
#[cfg(feature = "payouts")]
@@ -8,7 +9,8 @@ use hyperswitch_domain_models::{
router_data_v2::{
flow_common_types::{
AccessTokenFlowData, DisputesFlowData, ExternalAuthenticationFlowData, FilesFlowData,
- MandateRevokeFlowData, PaymentFlowData, RefundFlowData, WebhookSourceVerifyData,
+ MandateRevokeFlowData, PaymentFlowData, RefundFlowData, UasFlowData,
+ WebhookSourceVerifyData,
},
RouterDataV2,
},
@@ -77,6 +79,7 @@ fn get_default_router_data<F, Req, Resp>(
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
}
}
@@ -688,3 +691,47 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
Ok(router_data)
}
}
+
+impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowData {
+ fn from_old_router_data(
+ old_router_data: &RouterData<T, Req, Resp>,
+ ) -> errors::CustomResult<RouterDataV2<T, Self, Req, Resp>, errors::ConnectorError>
+ where
+ Self: Sized,
+ {
+ let resource_common_data = Self {
+ authenticate_by: old_router_data.connector.clone(),
+ source_authentication_id: old_router_data
+ .authentication_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "source_authentication_id",
+ })
+ .attach_printable("missing authentication id for uas")?,
+ };
+ Ok(RouterDataV2 {
+ flow: std::marker::PhantomData,
+ resource_common_data,
+ connector_auth_type: old_router_data.connector_auth_type.clone(),
+ request: old_router_data.request.clone(),
+ response: old_router_data.response.clone(),
+ })
+ }
+
+ fn to_old_router_data(
+ new_router_data: RouterDataV2<T, Self, Req, Resp>,
+ ) -> errors::CustomResult<RouterData<T, Req, Resp>, errors::ConnectorError>
+ where
+ Self: Sized,
+ {
+ let Self {
+ authenticate_by,
+ source_authentication_id,
+ } = new_router_data.resource_common_data;
+ let mut router_data =
+ get_default_router_data("uas", new_router_data.request, new_router_data.response);
+ router_data.connector = authenticate_by;
+ router_data.authentication_id = Some(source_authentication_id);
+ Ok(router_data)
+ }
+}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 9e7fc4e204..e3d5b7246a 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -48,10 +48,14 @@ pub use hyperswitch_domain_models::{
},
router_data_v2::{
AccessTokenFlowData, DisputesFlowData, ExternalAuthenticationFlowData, FilesFlowData,
- MandateRevokeFlowData, PaymentFlowData, RefundFlowData, RouterDataV2,
+ MandateRevokeFlowData, PaymentFlowData, RefundFlowData, RouterDataV2, UasFlowData,
WebhookSourceVerifyData,
},
router_request_types::{
+ unified_authentication_service::{
+ UasAuthenticationResponseData, UasPostAuthenticationRequestData,
+ UasPreAuthenticationRequestData,
+ },
AcceptDisputeRequestData, AccessTokenRequestData, AuthorizeSessionTokenData,
BrowserInformation, ChargeRefunds, ChargeRefundsOptions, CompleteAuthorizeData,
CompleteAuthorizeRedirectResponse, ConnectorCustomerData, DefendDisputeRequestData,
@@ -952,6 +956,7 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)
connector_mandate_request_reference_id: data
.connector_mandate_request_reference_id
.clone(),
+ authentication_id: data.authentication_id.clone(),
psd2_sca_exemption_type: data.psd2_sca_exemption_type,
}
}
@@ -1015,10 +1020,11 @@ impl<F1, F2>
dispute_id: None,
connector_response: data.connector_response.clone(),
integrity_check: Ok(()),
- additional_merchant_data: data.additional_merchant_data.clone(),
header_payload: data.header_payload.clone(),
- connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
+ additional_merchant_data: data.additional_merchant_data.clone(),
+ connector_mandate_request_reference_id: None,
}
}
}
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 661c557e20..f542eece81 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -36,6 +36,9 @@ pub mod payments_v2;
pub mod payouts_v2;
pub mod refunds_v2;
+pub mod unified_authentication_service;
+pub mod unified_authentication_service_v2;
+
use std::{fmt::Debug, str::FromStr};
use api_models::routing::{self as api_routing, RoutableConnectorChoice};
@@ -58,7 +61,7 @@ pub use self::payouts::*;
pub use self::{
admin::*, api_keys::*, authentication::*, configs::*, customers::*, disputes::*, files::*,
payment_link::*, payment_methods::*, payments::*, poll::*, refunds::*, refunds_v2::*,
- webhooks::*,
+ unified_authentication_service::*, webhooks::*,
};
use super::transformers::ForeignTryFrom;
use crate::{
@@ -106,6 +109,7 @@ pub trait Connector:
+ ConnectorMandateRevoke
+ ExternalAuthentication
+ TaxCalculation
+ + UnifiedAuthenticationService
{
}
@@ -124,7 +128,8 @@ impl<
+ FraudCheck
+ ConnectorMandateRevoke
+ ExternalAuthentication
- + TaxCalculation,
+ + TaxCalculation
+ + UnifiedAuthenticationService,
> Connector for T
{
}
@@ -144,6 +149,7 @@ pub trait ConnectorV2:
+ FraudCheckV2
+ ConnectorMandateRevokeV2
+ ExternalAuthenticationV2
+ + UnifiedAuthenticationServiceV2
{
}
impl<
@@ -160,7 +166,8 @@ impl<
+ ConnectorVerifyWebhookSourceV2
+ FraudCheckV2
+ ConnectorMandateRevokeV2
- + ExternalAuthenticationV2,
+ + ExternalAuthenticationV2
+ + UnifiedAuthenticationServiceV2,
> ConnectorV2 for T
{
}
diff --git a/crates/router/src/types/api/unified_authentication_service.rs b/crates/router/src/types/api/unified_authentication_service.rs
new file mode 100644
index 0000000000..97f698856f
--- /dev/null
+++ b/crates/router/src/types/api/unified_authentication_service.rs
@@ -0,0 +1,59 @@
+use hyperswitch_domain_models::{
+ router_data::RouterData,
+ router_request_types::unified_authentication_service::{
+ UasAuthenticationResponseData, UasPostAuthenticationRequestData,
+ UasPreAuthenticationRequestData,
+ },
+};
+
+pub use super::unified_authentication_service_v2::{
+ UasPostAuthenticationV2, UasPreAuthenticationV2, UnifiedAuthenticationServiceV2,
+};
+use crate::services;
+
+#[derive(Debug, Clone)]
+pub struct PreAuthenticate;
+
+pub trait UnifiedAuthenticationService:
+ super::ConnectorCommon + UasPreAuthentication + UasPostAuthentication
+{
+}
+
+#[derive(Debug, Clone)]
+pub struct PostAuthenticate;
+
+pub trait UasPreAuthentication:
+ services::ConnectorIntegration<
+ PreAuthenticate,
+ UasPreAuthenticationRequestData,
+ UasAuthenticationResponseData,
+>
+{
+}
+
+pub trait UasPostAuthentication:
+ services::ConnectorIntegration<
+ PostAuthenticate,
+ UasPostAuthenticationRequestData,
+ UasAuthenticationResponseData,
+>
+{
+}
+
+pub type UasPostAuthenticationRouterData =
+ RouterData<PostAuthenticate, UasPostAuthenticationRequestData, UasAuthenticationResponseData>;
+
+pub type UasPostAuthenticationType = dyn services::ConnectorIntegration<
+ PostAuthenticate,
+ UasPostAuthenticationRequestData,
+ UasAuthenticationResponseData,
+>;
+
+pub type UasPreAuthenticationRouterData =
+ RouterData<PreAuthenticate, UasPreAuthenticationRequestData, UasAuthenticationResponseData>;
+
+pub type UasPreAuthenticationType = dyn services::ConnectorIntegration<
+ PreAuthenticate,
+ UasPreAuthenticationRequestData,
+ UasAuthenticationResponseData,
+>;
diff --git a/crates/router/src/types/api/unified_authentication_service_v2.rs b/crates/router/src/types/api/unified_authentication_service_v2.rs
new file mode 100644
index 0000000000..3de12b0bb9
--- /dev/null
+++ b/crates/router/src/types/api/unified_authentication_service_v2.rs
@@ -0,0 +1,35 @@
+use hyperswitch_domain_models::{
+ router_data_v2::UasFlowData,
+ router_request_types::unified_authentication_service::{
+ UasAuthenticationResponseData, UasPostAuthenticationRequestData,
+ UasPreAuthenticationRequestData,
+ },
+};
+
+use super::unified_authentication_service::{PostAuthenticate, PreAuthenticate};
+use crate::services;
+
+pub trait UnifiedAuthenticationServiceV2:
+ super::ConnectorCommon + UasPreAuthenticationV2 + UasPostAuthenticationV2
+{
+}
+
+pub trait UasPreAuthenticationV2:
+ services::ConnectorIntegrationV2<
+ PreAuthenticate,
+ UasFlowData,
+ UasPreAuthenticationRequestData,
+ UasAuthenticationResponseData,
+>
+{
+}
+
+pub trait UasPostAuthenticationV2:
+ services::ConnectorIntegrationV2<
+ PostAuthenticate,
+ UasFlowData,
+ UasPostAuthenticationRequestData,
+ UasAuthenticationResponseData,
+>
+{
+}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index c368a3fb37..d046a57678 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,
+ authentication_id: None,
psd2_sca_exemption_type: None,
}
}
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 2d0272cfa7..e3fd2bc1ee 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -130,6 +130,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
}
}
@@ -201,6 +202,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id: None,
+ authentication_id: None,
psd2_sca_exemption_type: None,
}
}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 18c171d58c..19fb4a4372 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -549,6 +549,7 @@ pub trait ConnectorActions: Connector {
header_payload: None,
connector_mandate_request_reference_id: None,
psd2_sca_exemption_type: None,
+ authentication_id: None,
}
}
diff --git a/crates/router_derive/src/macros/operation.rs b/crates/router_derive/src/macros/operation.rs
index a096c236b2..995db7a6ce 100644
--- a/crates/router_derive/src/macros/operation.rs
+++ b/crates/router_derive/src/macros/operation.rs
@@ -44,7 +44,7 @@ impl Derives {
let req_type = Conversion::get_req_type(self);
quote! {
#[automatically_derived]
- impl<F:Send+Clone> Operation<F,#req_type> for #struct_name {
+ impl<F:Send+Clone+Sync> Operation<F,#req_type> for #struct_name {
type Data = PaymentData<F>;
#(#fns)*
}
@@ -59,7 +59,7 @@ impl Derives {
let req_type = Conversion::get_req_type(self);
quote! {
#[automatically_derived]
- impl<F:Send+Clone> Operation<F,#req_type> for &#struct_name {
+ impl<F:Send+Clone+Sync> Operation<F,#req_type> for &#struct_name {
type Data = PaymentData<F>;
#(#ref_fns)*
}