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: 0 additions & 1 deletion src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class Configuration {
defaultRef = '000-000';
defaultWalletId = 1;
transactionRefundExpirySeconds = 300; // 5 minutes - enough time to fill out the refund form
refRewardManualCheckLimit = 3000; // EUR
txRequestWaitingExpiryDays = 7;
financeLogTotalBalanceChangeLimit = 5000;
faucetAmount = 20; //CHF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CustodyOrderStatus, CustodyOrderType } from '../../enums/custody';
import { CustodyOrder } from '../../entities/custody-order.entity';
import { CustodyOrderStatus, CustodyOrderType } from '../../enums/custody';

export class CustodyOrderListEntry {
id: number;
Expand All @@ -20,9 +20,9 @@ export class CustodyOrderListEntry {
id: order.id,
type: order.type,
status: order.status,
inputAmount: order.inputAmount ?? tr?.amount,
inputAmount: order.inputAmount ?? tr?.estimatedAmount,
inputAsset: order.inputAsset?.name,
outputAmount: order.outputAmount ?? tr?.estimatedAmount,
outputAmount: order.outputAmount ?? tr?.amount,
outputAsset: order.outputAsset?.name,
userDataId: order.user?.userData?.id,
userName: order.user?.userData?.verifiedName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
import { Config } from 'src/config/config';
import { Blockchain } from 'src/integration/blockchain/shared/enums/blockchain.enum';
import { CryptoService } from 'src/integration/blockchain/shared/services/crypto.service';
import { AssetService } from 'src/shared/models/asset/asset.service';
import { SettingService } from 'src/shared/models/setting/setting.service';
import { Util } from 'src/shared/utils/util';
import { User } from 'src/subdomains/generic/user/models/user/user.entity';
import { UserService } from 'src/subdomains/generic/user/models/user/user.service';
Expand Down Expand Up @@ -70,6 +70,7 @@ export class RefRewardService {
private readonly pricingService: PricingService,
private readonly assetService: AssetService,
private readonly transactionService: TransactionService,
private readonly settingService: SettingService,
) {}

async createManualRefReward(dto: CreateManualRefRewardDto): Promise<void> {
Expand All @@ -90,12 +91,14 @@ export class RefRewardService {
PriceValidity.VALID_ONLY,
);

const refRewardManualCheckLimit = await this.settingService.getObj<number>('refRewardManualCheckLimit', 3000);

const entity = this.rewardRepo.create({
user,
targetAddress: user.address,
outputAsset: asset,
sourceTransaction,
status: dto.amountInEur > Config.refRewardManualCheckLimit ? RewardStatus.MANUAL_CHECK : RewardStatus.PREPARED,
status: dto.amountInEur > refRewardManualCheckLimit ? RewardStatus.MANUAL_CHECK : RewardStatus.PREPARED,
targetBlockchain: asset.blockchain,
amountInChf: eurChfPrice.convert(dto.amountInEur, 8),
amountInEur: dto.amountInEur,
Expand Down Expand Up @@ -151,10 +154,12 @@ export class RefRewardService {

if (!(refCreditEur >= minCredit)) continue;

const refRewardManualCheckLimit = await this.settingService.getObj<number>('refRewardManualCheckLimit', 3000);

const entity = this.rewardRepo.create({
outputAsset: payoutAsset,
user,
status: refCreditEur > Config.refRewardManualCheckLimit ? RewardStatus.MANUAL_CHECK : RewardStatus.PREPARED,
status: refCreditEur > refRewardManualCheckLimit ? RewardStatus.MANUAL_CHECK : RewardStatus.PREPARED,
targetAddress: user.address,
targetBlockchain: blockchain,
amountInChf: eurChfPrice.convert(refCreditEur, 8),
Expand Down
16 changes: 8 additions & 8 deletions src/subdomains/generic/kyc/services/kyc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,14 @@ export class KycService {
} else if (nationality) {
const hasOpenSanctions = await this.nameCheckService.hasOpenNameChecks(userData);

if (hasOpenSanctions) {
this.logger.warn(
`Sanctions guard: blocked KYC Level 30 for userData ${userData.id} due to open sanctioned name checks`,
);
} else if (userData.kycLevel <= KycLevel.LEVEL_30) {
await this.createKycLevelLog(userData, KycLevel.LEVEL_30);
}

await this.userDataService.updateUserDataInternal(userData, {
...(hasOpenSanctions ? {} : { kycLevel: KycLevel.LEVEL_30 }),
birthday: data.birthday,
Expand All @@ -1461,14 +1469,6 @@ export class KycService {
nationality,
});

if (hasOpenSanctions) {
this.logger.warn(
`Sanctions guard: blocked KYC Level 30 for userData ${userData.id} due to open sanctioned name checks`,
);
} else {
await this.createKycLevelLog(userData, KycLevel.LEVEL_30);
}

if (kycStep.isValidCreatingBankData && !DisabledProcess(Process.AUTO_CREATE_BANK_DATA))
await this.bankDataService.createBankDataInternal(kycStep.userData, {
name: kycStep.userName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,8 @@ export class TransactionHelper implements OnModuleInit {
const inputAmountNormal =
(outputAmount + dfx.fixed + bank.fixed + partner.fixed + network + networkStart) /
(1 - (dfx.rate + bank.rate + partner.rate));
const inputAmountWithMinFee = outputAmount + network + bank.fixed + partner.fixed + networkStart + min;
const inputAmountWithMinFee =
(outputAmount + network + bank.fixed + partner.fixed + networkStart + min) / (1 - (bank.rate + partner.rate));

return Math.max(inputAmountNormal, inputAmountWithMinFee);
}
Expand Down
Loading