- add hemat when transaction failed or success update to db
This commit is contained in:
parent
7f76d10062
commit
ead1a6efa4
|
@ -141,13 +141,13 @@ export class PpobCallbackController {
|
|||
if (response['msg'] != 'Transaksi Sukses') {
|
||||
//TODO: UPDATE GAGAL
|
||||
await this.transactionService.checkCallbackOrderFailed(
|
||||
response['clientid'],
|
||||
response['data']['idtransaction'],
|
||||
response,
|
||||
);
|
||||
} else {
|
||||
//TODO: UPDATE BERHASIL
|
||||
await this.transactionService.checkCallbackOrderSuccess(
|
||||
response['clientid'],
|
||||
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,37 +1459,6 @@ export class TransactionService {
|
|||
},
|
||||
});
|
||||
|
||||
dataTransaction.status = statusTransaction.SUCCESS;
|
||||
|
||||
if (callback['sn']) {
|
||||
dataTransaction.seri_number = callback['sn'];
|
||||
console.log('msksn1', dataTransaction.seri_number);
|
||||
} else {
|
||||
const response = callback['message'];
|
||||
const responseBaru = response.split(' ');
|
||||
|
||||
dataTransaction.seri_number =
|
||||
responseBaru[10].length > 1 ? responseBaru[10] : responseBaru[9];
|
||||
|
||||
if (dataTransaction.seri_number == 'SN:') {
|
||||
dataTransaction.seri_number = responseBaru[11];
|
||||
}
|
||||
}
|
||||
|
||||
dataTransaction.callback_json = callback;
|
||||
|
||||
if (callback['message']) {
|
||||
if (callback['message'].includes('METRO')) {
|
||||
if (callback['price'] != dataTransaction.product_price.price) {
|
||||
dataProductHistoryPrice.price = parseInt(callback['price']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const userData = await this.userService.findExist(dataTransaction.user);
|
||||
|
||||
let supervisorData = [];
|
||||
|
||||
const product_price = await this.productHistoryPriceService.findById(
|
||||
dataTransaction.product_price.id,
|
||||
);
|
||||
|
@ -1502,6 +1467,46 @@ export class TransactionService {
|
|||
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);
|
||||
} else {
|
||||
const response = callback['message'];
|
||||
const responseBaru = response.split(' ');
|
||||
|
||||
dataTransaction.seri_number =
|
||||
responseBaru[10].length > 1 ? responseBaru[10] : responseBaru[9];
|
||||
|
||||
if (dataTransaction.seri_number == 'SN:') {
|
||||
dataTransaction.seri_number = responseBaru[11];
|
||||
}
|
||||
}
|
||||
|
||||
dataTransaction.callback_json = callback;
|
||||
|
||||
if (callback['message']) {
|
||||
if (callback['message'].includes('METRO')) {
|
||||
if (callback['price'] != dataTransaction.product_price.price) {
|
||||
dataProductHistoryPrice.price = parseInt(callback['price']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const userData = await this.userService.findExist(dataTransaction.user);
|
||||
|
||||
let supervisorData = [];
|
||||
|
||||
let profit = product_price.mark_up_price;
|
||||
|
||||
//GET COA
|
||||
|
|
Loading…
Reference in New Issue
Block a user