feat(router): add total count for payments list (#1912)

This commit is contained in:
Apoorv Dixit
2023-08-29 16:48:35 +05:30
committed by GitHub
parent 784702d9c5
commit 7a5c8413cf
10 changed files with 292 additions and 16 deletions

View File

@ -4,7 +4,6 @@ use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use crate::{errors, MerchantStorageScheme};
const QUERY_LIMIT: u32 = 20;
const MAX_LIMIT: u32 = 100;
#[async_trait::async_trait]
pub trait PaymentIntentInterface {
@ -54,6 +53,14 @@ pub trait PaymentIntentInterface {
Vec<(PaymentIntent, super::payment_attempt::PaymentAttempt)>,
errors::StorageError,
>;
#[cfg(feature = "olap")]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
merchant_id: &str,
constraints: &PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, errors::StorageError>;
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
@ -420,7 +427,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
customer_id: None,
starting_after_id: None,
ending_before_id: None,
limit: Some(QUERY_LIMIT),
limit: value.limit,
}
}
}