fix: callback transaction

This commit is contained in:
ilham
2021-12-26 23:01:44 +07:00
parent 342c9902ca
commit aa8764ff2b
5 changed files with 35 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import {
import { TransactionService } from './transaction.service';
import { DistributeTransactionDto } from './dto/distribute-transaction.dto';
import { FastifyRequest } from 'fastify';
import { Public } from '../auth/public.decorator';
@Controller({
path: 'ppob_callback',
@@ -23,6 +24,7 @@ export class PpobCallbackController {
constructor(private readonly transactionService: TransactionService) {}
@Public()
@Get()
async get(@Req() request: FastifyRequest) {
const response = request.query;
@@ -30,12 +32,16 @@ export class PpobCallbackController {
if (response['statuscode'] == 2) {
//TODO: UPDATE GAGAL
const updateTransaction =
await this.transactionService.callbackOrderFailed(response['clientid']);
await this.transactionService.callbackOrderFailed(
response['clientid'],
response,
);
} else {
//TODO: UPDATE BERHASIL
const updateTransaction =
await this.transactionService.callbackOrderSuccess(
response['clientid'],
response,
);
}
this.logger.log({