Skip to content

Commit d443a4c

Browse files
authored
fix(connector): [worldpay] remove threeDS data from Authorize request for NTI flows (#7097)
1 parent 8917235 commit d443a4c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct Instruction {
3232
pub value: PaymentValue,
3333
#[serde(skip_serializing_if = "Option::is_none")]
3434
pub debt_repayment: Option<bool>,
35-
#[serde(rename = "threeDS")]
35+
#[serde(rename = "threeDS", skip_serializing_if = "Option::is_none")]
3636
pub three_ds: Option<ThreeDSRequest>,
3737
/// For setting up mandates
3838
pub token_creation: Option<TokenCreation>,

crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,14 @@ fn create_three_ds_request<T: WorldpayPaymentsRequestData>(
390390
router_data: &T,
391391
is_mandate_payment: bool,
392392
) -> Result<Option<ThreeDSRequest>, error_stack::Report<errors::ConnectorError>> {
393-
match router_data.get_auth_type() {
394-
enums::AuthenticationType::ThreeDs => {
393+
match (
394+
router_data.get_auth_type(),
395+
router_data.get_payment_method_data(),
396+
) {
397+
// 3DS for NTI flow
398+
(_, PaymentMethodData::CardDetailsForNetworkTransactionId(_)) => Ok(None),
399+
// 3DS for regular payments
400+
(enums::AuthenticationType::ThreeDs, _) => {
395401
let browser_info = router_data.get_browser_info().ok_or(
396402
errors::ConnectorError::MissingRequiredField {
397403
field_name: "browser_info",
@@ -439,6 +445,7 @@ fn create_three_ds_request<T: WorldpayPaymentsRequestData>(
439445
},
440446
}))
441447
}
448+
// Non 3DS
442449
_ => Ok(None),
443450
}
444451
}

0 commit comments

Comments
 (0)