From da2fd4fdf174ee72a2529fc683d3044597153b3b Mon Sep 17 00:00:00 2001 From: Fadli Date: Fri, 18 Nov 2022 15:39:05 +0700 Subject: [PATCH] - fix generate id for transaction --- src/transaction/transaction.service.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index a1a3923..c6f83f9 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -341,10 +341,13 @@ export class TransactionService { // ); // } else { + const d = new Date(); + let ms = d.getMilliseconds(); + const trxId = Array(6) .fill(null) .map(() => { - return Math.round(Math.random() * 16).toString(16); + return Math.round(Math.random() * 16).toString(16) + ms.toString(); }) .join(''); @@ -598,10 +601,13 @@ export class TransactionService { } //HIT API SUPPLIER + const d = new Date(); + let ms = d.getMilliseconds(); + const trxId = Array(6) .fill(null) .map(() => { - return Math.round(Math.random() * 16).toString(16); + return Math.round(Math.random() * 16).toString(16) + ms.toString(); }) .join(''); @@ -845,10 +851,12 @@ export class TransactionService { } //HIT API SUPPLIER + const d = new Date(); + let ms = d.getMilliseconds(); const trxId = Array(6) .fill(null) .map(() => { - return Math.round(Math.random() * 16).toString(16); + return Math.round(Math.random() * 16).toString(16) + ms.toString(); }) .join(''); @@ -997,10 +1005,13 @@ export class TransactionService { userData.partner?.id, ); //HIT API SUPPLIER + const d = new Date(); + let ms = d.getMilliseconds(); + const trxId = Array(6) .fill(null) .map(() => { - return Math.round(Math.random() * 16).toString(16); + return Math.round(Math.random() * 16).toString(16) + ms.toString(); }) .join('');