Skip to content

Commit d49973a

Browse files
committed
refactor(router): resolved pr comments for integrity checks
1 parent 4794efe commit d49973a

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

crates/common_utils/src/errors.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ pub enum ValidationError {
7070
}
7171

7272
/// Integrity check errors.
73-
#[allow(missing_docs)] // Only to prevent warnings about struct fields not being documented
7473
#[derive(Debug, Clone, PartialEq, Default)]
7574
pub struct IntegrityCheckError {
75+
/// Field names for which integrity check failed!
7676
pub field_names: String,
77+
/// Connector transaction reference id
7778
pub connector_transaction_id: Option<String>,
7879
}
7980

crates/router/src/core/payments/operations/payment_response.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,14 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
978978
.change_context(errors::ApiErrorResponse::InternalServerError)
979979
.attach_printable("Could not parse the connector response")?;
980980

981+
let auth_update = if Some(router_data.auth_type)
982+
!= payment_data.payment_attempt.authentication_type
983+
{
984+
Some(router_data.auth_type)
985+
} else {
986+
None
987+
};
988+
981989
// incase of success, update error code and error message
982990
let error_status =
983991
if router_data.status == enums::AttemptStatus::Charged {
@@ -1018,15 +1026,20 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
10181026
multiple_capture_data.get_latest_capture().clone(),
10191027
capture_update,
10201028
)];
1021-
(Some((multiple_capture_data, capture_update_list)), None)
1029+
(Some((multiple_capture_data, capture_update_list)), auth_update.map(|auth_type| {
1030+
storage::PaymentAttemptUpdate::AuthenticationTypeUpdate {
1031+
authentication_type: auth_type,
1032+
updated_by: storage_scheme.to_string(),
1033+
}
1034+
}))
10221035
}
10231036
None => (
10241037
None,
10251038
Some(storage::PaymentAttemptUpdate::ResponseUpdate {
10261039
status: updated_attempt_status,
10271040
connector: None,
10281041
connector_transaction_id: connector_transaction_id.clone(),
1029-
authentication_type: None,
1042+
authentication_type: auth_update,
10301043
amount_capturable: router_data
10311044
.request
10321045
.get_amount_capturable(

0 commit comments

Comments
 (0)