mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-03-10 17:11:44 +00:00
Merge pull request #69 from Zod-Alkhair/feature/kyc-onboarding
feat: enhance KYC process with external customer ID validation
This commit is contained in:
@ -34,6 +34,10 @@ export class CardService {
|
||||
throw new BadRequestException('CUSTOMER.KYC_NOT_APPROVED');
|
||||
}
|
||||
|
||||
if (!customer.neoleapExternalCustomerId) {
|
||||
throw new BadRequestException('CUSTOMER.KYC_NOT_COMPLETED');
|
||||
}
|
||||
|
||||
if (customer.cards.length > 0) {
|
||||
throw new BadRequestException('CUSTOMER.ALREADY_HAS_CARD');
|
||||
}
|
||||
|
||||
@ -188,7 +188,9 @@ export class NeoLeapService {
|
||||
},
|
||||
BillingCycle: 'C1',
|
||||
},
|
||||
ApplicationOtherInfo: {},
|
||||
ApplicationOtherInfo: {
|
||||
ExternalCorporateId: customer.neoleapExternalCustomerId,
|
||||
},
|
||||
ApplicationCustomerDetails: {
|
||||
FirstName: customer.firstName,
|
||||
LastName: customer.lastName,
|
||||
|
||||
@ -163,14 +163,15 @@ export class CustomerService {
|
||||
completedAt: new Date(),
|
||||
});
|
||||
|
||||
// Update customer KYC status
|
||||
// Update customer KYC status and external customer ID
|
||||
const kycStatus = body.status === 'ONBOARDING_SUCCESS' ? KycStatus.APPROVED : KycStatus.REJECTED;
|
||||
|
||||
|
||||
await this.customerRepository.updateCustomer(customer.id, {
|
||||
kycStatus,
|
||||
neoleapExternalCustomerId: body.entity.externalId,
|
||||
});
|
||||
|
||||
this.logger.log(`KYC updated successfully for customer ${customer.id}, status: ${body.status}`);
|
||||
this.logger.log(`KYC updated successfully for customer ${customer.id}, status: ${body.status}, externalId: ${body.entity.externalId}`);
|
||||
}
|
||||
|
||||
// TO BE REMOVED: This function is for testing only and will be removed
|
||||
|
||||
Reference in New Issue
Block a user