/
person.ex
510 lines (478 loc) · 20.2 KB
/
person.ex
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
defmodule Stripe.Person do
use Stripe.Entity
@moduledoc "This is an object representing a person associated with a Stripe account.\n\nA platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.\nSee the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform prefilling and account onboarding steps.\n\nRelated guide: [Handling identity verification with the API](https://stripe.com/docs/connect/handling-api-verification#person-information)"
(
defstruct [
:account,
:additional_tos_acceptances,
:address,
:address_kana,
:address_kanji,
:created,
:dob,
:email,
:first_name,
:first_name_kana,
:first_name_kanji,
:full_name_aliases,
:future_requirements,
:gender,
:id,
:id_number_provided,
:id_number_secondary_provided,
:last_name,
:last_name_kana,
:last_name_kanji,
:maiden_name,
:metadata,
:nationality,
:object,
:phone,
:political_exposure,
:registered_address,
:relationship,
:requirements,
:ssn_last_4_provided,
:verification
]
@typedoc "The `person` type.\n\n * `account` The account the person is associated with.\n * `additional_tos_acceptances` \n * `address` \n * `address_kana` The Kana variation of the person's address (Japan only).\n * `address_kanji` The Kanji variation of the person's address (Japan only).\n * `created` Time at which the object was created. Measured in seconds since the Unix epoch.\n * `dob` \n * `email` The person's email address.\n * `first_name` The person's first name.\n * `first_name_kana` The Kana variation of the person's first name (Japan only).\n * `first_name_kanji` The Kanji variation of the person's first name (Japan only).\n * `full_name_aliases` A list of alternate names or aliases that the person is known by.\n * `future_requirements` Information about the [upcoming new requirements for this person](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when.\n * `gender` The person's gender (International regulations require either \"male\" or \"female\").\n * `id` Unique identifier for the object.\n * `id_number_provided` Whether the person's `id_number` was provided. True if either the full ID number was provided or if only the required part of the ID number was provided (ex. last four of an individual's SSN for the US indicated by `ssn_last_4_provided`).\n * `id_number_secondary_provided` Whether the person's `id_number_secondary` was provided.\n * `last_name` The person's last name.\n * `last_name_kana` The Kana variation of the person's last name (Japan only).\n * `last_name_kanji` The Kanji variation of the person's last name (Japan only).\n * `maiden_name` The person's maiden name.\n * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.\n * `nationality` The country where the person is a national.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `phone` The person's phone number.\n * `political_exposure` Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.\n * `registered_address` \n * `relationship` \n * `requirements` Information about the requirements for this person, including what information needs to be collected, and by when.\n * `ssn_last_4_provided` Whether the last four digits of the person's Social Security number have been provided (U.S. only).\n * `verification` \n"
@type t :: %__MODULE__{
account: binary,
additional_tos_acceptances: term,
address: term,
address_kana: term | nil,
address_kanji: term | nil,
created: integer,
dob: term,
email: binary | nil,
first_name: binary | nil,
first_name_kana: binary | nil,
first_name_kanji: binary | nil,
full_name_aliases: term,
future_requirements: term | nil,
gender: binary | nil,
id: binary,
id_number_provided: boolean,
id_number_secondary_provided: boolean,
last_name: binary | nil,
last_name_kana: binary | nil,
last_name_kanji: binary | nil,
maiden_name: binary | nil,
metadata: term,
nationality: binary | nil,
object: binary,
phone: binary | nil,
political_exposure: binary,
registered_address: term,
relationship: term,
requirements: term | nil,
ssn_last_4_provided: boolean,
verification: term
}
)
(
@typedoc "Details on the legal guardian's acceptance of the main Stripe service agreement."
@type account :: %{
optional(:date) => integer,
optional(:ip) => binary,
optional(:user_agent) => binary | binary
}
)
(
@typedoc "A document showing address, either a passport, local ID card, or utility bill from a well-known utility company."
@type additional_document :: %{optional(:back) => binary, optional(:front) => binary}
)
(
@typedoc "Details on the legal guardian's acceptance of the required Stripe agreements."
@type additional_tos_acceptances :: %{optional(:account) => account}
)
(
@typedoc "The person's address."
@type address :: %{
optional(:city) => binary,
optional(:country) => binary,
optional(:line1) => binary,
optional(:line2) => binary,
optional(:postal_code) => binary,
optional(:state) => binary
}
)
(
@typedoc "The Kana variation of the person's address (Japan only)."
@type address_kana :: %{
optional(:city) => binary,
optional(:country) => binary,
optional(:line1) => binary,
optional(:line2) => binary,
optional(:postal_code) => binary,
optional(:state) => binary,
optional(:town) => binary
}
)
(
@typedoc "The Kanji variation of the person's address (Japan only)."
@type address_kanji :: %{
optional(:city) => binary,
optional(:country) => binary,
optional(:line1) => binary,
optional(:line2) => binary,
optional(:postal_code) => binary,
optional(:state) => binary,
optional(:town) => binary
}
)
(
@typedoc "One or more documents that demonstrate proof that this person is authorized to represent the company."
@type company_authorization :: %{optional(:files) => list(binary | binary)}
)
(
@typedoc nil
@type dob :: %{
optional(:day) => integer,
optional(:month) => integer,
optional(:year) => integer
}
)
(
@typedoc "An identifying document, either a passport or local ID card."
@type document :: %{optional(:back) => binary, optional(:front) => binary}
)
(
@typedoc "Documents that may be submitted to satisfy various informational requests."
@type documents :: %{
optional(:company_authorization) => company_authorization,
optional(:passport) => passport,
optional(:visa) => visa
}
)
(
@typedoc "One or more documents showing the person's passport page with photo and personal data."
@type passport :: %{optional(:files) => list(binary | binary)}
)
(
@typedoc "The person's registered address."
@type registered_address :: %{
optional(:city) => binary,
optional(:country) => binary,
optional(:line1) => binary,
optional(:line2) => binary,
optional(:postal_code) => binary,
optional(:state) => binary
}
)
(
@typedoc nil
@type relationship :: %{
optional(:director) => boolean,
optional(:executive) => boolean,
optional(:legal_guardian) => boolean,
optional(:owner) => boolean,
optional(:representative) => boolean
}
)
(
@typedoc "The person's verification status."
@type verification :: %{
optional(:additional_document) => additional_document,
optional(:document) => document
}
)
(
@typedoc "One or more documents showing the person's visa required for living in the country where they are residing."
@type visa :: %{optional(:files) => list(binary | binary)}
)
(
nil
@doc "<p>Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/accounts/{account}/persons`\n"
(
@spec list(
account :: binary(),
params :: %{
optional(:ending_before) => binary,
optional(:expand) => list(binary),
optional(:limit) => integer,
optional(:relationship) => relationship,
optional(:starting_after) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.List.t(Stripe.Person.t())}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def list(account, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/persons",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Retrieves an existing person.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/accounts/{account}/persons/{person}`\n"
(
@spec retrieve(
account :: binary(),
person :: binary(),
params :: %{optional(:expand) => list(binary)},
opts :: Keyword.t()
) :: {:ok, Stripe.Person.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def retrieve(account, person, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/persons/{person}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
},
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "person",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "person",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account, person]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Creates a new person.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/accounts/{account}/persons`\n"
(
@spec create(
account :: binary(),
params :: %{
optional(:additional_tos_acceptances) => additional_tos_acceptances,
optional(:address) => address,
optional(:address_kana) => address_kana,
optional(:address_kanji) => address_kanji,
optional(:dob) => dob | binary,
optional(:documents) => documents,
optional(:email) => binary,
optional(:expand) => list(binary),
optional(:first_name) => binary,
optional(:first_name_kana) => binary,
optional(:first_name_kanji) => binary,
optional(:full_name_aliases) => list(binary) | binary,
optional(:gender) => binary,
optional(:id_number) => binary,
optional(:id_number_secondary) => binary,
optional(:last_name) => binary,
optional(:last_name_kana) => binary,
optional(:last_name_kanji) => binary,
optional(:maiden_name) => binary,
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:nationality) => binary,
optional(:person_token) => binary,
optional(:phone) => binary,
optional(:political_exposure) => binary,
optional(:registered_address) => registered_address,
optional(:relationship) => relationship,
optional(:ssn_last_4) => binary,
optional(:verification) => verification
},
opts :: Keyword.t()
) :: {:ok, Stripe.Person.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def create(account, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/persons",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Updates an existing person.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/accounts/{account}/persons/{person}`\n"
(
@spec update(
account :: binary(),
person :: binary(),
params :: %{
optional(:additional_tos_acceptances) => additional_tos_acceptances,
optional(:address) => address,
optional(:address_kana) => address_kana,
optional(:address_kanji) => address_kanji,
optional(:dob) => dob | binary,
optional(:documents) => documents,
optional(:email) => binary,
optional(:expand) => list(binary),
optional(:first_name) => binary,
optional(:first_name_kana) => binary,
optional(:first_name_kanji) => binary,
optional(:full_name_aliases) => list(binary) | binary,
optional(:gender) => binary,
optional(:id_number) => binary,
optional(:id_number_secondary) => binary,
optional(:last_name) => binary,
optional(:last_name_kana) => binary,
optional(:last_name_kanji) => binary,
optional(:maiden_name) => binary,
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:nationality) => binary,
optional(:person_token) => binary,
optional(:phone) => binary,
optional(:political_exposure) => binary,
optional(:registered_address) => registered_address,
optional(:relationship) => relationship,
optional(:ssn_last_4) => binary,
optional(:verification) => verification
},
opts :: Keyword.t()
) :: {:ok, Stripe.Person.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def update(account, person, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/persons/{person}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
},
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "person",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "person",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account, person]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Deletes an existing person’s relationship to the account’s legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the <code>account_opener</code>. If your integration is using the <code>executive</code> parameter, you cannot delete the only verified <code>executive</code> on file.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/accounts/{account}/persons/{person}`\n"
(
@spec delete(account :: binary(), person :: binary(), opts :: Keyword.t()) ::
{:ok, Stripe.DeletedPerson.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def delete(account, person, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/persons/{person}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
},
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "person",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "person",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account, person]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_method(:delete)
|> Stripe.Request.make_request()
end
)
)
end