mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
feat(router): add payments create-intent flow for v2 (#6193)
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9576ee37a6
commit
afa803e0f9
@ -1,5 +1,9 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
use super::PaymentsCreateIntentRequest;
|
||||
#[cfg(feature = "v2")]
|
||||
use super::PaymentsCreateIntentResponse;
|
||||
#[cfg(all(
|
||||
any(feature = "v2", feature = "v1"),
|
||||
not(feature = "payment_methods_v2")
|
||||
@ -29,6 +33,8 @@ use crate::{
|
||||
PaymentsStartRequest, RedirectionResponse,
|
||||
},
|
||||
};
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsRetrieveRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
match self.resource_id {
|
||||
@ -40,6 +46,7 @@ impl ApiEventMetric for PaymentsRetrieveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsStartRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -48,6 +55,7 @@ impl ApiEventMetric for PaymentsStartRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsCaptureRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -56,6 +64,7 @@ impl ApiEventMetric for PaymentsCaptureRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsCompleteAuthorizeRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -64,6 +73,7 @@ impl ApiEventMetric for PaymentsCompleteAuthorizeRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsDynamicTaxCalculationRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -72,6 +82,7 @@ impl ApiEventMetric for PaymentsDynamicTaxCalculationRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsPostSessionTokensRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -80,6 +91,7 @@ impl ApiEventMetric for PaymentsPostSessionTokensRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsPostSessionTokensResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -88,8 +100,10 @@ impl ApiEventMetric for PaymentsPostSessionTokensResponse {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsDynamicTaxCalculationResponse {}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsCancelRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -98,6 +112,7 @@ impl ApiEventMetric for PaymentsCancelRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsApproveRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -106,6 +121,7 @@ impl ApiEventMetric for PaymentsApproveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsRejectRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -114,6 +130,7 @@ impl ApiEventMetric for PaymentsRejectRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
match self.payment_id {
|
||||
@ -125,6 +142,23 @@ impl ApiEventMetric for PaymentsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
impl ApiEventMetric for PaymentsCreateIntentRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
impl ApiEventMetric for PaymentsCreateIntentResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
payment_id: self.id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -262,6 +296,7 @@ impl ApiEventMetric for PaymentsAggregateResponse {
|
||||
|
||||
impl ApiEventMetric for RedirectionResponse {}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsIncrementalAuthorizationRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -270,8 +305,10 @@ impl ApiEventMetric for PaymentsIncrementalAuthorizationRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsExternalAuthenticationResponse {}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsExternalAuthenticationRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -280,8 +317,10 @@ impl ApiEventMetric for PaymentsExternalAuthenticationRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for ExtendedCardInfoResponse {}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsManualUpdateRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -290,6 +329,7 @@ impl ApiEventMetric for PaymentsManualUpdateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsManualUpdateResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
@ -298,6 +338,7 @@ impl ApiEventMetric for PaymentsManualUpdateResponse {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl ApiEventMetric for PaymentsSessionResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
|
||||
Reference in New Issue
Block a user