This commit is contained in:
Fadli 2022-09-06 13:27:07 +07:00
commit 1ab030a5fd

View File

@ -1107,47 +1107,6 @@ export class TransactionService {
async checkCallbackOrderFailed(supplier_trx_id: string, callback: any) { async checkCallbackOrderFailed(supplier_trx_id: string, callback: any) {
// const transactionData = await this.findDataTransactionBySupplierTrxId(
// 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 {
const updateTransaction = await this.callbackOrderFailed(
supplier_trx_id,
callback,
);
throw new HttpException(
{
updateTransaction,
statusCode: HttpStatus.BAD_REQUEST,
error: 'updated transaction to failed',
},
HttpStatus.BAD_REQUEST,
);
// }
}
async checkCallbackOrderSuccess(supplier_trx_id: string, callback: any) {
const transactionData = await this.findDataTransactionBySupplierTrxId( const transactionData = await this.findDataTransactionBySupplierTrxId(
supplier_trx_id supplier_trx_id
); );
@ -1169,6 +1128,47 @@ export class TransactionService {
HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST,
); );
} else { } else {
const updateTransaction = await this.callbackOrderFailed(
supplier_trx_id,
callback,
);
throw new HttpException(
{
updateTransaction,
statusCode: HttpStatus.BAD_REQUEST,
error: 'updated transaction to failed',
},
HttpStatus.BAD_REQUEST,
);
}
}
async checkCallbackOrderSuccess(supplier_trx_id: string, callback: any) {
// const transactionData = await this.findDataTransactionBySupplierTrxId(
// 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 {
const updateTransaction = const updateTransaction =
await this.callbackOrderSuccess( await this.callbackOrderSuccess(
@ -1185,7 +1185,7 @@ export class TransactionService {
HttpStatus.OK, HttpStatus.OK,
); );
} // }
} }