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

fix(connector): [Shift4] validate pretask for threeds cards (#1428)

chikke srujan2c1dcff04640
diff --git a/crates/router/src/connector/shift4.rs b/crates/router/src/connector/shift4.rs
index d75a089658..86dc4e5849 100644
--- a/crates/router/src/connector/shift4.rs
+++ b/crates/router/src/connector/shift4.rs
@@ -178,37 +178,36 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
router_data: &mut types::PaymentsAuthorizeRouterData,
app_state: &routes::AppState,
) -> CustomResult<(), errors::ConnectorError> {
- match router_data.auth_type {
- storage_models::enums::AuthenticationType::ThreeDs => {
- let integ: Box<
- &(dyn ConnectorIntegration<
- api::InitPayment,
- types::PaymentsAuthorizeData,
- types::PaymentsResponseData,
- > + Send
- + Sync
- + 'static),
- > = Box::new(&Self);
- let init_data = &types::PaymentsInitRouterData::from((
- &router_data.to_owned(),
- router_data.request.clone(),
- ));
- let init_resp = services::execute_connector_processing_step(
- app_state,
- integ,
- init_data,
- payments::CallConnectorAction::Trigger,
- )
- .await?;
- if init_resp.request.enrolled_for_3ds {
- router_data.response = init_resp.response;
- router_data.status = init_resp.status;
- } else {
- router_data.request.enrolled_for_3ds = false;
- }
+ if router_data.auth_type == storage_models::enums::AuthenticationType::ThreeDs
+ && router_data.payment_method == storage_models::enums::PaymentMethod::Card
+ {
+ let integ: Box<
+ &(dyn ConnectorIntegration<
+ api::InitPayment,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ > + Send
+ + Sync
+ + 'static),
+ > = Box::new(&Self);
+ let init_data = &types::PaymentsInitRouterData::from((
+ &router_data.to_owned(),
+ router_data.request.clone(),
+ ));
+ let init_resp = services::execute_connector_processing_step(
+ app_state,
+ integ,
+ init_data,
+ payments::CallConnectorAction::Trigger,
+ )
+ .await?;
+ if init_resp.request.enrolled_for_3ds {
+ router_data.response = init_resp.response;
+ router_data.status = init_resp.status;
+ } else {
+ router_data.request.enrolled_for_3ds = false;
}
- storage_models::enums::AuthenticationType::NoThreeDs => (),
- };
+ }
Ok(())
}