From 4685797ad48019ee566357b8c9aa41bcbd86f165 Mon Sep 17 00:00:00 2001 From: ilham Date: Thu, 28 Apr 2022 17:46:45 +0700 Subject: [PATCH] fix: callback metro --- src/transaction/ppob_callback.controller.ts | 34 ++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/transaction/ppob_callback.controller.ts b/src/transaction/ppob_callback.controller.ts index 8716d0f..b91b11c 100644 --- a/src/transaction/ppob_callback.controller.ts +++ b/src/transaction/ppob_callback.controller.ts @@ -44,12 +44,18 @@ export class PpobCallbackController { statusCode: HttpStatus.OK, message: 'success', }; + } + + @Public() + @Get('/metro') + async getMetro(@Req() request: FastifyRequest) { + const response = request.query; if (response['status'] != 20) { //TODO: UPDATE GAGAL const updateTransaction = await this.transactionService.callbackOrderFailed( - response['clientid'], + response['refid'], response, ); @@ -58,21 +64,21 @@ export class PpobCallbackController { statusCode: HttpStatus.BAD_REQUEST, message: 'failed to proccess', }; - } else { - //TODO: UPDATE BERHASIL - const updateTransaction = - await this.transactionService.callbackOrderSuccess( - response['clientid'], - response, - ); - - return { - updateTransaction, - statusCode: HttpStatus.OK, - message: 'success', - }; } + //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, });