squarefi-bff-api-module 1.36.34 → 1.36.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2930,6 +2930,29 @@ export interface paths {
2930
2930
  "application/json": components["schemas"]["ErrorResponse"];
2931
2931
  };
2932
2932
  };
2933
+ /** @description Card provider refused the top-up during the pre-flight allowance check
2934
+ * (`TOPUP_NOT_ALLOWED` / `TOPUP_AMOUNT_EXCEEDS_VENDOR_LIMIT`). No order
2935
+ * was created and the wallet was not debited.
2936
+ * */
2937
+ 409: {
2938
+ headers: {
2939
+ [name: string]: unknown;
2940
+ };
2941
+ content: {
2942
+ "application/json": components["schemas"]["ErrorResponse"];
2943
+ };
2944
+ };
2945
+ /** @description `TOPUP_CHECK_UNAVAILABLE` — the provider allowance check could not be
2946
+ * completed, so the top-up was refused rather than attempted.
2947
+ * */
2948
+ 503: {
2949
+ headers: {
2950
+ [name: string]: unknown;
2951
+ };
2952
+ content: {
2953
+ "application/json": components["schemas"]["ErrorResponse"];
2954
+ };
2955
+ };
2933
2956
  };
2934
2957
  };
2935
2958
  delete?: never;
@@ -3565,6 +3588,26 @@ export interface paths {
3565
3588
  };
3566
3589
  content?: never;
3567
3590
  };
3591
+ /** @description Conflict - the card provider refused the top-up during the pre-flight
3592
+ * allowance check (no order was created, the wallet was not debited):
3593
+ * - `TOPUP_NOT_ALLOWED` — provider does not allow a top-up for this account
3594
+ * - `TOPUP_AMOUNT_EXCEEDS_VENDOR_LIMIT` — amount is above the provider's cap
3595
+ * */
3596
+ 409: {
3597
+ headers: {
3598
+ [name: string]: unknown;
3599
+ };
3600
+ content?: never;
3601
+ };
3602
+ /** @description `TOPUP_CHECK_UNAVAILABLE` — the provider allowance check could not be
3603
+ * completed, so the top-up was refused rather than attempted. Retry later.
3604
+ * */
3605
+ 503: {
3606
+ headers: {
3607
+ [name: string]: unknown;
3608
+ };
3609
+ content?: never;
3610
+ };
3568
3611
  };
3569
3612
  };
3570
3613
  delete?: never;
@@ -4034,9 +4077,18 @@ export interface paths {
4034
4077
  };
4035
4078
  put?: never;
4036
4079
  /**
4037
- * Create cardholder
4038
- * @description Creates a new cardholder AND registers them at the vendor in one request.
4039
- * The `vendor_id` is resolved automatically from `issuing_program_id`.
4080
+ * Create cardholder draft
4081
+ * @description Creates a cardholder in `DRAFT` status. **No vendor is contacted here** — this is
4082
+ * step 1 of 3. The `vendor_id` is resolved automatically from `issuing_program_id`.
4083
+ *
4084
+ * **The three steps**:
4085
+ * 1. `POST /frontend/issuing/cardholders` — create the draft (this endpoint).
4086
+ * 2. `POST /frontend/issuing/cardholders/{cardholder_id}/documents` — upload the KYC
4087
+ * files as `multipart/form-data`, one request per file or all at once.
4088
+ * 3. `POST /frontend/issuing/cardholders/{cardholder_id}/submit` — register at the
4089
+ * vendor; the cardholder becomes `ACTIVE`.
4090
+ *
4091
+ * A draft cannot hold a card: card creation refuses anything that is not `ACTIVE`.
4040
4092
  *
4041
4093
  * **Authentication**: Bearer token with Authorization header and x-tenant-id header required
4042
4094
  *
@@ -4045,6 +4097,13 @@ export interface paths {
4045
4097
  *
4046
4098
  * **Uniqueness**: `email + wallet_id + issuing_program_id` must be unique (soft-deleted records excluded).
4047
4099
  *
4100
+ * **Two modes**:
4101
+ * - `user_data_id` mode: personal data + KYC documents are seeded from an existing
4102
+ * verified user (approved identity/face verification + Sumsub applicant required).
4103
+ * Manual fields only fill gaps. The Sumsub files are attached to the draft
4104
+ * immediately, so step 2 is usually unnecessary in this mode.
4105
+ * - Manual mode: `first_name`, `last_name`, `email`, `phone` are required.
4106
+ *
4048
4107
  */
4049
4108
  post: {
4050
4109
  parameters: {
@@ -4062,47 +4121,81 @@ export interface paths {
4062
4121
  */
4063
4122
  wallet_id: string;
4064
4123
  /**
4065
- * @description Cardholder's first name
4124
+ * Format: uuid
4125
+ * @description Seed personal data + KYC documents from this verified user (user_data.uuid).
4126
+ * When set, personal fields become optional and only fill gaps.
4127
+ *
4128
+ */
4129
+ user_data_id?: string;
4130
+ /**
4131
+ * @description Cardholder's first name (required in manual mode)
4066
4132
  * @example John
4067
4133
  */
4068
- first_name: string;
4134
+ first_name?: string;
4069
4135
  /**
4070
- * @description Cardholder's last name
4136
+ * @description Cardholder's last name (required in manual mode)
4071
4137
  * @example Doe
4072
4138
  */
4073
- last_name: string;
4139
+ last_name?: string;
4074
4140
  /**
4075
4141
  * Format: email
4076
- * @description Cardholder's email address
4142
+ * @description Cardholder's email address (required in manual mode)
4077
4143
  * @example john.doe@example.com
4078
4144
  */
4079
- email: string;
4145
+ email?: string;
4080
4146
  /**
4081
- * @description Cardholder's phone number in E.164 format (+ followed by 1-15 digits)
4147
+ * @description Cardholder's phone number in E.164 format (required in manual mode)
4082
4148
  * @example +14155552671
4083
4149
  */
4084
- phone: string;
4150
+ phone?: string;
4085
4151
  /**
4086
4152
  * Format: uuid
4087
4153
  * @description Issuing program ID (required). vendor_id is resolved from the program automatically.
4088
4154
  */
4089
4155
  issuing_program_id: string;
4090
- /**
4091
- * Format: uuid
4092
- * @description Sub-account ID (required for balance card vendors)
4093
- */
4094
- sub_account_id?: string;
4095
4156
  /**
4096
4157
  * Format: date
4097
- * @description Cardholder's date of birth
4158
+ * @description Cardholder's date of birth (YYYY-MM-DD)
4098
4159
  * @example 1990-01-15
4099
4160
  */
4100
- date_of_birth?: string;
4161
+ birth_date?: string;
4101
4162
  /**
4102
4163
  * @description Cardholder's nationality as ISO 3166-1 alpha-3 country code
4103
4164
  * @example USA
4104
4165
  */
4105
4166
  nationality?: string;
4167
+ /**
4168
+ * @description Cardholder's gender (required by some vendors)
4169
+ * @enum {string}
4170
+ */
4171
+ gender?: "M" | "F";
4172
+ /**
4173
+ * @description Relationship of the cardholder to the account holder
4174
+ * @enum {string}
4175
+ */
4176
+ cardholder_relationship?: "EMPLOYEE" | "CONTRACTOR";
4177
+ /**
4178
+ * @description Identity document type (KYC vendors)
4179
+ * @enum {string}
4180
+ */
4181
+ gov_id_type?: "passport" | "id_card" | "driving_license";
4182
+ /** @description Identity document number */
4183
+ gov_id_number?: string;
4184
+ /**
4185
+ * @description Issuing country of the identity document (2-3 letter code)
4186
+ * @example USA
4187
+ */
4188
+ gov_id_country?: string;
4189
+ /**
4190
+ * Format: date
4191
+ * @description Identity document issue date (YYYY-MM-DD)
4192
+ */
4193
+ gov_id_issuance_date?: string;
4194
+ /**
4195
+ * Format: date
4196
+ * @description Identity document expiry date (YYYY-MM-DD)
4197
+ */
4198
+ gov_id_expiration_date?: string;
4106
4199
  /** @description Cardholder's address */
4107
4200
  address?: {
4108
4201
  /**
@@ -4128,7 +4221,7 @@ export interface paths {
4128
4221
  };
4129
4222
  };
4130
4223
  responses: {
4131
- /** @description Cardholder created and registered at vendor successfully */
4224
+ /** @description Cardholder draft created (status DRAFT, not yet registered at the vendor) */
4132
4225
  201: {
4133
4226
  headers: {
4134
4227
  [name: string]: unknown;
@@ -4138,7 +4231,7 @@ export interface paths {
4138
4231
  /** @example true */
4139
4232
  success?: boolean;
4140
4233
  data?: components["schemas"]["IssuingCardholder"];
4141
- /** @example Cardholder created successfully */
4234
+ /** @example Cardholder draft created successfully */
4142
4235
  message?: string;
4143
4236
  };
4144
4237
  };
@@ -4352,6 +4445,19 @@ export interface paths {
4352
4445
  * @example USA
4353
4446
  */
4354
4447
  nationality?: string;
4448
+ /** @enum {string} */
4449
+ gender?: "M" | "F";
4450
+ /** @enum {string} */
4451
+ cardholder_relationship?: "EMPLOYEE" | "CONTRACTOR";
4452
+ /** @enum {string} */
4453
+ gov_id_type?: "passport" | "id_card" | "driving_license";
4454
+ gov_id_number?: string;
4455
+ /** @description 2-3 letter uppercase country code */
4456
+ gov_id_country?: string;
4457
+ /** Format: date */
4458
+ gov_id_issuance_date?: string;
4459
+ /** Format: date */
4460
+ gov_id_expiration_date?: string;
4355
4461
  address?: {
4356
4462
  line1?: string;
4357
4463
  line2?: string;
@@ -4404,6 +4510,387 @@ export interface paths {
4404
4510
  };
4405
4511
  trace?: never;
4406
4512
  };
4513
+ "/frontend/issuing/cardholders/{cardholder_id}/submit": {
4514
+ parameters: {
4515
+ query?: never;
4516
+ header?: never;
4517
+ path?: never;
4518
+ cookie?: never;
4519
+ };
4520
+ get?: never;
4521
+ put?: never;
4522
+ /**
4523
+ * Submit cardholder draft
4524
+ * @description Registers a `DRAFT` cardholder at the vendor and flips it to `ACTIVE` — step 3 of the
4525
+ * create flow. The vendor is resolved from the cardholder's issuing program.
4526
+ *
4527
+ * **Dossier check**: the submit is refused with `400
4528
+ * CARDHOLDER_SUBMISSION_INCOMPLETE` while the program's KYC level is not met.
4529
+ * `error.details.missing` lists every field and file still needed (e.g. `gender`,
4530
+ * `documents: selfie`), so the client can complete it and retry.
4531
+ *
4532
+ * **Retryable**: a failed submit leaves the draft untouched. Nothing is rolled back,
4533
+ * and the same endpoint can be called again once the dossier is complete.
4534
+ *
4535
+ * **Idempotency**: submitting an already-active cardholder returns `409
4536
+ * CARDHOLDER_NOT_DRAFT` rather than registering it twice.
4537
+ *
4538
+ * **Authentication**: Bearer token with x-tenant-id header required
4539
+ *
4540
+ * **Access Control**: Cardholder must belong to the user's wallet (admin role)
4541
+ *
4542
+ */
4543
+ post: {
4544
+ parameters: {
4545
+ query: {
4546
+ /** @description Wallet ID for access validation */
4547
+ wallet_id: string;
4548
+ };
4549
+ header?: never;
4550
+ path: {
4551
+ cardholder_id: string;
4552
+ };
4553
+ cookie?: never;
4554
+ };
4555
+ requestBody?: never;
4556
+ responses: {
4557
+ /** @description Cardholder registered at the vendor and activated */
4558
+ 200: {
4559
+ headers: {
4560
+ [name: string]: unknown;
4561
+ };
4562
+ content: {
4563
+ "application/json": {
4564
+ /** @example true */
4565
+ success?: boolean;
4566
+ data?: components["schemas"]["IssuingCardholder"];
4567
+ /** @example Cardholder submitted successfully */
4568
+ message?: string;
4569
+ };
4570
+ };
4571
+ };
4572
+ /** @description KYC dossier incomplete, or the program has no vendor configured */
4573
+ 400: {
4574
+ headers: {
4575
+ [name: string]: unknown;
4576
+ };
4577
+ content: {
4578
+ "application/json": components["schemas"]["ErrorResponse"];
4579
+ };
4580
+ };
4581
+ /** @description Access denied to this cardholder */
4582
+ 403: {
4583
+ headers: {
4584
+ [name: string]: unknown;
4585
+ };
4586
+ content?: never;
4587
+ };
4588
+ /** @description Cardholder not found */
4589
+ 404: {
4590
+ headers: {
4591
+ [name: string]: unknown;
4592
+ };
4593
+ content?: never;
4594
+ };
4595
+ /** @description Cardholder is not a draft (already submitted) */
4596
+ 409: {
4597
+ headers: {
4598
+ [name: string]: unknown;
4599
+ };
4600
+ content?: never;
4601
+ };
4602
+ /** @description Vendor rejected the registration; the draft is kept */
4603
+ 502: {
4604
+ headers: {
4605
+ [name: string]: unknown;
4606
+ };
4607
+ content?: never;
4608
+ };
4609
+ };
4610
+ };
4611
+ delete?: never;
4612
+ options?: never;
4613
+ head?: never;
4614
+ patch?: never;
4615
+ trace?: never;
4616
+ };
4617
+ "/frontend/issuing/cardholder-documents": {
4618
+ parameters: {
4619
+ query?: never;
4620
+ header?: never;
4621
+ path?: never;
4622
+ cookie?: never;
4623
+ };
4624
+ get?: never;
4625
+ put?: never;
4626
+ /**
4627
+ * Upload KYC document files
4628
+ * @description Uploads KYC files against a wallet via `multipart/form-data`, with no
4629
+ * cardholder involved — the upload step of the create flow runs before the
4630
+ * cardholder exists. The form field name is the document type (`selfie`,
4631
+ * `gov_id_front`, `gov_id_back`); one file per type, 5MB max each, formats
4632
+ * png/jpeg/pdf.
4633
+ *
4634
+ * Send one file per request so the UI can show progress per file and retry
4635
+ * a single file. The response returns an `id` per file; pass those ids to
4636
+ * `POST /frontend/issuing/cardholders/{cardholder_id}/documents` to attach
4637
+ * them to a draft.
4638
+ *
4639
+ * Do not set `Content-Type` manually — the browser must add the multipart
4640
+ * boundary itself, and the file has to be appended as a `File`/`Blob`, not
4641
+ * as a name or a base64 string.
4642
+ *
4643
+ * An upload that is never attached is deleted by a cleanup sweep.
4644
+ *
4645
+ * **Authentication**: Bearer token with x-tenant-id header required
4646
+ *
4647
+ * **Access Control**: wallet admin role
4648
+ *
4649
+ */
4650
+ post: {
4651
+ parameters: {
4652
+ query: {
4653
+ /** @description Wallet ID for access validation */
4654
+ wallet_id: string;
4655
+ };
4656
+ header?: never;
4657
+ path?: never;
4658
+ cookie?: never;
4659
+ };
4660
+ requestBody: {
4661
+ content: {
4662
+ "multipart/form-data": {
4663
+ /**
4664
+ * Format: binary
4665
+ * @description Identity photo / selfie
4666
+ */
4667
+ selfie?: string;
4668
+ /**
4669
+ * Format: binary
4670
+ * @description Government ID, front side
4671
+ */
4672
+ gov_id_front?: string;
4673
+ /**
4674
+ * Format: binary
4675
+ * @description Government ID, back side
4676
+ */
4677
+ gov_id_back?: string;
4678
+ };
4679
+ };
4680
+ };
4681
+ responses: {
4682
+ /** @description Files stored; returns one upload per file */
4683
+ 201: {
4684
+ headers: {
4685
+ [name: string]: unknown;
4686
+ };
4687
+ content: {
4688
+ "application/json": {
4689
+ /** @example true */
4690
+ success?: boolean;
4691
+ /** @example Documents uploaded successfully */
4692
+ message?: string;
4693
+ data?: {
4694
+ documents?: {
4695
+ /** Format: uuid */
4696
+ id?: string;
4697
+ /** @enum {string} */
4698
+ type?: "selfie" | "gov_id_front" | "gov_id_back";
4699
+ filename?: string | null;
4700
+ content_type?: string;
4701
+ size?: number;
4702
+ /** Format: date-time */
4703
+ created_at?: string;
4704
+ }[];
4705
+ };
4706
+ };
4707
+ };
4708
+ };
4709
+ /** @description No file parts, unsupported field/type, or a file exceeds 5MB */
4710
+ 400: {
4711
+ headers: {
4712
+ [name: string]: unknown;
4713
+ };
4714
+ content?: never;
4715
+ };
4716
+ /** @description Access denied to this wallet */
4717
+ 403: {
4718
+ headers: {
4719
+ [name: string]: unknown;
4720
+ };
4721
+ content?: never;
4722
+ };
4723
+ };
4724
+ };
4725
+ delete?: never;
4726
+ options?: never;
4727
+ head?: never;
4728
+ patch?: never;
4729
+ trace?: never;
4730
+ };
4731
+ "/frontend/issuing/cardholder-documents/{document_id}": {
4732
+ parameters: {
4733
+ query?: never;
4734
+ header?: never;
4735
+ path?: never;
4736
+ cookie?: never;
4737
+ };
4738
+ get?: never;
4739
+ put?: never;
4740
+ post?: never;
4741
+ /**
4742
+ * Discard an uploaded file
4743
+ * @description Deletes an upload that has not been attached to a cardholder yet — the
4744
+ * "remove this file" action of the upload form. Attached documents are
4745
+ * refused with 409; replace them by attaching a new file of the same type.
4746
+ *
4747
+ * **Authentication**: Bearer token with x-tenant-id header required
4748
+ *
4749
+ * **Access Control**: wallet admin role
4750
+ *
4751
+ */
4752
+ delete: {
4753
+ parameters: {
4754
+ query: {
4755
+ /** @description Wallet ID for access validation */
4756
+ wallet_id: string;
4757
+ };
4758
+ header?: never;
4759
+ path: {
4760
+ document_id: string;
4761
+ };
4762
+ cookie?: never;
4763
+ };
4764
+ requestBody?: never;
4765
+ responses: {
4766
+ /** @description Upload discarded */
4767
+ 200: {
4768
+ headers: {
4769
+ [name: string]: unknown;
4770
+ };
4771
+ content?: never;
4772
+ };
4773
+ /** @description Upload not found for this wallet */
4774
+ 404: {
4775
+ headers: {
4776
+ [name: string]: unknown;
4777
+ };
4778
+ content?: never;
4779
+ };
4780
+ /** @description Upload is already attached to a cardholder */
4781
+ 409: {
4782
+ headers: {
4783
+ [name: string]: unknown;
4784
+ };
4785
+ content?: never;
4786
+ };
4787
+ };
4788
+ };
4789
+ options?: never;
4790
+ head?: never;
4791
+ patch?: never;
4792
+ trace?: never;
4793
+ };
4794
+ "/frontend/issuing/cardholders/{cardholder_id}/documents": {
4795
+ parameters: {
4796
+ query?: never;
4797
+ header?: never;
4798
+ path?: never;
4799
+ cookie?: never;
4800
+ };
4801
+ get?: never;
4802
+ put?: never;
4803
+ /**
4804
+ * Attach uploaded KYC documents to a cardholder
4805
+ * @description Attaches files already uploaded via
4806
+ * `POST /frontend/issuing/cardholder-documents` to this cardholder. The
4807
+ * body carries upload ids only — no file bytes travel here.
4808
+ *
4809
+ * A document of a type the cardholder already has replaces the previous
4810
+ * one, and the superseded file is deleted. An upload can only be attached
4811
+ * once, and only to a cardholder in the wallet it was uploaded for.
4812
+ *
4813
+ * Documents are not pushed to the vendor here; they travel at
4814
+ * `POST /cardholders/{cardholder_id}/submit`.
4815
+ *
4816
+ * **Authentication**: Bearer token with x-tenant-id header required
4817
+ *
4818
+ * **Access Control**: Cardholder must belong to the user's wallet (admin role)
4819
+ *
4820
+ */
4821
+ post: {
4822
+ parameters: {
4823
+ query: {
4824
+ /** @description Wallet ID for access validation */
4825
+ wallet_id: string;
4826
+ };
4827
+ header?: never;
4828
+ path: {
4829
+ cardholder_id: string;
4830
+ };
4831
+ cookie?: never;
4832
+ };
4833
+ requestBody: {
4834
+ content: {
4835
+ "application/json": {
4836
+ /** @description Ids returned by the upload endpoint */
4837
+ document_ids: string[];
4838
+ };
4839
+ };
4840
+ };
4841
+ responses: {
4842
+ /** @description Documents attached; returns the updated cardholder */
4843
+ 200: {
4844
+ headers: {
4845
+ [name: string]: unknown;
4846
+ };
4847
+ content: {
4848
+ "application/json": {
4849
+ /** @example true */
4850
+ success?: boolean;
4851
+ /** @example Documents attached successfully */
4852
+ message?: string;
4853
+ /** @description Updated cardholder with refreshed kyc_documents */
4854
+ data?: Record<string, never>;
4855
+ };
4856
+ };
4857
+ };
4858
+ /** @description document_ids missing, empty, or listing two files of one type */
4859
+ 400: {
4860
+ headers: {
4861
+ [name: string]: unknown;
4862
+ };
4863
+ content?: never;
4864
+ };
4865
+ /** @description Access denied to this cardholder */
4866
+ 403: {
4867
+ headers: {
4868
+ [name: string]: unknown;
4869
+ };
4870
+ content?: never;
4871
+ };
4872
+ /** @description Cardholder or upload id not found */
4873
+ 404: {
4874
+ headers: {
4875
+ [name: string]: unknown;
4876
+ };
4877
+ content?: never;
4878
+ };
4879
+ /** @description An upload is already attached to a cardholder */
4880
+ 409: {
4881
+ headers: {
4882
+ [name: string]: unknown;
4883
+ };
4884
+ content?: never;
4885
+ };
4886
+ };
4887
+ };
4888
+ delete?: never;
4889
+ options?: never;
4890
+ head?: never;
4891
+ patch?: never;
4892
+ trace?: never;
4893
+ };
4407
4894
  "/frontend/kyc_persona/{wallet_id}/init": {
4408
4895
  parameters: {
4409
4896
  query?: never;
@@ -11297,8 +11784,6 @@ export interface components {
11297
11784
  currency: components["schemas"]["CurrencyRef"];
11298
11785
  /** @description Program embed; null when program_id is null */
11299
11786
  issuing_program?: components["schemas"]["IssuingProgram"] | null;
11300
- /** @description Bank details persisted on fiat_accounts; null when absent */
11301
- bank_account_details?: components["schemas"]["BankAccountDetails"] | null;
11302
11787
  /** @description Bank details from the external API meta; empty string `""` when none are available. */
11303
11788
  account_details: components["schemas"]["BankAccountDetails"] | "";
11304
11789
  /** Format: date-time */