@k-msg/channel 0.1.0 → 0.1.2

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.
@@ -0,0 +1,25 @@
1
+ import { type Channel, type ChannelCreateRequest, ChannelStatus, ChannelType } from "../types/channel.types";
2
+ export declare class KakaoChannelManager {
3
+ private channels;
4
+ createChannel(request: ChannelCreateRequest): Promise<Channel>;
5
+ private validateKakaoChannelRequest;
6
+ private isValidPlusFriendId;
7
+ private initiateBusinessVerification;
8
+ completeVerification(channelId: string, approved: boolean, rejectionReason?: string): Promise<void>;
9
+ getChannel(channelId: string): Promise<Channel | null>;
10
+ updateChannel(channelId: string, updates: Partial<Channel>): Promise<Channel>;
11
+ deleteChannel(channelId: string): Promise<boolean>;
12
+ listChannels(filters?: {
13
+ status?: ChannelStatus;
14
+ type?: ChannelType;
15
+ verified?: boolean;
16
+ }): Promise<Channel[]>;
17
+ suspendChannel(channelId: string, reason: string): Promise<void>;
18
+ reactivateChannel(channelId: string): Promise<void>;
19
+ checkChannelHealth(channelId: string): Promise<{
20
+ isHealthy: boolean;
21
+ issues: string[];
22
+ recommendations: string[];
23
+ }>;
24
+ private generateChannelId;
25
+ }
@@ -0,0 +1,31 @@
1
+ import { type SenderNumber, type SenderNumberCategory, type SenderNumberCreateRequest, SenderNumberStatus } from "../types/channel.types";
2
+ export declare class KakaoSenderNumberManager {
3
+ private senderNumbers;
4
+ private verificationCodes;
5
+ addSenderNumber(channelId: string, request: SenderNumberCreateRequest): Promise<SenderNumber>;
6
+ private validatePhoneNumber;
7
+ private findSenderNumberByPhone;
8
+ private initiateVerification;
9
+ private sendVerificationSMS;
10
+ verifySenderNumber(senderNumberId: string, code: string): Promise<boolean>;
11
+ resendVerificationCode(senderNumberId: string): Promise<void>;
12
+ getSenderNumber(senderNumberId: string): Promise<SenderNumber | null>;
13
+ listSenderNumbers(filters?: {
14
+ channelId?: string;
15
+ status?: SenderNumberStatus;
16
+ category?: SenderNumberCategory;
17
+ verified?: boolean;
18
+ }): Promise<SenderNumber[]>;
19
+ updateSenderNumber(senderNumberId: string, updates: Partial<SenderNumber>): Promise<SenderNumber>;
20
+ deleteSenderNumber(senderNumberId: string): Promise<boolean>;
21
+ private isSenderNumberInUse;
22
+ blockSenderNumber(senderNumberId: string, reason: string): Promise<void>;
23
+ unblockSenderNumber(senderNumberId: string): Promise<void>;
24
+ validateSenderNumberForSending(senderNumberId: string): Promise<{
25
+ isValid: boolean;
26
+ errors: string[];
27
+ }>;
28
+ private generateSenderNumberId;
29
+ private generateVerificationCode;
30
+ cleanup(): void;
31
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Channel CRUD Operations
3
+ * 채널 생성, 조회, 수정, 삭제 통합 관리
4
+ */
5
+ import { EventEmitter } from "events";
6
+ import { type Channel, type ChannelCreateRequest, type ChannelFilters, type SenderNumber, type SenderNumberCreateRequest, type SenderNumberFilters } from "../types/channel.types";
7
+ export interface PaginationOptions {
8
+ page: number;
9
+ limit: number;
10
+ sortBy?: string;
11
+ sortOrder?: "asc" | "desc";
12
+ }
13
+ export interface PaginatedResult<T> {
14
+ data: T[];
15
+ total: number;
16
+ page: number;
17
+ limit: number;
18
+ totalPages: number;
19
+ hasNext: boolean;
20
+ hasPrev: boolean;
21
+ }
22
+ export interface ChannelCRUDOptions {
23
+ enableAuditLog: boolean;
24
+ enableEventEmission: boolean;
25
+ defaultPageSize: number;
26
+ maxPageSize: number;
27
+ enableSoftDelete: boolean;
28
+ autoCleanup: boolean;
29
+ cleanupInterval: number;
30
+ }
31
+ export interface AuditLogEntry {
32
+ id: string;
33
+ entityType: "channel" | "senderNumber";
34
+ entityId: string;
35
+ action: "create" | "read" | "update" | "delete" | "verify" | "suspend" | "activate";
36
+ userId?: string;
37
+ timestamp: Date;
38
+ changes?: {
39
+ before: any;
40
+ after: any;
41
+ };
42
+ metadata?: Record<string, any>;
43
+ }
44
+ export declare class ChannelCRUD extends EventEmitter {
45
+ private options;
46
+ private channels;
47
+ private senderNumbers;
48
+ private auditLogs;
49
+ private cleanupTimer?;
50
+ private defaultOptions;
51
+ constructor(options?: Partial<ChannelCRUDOptions>);
52
+ createChannel(request: ChannelCreateRequest, userId?: string): Promise<Channel>;
53
+ getChannel(channelId: string, userId?: string): Promise<Channel | null>;
54
+ updateChannel(channelId: string, updates: Partial<Omit<Channel, "id" | "createdAt" | "updatedAt">>, userId?: string): Promise<Channel>;
55
+ deleteChannel(channelId: string, userId?: string): Promise<boolean>;
56
+ listChannels(filters?: ChannelFilters, pagination?: PaginationOptions): Promise<PaginatedResult<Channel>>;
57
+ createSenderNumber(channelId: string, request: SenderNumberCreateRequest, userId?: string): Promise<SenderNumber>;
58
+ getSenderNumber(senderNumberId: string, userId?: string): Promise<SenderNumber | null>;
59
+ updateSenderNumber(senderNumberId: string, updates: Partial<Omit<SenderNumber, "id" | "phoneNumber" | "createdAt" | "updatedAt">>, userId?: string): Promise<SenderNumber>;
60
+ deleteSenderNumber(senderNumberId: string, userId?: string): Promise<boolean>;
61
+ listSenderNumbers(filters?: SenderNumberFilters, pagination?: PaginationOptions): Promise<PaginatedResult<SenderNumber>>;
62
+ getAuditLogs(entityType?: "channel" | "senderNumber", entityId?: string, limit?: number): AuditLogEntry[];
63
+ getStatistics(): {
64
+ channels: {
65
+ total: number;
66
+ byStatus: Record<string, number>;
67
+ byType: Record<string, number>;
68
+ byProvider: Record<string, number>;
69
+ };
70
+ senderNumbers: {
71
+ total: number;
72
+ byStatus: Record<string, number>;
73
+ byCategory: Record<string, number>;
74
+ };
75
+ };
76
+ cleanup(): {
77
+ deletedChannels: number;
78
+ expiredAuditLogs: number;
79
+ };
80
+ destroy(): void;
81
+ private addAuditLog;
82
+ private getDefaultLimits;
83
+ private getDefaultFeatures;
84
+ private startAutoCleanup;
85
+ private generateChannelId;
86
+ private generateSenderNumberId;
87
+ private generateAuditLogId;
88
+ }
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Permission Management System
3
+ * 채널 및 발신번호 액세스 권한 관리
4
+ */
5
+ import { EventEmitter } from "events";
6
+ export interface User {
7
+ id: string;
8
+ email: string;
9
+ name: string;
10
+ roles: Role[];
11
+ isActive: boolean;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
15
+ export interface Role {
16
+ id: string;
17
+ name: string;
18
+ permissions: Permission[];
19
+ description?: string;
20
+ isSystem: boolean;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ }
24
+ export interface Permission {
25
+ id: string;
26
+ resource: ResourceType;
27
+ action: ActionType;
28
+ scope: PermissionScope;
29
+ conditions?: PermissionCondition[];
30
+ }
31
+ export declare enum ResourceType {
32
+ CHANNEL = "channel",
33
+ SENDER_NUMBER = "senderNumber",
34
+ TEMPLATE = "template",
35
+ MESSAGE = "message",
36
+ USER = "user",
37
+ ROLE = "role",
38
+ AUDIT_LOG = "auditLog",
39
+ ANALYTICS = "analytics"
40
+ }
41
+ export declare enum ActionType {
42
+ CREATE = "create",
43
+ READ = "read",
44
+ UPDATE = "update",
45
+ DELETE = "delete",
46
+ VERIFY = "verify",
47
+ SUSPEND = "suspend",
48
+ ACTIVATE = "activate",
49
+ SEND = "send",
50
+ MANAGE = "manage"
51
+ }
52
+ export declare enum PermissionScope {
53
+ GLOBAL = "global",
54
+ ORGANIZATION = "organization",
55
+ TEAM = "team",
56
+ PERSONAL = "personal"
57
+ }
58
+ export interface PermissionCondition {
59
+ field: string;
60
+ operator: "equals" | "not_equals" | "in" | "not_in" | "contains" | "starts_with";
61
+ value: any;
62
+ }
63
+ export interface AccessContext {
64
+ userId: string;
65
+ organizationId?: string;
66
+ teamId?: string;
67
+ resourceOwnerId?: string;
68
+ metadata?: Record<string, any>;
69
+ }
70
+ export interface PermissionCheck {
71
+ userId: string;
72
+ resource: ResourceType;
73
+ action: ActionType;
74
+ resourceId?: string;
75
+ context?: AccessContext;
76
+ }
77
+ export interface PermissionResult {
78
+ granted: boolean;
79
+ reason?: string;
80
+ matchedPermissions: Permission[];
81
+ deniedReasons: string[];
82
+ }
83
+ export declare class PermissionManager extends EventEmitter {
84
+ private users;
85
+ private roles;
86
+ private userRoleCache;
87
+ private permissionCache;
88
+ private cacheExpiry;
89
+ private readonly CACHE_DURATION;
90
+ constructor();
91
+ createUser(userData: Omit<User, "id" | "createdAt" | "updatedAt">): Promise<User>;
92
+ getUser(userId: string): Promise<User | null>;
93
+ updateUser(userId: string, updates: Partial<User>): Promise<User>;
94
+ deleteUser(userId: string): Promise<boolean>;
95
+ createRole(roleData: Omit<Role, "id" | "createdAt" | "updatedAt">): Promise<Role>;
96
+ getRole(roleId: string): Promise<Role | null>;
97
+ updateRole(roleId: string, updates: Partial<Role>): Promise<Role>;
98
+ deleteRole(roleId: string): Promise<boolean>;
99
+ assignRoleToUser(userId: string, roleId: string): Promise<void>;
100
+ removeRoleFromUser(userId: string, roleId: string): Promise<void>;
101
+ checkPermission(check: PermissionCheck): Promise<PermissionResult>;
102
+ hasPermission(userId: string, resource: ResourceType, action: ActionType, resourceId?: string, context?: AccessContext): Promise<boolean>;
103
+ requirePermission(userId: string, resource: ResourceType, action: ActionType, resourceId?: string, context?: AccessContext): Promise<void>;
104
+ getUserPermissions(userId: string): Promise<Permission[]>;
105
+ getUserRoles(userId: string): Promise<Role[]>;
106
+ listUsers(filters?: {
107
+ isActive?: boolean;
108
+ roleId?: string;
109
+ }): User[];
110
+ listRoles(): Role[];
111
+ private performPermissionCheck;
112
+ private doesPermissionMatch;
113
+ private checkConditions;
114
+ private evaluateCondition;
115
+ private initializeSystemRoles;
116
+ private updateUserRoleCache;
117
+ private clearUserPermissionCache;
118
+ private clearRolePermissionCache;
119
+ private getCacheKey;
120
+ private getFromCache;
121
+ private setCache;
122
+ private generateUserId;
123
+ private generateRoleId;
124
+ }
@@ -0,0 +1,22 @@
1
+ import type { ChannelConfig, ChannelVerificationResult } from "../types/channel.types";
2
+ import { SenderNumberStatus } from "../types/channel.types";
3
+ export interface ServiceSenderNumber {
4
+ phoneNumber: string;
5
+ name?: string;
6
+ verifiedAt?: Date;
7
+ status: SenderNumberStatus;
8
+ channelId: string;
9
+ }
10
+ export declare class ChannelService {
11
+ private channels;
12
+ private senderNumbers;
13
+ createChannel(channel: Omit<ChannelConfig, "id" | "createdAt" | "updatedAt">): Promise<ChannelConfig>;
14
+ getChannel(channelId: string): Promise<ChannelConfig | null>;
15
+ listChannels(providerId?: string): Promise<ChannelConfig[]>;
16
+ updateChannel(channelId: string, updates: Partial<ChannelConfig>): Promise<ChannelConfig>;
17
+ deleteChannel(channelId: string): Promise<void>;
18
+ addSenderNumber(channelId: string, phoneNumber: string, name?: string): Promise<ServiceSenderNumber>;
19
+ verifySenderNumber(phoneNumber: string): Promise<ChannelVerificationResult>;
20
+ getSenderNumbers(channelId?: string): Promise<ServiceSenderNumber[]>;
21
+ private generateChannelId;
22
+ }
@@ -0,0 +1,228 @@
1
+ import { z } from "zod";
2
+ export interface Channel {
3
+ id: string;
4
+ name: string;
5
+ provider: string;
6
+ type: ChannelType;
7
+ status: ChannelStatus;
8
+ profileKey: string;
9
+ senderNumbers: SenderNumber[];
10
+ metadata: ChannelMetadata;
11
+ verification: ChannelVerification;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
15
+ export declare enum ChannelType {
16
+ KAKAO_ALIMTALK = "KAKAO_ALIMTALK",
17
+ KAKAO_FRIENDTALK = "KAKAO_FRIENDTALK",
18
+ SMS = "SMS",
19
+ LMS = "LMS",
20
+ MMS = "MMS"
21
+ }
22
+ export declare enum ChannelStatus {
23
+ PENDING = "PENDING",// 등록 대기
24
+ VERIFYING = "VERIFYING",// 검증 중
25
+ ACTIVE = "ACTIVE",// 활성화
26
+ SUSPENDED = "SUSPENDED",// 일시 정지
27
+ BLOCKED = "BLOCKED",// 차단됨
28
+ DELETED = "DELETED"
29
+ }
30
+ export interface SenderNumber {
31
+ id: string;
32
+ phoneNumber: string;
33
+ status: SenderNumberStatus;
34
+ verificationCode?: string;
35
+ verifiedAt?: Date;
36
+ category: SenderNumberCategory;
37
+ metadata: {
38
+ businessName?: string;
39
+ businessRegistrationNumber?: string;
40
+ contactPerson?: string;
41
+ contactEmail?: string;
42
+ };
43
+ createdAt: Date;
44
+ updatedAt: Date;
45
+ }
46
+ export declare enum SenderNumberStatus {
47
+ PENDING = "PENDING",// 등록 대기
48
+ VERIFYING = "VERIFYING",// 인증 중
49
+ VERIFIED = "VERIFIED",// 인증 완료
50
+ REJECTED = "REJECTED",// 반려됨
51
+ BLOCKED = "BLOCKED"
52
+ }
53
+ export declare enum SenderNumberCategory {
54
+ BUSINESS = "BUSINESS",// 사업자
55
+ PERSONAL = "PERSONAL",// 개인
56
+ GOVERNMENT = "GOVERNMENT",// 관공서
57
+ NON_PROFIT = "NON_PROFIT"
58
+ }
59
+ export interface ChannelMetadata {
60
+ businessInfo?: {
61
+ name: string;
62
+ registrationNumber: string;
63
+ category: string;
64
+ contactPerson: string;
65
+ contactEmail: string;
66
+ contactPhone: string;
67
+ };
68
+ kakaoInfo?: {
69
+ plusFriendId: string;
70
+ brandName: string;
71
+ logoUrl?: string;
72
+ description?: string;
73
+ };
74
+ limits: {
75
+ dailyMessageLimit: number;
76
+ monthlyMessageLimit: number;
77
+ rateLimit: number;
78
+ };
79
+ features: {
80
+ supportsBulkSending: boolean;
81
+ supportsScheduling: boolean;
82
+ supportsButtons: boolean;
83
+ maxButtonCount: number;
84
+ };
85
+ }
86
+ export interface ChannelVerification {
87
+ status: VerificationStatus;
88
+ documents: VerificationDocument[];
89
+ verifiedAt?: Date;
90
+ rejectedAt?: Date;
91
+ rejectionReason?: string;
92
+ verifiedBy?: string;
93
+ }
94
+ export declare enum VerificationStatus {
95
+ NOT_REQUIRED = "NOT_REQUIRED",
96
+ PENDING = "PENDING",
97
+ UNDER_REVIEW = "UNDER_REVIEW",
98
+ VERIFIED = "VERIFIED",
99
+ REJECTED = "REJECTED"
100
+ }
101
+ export interface VerificationDocument {
102
+ id: string;
103
+ type: DocumentType;
104
+ fileName: string;
105
+ fileUrl: string;
106
+ uploadedAt: Date;
107
+ status: DocumentStatus;
108
+ }
109
+ export declare enum DocumentType {
110
+ BUSINESS_REGISTRATION = "BUSINESS_REGISTRATION",
111
+ BUSINESS_LICENSE = "BUSINESS_LICENSE",
112
+ ID_CARD = "ID_CARD",
113
+ AUTHORIZATION_LETTER = "AUTHORIZATION_LETTER",
114
+ OTHER = "OTHER"
115
+ }
116
+ export declare enum DocumentStatus {
117
+ UPLOADED = "UPLOADED",
118
+ VERIFIED = "VERIFIED",
119
+ REJECTED = "REJECTED"
120
+ }
121
+ export interface ChannelCreateRequest {
122
+ name: string;
123
+ type: ChannelType;
124
+ provider: string;
125
+ profileKey: string;
126
+ businessInfo?: {
127
+ name: string;
128
+ registrationNumber: string;
129
+ category: string;
130
+ contactPerson: string;
131
+ contactEmail: string;
132
+ contactPhone: string;
133
+ };
134
+ kakaoInfo?: {
135
+ plusFriendId: string;
136
+ brandName: string;
137
+ logoUrl?: string;
138
+ description?: string;
139
+ };
140
+ }
141
+ export interface SenderNumberCreateRequest {
142
+ phoneNumber: string;
143
+ category: SenderNumberCategory;
144
+ businessInfo?: {
145
+ businessName: string;
146
+ businessRegistrationNumber: string;
147
+ contactPerson: string;
148
+ contactEmail: string;
149
+ };
150
+ }
151
+ export interface ChannelFilters {
152
+ provider?: string;
153
+ type?: ChannelType;
154
+ status?: ChannelStatus;
155
+ verified?: boolean;
156
+ createdAfter?: Date;
157
+ createdBefore?: Date;
158
+ }
159
+ export interface SenderNumberFilters {
160
+ channelId?: string;
161
+ status?: SenderNumberStatus;
162
+ category?: SenderNumberCategory;
163
+ verified?: boolean;
164
+ }
165
+ export declare const ChannelCreateRequestSchema: z.ZodObject<{
166
+ name: z.ZodString;
167
+ type: z.ZodEnum<typeof ChannelType>;
168
+ provider: z.ZodString;
169
+ profileKey: z.ZodString;
170
+ businessInfo: z.ZodOptional<z.ZodObject<{
171
+ name: z.ZodString;
172
+ registrationNumber: z.ZodString;
173
+ category: z.ZodString;
174
+ contactPerson: z.ZodString;
175
+ contactEmail: z.ZodString;
176
+ contactPhone: z.ZodString;
177
+ }, z.core.$strip>>;
178
+ kakaoInfo: z.ZodOptional<z.ZodObject<{
179
+ plusFriendId: z.ZodString;
180
+ brandName: z.ZodString;
181
+ logoUrl: z.ZodOptional<z.ZodString>;
182
+ description: z.ZodOptional<z.ZodString>;
183
+ }, z.core.$strip>>;
184
+ }, z.core.$strip>;
185
+ export declare const SenderNumberCreateRequestSchema: z.ZodObject<{
186
+ phoneNumber: z.ZodString;
187
+ category: z.ZodEnum<typeof SenderNumberCategory>;
188
+ businessInfo: z.ZodOptional<z.ZodObject<{
189
+ businessName: z.ZodString;
190
+ businessRegistrationNumber: z.ZodString;
191
+ contactPerson: z.ZodString;
192
+ contactEmail: z.ZodString;
193
+ }, z.core.$strip>>;
194
+ }, z.core.$strip>;
195
+ export declare const ChannelFiltersSchema: z.ZodObject<{
196
+ provider: z.ZodOptional<z.ZodString>;
197
+ type: z.ZodOptional<z.ZodEnum<typeof ChannelType>>;
198
+ status: z.ZodOptional<z.ZodEnum<typeof ChannelStatus>>;
199
+ verified: z.ZodOptional<z.ZodBoolean>;
200
+ createdAfter: z.ZodOptional<z.ZodDate>;
201
+ createdBefore: z.ZodOptional<z.ZodDate>;
202
+ }, z.core.$strip>;
203
+ export declare const SenderNumberFiltersSchema: z.ZodObject<{
204
+ channelId: z.ZodOptional<z.ZodString>;
205
+ status: z.ZodOptional<z.ZodEnum<typeof SenderNumberStatus>>;
206
+ category: z.ZodOptional<z.ZodEnum<typeof SenderNumberCategory>>;
207
+ verified: z.ZodOptional<z.ZodBoolean>;
208
+ }, z.core.$strip>;
209
+ export type ChannelCreateRequestType = z.infer<typeof ChannelCreateRequestSchema>;
210
+ export type SenderNumberCreateRequestType = z.infer<typeof SenderNumberCreateRequestSchema>;
211
+ export type ChannelFiltersType = z.infer<typeof ChannelFiltersSchema>;
212
+ export type SenderNumberFiltersType = z.infer<typeof SenderNumberFiltersSchema>;
213
+ export interface ChannelConfig {
214
+ id: string;
215
+ name: string;
216
+ type: "alimtalk" | "sms" | "lms" | "friendtalk";
217
+ providerId: string;
218
+ active: boolean;
219
+ settings: Record<string, any>;
220
+ createdAt: Date;
221
+ updatedAt: Date;
222
+ }
223
+ export interface ChannelVerificationResult {
224
+ success: boolean;
225
+ status: string;
226
+ verificationCode?: string;
227
+ error?: string;
228
+ }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Business Verification System
3
+ * 사업자 정보 및 서류 검증 시스템
4
+ */
5
+ import { EventEmitter } from "events";
6
+ import { DocumentType, type VerificationDocument, VerificationStatus } from "../types/channel.types";
7
+ export interface BusinessInfo {
8
+ businessName: string;
9
+ businessRegistrationNumber: string;
10
+ businessType: "corporation" | "individual" | "partnership" | "other";
11
+ industry: string;
12
+ establishedDate: Date;
13
+ address: {
14
+ street: string;
15
+ city: string;
16
+ state: string;
17
+ postalCode: string;
18
+ country: string;
19
+ };
20
+ contactInfo: {
21
+ phoneNumber: string;
22
+ email: string;
23
+ website?: string;
24
+ };
25
+ representatives: Array<{
26
+ name: string;
27
+ position: string;
28
+ phoneNumber: string;
29
+ email: string;
30
+ }>;
31
+ }
32
+ export interface VerificationRequest {
33
+ id: string;
34
+ channelId: string;
35
+ businessInfo: BusinessInfo;
36
+ documents: VerificationDocument[];
37
+ status: VerificationStatus;
38
+ submittedAt: Date;
39
+ reviewedAt?: Date;
40
+ reviewedBy?: string;
41
+ reviewNotes?: string;
42
+ autoVerificationResults?: AutoVerificationResult[];
43
+ }
44
+ export interface AutoVerificationResult {
45
+ checkType: "business_registry" | "document_validation" | "address_verification" | "phone_verification";
46
+ status: "passed" | "failed" | "warning";
47
+ score: number;
48
+ details: string;
49
+ metadata?: Record<string, any>;
50
+ }
51
+ export interface DocumentValidationResult {
52
+ isValid: boolean;
53
+ confidence: number;
54
+ extractedData?: Record<string, any>;
55
+ issues: Array<{
56
+ type: "format" | "content" | "quality" | "authenticity";
57
+ severity: "low" | "medium" | "high" | "critical";
58
+ message: string;
59
+ }>;
60
+ }
61
+ export interface BusinessVerifierOptions {
62
+ enableAutoVerification: boolean;
63
+ requiredDocuments: DocumentType[];
64
+ autoApprovalThreshold: number;
65
+ requireManualReview: boolean;
66
+ documentRetentionDays: number;
67
+ enableExternalAPIs: boolean;
68
+ externalAPIConfig?: {
69
+ businessRegistryAPI?: string;
70
+ addressVerificationAPI?: string;
71
+ documentOCRAPI?: string;
72
+ };
73
+ }
74
+ export declare class BusinessVerifier extends EventEmitter {
75
+ private options;
76
+ private verificationRequests;
77
+ private documentValidators;
78
+ private defaultOptions;
79
+ constructor(options?: Partial<BusinessVerifierOptions>);
80
+ /**
81
+ * Submit business verification request
82
+ */
83
+ submitVerification(channelId: string, businessInfo: BusinessInfo, documents: VerificationDocument[]): Promise<VerificationRequest>;
84
+ /**
85
+ * Get verification request by ID
86
+ */
87
+ getVerificationRequest(requestId: string): VerificationRequest | null;
88
+ /**
89
+ * Get verification request by channel ID
90
+ */
91
+ getVerificationByChannelId(channelId: string): VerificationRequest | null;
92
+ /**
93
+ * Manually approve verification
94
+ */
95
+ approveVerification(requestId: string, reviewerId: string, notes?: string): Promise<VerificationRequest>;
96
+ /**
97
+ * Manually reject verification
98
+ */
99
+ rejectVerification(requestId: string, reviewerId: string, reason: string): Promise<VerificationRequest>;
100
+ /**
101
+ * Update verification request with additional documents
102
+ */
103
+ addDocument(requestId: string, document: VerificationDocument): Promise<VerificationRequest>;
104
+ /**
105
+ * List verification requests with filters
106
+ */
107
+ listVerificationRequests(filters?: {
108
+ status?: VerificationStatus;
109
+ channelId?: string;
110
+ submittedAfter?: Date;
111
+ submittedBefore?: Date;
112
+ }): VerificationRequest[];
113
+ /**
114
+ * Get verification statistics
115
+ */
116
+ getVerificationStats(): {
117
+ total: number;
118
+ byStatus: Record<string, number>;
119
+ averageProcessingTime: number;
120
+ autoApprovalRate: number;
121
+ };
122
+ private processAutoVerification;
123
+ private validateRequiredDocuments;
124
+ private verifyBusinessRegistration;
125
+ private calculateBusinessRegistrationScore;
126
+ private validateDocument;
127
+ private verifyAddress;
128
+ private verifyPhoneNumber;
129
+ private initializeDocumentValidators;
130
+ private generateRequestId;
131
+ }