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, });