- 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 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(
supplier_trx_id, supplier_trx_id,
callback, callback,
@ -1142,7 +1142,7 @@ export class TransactionService {
HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST,
); );
} // }
} }
@ -1420,7 +1420,7 @@ export class TransactionService {
} catch (e) { } catch (e) {
throw e; throw e;
} }
if (userData.partner != null) {
if (userData.partner) { if (userData.partner) {
const message = `Transaksi ${product.code} dengan tujuan ${dataTransaction.destination} telah berhasil.`; const message = `Transaksi ${product.code} dengan tujuan ${dataTransaction.destination} telah berhasil.`;
this.callbackToPartner( this.callbackToPartner(
@ -1435,6 +1435,7 @@ export class TransactionService {
); );
} }
} }
}
async resendOrderToPartner(supplier_trx_id: string, status: boolean){ async resendOrderToPartner(supplier_trx_id: string, status: boolean){
const dataTransaction = await this.transactionRepository.findOne({ const dataTransaction = await this.transactionRepository.findOne({