diff --git a/release/obd-kardinal.yaml b/release/obd-kardinal.yaml
index 88ea69d..d109b38 100644
--- a/release/obd-kardinal.yaml
+++ b/release/obd-kardinal.yaml
@@ -104,7 +104,7 @@ spec:
spec:
containers:
- name: server
- image: kurtosistech/frontend:main
+ image: kurtosistech/frontend:demo-on-sale
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
@@ -286,7 +286,7 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
- image: kurtosistech/productcatalogservice:main
+ image: kurtosistech/productcatalogservice:demo-on-sale
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8070
diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go
index ee9da94..3aa5edc 100644
--- a/src/frontend/handlers.go
+++ b/src/frontend/handlers.go
@@ -78,8 +78,10 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
cart := cartResponse.JSON200
type productView struct {
- Item productcatalogservice_rest_types.Product
- Price *productcatalogservice_rest_types.Money
+ Item productcatalogservice_rest_types.Product
+ Price *productcatalogservice_rest_types.Money
+ Discount *productcatalogservice_rest_types.Money
+ FinalPrice *productcatalogservice_rest_types.Money
}
products := *productsList
@@ -91,7 +93,14 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
renderHTTPError(r, w, errors.Wrapf(err, "could not convert currency for product #%s", *p.Id), http.StatusInternalServerError)
return
}
- newPV := productView{p, price}
+
+ if p.Discount == nil {
+ renderHTTPError(r, w, errors.Errorf("could not calculate discount for product #%s", *p.Id), http.StatusInternalServerError)
+ return
+ }
+ discount := money.Must(money.MultiplyFloat(price, float64(*p.Discount)))
+ finalPrice := money.Must(money.Sum(price, money.Negate(discount)))
+ newPV := productView{p, price, discount, finalPrice}
ps[i] = newPV
}
@@ -150,10 +159,19 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request)
return
}
+ if p.Discount == nil {
+ renderHTTPError(r, w, errors.Errorf("Could not calculate discount for product #%s", *p.Id), http.StatusInternalServerError)
+ return
+ }
+ discount := money.Must(money.MultiplyFloat(price, float64(*p.Discount)))
+ finalPrice := money.Must(money.Sum(price, money.Negate(discount)))
+
product := struct {
- Item productcatalogservice_rest_types.Product
- Price *productcatalogservice_rest_types.Money
- }{*p, price}
+ Item productcatalogservice_rest_types.Product
+ Price *productcatalogservice_rest_types.Money
+ Discount *productcatalogservice_rest_types.Money
+ FinalPrice *productcatalogservice_rest_types.Money
+ }{*p, price, discount, finalPrice}
if err := templates.ExecuteTemplate(w, "product", map[string]interface{}{
"session_id": sessionID(r),
@@ -247,7 +265,10 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
Quantity int32
IsAPresent bool
Price *productcatalogservice_rest_types.Money
+ FinalPrice *productcatalogservice_rest_types.Money
+ Discount *productcatalogservice_rest_types.Money
}
+
items := make([]cartItemView, len(*cart.Items))
currentCurrencyObj := currentCurrency(r)
zeroNanos := int32(0)
@@ -257,6 +278,11 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
Nanos: &zeroNanos,
Units: &zeroUnits,
}
+ totalDiscount := &productcatalogservice_rest_types.Money{
+ CurrencyCode: ¤tCurrencyObj,
+ Nanos: &zeroNanos,
+ Units: &zeroUnits,
+ }
cartItems := *cart.Items
@@ -272,21 +298,41 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
renderHTTPError(r, w, errors.Wrapf(err, "could not convert currency for product #%s", *item.ProductId), http.StatusInternalServerError)
return
}
-
logrus.Debugf("Price is %+v", price)
multPrice := money.MultiplySlow(price, uint32(*item.Quantity))
+ if p.Discount == nil {
+ renderHTTPError(r, w, errors.Errorf("Could not calculate discount for product #%s", *item.ProductId), http.StatusInternalServerError)
+ return
+ }
+
+ multDiscount, err := money.MultiplyFloat(price, float64(*p.Discount))
+ if err != nil {
+ renderHTTPError(r, w, errors.Wrapf(err, "could not calculate discount for product #%s", *item.ProductId), http.StatusInternalServerError)
+ return
+ }
+ finalPrice := money.Must(money.Sum(multPrice, money.Negate(multDiscount)))
+
prod := *p
quan := *item.Quantity
items[i] = cartItemView{
- Item: prod,
- Quantity: quan,
- Price: multPrice,
+ Item: prod,
+ Quantity: quan,
+ Price: multPrice,
+ FinalPrice: finalPrice,
+ Discount: multDiscount,
}
totalPrice = money.Must(money.Sum(totalPrice, multPrice))
+ totalDiscount = money.Must(money.Sum(totalDiscount, multDiscount))
+ }
+
+ totalCost, err := money.Sum(totalPrice, money.Negate(totalDiscount))
+ if err != nil {
+ renderHTTPError(r, w, errors.Wrapf(err, "could not calculate discount for cart"), http.StatusInternalServerError)
+ return
}
year := time.Now().Year()
@@ -299,7 +345,9 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
"cart_size": cartSize(*cart.Items),
//"shipping_cost": shippingCost,
"show_currency": true,
- "total_cost": totalPrice,
+ "total_cost": totalCost,
+ "total_value": totalPrice,
+ "total_discount": totalDiscount,
"items": items,
"expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4},
"platform_css": plat.css,
diff --git a/src/frontend/money/money.go b/src/frontend/money/money.go
index 07278b1..37c18fc 100644
--- a/src/frontend/money/money.go
+++ b/src/frontend/money/money.go
@@ -16,6 +16,7 @@ package money
import (
"errors"
+
productcatalogservice_rest_types "github.com/kurtosis-tech/new-obd/src/productcatalogservice/api/http_rest/types"
)
@@ -32,7 +33,6 @@ var (
// IsValid checks if specified value has a valid units/nanos signs and ranges.
func IsValid(m *productcatalogservice_rest_types.Money) bool {
-
nanos := *m.Nanos
return signMatches(m) && validNanos(nanos)
}
@@ -84,7 +84,8 @@ func Negate(m *productcatalogservice_rest_types.Money) *productcatalogservice_re
return &productcatalogservice_rest_types.Money{
Units: &negativeUnits,
Nanos: &negativeNanos,
- CurrencyCode: m.CurrencyCode}
+ CurrencyCode: m.CurrencyCode,
+ }
}
// Must panics if the given error is not nil. This can be used with other
@@ -126,7 +127,8 @@ func Sum(l, r *productcatalogservice_rest_types.Money) (*productcatalogservice_r
return &productcatalogservice_rest_types.Money{
Units: &units,
Nanos: &nanos,
- CurrencyCode: l.CurrencyCode}, nil
+ CurrencyCode: l.CurrencyCode,
+ }, nil
}
// MultiplySlow is a slow multiplication operation done through adding the value
@@ -139,3 +141,32 @@ func MultiplySlow(m *productcatalogservice_rest_types.Money, n uint32) *productc
}
return out
}
+
+// MultiplyFloat multiplies the Money value by a floating-point factor.
+// It returns an error if the value is invalid or the result is invalid.
+func MultiplyFloat(m *productcatalogservice_rest_types.Money, factor float64) (*productcatalogservice_rest_types.Money, error) {
+ if !IsValid(m) {
+ return &productcatalogservice_rest_types.Money{}, ErrInvalidValue
+ }
+
+ // Convert Money to total nanoseconds
+ totalNanos := int64(*m.Units)*nanosMod + int64(*m.Nanos)
+
+ // Perform the multiplication
+ resultNanos := int64(float64(totalNanos) * factor)
+
+ // Convert back to units and nanos
+ units := resultNanos / nanosMod
+ nanos := int32(resultNanos % nanosMod)
+
+ // Ensure nanos is within valid range
+ if nanos < nanosMin || nanos > nanosMax {
+ return &productcatalogservice_rest_types.Money{}, ErrInvalidValue
+ }
+
+ return &productcatalogservice_rest_types.Money{
+ Units: &units,
+ Nanos: &nanos,
+ CurrencyCode: m.CurrencyCode,
+ }, nil
+}
diff --git a/src/frontend/static/styles/cart.css b/src/frontend/static/styles/cart.css
index 8933f68..3e35f75 100755
--- a/src/frontend/static/styles/cart.css
+++ b/src/frontend/static/styles/cart.css
@@ -56,6 +56,8 @@
.cart-summary-item-row,
.cart-summary-shipping-row,
+.cart-summary-total-value-row,
+.cart-summary-total-discount-row,
.cart-summary-total-row {
padding-bottom: 24px;
padding-top: 24px;
@@ -90,6 +92,11 @@
}
}
+.cart-item-original-price {
+ font-size: 14px;
+ text-decoration: line-through;
+}
+
/* Item cost (price). */
.cart-summary-item-row .row:last-child strong {
font-weight: 500;
@@ -99,6 +106,17 @@
font-size: 28px;
}
+.cart-summary-total-value-row {
+ font-size: 28px;
+ text-decoration: line-through;
+}
+
+.cart-summary-total-discount-row {
+ font-size: 28px;
+ color: red;
+}
+
+
/* Cart Checkout Form */
.cart-checkout-form h3 {
@@ -112,4 +130,4 @@
/* "Place Order" button */
.cart-checkout-form .cymbal-button-primary {
margin-top: 36px;
-}
\ No newline at end of file
+}
diff --git a/src/frontend/static/styles/styles.css b/src/frontend/static/styles/styles.css
index 213e763..d0537d3 100755
--- a/src/frontend/static/styles/styles.css
+++ b/src/frontend/static/styles/styles.css
@@ -342,6 +342,11 @@ main {
margin-bottom: 8px;
}
+.hot-product-card-original-price {
+ font-size: 14px;
+ text-decoration: line-through;
+}
+
.hot-product-card-price {
font-size: 14px;
}
@@ -419,6 +424,11 @@ similar to that of the hot-products-row.
font-size: 28px;
}
+.h-product .product-original-price {
+ font-size: 28px;
+ text-decoration: line-through;
+}
+
.h-product .product-info .product-wrapper {
margin-left: 15px;
}
diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html
index 325551a..35cc4d1 100755
--- a/src/frontend/templates/cart.html
+++ b/src/frontend/templates/cart.html
@@ -81,8 +81,11 @@
{{ .Item.Name }}
{{end}}
-
+
{{ renderMoney .Price }}
+
+
+ {{ renderMoney .FinalPrice }}
@@ -95,6 +98,16 @@ {{ .Item.Name }}
{{ renderMoney .shipping_cost }}
+
+
Total Value
+
{{ renderMoney .total_value }}
+
+
+
+
Total Discount
+
{{ renderMoney .total_discount }}
+
+
Total
{{ renderMoney .total_cost }}
diff --git a/src/frontend/templates/home.html b/src/frontend/templates/home.html
index 8fd0f74..bd30582 100755
--- a/src/frontend/templates/home.html
+++ b/src/frontend/templates/home.html
@@ -49,7 +49,8 @@
Hot Products
{{ .Item.Name }}
-
{{ renderMoney .Price }}
+
{{ renderMoney .Price }}
+
{{ renderMoney .FinalPrice }}
{{ end }}
@@ -75,4 +76,4 @@ Hot Products
{{ template "footer" . }}
-{{ end }}
\ No newline at end of file
+{{ end }}
diff --git a/src/frontend/templates/product.html b/src/frontend/templates/product.html
index ce2d649..f594f43 100755
--- a/src/frontend/templates/product.html
+++ b/src/frontend/templates/product.html
@@ -32,7 +32,8 @@
{{ $.product.Item.Name }}
-
{{ renderMoney $.product.Price }}
+
{{ renderMoney $.product.Price }}
+
{{ renderMoney $.product.FinalPrice }}
{{ $.product.Item.Description }}
{{ template "footer" . }}
-{{ end }}
\ No newline at end of file
+{{ end }}
diff --git a/src/productcatalogservice/api/http_rest/server/server.gen.go b/src/productcatalogservice/api/http_rest/server/server.gen.go
index 42dd8e9..6084dbe 100644
--- a/src/productcatalogservice/api/http_rest/server/server.gen.go
+++ b/src/productcatalogservice/api/http_rest/server/server.gen.go
@@ -294,20 +294,20 @@ func (sh *strictHandler) GetProductsId(ctx echo.Context, id Id) error {
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
- "H4sIAAAAAAAC/7xWYYsbNxD9K2JayJe1d+sLLd1vgaZX0/bu8F0oNBxBkca2Eq+kjkYh5vB/L5LW6/N5",
- "fQ2kLRyHLL+defNm5nkfQLnOO4uWA7QP4CXJDhkpfzI6/dcYFBnPxllowZPTUbEwGiow+UbyGiqwskNo",
- "Id8T/hUNoYaWKWIFQa2xkykYb31CBSZjV7Db7RI4eGcD5pRXjq8/poNyltFyOkrvN0bJRKD+EBKLh0cR",
- "vyVcQgvf1IdK6vJtqBd96LldupLsuJg3Fj97VIxaIJEjSJD+4RT7F5QbXu+jZIHIeSQ2hW1gyTGf8LPs",
- "/CaV9uYGqqdlVsCmw8Cy88fgWTN7OWl+mMx+vGuaNv/9CRUsHXWSoQUtGSfp2dOYu+HGvf+AilOW353F",
- "7SlNFYnQqu075TSOdCE1z7oMHTIbyxezQ1ZjGVdICRut4RPs9y9HsGMUb8r8jJCUjCtH/SfD2IVRqv2F",
- "JJJbeNrREXwZ4pGKu3EpvFEc6cx3ZBS+i0H/0+CVRowKcDSTpyr0HRq0jecb0WEIcoXPqPRl23GXsGUT",
- "92v7tgQ45KgKs/tnCrrrU6KNXYrwerG4XkAF86ufr6GCP14truZXl49CPDYB06txvJ+L17d3y7gRr27m",
- "InhUZtn7gFg6ErxG0Y+TUJLlxq1EQPpkFFbC8IsgYkAt2AkZ2U1WaJEko1Abg5bF7U+/vghCWp0fQpoE",
- "o1HkMtO+cl7QM/Ghgk9IobBspt9Nm6SE82ilN9DCxbSZXkCVvTH3tV5nK0nHFfJIpciRbMg1Fago5iLc",
- "Ml/2iaeQ01BWYa6hhUvkYlPwxEpnTfOvGekTIxyx0tvCT5jQ8++Xcynjhs+FH/jWxfez/cauk7SFtndf",
- "odaoPgq02jtjOWPq/lcoPNLzRJWbPeYrdRms6DmB9rZ2YlAjSkWlMIQ01zQI+pVS/WYCi0GUI4nqB6N3",
- "X6LTXOeBPbwAvB1ncoDURsPu/j8cu0HV/0fFSxxEFO+36RUnJy72UAQ5JnHGHZJfQQWRNtDCmtmHtt73",
- "o4f2yBp297u/AwAA//8OU3jphQkAAA==",
+ "H4sIAAAAAAAC/7xWf2sjNxD9KmJauH/W3q1ztHT/O+g1NW2T4OQo9AiHIo1t3XklVRodZ8J+96IfXsf2",
+ "Oj1IWzBGq3078+bN6O0+gjCdNRo1eWgfwXLHOyR06UrJ+C/RC6csKaOhBeuMDIKYklCBSjuc1lCB5h1C",
+ "C2nf4V9BOZTQkgtYgRdr7HgMRlsbUZ6c0ivo+z6CvTXaY0p5Zej6U1wIowk1xSW3dqMEjwTqjz6yeHwS",
+ "8VuHS2jhm3pfSZ3v+npRQs/10uRkh8W80/jFoiCUDJ0zDiKkPBxj/4J8Q+tdlCSQMxYdqczWE6eQVviF",
+ "d3YTS3t3A9VxmRWQ6tAT7+wheNbMXk+aHyazH++apk2/P6GCpXEdJ2hBcsJJfPY0Zj/smIePKChm+d1o",
+ "3J7SFME51GL7QRiJI12IzdMmQYfMStPFbJ9VacIVuogNWtEJ9vvXI9gxijd5fkZIcsKVceVKEXZ+lGrZ",
+ "4M7xLRx3dAQvlRcm5EkqN3XoHnItecJH5OjGdbJKUHBn7jkl8EPw8p+mMndpVJ2DgT2VqLRvED6c71KH",
+ "3vMVPiPh1x2du4jNx3R3pt/nAPscVWZ2/0xBdyUl6tDFCG8Xi+sFVDC/+vkaKvjjzeJqfnX5JMRTh1BF",
+ "jcPDu3h7e7cMG/bmZs68RaGWxSTY0jhGa2Rl1pjgxDdmxTy6z0pgxRS98ix4lIwM44HMZIUaHSdkYqNQ",
+ "E7v96ddXnnEt00PoJl5JZKnMeJgpnd4z8aGCz+h8ZtlMv5s2UQljUXOroIWLaTO9gCoZZ+prvU4+E5cr",
+ "pJFKkYLTPtWUoSw7DzPLtFkSTyGlcUmFuYQWLpGyh8GRz86a5l9z2SOXHPHZ28yPKV/4l5O75GFD58IP",
+ "fOv8UkjeHLqOuy20xZqZWKP4xFBLa5SmhKnLK8o/0fNElZsd5oW6DD71nEA7zztxrxGlghDofZxrNwj6",
+ "Qql+U57YIMqBRPWjkv3X6DSXaWD3Xwfvx5nsIbWS0N//h2M3qPr/qHiJg4jsYRu/f1LibA9ZkEMSZ9wh",
+ "+hVUENwGWlgTWd/Wu34UaEHW0N/3fwcAAP//BHVic6IJAAA=",
}
// GetSwagger returns the content of the embedded swagger specification file
diff --git a/src/productcatalogservice/api/http_rest/specs/productcatalogservice.yaml b/src/productcatalogservice/api/http_rest/specs/productcatalogservice.yaml
index 1ca49da..03255f5 100644
--- a/src/productcatalogservice/api/http_rest/specs/productcatalogservice.yaml
+++ b/src/productcatalogservice/api/http_rest/specs/productcatalogservice.yaml
@@ -10,7 +10,6 @@ servers:
description: Product catalog service API
paths:
-
/health:
get:
summary: Health check endpoint
@@ -18,12 +17,12 @@ paths:
responses:
default:
$ref: "#/components/responses/NotOk"
- '200':
+ "200":
description: Service is healthy
content:
application/json:
schema:
- $ref: '#/components/schemas/HealthResponse'
+ $ref: "#/components/schemas/HealthResponse"
/products:
get:
@@ -140,6 +139,8 @@ components:
type: string
price_usd:
$ref: "#/components/schemas/Money"
+ discount:
+ type: number
categories:
type: array
items:
diff --git a/src/productcatalogservice/api/http_rest/types/types.gen.go b/src/productcatalogservice/api/http_rest/types/types.gen.go
index 6aac32c..16f9ced 100644
--- a/src/productcatalogservice/api/http_rest/types/types.gen.go
+++ b/src/productcatalogservice/api/http_rest/types/types.gen.go
@@ -31,6 +31,7 @@ type Money struct {
type Product struct {
Categories *[]string `json:"categories,omitempty"`
Description *string `json:"description,omitempty"`
+ Discount *float32 `json:"discount,omitempty"`
Id *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Picture *string `json:"picture,omitempty"`
diff --git a/src/productcatalogservice/data/products.json b/src/productcatalogservice/data/products.json
index 8019820..d736242 100644
--- a/src/productcatalogservice/data/products.json
+++ b/src/productcatalogservice/data/products.json
@@ -1,112 +1,142 @@
{
- "products": [
- {
- "id": "OLJCESPC7Z",
- "name": "Sunglasses",
- "description": "Add a modern touch to your outfits with these sleek aviator sunglasses.",
- "picture": "/static/img/products/sunglasses.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 19,
- "nanos": 990000000
- },
- "categories": ["accessories"]
- },
- {
- "id": "66VCHSJNUP",
- "name": "Tank Top",
- "description": "Perfectly cropped cotton tank, with a scooped neckline.",
- "picture": "/static/img/products/tank-top.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 18,
- "nanos": 990000000
- },
- "categories": ["clothing", "tops"]
- },
- {
- "id": "1YMWWN1N4O",
- "name": "Watch",
- "description": "This gold-tone stainless steel watch will work with most of your outfits.",
- "picture": "/static/img/products/watch.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 109,
- "nanos": 990000000
- },
- "categories": ["accessories"]
- },
- {
- "id": "L9ECAV7KIM",
- "name": "Loafers",
- "description": "A neat addition to your summer wardrobe.",
- "picture": "/static/img/products/loafers.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 89,
- "nanos": 990000000
- },
- "categories": ["footwear"]
- },
- {
- "id": "2ZYFJ3GM2N",
- "name": "Hairdryer",
- "description": "This lightweight hairdryer has 3 heat and speed settings. It's perfect for travel.",
- "picture": "/static/img/products/hairdryer.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 24,
- "nanos": 990000000
- },
- "categories": ["hair", "beauty"]
- },
- {
- "id": "0PUK6V6EV0",
- "name": "Candle Holder",
- "description": "This small but intricate candle holder is an excellent gift.",
- "picture": "/static/img/products/candle-holder.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 18,
- "nanos": 990000000
- },
- "categories": ["decor", "home"]
- },
- {
- "id": "LS4PSXUNUM",
- "name": "Salt & Pepper Shakers",
- "description": "Add some flavor to your kitchen.",
- "picture": "/static/img/products/salt-and-pepper-shakers.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 18,
- "nanos": 490000000
- },
- "categories": ["kitchen"]
- },
- {
- "id": "9SIQT8TOJO",
- "name": "Bamboo Glass Jar",
- "description": "This bamboo glass jar can hold 57 oz (1.7 l) and is perfect for any kitchen.",
- "picture": "/static/img/products/bamboo-glass-jar.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 5,
- "nanos": 490000000
- },
- "categories": ["kitchen"]
- },
- {
- "id": "6E92ZMYYFZ",
- "name": "Mug",
- "description": "A simple mug with a mustard interior.",
- "picture": "/static/img/products/mug.jpg",
- "price_usd": {
- "currency_code": "USD",
- "units": 8,
- "nanos": 990000000
- },
- "categories": ["kitchen"]
- }
- ]
+ "products": [
+ {
+ "id": "OLJCESPC7Z",
+ "name": "Sunglasses",
+ "description": "Add a modern touch to your outfits with these sleek aviator sunglasses.",
+ "picture": "/static/img/products/sunglasses.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 19,
+ "nanos": 990000000
+ },
+ "categories": [
+ "accessories"
+ ],
+ "discount": 0.08
+ },
+ {
+ "id": "66VCHSJNUP",
+ "name": "Tank Top",
+ "description": "Perfectly cropped cotton tank, with a scooped neckline.",
+ "picture": "/static/img/products/tank-top.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 18,
+ "nanos": 990000000
+ },
+ "categories": [
+ "clothing",
+ "tops"
+ ],
+ "discount": 0.29
+ },
+ {
+ "id": "1YMWWN1N4O",
+ "name": "Watch",
+ "description": "This gold-tone stainless steel watch will work with most of your outfits.",
+ "picture": "/static/img/products/watch.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 109,
+ "nanos": 990000000
+ },
+ "categories": [
+ "accessories"
+ ],
+ "discount": 0.23
+ },
+ {
+ "id": "L9ECAV7KIM",
+ "name": "Loafers",
+ "description": "A neat addition to your summer wardrobe.",
+ "picture": "/static/img/products/loafers.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 89,
+ "nanos": 990000000
+ },
+ "categories": [
+ "footwear"
+ ],
+ "discount": 0.14
+ },
+ {
+ "id": "2ZYFJ3GM2N",
+ "name": "Hairdryer",
+ "description": "This lightweight hairdryer has 3 heat and speed settings. It's perfect for travel.",
+ "picture": "/static/img/products/hairdryer.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 24,
+ "nanos": 990000000
+ },
+ "categories": [
+ "hair",
+ "beauty"
+ ],
+ "discount": 0.09
+ },
+ {
+ "id": "0PUK6V6EV0",
+ "name": "Candle Holder",
+ "description": "This small but intricate candle holder is an excellent gift.",
+ "picture": "/static/img/products/candle-holder.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 18,
+ "nanos": 990000000
+ },
+ "categories": [
+ "decor",
+ "home"
+ ],
+ "discount": 0.27
+ },
+ {
+ "id": "LS4PSXUNUM",
+ "name": "Salt & Pepper Shakers",
+ "description": "Add some flavor to your kitchen.",
+ "picture": "/static/img/products/salt-and-pepper-shakers.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 18,
+ "nanos": 490000000
+ },
+ "categories": [
+ "kitchen"
+ ],
+ "discount": 0.27
+ },
+ {
+ "id": "9SIQT8TOJO",
+ "name": "Bamboo Glass Jar",
+ "description": "This bamboo glass jar can hold 57 oz (1.7 l) and is perfect for any kitchen.",
+ "picture": "/static/img/products/bamboo-glass-jar.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 5,
+ "nanos": 490000000
+ },
+ "categories": [
+ "kitchen"
+ ],
+ "discount": 0.08
+ },
+ {
+ "id": "6E92ZMYYFZ",
+ "name": "Mug",
+ "description": "A simple mug with a mustard interior.",
+ "picture": "/static/img/products/mug.jpg",
+ "price_usd": {
+ "currency_code": "USD",
+ "units": 8,
+ "nanos": 990000000
+ },
+ "categories": [
+ "kitchen"
+ ],
+ "discount": 0.23
+ }
+ ]
}
diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go
index 6cc2808..a295806 100644
--- a/src/productcatalogservice/main.go
+++ b/src/productcatalogservice/main.go
@@ -2,11 +2,12 @@ package main
import (
"fmt"
+ "net"
+
productcatalogservice_server_rest_server "github.com/kurtosis-tech/new-obd/src/productcatalogservice/api/http_rest/server"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/sirupsen/logrus"
- "net"
)
const (