Skip to content

Commit 7f622b9

Browse files
committed
feat(aml): add NAME_TOO_SHORT check for bank payout validation
Add AML check to reject transactions where the user's name contains fewer than 4 letters. Banks require a minimum name length for processing. Changes: - Add AmlError.NAME_TOO_SHORT with CRUCIAL type and FAIL status - Add AmlReason.NAME_TOO_SHORT - Add countLetters() helper to count only alphabetic characters - Add name length validation in getAmlErrors() after NAME_MISSING check - Update SiftAmlDeclineMap and TransactionReasonMapper The check uses verifiedName, bankData.name, or completeName (in that order) and counts only letters (including European special characters like ä, ö, ü, ß).
1 parent b234dae commit 7f622b9

5 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/integration/sift/dto/sift.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ export const SiftAmlDeclineMap: { [method in AmlReason]: DeclineCategory } = {
10371037
[AmlReason.BANK_RELEASE_PENDING]: DeclineCategory.OTHER,
10381038
[AmlReason.VIRTUAL_IBAN_USER_MISMATCH]: DeclineCategory.RISKY,
10391039
[AmlReason.INTERMEDIARY_WITHOUT_SENDER]: DeclineCategory.RISKY,
1040+
[AmlReason.NAME_TOO_SHORT]: DeclineCategory.OTHER,
10401041
};
10411042

10421043
export interface ScoreRsponse {

src/subdomains/core/aml/enums/aml-error.enum.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export enum AmlError {
2626
INVALID_KYC_TYPE = 'InvalidKycType',
2727
NO_VERIFIED_NAME = 'NoVerifiedName',
2828
NAME_MISSING = 'NameMissing',
29+
NAME_TOO_SHORT = 'NameTooShort',
2930
VERIFIED_COUNTRY_NOT_ALLOWED = 'VerifiedCountryNotAllowed',
3031
IBAN_COUNTRY_FATF_NOT_ALLOWED = 'IbanCountryFatfNotAllowed',
3132
TX_COUNTRY_NOT_ALLOWED = 'TxCountryNotAllowed',
@@ -151,6 +152,11 @@ export const AmlErrorResult: {
151152
amlCheck: CheckStatus.PENDING,
152153
amlReason: AmlReason.KYC_DATA_NEEDED,
153154
},
155+
[AmlError.NAME_TOO_SHORT]: {
156+
type: AmlErrorType.CRUCIAL,
157+
amlCheck: CheckStatus.FAIL,
158+
amlReason: AmlReason.NAME_TOO_SHORT,
159+
},
154160
[AmlError.VERIFIED_COUNTRY_NOT_ALLOWED]: {
155161
type: AmlErrorType.CRUCIAL,
156162
amlCheck: CheckStatus.GSHEET,

src/subdomains/core/aml/enums/aml-reason.enum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export enum AmlReason {
3939
BANK_RELEASE_PENDING = 'BankReleasePending',
4040
VIRTUAL_IBAN_USER_MISMATCH = 'VirtualIbanUserMismatch',
4141
INTERMEDIARY_WITHOUT_SENDER = 'IntermediaryWithoutSender',
42+
NAME_TOO_SHORT = 'NameTooShort',
4243
}
4344

4445
export const KycAmlReasons = [

src/subdomains/core/aml/services/aml-helper.service.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ export class AmlHelperService {
6969
if (!entity.userData.verifiedName) errors.push(AmlError.NO_VERIFIED_NAME);
7070
if (!entity.userData.verifiedName && !bankData?.name && !entity.userData.completeName)
7171
errors.push(AmlError.NAME_MISSING);
72+
73+
// Check name length (min 4 letters for bank processing)
74+
const completeName = entity.userData.verifiedName ?? bankData?.name ?? entity.userData.completeName;
75+
if (completeName && this.countLetters(completeName) < 4) {
76+
errors.push(AmlError.NAME_TOO_SHORT);
77+
}
78+
7279
if (entity.userData.verifiedCountry && !entity.userData.verifiedCountry.fatfEnable)
7380
errors.push(AmlError.VERIFIED_COUNTRY_NOT_ALLOWED);
7481
if (ibanCountry && !ibanCountry.fatfEnable) errors.push(AmlError.IBAN_COUNTRY_FATF_NOT_ALLOWED);
@@ -606,4 +613,8 @@ export class AmlHelperService {
606613
// No Result - only comment
607614
return { bankData, comment };
608615
}
616+
617+
private static countLetters(str: string): number {
618+
return str.replace(/[^a-zA-ZäöüÄÖÜàáâãéèêëìíîïòóôõùúûüñçßÀÁÂÃÈÉÊËÌÍÎÏÒÓÔÕÙÚÛÜÑÇ]/g, '').length;
619+
}
609620
}

src/subdomains/supporting/payment/dto/transaction.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const TransactionReasonMapper: {
114114
[AmlReason.BANK_RELEASE_PENDING]: TransactionReason.BANK_RELEASE_PENDING,
115115
[AmlReason.VIRTUAL_IBAN_USER_MISMATCH]: TransactionReason.UNKNOWN,
116116
[AmlReason.INTERMEDIARY_WITHOUT_SENDER]: TransactionReason.BANK_NOT_ALLOWED,
117+
[AmlReason.NAME_TOO_SHORT]: TransactionReason.KYC_DATA_NEEDED,
117118
};
118119

119120
export class UnassignedTransactionDto {

0 commit comments

Comments
 (0)