fix: callback

This commit is contained in:
ilham 2022-05-13 00:27:15 +07:00
parent 284ae2416b
commit 9bdda9e8bf

View File

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