@inkress/admin-sdk 1.1.43 → 1.1.44

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.
package/README.md CHANGED
@@ -238,11 +238,10 @@ The SDK provides access to 23+ fully-typed resources:
238
238
  - **Addresses** - Address management
239
239
  - **Tokens** - API token management
240
240
  - **Webhook URLs** - Webhook configuration
241
+ - **KYC** - Know Your Customer verification and compliance
241
242
 
242
243
  ### Content & Other
243
244
  - **Generics** - Dynamic endpoint access
244
- - **KYC** - Know Your Customer operations
245
- - **Payout** - Payout processing
246
245
  - **Public** - Public-facing merchant data
247
246
 
248
247
  ---
@@ -814,6 +813,249 @@ const fees = await inkress.public.getMerchantFees('merchant-name', {
814
813
  // Returns: PublicMerchantFees
815
814
  ```
816
815
 
816
+ ---
817
+
818
+ ## KYC (Know Your Customer) Module
819
+
820
+ The KYC module helps you manage merchant verification and compliance documents. It provides both client-side document requirements and server-side status tracking.
821
+
822
+ ### Understanding Entity Types
823
+
824
+ Different merchant types require different KYC documents:
825
+
826
+ | Entity Type | Description | Required Documents |
827
+ |------------|-------------|-------------------|
828
+ | `personal` | Individual merchant | 3 documents |
829
+ | `sole-trader` | Sole proprietorship | 5 documents |
830
+ | `llc` | Limited Liability Company | 9 documents |
831
+ | `non-profit` | Non-profit organization | 6 documents |
832
+ | `alumni` | Alumni association | 6 documents |
833
+ | `other` | Other business types | 9 documents |
834
+
835
+ ### Document Types
836
+
837
+ ```typescript
838
+ type KycDocumentType =
839
+ | 'Proof of Identity'
840
+ | 'Proof of Address'
841
+ | 'Proof of Bank Account Ownership'
842
+ | 'Business Certificate'
843
+ | 'Articles of Incorporation'
844
+ | 'Annual Return'
845
+ | 'Notice of Directors'
846
+ | 'Notice of Secretary'
847
+ | 'Tax Compliance Certificate';
848
+ ```
849
+
850
+ ### Quick Status Check
851
+
852
+ ```typescript
853
+ // Check if KYC is complete for the authenticated merchant
854
+ const isComplete = await inkress.kyc.isKycComplete('llc');
855
+
856
+ if (isComplete) {
857
+ console.log('✅ Merchant is fully verified!');
858
+ } else {
859
+ console.log('⚠️ Verification incomplete');
860
+ }
861
+ ```
862
+
863
+ ### Get Requirements Status (with API call)
864
+
865
+ Fetch the complete KYC status including all document submissions:
866
+
867
+ ```typescript
868
+ const response = await inkress.kyc.getRequirementsStatus('llc');
869
+
870
+ if (response.state === 'ok') {
871
+ const status = response.result!;
872
+
873
+ console.log(`Completion: ${status.completion_percentage}%`);
874
+ console.log(`Complete: ${status.is_complete ? 'Yes' : 'No'}`);
875
+ console.log(`Approved: ${status.total_approved}/${status.total_required}`);
876
+ console.log(`Pending: ${status.total_pending}`);
877
+ console.log(`Rejected: ${status.total_rejected}`);
878
+
879
+ // Check individual documents
880
+ status.document_statuses.forEach(doc => {
881
+ console.log(`${doc.document_type}: ${doc.status || 'not submitted'}`);
882
+
883
+ if (doc.status === 'rejected' && doc.rejection_reason) {
884
+ console.log(` Reason: ${doc.rejection_reason}`);
885
+ }
886
+ });
887
+ }
888
+ ```
889
+
890
+ ### Get Missing Documents
891
+
892
+ Find out which documents still need to be submitted:
893
+
894
+ ```typescript
895
+ const missing = await inkress.kyc.getMissingDocuments('llc');
896
+
897
+ if (missing.length > 0) {
898
+ console.log('Please submit the following documents:');
899
+ missing.forEach(doc => console.log(` • ${doc}`));
900
+ } else {
901
+ console.log('All documents submitted!');
902
+ }
903
+ ```
904
+
905
+ ### Client-Side Requirements (no API call)
906
+
907
+ View required documents without making an API request:
908
+
909
+ ```typescript
910
+ // Get requirements for a specific entity type
911
+ const docs = inkress.kyc.getRequiredDocuments('llc');
912
+ console.log(`LLC requires ${docs.length} documents:`, docs);
913
+ // Returns: ['Proof of Identity', 'Proof of Address', ...]
914
+
915
+ // Get all requirements at once
916
+ const allRequirements = inkress.kyc.getAllRequirements();
917
+ console.log('Personal:', allRequirements.personal);
918
+ console.log('LLC:', allRequirements.llc);
919
+ // Returns complete mapping of all entity types to their required documents
920
+ ```
921
+
922
+ ### Submit KYC Documents
923
+
924
+ ```typescript
925
+ // Upload a document
926
+ await inkress.kyc.uploadDocument({
927
+ kind: 'document_submission',
928
+ status: 'pending',
929
+ data: {
930
+ document_type: 'Proof of Identity',
931
+ document_url: 'https://cdn.example.com/id-card.pdf',
932
+ notes: 'Government-issued ID card'
933
+ }
934
+ });
935
+
936
+ // Update bank information
937
+ await inkress.kyc.updateBankInfo({
938
+ kind: 'bank_info_update',
939
+ status: 'pending',
940
+ data: {
941
+ account_number: '123456789',
942
+ routing_number: '987654321',
943
+ bank_name: 'Example Bank',
944
+ account_holder_name: 'John Doe'
945
+ }
946
+ });
947
+ ```
948
+
949
+ ### Complete Onboarding Flow Example
950
+
951
+ ```typescript
952
+ async function checkKycOnboarding(entityType: 'llc' | 'personal' | 'sole-trader') {
953
+ console.log('🚀 Starting KYC Onboarding Check...\n');
954
+
955
+ // Step 1: Show what's required
956
+ const required = inkress.kyc.getRequiredDocuments(entityType);
957
+ console.log(`📋 ${entityType} requires ${required.length} documents:`);
958
+ required.forEach((doc, i) => console.log(` ${i + 1}. ${doc}`));
959
+ console.log('');
960
+
961
+ // Step 2: Check current status
962
+ const statusResponse = await inkress.kyc.getRequirementsStatus(entityType);
963
+
964
+ if (statusResponse.state === 'ok') {
965
+ const status = statusResponse.result!;
966
+
967
+ console.log('📊 Current Status:');
968
+ console.log(` Completion: ${status.completion_percentage}%`);
969
+ console.log(` Approved: ${status.total_approved}/${status.total_required}`);
970
+ console.log(` Pending: ${status.total_pending}`);
971
+ console.log(` Rejected: ${status.total_rejected}`);
972
+ console.log('');
973
+ }
974
+
975
+ // Step 3: Check if complete
976
+ const isComplete = await inkress.kyc.isKycComplete(entityType);
977
+
978
+ if (isComplete) {
979
+ console.log('✅ KYC Complete - Merchant is verified!');
980
+ } else {
981
+ // Step 4: Show what's missing
982
+ const missing = await inkress.kyc.getMissingDocuments(entityType);
983
+ console.log('⚠️ Action Required:');
984
+ console.log(`Please submit ${missing.length} document(s):`);
985
+ missing.forEach(doc => console.log(` • ${doc}`));
986
+ }
987
+ }
988
+
989
+ // Run the check
990
+ await checkKycOnboarding('llc');
991
+ ```
992
+
993
+ ### TypeScript Types
994
+
995
+ ```typescript
996
+ import type {
997
+ EntityType,
998
+ KycDocumentType,
999
+ KycRequirements,
1000
+ KycDocumentStatus,
1001
+ KYC_DOCUMENT_REQUIREMENTS
1002
+ } from '@inkress/admin-sdk';
1003
+
1004
+ // Document status interface
1005
+ interface KycDocumentStatus {
1006
+ document_type: KycDocumentType;
1007
+ required: boolean;
1008
+ submitted: boolean;
1009
+ status?: 'pending' | 'approved' | 'rejected';
1010
+ submitted_at?: string;
1011
+ reviewed_at?: string;
1012
+ rejection_reason?: string;
1013
+ }
1014
+
1015
+ // Complete requirements interface
1016
+ interface KycRequirements {
1017
+ entity_type: EntityType;
1018
+ required_documents: KycDocumentType[];
1019
+ document_statuses: KycDocumentStatus[];
1020
+ total_required: number;
1021
+ total_submitted: number;
1022
+ total_approved: number;
1023
+ total_rejected: number;
1024
+ total_pending: number;
1025
+ completion_percentage: number;
1026
+ is_complete: boolean;
1027
+ }
1028
+ ```
1029
+
1030
+ ### KYC Status Values
1031
+
1032
+ The API returns integer status codes that are automatically converted:
1033
+
1034
+ | Integer | API Value | Simplified |
1035
+ |---------|-----------|------------|
1036
+ | 1 | `pending` | `pending` |
1037
+ | 2 | `in_review` | `pending` |
1038
+ | 3 | `approved` | `approved` |
1039
+ | 4 | `rejected` | `rejected` |
1040
+
1041
+ The SDK automatically handles the conversion between integers and human-readable strings.
1042
+
1043
+ ### Best Practices
1044
+
1045
+ 1. **Cache Requirements**: The `getRequiredDocuments()` and `getAllRequirements()` methods don't make API calls - use them freely for UI display.
1046
+
1047
+ 2. **Periodic Status Checks**: Poll `getRequirementsStatus()` periodically to track verification progress.
1048
+
1049
+ 3. **Handle Rejections**: Check `rejection_reason` when a document is rejected to provide clear feedback to users.
1050
+
1051
+ 4. **Track Submissions**: Use `submitted_at` and `reviewed_at` timestamps to show processing time.
1052
+
1053
+ 5. **Authentication**: All KYC methods use the authenticated merchant from the `Client-Id` header (set via `username` config).
1054
+
1055
+ See [examples/kyc-requirements.ts](examples/kyc-requirements.ts) for complete working examples.
1056
+
1057
+ ---
1058
+
817
1059
  ## Advanced Query System
818
1060
 
819
1061
  The SDK provides a powerful type-safe query system with two interfaces:
package/dist/index.d.ts CHANGED
@@ -99,6 +99,7 @@ export declare class InkressSDK {
99
99
  export * from './types';
100
100
  export * from './client';
101
101
  export type { WebhookPayload, WebhookVerificationOptions, IncomingWebhookRequest, } from './resources/webhook-urls';
102
+ export { KYC_DOCUMENT_REQUIREMENTS, type EntityType, type KycDocumentType, type KycDocumentStatus, type KycRequirements, } from './resources/kyc';
102
103
  export { InkressSDK as default };
103
104
  export type { OrderQueryParams, ProductQueryParams, UserQueryParams, MerchantQueryParams, CategoryQueryParams, BillingPlanQueryParams, SubscriptionQueryParams, PaymentLinkQueryParams, FinancialAccountQueryParams, FinancialRequestQueryParams, WebhookUrlQueryParams, TokenQueryParams, AddressQueryParams, CurrencyQueryParams, ExchangeRateQueryParams, FeeQueryParams, PaymentMethodQueryParams, TransactionEntryQueryParams, OrderFilterParams, ProductFilterParams, UserFilterParams, MerchantFilterParams, CategoryFilterParams, BillingPlanFilterParams, SubscriptionFilterParams, PaymentLinkFilterParams, FinancialAccountFilterParams, FinancialRequestFilterParams, WebhookUrlFilterParams, TokenFilterParams, AddressFilterParams, CurrencyFilterParams, ExchangeRateFilterParams, FeeFilterParams, PaymentMethodFilterParams, TransactionEntryFilterParams, OrderListResponse, ProductListResponse, UserListResponse, MerchantListResponse, CategoryListResponse, BillingPlanListResponse, SubscriptionListResponse, PaymentLinkListResponse, FinancialAccountListResponse, FinancialRequestListResponse, WebhookUrlListResponse, TokenListResponse, AddressListResponse, CurrencyListResponse, ExchangeRateListResponse, FeeListResponse, PaymentMethodListResponse, TransactionEntryListResponse, PageInfo, } from './types/resources';
104
105
  export { ORDER_FIELD_TYPES, PRODUCT_FIELD_TYPES, USER_FIELD_TYPES, MERCHANT_FIELD_TYPES, CATEGORY_FIELD_TYPES, BILLING_PLAN_FIELD_TYPES, SUBSCRIPTION_FIELD_TYPES, PAYMENT_LINK_FIELD_TYPES, FINANCIAL_ACCOUNT_FIELD_TYPES, FINANCIAL_REQUEST_FIELD_TYPES, WEBHOOK_URL_FIELD_TYPES, TOKEN_FIELD_TYPES, ADDRESS_FIELD_TYPES, CURRENCY_FIELD_TYPES, EXCHANGE_RATE_FIELD_TYPES, FEE_FIELD_TYPES, PAYMENT_METHOD_FIELD_TYPES, TRANSACTION_ENTRY_FIELD_TYPES, } from './types/resources';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM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AAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,SAAS,GACf,MAAM,wBAAwB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -3469,6 +3469,62 @@ class PublicResource {
3469
3469
  }
3470
3470
  }
3471
3471
 
3472
+ /**
3473
+ * KYC document requirements by entity type
3474
+ * These are the standard documents required for each type of business entity
3475
+ */
3476
+ const KYC_DOCUMENT_REQUIREMENTS = {
3477
+ personal: [
3478
+ 'Proof of Identity',
3479
+ 'Proof of Address',
3480
+ 'Proof of Bank Account Ownership',
3481
+ ],
3482
+ 'sole-trader': [
3483
+ 'Proof of Identity',
3484
+ 'Proof of Address',
3485
+ 'Proof of Bank Account Ownership',
3486
+ 'Business Certificate',
3487
+ 'Articles of Incorporation',
3488
+ ],
3489
+ llc: [
3490
+ 'Proof of Identity',
3491
+ 'Proof of Address',
3492
+ 'Proof of Bank Account Ownership',
3493
+ 'Business Certificate',
3494
+ 'Articles of Incorporation',
3495
+ 'Annual Return',
3496
+ 'Notice of Directors',
3497
+ 'Notice of Secretary',
3498
+ 'Tax Compliance Certificate',
3499
+ ],
3500
+ 'non-profit': [
3501
+ 'Proof of Identity',
3502
+ 'Proof of Address',
3503
+ 'Proof of Bank Account Ownership',
3504
+ 'Business Certificate',
3505
+ 'Articles of Incorporation',
3506
+ 'Annual Return',
3507
+ ],
3508
+ alumni: [
3509
+ 'Proof of Identity',
3510
+ 'Proof of Address',
3511
+ 'Proof of Bank Account Ownership',
3512
+ 'Business Certificate',
3513
+ 'Articles of Incorporation',
3514
+ 'Annual Return',
3515
+ ],
3516
+ other: [
3517
+ 'Proof of Identity',
3518
+ 'Proof of Address',
3519
+ 'Proof of Bank Account Ownership',
3520
+ 'Business Certificate',
3521
+ 'Articles of Incorporation',
3522
+ 'Annual Return',
3523
+ 'Notice of Directors',
3524
+ 'Notice of Secretary',
3525
+ 'Tax Compliance Certificate',
3526
+ ],
3527
+ };
3472
3528
  // Field type definitions for query validation
3473
3529
  const KYC_FIELD_TYPES = {
3474
3530
  id: 'number',
@@ -3549,6 +3605,185 @@ class KycResource {
3549
3605
  async updateBankInfo(data) {
3550
3606
  return this.client.post('/legal_requests', data);
3551
3607
  }
3608
+ // ============================================================================
3609
+ // KYC DOCUMENT REQUIREMENTS & STATUS
3610
+ // ============================================================================
3611
+ /**
3612
+ * Get required KYC documents for a specific entity type
3613
+ * This is a client-side method that doesn't make an API call
3614
+ *
3615
+ * @param entityType - The type of business entity
3616
+ * @returns Array of required document types
3617
+ *
3618
+ * @example
3619
+ * const docs = kyc.getRequiredDocuments('llc');
3620
+ * // Returns: ['Proof of Identity', 'Proof of Address', ...]
3621
+ */
3622
+ getRequiredDocuments(entityType) {
3623
+ return [...KYC_DOCUMENT_REQUIREMENTS[entityType]];
3624
+ }
3625
+ /**
3626
+ * Get all KYC document requirements (without making an API call)
3627
+ * Useful for displaying the full list in your application
3628
+ *
3629
+ * @returns Complete mapping of entity types to required documents
3630
+ *
3631
+ * @example
3632
+ * const allRequirements = kyc.getAllRequirements();
3633
+ * console.log(allRequirements.llc); // ['Proof of Identity', ...]
3634
+ */
3635
+ getAllRequirements() {
3636
+ return { ...KYC_DOCUMENT_REQUIREMENTS };
3637
+ }
3638
+ /**
3639
+ * Get KYC requirements and submission status for the authenticated merchant
3640
+ * Fetches all KYC requests and maps them to required documents
3641
+ *
3642
+ * @param entityType - The merchant's business entity type
3643
+ * @returns Complete KYC requirements with submission status
3644
+ *
3645
+ * @example
3646
+ * const status = await kyc.getRequirementsStatus('llc');
3647
+ * console.log(`Completion: ${status.completion_percentage}%`);
3648
+ * console.log(`Approved: ${status.total_approved}/${status.total_required}`);
3649
+ *
3650
+ * // Check individual document status
3651
+ * status.document_statuses.forEach(doc => {
3652
+ * console.log(`${doc.document_type}: ${doc.status || 'not submitted'}`);
3653
+ * });
3654
+ */
3655
+ async getRequirementsStatus(entityType) {
3656
+ // Get required documents for this entity type
3657
+ const requiredDocuments = this.getRequiredDocuments(entityType);
3658
+ // Fetch all KYC requests for the authenticated merchant
3659
+ const params = {
3660
+ kind: 'document_submission',
3661
+ };
3662
+ const response = await this.list(params);
3663
+ if (response.state === 'error' || !response.result) {
3664
+ return {
3665
+ state: 'error',
3666
+ };
3667
+ }
3668
+ const kycRequests = response.result.entries || [];
3669
+ // Map submitted documents
3670
+ const submittedDocs = new Map();
3671
+ kycRequests.forEach(request => {
3672
+ var _a;
3673
+ const docType = (_a = request.data) === null || _a === void 0 ? void 0 : _a.document_type;
3674
+ if (docType && requiredDocuments.includes(docType)) {
3675
+ // Keep the most recent submission for each document type
3676
+ const existing = submittedDocs.get(docType);
3677
+ if (!existing || new Date(request.inserted_at) > new Date(existing.inserted_at)) {
3678
+ submittedDocs.set(docType, request);
3679
+ }
3680
+ }
3681
+ });
3682
+ // Build document statuses
3683
+ const documentStatuses = requiredDocuments.map(docType => {
3684
+ var _a;
3685
+ const submission = submittedDocs.get(docType);
3686
+ if (!submission) {
3687
+ return {
3688
+ document_type: docType,
3689
+ required: true,
3690
+ submitted: false,
3691
+ };
3692
+ }
3693
+ // Convert integer status to string using translator
3694
+ // The API returns status as a number, but the type says it's a string
3695
+ const statusString = StatusTranslator.toStringWithoutContext(submission.status, 'legal_request');
3696
+ // Map to our simplified status types
3697
+ let status;
3698
+ if (statusString) {
3699
+ if (statusString === 'pending' || statusString === 'in_review') {
3700
+ status = 'pending';
3701
+ }
3702
+ else if (statusString === 'approved') {
3703
+ status = 'approved';
3704
+ }
3705
+ else if (statusString === 'rejected') {
3706
+ status = 'rejected';
3707
+ }
3708
+ }
3709
+ const reviewedAt = submission.updated_at !== submission.inserted_at
3710
+ ? submission.updated_at
3711
+ : undefined;
3712
+ return {
3713
+ document_type: docType,
3714
+ required: true,
3715
+ submitted: true,
3716
+ status,
3717
+ submitted_at: submission.inserted_at,
3718
+ reviewed_at: reviewedAt,
3719
+ rejection_reason: (_a = submission.data) === null || _a === void 0 ? void 0 : _a.rejection_reason,
3720
+ };
3721
+ });
3722
+ // Calculate statistics
3723
+ const totalRequired = requiredDocuments.length;
3724
+ const totalSubmitted = documentStatuses.filter(d => d.submitted).length;
3725
+ const totalApproved = documentStatuses.filter(d => d.status === 'approved').length;
3726
+ const totalRejected = documentStatuses.filter(d => d.status === 'rejected').length;
3727
+ const totalPending = documentStatuses.filter(d => d.status === 'pending').length;
3728
+ const completionPercentage = totalRequired > 0
3729
+ ? Math.round((totalApproved / totalRequired) * 100)
3730
+ : 0;
3731
+ const isComplete = totalApproved === totalRequired;
3732
+ const requirements = {
3733
+ entity_type: entityType,
3734
+ required_documents: requiredDocuments,
3735
+ document_statuses: documentStatuses,
3736
+ total_required: totalRequired,
3737
+ total_submitted: totalSubmitted,
3738
+ total_approved: totalApproved,
3739
+ total_rejected: totalRejected,
3740
+ total_pending: totalPending,
3741
+ completion_percentage: completionPercentage,
3742
+ is_complete: isComplete,
3743
+ };
3744
+ return {
3745
+ state: 'ok',
3746
+ result: requirements,
3747
+ };
3748
+ }
3749
+ /**
3750
+ * Check if all required documents have been approved for the authenticated merchant
3751
+ *
3752
+ * @param entityType - The merchant's business entity type
3753
+ * @returns True if all required documents are approved
3754
+ *
3755
+ * @example
3756
+ * const isComplete = await kyc.isKycComplete('llc');
3757
+ * if (isComplete) {
3758
+ * console.log('Merchant is fully verified!');
3759
+ * }
3760
+ */
3761
+ async isKycComplete(entityType) {
3762
+ var _a;
3763
+ const response = await this.getRequirementsStatus(entityType);
3764
+ return ((_a = response.result) === null || _a === void 0 ? void 0 : _a.is_complete) || false;
3765
+ }
3766
+ /**
3767
+ * Get list of missing (not submitted or rejected) documents for the authenticated merchant
3768
+ *
3769
+ * @param entityType - The merchant's business entity type
3770
+ * @returns Array of document types that need to be submitted or resubmitted
3771
+ *
3772
+ * @example
3773
+ * const missing = await kyc.getMissingDocuments('llc');
3774
+ * if (missing.length > 0) {
3775
+ * console.log('Please submit:', missing.join(', '));
3776
+ * }
3777
+ */
3778
+ async getMissingDocuments(entityType) {
3779
+ const response = await this.getRequirementsStatus(entityType);
3780
+ if (response.state === 'error' || !response.result) {
3781
+ return [];
3782
+ }
3783
+ return response.result.document_statuses
3784
+ .filter(doc => !doc.submitted || doc.status === 'rejected')
3785
+ .map(doc => doc.document_type);
3786
+ }
3552
3787
  }
3553
3788
 
3554
3789
  class PaymentLinksResource {
@@ -4700,5 +4935,5 @@ class InkressSDK {
4700
4935
  }
4701
4936
  }
4702
4937
 
4703
- export { ADDRESS_FIELD_TYPES, AddressQueryBuilder, BILLING_PLAN_FIELD_TYPES, BillingPlanQueryBuilder, CATEGORY_FIELD_TYPES, CURRENCY_FIELD_TYPES, CategoryQueryBuilder, CurrencyQueryBuilder, EXCHANGE_RATE_FIELD_TYPES, ExchangeRateQueryBuilder, FEE_FIELD_TYPES, FINANCIAL_ACCOUNT_FIELD_TYPES, FINANCIAL_REQUEST_FIELD_TYPES, FeeQueryBuilder, FinancialAccountQueryBuilder, FinancialRequestQueryBuilder, HttpClient, InkressApiError, InkressSDK, MERCHANT_FIELD_TYPES, MerchantQueryBuilder, ORDER_FIELD_TYPES, OrderQueryBuilder, PAYMENT_LINK_FIELD_TYPES, PAYMENT_METHOD_FIELD_TYPES, PRODUCT_FIELD_TYPES, PaymentLinkQueryBuilder, PaymentMethodQueryBuilder, ProductQueryBuilder, QueryBuilder, SUBSCRIPTION_FIELD_TYPES, SubscriptionQueryBuilder, TOKEN_FIELD_TYPES, TRANSACTION_ENTRY_FIELD_TYPES, TokenQueryBuilder, TransactionEntryQueryBuilder, USER_FIELD_TYPES, UserQueryBuilder, WEBHOOK_URL_FIELD_TYPES, WebhookUrlQueryBuilder, InkressSDK as default, processQuery };
4938
+ export { ADDRESS_FIELD_TYPES, AddressQueryBuilder, BILLING_PLAN_FIELD_TYPES, BillingPlanQueryBuilder, CATEGORY_FIELD_TYPES, CURRENCY_FIELD_TYPES, CategoryQueryBuilder, CurrencyQueryBuilder, EXCHANGE_RATE_FIELD_TYPES, ExchangeRateQueryBuilder, FEE_FIELD_TYPES, FINANCIAL_ACCOUNT_FIELD_TYPES, FINANCIAL_REQUEST_FIELD_TYPES, FeeQueryBuilder, FinancialAccountQueryBuilder, FinancialRequestQueryBuilder, HttpClient, InkressApiError, InkressSDK, KYC_DOCUMENT_REQUIREMENTS, MERCHANT_FIELD_TYPES, MerchantQueryBuilder, ORDER_FIELD_TYPES, OrderQueryBuilder, PAYMENT_LINK_FIELD_TYPES, PAYMENT_METHOD_FIELD_TYPES, PRODUCT_FIELD_TYPES, PaymentLinkQueryBuilder, PaymentMethodQueryBuilder, ProductQueryBuilder, QueryBuilder, SUBSCRIPTION_FIELD_TYPES, SubscriptionQueryBuilder, TOKEN_FIELD_TYPES, TRANSACTION_ENTRY_FIELD_TYPES, TokenQueryBuilder, TransactionEntryQueryBuilder, USER_FIELD_TYPES, UserQueryBuilder, WEBHOOK_URL_FIELD_TYPES, WebhookUrlQueryBuilder, InkressSDK as default, processQuery };
4704
4939
  //# sourceMappingURL=index.esm.js.map