@inkress/admin-sdk 1.1.43 → 1.1.45

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
@@ -128,7 +128,7 @@ const products = await inkress.public.getMerchantProducts('merchant-username', {
128
128
 
129
129
  // Get merchant fees
130
130
  const fees = await inkress.public.getMerchantFees('merchant-username', {
131
- currency: 'JMD',
131
+ currency_code: 'JMD', // JMD = 1, USD = 2
132
132
  total: 1000
133
133
  });
134
134
  ```
@@ -142,8 +142,8 @@ The SDK automatically translates human-readable strings to API integers:
142
142
  const order = await inkress.orders.create({
143
143
  total: 99.99,
144
144
  currency_code: 'USD',
145
- status: 'pending', // SDK converts 'pending' → integer
146
- kind: 'online', // SDK converts 'online' → integer
145
+ status: 'pending',
146
+ kind: 'online',
147
147
  customer: {
148
148
  email: 'customer@example.com',
149
149
  first_name: 'John',
@@ -154,19 +154,16 @@ const order = await inkress.orders.create({
154
154
 
155
155
  // Update merchant with contextual values
156
156
  const merchant = await inkress.merchants.update(123, {
157
- status: 'approved', // SDK converts to integer
158
- platform_fee_structure: 'customer_pay', // SDK converts to integer
157
+ status: 'approved',
158
+ platform_fee_structure: 'customer_pay',
159
159
  provider_fee_structure: 'merchant_absorb'
160
160
  });
161
161
 
162
- // Create user with contextual status and kind
162
+ // Create user
163
163
  const user = await inkress.users.create({
164
164
  email: 'user@example.com',
165
165
  first_name: 'John',
166
166
  last_name: 'Doe',
167
- password: 'secure-password',
168
- status: 'pending', // SDK converts to account_pending integer
169
- kind: 'organisation' // SDK converts to user_organisation integer
170
167
  });
171
168
  ```
172
169
 
@@ -180,7 +177,7 @@ const orders = await inkress.orders.query({
180
177
  status: ['confirmed', 'shipped'], // Array → IN query
181
178
  total: { min: 100, max: 1000 }, // Range query
182
179
  reference_id: { contains: 'VIP' }, // String search
183
- inserted_at: { after: '2024-01-01' },
180
+ inserted_at: { min: '2024-01-01' },
184
181
  page: 1,
185
182
  page_size: 20
186
183
  });
@@ -238,11 +235,10 @@ The SDK provides access to 23+ fully-typed resources:
238
235
  - **Addresses** - Address management
239
236
  - **Tokens** - API token management
240
237
  - **Webhook URLs** - Webhook configuration
238
+ - **KYC** - Know Your Customer verification and compliance
241
239
 
242
240
  ### Content & Other
243
241
  - **Generics** - Dynamic endpoint access
244
- - **KYC** - Know Your Customer operations
245
- - **Payout** - Payout processing
246
242
  - **Public** - Public-facing merchant data
247
243
 
248
244
  ---
@@ -555,7 +551,7 @@ await inkress.billingPlans.get(planId);
555
551
  await inkress.billingPlans.create({
556
552
  name: 'Premium Plan',
557
553
  amount: 29.99,
558
- currency: 'USD',
554
+ currency_code: 'USD', // JMD = 1, USD = 2
559
555
  kind: 'subscription', // Contextual
560
556
  status: 'active'
561
557
  });
@@ -675,7 +671,7 @@ await inkress.paymentLinks.list({ status: 'active' });
675
671
  await inkress.paymentLinks.create({
676
672
  title: 'Product Payment',
677
673
  amount: 99.99,
678
- currency: 'USD',
674
+ currency_code: 'USD', // JMD = 1, USD = 2
679
675
  status: 'active'
680
676
  });
681
677
 
@@ -696,7 +692,7 @@ await inkress.financialAccounts.list();
696
692
  await inkress.financialAccounts.create({
697
693
  name: 'Main Account',
698
694
  type: 'checking',
699
- currency: 'USD'
695
+ currency_code: 'USD' // JMD = 1, USD = 2
700
696
  });
701
697
 
702
698
  // Update account
@@ -808,12 +804,255 @@ await inkress.public.getMerchantProducts('merchant-name', {
808
804
 
809
805
  // Get merchant fees (fully typed)
810
806
  const fees = await inkress.public.getMerchantFees('merchant-name', {
811
- currency: 'USD',
807
+ currency_code: 'USD', // JMD = 1, USD = 2
812
808
  total: 100
813
809
  });
814
810
  // Returns: PublicMerchantFees
815
811
  ```
816
812
 
813
+ ---
814
+
815
+ ## KYC (Know Your Customer) Module
816
+
817
+ The KYC module helps you manage merchant verification and compliance documents. It provides both client-side document requirements and server-side status tracking.
818
+
819
+ ### Understanding Entity Types
820
+
821
+ Different merchant types require different KYC documents:
822
+
823
+ | Entity Type | Description | Required Documents |
824
+ |------------|-------------|-------------------|
825
+ | `personal` | Individual merchant | 3 documents |
826
+ | `sole-trader` | Sole proprietorship | 5 documents |
827
+ | `llc` | Limited Liability Company | 9 documents |
828
+ | `non-profit` | Non-profit organization | 6 documents |
829
+ | `alumni` | Alumni association | 6 documents |
830
+ | `other` | Other business types | 9 documents |
831
+
832
+ ### Document Types
833
+
834
+ ```typescript
835
+ type KycDocumentType =
836
+ | 'Proof of Identity'
837
+ | 'Proof of Address'
838
+ | 'Proof of Bank Account Ownership'
839
+ | 'Business Certificate'
840
+ | 'Articles of Incorporation'
841
+ | 'Annual Return'
842
+ | 'Notice of Directors'
843
+ | 'Notice of Secretary'
844
+ | 'Tax Compliance Certificate';
845
+ ```
846
+
847
+ ### Quick Status Check
848
+
849
+ ```typescript
850
+ // Check if KYC is complete for the authenticated merchant
851
+ const isComplete = await inkress.kyc.isKycComplete('llc');
852
+
853
+ if (isComplete) {
854
+ console.log('✅ Merchant is fully verified!');
855
+ } else {
856
+ console.log('⚠️ Verification incomplete');
857
+ }
858
+ ```
859
+
860
+ ### Get Requirements Status (with API call)
861
+
862
+ Fetch the complete KYC status including all document submissions:
863
+
864
+ ```typescript
865
+ const response = await inkress.kyc.getRequirementsStatus('llc');
866
+
867
+ if (response.state === 'ok') {
868
+ const status = response.result!;
869
+
870
+ console.log(`Completion: ${status.completion_percentage}%`);
871
+ console.log(`Complete: ${status.is_complete ? 'Yes' : 'No'}`);
872
+ console.log(`Approved: ${status.total_approved}/${status.total_required}`);
873
+ console.log(`Pending: ${status.total_pending}`);
874
+ console.log(`Rejected: ${status.total_rejected}`);
875
+
876
+ // Check individual documents
877
+ status.document_statuses.forEach(doc => {
878
+ console.log(`${doc.document_type}: ${doc.status || 'not submitted'}`);
879
+
880
+ if (doc.status === 'rejected' && doc.rejection_reason) {
881
+ console.log(` Reason: ${doc.rejection_reason}`);
882
+ }
883
+ });
884
+ }
885
+ ```
886
+
887
+ ### Get Missing Documents
888
+
889
+ Find out which documents still need to be submitted:
890
+
891
+ ```typescript
892
+ const missing = await inkress.kyc.getMissingDocuments('llc');
893
+
894
+ if (missing.length > 0) {
895
+ console.log('Please submit the following documents:');
896
+ missing.forEach(doc => console.log(` • ${doc}`));
897
+ } else {
898
+ console.log('All documents submitted!');
899
+ }
900
+ ```
901
+
902
+ ### Client-Side Requirements (no API call)
903
+
904
+ View required documents without making an API request:
905
+
906
+ ```typescript
907
+ // Get requirements for a specific entity type
908
+ const docs = inkress.kyc.getRequiredDocuments('llc');
909
+ console.log(`LLC requires ${docs.length} documents:`, docs);
910
+ // Returns: ['Proof of Identity', 'Proof of Address', ...]
911
+
912
+ // Get all requirements at once
913
+ const allRequirements = inkress.kyc.getAllRequirements();
914
+ console.log('Personal:', allRequirements.personal);
915
+ console.log('LLC:', allRequirements.llc);
916
+ // Returns complete mapping of all entity types to their required documents
917
+ ```
918
+
919
+ ### Submit KYC Documents
920
+
921
+ ```typescript
922
+ // Upload a document
923
+ await inkress.kyc.uploadDocument({
924
+ kind: 'document_submission',
925
+ status: 'pending',
926
+ data: {
927
+ document_type: 'Proof of Identity',
928
+ document_url: 'https://cdn.example.com/id-card.pdf',
929
+ notes: 'Government-issued ID card'
930
+ }
931
+ });
932
+
933
+ // Update bank information
934
+ await inkress.kyc.updateBankInfo({
935
+ kind: 'bank_info_update',
936
+ status: 'pending',
937
+ data: {
938
+ account_number: '123456789',
939
+ routing_number: '987654321',
940
+ bank_name: 'Example Bank',
941
+ account_holder_name: 'John Doe'
942
+ }
943
+ });
944
+ ```
945
+
946
+ ### Complete Onboarding Flow Example
947
+
948
+ ```typescript
949
+ async function checkKycOnboarding(entityType: 'llc' | 'personal' | 'sole-trader') {
950
+ console.log('🚀 Starting KYC Onboarding Check...\n');
951
+
952
+ // Step 1: Show what's required
953
+ const required = inkress.kyc.getRequiredDocuments(entityType);
954
+ console.log(`📋 ${entityType} requires ${required.length} documents:`);
955
+ required.forEach((doc, i) => console.log(` ${i + 1}. ${doc}`));
956
+ console.log('');
957
+
958
+ // Step 2: Check current status
959
+ const statusResponse = await inkress.kyc.getRequirementsStatus(entityType);
960
+
961
+ if (statusResponse.state === 'ok') {
962
+ const status = statusResponse.result!;
963
+
964
+ console.log('📊 Current Status:');
965
+ console.log(` Completion: ${status.completion_percentage}%`);
966
+ console.log(` Approved: ${status.total_approved}/${status.total_required}`);
967
+ console.log(` Pending: ${status.total_pending}`);
968
+ console.log(` Rejected: ${status.total_rejected}`);
969
+ console.log('');
970
+ }
971
+
972
+ // Step 3: Check if complete
973
+ const isComplete = await inkress.kyc.isKycComplete(entityType);
974
+
975
+ if (isComplete) {
976
+ console.log('✅ KYC Complete - Merchant is verified!');
977
+ } else {
978
+ // Step 4: Show what's missing
979
+ const missing = await inkress.kyc.getMissingDocuments(entityType);
980
+ console.log('⚠️ Action Required:');
981
+ console.log(`Please submit ${missing.length} document(s):`);
982
+ missing.forEach(doc => console.log(` • ${doc}`));
983
+ }
984
+ }
985
+
986
+ // Run the check
987
+ await checkKycOnboarding('llc');
988
+ ```
989
+
990
+ ### TypeScript Types
991
+
992
+ ```typescript
993
+ import type {
994
+ EntityType,
995
+ KycDocumentType,
996
+ KycRequirements,
997
+ KycDocumentStatus,
998
+ KYC_DOCUMENT_REQUIREMENTS
999
+ } from '@inkress/admin-sdk';
1000
+
1001
+ // Document status interface
1002
+ interface KycDocumentStatus {
1003
+ document_type: KycDocumentType;
1004
+ required: boolean;
1005
+ submitted: boolean;
1006
+ status?: 'pending' | 'approved' | 'rejected';
1007
+ submitted_at?: string;
1008
+ reviewed_at?: string;
1009
+ rejection_reason?: string;
1010
+ }
1011
+
1012
+ // Complete requirements interface
1013
+ interface KycRequirements {
1014
+ entity_type: EntityType;
1015
+ required_documents: KycDocumentType[];
1016
+ document_statuses: KycDocumentStatus[];
1017
+ total_required: number;
1018
+ total_submitted: number;
1019
+ total_approved: number;
1020
+ total_rejected: number;
1021
+ total_pending: number;
1022
+ completion_percentage: number;
1023
+ is_complete: boolean;
1024
+ }
1025
+ ```
1026
+
1027
+ ### KYC Status Values
1028
+
1029
+ The API returns integer status codes that are automatically converted:
1030
+
1031
+ | Integer | API Value | Simplified |
1032
+ |---------|-----------|------------|
1033
+ | 1 | `pending` | `pending` |
1034
+ | 2 | `in_review` | `pending` |
1035
+ | 3 | `approved` | `approved` |
1036
+ | 4 | `rejected` | `rejected` |
1037
+
1038
+ The SDK automatically handles the conversion between integers and human-readable strings.
1039
+
1040
+ ### Best Practices
1041
+
1042
+ 1. **Cache Requirements**: The `getRequiredDocuments()` and `getAllRequirements()` methods don't make API calls - use them freely for UI display.
1043
+
1044
+ 2. **Periodic Status Checks**: Poll `getRequirementsStatus()` periodically to track verification progress.
1045
+
1046
+ 3. **Handle Rejections**: Check `rejection_reason` when a document is rejected to provide clear feedback to users.
1047
+
1048
+ 4. **Track Submissions**: Use `submitted_at` and `reviewed_at` timestamps to show processing time.
1049
+
1050
+ 5. **Authentication**: All KYC methods use the authenticated merchant from the `Client-Id` header (set via `username` config).
1051
+
1052
+ See [examples/kyc-requirements.ts](examples/kyc-requirements.ts) for complete working examples.
1053
+
1054
+ ---
1055
+
817
1056
  ## Advanced Query System
818
1057
 
819
1058
  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;A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AChB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,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