From 9bdda9e8bfac2506ae1561a280592961294ed4f6 Mon Sep 17 00:00:00 2001 From: ilham Date: Fri, 13 May 2022 00:27:15 +0700 Subject: [PATCH] fix: callback --- src/transaction/ppob_callback.controller.ts | 42 ++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/transaction/ppob_callback.controller.ts b/src/transaction/ppob_callback.controller.ts index b91b11c..1042178 100644 --- a/src/transaction/ppob_callback.controller.ts +++ b/src/transaction/ppob_callback.controller.ts @@ -51,34 +51,32 @@ export class PpobCallbackController { async getMetro(@Req() request: FastifyRequest) { const response = request.query; - if (response['status'] != 20) { - //TODO: UPDATE GAGAL + if (response['message'].include('CEK TAGIHAN')) { + console.log("messagenya tuh",response['message']) + } else { + if (response['status'] != 20) { + //TODO: UPDATE GAGAL + const updateTransaction = + await this.transactionService.callbackOrderFailed( + response['refid'], + response, + ); + + return { + updateTransaction, + statusCode: HttpStatus.BAD_REQUEST, + message: 'failed to proccess', + }; + } + + //TODO: UPDATE BERHASIL const updateTransaction = - await this.transactionService.callbackOrderFailed( + await this.transactionService.callbackOrderSuccess( response['refid'], response, ); - - return { - updateTransaction, - statusCode: HttpStatus.BAD_REQUEST, - message: 'failed to proccess', - }; } - //TODO: UPDATE BERHASIL - const updateTransaction = - await this.transactionService.callbackOrderSuccess( - response['refid'], - response, - ); - - return { - updateTransaction, - statusCode: HttpStatus.OK, - message: 'success', - }; - this.logger.log({ requestQuery: request.query, });