-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinvoice_detail.go
executable file
·114 lines (102 loc) · 3.43 KB
/
invoice_detail.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
package processout
import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"
"gopkg.in/processout.v5/errors"
)
// InvoiceDetail represents the InvoiceDetail API object
type InvoiceDetail struct {
// ID is the iD of the invoice detail
ID *string `json:"id,omitempty"`
// Name is the name of the invoice detail
Name *string `json:"name,omitempty"`
// Type is the type of the invoice detail. Can be a string containing anything, up to 30 characters
Type *string `json:"type,omitempty"`
// Amount is the amount represented by the invoice detail
Amount *string `json:"amount,omitempty"`
// Quantity is the quantity of items represented by the invoice detail
Quantity *int `json:"quantity,omitempty"`
// Metadata is the metadata related to the invoice detail, in the form of a dictionary (key-value pair)
Metadata *map[string]string `json:"metadata,omitempty"`
// Reference is the reference of the product
Reference *string `json:"reference,omitempty"`
// Description is the description of the invoice detail
Description *string `json:"description,omitempty"`
// Brand is the brand of the product
Brand *string `json:"brand,omitempty"`
// Model is the model of the product
Model *string `json:"model,omitempty"`
// DiscountAmount is the discount amount represented by the invoice detail
DiscountAmount *string `json:"discount_amount,omitempty"`
// Condition is the condition of the product
Condition *string `json:"condition,omitempty"`
// MarketplaceMerchant is the marketplace merchant of the invoice detail
MarketplaceMerchant *string `json:"marketplace_merchant,omitempty"`
// MarketplaceMerchantIsBusiness is the define whether or not the marketplace merchant is a business
MarketplaceMerchantIsBusiness *bool `json:"marketplace_merchant_is_business,omitempty"`
// MarketplaceMerchantCreatedAt is the date at which the merchant was created
MarketplaceMerchantCreatedAt *time.Time `json:"marketplace_merchant_created_at,omitempty"`
// Category is the category of the product
Category *string `json:"category,omitempty"`
client *ProcessOut
}
// GetID implements the Identiable interface
func (s *InvoiceDetail) GetID() string {
if s.ID == nil {
return ""
}
return *s.ID
}
// SetClient sets the client for the InvoiceDetail object and its
// children
func (s *InvoiceDetail) SetClient(c *ProcessOut) *InvoiceDetail {
if s == nil {
return s
}
s.client = c
return s
}
// Prefil prefills the object with data provided in the parameter
func (s *InvoiceDetail) Prefill(c *InvoiceDetail) *InvoiceDetail {
if c == nil {
return s
}
s.ID = c.ID
s.Name = c.Name
s.Type = c.Type
s.Amount = c.Amount
s.Quantity = c.Quantity
s.Metadata = c.Metadata
s.Reference = c.Reference
s.Description = c.Description
s.Brand = c.Brand
s.Model = c.Model
s.DiscountAmount = c.DiscountAmount
s.Condition = c.Condition
s.MarketplaceMerchant = c.MarketplaceMerchant
s.MarketplaceMerchantIsBusiness = c.MarketplaceMerchantIsBusiness
s.MarketplaceMerchantCreatedAt = c.MarketplaceMerchantCreatedAt
s.Category = c.Category
return s
}
// dummyInvoiceDetail is a dummy function that's only
// here because some files need specific packages and some don't.
// It's easier to include it for every file. In case you couldn't
// tell, everything is generated.
func dummyInvoiceDetail() {
type dummy struct {
a bytes.Buffer
b json.RawMessage
c http.File
d strings.Reader
e time.Time
f url.URL
g io.Reader
}
errors.New(nil, "", "")
}