feat(analytics): add force retrieve call for force retrieve calls (#3565)

Co-authored-by: harsh-sharma-juspay <125131007+harsh-sharma-juspay@users.noreply.github.com>
This commit is contained in:
Sagar naik
2024-02-28 19:10:20 +05:30
committed by GitHub
parent ffbe042fdc
commit 032d58cdbb
7 changed files with 55 additions and 19 deletions

View File

@ -71,7 +71,7 @@ pub async fn payment_intents_create(
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieve))]
#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieveForceSync))]
pub async fn payment_intents_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
@ -96,7 +96,7 @@ pub async fn payment_intents_retrieve(
Err(err) => return api::log_and_return_error_response(report!(err)),
};
let flow = Flow::PaymentsRetrieve;
let flow = Flow::PaymentsRetrieveForceSync;
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(wrap::compatibility_api_wrap::<
_,
@ -131,7 +131,7 @@ pub async fn payment_intents_retrieve(
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieve))]
#[instrument(skip_all, fields(flow))]
pub async fn payment_intents_retrieve_with_gateway_creds(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
@ -160,7 +160,13 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
Err(err) => return api::log_and_return_error_response(report!(err)),
};
let flow = Flow::PaymentsRetrieve;
let flow = match json_payload.force_sync {
Some(true) => Flow::PaymentsRetrieveForceSync,
_ => Flow::PaymentsRetrieve,
};
tracing::Span::current().record("flow", &flow.to_string());
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(wrap::compatibility_api_wrap::<
_,

View File

@ -57,14 +57,14 @@ pub async fn refund_create(
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieve))]
#[instrument(skip_all, fields(flow))]
pub async fn refund_retrieve_with_gateway_creds(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
form_payload: web::Bytes,
) -> HttpResponse {
let refund_request = match qs_config
let refund_request: refund_types::RefundsRetrieveRequest = match qs_config
.deserialize_bytes(&form_payload)
.map_err(|err| report!(errors::StripeErrorCode::from(err)))
{
@ -72,7 +72,12 @@ pub async fn refund_retrieve_with_gateway_creds(
Err(err) => return api::log_and_return_error_response(err),
};
let flow = Flow::RefundsRetrieve;
let flow = match refund_request.force_sync {
Some(true) => Flow::RefundsRetrieveForceSync,
_ => Flow::RefundsRetrieve,
};
tracing::Span::current().record("flow", &flow.to_string());
Box::pin(wrap::compatibility_api_wrap::<
_,
@ -103,7 +108,7 @@ pub async fn refund_retrieve_with_gateway_creds(
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieve))]
#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieveForceSync))]
pub async fn refund_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
@ -115,7 +120,7 @@ pub async fn refund_retrieve(
merchant_connector_details: None,
};
let flow = Flow::RefundsRetrieve;
let flow = Flow::RefundsRetrieveForceSync;
Box::pin(wrap::compatibility_api_wrap::<
_,

View File

@ -78,7 +78,7 @@ pub async fn setup_intents_create(
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieve))]
#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieveForceSync))]
pub async fn setup_intents_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
@ -103,7 +103,7 @@ pub async fn setup_intents_retrieve(
Err(err) => return api::log_and_return_error_response(report!(err)),
};
let flow = Flow::PaymentsRetrieve;
let flow = Flow::PaymentsRetrieveForceSync;
Box::pin(wrap::compatibility_api_wrap::<
_,