mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
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:
@ -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",
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user