-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_types.go
67 lines (50 loc) · 2.03 KB
/
event_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package tebex
import (
"encoding/json"
"time"
)
type EventType string
const (
ValidationEventType EventType = "validation.webhook"
PaymentCompletedEventType EventType = "payment.completed"
PaymentDeclinedEventType EventType = "payment.declined"
PaymentRefundedEventType EventType = "payment.refunded"
PaymentDisputeOpenedEventType EventType = "payment.dispute.opened"
PaymentDisputeWonEventType EventType = "payment.dispute.won"
PaymentDisputeLostEventType EventType = "payment.dispute.lost"
PaymentDisputeClosedEventType EventType = "payment.dispute.closed"
RecurringPaymentStartedEventType EventType = "recurring-payment.started"
RecurringPaymentRenewedEventType EventType = "recurring-payment.renewed"
RecurringPaymentEndedEventType EventType = "recurring-payment.ended"
RecurringPaymentStatusChangedEventType EventType = "recurring-payment.status-changed"
)
type eventInternal struct {
Id string `json:"id"`
Type EventType `json:"type"`
Date time.Time `json:"date"`
Subject json.RawMessage `json:"subject"`
}
// Event is the common wrapper around any Tebex event
type Event struct {
Id string `json:"id"`
Type EventType `json:"type"`
Date time.Time `json:"date"`
Subject interface{} `json:"subject"`
}
// ValidationEvent is sent by Tebex when the webhook is added to the project
// to verify that it expects to receive Tebex webhooks.
//
// type = `validation.webhook`
type ValidationEvent struct {
}
type PaymentCompletedEvent Payment
type PaymentDeclinedEvent Payment
type PaymentRefundedEvent Payment
type PaymentDisputeOpenedEvent Payment
type PaymentDisputeWonEvent Payment
type PaymentDisputeLostEvent Payment
type PaymentDisputeClosedEvent Payment
type RecurringPaymentStartedEvent RecurringPayment
type RecurringPaymentRenewedEvent RecurringPayment
type RecurringPaymentEndedEvent RecurringPayment
type RecurringPaymentStatusChangedEvent RecurringPayment