Compare commits
2 Commits
b987f79173
...
c8cd8bc745
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8cd8bc745 | ||
|
|
2852ab5bb4 |
@@ -28,9 +28,15 @@ Content-Type: application/json
|
||||
|
||||
{
|
||||
"provider": "postnord",
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
}
|
||||
]
|
||||
"items": []
|
||||
}
|
||||
|
||||
|
||||
### Get cart
|
||||
GET https://cart.tornberg.me/api/12345
|
||||
|
||||
|
||||
### Remove delivery method
|
||||
DELETE https://cart.tornberg.me/api/12345/delivery/2
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ type CartItem struct {
|
||||
Disclaimer string `json:"disclaimer,omitempty"`
|
||||
ArticleType string `json:"type,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
Outlet string `json:"outlet,omitempty"`
|
||||
Outlet *string `json:"outlet,omitempty"`
|
||||
}
|
||||
|
||||
type CartDelivery struct {
|
||||
@@ -263,16 +263,18 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
||||
tax = int(msg.Tax)
|
||||
}
|
||||
c.Items = append(c.Items, &CartItem{
|
||||
Id: c.lastItemId,
|
||||
Quantity: int(msg.Quantity),
|
||||
Sku: msg.Sku,
|
||||
Name: msg.Name,
|
||||
Price: msg.Price,
|
||||
Image: msg.Image,
|
||||
Stock: StockStatus(msg.Stock),
|
||||
Disclaimer: msg.Disclaimer,
|
||||
OrgPrice: msg.OrgPrice,
|
||||
Tax: tax,
|
||||
Id: c.lastItemId,
|
||||
Quantity: int(msg.Quantity),
|
||||
Sku: msg.Sku,
|
||||
Name: msg.Name,
|
||||
Price: msg.Price,
|
||||
Image: msg.Image,
|
||||
Stock: StockStatus(msg.Stock),
|
||||
Disclaimer: msg.Disclaimer,
|
||||
OrgPrice: msg.OrgPrice,
|
||||
ArticleType: msg.ArticleType,
|
||||
Outlet: msg.Outlet,
|
||||
Tax: tax,
|
||||
})
|
||||
c.TotalPrice += msg.Price * int64(msg.Quantity)
|
||||
c.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user