-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsubscription_type.go
62 lines (52 loc) · 2.13 KB
/
subscription_type.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
package apple
import "encoding/json"
// SubscriptionsStatusResponse https://developer.apple.com/documentation/appstoreserverapi/statusresponse
type SubscriptionsStatusResponse struct {
Data []*SubscriptionGroupIdentifier `json:"data"`
Environment Environment `json:"environment"`
AppAppleId int `json:"appAppleId"`
BundleId string `json:"bundleId"`
}
type SubscriptionGroupIdentifier struct {
SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier"`
LastTransactions []*LastTransaction `json:"lastTransactions"`
}
type LastTransaction struct {
OriginalTransactionId string `json:"originalTransactionId"`
Status int `json:"status"`
Renewal *Renewal `json:"renewal"`
Transaction *Transaction `json:"transaction"`
}
type LastTransactionAlias LastTransaction
func (t *LastTransaction) UnmarshalJSON(data []byte) (err error) {
var aux = struct {
*LastTransactionAlias
SignedRenewal SignedRenewal `json:"signedRenewalInfo"`
SignedTransaction SignedTransaction `json:"signedTransactionInfo"`
}{
LastTransactionAlias: (*LastTransactionAlias)(t),
}
if err = json.Unmarshal(data, &aux); err != nil {
return err
}
if t.Renewal, err = aux.SignedRenewal.Decode(); err != nil {
return err
}
if t.Transaction, err = aux.SignedTransaction.Decode(); err != nil {
return err
}
return nil
}
// ExtendRenewalDateParam https://developer.apple.com/documentation/appstoreserverapi/extendrenewaldaterequest
type ExtendRenewalDateParam struct {
ExtendByDays int `json:"extendByDays"`
ExtendReasonCode int `json:"extendReasonCode"`
RequestIdentifier string `json:"requestIdentifier"`
}
// ExtendRenewalDateResponse https://developer.apple.com/documentation/appstoreserverapi/extendrenewaldateresponse
type ExtendRenewalDateResponse struct {
EffectiveDate int64 `json:"effectiveDate"`
OriginalTransactionId string `json:"originalTransactionId"`
Success bool `json:"success"`
WebOrderLineItemId string `json:"webOrderLineItemId"`
}