feat(payments): add amount and connector id filter in list (#4354)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Apoorv Dixit
2024-04-18 19:14:35 +05:30
committed by GitHub
parent 4feda8f890
commit 53e5307c3c
11 changed files with 95 additions and 30 deletions

View File

@ -99,6 +99,7 @@ pub trait PaymentAttemptInterface {
payment_method: Option<Vec<storage_enums::PaymentMethod>>,
payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<String>>,
storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<i64, errors::StorageError>;
}

View File

@ -430,12 +430,14 @@ pub struct PaymentIntentListParams {
pub offset: u32,
pub starting_at: Option<PrimitiveDateTime>,
pub ending_at: Option<PrimitiveDateTime>,
pub amount_filter: Option<api_models::payments::AmountFilter>,
pub connector: Option<Vec<api_models::enums::Connector>>,
pub currency: Option<Vec<storage_enums::Currency>>,
pub status: Option<Vec<storage_enums::IntentStatus>>,
pub payment_method: Option<Vec<storage_enums::PaymentMethod>>,
pub payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
pub authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
pub merchant_connector_id: Option<Vec<String>>,
pub profile_id: Option<String>,
pub customer_id: Option<String>,
pub starting_after_id: Option<String>,
@ -449,12 +451,14 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCo
offset: 0,
starting_at: value.created_gte.or(value.created_gt).or(value.created),
ending_at: value.created_lte.or(value.created_lt).or(value.created),
amount_filter: None,
connector: None,
currency: None,
status: None,
payment_method: None,
payment_method_type: None,
authentication_type: None,
merchant_connector_id: None,
profile_id: None,
customer_id: value.customer_id,
starting_after_id: value.starting_after,
@ -470,12 +474,14 @@ impl From<api_models::payments::TimeRange> for PaymentIntentFetchConstraints {
offset: 0,
starting_at: Some(value.start_time),
ending_at: value.end_time,
amount_filter: None,
connector: None,
currency: None,
status: None,
payment_method: None,
payment_method_type: None,
authentication_type: None,
merchant_connector_id: None,
profile_id: None,
customer_id: None,
starting_after_id: None,
@ -494,12 +500,14 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
offset: value.offset.unwrap_or_default(),
starting_at: value.time_range.map(|t| t.start_time),
ending_at: value.time_range.and_then(|t| t.end_time),
amount_filter: value.amount_filter,
connector: value.connector,
currency: value.currency,
status: value.status,
payment_method: value.payment_method,
payment_method_type: value.payment_method_type,
authentication_type: value.authentication_type,
merchant_connector_id: value.merchant_connector_id,
profile_id: value.profile_id,
customer_id: value.customer_id,
starting_after_id: None,