feat(router): Add v2 endpoint to list payment attempts by intent_id (#8368)

Co-authored-by: Aniket Burman <aniket.burman@Aniket-Burman-JDXHW2PH34.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Aniket Burman
2025-06-20 11:55:06 +05:30
committed by GitHub
parent 23c1df1b13
commit 7943fb4bfb
15 changed files with 719 additions and 12 deletions

View File

@ -2,8 +2,8 @@ use common_utils::events::{ApiEventMetric, ApiEventsType};
#[cfg(feature = "v2")]
use super::{
PaymentStartRedirectionRequest, PaymentsCreateIntentRequest, PaymentsGetIntentRequest,
PaymentsIntentResponse, PaymentsRequest,
PaymentAttemptListRequest, PaymentAttemptListResponse, PaymentStartRedirectionRequest,
PaymentsCreateIntentRequest, PaymentsGetIntentRequest, PaymentsIntentResponse, PaymentsRequest,
};
#[cfg(feature = "v2")]
use crate::payment_methods::PaymentMethodListResponseForSession;
@ -185,6 +185,22 @@ impl ApiEventMetric for PaymentsGetIntentRequest {
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for PaymentAttemptListRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.payment_intent_id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for PaymentAttemptListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
None
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for PaymentsIntentResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {

View File

@ -290,7 +290,18 @@ pub struct MerchantConnectorDetails {
}"#)]
pub merchant_connector_creds: pii::SecretSerdeValue,
}
#[cfg(feature = "v2")]
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
pub struct PaymentAttemptListRequest {
#[schema(value_type = String)]
pub payment_intent_id: id_type::GlobalPaymentId,
}
#[cfg(feature = "v2")]
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
pub struct PaymentAttemptListResponse {
pub payment_attempt_list: Vec<PaymentAttemptResponse>,
}
#[cfg(feature = "v2")]
impl PaymentsCreateIntentRequest {
pub fn get_feature_metadata_as_value(