- fix callback if got 2 times in elang

This commit is contained in:
Fadli 2022-09-30 14:03:16 +07:00
parent 903880ed49
commit d598bbb4ab

View File

@ -1222,23 +1222,23 @@ export class TransactionService {
supplier_trx_id, supplier_trx_id,
); );
if (transactionData.status == statusTransaction.FAILED) { // if (transactionData.status == statusTransaction.FAILED) {
throw new HttpException( // throw new HttpException(
{ // {
statusCode: HttpStatus.BAD_REQUEST, // statusCode: HttpStatus.BAD_REQUEST,
error: 'failed to update, the transaction already failed', // error: 'failed to update, the transaction already failed',
}, // },
HttpStatus.BAD_REQUEST, // HttpStatus.BAD_REQUEST,
); // );
} else if (transactionData.status == statusTransaction.SUCCESS) { // } else if (transactionData.status == statusTransaction.SUCCESS) {
throw new HttpException( // throw new HttpException(
{ // {
statusCode: HttpStatus.BAD_REQUEST, // statusCode: HttpStatus.BAD_REQUEST,
error: 'failed to update, the transaction already success', // error: 'failed to update, the transaction already success',
}, // },
HttpStatus.BAD_REQUEST, // HttpStatus.BAD_REQUEST,
); // );
} else { // } else {
const updateTransaction = await this.callbackOrderFailed( const updateTransaction = await this.callbackOrderFailed(
@ -1254,7 +1254,7 @@ export class TransactionService {
}, },
HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST,
); );
} // }
} }
async checkCallbackOrderSuccess(supplier_trx_id: string, callback: any) { async checkCallbackOrderSuccess(supplier_trx_id: string, callback: any) {
@ -1262,23 +1262,23 @@ export class TransactionService {
supplier_trx_id, supplier_trx_id,
); );
if (transactionData.status == statusTransaction.FAILED) { // if (transactionData.status == statusTransaction.FAILED) {
throw new HttpException( // throw new HttpException(
{ // {
statusCode: HttpStatus.BAD_REQUEST, // statusCode: HttpStatus.BAD_REQUEST,
error: 'failed to update, the transaction already failed', // error: 'failed to update, the transaction already failed',
}, // },
HttpStatus.BAD_REQUEST, // HttpStatus.BAD_REQUEST,
); // );
} else if (transactionData.status == statusTransaction.SUCCESS) { // } else if (transactionData.status == statusTransaction.SUCCESS) {
throw new HttpException( // throw new HttpException(
{ // {
statusCode: HttpStatus.BAD_REQUEST, // statusCode: HttpStatus.BAD_REQUEST,
error: 'failed to update, the transaction already success', // error: 'failed to update, the transaction already success',
}, // },
HttpStatus.BAD_REQUEST, // HttpStatus.BAD_REQUEST,
); // );
} else { // } else {
const updateTransaction = await this.callbackOrderSuccess( const updateTransaction = await this.callbackOrderSuccess(
supplier_trx_id, supplier_trx_id,
callback, callback,
@ -1292,7 +1292,7 @@ export class TransactionService {
}, },
HttpStatus.OK, HttpStatus.OK,
); );
} // }
} }
async findDataTransactionBySupplierTrxId(supplier_trx_id: string) { async findDataTransactionBySupplierTrxId(supplier_trx_id: string) {