/
common.go
266 lines (222 loc) · 8.04 KB
/
common.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
package common
import (
"net/http"
"time"
)
type AccountType string
const (
Savings AccountType = "savings"
Current AccountType = "current"
Cash AccountType = "cash"
)
type CardType string
const (
Credit CardType = "Credit"
Debit CardType = "Debit"
Prepaid CardType = "Prepaid"
Charge CardType = "Charge"
DeferredDebit CardType = "Deferred Debit"
)
type CardCategory string
const (
Consumer CardCategory = "Consumer"
Commercial CardCategory = "Commercial"
All CardCategory = "All"
OtherCardCategory CardCategory = "Other"
)
type AccountHolderType string
const (
Individual AccountHolderType = "individual"
Corporate AccountHolderType = "corporate"
Government AccountHolderType = "government"
)
type ChallengeIndicator string
const (
NoPreference ChallengeIndicator = "no_preference"
NoChallengeRequested ChallengeIndicator = "no_challenge_requested"
ChallengeRequested ChallengeIndicator = "challenge_requested"
ChallengeRequestedMandate ChallengeIndicator = "challenge_requested_mandate"
)
type DocumentType string
const (
PassportDocumentType DocumentType = "passport"
NationalIdentityCard DocumentType = "national_identity_card"
DrivingLicense DocumentType = "driving_license"
CitizenCard DocumentType = "citizen_card"
ResidencePermit DocumentType = "residence_permit"
ElectoralId DocumentType = "electoral_id"
)
type AccountHolderIdentificationType string
const (
Passport AccountHolderIdentificationType = "passport"
DrivingLicence AccountHolderIdentificationType = "driving_licence"
NationalId AccountHolderIdentificationType = "national_id"
CompanyRegistration AccountHolderIdentificationType = "company_registration"
TaxId AccountHolderIdentificationType = "tax_id"
)
type ThreeDsFlowType string
const (
Challenged ThreeDsFlowType = "challenged"
Frictionless ThreeDsFlowType = "frictionless"
FrictionlessDelegated ThreeDsFlowType = "frictionless_delegated"
)
type Exemption string
const (
None Exemption = "none"
LowValue Exemption = "low_value"
RecurringOperation Exemption = "recurring_operation"
TransactionRiskAssessment Exemption = "transaction_risk_assessment"
SecureCorporatePayment Exemption = "secure_corporate_payment"
TrustedListing Exemption = "trusted_listing"
ThreeDsOutage Exemption = "3ds_outage"
ScaDelegation Exemption = "sca_delegation"
OutOfScaScope Exemption = "out_of_sca_scope"
Other Exemption = "other"
LowRiskProgram Exemption = "low_risk_program"
)
type ThreeDsMethodCompletion string
const (
Y ThreeDsMethodCompletion = "y"
N ThreeDsMethodCompletion = "n"
U ThreeDsMethodCompletion = "u"
)
type (
Address struct {
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zip string `json:"zip,omitempty"`
Country Country `json:"country,omitempty"`
}
Phone struct {
CountryCode string `json:"country_code,omitempty"`
Number string `json:"number,omitempty"`
}
BankDetails struct {
Name string `json:"name,omitempty"`
Branch string `json:"branch,omitempty"`
Address *Address `json:"address,omitempty"`
}
)
type (
IdResponse struct {
HttpMetadata HttpMetadata
Id string `json:"id,omitempty"`
Links map[string]Link `json:"_links"`
}
MetadataResponse struct {
HttpMetadata HttpMetadata
}
ContentResponse struct {
HttpMetadata HttpMetadata
Content string `json:"content,omitempty"`
}
HttpMetadata struct {
Status string `json:"status,omitempty"`
StatusCode int `json:"status_code,omitempty"`
ResponseBody []byte `json:"response_body,omitempty"`
ResponseCSV [][]string `json:"response_csv,omitempty"`
Headers *Headers `json:"headers,omitempty"`
}
AlternativeResponse map[string]interface{}
Headers struct {
Header http.Header
CKORequestID *string `json:"cko-request-id,omitempty"`
CKOVersion *string `json:"cko-version,omitempty"`
}
Link struct {
HRef *string `json:"href,omitempty"`
Title *string `json:"title,omitempty"`
}
)
type (
AccountHolderIdentification struct {
Type AccountHolderIdentificationType `json:"type,omitempty"`
Number string `json:"number,omitempty"`
IssuingCountry Country `json:"issuing_country,omitempty"`
DateOfExpiry string `json:"date_of_expiry,omitempty"`
}
AccountHolder struct {
Type AccountHolderType `json:"type,omitempty"`
Title string `json:"title,omitempty"`
FirstName string `json:"first_name,omitempty"`
MiddleName string `json:"middle_name,omitempty"`
LastName string `json:"last_name,omitempty"`
CompanyName string `json:"company_name,omitempty"`
TaxId string `json:"tax_id,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
CountryOfBirth string `json:"country_of_birth,omitempty"`
ResidentialStatus string `json:"residential_status,omitempty"`
BillingAddress *Address `json:"billing_address,omitempty"`
Phone *Phone `json:"phone,omitempty"`
Identification *AccountHolderIdentification `json:"identification,omitempty"`
Email string `json:"email,omitempty"`
Gender string `json:"gender,omitempty"`
}
)
type InstrumentType string
const (
Card InstrumentType = "card"
BankAccount InstrumentType = "bank_account"
Token InstrumentType = "token"
CardToken InstrumentType = "card_token"
)
type (
InstrumentDetails struct {
Id string `json:"id,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
InstrumentCustomerResponse *InstrumentCustomerResponse `json:"customer,omitempty"`
AccountHolder *AccountHolder `json:"account_holder,omitempty"`
}
InstrumentCustomerResponse struct {
Id string `json:"id,omitempty"`
Email string `json:"email,omitempty"`
Name string `json:"name,omitempty"`
Phone *Phone `json:"phone,omitempty"`
Default bool `json:"default,omitempty"`
}
)
type (
CustomerRequest struct {
Id string `json:"id,omitempty"`
Email string `json:"email,omitempty"`
Name string `json:"name,omitempty"`
TaxNumber string `json:"tax_number,omitempty"`
Phone *Phone `json:"phone,omitempty"`
Default bool `json:"default,omitempty"`
}
CustomerResponse struct {
Id string `json:"id,omitempty"`
Email string `json:"email,omitempty"`
Name string `json:"name,omitempty"`
Phone *Phone `json:"phone,omitempty"`
}
UpdateCustomerRequest struct {
Id string `json:"id,omitempty"`
Default bool `json:"default,omitempty"`
}
)
type (
// Deprecated: should use AmountAllocations instead
MarketplaceData struct {
SubEntityId string `json:"sub_entity_id,omitempty"`
SubEntities []AmountAllocations `json:"sub_entities,omitempty"`
}
AmountAllocations struct {
Id string `json:"id,omitempty"`
Amount int64 `json:"amount"`
Reference string `json:"reference,omitempty"`
Commission *Commission `json:"commission,omitempty"`
}
Commission struct {
Amount int64 `json:"amount,omitempty"`
Percentage float32 `json:"percentage,omitempty"`
}
)
type (
DateRangeQuery struct {
From *time.Time `url:"from,omitempty" layout:"2006-01-02T15:04:05Z"`
To *time.Time `url:"to,omitempty" layout:"2006-01-02T15:04:05Z"`
}
)