Merge branch 'devops-staging' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend
This commit is contained in:
commit
4e9d4e48f9
|
@ -3,7 +3,7 @@ import {
|
||||||
Get,
|
Get,
|
||||||
HttpException,
|
HttpException,
|
||||||
HttpStatus,
|
HttpStatus,
|
||||||
Logger,
|
Logger, Post,
|
||||||
Req,
|
Req,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { TransactionService } from './transaction.service';
|
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,
|
product_price.product.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('inipricetable', dataTransaction.product_price.price);
|
|
||||||
console.log('inipricecallback', callback['price']);
|
|
||||||
|
|
||||||
if (callback['message']) {
|
if (callback['message']) {
|
||||||
if (callback['message'].includes('METRO')) {
|
if (callback['message'].includes('METRO')) {
|
||||||
if (callback['price'] != dataTransaction.product_price.price) {
|
if (callback['price'] != dataTransaction.product_price.price) {
|
||||||
console.log('mskupdt', 'msk');
|
|
||||||
dataTransaction.product_price.price = parseInt(callback['price']);
|
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;
|
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']) {
|
if (callback['sn']) {
|
||||||
dataTransaction.seri_number = callback['sn'];
|
dataTransaction.seri_number = callback['sn'];
|
||||||
console.log('msksn1', dataTransaction.seri_number);
|
console.log('msksn1', dataTransaction.seri_number);
|
||||||
|
@ -1489,19 +1501,12 @@ export class TransactionService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const userData = await this.userService.findExist(dataTransaction.user);
|
const userData = await this.userService.findExist(dataTransaction.user);
|
||||||
|
|
||||||
let supervisorData = [];
|
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;
|
let profit = product_price.mark_up_price;
|
||||||
|
|
||||||
//GET COA
|
//GET COA
|
||||||
|
@ -2121,7 +2126,7 @@ export class TransactionService {
|
||||||
total_transaction: parseInt(data.total_transaction),
|
total_transaction: parseInt(data.total_transaction),
|
||||||
total_modal: parseInt(data.total_modal),
|
total_modal: parseInt(data.total_modal),
|
||||||
total_profit: parseInt(data.total_profit),
|
total_profit: parseInt(data.total_profit),
|
||||||
total_commission: parseInt(total_expense) - parseInt(data.total_profit),
|
total_commission: parseInt(data.total_profit) - parseInt(total_expense),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user