Merge branch 'master' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-production

This commit is contained in:
Muhammad Fadli 2023-05-11 07:34:04 +07:00
commit 90f66066d3
2 changed files with 41 additions and 9 deletions

View File

@ -186,6 +186,7 @@ export class TransactionController {
@Query('start') startDate: string, @Query('start') startDate: string,
@Query('end') endDate: string, @Query('end') endDate: string,
@Query('trxId') trxId: string, @Query('trxId') trxId: string,
@Query('partnerTrxId') partnerTrxId: string,
@Request() req, @Request() req,
) { ) {
const data = await this.transactionService.transactionHistoryByUser( const data = await this.transactionService.transactionHistoryByUser(
@ -194,6 +195,7 @@ export class TransactionController {
startDate == 'null' ? null : startDate, startDate == 'null' ? null : startDate,
endDate == 'null' ? null : endDate, endDate == 'null' ? null : endDate,
trxId == 'null' ? null : trxId, trxId == 'null' ? null : trxId,
partnerTrxId == 'null' ? null : partnerTrxId,
pageSize, pageSize,
); );
@ -232,6 +234,7 @@ export class TransactionController {
@Query('start') startDate: string, @Query('start') startDate: string,
@Query('end') endDate: string, @Query('end') endDate: string,
@Query('trxId') trxId: string, @Query('trxId') trxId: string,
@Query('partnerTrxId') partnerTrxId: string,
@Param('id', ParseUUIDPipe) id: string, @Param('id', ParseUUIDPipe) id: string,
) { ) {
const data = await this.transactionService.transactionHistoryByUser( const data = await this.transactionService.transactionHistoryByUser(
@ -240,6 +243,7 @@ export class TransactionController {
startDate == 'null' ? null : startDate, startDate == 'null' ? null : startDate,
endDate == 'null' ? null : endDate, endDate == 'null' ? null : endDate,
trxId == 'null' ? null : trxId, trxId == 'null' ? null : trxId,
partnerTrxId == 'null' ? null : partnerTrxId,
pageSize, pageSize,
); );

View File

@ -1514,6 +1514,7 @@ export class TransactionService {
this.callbackToPartner( this.callbackToPartner(
userData.partner.id, userData.partner.id,
message, message,
dataTransaction.supplier_trx_id,
dataTransaction.partner_trx_id, dataTransaction.partner_trx_id,
dataTransaction.amount, dataTransaction.amount,
product.code, product.code,
@ -1677,6 +1678,7 @@ export class TransactionService {
this.callbackToPartner( this.callbackToPartner(
userData.partner.id, userData.partner.id,
message, message,
dataTransaction.supplier_trx_id,
dataTransaction.partner_trx_id, dataTransaction.partner_trx_id,
dataTransaction.amount, dataTransaction.amount,
product.code, product.code,
@ -1712,6 +1714,7 @@ export class TransactionService {
await this.callbackToPartner( await this.callbackToPartner(
userData.partner.id, userData.partner.id,
message, message,
dataTransaction.supplier_trx_id,
dataTransaction.partner_trx_id, dataTransaction.partner_trx_id,
dataTransaction.amount, dataTransaction.amount,
product.code, product.code,
@ -1725,6 +1728,7 @@ export class TransactionService {
this.callbackToPartner( this.callbackToPartner(
userData.partner.id, userData.partner.id,
message, message,
dataTransaction.supplier_trx_id,
dataTransaction.partner_trx_id, dataTransaction.partner_trx_id,
dataTransaction.amount, dataTransaction.amount,
product.code, product.code,
@ -1739,6 +1743,7 @@ export class TransactionService {
partnerId: string, partnerId: string,
message: string, message: string,
trxId: string, trxId: string,
partnerTrxId: string,
harga: number, harga: number,
productCode: string, productCode: string,
destination: string, destination: string,
@ -1762,9 +1767,9 @@ export class TransactionService {
return false; 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({ const result = await this.callbackPartnerRepository.insert({
partner_trx_id: partnerId, partner_trx_id: partnerTrxId,
trx_id: trxId, trx_id: trxId,
url: url, url: url,
}); });
@ -1886,6 +1891,7 @@ export class TransactionService {
startDate: string, startDate: string,
endDate: string, endDate: string,
trxId: string, trxId: string,
partnerTrxId: string,
pageSize?: number, pageSize?: number,
) { ) {
const userData = await this.userService.findExist(user); const userData = await this.userService.findExist(user);
@ -1959,13 +1965,34 @@ export class TransactionService {
enDate: new Date(endDate), enDate: new Date(endDate),
}, },
); );
} else if (trxId != null) { } else if (trxId != null || partnerTrxId != null) {
baseQuery.andWhere( if (trxId != null && partnerTrxId != null) {
'transaction.supplier_trx_id = :trxId', baseQuery.andWhere(
{ 'transaction.supplier_trx_id = :trxId and transaction.partner_trx_id = :partnerTrxId',
trxId: trxId {
}, 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 const data = await baseQuery
@ -2735,6 +2762,7 @@ export class TransactionService {
this.callbackToPartner( this.callbackToPartner(
userData.id, userData.id,
message, message,
billData.trx_id,
billData.partner_trx_id, billData.partner_trx_id,
amount + product_price.partner_fee + product_price.mark_up_price, amount + product_price.partner_fee + product_price.mark_up_price,
billData.product_code, billData.product_code,