diff --git a/src/transaction/transaction.controller.ts b/src/transaction/transaction.controller.ts index 98fed2e..9213032 100644 --- a/src/transaction/transaction.controller.ts +++ b/src/transaction/transaction.controller.ts @@ -186,6 +186,7 @@ export class TransactionController { @Query('start') startDate: string, @Query('end') endDate: string, @Query('trxId') trxId: string, + @Query('partnerTrxId') partnerTrxId: string, @Request() req, ) { const data = await this.transactionService.transactionHistoryByUser( @@ -194,6 +195,7 @@ export class TransactionController { startDate == 'null' ? null : startDate, endDate == 'null' ? null : endDate, trxId == 'null' ? null : trxId, + partnerTrxId == 'null' ? null : partnerTrxId, pageSize, ); @@ -232,6 +234,7 @@ export class TransactionController { @Query('start') startDate: string, @Query('end') endDate: string, @Query('trxId') trxId: string, + @Query('partnerTrxId') partnerTrxId: string, @Param('id', ParseUUIDPipe) id: string, ) { const data = await this.transactionService.transactionHistoryByUser( @@ -240,6 +243,7 @@ export class TransactionController { startDate == 'null' ? null : startDate, endDate == 'null' ? null : endDate, trxId == 'null' ? null : trxId, + partnerTrxId == 'null' ? null : partnerTrxId, pageSize, ); diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index cdc062a..6e43b47 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -1514,6 +1514,7 @@ export class TransactionService { this.callbackToPartner( userData.partner.id, message, + dataTransaction.supplier_trx_id, dataTransaction.partner_trx_id, dataTransaction.amount, product.code, @@ -1677,6 +1678,7 @@ export class TransactionService { this.callbackToPartner( userData.partner.id, message, + dataTransaction.supplier_trx_id, dataTransaction.partner_trx_id, dataTransaction.amount, product.code, @@ -1712,6 +1714,7 @@ export class TransactionService { await this.callbackToPartner( userData.partner.id, message, + dataTransaction.supplier_trx_id, dataTransaction.partner_trx_id, dataTransaction.amount, product.code, @@ -1725,6 +1728,7 @@ export class TransactionService { this.callbackToPartner( userData.partner.id, message, + dataTransaction.supplier_trx_id, dataTransaction.partner_trx_id, dataTransaction.amount, product.code, @@ -1739,6 +1743,7 @@ export class TransactionService { partnerId: string, message: string, trxId: string, + partnerTrxId: string, harga: number, productCode: string, destination: string, @@ -1762,9 +1767,9 @@ export class TransactionService { return false; } - const url = `${partnerData.callback_url}?status=${status}&memberID=${partnerData.code}&trxid=${trxId}&harga=${harga}&product=${productCode}&dest=${destination}&seriNumber=${seriNumber}&message=${message}&saldo=${coaAccount.amount}`; + const url = `${partnerData.callback_url}?status=${status}&memberID=${partnerData.code}&trxid=${partnerTrxId}&harga=${harga}&product=${productCode}&dest=${destination}&seriNumber=${seriNumber}&message=${message}&saldo=${coaAccount.amount}`; const result = await this.callbackPartnerRepository.insert({ - partner_trx_id: partnerId, + partner_trx_id: partnerTrxId, trx_id: trxId, url: url, }); @@ -1886,6 +1891,7 @@ export class TransactionService { startDate: string, endDate: string, trxId: string, + partnerTrxId: string, pageSize?: number, ) { const userData = await this.userService.findExist(user); @@ -1959,13 +1965,34 @@ export class TransactionService { enDate: new Date(endDate), }, ); - } else if (trxId != null) { - baseQuery.andWhere( - 'transaction.supplier_trx_id = :trxId', - { - trxId: trxId - }, - ); + } else if (trxId != null || partnerTrxId != null) { + if (trxId != null && partnerTrxId != null) { + baseQuery.andWhere( + 'transaction.supplier_trx_id = :trxId and transaction.partner_trx_id = :partnerTrxId', + { + trxId: trxId, + partnerTrxId: partnerTrxId, + }, + ); + } else { + if (trxId != null) { + baseQuery.andWhere( + 'transaction.supplier_trx_id = :trxId', + { + trxId: trxId + }, + ); + } else if (partnerTrxId != null) { + baseQuery.andWhere( + 'transaction.partner_trx_id = :partnerTrxId', + { + partnerTrxId: partnerTrxId + }, + ); + } + } + + } const data = await baseQuery @@ -2735,6 +2762,7 @@ export class TransactionService { this.callbackToPartner( userData.id, message, + billData.trx_id, billData.partner_trx_id, amount + product_price.partner_fee + product_price.mark_up_price, billData.product_code,