- add condition for userdata partner if not null in callback success

- comment check if the transaction is success
This commit is contained in:
Fadli 2022-09-06 21:36:05 +07:00
parent 6a7c66f461
commit 9d9772270d

View File

@ -1111,23 +1111,23 @@ export class TransactionService {
supplier_trx_id
);
if (transactionData.status == statusTransaction.FAILED) {
throw new HttpException(
{
statusCode: HttpStatus.BAD_REQUEST,
error: 'failed to update, the transaction already failed',
},
HttpStatus.BAD_REQUEST,
);
} else if (transactionData.status == statusTransaction.SUCCESS) {
throw new HttpException(
{
statusCode: HttpStatus.BAD_REQUEST,
error: 'failed to update, the transaction already success',
},
HttpStatus.BAD_REQUEST,
);
} else {
// if (transactionData.status == statusTransaction.FAILED) {
// throw new HttpException(
// {
// statusCode: HttpStatus.BAD_REQUEST,
// error: 'failed to update, the transaction already failed',
// },
// HttpStatus.BAD_REQUEST,
// );
// } else if (transactionData.status == statusTransaction.SUCCESS) {
// throw new HttpException(
// {
// statusCode: HttpStatus.BAD_REQUEST,
// error: 'failed to update, the transaction already success',
// },
// HttpStatus.BAD_REQUEST,
// );
// } else {
const updateTransaction = await this.callbackOrderFailed(
supplier_trx_id,
callback,
@ -1142,7 +1142,7 @@ export class TransactionService {
HttpStatus.BAD_REQUEST,
);
}
// }
}
@ -1337,7 +1337,7 @@ export class TransactionService {
});
dataTransaction.status = statusTransaction.SUCCESS;
if(callback['sn']){
if (callback['sn']) {
dataTransaction.seri_number = callback['sn'];
console.log("msksn1", dataTransaction.seri_number)
} else {
@ -1352,7 +1352,7 @@ export class TransactionService {
}
dataTransaction.callback_json = callback;
if(callback['message']) {
if (callback['message']) {
if (callback['message'].includes('METRO')) {
if (callback['price'] != dataTransaction.product_price.price) {
dataProductHistoryPrice.price = parseInt(callback['price'])
@ -1420,7 +1420,7 @@ export class TransactionService {
} catch (e) {
throw e;
}
if (userData.partner != null) {
if (userData.partner) {
const message = `Transaksi ${product.code} dengan tujuan ${dataTransaction.destination} telah berhasil.`;
this.callbackToPartner(
@ -1435,6 +1435,7 @@ export class TransactionService {
);
}
}
}
async resendOrderToPartner(supplier_trx_id: string, status: boolean){
const dataTransaction = await this.transactionRepository.findOne({