add: callback transaction

This commit is contained in:
ilham
2021-12-26 00:43:27 +07:00
parent c5e1df20b8
commit 4f50bad562
10 changed files with 384 additions and 71 deletions

View File

@@ -24,7 +24,20 @@ export class PpobCallbackController {
constructor(private readonly transactionService: TransactionService) {}
@Get()
get(@Req() request: FastifyRequest) {
async get(@Req() request: FastifyRequest) {
const response = request.query;
if (response['statuscode'] == 2) {
//TODO: UPDATE GAGAL
const updateTransaction =
await this.transactionService.callbackOrderFailed(response['clientid']);
} else {
//TODO: UPDATE BERHASIL
const updateTransaction =
await this.transactionService.callbackOrderSuccess(
response['clientid'],
);
}
this.logger.log({
requestQuery: request.query,
});