From eec61277c2d109b94e06f16dec8cee437d8103da Mon Sep 17 00:00:00 2001 From: Fadli Date: Wed, 10 Aug 2022 22:30:17 +0700 Subject: [PATCH] - fix product price auto update getting from calback in metro - revert logs in ppob callback metro --- src/transaction/ppob_callback.controller.ts | 40 ++++++++++----------- src/transaction/transaction.service.ts | 12 ++----- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/transaction/ppob_callback.controller.ts b/src/transaction/ppob_callback.controller.ts index be25a30..99f3cc7 100644 --- a/src/transaction/ppob_callback.controller.ts +++ b/src/transaction/ppob_callback.controller.ts @@ -79,37 +79,33 @@ export class PpobCallbackController { console.log('statusapani2', response.toString()); if (response['status'].toString() != '20') { - console.log('masukkesiniga', 'msk'); - //TODO: UPDATE GAGAL - console.log('gagal') const updateTransaction = - console.log('transaction failed') - await this.transactionService.callbackOrderFailed( - response['refid'], - response, - ); + await this.transactionService.callbackOrderFailed( + response['refid'], + response, + ); return { updateTransaction, statusCode: HttpStatus.BAD_REQUEST, message: 'failed to proccess', }; + } else { + + //TODO: UPDATE BERHASIL + const updateTransaction = + await this.transactionService.callbackOrderSuccess( + response['refid'], + response, + ); + + return { + updateTransaction, + statusCode: HttpStatus.OK, + message: 'success', + }; } - - //TODO: UPDATE BERHASIL - console.log('berhasil') - const updateTransaction = - await this.transactionService.callbackOrderSuccess( - response['refid'], - response, - ); - - return { - updateTransaction, - statusCode: HttpStatus.OK, - message: 'success', - }; } this.logger.log({ diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index a9ad053..17fd7da 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -1204,14 +1204,6 @@ export class TransactionService { relations: ['product_price'], }); - console.log(dataTransaction.product_price, 'productPrice') - - const dataProductPrice = await this.productPriceRepository.findOne({ - where: { - id: dataTransaction.product_price, - } - }); - // const dataMsg = callback.msg; // const failedReason = dataMsg.split('.'); @@ -1239,7 +1231,7 @@ export class TransactionService { if (callback['message'].includes('METRO')) { if (callback['price'] != dataTransaction.product_price.price) { console.log("mskupdt", "msk") - dataProductPrice.price = callback['price'] + dataTransaction.product_price.price = callback['price'].toInt() } } } @@ -1338,7 +1330,7 @@ export class TransactionService { if(callback['message']) { if (callback['message'].includes('METRO')) { if (callback['price'] != dataTransaction.product_price.price) { - dataTransaction.product_price.price = callback['price'] + dataTransaction.product_price.price = callback['price'].toInt() } } }