-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinvoice_shipping.go
executable file
·111 lines (101 loc) · 3.19 KB
/
invoice_shipping.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
package processout
import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"
"gopkg.in/processout.v5/errors"
)
// InvoiceShipping represents the InvoiceShipping API object
type InvoiceShipping struct {
// Amount is the amount of the shipping
Amount *string `json:"amount,omitempty"`
// Method is the delivery method
Method *string `json:"method,omitempty"`
// Provider is the delivery provider
Provider *string `json:"provider,omitempty"`
// Delay is the shipping delay
Delay *string `json:"delay,omitempty"`
// Address1 is the address where the shipment will be delivered
Address1 *string `json:"address1,omitempty"`
// Address2 is the secondary address where the shipment will be delivered
Address2 *string `json:"address2,omitempty"`
// City is the city where the shipment will be delivered
City *string `json:"city,omitempty"`
// State is the state where the shipment will be delivered
State *string `json:"state,omitempty"`
// CountryCode is the country code where the shipment will be delivered
CountryCode *string `json:"country_code,omitempty"`
// Zip is the zIP where the shipment will be delivered
Zip *string `json:"zip,omitempty"`
// PhoneNumber is the shipment full phone number, consisting of a combined dialing code and phone number
PhoneNumber *string `json:"phone_number,omitempty"`
// Phone is the phone number for the shipment
Phone *InvoiceShippingPhone `json:"phone,omitempty"`
// ExpectsShippingAt is the date at which the shipment is expected to be sent
ExpectsShippingAt *time.Time `json:"expects_shipping_at,omitempty"`
// RelayStoreName is the relay store name
RelayStoreName *string `json:"relay_store_name,omitempty"`
// FirstName is the first name for the shipment
FirstName *string `json:"first_name,omitempty"`
// LastName is the last name for the shipment
LastName *string `json:"last_name,omitempty"`
// Email is the email for the shipment
Email *string `json:"email,omitempty"`
client *ProcessOut
}
// SetClient sets the client for the InvoiceShipping object and its
// children
func (s *InvoiceShipping) SetClient(c *ProcessOut) *InvoiceShipping {
if s == nil {
return s
}
s.client = c
if s.Phone != nil {
s.Phone.SetClient(c)
}
return s
}
// Prefil prefills the object with data provided in the parameter
func (s *InvoiceShipping) Prefill(c *InvoiceShipping) *InvoiceShipping {
if c == nil {
return s
}
s.Amount = c.Amount
s.Method = c.Method
s.Provider = c.Provider
s.Delay = c.Delay
s.Address1 = c.Address1
s.Address2 = c.Address2
s.City = c.City
s.State = c.State
s.CountryCode = c.CountryCode
s.Zip = c.Zip
s.PhoneNumber = c.PhoneNumber
s.Phone = c.Phone
s.ExpectsShippingAt = c.ExpectsShippingAt
s.RelayStoreName = c.RelayStoreName
s.FirstName = c.FirstName
s.LastName = c.LastName
s.Email = c.Email
return s
}
// dummyInvoiceShipping 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 dummyInvoiceShipping() {
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, "", "")
}