Complete refactor to new grpc control plane and only http proxy for carts #4
@@ -34,21 +34,16 @@ type CartItem struct {
|
|||||||
ItemId uint32 `json:"itemId,omitempty"`
|
ItemId uint32 `json:"itemId,omitempty"`
|
||||||
ParentId uint32 `json:"parentId,omitempty"`
|
ParentId uint32 `json:"parentId,omitempty"`
|
||||||
Sku string `json:"sku"`
|
Sku string `json:"sku"`
|
||||||
|
|
||||||
Price Price `json:"price"`
|
Price Price `json:"price"`
|
||||||
TotalPrice Price `json:"totalPrice"`
|
TotalPrice Price `json:"totalPrice"`
|
||||||
|
|
||||||
OrgPrice *Price `json:"orgPrice,omitempty"`
|
OrgPrice *Price `json:"orgPrice,omitempty"`
|
||||||
Stock StockStatus `json:"stock"`
|
Stock StockStatus `json:"stock"`
|
||||||
Quantity int `json:"qty"`
|
Quantity int `json:"qty"`
|
||||||
Discount *Price `json:"discount,omitempty"`
|
Discount *Price `json:"discount,omitempty"`
|
||||||
|
|
||||||
Disclaimer string `json:"disclaimer,omitempty"`
|
Disclaimer string `json:"disclaimer,omitempty"`
|
||||||
|
|
||||||
ArticleType string `json:"type,omitempty"`
|
ArticleType string `json:"type,omitempty"`
|
||||||
|
|
||||||
StoreId *string `json:"storeId,omitempty"`
|
StoreId *string `json:"storeId,omitempty"`
|
||||||
Meta ItemMeta `json:"meta,omitempty"`
|
Meta *ItemMeta `json:"meta,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CartDelivery struct {
|
type CartDelivery struct {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
messages "git.tornberg.me/go-cart-actor/pkg/messages"
|
messages "git.tornberg.me/go-cart-actor/pkg/messages"
|
||||||
"github.com/matst80/slask-finder/pkg/index"
|
"github.com/matst80/slask-finder/pkg/index"
|
||||||
@@ -52,10 +54,13 @@ func ToItemAddMessage(item *index.DataItem, storeId *string, qty int, country st
|
|||||||
}
|
}
|
||||||
|
|
||||||
stock := StockStatus(0)
|
stock := StockStatus(0)
|
||||||
centralStockValue, ok := item.GetNumberFieldValue(3)
|
centralStockValue, ok := item.GetStringFieldValue(3)
|
||||||
if storeId == nil {
|
if storeId == nil {
|
||||||
if ok {
|
if ok {
|
||||||
stock = StockStatus(centralStockValue)
|
pureNumber := strings.Replace(centralStockValue, "+", "", -1)
|
||||||
|
if centralStock, err := strconv.ParseInt(pureNumber, 10, 64); err == nil {
|
||||||
|
stock = StockStatus(centralStock)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
storeStock, ok := item.Stock.GetStock()[*storeId]
|
storeStock, ok := item.Stock.GetStock()[*storeId]
|
||||||
|
|||||||
Reference in New Issue
Block a user