push endpoint
Some checks failed
Build and Publish / BuildAndDeploy (push) Successful in 3m16s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
matst80
2025-04-18 16:38:24 +02:00
parent 7d27257a71
commit 9f585eec2e
3 changed files with 165 additions and 10 deletions

View File

@@ -60,15 +60,18 @@ type CartDelivery struct {
}
type CartGrain struct {
mu sync.RWMutex
lastItemId int
lastDeliveryId int
storageMessages []Message
Id CartId `json:"id"`
Items []*CartItem `json:"items"`
TotalPrice int64 `json:"totalPrice"`
Deliveries []*CartDelivery `json:"deliveries,omitempty"`
Processing bool `json:"processing"`
mu sync.RWMutex
lastItemId int
lastDeliveryId int
storageMessages []Message
Id CartId `json:"id"`
Items []*CartItem `json:"items"`
TotalPrice int64 `json:"totalPrice"`
Deliveries []*CartDelivery `json:"deliveries,omitempty"`
Processing bool `json:"processing"`
PaymentInProgress bool `json:"paymentInProgress"`
OrderReference string `json:"orderReference,omitempty"`
PaymentReference string `json:"paymentReference,omitempty"`
}
type Grain interface {
@@ -413,6 +416,8 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
} else {
orderLines := make([]*klarna.Line, 0, len(c.Items))
totalTax := 0
c.PaymentInProgress = true
c.Processing = true
for _, item := range c.Items {
total := int(item.Price) * item.Quantity
taxAmount := GetTaxAmount(total, item.Tax)