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::trivially_copy_pass_by_ref` lint and address it (#6724)

Sanchith Hegded17d2fe075be
diff --git a/Cargo.toml b/Cargo.toml
index 38d895d767..dc60c64f66 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,6 +35,7 @@ panicking_unwrap = "warn"
print_stderr = "warn"
print_stdout = "warn"
todo = "warn"
+trivially_copy_pass_by_ref = "warn"
unimplemented = "warn"
unnecessary_self_imports = "warn"
unreachable = "warn"
diff --git a/crates/analytics/src/api_event/core.rs b/crates/analytics/src/api_event/core.rs
index 305de7e69c..425d1476a4 100644
--- a/crates/analytics/src/api_event/core.rs
+++ b/crates/analytics/src/api_event/core.rs
@@ -118,7 +118,7 @@ pub async fn get_api_event_metrics(
&req.group_by_names.clone(),
&merchant_id_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/api_event/metrics.rs b/crates/analytics/src/api_event/metrics.rs
index ac29ec1516..ad49f5d0cc 100644
--- a/crates/analytics/src/api_event/metrics.rs
+++ b/crates/analytics/src/api_event/metrics.rs
@@ -45,7 +45,7 @@ where
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>>;
@@ -66,7 +66,7 @@ where
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
diff --git a/crates/analytics/src/api_event/metrics/api_count.rs b/crates/analytics/src/api_event/metrics/api_count.rs
index f00c01bbf3..85f6cac01c 100644
--- a/crates/analytics/src/api_event/metrics/api_count.rs
+++ b/crates/analytics/src/api_event/metrics/api_count.rs
@@ -32,7 +32,7 @@ where
_dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
@@ -62,7 +62,7 @@ where
alias: Some("end_bucket"),
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/api_event/metrics/latency.rs b/crates/analytics/src/api_event/metrics/latency.rs
index 5d71da2a0a..03c1a226e4 100644
--- a/crates/analytics/src/api_event/metrics/latency.rs
+++ b/crates/analytics/src/api_event/metrics/latency.rs
@@ -35,7 +35,7 @@ where
_dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
@@ -67,7 +67,7 @@ where
alias: Some("end_bucket"),
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/api_event/metrics/status_code_count.rs b/crates/analytics/src/api_event/metrics/status_code_count.rs
index b4fff367b6..f67d3d73e5 100644
--- a/crates/analytics/src/api_event/metrics/status_code_count.rs
+++ b/crates/analytics/src/api_event/metrics/status_code_count.rs
@@ -32,7 +32,7 @@ where
_dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
@@ -68,7 +68,7 @@ where
alias: Some("end_bucket"),
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index 250dc07fee..3fd134bc49 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -38,7 +38,7 @@ pub async fn get_metrics(
&metric_type,
&merchant_id_scoped,
&publishable_key_scoped,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index da5bf6309f..4a1fbd0e14 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -46,7 +46,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>>;
@@ -66,7 +66,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 4fee15e2af..5faeefec68 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index 06de7a694f..663473c2d8 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index 2f744f15e9..15cd86e5cc 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -31,7 +31,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
_publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index 551810d8e5..61b10e6fb9 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index c6c7d1cda0..c5bf7bf81c 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -31,7 +31,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
_publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index 69b4eeba4a..c08cc511e1 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index 6ea26a9097..b310567c9d 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -31,7 +31,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
_publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs b/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
index ca67400a9b..4ce10c9aad 100644
--- a/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
+++ b/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
@@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -45,7 +45,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/disputes/core.rs b/crates/analytics/src/disputes/core.rs
index 85d1a62a1d..f4235518b2 100644
--- a/crates/analytics/src/disputes/core.rs
+++ b/crates/analytics/src/disputes/core.rs
@@ -54,7 +54,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&auth_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/disputes/metrics.rs b/crates/analytics/src/disputes/metrics.rs
index ad7ed81aae..6514e5fcbe 100644
--- a/crates/analytics/src/disputes/metrics.rs
+++ b/crates/analytics/src/disputes/metrics.rs
@@ -52,7 +52,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>;
@@ -73,7 +73,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>> {
diff --git a/crates/analytics/src/disputes/metrics/dispute_status_metric.rs b/crates/analytics/src/disputes/metrics/dispute_status_metric.rs
index bbce460e47..ce962e284f 100644
--- a/crates/analytics/src/disputes/metrics/dispute_status_metric.rs
+++ b/crates/analytics/src/disputes/metrics/dispute_status_metric.rs
@@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
@@ -80,7 +80,7 @@ where
.add_group_by_clause("dispute_status")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/disputes/metrics/sessionized_metrics/dispute_status_metric.rs b/crates/analytics/src/disputes/metrics/sessionized_metrics/dispute_status_metric.rs
index c5c0b91a17..9a7b053581 100644
--- a/crates/analytics/src/disputes/metrics/sessionized_metrics/dispute_status_metric.rs
+++ b/crates/analytics/src/disputes/metrics/sessionized_metrics/dispute_status_metric.rs
@@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
@@ -80,7 +80,7 @@ where
.add_group_by_clause("dispute_status")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/disputes/metrics/sessionized_metrics/total_amount_disputed.rs b/crates/analytics/src/disputes/metrics/sessionized_metrics/total_amount_disputed.rs
index 0767bdaf85..5c5eceb061 100644
--- a/crates/analytics/src/disputes/metrics/sessionized_metrics/total_amount_disputed.rs
+++ b/crates/analytics/src/disputes/metrics/sessionized_metrics/total_amount_disputed.rs
@@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
@@ -78,7 +78,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/disputes/metrics/sessionized_metrics/total_dispute_lost_amount.rs b/crates/analytics/src/disputes/metrics/sessionized_metrics/total_dispute_lost_amount.rs
index f4f4d86086..d6308b09f3 100644
--- a/crates/analytics/src/disputes/metrics/sessionized_metrics/total_dispute_lost_amount.rs
+++ b/crates/analytics/src/disputes/metrics/sessionized_metrics/total_dispute_lost_amount.rs
@@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
@@ -78,7 +78,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/disputes/metrics/total_amount_disputed.rs b/crates/analytics/src/disputes/metrics/total_amount_disputed.rs
index 5b9d0f5462..68c7fa6d16 100644
--- a/crates/analytics/src/disputes/metrics/total_amount_disputed.rs
+++ b/crates/analytics/src/disputes/metrics/total_amount_disputed.rs
@@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
@@ -77,7 +77,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/disputes/metrics/total_dispute_lost_amount.rs b/crates/analytics/src/disputes/metrics/total_dispute_lost_amount.rs
index e13f3a0f53..d14d498270 100644
--- a/crates/analytics/src/disputes/metrics/total_dispute_lost_amount.rs
+++ b/crates/analytics/src/disputes/metrics/total_dispute_lost_amount.rs
@@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
@@ -77,7 +77,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/frm/core.rs b/crates/analytics/src/frm/core.rs
index d2b79ad277..6f120913a7 100644
--- a/crates/analytics/src/frm/core.rs
+++ b/crates/analytics/src/frm/core.rs
@@ -47,7 +47,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&merchant_id_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/frm/metrics.rs b/crates/analytics/src/frm/metrics.rs
index 7f5b4ea32b..b3780dfd3c 100644
--- a/crates/analytics/src/frm/metrics.rs
+++ b/crates/analytics/src/frm/metrics.rs
@@ -44,7 +44,7 @@ where
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>>;
@@ -65,7 +65,7 @@ where
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>> {
diff --git a/crates/analytics/src/frm/metrics/frm_blocked_rate.rs b/crates/analytics/src/frm/metrics/frm_blocked_rate.rs
index 7154478c02..00903cdcae 100644
--- a/crates/analytics/src/frm/metrics/frm_blocked_rate.rs
+++ b/crates/analytics/src/frm/metrics/frm_blocked_rate.rs
@@ -29,7 +29,7 @@ where
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>>
@@ -76,7 +76,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/frm/metrics/frm_triggered_attempts.rs b/crates/analytics/src/frm/metrics/frm_triggered_attempts.rs
index 168a256ffa..dd487cdc93 100644
--- a/crates/analytics/src/frm/metrics/frm_triggered_attempts.rs
+++ b/crates/analytics/src/frm/metrics/frm_triggered_attempts.rs
@@ -30,7 +30,7 @@ where
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>> {
@@ -77,7 +77,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index 13fdefe864..6d694caadf 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -116,7 +116,7 @@ impl AnalyticsProvider {
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
// Metrics to get the fetch time for each payment metric
@@ -220,7 +220,7 @@ impl AnalyticsProvider {
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>> {
// Metrics to get the fetch time for each payment metric
@@ -330,7 +330,7 @@ impl AnalyticsProvider {
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
{
@@ -435,7 +435,7 @@ impl AnalyticsProvider {
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> {
// Metrics to get the fetch time for each refund metric
@@ -645,7 +645,7 @@ impl AnalyticsProvider {
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>> {
// Metrics to get the fetch time for each refund metric
@@ -745,7 +745,7 @@ impl AnalyticsProvider {
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>> {
// Metrics to get the fetch time for each refund metric
@@ -845,7 +845,7 @@ impl AnalyticsProvider {
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
match self {
@@ -910,7 +910,7 @@ impl AnalyticsProvider {
metric: &AuthEventMetrics,
merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
match self {
@@ -941,7 +941,7 @@ impl AnalyticsProvider {
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
match self {
diff --git a/crates/analytics/src/opensearch.rs b/crates/analytics/src/opensearch.rs
index 246a0f4e8b..e85340e49d 100644
--- a/crates/analytics/src/opensearch.rs
+++ b/crates/analytics/src/opensearch.rs
@@ -497,7 +497,7 @@ impl OpenSearchQueryBuilder {
Ok(())
}
- pub fn get_status_field(&self, index: &SearchIndex) -> &str {
+ pub fn get_status_field(&self, index: SearchIndex) -> &str {
match index {
SearchIndex::Refunds | SearchIndex::SessionizerRefunds => "refund_status.keyword",
SearchIndex::Disputes | SearchIndex::SessionizerDisputes => "dispute_status.keyword",
@@ -544,7 +544,7 @@ impl OpenSearchQueryBuilder {
mut payload: Value,
case_insensitive_filters: &[&(String, Vec<String>)],
auth_array: Vec<Value>,
- index: &SearchIndex,
+ index: SearchIndex,
) -> Value {
let mut must_array = case_insensitive_filters
.iter()
@@ -728,7 +728,7 @@ impl OpenSearchQueryBuilder {
payload,
&case_insensitive_filters,
should_array.clone(),
- index,
+ *index,
);
payload
})
diff --git a/crates/analytics/src/payment_intents/core.rs b/crates/analytics/src/payment_intents/core.rs
index 0b66dfda58..80cfc56307 100644
--- a/crates/analytics/src/payment_intents/core.rs
+++ b/crates/analytics/src/payment_intents/core.rs
@@ -98,7 +98,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&auth_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/payment_intents/metrics.rs b/crates/analytics/src/payment_intents/metrics.rs
index ee3d4773e2..c063b3a7c0 100644
--- a/crates/analytics/src/payment_intents/metrics.rs
+++ b/crates/analytics/src/payment_intents/metrics.rs
@@ -66,7 +66,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>;
@@ -87,7 +87,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
diff --git a/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs b/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs
index b301a9b9b2..424901ca7e 100644
--- a/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs
+++ b/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs
@@ -35,7 +35,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -82,7 +82,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/payment_processed_amount.rs b/crates/analytics/src/payment_intents/metrics/payment_processed_amount.rs
index 696dd6a584..d913bfe9a3 100644
--- a/crates/analytics/src/payment_intents/metrics/payment_processed_amount.rs
+++ b/crates/analytics/src/payment_intents/metrics/payment_processed_amount.rs
@@ -36,7 +36,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -103,7 +103,7 @@ where
.attach_printable("Error grouping by currency")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/payments_success_rate.rs b/crates/analytics/src/payment_intents/metrics/payments_success_rate.rs
index 4bb9dc36b0..dda3e37d39 100644
--- a/crates/analytics/src/payment_intents/metrics/payments_success_rate.rs
+++ b/crates/analytics/src/payment_intents/metrics/payments_success_rate.rs
@@ -35,7 +35,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -86,7 +86,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_intent_count.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_intent_count.rs
index 7475a75bb5..3f0f3bc3bc 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_intent_count.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_intent_count.rs
@@ -35,7 +35,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -82,7 +82,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_processed_amount.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_processed_amount.rs
index 0f13ff39af..11b630a55c 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_processed_amount.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_processed_amount.rs
@@ -36,7 +36,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -105,7 +105,7 @@ where
.add_group_by_clause("currency")
.attach_printable("Error grouping by currency")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_distribution.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_distribution.rs
index 437b22aac7..dbb6d33e90 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_distribution.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_distribution.rs
@@ -35,7 +35,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -94,7 +94,7 @@ where
.add_group_by_clause("first_attempt")
.attach_printable("Error grouping by first_attempt")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_success_rate.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_success_rate.rs
index 9716c7ce4d..178d9c1d81 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_success_rate.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_success_rate.rs
@@ -35,7 +35,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -95,7 +95,7 @@ where
.attach_printable("Error grouping by first_attempt")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/smart_retried_amount.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/smart_retried_amount.rs
index c6d7c59f24..40e41253d7 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/smart_retried_amount.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/smart_retried_amount.rs
@@ -41,7 +41,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -107,7 +107,7 @@ where
.add_group_by_clause("currency")
.attach_printable("Error grouping by currency")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/successful_smart_retries.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/successful_smart_retries.rs
index 0b28cb5366..84f6d31dfc 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/successful_smart_retries.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/successful_smart_retries.rs
@@ -41,7 +41,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -92,7 +92,7 @@ where
.attach_printable("Error grouping by dimensions")
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/total_smart_retries.rs b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/total_smart_retries.rs
index 20ef8be627..8cc4e75b3b 100644
--- a/crates/analytics/src/payment_intents/metrics/sessionized_metrics/total_smart_retries.rs
+++ b/crates/analytics/src/payment_intents/metrics/sessionized_metrics/total_smart_retries.rs
@@ -38,7 +38,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -87,7 +87,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs b/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs
index f8acb2e6e9..d51cb4cdf7 100644
--- a/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs
+++ b/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs
@@ -41,7 +41,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -99,7 +99,7 @@ where
.add_group_by_clause("currency")
.attach_printable("Error grouping by currency")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs b/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs
index a19bdec518..524b3ff293 100644
--- a/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs
+++ b/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs
@@ -41,7 +41,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -92,7 +92,7 @@ where
.attach_printable("Error grouping by dimensions")
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs b/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs
index f5539abd9f..8eb561d38d 100644
--- a/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs
+++ b/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs
@@ -38,7 +38,7 @@ where
dimensions: &[PaymentIntentDimensions],
auth: &AuthInfo,
filters: &PaymentIntentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
@@ -87,7 +87,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/core.rs b/crates/analytics/src/payments/core.rs
index 01a3b1abc1..c6f0276c47 100644
--- a/crates/analytics/src/payments/core.rs
+++ b/crates/analytics/src/payments/core.rs
@@ -78,7 +78,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&auth_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
@@ -106,7 +106,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&auth_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/payments/distribution.rs b/crates/analytics/src/payments/distribution.rs
index 055572a080..86a2f06c5f 100644
--- a/crates/analytics/src/payments/distribution.rs
+++ b/crates/analytics/src/payments/distribution.rs
@@ -57,7 +57,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>>;
@@ -79,7 +79,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>> {
diff --git a/crates/analytics/src/payments/distribution/payment_error_message.rs b/crates/analytics/src/payments/distribution/payment_error_message.rs
index de5cb3ae5e..0a92cfbe47 100644
--- a/crates/analytics/src/payments/distribution/payment_error_message.rs
+++ b/crates/analytics/src/payments/distribution/payment_error_message.rs
@@ -35,7 +35,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>> {
@@ -89,7 +89,7 @@ where
.attach_printable("Error grouping by distribution_for")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics.rs b/crates/analytics/src/payments/metrics.rs
index 23b133ad03..71d2e57d7f 100644
--- a/crates/analytics/src/payments/metrics.rs
+++ b/crates/analytics/src/payments/metrics.rs
@@ -68,7 +68,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>>;
@@ -89,7 +89,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
diff --git a/crates/analytics/src/payments/metrics/avg_ticket_size.rs b/crates/analytics/src/payments/metrics/avg_ticket_size.rs
index fc2f44cada..10f350e30c 100644
--- a/crates/analytics/src/payments/metrics/avg_ticket_size.rs
+++ b/crates/analytics/src/payments/metrics/avg_ticket_size.rs
@@ -34,7 +34,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -85,7 +85,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/connector_success_rate.rs b/crates/analytics/src/payments/metrics/connector_success_rate.rs
index 36783eda72..9e6bf31fbf 100644
--- a/crates/analytics/src/payments/metrics/connector_success_rate.rs
+++ b/crates/analytics/src/payments/metrics/connector_success_rate.rs
@@ -36,7 +36,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -87,7 +87,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/payment_count.rs b/crates/analytics/src/payments/metrics/payment_count.rs
index bd0b52d7cf..297aef4fec 100644
--- a/crates/analytics/src/payments/metrics/payment_count.rs
+++ b/crates/analytics/src/payments/metrics/payment_count.rs
@@ -33,7 +33,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -78,7 +78,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/payment_processed_amount.rs b/crates/analytics/src/payments/metrics/payment_processed_amount.rs
index fa54c17304..9584692466 100644
--- a/crates/analytics/src/payments/metrics/payment_processed_amount.rs
+++ b/crates/analytics/src/payments/metrics/payment_processed_amount.rs
@@ -34,7 +34,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -85,7 +85,7 @@ where
.attach_printable("Error grouping by currency")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/payment_success_count.rs b/crates/analytics/src/payments/metrics/payment_success_count.rs
index ea926761c1..843e285897 100644
--- a/crates/analytics/src/payments/metrics/payment_success_count.rs
+++ b/crates/analytics/src/payments/metrics/payment_success_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -79,7 +79,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/retries_count.rs b/crates/analytics/src/payments/metrics/retries_count.rs
index 9695e1fe18..ced845651c 100644
--- a/crates/analytics/src/payments/metrics/retries_count.rs
+++ b/crates/analytics/src/payments/metrics/retries_count.rs
@@ -39,7 +39,7 @@ where
_dimensions: &[PaymentDimensions],
auth: &AuthInfo,
_filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -82,7 +82,7 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs
index b7f1366791..e29c19bda8 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs
@@ -34,7 +34,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -86,7 +86,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs
index 66006c15a2..d8ee7fcb47 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs
@@ -36,7 +36,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -88,7 +88,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs
index c472c12795..d6944d8d0b 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs
@@ -37,7 +37,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -136,7 +136,7 @@ where
.attach_printable("Error grouping by first_attempt")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut outer_query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs
index 29d083dd23..98735b9383 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs
@@ -33,7 +33,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -79,7 +79,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs
index a315b2fc4c..453f988d22 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs
@@ -34,7 +34,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -103,7 +103,7 @@ where
.attach_printable("Error grouping by currency")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs
index b307b77d5d..14391588b4 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -80,7 +80,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs
index e0987dd0d2..5c6a8c6ade 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs
@@ -33,7 +33,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -89,7 +89,7 @@ where
.add_group_by_clause("first_attempt")
.attach_printable("Error grouping by first_attempt")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs
index b79489744c..7d81c48274 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs
@@ -39,7 +39,7 @@ where
_dimensions: &[PaymentDimensions],
auth: &AuthInfo,
_filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -82,7 +82,7 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs
index 30e7471d60..f20308ed3b 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs
@@ -33,7 +33,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -82,7 +82,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/payments/metrics/success_rate.rs b/crates/analytics/src/payments/metrics/success_rate.rs
index e756115a67..6698fe8ce6 100644
--- a/crates/analytics/src/payments/metrics/success_rate.rs
+++ b/crates/analytics/src/payments/metrics/success_rate.rs
@@ -33,7 +33,7 @@ where
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
@@ -81,7 +81,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index cbb0cf6737..f449ba2f9b 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -379,7 +379,7 @@ impl Default for Filter {
impl<T: AnalyticsDataSource> ToSql<T> for Filter {
fn to_sql(&self, table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> {
Ok(match self {
- Self::Plain(l, op, r) => filter_type_to_sql(l, op, r),
+ Self::Plain(l, op, r) => filter_type_to_sql(l, *op, r),
Self::NestedFilter(operator, filters) => {
format!(
"( {} )",
@@ -536,7 +536,7 @@ pub enum FilterTypes {
IsNotNull,
}
-pub fn filter_type_to_sql(l: &String, op: &FilterTypes, r: &String) -> String {
+pub fn filter_type_to_sql(l: &str, op: FilterTypes, r: &str) -> String {
match op {
FilterTypes::EqualBool => format!("{l} = {r}"),
FilterTypes::Equal => format!("{l} = '{r}'"),
@@ -743,7 +743,7 @@ where
Ok(())
}
- pub fn add_granularity_in_mins(&mut self, granularity: &Granularity) -> QueryResult<()> {
+ pub fn add_granularity_in_mins(&mut self, granularity: Granularity) -> QueryResult<()> {
let interval = match granularity {
Granularity::OneMin => "1",
Granularity::FiveMin => "5",
@@ -814,7 +814,7 @@ where
pub fn get_filter_type_clause(&self) -> Option<String> {
self.having.as_ref().map(|vec| {
vec.iter()
- .map(|(l, op, r)| filter_type_to_sql(l, op, r))
+ .map(|(l, op, r)| filter_type_to_sql(l, *op, r))
.collect::<Vec<String>>()
.join(" AND ")
})
diff --git a/crates/analytics/src/refunds/core.rs b/crates/analytics/src/refunds/core.rs
index 205600b925..ca72c9003a 100644
--- a/crates/analytics/src/refunds/core.rs
+++ b/crates/analytics/src/refunds/core.rs
@@ -73,7 +73,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&auth_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/refunds/metrics.rs b/crates/analytics/src/refunds/metrics.rs
index 57e6511d92..13990e8c2e 100644
--- a/crates/analytics/src/refunds/metrics.rs
+++ b/crates/analytics/src/refunds/metrics.rs
@@ -58,7 +58,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>;
@@ -79,7 +79,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> {
diff --git a/crates/analytics/src/refunds/metrics/refund_count.rs b/crates/analytics/src/refunds/metrics/refund_count.rs
index 7079993094..ae21f166a2 100644
--- a/crates/analytics/src/refunds/metrics/refund_count.rs
+++ b/crates/analytics/src/refunds/metrics/refund_count.rs
@@ -33,7 +33,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> {
@@ -78,7 +78,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/refunds/metrics/refund_processed_amount.rs b/crates/analytics/src/refunds/metrics/refund_processed_amount.rs
index 3890b8be6e..9b8c4f313d 100644
--- a/crates/analytics/src/refunds/metrics/refund_processed_amount.rs
+++ b/crates/analytics/src/refunds/metrics/refund_processed_amount.rs
@@ -33,7 +33,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
@@ -80,7 +80,7 @@ where
}
query_builder.add_group_by_clause("currency").switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/refunds/metrics/refund_success_count.rs b/crates/analytics/src/refunds/metrics/refund_success_count.rs
index 4c3f600b05..1eb198687a 100644
--- a/crates/analytics/src/refunds/metrics/refund_success_count.rs
+++ b/crates/analytics/src/refunds/metrics/refund_success_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
@@ -76,7 +76,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/refunds/metrics/refund_success_rate.rs b/crates/analytics/src/refunds/metrics/refund_success_rate.rs
index 8ed144999a..c0a8d27db6 100644
--- a/crates/analytics/src/refunds/metrics/refund_success_rate.rs
+++ b/crates/analytics/src/refunds/metrics/refund_success_rate.rs
@@ -32,7 +32,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
@@ -77,7 +77,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_count.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_count.rs
index 20989daca7..c7114e5ddc 100644
--- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_count.rs
+++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_count.rs
@@ -33,7 +33,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> {
@@ -79,7 +79,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs
index 72e32907ef..c6579005fa 100644
--- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs
+++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs
@@ -37,7 +37,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> {
@@ -127,7 +127,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut outer_query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_processed_amount.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_processed_amount.rs
index 93880824ef..b376b7c128 100644
--- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_processed_amount.rs
+++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_processed_amount.rs
@@ -33,7 +33,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
@@ -88,7 +88,7 @@ where
query_builder.add_group_by_clause("currency").switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs
index 0df28901e8..f7a2e11676 100644
--- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs
+++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs
@@ -36,7 +36,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> {
@@ -119,7 +119,7 @@ where
.switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut outer_query_builder)
.attach_printable("Error adding granularity")
diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_count.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_count.rs
index c0bb139c46..ce9c8f4b39 100644
--- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_count.rs
+++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
@@ -76,7 +76,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_rate.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_rate.rs
index e2348d51ad..b04698c28d 100644
--- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_rate.rs
+++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_rate.rs
@@ -32,7 +32,7 @@ where
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
@@ -77,7 +77,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/core.rs b/crates/analytics/src/sdk_events/core.rs
index 3eca479818..c8ea156674 100644
--- a/crates/analytics/src/sdk_events/core.rs
+++ b/crates/analytics/src/sdk_events/core.rs
@@ -65,7 +65,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&publishable_key_scoped,
&req.filters,
- &req.time_series.map(|t| t.granularity),
+ req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
diff --git a/crates/analytics/src/sdk_events/metrics.rs b/crates/analytics/src/sdk_events/metrics.rs
index 7d5ad0c53d..3c587925a2 100644
--- a/crates/analytics/src/sdk_events/metrics.rs
+++ b/crates/analytics/src/sdk_events/metrics.rs
@@ -56,7 +56,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>>;
@@ -77,7 +77,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
diff --git a/crates/analytics/src/sdk_events/metrics/average_payment_time.rs b/crates/analytics/src/sdk_events/metrics/average_payment_time.rs
index c7f6bca988..1b3ce56682 100644
--- a/crates/analytics/src/sdk_events/metrics/average_payment_time.rs
+++ b/crates/analytics/src/sdk_events/metrics/average_payment_time.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -54,7 +54,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/load_time.rs b/crates/analytics/src/sdk_events/metrics/load_time.rs
index 73cc693c50..6c6ce21a75 100644
--- a/crates/analytics/src/sdk_events/metrics/load_time.rs
+++ b/crates/analytics/src/sdk_events/metrics/load_time.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -54,7 +54,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/payment_attempts.rs b/crates/analytics/src/sdk_events/metrics/payment_attempts.rs
index 4d949d9fb8..a7bb717102 100644
--- a/crates/analytics/src/sdk_events/metrics/payment_attempts.rs
+++ b/crates/analytics/src/sdk_events/metrics/payment_attempts.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -53,7 +53,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/payment_data_filled_count.rs b/crates/analytics/src/sdk_events/metrics/payment_data_filled_count.rs
index 37eb967b38..0488907f9a 100644
--- a/crates/analytics/src/sdk_events/metrics/payment_data_filled_count.rs
+++ b/crates/analytics/src/sdk_events/metrics/payment_data_filled_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -53,7 +53,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/payment_method_selected_count.rs b/crates/analytics/src/sdk_events/metrics/payment_method_selected_count.rs
index d524d0021c..9599caa1e7 100644
--- a/crates/analytics/src/sdk_events/metrics/payment_method_selected_count.rs
+++ b/crates/analytics/src/sdk_events/metrics/payment_method_selected_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -53,7 +53,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/payment_methods_call_count.rs b/crates/analytics/src/sdk_events/metrics/payment_methods_call_count.rs
index 081c4968c5..77e6f38993 100644
--- a/crates/analytics/src/sdk_events/metrics/payment_methods_call_count.rs
+++ b/crates/analytics/src/sdk_events/metrics/payment_methods_call_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -53,7 +53,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs b/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs
index 92308acac6..25c81eacd8 100644
--- a/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs
+++ b/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -53,7 +53,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/analytics/src/sdk_events/metrics/sdk_rendered_count.rs b/crates/analytics/src/sdk_events/metrics/sdk_rendered_count.rs
index 6f03008e0c..e972abbd8e 100644
--- a/crates/analytics/src/sdk_events/metrics/sdk_rendered_count.rs
+++ b/crates/analytics/src/sdk_events/metrics/sdk_rendered_count.rs
@@ -34,7 +34,7 @@ where
dimensions: &[SdkEventDimensions],
publishable_key: &str,
filters: &SdkEventFilters,
- granularity: &Option<Granularity>,
+ granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
@@ -53,7 +53,7 @@ where
})
.switch()?;
- if let Some(granularity) = granularity.as_ref() {
+ if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
diff --git a/crates/api_models/src/connector_enums.rs b/crates/api_models/src/connector_enums.rs
index 4931b8dbd9..294666f35f 100644
--- a/crates/api_models/src/connector_enums.rs
+++ b/crates/api_models/src/connector_enums.rs
@@ -139,7 +139,7 @@ pub enum Connector {
impl Connector {
#[cfg(feature = "payouts")]
- pub fn supports_instant_payout(&self, payout_method: Option<PayoutType>) -> bool {
+ pub fn supports_instant_payout(self, payout_method: Option<PayoutType>) -> bool {
matches!(
(self, payout_method),
(Self::Paypal, Some(PayoutType::Wallet))
@@ -148,26 +148,26 @@ impl Connector {
)
}
#[cfg(feature = "payouts")]
- pub fn supports_create_recipient(&self, payout_method: Option<PayoutType>) -> bool {
+ pub fn supports_create_recipient(self, payout_method: Option<PayoutType>) -> bool {
matches!((self, payout_method), (_, Some(PayoutType::Bank)))
}
#[cfg(feature = "payouts")]
- pub fn supports_payout_eligibility(&self, payout_method: Option<PayoutType>) -> bool {
+ pub fn supports_payout_eligibility(self, payout_method: Option<PayoutType>) -> bool {
matches!((self, payout_method), (_, Some(PayoutType::Card)))
}
#[cfg(feature = "payouts")]
- pub fn is_payout_quote_call_required(&self) -> bool {
+ pub fn is_payout_quote_call_required(self) -> bool {
matches!(self, Self::Wise)
}
#[cfg(feature = "payouts")]
- pub fn supports_access_token_for_payout(&self, payout_method: Option<PayoutType>) -> bool {
+ pub fn supports_access_token_for_payout(self, payout_method: Option<PayoutType>) -> bool {
matches!((self, payout_method), (Self::Paypal, _))
}
#[cfg(feature = "payouts")]
- pub fn supports_vendor_disburse_account_create_for_payout(&self) -> bool {
+ pub fn supports_vendor_disburse_account_create_for_payout(self) -> bool {
matches!(self, Self::Stripe)
}
- pub fn supports_access_token(&self, payment_method: PaymentMethod) -> bool {
+ pub fn supports_access_token(self, payment_method: PaymentMethod) -> bool {
matches!(
(self, payment_method),
(Self::Airwallex, _)
@@ -181,13 +181,13 @@ impl Connector {
| (Self::Itaubank, _)
)
}
- pub fn supports_file_storage_module(&self) -> bool {
+ pub fn supports_file_storage_module(self) -> bool {
matches!(self, Self::Stripe | Self::Checkout)
}
- pub fn requires_defend_dispute(&self) -> bool {
+ pub fn requires_defend_dispute(self) -> bool {
matches!(self, Self::Checkout)
}
- pub fn is_separate_authentication_supported(&self) -> bool {
+ pub fn is_separate_authentication_supported(self) -> bool {
match self {
#[cfg(feature = "dummy_connector")]
Self::DummyConnector1
@@ -281,15 +281,15 @@ impl Connector {
Self::Checkout | Self::Nmi | Self::Cybersource => true,
}
}
- pub fn is_pre_processing_required_before_authorize(&self) -> bool {
+ pub fn is_pre_processing_required_before_authorize(self) -> bool {
matches!(self, Self::Airwallex)
}
- pub fn should_acknowledge_webhook_for_resource_not_found_errors(&self) -> bool {
+ pub fn should_acknowledge_webhook_for_resource_not_found_errors(self) -> bool {
matches!(self, Self::Adyenplatform)
}
#[cfg(feature = "dummy_connector")]
pub fn validate_dummy_connector_enabled(
- &self,
+ self,
is_dummy_connector_enabled: bool,
) -> errors::CustomResult<(), errors::ValidationError> {
if !is_dummy_connector_enabled
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 701e879378..1e05e7ec88 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -599,13 +599,13 @@ pub enum Currency {
impl Currency {
/// Convert the amount to its base denomination based on Currency and return String
- pub fn to_currency_base_unit(&self, amount: i64) -> Result<String, TryFromIntError> {
+ pub fn to_currency_base_unit(self, amount: i64) -> Result<String, TryFromIntError> {
let amount_f64 = self.to_currency_base_unit_asf64(amount)?;
Ok(format!("{amount_f64:.2}"))
}
/// Convert the amount to its base denomination based on Currency and return f64
- pub fn to_currency_base_unit_asf64(&self, amount: i64) -> Result<f64, TryFromIntError> {
+ pub fn to_currency_base_unit_asf64(self, amount: i64) -> Result<f64, TryFromIntError> {
let amount_f64: f64 = u32::try_from(amount)?.into();
let amount = if self.is_zero_decimal_currency() {
amount_f64
@@ -618,7 +618,7 @@ impl Currency {
}
///Convert the higher decimal amount to its base absolute units
- pub fn to_currency_lower_unit(&self, amount: String) -> Result<String, ParseFloatError> {
+ pub fn to_currency_lower_unit(self, amount: String) -> Result<String, ParseFloatError> {
let amount_f64 = amount.parse::<f64>()?;
let amount_string = if self.is_zero_decimal_currency() {
amount_f64
@@ -634,7 +634,7 @@ impl Currency {
/// Paypal Connector accepts Zero and Two decimal currency but not three decimal and it should be updated as required for 3 decimal currencies.
/// Paypal Ref - https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/
pub fn to_currency_base_unit_with_zero_decimal_check(
- &self,
+ self,
amount: i64,
) -> Result<String, TryFromIntError> {
let amount_f64 = self.to_currency_base_unit_asf64(amount)?;
@@ -645,8 +645,8 @@ impl Currency {
}
}
- pub fn iso_4217(&self) -> &'static str {
- match *self {
+ pub fn iso_4217(self) -> &'static str {
+ match self {
Self::AED => "784",
Self::AFN => "971",
Self::ALL => "008",
@@ -1301,7 +1301,7 @@ pub enum IntentStatus {
impl IntentStatus {
/// Indicates whether the syncing with the connector should be allowed or not
- pub fn should_force_sync_with_connector(&self) -> bool {
+ pub fn should_force_sync_with_connector(self) -> bool {
match self {
// Confirm has not happened yet
Self::RequiresConfirmation
@@ -2495,7 +2495,7 @@ pub enum ClientPlatform {
}
impl PaymentSource {
- pub fn is_for_internal_use_only(&self) -> bool {
+ pub fn is_for_internal_use_only(self) -> bool {
match self {
Self::Dashboard | Self::Sdk | Self::MerchantServer | Self::Postman => false,
Self::Webhook | Self::ExternalAuthenticator => true,
@@ -2590,7 +2590,7 @@ pub enum AuthenticationConnectors {
}
impl AuthenticationConnectors {
- pub fn is_separate_version_call_required(&self) -> bool {
+ pub fn is_separate_version_call_required(self) -> bool {
match self {
Self::Threedsecureio | Self::Netcetera => false,
Self::Gpayments => true,
@@ -2624,15 +2624,15 @@ pub enum AuthenticationStatus {
}
impl AuthenticationStatus {
- pub fn is_terminal_status(&self) -> bool {
+ pub fn is_terminal_status(self) -> bool {
match self {
Self::Started | Self::Pending => false,
Self::Success | Self::Failed => true,
}
}
- pub fn is_failed(&self) -> bool {
- self == &Self::Failed
+ pub fn is_failed(self) -> bool {
+ self == Self::Failed
}
}
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index ddf55d2937..7611ae127e 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -522,7 +522,7 @@ impl Country {
CountryAlpha2::ZW => Self::Zimbabwe,
}
}
- pub const fn to_alpha2(&self) -> CountryAlpha2 {
+ pub const fn to_alpha2(self) -> CountryAlpha2 {
match self {
Self::Afghanistan => CountryAlpha2::AF,
Self::AlandIslands => CountryAlpha2::AX,
@@ -1028,7 +1028,7 @@ impl Country {
CountryAlpha3::ZWE => Self::Zimbabwe,
}
}
- pub const fn to_alpha3(&self) -> CountryAlpha3 {
+ pub const fn to_alpha3(self) -> CountryAlpha3 {
match self {
Self::Afghanistan => CountryAlpha3::AFG,
Self::AlandIslands => CountryAlpha3::ALA,
@@ -1535,7 +1535,7 @@ impl Country {
_ => Err(NumericCountryCodeParseError),
}
}
- pub const fn to_numeric(&self) -> u32 {
+ pub const fn to_numeric(self) -> u32 {
match self {
Self::Afghanistan => 4,
Self::AlandIslands => 248,
@@ -1905,6 +1905,8 @@ mod custom_serde {
use super::*;
+ // `serde::Serialize` implementation needs the function to accept `&Country`
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn serialize<S>(code: &Country, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -1937,6 +1939,8 @@ mod custom_serde {
use super::*;
+ // `serde::Serialize` implementation needs the function to accept `&Country`
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn serialize<S>(code: &Country, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -1969,6 +1973,8 @@ mod custom_serde {
use super::*;
+ // `serde::Serialize` implementation needs the function to accept `&Country`
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn serialize<S>(code: &Country, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
index a808556414..e0aa77ce70 100644
--- a/crates/common_utils/src/id_type.rs
+++ b/crates/common_utils/src/id_type.rs
@@ -47,7 +47,7 @@ use thiserror::Error;
use crate::{fp_utils::when, generate_id_with_default_len};
#[inline]
-fn is_valid_id_character(input_char: &char) -> bool {
+fn is_valid_id_character(input_char: char) -> bool {
input_char.is_ascii_alphanumeric() || matches!(input_char, '_' | '-')
}
@@ -57,7 +57,7 @@ fn get_invalid_input_character(input_string: Cow<'static, str>) -> Option<char>
input_string
.trim()
.chars()
- .find(|char| !is_valid_id_character(char))
+ .find(|&char| !is_valid_id_character(char))
}
#[derive(Debug, PartialEq, Hash, Serialize, Clone, Eq)]
diff --git a/crates/common_utils/src/id_type/global_id.rs b/crates/common_utils/src/id_type/global_id.rs
index a54df75858..d783912459 100644
--- a/crates/common_utils/src/id_type/global_id.rs
+++ b/crates/common_utils/src/id_type/global_id.rs
@@ -29,7 +29,7 @@ pub(crate) enum GlobalEntity {
}
impl GlobalEntity {
- fn prefix(&self) -> &'static str {
+ fn prefix(self) -> &'static str {
match self {
Self::Customer => "cus",
Self::Payment => "pay",
diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs
index 6c4b090fff..0d39841fe0 100644
--- a/crates/common_utils/src/types.rs
+++ b/crates/common_utils/src/types.rs
@@ -375,7 +375,7 @@ pub struct MinorUnit(i64);
impl MinorUnit {
/// gets amount as i64 value will be removed in future
- pub fn get_amount_as_i64(&self) -> i64 {
+ pub fn get_amount_as_i64(self) -> i64 {
self.0
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
index b5363cdf5d..b4e066ebd9 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
@@ -64,7 +64,7 @@ impl api::RefundExecute for Cashtocode {}
impl api::RefundSync for Cashtocode {}
fn get_b64_auth_cashtocode(
- payment_method_type: &Option<enums::PaymentMethodType>,
+ payment_method_type: Option<enums::PaymentMethodType>,
auth_type: &transformers::CashtocodeAuth,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
fn construct_basic_auth(
@@ -204,7 +204,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
&req.request.currency,
))?;
- let mut api_key = get_b64_auth_cashtocode(&req.request.payment_method_type, &auth_type)?;
+ let mut api_key = get_b64_auth_cashtocode(req.request.payment_method_type, &auth_type)?;
header.append(&mut api_key);
Ok(header)
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
index 2a282414f4..7a70d97a10 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
@@ -203,7 +203,7 @@ pub struct CashtocodePaymentsSyncResponse {
}
fn get_redirect_form_data(
- payment_method_type: &enums::PaymentMethodType,
+ payment_method_type: enums::PaymentMethodType,
response_data: CashtocodePaymentsResponseData,
) -> CustomResult<RedirectForm, errors::ConnectorError> {
match payment_method_type {
@@ -260,7 +260,6 @@ impl<F>
.data
.request
.payment_method_type
- .as_ref()
.ok_or(errors::ConnectorError::MissingPaymentMethodType)?;
let redirection_data = get_redirect_form_data(payment_method_type, response_data)?;
(
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
index 74c8d1edb3..83f861dfdb 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
@@ -1,4 +1,4 @@
-use common_enums::enums::{self, AuthenticationType, Currency};
+use common_enums::enums::{self, AuthenticationType};
use common_utils::pii::IpAddress;
use hyperswitch_domain_models::{
payment_method_data::{Card, PaymentMethodData},
@@ -148,7 +148,7 @@ impl TryFrom<&PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest {
item.request.amount,
item.request.currency,
)?,
- currency_code: Currency::iso_4217(&item.request.currency).to_string(),
+ currency_code: item.request.currency.iso_4217().to_string(),
three_d_secure,
source,
order_identifier: item.connector_request_reference_id.clone(),
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
index c94cd09e27..f909de4dcc 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
@@ -69,7 +69,7 @@ impl Rapyd {
http_method: &str,
url_path: &str,
body: &str,
- timestamp: &i64,
+ timestamp: i64,
salt: &str,
) -> CustomResult<String, errors::ConnectorError> {
let rapyd::RapydAuthType {
@@ -230,7 +230,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
let body = types::PaymentsAuthorizeType::get_request_body(self, req, connectors)?;
let req_body = body.get_inner_value().expose();
let signature =
- self.generate_signature(&auth, "post", "/v1/payments", &req_body, &timestamp, &salt)?;
+ self.generate_signature(&auth, "post", "/v1/payments", &req_body, timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
@@ -342,7 +342,7 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Ra
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let url_path = format!("/v1/payments/{}", req.request.connector_transaction_id);
let signature =
- self.generate_signature(&auth, "delete", &url_path, "", &timestamp, &salt)?;
+ self.generate_signature(&auth, "delete", &url_path, "", timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
@@ -438,7 +438,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Rap
.get_connector_transaction_id()
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?
);
- let signature = self.generate_signature(&auth, "get", &url_path, "", &timestamp, &salt)?;
+ let signature = self.generate_signature(&auth, "get", &url_path, "", timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
@@ -535,7 +535,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
let body = types::PaymentsCaptureType::get_request_body(self, req, connectors)?;
let req_body = body.get_inner_value().expose();
let signature =
- self.generate_signature(&auth, "post", &url_path, &req_body, &timestamp, &salt)?;
+ self.generate_signature(&auth, "post", &url_path, &req_body, timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
@@ -664,7 +664,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Rapyd {
let req_body = body.get_inner_value().expose();
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let signature =
- self.generate_signature(&auth, "post", "/v1/refunds", &req_body, &timestamp, &salt)?;
+ self.generate_signature(&auth, "post", "/v1/refunds", &req_body, timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
diff --git a/crates/hyperswitch_connectors/src/connectors/worldline.rs b/crates/hyperswitch_connectors/src/connectors/worldline.rs
index 0cbd4660da..b68a1e7a65 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldline.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldline.rs
@@ -62,7 +62,7 @@ impl Worldline {
pub fn generate_authorization_token(
&self,
auth: worldline::WorldlineAuthType,
- http_method: &Method,
+ http_method: Method,
content_type: &str,
date: &str,
endpoint: &str,
@@ -113,7 +113,7 @@ where
let date = Self::get_current_date_time()?;
let content_type = Self::get_content_type(self);
let signed_data: String =
- self.generate_authorization_token(auth, &http_method, content_type, &date, &endpoint)?;
+ self.generate_authorization_token(auth, http_method, content_type, &date, &endpoint)?;
Ok(vec![
(headers::DATE.to_string(), date.into()),
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index e35c467230..c65ec864d3 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -515,13 +515,13 @@ fn compile_graph_for_countries_and_currencies(
fn compile_config_graph(
builder: &mut cgraph::ConstraintGraphBuilder<dir::DirValue>,
config: &kgraph_types::CountryCurrencyFilter,
- connector: &api_enums::RoutableConnectors,
+ connector: api_enums::RoutableConnectors,
) -> Result<cgraph::NodeId, KgraphError> {
let mut agg_node_id: Vec<(cgraph::NodeId, cgraph::Relation, cgraph::Strength)> = Vec::new();
let mut pmt_enabled: Vec<dir::DirValue> = Vec::new();
if let Some(pmt) = config
.connector_configs
- .get(connector)
+ .get(&connector)
.or(config.default_configs.as_ref())
.map(|inner| inner.0.clone())
{
@@ -635,7 +635,7 @@ fn compile_merchant_connector_graph(
let config_info = "Config for respective PaymentMethodType for the connector";
- let config_enabled_agg_id = compile_config_graph(builder, config, &connector)?;
+ let config_enabled_agg_id = compile_config_graph(builder, config, connector)?;
let domain_level_node_id = builder
.make_all_aggregator(
diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs
index 5b6dd81501..212a125742 100644
--- a/crates/router/src/bin/router.rs
+++ b/crates/router/src/bin/router.rs
@@ -35,7 +35,7 @@ async fn main() -> ApplicationResult<()> {
// Spawn a thread for collecting metrics at fixed intervals
metrics::bg_metrics_collector::spawn_metrics_collector(
- &conf.log.telemetry.bg_metrics_collection_interval_in_secs,
+ conf.log.telemetry.bg_metrics_collection_interval_in_secs,
);
#[allow(clippy::expect_used)]
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 83ad0d3a18..16cab2fda4 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1738,7 +1738,7 @@ fn get_additional_data(item: &types::PaymentsAuthorizeRouterData) -> Option<Addi
})
}
-fn get_channel_type(pm_type: &Option<storage_enums::PaymentMethodType>) -> Option<Channel> {
+fn get_channel_type(pm_type: Option<storage_enums::PaymentMethodType>) -> Option<Channel> {
pm_type.as_ref().and_then(|pmt| match pmt {
storage_enums::PaymentMethodType::GoPay | storage_enums::PaymentMethodType::Vipps => {
Some(Channel::Web)
@@ -3139,7 +3139,7 @@ impl
let additional_data = get_additional_data(item.router_data);
let payment_method = AdyenPaymentMethod::try_from((wallet_data, item.router_data))?;
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
- let channel = get_channel_type(&item.router_data.request.payment_method_type);
+ let channel = get_channel_type(item.router_data.request.payment_method_type);
let (recurring_processing_model, store_payment_method, shopper_reference) =
get_recurring_processing_model(item.router_data)?;
let return_url = item.router_data.request.get_router_return_url()?;
diff --git a/crates/router/src/connector/paybox/transformers.rs b/crates/router/src/connector/paybox/transformers.rs
index 4e237223fa..80e3e0ef07 100644
--- a/crates/router/src/connector/paybox/transformers.rs
+++ b/crates/router/src/connector/paybox/transformers.rs
@@ -189,8 +189,7 @@ impl TryFrom<&PayboxRouterData<&types::PaymentsCaptureRouterData>> for PayboxCap
let auth_data: PayboxAuthType =
PayboxAuthType::try_from(&item.router_data.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- let currency = diesel_models::enums::Currency::iso_4217(&item.router_data.request.currency)
- .to_string();
+ let currency = item.router_data.request.currency.iso_4217().to_string();
let paybox_meta_data: PayboxMeta =
utils::to_connector_meta(item.router_data.request.connector_meta.clone())?;
let format_time = common_utils::date_time::format_date(
@@ -387,9 +386,7 @@ impl TryFrom<&PayboxRouterData<&types::PaymentsAuthorizeRouterData>> for PayboxP
item.router_data.request.capture_method,
item.router_data.request.is_mandate_payment(),
)?;
- let currency =
- diesel_models::enums::Currency::iso_4217(&item.router_data.request.currency)
- .to_string();
+ let currency = item.router_data.request.currency.iso_4217().to_string();
let expiration_date =
req_card.get_card_expiry_month_year_2_digit_with_delimiter("".to_owned())?;
let format_time = common_utils::date_time::format_date(
@@ -892,8 +889,7 @@ impl<F> TryFrom<&PayboxRouterData<&types::RefundsRouterData<F>>> for PayboxRefun
let auth_data: PayboxAuthType =
PayboxAuthType::try_from(&item.router_data.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- let currency = diesel_models::enums::Currency::iso_4217(&item.router_data.request.currency)
- .to_string();
+ let currency = item.router_data.request.currency.iso_4217().to_string();
let format_time = common_utils::date_time::format_date(
common_utils::date_time::now(),
DateFormat::DDMMYYYYHHmmss,
@@ -1090,9 +1086,7 @@ impl TryFrom<&PayboxRouterData<&types::PaymentsCompleteAuthorizeRouterData>> for
item.router_data.request.capture_method,
item.router_data.request.is_mandate_payment(),
)?;
- let currency =
- diesel_models::enums::Currency::iso_4217(&item.router_data.request.currency)
- .to_string();
+ let currency = item.router_data.request.currency.iso_4217().to_string();
let expiration_date =
req_card.get_card_expiry_month_year_2_digit_with_delimiter("".to_owned())?;
let format_time = common_utils::date_time::format_date(
@@ -1207,8 +1201,7 @@ impl
Some(enums::CaptureMethod::Manual) => Ok(MANDATE_AUTH_ONLY.to_string()),
_ => Err(errors::ConnectorError::CaptureMethodNotSupported),
}?;
- let currency = diesel_models::enums::Currency::iso_4217(&item.router_data.request.currency)
- .to_string();
+ let currency = item.router_data.request.currency.iso_4217().to_string();
let format_time = common_utils::date_time::format_date(
common_utils::date_time::now(),
DateFormat::DDMMYYYYHHmmss,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 6e2ed22072..b026b1e32f 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -2723,7 +2723,6 @@ pub async fn create_connector(
let key_manager_state = &(&state).into();
#[cfg(feature = "dummy_connector")]
req.connector_name
- .clone()
.validate_dummy_connector_enabled(state.conf.dummy_connector.enabled)
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid connector name".to_string(),
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index 3555eb1193..bc66461e81 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -182,7 +182,7 @@ pub async fn form_payment_link_data(
let payment_link_status = check_payment_link_status(session_expiry);
let is_terminal_state = check_payment_link_invalid_conditions(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Cancelled,
storage_enums::IntentStatus::Failed,
@@ -668,10 +668,10 @@ fn capitalize_first_char(s: &str) -> String {
}
fn check_payment_link_invalid_conditions(
- intent_status: &storage_enums::IntentStatus,
+ intent_status: storage_enums::IntentStatus,
not_allowed_statuses: &[storage_enums::IntentStatus],
) -> bool {
- not_allowed_statuses.contains(intent_status)
+ not_allowed_statuses.contains(&intent_status)
}
#[cfg(feature = "v2")]
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index a7c4a4c4ad..53ec012989 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -433,7 +433,7 @@ pub async fn render_pm_collect_link(
fn generate_task_id_for_payment_method_status_update_workflow(
key_id: &str,
- runner: &storage::ProcessTrackerRunner,
+ runner: storage::ProcessTrackerRunner,
task: &str,
) -> String {
format!("{runner}_{task}_{key_id}")
@@ -467,7 +467,7 @@ pub async fn add_payment_method_status_update_task(
let process_tracker_id = generate_task_id_for_payment_method_status_update_workflow(
payment_method.get_id().as_str(),
- &runner,
+ runner,
task,
);
let process_tracker_entry = storage::ProcessTrackerNew::new(
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index ad612ed6f3..68b1790880 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -3328,7 +3328,7 @@ pub async fn list_payment_methods(
None
};
- helpers::infer_payment_type(&amount, mandate_type.as_ref())
+ helpers::infer_payment_type(amount, mandate_type.as_ref())
});
let all_mcas = db
@@ -3838,7 +3838,7 @@ pub async fn list_payment_methods(
.extend(required_fields_final.non_mandate.clone());
}
required_fields_hs = should_collect_shipping_or_billing_details_from_wallet_connector(
- &payment_method,
+ payment_method,
element.payment_experience.as_ref(),
business_profile.as_ref(),
required_fields_hs.clone(),
@@ -4269,7 +4269,7 @@ pub async fn list_payment_methods(
}
fn should_collect_shipping_or_billing_details_from_wallet_connector(
- payment_method: &api_enums::PaymentMethod,
+ payment_method: api_enums::PaymentMethod,
payment_experience_optional: Option<&api_enums::PaymentExperience>,
business_profile: Option<&Profile>,
mut required_fields_hs: HashMap<String, RequiredFieldInfo>,
@@ -4553,7 +4553,7 @@ pub async fn filter_payment_methods(
let filter_pm_based_on_allowed_types = filter_pm_based_on_allowed_types(
allowed_payment_method_types.as_ref(),
- &payment_method_object.payment_method_type,
+ payment_method_object.payment_method_type,
);
if payment_attempt
@@ -4596,7 +4596,7 @@ pub async fn filter_payment_methods(
let filter_pm_card_network_based = filter_pm_card_network_based(
payment_method_object.card_networks.as_ref(),
req.card_networks.as_ref(),
- &payment_method_object.payment_method_type,
+ payment_method_object.payment_method_type,
);
let saved_payment_methods_filter = req
@@ -4696,7 +4696,7 @@ fn filter_installment_based(
fn filter_pm_card_network_based(
pm_card_networks: Option<&Vec<api_enums::CardNetwork>>,
request_card_networks: Option<&Vec<api_enums::CardNetwork>>,
- pm_type: &api_enums::PaymentMethodType,
+ pm_type: api_enums::PaymentMethodType,
) -> bool {
match pm_type {
api_enums::PaymentMethodType::Credit | api_enums::PaymentMethodType::Debit => {
@@ -4714,9 +4714,9 @@ fn filter_pm_card_network_based(
fn filter_pm_based_on_allowed_types(
allowed_types: Option<&Vec<api_enums::PaymentMethodType>>,
- payment_method_type: &api_enums::PaymentMethodType,
+ payment_method_type: api_enums::PaymentMethodType,
) -> bool {
- allowed_types.map_or(true, |pm| pm.contains(payment_method_type))
+ allowed_types.map_or(true, |pm| pm.contains(&payment_method_type))
}
fn filter_recurring_based(
diff --git a/crates/router/src/core/payment_methods/utils.rs b/crates/router/src/core/payment_methods/utils.rs
index 604e8c7062..816807fe01 100644
--- a/crates/router/src/core/payment_methods/utils.rs
+++ b/crates/router/src/core/payment_methods/utils.rs
@@ -96,7 +96,7 @@ fn compile_pm_graph(
domain_id,
supported_payment_methods_for_update_mandate,
pmt.clone(),
- &pm_enabled.payment_method,
+ pm_enabled.payment_method,
);
if let Ok(Some(connector_eligible_for_update_mandates_node)) = res {
agg_or_nodes_for_mandate_filters.push((
@@ -200,7 +200,7 @@ fn compile_pm_graph(
.or_else(|| config.0.get("default"))
.map(|inner| {
if let Ok(Some(capture_method_filter)) =
- construct_capture_method_node(builder, inner, &pmt.payment_method_type)
+ construct_capture_method_node(builder, inner, pmt.payment_method_type)
{
agg_nodes.push((
capture_method_filter,
@@ -214,7 +214,7 @@ fn compile_pm_graph(
if let Ok(Some(country_node)) = compile_accepted_countries_for_mca(
builder,
domain_id,
- &pmt.payment_method_type,
+ pmt.payment_method_type,
pmt.accepted_countries,
config,
connector.clone(),
@@ -230,7 +230,7 @@ fn compile_pm_graph(
if let Ok(Some(currency_node)) = compile_accepted_currency_for_mca(
builder,
domain_id,
- &pmt.payment_method_type,
+ pmt.payment_method_type,
pmt.accepted_currencies,
config,
connector.clone(),
@@ -274,7 +274,7 @@ fn construct_supported_connectors_for_update_mandate_node(
domain_id: cgraph::DomainId,
supported_payment_methods_for_update_mandate: &settings::SupportedPaymentMethodsForMandate,
pmt: RequestPaymentMethodTypes,
- payment_method: &enums::PaymentMethod,
+ payment_method: enums::PaymentMethod,
) -> Result<Option<cgraph::NodeId>, KgraphError> {
let card_value_node = builder.make_value_node(
cgraph::NodeValue::Value(dir::DirValue::PaymentMethod(enums::PaymentMethod::Card)),
@@ -296,9 +296,9 @@ fn construct_supported_connectors_for_update_mandate_node(
if let Some(supported_pm_for_mandates) = supported_payment_methods_for_update_mandate
.0
- .get(payment_method)
+ .get(&payment_method)
{
- if payment_method == &enums::PaymentMethod::Card {
+ if payment_method == enums::PaymentMethod::Card {
if let Some(credit_connector_list) = supported_pm_for_mandates
.0
.get(&api_enums::PaymentMethodType::Credit)
@@ -498,12 +498,12 @@ fn construct_supported_connectors_for_mandate_node(
fn construct_capture_method_node(
builder: &mut cgraph::ConstraintGraphBuilder<dir::DirValue>,
payment_method_filters: &settings::PaymentMethodFilters,
- payment_method_type: &api_enums::PaymentMethodType,
+ payment_method_type: api_enums::PaymentMethodType,
) -> Result<Option<cgraph::NodeId>, KgraphError> {
if !payment_method_filters
.0
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
- *payment_method_type,
+ payment_method_type,
))
.and_then(|v| v.not_available_flows)
.and_then(|v| v.capture_method)
@@ -542,7 +542,7 @@ fn construct_capture_method_node(
fn compile_accepted_countries_for_mca(
builder: &mut cgraph::ConstraintGraphBuilder<dir::DirValue>,
domain_id: cgraph::DomainId,
- payment_method_type: &enums::PaymentMethodType,
+ payment_method_type: enums::PaymentMethodType,
pm_countries: Option<admin::AcceptedCountries>,
config: &settings::ConnectorFilters,
connector: String,
@@ -608,7 +608,7 @@ fn compile_accepted_countries_for_mca(
derived_config
.0
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
- *payment_method_type,
+ payment_method_type,
))
{
if let Some(config_countries) = value.country.as_ref() {
@@ -636,7 +636,7 @@ fn compile_accepted_countries_for_mca(
default_derived_config
.0
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
- *payment_method_type,
+ payment_method_type,
))
{
if let Some(config_countries) = value.country.as_ref() {
@@ -673,7 +673,7 @@ fn compile_accepted_countries_for_mca(
fn compile_accepted_currency_for_mca(
builder: &mut cgraph::ConstraintGraphBuilder<dir::DirValue>,
domain_id: cgraph::DomainId,
- payment_method_type: &enums::PaymentMethodType,
+ payment_method_type: enums::PaymentMethodType,
pm_currency: Option<admin::AcceptedCurrencies>,
config: &settings::ConnectorFilters,
connector: String,
@@ -730,7 +730,7 @@ fn compile_accepted_currency_for_mca(
derived_config
.0
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
- *payment_method_type,
+ payment_method_type,
))
{
if let Some(config_currencies) = value.currency.as_ref() {
@@ -760,7 +760,7 @@ fn compile_accepted_currency_for_mca(
default_derived_config
.0
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
- *payment_method_type,
+ payment_method_type,
))
{
if let Some(config_currencies) = value.currency.as_ref() {
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index 7a24f2a30a..e4f72c717f 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -1379,7 +1379,7 @@ pub async fn add_delete_tokenized_data_task(
lookup_key: lookup_key.to_owned(),
pm,
};
- let schedule_time = get_delete_tokenize_schedule_time(db, &pm, 0)
+ let schedule_time = get_delete_tokenize_schedule_time(db, pm, 0)
.await
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to obtain initial process tracker schedule time")?;
@@ -1434,8 +1434,7 @@ pub async fn start_tokenize_data_workflow(
}
Err(err) => {
logger::error!("Err: Deleting Card From Locker : {:?}", err);
- retry_delete_tokenize(db, &delete_tokenize_data.pm, tokenize_tracker.to_owned())
- .await?;
+ retry_delete_tokenize(db, delete_tokenize_data.pm, tokenize_tracker.to_owned()).await?;
metrics::RETRIED_DELETE_DATA_COUNT.add(&metrics::CONTEXT, 1, &[]);
}
}
@@ -1444,7 +1443,7 @@ pub async fn start_tokenize_data_workflow(
pub async fn get_delete_tokenize_schedule_time(
db: &dyn db::StorageInterface,
- pm: &enums::PaymentMethod,
+ pm: enums::PaymentMethod,
retry_count: i32,
) -> Option<time::PrimitiveDateTime> {
let redis_mapping = db::get_and_deserialize_key(
@@ -1467,7 +1466,7 @@ pub async fn get_delete_tokenize_schedule_time(
pub async fn retry_delete_tokenize(
db: &dyn db::StorageInterface,
- pm: &enums::PaymentMethod,
+ pm: enums::PaymentMethod,
pt: storage::ProcessTracker,
) -> Result<(), errors::ProcessTrackerError> {
let schedule_time = get_delete_tokenize_schedule_time(db, pm, pt.retry_count).await;
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index c088fa3fce..99b0a63540 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3281,8 +3281,8 @@ where
payment_data.set_surcharge_details(session_surcharge_details.as_ref().and_then(
|session_surcharge_details| {
session_surcharge_details.fetch_surcharge_details(
- &session_connector_data.payment_method_type.into(),
- &session_connector_data.payment_method_type,
+ session_connector_data.payment_method_type.into(),
+ session_connector_data.payment_method_type,
None,
)
},
@@ -3736,8 +3736,8 @@ where
fn is_payment_method_tokenization_enabled_for_connector(
state: &SessionState,
connector_name: &str,
- payment_method: &storage::enums::PaymentMethod,
- payment_method_type: &Option<storage::enums::PaymentMethodType>,
+ payment_method: storage::enums::PaymentMethod,
+ payment_method_type: Option<storage::enums::PaymentMethodType>,
apple_pay_flow: &Option<domain::ApplePayFlow>,
) -> RouterResult<bool> {
let connector_tokenization_filter = state.conf.tokenization.0.get(connector_name);
@@ -3747,7 +3747,7 @@ fn is_payment_method_tokenization_enabled_for_connector(
connector_filter
.payment_method
.clone()
- .contains(payment_method)
+ .contains(&payment_method)
&& is_payment_method_type_allowed_for_connector(
payment_method_type,
connector_filter.payment_method_type.clone(),
@@ -3762,7 +3762,7 @@ fn is_payment_method_tokenization_enabled_for_connector(
}
fn is_apple_pay_pre_decrypt_type_connector_tokenization(
- payment_method_type: &Option<storage::enums::PaymentMethodType>,
+ payment_method_type: Option<storage::enums::PaymentMethodType>,
apple_pay_flow: &Option<domain::ApplePayFlow>,
apple_pay_pre_decrypt_flow_filter: Option<ApplePayPreDecryptFlow>,
) -> bool {
@@ -3780,7 +3780,7 @@ fn is_apple_pay_pre_decrypt_type_connector_tokenization(
fn decide_apple_pay_flow(
state: &SessionState,
- payment_method_type: &Option<enums::PaymentMethodType>,
+ payment_method_type: Option<enums::PaymentMethodType>,
merchant_connector_account: Option<&helpers::MerchantConnectorAccountType>,
) -> Option<domain::ApplePayFlow> {
payment_method_type.and_then(|pmt| match pmt {
@@ -3872,10 +3872,10 @@ fn check_apple_pay_metadata(
}
fn is_payment_method_type_allowed_for_connector(
- current_pm_type: &Option<storage::enums::PaymentMethodType>,
+ current_pm_type: Option<storage::enums::PaymentMethodType>,
pm_type_filter: Option<PaymentMethodTypeTokenFilter>,
) -> bool {
- match (*current_pm_type).zip(pm_type_filter) {
+ match (current_pm_type).zip(pm_type_filter) {
Some((pm_type, type_filter)) => match type_filter {
PaymentMethodTypeTokenFilter::AllAccepted => true,
PaymentMethodTypeTokenFilter::EnableOnly(enabled) => enabled.contains(&pm_type),
@@ -3888,7 +3888,7 @@ fn is_payment_method_type_allowed_for_connector(
async fn decide_payment_method_tokenize_action(
state: &SessionState,
connector_name: &str,
- payment_method: &storage::enums::PaymentMethod,
+ payment_method: storage::enums::PaymentMethod,
pm_parent_token: Option<&str>,
is_connector_tokenization_enabled: bool,
apple_pay_flow: Option<domain::ApplePayFlow>,
@@ -4041,11 +4041,11 @@ where
TokenizationAction::SkipConnectorTokenization,
),
Some(connector) if is_operation_confirm(&operation) => {
- let payment_method = &payment_data
+ let payment_method = payment_data
.get_payment_attempt()
.payment_method
.get_required_value("payment_method")?;
- let payment_method_type = &payment_data.get_payment_attempt().payment_method_type;
+ let payment_method_type = payment_data.get_payment_attempt().payment_method_type;
let apple_pay_flow =
decide_apple_pay_flow(state, payment_method_type, Some(merchant_connector_account));
@@ -4072,7 +4072,7 @@ where
payment_data.get_token(),
is_connector_tokenization_enabled,
apple_pay_flow,
- *payment_method_type,
+ payment_method_type,
)
.await?;
@@ -6268,7 +6268,7 @@ pub async fn payment_external_authentication(
})?
}
helpers::validate_payment_status_against_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[storage_enums::IntentStatus::RequiresCustomerAction],
"authenticate",
)?;
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 265046f42d..71049a5624 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -162,7 +162,7 @@ fn is_dynamic_fields_required(
required_fields: &settings::RequiredFields,
payment_method: enums::PaymentMethod,
payment_method_type: enums::PaymentMethodType,
- connector: &types::Connector,
+ connector: types::Connector,
required_field_type: Vec<enums::FieldType>,
) -> bool {
required_fields
@@ -170,7 +170,7 @@ fn is_dynamic_fields_required(
.get(&payment_method)
.and_then(|pm_type| pm_type.0.get(&payment_method_type))
.and_then(|required_fields_for_connector| {
- required_fields_for_connector.fields.get(connector)
+ required_fields_for_connector.fields.get(&connector)
})
.map(|required_fields_final| {
required_fields_final
@@ -371,7 +371,7 @@ async fn create_applepay_session_token(
&state.conf.required_fields,
enums::PaymentMethod::Wallet,
enums::PaymentMethodType::ApplePay,
- &connector.connector_name,
+ connector.connector_name,
billing_variants,
)
.then_some(payment_types::ApplePayBillingContactFields(vec![
@@ -399,7 +399,7 @@ async fn create_applepay_session_token(
&state.conf.required_fields,
enums::PaymentMethod::Wallet,
enums::PaymentMethodType::ApplePay,
- &connector.connector_name,
+ connector.connector_name,
shipping_variants,
)
.then_some(payment_types::ApplePayShippingContactFields(vec![
@@ -839,7 +839,7 @@ fn create_gpay_session_token(
&state.conf.required_fields,
enums::PaymentMethod::Wallet,
enums::PaymentMethodType::GooglePay,
- &connector.connector_name,
+ connector.connector_name,
billing_variants,
)
} else {
@@ -901,7 +901,7 @@ fn create_gpay_session_token(
&state.conf.required_fields,
enums::PaymentMethod::Wallet,
enums::PaymentMethodType::GooglePay,
- &connector.connector_name,
+ connector.connector_name,
shipping_variants,
)
} else {
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 1be4f4eb7c..6d40593060 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1052,7 +1052,7 @@ pub fn validate_card_expiry(
}
pub fn infer_payment_type(
- amount: &api::Amount,
+ amount: api::Amount,
mandate_type: Option<&api::MandateTransactionType>,
) -> api_enums::PaymentType {
match mandate_type {
@@ -2833,7 +2833,7 @@ pub fn validate_payment_method_type_against_payment_method(
}
}
-pub fn check_force_psync_precondition(status: &storage_enums::AttemptStatus) -> bool {
+pub fn check_force_psync_precondition(status: storage_enums::AttemptStatus) -> bool {
!matches!(
status,
storage_enums::AttemptStatus::Charged
@@ -3257,11 +3257,11 @@ pub fn authenticate_client_secret(
}
pub(crate) fn validate_payment_status_against_allowed_statuses(
- intent_status: &storage_enums::IntentStatus,
+ intent_status: storage_enums::IntentStatus,
allowed_statuses: &[storage_enums::IntentStatus],
action: &'static str,
) -> Result<(), errors::ApiErrorResponse> {
- fp_utils::when(!allowed_statuses.contains(intent_status), || {
+ fp_utils::when(!allowed_statuses.contains(&intent_status), || {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: format!(
"You cannot {action} this payment because it has status {intent_status}",
@@ -3271,11 +3271,11 @@ pub(crate) fn validate_payment_status_against_allowed_statuses(
}
pub(crate) fn validate_payment_status_against_not_allowed_statuses(
- intent_status: &storage_enums::IntentStatus,
+ intent_status: storage_enums::IntentStatus,
not_allowed_statuses: &[storage_enums::IntentStatus],
action: &'static str,
) -> Result<(), errors::ApiErrorResponse> {
- fp_utils::when(not_allowed_statuses.contains(intent_status), || {
+ fp_utils::when(not_allowed_statuses.contains(&intent_status), || {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: format!(
"You cannot {action} this payment because it has status {intent_status}",
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 2bc18122b2..97832a0818 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -70,7 +70,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[IntentStatus::Failed, IntentStatus::Succeeded],
"approve",
)?;
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 8d7361cd25..ef6570abf8 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -68,7 +68,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
enums::IntentStatus::Failed,
enums::IntentStatus::Succeeded,
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 8c003f54ad..b296d6c305 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -76,7 +76,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
helpers::authenticate_client_secret(request.client_secret.as_ref(), &payment_intent)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Failed,
storage_enums::IntentStatus::Succeeded,
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 4b4091b1c3..5a73371c21 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -115,7 +115,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.contains(&header_payload.payment_confirm_source)
{
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Cancelled,
storage_enums::IntentStatus::Succeeded,
@@ -127,7 +127,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
)?;
} else {
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Cancelled,
storage_enums::IntentStatus::Succeeded,
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 23531d2342..c747c7d984 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -64,7 +64,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsCancelRequest> for P
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
enums::IntentStatus::Cancelled,
enums::IntentStatus::Failed,
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 1bc11854ad..ebc663aaf3 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -68,7 +68,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Failed,
storage_enums::IntentStatus::Succeeded,
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index cad5dcfbd6..edcb0282bd 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -66,7 +66,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Failed,
storage_enums::IntentStatus::Succeeded,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index a3a826ccd0..ab3a70aa1b 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -480,7 +480,7 @@ async fn get_tracker_for_sync<
payment_method_info,
force_sync: Some(
request.force_sync
- && (helpers::check_force_psync_precondition(&payment_attempt.status)
+ && (helpers::check_force_psync_precondition(payment_attempt.status)
|| contains_encoded_data),
),
payment_attempt,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 98491cab1d..61a52e7dfb 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -102,7 +102,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
)?;
helpers::validate_payment_status_against_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::RequiresPaymentMethod,
storage_enums::IntentStatus::RequiresConfirmation,
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index 1ddaf0b6ab..1b7acc796e 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -77,7 +77,7 @@ impl<F: Send + Clone>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[enums::IntentStatus::RequiresCapture],
"increment authorization",
)?;
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index c615e2eb17..712dff35c7 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -78,7 +78,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCalcu
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
+ payment_intent.status,
&[
storage_enums::IntentStatus::Failed,
storage_enums::IntentStatus::Succeeded,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index fe70c3b710..fb8962117c 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -751,7 +751,7 @@ where
let apple_pay_flow = payments::decide_apple_pay_flow(
state,
- &payment_data.payment_attempt.payment_method_type,
+ payment_data.payment_attempt.payment_method_type,
Some(merchant_connector_account),
);
diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs
index 223db5b9f9..61ebffe6b8 100644
--- a/crates/router/src/core/payout_link.rs
+++ b/crates/router/src/core/payout_link.rs
@@ -388,7 +388,7 @@ pub async fn filter_payout_methods(
let currency_country_filter = check_currency_country_filters(
payout_filter,
request_payout_method_type,
- &payout.destination_currency,
+ payout.destination_currency,
address
.as_ref()
.and_then(|address| address.country)
@@ -447,7 +447,7 @@ pub async fn filter_payout_methods(
pub fn check_currency_country_filters(
payout_method_filter: Option<&PaymentMethodFilters>,
request_payout_method_type: &api_models::payment_methods::RequestPaymentMethodTypes,
- currency: &common_enums::Currency,
+ currency: common_enums::Currency,
country: Option<&common_enums::CountryAlpha2>,
) -> errors::RouterResult<Option<bool>> {
if matches!(
@@ -476,7 +476,7 @@ pub fn check_currency_country_filters(
currency_country_filter
.currency
.as_ref()
- .map(|currency_hash_set| currency_hash_set.contains(currency))
+ .map(|currency_hash_set| currency_hash_set.contains(&currency))
});
Ok(currency_filter.or(country_filter))
}
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index d239638c0c..94946b7e0e 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -383,7 +383,7 @@ pub async fn payouts_confirm_core(
let status = payout_attempt.status;
helpers::validate_payout_status_against_not_allowed_statuses(
- &status,
+ status,
&[
storage_enums::PayoutStatus::Cancelled,
storage_enums::PayoutStatus::Success,
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 49b18e53a0..5becf01597 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -1010,11 +1010,11 @@ pub fn is_payout_initiated(status: api_enums::PayoutStatus) -> bool {
}
pub(crate) fn validate_payout_status_against_not_allowed_statuses(
- payout_status: &api_enums::PayoutStatus,
+ payout_status: api_enums::PayoutStatus,
not_allowed_statuses: &[api_enums::PayoutStatus],
action: &'static str,
) -> Result<(), errors::ApiErrorResponse> {
- fp_utils::when(not_allowed_statuses.contains(payout_status), || {
+ fp_utils::when(not_allowed_statuses.contains(&payout_status), || {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: format!(
"You cannot {action} this payout because it has status {payout_status}",
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index f7a8939639..cdd8b518f3 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -99,7 +99,7 @@ impl RoutingAlgorithmUpdate {
request: &routing_types::RoutingConfigRequest,
merchant_id: &common_utils::id_type::MerchantId,
profile_id: common_utils::id_type::ProfileId,
- transaction_type: &enums::TransactionType,
+ transaction_type: enums::TransactionType,
) -> Self {
let algorithm_id = common_utils::generate_routing_id_of_default_length();
let timestamp = common_utils::date_time::now();
@@ -113,7 +113,7 @@ impl RoutingAlgorithmUpdate {
algorithm_data: serde_json::json!(request.algorithm),
created_at: timestamp,
modified_at: timestamp,
- algorithm_for: transaction_type.to_owned(),
+ algorithm_for: transaction_type,
};
Self(algo)
}
@@ -170,7 +170,7 @@ pub async fn create_routing_algorithm_under_profile(
key_store: domain::MerchantKeyStore,
authentication_profile_id: Option<common_utils::id_type::ProfileId>,
request: routing_types::RoutingConfigRequest,
- transaction_type: &enums::TransactionType,
+ transaction_type: enums::TransactionType,
) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
metrics::ROUTING_CREATE_REQUEST_RECEIVED.add(&metrics::CONTEXT, 1, &[]);
let db = &*state.store;
@@ -240,7 +240,7 @@ pub async fn create_routing_algorithm_under_profile(
key_store: domain::MerchantKeyStore,
authentication_profile_id: Option<common_utils::id_type::ProfileId>,
request: routing_types::RoutingConfigRequest,
- transaction_type: &enums::TransactionType,
+ transaction_type: enums::TransactionType,
) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
metrics::ROUTING_CREATE_REQUEST_RECEIVED.add(&metrics::CONTEXT, 1, &[]);
let db = state.store.as_ref();
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 196db63ff1..6a5e3bd026 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -725,7 +725,7 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
)?;
let payment_status_attribute =
- get_desired_payment_status_for_success_routing_metrics(&payment_attempt.status);
+ get_desired_payment_status_for_success_routing_metrics(payment_attempt.status);
let first_success_based_connector_label = &success_based_connectors
.labels_with_score
@@ -746,7 +746,7 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
))?;
let outcome = get_success_based_metrics_outcome_for_payment(
- &payment_status_attribute,
+ payment_status_attribute,
payment_connector.to_string(),
first_success_based_connector.to_string(),
);
@@ -843,7 +843,7 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
fn get_desired_payment_status_for_success_routing_metrics(
- attempt_status: &common_enums::AttemptStatus,
+ attempt_status: common_enums::AttemptStatus,
) -> common_enums::AttemptStatus {
match attempt_status {
common_enums::AttemptStatus::Charged
@@ -879,7 +879,7 @@ fn get_desired_payment_status_for_success_routing_metrics(
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
fn get_success_based_metrics_outcome_for_payment(
- payment_status_attribute: &common_enums::AttemptStatus,
+ payment_status_attribute: common_enums::AttemptStatus,
payment_connector: String,
first_success_based_connector: String,
) -> common_enums::SuccessBasedRoutingConclusiveState {
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 4f77b21904..e4ac902f7b 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -2403,7 +2403,7 @@ pub async fn terminate_auth_select(
// Skip SSO if continue with password(TOTP)
if next_flow.get_flow() == domain::UserFlow::SPTFlow(domain::SPTFlow::SSO)
- && !utils::user::is_sso_auth_type(&user_authentication_method.auth_type)
+ && !utils::user::is_sso_auth_type(user_authentication_method.auth_type)
{
next_flow = next_flow.skip(user_from_db, &state).await?;
}
diff --git a/crates/router/src/core/user/dashboard_metadata.rs b/crates/router/src/core/user/dashboard_metadata.rs
index 32ad135a7d..a64b0f39dc 100644
--- a/crates/router/src/core/user/dashboard_metadata.rs
+++ b/crates/router/src/core/user/dashboard_metadata.rs
@@ -46,11 +46,11 @@ pub async fn get_multiple_metadata(
for key in metadata_keys {
let data = metadata.iter().find(|ele| ele.data_key == key);
let resp;
- if data.is_none() && utils::is_backfill_required(&key) {
+ if data.is_none() && utils::is_backfill_required(key) {
let backfill_data = backfill_metadata(&state, &user, &key).await?;
- resp = into_response(backfill_data.as_ref(), &key)?;
+ resp = into_response(backfill_data.as_ref(), key)?;
} else {
- resp = into_response(data, &key)?;
+ resp = into_response(data, key)?;
}
response.push(resp);
}
@@ -148,7 +148,7 @@ fn parse_get_request(data_enum: api::GetMetaDataRequest) -> DBEnum {
fn into_response(
data: Option<&DashboardMetadata>,
- data_type: &DBEnum,
+ data_type: DBEnum,
) -> UserResult<api::GetMetaDataResponse> {
match data_type {
DBEnum::ProductionAgreement => Ok(api::GetMetaDataResponse::ProductionAgreement(
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index cfd3662913..62f1425d4d 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -553,8 +553,8 @@ mod tests {
// Dispute Stage can move linearly from PreDispute -> Dispute -> PreArbitration
pub fn validate_dispute_stage(
- prev_dispute_stage: &DisputeStage,
- dispute_stage: &DisputeStage,
+ prev_dispute_stage: DisputeStage,
+ dispute_stage: DisputeStage,
) -> bool {
match prev_dispute_stage {
DisputeStage::PreDispute => true,
@@ -596,7 +596,7 @@ pub fn validate_dispute_stage_and_dispute_status(
dispute_stage: DisputeStage,
dispute_status: DisputeStatus,
) -> CustomResult<(), errors::WebhooksFlowError> {
- let dispute_stage_validation = validate_dispute_stage(&prev_dispute_stage, &dispute_stage);
+ let dispute_stage_validation = validate_dispute_stage(prev_dispute_stage, dispute_stage);
let dispute_status_validation = if dispute_stage == prev_dispute_stage {
validate_dispute_status(prev_dispute_status, dispute_status)
} else {
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index b1e1127787..be24084bcc 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -728,7 +728,7 @@ impl Routing {
.app_data(web::Data::new(state.clone()))
.service(
web::resource("").route(web::post().to(|state, req, payload| {
- routing::routing_create_config(state, req, payload, &TransactionType::Payment)
+ routing::routing_create_config(state, req, payload, TransactionType::Payment)
})),
)
.service(
@@ -770,7 +770,7 @@ impl Routing {
state,
req,
payload,
- &TransactionType::Payment,
+ TransactionType::Payment,
)
})),
)
@@ -850,7 +850,7 @@ impl Routing {
state,
req,
payload,
- &TransactionType::Payout,
+ TransactionType::Payout,
)
})),
)
diff --git a/crates/router/src/routes/metrics/bg_metrics_collector.rs b/crates/router/src/routes/metrics/bg_metrics_collector.rs
index 52d7777f5a..f3ba7076e5 100644
--- a/crates/router/src/routes/metrics/bg_metrics_collector.rs
+++ b/crates/router/src/routes/metrics/bg_metrics_collector.rs
@@ -2,7 +2,7 @@ use storage_impl::redis::cache;
const DEFAULT_BG_METRICS_COLLECTION_INTERVAL_IN_SECS: u16 = 15;
-pub fn spawn_metrics_collector(metrics_collection_interval_in_secs: &Option<u16>) {
+pub fn spawn_metrics_collector(metrics_collection_interval_in_secs: Option<u16>) {
let metrics_collection_interval = metrics_collection_interval_in_secs
.unwrap_or(DEFAULT_BG_METRICS_COLLECTION_INTERVAL_IN_SECS);
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index a9f0bc3a26..19b96a9dc8 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -21,7 +21,7 @@ pub async fn routing_create_config(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<routing_types::RoutingConfigRequest>,
- transaction_type: &enums::TransactionType,
+ transaction_type: enums::TransactionType,
) -> impl Responder {
let flow = Flow::RoutingCreateConfig;
Box::pin(oss_api::server_wrap(
@@ -62,7 +62,7 @@ pub async fn routing_create_config(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<routing_types::RoutingConfigRequest>,
- transaction_type: &enums::TransactionType,
+ transaction_type: enums::TransactionType,
) -> impl Responder {
let flow = Flow::RoutingCreateConfig;
Box::pin(oss_api::server_wrap(
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 58253684a2..f465719949 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -1680,7 +1680,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
Ok((
(),
@@ -1713,7 +1713,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
Ok((
UserFromToken {
@@ -1753,7 +1753,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -1816,7 +1816,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
// Check if token has access to Organization that has been requested in the route
if payload.org_id != self.organization_id {
@@ -1861,7 +1861,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let merchant_id_from_header = HeaderMapStruct::new(request_headers)
.get_id_type_from_header::<id_type::MerchantId>(headers::X_MERCHANT_ID)?;
@@ -1900,7 +1900,7 @@ where
&state.session_state().tenant.tenant_id,
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let merchant_id_from_header = HeaderMapStruct::new(request_headers)
.get_id_type_from_header::<id_type::MerchantId>(headers::X_MERCHANT_ID)?;
@@ -1970,7 +1970,7 @@ where
.get_required_value(headers::X_PROFILE_ID)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let merchant_id_from_header = HeaderMapStruct::new(request_headers)
.get_id_type_from_header::<id_type::MerchantId>(headers::X_MERCHANT_ID)?;
@@ -2047,7 +2047,7 @@ where
}
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let merchant_id_from_header = HeaderMapStruct::new(request_headers)
.get_id_type_from_header::<id_type::MerchantId>(headers::X_MERCHANT_ID)?;
@@ -2116,7 +2116,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
// Check if token has access to MerchantId that has been requested through query param
if payload.merchant_id != self.merchant_id {
@@ -2157,7 +2157,7 @@ where
}
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2221,7 +2221,7 @@ where
}
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2292,7 +2292,7 @@ where
}
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2366,7 +2366,7 @@ where
}
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2433,7 +2433,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2498,7 +2498,7 @@ where
.get_required_value(headers::X_PROFILE_ID)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.required_permission, &role_info)?;
+ authorization::check_permission(self.required_permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2598,7 +2598,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2662,7 +2662,7 @@ where
.get_id_type_from_header::<id_type::ProfileId>(headers::X_PROFILE_ID)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -2735,7 +2735,7 @@ where
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -3184,7 +3184,7 @@ where
&state.session_state().tenant.tenant_id,
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
let key_manager_state = &(&state.session_state()).into();
let key_store = state
@@ -3255,7 +3255,7 @@ where
&state.session_state().tenant.tenant_id,
)?;
let role_info = authorization::get_role_info(state, &payload).await?;
- authorization::check_permission(&self.permission, &role_info)?;
+ authorization::check_permission(self.permission, &role_info)?;
let user = UserFromToken {
user_id: payload.user_id.clone(),
diff --git a/crates/router/src/services/authorization.rs b/crates/router/src/services/authorization.rs
index 8f48ef068c..e0feaa5e81 100644
--- a/crates/router/src/services/authorization.rs
+++ b/crates/router/src/services/authorization.rs
@@ -100,7 +100,7 @@ where
}
pub fn check_permission(
- required_permission: &permissions::Permission,
+ required_permission: permissions::Permission,
role_info: &roles::RoleInfo,
) -> RouterResult<()> {
role_info
diff --git a/crates/router/src/services/authorization/permission_groups.rs b/crates/router/src/services/authorization/permission_groups.rs
index 7ca8442c1c..8c45210e4b 100644
--- a/crates/router/src/services/authorization/permission_groups.rs
+++ b/crates/router/src/services/authorization/permission_groups.rs
@@ -137,13 +137,13 @@ impl ParentGroupExt for ParentGroup {
.resources()
.iter()
.filter(|res| res.entities().iter().any(|entity| entity <= &entity_type))
- .map(|res| permissions::get_resource_name(res, &entity_type))
+ .map(|res| permissions::get_resource_name(*res, entity_type))
.collect::<Vec<_>>()
.join(", ");
Some((
parent,
- format!("{} {}", permissions::get_scope_name(&scopes), resources),
+ format!("{} {}", permissions::get_scope_name(scopes), resources),
))
})
.collect()
diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rs
index 6f61200742..b9872b371e 100644
--- a/crates/router/src/services/authorization/permissions.rs
+++ b/crates/router/src/services/authorization/permissions.rs
@@ -98,7 +98,7 @@ generate_permissions! {
]
}
-pub fn get_resource_name(resource: &Resource, entity_type: &EntityType) -> &'static str {
+pub fn get_resource_name(resource: Resource, entity_type: EntityType) -> &'static str {
match (resource, entity_type) {
(Resource::Payment, _) => "Payments",
(Resource::Refund, _) => "Refunds",
@@ -128,7 +128,7 @@ pub fn get_resource_name(resource: &Resource, entity_type: &EntityType) -> &'sta
}
}
-pub fn get_scope_name(scope: &PermissionScope) -> &'static str {
+pub fn get_scope_name(scope: PermissionScope) -> &'static str {
match scope {
PermissionScope::Read => "View",
PermissionScope::Write => "View and Manage",
diff --git a/crates/router/src/services/authorization/roles.rs b/crates/router/src/services/authorization/roles.rs
index f6c4f4b9ef..a6c5cee1c4 100644
--- a/crates/router/src/services/authorization/roles.rs
+++ b/crates/router/src/services/authorization/roles.rs
@@ -76,7 +76,7 @@ impl RoleInfo {
.collect()
}
- pub fn check_permission_exists(&self, required_permission: &Permission) -> bool {
+ pub fn check_permission_exists(&self, required_permission: Permission) -> bool {
required_permission.entity_type() <= self.entity_type
&& self.get_permission_groups().iter().any(|group| {
required_permission.scope() <= group.scope()
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 975b219a26..763d408d17 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -248,15 +248,15 @@ pub enum SessionSurchargeDetails {
impl SessionSurchargeDetails {
pub fn fetch_surcharge_details(
&self,
- payment_method: &enums::PaymentMethod,
- payment_method_type: &enums::PaymentMethodType,
+ payment_method: enums::PaymentMethod,
+ payment_method_type: enums::PaymentMethodType,
card_network: Option<&enums::CardNetwork>,
) -> Option<payments_types::SurchargeDetails> {
match self {
Self::Calculated(surcharge_metadata) => surcharge_metadata
.get_surcharge_details(payments_types::SurchargeKey::PaymentMethodData(
- *payment_method,
- *payment_method_type,
+ payment_method,
+ payment_method_type,
card_network.cloned(),
))
.cloned(),
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index 281b95255c..e2c2514180 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -273,7 +273,7 @@ pub fn get_oidc_sso_redirect_url(state: &SessionState, provider: &str) -> String
format!("{}/redirect/oidc/{}", state.conf.user.base_url, provider)
}
-pub fn is_sso_auth_type(auth_type: &UserAuthType) -> bool {
+pub fn is_sso_auth_type(auth_type: UserAuthType) -> bool {
match auth_type {
UserAuthType::OpenIdConnect => true,
UserAuthType::Password | UserAuthType::MagicLink => false,
diff --git a/crates/router/src/utils/user/dashboard_metadata.rs b/crates/router/src/utils/user/dashboard_metadata.rs
index 3abdfdd3ab..39a76844be 100644
--- a/crates/router/src/utils/user/dashboard_metadata.rs
+++ b/crates/router/src/utils/user/dashboard_metadata.rs
@@ -233,7 +233,7 @@ pub fn is_update_required(metadata: &UserResult<DashboardMetadata>) -> bool {
}
}
-pub fn is_backfill_required(metadata_key: &DBEnum) -> bool {
+pub fn is_backfill_required(metadata_key: DBEnum) -> bool {
matches!(
metadata_key,
DBEnum::StripeConnected | DBEnum::PaypalConnected
diff --git a/crates/router/tests/connectors/payeezy.rs b/crates/router/tests/connectors/payeezy.rs
index 49f7085bda..a91f5b0fed 100644
--- a/crates/router/tests/connectors/payeezy.rs
+++ b/crates/router/tests/connectors/payeezy.rs
@@ -71,7 +71,7 @@ impl PayeezyTest {
..Default::default()
})
}
- fn get_request_interval(&self) -> u64 {
+ fn get_request_interval(self) -> u64 {
20
}
}
diff --git a/crates/router_derive/src/macros/to_encryptable.rs b/crates/router_derive/src/macros/to_encryptable.rs
index 561c3a7237..60895c50a8 100644
--- a/crates/router_derive/src/macros/to_encryptable.rs
+++ b/crates/router_derive/src/macros/to_encryptable.rs
@@ -124,7 +124,7 @@ enum StructType {
impl StructType {
/// Generates the fields for temporary structs which consists of the fields that should be
/// encrypted/decrypted
- fn generate_struct_fields(&self, fields: &[(Field, Ident)]) -> Vec<proc_macro2::TokenStream> {
+ fn generate_struct_fields(self, fields: &[(Field, Ident)]) -> Vec<proc_macro2::TokenStream> {
fields
.iter()
.map(|(field, inner_ty)| {
@@ -162,7 +162,7 @@ impl StructType {
/// Generates the ToEncryptable trait implementation
fn generate_impls(
- &self,
+ self,
gen1: proc_macro2::TokenStream,
gen2: proc_macro2::TokenStream,
gen3: proc_macro2::TokenStream,
@@ -177,7 +177,7 @@ impl StructType {
let field_ident = &field.ident;
let field_ident_string = field_ident.as_ref().map(|s| s.to_string());
- if is_option || *self == Self::Updated {
+ if is_option || self == Self::Updated {
quote! { self.#field_ident.map(|s| map.insert(#field_ident_string.to_string(), s)) }
} else {
quote! { map.insert(#field_ident_string.to_string(), self.#field_ident) }
@@ -191,7 +191,7 @@ impl StructType {
let field_ident = &field.ident;
let field_ident_string = field_ident.as_ref().map(|s| s.to_string());
- if is_option || *self == Self::Updated {
+ if is_option || self == Self::Updated {
quote! { #field_ident: map.remove(#field_ident_string) }
} else {
quote! {
diff --git a/crates/router_env/src/logger/config.rs b/crates/router_env/src/logger/config.rs
index 746c8ee958..431fb5a636 100644
--- a/crates/router_env/src/logger/config.rs
+++ b/crates/router_env/src/logger/config.rs
@@ -47,7 +47,7 @@ pub struct Level(pub(super) tracing::Level);
impl Level {
/// Returns the most verbose [`tracing::Level`]
- pub fn into_level(&self) -> tracing::Level {
+ pub fn into_level(self) -> tracing::Level {
self.0
}
}
diff --git a/crates/router_env/src/logger/formatter.rs b/crates/router_env/src/logger/formatter.rs
index 5c3341026c..bbcf1e2306 100644
--- a/crates/router_env/src/logger/formatter.rs
+++ b/crates/router_env/src/logger/formatter.rs
@@ -330,7 +330,7 @@ where
/// Serialize event into a buffer of bytes using parent span.
pub fn event_serialize<S>(
&self,
- span: &Option<&SpanRef<'_, S>>,
+ span: Option<&SpanRef<'_, S>>,
event: &Event<'_>,
) -> std::io::Result<Vec<u8>>
where
@@ -347,7 +347,7 @@ where
let name = span.map_or("?", SpanRef::name);
Self::event_message(span, event, &mut storage);
- self.common_serialize(&mut map_serializer, event.metadata(), *span, &storage, name)?;
+ self.common_serialize(&mut map_serializer, event.metadata(), span, &storage, name)?;
map_serializer.end()?;
Ok(buffer)
@@ -366,11 +366,8 @@ where
/// Format message of an event.
///
/// Examples: "[FN_WITHOUT_COLON - EVENT] Message"
- fn event_message<S>(
- span: &Option<&SpanRef<'_, S>>,
- event: &Event<'_>,
- storage: &mut Storage<'_>,
- ) where
+ fn event_message<S>(span: Option<&SpanRef<'_, S>>, event: &Event<'_>, storage: &mut Storage<'_>)
+ where
S: Subscriber + for<'a> LookupSpan<'a>,
{
// Get value of kept "message" or "target" if does not exist.
@@ -397,7 +394,7 @@ where
// Event could have no span.
let span = ctx.lookup_current();
- let result: std::io::Result<Vec<u8>> = self.event_serialize(&span.as_ref(), event);
+ let result: std::io::Result<Vec<u8>> = self.event_serialize(span.as_ref(), event);
if let Ok(formatted) = result {
let _ = self.flush(formatted);
}
diff --git a/crates/scheduler/src/utils.rs b/crates/scheduler/src/utils.rs
index 8c2424d501..e4b636ac5f 100644
--- a/crates/scheduler/src/utils.rs
+++ b/crates/scheduler/src/utils.rs
@@ -321,10 +321,10 @@ pub fn get_schedule_time(
pub fn get_pm_schedule_time(
mapping: process_data::PaymentMethodsPTMapping,
- pm: &enums::PaymentMethod,
+ pm: enums::PaymentMethod,
retry_count: i32,
) -> Option<i32> {
- let mapping = match mapping.custom_pm_mapping.get(pm) {
+ let mapping = match mapping.custom_pm_mapping.get(&pm) {
Some(map) => map.clone(),
None => mapping.default_mapping,
};
diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs
index 5954f4791a..9b306ec8b0 100644
--- a/crates/storage_impl/src/lib.rs
+++ b/crates/storage_impl/src/lib.rs
@@ -280,7 +280,7 @@ pub trait DataModelExt {
}
pub(crate) fn diesel_error_to_data_error(
- diesel_error: &diesel_models::errors::DatabaseError,
+ diesel_error: diesel_models::errors::DatabaseError,
) -> StorageError {
match diesel_error {
diesel_models::errors::DatabaseError::DatabaseConnectionError => {
@@ -293,7 +293,7 @@ pub(crate) fn diesel_error_to_data_error(
entity: "entity ",
key: None,
},
- _ => StorageError::DatabaseError(error_stack::report!(*diesel_error)),
+ _ => StorageError::DatabaseError(error_stack::report!(diesel_error)),
}
}
diff --git a/crates/storage_impl/src/lookup.rs b/crates/storage_impl/src/lookup.rs
index eec85e267b..2f8a743a81 100644
--- a/crates/storage_impl/src/lookup.rs
+++ b/crates/storage_impl/src/lookup.rs
@@ -44,7 +44,7 @@ impl<T: DatabaseStore> ReverseLookupInterface for RouterStore<T> {
.await
.change_context(errors::StorageError::DatabaseConnectionError)?;
new.insert(&conn).await.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
@@ -58,7 +58,7 @@ impl<T: DatabaseStore> ReverseLookupInterface for RouterStore<T> {
DieselReverseLookup::find_by_lookup_id(id, &conn)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 4eedfd5005..06c7fefe85 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -60,7 +60,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.insert(&conn)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -83,7 +83,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.insert(&conn)
.await
.map_err(|error| {
- let new_error = diesel_error_to_data_error(error.current_context());
+ let new_error = diesel_error_to_data_error(*error.current_context());
error.change_context(new_error)
})?
.convert(
@@ -108,7 +108,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.update_with_attempt_id(&conn, payment_attempt.to_storage_model())
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -135,7 +135,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|error| {
- let new_error = diesel_error_to_data_error(error.current_context());
+ let new_error = diesel_error_to_data_error(*error.current_context());
error.change_context(new_error)
})?
.convert(
@@ -165,7 +165,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -187,7 +187,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -209,7 +209,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -231,7 +231,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -255,7 +255,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?
.convert(
@@ -286,7 +286,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -313,7 +313,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
DieselPaymentAttempt::get_filters_for_payments(&conn, intents.as_slice(), merchant_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(
@@ -352,7 +352,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -370,7 +370,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
DieselPaymentAttempt::find_by_merchant_id_payment_id(&conn, merchant_id, payment_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(|a| {
@@ -393,7 +393,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
DieselPaymentAttempt::find_by_merchant_id_attempt_id(&conn, merchant_id, attempt_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PaymentAttempt::from_storage_model)
@@ -413,7 +413,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
DieselPaymentAttempt::find_by_id(&conn, attempt_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?
.convert(
@@ -464,7 +464,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 15f1aa2437..ebf75a58b2 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -297,7 +297,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
DieselPaymentIntent::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
};
@@ -358,7 +358,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
let diesel_payment_intent = DieselPaymentIntent::find_by_global_id(&conn, id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
@@ -481,7 +481,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.insert(&conn)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
@@ -515,7 +515,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.update(&conn, diesel_payment_intent_update)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
@@ -550,7 +550,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.update(&conn, diesel_payment_intent_update)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
@@ -579,7 +579,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
DieselPaymentIntent::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.async_and_then(|diesel_payment_intent| async {
@@ -608,7 +608,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
let diesel_payment_intent = DieselPaymentIntent::find_by_global_id(&conn, id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
diff --git a/crates/storage_impl/src/payouts/payout_attempt.rs b/crates/storage_impl/src/payouts/payout_attempt.rs
index 3ac66a2c30..caefa4eeda 100644
--- a/crates/storage_impl/src/payouts/payout_attempt.rs
+++ b/crates/storage_impl/src/payouts/payout_attempt.rs
@@ -395,7 +395,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
.insert(&conn)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PayoutAttempt::from_storage_model)
@@ -415,7 +415,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
.update_with_attempt_id(&conn, payout.to_storage_model())
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PayoutAttempt::from_storage_model)
@@ -437,7 +437,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
.await
.map(PayoutAttempt::from_storage_model)
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
@@ -458,7 +458,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
.await
.map(PayoutAttempt::from_storage_model)
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
@@ -479,7 +479,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
DieselPayoutAttempt::get_filters_for_payouts(&conn, payouts.as_slice(), merchant_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(
diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs
index 2f6540732f..0c69b2f241 100644
--- a/crates/storage_impl/src/payouts/payouts.rs
+++ b/crates/storage_impl/src/payouts/payouts.rs
@@ -235,7 +235,7 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
DieselPayouts::find_by_merchant_id_payout_id(&conn, merchant_id, payout_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
};
@@ -283,7 +283,7 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
DieselPayouts::find_optional_by_merchant_id_payout_id(&conn, merchant_id, payout_id)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
};
@@ -423,7 +423,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
.insert(&conn)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(Payouts::from_storage_model)
@@ -443,7 +443,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
.update(&conn, payout.to_storage_model())
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(Payouts::from_storage_model)
@@ -461,7 +461,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
.await
.map(Payouts::from_storage_model)
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
@@ -478,7 +478,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
.await
.map(|x| x.map(Payouts::from_storage_model))
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
@@ -814,7 +814,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
)
.await
.map_err(|er| {
- let new_err = diesel_error_to_data_error(er.current_context());
+ let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}