From c9a5fd39aab84b9986f5f850e3b32fe031440d2a Mon Sep 17 00:00:00 2001 From: Lam Nguyen <32935491+xlamn@users.noreply.github.com> Date: Tue, 10 Mar 2026 17:36:48 +0100 Subject: [PATCH 1/2] feat: throw correct exception when trading limit exceeded. (#3382) --- .../supporting/realunit/realunit.service.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/subdomains/supporting/realunit/realunit.service.ts b/src/subdomains/supporting/realunit/realunit.service.ts index 35073052a7..9a7fdc8864 100644 --- a/src/subdomains/supporting/realunit/realunit.service.ts +++ b/src/subdomains/supporting/realunit/realunit.service.ts @@ -45,6 +45,7 @@ import { UserDataService } from 'src/subdomains/generic/user/models/user-data/us import { User } from 'src/subdomains/generic/user/models/user/user.entity'; import { UserService } from 'src/subdomains/generic/user/models/user/user.service'; import { FiatPaymentMethod } from 'src/subdomains/supporting/payment/dto/payment-method.enum'; +import { QuoteError } from 'src/subdomains/supporting/payment/dto/transaction-helper/quote-error.enum'; import { TransactionRequestStatus } from 'src/subdomains/supporting/payment/entities/transaction-request.entity'; import { SwissQRService } from 'src/subdomains/supporting/payment/services/swiss-qr.service'; import { TransactionRequestService } from 'src/subdomains/supporting/payment/services/transaction-request.service'; @@ -867,9 +868,12 @@ export class RealUnitService { } // 2. KYC Level check - Level 30 minimum - const requiredLevel = KycLevel.LEVEL_30; - if (userData.kycLevel < requiredLevel) { - throw new KycLevelRequiredException(requiredLevel, userData.kycLevel, 'KYC Level 30 required for RealUnit sell'); + if (userData.kycLevel < KycLevel.LEVEL_30) { + throw new KycLevelRequiredException( + KycLevel.LEVEL_30, + userData.kycLevel, + 'KYC Level 30 required for RealUnit sell', + ); } // 3. Get REALU asset @@ -901,13 +905,22 @@ export class RealUnitService { false, // includeTx ); - // 7. Prepare EIP-7702 delegation data (ALWAYS for RealUnit - app supports eth_sign) + // 7. Check if limit exceeded + if (sellPaymentInfo.error === QuoteError.LIMIT_EXCEEDED) { + throw new KycLevelRequiredException( + KycLevel.LEVEL_50, + userData.kycLevel, + 'KYC Level 50 required for RealUnit sell exceeding trading limit', + ); + } + + // 8. Prepare EIP-7702 delegation data (ALWAYS for RealUnit - app supports eth_sign) const delegationData = await this.eip7702DelegationService.prepareDelegationDataForRealUnit( user.address, realuAsset.blockchain, ); - // 8. Build response with EIP-7702 data AND fallback transfer info + // 9. Build response with EIP-7702 data AND fallback transfer info const amountWei = EvmUtil.toWeiAmount(sellPaymentInfo.amount, realuAsset.decimals); const response: RealUnitSellPaymentInfoDto = { From 4c9c639bb244df4aca3209e91bdb37e6dbfd3adf Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 10 Mar 2026 17:39:04 +0100 Subject: [PATCH 2/2] unblock iban and bban columns for virtual_iban debug queries (#3384) --- src/subdomains/generic/gs/dto/gs.dto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subdomains/generic/gs/dto/gs.dto.ts b/src/subdomains/generic/gs/dto/gs.dto.ts index 54d9bdada8..8f10b820fb 100644 --- a/src/subdomains/generic/gs/dto/gs.dto.ts +++ b/src/subdomains/generic/gs/dto/gs.dto.ts @@ -88,7 +88,7 @@ export const DebugBlockedCols: Record = { 'country', ], checkout_tx: ['cardName', 'ip', 'cardBin', 'cardLast4', 'cardFingerPrint', 'cardIssuer', 'cardIssuerCountry', 'raw'], - virtual_iban: ['iban', 'bban', 'label'], + virtual_iban: ['label'], kyc_step: ['result'], kyc_file: ['name', 'uid'], kyc_log: ['comment', 'ipAddress', 'result', 'pdfUrl'],