-
Notifications
You must be signed in to change notification settings - Fork 244
/
model.go
194 lines (167 loc) · 8.95 KB
/
model.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package api
import "github.com/awa/go-iap/appstore"
// OrderLookupResponse https://developer.apple.com/documentation/appstoreserverapi/orderlookupresponse
type OrderLookupResponse struct {
Status int `json:"status"`
SignedTransactions []string `json:"signedTransactions"`
}
// HistoryResponse https://developer.apple.com/documentation/appstoreserverapi/historyresponse
type HistoryResponse struct {
AppAppleId int `json:"appAppleId"`
BundleId string `json:"bundleId"`
Environment string `json:"environment"`
HasMore bool `json:"hasMore"`
Revision string `json:"revision"`
SignedTransactions []string `json:"signedTransactions"`
}
// TransactionInfoResponse https://developer.apple.com/documentation/appstoreserverapi/transactioninforesponse
type TransactionInfoResponse struct {
SignedTransactionInfo string `json:"signedTransactionInfo"`
}
// RefundLookupResponse https://developer.apple.com/documentation/appstoreserverapi/refundlookupresponse
type RefundLookupResponse struct {
HasMore bool `json:"hasMore"`
Revision string `json:"revision"`
SignedTransactions []string `json:"signedTransactions"`
}
// StatusResponse https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses
type StatusResponse struct {
Environment string `json:"environment"`
AppAppleId int `json:"appAppleId"`
BundleId string `json:"bundleId"`
Data []SubscriptionGroupIdentifierItem `json:"data"`
}
type SubscriptionGroupIdentifierItem struct {
SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier"`
LastTransactions []LastTransactionsItem `json:"lastTransactions"`
}
type LastTransactionsItem struct {
OriginalTransactionId string `json:"originalTransactionId"`
Status int `json:"status"`
SignedRenewalInfo string `json:"signedRenewalInfo"`
SignedTransactionInfo string `json:"signedTransactionInfo"`
}
// MassExtendRenewalDateRequest https://developer.apple.com/documentation/appstoreserverapi/massextendrenewaldaterequest
type MassExtendRenewalDateRequest struct {
RequestIdentifier string `json:"requestIdentifier"`
ExtendByDays int `json:"extendByDays"`
ExtendReasonCode int `json:"extendReasonCode"`
ProductId string `json:"productId"`
StorefrontCountryCodes []string `json:"storefrontCountryCodes"`
}
// ConsumptionRequestBody https://developer.apple.com/documentation/appstoreserverapi/consumptionrequest
type ConsumptionRequestBody struct {
AccountTenure int `json:"accountTenure"`
AppAccountToken string `json:"appAccountToken"`
ConsumptionStatus int `json:"consumptionStatus"`
CustomerConsented bool `json:"customerConsented"`
DeliveryStatus int `json:"deliveryStatus"`
LifetimeDollarsPurchased int `json:"lifetimeDollarsPurchased"`
LifetimeDollarsRefunded int `json:"lifetimeDollarsRefunded"`
Platform int `json:"platform"`
PlayTime int `json:"playTime"`
SampleContentProvided bool `json:"sampleContentProvided"`
UserStatus int `json:"userStatus"`
}
type JWSRenewalInfoDecodedPayload struct {
}
// JWSDecodedHeader https://developer.apple.com/documentation/appstoreserverapi/jwsdecodedheader
type JWSDecodedHeader struct {
Alg string `json:"alg,omitempty"`
Kid string `json:"kid,omitempty"`
X5C []string `json:"x5c,omitempty"`
}
// TransactionReason indicates the cause of a purchase transaction,
// https://developer.apple.com/documentation/appstoreservernotifications/transactionreason
type TransactionReason string
const (
TransactionReasonPurchase = "PURCHASE"
TransactionReasonRenewal = "RENEWAL"
)
// IAPType https://developer.apple.com/documentation/appstoreserverapi/type
type IAPType string
const (
AutoRenewable IAPType = "Auto-Renewable Subscription"
NonConsumable IAPType = "Non-Consumable"
Consumable IAPType = "Consumable"
NonRenewable IAPType = "Non-Renewing Subscription"
)
// JWSTransaction https://developer.apple.com/documentation/appstoreserverapi/jwstransaction
type JWSTransaction struct {
TransactionID string `json:"transactionId,omitempty"`
OriginalTransactionId string `json:"originalTransactionId,omitempty"`
WebOrderLineItemId string `json:"webOrderLineItemId,omitempty"`
BundleID string `json:"bundleId,omitempty"`
ProductID string `json:"productId,omitempty"`
SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier,omitempty"`
PurchaseDate int64 `json:"purchaseDate,omitempty"`
OriginalPurchaseDate int64 `json:"originalPurchaseDate,omitempty"`
ExpiresDate int64 `json:"expiresDate,omitempty"`
Quantity int64 `json:"quantity,omitempty"`
Type IAPType `json:"type,omitempty"`
AppAccountToken string `json:"appAccountToken,omitempty"`
InAppOwnershipType string `json:"inAppOwnershipType,omitempty"`
SignedDate int64 `json:"signedDate,omitempty"`
OfferType int64 `json:"offerType,omitempty"`
OfferIdentifier string `json:"offerIdentifier,omitempty"`
RevocationDate int64 `json:"revocationDate,omitempty"`
RevocationReason int `json:"revocationReason,omitempty"`
IsUpgraded bool `json:"isUpgraded,omitempty"`
Storefront string `json:"storefront"`
StorefrontId string `json:"storefrontId"`
TransactionReason TransactionReason `json:"transactionReason"`
}
func (J JWSTransaction) Valid() error {
return nil
}
// https://developer.apple.com/documentation/appstoreserverapi/extendreasoncode
type ExtendReasonCode int
const (
UndeclaredExtendReasonCode = iota
CustomerSatisfaction
OtherReasons
ServiceIssueOrOutage
)
// ExtendRenewalDateRequest https://developer.apple.com/documentation/appstoreserverapi/extendrenewaldaterequest
type ExtendRenewalDateRequest struct {
ExtendByDays int `json:"extendByDays"`
ExtendReasonCode ExtendReasonCode `json:"extendReasonCode"`
RequestIdentifier string `json:"requestIdentifier"`
}
// NotificationHistoryRequest https://developer.apple.com/documentation/appstoreserverapi/notificationhistoryrequest
type NotificationHistoryRequest struct {
StartDate int64 `json:"startDate"`
EndDate int64 `json:"endDate"`
OriginalTransactionId string `json:"originalTransactionId,omitempty"`
NotificationType appstore.NotificationTypeV2 `json:"notificationType,omitempty"`
NotificationSubtype appstore.SubtypeV2 `json:"notificationSubtype,omitempty"`
}
// NotificationHistoryResponses https://developer.apple.com/documentation/appstoreserverapi/notificationhistoryresponse
type NotificationHistoryResponses struct {
HasMore bool `json:"hasMore"`
PaginationToken string `json:"paginationToken"`
NotificationHistory []NotificationHistoryResponseItem `json:"notificationHistory"`
}
// NotificationHistoryResponseItem https://developer.apple.com/documentation/appstoreserverapi/notificationhistoryresponseitem
type NotificationHistoryResponseItem struct {
SignedPayload string `json:"signedPayload"`
FirstSendAttemptResult FirstSendAttemptResult `json:"firstSendAttemptResult"`
}
// https://developer.apple.com/documentation/appstoreserverapi/firstsendattemptresult
type FirstSendAttemptResult string
const (
FirstSendAttemptResultSuccess FirstSendAttemptResult = "SUCCESS"
FirstSendAttemptResultCircularRedirect FirstSendAttemptResult = "CIRCULAR_REDIRECT"
FirstSendAttemptResultInvalidResponse FirstSendAttemptResult = "INVALID_RESPONSE"
FirstSendAttemptResultNoResponse FirstSendAttemptResult = "NO_RESPONSE"
FirstSendAttemptResultOther FirstSendAttemptResult = "OTHER"
FirstSendAttemptResultPrematureClose FirstSendAttemptResult = "PREMATURE_CLOSE"
FirstSendAttemptResultSocketIssue FirstSendAttemptResult = "SOCKET_ISSUE"
FirstSendAttemptResultTimedOut FirstSendAttemptResult = "TIMED_OUT"
FirstSendAttemptResultTlsIssue FirstSendAttemptResult = "TLS_ISSUE"
FirstSendAttemptResultUnsupportedCharset FirstSendAttemptResult = "UNSUPPORTED_CHARSET"
)
// SendTestNotificationResponse https://developer.apple.com/documentation/appstoreserverapi/sendtestnotificationresponse
type SendTestNotificationResponse struct {
TestNotificationToken string `json:"testNotificationToken"`
}