support mapping
This commit is contained in:
@@ -76,6 +76,9 @@ func (s *PoolServer) GetCartHandler(w http.ResponseWriter, r *http.Request, id c
|
|||||||
func (s *PoolServer) AddSkuToCartHandler(w http.ResponseWriter, r *http.Request, id cart.CartId) error {
|
func (s *PoolServer) AddSkuToCartHandler(w http.ResponseWriter, r *http.Request, id cart.CartId) error {
|
||||||
sku := r.PathValue("sku")
|
sku := r.PathValue("sku")
|
||||||
country := getCountryFromHost(r.Host)
|
country := getCountryFromHost(r.Host)
|
||||||
|
if s.idx == nil {
|
||||||
|
log.Printf("No index present")
|
||||||
|
}
|
||||||
if s.idx != nil && s.idx.IsDeleted(sku) {
|
if s.idx != nil && s.idx.IsDeleted(sku) {
|
||||||
// Bus-deleted SKU — skip the HTTP fetch and reject the add. Mirrors the
|
// Bus-deleted SKU — skip the HTTP fetch and reject the add. Mirrors the
|
||||||
// product-fetcher's "product service returned %d for sku %s" shape so
|
// product-fetcher's "product service returned %d for sku %s" shape so
|
||||||
@@ -100,6 +103,9 @@ func (s *PoolServer) AddSkuToCartHandler(w http.ResponseWriter, r *http.Request,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if msg == nil {
|
if msg == nil {
|
||||||
|
if s.idx == nil {
|
||||||
|
log.Printf("No item found in index %s", sku)
|
||||||
|
}
|
||||||
var err error
|
var err error
|
||||||
msg, err = GetItemAddMessage(r.Context(), sku, 1, country, nil)
|
msg, err = GetItemAddMessage(r.Context(), sku, 1, country, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user