feat(events): add APIs to list webhook events and webhook delivery attempts (#4131)

This commit is contained in:
Sanchith Hegde
2024-03-21 19:02:17 +05:30
committed by GitHub
parent 4f8461b2a9
commit 14e1bbaf07
54 changed files with 4472 additions and 2705 deletions

View File

@ -14,6 +14,7 @@ pub mod diesel_exports {
DbPaymentMethodIssuerCode as PaymentMethodIssuerCode, DbPaymentType as PaymentType,
DbRefundStatus as RefundStatus,
DbRequestIncrementalAuthorization as RequestIncrementalAuthorization,
DbWebhookDeliveryAttempt as WebhookDeliveryAttempt,
};
}
@ -1032,6 +1033,28 @@ impl Currency {
}
}
#[derive(
Clone,
Copy,
Debug,
Eq,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumString,
ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum EventClass {
Payments,
Refunds,
Disputes,
Mandates,
}
#[derive(
Clone,
Copy,
@ -1070,6 +1093,27 @@ pub enum EventType {
MandateRevoked,
}
#[derive(
Clone,
Copy,
Debug,
Eq,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumString,
ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum WebhookDeliveryAttempt {
InitialAttempt,
AutomaticRetry,
ManualRetry,
}
// TODO: This decision about using KV mode or not,
// should be taken at a top level rather than pushing it down to individual functions via an enum.
#[derive(