-
Notifications
You must be signed in to change notification settings - Fork 448
/
identity_verificationreport.go
319 lines (280 loc) · 14.5 KB
/
identity_verificationreport.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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
//
//
// File generated from our OpenAPI spec
//
//
package stripe
import "encoding/json"
// A short machine-readable string giving the reason for the verification failure.
type IdentityVerificationReportDocumentErrorCode string
// List of values that IdentityVerificationReportDocumentErrorCode can take
const (
IdentityVerificationReportDocumentErrorCodeDocumentExpired IdentityVerificationReportDocumentErrorCode = "document_expired"
IdentityVerificationReportDocumentErrorCodeDocumentTypeNotSupported IdentityVerificationReportDocumentErrorCode = "document_type_not_supported"
IdentityVerificationReportDocumentErrorCodeDocumentUnverifiedOther IdentityVerificationReportDocumentErrorCode = "document_unverified_other"
)
// Status of this `document` check.
type IdentityVerificationReportDocumentStatus string
// List of values that IdentityVerificationReportDocumentStatus can take
const (
IdentityVerificationReportDocumentStatusUnverified IdentityVerificationReportDocumentStatus = "unverified"
IdentityVerificationReportDocumentStatusVerified IdentityVerificationReportDocumentStatus = "verified"
)
// Type of the document.
type IdentityVerificationReportDocumentType string
// List of values that IdentityVerificationReportDocumentType can take
const (
IdentityVerificationReportDocumentTypeDrivingLicense IdentityVerificationReportDocumentType = "driving_license"
IdentityVerificationReportDocumentTypeIDCard IdentityVerificationReportDocumentType = "id_card"
IdentityVerificationReportDocumentTypePassport IdentityVerificationReportDocumentType = "passport"
)
// A short machine-readable string giving the reason for the verification failure.
type IdentityVerificationReportIDNumberErrorCode string
// List of values that IdentityVerificationReportIDNumberErrorCode can take
const (
IdentityVerificationReportIDNumberErrorCodeIDNumberInsufficientDocumentData IdentityVerificationReportIDNumberErrorCode = "id_number_insufficient_document_data"
IdentityVerificationReportIDNumberErrorCodeIDNumberMismatch IdentityVerificationReportIDNumberErrorCode = "id_number_mismatch"
IdentityVerificationReportIDNumberErrorCodeIDNumberUnverifiedOther IdentityVerificationReportIDNumberErrorCode = "id_number_unverified_other"
)
// Type of ID number.
type IdentityVerificationReportIDNumberIDNumberType string
// List of values that IdentityVerificationReportIDNumberIDNumberType can take
const (
IdentityVerificationReportIDNumberIDNumberTypeBRCPF IdentityVerificationReportIDNumberIDNumberType = "br_cpf"
IdentityVerificationReportIDNumberIDNumberTypeSGNRIC IdentityVerificationReportIDNumberIDNumberType = "sg_nric"
IdentityVerificationReportIDNumberIDNumberTypeUSSSN IdentityVerificationReportIDNumberIDNumberType = "us_ssn"
)
// Status of this `id_number` check.
type IdentityVerificationReportIDNumberStatus string
// List of values that IdentityVerificationReportIDNumberStatus can take
const (
IdentityVerificationReportIDNumberStatusUnverified IdentityVerificationReportIDNumberStatus = "unverified"
IdentityVerificationReportIDNumberStatusVerified IdentityVerificationReportIDNumberStatus = "verified"
)
// Array of strings of allowed identity document types. If the provided identity document isn't one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
type IdentityVerificationReportOptionsDocumentAllowedType string
// List of values that IdentityVerificationReportOptionsDocumentAllowedType can take
const (
IdentityVerificationReportOptionsDocumentAllowedTypeDrivingLicense IdentityVerificationReportOptionsDocumentAllowedType = "driving_license"
IdentityVerificationReportOptionsDocumentAllowedTypeIDCard IdentityVerificationReportOptionsDocumentAllowedType = "id_card"
IdentityVerificationReportOptionsDocumentAllowedTypePassport IdentityVerificationReportOptionsDocumentAllowedType = "passport"
)
// A short machine-readable string giving the reason for the verification failure.
type IdentityVerificationReportSelfieErrorCode string
// List of values that IdentityVerificationReportSelfieErrorCode can take
const (
IdentityVerificationReportSelfieErrorCodeSelfieDocumentMissingPhoto IdentityVerificationReportSelfieErrorCode = "selfie_document_missing_photo"
IdentityVerificationReportSelfieErrorCodeSelfieFaceMismatch IdentityVerificationReportSelfieErrorCode = "selfie_face_mismatch"
IdentityVerificationReportSelfieErrorCodeSelfieManipulated IdentityVerificationReportSelfieErrorCode = "selfie_manipulated"
IdentityVerificationReportSelfieErrorCodeSelfieUnverifiedOther IdentityVerificationReportSelfieErrorCode = "selfie_unverified_other"
)
// Status of this `selfie` check.
type IdentityVerificationReportSelfieStatus string
// List of values that IdentityVerificationReportSelfieStatus can take
const (
IdentityVerificationReportSelfieStatusUnverified IdentityVerificationReportSelfieStatus = "unverified"
IdentityVerificationReportSelfieStatusVerified IdentityVerificationReportSelfieStatus = "verified"
)
// Type of report.
type IdentityVerificationReportType string
// List of values that IdentityVerificationReportType can take
const (
IdentityVerificationReportTypeDocument IdentityVerificationReportType = "document"
IdentityVerificationReportTypeIDNumber IdentityVerificationReportType = "id_number"
)
// Retrieves an existing VerificationReport
type IdentityVerificationReportParams struct {
Params `form:"*"`
}
// List all verification reports.
type IdentityVerificationReportListParams struct {
ListParams `form:"*"`
Created *int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
// Only return VerificationReports of this type
Type *string `form:"type"`
// Only return VerificationReports created by this VerificationSession ID. It is allowed to provide a VerificationIntent ID.
VerificationSession *string `form:"verification_session"`
}
// Date of birth as it appears in the document.
type IdentityVerificationReportDocumentDOB struct {
// Numerical day between 1 and 31.
Day int64 `json:"day"`
// Numerical month between 1 and 12.
Month int64 `json:"month"`
// The four-digit year.
Year int64 `json:"year"`
}
// Details on the verification error. Present when status is `unverified`.
type IdentityVerificationReportDocumentError struct {
// A short machine-readable string giving the reason for the verification failure.
Code IdentityVerificationReportDocumentErrorCode `json:"code"`
// A human-readable message giving the reason for the failure. These messages can be shown to your users.
Reason string `json:"reason"`
}
// Expiration date of the document.
type IdentityVerificationReportDocumentExpirationDate struct {
// Numerical day between 1 and 31.
Day int64 `json:"day"`
// Numerical month between 1 and 12.
Month int64 `json:"month"`
// The four-digit year.
Year int64 `json:"year"`
}
// Issued date of the document.
type IdentityVerificationReportDocumentIssuedDate struct {
// Numerical day between 1 and 31.
Day int64 `json:"day"`
// Numerical month between 1 and 12.
Month int64 `json:"month"`
// The four-digit year.
Year int64 `json:"year"`
}
// Result from a document check
type IdentityVerificationReportDocument struct {
// Address as it appears in the document.
Address *Address `json:"address"`
// Date of birth as it appears in the document.
DOB *IdentityVerificationReportDocumentDOB `json:"dob"`
// Details on the verification error. Present when status is `unverified`.
Error *IdentityVerificationReportDocumentError `json:"error"`
// Expiration date of the document.
ExpirationDate *IdentityVerificationReportDocumentExpirationDate `json:"expiration_date"`
// Array of [File](https://stripe.com/docs/api/files) ids containing images for this document.
Files []string `json:"files"`
// First name as it appears in the document.
FirstName string `json:"first_name"`
// Issued date of the document.
IssuedDate *IdentityVerificationReportDocumentIssuedDate `json:"issued_date"`
// Issuing country of the document.
IssuingCountry string `json:"issuing_country"`
// Last name as it appears in the document.
LastName string `json:"last_name"`
// Document ID number.
Number string `json:"number"`
// Status of this `document` check.
Status IdentityVerificationReportDocumentStatus `json:"status"`
// Type of the document.
Type IdentityVerificationReportDocumentType `json:"type"`
}
// Date of birth.
type IdentityVerificationReportIDNumberDOB struct {
// Numerical day between 1 and 31.
Day int64 `json:"day"`
// Numerical month between 1 and 12.
Month int64 `json:"month"`
// The four-digit year.
Year int64 `json:"year"`
}
// Details on the verification error. Present when status is `unverified`.
type IdentityVerificationReportIDNumberError struct {
// A short machine-readable string giving the reason for the verification failure.
Code IdentityVerificationReportIDNumberErrorCode `json:"code"`
// A human-readable message giving the reason for the failure. These messages can be shown to your users.
Reason string `json:"reason"`
}
// Result from an id_number check
type IdentityVerificationReportIDNumber struct {
// Date of birth.
DOB *IdentityVerificationReportIDNumberDOB `json:"dob"`
// Details on the verification error. Present when status is `unverified`.
Error *IdentityVerificationReportIDNumberError `json:"error"`
// First name.
FirstName string `json:"first_name"`
// ID number.
IDNumber string `json:"id_number"`
// Type of ID number.
IDNumberType IdentityVerificationReportIDNumberIDNumberType `json:"id_number_type"`
// Last name.
LastName string `json:"last_name"`
// Status of this `id_number` check.
Status IdentityVerificationReportIDNumberStatus `json:"status"`
}
type IdentityVerificationReportOptionsDocument struct {
// Array of strings of allowed identity document types. If the provided identity document isn't one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
AllowedTypes []IdentityVerificationReportOptionsDocumentAllowedType `json:"allowed_types"`
// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document's extracted name and date of birth.
RequireIDNumber bool `json:"require_id_number"`
// Disable image uploads, identity document images have to be captured using the device's camera.
RequireLiveCapture bool `json:"require_live_capture"`
// Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://stripe.com/docs/identity/selfie).
RequireMatchingSelfie bool `json:"require_matching_selfie"`
}
type IdentityVerificationReportOptionsIDNumber struct{}
type IdentityVerificationReportOptions struct {
Document *IdentityVerificationReportOptionsDocument `json:"document"`
IDNumber *IdentityVerificationReportOptionsIDNumber `json:"id_number"`
}
// Details on the verification error. Present when status is `unverified`.
type IdentityVerificationReportSelfieError struct {
// A short machine-readable string giving the reason for the verification failure.
Code IdentityVerificationReportSelfieErrorCode `json:"code"`
// A human-readable message giving the reason for the failure. These messages can be shown to your users.
Reason string `json:"reason"`
}
// Result from a selfie check
type IdentityVerificationReportSelfie struct {
// ID of the [File](https://stripe.com/docs/api/files) holding the image of the identity document used in this check.
Document string `json:"document"`
// Details on the verification error. Present when status is `unverified`.
Error *IdentityVerificationReportSelfieError `json:"error"`
// ID of the [File](https://stripe.com/docs/api/files) holding the image of the selfie used in this check.
Selfie string `json:"selfie"`
// Status of this `selfie` check.
Status IdentityVerificationReportSelfieStatus `json:"status"`
}
// A VerificationReport is the result of an attempt to collect and verify data from a user.
// The collection of verification checks performed is determined from the `type` and `options`
// parameters used. You can find the result of each verification check performed in the
// appropriate sub-resource: `document`, `id_number`, `selfie`.
//
// Each VerificationReport contains a copy of any data collected by the user as well as
// reference IDs which can be used to access collected images through the [FileUpload](https://stripe.com/docs/api/files)
// API. To configure and create VerificationReports, use the
// [VerificationSession](https://stripe.com/docs/api/identity/verification_sessions) API.
//
// Related guides: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results).
type IdentityVerificationReport struct {
APIResource
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
// Result from a document check
Document *IdentityVerificationReportDocument `json:"document"`
// Unique identifier for the object.
ID string `json:"id"`
// Result from an id_number check
IDNumber *IdentityVerificationReportIDNumber `json:"id_number"`
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Livemode bool `json:"livemode"`
// String representing the object's type. Objects of the same type share the same value.
Object string `json:"object"`
Options *IdentityVerificationReportOptions `json:"options"`
// Result from a selfie check
Selfie *IdentityVerificationReportSelfie `json:"selfie"`
// Type of report.
Type IdentityVerificationReportType `json:"type"`
// ID of the VerificationSession that created this report.
VerificationSession string `json:"verification_session"`
}
// IdentityVerificationReportList is a list of VerificationReports as retrieved from a list endpoint.
type IdentityVerificationReportList struct {
APIResource
ListMeta
Data []*IdentityVerificationReport `json:"data"`
}
// UnmarshalJSON handles deserialization of an IdentityVerificationReport.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (i *IdentityVerificationReport) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
i.ID = id
return nil
}
type identityVerificationReport IdentityVerificationReport
var v identityVerificationReport
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*i = IdentityVerificationReport(v)
return nil
}