mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
chore: enable clippy::large_futures lint (#4822)
This commit is contained in:
@ -6,6 +6,7 @@ rustflags = [
|
||||
"-Wclippy::expect_used",
|
||||
"-Wclippy::index_refutable_slice",
|
||||
"-Wclippy::indexing_slicing",
|
||||
"-Wclippy::large_futures",
|
||||
"-Wclippy::match_on_vec_items",
|
||||
"-Wclippy::missing_panics_doc",
|
||||
"-Wclippy::out_of_bounds_indexing",
|
||||
|
||||
@ -358,12 +358,12 @@ pub async fn attach_evidence(
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let create_file_response = files::files_create_core(
|
||||
let create_file_response = Box::pin(files::files_create_core(
|
||||
state.clone(),
|
||||
merchant_account,
|
||||
key_store,
|
||||
attach_evidence_request.create_file_request,
|
||||
)
|
||||
))
|
||||
.await?;
|
||||
let file_id = match &create_file_response {
|
||||
services::ApplicationResponse::Json(res) => res.file_id.clone(),
|
||||
|
||||
@ -563,7 +563,7 @@ where
|
||||
frm_routing_algorithm.zip(frm_connector_label)
|
||||
{
|
||||
if let Some(frm_configs) = frm_configs.clone() {
|
||||
let mut updated_frm_info = make_frm_data_and_fraud_check_operation(
|
||||
let mut updated_frm_info = Box::pin(make_frm_data_and_fraud_check_operation(
|
||||
db,
|
||||
state,
|
||||
merchant_account,
|
||||
@ -572,7 +572,7 @@ where
|
||||
profile_id,
|
||||
frm_configs.clone(),
|
||||
customer,
|
||||
)
|
||||
))
|
||||
.await?;
|
||||
|
||||
if is_frm_enabled {
|
||||
|
||||
@ -286,7 +286,7 @@ pub async fn get_client_secret_or_add_payment_method(
|
||||
let condition = req.card.is_some() || req.bank_transfer.is_some() || req.wallet.is_some();
|
||||
|
||||
if condition {
|
||||
add_payment_method(state, req, merchant_account, key_store).await
|
||||
Box::pin(add_payment_method(state, req, merchant_account, key_store)).await
|
||||
} else {
|
||||
let payment_method_id = generate_id(consts::ID_LENGTH, "pm");
|
||||
|
||||
@ -393,14 +393,14 @@ pub async fn add_payment_method_data(
|
||||
match pmd {
|
||||
api_models::payment_methods::PaymentMethodCreateData::Card(card) => {
|
||||
helpers::validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?;
|
||||
let resp = add_card_to_locker(
|
||||
let resp = Box::pin(add_card_to_locker(
|
||||
&state,
|
||||
req.clone(),
|
||||
&card,
|
||||
&customer_id,
|
||||
&merchant_account,
|
||||
None,
|
||||
)
|
||||
))
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError);
|
||||
|
||||
@ -555,14 +555,14 @@ pub async fn add_payment_method(
|
||||
api_enums::PaymentMethod::Card => match req.card.clone() {
|
||||
Some(card) => {
|
||||
helpers::validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?;
|
||||
add_card_to_locker(
|
||||
Box::pin(add_card_to_locker(
|
||||
&state,
|
||||
req.clone(),
|
||||
&card,
|
||||
&customer_id,
|
||||
merchant_account,
|
||||
None,
|
||||
)
|
||||
))
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Add Card Failed")
|
||||
@ -888,14 +888,14 @@ pub async fn update_customer_payment_method(
|
||||
.await?;
|
||||
|
||||
// Add the updated payment method data to locker
|
||||
let (mut add_card_resp, _) = add_card_to_locker(
|
||||
let (mut add_card_resp, _) = Box::pin(add_card_to_locker(
|
||||
&state,
|
||||
new_pm.clone(),
|
||||
&updated_card_details,
|
||||
&pm.customer_id,
|
||||
&merchant_account,
|
||||
Some(pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id)),
|
||||
)
|
||||
))
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Failed to add updated payment method to locker")?;
|
||||
|
||||
@ -660,14 +660,14 @@ pub async fn save_in_locker(
|
||||
.clone()
|
||||
.get_required_value("customer_id")?;
|
||||
match payment_method_request.card.clone() {
|
||||
Some(card) => payment_methods::cards::add_card_to_locker(
|
||||
Some(card) => Box::pin(payment_methods::cards::add_card_to_locker(
|
||||
state,
|
||||
payment_method_request,
|
||||
&card,
|
||||
&customer_id,
|
||||
merchant_account,
|
||||
None,
|
||||
)
|
||||
))
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Add Card Failed"),
|
||||
|
||||
@ -726,7 +726,7 @@ pub async fn validate_and_create_refund(
|
||||
.await
|
||||
{
|
||||
Ok(refund) => {
|
||||
schedule_refund_execution(
|
||||
Box::pin(schedule_refund_execution(
|
||||
state,
|
||||
refund.clone(),
|
||||
refund_type,
|
||||
@ -736,7 +736,7 @@ pub async fn validate_and_create_refund(
|
||||
payment_intent,
|
||||
creds_identifier,
|
||||
charges,
|
||||
)
|
||||
))
|
||||
.await?
|
||||
}
|
||||
Err(err) => {
|
||||
|
||||
@ -1070,7 +1070,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
|
||||
// may have an actix arbiter
|
||||
tokio::spawn(
|
||||
async move {
|
||||
trigger_webhook_and_raise_event(
|
||||
Box::pin(trigger_webhook_and_raise_event(
|
||||
state,
|
||||
business_profile,
|
||||
&cloned_key_store,
|
||||
@ -1079,7 +1079,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
|
||||
delivery_attempt,
|
||||
Some(content),
|
||||
process_tracker,
|
||||
)
|
||||
))
|
||||
.await;
|
||||
}
|
||||
.in_current_span(),
|
||||
|
||||
@ -231,7 +231,7 @@ pub async fn retry_delivery_attempt(
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Failed to parse webhook event request information")?;
|
||||
|
||||
super::trigger_webhook_and_raise_event(
|
||||
Box::pin(super::trigger_webhook_and_raise_event(
|
||||
state.clone(),
|
||||
business_profile,
|
||||
&key_store,
|
||||
@ -240,7 +240,7 @@ pub async fn retry_delivery_attempt(
|
||||
delivery_attempt,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
))
|
||||
.await;
|
||||
|
||||
let updated_event = store
|
||||
|
||||
@ -41,7 +41,7 @@ pub async fn card_iin_info(
|
||||
Err(e) => return api::log_and_return_error_response(e),
|
||||
};
|
||||
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
Flow::CardsInfo,
|
||||
state,
|
||||
&req,
|
||||
@ -49,6 +49,6 @@ pub async fn card_iin_info(
|
||||
|state, auth, req, _| cards_info::retrieve_card_info(state, auth.merchant_account, req),
|
||||
&*auth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ pub async fn customers_retrieve(
|
||||
}
|
||||
};
|
||||
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -61,7 +61,7 @@ pub async fn customers_retrieve(
|
||||
|state, auth, req, _| retrieve_customer(state, auth.merchant_account, auth.key_store, req),
|
||||
&*auth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ pub async fn retrieve_dispute(
|
||||
let dispute_id = dispute_types::DisputeId {
|
||||
dispute_id: path.into_inner(),
|
||||
};
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -50,7 +50,7 @@ pub async fn retrieve_dispute(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
/// Disputes - List Disputes
|
||||
@ -85,7 +85,7 @@ pub async fn retrieve_disputes_list(
|
||||
) -> HttpResponse {
|
||||
let flow = Flow::DisputesList;
|
||||
let payload = payload.into_inner();
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -97,7 +97,7 @@ pub async fn retrieve_disputes_list(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
/// Disputes - Accept Dispute
|
||||
|
||||
@ -36,7 +36,7 @@ pub async fn get_mandate(
|
||||
let mandate_id = mandates::MandateId {
|
||||
mandate_id: path.into_inner(),
|
||||
};
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -46,7 +46,7 @@ pub async fn get_mandate(
|
||||
},
|
||||
&auth::ApiKeyAuth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
/// Mandates - Revoke Mandate
|
||||
|
||||
@ -112,7 +112,7 @@ pub async fn payments_link_list(
|
||||
) -> impl Responder {
|
||||
let flow = Flow::PaymentLinkList;
|
||||
let payload = payload.into_inner();
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -120,7 +120,7 @@ pub async fn payments_link_list(
|
||||
|state, auth, payload, _| list_payment_link(state, auth.merchant_account, payload),
|
||||
&auth::ApiKeyAuth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
@ -949,7 +949,7 @@ pub async fn payments_list(
|
||||
) -> impl Responder {
|
||||
let flow = Flow::PaymentsList;
|
||||
let payload = payload.into_inner();
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -961,7 +961,7 @@ pub async fn payments_list(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
#[instrument(skip_all, fields(flow = ?Flow::PaymentsList))]
|
||||
@ -973,7 +973,7 @@ pub async fn payments_list_by_filter(
|
||||
) -> impl Responder {
|
||||
let flow = Flow::PaymentsList;
|
||||
let payload = payload.into_inner();
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -983,7 +983,7 @@ pub async fn payments_list_by_filter(
|
||||
},
|
||||
&auth::JWTAuth(Permission::PaymentRead),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
#[instrument(skip_all, fields(flow = ?Flow::PaymentsList))]
|
||||
@ -995,7 +995,7 @@ pub async fn get_filters_for_payments(
|
||||
) -> impl Responder {
|
||||
let flow = Flow::PaymentsList;
|
||||
let payload = payload.into_inner();
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -1005,7 +1005,7 @@ pub async fn get_filters_for_payments(
|
||||
},
|
||||
&auth::JWTAuth(Permission::PaymentRead),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -1016,7 +1016,7 @@ pub async fn get_payment_filters(
|
||||
req: actix_web::HttpRequest,
|
||||
) -> impl Responder {
|
||||
let flow = Flow::PaymentsFilters;
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -1026,7 +1026,7 @@ pub async fn get_payment_filters(
|
||||
},
|
||||
&auth::JWTAuth(Permission::PaymentRead),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ pub async fn retrieve_poll_status(
|
||||
let poll_id = PollId {
|
||||
poll_id: path.into_inner(),
|
||||
};
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -41,6 +41,6 @@ pub async fn retrieve_poll_status(
|
||||
|state, auth, req, _| poll::retrieve_poll_status(state, req, auth.merchant_account),
|
||||
&auth::PublishableKeyAuth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ pub async fn refunds_update(
|
||||
let flow = Flow::RefundsUpdate;
|
||||
let mut refund_update_req = json_payload.into_inner();
|
||||
refund_update_req.refund_id = path.into_inner();
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -190,7 +190,7 @@ pub async fn refunds_update(
|
||||
|state, auth, req, _| refund_update_core(state, auth.merchant_account, req),
|
||||
&auth::ApiKeyAuth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
/// Refunds - List
|
||||
@ -215,7 +215,7 @@ pub async fn refunds_list(
|
||||
payload: web::Json<api_models::refunds::RefundListRequest>,
|
||||
) -> HttpResponse {
|
||||
let flow = Flow::RefundsList;
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -227,7 +227,7 @@ pub async fn refunds_list(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ pub async fn refunds_filter_list(
|
||||
payload: web::Json<api_models::payments::TimeRange>,
|
||||
) -> HttpResponse {
|
||||
let flow = Flow::RefundsList;
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -265,7 +265,7 @@ pub async fn refunds_filter_list(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ pub async fn refunds_filter_list(
|
||||
#[cfg(feature = "olap")]
|
||||
pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
|
||||
let flow = Flow::RefundsFilters;
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -298,6 +298,6 @@ pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ pub async fn routing_update_default_config(
|
||||
json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>,
|
||||
transaction_type: &enums::TransactionType,
|
||||
) -> impl Responder {
|
||||
oss_api::server_wrap(
|
||||
Box::pin(oss_api::server_wrap(
|
||||
Flow::RoutingUpdateDefaultConfig,
|
||||
state,
|
||||
&req,
|
||||
@ -281,7 +281,7 @@ pub async fn routing_update_default_config(
|
||||
#[cfg(feature = "release")]
|
||||
&auth::JWTAuth(Permission::RoutingWrite),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ pub async fn routing_retrieve_default_config(
|
||||
req: HttpRequest,
|
||||
transaction_type: &enums::TransactionType,
|
||||
) -> impl Responder {
|
||||
oss_api::server_wrap(
|
||||
Box::pin(oss_api::server_wrap(
|
||||
Flow::RoutingRetrieveDefaultConfig,
|
||||
state,
|
||||
&req,
|
||||
@ -309,7 +309,7 @@ pub async fn routing_retrieve_default_config(
|
||||
#[cfg(feature = "release")]
|
||||
&auth::JWTAuth(Permission::RoutingRead),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ pub async fn routing_retrieve_default_config_for_profiles(
|
||||
req: HttpRequest,
|
||||
transaction_type: &enums::TransactionType,
|
||||
) -> impl Responder {
|
||||
oss_api::server_wrap(
|
||||
Box::pin(oss_api::server_wrap(
|
||||
Flow::RoutingRetrieveDefaultConfig,
|
||||
state,
|
||||
&req,
|
||||
@ -598,7 +598,7 @@ pub async fn routing_retrieve_default_config_for_profiles(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ pub async fn routing_update_default_config_for_profile(
|
||||
updated_config: json_payload.into_inner(),
|
||||
profile_id: path.into_inner(),
|
||||
};
|
||||
oss_api::server_wrap(
|
||||
Box::pin(oss_api::server_wrap(
|
||||
Flow::RoutingUpdateDefaultConfig,
|
||||
state,
|
||||
&req,
|
||||
@ -638,6 +638,6 @@ pub async fn routing_update_default_config_for_profile(
|
||||
#[cfg(feature = "release")]
|
||||
&auth::JWTAuth(Permission::RoutingWrite),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ pub async fn list_initial_webhook_delivery_attempts(
|
||||
constraints,
|
||||
};
|
||||
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -48,7 +48,7 @@ pub async fn list_initial_webhook_delivery_attempts(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ pub async fn list_webhook_delivery_attempts(
|
||||
initial_attempt_id,
|
||||
};
|
||||
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -87,7 +87,7 @@ pub async fn list_webhook_delivery_attempts(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ pub async fn retry_webhook_delivery_attempt(
|
||||
event_id,
|
||||
};
|
||||
|
||||
api::server_wrap(
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
@ -126,6 +126,6 @@ pub async fn retry_webhook_delivery_attempt(
|
||||
req.headers(),
|
||||
),
|
||||
api_locking::LockAction::NotApplicable,
|
||||
)
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
|
||||
.peek()
|
||||
.parse_struct("OutgoingWebhookRequestContent")?;
|
||||
|
||||
webhooks_core::trigger_webhook_and_raise_event(
|
||||
Box::pin(webhooks_core::trigger_webhook_and_raise_event(
|
||||
state.clone(),
|
||||
business_profile,
|
||||
&key_store,
|
||||
@ -123,7 +123,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
|
||||
delivery_attempt,
|
||||
None,
|
||||
Some(process),
|
||||
)
|
||||
))
|
||||
.await;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
|
||||
errors::ProcessTrackerError::EApiErrorResponse
|
||||
})?;
|
||||
|
||||
webhooks_core::trigger_webhook_and_raise_event(
|
||||
Box::pin(webhooks_core::trigger_webhook_and_raise_event(
|
||||
state.clone(),
|
||||
business_profile,
|
||||
&key_store,
|
||||
@ -177,7 +177,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
|
||||
delivery_attempt,
|
||||
Some(content),
|
||||
Some(process),
|
||||
)
|
||||
))
|
||||
.await;
|
||||
}
|
||||
// Resource status has changed since the event was created, finish task
|
||||
|
||||
Reference in New Issue
Block a user