@@ -493,20 +493,26 @@ export class TransactionHelper implements OnModuleInit {
493493
494494 async getTxStatementDetails (
495495 userDataId : number ,
496- txId : number ,
496+ txIdOrUid : number | string ,
497497 statementType : TxStatementType ,
498498 ) : Promise < TxStatementDetails > {
499- const transaction = await this . transactionService . getTransactionById ( txId , {
499+ const relations = {
500500 userData : { organization : true } ,
501501 buyCrypto : { buy : { user : { wallet : true } } , cryptoRoute : true , cryptoInput : true } ,
502502 buyFiat : { sell : true , cryptoInput : true } ,
503503 refReward : { user : { userData : true } } ,
504- } ) ;
504+ } ;
505+
506+ const transaction =
507+ typeof txIdOrUid === 'number'
508+ ? await this . transactionService . getTransactionById ( txIdOrUid , relations )
509+ : await this . transactionService . getTransactionByUid ( txIdOrUid , relations ) ;
505510
506511 if ( ! transaction || ! transaction . targetEntity || transaction . targetEntity instanceof BankTxReturn )
507512 throw new BadRequestException ( 'Transaction not found' ) ;
508513 if ( ! transaction . userData . isDataComplete ) throw new BadRequestException ( 'User data is not complete' ) ;
509- if ( ! transaction . targetEntity . isComplete ) throw new BadRequestException ( 'Transaction not completed' ) ;
514+ if ( statementType === TxStatementType . RECEIPT && ! transaction . targetEntity . isComplete )
515+ throw new BadRequestException ( 'Transaction not completed' ) ;
510516 if ( transaction . userData . id !== userDataId ) throw new ForbiddenException ( 'Not your transaction' ) ;
511517
512518 if ( transaction . buyCrypto && ! transaction . buyCrypto . isCryptoCryptoTransaction ) {
0 commit comments