-
Notifications
You must be signed in to change notification settings - Fork 21
/
event.go
82 lines (75 loc) · 2.57 KB
/
event.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package events
import (
"time"
"github.com/checkout/checkout-sdk-go"
"github.com/checkout/checkout-sdk-go/common"
"github.com/checkout/checkout-sdk-go/payments"
)
type (
// Request -
Request struct {
*QueryParameter
*EventTypeRequest
}
// QueryParameter -
QueryParameter struct {
From time.Time `url:"from,omitempty"`
To time.Time `url:"to,omitempty"`
Limit uint64 `url:"limit,omitempty"`
PaymentID string `url:"payment_id,omitempty"`
}
// EventTypeRequest -
EventTypeRequest struct {
Version string `url:"version,omitempty"`
}
)
type (
// Response -
Response struct {
StatusResponse *checkout.StatusResponse `json:"api_response,omitempty"`
EventTypes []EventType `json:"event_types,omitempty"`
Events *Events `json:"events,omitempty"`
Event *Event `json:"event,omitempty"`
Notification *Notification `json:"notification,omitempty"`
}
// EventType -
EventType struct {
Version string `json:"version,omitempty"`
EventTypes []string `json:"event_types,omitempty"`
}
// Events -
Events struct {
TotalCount uint64 `json:"total_count,omitempty"`
Limit uint64 `json:"limit,omitempty"`
Skip uint64 `json:"skip,omitempty"`
From time.Time `json:"from,omitempty"`
To time.Time `json:"to,omitempty"`
Data []Event `json:"data,omitempty"`
}
// Event -
Event struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
Data *payments.Processed `json:"data,omitempty"`
Notifications []Notification `json:"notifications,omitempty"`
Links map[string]common.Link `json:"_links"`
}
// Notification -
Notification struct {
ID string `json:"id,omitempty"`
URL string `json:"url,omitempty"`
Success *bool `json:"success,omitempty"`
ContentType string `json:"content_type,omitempty"`
Attempts []NotificationAttempt `json:"attempts,omitempty"`
Links map[string]common.Link `json:"_links"`
}
// NotificationAttempt -
NotificationAttempt struct {
StatusCode uint64 `json:"status_code,omitempty"`
ResponseBody string `json:"response_body,omitempty"`
RetryMode string `json:"retry_mode,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
)