Description: KycService.getVerificationStatus explicitly exists "used by payouts module" per its own comment, yet PayoutsService.createPayout never calls it — a payout record (and eventually funds) can be created for an instructor who has never submitted or been approved for KYC, defeating the purpose of the KYC gate described in KycService.review's notification copy ("You are now eligible to receive payouts").
Requirements:
- Inject
KycService into PayoutsService and call getVerificationStatus(instructorId) in createPayout, rejecting with ForbiddenException when isVerified is false.
- Surface a clear error message directing the instructor to complete KYC.
- Add a test asserting payout creation for an unverified instructor is rejected, and succeeds for a verified one.
Acceptance Criteria:
POST /payouts for an instructor without an APPROVED KYC submission returns 403 with a clear message.
POST /payouts for a KYC-verified instructor continues to succeed.
Technical Details:
Files: src/modules/payouts/payouts.service.ts, src/modules/payouts/payouts.module.ts, src/modules/kyc/kyc.service.ts, src/modules/kyc/kyc.module.ts
Libraries: prisma, @nestjs/common
Description:
KycService.getVerificationStatusexplicitly exists "used by payouts module" per its own comment, yetPayoutsService.createPayoutnever calls it — a payout record (and eventually funds) can be created for an instructor who has never submitted or been approved for KYC, defeating the purpose of the KYC gate described inKycService.review's notification copy ("You are now eligible to receive payouts").Requirements:
KycServiceintoPayoutsServiceand callgetVerificationStatus(instructorId)increatePayout, rejecting withForbiddenExceptionwhenisVerifiedis false.Acceptance Criteria:
POST /payoutsfor an instructor without an APPROVED KYC submission returns 403 with a clear message.POST /payoutsfor a KYC-verified instructor continues to succeed.Technical Details:
Files: src/modules/payouts/payouts.service.ts, src/modules/payouts/payouts.module.ts, src/modules/kyc/kyc.service.ts, src/modules/kyc/kyc.module.ts
Libraries: prisma, @nestjs/common