mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
refactor(payment_id): add payment id domain type (#5738)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -35,7 +35,7 @@ where
|
||||
match query_param.query_param {
|
||||
QueryType::Payment { payment_id } => {
|
||||
query_builder
|
||||
.add_filter_clause("payment_id", payment_id)
|
||||
.add_filter_clause("payment_id", &payment_id)
|
||||
.switch()?;
|
||||
query_builder
|
||||
.add_filter_in_range_clause(
|
||||
@ -62,7 +62,7 @@ where
|
||||
refund_id,
|
||||
} => {
|
||||
query_builder
|
||||
.add_filter_clause("payment_id", payment_id)
|
||||
.add_filter_clause("payment_id", &payment_id)
|
||||
.switch()?;
|
||||
query_builder
|
||||
.add_filter_clause("refund_id", refund_id)
|
||||
@ -76,7 +76,7 @@ where
|
||||
dispute_id,
|
||||
} => {
|
||||
query_builder
|
||||
.add_filter_clause("payment_id", payment_id)
|
||||
.add_filter_clause("payment_id", &payment_id)
|
||||
.switch()?;
|
||||
query_builder
|
||||
.add_filter_clause("dispute_id", dispute_id)
|
||||
@ -103,7 +103,7 @@ where
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ApiLogsResult {
|
||||
pub merchant_id: common_utils::id_type::MerchantId,
|
||||
pub payment_id: Option<String>,
|
||||
pub payment_id: Option<common_utils::id_type::PaymentId>,
|
||||
pub refund_id: Option<String>,
|
||||
pub payment_method_id: Option<String>,
|
||||
pub payment_method: Option<String>,
|
||||
|
||||
@ -31,7 +31,7 @@ where
|
||||
.switch()?;
|
||||
|
||||
query_builder
|
||||
.add_filter_clause("payment_id", query_param.payment_id)
|
||||
.add_filter_clause("payment_id", &query_param.payment_id)
|
||||
.switch()?;
|
||||
|
||||
if let Some(refund_id) = query_param.refund_id {
|
||||
|
||||
@ -30,7 +30,7 @@ where
|
||||
.add_filter_clause("merchant_id", merchant_id)
|
||||
.switch()?;
|
||||
query_builder
|
||||
.add_filter_clause("payment_id", query_param.payment_id)
|
||||
.add_filter_clause("payment_id", &query_param.payment_id)
|
||||
.switch()?;
|
||||
|
||||
if let Some(event_id) = query_param.event_id {
|
||||
@ -76,7 +76,7 @@ pub struct OutgoingWebhookLogsResult {
|
||||
pub event_id: String,
|
||||
pub event_type: String,
|
||||
pub outgoing_webhook_event_type: String,
|
||||
pub payment_id: String,
|
||||
pub payment_id: common_utils::id_type::PaymentId,
|
||||
pub refund_id: Option<String>,
|
||||
pub attempt_id: Option<String>,
|
||||
pub dispute_id: Option<String>,
|
||||
|
||||
@ -360,6 +360,12 @@ impl<T: AnalyticsDataSource> ToSql<T> for &common_utils::id_type::MerchantId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AnalyticsDataSource> ToSql<T> for &common_utils::id_type::PaymentId {
|
||||
fn to_sql(&self, _table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> {
|
||||
Ok(self.get_string_repr().to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
/// Implement `ToSql` on arrays of types that impl `ToString`.
|
||||
macro_rules! impl_to_sql_for_to_string {
|
||||
($($type:ty),+) => {
|
||||
|
||||
@ -37,7 +37,7 @@ where
|
||||
.add_filter_clause("merchant_id", publishable_key)
|
||||
.switch()?;
|
||||
query_builder
|
||||
.add_filter_clause("payment_id", request.payment_id)
|
||||
.add_filter_clause("payment_id", &request.payment_id)
|
||||
.switch()?;
|
||||
query_builder
|
||||
.add_custom_filter_clause("event_name", static_event_list, FilterTypes::In)
|
||||
@ -58,7 +58,7 @@ where
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SdkEventsResult {
|
||||
pub merchant_id: common_utils::id_type::MerchantId,
|
||||
pub payment_id: String,
|
||||
pub payment_id: common_utils::id_type::PaymentId,
|
||||
pub event_name: Option<String>,
|
||||
pub log_type: Option<String>,
|
||||
pub first_event: bool,
|
||||
|
||||
Reference in New Issue
Block a user