feat(payments): get new filters for payments list (#4174)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sampras Lopes <lsampras@pm.me>
This commit is contained in:
Apoorv Dixit
2024-04-16 15:31:28 +05:30
committed by GitHub
parent 1b7cde2d1b
commit c3361ef5eb
10 changed files with 158 additions and 9 deletions

View File

@ -518,6 +518,12 @@ pub struct MerchantConnectorWebhookDetails {
pub additional_secret: Option<Secret<String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct MerchantConnectorInfo {
pub connector_label: String,
pub merchant_connector_id: String,
}
/// Response of creating a new Merchant Connector for the merchant account."
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]

View File

@ -9,8 +9,8 @@ use crate::{
},
payments::{
PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters,
PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelRequest,
PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest,
PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
PaymentsRejectRequest, PaymentsRequest, PaymentsResponse, PaymentsRetrieveRequest,
PaymentsStartRequest, RedirectionResponse,
@ -158,6 +158,11 @@ impl ApiEventMetric for PaymentListFilters {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for PaymentListFiltersV2 {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for PaymentListConstraints {
fn get_api_event_type(&self) -> Option<ApiEventsType> {

View File

@ -1,4 +1,8 @@
use std::{collections::HashMap, fmt, num::NonZeroI64};
use std::{
collections::{HashMap, HashSet},
fmt,
num::NonZeroI64,
};
use cards::CardNumber;
use common_utils::{
@ -19,8 +23,11 @@ use url::Url;
use utoipa::ToSchema;
use crate::{
admin, disputes, enums as api_enums, ephemeral_key::EphemeralKeyCreateResponse,
mandates::RecurringDetails, refunds,
admin::{self, MerchantConnectorInfo},
disputes, enums as api_enums,
ephemeral_key::EphemeralKeyCreateResponse,
mandates::RecurringDetails,
refunds,
};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
@ -3419,6 +3426,20 @@ pub struct PaymentListFilters {
pub authentication_type: Vec<enums::AuthenticationType>,
}
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListFiltersV2 {
/// The list of available connector filters
pub connector: HashMap<String, Vec<MerchantConnectorInfo>>,
/// The list of available currency filters
pub currency: Vec<enums::Currency>,
/// The list of available payment status filters
pub status: Vec<enums::IntentStatus>,
/// The list payment method and their corresponding types
pub payment_method: HashMap<enums::PaymentMethod, HashSet<enums::PaymentMethodType>>,
/// The list of available authentication types
pub authentication_type: Vec<enums::AuthenticationType>,
}
#[derive(
Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
)]