From 06f12b01404570b26525871f5f116e75f4dd7153 Mon Sep 17 00:00:00 2001 From: Fadli Date: Thu, 28 Apr 2022 17:26:56 +0700 Subject: [PATCH] add : Add supplier: Metro, logic for the callback --- src/transaction/ppob_callback.controller.ts | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/transaction/ppob_callback.controller.ts b/src/transaction/ppob_callback.controller.ts index a92606c..8716d0f 100644 --- a/src/transaction/ppob_callback.controller.ts +++ b/src/transaction/ppob_callback.controller.ts @@ -24,6 +24,40 @@ export class PpobCallbackController { response['clientid'], response, ); + + return { + updateTransaction, + statusCode: HttpStatus.BAD_REQUEST, + message: 'failed to proccess', + }; + } + + //TODO: UPDATE BERHASIL + const updateTransaction = + await this.transactionService.callbackOrderSuccess( + response['clientid'], + response, + ); + + return { + updateTransaction, + statusCode: HttpStatus.OK, + message: 'success', + }; + + if (response['status'] != 20) { + //TODO: UPDATE GAGAL + const updateTransaction = + await this.transactionService.callbackOrderFailed( + response['clientid'], + response, + ); + + return { + updateTransaction, + statusCode: HttpStatus.BAD_REQUEST, + message: 'failed to proccess', + }; } else { //TODO: UPDATE BERHASIL const updateTransaction = @@ -31,7 +65,14 @@ export class PpobCallbackController { response['clientid'], response, ); + + return { + updateTransaction, + statusCode: HttpStatus.OK, + message: 'success', + }; } + this.logger.log({ requestQuery: request.query, });