-
Notifications
You must be signed in to change notification settings - Fork 6
/
refund_type.go
52 lines (43 loc) · 1.24 KB
/
refund_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
package apple
import (
"encoding/json"
"net/url"
)
// RefundLookupParam https://developer.apple.com/documentation/appstoreserverapi/get_refund_history#query-parameters
type RefundLookupParam struct {
Revision string
}
func (r RefundLookupParam) Values() url.Values {
var values = url.Values{}
if r.Revision != "" {
values.Set("revision", r.Revision)
}
return values
}
// RefundLookupResponse https://developer.apple.com/documentation/appstoreserverapi/refundhistoryresponse
type RefundLookupResponse struct {
HasMore bool `json:"hasMore"`
Revision string `json:"revision"`
Transactions []*Transaction `json:"transactions"`
}
type RefundLookupResponseAlias RefundLookupResponse
func (r *RefundLookupResponse) UnmarshalJSON(data []byte) (err error) {
var aux = struct {
*RefundLookupResponseAlias
SignedTransactions []SignedTransaction `json:"signedTransactions"`
}{
RefundLookupResponseAlias: (*RefundLookupResponseAlias)(r),
}
if err = json.Unmarshal(data, &aux); err != nil {
return err
}
for _, item := range aux.SignedTransactions {
var transaction *Transaction
transaction, err = item.Decode()
if err != nil {
return err
}
r.Transactions = append(r.Transactions, transaction)
}
return nil
}