From 9e4d5df733ef824b3abda33f8bc253f569ab99ed Mon Sep 17 00:00:00 2001 From: matst80 Date: Sun, 18 May 2025 19:46:12 +0200 Subject: [PATCH] delivery pickup point --- cart-grain.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cart-grain.go b/cart-grain.go index 6ce6c81..bb231fa 100644 --- a/cart-grain.go +++ b/cart-grain.go @@ -428,7 +428,7 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa Id: c.lastDeliveryId, Provider: msg.Provider, PickupPoint: msg.PickupPoint, - Price: 49, + Price: 4900, Items: items, }) @@ -500,6 +500,21 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa ImageURL: fmt.Sprintf("https://www.elgiganten.se%s", item.Image), }) } + for _, line := range c.Deliveries { + if line.Price > 0 { + orderLines = append(orderLines, &Line{ + Type: "shipping_fee", + Reference: line.Provider, + Name: "Delivery", + Quantity: 1, + UnitPrice: int(line.Price), + TaxRate: 2500, // item.TaxRate, + QuantityUnit: "st", + TotalAmount: int(line.Price), + TotalTaxAmount: int(GetTaxAmount(line.Price, 2500)), + }) + } + } order := CheckoutOrder{ PurchaseCountry: "SE", PurchaseCurrency: "SEK", @@ -588,6 +603,7 @@ func (c *CartGrain) UpdateTotals() { } for _, delivery := range c.Deliveries { c.TotalPrice += delivery.Price + c.TotalTax += GetTaxAmount(delivery.Price, 2500) } }