Merge branch 'master' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-production
This commit is contained in:
commit
cf3d84cb2f
|
@ -3,7 +3,7 @@ import {
|
|||
Get,
|
||||
HttpException,
|
||||
HttpStatus,
|
||||
Logger,
|
||||
Logger, Post,
|
||||
Req,
|
||||
} from '@nestjs/common';
|
||||
import { TransactionService } from './transaction.service';
|
||||
|
@ -131,4 +131,25 @@ export class PpobCallbackController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Public()
|
||||
@Post('/hemat')
|
||||
async getHemat(@Req() request: FastifyRequest) {
|
||||
const response = request.body;
|
||||
console.log('responsehemat', response);
|
||||
console.log('responsehemat2', request.body);
|
||||
if (response['msg'] != 'Transaksi Sukses') {
|
||||
//TODO: UPDATE GAGAL
|
||||
await this.transactionService.checkCallbackOrderFailed(
|
||||
response['data']['idtransaction'],
|
||||
response,
|
||||
);
|
||||
} else {
|
||||
//TODO: UPDATE BERHASIL
|
||||
await this.transactionService.checkCallbackOrderSuccess(
|
||||
response['data']['idtransaction'],
|
||||
response,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1361,13 +1361,9 @@ export class TransactionService {
|
|||
product_price.product.id,
|
||||
);
|
||||
|
||||
console.log('inipricetable', dataTransaction.product_price.price);
|
||||
console.log('inipricecallback', callback['price']);
|
||||
|
||||
if (callback['message']) {
|
||||
if (callback['message'].includes('METRO')) {
|
||||
if (callback['price'] != dataTransaction.product_price.price) {
|
||||
console.log('mskupdt', 'msk');
|
||||
dataTransaction.product_price.price = parseInt(callback['price']);
|
||||
}
|
||||
}
|
||||
|
@ -1463,8 +1459,24 @@ export class TransactionService {
|
|||
},
|
||||
});
|
||||
|
||||
const product_price = await this.productHistoryPriceService.findById(
|
||||
dataTransaction.product_price.id,
|
||||
);
|
||||
|
||||
const product = await this.productService.findOneById(
|
||||
product_price.product.id,
|
||||
);
|
||||
|
||||
const supplier = await this.supplierService.findByCode(
|
||||
product.supplier.code,
|
||||
);
|
||||
|
||||
dataTransaction.status = statusTransaction.SUCCESS;
|
||||
|
||||
if (supplier.code == 'Hemat') {
|
||||
dataTransaction.seri_number = callback['data']['serial_number'];
|
||||
dataProductHistoryPrice.price = parseInt(callback['data']['additional']['harga']);
|
||||
} else {
|
||||
if (callback['sn']) {
|
||||
dataTransaction.seri_number = callback['sn'];
|
||||
console.log('msksn1', dataTransaction.seri_number);
|
||||
|
@ -1489,19 +1501,12 @@ export class TransactionService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const userData = await this.userService.findExist(dataTransaction.user);
|
||||
|
||||
let supervisorData = [];
|
||||
|
||||
const product_price = await this.productHistoryPriceService.findById(
|
||||
dataTransaction.product_price.id,
|
||||
);
|
||||
|
||||
const product = await this.productService.findOneById(
|
||||
product_price.product.id,
|
||||
);
|
||||
|
||||
let profit = product_price.mark_up_price;
|
||||
|
||||
//GET COA
|
||||
|
|
Loading…
Reference in New Issue
Block a user