-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
98 lines (90 loc) · 3.74 KB
/
types.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
package cielo
// Merchant identification on Cielo
type Merchant struct {
ID, Key string
}
// Sale is used to create a sale request
type Sale struct {
MerchantOrderID string `json:",omitempty"`
Customer *Customer `json:",omitempty"`
Payment *Payment `json:",omitempty"`
}
// Customer handle information about buyer
type Customer struct {
Name string `json:",omitempty"`
Email string `json:",omitempty"`
BirthDate string `json:",omitempty"`
Identity string `json:",omitempty"`
IdentityType string `json:",omitempty"`
Address *Address `json:",omitempty"`
DeliveryAddress *Address `json:",omitempty"`
}
// Address is used to set customer address
type Address struct {
Street string `json:",omitempty"`
Number string `json:",omitempty"`
Complement string `json:",omitempty"`
ZipCode string `json:",omitempty"`
City string `json:",omitempty"`
State string `json:",omitempty"`
Country string `json:",omitempty"`
}
// Payment represents a payment on Cielo
type Payment struct {
ServiceTaxAmount uint32 `json:",omitempty"`
Installments uint32 `json:",omitempty"`
Interest interface{} `json:",omitempty"`
Capture bool `json:",omitempty"`
Authenticate bool `json:",omitempty"`
Recurrent bool `json:",omitempty"`
RecurrentPayment *RecurrentPayment `json:",omitempty"`
CreditCard *CreditCard `json:",omitempty"`
Tid string `json:",omitempty"`
ProofOfSale string `json:",omitempty"`
AuthorizationCode string `json:",omitempty"`
SoftDescriptor string `json:",omitempty"`
ReturnURL string `json:",omitempty"`
Provider paymentProvider `json:",omitempty"`
PaymentID string `json:",omitempty"`
Type paymentType `json:",omitempty"`
Amount uint32 `json:",omitempty"`
ReceiveDate string `json:",omitempty"`
CapturedAmount uint32 `json:",omitempty"`
CapturedDate string `json:",omitempty"`
Currency currency `json:",omitempty"`
Country string `json:",omitempty"`
ReturnCode string `json:",omitempty"`
ReturnMessage string `json:",omitempty"`
Status uint32 `json:",omitempty"`
Links []interface{} `json:",omitempty"`
ExtraDataCollection []interface{} `json:",omitempty"`
ExpirationDate string `json:",omitempty"`
URL string `json:",omitempty"`
Number string `json:",omitempty"`
BarCodeNumber string `json:",omitempty"`
DigitableLine string `json:",omitempty"`
Address string `json:",omitempty"`
}
// RecurrentPayment is used to configure recurrent payments
type RecurrentPayment struct {
AuthorizeNow bool `json:",omitempty"`
EndDate string `json:",omitempty"`
Interval recurrentInterval `json:",omitempty"`
}
type recurrentInterval string
type paymentProvider string
type paymentType string
type currency string
type environment struct {
APIURL, APIQueryURL string
}
// CreditCard holds credit card informations
type CreditCard struct {
CardNumber string `json:",omitempty"`
Holder string `json:",omitempty"`
ExpirationDate string `json:",omitempty"`
SecurityCode string `json:",omitempty"`
SaveCard bool `json:",omitempty"`
Brand string `json:",omitempty"`
CardToken string `json:",omitempty"`
}