order item
This commit is contained in:
@@ -85,7 +85,7 @@ export class OrderService {
|
||||
// return updateOrder
|
||||
}
|
||||
|
||||
//TODO : clean
|
||||
|
||||
async updateOrderAsAdmin2(orderId: string, dto: UpdateOrderAsAdminDto) {
|
||||
const order = await this.findOrderOrFail(orderId)
|
||||
|
||||
@@ -324,44 +324,6 @@ export class OrderService {
|
||||
return orders
|
||||
}
|
||||
|
||||
// async calculateOrder(inputOrder?: Order, orderId?: string) {
|
||||
// let order: undefined | Order = inputOrder
|
||||
|
||||
// if (!order && orderId) {
|
||||
// order = await this.findOneOrFail(orderId)
|
||||
// }
|
||||
|
||||
// if (!order) {
|
||||
// throw new BadRequestException("Order not found")
|
||||
// }
|
||||
// // calculate order financials
|
||||
// const subTotal = order.items.reduce((sum, item) => {
|
||||
// return sum + item.subTotal
|
||||
// }, 0)
|
||||
|
||||
// const totalDiscount = order.items.reduce((sum, item) => {
|
||||
// return sum + Number(item.discount)
|
||||
// }, 0)
|
||||
|
||||
|
||||
// const totalBeforeTax = subTotal - totalDiscount
|
||||
// let tax = 0
|
||||
|
||||
// if (order.enableTax) {
|
||||
// tax = 0.1 * totalBeforeTax
|
||||
// }
|
||||
|
||||
// const total = totalBeforeTax + tax
|
||||
|
||||
// // Update Order financial values
|
||||
// // order.subTotal = subTotal
|
||||
// // order.discount = totalDiscount
|
||||
// // order.taxAmount = tax
|
||||
// // order.total = total
|
||||
// // order.balance = total - paidAmount
|
||||
|
||||
// return order
|
||||
// }
|
||||
|
||||
async confirmOrderItem(userId: string, orderId: string, orderItemId: string) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user