-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypes.go
147 lines (133 loc) · 5.42 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package cielo
import (
"fmt"
"io"
"net/http"
"sync"
)
type (
Environment struct {
APIUrl, APIQueryURL string
}
// Client represents a Cielo REST API Client
Client struct {
sync.Mutex
Client *http.Client
MerchantId string
MerchantKey string
Environment Environment
Log io.Writer // If user set log file name all requests will be logged there
}
ErrorResponse struct {
Response *http.Response `json:"-"`
Name uint32 `json:"code"`
Message string `json:"message"`
}
Sale struct {
MerchantOrderID string `json:",omitempty"`
Customer *Customer `json:",omitempty"`
Payment *Payment `json:",omitempty"`
}
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 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 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"`
DebitCard *DebitCard `json:",omitempty"`
Tid string `json:",omitempty"`
ProofOfSale string `json:",omitempty"`
AuthorizationCode string `json:",omitempty"`
SoftDescriptor string `json:",omitempty"`
ReturnURL string `json:",omitempty"`
Provider string `json:",omitempty"`
PaymentID string `json:",omitempty"`
Type string `json:",omitempty"`
Amount uint32 `json:",omitempty"`
ReceiveDate string `json:",omitempty"`
CapturedAmount uint32 `json:",omitempty"`
CapturedDate string `json:",omitempty"`
Currency string `json:",omitempty"`
Country string `json:",omitempty"`
ReturnCode string `json:",omitempty"`
ReturnMessage string `json:",omitempty"`
Status uint32 `json:",omitempty"`
Links []*Links `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"`
}
Links struct {
Method string `json:",omitempty"`
Rel string `json:",omitempty"`
Href string `json:",omitempty"`
}
RecurrentPayment struct {
AuthorizeNow bool `json:",omitempty"`
EndDate string `json:",omitempty"`
Interval uint32 `json:",omitempty"`
RecurrentPaymentId string `json:",omitempty"`
ReasonCode int32 `json:",omitempty"`
ReasonMessage string `json:",omitempty"`
NextRecurrency string `json:",omitempty"`
}
CreditCard struct {
CardNumber string `json:",omitempty"`
CustomerName 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"`
Links []*Links `json:"-"`
}
DebitCard struct {
CardNumber string `json:",omitempty"`
CustomerName string `json:",omitempty"`
Authenticate bool `json:",omitempty"`
ReturnUrl string `json:",omitempty"`
IsCryptoCurrencyNegotiation bool `json:",omitempty"`
Holder string `json:",omitempty"`
ExpirationDate string `json:",omitempty"`
RecurrentPayment RecurrentPayment `json:",omitempty"`
SecurityCode string `json:",omitempty"`
CardOnFile CardOnFile `json:",omitempty"`
Brand string `json:",omitempty"`
CardToken string `json:",omitempty"`
Links []*Links `json:",omitempty"`
}
CardOnFile struct {
Usage string `json:",omitempty"`
Reason string `json:",omitempty"`
}
)
// Error method implementation for ErrorResponse struct
func (r *ErrorResponse) Error() string {
return fmt.Sprintf("%v %v: %d %s", r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, r.Message)
}