feat: add column check bill
This commit is contained in:
parent
feda138732
commit
6bc9c72df8
|
@ -16,6 +16,11 @@ export class Transactions extends BaseModel {
|
|||
@Column()
|
||||
type: typeTransaction;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
check_bill: string;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
|
|
|
@ -481,7 +481,29 @@ export class TransactionService {
|
|||
`${coaType[coaType.SALES]}-SYSTEM`,
|
||||
);
|
||||
|
||||
if (orderTransactionDto.bill_trx_id !== null) {
|
||||
try {
|
||||
const billId = await this.checkBillHistoryRepository.findOneOrFail({
|
||||
where: {
|
||||
id: orderTransactionDto.bill_trx_id
|
||||
},
|
||||
});
|
||||
product_price.price = billId.amount
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
throw new HttpException(
|
||||
{
|
||||
statusCode: HttpStatus.NOT_FOUND,
|
||||
error: 'Build not found',
|
||||
},
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (coaAccount.amount < product_price.mark_up_price + product_price.price) {
|
||||
throw new HttpException(
|
||||
|
@ -570,6 +592,7 @@ export class TransactionService {
|
|||
transactionData.destination = orderTransactionDto.destination;
|
||||
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
||||
transactionData.supplier_trx_id = trxId;
|
||||
transactionData.check_bill = orderTransactionDto.bill_trx_id;
|
||||
|
||||
if (!hitSupplier.success) {
|
||||
transactionData.status = statusTransaction.FAILED;
|
||||
|
|
Loading…
Reference in New Issue
Block a user