-
Notifications
You must be signed in to change notification settings - Fork 4
/
account_holders.py
1924 lines (1647 loc) · 85.2 KB
/
account_holders.py
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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import List, Union, Iterable
from datetime import datetime
from typing_extensions import Literal, overload
import httpx
from .. import _legacy_response
from ..types import (
account_holder_list_params,
account_holder_create_params,
account_holder_update_params,
account_holder_resubmit_params,
account_holder_upload_document_params,
account_holder_simulate_enrollment_review_params,
account_holder_simulate_enrollment_document_review_params,
)
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
is_given,
required_args,
maybe_transform,
async_maybe_transform,
)
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from .._constants import DEFAULT_TIMEOUT
from ..pagination import SyncSinglePage, AsyncSinglePage
from .._base_client import AsyncPaginator, make_request_options
from ..types.account_holder import AccountHolder
from ..types.shared.document import Document
from ..types.shared_params.address import Address
from ..types.account_holder_create_response import AccountHolderCreateResponse
from ..types.account_holder_update_response import AccountHolderUpdateResponse
from ..types.account_holder_list_documents_response import AccountHolderListDocumentsResponse
from ..types.account_holder_simulate_enrollment_review_response import AccountHolderSimulateEnrollmentReviewResponse
__all__ = ["AccountHolders", "AsyncAccountHolders"]
class AccountHolders(SyncAPIResource):
@cached_property
def with_raw_response(self) -> AccountHoldersWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.
For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers
"""
return AccountHoldersWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AccountHoldersWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/lithic-com/lithic-python#with_streaming_response
"""
return AccountHoldersWithStreamingResponse(self)
@overload
def create(
self,
*,
beneficial_owner_entities: Iterable[account_holder_create_params.KYBBeneficialOwnerEntity],
beneficial_owner_individuals: Iterable[account_holder_create_params.KYBBeneficialOwnerIndividual],
business_entity: account_holder_create_params.KYBBusinessEntity,
control_person: account_holder_create_params.KYBControlPerson,
nature_of_business: str,
tos_timestamp: str,
workflow: Literal["KYB_BASIC", "KYB_BYO"],
external_id: str | NotGiven = NOT_GIVEN,
kyb_passed_timestamp: str | NotGiven = NOT_GIVEN,
website_url: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderCreateResponse:
"""
Run an individual or business's information through the Customer Identification
Program (CIP). All calls to this endpoint will return an immediate response -
though in some cases, the response may indicate the enrollment is under review
or further action will be needed to complete the account enrollment process.
This endpoint can only be used on accounts that are part of the program that the
calling API key manages.
Args:
beneficial_owner_entities: List of all entities with >25% ownership in the company. If no entity or
individual owns >25% of the company, and the largest shareholder is an entity,
please identify them in this field. See
[FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
(Section I) for more background. If no business owner is an entity, pass in an
empty list. However, either this parameter or `beneficial_owner_individuals`
must be populated. on entities that should be included.
beneficial_owner_individuals: List of all direct and indirect individuals with >25% ownership in the company.
If no entity or individual owns >25% of the company, and the largest shareholder
is an individual, please identify them in this field. See
[FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
(Section I) for more background on individuals that should be included. If no
individual is an entity, pass in an empty list. However, either this parameter
or `beneficial_owner_entities` must be populated.
business_entity: Information for business for which the account is being opened and KYB is being
run.
control_person: An individual with significant responsibility for managing the legal entity
(e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating
Officer, Managing Member, General Partner, President, Vice President, or
Treasurer). This can be an executive, or someone who will have program-wide
access to the cards that Lithic will provide. In some cases, this individual
could also be a beneficial owner listed above. See
[FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
(Section II) for more background.
nature_of_business: Short description of the company's line of business (i.e., what does the company
do?).
tos_timestamp: An RFC 3339 timestamp indicating when the account holder accepted the applicable
legal agreements (e.g., cardholder terms) as agreed upon during API customer's
implementation with Lithic.
workflow: Specifies the type of KYB workflow to run.
external_id: A user provided id that can be used to link an account holder with an external
system
kyb_passed_timestamp: An RFC 3339 timestamp indicating when precomputed KYC was completed on the
business with a pass result.
This field is required only if workflow type is `KYB_BYO`.
website_url: Company website URL.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
...
@overload
def create(
self,
*,
individual: account_holder_create_params.KYCIndividual,
tos_timestamp: str,
workflow: Literal["KYC_ADVANCED", "KYC_BASIC", "KYC_BYO"],
external_id: str | NotGiven = NOT_GIVEN,
kyc_passed_timestamp: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderCreateResponse:
"""
Run an individual or business's information through the Customer Identification
Program (CIP). All calls to this endpoint will return an immediate response -
though in some cases, the response may indicate the enrollment is under review
or further action will be needed to complete the account enrollment process.
This endpoint can only be used on accounts that are part of the program that the
calling API key manages.
Args:
individual: Information on individual for whom the account is being opened and KYC is being
run.
tos_timestamp: An RFC 3339 timestamp indicating when the account holder accepted the applicable
legal agreements (e.g., cardholder terms) as agreed upon during API customer's
implementation with Lithic.
workflow: Specifies the type of KYC workflow to run.
external_id: A user provided id that can be used to link an account holder with an external
system
kyc_passed_timestamp: An RFC 3339 timestamp indicating when precomputed KYC was completed on the
individual with a pass result.
This field is required only if workflow type is `KYC_BYO`.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
...
@overload
def create(
self,
*,
address: Address,
email: str,
first_name: str,
kyc_exemption_type: Literal["AUTHORIZED_USER", "PREPAID_CARD_USER"],
last_name: str,
phone_number: str,
workflow: Literal["KYC_EXEMPT"],
business_account_token: str | NotGiven = NOT_GIVEN,
external_id: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderCreateResponse:
"""
Run an individual or business's information through the Customer Identification
Program (CIP). All calls to this endpoint will return an immediate response -
though in some cases, the response may indicate the enrollment is under review
or further action will be needed to complete the account enrollment process.
This endpoint can only be used on accounts that are part of the program that the
calling API key manages.
Args:
address: KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not
acceptable; APO/FPO are acceptable.
email: The KYC Exempt user's email
first_name: The KYC Exempt user's first name
kyc_exemption_type: Specifies the type of KYC Exempt user
last_name: The KYC Exempt user's last name
phone_number: The KYC Exempt user's phone number
workflow: Specifies the workflow type. This must be 'KYC_EXEMPT'
business_account_token: Only applicable for customers using the KYC-Exempt workflow to enroll authorized
users of businesses. Pass the account_token of the enrolled business associated
with the AUTHORIZED_USER in this field.
external_id: A user provided id that can be used to link an account holder with an external
system
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
...
@required_args(
[
"beneficial_owner_entities",
"beneficial_owner_individuals",
"business_entity",
"control_person",
"nature_of_business",
"tos_timestamp",
"workflow",
],
["individual", "tos_timestamp", "workflow"],
["address", "email", "first_name", "kyc_exemption_type", "last_name", "phone_number", "workflow"],
)
def create(
self,
*,
beneficial_owner_entities: Iterable[account_holder_create_params.KYBBeneficialOwnerEntity]
| NotGiven = NOT_GIVEN,
beneficial_owner_individuals: Iterable[account_holder_create_params.KYBBeneficialOwnerIndividual]
| NotGiven = NOT_GIVEN,
business_entity: account_holder_create_params.KYBBusinessEntity | NotGiven = NOT_GIVEN,
control_person: account_holder_create_params.KYBControlPerson | NotGiven = NOT_GIVEN,
nature_of_business: str | NotGiven = NOT_GIVEN,
tos_timestamp: str | NotGiven = NOT_GIVEN,
workflow: Literal["KYB_BASIC", "KYB_BYO"]
| Literal["KYC_ADVANCED", "KYC_BASIC", "KYC_BYO"]
| Literal["KYC_EXEMPT"],
external_id: str | NotGiven = NOT_GIVEN,
kyb_passed_timestamp: str | NotGiven = NOT_GIVEN,
website_url: str | NotGiven = NOT_GIVEN,
individual: account_holder_create_params.KYCIndividual | NotGiven = NOT_GIVEN,
kyc_passed_timestamp: str | NotGiven = NOT_GIVEN,
address: Address | NotGiven = NOT_GIVEN,
email: str | NotGiven = NOT_GIVEN,
first_name: str | NotGiven = NOT_GIVEN,
kyc_exemption_type: Literal["AUTHORIZED_USER", "PREPAID_CARD_USER"] | NotGiven = NOT_GIVEN,
last_name: str | NotGiven = NOT_GIVEN,
phone_number: str | NotGiven = NOT_GIVEN,
business_account_token: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderCreateResponse:
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
timeout = 300
return self._post(
"/v1/account_holders",
body=maybe_transform(
{
"beneficial_owner_entities": beneficial_owner_entities,
"beneficial_owner_individuals": beneficial_owner_individuals,
"business_entity": business_entity,
"control_person": control_person,
"nature_of_business": nature_of_business,
"tos_timestamp": tos_timestamp,
"workflow": workflow,
"external_id": external_id,
"kyb_passed_timestamp": kyb_passed_timestamp,
"website_url": website_url,
"individual": individual,
"kyc_passed_timestamp": kyc_passed_timestamp,
"address": address,
"email": email,
"first_name": first_name,
"kyc_exemption_type": kyc_exemption_type,
"last_name": last_name,
"phone_number": phone_number,
"business_account_token": business_account_token,
},
account_holder_create_params.AccountHolderCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AccountHolderCreateResponse,
)
def retrieve(
self,
account_holder_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolder:
"""
Get an Individual or Business Account Holder and/or their KYC or KYB evaluation
status.
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_holder_token:
raise ValueError(
f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}"
)
return self._get(
f"/v1/account_holders/{account_holder_token}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AccountHolder,
)
def update(
self,
account_holder_token: str,
*,
business_account_token: str | NotGiven = NOT_GIVEN,
email: str | NotGiven = NOT_GIVEN,
phone_number: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderUpdateResponse:
"""
Update the information associated with a particular account holder.
Args:
business_account_token: Only applicable for customers using the KYC-Exempt workflow to enroll authorized
users of businesses. Pass the account_token of the enrolled business associated
with the AUTHORIZED_USER in this field.
email: Account holder's email address. The primary purpose of this field is for
cardholder identification and verification during the digital wallet
tokenization process.
phone_number: Account holder's phone number, entered in E.164 format. The primary purpose of
this field is for cardholder identification and verification during the digital
wallet tokenization process.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_holder_token:
raise ValueError(
f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}"
)
return self._patch(
f"/v1/account_holders/{account_holder_token}",
body=maybe_transform(
{
"business_account_token": business_account_token,
"email": email,
"phone_number": phone_number,
},
account_holder_update_params.AccountHolderUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AccountHolderUpdateResponse,
)
def list(
self,
*,
begin: Union[str, datetime] | NotGiven = NOT_GIVEN,
email: str | NotGiven = NOT_GIVEN,
end: Union[str, datetime] | NotGiven = NOT_GIVEN,
ending_before: str | NotGiven = NOT_GIVEN,
external_id: str | NotGiven = NOT_GIVEN,
first_name: str | NotGiven = NOT_GIVEN,
last_name: str | NotGiven = NOT_GIVEN,
legal_business_name: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
phone_number: str | NotGiven = NOT_GIVEN,
starting_after: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[AccountHolder]:
"""
Get a list of individual or business account holders and their KYC or KYB
evaluation status.
Args:
begin: Date string in RFC 3339 format. Only entries created after the specified time
will be included. UTC time zone.
email: Email address of the account holder. The query must be an exact match, case
insensitive.
end: Date string in RFC 3339 format. Only entries created before the specified time
will be included. UTC time zone.
ending_before: A cursor representing an item's token before which a page of results should end.
Used to retrieve the previous page of results before this item.
external_id: If applicable, represents the external_id associated with the account_holder.
first_name: (Individual Account Holders only) The first name of the account holder. The
query is case insensitive and supports partial matches.
last_name: (Individual Account Holders only) The last name of the account holder. The query
is case insensitive and supports partial matches.
legal_business_name: (Business Account Holders only) The legal business name of the account holder.
The query is case insensitive and supports partial matches.
limit: The number of account_holders to limit the response to.
phone_number: Phone number of the account holder. The query must be an exact match.
starting_after: A cursor representing an item's token after which a page of results should
begin. Used to retrieve the next page of results after this item.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
"/v1/account_holders",
page=SyncSinglePage[AccountHolder],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"begin": begin,
"email": email,
"end": end,
"ending_before": ending_before,
"external_id": external_id,
"first_name": first_name,
"last_name": last_name,
"legal_business_name": legal_business_name,
"limit": limit,
"phone_number": phone_number,
"starting_after": starting_after,
},
account_holder_list_params.AccountHolderListParams,
),
),
model=AccountHolder,
)
def list_documents(
self,
account_holder_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderListDocumentsResponse:
"""
Retrieve the status of account holder document uploads, or retrieve the upload
URLs to process your image uploads.
Note that this is not equivalent to checking the status of the KYC evaluation
overall (a document may be successfully uploaded but not be sufficient for KYC
to pass).
In the event your upload URLs have expired, calling this endpoint will refresh
them. Similarly, in the event a previous account holder document upload has
failed, you can use this endpoint to get a new upload URL for the failed image
upload.
When a new document upload is generated for a failed attempt, the response will
show an additional entry in the `required_document_uploads` list in a `PENDING`
state for the corresponding `image_type`.
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_holder_token:
raise ValueError(
f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}"
)
return self._get(
f"/v1/account_holders/{account_holder_token}/documents",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AccountHolderListDocumentsResponse,
)
def resubmit(
self,
account_holder_token: str,
*,
individual: account_holder_resubmit_params.Individual,
tos_timestamp: str,
workflow: Literal["KYC_ADVANCED"],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolder:
"""Resubmit a KYC submission.
This endpoint should be used in cases where a KYC
submission returned a `PENDING_RESUBMIT` result, meaning one or more critical
KYC fields may have been mis-entered and the individual's identity has not yet
been successfully verified. This step must be completed in order to proceed with
the KYC evaluation.
Two resubmission attempts are permitted via this endpoint before a `REJECTED`
status is returned and the account creation process is ended.
Args:
individual: Information on individual for whom the account is being opened and KYC is being
re-run.
tos_timestamp: An RFC 3339 timestamp indicating when the account holder accepted the applicable
legal agreements (e.g., cardholder terms) as agreed upon during API customer's
implementation with Lithic.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_holder_token:
raise ValueError(
f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}"
)
return self._post(
f"/v1/account_holders/{account_holder_token}/resubmit",
body=maybe_transform(
{
"individual": individual,
"tos_timestamp": tos_timestamp,
"workflow": workflow,
},
account_holder_resubmit_params.AccountHolderResubmitParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AccountHolder,
)
def retrieve_document(
self,
document_token: str,
*,
account_holder_token: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Document:
"""
Check the status of an account holder document upload, or retrieve the upload
URLs to process your image uploads.
Note that this is not equivalent to checking the status of the KYC evaluation
overall (a document may be successfully uploaded but not be sufficient for KYC
to pass).
In the event your upload URLs have expired, calling this endpoint will refresh
them. Similarly, in the event a document upload has failed, you can use this
endpoint to get a new upload URL for the failed image upload.
When a new account holder document upload is generated for a failed attempt, the
response will show an additional entry in the `required_document_uploads` array
in a `PENDING` state for the corresponding `image_type`.
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_holder_token:
raise ValueError(
f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}"
)
if not document_token:
raise ValueError(f"Expected a non-empty value for `document_token` but received {document_token!r}")
return self._get(
f"/v1/account_holders/{account_holder_token}/documents/{document_token}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Document,
)
def simulate_enrollment_document_review(
self,
*,
document_upload_token: str,
status: Literal["UPLOADED", "ACCEPTED", "REJECTED", "PARTIAL_APPROVAL"],
accepted_entity_status_reasons: List[str] | NotGiven = NOT_GIVEN,
status_reason: Literal[
"DOCUMENT_MISSING_REQUIRED_DATA",
"DOCUMENT_UPLOAD_TOO_BLURRY",
"FILE_SIZE_TOO_LARGE",
"INVALID_DOCUMENT_TYPE",
"INVALID_DOCUMENT_UPLOAD",
"INVALID_ENTITY",
"DOCUMENT_EXPIRED",
"DOCUMENT_ISSUED_GREATER_THAN_30_DAYS",
"DOCUMENT_TYPE_NOT_SUPPORTED",
"UNKNOWN_FAILURE_REASON",
"UNKNOWN_ERROR",
]
| NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Document:
"""
Simulates a review for an account holder document upload.
Args:
document_upload_token: The account holder document upload which to perform the simulation upon.
status: An account holder document's upload status for use within the simulation.
accepted_entity_status_reasons: A list of status reasons associated with a KYB account holder in PENDING_REVIEW
status_reason: Status reason that will be associated with the simulated account holder status.
Only required for a `REJECTED` status or `PARTIAL_APPROVAL` status.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/v1/simulate/account_holders/enrollment_document_review",
body=maybe_transform(
{
"document_upload_token": document_upload_token,
"status": status,
"accepted_entity_status_reasons": accepted_entity_status_reasons,
"status_reason": status_reason,
},
account_holder_simulate_enrollment_document_review_params.AccountHolderSimulateEnrollmentDocumentReviewParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Document,
)
def simulate_enrollment_review(
self,
*,
account_holder_token: str | NotGiven = NOT_GIVEN,
status: Literal["ACCEPTED", "REJECTED"] | NotGiven = NOT_GIVEN,
status_reasons: List[
Literal[
"PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE",
"PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE",
"PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE",
"PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED",
"PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE",
"PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED",
"PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE",
"PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE",
"PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE",
"CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE",
"CONTROL_PERSON_ID_VERIFICATION_FAILURE",
"CONTROL_PERSON_DOB_VERIFICATION_FAILURE",
"CONTROL_PERSON_NAME_VERIFICATION_FAILURE",
"BENEFICIAL_OWNER_INDIVIDUAL_DOB_VERIFICATION_FAILURE",
"BENEFICIAL_OWNER_INDIVIDUAL_BLOCKLIST_ALERT_FAILURE",
"BENEFICIAL_OWNER_INDIVIDUAL_ID_VERIFICATION_FAILURE",
"BENEFICIAL_OWNER_INDIVIDUAL_NAME_VERIFICATION_FAILURE",
]
]
| NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderSimulateEnrollmentReviewResponse:
"""Simulates an enrollment review for an account holder.
This endpoint is only
applicable for workflows that may required intervention such as `KYB_BASIC` or
`KYC_ADVANCED`.
Args:
account_holder_token: The account holder which to perform the simulation upon.
status: An account holder's status for use within the simulation.
status_reasons: Status reason that will be associated with the simulated account holder status.
Only required for a `REJECTED` status.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/v1/simulate/account_holders/enrollment_review",
body=maybe_transform(
{
"account_holder_token": account_holder_token,
"status": status,
"status_reasons": status_reasons,
},
account_holder_simulate_enrollment_review_params.AccountHolderSimulateEnrollmentReviewParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AccountHolderSimulateEnrollmentReviewResponse,
)
def upload_document(
self,
account_holder_token: str,
*,
document_type: Literal[
"EIN_LETTER",
"TAX_RETURN",
"OPERATING_AGREEMENT",
"CERTIFICATE_OF_FORMATION",
"DRIVERS_LICENSE",
"PASSPORT",
"PASSPORT_CARD",
"CERTIFICATE_OF_GOOD_STANDING",
"ARTICLES_OF_INCORPORATION",
"ARTICLES_OF_ORGANIZATION",
"BYLAWS",
"GOVERNMENT_BUSINESS_LICENSE",
"PARTNERSHIP_AGREEMENT",
"SS4_FORM",
"BANK_STATEMENT",
"UTILITY_BILL_STATEMENT",
"SSN_CARD",
"ITIN_LETTER",
],
entity_token: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Document:
"""
Use this endpoint to identify which type of supported government-issued
documentation you will upload for further verification. It will return two URLs
to upload your document images to - one for the front image and one for the back
image.
This endpoint is only valid for evaluations in a `PENDING_DOCUMENT` state.
Uploaded images must either be a `jpg` or `png` file, and each must be less than
15 MiB. Once both required uploads have been successfully completed, your
document will be run through KYC verification.
If you have registered a webhook, you will receive evaluation updates for any
document submission evaluations, as well as for any failed document uploads.
Two document submission attempts are permitted via this endpoint before a
`REJECTED` status is returned and the account creation process is ended.
Currently only one type of account holder document is supported per KYC
verification.
Args:
document_type: The type of document to upload
entity_token: Globally unique identifier for the entity.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_holder_token:
raise ValueError(
f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}"
)
return self._post(
f"/v1/account_holders/{account_holder_token}/documents",
body=maybe_transform(
{
"document_type": document_type,
"entity_token": entity_token,
},
account_holder_upload_document_params.AccountHolderUploadDocumentParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Document,
)
class AsyncAccountHolders(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAccountHoldersWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.
For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers
"""
return AsyncAccountHoldersWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AsyncAccountHoldersWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/lithic-com/lithic-python#with_streaming_response
"""
return AsyncAccountHoldersWithStreamingResponse(self)
@overload
async def create(
self,
*,
beneficial_owner_entities: Iterable[account_holder_create_params.KYBBeneficialOwnerEntity],
beneficial_owner_individuals: Iterable[account_holder_create_params.KYBBeneficialOwnerIndividual],
business_entity: account_holder_create_params.KYBBusinessEntity,
control_person: account_holder_create_params.KYBControlPerson,
nature_of_business: str,
tos_timestamp: str,
workflow: Literal["KYB_BASIC", "KYB_BYO"],
external_id: str | NotGiven = NOT_GIVEN,
kyb_passed_timestamp: str | NotGiven = NOT_GIVEN,
website_url: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountHolderCreateResponse:
"""
Run an individual or business's information through the Customer Identification
Program (CIP). All calls to this endpoint will return an immediate response -
though in some cases, the response may indicate the enrollment is under review
or further action will be needed to complete the account enrollment process.
This endpoint can only be used on accounts that are part of the program that the
calling API key manages.
Args:
beneficial_owner_entities: List of all entities with >25% ownership in the company. If no entity or
individual owns >25% of the company, and the largest shareholder is an entity,
please identify them in this field. See
[FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
(Section I) for more background. If no business owner is an entity, pass in an
empty list. However, either this parameter or `beneficial_owner_individuals`
must be populated. on entities that should be included.
beneficial_owner_individuals: List of all direct and indirect individuals with >25% ownership in the company.
If no entity or individual owns >25% of the company, and the largest shareholder
is an individual, please identify them in this field. See
[FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
(Section I) for more background on individuals that should be included. If no
individual is an entity, pass in an empty list. However, either this parameter
or `beneficial_owner_entities` must be populated.
business_entity: Information for business for which the account is being opened and KYB is being
run.
control_person: An individual with significant responsibility for managing the legal entity
(e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating
Officer, Managing Member, General Partner, President, Vice President, or
Treasurer). This can be an executive, or someone who will have program-wide
access to the cards that Lithic will provide. In some cases, this individual
could also be a beneficial owner listed above. See
[FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
(Section II) for more background.
nature_of_business: Short description of the company's line of business (i.e., what does the company
do?).
tos_timestamp: An RFC 3339 timestamp indicating when the account holder accepted the applicable
legal agreements (e.g., cardholder terms) as agreed upon during API customer's
implementation with Lithic.
workflow: Specifies the type of KYB workflow to run.