-
Notifications
You must be signed in to change notification settings - Fork 6
/
order_type.go
34 lines (28 loc) · 871 Bytes
/
order_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
package apple
import "encoding/json"
// OrderLookupResponse https://developer.apple.com/documentation/appstoreserverapi/orderlookupresponse
type OrderLookupResponse struct {
Status int `json:"status"`
Transactions []*Transaction `json:"transactions"`
}
type OrderLookupResponseAlias OrderLookupResponse
func (o *OrderLookupResponse) UnmarshalJSON(data []byte) (err error) {
var aux = struct {
*OrderLookupResponseAlias
SignedTransactions []SignedTransaction `json:"signedTransactions"`
}{
OrderLookupResponseAlias: (*OrderLookupResponseAlias)(o),
}
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
}
o.Transactions = append(o.Transactions, transaction)
}
return nil
}