feat(core): Add support for Void after Capture (#8839)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Swangi Kumari
2025-08-06 13:15:43 +05:30
committed by GitHub
parent 0598782048
commit 57e92c9fda
61 changed files with 1422 additions and 87 deletions

View File

@ -27,8 +27,8 @@ use crate::{
payment_methods::{PaymentMethodListRequest, PaymentMethodListResponse},
payments::{
ExtendedCardInfoResponse, PaymentIdType, PaymentListFilterConstraints,
PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelRequest,
PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelPostCaptureRequest,
PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse,
PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest,
@ -134,6 +134,15 @@ impl ApiEventMetric for PaymentsCancelRequest {
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentsCancelPostCaptureRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.payment_id.clone(),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentsApproveRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {

View File

@ -221,6 +221,7 @@ pub enum TxnStatus {
Authorizing,
CODInitiated,
Voided,
VoidedPostCharge,
VoidInitiated,
Nop,
CaptureInitiated,

View File

@ -7689,6 +7689,16 @@ pub struct PaymentsCancelRequest {
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
}
/// Request to cancel a payment when the payment is already captured
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsCancelPostCaptureRequest {
/// The identifier for the payment
#[serde(skip)]
pub payment_id: id_type::PaymentId,
/// The reason for the payment cancel
pub cancellation_reason: Option<String>,
}
#[derive(Default, Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
pub struct PaymentsIncrementalAuthorizationRequest {
/// The identifier for the payment