feat(router): add an endpoint for extending authorization (#9813)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2025-10-17 18:41:59 +05:30
committed by GitHub
parent a75c89002f
commit 7e09699a5b
38 changed files with 1691 additions and 216 deletions

View File

@ -31,11 +31,12 @@ use crate::{
PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelPostCaptureRequest,
PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse,
PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest,
PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest,
PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsRetrieveRequest,
PaymentsStartRequest, PaymentsUpdateMetadataRequest, PaymentsUpdateMetadataResponse,
PaymentsExtendAuthorizationRequest, PaymentsExternalAuthenticationRequest,
PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
PaymentsManualUpdateRequest, PaymentsManualUpdateResponse,
PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest,
PaymentsRetrieveRequest, PaymentsStartRequest, PaymentsUpdateMetadataRequest,
PaymentsUpdateMetadataResponse,
},
};
@ -143,6 +144,14 @@ impl ApiEventMetric for PaymentsCancelPostCaptureRequest {
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentsExtendAuthorizationRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.payment_id.clone(),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentsApproveRequest {

View File

@ -8469,6 +8469,13 @@ pub struct PaymentsCancelPostCaptureRequest {
pub cancellation_reason: Option<String>,
}
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
/// Request constructed internally for extending authorization
pub struct PaymentsExtendAuthorizationRequest {
/// The identifier for the payment
pub payment_id: id_type::PaymentId,
}
#[derive(Default, Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
pub struct PaymentsIncrementalAuthorizationRequest {
/// The identifier for the payment

View File

@ -20,6 +20,8 @@ pub enum IncomingWebhookEvent {
PaymentIntentCancelFailure,
PaymentIntentAuthorizationSuccess,
PaymentIntentAuthorizationFailure,
PaymentIntentExtendAuthorizationSuccess,
PaymentIntentExtendAuthorizationFailure,
PaymentIntentCaptureSuccess,
PaymentIntentCaptureFailure,
PaymentIntentExpired,
@ -265,7 +267,9 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
| IncomingWebhookEvent::PaymentIntentAuthorizationFailure
| IncomingWebhookEvent::PaymentIntentCaptureSuccess
| IncomingWebhookEvent::PaymentIntentCaptureFailure
| IncomingWebhookEvent::PaymentIntentExpired => Self::Payment,
| IncomingWebhookEvent::PaymentIntentExpired
| IncomingWebhookEvent::PaymentIntentExtendAuthorizationSuccess
| IncomingWebhookEvent::PaymentIntentExtendAuthorizationFailure => Self::Payment,
IncomingWebhookEvent::EventNotSupported => Self::ReturnResponse,
IncomingWebhookEvent::RefundSuccess | IncomingWebhookEvent::RefundFailure => {
Self::Refund