Merge branch 'development' into 'devops-staging'
Feat: add column and function balance_remaining See merge request empatnusabangsa/ppob/ppob-backend!193
This commit is contained in:
		| @@ -10,6 +10,9 @@ export class Transactions extends BaseModel { | |||||||
|   @Column() |   @Column() | ||||||
|   amount: number; |   amount: number; | ||||||
|  |  | ||||||
|  |   @Column() | ||||||
|  |   balance_remaining: number; | ||||||
|  |  | ||||||
|   @Column() |   @Column() | ||||||
|   status: statusTransaction; |   status: statusTransaction; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -627,6 +627,7 @@ export class TransactionService { | |||||||
|         transactionData.partner_trx_id = orderTransactionDto.trx_id; |         transactionData.partner_trx_id = orderTransactionDto.trx_id; | ||||||
|         transactionData.supplier_trx_id = trxId; |         transactionData.supplier_trx_id = trxId; | ||||||
|         transactionData.check_bill = orderTransactionDto.bill_trx_id; |         transactionData.check_bill = orderTransactionDto.bill_trx_id; | ||||||
|  |         transactionData.balance_remaining = coaAccount.amount - product_price.mark_up_price - costInventory; | ||||||
|  |  | ||||||
|         if (!hitSupplier.success) { |         if (!hitSupplier.success) { | ||||||
|           transactionData.status = statusTransaction.FAILED; |           transactionData.status = statusTransaction.FAILED; | ||||||
| @@ -1236,6 +1237,12 @@ export class TransactionService { | |||||||
|       coaType.WALLET, |       coaType.WALLET, | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|  |     dataTransaction.status = statusTransaction.FAILED; | ||||||
|  |     dataTransaction.callback_json = callback; | ||||||
|  |     dataTransaction.failed_reason = `Trx ${product.code} ke ${dataTransaction.destination} gagal`; | ||||||
|  |     dataTransaction.balance_remaining = coaAccount.amount + product_price.mark_up_price + product_price.price; | ||||||
|  |  | ||||||
|  |  | ||||||
|     const coaInventory = await this.coaService.findByName( |     const coaInventory = await this.coaService.findByName( | ||||||
|       `${coaType[coaType.INVENTORY]}-${product.supplier.code}`, |       `${coaType[coaType.INVENTORY]}-${product.supplier.code}`, | ||||||
|     ); |     ); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user