feat: Implement subscriptions workflow and incoming webhook support (#9400)

Co-authored-by: Prajjwal kumar <write2prajjwal@gmail.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Prajjwal Kumar <prajjwal.kumar@juspay.in>
This commit is contained in:
Gaurav Rawat
2025-10-03 21:31:21 +05:30
committed by GitHub
parent e186a0f4f4
commit 32dd9e10e3
12 changed files with 381 additions and 52 deletions

View File

@ -67,6 +67,7 @@ pub enum IncomingWebhookEvent {
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
RecoveryInvoiceCancel,
SetupWebhook,
InvoiceGenerated,
}
impl IncomingWebhookEvent {
@ -300,6 +301,7 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
| IncomingWebhookEvent::RecoveryPaymentPending
| IncomingWebhookEvent::RecoveryPaymentSuccess => Self::Recovery,
IncomingWebhookEvent::SetupWebhook => Self::Setup,
IncomingWebhookEvent::InvoiceGenerated => Self::Subscription,
}
}
}
@ -341,6 +343,7 @@ pub enum ObjectReferenceId {
PayoutId(PayoutIdType),
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
InvoiceId(InvoiceIdType),
SubscriptionId(common_utils::id_type::SubscriptionId),
}
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
@ -388,7 +391,12 @@ impl ObjectReferenceId {
common_utils::errors::ValidationError::IncorrectValueProvided {
field_name: "PaymentId is required but received InvoiceId",
},
)
),
Self::SubscriptionId(_) => Err(
common_utils::errors::ValidationError::IncorrectValueProvided {
field_name: "PaymentId is required but received SubscriptionId",
},
),
}
}
}