From e7df49c9cfa0c8ccab8c920e9067d185c439a296 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:10:18 +0200 Subject: [PATCH 1/2] fix(aml): set priceDefinitionAllowedDate when amlCheck is manually passed When compliance staff set amlCheck to Pass via the generic update endpoint (PUT /buyCrypto/:id, PUT /buyFiat/:id), priceDefinitionAllowedDate was only persisted if it was explicitly included in the payload. Unlike the automatic AML pass (AmlHelperService) and manualPassAmlCheck, the update path did not couple the date to the Pass transition, leaving transactions stuck in status Created with amlCheck=Pass and a null priceDefinitionAllowedDate. Couple priceDefinitionAllowedDate to the Pass transition in both BuyCryptoService.update and BuyFiatService.update, mirroring the automatic pass behaviour. An explicit payload value still takes precedence. --- .../buy-crypto/process/services/buy-crypto.service.ts | 11 ++++++++++- .../sell-crypto/process/services/buy-fiat.service.ts | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts b/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts index f3d499bb3f..5bb7216827 100644 --- a/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts +++ b/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts @@ -342,7 +342,16 @@ export class BuyCryptoService implements OnModuleInit { (entity.amlCheck === CheckStatus.FAIL && dto.amlCheck === CheckStatus.GSHEET)) && !entity.isComplete && (update?.amlCheck !== entity.amlCheck || update.amlReason !== entity.amlReason) - ? { amlCheck: update.amlCheck, mailSendDate: null, amlReason: update.amlReason, comment: update.comment } + ? { + amlCheck: update.amlCheck, + mailSendDate: null, + amlReason: update.amlReason, + comment: update.comment, + ...(update.amlCheck === CheckStatus.PASS && { + priceDefinitionAllowedDate: + update.priceDefinitionAllowedDate ?? entity.priceDefinitionAllowedDate ?? new Date(), + }), + } : undefined), isComplete: dto.isComplete, }; diff --git a/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts b/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts index 1e15117823..abce0b06a8 100644 --- a/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts +++ b/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts @@ -208,7 +208,15 @@ export class BuyFiatService implements OnModuleInit { (entity.amlCheck === CheckStatus.FAIL && dto.amlCheck === CheckStatus.GSHEET)) && !entity.isComplete && (update?.amlCheck !== entity.amlCheck || update.amlReason !== entity.amlReason) - ? { amlCheck: update.amlCheck, mailSendDate: null, amlReason: update.amlReason } + ? { + amlCheck: update.amlCheck, + mailSendDate: null, + amlReason: update.amlReason, + ...(update.amlCheck === CheckStatus.PASS && { + priceDefinitionAllowedDate: + update.priceDefinitionAllowedDate ?? entity.priceDefinitionAllowedDate ?? new Date(), + }), + } : undefined), isComplete: dto.isComplete, comment: update.comment, From 54fb4dd4b1c4fc992773585263677bb92dba86a4 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Tue, 9 Jun 2026 12:39:05 +0200 Subject: [PATCH 2/2] refactor(aml): align priceDefinitionAllowedDate spread with surrounding style --- .../buy-crypto/process/services/buy-crypto.service.ts | 10 ++++++---- .../sell-crypto/process/services/buy-fiat.service.ts | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts b/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts index 5bb7216827..78fcdf71df 100644 --- a/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts +++ b/src/subdomains/core/buy-crypto/process/services/buy-crypto.service.ts @@ -347,10 +347,12 @@ export class BuyCryptoService implements OnModuleInit { mailSendDate: null, amlReason: update.amlReason, comment: update.comment, - ...(update.amlCheck === CheckStatus.PASS && { - priceDefinitionAllowedDate: - update.priceDefinitionAllowedDate ?? entity.priceDefinitionAllowedDate ?? new Date(), - }), + ...(update.amlCheck === CheckStatus.PASS + ? { + priceDefinitionAllowedDate: + update.priceDefinitionAllowedDate ?? entity.priceDefinitionAllowedDate ?? new Date(), + } + : undefined), } : undefined), isComplete: dto.isComplete, diff --git a/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts b/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts index abce0b06a8..a710a87dde 100644 --- a/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts +++ b/src/subdomains/core/sell-crypto/process/services/buy-fiat.service.ts @@ -212,10 +212,12 @@ export class BuyFiatService implements OnModuleInit { amlCheck: update.amlCheck, mailSendDate: null, amlReason: update.amlReason, - ...(update.amlCheck === CheckStatus.PASS && { - priceDefinitionAllowedDate: - update.priceDefinitionAllowedDate ?? entity.priceDefinitionAllowedDate ?? new Date(), - }), + ...(update.amlCheck === CheckStatus.PASS + ? { + priceDefinitionAllowedDate: + update.priceDefinitionAllowedDate ?? entity.priceDefinitionAllowedDate ?? new Date(), + } + : undefined), } : undefined), isComplete: dto.isComplete,