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

@ -141,6 +141,7 @@ pub enum AttemptStatus {
Authorizing,
CodInitiated,
Voided,
VoidedPostCharge,
VoidInitiated,
CaptureInitiated,
CaptureFailed,
@ -166,6 +167,7 @@ impl AttemptStatus {
| Self::Charged
| Self::AutoRefunded
| Self::Voided
| Self::VoidedPostCharge
| Self::VoidFailed
| Self::CaptureFailed
| Self::Failure
@ -1501,6 +1503,7 @@ impl EventClass {
EventType::PaymentFailed,
EventType::PaymentProcessing,
EventType::PaymentCancelled,
EventType::PaymentCancelledPostCapture,
EventType::PaymentAuthorized,
EventType::PaymentCaptured,
EventType::PaymentExpired,
@ -1555,6 +1558,7 @@ pub enum EventType {
PaymentFailed,
PaymentProcessing,
PaymentCancelled,
PaymentCancelledPostCapture,
PaymentAuthorized,
PaymentCaptured,
PaymentExpired,
@ -1659,6 +1663,8 @@ pub enum IntentStatus {
Failed,
/// This payment has been cancelled.
Cancelled,
/// This payment has been cancelled post capture.
CancelledPostCapture,
/// This payment is still being processed by the payment processor.
/// The status update might happen through webhooks or polling with the connector.
Processing,
@ -1690,6 +1696,7 @@ impl IntentStatus {
Self::Succeeded
| Self::Failed
| Self::Cancelled
| Self::CancelledPostCapture
| Self::PartiallyCaptured
| Self::Expired => true,
Self::Processing
@ -1713,6 +1720,7 @@ impl IntentStatus {
| Self::Succeeded
| Self::Failed
| Self::Cancelled
| Self::CancelledPostCapture
| Self::PartiallyCaptured
| Self::RequiresCapture | Self::Conflicted | Self::Expired=> false,
Self::Processing
@ -1826,6 +1834,7 @@ impl From<AttemptStatus> for PaymentMethodStatus {
match attempt_status {
AttemptStatus::Failure
| AttemptStatus::Voided
| AttemptStatus::VoidedPostCharge
| AttemptStatus::Started
| AttemptStatus::Pending
| AttemptStatus::Unresolved

View File

@ -2123,6 +2123,7 @@ impl From<AttemptStatus> for IntentStatus {
| AttemptStatus::CaptureFailed
| AttemptStatus::Failure => Self::Failed,
AttemptStatus::Voided => Self::Cancelled,
AttemptStatus::VoidedPostCharge => Self::CancelledPostCapture,
AttemptStatus::Expired => Self::Expired,
}
}
@ -2138,6 +2139,7 @@ impl From<IntentStatus> for Option<EventType> {
| IntentStatus::RequiresCustomerAction
| IntentStatus::Conflicted => Some(EventType::ActionRequired),
IntentStatus::Cancelled => Some(EventType::PaymentCancelled),
IntentStatus::CancelledPostCapture => Some(EventType::PaymentCancelledPostCapture),
IntentStatus::Expired => Some(EventType::PaymentExpired),
IntentStatus::PartiallyCaptured | IntentStatus::PartiallyCapturedAndCapturable => {
Some(EventType::PaymentCaptured)