Skip to content

Commit 07a6271

Browse files
dgeee13Debarati Ghatak
andauthored
fix(connector): [CYBERSOURCE] fix incorrect consumer authentication information fields (#8927)
Co-authored-by: Debarati Ghatak <[email protected]>
1 parent 15cb473 commit 07a6271

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

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

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
335335
))?
336336
}
337337
};
338-
let cavv_algorithm = Some("2".to_string());
339338

340339
let processing_information = ProcessingInformation {
341340
capture: Some(false),
@@ -345,7 +344,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
345344
authorization_options,
346345
commerce_indicator: String::from("internet"),
347346
payment_solution: solution.map(String::from),
348-
cavv_algorithm,
349347
};
350348
Ok(Self {
351349
processing_information,
@@ -379,7 +377,6 @@ pub struct ProcessingInformation {
379377
capture: Option<bool>,
380378
capture_options: Option<CaptureOptions>,
381379
payment_solution: Option<String>,
382-
cavv_algorithm: Option<String>,
383380
}
384381

385382
#[derive(Debug, Serialize)]
@@ -425,13 +422,15 @@ pub struct CybersourceConsumerAuthInformation {
425422
/// This field indicates the authentication type or challenge presented to the cardholder at checkout.
426423
challenge_code: Option<String>,
427424
/// This field indicates the reason for payer authentication response status. It is only supported for secure transactions in France.
428-
pares_status_reason: Option<String>,
425+
signed_pares_status_reason: Option<String>,
429426
/// This field indicates the reason why strong authentication was cancelled. It is only supported for secure transactions in France.
430427
challenge_cancel_code: Option<String>,
431428
/// This field indicates the score calculated by the 3D Securing platform. It is only supported for secure transactions in France.
432429
network_score: Option<u32>,
433430
/// This is the transaction ID generated by the access control server. This field is supported only for secure transactions in France.
434431
acs_transaction_id: Option<String>,
432+
/// This is the algorithm for generating a cardholder authentication verification value (CAVV) or universal cardholder authentication field (UCAF) data.
433+
cavv_algorithm: Option<String>,
435434
}
436435

437436
#[derive(Debug, Serialize)]
@@ -1007,11 +1006,6 @@ impl
10071006
.map(|eci| get_commerce_indicator_for_external_authentication(network, eci))
10081007
});
10091008

1010-
// The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.
1011-
// In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.
1012-
// This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).
1013-
let cavv_algorithm = Some("2".to_string());
1014-
10151009
Ok(Self {
10161010
capture: Some(matches!(
10171011
item.router_data.request.capture_method,
@@ -1024,7 +1018,6 @@ impl
10241018
capture_options: None,
10251019
commerce_indicator: commerce_indicator_for_external_authentication
10261020
.unwrap_or(commerce_indicator),
1027-
cavv_algorithm,
10281021
})
10291022
}
10301023
}
@@ -1121,7 +1114,6 @@ impl
11211114
} else {
11221115
(None, None, None)
11231116
};
1124-
let cavv_algorithm = Some("2".to_string());
11251117

11261118
Ok(Self {
11271119
capture: Some(matches!(
@@ -1137,7 +1129,6 @@ impl
11371129
.indicator
11381130
.to_owned()
11391131
.unwrap_or(String::from("internet")),
1140-
cavv_algorithm,
11411132
})
11421133
}
11431134
}
@@ -1456,6 +1447,11 @@ impl
14561447
.and_then(|exts| extract_score_id(&exts))
14571448
});
14581449

1450+
// The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.
1451+
// In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.
1452+
// This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).
1453+
let cavv_algorithm = Some("2".to_string());
1454+
14591455
CybersourceConsumerAuthInformation {
14601456
pares_status,
14611457
ucaf_collection_indicator,
@@ -1473,10 +1469,11 @@ impl
14731469
authentication_date,
14741470
effective_authentication_type,
14751471
challenge_code: authn_data.challenge_code.clone(),
1476-
pares_status_reason: authn_data.challenge_code_reason.clone(),
1472+
signed_pares_status_reason: authn_data.challenge_code_reason.clone(),
14771473
challenge_cancel_code: authn_data.challenge_cancel.clone(),
14781474
network_score,
14791475
acs_transaction_id: authn_data.acs_trans_id.clone(),
1476+
cavv_algorithm,
14801477
}
14811478
});
14821479

@@ -1577,6 +1574,8 @@ impl
15771574
.and_then(|exts| extract_score_id(&exts))
15781575
});
15791576

1577+
let cavv_algorithm = Some("2".to_string());
1578+
15801579
CybersourceConsumerAuthInformation {
15811580
pares_status,
15821581
ucaf_collection_indicator,
@@ -1594,10 +1593,11 @@ impl
15941593
authentication_date,
15951594
effective_authentication_type,
15961595
challenge_code: authn_data.challenge_code.clone(),
1597-
pares_status_reason: authn_data.challenge_code_reason.clone(),
1596+
signed_pares_status_reason: authn_data.challenge_code_reason.clone(),
15981597
challenge_cancel_code: authn_data.challenge_cancel.clone(),
15991598
network_score,
16001599
acs_transaction_id: authn_data.acs_trans_id.clone(),
1600+
cavv_algorithm,
16011601
}
16021602
});
16031603

@@ -1702,6 +1702,8 @@ impl
17021702
.and_then(|exts| extract_score_id(&exts))
17031703
});
17041704

1705+
let cavv_algorithm = Some("2".to_string());
1706+
17051707
CybersourceConsumerAuthInformation {
17061708
pares_status,
17071709
ucaf_collection_indicator,
@@ -1719,10 +1721,11 @@ impl
17191721
authentication_date,
17201722
effective_authentication_type,
17211723
challenge_code: authn_data.challenge_code.clone(),
1722-
pares_status_reason: authn_data.challenge_code_reason.clone(),
1724+
signed_pares_status_reason: authn_data.challenge_code_reason.clone(),
17231725
challenge_cancel_code: authn_data.challenge_cancel.clone(),
17241726
network_score,
17251727
acs_transaction_id: authn_data.acs_trans_id.clone(),
1728+
cavv_algorithm,
17261729
}
17271730
});
17281731

@@ -1907,10 +1910,11 @@ impl
19071910
authentication_date: None,
19081911
effective_authentication_type: None,
19091912
challenge_code: None,
1910-
pares_status_reason: None,
1913+
signed_pares_status_reason: None,
19111914
challenge_cancel_code: None,
19121915
network_score: None,
19131916
acs_transaction_id: None,
1917+
cavv_algorithm: None,
19141918
});
19151919

19161920
let merchant_defined_information = item
@@ -2014,10 +2018,11 @@ impl
20142018
authentication_date: None,
20152019
effective_authentication_type: None,
20162020
challenge_code: None,
2017-
pares_status_reason: None,
2021+
signed_pares_status_reason: None,
20182022
challenge_cancel_code: None,
20192023
network_score: None,
20202024
acs_transaction_id: None,
2025+
cavv_algorithm: None,
20212026
}),
20222027
merchant_defined_information,
20232028
})
@@ -2166,10 +2171,11 @@ impl
21662171
authentication_date: None,
21672172
effective_authentication_type: None,
21682173
challenge_code: None,
2169-
pares_status_reason: None,
2174+
signed_pares_status_reason: None,
21702175
challenge_cancel_code: None,
21712176
network_score: None,
21722177
acs_transaction_id: None,
2178+
cavv_algorithm: None,
21732179
}),
21742180
merchant_defined_information,
21752181
})
@@ -2384,10 +2390,11 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
23842390
authentication_date: None,
23852391
effective_authentication_type: None,
23862392
challenge_code: None,
2387-
pares_status_reason: None,
2393+
signed_pares_status_reason: None,
23882394
challenge_cancel_code: None,
23892395
network_score: None,
23902396
acs_transaction_id: None,
2397+
cavv_algorithm: None,
23912398
},
23922399
),
23932400
})
@@ -2658,7 +2665,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>
26582665
)
26592666
.then_some(true);
26602667

2661-
let cavv_algorithm = Some("2".to_string());
26622668
Ok(Self {
26632669
processing_information: ProcessingInformation {
26642670
capture_options: Some(CaptureOptions {
@@ -2672,7 +2678,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>
26722678
capture: None,
26732679
commerce_indicator: String::from("internet"),
26742680
payment_solution: None,
2675-
cavv_algorithm,
26762681
},
26772682
order_information: OrderInformationWithBill {
26782683
amount_details: Amount {
@@ -2698,7 +2703,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>
26982703
) -> Result<Self, Self::Error> {
26992704
let connector_merchant_config =
27002705
CybersourceConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?;
2701-
let cavv_algorithm = Some("2".to_string());
27022706

27032707
Ok(Self {
27042708
processing_information: ProcessingInformation {
@@ -2722,7 +2726,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>
27222726
capture: None,
27232727
capture_options: None,
27242728
payment_solution: None,
2725-
cavv_algorithm,
27262729
},
27272730
order_information: OrderInformationIncrementalAuthorization {
27282731
amount_details: AdditionalAmount {

0 commit comments

Comments
 (0)