feat(backend): Implement KYC/AML integration hook (closes #496) - #508
Open
graceshaba93 wants to merge 1 commit into
Open
feat(backend): Implement KYC/AML integration hook (closes #496)#508graceshaba93 wants to merge 1 commit into
graceshaba93 wants to merge 1 commit into
Conversation
|
@graceshaba93 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
@graceshaba93 kindly resolve the error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #496
Description
This PR implements a comprehensive KYC (Know Your Customer) and AML (Anti-Money Laundering) integration system for the Vaultix backend. The system uses a pluggable provider pattern to support multiple identity verification providers and sanctions screening services, meeting compliance requirements for a production financial platform.
Changes Made
New Files (13 files)
KYC Module (
apps/backend/src/modules/kyc/)kyc.module.ts- Module definition registering all KYC providers, controllers, services, and exportsentities/kyc-verification.entity.ts- Entity for tracking individual KYC verification sessions with provider metadatainterfaces/kyc-provider.interface.ts- PluggableIKycProviderinterface for KYC provider implementationsinterfaces/aml-provider.interface.ts- PluggableIAmlProviderinterface for AML screening implementationsservices/kyc.service.ts- Core KYC service with provider pattern, webhook processing, and admin managementservices/aml.service.ts- AML screening service with address checking and transaction party screeningcontrollers/kyc.controller.ts- User-facing endpoints:GET /kyc/status,POST /kyc/initiatecontrollers/kyc-webhook.controller.ts- Webhook endpoint:POST /kyc/webhook/:providerfor provider callbackscontrollers/kyc.controller.spec.ts- Unit tests for KYC controllerservices/kyc.service.spec.ts- Unit tests for KYC serviceservices/aml.service.spec.ts- Unit tests for AML serviceproviders/mock-kyc.provider.ts- Mock KYC provider for dev/testingproviders/mock-aml.provider.ts- Mock AML provider for dev/testingdto/kyc.dto.ts- DTOs with class-validator decorators for all KYC endpointsguards/kyc.guard.ts- Guard that gates high-value escrows behind KYC verificationAdmin KYC Management
apps/backend/src/modules/admin/controllers/admin-kyc.controller.ts- Admin endpoints:GET /admin/kyc/users,PATCH /admin/kyc/users/:id/statuswith audit loggingMigration & Documentation
apps/backend/src/migrations/1780700000000-AddKycAndAml.ts- Migration addingkycStatus,kycRejectionReason,kycVerifiedAtto users table and creatingkyc_verificationstableapps/backend/docs/KYC_FLOW.md- Comprehensive documentation covering architecture, API endpoints, provider configuration, AML flow, and testing proceduresModified Files
apps/backend/src/modules/user/entities/user.entity.ts- AddedkycStatus,kycRejectionReason,kycVerifiedAtfields and exportedKycStatusenumapps/backend/src/app.module.ts- RegisteredKycModuleandKycVerificationentityapps/backend/src/data-source.ts- RegisteredKycVerificationentity for CLI migrationsapps/backend/src/modules/auth/controllers/auth.controller.ts- AddedkycStatustoGET /auth/meresponseapps/backend/src/modules/escrow/escrow.module.ts- AddedKycModuleimport forKycGuardDIapps/backend/src/modules/escrow/controllers/escrow.controller.ts- AddedKycGuardto escrow creation endpoint for high-value gatingapps/backend/src/modules/admin/admin.module.ts- AddedKycModuleimport andAdminKycControllerapps/backend/.env.example- Added KYC and AML configuration variablesapps/backend/package.json- AddeduuiddependencyArchitecture
Pluggable Provider Pattern
Both KYC and AML use a strategy pattern allowing different providers to be swapped via configuration:
API Endpoints
GET/v1/kyc/statusPOST/v1/kyc/initiatePOST/v1/kyc/webhook/:providerGET/v1/admin/kyc/usersPATCH/v1/admin/kyc/users/:id/statusKYC Status Flow
High-Value Escrow Gating
Escrows above
KYC_REQUIRED_MIN_ESCROW_AMOUNT(default: 1000 XLM) require KYC verification via theKycGuard, which returns 403 for unverified users.Testing
Configuration
Screenshots / gifs
N/A — backend-only change
How Has This Been Tested?
Checklist