Skip to content

Commit 2455732

Browse files
committed
fix(router): fix compilation errors in FRM, payouts and recon modules
1 parent 2e25f14 commit 2455732

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

crates/router/src/core/fraud_check/operation/fraud_check_post.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,10 @@ impl<F: Clone + Send> UpdateTracker<FrmData, F> for FraudCheckPost {
398398
last_step: frm_data.fraud_check.last_step,
399399
};
400400
Some(fraud_check_update)
401-
402401
}
403402
},
404403
},
405404

406-
407405
FrmResponse::Checkout(_) | FrmResponse::Transaction(_) => {
408406
Some(FraudCheckUpdate::ErrorUpdate {
409407
status: FraudCheckStatus::TransactionFailure,

crates/router/src/core/payouts/retry.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{cmp::Ordering, str::FromStr, vec::IntoIter};
22

33
use api_models::payouts::PayoutCreateRequest;
4-
use error_stack::ResultExt;
4+
use error_stack::{report, ResultExt};
55
use router_env::{
66
logger,
77
tracing::{self, instrument},
@@ -83,11 +83,11 @@ pub async fn do_gsm_multiple_connector_actions(
8383
retries = retries.map(|i| i - 1);
8484
}
8585
api_models::gsm::GsmDecision::Requeue => {
86-
Err(errors::ApiErrorResponse::NotImplemented {
86+
Err(report!(errors::ApiErrorResponse::NotImplemented {
8787
message: errors::api_error_response::NotImplementedMessage::Reason(
8888
"Requeue not implemented".to_string(),
8989
),
90-
})?
90+
}))?
9191
}
9292
api_models::gsm::GsmDecision::DoDefault => break,
9393
}
@@ -149,11 +149,11 @@ pub async fn do_gsm_single_connector_actions(
149149
retries = retries.map(|i| i - 1);
150150
}
151151
api_models::gsm::GsmDecision::Requeue => {
152-
Err(errors::ApiErrorResponse::NotImplemented {
152+
Err(report!(errors::ApiErrorResponse::NotImplemented {
153153
message: errors::api_error_response::NotImplementedMessage::Reason(
154154
"Requeue not implemented".to_string(),
155155
),
156-
})?
156+
}))?
157157
}
158158
api_models::gsm::GsmDecision::DoDefault => break,
159159
}
@@ -223,9 +223,8 @@ pub fn get_gsm_decision(
223223
let option_gsm_decision = option_gsm
224224
.and_then(|gsm| {
225225
api_models::gsm::GsmDecision::from_str(gsm.decision.as_str())
226-
227226
.map_err(|err| {
228-
let api_error = err.change_context(errors::ApiErrorResponse::InternalServerError)
227+
let api_error = report!(err).change_context(errors::ApiErrorResponse::InternalServerError)
229228
.attach_printable("gsm decision parsing failed");
230229
logger::warn!(get_gsm_decision_parse_error=?api_error, "error fetching gsm decision");
231230
api_error

crates/router/src/db/fraud_check.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use diesel_models::fraud_check::{self as storage, FraudCheck, FraudCheckUpdate};
2-
use error_stack::ResultExt;
2+
use error_stack::report;
33
use router_env::{instrument, tracing};
44

55
use super::MockDb;
@@ -43,7 +43,9 @@ impl FraudCheckInterface for Store {
4343
new: storage::FraudCheckNew,
4444
) -> CustomResult<FraudCheck, errors::StorageError> {
4545
let conn = connection::pg_connection_write(self).await?;
46-
new.insert(&conn).await.map_err(Into::into)
46+
new.insert(&conn)
47+
.await
48+
.map_err(|error| report!(errors::StorageError::from(error)))
4749
}
4850

4951
#[instrument(skip_all)]
@@ -55,7 +57,7 @@ impl FraudCheckInterface for Store {
5557
let conn = connection::pg_connection_write(self).await?;
5658
this.update_with_attempt_id(&conn, fraud_check)
5759
.await
58-
.map_err(Into::into)
60+
.map_err(|error| report!(errors::StorageError::from(error)))
5961
}
6062

6163
#[instrument(skip_all)]
@@ -67,7 +69,7 @@ impl FraudCheckInterface for Store {
6769
let conn = connection::pg_connection_write(self).await?;
6870
FraudCheck::get_with_payment_id(&conn, payment_id, merchant_id)
6971
.await
70-
.map_err(Into::into)
72+
.map_err(|error| report!(errors::StorageError::from(error)))
7173
}
7274

7375
#[instrument(skip_all)]
@@ -79,7 +81,7 @@ impl FraudCheckInterface for Store {
7981
let conn = connection::pg_connection_write(self).await?;
8082
FraudCheck::get_with_payment_id_if_present(&conn, payment_id, merchant_id)
8183
.await
82-
.map_err(Into::into)
84+
.map_err(|error| report!(errors::StorageError::from(error)))
8385
}
8486
}
8587

crates/router/src/routes/recon.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ pub async fn recon_merchant_account_update(
209209
}
210210

211211
Ok(service_api::ApplicationResponse::Json(
212-
response
213-
.try_into()
214-
.change_context(errors::ApiErrorResponse::InvalidDataValue {
212+
api_types::MerchantAccountResponse::try_from(response).change_context(
213+
errors::ApiErrorResponse::InvalidDataValue {
215214
field_name: "merchant_account",
216-
})?,
215+
},
216+
)?,
217217
))
218218
}
219219

0 commit comments

Comments
 (0)