Skip to content

Commit c6be5a8

Browse files
authored
Merge pull request #3287 from DFXswiss/develop
Release: develop -> main
2 parents c0c6337 + f58cdc9 commit c6be5a8

6 files changed

Lines changed: 22 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ export const SiftAmlDeclineMap: { [method in AmlReason]: DeclineCategory } = {
10381038
[AmlReason.VIRTUAL_IBAN_USER_MISMATCH]: DeclineCategory.RISKY,
10391039
[AmlReason.INTERMEDIARY_WITHOUT_SENDER]: DeclineCategory.RISKY,
10401040
[AmlReason.NAME_TOO_SHORT]: DeclineCategory.OTHER,
1041+
[AmlReason.ASSET_INPUT_NOT_ALLOWED]: DeclineCategory.INVALID,
10411042
};
10421043

10431044
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
@@ -67,6 +67,7 @@ export enum AmlError {
6767
TRADE_APPROVAL_DATE_MISSING = 'TradeApprovalDateMissing',
6868
BANK_TX_CUSTOMER_NAME_MISSING = 'BankTxCustomerNameMissing',
6969
FORCE_MANUAL_CHECK = 'ForceManualCheck',
70+
ASSET_INPUT_NOT_ALLOWED = 'AssetInputNotAllowed',
7071
}
7172

7273
export const DelayResultError = [
@@ -328,4 +329,9 @@ export const AmlErrorResult: {
328329
amlCheck: CheckStatus.PENDING,
329330
amlReason: AmlReason.MANUAL_CHECK,
330331
},
332+
[AmlError.ASSET_INPUT_NOT_ALLOWED]: {
333+
type: AmlErrorType.CRUCIAL,
334+
amlCheck: CheckStatus.FAIL,
335+
amlReason: AmlReason.ASSET_INPUT_NOT_ALLOWED,
336+
},
331337
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export enum AmlReason {
4040
VIRTUAL_IBAN_USER_MISMATCH = 'VirtualIbanUserMismatch',
4141
INTERMEDIARY_WITHOUT_SENDER = 'IntermediaryWithoutSender',
4242
NAME_TOO_SHORT = 'NameTooShort',
43+
ASSET_INPUT_NOT_ALLOWED = 'AssetInputNotAllowed',
4344
}
4445

4546
export const KycAmlReasons = [

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Config, Environment } from 'src/config/config';
2-
import { Active } from 'src/shared/models/active';
2+
import { Active, isAsset } from 'src/shared/models/active';
33
import { Country } from 'src/shared/models/country/country.entity';
44
import { DisabledProcess, Process } from 'src/shared/services/process.service';
55
import { Util } from 'src/shared/utils/util';
@@ -52,6 +52,8 @@ export class AmlHelperService {
5252
)
5353
return errors;
5454

55+
if (isAsset(inputAsset) && inputAsset.name === 'REALU') errors.push(AmlError.ASSET_INPUT_NOT_ALLOWED);
56+
5557
if (
5658
!DisabledProcess(Process.TRADE_APPROVAL_DATE) &&
5759
!entity.userData.tradeApprovalDate &&

src/subdomains/supporting/log/log-job.service.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,16 @@ export class LogJobService {
454454
const cryptoInput = [Blockchain.MONERO, Blockchain.LIGHTNING, Blockchain.ZANO].includes(curr.blockchain)
455455
? 0
456456
: pendingPayIns.reduce((sum, tx) => sum + (tx.asset.id === curr.id ? tx.amount : 0), 0);
457-
const exchangeOrder = pendingExchangeOrders.reduce(
458-
(sum, tx) => sum + (tx.pipeline.rule.targetAsset.id === curr.id ? tx.inputAmount : 0),
459-
0,
460-
);
457+
const exchangeOrder = pendingExchangeOrders.reduce((sum, tx) => {
458+
if (tx.pipeline.rule.targetAsset.id !== curr.id) return sum;
459+
460+
// for transfer/deposit: only count when action.system matches the target asset's exchange
461+
// (funds leaving this exchange, balance decreased). Skip when funds arrive from another
462+
// exchange, as the destination balance already reflects those funds before order completion.
463+
if (tx.action.command !== 'withdraw' && tx.action.system !== (curr.blockchain as string)) return sum;
464+
465+
return sum + tx.inputAmount;
466+
}, 0);
461467
const bridgeOrder = pendingBridgeOrders.reduce(
462468
(sum, tx) => sum + (tx.pipeline.rule.targetAsset.id === curr.id ? tx.inputAmount : 0),
463469
0,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export const TransactionReasonMapper: {
115115
[AmlReason.VIRTUAL_IBAN_USER_MISMATCH]: TransactionReason.UNKNOWN,
116116
[AmlReason.INTERMEDIARY_WITHOUT_SENDER]: TransactionReason.BANK_NOT_ALLOWED,
117117
[AmlReason.NAME_TOO_SHORT]: TransactionReason.KYC_DATA_NEEDED,
118+
[AmlReason.ASSET_INPUT_NOT_ALLOWED]: TransactionReason.ASSET_NOT_AVAILABLE,
118119
};
119120

120121
export class UnassignedTransactionDto {

0 commit comments

Comments
 (0)