Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/integration/sift/dto/sift.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ export const SiftAmlDeclineMap: { [method in AmlReason]: DeclineCategory } = {
[AmlReason.VIRTUAL_IBAN_USER_MISMATCH]: DeclineCategory.RISKY,
[AmlReason.INTERMEDIARY_WITHOUT_SENDER]: DeclineCategory.RISKY,
[AmlReason.NAME_TOO_SHORT]: DeclineCategory.OTHER,
[AmlReason.ASSET_INPUT_NOT_ALLOWED]: DeclineCategory.INVALID,
};

export interface ScoreRsponse {
Expand Down
6 changes: 6 additions & 0 deletions src/subdomains/core/aml/enums/aml-error.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export enum AmlError {
TRADE_APPROVAL_DATE_MISSING = 'TradeApprovalDateMissing',
BANK_TX_CUSTOMER_NAME_MISSING = 'BankTxCustomerNameMissing',
FORCE_MANUAL_CHECK = 'ForceManualCheck',
ASSET_INPUT_NOT_ALLOWED = 'AssetInputNotAllowed',
}

export const DelayResultError = [
Expand Down Expand Up @@ -328,4 +329,9 @@ export const AmlErrorResult: {
amlCheck: CheckStatus.PENDING,
amlReason: AmlReason.MANUAL_CHECK,
},
[AmlError.ASSET_INPUT_NOT_ALLOWED]: {
type: AmlErrorType.CRUCIAL,
amlCheck: CheckStatus.FAIL,
amlReason: AmlReason.ASSET_INPUT_NOT_ALLOWED,
},
};
1 change: 1 addition & 0 deletions src/subdomains/core/aml/enums/aml-reason.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export enum AmlReason {
VIRTUAL_IBAN_USER_MISMATCH = 'VirtualIbanUserMismatch',
INTERMEDIARY_WITHOUT_SENDER = 'IntermediaryWithoutSender',
NAME_TOO_SHORT = 'NameTooShort',
ASSET_INPUT_NOT_ALLOWED = 'AssetInputNotAllowed',
}

export const KycAmlReasons = [
Expand Down
4 changes: 3 additions & 1 deletion src/subdomains/core/aml/services/aml-helper.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config, Environment } from 'src/config/config';
import { Active } from 'src/shared/models/active';
import { Active, isAsset } from 'src/shared/models/active';
import { Country } from 'src/shared/models/country/country.entity';
import { DisabledProcess, Process } from 'src/shared/services/process.service';
import { Util } from 'src/shared/utils/util';
Expand Down Expand Up @@ -52,6 +52,8 @@ export class AmlHelperService {
)
return errors;

if (isAsset(inputAsset) && inputAsset.name === 'REALU') errors.push(AmlError.ASSET_INPUT_NOT_ALLOWED);

if (
!DisabledProcess(Process.TRADE_APPROVAL_DATE) &&
!entity.userData.tradeApprovalDate &&
Expand Down
14 changes: 10 additions & 4 deletions src/subdomains/supporting/log/log-job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,16 @@ export class LogJobService {
const cryptoInput = [Blockchain.MONERO, Blockchain.LIGHTNING, Blockchain.ZANO].includes(curr.blockchain)
? 0
: pendingPayIns.reduce((sum, tx) => sum + (tx.asset.id === curr.id ? tx.amount : 0), 0);
const exchangeOrder = pendingExchangeOrders.reduce(
(sum, tx) => sum + (tx.pipeline.rule.targetAsset.id === curr.id ? tx.inputAmount : 0),
0,
);
const exchangeOrder = pendingExchangeOrders.reduce((sum, tx) => {
if (tx.pipeline.rule.targetAsset.id !== curr.id) return sum;

// for transfer/deposit: only count when action.system matches the target asset's exchange
// (funds leaving this exchange, balance decreased). Skip when funds arrive from another
// exchange, as the destination balance already reflects those funds before order completion.
if (tx.action.command !== 'withdraw' && tx.action.system !== (curr.blockchain as string)) return sum;

return sum + tx.inputAmount;
}, 0);
const bridgeOrder = pendingBridgeOrders.reduce(
(sum, tx) => sum + (tx.pipeline.rule.targetAsset.id === curr.id ? tx.inputAmount : 0),
0,
Expand Down
1 change: 1 addition & 0 deletions src/subdomains/supporting/payment/dto/transaction.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const TransactionReasonMapper: {
[AmlReason.VIRTUAL_IBAN_USER_MISMATCH]: TransactionReason.UNKNOWN,
[AmlReason.INTERMEDIARY_WITHOUT_SENDER]: TransactionReason.BANK_NOT_ALLOWED,
[AmlReason.NAME_TOO_SHORT]: TransactionReason.KYC_DATA_NEEDED,
[AmlReason.ASSET_INPUT_NOT_ALLOWED]: TransactionReason.ASSET_NOT_AVAILABLE,
};

export class UnassignedTransactionDto {
Expand Down
Loading