mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
fix(frm): add feature flag for querying FRM data (#5889)
This commit is contained in:
@ -136,13 +136,17 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
|
|||||||
payment_intent.shipping_address_id = shipping_address.clone().map(|i| i.address_id);
|
payment_intent.shipping_address_id = shipping_address.clone().map(|i| i.address_id);
|
||||||
payment_intent.billing_address_id = billing_address.clone().map(|i| i.address_id);
|
payment_intent.billing_address_id = billing_address.clone().map(|i| i.address_id);
|
||||||
|
|
||||||
let frm_response = db
|
let frm_response = if cfg!(feature = "frm") {
|
||||||
.find_fraud_check_by_payment_id(payment_intent.payment_id.clone(), merchant_account.get_id().clone())
|
db.find_fraud_check_by_payment_id(payment_intent.payment_id.clone(), merchant_account.get_id().clone())
|
||||||
.await
|
.await
|
||||||
.change_context(errors::ApiErrorResponse::PaymentNotFound)
|
.change_context(errors::ApiErrorResponse::PaymentNotFound)
|
||||||
.attach_printable_lazy(|| {
|
.attach_printable_lazy(|| {
|
||||||
format!("Error while retrieving frm_response, merchant_id: {}, payment_id: {attempt_id}", merchant_account.get_id().get_string_repr())
|
format!("Error while retrieving frm_response, merchant_id: {}, payment_id: {attempt_id}", merchant_account.get_id().get_string_repr())
|
||||||
});
|
})
|
||||||
|
.ok()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let payment_data = PaymentData {
|
let payment_data = PaymentData {
|
||||||
flow: PhantomData,
|
flow: PhantomData,
|
||||||
@ -180,7 +184,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
|
|||||||
multiple_capture_data: None,
|
multiple_capture_data: None,
|
||||||
redirect_response: None,
|
redirect_response: None,
|
||||||
surcharge_details: None,
|
surcharge_details: None,
|
||||||
frm_message: frm_response.ok(),
|
frm_message: frm_response,
|
||||||
payment_link_data: None,
|
payment_link_data: None,
|
||||||
incremental_authorization_details: None,
|
incremental_authorization_details: None,
|
||||||
authorizations: vec![],
|
authorizations: vec![],
|
||||||
|
|||||||
@ -117,13 +117,17 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsCancelRequest> for P
|
|||||||
let currency = payment_attempt.currency.get_required_value("currency")?;
|
let currency = payment_attempt.currency.get_required_value("currency")?;
|
||||||
let amount = payment_attempt.get_total_amount().into();
|
let amount = payment_attempt.get_total_amount().into();
|
||||||
|
|
||||||
let frm_response = db
|
let frm_response = if cfg!(feature = "frm") {
|
||||||
.find_fraud_check_by_payment_id(payment_intent.payment_id.clone(), merchant_account.get_id().clone())
|
db.find_fraud_check_by_payment_id(payment_intent.payment_id.clone(), merchant_account.get_id().clone())
|
||||||
.await
|
.await
|
||||||
.change_context(errors::ApiErrorResponse::PaymentNotFound)
|
.change_context(errors::ApiErrorResponse::PaymentNotFound)
|
||||||
.attach_printable_lazy(|| {
|
.attach_printable_lazy(|| {
|
||||||
format!("Error while retrieving frm_response, merchant_id: {:?}, payment_id: {attempt_id}", merchant_account.get_id())
|
format!("Error while retrieving frm_response, merchant_id: {:?}, payment_id: {attempt_id}", merchant_account.get_id())
|
||||||
});
|
})
|
||||||
|
.ok()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let profile_id = payment_intent
|
let profile_id = payment_intent
|
||||||
.profile_id
|
.profile_id
|
||||||
@ -176,7 +180,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsCancelRequest> for P
|
|||||||
multiple_capture_data: None,
|
multiple_capture_data: None,
|
||||||
redirect_response: None,
|
redirect_response: None,
|
||||||
surcharge_details: None,
|
surcharge_details: None,
|
||||||
frm_message: frm_response.ok(),
|
frm_message: frm_response,
|
||||||
payment_link_data: None,
|
payment_link_data: None,
|
||||||
incremental_authorization_details: None,
|
incremental_authorization_details: None,
|
||||||
authorizations: vec![],
|
authorizations: vec![],
|
||||||
|
|||||||
@ -348,13 +348,17 @@ async fn get_tracker_for_sync<
|
|||||||
format!("Error while retrieving dispute list for, merchant_id: {:?}, payment_id: {payment_id:?}", merchant_account.get_id())
|
format!("Error while retrieving dispute list for, merchant_id: {:?}, payment_id: {payment_id:?}", merchant_account.get_id())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let frm_response = db
|
let frm_response = if cfg!(feature = "frm") {
|
||||||
.find_fraud_check_by_payment_id(payment_id.to_owned(), merchant_account.get_id().clone())
|
db.find_fraud_check_by_payment_id(payment_id.to_owned(), merchant_account.get_id().clone())
|
||||||
.await
|
.await
|
||||||
.change_context(errors::ApiErrorResponse::PaymentNotFound)
|
.change_context(errors::ApiErrorResponse::PaymentNotFound)
|
||||||
.attach_printable_lazy(|| {
|
.attach_printable_lazy(|| {
|
||||||
format!("Error while retrieving frm_response, merchant_id: {:?}, payment_id: {payment_id:?}", merchant_account.get_id())
|
format!("Error while retrieving frm_response, merchant_id: {:?}, payment_id: {payment_id:?}", merchant_account.get_id())
|
||||||
});
|
})
|
||||||
|
.ok()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let contains_encoded_data = payment_attempt.encoded_data.is_some();
|
let contains_encoded_data = payment_attempt.encoded_data.is_some();
|
||||||
|
|
||||||
@ -472,7 +476,7 @@ async fn get_tracker_for_sync<
|
|||||||
redirect_response: None,
|
redirect_response: None,
|
||||||
payment_link_data: None,
|
payment_link_data: None,
|
||||||
surcharge_details: None,
|
surcharge_details: None,
|
||||||
frm_message: frm_response.ok(),
|
frm_message: frm_response,
|
||||||
incremental_authorization_details: None,
|
incremental_authorization_details: None,
|
||||||
authorizations,
|
authorizations,
|
||||||
authentication,
|
authentication,
|
||||||
|
|||||||
Reference in New Issue
Block a user