fix: transaction for partner
This commit is contained in:
parent
89d0895ff3
commit
1886ef160c
|
@ -292,6 +292,13 @@ export class TransactionService {
|
||||||
orderTransactionDto: OrderTransactionDto,
|
orderTransactionDto: OrderTransactionDto,
|
||||||
currentUser: any,
|
currentUser: any,
|
||||||
) {
|
) {
|
||||||
|
const trxId = Array(6)
|
||||||
|
.fill(null)
|
||||||
|
.map(() => {
|
||||||
|
return Math.round(Math.random() * 16).toString(16);
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
|
||||||
//GET USER
|
//GET USER
|
||||||
const userData = await this.userService.findByUsername(
|
const userData = await this.userService.findByUsername(
|
||||||
currentUser.username,
|
currentUser.username,
|
||||||
|
@ -378,6 +385,7 @@ export class TransactionService {
|
||||||
transactionData.product_price = product_price;
|
transactionData.product_price = product_price;
|
||||||
transactionData.destination = orderTransactionDto.destination;
|
transactionData.destination = orderTransactionDto.destination;
|
||||||
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
||||||
|
transactionData.partner_trx_id = trxId;
|
||||||
await manager.insert(Transactions, transactionData);
|
await manager.insert(Transactions, transactionData);
|
||||||
|
|
||||||
await this.accountingTransaction({
|
await this.accountingTransaction({
|
||||||
|
@ -410,7 +418,13 @@ export class TransactionService {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return {
|
||||||
|
trx_id: trxId,
|
||||||
|
client_trx_id: orderTransactionDto.trx_id,
|
||||||
|
product: orderTransactionDto.productCode,
|
||||||
|
amount: product_price.mark_up_price + product_price.price,
|
||||||
|
status: statusTransaction[statusTransaction.SUCCESS],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async orderTransactionProd(
|
async orderTransactionProd(
|
||||||
|
@ -490,7 +504,13 @@ export class TransactionService {
|
||||||
await this.productHistoryPriceService.create(newProductPrice);
|
await this.productHistoryPriceService.create(newProductPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hitSupplier;
|
return {
|
||||||
|
trx_id: trxId,
|
||||||
|
client_trx_id: orderTransactionDto.trx_id,
|
||||||
|
product: orderTransactionDto.productCode,
|
||||||
|
amount: transactionData.amount,
|
||||||
|
status: statusTransaction[transactionData.status],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async createDepositReturn(currentUser, depositReturnDto: DepositReturnDto) {
|
async createDepositReturn(currentUser, depositReturnDto: DepositReturnDto) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user