Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuthaDev committed Feb 10, 2025
1 parent fe4849a commit ddae0e8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
27 changes: 18 additions & 9 deletions crates/api_models/src/events/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use super::{
not(feature = "payment_methods_v2")
))]
use crate::payment_methods::CustomerPaymentMethodsListResponse;
use crate::payments::{PaymentListResponse, PaymentListResponseV2};
#[cfg(feature = "v1")]
use crate::payments::PaymentListConstraints;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use crate::{events, payment_methods::CustomerPaymentMethodsListResponse};
use crate::{
Expand All @@ -23,14 +24,15 @@ use crate::{
},
payments::{
self, ExtendedCardInfoResponse, PaymentIdType, PaymentListFilterConstraints,
PaymentListFilters, PaymentListFiltersV2, PaymentsAggregateResponse,
PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
PaymentsManualUpdateRequest, PaymentsManualUpdateResponse,
PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest,
PaymentsResponse, PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
PaymentListFilters, PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2,
PaymentsAggregateResponse, PaymentsApproveRequest, PaymentsCancelRequest,
PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse,
PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest,
PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest,
PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsResponse,
PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
RedirectionResponse,
},
};
Expand Down Expand Up @@ -365,6 +367,13 @@ impl ApiEventMetric for PaymentListFiltersV2 {
}
}

#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentListConstraints {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}

#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Expand Down
22 changes: 22 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5559,6 +5559,16 @@ pub struct PaymentListConstraints {
pub created_gte: Option<PrimitiveDateTime>,
}

#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct PaymentListResponse {
/// The number of payments included in the list
pub size: usize,
// The list of payments response objects
pub data: Vec<PaymentsResponse>,
}

#[cfg(feature = "v2")]
#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct PaymentListResponse {
/// The number of payments included in the list
Expand All @@ -5585,6 +5595,18 @@ pub struct IncrementalAuthorizationResponse {
pub previously_authorized_amount: MinorUnit,
}

#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListResponseV2 {
/// The number of payments included in the list for given constraints
pub count: usize,
/// The total number of available payments for given constraints
pub total_count: i64,
/// The list of payments response objects
pub data: Vec<PaymentsResponse>,
}

#[cfg(feature = "v2")]
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListResponseV2 {
/// The number of payments included in the list for given constraints
Expand Down
3 changes: 1 addition & 2 deletions crates/router/src/core/routing/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
//!
//! Functions that are used to perform the retrieval of merchant's
//! routing dict, configs, defaults
use std::fmt::Debug;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use std::str::FromStr;
use std::sync::Arc;
use std::{fmt::Debug, sync::Arc};

use api_models::routing as routing_types;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
Expand Down
1 change: 0 additions & 1 deletion crates/storage_impl/src/payments/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,5 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
)
.into()
})
// .map(|vec| vec.into_iter().filter_map(|opt| opt).collect())
}
}

0 comments on commit ddae0e8

Please sign in to comment.