calcualte tax before sending it
This commit is contained in:
@@ -115,15 +115,16 @@ export default function useOrder() {
|
||||
? `${location?.lat},${location?.lng}`
|
||||
: "",
|
||||
delivery_address: location?.address,
|
||||
vatvalue: restaurant?.vat || 0,
|
||||
vatvalue: ((restaurant?.vat || 0) / 100) * (subtotal - discountAmount),
|
||||
taxes:
|
||||
restaurant?.taxes?.map((t) => ({
|
||||
tax_id: t.id,
|
||||
percentage: t.percentage,
|
||||
amount:
|
||||
((typeof t.percentage === "number" ? t.percentage : 0) as number) *
|
||||
Number(subtotal - discountAmount),
|
||||
})) || [],
|
||||
restaurant?.taxes
|
||||
?.filter((t) => t.is_active === 1)
|
||||
.map((t) => ({
|
||||
tax_id: t.id,
|
||||
percentage: t.percentage,
|
||||
amount:
|
||||
((Number(t.percentage) || 0) / 100) * (subtotal - discountAmount),
|
||||
})) || [],
|
||||
...(orderType === OrderType.Gift
|
||||
? {
|
||||
receiverName: giftDetails?.receiverName,
|
||||
|
||||
Reference in New Issue
Block a user