feat(router): Add payments get-intent API for v2 (#6396)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Anurag Thakur
2024-10-30 21:26:23 +05:30
committed by GitHub
parent 33bc83fce4
commit c514608594
18 changed files with 571 additions and 196 deletions

View File

@ -2,7 +2,8 @@ use common_utils::events::{ApiEventMetric, ApiEventsType};
#[cfg(feature = "v2")]
use super::{
PaymentsConfirmIntentResponse, PaymentsCreateIntentRequest, PaymentsCreateIntentResponse,
PaymentsConfirmIntentResponse, PaymentsCreateIntentRequest, PaymentsGetIntentRequest,
PaymentsIntentResponse,
};
#[cfg(all(
any(feature = "v2", feature = "v1"),
@ -150,7 +151,16 @@ impl ApiEventMetric for PaymentsCreateIntentRequest {
}
#[cfg(feature = "v2")]
impl ApiEventMetric for PaymentsCreateIntentResponse {
impl ApiEventMetric for PaymentsGetIntentRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for PaymentsIntentResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.id.clone(),

View File

@ -287,10 +287,17 @@ impl PaymentsCreateIntentRequest {
}
}
// This struct is only used internally, not visible in API Reference
#[derive(Debug, Clone, serde::Serialize)]
#[cfg(feature = "v2")]
pub struct PaymentsGetIntentRequest {
pub id: id_type::GlobalPaymentId,
}
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
#[serde(deny_unknown_fields)]
#[cfg(feature = "v2")]
pub struct PaymentsCreateIntentResponse {
pub struct PaymentsIntentResponse {
/// Global Payment Id for the payment
#[schema(value_type = String)]
pub id: id_type::GlobalPaymentId,