diff --git a/src/subdomains/generic/kyc/services/kyc.service.ts b/src/subdomains/generic/kyc/services/kyc.service.ts index 6064e6d09a..6006338b92 100644 --- a/src/subdomains/generic/kyc/services/kyc.service.ts +++ b/src/subdomains/generic/kyc/services/kyc.service.ts @@ -1170,7 +1170,9 @@ export class KycService { async trySetMail(user: UserData, step: KycStep, mail: string): Promise> { try { - user = await this.userDataService.trySetUserMail(user, mail); + if (user.mail !== mail) { + await this.userDataService.trySetUserMail(user, mail); + } return step.complete({ mail }); } catch (e) { const error = (e as Error).message?.includes('account merge request sent') diff --git a/src/subdomains/supporting/payment/services/transaction-notification.service.ts b/src/subdomains/supporting/payment/services/transaction-notification.service.ts index 18105811e9..586b37569b 100644 --- a/src/subdomains/supporting/payment/services/transaction-notification.service.ts +++ b/src/subdomains/supporting/payment/services/transaction-notification.service.ts @@ -43,7 +43,7 @@ export class TransactionNotificationService { }, relations: { bankTx: true, - buyCrypto: true, + buyCrypto: { buy: { asset: true } }, buyFiat: true, userData: { wallet: true }, user: { wallet: true }, @@ -59,6 +59,12 @@ export class TransactionNotificationService { ) continue; + // Skip input mail for Bitcoin purchases that already have txId (will receive BuyCryptoCompleted mail directly) + if (entity.buyCrypto?.txId && entity.buyCrypto?.buy?.asset?.uniqueName === 'Bitcoin/BTC') { + await this.repo.update(...entity.mailSent()); + continue; + } + if (entity.userData?.mail) await this.notificationService.sendMail({ type: MailType.USER_V2,