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(connector): Add 3DS changes for moneris connector (#13864)

Shubhodip palc286e312da37
diff --git a/crates/hyperswitch_connectors/src/connectors/moneris.rs b/crates/hyperswitch_connectors/src/connectors/moneris.rs
index 2c86f32b32..6eea06562f 100644
--- a/crates/hyperswitch_connectors/src/connectors/moneris.rs
+++ b/crates/hyperswitch_connectors/src/connectors/moneris.rs
@@ -48,7 +48,7 @@ use transformers as moneris;
use crate::{
constants::headers,
types::ResponseRouterData,
- utils::{self, RefundsRequestData},
+ utils::{self, PaymentsAuthorizeRequestData, RefundsRequestData},
};
#[derive(Clone)]
@@ -843,7 +843,7 @@ static MONERIS_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = La
specific_features: Some(
api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
api_models::feature_matrix::CardSpecificFeatures {
- three_ds: common_enums::FeatureStatus::NotSupported,
+ three_ds: common_enums::FeatureStatus::Supported,
no_three_ds: common_enums::FeatureStatus::Supported,
supported_card_networks: supported_card_network.clone(),
}
@@ -862,7 +862,7 @@ static MONERIS_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = La
specific_features: Some(
api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
api_models::feature_matrix::CardSpecificFeatures {
- three_ds: common_enums::FeatureStatus::NotSupported,
+ three_ds: common_enums::FeatureStatus::Supported,
no_three_ds: common_enums::FeatureStatus::Supported,
supported_card_networks: supported_card_network.clone(),
}
@@ -917,4 +917,35 @@ impl ConnectorSpecifications for Moneris {
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
Some(&MONERIS_SUPPORTED_WEBHOOK_FLOWS)
}
+
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
+ match current_flow {
+ api::CurrentFlowInfo::Authorize {
+ auth_type,
+ request_data,
+ } => auth_type.is_three_ds() && request_data.is_card(),
+ api::CurrentFlowInfo::CompleteAuthorize { .. }
+ | api::CurrentFlowInfo::SetupMandate { .. }
+ | api::CurrentFlowInfo::Psync { .. }
+ | api::CurrentFlowInfo::UpdatePostConfirm { .. }
+ | api::CurrentFlowInfo::ConnectorWebhookRegister { .. } => false,
+ }
+ }
+
+ fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
+ matches!(current_flow, api::CurrentFlowInfo::CompleteAuthorize { .. })
+ }
+
+ fn get_preprocessing_flow_if_needed(
+ &self,
+ current_flow_info: api::CurrentFlowInfo,
+ ) -> Option<api::PreProcessingFlowName> {
+ match current_flow_info {
+ api::CurrentFlowInfo::Authorize { .. } => None,
+ api::CurrentFlowInfo::CompleteAuthorize { .. } => {
+ Some(api::PreProcessingFlowName::PostAuthenticate)
+ }
+ _ => None,
+ }
+ }
}
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index 3b5c5deda5..27bf4562f4 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -1600,6 +1600,10 @@ impl
.transpose()
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into());
+ let state = router_data
+ .access_token
+ .as_ref()
+ .map(ConnectorState::foreign_from);
Ok(Self {
merchant_order_id: Some(router_data.connector_request_reference_id.clone()),
@@ -1633,7 +1637,7 @@ impl
metadata,
return_url: router_data.request.router_return_url.clone(),
continue_redirection_url: router_data.request.complete_authorize_url.clone(),
- state: None,
+ state,
browser_info: router_data
.request
.browser_info