Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

chore: enable `clippy::large_futures` lint (#4822)

Sanchith Hegded2d317ce61c0
diff --git a/.cargo/config.toml b/.cargo/config.toml
index 852384da78..e643b41ec0 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -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",
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index 4928dc949d..f608100c08 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -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(),
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index 63bf80bac0..dddcf58129 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -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 {
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 33103b7a90..02e29f24a6 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -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")?;
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 3341011bb5..c19c8c4575 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -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"),
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 9ab1ec0eb8..d2d2db71ef 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -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) => {
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index 7e29036c40..c5055d4c8c 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -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(),
diff --git a/crates/router/src/core/webhooks/webhook_events.rs b/crates/router/src/core/webhooks/webhook_events.rs
index 6db214c2b0..f248edd652 100644
--- a/crates/router/src/core/webhooks/webhook_events.rs
+++ b/crates/router/src/core/webhooks/webhook_events.rs
@@ -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
diff --git a/crates/router/src/routes/cards_info.rs b/crates/router/src/routes/cards_info.rs
index 4d65fc7203..ca59e072a9 100644
--- a/crates/router/src/routes/cards_info.rs
+++ b/crates/router/src/routes/cards_info.rs
@@ -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
}
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index b97cfc3fa0..4d86ae829e 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -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
}
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index a4a6c7507a..4c7199f2f2 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -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
diff --git a/crates/router/src/routes/mandates.rs b/crates/router/src/routes/mandates.rs
index 365f9a4324..c2ed58ae40 100644
--- a/crates/router/src/routes/mandates.rs
+++ b/crates/router/src/routes/mandates.rs
@@ -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
diff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rs
index 7742f6c1c0..f375a18ab6 100644
--- a/crates/router/src/routes/payment_link.rs
+++ b/crates/router/src/routes/payment_link.rs
@@ -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
}
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index f28cad8900..ab6b0f450d 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -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
}
diff --git a/crates/router/src/routes/poll.rs b/crates/router/src/routes/poll.rs
index 39bb63832a..e4591b4032 100644
--- a/crates/router/src/routes/poll.rs
+++ b/crates/router/src/routes/poll.rs
@@ -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
}
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index 3df6c87166..50e0c0c917 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -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
}
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 556e91d869..74bd61765b 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -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
}
diff --git a/crates/router/src/routes/webhook_events.rs b/crates/router/src/routes/webhook_events.rs
index ef1d64f54e..b4839f5bd0 100644
--- a/crates/router/src/routes/webhook_events.rs
+++ b/crates/router/src/routes/webhook_events.rs
@@ -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
}
diff --git a/crates/router/src/workflows/outgoing_webhook_retry.rs b/crates/router/src/workflows/outgoing_webhook_retry.rs
index 726cbf9de0..63bdb7ec98 100644
--- a/crates/router/src/workflows/outgoing_webhook_retry.rs
+++ b/crates/router/src/workflows/outgoing_webhook_retry.rs
@@ -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