fix(router): correct limit for payments list by filters (#2060)

This commit is contained in:
Apoorv Dixit
2023-09-01 15:04:18 +05:30
committed by GitHub
parent 8b22f38dd6
commit b7d6d31504
5 changed files with 36 additions and 18 deletions

View File

@ -1,10 +1,12 @@
use common_enums as storage_enums;
use common_utils::pii;
use common_utils::{
consts::{PAYMENTS_LIST_MAX_LIMIT_V1, PAYMENTS_LIST_MAX_LIMIT_V2},
pii,
};
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use crate::{errors, MerchantStorageScheme};
const MAX_LIMIT: u32 = 100;
#[async_trait::async_trait]
pub trait PaymentIntentInterface {
async fn update_payment_intent(
@ -388,7 +390,7 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCo
customer_id: value.customer_id,
starting_after_id: value.starting_after,
ending_before_id: value.ending_before,
limit: Some(std::cmp::min(value.limit, MAX_LIMIT)),
limit: Some(std::cmp::min(value.limit, PAYMENTS_LIST_MAX_LIMIT_V1)),
}
}
}
@ -427,7 +429,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
customer_id: None,
starting_after_id: None,
ending_before_id: None,
limit: value.limit,
limit: Some(std::cmp::min(value.limit, PAYMENTS_LIST_MAX_LIMIT_V2)),
}
}
}