-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcard_shipping.go
executable file
·90 lines (80 loc) · 2.19 KB
/
card_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
package processout
import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"
"gopkg.in/processout.v5/errors"
)
// CardShipping represents the CardShipping API object
type CardShipping struct {
// Address1 is the address line of the card holder
Address1 *string `json:"address1,omitempty"`
// Address2 is the secondary address line of the card holder
Address2 *string `json:"address2,omitempty"`
// City is the city of the card holder
City *string `json:"city,omitempty"`
// State is the state of the card holder
State *string `json:"state,omitempty"`
// CountryCode is the country code of the card holder (ISO-3166, 2 characters format)
CountryCode *string `json:"country_code,omitempty"`
// Zip is the zIP code of the card holder
Zip *string `json:"zip,omitempty"`
// Phone is the shipping phone number
Phone *Phone `json:"phone,omitempty"`
// FirstName is the first name of the card shipping
FirstName *string `json:"first_name,omitempty"`
// LastName is the last name of the card shipping
LastName *string `json:"last_name,omitempty"`
// Email is the email of the card shipping
Email *string `json:"email,omitempty"`
client *ProcessOut
}
// SetClient sets the client for the CardShipping object and its
// children
func (s *CardShipping) SetClient(c *ProcessOut) *CardShipping {
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 *CardShipping) Prefill(c *CardShipping) *CardShipping {
if c == nil {
return s
}
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.Phone = c.Phone
s.FirstName = c.FirstName
s.LastName = c.LastName
s.Email = c.Email
return s
}
// dummyCardShipping 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 dummyCardShipping() {
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, "", "")
}