-
Notifications
You must be signed in to change notification settings - Fork 2
/
paymentlineitem.go
49 lines (39 loc) · 1.3 KB
/
paymentlineitem.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
package files_sdk
import (
"encoding/json"
"time"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type PaymentLineItem struct {
Amount string `json:"amount,omitempty" path:"amount"`
CreatedAt *time.Time `json:"created_at,omitempty" path:"created_at"`
InvoiceId int64 `json:"invoice_id,omitempty" path:"invoice_id"`
PaymentId int64 `json:"payment_id,omitempty" path:"payment_id"`
UpdatedAt *time.Time `json:"updated_at,omitempty" path:"updated_at"`
}
type PaymentLineItemCollection []PaymentLineItem
func (p *PaymentLineItem) UnmarshalJSON(data []byte) error {
type paymentLineItem PaymentLineItem
var v paymentLineItem
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*p = PaymentLineItem(v)
return nil
}
func (p *PaymentLineItemCollection) UnmarshalJSON(data []byte) error {
type paymentLineItems PaymentLineItemCollection
var v paymentLineItems
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*p = PaymentLineItemCollection(v)
return nil
}
func (p *PaymentLineItemCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*p))
for i, v := range *p {
ret[i] = v
}
return &ret
}