From 259e9ccf5de41f8311d3c68e5ab5a92b2cb8fc2b Mon Sep 17 00:00:00 2001 From: Yannick1712 <52333989+Yannick1712@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:07:42 +0100 Subject: [PATCH 1/6] [DEV-4537] SupportData endpoint --- .../models/wallet/mapper/wallet-dto.mapper.ts | 19 +++ .../dto/support-issue-dto.mapper.ts | 59 ++++++++++ .../support-issue/dto/support-issue.dto.ts | 110 ++++++++++++++++++ .../services/support-issue.service.ts | 12 +- .../support-issue/support-issue.controller.ts | 10 +- 5 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts diff --git a/src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts b/src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts new file mode 100644 index 0000000000..295998740d --- /dev/null +++ b/src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts @@ -0,0 +1,19 @@ +import { WalletDto } from '../dto/wallet.dto'; +import { Wallet } from '../wallet.entity'; + +export class WalletDtoMapper { + static mapWalletDto(wallet: Wallet): WalletDto { + return { + amlRules: wallet.amlRules, + address: wallet.address, + name: wallet.name, + displayName: wallet.displayName, + isKycClient: wallet.isKycClient, + customKyc: wallet.customKyc, + identMethod: wallet.identMethod, + apiUrl: wallet.apiUrl, + apiKey: wallet.apiKey, + webhookConfig: wallet.webhookConfig, + }; + } +} diff --git a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts index 92dbc84e26..46b9e2a0ba 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts @@ -1,9 +1,15 @@ +import { CountryDtoMapper } from 'src/shared/models/country/dto/country-dto.mapper'; +import { UserData } from 'src/subdomains/generic/user/models/user-data/user-data.entity'; +import { WalletDtoMapper } from 'src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper'; import { Transaction } from '../../payment/entities/transaction.entity'; import { LimitRequest } from '../entities/limit-request.entity'; import { SupportIssue } from '../entities/support-issue.entity'; import { SupportMessage } from '../entities/support-message.entity'; import { SupportIssueDto, + SupportIssueInternalAccountDataDto, + SupportIssueInternalDataDto, + SupportIssueInternalTransactionDataDto, SupportIssueLimitRequestDto, SupportIssueStateMapper, SupportIssueTransactionDto, @@ -27,6 +33,23 @@ export class SupportIssueDtoMapper { return Object.assign(new SupportIssueDto(), dto); } + static mapSupportIssueData(supportIssue: SupportIssue): SupportIssueInternalDataDto { + const dto: SupportIssueInternalDataDto = { + id: supportIssue.id, + created: supportIssue.created, + uid: supportIssue.uid, + type: supportIssue.type, + department: supportIssue.department, + reason: supportIssue.reason, + state: supportIssue.state, + name: supportIssue.name, + userData: SupportIssueDtoMapper.mapUserData(supportIssue.userData), + transaction: SupportIssueDtoMapper.mapTransactionData(supportIssue.transaction), + }; + + return Object.assign(new SupportIssueInternalDataDto(), dto); + } + static mapSupportMessage(supportMessage: SupportMessage): SupportMessageDto { const dto: SupportMessageDto = { id: supportMessage.id, @@ -39,6 +62,42 @@ export class SupportIssueDtoMapper { return Object.assign(new SupportMessageDto(), dto); } + static mapUserData(userData: UserData): SupportIssueInternalAccountDataDto { + return { + id: userData.id, + status: userData.status, + verifiedName: userData.verifiedName, + completeName: userData.completeName, + accountType: userData.accountType, + kycLevel: userData.kycLevel, + depositLimit: userData.depositLimit, + annualVolume: userData.annualBuyVolume + userData.annualSellVolume + userData.annualCryptoVolume, + kycHash: userData.kycHash, + country: userData.country ? CountryDtoMapper.entityToDto(userData.country) : undefined, + }; + } + + static mapTransactionData(transaction: Transaction): SupportIssueInternalTransactionDataDto { + if (!transaction?.id) return undefined; + + const wallet = transaction.buyCrypto?.wallet ?? transaction.buyFiat?.wallet; + + return { + id: transaction.id, + sourceType: transaction.sourceType, + type: transaction.type, + amlCheck: transaction.amlCheck, + amlReason: transaction.buyCrypto?.amlReason ?? transaction.buyFiat?.amlReason, + comment: transaction.buyCrypto?.comment ?? transaction.buyFiat?.comment, + inputAmount: transaction.buyCrypto?.inputAmount ?? transaction.buyFiat?.inputAmount, + inputAsset: transaction.buyCrypto?.inputAsset ?? transaction.buyFiat?.inputAsset, + outputAmount: transaction.buyCrypto?.outputAmount ?? transaction.buyFiat?.outputAmount, + outputAsset: transaction.buyCrypto?.amlReason ?? transaction.buyFiat?.amlReason, + wallet: wallet ? WalletDtoMapper.mapWalletDto(wallet) : undefined, + isComplete: transaction.buyCrypto?.isComplete ?? transaction.buyFiat?.isComplete, + }; + } + static mapTransaction(transaction: Transaction): SupportIssueTransactionDto { if (!transaction?.id) return null; diff --git a/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts b/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts index 8952b051f3..e3aca69e22 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts @@ -1,4 +1,12 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { CountryDto } from 'src/shared/models/country/dto/country.dto'; +import { AmlReason } from 'src/subdomains/core/aml/enums/aml-reason.enum'; +import { CheckStatus } from 'src/subdomains/core/aml/enums/check-status.enum'; +import { AccountType } from 'src/subdomains/generic/user/models/user-data/account-type.enum'; +import { KycLevel, UserDataStatus } from 'src/subdomains/generic/user/models/user-data/user-data.enum'; +import { WalletDto } from 'src/subdomains/generic/user/models/wallet/dto/wallet.dto'; +import { TransactionSourceType, TransactionTypeInternal } from '../../payment/entities/transaction.entity'; +import { Department } from '../enums/department.enum'; import { SupportIssueInternalState, SupportIssueReason, @@ -68,6 +76,108 @@ export class SupportIssueDto { limitRequest?: SupportIssueLimitRequestDto; } +export class SupportIssueInternalAccountDataDto { + @ApiProperty() + id: number; + + @ApiProperty({ enum: UserDataStatus }) + status: UserDataStatus; + + @ApiProperty() + verifiedName: string; + + @ApiProperty() + completeName: string; + + @ApiProperty({ enum: AccountType }) + accountType: AccountType; + + @ApiProperty({ enum: KycLevel }) + kycLevel: KycLevel; + + @ApiProperty() + depositLimit: number; + + @ApiProperty() + annualVolume: number; + + @ApiProperty() + kycHash: string; + + @ApiProperty({ type: CountryDto }) + country: CountryDto; +} + +export class SupportIssueInternalTransactionDataDto { + @ApiProperty() + id: number; + + @ApiProperty({ enum: TransactionSourceType }) + sourceType: TransactionSourceType; + + @ApiProperty({ enum: TransactionTypeInternal }) + type: TransactionTypeInternal; + + @ApiProperty({ enum: CheckStatus }) + amlCheck: CheckStatus; + + @ApiProperty({ enum: AmlReason }) + amlReason: AmlReason; + + @ApiProperty() + comment: string; + + @ApiProperty() + inputAmount: number; + + @ApiProperty() + inputAsset: string; + + @ApiProperty() + outputAmount: number; + + @ApiProperty() + outputAsset: string; + + @ApiProperty({ type: WalletDto }) + wallet: WalletDto; + + @ApiProperty() + isComplete: boolean; +} + +export class SupportIssueInternalDataDto { + @ApiProperty() + id: number; + + @ApiProperty({ type: Date }) + created: Date; + + @ApiProperty() + uid: string; + + @ApiProperty({ enum: SupportIssueType }) + type: SupportIssueType; + + @ApiProperty({ enum: Department }) + department?: Department; + + @ApiProperty({ enum: SupportIssueReason }) + reason: SupportIssueReason; + + @ApiProperty({ enum: SupportIssueInternalState }) + state: SupportIssueInternalState; + + @ApiProperty() + name: string; + + @ApiProperty({ type: SupportIssueInternalAccountDataDto }) + userData: SupportIssueInternalAccountDataDto; + + @ApiProperty({ type: SupportIssueInternalTransactionDataDto }) + transaction: SupportIssueInternalTransactionDataDto; +} + export const SupportIssueStateMapper: { [key in SupportIssueInternalState]: SupportIssueState; } = { diff --git a/src/subdomains/supporting/support-issue/services/support-issue.service.ts b/src/subdomains/supporting/support-issue/services/support-issue.service.ts index ad29ba869a..1d9ea407af 100644 --- a/src/subdomains/supporting/support-issue/services/support-issue.service.ts +++ b/src/subdomains/supporting/support-issue/services/support-issue.service.ts @@ -21,7 +21,7 @@ import { CreateSupportIssueBaseDto, CreateSupportIssueDto } from '../dto/create- import { CreateSupportMessageDto } from '../dto/create-support-message.dto'; import { GetSupportIssueFilter } from '../dto/get-support-issue.dto'; import { SupportIssueDtoMapper } from '../dto/support-issue-dto.mapper'; -import { SupportIssueDto, SupportMessageDto } from '../dto/support-issue.dto'; +import { SupportIssueDto, SupportIssueInternalDataDto, SupportMessageDto } from '../dto/support-issue.dto'; import { UpdateSupportIssueDto } from '../dto/update-support-issue.dto'; import { SupportIssue } from '../entities/support-issue.entity'; import { CustomerAuthor, SupportMessage } from '../entities/support-message.entity'; @@ -213,6 +213,16 @@ export class SupportIssueService { return SupportIssueDtoMapper.mapSupportIssue(issue); } + async getIssueData(id: number): Promise { + const issue = await this.supportIssueRepo.findOne({ + where: { id }, + relations: { transaction: { buyCrypto: true, buyFiat: true, user: { wallet: true } } }, + }); + if (!issue) throw new NotFoundException('Support issue not found'); + + return SupportIssueDtoMapper.mapSupportIssueData(issue); + } + async getIssueFile(id: string, messageId: number, userDataId?: number): Promise { const message = await this.messageRepo.findOneBy({ id: messageId, issue: this.getIssueSearch(id, userDataId) }); if (!message) throw new NotFoundException('Message not found'); diff --git a/src/subdomains/supporting/support-issue/support-issue.controller.ts b/src/subdomains/supporting/support-issue/support-issue.controller.ts index 3280a14232..27865086fd 100644 --- a/src/subdomains/supporting/support-issue/support-issue.controller.ts +++ b/src/subdomains/supporting/support-issue/support-issue.controller.ts @@ -11,7 +11,7 @@ import { UserRole } from 'src/shared/auth/user-role.enum'; import { CreateSupportIssueDto, CreateSupportIssueSupportDto } from './dto/create-support-issue.dto'; import { CreateSupportMessageDto } from './dto/create-support-message.dto'; import { GetSupportIssueFilter } from './dto/get-support-issue.dto'; -import { SupportIssueDto, SupportMessageDto } from './dto/support-issue.dto'; +import { SupportIssueDto, SupportIssueInternalDataDto, SupportMessageDto } from './dto/support-issue.dto'; import { UpdateSupportIssueDto } from './dto/update-support-issue.dto'; import { SupportIssue } from './entities/support-issue.entity'; import { CustomerAuthor } from './entities/support-message.entity'; @@ -65,6 +65,14 @@ export class SupportIssueController { return this.supportIssueService.getIssue(id, query, jwt?.account); } + @Get(':id/data') + @ApiBearerAuth() + @ApiExcludeEndpoint() + @UseGuards(AuthGuard(), RoleGuard(UserRole.SUPPORT), UserActiveGuard()) + async getIssueData(@Param('id') id: string): Promise { + return this.supportIssueService.getIssueData(+id); + } + @Post(':id/message') @ApiBearerAuth() @UseGuards(OptionalJwtAuthGuard) From 2de020b89b0553eb1b58bb9f24b39610dfc6d85a Mon Sep 17 00:00:00 2001 From: Yannick1712 <52333989+Yannick1712@users.noreply.github.com> Date: Fri, 23 Jan 2026 16:57:25 +0100 Subject: [PATCH 2/6] [DEV-4537] Refactoring --- .../models/wallet/mapper/wallet-dto.mapper.ts | 19 ------------- .../dto/support-issue-dto.mapper.ts | 27 +++++++++++-------- .../support-issue/dto/support-issue.dto.ts | 18 ++++++++++--- 3 files changed, 30 insertions(+), 34 deletions(-) delete mode 100644 src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts diff --git a/src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts b/src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts deleted file mode 100644 index 295998740d..0000000000 --- a/src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { WalletDto } from '../dto/wallet.dto'; -import { Wallet } from '../wallet.entity'; - -export class WalletDtoMapper { - static mapWalletDto(wallet: Wallet): WalletDto { - return { - amlRules: wallet.amlRules, - address: wallet.address, - name: wallet.name, - displayName: wallet.displayName, - isKycClient: wallet.isKycClient, - customKyc: wallet.customKyc, - identMethod: wallet.identMethod, - apiUrl: wallet.apiUrl, - apiKey: wallet.apiKey, - webhookConfig: wallet.webhookConfig, - }; - } -} diff --git a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts index 46b9e2a0ba..49cce47383 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts @@ -1,6 +1,5 @@ import { CountryDtoMapper } from 'src/shared/models/country/dto/country-dto.mapper'; import { UserData } from 'src/subdomains/generic/user/models/user-data/user-data.entity'; -import { WalletDtoMapper } from 'src/subdomains/generic/user/models/wallet/mapper/wallet-dto.mapper'; import { Transaction } from '../../payment/entities/transaction.entity'; import { LimitRequest } from '../entities/limit-request.entity'; import { SupportIssue } from '../entities/support-issue.entity'; @@ -43,7 +42,7 @@ export class SupportIssueDtoMapper { reason: supportIssue.reason, state: supportIssue.state, name: supportIssue.name, - userData: SupportIssueDtoMapper.mapUserData(supportIssue.userData), + account: SupportIssueDtoMapper.mapUserData(supportIssue.userData), transaction: SupportIssueDtoMapper.mapTransactionData(supportIssue.transaction), }; @@ -80,21 +79,27 @@ export class SupportIssueDtoMapper { static mapTransactionData(transaction: Transaction): SupportIssueInternalTransactionDataDto { if (!transaction?.id) return undefined; - const wallet = transaction.buyCrypto?.wallet ?? transaction.buyFiat?.wallet; + const targetEntity = transaction.buyCrypto ?? transaction.buyFiat; return { id: transaction.id, sourceType: transaction.sourceType, type: transaction.type, amlCheck: transaction.amlCheck, - amlReason: transaction.buyCrypto?.amlReason ?? transaction.buyFiat?.amlReason, - comment: transaction.buyCrypto?.comment ?? transaction.buyFiat?.comment, - inputAmount: transaction.buyCrypto?.inputAmount ?? transaction.buyFiat?.inputAmount, - inputAsset: transaction.buyCrypto?.inputAsset ?? transaction.buyFiat?.inputAsset, - outputAmount: transaction.buyCrypto?.outputAmount ?? transaction.buyFiat?.outputAmount, - outputAsset: transaction.buyCrypto?.amlReason ?? transaction.buyFiat?.amlReason, - wallet: wallet ? WalletDtoMapper.mapWalletDto(wallet) : undefined, - isComplete: transaction.buyCrypto?.isComplete ?? transaction.buyFiat?.isComplete, + amlReason: targetEntity?.amlReason, + comment: targetEntity?.comment, + inputAmount: targetEntity?.inputAmount, + inputAsset: targetEntity?.inputAsset, + outputAmount: targetEntity?.outputAmount, + outputAsset: targetEntity?.amlReason, + wallet: targetEntity?.wallet + ? { + name: targetEntity.wallet.displayName ?? targetEntity.wallet.name, + amlRules: targetEntity.wallet.amlRules, + isKycClient: targetEntity.wallet.isKycClient, + } + : undefined, + isComplete: targetEntity?.isComplete, }; } diff --git a/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts b/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts index e3aca69e22..2c168a5a02 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts @@ -4,7 +4,6 @@ import { AmlReason } from 'src/subdomains/core/aml/enums/aml-reason.enum'; import { CheckStatus } from 'src/subdomains/core/aml/enums/check-status.enum'; import { AccountType } from 'src/subdomains/generic/user/models/user-data/account-type.enum'; import { KycLevel, UserDataStatus } from 'src/subdomains/generic/user/models/user-data/user-data.enum'; -import { WalletDto } from 'src/subdomains/generic/user/models/wallet/dto/wallet.dto'; import { TransactionSourceType, TransactionTypeInternal } from '../../payment/entities/transaction.entity'; import { Department } from '../enums/department.enum'; import { @@ -108,6 +107,17 @@ export class SupportIssueInternalAccountDataDto { country: CountryDto; } +export class SupportIssueInternalWalletDto { + @ApiProperty() + name: string; + + @ApiProperty() + amlRules: string; + + @ApiProperty() + isKycClient: boolean; +} + export class SupportIssueInternalTransactionDataDto { @ApiProperty() id: number; @@ -139,8 +149,8 @@ export class SupportIssueInternalTransactionDataDto { @ApiProperty() outputAsset: string; - @ApiProperty({ type: WalletDto }) - wallet: WalletDto; + @ApiProperty({ type: SupportIssueInternalWalletDto }) + wallet: SupportIssueInternalWalletDto; @ApiProperty() isComplete: boolean; @@ -172,7 +182,7 @@ export class SupportIssueInternalDataDto { name: string; @ApiProperty({ type: SupportIssueInternalAccountDataDto }) - userData: SupportIssueInternalAccountDataDto; + account: SupportIssueInternalAccountDataDto; @ApiProperty({ type: SupportIssueInternalTransactionDataDto }) transaction: SupportIssueInternalTransactionDataDto; From 78cea1e1f5ffefb5c466360c7d2674e89eb4fed3 Mon Sep 17 00:00:00 2001 From: Yannick1712 <52333989+Yannick1712@users.noreply.github.com> Date: Tue, 27 Jan 2026 13:32:49 +0100 Subject: [PATCH 3/6] [DEV-4537] adapt relations --- .../support-issue/services/support-issue.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/subdomains/supporting/support-issue/services/support-issue.service.ts b/src/subdomains/supporting/support-issue/services/support-issue.service.ts index 1d9ea407af..40b8000552 100644 --- a/src/subdomains/supporting/support-issue/services/support-issue.service.ts +++ b/src/subdomains/supporting/support-issue/services/support-issue.service.ts @@ -216,7 +216,12 @@ export class SupportIssueService { async getIssueData(id: number): Promise { const issue = await this.supportIssueRepo.findOne({ where: { id }, - relations: { transaction: { buyCrypto: true, buyFiat: true, user: { wallet: true } } }, + relations: { + transaction: { + buyCrypto: { transaction: { user: { wallet: true } } }, + buyFiat: { transaction: { user: { wallet: true } } }, + }, + }, }); if (!issue) throw new NotFoundException('Support issue not found'); From 27fe3cfec1f358e835a8d8c2a7e4548f571db448 Mon Sep 17 00:00:00 2001 From: Yannick1712 <52333989+Yannick1712@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:32:17 +0100 Subject: [PATCH 4/6] [DEV-4537] Refactoring 2 --- .../dto/support-issue-dto.mapper.ts | 19 +++++++++++-------- .../support-issue/dto/support-issue.dto.ts | 7 +++++++ .../services/support-issue.service.ts | 11 ++++++++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts index 49cce47383..6d4863eb18 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts @@ -1,3 +1,4 @@ +import { Asset } from 'src/shared/models/asset/asset.entity'; import { CountryDtoMapper } from 'src/shared/models/country/dto/country-dto.mapper'; import { UserData } from 'src/subdomains/generic/user/models/user-data/user-data.entity'; import { Transaction } from '../../payment/entities/transaction.entity'; @@ -32,7 +33,7 @@ export class SupportIssueDtoMapper { return Object.assign(new SupportIssueDto(), dto); } - static mapSupportIssueData(supportIssue: SupportIssue): SupportIssueInternalDataDto { + static mapSupportIssueData(supportIssue: SupportIssue, transactionInput?: Asset): SupportIssueInternalDataDto { const dto: SupportIssueInternalDataDto = { id: supportIssue.id, created: supportIssue.created, @@ -43,7 +44,7 @@ export class SupportIssueDtoMapper { state: supportIssue.state, name: supportIssue.name, account: SupportIssueDtoMapper.mapUserData(supportIssue.userData), - transaction: SupportIssueDtoMapper.mapTransactionData(supportIssue.transaction), + transaction: SupportIssueDtoMapper.mapTransactionData(supportIssue.transaction, transactionInput), }; return Object.assign(new SupportIssueInternalDataDto(), dto); @@ -76,7 +77,7 @@ export class SupportIssueDtoMapper { }; } - static mapTransactionData(transaction: Transaction): SupportIssueInternalTransactionDataDto { + static mapTransactionData(transaction: Transaction, inputCurrency?: Asset): SupportIssueInternalTransactionDataDto { if (!transaction?.id) return undefined; const targetEntity = transaction.buyCrypto ?? transaction.buyFiat; @@ -90,13 +91,15 @@ export class SupportIssueDtoMapper { comment: targetEntity?.comment, inputAmount: targetEntity?.inputAmount, inputAsset: targetEntity?.inputAsset, + inputBlockchain: inputCurrency?.blockchain, outputAmount: targetEntity?.outputAmount, - outputAsset: targetEntity?.amlReason, - wallet: targetEntity?.wallet + outputAsset: targetEntity?.outputAsset.name, + outputBlockchain: transaction?.buyCrypto?.outputAsset.blockchain, + wallet: transaction.user?.wallet ? { - name: targetEntity.wallet.displayName ?? targetEntity.wallet.name, - amlRules: targetEntity.wallet.amlRules, - isKycClient: targetEntity.wallet.isKycClient, + name: transaction.user.wallet.displayName ?? transaction.user.wallet.name, + amlRules: transaction.user.wallet.amlRules, + isKycClient: transaction.user.wallet.isKycClient, } : undefined, isComplete: targetEntity?.isComplete, diff --git a/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts b/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts index 2c168a5a02..207a5397d0 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue.dto.ts @@ -1,4 +1,5 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { Blockchain } from 'src/integration/blockchain/shared/enums/blockchain.enum'; import { CountryDto } from 'src/shared/models/country/dto/country.dto'; import { AmlReason } from 'src/subdomains/core/aml/enums/aml-reason.enum'; import { CheckStatus } from 'src/subdomains/core/aml/enums/check-status.enum'; @@ -143,12 +144,18 @@ export class SupportIssueInternalTransactionDataDto { @ApiProperty() inputAsset: string; + @ApiPropertyOptional({ enum: Blockchain }) + inputBlockchain?: Blockchain; + @ApiProperty() outputAmount: number; @ApiProperty() outputAsset: string; + @ApiPropertyOptional({ enum: Blockchain }) + outputBlockchain?: Blockchain; + @ApiProperty({ type: SupportIssueInternalWalletDto }) wallet: SupportIssueInternalWalletDto; diff --git a/src/subdomains/supporting/support-issue/services/support-issue.service.ts b/src/subdomains/supporting/support-issue/services/support-issue.service.ts index 40b8000552..ae9adc663d 100644 --- a/src/subdomains/supporting/support-issue/services/support-issue.service.ts +++ b/src/subdomains/supporting/support-issue/services/support-issue.service.ts @@ -7,6 +7,7 @@ import { } from '@nestjs/common'; import { Config } from 'src/config/config'; import { BlobContent } from 'src/integration/infrastructure/azure-storage.service'; +import { FiatService } from 'src/shared/models/fiat/fiat.service'; import { Util } from 'src/shared/utils/util'; import { ContentType } from 'src/subdomains/generic/kyc/enums/content-type.enum'; import { BankDataService } from 'src/subdomains/generic/user/models/bank-data/bank-data.service'; @@ -48,6 +49,7 @@ export class SupportIssueService { private readonly transactionRequestService: TransactionRequestService, private readonly supportLogService: SupportLogService, private readonly bankDataService: BankDataService, + private readonly fiatService: FiatService, ) {} async createTransactionRequestIssue(dto: CreateSupportIssueBaseDto): Promise { @@ -218,14 +220,17 @@ export class SupportIssueService { where: { id }, relations: { transaction: { - buyCrypto: { transaction: { user: { wallet: true } } }, - buyFiat: { transaction: { user: { wallet: true } } }, + user: { wallet: true }, + buyCrypto: { transaction: true, cryptoInput: true }, + buyFiat: { transaction: true, cryptoInput: true }, }, }, }); if (!issue) throw new NotFoundException('Support issue not found'); - return SupportIssueDtoMapper.mapSupportIssueData(issue); + const transactionInput = (issue.transaction?.buyCrypto ?? issue.transaction?.buyFiat)?.cryptoInput.asset; + + return SupportIssueDtoMapper.mapSupportIssueData(issue, transactionInput); } async getIssueFile(id: string, messageId: number, userDataId?: number): Promise { From 689648e2b076a99996d9a8eb995491bf96c69e46 Mon Sep 17 00:00:00 2001 From: Yannick1712 <52333989+Yannick1712@users.noreply.github.com> Date: Tue, 27 Jan 2026 17:16:05 +0100 Subject: [PATCH 5/6] [DEV-4537] fix missing optional operator --- .../supporting/support-issue/services/support-issue.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subdomains/supporting/support-issue/services/support-issue.service.ts b/src/subdomains/supporting/support-issue/services/support-issue.service.ts index ae9adc663d..7b331ffafd 100644 --- a/src/subdomains/supporting/support-issue/services/support-issue.service.ts +++ b/src/subdomains/supporting/support-issue/services/support-issue.service.ts @@ -228,7 +228,7 @@ export class SupportIssueService { }); if (!issue) throw new NotFoundException('Support issue not found'); - const transactionInput = (issue.transaction?.buyCrypto ?? issue.transaction?.buyFiat)?.cryptoInput.asset; + const transactionInput = (issue.transaction?.buyCrypto ?? issue.transaction?.buyFiat)?.cryptoInput?.asset; return SupportIssueDtoMapper.mapSupportIssueData(issue, transactionInput); } From 373e7797b92cdb4908afc349c099c510fb681069 Mon Sep 17 00:00:00 2001 From: Yannick1712 <52333989+Yannick1712@users.noreply.github.com> Date: Fri, 30 Jan 2026 00:20:23 +0100 Subject: [PATCH 6/6] [DEV-4537] Refactoring 3 --- .../support-issue/dto/support-issue-dto.mapper.ts | 9 ++++----- .../support-issue/services/support-issue.service.ts | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts index 6d4863eb18..43c3934a8b 100644 --- a/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts +++ b/src/subdomains/supporting/support-issue/dto/support-issue-dto.mapper.ts @@ -1,4 +1,3 @@ -import { Asset } from 'src/shared/models/asset/asset.entity'; import { CountryDtoMapper } from 'src/shared/models/country/dto/country-dto.mapper'; import { UserData } from 'src/subdomains/generic/user/models/user-data/user-data.entity'; import { Transaction } from '../../payment/entities/transaction.entity'; @@ -33,7 +32,7 @@ export class SupportIssueDtoMapper { return Object.assign(new SupportIssueDto(), dto); } - static mapSupportIssueData(supportIssue: SupportIssue, transactionInput?: Asset): SupportIssueInternalDataDto { + static mapSupportIssueData(supportIssue: SupportIssue): SupportIssueInternalDataDto { const dto: SupportIssueInternalDataDto = { id: supportIssue.id, created: supportIssue.created, @@ -44,7 +43,7 @@ export class SupportIssueDtoMapper { state: supportIssue.state, name: supportIssue.name, account: SupportIssueDtoMapper.mapUserData(supportIssue.userData), - transaction: SupportIssueDtoMapper.mapTransactionData(supportIssue.transaction, transactionInput), + transaction: SupportIssueDtoMapper.mapTransactionData(supportIssue.transaction), }; return Object.assign(new SupportIssueInternalDataDto(), dto); @@ -77,7 +76,7 @@ export class SupportIssueDtoMapper { }; } - static mapTransactionData(transaction: Transaction, inputCurrency?: Asset): SupportIssueInternalTransactionDataDto { + static mapTransactionData(transaction: Transaction): SupportIssueInternalTransactionDataDto { if (!transaction?.id) return undefined; const targetEntity = transaction.buyCrypto ?? transaction.buyFiat; @@ -91,7 +90,7 @@ export class SupportIssueDtoMapper { comment: targetEntity?.comment, inputAmount: targetEntity?.inputAmount, inputAsset: targetEntity?.inputAsset, - inputBlockchain: inputCurrency?.blockchain, + inputBlockchain: targetEntity?.cryptoInput?.asset?.blockchain, outputAmount: targetEntity?.outputAmount, outputAsset: targetEntity?.outputAsset.name, outputBlockchain: transaction?.buyCrypto?.outputAsset.blockchain, diff --git a/src/subdomains/supporting/support-issue/services/support-issue.service.ts b/src/subdomains/supporting/support-issue/services/support-issue.service.ts index 7b331ffafd..725cf1b0bd 100644 --- a/src/subdomains/supporting/support-issue/services/support-issue.service.ts +++ b/src/subdomains/supporting/support-issue/services/support-issue.service.ts @@ -228,9 +228,7 @@ export class SupportIssueService { }); if (!issue) throw new NotFoundException('Support issue not found'); - const transactionInput = (issue.transaction?.buyCrypto ?? issue.transaction?.buyFiat)?.cryptoInput?.asset; - - return SupportIssueDtoMapper.mapSupportIssueData(issue, transactionInput); + return SupportIssueDtoMapper.mapSupportIssueData(issue); } async getIssueFile(id: string, messageId: number, userDataId?: number): Promise {