update project
This commit is contained in:
18
apps/api/src/events/handlers/kyc-verified.handler.ts
Normal file
18
apps/api/src/events/handlers/kyc-verified.handler.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { UserModel } from '../../models/user.model';
|
||||
|
||||
interface KycVerifiedPayload {
|
||||
bitok_user_id: string;
|
||||
kyc_verified: boolean;
|
||||
kyc_level: string;
|
||||
}
|
||||
|
||||
export async function handleKycVerified(payload: Record<string, unknown>): Promise<void> {
|
||||
const data = payload as unknown as KycVerifiedPayload;
|
||||
|
||||
if (!data.bitok_user_id || typeof data.kyc_verified !== 'boolean') {
|
||||
throw new Error('Invalid kyc_verified payload');
|
||||
}
|
||||
|
||||
await UserModel.updateKyc(data.bitok_user_id, data.kyc_verified, data.kyc_level || null);
|
||||
console.log(`[KYC] Updated KYC for user ${data.bitok_user_id}: verified=${data.kyc_verified}, level=${data.kyc_level}`);
|
||||
}
|
||||
Reference in New Issue
Block a user