-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_identity.go
989 lines (839 loc) · 39.2 KB
/
api_identity.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
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
/*
Paxos API
<p>Welcome to Paxos APIs. At Paxos, our mission is to enable the movement of any asset, any time, in a trustworthy way. These APIs serve that mission by making it easier than ever for you to directly integrate our product capabilities into your application, leveraging the speed, stability, and security of the Paxos platform.</p> <p>The documentation that follows gives you access to our Crypto Brokerage, Trading, and Exchange products. It includes APIs for market data, orders, and the held rate quote flow.</p> <p>To test in our sandbox environment, <a href=\"https://account.sandbox.paxos.com\" target=\"_blank\">sign up</a> for an account. For more information about Paxos and our APIs, visit <a href=\"https://www.paxos.com/\" target=\"_blank\">Paxos.com</a>.</p>
API version: 2.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package paxos
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
"strings"
"time"
)
// IdentityAPIService IdentityAPI service
type IdentityAPIService service
type ApiCreateIdentityRequest struct {
ctx context.Context
ApiService *IdentityAPIService
createIdentityRequest *CreateIdentityRequest
}
func (r ApiCreateIdentityRequest) CreateIdentityRequest(createIdentityRequest CreateIdentityRequest) ApiCreateIdentityRequest {
r.createIdentityRequest = &createIdentityRequest
return r
}
func (r ApiCreateIdentityRequest) Execute() (*Identity, *http.Response, error) {
return r.ApiService.CreateIdentityExecute(r)
}
/*
CreateIdentity Create Identity
This enables you to create a new identity within the Paxos platform. Depending upon the fields provided, the
identity will either be person or an institution.
- [create person identity](#create-person-identity)
- [create institution identity](#create-institution-identity)
A successful response indicates that the identity has been created. This does not mean that
it has already been processed. You can use the unique ID returned within the response to check
the approval status of the identity.
### Create Person Identity
The Person identity type is used to represent individuals on the platform. Attributes of the Person identity type are recorded in the *person_details* field.
Note that fields not listed below are forbidden in this request.
Field | Notes
---|---
person_details | Required
metadata | Optional
tax_details | Optional
ref_id | Optional
For US based identities, if the `tax_details` attribute is empty, it will be backfilled with the `cip_id` and `cip_id_country` fields from the `person_details` attribute.
For international identities, the `tax_details` attribute must be present.
Currently both `JUMIO` or `PASSTHROUGH` are supported for verification, but only `JUMIO` is enabled by default.
- [create person identity with jumio verification](#automatic-id-verification-with-jumio)
- [create person identity with passthrough verification](#automatic-id-verification-with-passthrough)
#### Automatic ID Verification with Jumio
To use Jumio, you must submit the fields listed below as part of the `person_details` attribute in your request.
Field | Notes
---|---
person_details.verifier_type | Required. Must be `JUMIO`
person_details.verifier_id | Required
person_details.address | Required
Please note that when using this method:
- You must ensure that the identity has already been validated by Jumio before submitting the identity to Paxos.
- You must have previously [set the API credentials for Jumio access](#operation/SetVerifierCredentials).
Paxos will compare the provided information with the information returned from the Jumio API.
In the event that there is a conflict between the submitted data and the data returned from the identity provider,
the information from the identity provider will be preferred.
##### Example Request
<!--indentation does not work in swagger code blocks-->
<pre>
<code>
{
"person_details": {
"verifier_id": "b7b77d82-e6a7-4ae9-9904-36231aedf985",
"verifier_type": "JUMIO",
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1980-01-01",
"cip_id": "111-11-1111",
"cip_id_type": "SSN",
"cip_id_country": "USA",
"nationality": "USA",
"profession": "Engineer",
"country_of_birth": "USA",
"address": {
"country": "USA",
"address1": "1 Example St",
"city": "New York",
"province": "NY",
"zip_code": "10001"
},
"ref_id": "33ece656-eef1-43b5-a851-b6b9099089a5"
}
}
</code>
</pre>
#### Automatic ID Verification with Passthrough
To use Passthrough, Paxos Compliance must first confirm your eligibility.
Once confirmed, you can submit the fields listed below as part of the the `person_details` attribute in your request.
| Field | Notes |
|------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| person_details.verifier_type | Required. Must be `PASSTHROUGH` |
| person_details.passthrough_verifier_type | Required. Specifies the ID Verification provider you originally used |
| person_details.passthrough_verified_at | Required |
| person_details.passthrough_verification_id | Unique identifier for the underlying individual's ID verification record. |
| person_details.passthrough_verification_status | Status of the ID verification indicating whether the identity was approved or denied. |
| person_details.passthrough_verification_fields | List of verification fields used by the external verifier to validate the individual's identity. |
| person_details.address | Required |
Note that the following field is forbidden in the request:
`person_details.verifier_id`
##### Example Request
<!--indentation does not work in swagger code blocks-->
<pre>
<code>
{
"person_details": {
"verifier_type": "PASSTHROUGH",
"passthrough_verifier_type": "JUMIO",
"passthrough_verified_at": "2021-06-16T09:28:14Z",
"passthrough_verification_id": "775300ef-4edb-47b9-8ec4-f45fe3cbf41f",
"passthrough_verification_status": "APPROVED",
"passthrough_verification_fields": ["FULL_LEGAL_NAME", "DATE_OF_BIRTH"]
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1980-01-01",
"cip_id_type": "SSN",
"cip_id": "111-11-1111",
"cip_id_country": "USA",
"nationality": "USA",
"profession": "Engineer",
"country_of_birth": "USA",
"address": {
"country": "USA",
"address1": "1 Example St",
"city": "New York",
"province": "NY",
"zip_code": "10001"
},
"ref_id": "33ece656-eef1-43b5-a851-b6b9099089a5"
}
}
</code>
</pre>
Note that this feature is not yet supported - `customer_due_diligence`.
### Create Institution Identity
Institution identities are used to represent all non-person entities.
Details for institution identity type are recorded in `institution_details`. An institution identity also has `institution_members` associated with it. This defines persons or other entities that have some relationship to the institution.
We support the following types and sub-types of institutions. Note that all institution types listed do share some common validations that can also be found below.
#### Supported Institution Types
institution_type | Supported institution_member roles | Notes
---| ---| ---
`TRUST` | `BENEFICIAL_OWNER`<br>`BENEFICIARY`<br>`GRANTOR`<br>`TRUSTEE` | [See Trusts](#trust-institutions-requirement)
`CORPORATION`<br>`LLC`<br>`PARTNERSHIP` | `ACCOUNT_OPENER`<br>`AUTHORIZED_USER`<br>`BENEFICIAL_OWNER`<br>`MANAGEMENT_CONTROL_PERSON` | [See other Institutions](#institutions-requirement)
#### Industry Type to Institution Subtypes Mapping
institution_sub_type | industry
---| ---
`ACCOMMODATION_FOOD_SERVICES` | Food or Beverage Services
`ADMINISTRATIVE_SUPPORT_WASTE_MANAGEMENT_REMEDIATION_SERVICES` | Administrative and Support Services
`ADULT_ENTERTAINMENT` | Adult Entertainment / Pornography
`AGRICULTURE_FORESTRY_FISHING_HUNTING` | Agriculture
`ARTS_ENTERTAINMENT_RECREATION` | Arts, Entertainment, and Recreation
`AUCTIONS` | Auction Houses / Art Galleries
`AUTOMOBILES` | Automobiles / Automotives
`BLOCKCHAIN` | Blockchain Technology
`CONSTRUCTION` | Construction
`CRYPTO` | Crypto Services and Products (Mining, Exchange, Broker)
`DRUGS` | Illicit Drugs / Drug Paraphernalia
`E_COMMERCE` | E-Commerce
`EDUCATIONAL_SERVICES` | Educational Services
`EXPORT_IMPORT` | Export / Import Companies
`FINANCE_INSURANCE` | Other Financial & Insurance Services (Not Referenced Elsewhere)
`FINANCIAL_INSTITUTION` | Financial Institution
`GAMBLING` | Gaming, Gambling, Casinos, or Sports Betting
`HEALTH_CARE_SOCIAL_ASSISTANCE` | Health Care and Social Assistance
`HEDGE_FUND` | Pooled Investment Vehicle / Investment Fund / Hedge Fund
`INFORMATION` | Information, Communications, and Media
`INSURANCE` | Insurance
`INVESTMENT` | Investment
`MANAGEMENT_OF_COMPANIES_ENTERPRISES` | Management of Companies & Enterprises (Holding Companies)
`MANUFACTURING` | Manufacturing
`MARKET_MAKER` | Market Maker / Proprietary Trading
`MINING` | Oil & Gas
`MONEY_SERVICE_BUSINESS` | Money Services Business / Money Transmitters (including ATMs)
`NON_PROFIT` | Non-Profit, Charity or Political Organizations
`OTHER_SERVICES` | Other
`PRECIOUS_METALS` | Jewelry or Precious Metals (Mining, Transportation, Dealing or Retail)
`PROFESSIONAL_SCIENTIFIC_TECHNICAL_SERVICES` | Professional Services (Consulting, Legal, Accounting, etc.)
`PUBLIC_ADMINISTRATION` | Public or Government Services
`RANSOMWARE` | Ransomware / Facilitators of Ransomware Transactions
`REAL_ESTATE_RENTAL_LEASING` | Real Estate and Rental and Leasing
`REGISTERED_INVESTMENT_ADVISOR` | Registered Investment Advisor
`RETAIL_TRADE` | Retail Trade
`SHELL_BANK` | Shell Banks or Shell Companies
`STO_ISSUER` | Security Token Offering (STO) Issuer
`TRANSPORTATION_WAREHOUSING` | Transportation and Services
`TRAVEL_TRANSPORT` | Travel, Accomodation or Transport
`UTILITIES` | Utilities
`WEAPONS` | Weapons or Arms (Manufacturing, Sales or Transportation)
`WHOLESALE_TRADE` | Wholesale Trade
Notes:
- `INVESTMENT` is only supported by the institution type `TRUST`.
- All other subtypes are only supported by types `CORPORATION`, `LLC` and `PARTNERSHIP`.
#### Prohibited Institution Subtypes
Paxos prohibits certain types of business activity (“Prohibited Businesses”) in accordance with its Compliance policies.
The following non-exhaustive list is representative of the type of activity that Paxos prohibits on its platform.
By creating a Paxos Identity, Paxos customers agree not to use Paxos services in connection with any of the following Prohibited Businesses.
- `ADULT_ENTERTAINMENT`
- `DRUGS`
- `RANSOMWARE`
- `SHELL_BANK`
- `WEAPONS`
#### Shared Validations Across All Institution Types
Field | Notes
---|---
cip_id | One of EIN, REGISTRATION_NUMBER, SSN, ITIN. SSN and ITIN are only supported for passthrough/revocable entities.
tax_details | Automatically populated if the cip_id_type is SSN, ITIN or EIN.
tax_details_not_required | Can be set for non-US institutions where tax details are not required.
metadata | Optional
ref_id | Optional
#### Specifying Institution Members and Their Roles
Field | Notes
---|---
identity_id | Required
roles | Required.
ownership | Optional. Must be between 0 and 100
position | Optional
Note
See supported institution types for details on which roles are supported by which institution type.
#### Fields Required for Trusts
Type | Fields
---|---
Required | name, cip_id, cip_id_type, cip_id_country, institution_type, institution_sub_type, business_address, govt_registration_date
Optional | phone_number, email, incorporation_address, regulation_status, trading_type, listed_exchange, ticker_symbol, parent_institution_name, regulator_jurisdiction, regulator_name, regulator_register_number
Notes
Fields not listed are forbidden in the request. `institution_type` must be set to TRUST. `institution_sub_type` must be set to Investment.
`incorporation_address` is required for Trusts where their cip_id_type is not SSN or ITIN.
##### Example Request for a Trust
<!--indentation does not work in swagger code blocks-->
<pre>
<code>
{
"institution_members": [{
"identity_id": "33ece656-eef1-43b5-a851-b6b9099089a5",
"roles": ["GRANTOR"]
},
{
"identity_id": "44ece656-eef1-43b5-a851-b6b9099089a6",
"roles": ["TRUSTEE"]
}],
"institution_details": {
"name": "Trust A",
"business_address": {
"country": "United States",
"address1": "1 Example St",
"city": "New York",
"province": "NY",
"zip_code": "10001"
},
"email": "[email protected]",
"institution_type": "CORPORATION",
"institution_sub_type": "HEDGE_FUND",
"cip_id": "11-1111111",
"cip_id_type": "EIN",
"cip_id_country": "USA",
"govt_registration_date": "2021-04-14T00:00:00Z",
"incorporation_address": {
"country": "United States",
"address1": "1 Example St",
"city": "New York",
"province": "NY",
"zip_code": "10001"
},
"regulation_status": "US_REGULATED",
"trading_type": "PUBLIC",
"listed_exchange": "NASDAQ",
"ticker_symbol": "ABC",
"regulator_name": "SEC",
"regulator_jurisdiction": "USA",
"regulator_register_number": "111-111111"
}
}
</code>
</pre>
#### Fields Required for Institutions (excluding Trusts and Registered Investment Advisors)
Type | Fields
---|---
Required | name, cip_id, cip_id_type, cip_id_country, institution_type, institution_sub_type, business_address, incorporation_address, govt_registration_date, regulation_status, trading_type
Optional | phone_number, email, listed_exchange, ticker_symbol, parent_institution_name, regulator_jurisdiction, regulator_name, regulator_register_number
#### Creating Financially Regulated Institutions
Please refer to the following table for creating institutions which are financially regulated.
regulation_status | Notes
---|---
US_REGULATED | Institution financially regulated in the US
INTL_REGULATED | Institution financially regulated by an international entity
NON_REGULATED | Non-financially regulated institution
Note that each category of `regulation_status` then has additional validations tied to `trading type` and other required fields.
regulation_status | trading_type | fields required | Notes
---|---|---|---
US_REGULATED | PRIVATE | regulator_name, regulator_jurisdiction, regulator_register_number | Not publicly traded
US_REGULATED | PUBLIC | listed_ exchange, ticker_symbol, regulator_name, regulator_jurisdiction, regulator_register_number | Publicly traded
US_REGULATED | PUBLICLY_TRADED_SUBSIDIARY | listed_exchange, ticker_symbol, regulator_name, regulator_jurisdiction, regulator_register_number, parent_institution_name | Subsidiary of a publicly traded company
INTL_REGULATED | PRIVATE | regulator_name, regulator_jurisdiction, regulator_register_number | Not publicly traded
INTL_REGULATED | PUBLIC | listed_ exchange, ticker_symbol, regulator_name, regulator_jurisdiction, regulator_register_number | Publicly traded
INTL_REGULATED | PUBLICLY_TRADED_SUBSIDIARY | listed_exchange, ticker_symbol, regulator_name, regulator_jurisdiction, regulator_register_number, parent_institution_name | Subsidiary of a publicly traded company
NON_REGULATED | PRIVATE | PRIVATE | Not publicly traded
NON_REGULATED | PUBLIC | listed_exchange, ticker_symbol | Publicly traded
#### Fields required for Registered Investment Advisors (RIA)
RIAs are a special sub-type of Institution. Usage of this sub-type requires prior authorization and approval from Paxos.
Notes
`institution_sub_type` must be set to REGISTERED_INVESTMENT_ADVISOR. The list of required and optional fields below varies slightly from other supported institutions
while certain fields are optional (e.g. trading_type), if they are specified in the request, their input will been validated
Type | Fields
---|---
Required | name, cip_id, cip_id_type, cip_id_country, institution_type, institution_sub_type, business_address, regulation_status, regulator_jurisdiction, regulator_name, regulator_register_number
Optional | phone_number, email, listed_exchange, ticker_symbol, parent_institution_name, incorporation_address, govt_registration_date, trading_type
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiCreateIdentityRequest
*/
func (a *IdentityAPIService) CreateIdentity(ctx context.Context) ApiCreateIdentityRequest {
return ApiCreateIdentityRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return Identity
func (a *IdentityAPIService) CreateIdentityExecute(r ApiCreateIdentityRequest) (*Identity, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *Identity
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityAPIService.CreateIdentity")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/identity/identities"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.createIdentityRequest == nil {
return localVarReturnValue, nil, reportError("createIdentityRequest is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.createIdentityRequest
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 409 {
var v Problem
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetIdentityRequest struct {
ctx context.Context
ApiService *IdentityAPIService
id string
includeDetails *bool
includeInstitutionMembers *bool
}
// query param; details are encrypted, so we do not want to include them by default
func (r ApiGetIdentityRequest) IncludeDetails(includeDetails bool) ApiGetIdentityRequest {
r.includeDetails = &includeDetails
return r
}
// query param; to include institution members for institution identity
func (r ApiGetIdentityRequest) IncludeInstitutionMembers(includeInstitutionMembers bool) ApiGetIdentityRequest {
r.includeInstitutionMembers = &includeInstitutionMembers
return r
}
func (r ApiGetIdentityRequest) Execute() (*Identity, *http.Response, error) {
return r.ApiService.GetIdentityExecute(r)
}
/*
GetIdentity Get Identity
Get an identity by ID. By default, the identity details (person_details or institution_details) will not be returned.
Set `?include_details=true` to receive them in the response. For institution type identities,
members will not be returned in the default response. Set `?include_institution_members=true` to get the members.
An identity is allowed to transact on the Paxos platform when `summary_status` is `"APPROVED"`.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id id associated with the identity
@return ApiGetIdentityRequest
*/
func (a *IdentityAPIService) GetIdentity(ctx context.Context, id string) ApiGetIdentityRequest {
return ApiGetIdentityRequest{
ApiService: a,
ctx: ctx,
id: id,
}
}
// Execute executes the request
// @return Identity
func (a *IdentityAPIService) GetIdentityExecute(r ApiGetIdentityRequest) (*Identity, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *Identity
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityAPIService.GetIdentity")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/identity/identities/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.includeDetails != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "include_details", r.includeDetails, "")
}
if r.includeInstitutionMembers != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "include_institution_members", r.includeInstitutionMembers, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiListIdentitiesRequest struct {
ctx context.Context
ApiService *IdentityAPIService
summaryStatus *string
createdAtLt *time.Time
createdAtLte *time.Time
createdAtEq *time.Time
createdAtGte *time.Time
createdAtGt *time.Time
updatedAtLt *time.Time
updatedAtLte *time.Time
updatedAtEq *time.Time
updatedAtGte *time.Time
updatedAtGt *time.Time
limit *int32
order *string
orderBy *string
pageCursor *string
identityType *string
}
// Summary Status of the Identity.
func (r ApiListIdentitiesRequest) SummaryStatus(summaryStatus string) ApiListIdentitiesRequest {
r.summaryStatus = &summaryStatus
return r
}
// Include timestamps strictly less than lt. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) CreatedAtLt(createdAtLt time.Time) ApiListIdentitiesRequest {
r.createdAtLt = &createdAtLt
return r
}
// Include timestamps less than or equal to lte. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) CreatedAtLte(createdAtLte time.Time) ApiListIdentitiesRequest {
r.createdAtLte = &createdAtLte
return r
}
// Include timestamps exactly equal to eq. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) CreatedAtEq(createdAtEq time.Time) ApiListIdentitiesRequest {
r.createdAtEq = &createdAtEq
return r
}
// Include timestamps greater than or equal to lte. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) CreatedAtGte(createdAtGte time.Time) ApiListIdentitiesRequest {
r.createdAtGte = &createdAtGte
return r
}
// Include timestamps strictly greater than gt. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) CreatedAtGt(createdAtGt time.Time) ApiListIdentitiesRequest {
r.createdAtGt = &createdAtGt
return r
}
// Include timestamps strictly less than lt. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) UpdatedAtLt(updatedAtLt time.Time) ApiListIdentitiesRequest {
r.updatedAtLt = &updatedAtLt
return r
}
// Include timestamps less than or equal to lte. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) UpdatedAtLte(updatedAtLte time.Time) ApiListIdentitiesRequest {
r.updatedAtLte = &updatedAtLte
return r
}
// Include timestamps exactly equal to eq. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) UpdatedAtEq(updatedAtEq time.Time) ApiListIdentitiesRequest {
r.updatedAtEq = &updatedAtEq
return r
}
// Include timestamps greater than or equal to lte. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) UpdatedAtGte(updatedAtGte time.Time) ApiListIdentitiesRequest {
r.updatedAtGte = &updatedAtGte
return r
}
// Include timestamps strictly greater than gt. RFC3339 format, like `2006-01-02T15:04:05Z`.
func (r ApiListIdentitiesRequest) UpdatedAtGt(updatedAtGt time.Time) ApiListIdentitiesRequest {
r.updatedAtGt = &updatedAtGt
return r
}
// Number of results to return.
func (r ApiListIdentitiesRequest) Limit(limit int32) ApiListIdentitiesRequest {
r.limit = &limit
return r
}
// Return items in ascending (ASC) or descending (DESC) order. Defaults to DESC.
func (r ApiListIdentitiesRequest) Order(order string) ApiListIdentitiesRequest {
r.order = &order
return r
}
// The specific method by which the returned results will be ordered.
func (r ApiListIdentitiesRequest) OrderBy(orderBy string) ApiListIdentitiesRequest {
r.orderBy = &orderBy
return r
}
// Cursor token for fetching the next page.
func (r ApiListIdentitiesRequest) PageCursor(pageCursor string) ApiListIdentitiesRequest {
r.pageCursor = &pageCursor
return r
}
// Optionally filter by Identity type
func (r ApiListIdentitiesRequest) IdentityType(identityType string) ApiListIdentitiesRequest {
r.identityType = &identityType
return r
}
func (r ApiListIdentitiesRequest) Execute() (*ListIdentitiesResponse, *http.Response, error) {
return r.ApiService.ListIdentitiesExecute(r)
}
/*
ListIdentities List Identities
This endpoint enables you to fetch a list of identities that you have created within the Paxos platform. You
can use query parameters to filter the results returned by:
- Summary Status of the Identity
- Date created
- Date updated
Note that this endpoint supports pagination and returns a cursor token for fetching next pages.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiListIdentitiesRequest
*/
func (a *IdentityAPIService) ListIdentities(ctx context.Context) ApiListIdentitiesRequest {
return ApiListIdentitiesRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return ListIdentitiesResponse
func (a *IdentityAPIService) ListIdentitiesExecute(r ApiListIdentitiesRequest) (*ListIdentitiesResponse, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ListIdentitiesResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityAPIService.ListIdentities")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/identity/identities"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.summaryStatus != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "summary_status", r.summaryStatus, "")
}
if r.createdAtLt != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "created_at.lt", r.createdAtLt, "")
}
if r.createdAtLte != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "created_at.lte", r.createdAtLte, "")
}
if r.createdAtEq != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "created_at.eq", r.createdAtEq, "")
}
if r.createdAtGte != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "created_at.gte", r.createdAtGte, "")
}
if r.createdAtGt != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "created_at.gt", r.createdAtGt, "")
}
if r.updatedAtLt != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updated_at.lt", r.updatedAtLt, "")
}
if r.updatedAtLte != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updated_at.lte", r.updatedAtLte, "")
}
if r.updatedAtEq != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updated_at.eq", r.updatedAtEq, "")
}
if r.updatedAtGte != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updated_at.gte", r.updatedAtGte, "")
}
if r.updatedAtGt != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updated_at.gt", r.updatedAtGt, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.order != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "")
}
if r.orderBy != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "order_by", r.orderBy, "")
}
if r.pageCursor != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "page_cursor", r.pageCursor, "")
}
if r.identityType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "identity_type", r.identityType, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiUpdateIdentityRequest struct {
ctx context.Context
ApiService *IdentityAPIService
id string
updateIdentityRequest *UpdateIdentityRequest
}
func (r ApiUpdateIdentityRequest) UpdateIdentityRequest(updateIdentityRequest UpdateIdentityRequest) ApiUpdateIdentityRequest {
r.updateIdentityRequest = &updateIdentityRequest
return r
}
func (r ApiUpdateIdentityRequest) Execute() (*Identity, *http.Response, error) {
return r.ApiService.UpdateIdentityExecute(r)
}
/*
UpdateIdentity Update Identity
This enables you to update an existing identity with new information. Please note that:
- Updating any field other than `set_user_disabled`, `metadata` or `ref_id` will transition the identity to a PENDING status.
This will restrict the identity until it has been re-verified.
- Setting `set_user_disabled` to `true` will disable the identity, limiting its ability to be used within
the Paxos platform.
- Details of the identity can be updated by providing `person_details` or `institution_details` depending upon the type.
- You can add, update or remove tax_details by providing the `tax_details` list. The tax_details will be updated to exactly
comprise the given list
Note: Identity conversion from person to institution type or vice-versa is not permitted.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id
@return ApiUpdateIdentityRequest
*/
func (a *IdentityAPIService) UpdateIdentity(ctx context.Context, id string) ApiUpdateIdentityRequest {
return ApiUpdateIdentityRequest{
ApiService: a,
ctx: ctx,
id: id,
}
}
// Execute executes the request
// @return Identity
func (a *IdentityAPIService) UpdateIdentityExecute(r ApiUpdateIdentityRequest) (*Identity, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPut
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *Identity
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityAPIService.UpdateIdentity")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/identity/identities/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.updateIdentityRequest == nil {
return localVarReturnValue, nil, reportError("updateIdentityRequest is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.updateIdentityRequest
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}