2017-04-03 11:17:05 +00:00
|
|
|
include "base.thrift"
|
|
|
|
include "domain.thrift"
|
|
|
|
|
2022-01-06 10:30:52 +00:00
|
|
|
namespace java dev.vality.damsel.webhooker
|
2022-06-16 16:36:21 +00:00
|
|
|
namespace erlang dmsl.webhooker
|
2017-04-03 11:17:05 +00:00
|
|
|
|
|
|
|
typedef string Url
|
|
|
|
typedef string Key
|
2017-04-12 14:28:12 +00:00
|
|
|
typedef i64 WebhookID
|
2020-07-29 15:29:00 +00:00
|
|
|
typedef string SourceID
|
2017-04-03 11:17:05 +00:00
|
|
|
exception WebhookNotFound {}
|
2020-07-29 15:29:00 +00:00
|
|
|
exception SourceNotFound {}
|
2020-01-23 15:05:17 +00:00
|
|
|
exception LimitExceeded {}
|
2017-04-03 11:17:05 +00:00
|
|
|
|
|
|
|
struct Webhook {
|
2017-04-12 14:28:12 +00:00
|
|
|
1: required WebhookID id
|
2017-04-03 11:17:05 +00:00
|
|
|
2: required domain.PartyID party_id
|
|
|
|
3: required EventFilter event_filter
|
|
|
|
4: required Url url
|
|
|
|
5: required Key pub_key
|
2017-04-11 12:07:49 +00:00
|
|
|
6: required bool enabled
|
2017-04-03 11:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct WebhookParams {
|
|
|
|
1: required domain.PartyID party_id
|
2017-04-11 12:07:49 +00:00
|
|
|
2: required EventFilter event_filter
|
2017-04-03 11:17:05 +00:00
|
|
|
3: required Url url
|
|
|
|
}
|
|
|
|
|
|
|
|
union EventFilter {
|
|
|
|
1: PartyEventFilter party
|
|
|
|
2: InvoiceEventFilter invoice
|
2017-10-23 12:00:48 +00:00
|
|
|
3: CustomerEventFilter customer
|
2018-07-17 14:32:10 +00:00
|
|
|
4: WalletEventFilter wallet
|
2017-04-03 11:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct PartyEventFilter {
|
2017-04-10 15:46:28 +00:00
|
|
|
1: required set<PartyEventType> types
|
2017-04-03 11:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
union PartyEventType {
|
|
|
|
1: ClaimEventType claim
|
|
|
|
}
|
|
|
|
|
|
|
|
union ClaimEventType {
|
|
|
|
1: ClaimCreated created
|
|
|
|
2: ClaimDenied denied
|
|
|
|
3: ClaimAccepted accepted
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimCreated {}
|
|
|
|
struct ClaimDenied {}
|
|
|
|
struct ClaimAccepted {}
|
|
|
|
|
|
|
|
struct InvoiceEventFilter {
|
2017-04-10 15:46:28 +00:00
|
|
|
1: required set<InvoiceEventType> types
|
2022-08-24 13:43:29 +00:00
|
|
|
2: required domain.ShopID shop_id
|
2017-04-03 11:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
union InvoiceEventType {
|
|
|
|
1: InvoiceCreated created
|
|
|
|
2: InvoiceStatusChanged status_changed
|
|
|
|
3: InvoicePaymentEventType payment
|
|
|
|
}
|
|
|
|
|
|
|
|
struct InvoiceCreated {}
|
2017-04-17 13:21:21 +00:00
|
|
|
struct InvoiceStatusChanged {
|
2022-08-24 13:43:29 +00:00
|
|
|
1: required InvoiceStatus value
|
2017-04-17 13:21:21 +00:00
|
|
|
}
|
2017-04-03 11:17:05 +00:00
|
|
|
|
2017-04-19 15:36:45 +00:00
|
|
|
union InvoiceStatus {
|
|
|
|
1: InvoiceUnpaid unpaid
|
|
|
|
2: InvoicePaid paid
|
|
|
|
3: InvoiceCancelled cancelled
|
|
|
|
4: InvoiceFulfilled fulfilled
|
|
|
|
}
|
|
|
|
|
|
|
|
struct InvoiceUnpaid {}
|
|
|
|
struct InvoicePaid {}
|
|
|
|
struct InvoiceCancelled {}
|
|
|
|
struct InvoiceFulfilled {}
|
|
|
|
|
2017-04-03 11:17:05 +00:00
|
|
|
union InvoicePaymentEventType {
|
|
|
|
1: InvoicePaymentCreated created
|
|
|
|
2: InvoicePaymentStatusChanged status_changed
|
2018-03-06 14:04:49 +00:00
|
|
|
3: InvoicePaymentRefundChange invoice_payment_refund_change
|
2017-04-03 11:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct InvoicePaymentCreated {}
|
2017-04-17 13:21:21 +00:00
|
|
|
struct InvoicePaymentStatusChanged {
|
2022-08-24 13:43:29 +00:00
|
|
|
1: required InvoicePaymentStatus value
|
2017-04-17 13:21:21 +00:00
|
|
|
}
|
2017-04-03 11:17:05 +00:00
|
|
|
|
2018-03-16 13:29:27 +00:00
|
|
|
union InvoicePaymentRefundChange {
|
2018-03-06 14:04:49 +00:00
|
|
|
1: InvoicePaymentRefundCreated invoice_payment_refund_created
|
|
|
|
2: InvoicePaymentRefundStatusChanged invoice_payment_refund_status_changed
|
|
|
|
}
|
|
|
|
|
|
|
|
struct InvoicePaymentRefundCreated {}
|
|
|
|
struct InvoicePaymentRefundStatusChanged {
|
|
|
|
1: required InvoicePaymentRefundStatus value
|
|
|
|
}
|
|
|
|
|
2017-04-19 15:36:45 +00:00
|
|
|
union InvoicePaymentStatus {
|
|
|
|
1: InvoicePaymentPending pending
|
|
|
|
4: InvoicePaymentProcessed processed
|
|
|
|
2: InvoicePaymentCaptured captured
|
|
|
|
5: InvoicePaymentCancelled cancelled
|
|
|
|
3: InvoicePaymentFailed failed
|
2017-09-12 09:36:42 +00:00
|
|
|
6: InvoicePaymentRefunded refunded
|
2017-04-19 15:36:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct InvoicePaymentPending {}
|
|
|
|
struct InvoicePaymentProcessed {}
|
|
|
|
struct InvoicePaymentCaptured {}
|
|
|
|
struct InvoicePaymentCancelled {}
|
|
|
|
struct InvoicePaymentFailed {}
|
2017-09-12 09:36:42 +00:00
|
|
|
struct InvoicePaymentRefunded {}
|
2017-04-19 15:36:45 +00:00
|
|
|
|
2018-03-06 14:04:49 +00:00
|
|
|
union InvoicePaymentRefundStatus {
|
|
|
|
1: InvoicePaymentRefundPending pending
|
|
|
|
2: InvoicePaymentRefundSucceeded succeeded
|
|
|
|
3: InvoicePaymentRefundFailed failed
|
|
|
|
}
|
|
|
|
|
|
|
|
struct InvoicePaymentRefundPending {}
|
|
|
|
struct InvoicePaymentRefundSucceeded {}
|
|
|
|
struct InvoicePaymentRefundFailed {}
|
|
|
|
|
2017-10-23 12:00:48 +00:00
|
|
|
struct CustomerEventFilter {
|
|
|
|
1: required set<CustomerEventType> types
|
2022-08-24 13:43:29 +00:00
|
|
|
2: required domain.ShopID shop_id
|
2017-10-23 12:00:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
union CustomerEventType {
|
|
|
|
1: CustomerCreated created
|
|
|
|
2: CustomerDeleted deleted
|
|
|
|
3: CustomerStatusReady ready
|
|
|
|
4: CustomerBindingEvent binding
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CustomerCreated {}
|
|
|
|
struct CustomerDeleted {}
|
|
|
|
struct CustomerStatusReady {}
|
|
|
|
|
|
|
|
union CustomerBindingEvent {
|
|
|
|
1: CustomerBindingStarted started
|
|
|
|
2: CustomerBindingSucceeded succeeded
|
|
|
|
3: CustomerBindingFailed failed
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CustomerBindingStarted {}
|
|
|
|
struct CustomerBindingSucceeded {}
|
|
|
|
struct CustomerBindingFailed {}
|
|
|
|
|
2018-07-17 14:32:10 +00:00
|
|
|
struct WalletEventFilter {
|
|
|
|
1: required set<WalletEventType> types
|
|
|
|
}
|
|
|
|
|
|
|
|
union WalletEventType {
|
|
|
|
1: WalletWithdrawalEventType withdrawal
|
|
|
|
}
|
|
|
|
|
|
|
|
union WalletWithdrawalEventType {
|
|
|
|
1: WalletWithdrawalStarted started
|
|
|
|
2: WalletWithdrawalSucceeded succeeded
|
|
|
|
3: WalletWithdrawalFailed failed
|
|
|
|
}
|
|
|
|
|
|
|
|
struct WalletWithdrawalStarted {}
|
|
|
|
struct WalletWithdrawalSucceeded {}
|
|
|
|
struct WalletWithdrawalFailed {}
|
|
|
|
|
2017-04-03 11:17:05 +00:00
|
|
|
service WebhookManager {
|
|
|
|
list<Webhook> GetList(1: domain.PartyID party_id)
|
2017-04-12 14:28:12 +00:00
|
|
|
Webhook Get(1: WebhookID webhook_id) throws (1: WebhookNotFound ex1)
|
2020-01-23 15:05:17 +00:00
|
|
|
Webhook Create(1: WebhookParams webhook_params) throws (1: LimitExceeded ex1)
|
2017-04-12 14:28:12 +00:00
|
|
|
void Delete(1: WebhookID webhook_id) throws (1: WebhookNotFound ex1)
|
2017-04-03 11:17:05 +00:00
|
|
|
}
|
2020-07-29 15:29:00 +00:00
|
|
|
|
|
|
|
service WebhookMessageService {
|
|
|
|
void Send(1: WebhookID hook_id, 2: SourceID source_id) throws (1: WebhookNotFound ex1, 2: SourceNotFound ex2)
|
2022-06-16 16:36:21 +00:00
|
|
|
}
|