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