From 9634693f37397344f61c621e8e4d75d0bdc56015 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Tue, 26 Jun 2018 14:01:05 -0700 Subject: [PATCH 01/49] recommendationservice: exclude input ids Signed-off-by: Ahmet Alp Balkan --- src/recommendationservice/recommendation_server.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/recommendationservice/recommendation_server.py b/src/recommendationservice/recommendation_server.py index 1ea14f5..b75c3a0 100644 --- a/src/recommendationservice/recommendation_server.py +++ b/src/recommendationservice/recommendation_server.py @@ -12,13 +12,17 @@ class RecommendationService(demo_pb2_grpc.RecommendationServiceServicer): # fetch list of products from product catalog stub cat_response = stub.ListProducts(demo_pb2.Empty()) - num_prodcuts = len(cat_response.products) - num_return = min(max_responses, num_prodcuts) + + product_ids = [x.id for x in cat_response.products] + filtered_products = list(set(product_ids)-set(request.product_ids)) + + num_products = len(filtered_products) + num_return = min(max_responses, num_products) # sample list of indicies to return - indices = random.sample(range(num_prodcuts), num_return) + indices = random.sample(range(num_products), num_return) # fetch product ids from indices - prod_list = [cat_response.products[i].id for i in indices] + prod_list = [filtered_products[i] for i in indices] print("handling request: {}".format(prod_list)) # build and return response From 908df8d3316eb37b43e986316887368ffa607037 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Tue, 26 Jun 2018 14:19:22 -0700 Subject: [PATCH 02/49] frontend: integrate recommmendationservice Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 46 ++++++++++++++++----- src/frontend/main.go | 8 ++++ src/frontend/rpc.go | 21 ++++++++++ src/frontend/templates/cart.html | 9 +++- src/frontend/templates/footer.html | 5 +-- src/frontend/templates/product.html | 6 ++- src/frontend/templates/recommendations.html | 21 ++++++++++ 7 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 src/frontend/templates/recommendations.html diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 2170c1a..a9ad7b0 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -95,7 +95,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) http.Error(w, "product id not specified", http.StatusBadRequest) return } - log.Printf("[productHandler] id=%s currency=%s", id, currentCurrency(r)) + log.Printf("[productHandler] id=%s currency=%s session=%s", id, currentCurrency(r), sessionID(r)) p, err := fe.getProduct(r.Context(), id) if err != nil { http.Error(w, fmt.Sprintf("could not retrieve product: %+v", err), http.StatusInternalServerError) @@ -106,6 +106,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) return } + cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { http.Error(w, fmt.Sprintf("could not retrieve cart: %+v", err), http.StatusInternalServerError) @@ -120,17 +121,25 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) return } + recommendations, err := fe.getRecommendations(r.Context(), sessionID(r), []string{id}) + if err != nil { + http.Error(w, fmt.Sprintf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) + return + } + log.Printf("cart size=%d", len(cart)) + product := struct { Item *pb.Product Price *pb.Money }{p, price} if err := templates.ExecuteTemplate(w, "product", map[string]interface{}{ - "user_currency": currentCurrency(r), - "currencies": currencies, - "product": product, - "session_id": sessionID(r), - "cart_size": len(cart), + "user_currency": currentCurrency(r), + "currencies": currencies, + "product": product, + "session_id": sessionID(r), + "recommendations": recommendations, + "cart_size": len(cart), }); err != nil { log.Println(err) } @@ -183,6 +192,12 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request return } + recommendations, err := fe.getRecommendations(r.Context(), sessionID(r), cartIDs(cart)) + if err != nil { + http.Error(w, fmt.Sprintf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) + return + } + type cartItemView struct { Item *pb.Product Quantity int32 @@ -211,11 +226,12 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request } if err := templates.ExecuteTemplate(w, "cart", map[string]interface{}{ - "user_currency": currentCurrency(r), - "currencies": currencies, - "session_id": sessionID(r), - "cart_size": len(cart), - "items": items, + "user_currency": currentCurrency(r), + "currencies": currencies, + "session_id": sessionID(r), + "recommendations": recommendations, + "cart_size": len(cart), + "items": items, }); err != nil { log.Println(err) } @@ -265,3 +281,11 @@ func sessionID(r *http.Request) string { } return "" } + +func cartIDs(c []*pb.CartItem) []string { + out := make([]string, len(c)) + for i, v := range c { + out[i] = v.GetProductId() + } + return out +} diff --git a/src/frontend/main.go b/src/frontend/main.go index cda4a22..46ca919 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -37,6 +37,9 @@ type frontendServer struct { cartSvcAddr string cartSvcConn *grpc.ClientConn + + recommendationSvcAddr string + recommendationSvcConn *grpc.ClientConn } func main() { @@ -51,6 +54,7 @@ func main() { mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR") mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR") mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR") + mustMapEnv(&svc.recommendationSvcAddr, "RECOMMENDATION_SERVICE_ADDR") var err error svc.currencySvcConn, err = grpc.DialContext(ctx, svc.currencySvcAddr, grpc.WithInsecure()) @@ -65,6 +69,10 @@ func main() { if err != nil { log.Fatalf("failed to connect cart service at %s: %+v", svc.cartSvcAddr, err) } + svc.recommendationSvcConn, err = grpc.DialContext(ctx, svc.recommendationSvcAddr, grpc.WithInsecure()) + if err != nil { + log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcConn, err) + } r := mux.NewRouter() r.HandleFunc("/", ensureSessionID(svc.homeHandler)).Methods(http.MethodGet, http.MethodHead) diff --git a/src/frontend/rpc.go b/src/frontend/rpc.go index f295506..4e589f3 100644 --- a/src/frontend/rpc.go +++ b/src/frontend/rpc.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "google.golang.org/grpc/codes" @@ -74,3 +75,23 @@ func (fe *frontendServer) convertCurrency(ctx context.Context, money *pb.Money, From: money, ToCode: currency}) } + +func (fe *frontendServer) getRecommendations(ctx context.Context, userID string, productIDs []string) ([]*pb.Product, error) { + resp, err := pb.NewRecommendationServiceClient(fe.recommendationSvcConn).ListRecommendations(ctx, + &pb.ListRecommendationsRequest{UserId: userID, ProductIds: productIDs}) + if err != nil { + return nil, err + } + out := make([]*pb.Product, len(resp.GetProductIds())) + for i, v := range resp.GetProductIds() { + p, err := fe.getProduct(ctx, v) + if err != nil { + return nil, fmt.Errorf("failed to get recommended product info (#%s): %+v", v, err) + } + out[i] = p + } + if len(out) > 4 { + out = out[:4] // take only first four to fit the UI + } + return out, err +} diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index f20057c..b73fba0 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -14,8 +14,8 @@ {{ range $.items }}
- +
{{.Item.Name}}
@@ -45,6 +45,11 @@
{{ end }} + {{ if $.recommendations}} +
+ {{ template "recommendations" $.recommendations }} + {{ end }} +
diff --git a/src/frontend/templates/footer.html b/src/frontend/templates/footer.html index f4eef54..7b8d3f1 100644 --- a/src/frontend/templates/footer.html +++ b/src/frontend/templates/footer.html @@ -1,7 +1,6 @@ {{ define "footer" }} - - -session-id: {{$.session_id}} + + This is a demo application. {{ end }} diff --git a/src/frontend/templates/product.html b/src/frontend/templates/product.html index a4dae1d..332c3b4 100644 --- a/src/frontend/templates/product.html +++ b/src/frontend/templates/product.html @@ -6,7 +6,7 @@
-
@@ -43,6 +43,10 @@
+ {{ if $.recommendations}} +
+ {{ template "recommendations" $.recommendations }} + {{ end }}
diff --git a/src/frontend/templates/recommendations.html b/src/frontend/templates/recommendations.html new file mode 100644 index 0000000..e3c2728 --- /dev/null +++ b/src/frontend/templates/recommendations.html @@ -0,0 +1,21 @@ +{{ define "recommendations" }} +
Similar products
+
+ {{range . }} +
+
+ + + +
+ + {{ .Name }} + +
+
+
+ {{ end }} +
+{{ end }} From 22762b28bd6f9dc5de5c5522acf5c25d5eaf2d7c Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Wed, 27 Jun 2018 10:33:18 -0700 Subject: [PATCH 03/49] Fixing AddItem and adding more tests/cartservice/CartServiceTests Updated AddItem functionality so it handles update quantities scenario. Added tests --- src/cartservice/cartstore/RedisCartStore.cs | 14 ++++- tests/cartservice/CartServiceTests.cs | 66 ++++++++++++++------- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/src/cartservice/cartstore/RedisCartStore.cs b/src/cartservice/cartstore/RedisCartStore.cs index ea87568..87adb2c 100644 --- a/src/cartservice/cartstore/RedisCartStore.cs +++ b/src/cartservice/cartstore/RedisCartStore.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using System.Threading.Tasks; using cartservice.interfaces; using Google.Protobuf; @@ -40,14 +41,23 @@ namespace cartservice.cartstore if (value.IsNull) { cart = new Hipstershop.Cart(); + cart.UserId = userId; + cart.Items.Add(new Hipstershop.CartItem { ProductId = productId, Quantity = quantity }); } else { cart = Hipstershop.Cart.Parser.ParseFrom(value); + var existingItem = cart.Items.SingleOrDefault(i => i.ProductId == productId); + if (existingItem == null) + { + cart.Items.Add(new Hipstershop.CartItem { ProductId = productId, Quantity = quantity }); + } + else + { + existingItem.Quantity += quantity; + } } - cart.UserId = userId; - cart.Items.Add(new Hipstershop.CartItem { ProductId = productId, Quantity = quantity }); await db.HashSetAsync(userId, new[]{ new HashEntry(CART_FIELD_NAME, cart.ToByteArray()) }); } diff --git a/tests/cartservice/CartServiceTests.cs b/tests/cartservice/CartServiceTests.cs index b82ace3..5794a82 100644 --- a/tests/cartservice/CartServiceTests.cs +++ b/tests/cartservice/CartServiceTests.cs @@ -36,7 +36,49 @@ namespace cartservice } [Fact] - public async Task AddItem_ItemInserted() + public async Task AddItem_ItemExists_Udpated() + { + string userId = Guid.NewGuid().ToString(); + + // Construct server's Uri + string targetUri = $"{serverHostName}:{port}"; + + // Create a GRPC communication channel between the client and the server + var channel = new Channel(targetUri, ChannelCredentials.Insecure); + + var client = new CartServiceClient(channel); + var request = new AddItemRequest + { + UserId = userId, + Item = new CartItem + { + ProductId = "1", + Quantity = 1 + } + }; + + // First add - nothing should fail + await client.AddItemAsync(request); + + // Second add of existing product - quantity should be updated + await client.AddItemAsync(request); + + var getCartRequest = new GetCartRequest + { + UserId = userId + }; + var cart = await client.GetCartAsync(getCartRequest); + Assert.NotNull(cart); + Assert.Equal(userId, cart.UserId); + Assert.Single(cart.Items); + Assert.Equal(2, cart.Items[0].Quantity); + + // Cleanup + await client.EmptyCartAsync(new EmptyCartRequest{ UserId = userId }); + } + + [Fact] + public async Task AddItem_New_Inserted() { string userId = Guid.NewGuid().ToString(); @@ -46,8 +88,6 @@ namespace cartservice // Create a GRPC communication channel between the client and the server var channel = new Channel(targetUri, ChannelCredentials.Insecure); - //ar interceptorObject = new ObjecT(); - //var channel.Intercept(interceptorObject); // Create a proxy object to work with the server var client = new CartServiceClient(channel); @@ -61,30 +101,12 @@ namespace cartservice } }; -/* - for (int i = 0; i < 3; i++) - { - try - { - Console.WriteLine("Try " + i+1); - await client.AddItemAsync(request); - break; - } - catch (Exception) - { - await Task.Delay(1000); - continue; - } - } -*/ await client.AddItemAsync(request); + var getCartRequest = new GetCartRequest { UserId = userId }; - //await client.EmptyCartAsync(nameof) - //await client.EmptyCartAsync(new EmptyCartRequest{ UserId = userId }); - var cart = await client.GetCartAsync(getCartRequest); Assert.NotNull(cart); Assert.Equal(userId, cart.UserId); From 3144c87e2134cb4f2e68ab3566ed56107421bd65 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Tue, 26 Jun 2018 20:55:11 -0700 Subject: [PATCH 04/49] frontend: ui tweaks Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 1 - src/frontend/templates/cart.html | 12 +++++++----- src/frontend/templates/footer.html | 2 +- src/frontend/templates/header.html | 2 +- src/frontend/templates/product.html | 5 +++-- src/frontend/templates/recommendations.html | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index a9ad7b0..447bcbc 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -126,7 +126,6 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) http.Error(w, fmt.Sprintf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) return } - log.Printf("cart size=%d", len(cart)) product := struct { Item *pb.Product diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index b73fba0..223e90a 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -4,11 +4,13 @@
-

Shopping Cart

- {{ if eq (len $.items) 0 }} -

Your shopping cart is empty.

- Browse Products +

Your shopping cart is empty!

+

Items you add to your shopping cart will appear here.

+ Browse Products → + {{ else }} +

{{ len $.items }} item {{- if gt (len $.items) 0}}s{{end}} + in your Shopping Cart

{{ end }} {{ range $.items }} @@ -39,7 +41,7 @@
- Proceed to Checkout + Proceed to Checkout →
diff --git a/src/frontend/templates/footer.html b/src/frontend/templates/footer.html index 7b8d3f1..acfdca7 100644 --- a/src/frontend/templates/footer.html +++ b/src/frontend/templates/footer.html @@ -1,6 +1,6 @@ {{ define "footer" }} - This is a demo application. + This is a demo application. ({{$.session_id}}) {{ end }} diff --git a/src/frontend/templates/header.html b/src/frontend/templates/header.html index 76bb700..81502f4 100644 --- a/src/frontend/templates/header.html +++ b/src/frontend/templates/header.html @@ -23,7 +23,7 @@ {{end}} - View Cart ({{$.cart_size}}) + View Cart ({{$.cart_size}}) diff --git a/src/frontend/templates/product.html b/src/frontend/templates/product.html index 332c3b4..192816f 100644 --- a/src/frontend/templates/product.html +++ b/src/frontend/templates/product.html @@ -30,15 +30,16 @@
- + - + diff --git a/src/frontend/templates/recommendations.html b/src/frontend/templates/recommendations.html index e3c2728..66c5b6a 100644 --- a/src/frontend/templates/recommendations.html +++ b/src/frontend/templates/recommendations.html @@ -1,6 +1,6 @@ {{ define "recommendations" }} -
Similar products
-
+
Products you might like
+
{{range . }}
From 8ca3593635140f1c4900612a6766dd2cbe7084b8 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:04:21 -0700 Subject: [PATCH 05/49] frontend/money: add money utilities Signed-off-by: Ahmet Alp Balkan --- src/frontend/money.go | 50 ------- src/frontend/money/money.go | 117 ++++++++++++++++ src/frontend/money/money_test.go | 231 +++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+), 50 deletions(-) delete mode 100644 src/frontend/money.go create mode 100644 src/frontend/money/money.go create mode 100644 src/frontend/money/money_test.go diff --git a/src/frontend/money.go b/src/frontend/money.go deleted file mode 100644 index a97e1d3..0000000 --- a/src/frontend/money.go +++ /dev/null @@ -1,50 +0,0 @@ -package main - -import ( - "math" - - pb "frontend/genproto" -) - -// TODO(ahmetb): any logic below is flawed because I just realized we have no -// way of representing amounts like 17.07 because Fractional cannot store 07. -func multMoney(m pb.MoneyAmount, n uint32) pb.MoneyAmount { - out := m - for n > 1 { - out = sum(out, m) - n-- - } - return out -} - -func sum(m1, m2 pb.MoneyAmount) pb.MoneyAmount { - // TODO(ahmetb) this is copied from ./checkoutservice/money.go, find a - // better mult function. - f1, f2 := float64(m1.Fractional), float64(m2.Fractional) - lg1 := math.Max(1, math.Ceil(math.Log10(f1))) - if f1 == math.Pow(10, lg1) { - lg1++ - } - lg2 := math.Max(1, math.Ceil(math.Log10(f2))) - if f2 == math.Pow(10, lg2) { - lg2++ - } - lgMax := math.Max(lg1, lg2) - - dSum := m1.Decimal + m2.Decimal - o1 := f1 * math.Pow(10, lgMax-lg1) - o2 := f2 * math.Pow(10, lgMax-lg2) - fSum := o1 + o2 - if fSum >= math.Pow(10, lgMax) { - fSum -= math.Pow(10, lgMax) - dSum++ - } - - for int(fSum)%10 == 0 && fSum != 0 { - fSum = float64(int(fSum) / 10) - } - - return pb.MoneyAmount{ - Decimal: dSum, - Fractional: uint32(fSum)} -} diff --git a/src/frontend/money/money.go b/src/frontend/money/money.go new file mode 100644 index 0000000..bc1856a --- /dev/null +++ b/src/frontend/money/money.go @@ -0,0 +1,117 @@ +package money + +import ( + "errors" + pb "frontend/genproto" +) + +const ( + nanosMin = -999999999 + nanosMax = +999999999 + nanosMod = 1000000000 +) + +var ( + ErrInvalidValue = errors.New("one of the specified money values is invalid") + ErrMismatchingCurrency = errors.New("mismatching currency codes") +) + +// IsValid checks if specified value has a valid units/nanos signs and ranges. +func IsValid(m pb.Money) bool { + return signMatches(m) && validNanos(m.GetNanos()) +} + +func signMatches(m pb.Money) bool { + return m.GetNanos() == 0 || m.GetUnits() == 0 || (m.GetNanos() < 0) == (m.GetUnits() < 0) +} + +func validNanos(nanos int32) bool { return nanosMin <= nanos && nanos <= nanosMax } + +// IsZero returns true if the specified money value is equal to zero. +func IsZero(m pb.Money) bool { return m.GetUnits() == 0 && m.GetNanos() == 0 } + +// IsPositive returns true if the specified money value is valid and is +// positive. +func IsPositive(m pb.Money) bool { + return IsValid(m) && m.GetUnits() > 0 || (m.GetUnits() == 0 && m.GetNanos() > 0) +} + +// IsNegative returns true if the specified money value is valid and is +// negative. +func IsNegative(m pb.Money) bool { + return IsValid(m) && m.GetUnits() < 0 || (m.GetUnits() == 0 && m.GetNanos() < 0) +} + +// AreSameCurrency returns true if values l and r have a currency code and +// they are the same values. +func AreSameCurrency(l, r pb.Money) bool { + return l.GetCurrencyCode() == r.GetCurrencyCode() && l.GetCurrencyCode() != "" +} + +// AreEquals returns true if values l and r are the equal, including the +// currency. This does not check validity of the provided values. +func AreEquals(l, r pb.Money) bool { + return l.GetCurrencyCode() == r.GetCurrencyCode() && + l.GetUnits() == r.GetUnits() && l.GetNanos() == r.GetNanos() +} + +// Negate returns the same amount with the sign negated. +func Negate(m pb.Money) pb.Money { + return pb.Money{ + Units: -m.GetUnits(), + Nanos: -m.GetNanos(), + CurrencyCode: m.GetCurrencyCode()} +} + +// Must panics if the given error is not nil. This can be used with other +// functions like: "m := Must(Sum(a,b))". +func Must(v pb.Money, err error) pb.Money { + if err != nil { + panic(err) + } + return v +} + +// Sum adds two values. Returns an error if one of the values are invalid or +// currency codes are not matching (unless currency code is unspecified for +// both). +func Sum(l, r pb.Money) (pb.Money, error) { + if !IsValid(l) || !IsValid(r) { + return pb.Money{}, ErrInvalidValue + } else if l.GetCurrencyCode() != r.GetCurrencyCode() { + return pb.Money{}, ErrMismatchingCurrency + } + units := l.GetUnits() + r.GetUnits() + nanos := l.GetNanos() + r.GetNanos() + + if (units == 0 && nanos == 0) || (units > 0 && nanos >= 0) || (units < 0 && nanos <= 0) { + // same sign + units += int64(nanos / nanosMod) + nanos = nanos % nanosMod + } else { + // different sign. nanos guaranteed to not to go over the limit + if units > 0 { + units-- + nanos += nanosMod + } else { + units++ + nanos -= nanosMod + } + } + + return pb.Money{ + Units: units, + Nanos: nanos, + CurrencyCode: l.GetCurrencyCode()}, nil +} + +// MultiplySlow is a slow multiplication operation done through adding the value +// to itself n-1 times. +func MultiplySlow(m pb.MoneyAmount, n uint32) pb.MoneyAmount { + out := m + for n > 1 { + out = Sum(out, m) + n-- + } + return out +} diff --git a/src/frontend/money/money_test.go b/src/frontend/money/money_test.go new file mode 100644 index 0000000..457227a --- /dev/null +++ b/src/frontend/money/money_test.go @@ -0,0 +1,231 @@ +package money + +import ( + "fmt" + "reflect" + "testing" + + pb "frontend/genproto" +) + +func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} } +func mm(u int64, n int32) pb.Money { return mmc(u, n, "") } + +func TestIsValid(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"valid -/-", mm(-981273891273, -999999999), true}, + {"invalid -/+", mm(-981273891273, +999999999), false}, + {"valid +/+", mm(981273891273, 999999999), true}, + {"invalid +/-", mm(981273891273, -999999999), false}, + {"invalid +/+overflow", mm(3, 1000000000), false}, + {"invalid +/-overflow", mm(3, -1000000000), false}, + {"invalid -/+overflow", mm(-3, 1000000000), false}, + {"invalid -/-overflow", mm(-3, -1000000000), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsValid(tt.in); got != tt.want { + t.Errorf("IsValid(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsZero(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"zero", mm(0, 0), true}, + {"not-zero (-/+)", mm(-1, +1), false}, + {"not-zero (-/-)", mm(-1, -1), false}, + {"not-zero (+/+)", mm(+1, +1), false}, + {"not-zero (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsZero(tt.in); got != tt.want { + t.Errorf("IsZero(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsPositive(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"zero", mm(0, 0), false}, + {"positive (+/+)", mm(+1, +1), true}, + {"invalid (-/+)", mm(-1, +1), false}, + {"negative (-/-)", mm(-1, -1), false}, + {"invalid (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsPositive(tt.in); got != tt.want { + t.Errorf("IsPositive(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsNegative(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"zero", mm(0, 0), false}, + {"positive (+/+)", mm(+1, +1), false}, + {"invalid (-/+)", mm(-1, +1), false}, + {"negative (-/-)", mm(-1, -1), true}, + {"invalid (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsNegative(tt.in); got != tt.want { + t.Errorf("IsNegative(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestAreSameCurrency(t *testing.T) { + type args struct { + l pb.Money + r pb.Money + } + tests := []struct { + name string + args args + want bool + }{ + {"both empty currency", args{mmc(1, 0, ""), mmc(2, 0, "")}, false}, + {"left empty currency", args{mmc(1, 0, ""), mmc(2, 0, "USD")}, false}, + {"right empty currency", args{mmc(1, 0, "USD"), mmc(2, 0, "")}, false}, + {"mismatching", args{mmc(1, 0, "USD"), mmc(2, 0, "CAD")}, false}, + {"matching", args{mmc(1, 0, "USD"), mmc(2, 0, "USD")}, true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AreSameCurrency(tt.args.l, tt.args.r); got != tt.want { + t.Errorf("AreSameCurrency([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} + +func TestAreEquals(t *testing.T) { + type args struct { + l pb.Money + r pb.Money + } + tests := []struct { + name string + args args + want bool + }{ + {"equals", args{mmc(1, 2, "USD"), mmc(1, 2, "USD")}, true}, + {"mismatching currency", args{mmc(1, 2, "USD"), mmc(1, 2, "CAD")}, false}, + {"mismatching units", args{mmc(10, 20, "USD"), mmc(1, 20, "USD")}, false}, + {"mismatching nanos", args{mmc(1, 2, "USD"), mmc(1, 20, "USD")}, false}, + {"negated", args{mmc(1, 2, "USD"), mmc(-1, -2, "USD")}, false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AreEquals(tt.args.l, tt.args.r); got != tt.want { + t.Errorf("AreEquals([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} + +func TestNegate(t *testing.T) { + tests := []struct { + name string + in pb.Money + want pb.Money + }{ + {"zero", mm(0, 0), mm(0, 0)}, + {"negative", mm(-1, -200), mm(1, 200)}, + {"positive", mm(1, 200), mm(-1, -200)}, + {"carries currency code", mmc(0, 0, "XXX"), mmc(0, 0, "XXX")}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := Negate(tt.in); !AreEquals(got, tt.want) { + t.Errorf("Negate([%v]) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestMust_pass(t *testing.T) { + v := Must(mm(2, 3), nil) + if !AreEquals(v, mm(2, 3)) { + t.Errorf("returned the wrong value: %v", v) + } +} + +func TestMust_panic(t *testing.T) { + defer func() { + if r := recover(); r != nil { + t.Logf("panic captured: %v", r) + } + }() + Must(mm(2, 3), fmt.Errorf("some error")) + t.Fatal("this should not have executed due to the panic above") +} + +func TestSum(t *testing.T) { + type args struct { + l pb.Money + r pb.Money + } + tests := []struct { + name string + args args + want pb.Money + wantErr error + }{ + {"0+0=0", args{mm(0, 0), mm(0, 0)}, mm(0, 0), nil}, + {"Error: currency code on left", args{mmc(0, 0, "XXX"), mm(0, 0)}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: currency code on right", args{mm(0, 0), mmc(0, 0, "YYY")}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: currency code mismatch", args{mmc(0, 0, "AAA"), mmc(0, 0, "BBB")}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: invalid +/-", args{mm(+1, -1), mm(0, 0)}, mm(0, 0), ErrInvalidValue}, + {"Error: invalid -/+", args{mm(0, 0), mm(-1, +2)}, mm(0, 0), ErrInvalidValue}, + {"Error: invalid nanos", args{mm(0, 1000000000), mm(1, 0)}, mm(0, 0), ErrInvalidValue}, + {"both positive (no carry)", args{mm(2, 200000000), mm(2, 200000000)}, mm(4, 400000000), nil}, + {"both positive (nanos=max)", args{mm(2, 111111111), mm(2, 888888888)}, mm(4, 999999999), nil}, + {"both positive (carry)", args{mm(2, 200000000), mm(2, 900000000)}, mm(5, 100000000), nil}, + {"both negative (no carry)", args{mm(-2, -200000000), mm(-2, -200000000)}, mm(-4, -400000000), nil}, + {"both negative (carry)", args{mm(-2, -200000000), mm(-2, -900000000)}, mm(-5, -100000000), nil}, + {"mixed (larger positive, just decimals)", args{mm(11, 0), mm(-2, 0)}, mm(9, 0), nil}, + {"mixed (larger negative, just decimals)", args{mm(-11, 0), mm(2, 0)}, mm(-9, 0), nil}, + {"mixed (larger positive, no borrow)", args{mm(11, 100000000), mm(-2, -100000000)}, mm(9, 0), nil}, + {"mixed (larger positive, with borrow)", args{mm(11, 100000000), mm(-2, -9000000 /*.09*/)}, mm(9, 91000000 /*.091*/), nil}, + {"mixed (larger negative, no borrow)", args{mm(-11, -100000000), mm(2, 100000000)}, mm(-9, 0), nil}, + {"mixed (larger negative, with borrow)", args{mm(-11, -100000000), mm(2, 9000000 /*.09*/)}, mm(-9, -91000000 /*.091*/), nil}, + {"0+negative", args{mm(0, 0), mm(-2, -100000000)}, mm(-2, -100000000), nil}, + {"negative+0", args{mm(-2, -100000000), mm(0, 0)}, mm(-2, -100000000), nil}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := Sum(tt.args.l, tt.args.r) + if err != tt.wantErr { + t.Errorf("Sum([%v],[%v]): expected err=\"%v\" got=\"%v\"", tt.args.l, tt.args.r, tt.wantErr, err) + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Sum([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} From 07419c20772307d8ff88a84f33317c60c8f4bc39 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:08:20 -0700 Subject: [PATCH 06/49] pb: breaking change to Money, remove MoneyAmount Signed-off-by: Ahmet Alp Balkan --- pb/demo.proto | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/pb/demo.proto b/pb/demo.proto index ffd0518..0c3fdf2 100644 --- a/pb/demo.proto +++ b/pb/demo.proto @@ -63,7 +63,7 @@ message Product { string name = 2; string description = 3; string picture = 4; - MoneyAmount price_usd = 5; + Money price_usd = 5; } message ListProductsResponse { @@ -95,7 +95,7 @@ message GetQuoteRequest { } message GetQuoteResponse { - MoneyAmount cost_usd = 1; + Money cost_usd = 1; } message ShipOrderRequest { @@ -122,18 +122,22 @@ service CurrencyService { rpc Convert(CurrencyConversionRequest) returns (Money) {} } - -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -message MoneyAmount { - uint32 decimal = 1; - uint32 fractional = 2; -} - +// Represents an amount of money with its currency type. message Money { // The 3-letter currency code defined in ISO 4217. string currency_code = 1; - MoneyAmount amount = 2; + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + int64 units = 2; + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + int32 nanos = 3; } message GetSupportedCurrenciesResponse { From c43dcd7c906e74547c6c62ad41300b8869746552 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:17:26 -0700 Subject: [PATCH 07/49] productcatalog: regenerate protos Signed-off-by: Ahmet Alp Balkan --- src/productcatalogservice/genproto/demo.pb.go | 359 ++++++++---------- src/productcatalogservice/server.go | 21 +- src/productcatalogservice/server_test.go | 8 +- 3 files changed, 178 insertions(+), 210 deletions(-) diff --git a/src/productcatalogservice/genproto/demo.pb.go b/src/productcatalogservice/genproto/demo.pb.go index d547682..7e64573 100644 --- a/src/productcatalogservice/genproto/demo.pb.go +++ b/src/productcatalogservice/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{0} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{1} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{2} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{3} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{4} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{5} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{6} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{7} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string { } type Product struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` - PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` + PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{8} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -414,7 +414,7 @@ func (m *Product) GetPicture() string { return "" } -func (m *Product) GetPriceUsd() *MoneyAmount { +func (m *Product) GetPriceUsd() *Money { if m != nil { return m.PriceUsd } @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{9} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{10} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{11} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{12} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{13} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem { } type GetQuoteResponse struct { - CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{14} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo -func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { +func (m *GetQuoteResponse) GetCostUsd() *Money { if m != nil { return m.CostUsd } @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{15} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{16} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{17} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 { return 0 } -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -type MoneyAmount struct { - Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` - Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` +// Represents an amount of money with its currency type. +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"` + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } -func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } -func (*MoneyAmount) ProtoMessage() {} -func (*MoneyAmount) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{18} -} -func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) -} -func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) -} -func (dst *MoneyAmount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoneyAmount.Merge(dst, src) -} -func (m *MoneyAmount) XXX_Size() int { - return xxx_messageInfo_MoneyAmount.Size(m) -} -func (m *MoneyAmount) XXX_DiscardUnknown() { - xxx_messageInfo_MoneyAmount.DiscardUnknown(m) -} - -var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo - -func (m *MoneyAmount) GetDecimal() uint32 { - if m != nil { - return m.Decimal - } - return 0 -} - -func (m *MoneyAmount) GetFractional() uint32 { - if m != nil { - return m.Fractional - } - return 0 -} - -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` - Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{19} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string { return "" } -func (m *Money) GetAmount() *MoneyAmount { +func (m *Money) GetUnits() int64 { if m != nil { - return m.Amount + return m.Units } - return nil + return 0 +} + +func (m *Money) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 } type GetSupportedCurrenciesResponse struct { @@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{20} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{21} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{22} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{23} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{24} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{25} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{26} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{27} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{28} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{29} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{30} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{31} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1527,7 +1496,6 @@ func init() { proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") proto.RegisterType((*Address)(nil), "hipstershop.Address") - proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") proto.RegisterType((*Money)(nil), "hipstershop.Money") proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") @@ -2294,100 +2262,99 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } -var fileDescriptor_demo_40506d781b7ed975 = []byte{ - // 1466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, - 0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66, - 0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa, - 0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a, - 0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, - 0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf, - 0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34, - 0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0, 0xa4, 0x6c, 0xc4, 0x88, 0x8b, 0x2e, 0x01, 0x04, 0xd4, - 0xb7, 0x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 0x21, - 0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4, - 0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, - 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, +var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ + // 1442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, + 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, + 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, + 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3, + 0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe8, 0x7d, 0x5f, 0xa1, 0xcf, 0xd1, + 0xd9, 0xd5, 0xae, 0xfe, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xa7, 0xdd, 0xfd, 0xf6, 0x9c, 0x6f, 0xcf, + 0x9e, 0x73, 0xf6, 0xb3, 0x01, 0x5c, 0xe2, 0xd3, 0xbd, 0x90, 0x51, 0x4e, 0x51, 0x7b, 0xe2, 0x85, + 0x11, 0x27,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 0xbb, 0xb0, 0x96, + 0xf9, 0x53, 0x9c, 0xaf, 0xc3, 0xb2, 0x43, 0x23, 0x2e, 0xef, 0xc6, 0xa8, 0xbd, 0x9b, 0xa6, 0xc0, + 0x88, 0xab, 0xa1, 0xb0, 0x76, 0x30, 0xf1, 0xc2, 0x47, 0xcc, 0x25, 0xec, 0x5f, 0xe1, 0xfc, 0x29, + 0xac, 0xe7, 0x1c, 0x66, 0xe9, 0xcd, 0x99, 0xed, 0xbc, 0xf6, 0x82, 0x57, 0x59, 0xed, 0x80, 0x9e, + 0x1a, 0xb9, 0xf8, 0x57, 0x03, 0x9a, 0xca, 0x2f, 0xda, 0x85, 0xb5, 0x88, 0x33, 0x42, 0xf8, 0x58, + 0x11, 0x18, 0xdf, 0x54, 0x3b, 0xba, 0xc9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14, + 0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03, + 0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, + 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, + 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, + 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, + 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, + 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae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 0x60, 0x41, 0x3b, + 0xf7, 0x60, 0xa0, 0x4b, 0xe5, 0x96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, + 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, + 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, + 0x00, 0x00, } diff --git a/src/productcatalogservice/server.go b/src/productcatalogservice/server.go index ae450b2..fa2fa7e 100644 --- a/src/productcatalogservice/server.go +++ b/src/productcatalogservice/server.go @@ -22,63 +22,63 @@ var catalog = []*pb.Product{ Name: "Vintage Typewriter", Description: "This typewriter looks good in your living room.", Picture: "/static/img/products/typewriter.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 67, Fractional: 99}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 67, Nanos: 990000000}, }, { Id: "66VCHSJNUP", Name: "Vintage Camera Lens", Description: "You won't have a camera to use it and it probably doesn't work anyway.", Picture: "/static/img/products/camera-lens.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 12, Fractional: 49}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 12, Nanos: 490000000}, }, { Id: "1YMWWN1N4O", Name: "Home Barista Kit", Description: "Always wanted to brew coffee with Chemex and Aeropress at home?", Picture: "/static/img/products/barista-kit.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 124, Fractional: 0}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 124, Nanos: 0}, }, { Id: "L9ECAV7KIM", Name: "Terrarium", Description: "This terrarium will looks great in your white painted living room.", Picture: "/static/img/products/terrarium.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 36, Fractional: 45}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 36, Nanos: 450000000}, }, { Id: "2ZYFJ3GM2N", Name: "Film Camera", Description: "This camera looks like it's a film camera, but it's actually digital.", Picture: "/static/img/products/film-camera.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 2245, Fractional: 0}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 2245, Nanos: 00000000}, }, { Id: "0PUK6V6EV0", Name: "Vintage Record Player", Description: "It still works.", Picture: "/static/img/products/record-player.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 65, Fractional: 50}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 65, Nanos: 500000000}, }, { Id: "LS4PSXUNUM", Name: "Metal Camping Mug", Description: "You probably don't go camping that often but this is better than plastic cups.", Picture: "/static/img/products/camp-mug.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 24, Fractional: 33}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 24, Nanos: 330000000}, }, { Id: "9SIQT8TOJO", Name: "City Bike", Description: "This single gear bike probably cannot climb the hills of San Francisco.", Picture: "/static/img/products/city-bike.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 789, Fractional: 50}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 789, Nanos: 500000000}, }, { Id: "6E92ZMYYFZ", Name: "Air Plant", Description: "Have you ever wondered whether air plants need water? Buy one and figure out.", Picture: "/static/img/products/air-plant.jpg", - PriceUsd: &pb.MoneyAmount{Decimal: 12, Fractional: 30}, + PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 12, Nanos: 300000000}, }, } @@ -118,7 +118,8 @@ func (p *productCatalog) SearchProducts(ctx context.Context, req *pb.SearchProdu // Intepret query as a substring match in name or description. var ps []*pb.Product for _, p := range catalog { - if strings.Contains(p.Name, req.Query) || strings.Contains(p.Description, req.Query) { + if strings.Contains(strings.ToLower(p.Name), strings.ToLower(req.Query)) || + strings.Contains(strings.ToLower(p.Description), strings.ToLower(req.Query)) { ps = append(ps, p) } } diff --git a/src/productcatalogservice/server_test.go b/src/productcatalogservice/server_test.go index 96b6a85..3ff811e 100644 --- a/src/productcatalogservice/server_test.go +++ b/src/productcatalogservice/server_test.go @@ -29,11 +29,11 @@ func TestServer(t *testing.T) { t.Error(diff) } - got, err := client.GetProduct(ctx, &pb.GetProductRequest{Id: "2"}) + got, err := client.GetProduct(ctx, &pb.GetProductRequest{Id: "OLJCESPC7Z"}) if err != nil { t.Fatal(err) } - if want := catalog[1]; !proto.Equal(got, want) { + if want := catalog[0]; !proto.Equal(got, want) { t.Errorf("got %v, want %v", got, want) } _, err = client.GetProduct(ctx, &pb.GetProductRequest{Id: "N/A"}) @@ -41,11 +41,11 @@ func TestServer(t *testing.T) { t.Errorf("got %s, want %s", got, want) } - sres, err := client.SearchProducts(ctx, &pb.SearchProductsRequest{Query: "nice"}) + sres, err := client.SearchProducts(ctx, &pb.SearchProductsRequest{Query: "typewriter"}) if err != nil { t.Fatal(err) } - if diff := cmp.Diff(sres.Results, catalog, cmp.Comparer(proto.Equal)); diff != "" { + if diff := cmp.Diff(sres.Results, []*pb.Product{catalog[0]}, cmp.Comparer(proto.Equal)); diff != "" { t.Error(diff) } } From bc87db4601bb24ad3f7860cc52fa45e77d9c5a4c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:28:20 -0700 Subject: [PATCH 08/49] test-cli: money proto migration Signed-off-by: Ahmet Alp Balkan --- src/test-cli/genproto/demo.pb.go | 359 ++++++++++++++----------------- src/test-cli/main.go | 28 +-- 2 files changed, 173 insertions(+), 214 deletions(-) diff --git a/src/test-cli/genproto/demo.pb.go b/src/test-cli/genproto/demo.pb.go index d547682..7e64573 100644 --- a/src/test-cli/genproto/demo.pb.go +++ b/src/test-cli/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{0} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{1} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{2} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{3} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{4} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{5} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{6} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{7} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string { } type Product struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` - PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` + PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{8} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -414,7 +414,7 @@ func (m *Product) GetPicture() string { return "" } -func (m *Product) GetPriceUsd() *MoneyAmount { +func (m *Product) GetPriceUsd() *Money { if m != nil { return m.PriceUsd } @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{9} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{10} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{11} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{12} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{13} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem { } type GetQuoteResponse struct { - CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{14} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo -func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { +func (m *GetQuoteResponse) GetCostUsd() *Money { if m != nil { return m.CostUsd } @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{15} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{16} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{17} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 { return 0 } -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -type MoneyAmount struct { - Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` - Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` +// Represents an amount of money with its currency type. +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"` + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } -func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } -func (*MoneyAmount) ProtoMessage() {} -func (*MoneyAmount) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{18} -} -func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) -} -func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) -} -func (dst *MoneyAmount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoneyAmount.Merge(dst, src) -} -func (m *MoneyAmount) XXX_Size() int { - return xxx_messageInfo_MoneyAmount.Size(m) -} -func (m *MoneyAmount) XXX_DiscardUnknown() { - xxx_messageInfo_MoneyAmount.DiscardUnknown(m) -} - -var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo - -func (m *MoneyAmount) GetDecimal() uint32 { - if m != nil { - return m.Decimal - } - return 0 -} - -func (m *MoneyAmount) GetFractional() uint32 { - if m != nil { - return m.Fractional - } - return 0 -} - -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` - Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{19} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string { return "" } -func (m *Money) GetAmount() *MoneyAmount { +func (m *Money) GetUnits() int64 { if m != nil { - return m.Amount + return m.Units } - return nil + return 0 +} + +func (m *Money) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 } type GetSupportedCurrenciesResponse struct { @@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{20} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{21} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{22} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{23} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{24} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{25} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{26} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{27} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{28} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{29} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{30} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{31} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1527,7 +1496,6 @@ func init() { proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") proto.RegisterType((*Address)(nil), "hipstershop.Address") - proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") proto.RegisterType((*Money)(nil), "hipstershop.Money") proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") @@ -2294,100 +2262,99 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } -var fileDescriptor_demo_40506d781b7ed975 = []byte{ - // 1466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, - 0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66, - 0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa, - 0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a, - 0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, - 0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0x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0xb8, 0xed, 0x23, 0x3d, 0x2f, 0x39, 0x3b, 0x86, 0xe8, 0x5b, - 0xa5, 0x67, 0x89, 0x41, 0x26, 0xb0, 0x72, 0xc0, 0x6b, 0x94, 0x12, 0xfa, 0x2d, 0xff, 0x02, 0x2b, - 0xe9, 0x56, 0xe8, 0x6a, 0x21, 0x1a, 0xaa, 0x3b, 0x5a, 0x45, 0xce, 0xfe, 0xce, 0x4d, 0x3f, 0x21, - 0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4, - 0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, - 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, +var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ + // 1442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, + 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, + 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, + 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3, + 0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe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2f, 0x43, 0xcc, 0xad, 0xca, 0xb5, 0x34, 0x20, 0x13, 0x58, 0xd9, 0x17, + 0x3d, 0x4a, 0x1b, 0x7d, 0x26, 0x7e, 0x2c, 0x55, 0xbc, 0x56, 0xe8, 0x4a, 0x29, 0x1b, 0xea, 0x5f, + 0xb4, 0x9a, 0x9a, 0xfd, 0x5d, 0x84, 0x7e, 0x42, 0x9c, 0xd7, 0x34, 0x4e, 0x8f, 0x60, 0x41, 0x3b, + 0xf7, 0x60, 0xa0, 0x4b, 0xe5, 0x96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, + 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, + 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, + 0x00, 0x00, } diff --git a/src/test-cli/main.go b/src/test-cli/main.go index b66503b..44fa6ae 100644 --- a/src/test-cli/main.go +++ b/src/test-cli/main.go @@ -183,10 +183,8 @@ func testPaymentService() error { resp, err := cl.Charge(context.TODO(), &pb.ChargeRequest{ Amount: &pb.Money{ CurrencyCode: "USD", - Amount: &pb.MoneyAmount{ - Decimal: 10, - Fractional: 55}, - }, + Units: 10, + Nanos: 550000000}, CreditCard: &pb.CreditCardInfo{ CreditCardNumber: "4444-4530-1092-6639", CreditCardCvv: 612, @@ -216,10 +214,8 @@ func testEmailService() error { ShippingTrackingId: "000-123-456", ShippingCost: &pb.Money{ CurrencyCode: "CAD", - Amount: &pb.MoneyAmount{ - Decimal: 10, - Fractional: 55}, - }, + Units: 10, + Nanos: 550000000}, ShippingAddress: &pb.Address{ StreetAddress_1: "Muffin Man", StreetAddress_2: "Drury Lane", @@ -233,9 +229,8 @@ func testEmailService() error { Quantity: 4}, Cost: &pb.Money{ CurrencyCode: "CAD", - Amount: &pb.MoneyAmount{ - Decimal: 120, - Fractional: 0}}, + Units: 120, + Nanos: 0}, }, &pb.OrderItem{ Item: &pb.CartItem{ @@ -243,9 +238,8 @@ func testEmailService() error { Quantity: 1}, Cost: &pb.Money{ CurrencyCode: "CAD", - Amount: &pb.MoneyAmount{ - Decimal: 12, - Fractional: 25}}, + Units: 12, + Nanos: 250000000}, }, }, }, @@ -276,10 +270,8 @@ func testCurrencyService() error { log.Println("--- rpc Convert()") in := &pb.Money{ CurrencyCode: "CAD", - Amount: &pb.MoneyAmount{ - Decimal: 12, - Fractional: 25}, - } + Units: 12, + Nanos: 250000000} convertResp, err := cl.Convert(context.TODO(), &pb.CurrencyConversionRequest{ From: in, ToCode: "USD"}) From 8a07a97872ec1ee8cdfa3213345d8f7839217ffa Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:36:02 -0700 Subject: [PATCH 09/49] recommendationservice: money proto migration Signed-off-by: Ahmet Alp Balkan --- src/recommendationservice/demo_pb2.py | 188 ++++++++++---------------- 1 file changed, 74 insertions(+), 114 deletions(-) diff --git a/src/recommendationservice/demo_pb2.py b/src/recommendationservice/demo_pb2.py index 387e61a..ba0401c 100644 --- a/src/recommendationservice/demo_pb2.py +++ b/src/recommendationservice/demo_pb2.py @@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( name='demo.proto', package='hipstershop', syntax='proto3', - serialized_pb=_b('\n\ndemo.proto\x12\x0bhipstershop\"0\n\x08\x43\x61rtItem\x12\x12\n\nproduct_id\x18\x01 \x01(\t\x12\x10\n\x08quantity\x18\x02 \x01(\x05\"F\n\x0e\x41\x64\x64ItemRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12#\n\x04item\x18\x02 \x01(\x0b\x32\x15.hipstershop.CartItem\"#\n\x10\x45mptyCartRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"!\n\x0eGetCartRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"=\n\x04\x43\x61rt\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"\x07\n\x05\x45mpty\"B\n\x1aListRecommendationsRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x13\n\x0bproduct_ids\x18\x02 \x03(\t\"2\n\x1bListRecommendationsResponse\x12\x13\n\x0bproduct_ids\x18\x01 \x03(\t\"v\n\x07Product\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0f\n\x07picture\x18\x04 \x01(\t\x12+\n\tprice_usd\x18\x05 \x01(\x0b\x32\x18.hipstershop.MoneyAmount\">\n\x14ListProductsResponse\x12&\n\x08products\x18\x01 \x03(\x0b\x32\x14.hipstershop.Product\"\x1f\n\x11GetProductRequest\x12\n\n\x02id\x18\x01 \x01(\t\"&\n\x15SearchProductsRequest\x12\r\n\x05query\x18\x01 \x01(\t\"?\n\x16SearchProductsResponse\x12%\n\x07results\x18\x01 \x03(\x0b\x32\x14.hipstershop.Product\"^\n\x0fGetQuoteRequest\x12%\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x14.hipstershop.Address\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\">\n\x10GetQuoteResponse\x12*\n\x08\x63ost_usd\x18\x01 \x01(\x0b\x32\x18.hipstershop.MoneyAmount\"_\n\x10ShipOrderRequest\x12%\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x14.hipstershop.Address\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"(\n\x11ShipOrderResponse\x12\x13\n\x0btracking_id\x18\x01 \x01(\t\"n\n\x07\x41\x64\x64ress\x12\x18\n\x10street_address_1\x18\x01 \x01(\t\x12\x18\n\x10street_address_2\x18\x02 \x01(\t\x12\x0c\n\x04\x63ity\x18\x03 \x01(\t\x12\x0f\n\x07\x63ountry\x18\x04 \x01(\t\x12\x10\n\x08zip_code\x18\x05 \x01(\x05\"2\n\x0bMoneyAmount\x12\x0f\n\x07\x64\x65\x63imal\x18\x01 \x01(\r\x12\x12\n\nfractional\x18\x02 \x01(\r\"H\n\x05Money\x12\x15\n\rcurrency_code\x18\x01 \x01(\t\x12(\n\x06\x61mount\x18\x02 \x01(\x0b\x32\x18.hipstershop.MoneyAmount\"8\n\x1eGetSupportedCurrenciesResponse\x12\x16\n\x0e\x63urrency_codes\x18\x01 \x03(\t\"N\n\x19\x43urrencyConversionRequest\x12 \n\x04\x66rom\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\x12\x0f\n\x07to_code\x18\x02 \x01(\t\"\x90\x01\n\x0e\x43reditCardInfo\x12\x1a\n\x12\x63redit_card_number\x18\x01 \x01(\t\x12\x17\n\x0f\x63redit_card_cvv\x18\x02 \x01(\x05\x12#\n\x1b\x63redit_card_expiration_year\x18\x03 \x01(\x05\x12$\n\x1c\x63redit_card_expiration_month\x18\x04 \x01(\x05\"e\n\rChargeRequest\x12\"\n\x06\x61mount\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\x12\x30\n\x0b\x63redit_card\x18\x02 \x01(\x0b\x32\x1b.hipstershop.CreditCardInfo\"(\n\x0e\x43hargeResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"R\n\tOrderItem\x12#\n\x04item\x18\x01 \x01(\x0b\x32\x15.hipstershop.CartItem\x12 \n\x04\x63ost\x18\x02 \x01(\x0b\x32\x12.hipstershop.Money\"\xbf\x01\n\x0bOrderResult\x12\x10\n\x08order_id\x18\x01 \x01(\t\x12\x1c\n\x14shipping_tracking_id\x18\x02 \x01(\t\x12)\n\rshipping_cost\x18\x03 \x01(\x0b\x32\x12.hipstershop.Money\x12.\n\x10shipping_address\x18\x04 \x01(\x0b\x32\x14.hipstershop.Address\x12%\n\x05items\x18\x05 \x03(\x0b\x32\x16.hipstershop.OrderItem\"V\n\x1cSendOrderConfirmationRequest\x12\r\n\x05\x65mail\x18\x01 \x01(\t\x12\'\n\x05order\x18\x02 \x01(\x0b\x32\x18.hipstershop.OrderResult\"c\n\x12\x43reateOrderRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x15\n\ruser_currency\x18\x02 \x01(\t\x12%\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x14.hipstershop.Address\"g\n\x13\x43reateOrderResponse\x12%\n\x05items\x18\x01 \x03(\x0b\x32\x16.hipstershop.OrderItem\x12)\n\rshipping_cost\x18\x02 \x01(\x0b\x32\x12.hipstershop.Money\"\xa3\x01\n\x11PlaceOrderRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x15\n\ruser_currency\x18\x02 \x01(\t\x12%\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x14.hipstershop.Address\x12\r\n\x05\x65mail\x18\x05 \x01(\t\x12\x30\n\x0b\x63redit_card\x18\x06 \x01(\x0b\x32\x1b.hipstershop.CreditCardInfo\"=\n\x12PlaceOrderResponse\x12\'\n\x05order\x18\x01 \x01(\x0b\x32\x18.hipstershop.OrderResult2\xca\x01\n\x0b\x43\x61rtService\x12<\n\x07\x41\x64\x64Item\x12\x1b.hipstershop.AddItemRequest\x1a\x12.hipstershop.Empty\"\x00\x12;\n\x07GetCart\x12\x1b.hipstershop.GetCartRequest\x1a\x11.hipstershop.Cart\"\x00\x12@\n\tEmptyCart\x12\x1d.hipstershop.EmptyCartRequest\x1a\x12.hipstershop.Empty\"\x00\x32\x83\x01\n\x15RecommendationService\x12j\n\x13ListRecommendations\x12\'.hipstershop.ListRecommendationsRequest\x1a(.hipstershop.ListRecommendationsResponse\"\x00\x32\x83\x02\n\x15ProductCatalogService\x12G\n\x0cListProducts\x12\x12.hipstershop.Empty\x1a!.hipstershop.ListProductsResponse\"\x00\x12\x44\n\nGetProduct\x12\x1e.hipstershop.GetProductRequest\x1a\x14.hipstershop.Product\"\x00\x12[\n\x0eSearchProducts\x12\".hipstershop.SearchProductsRequest\x1a#.hipstershop.SearchProductsResponse\"\x00\x32\xaa\x01\n\x0fShippingService\x12I\n\x08GetQuote\x12\x1c.hipstershop.GetQuoteRequest\x1a\x1d.hipstershop.GetQuoteResponse\"\x00\x12L\n\tShipOrder\x12\x1d.hipstershop.ShipOrderRequest\x1a\x1e.hipstershop.ShipOrderResponse\"\x00\x32\xb7\x01\n\x0f\x43urrencyService\x12[\n\x16GetSupportedCurrencies\x12\x12.hipstershop.Empty\x1a+.hipstershop.GetSupportedCurrenciesResponse\"\x00\x12G\n\x07\x43onvert\x12&.hipstershop.CurrencyConversionRequest\x1a\x12.hipstershop.Money\"\x00\x32U\n\x0ePaymentService\x12\x43\n\x06\x43harge\x12\x1a.hipstershop.ChargeRequest\x1a\x1b.hipstershop.ChargeResponse\"\x00\x32h\n\x0c\x45mailService\x12X\n\x15SendOrderConfirmation\x12).hipstershop.SendOrderConfirmationRequest\x1a\x12.hipstershop.Empty\"\x00\x32\xb6\x01\n\x0f\x43heckoutService\x12R\n\x0b\x43reateOrder\x12\x1f.hipstershop.CreateOrderRequest\x1a .hipstershop.CreateOrderResponse\"\x00\x12O\n\nPlaceOrder\x12\x1e.hipstershop.PlaceOrderRequest\x1a\x1f.hipstershop.PlaceOrderResponse\"\x00\x62\x06proto3') + serialized_pb=_b('\n\ndemo.proto\x12\x0bhipstershop\"0\n\x08\x43\x61rtItem\x12\x12\n\nproduct_id\x18\x01 \x01(\t\x12\x10\n\x08quantity\x18\x02 \x01(\x05\"F\n\x0e\x41\x64\x64ItemRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12#\n\x04item\x18\x02 \x01(\x0b\x32\x15.hipstershop.CartItem\"#\n\x10\x45mptyCartRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"!\n\x0eGetCartRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"=\n\x04\x43\x61rt\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"\x07\n\x05\x45mpty\"B\n\x1aListRecommendationsRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x13\n\x0bproduct_ids\x18\x02 \x03(\t\"2\n\x1bListRecommendationsResponse\x12\x13\n\x0bproduct_ids\x18\x01 \x03(\t\"p\n\x07Product\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0f\n\x07picture\x18\x04 \x01(\t\x12%\n\tprice_usd\x18\x05 \x01(\x0b\x32\x12.hipstershop.Money\">\n\x14ListProductsResponse\x12&\n\x08products\x18\x01 \x03(\x0b\x32\x14.hipstershop.Product\"\x1f\n\x11GetProductRequest\x12\n\n\x02id\x18\x01 \x01(\t\"&\n\x15SearchProductsRequest\x12\r\n\x05query\x18\x01 \x01(\t\"?\n\x16SearchProductsResponse\x12%\n\x07results\x18\x01 \x03(\x0b\x32\x14.hipstershop.Product\"^\n\x0fGetQuoteRequest\x12%\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x14.hipstershop.Address\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"8\n\x10GetQuoteResponse\x12$\n\x08\x63ost_usd\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\"_\n\x10ShipOrderRequest\x12%\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x14.hipstershop.Address\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"(\n\x11ShipOrderResponse\x12\x13\n\x0btracking_id\x18\x01 \x01(\t\"n\n\x07\x41\x64\x64ress\x12\x18\n\x10street_address_1\x18\x01 \x01(\t\x12\x18\n\x10street_address_2\x18\x02 \x01(\t\x12\x0c\n\x04\x63ity\x18\x03 \x01(\t\x12\x0f\n\x07\x63ountry\x18\x04 \x01(\t\x12\x10\n\x08zip_code\x18\x05 \x01(\x05\"<\n\x05Money\x12\x15\n\rcurrency_code\x18\x01 \x01(\t\x12\r\n\x05units\x18\x02 \x01(\x03\x12\r\n\x05nanos\x18\x03 \x01(\x05\"8\n\x1eGetSupportedCurrenciesResponse\x12\x16\n\x0e\x63urrency_codes\x18\x01 \x03(\t\"N\n\x19\x43urrencyConversionRequest\x12 \n\x04\x66rom\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\x12\x0f\n\x07to_code\x18\x02 \x01(\t\"\x90\x01\n\x0e\x43reditCardInfo\x12\x1a\n\x12\x63redit_card_number\x18\x01 \x01(\t\x12\x17\n\x0f\x63redit_card_cvv\x18\x02 \x01(\x05\x12#\n\x1b\x63redit_card_expiration_year\x18\x03 \x01(\x05\x12$\n\x1c\x63redit_card_expiration_month\x18\x04 \x01(\x05\"e\n\rChargeRequest\x12\"\n\x06\x61mount\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\x12\x30\n\x0b\x63redit_card\x18\x02 \x01(\x0b\x32\x1b.hipstershop.CreditCardInfo\"(\n\x0e\x43hargeResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"R\n\tOrderItem\x12#\n\x04item\x18\x01 \x01(\x0b\x32\x15.hipstershop.CartItem\x12 \n\x04\x63ost\x18\x02 \x01(\x0b\x32\x12.hipstershop.Money\"\xbf\x01\n\x0bOrderResult\x12\x10\n\x08order_id\x18\x01 \x01(\t\x12\x1c\n\x14shipping_tracking_id\x18\x02 \x01(\t\x12)\n\rshipping_cost\x18\x03 \x01(\x0b\x32\x12.hipstershop.Money\x12.\n\x10shipping_address\x18\x04 \x01(\x0b\x32\x14.hipstershop.Address\x12%\n\x05items\x18\x05 \x03(\x0b\x32\x16.hipstershop.OrderItem\"V\n\x1cSendOrderConfirmationRequest\x12\r\n\x05\x65mail\x18\x01 \x01(\t\x12\'\n\x05order\x18\x02 \x01(\x0b\x32\x18.hipstershop.OrderResult\"c\n\x12\x43reateOrderRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x15\n\ruser_currency\x18\x02 \x01(\t\x12%\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x14.hipstershop.Address\"g\n\x13\x43reateOrderResponse\x12%\n\x05items\x18\x01 \x03(\x0b\x32\x16.hipstershop.OrderItem\x12)\n\rshipping_cost\x18\x02 \x01(\x0b\x32\x12.hipstershop.Money\"\xa3\x01\n\x11PlaceOrderRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x15\n\ruser_currency\x18\x02 \x01(\t\x12%\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x14.hipstershop.Address\x12\r\n\x05\x65mail\x18\x05 \x01(\t\x12\x30\n\x0b\x63redit_card\x18\x06 \x01(\x0b\x32\x1b.hipstershop.CreditCardInfo\"=\n\x12PlaceOrderResponse\x12\'\n\x05order\x18\x01 \x01(\x0b\x32\x18.hipstershop.OrderResult2\xca\x01\n\x0b\x43\x61rtService\x12<\n\x07\x41\x64\x64Item\x12\x1b.hipstershop.AddItemRequest\x1a\x12.hipstershop.Empty\"\x00\x12;\n\x07GetCart\x12\x1b.hipstershop.GetCartRequest\x1a\x11.hipstershop.Cart\"\x00\x12@\n\tEmptyCart\x12\x1d.hipstershop.EmptyCartRequest\x1a\x12.hipstershop.Empty\"\x00\x32\x83\x01\n\x15RecommendationService\x12j\n\x13ListRecommendations\x12\'.hipstershop.ListRecommendationsRequest\x1a(.hipstershop.ListRecommendationsResponse\"\x00\x32\x83\x02\n\x15ProductCatalogService\x12G\n\x0cListProducts\x12\x12.hipstershop.Empty\x1a!.hipstershop.ListProductsResponse\"\x00\x12\x44\n\nGetProduct\x12\x1e.hipstershop.GetProductRequest\x1a\x14.hipstershop.Product\"\x00\x12[\n\x0eSearchProducts\x12\".hipstershop.SearchProductsRequest\x1a#.hipstershop.SearchProductsResponse\"\x00\x32\xaa\x01\n\x0fShippingService\x12I\n\x08GetQuote\x12\x1c.hipstershop.GetQuoteRequest\x1a\x1d.hipstershop.GetQuoteResponse\"\x00\x12L\n\tShipOrder\x12\x1d.hipstershop.ShipOrderRequest\x1a\x1e.hipstershop.ShipOrderResponse\"\x00\x32\xb7\x01\n\x0f\x43urrencyService\x12[\n\x16GetSupportedCurrencies\x12\x12.hipstershop.Empty\x1a+.hipstershop.GetSupportedCurrenciesResponse\"\x00\x12G\n\x07\x43onvert\x12&.hipstershop.CurrencyConversionRequest\x1a\x12.hipstershop.Money\"\x00\x32U\n\x0ePaymentService\x12\x43\n\x06\x43harge\x12\x1a.hipstershop.ChargeRequest\x1a\x1b.hipstershop.ChargeResponse\"\x00\x32h\n\x0c\x45mailService\x12X\n\x15SendOrderConfirmation\x12).hipstershop.SendOrderConfirmationRequest\x1a\x12.hipstershop.Empty\"\x00\x32\xb6\x01\n\x0f\x43heckoutService\x12R\n\x0b\x43reateOrder\x12\x1f.hipstershop.CreateOrderRequest\x1a .hipstershop.CreateOrderResponse\"\x00\x12O\n\nPlaceOrder\x12\x1e.hipstershop.PlaceOrderRequest\x1a\x1f.hipstershop.PlaceOrderResponse\"\x00\x62\x06proto3') ) @@ -349,7 +349,7 @@ _PRODUCT = _descriptor.Descriptor( oneofs=[ ], serialized_start=413, - serialized_end=531, + serialized_end=525, ) @@ -379,8 +379,8 @@ _LISTPRODUCTSRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=533, - serialized_end=595, + serialized_start=527, + serialized_end=589, ) @@ -410,8 +410,8 @@ _GETPRODUCTREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=597, - serialized_end=628, + serialized_start=591, + serialized_end=622, ) @@ -441,8 +441,8 @@ _SEARCHPRODUCTSREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=630, - serialized_end=668, + serialized_start=624, + serialized_end=662, ) @@ -472,8 +472,8 @@ _SEARCHPRODUCTSRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=670, - serialized_end=733, + serialized_start=664, + serialized_end=727, ) @@ -510,8 +510,8 @@ _GETQUOTEREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=735, - serialized_end=829, + serialized_start=729, + serialized_end=823, ) @@ -541,8 +541,8 @@ _GETQUOTERESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=831, - serialized_end=893, + serialized_start=825, + serialized_end=881, ) @@ -579,8 +579,8 @@ _SHIPORDERREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=895, - serialized_end=990, + serialized_start=883, + serialized_end=978, ) @@ -610,8 +610,8 @@ _SHIPORDERRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=992, - serialized_end=1032, + serialized_start=980, + serialized_end=1020, ) @@ -669,46 +669,8 @@ _ADDRESS = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1034, - serialized_end=1144, -) - - -_MONEYAMOUNT = _descriptor.Descriptor( - name='MoneyAmount', - full_name='hipstershop.MoneyAmount', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='decimal', full_name='hipstershop.MoneyAmount.decimal', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='fractional', full_name='hipstershop.MoneyAmount.fractional', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1146, - serialized_end=1196, + serialized_start=1022, + serialized_end=1132, ) @@ -727,9 +689,16 @@ _MONEY = _descriptor.Descriptor( is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='amount', full_name='hipstershop.Money.amount', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='units', full_name='hipstershop.Money.units', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='nanos', full_name='hipstershop.Money.nanos', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), @@ -745,8 +714,8 @@ _MONEY = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1198, - serialized_end=1270, + serialized_start=1134, + serialized_end=1194, ) @@ -776,8 +745,8 @@ _GETSUPPORTEDCURRENCIESRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1272, - serialized_end=1328, + serialized_start=1196, + serialized_end=1252, ) @@ -814,8 +783,8 @@ _CURRENCYCONVERSIONREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1330, - serialized_end=1408, + serialized_start=1254, + serialized_end=1332, ) @@ -866,8 +835,8 @@ _CREDITCARDINFO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1411, - serialized_end=1555, + serialized_start=1335, + serialized_end=1479, ) @@ -904,8 +873,8 @@ _CHARGEREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1557, - serialized_end=1658, + serialized_start=1481, + serialized_end=1582, ) @@ -935,8 +904,8 @@ _CHARGERESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1660, - serialized_end=1700, + serialized_start=1584, + serialized_end=1624, ) @@ -973,8 +942,8 @@ _ORDERITEM = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1702, - serialized_end=1784, + serialized_start=1626, + serialized_end=1708, ) @@ -1032,8 +1001,8 @@ _ORDERRESULT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1787, - serialized_end=1978, + serialized_start=1711, + serialized_end=1902, ) @@ -1070,8 +1039,8 @@ _SENDORDERCONFIRMATIONREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1980, - serialized_end=2066, + serialized_start=1904, + serialized_end=1990, ) @@ -1115,8 +1084,8 @@ _CREATEORDERREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=2068, - serialized_end=2167, + serialized_start=1992, + serialized_end=2091, ) @@ -1153,8 +1122,8 @@ _CREATEORDERRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=2169, - serialized_end=2272, + serialized_start=2093, + serialized_end=2196, ) @@ -1212,8 +1181,8 @@ _PLACEORDERREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=2275, - serialized_end=2438, + serialized_start=2199, + serialized_end=2362, ) @@ -1243,21 +1212,20 @@ _PLACEORDERRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=2440, - serialized_end=2501, + serialized_start=2364, + serialized_end=2425, ) _ADDITEMREQUEST.fields_by_name['item'].message_type = _CARTITEM _CART.fields_by_name['items'].message_type = _CARTITEM -_PRODUCT.fields_by_name['price_usd'].message_type = _MONEYAMOUNT +_PRODUCT.fields_by_name['price_usd'].message_type = _MONEY _LISTPRODUCTSRESPONSE.fields_by_name['products'].message_type = _PRODUCT _SEARCHPRODUCTSRESPONSE.fields_by_name['results'].message_type = _PRODUCT _GETQUOTEREQUEST.fields_by_name['address'].message_type = _ADDRESS _GETQUOTEREQUEST.fields_by_name['items'].message_type = _CARTITEM -_GETQUOTERESPONSE.fields_by_name['cost_usd'].message_type = _MONEYAMOUNT +_GETQUOTERESPONSE.fields_by_name['cost_usd'].message_type = _MONEY _SHIPORDERREQUEST.fields_by_name['address'].message_type = _ADDRESS _SHIPORDERREQUEST.fields_by_name['items'].message_type = _CARTITEM -_MONEY.fields_by_name['amount'].message_type = _MONEYAMOUNT _CURRENCYCONVERSIONREQUEST.fields_by_name['from'].message_type = _MONEY _CHARGEREQUEST.fields_by_name['amount'].message_type = _MONEY _CHARGEREQUEST.fields_by_name['credit_card'].message_type = _CREDITCARDINFO @@ -1291,7 +1259,6 @@ DESCRIPTOR.message_types_by_name['GetQuoteResponse'] = _GETQUOTERESPONSE DESCRIPTOR.message_types_by_name['ShipOrderRequest'] = _SHIPORDERREQUEST DESCRIPTOR.message_types_by_name['ShipOrderResponse'] = _SHIPORDERRESPONSE DESCRIPTOR.message_types_by_name['Address'] = _ADDRESS -DESCRIPTOR.message_types_by_name['MoneyAmount'] = _MONEYAMOUNT DESCRIPTOR.message_types_by_name['Money'] = _MONEY DESCRIPTOR.message_types_by_name['GetSupportedCurrenciesResponse'] = _GETSUPPORTEDCURRENCIESRESPONSE DESCRIPTOR.message_types_by_name['CurrencyConversionRequest'] = _CURRENCYCONVERSIONREQUEST @@ -1433,13 +1400,6 @@ Address = _reflection.GeneratedProtocolMessageType('Address', (_message.Message, )) _sym_db.RegisterMessage(Address) -MoneyAmount = _reflection.GeneratedProtocolMessageType('MoneyAmount', (_message.Message,), dict( - DESCRIPTOR = _MONEYAMOUNT, - __module__ = 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.MoneyAmount) - )) -_sym_db.RegisterMessage(MoneyAmount) - Money = _reflection.GeneratedProtocolMessageType('Money', (_message.Message,), dict( DESCRIPTOR = _MONEY, __module__ = 'demo_pb2' @@ -1539,8 +1499,8 @@ _CARTSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=0, options=None, - serialized_start=2504, - serialized_end=2706, + serialized_start=2428, + serialized_end=2630, methods=[ _descriptor.MethodDescriptor( name='AddItem', @@ -1581,8 +1541,8 @@ _RECOMMENDATIONSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=1, options=None, - serialized_start=2709, - serialized_end=2840, + serialized_start=2633, + serialized_end=2764, methods=[ _descriptor.MethodDescriptor( name='ListRecommendations', @@ -1605,8 +1565,8 @@ _PRODUCTCATALOGSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=2, options=None, - serialized_start=2843, - serialized_end=3102, + serialized_start=2767, + serialized_end=3026, methods=[ _descriptor.MethodDescriptor( name='ListProducts', @@ -1647,8 +1607,8 @@ _SHIPPINGSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=3, options=None, - serialized_start=3105, - serialized_end=3275, + serialized_start=3029, + serialized_end=3199, methods=[ _descriptor.MethodDescriptor( name='GetQuote', @@ -1680,8 +1640,8 @@ _CURRENCYSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=4, options=None, - serialized_start=3278, - serialized_end=3461, + serialized_start=3202, + serialized_end=3385, methods=[ _descriptor.MethodDescriptor( name='GetSupportedCurrencies', @@ -1713,8 +1673,8 @@ _PAYMENTSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=5, options=None, - serialized_start=3463, - serialized_end=3548, + serialized_start=3387, + serialized_end=3472, methods=[ _descriptor.MethodDescriptor( name='Charge', @@ -1737,8 +1697,8 @@ _EMAILSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=6, options=None, - serialized_start=3550, - serialized_end=3654, + serialized_start=3474, + serialized_end=3578, methods=[ _descriptor.MethodDescriptor( name='SendOrderConfirmation', @@ -1761,8 +1721,8 @@ _CHECKOUTSERVICE = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=7, options=None, - serialized_start=3657, - serialized_end=3839, + serialized_start=3581, + serialized_end=3763, methods=[ _descriptor.MethodDescriptor( name='CreateOrder', From c2b08f07938d142401f0b9af80b4b6d3b18cb699 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:40:09 -0700 Subject: [PATCH 10/49] shippingservice: money proto migration Signed-off-by: Ahmet Alp Balkan --- src/shippingservice/genproto/demo.pb.go | 359 +++++++++----------- src/shippingservice/main.go | 8 +- src/shippingservice/shippingservice_test.go | 4 +- 3 files changed, 169 insertions(+), 202 deletions(-) diff --git a/src/shippingservice/genproto/demo.pb.go b/src/shippingservice/genproto/demo.pb.go index d547682..7e64573 100644 --- a/src/shippingservice/genproto/demo.pb.go +++ b/src/shippingservice/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{0} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{1} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{2} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{3} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{4} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{5} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{6} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{7} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string { } type Product struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` - PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` + PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{8} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -414,7 +414,7 @@ func (m *Product) GetPicture() string { return "" } -func (m *Product) GetPriceUsd() *MoneyAmount { +func (m *Product) GetPriceUsd() *Money { if m != nil { return m.PriceUsd } @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{9} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{10} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{11} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{12} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{13} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem { } type GetQuoteResponse struct { - CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{14} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo -func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { +func (m *GetQuoteResponse) GetCostUsd() *Money { if m != nil { return m.CostUsd } @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{15} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{16} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{17} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 { return 0 } -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -type MoneyAmount struct { - Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` - Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` +// Represents an amount of money with its currency type. +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"` + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } -func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } -func (*MoneyAmount) ProtoMessage() {} -func (*MoneyAmount) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{18} -} -func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) -} -func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) -} -func (dst *MoneyAmount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoneyAmount.Merge(dst, src) -} -func (m *MoneyAmount) XXX_Size() int { - return xxx_messageInfo_MoneyAmount.Size(m) -} -func (m *MoneyAmount) XXX_DiscardUnknown() { - xxx_messageInfo_MoneyAmount.DiscardUnknown(m) -} - -var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo - -func (m *MoneyAmount) GetDecimal() uint32 { - if m != nil { - return m.Decimal - } - return 0 -} - -func (m *MoneyAmount) GetFractional() uint32 { - if m != nil { - return m.Fractional - } - return 0 -} - -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` - Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{19} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string { return "" } -func (m *Money) GetAmount() *MoneyAmount { +func (m *Money) GetUnits() int64 { if m != nil { - return m.Amount + return m.Units } - return nil + return 0 +} + +func (m *Money) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 } type GetSupportedCurrenciesResponse struct { @@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{20} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{21} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{22} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{23} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{24} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{25} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{26} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{27} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{28} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{29} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{30} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{31} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1527,7 +1496,6 @@ func init() { proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") proto.RegisterType((*Address)(nil), "hipstershop.Address") - proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") proto.RegisterType((*Money)(nil), "hipstershop.Money") proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") @@ -2294,100 +2262,99 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } -var fileDescriptor_demo_40506d781b7ed975 = []byte{ - // 1466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, - 0x17, 0x8f, 0x9c, 0x38, 0xb6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10, 0x5a, 0xc9, 0xbc, 0x59, 0x08, 0x96, 0xe2, 0xe0, 0xab, 0x6f, 0x57, 0x1d, 0x27, 0x64, - 0xff, 0xd0, 0x60, 0x55, 0x25, 0xb7, 0x22, 0xfb, 0x1c, 0xce, 0x97, 0x4f, 0x52, 0xa5, 0x6e, 0xbb, - 0x56, 0x24, 0x7c, 0xc2, 0x08, 0x86, 0x17, 0xd0, 0x10, 0x1a, 0xf1, 0x54, 0xc5, 0xd0, 0x95, 0x7c, - 0x2e, 0x54, 0xcd, 0x5c, 0x7a, 0x49, 0xa5, 0xc3, 0x0b, 0xfd, 0x67, 0xd0, 0x7d, 0x62, 0xce, 0x5c, - 0xe2, 0x25, 0x19, 0x3c, 0x80, 0xe5, 0xb8, 0xed, 0x23, 0x3d, 0x2f, 0x39, 0x3b, 0x86, 0xe8, 0x5b, - 0xa5, 0x67, 0x89, 0x41, 0x26, 0xb0, 0x72, 0xc0, 0x6b, 0x94, 0x12, 0xfa, 0x2d, 0xff, 0x02, 0x2b, - 0xe9, 0x56, 0xe8, 0x6a, 0x21, 0x1a, 0xaa, 0x3b, 0x5a, 0x45, 0xce, 0xfe, 0xce, 0x4d, 0x3f, 0x21, - 0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4, - 0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, - 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, +var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ + // 1442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00,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c9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14, + 0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03, + 0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, + 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, + 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, + 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, + 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, + 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0xde, 0x67, + 0x84, 0xbf, 0x83, 0x73, 0x83, 0x74, 0x22, 0x38, 0x22, 0x2c, 0xf2, 0x68, 0xa0, 0xef, 0xfe, 0x32, + 0x2c, 0xbe, 0x64, 0xd4, 0x3f, 0x26, 0x75, 0xe4, 0xba, 0xe8, 0x74, 0x9c, 0x26, 0x07, 0x4b, 0x22, + 0xba, 0xc4, 0xa9, 0x0c, 0xc0, 0xdf, 0x06, 0x74, 0x07, 0x8c, 0xb8, 0x9e, 0x68, 0xd3, 0xee, 0x28, + 0x78, 0x49, 0xd1, 0x35, 0x40, 0x8e, 0x9c, 0x19, 0x3b, 0x36, 0x73, 0xc7, 0x41, 0xec, 0xbf, 0x20, + 0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 0x4a, 0xd5, 0xbc, 0x58, 0xb7, 0x9c, 0x92, 0xfd, 0xc3, 0x80, 0x55, 0x5d, 0xdc, 0x9a, 0xec, + 0x73, 0x38, 0x5b, 0xad, 0xa4, 0x2a, 0xaf, 0xed, 0x6a, 0x99, 0xf0, 0x31, 0x12, 0x0c, 0xcf, 0xa1, + 0x21, 0x34, 0x13, 0x55, 0xc5, 0xd1, 0xe5, 0x62, 0x2d, 0xd4, 0x69, 0x2e, 0xb3, 0xa2, 0xd3, 0xe1, + 0xb9, 0xfe, 0x53, 0xe8, 0x3e, 0xb6, 0xa7, 0x3e, 0x09, 0xd2, 0x0a, 0x1e, 0xc0, 0x52, 0xf2, 0xec, + 0x23, 0xb3, 0x68, 0x39, 0x2f, 0x43, 0xcc, 0xad, 0xca, 0xb5, 0x34, 0x20, 0x13, 0x58, 0xd9, 0x17, + 0x3d, 0x4a, 0x1b, 0x7d, 0x26, 0x7e, 0x2c, 0x55, 0xbc, 0x56, 0xe8, 0x4a, 0x29, 0x1b, 0xea, 0x5f, + 0xb4, 0x9a, 0x9a, 0xfd, 0x5d, 0x84, 0x7e, 0x42, 0x9c, 0xd7, 0x34, 0x4e, 0x8f, 0x60, 0x41, 0x3b, + 0xf7, 0x60, 0xa0, 0x4b, 0xe5, 0x96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, + 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, + 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, + 0x00, 0x00, } diff --git a/src/shippingservice/main.go b/src/shippingservice/main.go index 08bb75f..9336336 100644 --- a/src/shippingservice/main.go +++ b/src/shippingservice/main.go @@ -34,10 +34,10 @@ func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQ // 3. Generate a response. return &pb.GetQuoteResponse{ - CostUsd: &pb.MoneyAmount{ - Decimal: quote.Dollars, - Fractional: quote.Cents, - }, + CostUsd: &pb.Money{ + CurrencyCode: "USD", + Units: int64(quote.Dollars), + Nanos: int32(quote.Cents * 10000000)}, }, nil } diff --git a/src/shippingservice/shippingservice_test.go b/src/shippingservice/shippingservice_test.go index e986a14..25e910d 100644 --- a/src/shippingservice/shippingservice_test.go +++ b/src/shippingservice/shippingservice_test.go @@ -36,8 +36,8 @@ func TestGetQuote(t *testing.T) { if err != nil { t.Errorf("TestGetQuote (%v) failed", err) } - if res.CostUsd.Decimal != 11 || res.CostUsd.Fractional != 22 { - t.Errorf("TestGetQuote: Quote value '%d.%d' does not match expected '%s'", res.CostUsd.Decimal, res.CostUsd.Fractional, "11.22") + if res.CostUsd.GetUnits() != 11 || res.CostUsd.GetNanos() != 220000000 { + t.Errorf("TestGetQuote: Quote value '%d.%d' does not match expected '%s'", res.CostUsd.GetUnits(), res.CostUsd.GetNanos(), "11.220000000") } } From 129eb9be6664ce7d4cb090112f04dae4cebe939c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:42:00 -0700 Subject: [PATCH 11/49] paymentservice: money proto migration the logs will reflect full nanos representation, I'm not sure how to divide this by 10000000 and left pad a zero (%02d). Signed-off-by: Ahmet Alp Balkan --- src/paymentservice/charge.js | 2 +- src/paymentservice/proto/demo.proto | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/paymentservice/charge.js b/src/paymentservice/charge.js index aa6c96d..fe6d266 100644 --- a/src/paymentservice/charge.js +++ b/src/paymentservice/charge.js @@ -58,7 +58,7 @@ module.exports = function charge(request) { throw new ExpiredCreditCard(cardNumber.replace('-', ''), month, year); console.log(`Transaction processed: ${cardType} ending ${cardNumber.substr(-4)} \ - Amount: ${amount.currency_code}${amount.amount.decimal}.${amount.amount.fractional}`) + Amount: ${amount.currency_code}${amount.units}.${amount.nanos}`) return { transaction_id: uuid() } } diff --git a/src/paymentservice/proto/demo.proto b/src/paymentservice/proto/demo.proto index ffd0518..0c3fdf2 100644 --- a/src/paymentservice/proto/demo.proto +++ b/src/paymentservice/proto/demo.proto @@ -63,7 +63,7 @@ message Product { string name = 2; string description = 3; string picture = 4; - MoneyAmount price_usd = 5; + Money price_usd = 5; } message ListProductsResponse { @@ -95,7 +95,7 @@ message GetQuoteRequest { } message GetQuoteResponse { - MoneyAmount cost_usd = 1; + Money cost_usd = 1; } message ShipOrderRequest { @@ -122,18 +122,22 @@ service CurrencyService { rpc Convert(CurrencyConversionRequest) returns (Money) {} } - -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -message MoneyAmount { - uint32 decimal = 1; - uint32 fractional = 2; -} - +// Represents an amount of money with its currency type. message Money { // The 3-letter currency code defined in ISO 4217. string currency_code = 1; - MoneyAmount amount = 2; + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + int64 units = 2; + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + int32 nanos = 3; } message GetSupportedCurrenciesResponse { From 3d22afac72adeb0b3ef7a051e04ec880a1bc0404 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 12:44:00 -0700 Subject: [PATCH 12/49] delete currencyservicetemp implementation Signed-off-by: Ahmet Alp Balkan --- src/currencyservicetemp/Dockerfile | 13 - src/currencyservicetemp/genproto/demo.pb.go | 2393 ------------------- src/currencyservicetemp/main.go | 77 - src/currencyservicetemp/money.go | 29 - src/currencyservicetemp/money_test.go | 46 - 5 files changed, 2558 deletions(-) delete mode 100644 src/currencyservicetemp/Dockerfile delete mode 100644 src/currencyservicetemp/genproto/demo.pb.go delete mode 100644 src/currencyservicetemp/main.go delete mode 100644 src/currencyservicetemp/money.go delete mode 100644 src/currencyservicetemp/money_test.go diff --git a/src/currencyservicetemp/Dockerfile b/src/currencyservicetemp/Dockerfile deleted file mode 100644 index 8fdb548..0000000 --- a/src/currencyservicetemp/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM golang:1.10-alpine as builder -RUN apk add --no-cache ca-certificates git -WORKDIR /src/microservices-demo/currencyservice -COPY . . -RUN go get -d ./... -RUN go build -o /currencyservice . - -FROM alpine as release -RUN apk add --no-cache \ - ca-certificates -COPY --from=builder /currencyservice /currencyservice -EXPOSE 7000 -ENTRYPOINT ["/currencyservice"] diff --git a/src/currencyservicetemp/genproto/demo.pb.go b/src/currencyservicetemp/genproto/demo.pb.go deleted file mode 100644 index d547682..0000000 --- a/src/currencyservicetemp/genproto/demo.pb.go +++ /dev/null @@ -1,2393 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: demo.proto - -package hipstershop - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type CartItem struct { - ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId" json:"product_id,omitempty"` - Quantity int32 `protobuf:"varint,2,opt,name=quantity" json:"quantity,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CartItem) Reset() { *m = CartItem{} } -func (m *CartItem) String() string { return proto.CompactTextString(m) } -func (*CartItem) ProtoMessage() {} -func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{0} -} -func (m *CartItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CartItem.Unmarshal(m, b) -} -func (m *CartItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CartItem.Marshal(b, m, deterministic) -} -func (dst *CartItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_CartItem.Merge(dst, src) -} -func (m *CartItem) XXX_Size() int { - return xxx_messageInfo_CartItem.Size(m) -} -func (m *CartItem) XXX_DiscardUnknown() { - xxx_messageInfo_CartItem.DiscardUnknown(m) -} - -var xxx_messageInfo_CartItem proto.InternalMessageInfo - -func (m *CartItem) GetProductId() string { - if m != nil { - return m.ProductId - } - return "" -} - -func (m *CartItem) GetQuantity() int32 { - if m != nil { - return m.Quantity - } - return 0 -} - -type AddItemRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - Item *CartItem `protobuf:"bytes,2,opt,name=item" json:"item,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } -func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } -func (*AddItemRequest) ProtoMessage() {} -func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{1} -} -func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) -} -func (m *AddItemRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddItemRequest.Marshal(b, m, deterministic) -} -func (dst *AddItemRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddItemRequest.Merge(dst, src) -} -func (m *AddItemRequest) XXX_Size() int { - return xxx_messageInfo_AddItemRequest.Size(m) -} -func (m *AddItemRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AddItemRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AddItemRequest proto.InternalMessageInfo - -func (m *AddItemRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *AddItemRequest) GetItem() *CartItem { - if m != nil { - return m.Item - } - return nil -} - -type EmptyCartRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } -func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } -func (*EmptyCartRequest) ProtoMessage() {} -func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{2} -} -func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) -} -func (m *EmptyCartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EmptyCartRequest.Marshal(b, m, deterministic) -} -func (dst *EmptyCartRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_EmptyCartRequest.Merge(dst, src) -} -func (m *EmptyCartRequest) XXX_Size() int { - return xxx_messageInfo_EmptyCartRequest.Size(m) -} -func (m *EmptyCartRequest) XXX_DiscardUnknown() { - xxx_messageInfo_EmptyCartRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_EmptyCartRequest proto.InternalMessageInfo - -func (m *EmptyCartRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -type GetCartRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } -func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } -func (*GetCartRequest) ProtoMessage() {} -func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{3} -} -func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) -} -func (m *GetCartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetCartRequest.Marshal(b, m, deterministic) -} -func (dst *GetCartRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetCartRequest.Merge(dst, src) -} -func (m *GetCartRequest) XXX_Size() int { - return xxx_messageInfo_GetCartRequest.Size(m) -} -func (m *GetCartRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetCartRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetCartRequest proto.InternalMessageInfo - -func (m *GetCartRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -type Cart struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - Items []*CartItem `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cart) Reset() { *m = Cart{} } -func (m *Cart) String() string { return proto.CompactTextString(m) } -func (*Cart) ProtoMessage() {} -func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{4} -} -func (m *Cart) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cart.Unmarshal(m, b) -} -func (m *Cart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cart.Marshal(b, m, deterministic) -} -func (dst *Cart) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cart.Merge(dst, src) -} -func (m *Cart) XXX_Size() int { - return xxx_messageInfo_Cart.Size(m) -} -func (m *Cart) XXX_DiscardUnknown() { - xxx_messageInfo_Cart.DiscardUnknown(m) -} - -var xxx_messageInfo_Cart proto.InternalMessageInfo - -func (m *Cart) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *Cart) GetItems() []*CartItem { - if m != nil { - return m.Items - } - return nil -} - -type Empty struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{5} -} -func (m *Empty) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Empty.Unmarshal(m, b) -} -func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Empty.Marshal(b, m, deterministic) -} -func (dst *Empty) XXX_Merge(src proto.Message) { - xxx_messageInfo_Empty.Merge(dst, src) -} -func (m *Empty) XXX_Size() int { - return xxx_messageInfo_Empty.Size(m) -} -func (m *Empty) XXX_DiscardUnknown() { - xxx_messageInfo_Empty.DiscardUnknown(m) -} - -var xxx_messageInfo_Empty proto.InternalMessageInfo - -type ListRecommendationsRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - ProductIds []string `protobuf:"bytes,2,rep,name=product_ids,json=productIds" json:"product_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsRequest{} } -func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } -func (*ListRecommendationsRequest) ProtoMessage() {} -func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{6} -} -func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) -} -func (m *ListRecommendationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListRecommendationsRequest.Marshal(b, m, deterministic) -} -func (dst *ListRecommendationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListRecommendationsRequest.Merge(dst, src) -} -func (m *ListRecommendationsRequest) XXX_Size() int { - return xxx_messageInfo_ListRecommendationsRequest.Size(m) -} -func (m *ListRecommendationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListRecommendationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListRecommendationsRequest proto.InternalMessageInfo - -func (m *ListRecommendationsRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *ListRecommendationsRequest) GetProductIds() []string { - if m != nil { - return m.ProductIds - } - return nil -} - -type ListRecommendationsResponse struct { - ProductIds []string `protobuf:"bytes,1,rep,name=product_ids,json=productIds" json:"product_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendationsResponse{} } -func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } -func (*ListRecommendationsResponse) ProtoMessage() {} -func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{7} -} -func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) -} -func (m *ListRecommendationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListRecommendationsResponse.Marshal(b, m, deterministic) -} -func (dst *ListRecommendationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListRecommendationsResponse.Merge(dst, src) -} -func (m *ListRecommendationsResponse) XXX_Size() int { - return xxx_messageInfo_ListRecommendationsResponse.Size(m) -} -func (m *ListRecommendationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListRecommendationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListRecommendationsResponse proto.InternalMessageInfo - -func (m *ListRecommendationsResponse) GetProductIds() []string { - if m != nil { - return m.ProductIds - } - return nil -} - -type Product struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` - PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Product) Reset() { *m = Product{} } -func (m *Product) String() string { return proto.CompactTextString(m) } -func (*Product) ProtoMessage() {} -func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{8} -} -func (m *Product) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Product.Unmarshal(m, b) -} -func (m *Product) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Product.Marshal(b, m, deterministic) -} -func (dst *Product) XXX_Merge(src proto.Message) { - xxx_messageInfo_Product.Merge(dst, src) -} -func (m *Product) XXX_Size() int { - return xxx_messageInfo_Product.Size(m) -} -func (m *Product) XXX_DiscardUnknown() { - xxx_messageInfo_Product.DiscardUnknown(m) -} - -var xxx_messageInfo_Product proto.InternalMessageInfo - -func (m *Product) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Product) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Product) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Product) GetPicture() string { - if m != nil { - return m.Picture - } - return "" -} - -func (m *Product) GetPriceUsd() *MoneyAmount { - if m != nil { - return m.PriceUsd - } - return nil -} - -type ListProductsResponse struct { - Products []*Product `protobuf:"bytes,1,rep,name=products" json:"products,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } -func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } -func (*ListProductsResponse) ProtoMessage() {} -func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{9} -} -func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) -} -func (m *ListProductsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListProductsResponse.Marshal(b, m, deterministic) -} -func (dst *ListProductsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListProductsResponse.Merge(dst, src) -} -func (m *ListProductsResponse) XXX_Size() int { - return xxx_messageInfo_ListProductsResponse.Size(m) -} -func (m *ListProductsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListProductsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListProductsResponse proto.InternalMessageInfo - -func (m *ListProductsResponse) GetProducts() []*Product { - if m != nil { - return m.Products - } - return nil -} - -type GetProductRequest struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } -func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } -func (*GetProductRequest) ProtoMessage() {} -func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{10} -} -func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) -} -func (m *GetProductRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetProductRequest.Marshal(b, m, deterministic) -} -func (dst *GetProductRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetProductRequest.Merge(dst, src) -} -func (m *GetProductRequest) XXX_Size() int { - return xxx_messageInfo_GetProductRequest.Size(m) -} -func (m *GetProductRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetProductRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetProductRequest proto.InternalMessageInfo - -func (m *GetProductRequest) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -type SearchProductsRequest struct { - Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } -func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } -func (*SearchProductsRequest) ProtoMessage() {} -func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{11} -} -func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) -} -func (m *SearchProductsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SearchProductsRequest.Marshal(b, m, deterministic) -} -func (dst *SearchProductsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchProductsRequest.Merge(dst, src) -} -func (m *SearchProductsRequest) XXX_Size() int { - return xxx_messageInfo_SearchProductsRequest.Size(m) -} -func (m *SearchProductsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SearchProductsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchProductsRequest proto.InternalMessageInfo - -func (m *SearchProductsRequest) GetQuery() string { - if m != nil { - return m.Query - } - return "" -} - -type SearchProductsResponse struct { - Results []*Product `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} } -func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } -func (*SearchProductsResponse) ProtoMessage() {} -func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{12} -} -func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) -} -func (m *SearchProductsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SearchProductsResponse.Marshal(b, m, deterministic) -} -func (dst *SearchProductsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchProductsResponse.Merge(dst, src) -} -func (m *SearchProductsResponse) XXX_Size() int { - return xxx_messageInfo_SearchProductsResponse.Size(m) -} -func (m *SearchProductsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SearchProductsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchProductsResponse proto.InternalMessageInfo - -func (m *SearchProductsResponse) GetResults() []*Product { - if m != nil { - return m.Results - } - return nil -} - -type GetQuoteRequest struct { - Address *Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` - Items []*CartItem `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } -func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } -func (*GetQuoteRequest) ProtoMessage() {} -func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{13} -} -func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) -} -func (m *GetQuoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetQuoteRequest.Marshal(b, m, deterministic) -} -func (dst *GetQuoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetQuoteRequest.Merge(dst, src) -} -func (m *GetQuoteRequest) XXX_Size() int { - return xxx_messageInfo_GetQuoteRequest.Size(m) -} -func (m *GetQuoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetQuoteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetQuoteRequest proto.InternalMessageInfo - -func (m *GetQuoteRequest) GetAddress() *Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *GetQuoteRequest) GetItems() []*CartItem { - if m != nil { - return m.Items - } - return nil -} - -type GetQuoteResponse struct { - CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } -func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } -func (*GetQuoteResponse) ProtoMessage() {} -func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{14} -} -func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) -} -func (m *GetQuoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetQuoteResponse.Marshal(b, m, deterministic) -} -func (dst *GetQuoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetQuoteResponse.Merge(dst, src) -} -func (m *GetQuoteResponse) XXX_Size() int { - return xxx_messageInfo_GetQuoteResponse.Size(m) -} -func (m *GetQuoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetQuoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo - -func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { - if m != nil { - return m.CostUsd - } - return nil -} - -type ShipOrderRequest struct { - Address *Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` - Items []*CartItem `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } -func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } -func (*ShipOrderRequest) ProtoMessage() {} -func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{15} -} -func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) -} -func (m *ShipOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShipOrderRequest.Marshal(b, m, deterministic) -} -func (dst *ShipOrderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShipOrderRequest.Merge(dst, src) -} -func (m *ShipOrderRequest) XXX_Size() int { - return xxx_messageInfo_ShipOrderRequest.Size(m) -} -func (m *ShipOrderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ShipOrderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ShipOrderRequest proto.InternalMessageInfo - -func (m *ShipOrderRequest) GetAddress() *Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *ShipOrderRequest) GetItems() []*CartItem { - if m != nil { - return m.Items - } - return nil -} - -type ShipOrderResponse struct { - TrackingId string `protobuf:"bytes,1,opt,name=tracking_id,json=trackingId" json:"tracking_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } -func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } -func (*ShipOrderResponse) ProtoMessage() {} -func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{16} -} -func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) -} -func (m *ShipOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShipOrderResponse.Marshal(b, m, deterministic) -} -func (dst *ShipOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShipOrderResponse.Merge(dst, src) -} -func (m *ShipOrderResponse) XXX_Size() int { - return xxx_messageInfo_ShipOrderResponse.Size(m) -} -func (m *ShipOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ShipOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ShipOrderResponse proto.InternalMessageInfo - -func (m *ShipOrderResponse) GetTrackingId() string { - if m != nil { - return m.TrackingId - } - return "" -} - -type Address struct { - StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"` - StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"` - City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"` - Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"` - ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Address) Reset() { *m = Address{} } -func (m *Address) String() string { return proto.CompactTextString(m) } -func (*Address) ProtoMessage() {} -func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{17} -} -func (m *Address) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Address.Unmarshal(m, b) -} -func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Address.Marshal(b, m, deterministic) -} -func (dst *Address) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address.Merge(dst, src) -} -func (m *Address) XXX_Size() int { - return xxx_messageInfo_Address.Size(m) -} -func (m *Address) XXX_DiscardUnknown() { - xxx_messageInfo_Address.DiscardUnknown(m) -} - -var xxx_messageInfo_Address proto.InternalMessageInfo - -func (m *Address) GetStreetAddress_1() string { - if m != nil { - return m.StreetAddress_1 - } - return "" -} - -func (m *Address) GetStreetAddress_2() string { - if m != nil { - return m.StreetAddress_2 - } - return "" -} - -func (m *Address) GetCity() string { - if m != nil { - return m.City - } - return "" -} - -func (m *Address) GetCountry() string { - if m != nil { - return m.Country - } - return "" -} - -func (m *Address) GetZipCode() int32 { - if m != nil { - return m.ZipCode - } - return 0 -} - -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -type MoneyAmount struct { - Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` - Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } -func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } -func (*MoneyAmount) ProtoMessage() {} -func (*MoneyAmount) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{18} -} -func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) -} -func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) -} -func (dst *MoneyAmount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoneyAmount.Merge(dst, src) -} -func (m *MoneyAmount) XXX_Size() int { - return xxx_messageInfo_MoneyAmount.Size(m) -} -func (m *MoneyAmount) XXX_DiscardUnknown() { - xxx_messageInfo_MoneyAmount.DiscardUnknown(m) -} - -var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo - -func (m *MoneyAmount) GetDecimal() uint32 { - if m != nil { - return m.Decimal - } - return 0 -} - -func (m *MoneyAmount) GetFractional() uint32 { - if m != nil { - return m.Fractional - } - return 0 -} - -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` - Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Money) Reset() { *m = Money{} } -func (m *Money) String() string { return proto.CompactTextString(m) } -func (*Money) ProtoMessage() {} -func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{19} -} -func (m *Money) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Money.Unmarshal(m, b) -} -func (m *Money) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Money.Marshal(b, m, deterministic) -} -func (dst *Money) XXX_Merge(src proto.Message) { - xxx_messageInfo_Money.Merge(dst, src) -} -func (m *Money) XXX_Size() int { - return xxx_messageInfo_Money.Size(m) -} -func (m *Money) XXX_DiscardUnknown() { - xxx_messageInfo_Money.DiscardUnknown(m) -} - -var xxx_messageInfo_Money proto.InternalMessageInfo - -func (m *Money) GetCurrencyCode() string { - if m != nil { - return m.CurrencyCode - } - return "" -} - -func (m *Money) GetAmount() *MoneyAmount { - if m != nil { - return m.Amount - } - return nil -} - -type GetSupportedCurrenciesResponse struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCodes []string `protobuf:"bytes,1,rep,name=currency_codes,json=currencyCodes" json:"currency_codes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurrenciesResponse{} } -func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } -func (*GetSupportedCurrenciesResponse) ProtoMessage() {} -func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{20} -} -func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) -} -func (m *GetSupportedCurrenciesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetSupportedCurrenciesResponse.Marshal(b, m, deterministic) -} -func (dst *GetSupportedCurrenciesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSupportedCurrenciesResponse.Merge(dst, src) -} -func (m *GetSupportedCurrenciesResponse) XXX_Size() int { - return xxx_messageInfo_GetSupportedCurrenciesResponse.Size(m) -} -func (m *GetSupportedCurrenciesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetSupportedCurrenciesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetSupportedCurrenciesResponse proto.InternalMessageInfo - -func (m *GetSupportedCurrenciesResponse) GetCurrencyCodes() []string { - if m != nil { - return m.CurrencyCodes - } - return nil -} - -type CurrencyConversionRequest struct { - From *Money `protobuf:"bytes,1,opt,name=from" json:"from,omitempty"` - // The 3-letter currency code defined in ISO 4217. - ToCode string `protobuf:"bytes,2,opt,name=to_code,json=toCode" json:"to_code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionRequest{} } -func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } -func (*CurrencyConversionRequest) ProtoMessage() {} -func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{21} -} -func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) -} -func (m *CurrencyConversionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CurrencyConversionRequest.Marshal(b, m, deterministic) -} -func (dst *CurrencyConversionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CurrencyConversionRequest.Merge(dst, src) -} -func (m *CurrencyConversionRequest) XXX_Size() int { - return xxx_messageInfo_CurrencyConversionRequest.Size(m) -} -func (m *CurrencyConversionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CurrencyConversionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CurrencyConversionRequest proto.InternalMessageInfo - -func (m *CurrencyConversionRequest) GetFrom() *Money { - if m != nil { - return m.From - } - return nil -} - -func (m *CurrencyConversionRequest) GetToCode() string { - if m != nil { - return m.ToCode - } - return "" -} - -type CreditCardInfo struct { - CreditCardNumber string `protobuf:"bytes,1,opt,name=credit_card_number,json=creditCardNumber" json:"credit_card_number,omitempty"` - CreditCardCvv int32 `protobuf:"varint,2,opt,name=credit_card_cvv,json=creditCardCvv" json:"credit_card_cvv,omitempty"` - CreditCardExpirationYear int32 `protobuf:"varint,3,opt,name=credit_card_expiration_year,json=creditCardExpirationYear" json:"credit_card_expiration_year,omitempty"` - CreditCardExpirationMonth int32 `protobuf:"varint,4,opt,name=credit_card_expiration_month,json=creditCardExpirationMonth" json:"credit_card_expiration_month,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } -func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } -func (*CreditCardInfo) ProtoMessage() {} -func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{22} -} -func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) -} -func (m *CreditCardInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreditCardInfo.Marshal(b, m, deterministic) -} -func (dst *CreditCardInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreditCardInfo.Merge(dst, src) -} -func (m *CreditCardInfo) XXX_Size() int { - return xxx_messageInfo_CreditCardInfo.Size(m) -} -func (m *CreditCardInfo) XXX_DiscardUnknown() { - xxx_messageInfo_CreditCardInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_CreditCardInfo proto.InternalMessageInfo - -func (m *CreditCardInfo) GetCreditCardNumber() string { - if m != nil { - return m.CreditCardNumber - } - return "" -} - -func (m *CreditCardInfo) GetCreditCardCvv() int32 { - if m != nil { - return m.CreditCardCvv - } - return 0 -} - -func (m *CreditCardInfo) GetCreditCardExpirationYear() int32 { - if m != nil { - return m.CreditCardExpirationYear - } - return 0 -} - -func (m *CreditCardInfo) GetCreditCardExpirationMonth() int32 { - if m != nil { - return m.CreditCardExpirationMonth - } - return 0 -} - -type ChargeRequest struct { - Amount *Money `protobuf:"bytes,1,opt,name=amount" json:"amount,omitempty"` - CreditCard *CreditCardInfo `protobuf:"bytes,2,opt,name=credit_card,json=creditCard" json:"credit_card,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } -func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } -func (*ChargeRequest) ProtoMessage() {} -func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{23} -} -func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) -} -func (m *ChargeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ChargeRequest.Marshal(b, m, deterministic) -} -func (dst *ChargeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChargeRequest.Merge(dst, src) -} -func (m *ChargeRequest) XXX_Size() int { - return xxx_messageInfo_ChargeRequest.Size(m) -} -func (m *ChargeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ChargeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ChargeRequest proto.InternalMessageInfo - -func (m *ChargeRequest) GetAmount() *Money { - if m != nil { - return m.Amount - } - return nil -} - -func (m *ChargeRequest) GetCreditCard() *CreditCardInfo { - if m != nil { - return m.CreditCard - } - return nil -} - -type ChargeResponse struct { - TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } -func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } -func (*ChargeResponse) ProtoMessage() {} -func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{24} -} -func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) -} -func (m *ChargeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ChargeResponse.Marshal(b, m, deterministic) -} -func (dst *ChargeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChargeResponse.Merge(dst, src) -} -func (m *ChargeResponse) XXX_Size() int { - return xxx_messageInfo_ChargeResponse.Size(m) -} -func (m *ChargeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ChargeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ChargeResponse proto.InternalMessageInfo - -func (m *ChargeResponse) GetTransactionId() string { - if m != nil { - return m.TransactionId - } - return "" -} - -type OrderItem struct { - Item *CartItem `protobuf:"bytes,1,opt,name=item" json:"item,omitempty"` - Cost *Money `protobuf:"bytes,2,opt,name=cost" json:"cost,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrderItem) Reset() { *m = OrderItem{} } -func (m *OrderItem) String() string { return proto.CompactTextString(m) } -func (*OrderItem) ProtoMessage() {} -func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{25} -} -func (m *OrderItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrderItem.Unmarshal(m, b) -} -func (m *OrderItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrderItem.Marshal(b, m, deterministic) -} -func (dst *OrderItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrderItem.Merge(dst, src) -} -func (m *OrderItem) XXX_Size() int { - return xxx_messageInfo_OrderItem.Size(m) -} -func (m *OrderItem) XXX_DiscardUnknown() { - xxx_messageInfo_OrderItem.DiscardUnknown(m) -} - -var xxx_messageInfo_OrderItem proto.InternalMessageInfo - -func (m *OrderItem) GetItem() *CartItem { - if m != nil { - return m.Item - } - return nil -} - -func (m *OrderItem) GetCost() *Money { - if m != nil { - return m.Cost - } - return nil -} - -type OrderResult struct { - OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId" json:"order_id,omitempty"` - ShippingTrackingId string `protobuf:"bytes,2,opt,name=shipping_tracking_id,json=shippingTrackingId" json:"shipping_tracking_id,omitempty"` - ShippingCost *Money `protobuf:"bytes,3,opt,name=shipping_cost,json=shippingCost" json:"shipping_cost,omitempty"` - ShippingAddress *Address `protobuf:"bytes,4,opt,name=shipping_address,json=shippingAddress" json:"shipping_address,omitempty"` - Items []*OrderItem `protobuf:"bytes,5,rep,name=items" json:"items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrderResult) Reset() { *m = OrderResult{} } -func (m *OrderResult) String() string { return proto.CompactTextString(m) } -func (*OrderResult) ProtoMessage() {} -func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{26} -} -func (m *OrderResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrderResult.Unmarshal(m, b) -} -func (m *OrderResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrderResult.Marshal(b, m, deterministic) -} -func (dst *OrderResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrderResult.Merge(dst, src) -} -func (m *OrderResult) XXX_Size() int { - return xxx_messageInfo_OrderResult.Size(m) -} -func (m *OrderResult) XXX_DiscardUnknown() { - xxx_messageInfo_OrderResult.DiscardUnknown(m) -} - -var xxx_messageInfo_OrderResult proto.InternalMessageInfo - -func (m *OrderResult) GetOrderId() string { - if m != nil { - return m.OrderId - } - return "" -} - -func (m *OrderResult) GetShippingTrackingId() string { - if m != nil { - return m.ShippingTrackingId - } - return "" -} - -func (m *OrderResult) GetShippingCost() *Money { - if m != nil { - return m.ShippingCost - } - return nil -} - -func (m *OrderResult) GetShippingAddress() *Address { - if m != nil { - return m.ShippingAddress - } - return nil -} - -func (m *OrderResult) GetItems() []*OrderItem { - if m != nil { - return m.Items - } - return nil -} - -type SendOrderConfirmationRequest struct { - Email string `protobuf:"bytes,1,opt,name=email" json:"email,omitempty"` - Order *OrderResult `protobuf:"bytes,2,opt,name=order" json:"order,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmationRequest{} } -func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } -func (*SendOrderConfirmationRequest) ProtoMessage() {} -func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{27} -} -func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) -} -func (m *SendOrderConfirmationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SendOrderConfirmationRequest.Marshal(b, m, deterministic) -} -func (dst *SendOrderConfirmationRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendOrderConfirmationRequest.Merge(dst, src) -} -func (m *SendOrderConfirmationRequest) XXX_Size() int { - return xxx_messageInfo_SendOrderConfirmationRequest.Size(m) -} -func (m *SendOrderConfirmationRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SendOrderConfirmationRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SendOrderConfirmationRequest proto.InternalMessageInfo - -func (m *SendOrderConfirmationRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *SendOrderConfirmationRequest) GetOrder() *OrderResult { - if m != nil { - return m.Order - } - return nil -} - -type CreateOrderRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` - Address *Address `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } -func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } -func (*CreateOrderRequest) ProtoMessage() {} -func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{28} -} -func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) -} -func (m *CreateOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOrderRequest.Marshal(b, m, deterministic) -} -func (dst *CreateOrderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOrderRequest.Merge(dst, src) -} -func (m *CreateOrderRequest) XXX_Size() int { - return xxx_messageInfo_CreateOrderRequest.Size(m) -} -func (m *CreateOrderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOrderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateOrderRequest proto.InternalMessageInfo - -func (m *CreateOrderRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *CreateOrderRequest) GetUserCurrency() string { - if m != nil { - return m.UserCurrency - } - return "" -} - -func (m *CreateOrderRequest) GetAddress() *Address { - if m != nil { - return m.Address - } - return nil -} - -type CreateOrderResponse struct { - Items []*OrderItem `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` - ShippingCost *Money `protobuf:"bytes,2,opt,name=shipping_cost,json=shippingCost" json:"shipping_cost,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } -func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } -func (*CreateOrderResponse) ProtoMessage() {} -func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{29} -} -func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) -} -func (m *CreateOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOrderResponse.Marshal(b, m, deterministic) -} -func (dst *CreateOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOrderResponse.Merge(dst, src) -} -func (m *CreateOrderResponse) XXX_Size() int { - return xxx_messageInfo_CreateOrderResponse.Size(m) -} -func (m *CreateOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateOrderResponse proto.InternalMessageInfo - -func (m *CreateOrderResponse) GetItems() []*OrderItem { - if m != nil { - return m.Items - } - return nil -} - -func (m *CreateOrderResponse) GetShippingCost() *Money { - if m != nil { - return m.ShippingCost - } - return nil -} - -type PlaceOrderRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` - Address *Address `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` - Email string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"` - CreditCard *CreditCardInfo `protobuf:"bytes,6,opt,name=credit_card,json=creditCard" json:"credit_card,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } -func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } -func (*PlaceOrderRequest) ProtoMessage() {} -func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{30} -} -func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) -} -func (m *PlaceOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PlaceOrderRequest.Marshal(b, m, deterministic) -} -func (dst *PlaceOrderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlaceOrderRequest.Merge(dst, src) -} -func (m *PlaceOrderRequest) XXX_Size() int { - return xxx_messageInfo_PlaceOrderRequest.Size(m) -} -func (m *PlaceOrderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PlaceOrderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PlaceOrderRequest proto.InternalMessageInfo - -func (m *PlaceOrderRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *PlaceOrderRequest) GetUserCurrency() string { - if m != nil { - return m.UserCurrency - } - return "" -} - -func (m *PlaceOrderRequest) GetAddress() *Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *PlaceOrderRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *PlaceOrderRequest) GetCreditCard() *CreditCardInfo { - if m != nil { - return m.CreditCard - } - return nil -} - -type PlaceOrderResponse struct { - Order *OrderResult `protobuf:"bytes,1,opt,name=order" json:"order,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } -func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } -func (*PlaceOrderResponse) ProtoMessage() {} -func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{31} -} -func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) -} -func (m *PlaceOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PlaceOrderResponse.Marshal(b, m, deterministic) -} -func (dst *PlaceOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlaceOrderResponse.Merge(dst, src) -} -func (m *PlaceOrderResponse) XXX_Size() int { - return xxx_messageInfo_PlaceOrderResponse.Size(m) -} -func (m *PlaceOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PlaceOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PlaceOrderResponse proto.InternalMessageInfo - -func (m *PlaceOrderResponse) GetOrder() *OrderResult { - if m != nil { - return m.Order - } - return nil -} - -func init() { - proto.RegisterType((*CartItem)(nil), "hipstershop.CartItem") - proto.RegisterType((*AddItemRequest)(nil), "hipstershop.AddItemRequest") - proto.RegisterType((*EmptyCartRequest)(nil), "hipstershop.EmptyCartRequest") - proto.RegisterType((*GetCartRequest)(nil), "hipstershop.GetCartRequest") - proto.RegisterType((*Cart)(nil), "hipstershop.Cart") - proto.RegisterType((*Empty)(nil), "hipstershop.Empty") - proto.RegisterType((*ListRecommendationsRequest)(nil), "hipstershop.ListRecommendationsRequest") - proto.RegisterType((*ListRecommendationsResponse)(nil), "hipstershop.ListRecommendationsResponse") - proto.RegisterType((*Product)(nil), "hipstershop.Product") - proto.RegisterType((*ListProductsResponse)(nil), "hipstershop.ListProductsResponse") - proto.RegisterType((*GetProductRequest)(nil), "hipstershop.GetProductRequest") - proto.RegisterType((*SearchProductsRequest)(nil), "hipstershop.SearchProductsRequest") - proto.RegisterType((*SearchProductsResponse)(nil), "hipstershop.SearchProductsResponse") - proto.RegisterType((*GetQuoteRequest)(nil), "hipstershop.GetQuoteRequest") - proto.RegisterType((*GetQuoteResponse)(nil), "hipstershop.GetQuoteResponse") - proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") - proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") - proto.RegisterType((*Address)(nil), "hipstershop.Address") - proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") - proto.RegisterType((*Money)(nil), "hipstershop.Money") - proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") - proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") - proto.RegisterType((*CreditCardInfo)(nil), "hipstershop.CreditCardInfo") - proto.RegisterType((*ChargeRequest)(nil), "hipstershop.ChargeRequest") - proto.RegisterType((*ChargeResponse)(nil), "hipstershop.ChargeResponse") - proto.RegisterType((*OrderItem)(nil), "hipstershop.OrderItem") - proto.RegisterType((*OrderResult)(nil), "hipstershop.OrderResult") - proto.RegisterType((*SendOrderConfirmationRequest)(nil), "hipstershop.SendOrderConfirmationRequest") - proto.RegisterType((*CreateOrderRequest)(nil), "hipstershop.CreateOrderRequest") - proto.RegisterType((*CreateOrderResponse)(nil), "hipstershop.CreateOrderResponse") - proto.RegisterType((*PlaceOrderRequest)(nil), "hipstershop.PlaceOrderRequest") - proto.RegisterType((*PlaceOrderResponse)(nil), "hipstershop.PlaceOrderResponse") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// CartServiceClient is the client API for CartService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CartServiceClient interface { - AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*Empty, error) - GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*Cart, error) - EmptyCart(ctx context.Context, in *EmptyCartRequest, opts ...grpc.CallOption) (*Empty, error) -} - -type cartServiceClient struct { - cc *grpc.ClientConn -} - -func NewCartServiceClient(cc *grpc.ClientConn) CartServiceClient { - return &cartServiceClient{cc} -} - -func (c *cartServiceClient) AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/hipstershop.CartService/AddItem", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cartServiceClient) GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*Cart, error) { - out := new(Cart) - err := c.cc.Invoke(ctx, "/hipstershop.CartService/GetCart", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cartServiceClient) EmptyCart(ctx context.Context, in *EmptyCartRequest, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/hipstershop.CartService/EmptyCart", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CartServiceServer is the server API for CartService service. -type CartServiceServer interface { - AddItem(context.Context, *AddItemRequest) (*Empty, error) - GetCart(context.Context, *GetCartRequest) (*Cart, error) - EmptyCart(context.Context, *EmptyCartRequest) (*Empty, error) -} - -func RegisterCartServiceServer(s *grpc.Server, srv CartServiceServer) { - s.RegisterService(&_CartService_serviceDesc, srv) -} - -func _CartService_AddItem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddItemRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CartServiceServer).AddItem(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CartService/AddItem", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CartServiceServer).AddItem(ctx, req.(*AddItemRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CartService_GetCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCartRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CartServiceServer).GetCart(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CartService/GetCart", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CartServiceServer).GetCart(ctx, req.(*GetCartRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CartService_EmptyCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(EmptyCartRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CartServiceServer).EmptyCart(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CartService/EmptyCart", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CartServiceServer).EmptyCart(ctx, req.(*EmptyCartRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _CartService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.CartService", - HandlerType: (*CartServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddItem", - Handler: _CartService_AddItem_Handler, - }, - { - MethodName: "GetCart", - Handler: _CartService_GetCart_Handler, - }, - { - MethodName: "EmptyCart", - Handler: _CartService_EmptyCart_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// RecommendationServiceClient is the client API for RecommendationService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type RecommendationServiceClient interface { - ListRecommendations(ctx context.Context, in *ListRecommendationsRequest, opts ...grpc.CallOption) (*ListRecommendationsResponse, error) -} - -type recommendationServiceClient struct { - cc *grpc.ClientConn -} - -func NewRecommendationServiceClient(cc *grpc.ClientConn) RecommendationServiceClient { - return &recommendationServiceClient{cc} -} - -func (c *recommendationServiceClient) ListRecommendations(ctx context.Context, in *ListRecommendationsRequest, opts ...grpc.CallOption) (*ListRecommendationsResponse, error) { - out := new(ListRecommendationsResponse) - err := c.cc.Invoke(ctx, "/hipstershop.RecommendationService/ListRecommendations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RecommendationServiceServer is the server API for RecommendationService service. -type RecommendationServiceServer interface { - ListRecommendations(context.Context, *ListRecommendationsRequest) (*ListRecommendationsResponse, error) -} - -func RegisterRecommendationServiceServer(s *grpc.Server, srv RecommendationServiceServer) { - s.RegisterService(&_RecommendationService_serviceDesc, srv) -} - -func _RecommendationService_ListRecommendations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRecommendationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RecommendationServiceServer).ListRecommendations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.RecommendationService/ListRecommendations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RecommendationServiceServer).ListRecommendations(ctx, req.(*ListRecommendationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _RecommendationService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.RecommendationService", - HandlerType: (*RecommendationServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListRecommendations", - Handler: _RecommendationService_ListRecommendations_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// ProductCatalogServiceClient is the client API for ProductCatalogService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ProductCatalogServiceClient interface { - ListProducts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListProductsResponse, error) - GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*Product, error) - SearchProducts(ctx context.Context, in *SearchProductsRequest, opts ...grpc.CallOption) (*SearchProductsResponse, error) -} - -type productCatalogServiceClient struct { - cc *grpc.ClientConn -} - -func NewProductCatalogServiceClient(cc *grpc.ClientConn) ProductCatalogServiceClient { - return &productCatalogServiceClient{cc} -} - -func (c *productCatalogServiceClient) ListProducts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListProductsResponse, error) { - out := new(ListProductsResponse) - err := c.cc.Invoke(ctx, "/hipstershop.ProductCatalogService/ListProducts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *productCatalogServiceClient) GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*Product, error) { - out := new(Product) - err := c.cc.Invoke(ctx, "/hipstershop.ProductCatalogService/GetProduct", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *productCatalogServiceClient) SearchProducts(ctx context.Context, in *SearchProductsRequest, opts ...grpc.CallOption) (*SearchProductsResponse, error) { - out := new(SearchProductsResponse) - err := c.cc.Invoke(ctx, "/hipstershop.ProductCatalogService/SearchProducts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProductCatalogServiceServer is the server API for ProductCatalogService service. -type ProductCatalogServiceServer interface { - ListProducts(context.Context, *Empty) (*ListProductsResponse, error) - GetProduct(context.Context, *GetProductRequest) (*Product, error) - SearchProducts(context.Context, *SearchProductsRequest) (*SearchProductsResponse, error) -} - -func RegisterProductCatalogServiceServer(s *grpc.Server, srv ProductCatalogServiceServer) { - s.RegisterService(&_ProductCatalogService_serviceDesc, srv) -} - -func _ProductCatalogService_ListProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProductCatalogServiceServer).ListProducts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.ProductCatalogService/ListProducts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProductCatalogServiceServer).ListProducts(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ProductCatalogService_GetProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProductRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProductCatalogServiceServer).GetProduct(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.ProductCatalogService/GetProduct", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProductCatalogServiceServer).GetProduct(ctx, req.(*GetProductRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ProductCatalogService_SearchProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SearchProductsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProductCatalogServiceServer).SearchProducts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.ProductCatalogService/SearchProducts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProductCatalogServiceServer).SearchProducts(ctx, req.(*SearchProductsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ProductCatalogService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.ProductCatalogService", - HandlerType: (*ProductCatalogServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListProducts", - Handler: _ProductCatalogService_ListProducts_Handler, - }, - { - MethodName: "GetProduct", - Handler: _ProductCatalogService_GetProduct_Handler, - }, - { - MethodName: "SearchProducts", - Handler: _ProductCatalogService_SearchProducts_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// ShippingServiceClient is the client API for ShippingService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ShippingServiceClient interface { - GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) - ShipOrder(ctx context.Context, in *ShipOrderRequest, opts ...grpc.CallOption) (*ShipOrderResponse, error) -} - -type shippingServiceClient struct { - cc *grpc.ClientConn -} - -func NewShippingServiceClient(cc *grpc.ClientConn) ShippingServiceClient { - return &shippingServiceClient{cc} -} - -func (c *shippingServiceClient) GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) { - out := new(GetQuoteResponse) - err := c.cc.Invoke(ctx, "/hipstershop.ShippingService/GetQuote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *shippingServiceClient) ShipOrder(ctx context.Context, in *ShipOrderRequest, opts ...grpc.CallOption) (*ShipOrderResponse, error) { - out := new(ShipOrderResponse) - err := c.cc.Invoke(ctx, "/hipstershop.ShippingService/ShipOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ShippingServiceServer is the server API for ShippingService service. -type ShippingServiceServer interface { - GetQuote(context.Context, *GetQuoteRequest) (*GetQuoteResponse, error) - ShipOrder(context.Context, *ShipOrderRequest) (*ShipOrderResponse, error) -} - -func RegisterShippingServiceServer(s *grpc.Server, srv ShippingServiceServer) { - s.RegisterService(&_ShippingService_serviceDesc, srv) -} - -func _ShippingService_GetQuote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetQuoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ShippingServiceServer).GetQuote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.ShippingService/GetQuote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShippingServiceServer).GetQuote(ctx, req.(*GetQuoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ShippingService_ShipOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ShipOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ShippingServiceServer).ShipOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.ShippingService/ShipOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShippingServiceServer).ShipOrder(ctx, req.(*ShipOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ShippingService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.ShippingService", - HandlerType: (*ShippingServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetQuote", - Handler: _ShippingService_GetQuote_Handler, - }, - { - MethodName: "ShipOrder", - Handler: _ShippingService_ShipOrder_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// CurrencyServiceClient is the client API for CurrencyService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CurrencyServiceClient interface { - GetSupportedCurrencies(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetSupportedCurrenciesResponse, error) - Convert(ctx context.Context, in *CurrencyConversionRequest, opts ...grpc.CallOption) (*Money, error) -} - -type currencyServiceClient struct { - cc *grpc.ClientConn -} - -func NewCurrencyServiceClient(cc *grpc.ClientConn) CurrencyServiceClient { - return ¤cyServiceClient{cc} -} - -func (c *currencyServiceClient) GetSupportedCurrencies(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetSupportedCurrenciesResponse, error) { - out := new(GetSupportedCurrenciesResponse) - err := c.cc.Invoke(ctx, "/hipstershop.CurrencyService/GetSupportedCurrencies", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *currencyServiceClient) Convert(ctx context.Context, in *CurrencyConversionRequest, opts ...grpc.CallOption) (*Money, error) { - out := new(Money) - err := c.cc.Invoke(ctx, "/hipstershop.CurrencyService/Convert", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CurrencyServiceServer is the server API for CurrencyService service. -type CurrencyServiceServer interface { - GetSupportedCurrencies(context.Context, *Empty) (*GetSupportedCurrenciesResponse, error) - Convert(context.Context, *CurrencyConversionRequest) (*Money, error) -} - -func RegisterCurrencyServiceServer(s *grpc.Server, srv CurrencyServiceServer) { - s.RegisterService(&_CurrencyService_serviceDesc, srv) -} - -func _CurrencyService_GetSupportedCurrencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CurrencyServiceServer).GetSupportedCurrencies(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CurrencyService/GetSupportedCurrencies", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CurrencyServiceServer).GetSupportedCurrencies(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _CurrencyService_Convert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CurrencyConversionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CurrencyServiceServer).Convert(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CurrencyService/Convert", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CurrencyServiceServer).Convert(ctx, req.(*CurrencyConversionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _CurrencyService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.CurrencyService", - HandlerType: (*CurrencyServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetSupportedCurrencies", - Handler: _CurrencyService_GetSupportedCurrencies_Handler, - }, - { - MethodName: "Convert", - Handler: _CurrencyService_Convert_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// PaymentServiceClient is the client API for PaymentService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type PaymentServiceClient interface { - Charge(ctx context.Context, in *ChargeRequest, opts ...grpc.CallOption) (*ChargeResponse, error) -} - -type paymentServiceClient struct { - cc *grpc.ClientConn -} - -func NewPaymentServiceClient(cc *grpc.ClientConn) PaymentServiceClient { - return &paymentServiceClient{cc} -} - -func (c *paymentServiceClient) Charge(ctx context.Context, in *ChargeRequest, opts ...grpc.CallOption) (*ChargeResponse, error) { - out := new(ChargeResponse) - err := c.cc.Invoke(ctx, "/hipstershop.PaymentService/Charge", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PaymentServiceServer is the server API for PaymentService service. -type PaymentServiceServer interface { - Charge(context.Context, *ChargeRequest) (*ChargeResponse, error) -} - -func RegisterPaymentServiceServer(s *grpc.Server, srv PaymentServiceServer) { - s.RegisterService(&_PaymentService_serviceDesc, srv) -} - -func _PaymentService_Charge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChargeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PaymentServiceServer).Charge(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.PaymentService/Charge", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PaymentServiceServer).Charge(ctx, req.(*ChargeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _PaymentService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.PaymentService", - HandlerType: (*PaymentServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Charge", - Handler: _PaymentService_Charge_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// EmailServiceClient is the client API for EmailService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type EmailServiceClient interface { - SendOrderConfirmation(ctx context.Context, in *SendOrderConfirmationRequest, opts ...grpc.CallOption) (*Empty, error) -} - -type emailServiceClient struct { - cc *grpc.ClientConn -} - -func NewEmailServiceClient(cc *grpc.ClientConn) EmailServiceClient { - return &emailServiceClient{cc} -} - -func (c *emailServiceClient) SendOrderConfirmation(ctx context.Context, in *SendOrderConfirmationRequest, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/hipstershop.EmailService/SendOrderConfirmation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// EmailServiceServer is the server API for EmailService service. -type EmailServiceServer interface { - SendOrderConfirmation(context.Context, *SendOrderConfirmationRequest) (*Empty, error) -} - -func RegisterEmailServiceServer(s *grpc.Server, srv EmailServiceServer) { - s.RegisterService(&_EmailService_serviceDesc, srv) -} - -func _EmailService_SendOrderConfirmation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendOrderConfirmationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(EmailServiceServer).SendOrderConfirmation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.EmailService/SendOrderConfirmation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(EmailServiceServer).SendOrderConfirmation(ctx, req.(*SendOrderConfirmationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _EmailService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.EmailService", - HandlerType: (*EmailServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SendOrderConfirmation", - Handler: _EmailService_SendOrderConfirmation_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -// CheckoutServiceClient is the client API for CheckoutService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CheckoutServiceClient interface { - CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) - PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) -} - -type checkoutServiceClient struct { - cc *grpc.ClientConn -} - -func NewCheckoutServiceClient(cc *grpc.ClientConn) CheckoutServiceClient { - return &checkoutServiceClient{cc} -} - -func (c *checkoutServiceClient) CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) { - out := new(CreateOrderResponse) - err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/CreateOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) { - out := new(PlaceOrderResponse) - err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/PlaceOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CheckoutServiceServer is the server API for CheckoutService service. -type CheckoutServiceServer interface { - CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error) - PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) -} - -func RegisterCheckoutServiceServer(s *grpc.Server, srv CheckoutServiceServer) { - s.RegisterService(&_CheckoutService_serviceDesc, srv) -} - -func _CheckoutService_CreateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CheckoutServiceServer).CreateOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CheckoutService/CreateOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CheckoutServiceServer).CreateOrder(ctx, req.(*CreateOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CheckoutService_PlaceOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlaceOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CheckoutServiceServer).PlaceOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CheckoutService/PlaceOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CheckoutServiceServer).PlaceOrder(ctx, req.(*PlaceOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _CheckoutService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hipstershop.CheckoutService", - HandlerType: (*CheckoutServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateOrder", - Handler: _CheckoutService_CreateOrder_Handler, - }, - { - MethodName: "PlaceOrder", - Handler: _CheckoutService_PlaceOrder_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "demo.proto", -} - -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } - -var fileDescriptor_demo_40506d781b7ed975 = []byte{ - // 1466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, - 0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66, - 0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa, - 0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a, - 0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, - 0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf, - 0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34, - 0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0, 0xa4, 0x6c, 0xc4, 0x88, 0x8b, 0x2e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0xed, 0x21, - 0x61, 0x87, 0x51, 0x10, 0xf8, 0x94, 0x11, 0x7b, 0x10, 0x4b, 0x73, 0x48, 0x9a, 0x03, 0x1f, 0x40, - 0x37, 0xa7, 0x58, 0x95, 0xa0, 0x4e, 0x56, 0x73, 0x88, 0xbf, 0x87, 0x0b, 0x83, 0x64, 0xc3, 0x3b, - 0x26, 0x34, 0x74, 0x7c, 0x4f, 0x85, 0xd2, 0x15, 0x58, 0x3a, 0xa2, 0xbe, 0x2b, 0xe3, 0x08, 0xcd, - 0xb3, 0x32, 0xc4, 0x39, 0x2f, 0xa2, 0xcc, 0x8f, 0x9f, 0x17, 0x3b, 0x68, 0x99, 0xf9, 0xc2, 0x9e, - 0x7f, 0x6b, 0xd0, 0x1d, 0x50, 0x62, 0x3b, 0xbc, 0x03, 0xd8, 0x23, 0xef, 0xc8, 0x47, 0xd7, 0x01, - 0x59, 0x62, 0x67, 0x6c, 0x99, 0xd4, 0x1e, 0x7b, 0x91, 0xfb, 0x92, 0x50, 0x69, 0x95, 0x35, 0x2b, - 0xc1, 0x7e, 0x25, 0xf6, 0xd1, 0x15, 0x58, 0xcd, 0xa2, 0xad, 0xe3, 0x63, 0xd9, 0xe4, 0x3a, 0x29, - 0x74, 0x70, 0x7c, 0x8c, 0x3e, 0x87, 0xad, 0x2c, 0x8e, 0xfc, 0x18, 0x38, 0x54, 0x14, 0xe4, 0xf1, - 0x8c, 0x98, 0x54, 0x04, 0x46, 0xdd, 0xe8, 0xa5, 0x77, 0x0e, 0x12, 0xc0, 0x77, 0xc4, 0xa4, 0xe8, - 0x2e, 0x5c, 0xac, 0xb8, 0xee, 0xfa, 0x1e, 0x9b, 0x88, 0x08, 0xaa, 0x1b, 0x17, 0xca, 0xee, 0x3f, - 0xe2, 0x00, 0x3c, 0x83, 0xce, 0x60, 0x62, 0xd2, 0x57, 0x49, 0xfd, 0xf8, 0x28, 0x71, 0x69, 0xb5, - 0xf1, 0x24, 0x02, 0xdd, 0x81, 0x76, 0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0xce, 0xfe, 0xce, 0x4d, 0x3f, 0x21, - 0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4, - 0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, - 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, -} diff --git a/src/currencyservicetemp/main.go b/src/currencyservicetemp/main.go deleted file mode 100644 index 7d65b27..0000000 --- a/src/currencyservicetemp/main.go +++ /dev/null @@ -1,77 +0,0 @@ -package main - -import ( - "context" - "fmt" - "log" - "net" - "os" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "google.golang.org/grpc" - - pb "./genproto" -) - -const ( - listenPort = "7000" -) - -type currencyServer struct { - currencies []string - conversionRates map[[2]string]float64 -} - -func main() { - port := listenPort - if os.Getenv("PORT") != "" { - port = os.Getenv("PORT") - } - - svc := ¤cyServer{ - currencies: []string{"USD", "EUR", "CAD"}, - conversionRates: map[[2]string]float64{ - {"USD", "EUR"}: 0.86, - {"EUR", "USD"}: 1 / 0.86, - - {"USD", "CAD"}: 1.33, - {"CAD", "USD"}: 1 / 1.33, - - {"EUR", "CAD"}: 1.54, - {"CAD", "EUR"}: 1 / 1.54, - }, - } - - lis, err := net.Listen("tcp", fmt.Sprintf(":%s", port)) - if err != nil { - log.Fatal(err) - } - srv := grpc.NewServer() - pb.RegisterCurrencyServiceServer(srv, svc) - log.Printf("starting to listen on tcp: %q", lis.Addr().String()) - log.Fatal(srv.Serve(lis)) -} - -func (cs *currencyServer) GetSupportedCurrencies(_ context.Context, _ *pb.Empty) (*pb.GetSupportedCurrenciesResponse, error) { - log.Printf("requesting supported currencies (%d)", len(cs.currencies)) - return &pb.GetSupportedCurrenciesResponse{CurrencyCodes: cs.currencies}, nil -} - -func (cs *currencyServer) Convert(_ context.Context, req *pb.CurrencyConversionRequest) (*pb.Money, error) { - log.Printf("requesting currency conversion [%+v] --> %s", req.From, req.ToCode) - conv := [2]string{req.GetFrom().GetCurrencyCode(), req.GetToCode()} - rate, ok := cs.conversionRates[conv] - if !ok { - return nil, status.Errorf(codes.InvalidArgument, "conversion %v not supported", conv) - } - if req.From == nil { - return nil, status.Errorf(codes.InvalidArgument, "no money amount provided") - } - - amount := convert(*req.From.Amount, rate) - return &pb.Money{ - CurrencyCode: req.GetToCode(), - Amount: &amount}, nil -} diff --git a/src/currencyservicetemp/money.go b/src/currencyservicetemp/money.go deleted file mode 100644 index 6b77a62..0000000 --- a/src/currencyservicetemp/money.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -import ( - "fmt" - "math" - "strconv" - "strings" - - pb "./genproto" -) - -func convert(m pb.MoneyAmount, rate float64) pb.MoneyAmount { - d, f := m.Decimal, m.Fractional - lg := int(math.Max(1, math.Ceil(math.Log10(float64(f))))) - ff, _ := strconv.ParseFloat(fmt.Sprintf("%d.%d", d, f), 64) - res := ff * rate - resTxt := fmt.Sprintf("%."+strconv.Itoa(lg)+"f", res) - p := strings.Split(resTxt, ".") - - ds, fs := p[0], p[1] - fs = strings.TrimSuffix(fs, "0") - if fs == "" { - fs = "0" - } - dn, _ := strconv.Atoi(ds) - fn, _ := strconv.Atoi(fs) - - return pb.MoneyAmount{Decimal: uint32(dn), Fractional: uint32(fn)} -} diff --git a/src/currencyservicetemp/money_test.go b/src/currencyservicetemp/money_test.go deleted file mode 100644 index fcf630a..0000000 --- a/src/currencyservicetemp/money_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -import ( - "reflect" - "testing" - - pb "./genproto" -) - -func Test_convert(t *testing.T) { - type args struct { - m pb.MoneyAmount - rate float64 - } - tests := []struct { - name string - args args - want pb.MoneyAmount - }{ - { - "0.33*3", args{pb.MoneyAmount{Decimal: 0, Fractional: 330}, 3}, pb.MoneyAmount{Decimal: 0, Fractional: 99}, - }, - { - "10.00*0.5", args{pb.MoneyAmount{Decimal: 10}, 0.5}, pb.MoneyAmount{Decimal: 5}, - }, - { - "10.00*1.5", args{pb.MoneyAmount{Decimal: 10}, 1.5}, pb.MoneyAmount{Decimal: 15}, - }, - { - "10.00*1/3", args{pb.MoneyAmount{Decimal: 10}, 1.0 / 3}, pb.MoneyAmount{Decimal: 3, Fractional: 3}, - }, - { - "32.320*0.5 (trailing zero removed)", args{pb.MoneyAmount{Decimal: 32, Fractional: 32}, 0.5}, pb.MoneyAmount{Decimal: 16, Fractional: 16}, - }, - { - "33.33*(1/3) (trailing zero removed)", args{pb.MoneyAmount{Decimal: 33, Fractional: 33}, 1.0 / 3}, pb.MoneyAmount{Decimal: 11, Fractional: 11}, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := convert(tt.args.m, tt.args.rate); !reflect.DeepEqual(got, tt.want) { - t.Errorf("convert([%v]*%f) = %v, want=[%v]", tt.args.m, tt.args.rate, got, tt.want) - } - }) - } -} From f5dc3dd0561402c38faa13efa9b1ee915d7e5abe Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 13:25:32 -0700 Subject: [PATCH 13/49] checkoutservice: money proto migration Signed-off-by: Ahmet Alp Balkan --- src/checkoutservice/genproto/demo.pb.go | 359 +++++++++++------------- src/checkoutservice/main.go | 27 +- src/checkoutservice/money.go | 44 --- src/checkoutservice/money/money.go | 118 ++++++++ src/checkoutservice/money/money_test.go | 231 +++++++++++++++ src/checkoutservice/money_test.go | 53 ---- 6 files changed, 523 insertions(+), 309 deletions(-) delete mode 100644 src/checkoutservice/money.go create mode 100644 src/checkoutservice/money/money.go create mode 100644 src/checkoutservice/money/money_test.go delete mode 100644 src/checkoutservice/money_test.go diff --git a/src/checkoutservice/genproto/demo.pb.go b/src/checkoutservice/genproto/demo.pb.go index d547682..7e64573 100644 --- a/src/checkoutservice/genproto/demo.pb.go +++ b/src/checkoutservice/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{0} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{1} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{2} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{3} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{4} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{5} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{6} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{7} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string { } type Product struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` - PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` + PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{8} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -414,7 +414,7 @@ func (m *Product) GetPicture() string { return "" } -func (m *Product) GetPriceUsd() *MoneyAmount { +func (m *Product) GetPriceUsd() *Money { if m != nil { return m.PriceUsd } @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{9} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{10} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{11} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{12} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{13} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem { } type GetQuoteResponse struct { - CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{14} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo -func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { +func (m *GetQuoteResponse) GetCostUsd() *Money { if m != nil { return m.CostUsd } @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{15} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{16} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{17} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 { return 0 } -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -type MoneyAmount struct { - Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` - Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` +// Represents an amount of money with its currency type. +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"` + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } -func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } -func (*MoneyAmount) ProtoMessage() {} -func (*MoneyAmount) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{18} -} -func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) -} -func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) -} -func (dst *MoneyAmount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoneyAmount.Merge(dst, src) -} -func (m *MoneyAmount) XXX_Size() int { - return xxx_messageInfo_MoneyAmount.Size(m) -} -func (m *MoneyAmount) XXX_DiscardUnknown() { - xxx_messageInfo_MoneyAmount.DiscardUnknown(m) -} - -var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo - -func (m *MoneyAmount) GetDecimal() uint32 { - if m != nil { - return m.Decimal - } - return 0 -} - -func (m *MoneyAmount) GetFractional() uint32 { - if m != nil { - return m.Fractional - } - return 0 -} - -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` - Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{19} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string { return "" } -func (m *Money) GetAmount() *MoneyAmount { +func (m *Money) GetUnits() int64 { if m != nil { - return m.Amount + return m.Units } - return nil + return 0 +} + +func (m *Money) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 } type GetSupportedCurrenciesResponse struct { @@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{20} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{21} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{22} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{23} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{24} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{25} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{26} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{27} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{28} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{29} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{30} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{31} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1527,7 +1496,6 @@ func init() { proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") proto.RegisterType((*Address)(nil), "hipstershop.Address") - proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") proto.RegisterType((*Money)(nil), "hipstershop.Money") proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") @@ -2294,100 +2262,99 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } -var fileDescriptor_demo_40506d781b7ed975 = []byte{ - // 1466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, - 0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66, - 0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa,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x26, - 0x22, 0x17, 0xea, 0x46, 0xe3, 0xad, 0x13, 0x0c, 0x7c, 0x9b, 0xe0, 0x21, 0xb4, 0x33, 0x76, 0xe6, - 0x32, 0x6c, 0x62, 0x39, 0xae, 0x39, 0x15, 0x14, 0x3b, 0x86, 0x5a, 0xa2, 0x6d, 0x80, 0x23, 0x6a, - 0x5a, 0x3c, 0xed, 0xcc, 0xa9, 0x60, 0xd5, 0x31, 0x32, 0x3b, 0xf8, 0x05, 0xd4, 0x85, 0x20, 0xb4, - 0x0b, 0x1d, 0x2b, 0xa2, 0x94, 0x78, 0xd6, 0x2c, 0xd6, 0x18, 0xbf, 0x75, 0x45, 0x6d, 0x72, 0xb5, - 0xe8, 0x06, 0x2c, 0x9b, 0x42, 0xa3, 0x2c, 0xbf, 0xd5, 0x9e, 0x97, 0x38, 0x3c, 0x84, 0xed, 0x21, - 0x61, 0x87, 0x51, 0x10, 0xf8, 0x94, 0x11, 0x7b, 0x10, 0x4b, 0x73, 0x48, 0x9a, 0x03, 0x1f, 0x40, - 0x37, 0xa7, 0x58, 0x95, 0xa0, 0x4e, 0x56, 0x73, 0x88, 0xbf, 0x87, 0x0b, 0x83, 0x64, 0xc3, 0x3b, - 0x26, 0x34, 0x74, 0x7c, 0x4f, 0x85, 0xd2, 0x15, 0x58, 0x3a, 0xa2, 0xbe, 0x2b, 0xe3, 0x08, 0xcd, - 0xb3, 0x32, 0xc4, 0x39, 0x2f, 0xa2, 0xcc, 0x8f, 0x9f, 0x17, 0x3b, 0x68, 0x99, 0xf9, 0xc2, 0x9e, - 0x7f, 0x6b, 0xd0, 0x1d, 0x50, 0x62, 0x3b, 0xbc, 0x03, 0xd8, 0x23, 0xef, 0xc8, 0x47, 0xd7, 0x01, - 0x59, 0x62, 0x67, 0x6c, 0x99, 0xd4, 0x1e, 0x7b, 0x91, 0xfb, 0x92, 0x50, 0x69, 0x95, 0x35, 0x2b, - 0xc1, 0x7e, 0x25, 0xf6, 0xd1, 0x15, 0x58, 0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0x52, 0xa5, 0x6e, 0xbb, - 0x56, 0x24, 0x7c, 0xc2, 0x08, 0x86, 0x17, 0xd0, 0x10, 0x1a, 0xf1, 0x54, 0xc5, 0xd0, 0x95, 0x7c, - 0x2e, 0x54, 0xcd, 0x5c, 0x7a, 0x49, 0xa5, 0xc3, 0x0b, 0xfd, 0x67, 0xd0, 0x7d, 0x62, 0xce, 0x5c, - 0xe2, 0x25, 0x19, 0x3c, 0x80, 0xe5, 0xb8, 0xed, 0x23, 0x3d, 0x2f, 0x39, 0x3b, 0x86, 0xe8, 0x5b, - 0xa5, 0x67, 0x89, 0x41, 0x26, 0xb0, 0x72, 0xc0, 0x6b, 0x94, 0x12, 0xfa, 0x2d, 0xff, 0x02, 0x2b, - 0xe9, 0x56, 0xe8, 0x6a, 0x21, 0x1a, 0xaa, 0x3b, 0x5a, 0x45, 0xce, 0xfe, 0xce, 0x4d, 0x3f, 0x21, - 0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4, - 0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, - 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, +var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ + // 1442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, + 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e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0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, + 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, + 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, + 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, + 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, + 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0xde, 0x67, + 0x84, 0xbf, 0x83, 0x73, 0x83, 0x74, 0x22, 0x38, 0x22, 0x2c, 0xf2, 0x68, 0xa0, 0xef, 0xfe, 0x32, + 0x2c, 0xbe, 0x64, 0xd4, 0x3f, 0x26, 0x75, 0xe4, 0xba, 0xe8, 0x74, 0x9c, 0x26, 0x07, 0x4b, 0x22, + 0xba, 0xc4, 0xa9, 0x0c, 0xc0, 0xdf, 0x06, 0x74, 0x07, 0x8c, 0xb8, 0x9e, 0x68, 0xd3, 0xee, 0x28, + 0x78, 0x49, 0xd1, 0x35, 0x40, 0x8e, 0x9c, 0x19, 0x3b, 0x36, 0x73, 0xc7, 0x41, 0xec, 0xbf, 0x20, + 0x4c, 0xc5, 0x63, 0xcd, 0x49, 0xb1, 0x5f, 0xc9, 0x79, 0x74, 0x19, 0x56, 0xf3, 0x68, 0xe7, 0xe8, + 0x48, 0xbd, 0x44, 0x9d, 0x0c, 0x3a, 0x38, 0x3a, 0x42, 0x9f, 0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, 0x31, 0x12, 0x0c, 0xcf, 0xa1, + 0x21, 0x34, 0x13, 0x55, 0xc5, 0xd1, 0xe5, 0x62, 0x2d, 0xd4, 0x69, 0x2e, 0xb3, 0xa2, 0xd3, 0xe1, + 0xb9, 0xfe, 0x53, 0xe8, 0x3e, 0xb6, 0xa7, 0x3e, 0x09, 0xd2, 0x0a, 0x1e, 0xc0, 0x52, 0xf2, 0xec, + 0x23, 0xb3, 0x68, 0x39, 0x2f, 0x43, 0xcc, 0xad, 0xca, 0xb5, 0x34, 0x20, 0x13, 0x58, 0xd9, 0x17, + 0x3d, 0x4a, 0x1b, 0x7d, 0x26, 0x7e, 0x2c, 0x55, 0xbc, 0x56, 0xe8, 0x4a, 0x29, 0x1b, 0xea, 0x5f, + 0xb4, 0x9a, 0x9a, 0xfd, 0x5d, 0x84, 0x7e, 0x42, 0x9c, 0xd7, 0x34, 0x4e, 0x8f, 0x60, 0x41, 0x3b, + 0xf7, 0x60, 0xa0, 0x4b, 0xe5, 0x96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, + 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, + 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, + 0x00, 0x00, } diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 65d976c..268fc99 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -13,6 +13,7 @@ import ( "google.golang.org/grpc/status" pb "./genproto" + money "./money" ) const ( @@ -71,10 +72,7 @@ func (cs *checkoutService) CreateOrder(ctx context.Context, req *pb.CreateOrderR if err != nil { return nil, status.Errorf(codes.Internal, "shipping quote failure: %+v", err) } - resp.ShippingCost = &pb.Money{ - Amount: shippingQuoteUSD, - CurrencyCode: "USD", - } + resp.ShippingCost = shippingQuoteUSD // TODO(ahmetb) convert to req.UserCurrency // TODO(ahmetb) calculate resp.OrderItem with req.UserCurrency return resp, nil @@ -102,20 +100,20 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq if err != nil { return nil, status.Errorf(codes.Internal, "shipping quote failure: %+v", err) } - shippingPrice, err := cs.convertCurrency(ctx, &pb.Money{ - Amount: shippingUsd, - CurrencyCode: usdCurrency}, req.UserCurrency) + shippingPrice, err := cs.convertCurrency(ctx, shippingUsd, req.UserCurrency) if err != nil { return nil, status.Errorf(codes.Internal, "failed to convert shipping cost to currency: %+v", err) } - var totalPrice pb.Money - totalPrice = sumMoney(totalPrice, *shippingPrice) + total := pb.Money{CurrencyCode: req.UserCurrency, + Units: 0, + Nanos: 0} + total = money.Must(money.Sum(total, *shippingPrice)) for _, it := range orderItems { - totalPrice = sumMoney(totalPrice, *it.Cost) + total = money.Must(money.Sum(total, *it.Cost)) } - txID, err := cs.chargeCard(ctx, &totalPrice, req.CreditCard) + txID, err := cs.chargeCard(ctx, &total, req.CreditCard) if err != nil { return nil, status.Errorf(codes.Internal, "failed to charge card: %+v", err) } @@ -143,7 +141,7 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq return resp, nil } -func (cs *checkoutService) quoteShipping(ctx context.Context, address *pb.Address, items []*pb.CartItem) (*pb.MoneyAmount, error) { +func (cs *checkoutService) quoteShipping(ctx context.Context, address *pb.Address, items []*pb.CartItem) (*pb.Money, error) { conn, err := grpc.DialContext(ctx, cs.shippingSvcAddr, grpc.WithInsecure()) if err != nil { return nil, fmt.Errorf("could not connect shipping service: %+v", err) @@ -189,10 +187,7 @@ func (cs *checkoutService) prepOrderItems(ctx context.Context, items []*pb.CartI if err != nil { return nil, fmt.Errorf("failed to get product #%q", item.GetProductId()) } - usdPrice := &pb.Money{ - Amount: product.GetPriceUsd(), - CurrencyCode: usdCurrency} - price, err := cs.convertCurrency(ctx, usdPrice, userCurrency) + price, err := cs.convertCurrency(ctx, product.GetPriceUsd(), userCurrency) if err != nil { return nil, fmt.Errorf("failed to convert price of %q to %s", item.GetProductId(), userCurrency) } diff --git a/src/checkoutservice/money.go b/src/checkoutservice/money.go deleted file mode 100644 index 584b72e..0000000 --- a/src/checkoutservice/money.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "math" - - pb "./genproto" -) - -func sum(m1, m2 pb.MoneyAmount) pb.MoneyAmount { - f1, f2 := float64(m1.Fractional), float64(m2.Fractional) - lg1 := math.Max(1, math.Ceil(math.Log10(f1))) - if f1 == math.Pow(10, lg1) { - lg1++ - } - lg2 := math.Max(1, math.Ceil(math.Log10(f2))) - if f2 == math.Pow(10, lg2) { - lg2++ - } - lgMax := math.Max(lg1, lg2) - - dSum := m1.Decimal + m2.Decimal - o1 := f1 * math.Pow(10, lgMax-lg1) - o2 := f2 * math.Pow(10, lgMax-lg2) - fSum := o1 + o2 - if fSum >= math.Pow(10, lgMax) { - fSum -= math.Pow(10, lgMax) - dSum++ - } - - for int(fSum)%10 == 0 && fSum != 0 { - fSum = float64(int(fSum) / 10) - } - - return pb.MoneyAmount{ - Decimal: dSum, - Fractional: uint32(fSum)} -} - -func sumMoney(m1, m2 pb.Money) pb.Money { - s := sum(*m1.Amount, *m2.Amount) - return pb.Money{ - Amount: &s, - CurrencyCode: m1.CurrencyCode} -} diff --git a/src/checkoutservice/money/money.go b/src/checkoutservice/money/money.go new file mode 100644 index 0000000..410daaf --- /dev/null +++ b/src/checkoutservice/money/money.go @@ -0,0 +1,118 @@ +package money + +import ( + "errors" + + pb "../genproto" +) + +const ( + nanosMin = -999999999 + nanosMax = +999999999 + nanosMod = 1000000000 +) + +var ( + ErrInvalidValue = errors.New("one of the specified money values is invalid") + ErrMismatchingCurrency = errors.New("mismatching currency codes") +) + +// IsValid checks if specified value has a valid units/nanos signs and ranges. +func IsValid(m pb.Money) bool { + return signMatches(m) && validNanos(m.GetNanos()) +} + +func signMatches(m pb.Money) bool { + return m.GetNanos() == 0 || m.GetUnits() == 0 || (m.GetNanos() < 0) == (m.GetUnits() < 0) +} + +func validNanos(nanos int32) bool { return nanosMin <= nanos && nanos <= nanosMax } + +// IsZero returns true if the specified money value is equal to zero. +func IsZero(m pb.Money) bool { return m.GetUnits() == 0 && m.GetNanos() == 0 } + +// IsPositive returns true if the specified money value is valid and is +// positive. +func IsPositive(m pb.Money) bool { + return IsValid(m) && m.GetUnits() > 0 || (m.GetUnits() == 0 && m.GetNanos() > 0) +} + +// IsNegative returns true if the specified money value is valid and is +// negative. +func IsNegative(m pb.Money) bool { + return IsValid(m) && m.GetUnits() < 0 || (m.GetUnits() == 0 && m.GetNanos() < 0) +} + +// AreSameCurrency returns true if values l and r have a currency code and +// they are the same values. +func AreSameCurrency(l, r pb.Money) bool { + return l.GetCurrencyCode() == r.GetCurrencyCode() && l.GetCurrencyCode() != "" +} + +// AreEquals returns true if values l and r are the equal, including the +// currency. This does not check validity of the provided values. +func AreEquals(l, r pb.Money) bool { + return l.GetCurrencyCode() == r.GetCurrencyCode() && + l.GetUnits() == r.GetUnits() && l.GetNanos() == r.GetNanos() +} + +// Negate returns the same amount with the sign negated. +func Negate(m pb.Money) pb.Money { + return pb.Money{ + Units: -m.GetUnits(), + Nanos: -m.GetNanos(), + CurrencyCode: m.GetCurrencyCode()} +} + +// Must panics if the given error is not nil. This can be used with other +// functions like: "m := Must(Sum(a,b))". +func Must(v pb.Money, err error) pb.Money { + if err != nil { + panic(err) + } + return v +} + +// Sum adds two values. Returns an error if one of the values are invalid or +// currency codes are not matching (unless currency code is unspecified for +// both). +func Sum(l, r pb.Money) (pb.Money, error) { + if !IsValid(l) || !IsValid(r) { + return pb.Money{}, ErrInvalidValue + } else if l.GetCurrencyCode() != r.GetCurrencyCode() { + return pb.Money{}, ErrMismatchingCurrency + } + units := l.GetUnits() + r.GetUnits() + nanos := l.GetNanos() + r.GetNanos() + + if (units == 0 && nanos == 0) || (units > 0 && nanos >= 0) || (units < 0 && nanos <= 0) { + // same sign + units += int64(nanos / nanosMod) + nanos = nanos % nanosMod + } else { + // different sign. nanos guaranteed to not to go over the limit + if units > 0 { + units-- + nanos += nanosMod + } else { + units++ + nanos -= nanosMod + } + } + + return pb.Money{ + Units: units, + Nanos: nanos, + CurrencyCode: l.GetCurrencyCode()}, nil +} + +// MultiplySlow is a slow multiplication operation done through adding the value +// to itself n-1 times. +func MultiplySlow(m pb.Money, n uint32) pb.Money { + out := m + for n > 1 { + out = Must(Sum(out, m)) + n-- + } + return out +} diff --git a/src/checkoutservice/money/money_test.go b/src/checkoutservice/money/money_test.go new file mode 100644 index 0000000..d672129 --- /dev/null +++ b/src/checkoutservice/money/money_test.go @@ -0,0 +1,231 @@ +package money + +import ( + "fmt" + "reflect" + "testing" + + pb "../genproto" +) + +func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} } +func mm(u int64, n int32) pb.Money { return mmc(u, n, "") } + +func TestIsValid(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"valid -/-", mm(-981273891273, -999999999), true}, + {"invalid -/+", mm(-981273891273, +999999999), false}, + {"valid +/+", mm(981273891273, 999999999), true}, + {"invalid +/-", mm(981273891273, -999999999), false}, + {"invalid +/+overflow", mm(3, 1000000000), false}, + {"invalid +/-overflow", mm(3, -1000000000), false}, + {"invalid -/+overflow", mm(-3, 1000000000), false}, + {"invalid -/-overflow", mm(-3, -1000000000), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsValid(tt.in); got != tt.want { + t.Errorf("IsValid(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsZero(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"zero", mm(0, 0), true}, + {"not-zero (-/+)", mm(-1, +1), false}, + {"not-zero (-/-)", mm(-1, -1), false}, + {"not-zero (+/+)", mm(+1, +1), false}, + {"not-zero (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsZero(tt.in); got != tt.want { + t.Errorf("IsZero(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsPositive(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"zero", mm(0, 0), false}, + {"positive (+/+)", mm(+1, +1), true}, + {"invalid (-/+)", mm(-1, +1), false}, + {"negative (-/-)", mm(-1, -1), false}, + {"invalid (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsPositive(tt.in); got != tt.want { + t.Errorf("IsPositive(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsNegative(t *testing.T) { + tests := []struct { + name string + in pb.Money + want bool + }{ + {"zero", mm(0, 0), false}, + {"positive (+/+)", mm(+1, +1), false}, + {"invalid (-/+)", mm(-1, +1), false}, + {"negative (-/-)", mm(-1, -1), true}, + {"invalid (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsNegative(tt.in); got != tt.want { + t.Errorf("IsNegative(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestAreSameCurrency(t *testing.T) { + type args struct { + l pb.Money + r pb.Money + } + tests := []struct { + name string + args args + want bool + }{ + {"both empty currency", args{mmc(1, 0, ""), mmc(2, 0, "")}, false}, + {"left empty currency", args{mmc(1, 0, ""), mmc(2, 0, "USD")}, false}, + {"right empty currency", args{mmc(1, 0, "USD"), mmc(2, 0, "")}, false}, + {"mismatching", args{mmc(1, 0, "USD"), mmc(2, 0, "CAD")}, false}, + {"matching", args{mmc(1, 0, "USD"), mmc(2, 0, "USD")}, true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AreSameCurrency(tt.args.l, tt.args.r); got != tt.want { + t.Errorf("AreSameCurrency([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} + +func TestAreEquals(t *testing.T) { + type args struct { + l pb.Money + r pb.Money + } + tests := []struct { + name string + args args + want bool + }{ + {"equals", args{mmc(1, 2, "USD"), mmc(1, 2, "USD")}, true}, + {"mismatching currency", args{mmc(1, 2, "USD"), mmc(1, 2, "CAD")}, false}, + {"mismatching units", args{mmc(10, 20, "USD"), mmc(1, 20, "USD")}, false}, + {"mismatching nanos", args{mmc(1, 2, "USD"), mmc(1, 20, "USD")}, false}, + {"negated", args{mmc(1, 2, "USD"), mmc(-1, -2, "USD")}, false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AreEquals(tt.args.l, tt.args.r); got != tt.want { + t.Errorf("AreEquals([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} + +func TestNegate(t *testing.T) { + tests := []struct { + name string + in pb.Money + want pb.Money + }{ + {"zero", mm(0, 0), mm(0, 0)}, + {"negative", mm(-1, -200), mm(1, 200)}, + {"positive", mm(1, 200), mm(-1, -200)}, + {"carries currency code", mmc(0, 0, "XXX"), mmc(0, 0, "XXX")}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := Negate(tt.in); !AreEquals(got, tt.want) { + t.Errorf("Negate([%v]) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestMust_pass(t *testing.T) { + v := Must(mm(2, 3), nil) + if !AreEquals(v, mm(2, 3)) { + t.Errorf("returned the wrong value: %v", v) + } +} + +func TestMust_panic(t *testing.T) { + defer func() { + if r := recover(); r != nil { + t.Logf("panic captured: %v", r) + } + }() + Must(mm(2, 3), fmt.Errorf("some error")) + t.Fatal("this should not have executed due to the panic above") +} + +func TestSum(t *testing.T) { + type args struct { + l pb.Money + r pb.Money + } + tests := []struct { + name string + args args + want pb.Money + wantErr error + }{ + {"0+0=0", args{mm(0, 0), mm(0, 0)}, mm(0, 0), nil}, + {"Error: currency code on left", args{mmc(0, 0, "XXX"), mm(0, 0)}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: currency code on right", args{mm(0, 0), mmc(0, 0, "YYY")}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: currency code mismatch", args{mmc(0, 0, "AAA"), mmc(0, 0, "BBB")}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: invalid +/-", args{mm(+1, -1), mm(0, 0)}, mm(0, 0), ErrInvalidValue}, + {"Error: invalid -/+", args{mm(0, 0), mm(-1, +2)}, mm(0, 0), ErrInvalidValue}, + {"Error: invalid nanos", args{mm(0, 1000000000), mm(1, 0)}, mm(0, 0), ErrInvalidValue}, + {"both positive (no carry)", args{mm(2, 200000000), mm(2, 200000000)}, mm(4, 400000000), nil}, + {"both positive (nanos=max)", args{mm(2, 111111111), mm(2, 888888888)}, mm(4, 999999999), nil}, + {"both positive (carry)", args{mm(2, 200000000), mm(2, 900000000)}, mm(5, 100000000), nil}, + {"both negative (no carry)", args{mm(-2, -200000000), mm(-2, -200000000)}, mm(-4, -400000000), nil}, + {"both negative (carry)", args{mm(-2, -200000000), mm(-2, -900000000)}, mm(-5, -100000000), nil}, + {"mixed (larger positive, just decimals)", args{mm(11, 0), mm(-2, 0)}, mm(9, 0), nil}, + {"mixed (larger negative, just decimals)", args{mm(-11, 0), mm(2, 0)}, mm(-9, 0), nil}, + {"mixed (larger positive, no borrow)", args{mm(11, 100000000), mm(-2, -100000000)}, mm(9, 0), nil}, + {"mixed (larger positive, with borrow)", args{mm(11, 100000000), mm(-2, -9000000 /*.09*/)}, mm(9, 91000000 /*.091*/), nil}, + {"mixed (larger negative, no borrow)", args{mm(-11, -100000000), mm(2, 100000000)}, mm(-9, 0), nil}, + {"mixed (larger negative, with borrow)", args{mm(-11, -100000000), mm(2, 9000000 /*.09*/)}, mm(-9, -91000000 /*.091*/), nil}, + {"0+negative", args{mm(0, 0), mm(-2, -100000000)}, mm(-2, -100000000), nil}, + {"negative+0", args{mm(-2, -100000000), mm(0, 0)}, mm(-2, -100000000), nil}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := Sum(tt.args.l, tt.args.r) + if err != tt.wantErr { + t.Errorf("Sum([%v],[%v]): expected err=\"%v\" got=\"%v\"", tt.args.l, tt.args.r, tt.wantErr, err) + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Sum([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} diff --git a/src/checkoutservice/money_test.go b/src/checkoutservice/money_test.go deleted file mode 100644 index 29f8a85..0000000 --- a/src/checkoutservice/money_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "reflect" - "testing" - - pb "./genproto" -) - -func Test_sum(t *testing.T) { - type args struct { - m1 pb.MoneyAmount - m2 pb.MoneyAmount - } - tests := []struct { - name string - args args - want pb.MoneyAmount - }{ - { - name: "no fractions", - args: args{pb.MoneyAmount{Decimal: 10}, pb.MoneyAmount{Decimal: 100}}, - want: pb.MoneyAmount{Decimal: 110}, - }, - { - name: "same fraction digits", - args: args{pb.MoneyAmount{Decimal: 1, Fractional: 23}, pb.MoneyAmount{Decimal: 1, Fractional: 44}}, - want: pb.MoneyAmount{Decimal: 2, Fractional: 67}, - }, - { - name: "different fraction digits", - args: args{pb.MoneyAmount{Decimal: 1, Fractional: 351}, pb.MoneyAmount{Decimal: 1, Fractional: 1}}, - want: pb.MoneyAmount{Decimal: 2, Fractional: 451}, - }, - { - name: "redundant trailing zeroes are removed from fraction", - args: args{pb.MoneyAmount{Decimal: 1, Fractional: 351}, pb.MoneyAmount{Decimal: 1, Fractional: 349}}, - want: pb.MoneyAmount{Decimal: 2, Fractional: 7}, - }, - { - name: "carry", - args: args{pb.MoneyAmount{Decimal: 1, Fractional: 5}, pb.MoneyAmount{Decimal: 1, Fractional: 5000000}}, - want: pb.MoneyAmount{Decimal: 3}, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := sum(tt.args.m1, tt.args.m2); !reflect.DeepEqual(got, tt.want) { - t.Errorf("sum(%v+%v) = %v, want=%v", tt.args.m1, tt.args.m2, got, tt.want) - } - }) - } -} From 51d5e9a3edacf907efc61331748421f08180f7f4 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 13:28:49 -0700 Subject: [PATCH 14/49] currencyservice: [WIP] money proto migration Signed-off-by: Ahmet Alp Balkan --- src/currencyservice/client.js | 6 ++---- src/currencyservice/genproto.sh | 0 src/currencyservice/proto/demo.proto | 26 +++++++++++++++----------- 3 files changed, 17 insertions(+), 15 deletions(-) mode change 100644 => 100755 src/currencyservice/genproto.sh diff --git a/src/currencyservice/client.js b/src/currencyservice/client.js index 519e2ad..b2b6298 100644 --- a/src/currencyservice/client.js +++ b/src/currencyservice/client.js @@ -29,10 +29,8 @@ const client = new shopProto.CurrencyService(`localhost:${PORT}`, const request = { from: { currency_code: 'USD', - amount: { - decimal: 300, - fractional: 0 - } + units: 300, + nanos: 500000000 }, to_code: 'CHF' }; diff --git a/src/currencyservice/genproto.sh b/src/currencyservice/genproto.sh old mode 100644 new mode 100755 diff --git a/src/currencyservice/proto/demo.proto b/src/currencyservice/proto/demo.proto index ffd0518..0c3fdf2 100644 --- a/src/currencyservice/proto/demo.proto +++ b/src/currencyservice/proto/demo.proto @@ -63,7 +63,7 @@ message Product { string name = 2; string description = 3; string picture = 4; - MoneyAmount price_usd = 5; + Money price_usd = 5; } message ListProductsResponse { @@ -95,7 +95,7 @@ message GetQuoteRequest { } message GetQuoteResponse { - MoneyAmount cost_usd = 1; + Money cost_usd = 1; } message ShipOrderRequest { @@ -122,18 +122,22 @@ service CurrencyService { rpc Convert(CurrencyConversionRequest) returns (Money) {} } - -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -message MoneyAmount { - uint32 decimal = 1; - uint32 fractional = 2; -} - +// Represents an amount of money with its currency type. message Money { // The 3-letter currency code defined in ISO 4217. string currency_code = 1; - MoneyAmount amount = 2; + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + int64 units = 2; + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + int32 nanos = 3; } message GetSupportedCurrenciesResponse { From 6f1a3d79e15001aee43b2a33bd7a45c66fca5742 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Wed, 27 Jun 2018 13:51:08 -0700 Subject: [PATCH 15/49] Move to new proto + add magic of left-pad --- src/currencyservice/client.js | 9 +++++---- src/currencyservice/package.json | 1 + src/currencyservice/server.js | 34 +++++++++++++++++--------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/currencyservice/client.js b/src/currencyservice/client.js index b2b6298..5b98c19 100644 --- a/src/currencyservice/client.js +++ b/src/currencyservice/client.js @@ -18,6 +18,7 @@ const path = require('path'); const grpc = require('grpc'); +const leftPad = require('left-pad'); const PROTO_PATH = path.join(__dirname, './proto/demo.proto'); const PORT = 31337; @@ -28,15 +29,15 @@ const client = new shopProto.CurrencyService(`localhost:${PORT}`, const request = { from: { - currency_code: 'USD', + currency_code: 'CHF', units: 300, - nanos: 500000000 + nanos: 0 }, - to_code: 'CHF' + to_code: 'EUR' }; function _moneyToString (m) { - return `${m.amount.decimal}.${m.amount.fractional} ${m.currency_code}`; + return `${m.units}.${leftPad(m.nanos, 9, '0')} ${m.currency_code}`; } client.getSupportedCurrencies({}, (err, response) => { diff --git a/src/currencyservice/package.json b/src/currencyservice/package.json index c5abff6..3aaa44e 100644 --- a/src/currencyservice/package.json +++ b/src/currencyservice/package.json @@ -8,6 +8,7 @@ "async": "^1.5.2", "google-protobuf": "^3.0.0", "grpc": "^1.0.0", + "left-pad": "^1.3.0", "request": "^2.87.0", "xml2js": "^0.4.19" } diff --git a/src/currencyservice/server.js b/src/currencyservice/server.js index a42d00b..a1429d8 100644 --- a/src/currencyservice/server.js +++ b/src/currencyservice/server.js @@ -31,7 +31,7 @@ const shopProto = grpc.load(PROTO_PATH).hipstershop; let _data; function _getCurrencyData (callback) { if (!_data) { - console.log('Fetching currency data...') + console.log('Fetching currency data...'); request(DATA_URL, (err, res) => { if (err) { throw new Error(`Error getting data: ${err}`); @@ -53,7 +53,7 @@ function _getCurrencyData (callback) { }); }); } else { - console.log('Using cached currency data...') + console.log('Using cached currency data...'); callback(_data); } } @@ -62,9 +62,10 @@ function _getCurrencyData (callback) { * Helper function that handles decimal/fractional carrying */ function _carry (amount) { - amount.fractional += (amount.decimal % 1) * 100; - amount.decimal = Math.floor(amount.decimal) + Math.floor(amount.fractional / 100); - amount.fractional = amount.fractional % 100; + const fractionSize = Math.pow(10, 9); + amount.nanos += (amount.units % 1) * fractionSize; + amount.units = Math.floor(amount.units) + Math.floor(amount.nanos / fractionSize); + amount.nanos = amount.nanos % fractionSize; return amount; } @@ -72,7 +73,7 @@ function _carry (amount) { * Lists the supported currencies */ function getSupportedCurrencies (call, callback) { - console.log('Getting supported currencies...') + console.log('Getting supported currencies...'); _getCurrencyData((data) => { callback(null, {currency_codes: Object.keys(data)}); }); @@ -82,7 +83,7 @@ function getSupportedCurrencies (call, callback) { * Converts between currencies */ function convert (call, callback) { - console.log('Starting conversion request...') + console.log('Starting conversion request...'); try { _getCurrencyData((data) => { const request = call.request; @@ -90,22 +91,23 @@ function convert (call, callback) { // Convert: from_currency --> EUR const from = request.from; const euros = _carry({ - decimal: from.amount.decimal / data[from.currency_code], - fractional: from.amount.fractional / data[from.currency_code] + units: from.units / data[from.currency_code], + nanos: from.nanos / data[from.currency_code] }); // Convert: EUR --> to_currency - const target = _carry({ - decimal: euros.decimal * data[request.to_code], - fractional: euros.fractional * data[request.to_code] + const result = _carry({ + units: euros.units * data[request.to_code], + nanos: euros.nanos * data[request.to_code] }); - target.fractional = Math.round(target.fractional); + result.nanos = Math.round(result.nanos); + result.currency_code = request.to_code; - console.log('Conversion request successful.') - callback(null, {currency_code: request.to_code, amount: target}); + console.log('Conversion request successful.'); + callback(null, result); }); } catch (err) { - console.error('Conversion request failed.') + console.error('Conversion request failed.'); callback(err.message); } } From 71c27ccea07a0fd95f6b2db10da6eff918c6876c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 14:27:17 -0700 Subject: [PATCH 16/49] checkoutservice: money proto migration Signed-off-by: Ahmet Alp Balkan --- src/checkoutservice/Dockerfile | 11 ++-- src/checkoutservice/main.go | 73 +++++++++++++++---------- src/checkoutservice/money/money.go | 2 +- src/checkoutservice/money/money_test.go | 2 +- 4 files changed, 52 insertions(+), 36 deletions(-) diff --git a/src/checkoutservice/Dockerfile b/src/checkoutservice/Dockerfile index d4d2f1c..c69a206 100644 --- a/src/checkoutservice/Dockerfile +++ b/src/checkoutservice/Dockerfile @@ -1,13 +1,12 @@ FROM golang:1.10-alpine as builder RUN apk add --no-cache ca-certificates git -WORKDIR /src/microservices-demo/catalogservice +WORKDIR /go/src/checkoutservice COPY . . RUN go get -d ./... -RUN go build -o /catalogservice . +RUN go build -o /checkoutservice . FROM alpine as release -RUN apk add --no-cache \ - ca-certificates -COPY --from=builder /catalogservice /catalogservice +RUN apk add --no-cache ca-certificates +COPY --from=builder /checkoutservice /checkoutservice EXPOSE 5050 -ENTRYPOINT ["/catalogservice"] +ENTRYPOINT ["/checkoutservice"] diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 268fc99..cea99d8 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -12,8 +12,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - pb "./genproto" - money "./money" + pb "checkoutservice/genproto" + money "checkoutservice/money" ) const ( @@ -68,13 +68,13 @@ func (cs *checkoutService) CreateOrder(ctx context.Context, req *pb.CreateOrderR log.Printf("[CreateOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency) resp := new(pb.CreateOrderResponse) - shippingQuoteUSD, err := cs.quoteShipping(ctx, req.Address, nil) // TODO(ahmetb): query CartService for items + prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address) if err != nil { - return nil, status.Errorf(codes.Internal, "shipping quote failure: %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) } - resp.ShippingCost = shippingQuoteUSD - // TODO(ahmetb) convert to req.UserCurrency - // TODO(ahmetb) calculate resp.OrderItem with req.UserCurrency + + resp.Items = prep.orderItems + resp.ShippingCost = prep.shippingCostLocalized return resp, nil } @@ -86,30 +86,16 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq return nil, status.Errorf(codes.Internal, "failed to generate order uuid") } - cartItems, err := cs.getUserCart(ctx, req.UserId) + prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address) if err != nil { - return nil, status.Errorf(codes.Internal, "cart failure: %+v", err) - } - - orderItems, err := cs.prepOrderItems(ctx, cartItems, req.UserCurrency) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to prepare order: %+v", err) - } - - shippingUsd, err := cs.quoteShipping(ctx, req.Address, cartItems) // TODO(ahmetb): query CartService for items - if err != nil { - return nil, status.Errorf(codes.Internal, "shipping quote failure: %+v", err) - } - shippingPrice, err := cs.convertCurrency(ctx, shippingUsd, req.UserCurrency) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to convert shipping cost to currency: %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) } total := pb.Money{CurrencyCode: req.UserCurrency, Units: 0, Nanos: 0} - total = money.Must(money.Sum(total, *shippingPrice)) - for _, it := range orderItems { + total = money.Must(money.Sum(total, *prep.shippingCostLocalized)) + for _, it := range prep.orderItems { total = money.Must(money.Sum(total, *it.Cost)) } @@ -119,7 +105,7 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq } log.Printf("payment went through (transaction_id: %s)", txID) - shippingTrackingID, err := cs.shipOrder(ctx, req.Address, cartItems) + shippingTrackingID, err := cs.shipOrder(ctx, req.Address, prep.cartItems) if err != nil { return nil, status.Errorf(codes.Unavailable, "shipping error: %+v", err) } @@ -127,9 +113,9 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq orderResult := &pb.OrderResult{ OrderId: orderID.String(), ShippingTrackingId: shippingTrackingID, - ShippingCost: shippingPrice, + ShippingCost: prep.shippingCostLocalized, ShippingAddress: req.Address, - Items: orderItems, + Items: prep.orderItems, } if err := cs.sendOrderConfirmation(ctx, req.Email, orderResult); err != nil { @@ -141,6 +127,37 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq return resp, nil } +type orderPrep struct { + orderItems []*pb.OrderItem + cartItems []*pb.CartItem + shippingCostLocalized *pb.Money +} + +func (cs *checkoutService) prepareOrderItemsAndShippingQuoteFromCart(ctx context.Context, userID, userCurrency string, address *pb.Address) (orderPrep, error) { + var out orderPrep + cartItems, err := cs.getUserCart(ctx, userID) + if err != nil { + return out, fmt.Errorf("cart failure: %+v", err) + } + orderItems, err := cs.prepOrderItems(ctx, cartItems, userCurrency) + if err != nil { + return out, fmt.Errorf("failed to prepare order: %+v", err) + } + shippingUSD, err := cs.quoteShipping(ctx, address, cartItems) + if err != nil { + return out, fmt.Errorf("shipping quote failure: %+v", err) + } + shippingPrice, err := cs.convertCurrency(ctx, shippingUSD, userCurrency) + if err != nil { + return out, fmt.Errorf("failed to convert shipping cost to currency: %+v", err) + } + + out.shippingCostLocalized = shippingPrice + out.cartItems = cartItems + out.orderItems = orderItems + return out, nil +} + func (cs *checkoutService) quoteShipping(ctx context.Context, address *pb.Address, items []*pb.CartItem) (*pb.Money, error) { conn, err := grpc.DialContext(ctx, cs.shippingSvcAddr, grpc.WithInsecure()) if err != nil { diff --git a/src/checkoutservice/money/money.go b/src/checkoutservice/money/money.go index 410daaf..97d8555 100644 --- a/src/checkoutservice/money/money.go +++ b/src/checkoutservice/money/money.go @@ -3,7 +3,7 @@ package money import ( "errors" - pb "../genproto" + pb "checkoutservice/genproto" ) const ( diff --git a/src/checkoutservice/money/money_test.go b/src/checkoutservice/money/money_test.go index d672129..deef207 100644 --- a/src/checkoutservice/money/money_test.go +++ b/src/checkoutservice/money/money_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - pb "../genproto" + pb "checkoutservice/genproto" ) func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} } From 6c2336b21e3028b719069dd5ddacf33c7b409a3a Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 14:31:38 -0700 Subject: [PATCH 17/49] frontend: money proto migration Signed-off-by: Ahmet Alp Balkan --- src/frontend/genproto/demo.pb.go | 359 ++++++++++++++----------------- src/frontend/handlers.go | 18 +- src/frontend/main.go | 2 +- src/frontend/money/money.go | 4 +- 4 files changed, 172 insertions(+), 211 deletions(-) diff --git a/src/frontend/genproto/demo.pb.go b/src/frontend/genproto/demo.pb.go index d547682..7e64573 100644 --- a/src/frontend/genproto/demo.pb.go +++ b/src/frontend/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{0} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{1} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{2} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{3} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{4} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{5} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{6} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{7} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string { } type Product struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` - PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` + PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{8} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -414,7 +414,7 @@ func (m *Product) GetPicture() string { return "" } -func (m *Product) GetPriceUsd() *MoneyAmount { +func (m *Product) GetPriceUsd() *Money { if m != nil { return m.PriceUsd } @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{9} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{10} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{11} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{12} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{13} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem { } type GetQuoteResponse struct { - CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{14} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo -func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { +func (m *GetQuoteResponse) GetCostUsd() *Money { if m != nil { return m.CostUsd } @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{15} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{16} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{17} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 { return 0 } -// Describes a money amount without currency. For example, decimal=2 and -// fractional=500 (or fractional=5) makes up 2.5 units. -type MoneyAmount struct { - Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` - Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` +// Represents an amount of money with its currency type. +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"` + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } -func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } -func (*MoneyAmount) ProtoMessage() {} -func (*MoneyAmount) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{18} -} -func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) -} -func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) -} -func (dst *MoneyAmount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoneyAmount.Merge(dst, src) -} -func (m *MoneyAmount) XXX_Size() int { - return xxx_messageInfo_MoneyAmount.Size(m) -} -func (m *MoneyAmount) XXX_DiscardUnknown() { - xxx_messageInfo_MoneyAmount.DiscardUnknown(m) -} - -var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo - -func (m *MoneyAmount) GetDecimal() uint32 { - if m != nil { - return m.Decimal - } - return 0 -} - -func (m *MoneyAmount) GetFractional() uint32 { - if m != nil { - return m.Fractional - } - return 0 -} - -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` - Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{19} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string { return "" } -func (m *Money) GetAmount() *MoneyAmount { +func (m *Money) GetUnits() int64 { if m != nil { - return m.Amount + return m.Units } - return nil + return 0 +} + +func (m *Money) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 } type GetSupportedCurrenciesResponse struct { @@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{20} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{21} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{22} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{23} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{24} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{25} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{26} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{27} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{28} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{29} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{30} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_40506d781b7ed975, []int{31} + return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1527,7 +1496,6 @@ func init() { proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") proto.RegisterType((*Address)(nil), "hipstershop.Address") - proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") proto.RegisterType((*Money)(nil), "hipstershop.Money") proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") @@ -2294,100 +2262,99 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } -var fileDescriptor_demo_40506d781b7ed975 = []byte{ - // 1466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, - 0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66, - 0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa, - 0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a, - 0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, - 0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf, - 0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34, - 0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0, 0xa4, 0x6c, 0xc4, 0x88, 0x8b, 0x2e, 0x01, 0x04, 0xd4, - 0xb7, 0x23, 0x8b, 0x8d, 0x1d, 0xbb, 0xa7, 0xed, 0x68, 0x7b, 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3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4, - 0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, - 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, +var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ + // 1442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, + 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, + 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, + 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3, + 0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe8, 0x7d, 0x5f, 0xa1, 0xcf, 0xd1, + 0xd9, 0xd5, 0xae, 0xfe, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xa7, 0xdd, 0xfd, 0xf6, 0x9c, 0x6f, 0xcf, + 0x9e, 0x73, 0xf6, 0xb3, 0x01, 0x5c, 0xe2, 0xd3, 0xbd, 0x90, 0x51, 0x4e, 0x51, 0x7b, 0xe2, 0x85, + 0x11, 0x27, 0x2c, 0x9a, 0xd0, 0x10, 0xef, 0xc3, 0xf2, 0xc0, 0x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xb2, 0x43, 0x23, 0x2e, 0xef, 0xc6, 0xa8, 0xbd, 0x9b, 0xa6, 0xc0, + 0x88, 0xab, 0xa1, 0xb0, 0x76, 0x30, 0xf1, 0xc2, 0x47, 0xcc, 0x25, 0xec, 0x5f, 0xe1, 0xfc, 0x29, + 0xac, 0xe7, 0x1c, 0x66, 0xe9, 0xcd, 0x99, 0xed, 0xbc, 0xf6, 0x82, 0x57, 0x59, 0xed, 0x80, 0x9e, + 0x1a, 0xb9, 0xf8, 0x57, 0x03, 0x9a, 0xca, 0x2f, 0xda, 0x85, 0xb5, 0x88, 0x33, 0x42, 0xf8, 0x58, + 0x11, 0x18, 0xdf, 0x54, 0x3b, 0xba, 0xc9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14, + 0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03, + 0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, + 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, + 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, + 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, + 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, + 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0x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96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, + 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, + 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, + 0x00, 0x00, } diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 447bcbc..38c98b1 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "frontend/money" "html/template" "log" "net/http" @@ -67,10 +68,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { } ps := make([]productView, len(products)) for i, p := range products { - price, err := fe.convertCurrency(r.Context(), &pb.Money{ - Amount: p.PriceUsd, - CurrencyCode: defaultCurrency, - }, currentCurrency(r)) + price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -113,9 +111,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) return } - price, err := fe.convertCurrency(r.Context(), &pb.Money{ - Amount: p.GetPriceUsd(), - CurrencyCode: defaultCurrency}, currentCurrency(r)) + price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { http.Error(w, fmt.Sprintf("failed to convert currency: %+v", err), http.StatusInternalServerError) return @@ -209,19 +205,17 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request http.Error(w, fmt.Sprintf("could not retrieve product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) return } - price, err := fe.convertCurrency(r.Context(), &pb.Money{ - Amount: p.GetPriceUsd(), - CurrencyCode: defaultCurrency}, currentCurrency(r)) + price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { http.Error(w, fmt.Sprintf("could not convert currency for product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) return } - multPrice := multMoney(*price.GetAmount(), uint32(item.GetQuantity())) + multPrice := money.MultiplySlow(*price, uint32(item.GetQuantity())) items[i] = cartItemView{ Item: p, Quantity: item.GetQuantity(), - Price: &pb.Money{Amount: &multPrice, CurrencyCode: price.GetCurrencyCode()}} + Price: &multPrice} } if err := templates.ExecuteTemplate(w, "cart", map[string]interface{}{ diff --git a/src/frontend/main.go b/src/frontend/main.go index 46ca919..e5217e9 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -71,7 +71,7 @@ func main() { } svc.recommendationSvcConn, err = grpc.DialContext(ctx, svc.recommendationSvcAddr, grpc.WithInsecure()) if err != nil { - log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcConn, err) + log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcAddr, err) } r := mux.NewRouter() diff --git a/src/frontend/money/money.go b/src/frontend/money/money.go index bc1856a..0c580a0 100644 --- a/src/frontend/money/money.go +++ b/src/frontend/money/money.go @@ -107,10 +107,10 @@ func Sum(l, r pb.Money) (pb.Money, error) { // MultiplySlow is a slow multiplication operation done through adding the value // to itself n-1 times. -func MultiplySlow(m pb.MoneyAmount, n uint32) pb.MoneyAmount { +func MultiplySlow(m pb.Money, n uint32) pb.Money { out := m for n > 1 { - out = Sum(out, m) + out = Must(Sum(out, m)) n-- } return out From 10748d6b0afcc00b02dede982e3f6560e67cce13 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 14:55:19 -0700 Subject: [PATCH 18/49] frontend/templates: fix money rendering Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 9 ++++++++- src/frontend/templates/cart.html | 4 +--- src/frontend/templates/home.html | 6 ++---- src/frontend/templates/product.html | 4 +--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 38c98b1..0feeae9 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -17,7 +17,10 @@ import ( ) var ( - templates = template.Must(template.ParseGlob("templates/*.html")) + templates = template.Must(template.New(""). + Funcs(template.FuncMap{ + "renderMoney": renderMoney, + }).ParseGlob("templates/*.html")) ) func ensureSessionID(next http.HandlerFunc) http.HandlerFunc { @@ -282,3 +285,7 @@ func cartIDs(c []*pb.CartItem) []string { } return out } + +func renderMoney(money pb.Money) string { + return fmt.Sprintf("%s %d.%02d", money.GetCurrencyCode(), money.GetUnits(), money.GetNanos()/10000000) +} diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index 223e90a..8e82dcf 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -26,9 +26,7 @@
Qty: {{.Quantity}}
- {{.Price.CurrencyCode}} - {{.Price.Amount.Decimal}}. - {{- .Price.Amount.Fractional}}{{- if lt .Price.Amount.Fractional 10}}0{{end}} + {{ renderMoney .Price}}
diff --git a/src/frontend/templates/home.html b/src/frontend/templates/home.html index b8c8dd9..a62c28e 100644 --- a/src/frontend/templates/home.html +++ b/src/frontend/templates/home.html @@ -38,10 +38,8 @@
- {{.Price.CurrencyCode}} - {{.Price.Amount.Decimal}}.{{.Price.Amount.Fractional}} - {{- if lt .Price.Amount.Fractional 10}}0{{end}} - + {{ renderMoney .Price }} +
diff --git a/src/frontend/templates/product.html b/src/frontend/templates/product.html index 192816f..a6fe9b0 100644 --- a/src/frontend/templates/product.html +++ b/src/frontend/templates/product.html @@ -13,9 +13,7 @@

{{$.product.Item.Name}}

- {{$.product.Price.CurrencyCode}} - {{$.product.Price.Amount.Decimal}}. - {{- $.product.Price.Amount.Fractional}}{{- if lt $.product.Price.Amount.Fractional 10}}0{{end}} + {{ renderMoney $.product.Price}}


From 2ec570c5072aa20e44d97bae489e8b78fce56ff3 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 15:43:24 -0700 Subject: [PATCH 19/49] frontend: checkout form Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 22 ++++ src/frontend/main.go | 5 + src/frontend/port-forward-dependencies.sh | 13 +++ src/frontend/templates/cart.html | 105 +++++++++++++------- src/frontend/templates/recommendations.html | 2 +- 5 files changed, 111 insertions(+), 36 deletions(-) create mode 100755 src/frontend/port-forward-dependencies.sh diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 0feeae9..371a177 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -233,6 +233,28 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request } } +func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http.Request) { + streetAddress1 := r.FormValue("street_address_1") + streetAddress2 := r.FormValue("street_address_2") + city := r.FormValue("city") + country := r.FormValue("country") + zipCode, _ := strconv.ParseInt(r.FormValue("country"), 10, 32) + + log.Printf("[prepareCheckout] session_id=%+v", sessionID(r)) + _, _ = pb.NewCheckoutServiceClient(fe.checkoutSvcConn).CreateOrder(r.Context(), + &pb.CreateOrderRequest{ + UserId: sessionID(r), + UserCurrency: currentCurrency(r), + Address: &pb.Address{ + StreetAddress_1: streetAddress1, + StreetAddress_2: streetAddress2, + City: city, + ZipCode: int32(zipCode), + Country: country, + }, + }) +} + func (fe *frontendServer) logoutHandler(w http.ResponseWriter, r *http.Request) { log.Printf("[home] session_id=%+v", sessionID(r)) for _, c := range r.Cookies() { diff --git a/src/frontend/main.go b/src/frontend/main.go index e5217e9..0bd613d 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -40,6 +40,9 @@ type frontendServer struct { recommendationSvcAddr string recommendationSvcConn *grpc.ClientConn + + checkoutSvcAddr string + checkoutSvcConn *grpc.ClientConn } func main() { @@ -55,6 +58,7 @@ func main() { mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR") mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR") mustMapEnv(&svc.recommendationSvcAddr, "RECOMMENDATION_SERVICE_ADDR") + mustMapEnv(&svc.checkoutSvcAddr, "CHECKOUT_SERVICE_ADDR") var err error svc.currencySvcConn, err = grpc.DialContext(ctx, svc.currencySvcAddr, grpc.WithInsecure()) @@ -82,6 +86,7 @@ func main() { r.HandleFunc("/cart/empty", ensureSessionID(svc.emptyCartHandler)).Methods(http.MethodPost) r.HandleFunc("/setCurrency", ensureSessionID(svc.setCurrencyHandler)).Methods(http.MethodPost) r.HandleFunc("/logout", svc.logoutHandler).Methods(http.MethodGet) + r.HandleFunc("/checkout", ensureSessionID(svc.prepareCheckoutHandler)).Methods(http.MethodGet, http.MethodHead) r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))) log.Printf("starting server on :" + srvPort) log.Fatal(http.ListenAndServe("localhost:"+srvPort, r)) diff --git a/src/frontend/port-forward-dependencies.sh b/src/frontend/port-forward-dependencies.sh new file mode 100755 index 0000000..5d507b4 --- /dev/null +++ b/src/frontend/port-forward-dependencies.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -ex + +kubectl port-forward $(kubectl get pods -l app=currencyservice -o=name) 7000:31337 & +kubectl port-forward $(kubectl get pods -l app=recommendationservice -o=name) 8081:8080 & +kubectl port-forward $(kubectl get pods -l app=cartservice -o=name) 7070:7070 & +kubectl port-forward $(kubectl get pods -l app=productcatalogservice -o=name) 3550:3550 & +kubectl port-forward $(kubectl get pods -l app=checkoutservice -o=name) 5050:5050 & + +set +x +trap "exit" INT TERM ERR +trap "kill 0" EXIT +wait diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index 8e82dcf..97f12f0 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -5,45 +5,80 @@

{{ if eq (len $.items) 0 }} -

Your shopping cart is empty!

-

Items you add to your shopping cart will appear here.

- Browse Products → +

Your shopping cart is empty!

+

Items you add to your shopping cart will appear here.

+ Browse Products → {{ else }} -

{{ len $.items }} item {{- if gt (len $.items) 0}}s{{end}} - in your Shopping Cart

- {{ end }} - {{ range $.items }} -
-
- -
-
- {{.Item.Name}}
- SKU: #{{.Item.Id}} -
-
- Qty: {{.Quantity}}
- - {{ renderMoney .Price}} - -
-
- {{ end }} - - {{ if $.items }} -
-
-
-
- -
- Proceed to Checkout → +

{{ len $.items }} item {{- if gt (len $.items) 1}}s{{end}} + in your Shopping Cart

+ + {{ range $.items }} +
+
+ +
+
+ {{.Item.Name}}
+ SKU: #{{.Item.Id}} +
+
+ Qty: {{.Quantity}}
+ + {{ renderMoney .Price}} +
-
- {{ end }} + {{ end }} + +
+
+
+

Prepare to checkout

+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + + + Proceed to Checkout → +
+
+ +
+
+ {{ end }} {{ if $.recommendations}}
diff --git a/src/frontend/templates/recommendations.html b/src/frontend/templates/recommendations.html index 66c5b6a..936a903 100644 --- a/src/frontend/templates/recommendations.html +++ b/src/frontend/templates/recommendations.html @@ -1,6 +1,6 @@ {{ define "recommendations" }}
Products you might like
-
+
{{range . }}
From 0dc4055b82f0585bc42b8580896f3e6390022faf Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 15:51:33 -0700 Subject: [PATCH 20/49] breaking changes to Address in proto Signed-off-by: Ahmet Alp Balkan --- pb/demo.proto | 6 +- src/checkoutservice/genproto/demo.pb.go | 273 ++++++++++---------- src/frontend/genproto/demo.pb.go | 273 ++++++++++---------- src/frontend/handlers.go | 14 +- src/shippingservice/genproto/demo.pb.go | 273 ++++++++++---------- src/shippingservice/main.go | 2 +- src/shippingservice/shippingservice_test.go | 16 +- src/test-cli/genproto/demo.pb.go | 273 ++++++++++---------- src/test-cli/main.go | 16 +- 9 files changed, 571 insertions(+), 575 deletions(-) diff --git a/pb/demo.proto b/pb/demo.proto index 0c3fdf2..1cd5902 100644 --- a/pb/demo.proto +++ b/pb/demo.proto @@ -108,9 +108,9 @@ message ShipOrderResponse { } message Address { - string street_address_1 = 1; - string street_address_2 = 2; - string city= 3; + string street_address = 1; + string city = 2; + string state = 3; string country = 4; int32 zip_code = 5; } diff --git a/src/checkoutservice/genproto/demo.pb.go b/src/checkoutservice/genproto/demo.pb.go index 7e64573..d548416 100644 --- a/src/checkoutservice/genproto/demo.pb.go +++ b/src/checkoutservice/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string { } type Address struct { - StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"` - StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"` - City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"` + StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"` + City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"` + State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"` Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"` ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() { var xxx_messageInfo_Address proto.InternalMessageInfo -func (m *Address) GetStreetAddress_1() string { +func (m *Address) GetStreetAddress() string { if m != nil { - return m.StreetAddress_1 - } - return "" -} - -func (m *Address) GetStreetAddress_2() string { - if m != nil { - return m.StreetAddress_2 + return m.StreetAddress } return "" } @@ -797,6 +790,13 @@ func (m *Address) GetCity() string { return "" } +func (m *Address) GetState() string { + if m != nil { + return m.State + } + return "" +} + func (m *Address) GetCountry() string { if m != nil { return m.Country @@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1282,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1335,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1450,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -2262,99 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) } -var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ - // 1442 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, - 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, - 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 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xa8, 0x4b, 0x64, - 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, - 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, - 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, - 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, - 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0xde, 0x67, - 0x84, 0xbf, 0x83, 0x73, 0x83, 0x74, 0x22, 0x38, 0x22, 0x2c, 0xf2, 0x68, 0xa0, 0xef, 0xfe, 0x32, - 0x2c, 0xbe, 0x64, 0xd4, 0x3f, 0x26, 0x75, 0xe4, 0xba, 0xe8, 0x74, 0x9c, 0x26, 0x07, 0x4b, 0x22, - 0xba, 0xc4, 0xa9, 0x0c, 0xc0, 0xdf, 0x06, 0x74, 0x07, 0x8c, 0xb8, 0x9e, 0x68, 0xd3, 0xee, 0x28, - 0x78, 0x49, 0xd1, 0x35, 0x40, 0x8e, 0x9c, 0x19, 0x3b, 0x36, 0x73, 0xc7, 0x41, 0xec, 0xbf, 0x20, - 0x4c, 0xc5, 0x63, 0xcd, 0x49, 0xb1, 0x5f, 0xc9, 0x79, 0x74, 0x19, 0x56, 0xf3, 0x68, 0xe7, 0xe8, - 0x48, 0xbd, 0x44, 0x9d, 0x0c, 0x3a, 0x38, 0x3a, 0x42, 0x9f, 0xc3, 0x56, 0x1e, 0x47, 0x7e, 0x0c, - 0x3d, 0x26, 0xbb, 0xe6, 0x78, 0x4a,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, 0x62, 0x2d, 0xd4, 0x69, 0x2e, 0xb3, 0xa2, 0xd3, 0xe1, - 0xb9, 0xfe, 0x53, 0xe8, 0x3e, 0xb6, 0xa7, 0x3e, 0x09, 0xd2, 0x0a, 0x1e, 0xc0, 0x52, 0xf2, 0xec, - 0x23, 0xb3, 0x68, 0x39, 0x2f, 0x43, 0xcc, 0xad, 0xca, 0xb5, 0x34, 0x20, 0x13, 0x58, 0xd9, 0x17, - 0x3d, 0x4a, 0x1b, 0x7d, 0x26, 0x7e, 0x2c, 0x55, 0xbc, 0x56, 0xe8, 0x4a, 0x29, 0x1b, 0xea, 0x5f, - 0xb4, 0x9a, 0x9a, 0xfd, 0x5d, 0x84, 0x7e, 0x42, 0x9c, 0xd7, 0x34, 0x4e, 0x8f, 0x60, 0x41, 0x3b, - 0xf7, 0x60, 0xa0, 0x4b, 0xe5, 0x96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, - 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, - 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, - 0x00, 0x00, +var fileDescriptor_demo_bbfc9458084e7e4b = []byte{ + // 1435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46, + 0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40, + 0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81, + 0x0e, 0x1d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x6d, 0xe8, 0x3a, 0x11, 0x63, 0x24, 0x70, 0xa6, 0x31, 0x30, + 0x66, 0xb3, 0xac, 0x37, 0x25, 0x5a, 0x2a, 0x8e, 0x02, 0x4f, 0x70, 0xc5, 0x66, 0xd1, 0x8a, 0x17, + 0x72, 0x37, 0xb0, 0x03, 0xca, 0x15, 0x9d, 0x86, 0x15, 0x2f, 0xf0, 0x10, 0x2e, 0x0e, 0x89, 0xd8, + 0x8f, 0xc2, 0x90, 0x32, 0x41, 0xdc, 0x41, 0x2c, 0xc7, 0x23, 0x59, 0x5c, 0x5e, 0x86, 0x5e, 0x41, + 0xa5, 0x2e, 0x08, 0xdd, 0xbc, 0x4e, 0x8e, 0xbf, 0x87, 0x73, 0x83, 0x74, 0x23, 0x38, 0x22, 0x8c, + 0x7b, 0x34, 0xd0, 0x4e, 0xbe, 0x02, 0xf5, 0x57, 0x8c, 0xfa, 0xc7, 0xc4, 0x88, 0x3a, 0x97, 0x25, + 0x4d, 0xd0, 0xf8, 0x61, 0xb1, 0x25, 0x97, 0x04, 0x55, 0x06, 0xf8, 0xc7, 0x80, 0xde, 0x80, 0x11, + 0xd7, 0x93, 0xf5, 0xd8, 0x1d, 0x05, 0xaf, 0x28, 0xba, 0x01, 0xc8, 0x51, 0x3b, 0x63, 0xc7, 0x66, + 0xee, 0x38, 0x88, 0xfc, 0x97, 0x84, 0x25, 0xf6, 0x58, 0x75, 0x52, 0xec, 0xd7, 0x6a, 0x1f, 0x5d, + 0x81, 0x95, 0x3c, 0xda, 0x39, 0x3a, 0x4a, 0x5a, 0x4e, 0x37, 0x83, 0x0e, 0x8e, 0x8e, 0xd0, 0x17, + 0xb0, 0x99, 0xc7, 0x91, 0x9f, 0x42, 0x8f, 0xa9, 0xf2, 0x38, 0x9e, 0x12, 0x9b, 0x25, 0xb6, 0xeb, + 0x67, 0x77, 0xf6, 0x52, 0xc0, 0x77, 0xc4, 0x66, 0xe8, 0x2e, 0x9c, 0xaf, 0xb8, 0xee, 0x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x7f, 0x31, 0x60, 0xa3, 0x38, + 0x04, 0xeb, 0x67, 0xfd, 0x08, 0x67, 0xe6, 0x4c, 0xc8, 0xe8, 0xa3, 0x82, 0x98, 0xea, 0xd9, 0xdc, + 0xbc, 0x7a, 0x32, 0x30, 0x76, 0x80, 0x64, 0x51, 0x83, 0x8d, 0x64, 0xba, 0x1b, 0xd8, 0xc2, 0x3e, + 0xa0, 0xaf, 0x35, 0x8b, 0x21, 0x2c, 0xe7, 0x47, 0x59, 0x34, 0xe7, 0x15, 0xe6, 0x87, 0x33, 0x9a, + 0xca, 0x93, 0x25, 0x5e, 0x40, 0xf7, 0x01, 0xb2, 0x49, 0x16, 0x5d, 0x2c, 0x9b, 0xba, 0x38, 0xe2, + 0x9a, 0x73, 0x07, 0x4f, 0xbc, 0x80, 0x5e, 0x40, 0xaf, 0x38, 0xbb, 0x22, 0x5c, 0x40, 0xce, 0x9d, + 0x83, 0xcd, 0xed, 0x63, 0x31, 0xa9, 0x15, 0x7e, 0x37, 0x60, 0x65, 0x3f, 0xc9, 0x43, 0xfd, 0xfe, + 0x11, 0xb4, 0xf4, 0xc8, 0x89, 0xce, 0x97, 0x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a, + 0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a, + 0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb, + 0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5, + 0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f, + 0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98, + 0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55, + 0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd, + 0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58, + 0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6, + 0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00, } diff --git a/src/frontend/genproto/demo.pb.go b/src/frontend/genproto/demo.pb.go index 7e64573..d548416 100644 --- a/src/frontend/genproto/demo.pb.go +++ b/src/frontend/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string { } type Address struct { - StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"` - StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"` - City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"` + StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"` + City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"` + State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"` Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"` ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() { var xxx_messageInfo_Address proto.InternalMessageInfo -func (m *Address) GetStreetAddress_1() string { +func (m *Address) GetStreetAddress() string { if m != nil { - return m.StreetAddress_1 - } - return "" -} - -func (m *Address) GetStreetAddress_2() string { - if m != nil { - return m.StreetAddress_2 + return m.StreetAddress } return "" } @@ -797,6 +790,13 @@ func (m *Address) GetCity() string { return "" } +func (m *Address) GetState() string { + if m != nil { + return m.State + } + return "" +} + func (m *Address) GetCountry() string { if m != nil { return m.Country @@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1282,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1335,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1450,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -2262,99 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) } -var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ - // 1442 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, - 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, - 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, - 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3, - 0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe8, 0x7d, 0x5f, 0xa1, 0xcf, 0xd1, - 0xd9, 0xd5, 0xae, 0xfe, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xa7, 0xdd, 0xfd, 0xf6, 0x9c, 0x6f, 0xcf, - 0x9e, 0x73, 0xf6, 0xb3, 0x01, 0x5c, 0xe2, 0xd3, 0xbd, 0x90, 0x51, 0x4e, 0x51, 0x7b, 0xe2, 0x85, - 0x11, 0x27, 0x2c, 0x9a, 0xd0, 0x10, 0xef, 0xc3, 0xf2, 0xc0, 0x66, 0x7c, 0xc4, 0x89, 0x8f, 0x2e, - 0x00, 0x84, 0x8c, 0xba, 0xb1, 0xc3, 0xc7, 0x9e, 0xdb, 0x33, 0xb6, 0x8d, 0xdd, 0x96, 0xd5, 0x52, - 0x33, 0x23, 0x17, 0x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xfc, 0x29, - 0xac, 0xe7, 0x1c, 0x66, 0xe9, 0xcd, 0x99, 0xed, 0xbc, 0xf6, 0x82, 0x57, 0x59, 0xed, 0x80, 0x9e, - 0x1a, 0xb9, 0xf8, 0x57, 0x03, 0x9a, 0xca, 0x2f, 0xda, 0x85, 0xb5, 0x88, 0x33, 0x42, 0xf8, 0x58, - 0x11, 0x18, 0xdf, 0x54, 0x3b, 0xba, 0xc9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14, - 0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03, - 0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, - 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, - 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, - 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, - 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, - 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0xde, 0x67, - 0x84, 0xbf, 0x83, 0x73, 0x83, 0x74, 0x22, 0x38, 0x22, 0x2c, 0xf2, 0x68, 0xa0, 0xef, 0xfe, 0x32, - 0x2c, 0xbe, 0x64, 0xd4, 0x3f, 0x26, 0x75, 0xe4, 0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f, 0x2c, - 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, - 0x00, 0x00, +var fileDescriptor_demo_bbfc9458084e7e4b = []byte{ + // 1435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46, + 0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40, + 0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81, + 0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57, + 0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, + 0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf, + 0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f, + 0xd0, 0x10, 0xef, 0x41, 0x6b, 0x60, 0x33, 0x31, 0x12, 0xc4, 0x47, 0x17, 0x00, 0x42, 0x46, 0xdd, + 0xc8, 0x11, 0x63, 0xcf, 0xed, 0x1b, 0x5b, 0xc6, 0xd5, 0xb6, 0xd5, 0x4e, 0x76, 0x46, 0x2e, 0x32, + 0xa1, 0x75, 0x18, 0xd9, 0x81, 0xf0, 0xc4, 0xb4, 0x5f, 0xdb, 0x32, 0x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 0xfd, 0xd2, + 0xfb, 0x3e, 0xa0, 0xfc, 0xb3, 0xd2, 0xa9, 0x23, 0x09, 0x10, 0xe3, 0x54, 0x01, 0xb2, 0xfb, 0x97, + 0x01, 0x1d, 0x99, 0xc6, 0xfb, 0x84, 0x1d, 0x79, 0x0e, 0x41, 0x77, 0x54, 0xab, 0x54, 0x99, 0xbf, + 0x59, 0x7e, 0x53, 0x6e, 0x7a, 0x37, 0x8b, 0x76, 0x8f, 0xc7, 0xdb, 0x05, 0xf4, 0x39, 0x34, 0x93, + 0x11, 0xbb, 0x74, 0xbb, 0x38, 0x78, 0x9b, 0x6b, 0x33, 0x65, 0x04, 0x2f, 0xa0, 0xaf, 0xa0, 0x9d, + 0x0e, 0xf3, 0xe8, 0xc2, 0xac, 0xfc, 0xbc, 0x80, 0xb9, 0xea, 0x77, 0x7f, 0x31, 0x60, 0xa3, 0x38, + 0x04, 0xeb, 0x67, 0xfd, 0x08, 0x67, 0xe6, 0x4c, 0xc8, 0xe8, 0xa3, 0x82, 0x98, 0xea, 0xd9, 0xdc, + 0xbc, 0x7a, 0x32, 0x30, 0x76, 0x80, 0x64, 0x51, 0x83, 0x8d, 0x64, 0xba, 0x1b, 0xd8, 0xc2, 0x3e, + 0xa0, 0xaf, 0x35, 0x8b, 0x21, 0x2c, 0xe7, 0x47, 0x59, 0x34, 0xe7, 0x15, 0xe6, 0x87, 0x33, 0x9a, + 0xca, 0x93, 0x25, 0x5e, 0x40, 0xf7, 0x01, 0xb2, 0x49, 0x16, 0x5d, 0x2c, 0x9b, 0xba, 0x38, 0xe2, + 0x9a, 0x73, 0x07, 0x4f, 0xbc, 0x80, 0x5e, 0x40, 0xaf, 0x38, 0xbb, 0x22, 0x5c, 0x40, 0xce, 0x9d, + 0x83, 0xcd, 0xed, 0x63, 0x31, 0xa9, 0x15, 0x7e, 0x37, 0x60, 0x65, 0x3f, 0xc9, 0x43, 0xfd, 0xfe, + 0x11, 0xb4, 0xf4, 0xc8, 0x89, 0xce, 0x97, 0x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a, + 0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a, + 0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb, + 0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5, + 0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f, + 0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98, + 0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55, + 0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd, + 0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58, + 0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6, + 0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00, } diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 371a177..014be97 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -234,9 +234,9 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request } func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http.Request) { - streetAddress1 := r.FormValue("street_address_1") - streetAddress2 := r.FormValue("street_address_2") + streetAddress := r.FormValue("street_address") city := r.FormValue("city") + state := r.FormValue("state") country := r.FormValue("country") zipCode, _ := strconv.ParseInt(r.FormValue("country"), 10, 32) @@ -246,11 +246,11 @@ func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http. UserId: sessionID(r), UserCurrency: currentCurrency(r), Address: &pb.Address{ - StreetAddress_1: streetAddress1, - StreetAddress_2: streetAddress2, - City: city, - ZipCode: int32(zipCode), - Country: country, + StreetAddress: streetAddress, + City: city, + State: state, + ZipCode: int32(zipCode), + Country: country, }, }) } diff --git a/src/shippingservice/genproto/demo.pb.go b/src/shippingservice/genproto/demo.pb.go index 7e64573..d548416 100644 --- a/src/shippingservice/genproto/demo.pb.go +++ b/src/shippingservice/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string { } type Address struct { - StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"` - StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"` - City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"` + StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"` + City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"` + State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"` Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"` ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() { var xxx_messageInfo_Address proto.InternalMessageInfo -func (m *Address) GetStreetAddress_1() string { +func (m *Address) GetStreetAddress() string { if m != nil { - return m.StreetAddress_1 - } - return "" -} - -func (m *Address) GetStreetAddress_2() string { - if m != nil { - return m.StreetAddress_2 + return m.StreetAddress } return "" } @@ -797,6 +790,13 @@ func (m *Address) GetCity() string { return "" } +func (m *Address) GetState() string { + if m != nil { + return m.State + } + return "" +} + func (m *Address) GetCountry() string { if m != nil { return m.Country @@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1282,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1335,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1450,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -2262,99 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) } -var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ - // 1442 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, - 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, - 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, - 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3, - 0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe8, 0x7d, 0x5f, 0xa1, 0xcf, 0xd1, - 0xd9, 0xd5, 0xae, 0xfe, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xa7, 0xdd, 0xfd, 0xf6, 0x9c, 0x6f, 0xcf, - 0x9e, 0x73, 0xf6, 0xb3, 0x01, 0x5c, 0xe2, 0xd3, 0xbd, 0x90, 0x51, 0x4e, 0x51, 0x7b, 0xe2, 0x85, - 0x11, 0x27, 0x2c, 0x9a, 0xd0, 0x10, 0xef, 0xc3, 0xf2, 0xc0, 0x66, 0x7c, 0xc4, 0x89, 0x8f, 0x2e, - 0x00, 0x84, 0x8c, 0xba, 0xb1, 0xc3, 0xc7, 0x9e, 0xdb, 0x33, 0xb6, 0x8d, 0xdd, 0x96, 0xd5, 0x52, - 0x33, 0x23, 0x17, 0x99, 0xb0, 0xfc, 0x26, 0xb6, 0x03, 0xee, 0xf1, 0x69, 0x6f, 0x7e, 0xdb, 0xd8, - 0x6d, 0x58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 0xed, 0x80, 0x9e, - 0x1a, 0xb9, 0xf8, 0x57, 0x03, 0x9a, 0xca, 0x2f, 0xda, 0x85, 0xb5, 0x88, 0x33, 0x42, 0xf8, 0x58, - 0x11, 0x18, 0xdf, 0x54, 0x3b, 0xba, 0xc9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14, - 0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03, - 0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, - 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, - 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, - 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, - 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, - 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0xde, 0x67, - 0x84, 0xbf, 0x83, 0x73, 0x83, 0x74, 0x22, 0x38, 0x22, 0x2c, 0xf2, 0x68, 0xa0, 0xef, 0xfe, 0x32, - 0x2c, 0xbe, 0x64, 0xd4, 0x3f, 0x26, 0x75, 0xe4, 0xba, 0xe8, 0x74, 0x9c, 0x26, 0x07, 0x4b, 0x22, - 0xba, 0xc4, 0xa9, 0x0c, 0xc0, 0xdf, 0x06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, 0x51, 0x11, - 0x00, 0x00, +var fileDescriptor_demo_bbfc9458084e7e4b = []byte{ + // 1435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46, + 0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40, + 0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81, + 0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57, + 0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, + 0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf, + 0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f, + 0xd0, 0x10, 0xef, 0x41, 0x6b, 0x60, 0x33, 0x31, 0x12, 0xc4, 0x47, 0x17, 0x00, 0x42, 0x46, 0xdd, + 0xc8, 0x11, 0x63, 0xcf, 0xed, 0x1b, 0x5b, 0xc6, 0xd5, 0xb6, 0xd5, 0x4e, 0x76, 0x46, 0x2e, 0x32, + 0xa1, 0x75, 0x18, 0xd9, 0x81, 0xf0, 0xc4, 0xb4, 0x5f, 0xdb, 0x32, 0xae, 0x36, 0xac, 0x74, 0x8d, + 0x9f, 0x42, 0xef, 0x9e, 0xeb, 0x4a, 0x29, 0x16, 0x39, 0x8c, 0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 0x01, 0xb2, 0xfb, 0x97, + 0x01, 0x1d, 0x99, 0xc6, 0xfb, 0x84, 0x1d, 0x79, 0x0e, 0x41, 0x77, 0x54, 0xab, 0x54, 0x99, 0xbf, + 0x59, 0x7e, 0x53, 0x6e, 0x7a, 0x37, 0x8b, 0x76, 0x8f, 0xc7, 0xdb, 0x05, 0xf4, 0x39, 0x34, 0x93, + 0x11, 0xbb, 0x74, 0xbb, 0x38, 0x78, 0x9b, 0x6b, 0x33, 0x65, 0x04, 0x2f, 0xa0, 0xaf, 0xa0, 0x9d, + 0x0e, 0xf3, 0xe8, 0xc2, 0xac, 0xfc, 0xbc, 0x80, 0xb9, 0xea, 0x77, 0x7f, 0x31, 0x60, 0xa3, 0x38, + 0x04, 0xeb, 0x67, 0xfd, 0x08, 0x67, 0xe6, 0x4c, 0xc8, 0xe8, 0xa3, 0x82, 0x98, 0xea, 0xd9, 0xdc, + 0xbc, 0x7a, 0x32, 0x30, 0x76, 0x80, 0x64, 0x51, 0x83, 0x8d, 0x64, 0xba, 0x1b, 0xd8, 0xc2, 0x3e, + 0xa0, 0xaf, 0x35, 0x8b, 0x21, 0x2c, 0xe7, 0x47, 0x59, 0x34, 0xe7, 0x15, 0xe6, 0x87, 0x33, 0x9a, + 0xca, 0x93, 0x25, 0x5e, 0x40, 0xf7, 0x01, 0xb2, 0x49, 0x16, 0x5d, 0x2c, 0x9b, 0xba, 0x38, 0xe2, + 0x9a, 0x73, 0x07, 0x4f, 0xbc, 0x80, 0x5e, 0x40, 0xaf, 0x38, 0xbb, 0x22, 0x5c, 0x40, 0xce, 0x9d, + 0x83, 0xcd, 0xed, 0x63, 0x31, 0xa9, 0x15, 0x7e, 0x37, 0x60, 0x65, 0x3f, 0xc9, 0x43, 0xfd, 0xfe, + 0x11, 0xb4, 0xf4, 0xc8, 0x89, 0xce, 0x97, 0x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a, + 0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a, + 0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb, + 0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5, + 0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f, + 0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98, + 0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55, + 0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd, + 0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58, + 0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6, + 0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00, } diff --git a/src/shippingservice/main.go b/src/shippingservice/main.go index 9336336..d6abd92 100644 --- a/src/shippingservice/main.go +++ b/src/shippingservice/main.go @@ -46,7 +46,7 @@ func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQ // It supplies a tracking ID for notional lookup of shipment delivery status. func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.ShipOrderResponse, error) { // 1. Create a Tracking ID - baseAddress := fmt.Sprintf("%s, %s, %s", in.Address.StreetAddress_1, in.Address.StreetAddress_2, in.Address.City) + baseAddress := fmt.Sprintf("%s, %s, %s", in.Address.StreetAddress, in.Address.City, in.Address.State) id := CreateTrackingId(baseAddress) // 2. Generate a response. diff --git a/src/shippingservice/shippingservice_test.go b/src/shippingservice/shippingservice_test.go index 25e910d..d542a27 100644 --- a/src/shippingservice/shippingservice_test.go +++ b/src/shippingservice/shippingservice_test.go @@ -15,10 +15,10 @@ func TestGetQuote(t *testing.T) { // A basic test case to test logic and protobuf interactions. req := &pb.GetQuoteRequest{ Address: &pb.Address{ - StreetAddress_1: "Muffin Man", - StreetAddress_2: "Drury Lane", - City: "London", - Country: "England", + StreetAddress: "Muffin Man", + City: "London", + State: "", + Country: "England", }, Items: []*pb.CartItem{ { @@ -48,10 +48,10 @@ func TestShipOrder(t *testing.T) { // A basic test case to test logic and protobuf interactions. req := &pb.ShipOrderRequest{ Address: &pb.Address{ - StreetAddress_1: "Muffin Man", - StreetAddress_2: "Drury Lane", - City: "London", - Country: "England", + StreetAddress: "Muffin Man", + City: "London", + State: "", + Country: "England", }, Items: []*pb.CartItem{ { diff --git a/src/test-cli/genproto/demo.pb.go b/src/test-cli/genproto/demo.pb.go index 7e64573..d548416 100644 --- a/src/test-cli/genproto/demo.pb.go +++ b/src/test-cli/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string { } type Address struct { - StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"` - StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"` - City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"` + StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"` + City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"` + State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"` Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"` ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() { var xxx_messageInfo_Address proto.InternalMessageInfo -func (m *Address) GetStreetAddress_1() string { +func (m *Address) GetStreetAddress() string { if m != nil { - return m.StreetAddress_1 - } - return "" -} - -func (m *Address) GetStreetAddress_2() string { - if m != nil { - return m.StreetAddress_2 + return m.StreetAddress } return "" } @@ -797,6 +790,13 @@ func (m *Address) GetCity() string { return "" } +func (m *Address) GetState() string { + if m != nil { + return m.State + } + return "" +} + func (m *Address) GetCountry() string { if m != nil { return m.Country @@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1282,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } func (*CreateOrderRequest) ProtoMessage() {} func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{27} } func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) @@ -1335,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } func (*CreateOrderResponse) ProtoMessage() {} func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{28} } func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{29} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1450,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30} + return fileDescriptor_demo_bbfc9458084e7e4b, []int{30} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -2262,99 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) } -var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{ - // 1442 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6, - 0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b, - 0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, - 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3, - 0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe8, 0x7d, 0x5f, 0xa1, 0xcf, 0xd1, - 0xd9, 0xd5, 0xae, 0xfe, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xa7, 0xdd, 0xfd, 0xf6, 0x9c, 0x6f, 0xcf, - 0x9e, 0x73, 0xf6, 0xb3, 0x01, 0x5c, 0xe2, 0xd3, 0xbd, 0x90, 0x51, 0x4e, 0x51, 0x7b, 0xe2, 0x85, - 0x11, 0x27, 0x2c, 0x9a, 0xd0, 0x10, 0xef,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, 0x9c, 0xaf, 0xc3, 0xb2, 0x43, 0x23, 0x2e, 0xef, 0xc6, 0xa8, 0xbd, 0x9b, 0xa6, 0xc0, - 0x88, 0xab, 0xa1, 0xb0, 0x76, 0x30, 0xf1, 0xc2, 0x47, 0xcc, 0x25, 0xec, 0x5f, 0xe1, 0xfc, 0x29, - 0xac, 0xe7, 0x1c, 0x66, 0xe9, 0xcd, 0x99, 0xed, 0xbc, 0xf6, 0x82, 0x57, 0x59, 0xed, 0x80, 0x9e, - 0x1a, 0xb9, 0xf8, 0x57, 0x03, 0x9a, 0xca, 0x2f, 0xda, 0x85, 0xb5, 0x88, 0x33, 0x42, 0xf8, 0x58, - 0x11, 0x18, 0xdf, 0x54, 0x3b, 0xba, 0xc9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14, - 0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03, - 0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64, - 0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b, - 0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48, - 0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9, - 0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77, - 0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52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 0xa0, 0x4b, 0xe5, 0x96, 0x58, 0x7a, 0xce, 0xcc, 0xed, 0x7a, 0x40, 0x1a, 0xf1, 0x47, - 0x00, 0x59, 0xbb, 0x2c, 0x95, 0xcc, 0xcc, 0xf3, 0x60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c, - 0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11, - 0x00, 0x00, +var fileDescriptor_demo_bbfc9458084e7e4b = []byte{ + // 1435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46, + 0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40, + 0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81, + 0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57, + 0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, + 0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf, + 0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f, + 0xd0, 0x10, 0xef, 0x41, 0x6b, 0x60, 0x33, 0x31, 0x12, 0xc4, 0x47, 0x17, 0x00, 0x42, 0x46, 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af, 0x38, 0xbb, 0x22, 0x5c, 0x40, 0xce, 0x9d, + 0x83, 0xcd, 0xed, 0x63, 0x31, 0xa9, 0x15, 0x7e, 0x37, 0x60, 0x65, 0x3f, 0xc9, 0x43, 0xfd, 0xfe, + 0x11, 0xb4, 0xf4, 0xc8, 0x89, 0xce, 0x97, 0x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a, + 0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a, + 0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb, + 0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5, + 0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f, + 0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98, + 0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55, + 0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd, + 0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58, + 0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6, + 0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00, } diff --git a/src/test-cli/main.go b/src/test-cli/main.go index 44fa6ae..3ad5180 100644 --- a/src/test-cli/main.go +++ b/src/test-cli/main.go @@ -111,10 +111,10 @@ func testShippingService() error { defer conn.Close() address := &pb.Address{ - StreetAddress_1: "Muffin Man", - StreetAddress_2: "Drury Lane", - City: "London", - Country: "United Kingdom", + StreetAddress: "Muffin Man", + State: "", + City: "London", + Country: "United Kingdom", } items := []*pb.CartItem{ { @@ -217,10 +217,10 @@ func testEmailService() error { Units: 10, Nanos: 550000000}, ShippingAddress: &pb.Address{ - StreetAddress_1: "Muffin Man", - StreetAddress_2: "Drury Lane", - City: "London", - Country: "United Kingdom", + StreetAddress: "Muffin Man", + State: "XX", + City: "London", + Country: "United Kingdom", }, Items: []*pb.OrderItem{ &pb.OrderItem{ From 05cb7ecfb9d1c998c719f5d00d257de3ea0b5c53 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 16:24:26 -0700 Subject: [PATCH 21/49] currencyservice: fix nanos overflow due to rounding Signed-off-by: Ahmet Alp Balkan --- src/currencyservice/server.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/currencyservice/server.js b/src/currencyservice/server.js index a1429d8..7cd6539 100644 --- a/src/currencyservice/server.js +++ b/src/currencyservice/server.js @@ -95,19 +95,24 @@ function convert (call, callback) { nanos: from.nanos / data[from.currency_code] }); + euros.nanos = Math.round(euros.nanos); + // Convert: EUR --> to_currency const result = _carry({ units: euros.units * data[request.to_code], nanos: euros.nanos * data[request.to_code] }); - result.nanos = Math.round(result.nanos); + + result.units = Math.floor(result.units) + result.nanos = Math.floor(result.nanos) result.currency_code = request.to_code; - console.log('Conversion request successful.'); + console.log(`Conversion request successful ${result.nanos}..${result.nanos}`); callback(null, result); }); } catch (err) { console.error('Conversion request failed.'); + console.error(err); callback(err.message); } } From 3eb02c0679353b5bcef059b507638eaa7cc33e0b Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 16:28:16 -0700 Subject: [PATCH 22/49] frontend/templates: reenable empty cart Signed-off-by: Ahmet Alp Balkan --- src/frontend/port-forward-dependencies.sh | 10 +++++----- src/frontend/templates/cart.html | 11 ++++------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/frontend/port-forward-dependencies.sh b/src/frontend/port-forward-dependencies.sh index 5d507b4..137c997 100755 --- a/src/frontend/port-forward-dependencies.sh +++ b/src/frontend/port-forward-dependencies.sh @@ -1,11 +1,11 @@ #!/bin/bash set -ex -kubectl port-forward $(kubectl get pods -l app=currencyservice -o=name) 7000:31337 & -kubectl port-forward $(kubectl get pods -l app=recommendationservice -o=name) 8081:8080 & -kubectl port-forward $(kubectl get pods -l app=cartservice -o=name) 7070:7070 & -kubectl port-forward $(kubectl get pods -l app=productcatalogservice -o=name) 3550:3550 & -kubectl port-forward $(kubectl get pods -l app=checkoutservice -o=name) 5050:5050 & +kubectl port-forward $(kubectl get pods -l app=currencyservice -o=name | head -n 1) 7000:31337 & +kubectl port-forward $(kubectl get pods -l app=recommendationservice -o=name | head -n 1) 8081:8080 & +kubectl port-forward $(kubectl get pods -l app=cartservice -o=name | head -n 1) 7070:7070 & +kubectl port-forward $(kubectl get pods -l app=productcatalogservice -o=name | head -n 1) 3550:3550 & +kubectl port-forward $(kubectl get pods -l app=checkoutservice -o=name | head -n 1) 5050:5050 & set +x trap "exit" INT TERM ERR diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index 97f12f0..652e64d 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -11,7 +11,9 @@ {{ else }}

{{ len $.items }} item {{- if gt (len $.items) 1}}s{{end}} - in your Shopping Cart

+ in your Shopping Cart
+ +
{{ range $.items }}
@@ -68,12 +70,7 @@
From 483e113643e724f3a45188c524cb71f6ec020e49 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 22:16:03 -0700 Subject: [PATCH 23/49] frontend: place order Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 85 +++++++++++++++--- src/frontend/main.go | 14 ++- src/frontend/rpc.go | 15 ++++ src/frontend/templates/cart.html | 135 +++++++++++++++++++++-------- src/frontend/templates/header.html | 2 + src/frontend/templates/order.html | 20 +++++ 6 files changed, 224 insertions(+), 47 deletions(-) create mode 100644 src/frontend/templates/order.html diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 014be97..a03be31 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -48,7 +48,7 @@ func ensureSessionID(next http.HandlerFunc) http.HandlerFunc { } func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("[home] session_id=%+v currency=%s", sessionID(r), currentCurrency(r)) + log.Printf("[home] session_id=%s currency=%s", sessionID(r), currentCurrency(r)) currencies, err := fe.getCurrencies(r.Context()) if err != nil { http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) @@ -150,7 +150,7 @@ func (fe *frontendServer) addToCartHandler(w http.ResponseWriter, r *http.Reques http.Error(w, "invalid form input", http.StatusBadRequest) return } - log.Printf("[addToCart] product_id=%s qty=%d session_id=%+v", productID, quantity, sessionID(r)) + log.Printf("[addToCart] product_id=%s qty=%d session_id=%s", productID, quantity, sessionID(r)) p, err := fe.getProduct(r.Context(), productID) if err != nil { @@ -167,7 +167,7 @@ func (fe *frontendServer) addToCartHandler(w http.ResponseWriter, r *http.Reques } func (fe *frontendServer) emptyCartHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("[emptyCart] session_id=%+v", sessionID(r)) + log.Printf("[emptyCart] session_id=%s", sessionID(r)) if err := fe.emptyCart(r.Context(), sessionID(r)); err != nil { http.Error(w, fmt.Sprintf("failed to empty cart: %+v", err), http.StatusInternalServerError) @@ -178,7 +178,7 @@ func (fe *frontendServer) emptyCartHandler(w http.ResponseWriter, r *http.Reques } func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("[viewCart] session_id=%+v", sessionID(r)) + log.Printf("[viewCart] session_id=%s", sessionID(r)) currencies, err := fe.getCurrencies(r.Context()) if err != nil { http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) @@ -196,12 +196,19 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request return } + shippingCost, err := fe.getShippingQuote(r.Context(), cart, currentCurrency(r)) + if err != nil { + http.Error(w, fmt.Sprintf("failed to get shipping quote: %+v", err), http.StatusInternalServerError) + return + } + type cartItemView struct { Item *pb.Product Quantity int32 Price *pb.Money } items := make([]cartItemView, len(cart)) + totalPrice := pb.Money{CurrencyCode: currentCurrency(r)} for i, item := range cart { p, err := fe.getProduct(r.Context(), item.GetProductId()) if err != nil { @@ -219,15 +226,73 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request Item: p, Quantity: item.GetQuantity(), Price: &multPrice} + totalPrice = money.Must(money.Sum(totalPrice, multPrice)) } + totalPrice = money.Must(money.Sum(totalPrice, *shippingCost)) + year := time.Now().Year() if err := templates.ExecuteTemplate(w, "cart", map[string]interface{}{ - "user_currency": currentCurrency(r), - "currencies": currencies, + "user_currency": currentCurrency(r), + "currencies": currencies, + "session_id": sessionID(r), + "recommendations": recommendations, + "cart_size": len(cart), + "shipping_cost": shippingCost, + "total_cost": totalPrice, + "items": items, + "expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4}, + }); err != nil { + log.Println(err) + } +} + +func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Request) { + log.Printf("[checkout] session_id=%s", sessionID(r)) + + var ( + email = r.FormValue("email") + streetAddress = r.FormValue("street_address") + zipCode, _ = strconv.ParseInt(r.FormValue("zip_code"), 10, 32) + city = r.FormValue("city") + state = r.FormValue("state") + country = r.FormValue("country") + ccNumber = r.FormValue("credit_card_number") + ccMonth, _ = strconv.ParseInt(r.FormValue("credit_card_expiration_month"), 10, 32) + ccYear, _ = strconv.ParseInt(r.FormValue("credit_card_expiration_year"), 10, 32) + ccCVV, _ = strconv.ParseInt(r.FormValue("credit_card_cvv"), 10, 32) + ) + + order, err := pb.NewCheckoutServiceClient(fe.checkoutSvcConn). + PlaceOrder(r.Context(), &pb.PlaceOrderRequest{ + Email: email, + CreditCard: &pb.CreditCardInfo{ + CreditCardNumber: ccNumber, + CreditCardExpirationMonth: int32(ccMonth), + CreditCardExpirationYear: int32(ccYear), + CreditCardCvv: int32(ccCVV)}, + UserId: sessionID(r), + UserCurrency: currentCurrency(r), + Address: &pb.Address{ + StreetAddress: streetAddress, + City: city, + State: state, + ZipCode: int32(zipCode), + Country: country}, + }) + if err != nil { + http.Error(w, fmt.Sprintf("failed to complete the order: %+v", err), http.StatusInternalServerError) + return + } + log.Printf("order #%s completed", order.GetOrder().GetOrderId()) + + order.GetOrder().GetItems() + recommendations, _ := fe.getRecommendations(r.Context(), sessionID(r), nil) + + if err := templates.ExecuteTemplate(w, "order", map[string]interface{}{ "session_id": sessionID(r), + "user_currency": currentCurrency(r), + "order": order.GetOrder(), "recommendations": recommendations, - "cart_size": len(cart), - "items": items, }); err != nil { log.Println(err) } @@ -256,7 +321,7 @@ func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http. } func (fe *frontendServer) logoutHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("[home] session_id=%+v", sessionID(r)) + log.Printf("[logout] session_id=%s", sessionID(r)) for _, c := range r.Cookies() { c.Expires = time.Now().Add(-time.Hour * 24 * 365) c.MaxAge = -1 @@ -268,7 +333,7 @@ func (fe *frontendServer) logoutHandler(w http.ResponseWriter, r *http.Request) func (fe *frontendServer) setCurrencyHandler(w http.ResponseWriter, r *http.Request) { cur := r.FormValue("currency_code") - log.Printf("[setCurrency] session_id=%+v code=%s", sessionID(r), cur) + log.Printf("[setCurrency] session_id=%s code=%s", sessionID(r), cur) if cur != "" { http.SetCookie(w, &http.Cookie{ Name: cookieCurrency, diff --git a/src/frontend/main.go b/src/frontend/main.go index 0bd613d..763dc3b 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -43,6 +43,9 @@ type frontendServer struct { checkoutSvcAddr string checkoutSvcConn *grpc.ClientConn + + shippingSvcAddr string + shippingSvcConn *grpc.ClientConn } func main() { @@ -59,6 +62,7 @@ func main() { mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR") mustMapEnv(&svc.recommendationSvcAddr, "RECOMMENDATION_SERVICE_ADDR") mustMapEnv(&svc.checkoutSvcAddr, "CHECKOUT_SERVICE_ADDR") + mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR") var err error svc.currencySvcConn, err = grpc.DialContext(ctx, svc.currencySvcAddr, grpc.WithInsecure()) @@ -77,6 +81,14 @@ func main() { if err != nil { log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcAddr, err) } + svc.shippingSvcConn, err = grpc.DialContext(ctx, svc.shippingSvcAddr, grpc.WithInsecure()) + if err != nil { + log.Fatalf("failed to connect shipping service at %s: %+v", svc.shippingSvcAddr, err) + } + svc.checkoutSvcConn, err = grpc.DialContext(ctx, svc.checkoutSvcAddr, grpc.WithInsecure()) + if err != nil { + log.Fatalf("failed to connect checkout service at %s: %+v", svc.checkoutSvcAddr, err) + } r := mux.NewRouter() r.HandleFunc("/", ensureSessionID(svc.homeHandler)).Methods(http.MethodGet, http.MethodHead) @@ -86,7 +98,7 @@ func main() { r.HandleFunc("/cart/empty", ensureSessionID(svc.emptyCartHandler)).Methods(http.MethodPost) r.HandleFunc("/setCurrency", ensureSessionID(svc.setCurrencyHandler)).Methods(http.MethodPost) r.HandleFunc("/logout", svc.logoutHandler).Methods(http.MethodGet) - r.HandleFunc("/checkout", ensureSessionID(svc.prepareCheckoutHandler)).Methods(http.MethodGet, http.MethodHead) + r.HandleFunc("/cart/checkout", ensureSessionID(svc.placeOrderHandler)).Methods(http.MethodPost) r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))) log.Printf("starting server on :" + srvPort) log.Fatal(http.ListenAndServe("localhost:"+srvPort, r)) diff --git a/src/frontend/rpc.go b/src/frontend/rpc.go index 4e589f3..07f24a8 100644 --- a/src/frontend/rpc.go +++ b/src/frontend/rpc.go @@ -76,6 +76,21 @@ func (fe *frontendServer) convertCurrency(ctx context.Context, money *pb.Money, ToCode: currency}) } +func (fe *frontendServer) getShippingQuote(ctx context.Context, items []*pb.CartItem, currency string) (*pb.Money, error) { + quote, err := pb.NewShippingServiceClient(fe.currencySvcConn).GetQuote(ctx, + &pb.GetQuoteRequest{ + Address: nil, + Items: items}) + if err != nil { + return nil, err + } + localized, err := fe.convertCurrency(ctx, quote.GetCostUsd(), currency) + if err != nil { + return nil, fmt.Errorf("failed to convert currency for shipping cost: %+v", err) + } + return localized, nil +} + func (fe *frontendServer) getRecommendations(ctx context.Context, userID string, productIDs []string) ([]*pb.Product, error) { resp, err := pb.NewRecommendationServiceClient(fe.recommendationSvcConn).ListRecommendations(ctx, &pb.ListRecommendationsRequest{UserId: userID, ProductIds: productIDs}) diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index 652e64d..790e710 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -10,11 +10,22 @@ Browse Products → {{ else }} -

{{ len $.items }} item {{- if gt (len $.items) 1}}s{{end}} - in your Shopping Cart

- -
- +
+
+

{{ len $.items }} item + {{- if gt (len $.items) 1}}s{{end}} + in your Shopping Cart

+
+
+
+ + Browse more products → +
+ +
+
+
+ {{ range $.items }}
@@ -33,45 +44,97 @@
{{ end }} +
+
+

Shipping Cost: {{ renderMoney .shipping_cost }}

+ Total Cost: {{ renderMoney .total_cost }} +
+

-

Prepare to checkout

-
-
-
- - +

Checkout

+ +
+
+ + +
+
+ + +
+
+ + +
+
-
- - +
+
+ + +
+
+ + +
+
+ + +
-
- - +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-
-
- - +
+
-
- - -
-
- - -
-
-
diff --git a/src/frontend/templates/header.html b/src/frontend/templates/header.html index 81502f4..36dadae 100644 --- a/src/frontend/templates/header.html +++ b/src/frontend/templates/header.html @@ -16,6 +16,7 @@ Hipster Shop + {{ if $.currencies }}
View Cart ({{$.cart_size}})
+ {{ end }}
diff --git a/src/frontend/templates/order.html b/src/frontend/templates/order.html new file mode 100644 index 0000000..b8424e5 --- /dev/null +++ b/src/frontend/templates/order.html @@ -0,0 +1,20 @@ +{{ define "order" }} + {{ template "header" . }} + +
+
+
+

+ Your order is complete! +

+

+ Order Confirmation ID: {{ $.order }} +

+ + {{ template "recommendations" $.recommendations }} +
+
+
+ + {{ template "footer" . }} +{{ end }} From f06bc11dd494951f3a84c6555c940d92718e7229 Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Wed, 27 Jun 2018 22:28:04 -0700 Subject: [PATCH 24/49] Renaming cart service env vars Renaming Cart service environment variables: CART_SERVICE_ADDR => LISTEN_ADDR CART_SERVICE_PORT => PORT --- src/cartservice/Program.cs | 6 +++--- src/cartservice/scripts/docker_setup.bat | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cartservice/Program.cs b/src/cartservice/Program.cs index be374f4..ead7546 100644 --- a/src/cartservice/Program.cs +++ b/src/cartservice/Program.cs @@ -11,14 +11,14 @@ namespace cartservice { class Program { - const string CART_SERVICE_ADDRESS = "CART_SERVICE_ADDR"; + const string CART_SERVICE_ADDRESS = "LISTEN_ADDR"; const string REDIS_ADDRESS = "REDIS_ADDR"; - const string CART_SERVICE_PORT = "CART_SERVICE_PORT"; + const string CART_SERVICE_PORT = "PORT"; [Verb("start", HelpText = "Starts the server listening on provided port")] class ServerOptions { - [Option('h', "hostname", HelpText = "The ip on which the server is running. If not provided, CART_SERVICE_ADDR environment variable value will be used. If not defined, localhost is used")] + [Option('h', "hostname", HelpText = "The ip on which the server is running. If not provided, LISTEN_ADDR environment variable value will be used. If not defined, localhost is used")] public string Host { get; set; } [Option('p', "port", HelpText = "The port on for running the server")] diff --git a/src/cartservice/scripts/docker_setup.bat b/src/cartservice/scripts/docker_setup.bat index 2e4e371..b841758 100644 --- a/src/cartservice/scripts/docker_setup.bat +++ b/src/cartservice/scripts/docker_setup.bat @@ -9,8 +9,8 @@ GOTO End1 :local set REDIS_PORT=6379 set REDIS_ADDR=localhost:%REDIS_PORT% - set CART_SERVICE_ADDR=127.0.0.1 - set CART_SERVICE_PORT=7070 + set LISTEN_ADDR=127.0.0.1 + set PORT=7070 echo running redis emulator locally on a separate window taskkill /f /im "redis-server.exe" @@ -24,8 +24,8 @@ GOTO End1 :docker_local set REDIS_PORT=6379 set REDIS_ADDR=redis:%REDIS_PORT% - set CART_SERVICE_ADDR=127.0.0.1 - set CART_SERVICE_PORT=7070 + set LISTEN_ADDR=127.0.0.1 + set PORT=7070 echo run docker container with redis docker run -d --name=redis -p %REDIS_PORT%:%REDIS_PORT% redis @@ -34,7 +34,7 @@ GOTO End1 docker build -t cartservice ..\. echo run container image for cart service - docker run -it --rm -e REDIS_ADDR=%REDIS_ADDR% -e CART_SERVICE_ADDR=%CART_SERVICE_ADDR% -e CART_SERVICE_PORT=%CART_SERVICE_PORT% -p %CART_SERVICE_PORT%:%CART_SERVICE_PORT% cartservice + docker run -it --rm -e REDIS_ADDR=%REDIS_ADDR% -e LISTEN_ADDR=%LISTEN_ADDR% -e PORT=%PORT% -p %PORT%:%PORT% cartservice GOTO End1 From 7c83802b9e5fa663f4cd7924b8c94e13f80d5bb4 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 22:21:26 -0700 Subject: [PATCH 25/49] fix cartservice listen addr Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/cartservice.yaml | 2 ++ src/frontend/rpc.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml index 83cb82d..d7200e5 100644 --- a/kubernetes-manifests/cartservice.yaml +++ b/kubernetes-manifests/cartservice.yaml @@ -18,6 +18,8 @@ spec: value: "redis-cart:6379" - name: CART_SERVICE_PORT value: "7070" + - name: CART_SERVICE_ADDR + value: "127.0.0.1" resources: requests: cpu: 200m diff --git a/src/frontend/rpc.go b/src/frontend/rpc.go index 07f24a8..00657f3 100644 --- a/src/frontend/rpc.go +++ b/src/frontend/rpc.go @@ -77,7 +77,7 @@ func (fe *frontendServer) convertCurrency(ctx context.Context, money *pb.Money, } func (fe *frontendServer) getShippingQuote(ctx context.Context, items []*pb.CartItem, currency string) (*pb.Money, error) { - quote, err := pb.NewShippingServiceClient(fe.currencySvcConn).GetQuote(ctx, + quote, err := pb.NewShippingServiceClient(fe.shippingSvcConn).GetQuote(ctx, &pb.GetQuoteRequest{ Address: nil, Items: items}) From 21909b46742a6e8d6b30d97907f62235d8813fe4 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 22:31:31 -0700 Subject: [PATCH 26/49] k8s: cartservice listen addr Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/cartservice.yaml | 2 +- src/checkoutservice/main.go | 2 +- src/frontend/port-forward-dependencies.sh | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml index d7200e5..70d5135 100644 --- a/kubernetes-manifests/cartservice.yaml +++ b/kubernetes-manifests/cartservice.yaml @@ -19,7 +19,7 @@ spec: - name: CART_SERVICE_PORT value: "7070" - name: CART_SERVICE_ADDR - value: "127.0.0.1" + value: "0.0.0.0" resources: requests: cpu: 200m diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index cea99d8..4f59ce1 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -184,7 +184,7 @@ func (cs *checkoutService) getUserCart(ctx context.Context, userID string) ([]*p cart, err := pb.NewCartServiceClient(conn).GetCart(ctx, &pb.GetCartRequest{UserId: userID}) if err != nil { - return nil, fmt.Errorf("failed to get user cart: %+v", err) + return nil, fmt.Errorf("failed to get user cart during checkout: %+v", err) } return cart.GetItems(), nil } diff --git a/src/frontend/port-forward-dependencies.sh b/src/frontend/port-forward-dependencies.sh index 137c997..4d7793d 100755 --- a/src/frontend/port-forward-dependencies.sh +++ b/src/frontend/port-forward-dependencies.sh @@ -6,6 +6,7 @@ kubectl port-forward $(kubectl get pods -l app=recommendationservice -o=name | h kubectl port-forward $(kubectl get pods -l app=cartservice -o=name | head -n 1) 7070:7070 & kubectl port-forward $(kubectl get pods -l app=productcatalogservice -o=name | head -n 1) 3550:3550 & kubectl port-forward $(kubectl get pods -l app=checkoutservice -o=name | head -n 1) 5050:5050 & +kubectl port-forward $(kubectl get pods -l app=shippingservice -o=name | head -n 1) 50051:50051 & set +x trap "exit" INT TERM ERR From 795fb3f80ef8a9983a9ab0a052310920dad2d06d Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 27 Jun 2018 22:49:12 -0700 Subject: [PATCH 27/49] k8s: new env vars for cartservice Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/cartservice.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml index 70d5135..daca526 100644 --- a/kubernetes-manifests/cartservice.yaml +++ b/kubernetes-manifests/cartservice.yaml @@ -16,9 +16,9 @@ spec: env: - name: REDIS_ADDR value: "redis-cart:6379" - - name: CART_SERVICE_PORT + - name: PORT value: "7070" - - name: CART_SERVICE_ADDR + - name: LISTEN_ADDR value: "0.0.0.0" resources: requests: From 7f4319ae54ab2da4b7dbf1076cd38b92139c4bbe Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 00:15:16 -0700 Subject: [PATCH 28/49] frontend: order result screen Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 10 ++++++++++ src/frontend/templates/cart.html | 6 +++++- src/frontend/templates/error.html | 17 ++++++++++++++++ src/frontend/templates/order.html | 33 +++++++++++++++++++++++-------- 4 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 src/frontend/templates/error.html diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index a03be31..7e84bac 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -288,14 +288,24 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque order.GetOrder().GetItems() recommendations, _ := fe.getRecommendations(r.Context(), sessionID(r), nil) + totalPaid := *order.GetOrder().GetShippingCost() + for _, v := range order.GetOrder().GetItems() { + totalPaid = money.Must(money.Sum(totalPaid, *v.GetCost())) + } + if err := templates.ExecuteTemplate(w, "order", map[string]interface{}{ "session_id": sessionID(r), "user_currency": currentCurrency(r), "order": order.GetOrder(), + "total_paid": &totalPaid, "recommendations": recommendations, }); err != nil { log.Println(err) } + + if err := fe.emptyCart(r.Context(), sessionID(r)); err != nil { + log.Printf("WARN: failed to empty user (%s) cart after checkout: %+v", sessionID(r), err) + } } func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http.Request) { diff --git a/src/frontend/templates/cart.html b/src/frontend/templates/cart.html index 790e710..64b5842 100644 --- a/src/frontend/templates/cart.html +++ b/src/frontend/templates/cart.html @@ -123,7 +123,11 @@
diff --git a/src/frontend/templates/error.html b/src/frontend/templates/error.html new file mode 100644 index 0000000..5a1b125 --- /dev/null +++ b/src/frontend/templates/error.html @@ -0,0 +1,17 @@ +{{ define "error" }} + {{ template "header" }} + +
+
+
+

Uh, oh!

+

Something has failed. Below are some details for debugging.

+
+                    {{.errorMsg}}
+                
+
+
+
+ + {{ template "footer" }} +{{ end }} diff --git a/src/frontend/templates/order.html b/src/frontend/templates/order.html index b8424e5..7784918 100644 --- a/src/frontend/templates/order.html +++ b/src/frontend/templates/order.html @@ -3,15 +3,32 @@
-
-

- Your order is complete! -

-

- Order Confirmation ID: {{ $.order }} -

+
+
+
+

+ Your order is complete! +

+

+ Order Confirmation ID: {{.order.OrderId}} +
+ Shipping Tracking ID: {{.order.ShippingTrackingId}} +

+

+ Shipping Cost: {{renderMoney .order.ShippingCost}} +
+ Total Paid: {{renderMoney .total_paid}} +

+ Browse other products → +
+
+
- {{ template "recommendations" $.recommendations }} + {{ if $.recommendations }} +
+ {{ template "recommendations" $.recommendations }} +
+ {{ end }}
From b2ca0868a5b2b56b86a8fe3109174cf9e72209b6 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 00:20:26 -0700 Subject: [PATCH 29/49] frontend: error page Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 52 ++++++++++++++++++------------- src/frontend/templates/error.html | 7 +++-- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 7e84bac..abb18cb 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -36,7 +36,7 @@ func ensureSessionID(next http.HandlerFunc) http.HandlerFunc { MaxAge: cookieMaxAge, }) } else if err != nil { - http.Error(w, fmt.Sprintf("unrecognized cookie error: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("unrecognized cookie error: %+v", err), http.StatusInternalServerError) return } else { sessionID = c.Value @@ -51,17 +51,17 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { log.Printf("[home] session_id=%s currency=%s", sessionID(r), currentCurrency(r)) currencies, err := fe.getCurrencies(r.Context()) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) return } products, err := fe.getProducts(r.Context()) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve products: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve products: %+v", err), http.StatusInternalServerError) return } cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve cart: %+v", err), http.StatusInternalServerError) return } @@ -73,7 +73,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { for i, p := range products { price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) + renderHTTPError(w, err, http.StatusInternalServerError) return } ps[i] = productView{p, price} @@ -93,36 +93,36 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] if id == "" { - http.Error(w, "product id not specified", http.StatusBadRequest) + renderHTTPError(w, fmt.Errorf("product id not specified"), http.StatusBadRequest) return } log.Printf("[productHandler] id=%s currency=%s session=%s", id, currentCurrency(r), sessionID(r)) p, err := fe.getProduct(r.Context(), id) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve product: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve product: %+v", err), http.StatusInternalServerError) return } currencies, err := fe.getCurrencies(r.Context()) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) return } cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve cart: %+v", err), http.StatusInternalServerError) return } price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - http.Error(w, fmt.Sprintf("failed to convert currency: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to convert currency: %+v", err), http.StatusInternalServerError) return } recommendations, err := fe.getRecommendations(r.Context(), sessionID(r), []string{id}) if err != nil { - http.Error(w, fmt.Sprintf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) return } @@ -147,19 +147,19 @@ func (fe *frontendServer) addToCartHandler(w http.ResponseWriter, r *http.Reques quantity, _ := strconv.ParseUint(r.FormValue("quantity"), 10, 32) productID := r.FormValue("product_id") if productID == "" || quantity == 0 { - http.Error(w, "invalid form input", http.StatusBadRequest) + renderHTTPError(w, fmt.Errorf("invalid form input"), http.StatusBadRequest) return } log.Printf("[addToCart] product_id=%s qty=%d session_id=%s", productID, quantity, sessionID(r)) p, err := fe.getProduct(r.Context(), productID) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve product: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve product: %+v", err), http.StatusInternalServerError) return } if err := fe.insertCart(r.Context(), sessionID(r), p.GetId(), int32(quantity)); err != nil { - http.Error(w, fmt.Sprintf("failed to add to cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to add to cart: %+v", err), http.StatusInternalServerError) return } w.Header().Set("location", "/cart") @@ -170,7 +170,7 @@ func (fe *frontendServer) emptyCartHandler(w http.ResponseWriter, r *http.Reques log.Printf("[emptyCart] session_id=%s", sessionID(r)) if err := fe.emptyCart(r.Context(), sessionID(r)); err != nil { - http.Error(w, fmt.Sprintf("failed to empty cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to empty cart: %+v", err), http.StatusInternalServerError) return } w.Header().Set("location", "/") @@ -181,24 +181,24 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request log.Printf("[viewCart] session_id=%s", sessionID(r)) currencies, err := fe.getCurrencies(r.Context()) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) return } cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve cart: %+v", err), http.StatusInternalServerError) return } recommendations, err := fe.getRecommendations(r.Context(), sessionID(r), cartIDs(cart)) if err != nil { - http.Error(w, fmt.Sprintf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) return } shippingCost, err := fe.getShippingQuote(r.Context(), cart, currentCurrency(r)) if err != nil { - http.Error(w, fmt.Sprintf("failed to get shipping quote: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to get shipping quote: %+v", err), http.StatusInternalServerError) return } @@ -212,12 +212,12 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request for i, item := range cart { p, err := fe.getProduct(r.Context(), item.GetProductId()) if err != nil { - http.Error(w, fmt.Sprintf("could not retrieve product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not retrieve product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) return } price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - http.Error(w, fmt.Sprintf("could not convert currency for product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("could not convert currency for product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) return } @@ -280,7 +280,7 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque Country: country}, }) if err != nil { - http.Error(w, fmt.Sprintf("failed to complete the order: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to complete the order: %+v", err), http.StatusInternalServerError) return } log.Printf("order #%s completed", order.GetOrder().GetOrderId()) @@ -359,6 +359,14 @@ func (fe *frontendServer) setCurrencyHandler(w http.ResponseWriter, r *http.Requ w.WriteHeader(http.StatusFound) } +func renderHTTPError(w http.ResponseWriter, err error, code int) { + w.WriteHeader(code) + templates.ExecuteTemplate(w, "error", map[string]interface{}{ + "error": err.Error(), + "status_code": code, + "status": http.StatusText(code)}) +} + func currentCurrency(r *http.Request) string { c, _ := r.Cookie(cookieCurrency) if c != nil { diff --git a/src/frontend/templates/error.html b/src/frontend/templates/error.html index 5a1b125..24e167a 100644 --- a/src/frontend/templates/error.html +++ b/src/frontend/templates/error.html @@ -6,8 +6,11 @@

Uh, oh!

Something has failed. Below are some details for debugging.

-
-                    {{.errorMsg}}
+                
+                

HTTP Status: {{.status_code}} {{.status}}

+
+                    {{- .error -}}
                 
From 7db573230bab510d24ee92005c57d9c9a7cbc47f Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 00:41:20 -0700 Subject: [PATCH 30/49] frontend: also log error Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index abb18cb..63008b9 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -360,6 +360,7 @@ func (fe *frontendServer) setCurrencyHandler(w http.ResponseWriter, r *http.Requ } func renderHTTPError(w http.ResponseWriter, err error, code int) { + log.Printf("[error] %+v (code=%d)", err, code) w.WriteHeader(code) templates.ExecuteTemplate(w, "error", map[string]interface{}{ "error": err.Error(), From 99cefc46c9eaa36b8d02888856785091587fc199 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 00:48:46 -0700 Subject: [PATCH 31/49] checkoutservice: remove PrepareOrder rpc Signed-off-by: Ahmet Alp Balkan --- pb/demo.proto | 12 - src/checkoutservice/genproto/demo.pb.go | 376 ++++++++---------------- src/checkoutservice/main.go | 14 - src/frontend/genproto/demo.pb.go | 376 ++++++++---------------- src/frontend/handlers.go | 26 -- 5 files changed, 238 insertions(+), 566 deletions(-) diff --git a/pb/demo.proto b/pb/demo.proto index 1cd5902..0862730 100644 --- a/pb/demo.proto +++ b/pb/demo.proto @@ -202,21 +202,9 @@ message SendOrderConfirmationRequest { // -------------Checkout service----------------- service CheckoutService { - rpc CreateOrder(CreateOrderRequest) returns (CreateOrderResponse) {} rpc PlaceOrder(PlaceOrderRequest) returns (PlaceOrderResponse) {} } -message CreateOrderRequest { - string user_id = 1; - string user_currency = 2; - Address address = 3; -} - -message CreateOrderResponse { - repeated OrderItem items = 1; - Money shipping_cost = 2; -} - message PlaceOrderRequest { string user_id = 1; string user_currency = 2; diff --git a/src/checkoutservice/genproto/demo.pb.go b/src/checkoutservice/genproto/demo.pb.go index d548416..4fdb7f0 100644 --- a/src/checkoutservice/genproto/demo.pb.go +++ b/src/checkoutservice/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{0} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{1} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{2} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{3} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{4} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{5} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{6} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{7} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{8} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{9} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{10} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{11} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{12} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{13} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{14} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{15} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{16} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{17} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{18} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{19} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{20} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{21} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{22} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{23} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{24} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{25} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{26} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1269,106 +1269,6 @@ func (m *SendOrderConfirmationRequest) GetOrder() *OrderResult { return nil } -type CreateOrderRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` - Address *Address `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } -func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } -func (*CreateOrderRequest) ProtoMessage() {} -func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{27} -} -func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) -} -func (m *CreateOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOrderRequest.Marshal(b, m, deterministic) -} -func (dst *CreateOrderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOrderRequest.Merge(dst, src) -} -func (m *CreateOrderRequest) XXX_Size() int { - return xxx_messageInfo_CreateOrderRequest.Size(m) -} -func (m *CreateOrderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOrderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateOrderRequest proto.InternalMessageInfo - -func (m *CreateOrderRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *CreateOrderRequest) GetUserCurrency() string { - if m != nil { - return m.UserCurrency - } - return "" -} - -func (m *CreateOrderRequest) GetAddress() *Address { - if m != nil { - return m.Address - } - return nil -} - -type CreateOrderResponse struct { - Items []*OrderItem `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` - ShippingCost *Money `protobuf:"bytes,2,opt,name=shipping_cost,json=shippingCost" json:"shipping_cost,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } -func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } -func (*CreateOrderResponse) ProtoMessage() {} -func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{28} -} -func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) -} -func (m *CreateOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOrderResponse.Marshal(b, m, deterministic) -} -func (dst *CreateOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOrderResponse.Merge(dst, src) -} -func (m *CreateOrderResponse) XXX_Size() int { - return xxx_messageInfo_CreateOrderResponse.Size(m) -} -func (m *CreateOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateOrderResponse proto.InternalMessageInfo - -func (m *CreateOrderResponse) GetItems() []*OrderItem { - if m != nil { - return m.Items - } - return nil -} - -func (m *CreateOrderResponse) GetShippingCost() *Money { - if m != nil { - return m.ShippingCost - } - return nil -} - type PlaceOrderRequest struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` @@ -1384,7 +1284,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{29} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{27} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1450,7 +1350,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{30} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{28} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1505,8 +1405,6 @@ func init() { proto.RegisterType((*OrderItem)(nil), "hipstershop.OrderItem") proto.RegisterType((*OrderResult)(nil), "hipstershop.OrderResult") proto.RegisterType((*SendOrderConfirmationRequest)(nil), "hipstershop.SendOrderConfirmationRequest") - proto.RegisterType((*CreateOrderRequest)(nil), "hipstershop.CreateOrderRequest") - proto.RegisterType((*CreateOrderResponse)(nil), "hipstershop.CreateOrderResponse") proto.RegisterType((*PlaceOrderRequest)(nil), "hipstershop.PlaceOrderRequest") proto.RegisterType((*PlaceOrderResponse)(nil), "hipstershop.PlaceOrderResponse") } @@ -2169,7 +2067,6 @@ var _EmailService_serviceDesc = grpc.ServiceDesc{ // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type CheckoutServiceClient interface { - CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) } @@ -2181,15 +2078,6 @@ func NewCheckoutServiceClient(cc *grpc.ClientConn) CheckoutServiceClient { return &checkoutServiceClient{cc} } -func (c *checkoutServiceClient) CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) { - out := new(CreateOrderResponse) - err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/CreateOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) { out := new(PlaceOrderResponse) err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/PlaceOrder", in, out, opts...) @@ -2201,7 +2089,6 @@ func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRe // CheckoutServiceServer is the server API for CheckoutService service. type CheckoutServiceServer interface { - CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error) PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) } @@ -2209,24 +2096,6 @@ func RegisterCheckoutServiceServer(s *grpc.Server, srv CheckoutServiceServer) { s.RegisterService(&_CheckoutService_serviceDesc, srv) } -func _CheckoutService_CreateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CheckoutServiceServer).CreateOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CheckoutService/CreateOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CheckoutServiceServer).CreateOrder(ctx, req.(*CreateOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _CheckoutService_PlaceOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PlaceOrderRequest) if err := dec(in); err != nil { @@ -2249,10 +2118,6 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ ServiceName: "hipstershop.CheckoutService", HandlerType: (*CheckoutServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateOrder", - Handler: _CheckoutService_CreateOrder_Handler, - }, { MethodName: "PlaceOrder", Handler: _CheckoutService_PlaceOrder_Handler, @@ -2262,98 +2127,95 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_e1d03823e14b5fb0) } -var fileDescriptor_demo_bbfc9458084e7e4b = []byte{ - // 1435 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46, - 0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40, - 0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81, - 0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57, - 0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, - 0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf, - 0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f, - 0xd0, 0x10, 0xef, 0x41, 0x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x73, 0x83, 0x74, 0x23, 0x38, 0x22, 0x8c, - 0x7b, 0x34, 0xd0, 0x4e, 0xbe, 0x02, 0xf5, 0x57, 0x8c, 0xfa, 0xc7, 0xc4, 0x88, 0x3a, 0x97, 0x25, - 0x4d, 0xd0, 0xf8, 0x61, 0xb1, 0x25, 0x97, 0x04, 0x55, 0x06, 0xf8, 0xc7, 0x80, 0xde, 0x80, 0x11, - 0xd7, 0x93, 0xf5, 0xd8, 0x1d, 0x05, 0xaf, 0x28, 0xba, 0x01, 0xc8, 0x51, 0x3b, 0x63, 0xc7, 0x66, - 0xee, 0x38, 0x88, 0xfc, 0x97, 0x84, 0x25, 0xf6, 0x58, 0x75, 0x52, 0xec, 0xd7, 0x6a, 0x1f, 0x5d, - 0x81, 0x95, 0x3c, 0xda, 0x39, 0x3a, 0x4a, 0x5a, 0x4e, 0x37, 0x83, 0x0e, 0x8e, 0x8e, 0xd0, 0x17, - 0xb0, 0x99, 0xc7, 0x91, 0x9f, 0x42, 0x8f, 0xa9, 0xf2, 0x38, 0x9e, 0x12, 0x9b, 0x25, 0xb6, 0xeb, - 0x67, 0x77, 0xf6, 0x52, 0xc0, 0x77, 0xc4, 0x66, 0xe8, 0x2e, 0x9c, 0xaf, 0xb8, 0xee, 0xd3, 0x40, - 0x4c, 0x94, 0xcb, 0x1b, 0xd6, 0xb9, 0x79, 0xf7, 0x1f, 0x49, 0x00, 0x9e, 0x42, 0x77, 0x30, 0xb1, - 0xd9, 0xeb, 0x34, 0xa7, 0x3f, 0x86, 0x25, 0xdb, 0x97, 0x11, 0x72, 0x8c, 0xf1, 0x12, 0x04, 0xba, - 0x03, 0x9d, 0x9c, 0xf6, 0xa4, 0x21, 0x6e, 0x16, 0x33, 0xa4, 0x60, 0x44, 0x0b, 0x32, 0x26, 0xf8, - 0x36, 0xf4, 0xb4, 0xea, 0xcc, 0xf5, 0x82, 0xd9, 0x01, 0xb7, 0x1d, 0xf5, 0x84, 0x34, 0x59, 0xba, - 0xb9, 0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, 0xe2, - 0x9a, 0x73, 0x07, 0x4f, 0xbc, 0x80, 0x5e, 0x40, 0xaf, 0x38, 0xbb, 0x22, 0x5c, 0x40, 0xce, 0x9d, - 0x83, 0xcd, 0xed, 0x63, 0x31, 0xa9, 0x15, 0x7e, 0x37, 0x60, 0x65, 0x3f, 0xc9, 0x43, 0xfd, 0xfe, - 0x11, 0xb4, 0xf4, 0xc8, 0x89, 0xce, 0x97, 0x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a, - 0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a, - 0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb, - 0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5, - 0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f, - 0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98, - 0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55, - 0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd, - 0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58, - 0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6, - 0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00, - 0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00, +var fileDescriptor_demo_e1d03823e14b5fb0 = []byte{ + // 1389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x72, 0xd3, 0xc6, + 0x17, 0x8f, 0x12, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0xd9, 0x7f, 0xc2, 0xdf, 0x28, 0x7c, 0xa4, 0x9b, + 0x81, 0x42, 0x81, 0x94, 0x49, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, + 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xda, 0x05, 0xab, 0x44, 0x5a, 0xb1, 0xbb, 0xca, 0xd4, 0x5c, + 0xb6, 0x0f, 0xd0, 0xfb, 0x3e, 0x42, 0x5f, 0xa0, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, + 0x2b, 0xad, 0xbe, 0x62, 0x25, 0xe1, 0xa6, 0x77, 0xda, 0xb3, 0xbf, 0x3d, 0xe7, 0x77, 0xce, 0x9e, + 0x73, 0xf6, 0x08, 0x80, 0xd0, 0x80, 0xed, 0x46, 0x9c, 0x49, 0x86, 0xba, 0x53, 0x3f, 0x12, 0x92, + 0x72, 0x31, 0x65, 0x11, 0xde, 0x87, 0xf6, 0xd0, 0xe5, 0x72, 0x2c, 0x69, 0x80, 0x2e, 0x02, 0x44, + 0x9c, 0x91, 0xd8, 0x93, 0x13, 0x9f, 0x0c, 0xac, 0x6d, 0xeb, 0x5a, 0xc7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0x35, + 0xbb, 0x59, 0x04, 0x1e, 0x41, 0x27, 0x1b, 0x83, 0x2a, 0xc9, 0x52, 0x9d, 0xc7, 0xec, 0x4b, 0x75, + 0xdb, 0x19, 0xd9, 0x3f, 0x2d, 0x58, 0x35, 0xc5, 0x6d, 0xc8, 0xbe, 0x84, 0x73, 0xf3, 0xc7, 0x88, + 0xb9, 0xd7, 0x76, 0xa3, 0x4a, 0xf8, 0x84, 0xf9, 0x03, 0x2f, 0xa0, 0x11, 0xb4, 0x92, 0x91, 0x42, + 0xa2, 0xab, 0xe5, 0x5a, 0xa8, 0x1b, 0x38, 0xec, 0x39, 0xed, 0x1b, 0x2f, 0xec, 0x3d, 0x87, 0xfe, + 0x53, 0x77, 0x16, 0xd0, 0x30, 0xab, 0xe0, 0x21, 0x2c, 0x27, 0x6f, 0x1e, 0xb2, 0xcb, 0x9a, 0x8b, + 0x6f, 0xb0, 0xbd, 0x35, 0x77, 0x2f, 0x0b, 0xc8, 0x14, 0x56, 0xf6, 0x55, 0x8f, 0x32, 0x4a, 0x5f, + 0xa8, 0x5f, 0x82, 0x39, 0xad, 0x1a, 0x5d, 0xaf, 0x64, 0x43, 0x7d, 0x3b, 0xaf, 0xa9, 0xd9, 0x57, + 0xb0, 0x3a, 0x9c, 0x52, 0xef, 0x2d, 0x8b, 0x33, 0x0f, 0x9e, 0x00, 0xe4, 0x9d, 0xad, 0x92, 0xdd, + 0xc7, 0x3a, 0xb9, 0x7d, 0xb9, 0x76, 0xdf, 0x78, 0xf3, 0x6a, 0x59, 0xff, 0xd4, 0x7f, 0xf6, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0xab, 0x01, 0x43, 0xe2, 0x0f, 0x00, 0x00, } diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 4f59ce1..78b4b94 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -64,20 +64,6 @@ func mustMapEnv(target *string, envKey string) { *target = v } -func (cs *checkoutService) CreateOrder(ctx context.Context, req *pb.CreateOrderRequest) (*pb.CreateOrderResponse, error) { - log.Printf("[CreateOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency) - resp := new(pb.CreateOrderResponse) - - prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address) - if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) - } - - resp.Items = prep.orderItems - resp.ShippingCost = prep.shippingCostLocalized - return resp, nil -} - func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderRequest) (*pb.PlaceOrderResponse, error) { log.Printf("[PlaceOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency) diff --git a/src/frontend/genproto/demo.pb.go b/src/frontend/genproto/demo.pb.go index d548416..4fdb7f0 100644 --- a/src/frontend/genproto/demo.pb.go +++ b/src/frontend/genproto/demo.pb.go @@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} } func (m *CartItem) String() string { return proto.CompactTextString(m) } func (*CartItem) ProtoMessage() {} func (*CartItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{0} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{0} } func (m *CartItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CartItem.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } func (*AddItemRequest) ProtoMessage() {} func (*AddItemRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{1} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{1} } func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) @@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } func (*EmptyCartRequest) ProtoMessage() {} func (*EmptyCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{2} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{2} } func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) @@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } func (*GetCartRequest) ProtoMessage() {} func (*GetCartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{3} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{3} } func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) @@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} } func (m *Cart) String() string { return proto.CompactTextString(m) } func (*Cart) ProtoMessage() {} func (*Cart) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{4} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{4} } func (m *Cart) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Cart.Unmarshal(m, b) @@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{5} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{5} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsRequest) ProtoMessage() {} func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{6} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{6} } func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) @@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } func (*ListRecommendationsResponse) ProtoMessage() {} func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{7} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{7} } func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) @@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} } func (m *Product) String() string { return proto.CompactTextString(m) } func (*Product) ProtoMessage() {} func (*Product) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{8} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{8} } func (m *Product) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Product.Unmarshal(m, b) @@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } func (*ListProductsResponse) ProtoMessage() {} func (*ListProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{9} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{9} } func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } func (*GetProductRequest) ProtoMessage() {} func (*GetProductRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{10} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{10} } func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) @@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } func (*SearchProductsRequest) ProtoMessage() {} func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{11} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{11} } func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) @@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } func (*SearchProductsResponse) ProtoMessage() {} func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{12} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{12} } func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } func (*GetQuoteRequest) ProtoMessage() {} func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{13} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{13} } func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) @@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } func (*GetQuoteResponse) ProtoMessage() {} func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{14} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{14} } func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) @@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } func (*ShipOrderRequest) ProtoMessage() {} func (*ShipOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{15} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{15} } func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) @@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } func (*ShipOrderResponse) ProtoMessage() {} func (*ShipOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{16} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{16} } func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) @@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{17} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{17} } func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) @@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} } func (m *Money) String() string { return proto.CompactTextString(m) } func (*Money) ProtoMessage() {} func (*Money) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{18} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{18} } func (m *Money) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Money.Unmarshal(m, b) @@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } func (*GetSupportedCurrenciesResponse) ProtoMessage() {} func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{19} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{19} } func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) @@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } func (*CurrencyConversionRequest) ProtoMessage() {} func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{20} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{20} } func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } func (*CreditCardInfo) ProtoMessage() {} func (*CreditCardInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{21} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{21} } func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) @@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } func (*ChargeRequest) ProtoMessage() {} func (*ChargeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{22} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{22} } func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) @@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } func (*ChargeResponse) ProtoMessage() {} func (*ChargeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{23} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{23} } func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} } func (m *OrderItem) String() string { return proto.CompactTextString(m) } func (*OrderItem) ProtoMessage() {} func (*OrderItem) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{24} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{24} } func (m *OrderItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderItem.Unmarshal(m, b) @@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} } func (m *OrderResult) String() string { return proto.CompactTextString(m) } func (*OrderResult) ProtoMessage() {} func (*OrderResult) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{25} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{25} } func (m *OrderResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderResult.Unmarshal(m, b) @@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } func (*SendOrderConfirmationRequest) ProtoMessage() {} func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{26} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{26} } func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) @@ -1269,106 +1269,6 @@ func (m *SendOrderConfirmationRequest) GetOrder() *OrderResult { return nil } -type CreateOrderRequest struct { - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` - UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` - Address *Address `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } -func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } -func (*CreateOrderRequest) ProtoMessage() {} -func (*CreateOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{27} -} -func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) -} -func (m *CreateOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOrderRequest.Marshal(b, m, deterministic) -} -func (dst *CreateOrderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOrderRequest.Merge(dst, src) -} -func (m *CreateOrderRequest) XXX_Size() int { - return xxx_messageInfo_CreateOrderRequest.Size(m) -} -func (m *CreateOrderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOrderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateOrderRequest proto.InternalMessageInfo - -func (m *CreateOrderRequest) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *CreateOrderRequest) GetUserCurrency() string { - if m != nil { - return m.UserCurrency - } - return "" -} - -func (m *CreateOrderRequest) GetAddress() *Address { - if m != nil { - return m.Address - } - return nil -} - -type CreateOrderResponse struct { - Items []*OrderItem `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` - ShippingCost *Money `protobuf:"bytes,2,opt,name=shipping_cost,json=shippingCost" json:"shipping_cost,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } -func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } -func (*CreateOrderResponse) ProtoMessage() {} -func (*CreateOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{28} -} -func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) -} -func (m *CreateOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOrderResponse.Marshal(b, m, deterministic) -} -func (dst *CreateOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOrderResponse.Merge(dst, src) -} -func (m *CreateOrderResponse) XXX_Size() int { - return xxx_messageInfo_CreateOrderResponse.Size(m) -} -func (m *CreateOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateOrderResponse proto.InternalMessageInfo - -func (m *CreateOrderResponse) GetItems() []*OrderItem { - if m != nil { - return m.Items - } - return nil -} - -func (m *CreateOrderResponse) GetShippingCost() *Money { - if m != nil { - return m.ShippingCost - } - return nil -} - type PlaceOrderRequest struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` @@ -1384,7 +1284,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } func (*PlaceOrderRequest) ProtoMessage() {} func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{29} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{27} } func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) @@ -1450,7 +1350,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } func (*PlaceOrderResponse) ProtoMessage() {} func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_demo_bbfc9458084e7e4b, []int{30} + return fileDescriptor_demo_e1d03823e14b5fb0, []int{28} } func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) @@ -1505,8 +1405,6 @@ func init() { proto.RegisterType((*OrderItem)(nil), "hipstershop.OrderItem") proto.RegisterType((*OrderResult)(nil), "hipstershop.OrderResult") proto.RegisterType((*SendOrderConfirmationRequest)(nil), "hipstershop.SendOrderConfirmationRequest") - proto.RegisterType((*CreateOrderRequest)(nil), "hipstershop.CreateOrderRequest") - proto.RegisterType((*CreateOrderResponse)(nil), "hipstershop.CreateOrderResponse") proto.RegisterType((*PlaceOrderRequest)(nil), "hipstershop.PlaceOrderRequest") proto.RegisterType((*PlaceOrderResponse)(nil), "hipstershop.PlaceOrderResponse") } @@ -2169,7 +2067,6 @@ var _EmailService_serviceDesc = grpc.ServiceDesc{ // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type CheckoutServiceClient interface { - CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) } @@ -2181,15 +2078,6 @@ func NewCheckoutServiceClient(cc *grpc.ClientConn) CheckoutServiceClient { return &checkoutServiceClient{cc} } -func (c *checkoutServiceClient) CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) { - out := new(CreateOrderResponse) - err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/CreateOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) { out := new(PlaceOrderResponse) err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/PlaceOrder", in, out, opts...) @@ -2201,7 +2089,6 @@ func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRe // CheckoutServiceServer is the server API for CheckoutService service. type CheckoutServiceServer interface { - CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error) PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) } @@ -2209,24 +2096,6 @@ func RegisterCheckoutServiceServer(s *grpc.Server, srv CheckoutServiceServer) { s.RegisterService(&_CheckoutService_serviceDesc, srv) } -func _CheckoutService_CreateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CheckoutServiceServer).CreateOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hipstershop.CheckoutService/CreateOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CheckoutServiceServer).CreateOrder(ctx, req.(*CreateOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _CheckoutService_PlaceOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PlaceOrderRequest) if err := dec(in); err != nil { @@ -2249,10 +2118,6 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ ServiceName: "hipstershop.CheckoutService", HandlerType: (*CheckoutServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateOrder", - Handler: _CheckoutService_CreateOrder_Handler, - }, { MethodName: "PlaceOrder", Handler: _CheckoutService_PlaceOrder_Handler, @@ -2262,98 +2127,95 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{ Metadata: "demo.proto", } -func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_e1d03823e14b5fb0) } -var fileDescriptor_demo_bbfc9458084e7e4b = []byte{ - // 1435 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46, - 0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40, - 0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81, - 0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57, - 0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, - 0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf, - 0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f, - 0xd0, 0x10, 0xef, 0x41, 0x6b, 0x60, 0x33, 0x31, 0x12, 0xc4, 0x47, 0x17, 0x00, 0x42, 0x46, 0xdd, - 0xc8, 0x11, 0x63, 0xcf, 0x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 0xfa, 0xc7, 0xc4, 0x88, 0x3a, 0x97, 0x25, - 0x4d, 0xd0, 0xf8, 0x61, 0xb1, 0x25, 0x97, 0x04, 0x55, 0x06, 0xf8, 0xc7, 0x80, 0xde, 0x80, 0x11, - 0xd7, 0x93, 0xf5, 0xd8, 0x1d, 0x05, 0xaf, 0x28, 0xba, 0x01, 0xc8, 0x51, 0x3b, 0x63, 0xc7, 0x66, - 0xee, 0x38, 0x88, 0xfc, 0x97, 0x84, 0x25, 0xf6, 0x58, 0x75, 0x52, 0xec, 0xd7, 0x6a, 0x1f, 0x5d, - 0x81, 0x95, 0x3c, 0xda, 0x39, 0x3a, 0x4a, 0x5a, 0x4e, 0x37, 0x83, 0x0e, 0x8e, 0x8e, 0xd0, 0x17, - 0xb0, 0x99, 0xc7, 0x91, 0x9f, 0x42, 0x8f, 0xa9, 0xf2, 0x38, 0x9e, 0x12, 0x9b, 0x25, 0xb6, 0xeb, - 0x67, 0x77, 0xf6, 0x52, 0xc0, 0x77, 0xc4, 0x66, 0xe8, 0x2e, 0x9c, 0xaf, 0xb8, 0xee, 0xd3, 0x40, - 0x4c, 0x94, 0xcb, 0x1b, 0xd6, 0xb9, 0x79, 0xf7, 0x1f, 0x49, 0x00, 0x9e, 0x42, 0x77, 0x30, 0xb1, - 0xd9, 0xeb, 0x34, 0xa7, 0x3f, 0x86, 0x25, 0xdb, 0x97, 0x11, 0x72, 0x8c, 0xf1, 0x12, 0x04, 0xba, - 0x03, 0x9d, 0x9c, 0xf6, 0xa4, 0x21, 0x6e, 0x16, 0x33, 0xa4, 0x60, 0x44, 0x0b, 0x32, 0x26, 0xf8, - 0x36, 0xf4, 0xb4, 0xea, 0xcc, 0xf5, 0x82, 0xd9, 0x01, 0xb7, 0x1d, 0xf5, 0x84, 0x34, 0x59, 0xba, - 0xb9, 0xdd, 0x91, 0x8b, 0x7f, 0x80, 0xb6, 0xca, 0x30, 0xd5, 0xf3, 0x75, 0x37, 0x36, 0x4e, 0xec, - 0xc6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0xce, 0x9d, - 0x83, 0xcd, 0xed, 0x63, 0x31, 0xa9, 0x15, 0x7e, 0x37, 0x60, 0x65, 0x3f, 0xc9, 0x43, 0xfd, 0xfe, - 0x11, 0xb4, 0xf4, 0xc8, 0x89, 0xce, 0x97, 0x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a, - 0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a, - 0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb, - 0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5, - 0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f, - 0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98, - 0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55, - 0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd, - 0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58, - 0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6, - 0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00, - 0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00, +var fileDescriptor_demo_e1d03823e14b5fb0 = []byte{ + // 1389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x72, 0xd3, 0xc6, + 0x17, 0x8f, 0x12, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0xd9, 0x7f, 0xc2, 0xdf, 0x28, 0x7c, 0xa4, 0x9b, + 0x81, 0x42, 0x81, 0x94, 0x49, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8, + 0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xda, 0x05, 0xab, 0x44, 0x5a, 0xb1, 0xbb, 0xca, 0xd4, 0x5c, + 0xb6, 0x0f, 0xd0, 0xfb, 0x3e, 0x42, 0x5f, 0xa0, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, + 0x2b, 0xad, 0xbe, 0x62, 0x25, 0xe1, 0xa6, 0x77, 0xda, 0xb3, 0xbf, 0x3d, 0xe7, 0x77, 0xce, 0x9e, + 0x73, 0xf6, 0x08, 0x80, 0xd0, 0x80, 0xed, 0x46, 0x9c, 0x49, 0x86, 0xba, 0x53, 0x3f, 0x12, 0x92, + 0x72, 0x31, 0x65, 0x11, 0xde, 0x87, 0xf6, 0xd0, 0xe5, 0x72, 0x2c, 0x69, 0x80, 0x2e, 0x02, 0x44, + 0x9c, 0x91, 0xd8, 0x93, 0x13, 0x9f, 0x0c, 0xac, 0x6d, 0xeb, 0x5a, 0xc7, 0xe9, 0xa4, 0x92, 0x31, + 0x41, 0x36, 0xb4, 0xdf, 0xc5, 0x6e, 0x28, 0x7d, 0x39, 0x1b, 0x2c,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ed, 0x80, 0x11, 0x8d, 0x09, 0xfe, 0xcd, 0x82, 0x56, + 0x6a, 0x17, 0x5d, 0x81, 0xbe, 0x90, 0x9c, 0x52, 0x39, 0x29, 0xb2, 0xec, 0x38, 0xbd, 0x44, 0x6a, + 0x60, 0x08, 0x1a, 0x9e, 0x69, 0x63, 0x1d, 0x47, 0x7f, 0xab, 0x04, 0x10, 0xd2, 0x95, 0x34, 0xcd, + 0xf7, 0x64, 0xa1, 0x32, 0xdd, 0x63, 0x71, 0x28, 0xf9, 0xcc, 0x64, 0x7a, 0xba, 0x44, 0xe7, 0xa1, + 0xfd, 0xde, 0x8f, 0x26, 0x1e, 0x23, 0x54, 0x27, 0x7a, 0xd3, 0x69, 0xbd, 0xf7, 0xa3, 0x21, 0x23, + 0x14, 0xbf, 0x80, 0xa6, 0x0e, 0x25, 0xda, 0x81, 0x9e, 0x17, 0x73, 0x4e, 0x43, 0x6f, 0x96, 0x00, + 0x13, 0x36, 0x2b, 0x46, 0xa8, 0xd0, 0xca, 0x70, 0x1c, 0xfa, 0x52, 0x68, 0x36, 0x4b, 0x4e, 0xb2, + 0x50, 0xd2, 0xd0, 0x0d, 0x99, 0xd0, 0x74, 0x9a, 0x4e, 0xb2, 0xc0, 0x23, 0xb8, 0x34, 0xa2, 0xf2, + 0x20, 0x8e, 0x22, 0xc6, 0x25, 0x25, 0xc3, 0x44, 0x8f, 0x4f, 0xf3, 0xbc, 0xbc, 0x02, 0xfd, 0x92, + 0x49, 0xd3, 0x10, 0x7a, 0x45, 0x9b, 0x02, 0xff, 0x00, 0xe7, 0x87, 0x99, 0x20, 0x3c, 0xa2, 0x5c, + 0xf8, 0x2c, 0x34, 0x97, 0x7c, 0x15, 0x1a, 0xaf, 0x39, 0x0b, 0x4e, 0xc8, 0x11, 0xbd, 0xaf, 0x5a, + 0x9a, 0x64, 0x89, 0x63, 0x49, 0x24, 0x97, 0x25, 0xd3, 0x01, 0xf8, 0xc7, 0x82, 0xfe, 0x90, 0x53, + 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b, 0x75, + 0xdb, 0x19, 0xd9, 0x3f, 0x2d, 0x58, 0x35, 0xc5, 0x6d, 0xc8, 0xbe, 0x84, 0x73, 0xf3, 0xc7, 0x88, + 0xb9, 0xd7, 0x76, 0xa3, 0x4a, 0xf8, 0x84, 0xf9, 0x03, 0x2f, 0xa0, 0x11, 0xb4, 0x92, 0x91, 0x42, + 0xa2, 0xab, 0xe5, 0x5a, 0xa8, 0x1b, 0x38, 0xec, 0x39, 0xed, 0x1b, 0x2f, 0xec, 0x3d, 0x87, 0xfe, + 0x53, 0x77, 0x16, 0xd0, 0x30, 0xab, 0xe0, 0x21, 0x2c, 0x27, 0x6f, 0x1e, 0xb2, 0xcb, 0x9a, 0x8b, + 0x6f, 0xb0, 0xbd, 0x35, 0x77, 0x2f, 0x0b, 0xc8, 0x14, 0x56, 0xf6, 0x55, 0x8f, 0x32, 0x4a, 0x5f, + 0xa8, 0x5f, 0x82, 0x39, 0xad, 0x1a, 0x5d, 0xaf, 0x64, 0x43, 0x7d, 0x3b, 0xaf, 0xa9, 0xd9, 0x57, + 0xb0, 0x3a, 0x9c, 0x52, 0xef, 0x2d, 0x8b, 0x33, 0x0f, 0x9e, 0x00, 0xe4, 0x9d, 0xad, 0x92, 0xdd, + 0xc7, 0x3a, 0xb9, 0x7d, 0xb9, 0x76, 0xdf, 0x78, 0xf3, 0x6a, 0x59, 0xff, 0xd4, 0x7f, 0xf6, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0xab, 0x01, 0x43, 0xe2, 0x0f, 0x00, 0x00, } diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 63008b9..cceb8e0 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -302,32 +302,6 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque }); err != nil { log.Println(err) } - - if err := fe.emptyCart(r.Context(), sessionID(r)); err != nil { - log.Printf("WARN: failed to empty user (%s) cart after checkout: %+v", sessionID(r), err) - } -} - -func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http.Request) { - streetAddress := r.FormValue("street_address") - city := r.FormValue("city") - state := r.FormValue("state") - country := r.FormValue("country") - zipCode, _ := strconv.ParseInt(r.FormValue("country"), 10, 32) - - log.Printf("[prepareCheckout] session_id=%+v", sessionID(r)) - _, _ = pb.NewCheckoutServiceClient(fe.checkoutSvcConn).CreateOrder(r.Context(), - &pb.CreateOrderRequest{ - UserId: sessionID(r), - UserCurrency: currentCurrency(r), - Address: &pb.Address{ - StreetAddress: streetAddress, - City: city, - State: state, - ZipCode: int32(zipCode), - Country: country, - }, - }) } func (fe *frontendServer) logoutHandler(w http.ResponseWriter, r *http.Request) { From f9fa569d41bed45eed8453783ceb85147bf6fb28 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 00:57:12 -0700 Subject: [PATCH 32/49] checkoutservice: empty cart after order Signed-off-by: Ahmet Alp Balkan --- src/checkoutservice/main.go | 15 +++++++++++++++ src/frontend/templates/footer.html | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 78b4b94..15cf5fa 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -96,6 +96,8 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq return nil, status.Errorf(codes.Unavailable, "shipping error: %+v", err) } + _ = cs.emptyUserCart(ctx, req.UserId) + orderResult := &pb.OrderResult{ OrderId: orderID.String(), ShippingTrackingId: shippingTrackingID, @@ -175,6 +177,19 @@ func (cs *checkoutService) getUserCart(ctx context.Context, userID string) ([]*p return cart.GetItems(), nil } +func (cs *checkoutService) emptyUserCart(ctx context.Context, userID string) error { + conn, err := grpc.DialContext(ctx, cs.cartSvcAddr, grpc.WithInsecure()) + if err != nil { + return fmt.Errorf("could not connect cart service: %+v", err) + } + defer conn.Close() + + if _, err = pb.NewCartServiceClient(conn).EmptyCart(ctx, &pb.EmptyCartRequest{UserId: userID}); err != nil { + return fmt.Errorf("failed to empty user cart during checkout: %+v", err) + } + return nil +} + func (cs *checkoutService) prepOrderItems(ctx context.Context, items []*pb.CartItem, userCurrency string) ([]*pb.OrderItem, error) { out := make([]*pb.OrderItem, len(items)) diff --git a/src/frontend/templates/footer.html b/src/frontend/templates/footer.html index acfdca7..9d94cde 100644 --- a/src/frontend/templates/footer.html +++ b/src/frontend/templates/footer.html @@ -1,6 +1,6 @@ {{ define "footer" }} - This is a demo application. ({{$.session_id}}) + This is a demo application, not a real retail business. ({{$.session_id}}) {{ end }} From 39fd019343c22e36426e1441098d8dfd25af7454 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 01:05:12 -0700 Subject: [PATCH 33/49] k8s: fix emailservice port mapping Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/emailservice.yaml | 2 +- src/cartservice/Dockerfile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kubernetes-manifests/emailservice.yaml b/kubernetes-manifests/emailservice.yaml index 863fe9f..3d08e9d 100644 --- a/kubernetes-manifests/emailservice.yaml +++ b/kubernetes-manifests/emailservice.yaml @@ -31,4 +31,4 @@ spec: app: emailservice ports: - port: 5000 - targetPort: 5000 + targetPort: 8080 diff --git a/src/cartservice/Dockerfile b/src/cartservice/Dockerfile index 6be8c6c..b0578d6 100644 --- a/src/cartservice/Dockerfile +++ b/src/cartservice/Dockerfile @@ -5,4 +5,6 @@ RUN dotnet restore RUN dotnet build RUN dotnet publish WORKDIR /app/bin/Debug/netcoreapp2.0 +ENV PORT 7070 +EXPOSE 7070 ENTRYPOINT ["dotnet", "cartservice.dll", "start"] From c9f2c89b9c6a9cff55c480f235482e1891fb5cbe Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 11:42:12 -0700 Subject: [PATCH 34/49] cartservice: add net-tools to build Signed-off-by: Ahmet Alp Balkan --- src/cartservice/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cartservice/Dockerfile b/src/cartservice/Dockerfile index b0578d6..0180d29 100644 --- a/src/cartservice/Dockerfile +++ b/src/cartservice/Dockerfile @@ -5,6 +5,5 @@ RUN dotnet restore RUN dotnet build RUN dotnet publish WORKDIR /app/bin/Debug/netcoreapp2.0 -ENV PORT 7070 -EXPOSE 7070 +RUN apt update && apt install net-tools telnet ENTRYPOINT ["dotnet", "cartservice.dll", "start"] From 92eb76c1db459a0f92309d0d5ab907ba4b77f955 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 16:53:56 -0700 Subject: [PATCH 35/49] k8s: add frontend dockerfile + skaffold Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/frontend.yaml | 59 ++++++++++++++++++++++++++++++ skaffold.yaml | 2 + src/frontend/Dockerfile | 24 ++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 kubernetes-manifests/frontend.yaml create mode 100644 src/frontend/Dockerfile diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml new file mode 100644 index 0000000..7dbaf7f --- /dev/null +++ b/kubernetes-manifests/frontend.yaml @@ -0,0 +1,59 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: frontend +spec: + template: + metadata: + labels: + app: frontend + spec: + containers: + - name: server + image: frontend + ports: + - containerPort: 8080 + env: + - name: PRODUCT_CATALOG_SERVICE_ADDR + value: "productcatalogservice:3550" + - name: CURRENCY_SERVICE_ADDR + value: "currencyservice:7000" + - name: CART_SERVICE_ADDR + value: "cartservice:7070" + - name: RECOMMENDATION_SERVICE_ADDR + value: "recommendationservice:8080" + - name: SHIPPING_SERVICE_ADDR + value: "shippingservice:50051" + - name: CHECKOUT_SERVICE_ADDR + value: "checkoutservice:5050" + resources: + requests: + cpu: 100m + memory: 64Mi + limits: + cpu: 200m + memory: 128Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend +spec: + type: ClusterIP + selector: + app: frontend + ports: + - port: 80 + targetPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend-external +spec: + type: LoadBalancer + selector: + app: frontend + ports: + - port: 80 + targetPort: 8080 diff --git a/skaffold.yaml b/skaffold.yaml index 366200c..a14c89d 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -18,6 +18,8 @@ build: workspace: src/currencyservice - imageName: cartservice workspace: src/cartservice + - imageName: frontend + workspace: src/frontend deploy: kubectl: manifests: diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile new file mode 100644 index 0000000..61e1604 --- /dev/null +++ b/src/frontend/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:1.10-alpine as builder +RUN apk add --no-cache ca-certificates git +WORKDIR /go/src/frontend +COPY . . + +# download known dependencies +RUN go get -d github.com/google/uuid \ + github.com/gorilla/mux \ + google.golang.org/grpc \ + google.golang.org/grpc/codes \ + google.golang.org/grpc/status + +# other dependencies might not have listed above +RUN go get -d ./... +RUN go build -o /frontend . + +FROM alpine as release +RUN apk add --no-cache ca-certificates +WORKDIR /frontend +COPY --from=builder /frontend /frontend/server +COPY ./templates ./templates +COPY ./static ./static +EXPOSE 8080 +ENTRYPOINT ["/frontend/server"] From 9728803877a37aeafc5a5c5b4fe8e81f9635965b Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 16:54:24 -0700 Subject: [PATCH 36/49] frontend/handlers: wrap err Signed-off-by: Ahmet Alp Balkan --- src/frontend/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index cceb8e0..514f2aa 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -73,7 +73,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { for i, p := range products { price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - renderHTTPError(w, err, http.StatusInternalServerError) + renderHTTPError(w, fmt.Errorf("failed to do currency conversion for product %s: %+v", p.GetId(), err), http.StatusInternalServerError) return } ps[i] = productView{p, price} From 07bb077c10075fc76dd951e7b5b1f3d5849410e2 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 17:09:22 -0700 Subject: [PATCH 37/49] optimize dockerfile caching for go builds Signed-off-by: Ahmet Alp Balkan --- src/checkoutservice/Dockerfile | 7 +++++++ src/productcatalogservice/Dockerfile | 6 ++++++ src/shippingservice/Dockerfile | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/src/checkoutservice/Dockerfile b/src/checkoutservice/Dockerfile index c69a206..ef6e45f 100644 --- a/src/checkoutservice/Dockerfile +++ b/src/checkoutservice/Dockerfile @@ -1,7 +1,14 @@ FROM golang:1.10-alpine as builder RUN apk add --no-cache ca-certificates git WORKDIR /go/src/checkoutservice + +# get known dependencies +RUN go get -d github.com/google/uuid \ + google.golang.org/grpc \ + google.golang.org/grpc/codes \ + google.golang.org/grpc/status COPY . . +# get remaining dependencies RUN go get -d ./... RUN go build -o /checkoutservice . diff --git a/src/productcatalogservice/Dockerfile b/src/productcatalogservice/Dockerfile index b98ee61..1e4d411 100644 --- a/src/productcatalogservice/Dockerfile +++ b/src/productcatalogservice/Dockerfile @@ -3,7 +3,13 @@ RUN apk add --no-cache \ ca-certificates \ git WORKDIR /src/microservices-demo/productcatalogservice +# get known dependencies +RUN go get -d google.golang.org/grpc \ + google.golang.org/grpc/codes \ + google.golang.org/grpc/status + COPY . . +# get remaining dependencies RUN go get -d ./... RUN go build -o /productcatalogservice . diff --git a/src/shippingservice/Dockerfile b/src/shippingservice/Dockerfile index 8d66d35..b2c4c13 100644 --- a/src/shippingservice/Dockerfile +++ b/src/shippingservice/Dockerfile @@ -3,7 +3,12 @@ RUN apk add --no-cache \ ca-certificates \ git WORKDIR /src/microservices-demo/shippingservice +# get known dependencies +RUN go get -d golang.org/x/net/context \ +google.golang.org/grpc \ +google.golang.org/grpc/reflection COPY . . +# get other dependencies RUN go get -d ./... RUN go build -o /shippingservice . From ca6e6647ef5ec61be87e55f82c4999eff2736715 Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Thu, 28 Jun 2018 17:12:33 -0700 Subject: [PATCH 38/49] Refactored the cart service to add more telemetry 1. Added more telemetry around starting redis cache 2. Now if you don't specify redis cache address via command line or environment variable, it will run with local cart (no redis). This is useful for debugging purposes --- src/cartservice/Program.cs | 57 +++++++++++++++------ src/cartservice/cartstore/LocalCartStore.cs | 7 +++ src/cartservice/cartstore/RedisCartStore.cs | 13 +++-- src/cartservice/interfaces/ICartStore.cs | 2 + src/cartservice/scripts/docker_setup.bat | 8 +-- 5 files changed, 63 insertions(+), 24 deletions(-) diff --git a/src/cartservice/Program.cs b/src/cartservice/Program.cs index ead7546..b0a4d1e 100644 --- a/src/cartservice/Program.cs +++ b/src/cartservice/Program.cs @@ -3,6 +3,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; using cartservice.cartstore; +using cartservice.interfaces; using CommandLine; using Grpc.Core; using Microsoft.Extensions.Configuration; @@ -28,22 +29,23 @@ namespace cartservice public string Redis { get; set; } } - static object StartServer(string host, int port, string redisAddress) + static object StartServer(string host, int port, ICartStore cartStore) { // Run the server in a separate thread and make the main thread busy waiting. // The busy wait is because when we run in a container, we can't use techniques such as waiting on user input (Console.Readline()) - Task.Run(() => + Task.Run(async () => { - //var store = new LocalCartStore(); - var store = new RedisCartStore(redisAddress); + Console.WriteLine($"Trying to start a grpc server at {host}:{port}"); Server server = new Server { - Services = { Hipstershop.CartService.BindService(new CartServiceImpl(store)) }, + Services = { Hipstershop.CartService.BindService(new CartServiceImpl(cartStore)) }, Ports = { new ServerPort(host, port, ServerCredentials.Insecure) } }; Console.WriteLine($"Cart server is listening at {host}:{port}"); server.Start(); + + await cartStore.InitializeAsync(); }); // Busy wait to keep the process alive @@ -75,8 +77,8 @@ namespace cartservice hostname = Environment.GetEnvironmentVariable(CART_SERVICE_ADDRESS); if (string.IsNullOrEmpty(hostname)) { - Console.WriteLine($"Environment variable {CART_SERVICE_ADDRESS} was not set. Setting the host to 127.0.0.1"); - hostname = "127.0.0.1"; + Console.WriteLine($"Environment variable {CART_SERVICE_ADDRESS} was not set. Setting the host to 0.0.0.0"); + hostname = "0.0.0.0"; } } @@ -98,19 +100,23 @@ namespace cartservice } // Set redis cache host (hostname+port) - string redis = options.Redis; - if (string.IsNullOrEmpty(redis)) + ICartStore cartStore; + string redis = ReadRedisAddress(options.Redis); + + // Redis was specified via command line or environment variable + if (!string.IsNullOrEmpty(redis)) { - Console.WriteLine($"Reading redis cache address from environment variable {REDIS_ADDRESS}"); - redis = Environment.GetEnvironmentVariable(REDIS_ADDRESS); - if (string.IsNullOrEmpty(redis)) - { - Console.WriteLine("Redis cache host(hostname+port) was not specified. It should be specified via command line or REDIS_ADDRESS environment variable."); - return -1; - } + cartStore = new RedisCartStore(redis); + return StartServer(hostname, port, cartStore); + } + else + { + Console.WriteLine("Redis cache host(hostname+port) was not specified. Starting a cart service using local store"); + Console.WriteLine("If you wanted to use Redis Cache as a backup store, you should provide its address via command line or REDIS_ADDRESS environment variable."); + cartStore = new LocalCartStore(); } - return StartServer(hostname, port, redis); + return StartServer(hostname, port, cartStore); }, errs => 1); break; @@ -119,5 +125,22 @@ namespace cartservice break; } } + + private static string ReadRedisAddress(string address) + { + if (!string.IsNullOrEmpty(address)) + { + return address; + } + + Console.WriteLine($"Reading redis cache address from environment variable {REDIS_ADDRESS}"); + string redis = Environment.GetEnvironmentVariable(REDIS_ADDRESS); + if (!string.IsNullOrEmpty(redis)) + { + return redis; + } + + return null; + } } } diff --git a/src/cartservice/cartstore/LocalCartStore.cs b/src/cartservice/cartstore/LocalCartStore.cs index 3a63de8..7ff5f61 100644 --- a/src/cartservice/cartstore/LocalCartStore.cs +++ b/src/cartservice/cartstore/LocalCartStore.cs @@ -11,6 +11,13 @@ namespace cartservice.cartstore // Maps between user and their cart private ConcurrentDictionary userCartItems = new ConcurrentDictionary(); + public Task InitializeAsync() + { + Console.WriteLine("Local Cart Store was initialized"); + + return Task.CompletedTask; + } + public Task AddItemAsync(string userId, string productId, int quantity) { Console.WriteLine($"AddItemAsync called with userId={userId}, productId={productId}, quantity={quantity}"); diff --git a/src/cartservice/cartstore/RedisCartStore.cs b/src/cartservice/cartstore/RedisCartStore.cs index 87adb2c..50f1f6f 100644 --- a/src/cartservice/cartstore/RedisCartStore.cs +++ b/src/cartservice/cartstore/RedisCartStore.cs @@ -13,9 +13,10 @@ namespace cartservice.cartstore { private const string CART_FIELD_NAME = "cart"; - private readonly ConnectionMultiplexer redis; + private static ConnectionMultiplexer redis; private readonly byte[] emptyCartBytes; + private readonly string connectionString; public RedisCartStore(string redisAddress) { @@ -23,9 +24,15 @@ namespace cartservice.cartstore var cart = new Hipstershop.Cart(); emptyCartBytes = cart.ToByteArray(); - string connectionString = $"{redisAddress},ssl=false,allowAdmin=true"; + connectionString = $"{redisAddress},ssl=false,allowAdmin=true"; + Console.WriteLine($"Going to use Redis cache at this address: {connectionString}"); + } + + public async Task InitializeAsync() + { Console.WriteLine("Connecting to Redis: " + connectionString); - redis = ConnectionMultiplexer.Connect(connectionString); + redis = await ConnectionMultiplexer.ConnectAsync(connectionString, Console.Out); + Console.WriteLine("Connected successfully to Redis"); } public async Task AddItemAsync(string userId, string productId, int quantity) diff --git a/src/cartservice/interfaces/ICartStore.cs b/src/cartservice/interfaces/ICartStore.cs index f4fa1e5..ae9702a 100644 --- a/src/cartservice/interfaces/ICartStore.cs +++ b/src/cartservice/interfaces/ICartStore.cs @@ -4,6 +4,8 @@ namespace cartservice.interfaces { internal interface ICartStore { + Task InitializeAsync(); + Task AddItemAsync(string userId, string productId, int quantity); Task EmptyCartAsync(string userId); diff --git a/src/cartservice/scripts/docker_setup.bat b/src/cartservice/scripts/docker_setup.bat index b841758..f5856a9 100644 --- a/src/cartservice/scripts/docker_setup.bat +++ b/src/cartservice/scripts/docker_setup.bat @@ -9,7 +9,7 @@ GOTO End1 :local set REDIS_PORT=6379 set REDIS_ADDR=localhost:%REDIS_PORT% - set LISTEN_ADDR=127.0.0.1 + set LISTEN_ADDR=0.0.0.0 set PORT=7070 echo running redis emulator locally on a separate window @@ -23,12 +23,12 @@ GOTO End1 :docker_local set REDIS_PORT=6379 - set REDIS_ADDR=redis:%REDIS_PORT% - set LISTEN_ADDR=127.0.0.1 + set REDIS_ADDR=0.0.0.0:%REDIS_PORT% + set LISTEN_ADDR=0.0.0.0 set PORT=7070 echo run docker container with redis - docker run -d --name=redis -p %REDIS_PORT%:%REDIS_PORT% redis + start docker run -d --name=redis -p %REDIS_PORT%:%REDIS_PORT% redis echo building container image for cart service docker build -t cartservice ..\. From ecba29655a04d5f9a5d29b17d8622c8cf71a0126 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 17:55:51 -0700 Subject: [PATCH 39/49] k8s: add liveness/readiness probes Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/cartservice.yaml | 6 ++++++ kubernetes-manifests/checkoutservice.yaml | 8 ++++++++ kubernetes-manifests/currencyservice.yaml | 8 ++++++++ kubernetes-manifests/emailservice.yaml | 10 +++++++++- kubernetes-manifests/paymentservice.yaml | 8 ++++++++ kubernetes-manifests/productcatalogservice.yaml | 8 ++++++++ kubernetes-manifests/recommendationservice.yaml | 8 ++++++++ kubernetes-manifests/redis.yaml | 10 ++++++++++ kubernetes-manifests/shippingservice.yaml | 8 ++++++++ 9 files changed, 73 insertions(+), 1 deletion(-) diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml index daca526..7d3f564 100644 --- a/kubernetes-manifests/cartservice.yaml +++ b/kubernetes-manifests/cartservice.yaml @@ -27,6 +27,12 @@ spec: limits: cpu: 300m memory: 128Mi + readinessProbe: + tcpSocket: + port: 7070 + livenessProbe: + tcpSocket: + port: 7070 --- apiVersion: v1 kind: Service diff --git a/kubernetes-manifests/checkoutservice.yaml b/kubernetes-manifests/checkoutservice.yaml index 5bc6ec9..39036d9 100644 --- a/kubernetes-manifests/checkoutservice.yaml +++ b/kubernetes-manifests/checkoutservice.yaml @@ -13,6 +13,14 @@ spec: image: checkoutservice ports: - containerPort: 5050 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 5050 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 5050 env: - name: PRODUCT_CATALOG_SERVICE_ADDR value: "productcatalogservice:3550" diff --git a/kubernetes-manifests/currencyservice.yaml b/kubernetes-manifests/currencyservice.yaml index 467f5d5..fc7911a 100644 --- a/kubernetes-manifests/currencyservice.yaml +++ b/kubernetes-manifests/currencyservice.yaml @@ -13,6 +13,14 @@ spec: image: currencyservice ports: - containerPort: 31337 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 31337 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 31337 resources: requests: cpu: 100m diff --git a/kubernetes-manifests/emailservice.yaml b/kubernetes-manifests/emailservice.yaml index 3d08e9d..9a4d166 100644 --- a/kubernetes-manifests/emailservice.yaml +++ b/kubernetes-manifests/emailservice.yaml @@ -12,7 +12,15 @@ spec: - name: server image: emailservice ports: - - containerPort: 5000 + - containerPort: 8080 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 8080 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 8080 resources: requests: cpu: 100m diff --git a/kubernetes-manifests/paymentservice.yaml b/kubernetes-manifests/paymentservice.yaml index 389484e..8ed2092 100644 --- a/kubernetes-manifests/paymentservice.yaml +++ b/kubernetes-manifests/paymentservice.yaml @@ -13,6 +13,14 @@ spec: image: paymentservice ports: - containerPort: 50051 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 50051 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 50051 resources: requests: cpu: 100m diff --git a/kubernetes-manifests/productcatalogservice.yaml b/kubernetes-manifests/productcatalogservice.yaml index ff1cc11..2d19b6a 100644 --- a/kubernetes-manifests/productcatalogservice.yaml +++ b/kubernetes-manifests/productcatalogservice.yaml @@ -13,6 +13,14 @@ spec: image: productcatalogservice ports: - containerPort: 3550 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 3550 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 3550 resources: requests: cpu: 100m diff --git a/kubernetes-manifests/recommendationservice.yaml b/kubernetes-manifests/recommendationservice.yaml index aeff8d1..dcc37a0 100644 --- a/kubernetes-manifests/recommendationservice.yaml +++ b/kubernetes-manifests/recommendationservice.yaml @@ -13,6 +13,14 @@ spec: image: recommendationservice ports: - containerPort: 8080 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 8080 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 8080 env: - name: PRODUCT_CATALOG_SERVICE_ADDR value: "productcatalogservice:3550" diff --git a/kubernetes-manifests/redis.yaml b/kubernetes-manifests/redis.yaml index 0a33116..ed7697f 100644 --- a/kubernetes-manifests/redis.yaml +++ b/kubernetes-manifests/redis.yaml @@ -11,6 +11,16 @@ spec: containers: - name: redis image: redis:alpine + ports: + - containerPort: 6379 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 6379 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 6379 volumeMounts: - mountPath: /data name: redis-data diff --git a/kubernetes-manifests/shippingservice.yaml b/kubernetes-manifests/shippingservice.yaml index 8740390..c0e7bda 100644 --- a/kubernetes-manifests/shippingservice.yaml +++ b/kubernetes-manifests/shippingservice.yaml @@ -13,6 +13,14 @@ spec: image: shippingservice ports: - containerPort: 50051 + readinessProbe: + periodSeconds: 5 + tcpSocket: + port: 50051 + livenessProbe: + periodSeconds: 5 + tcpSocket: + port: 50051 resources: requests: cpu: 100m From 1ae5e7737a97365f65608e3e82c22fc982c5206c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 18:15:05 -0700 Subject: [PATCH 40/49] frontend: add liveness/readiness probes Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/frontend.yaml | 10 ++++++++++ src/frontend/main.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml index 7dbaf7f..64eb005 100644 --- a/kubernetes-manifests/frontend.yaml +++ b/kubernetes-manifests/frontend.yaml @@ -13,6 +13,16 @@ spec: image: frontend ports: - containerPort: 8080 + readinessProbe: + initialDelaySeconds: 10 + httpGet: + path: "/" + port: 8080 + livenessProbe: + initialDelaySeconds: 10 + httpGet: + path: "/" + port: 8080 env: - name: PRODUCT_CATALOG_SERVICE_ADDR value: "productcatalogservice:3550" diff --git a/src/frontend/main.go b/src/frontend/main.go index 763dc3b..f14f755 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -101,7 +101,7 @@ func main() { r.HandleFunc("/cart/checkout", ensureSessionID(svc.placeOrderHandler)).Methods(http.MethodPost) r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))) log.Printf("starting server on :" + srvPort) - log.Fatal(http.ListenAndServe("localhost:"+srvPort, r)) + log.Fatal(http.ListenAndServe(":"+srvPort, r)) } func mustMapEnv(target *string, envKey string) { From 59063ff44a76d051a3360dcf54b58c78d0be8d8a Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 18:34:48 -0700 Subject: [PATCH 41/49] k8s: add terminationGracePeriodSeconds to some Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/currencyservice.yaml | 1 + kubernetes-manifests/emailservice.yaml | 1 + kubernetes-manifests/frontend.yaml | 8 +++++++- kubernetes-manifests/paymentservice.yaml | 1 + kubernetes-manifests/productcatalogservice.yaml | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kubernetes-manifests/currencyservice.yaml b/kubernetes-manifests/currencyservice.yaml index fc7911a..4a4dc64 100644 --- a/kubernetes-manifests/currencyservice.yaml +++ b/kubernetes-manifests/currencyservice.yaml @@ -8,6 +8,7 @@ spec: labels: app: currencyservice spec: + terminationGracePeriodSeconds: 5 containers: - name: server image: currencyservice diff --git a/kubernetes-manifests/emailservice.yaml b/kubernetes-manifests/emailservice.yaml index 9a4d166..76dbf07 100644 --- a/kubernetes-manifests/emailservice.yaml +++ b/kubernetes-manifests/emailservice.yaml @@ -8,6 +8,7 @@ spec: labels: app: emailservice spec: + terminationGracePeriodSeconds: 5 containers: - name: server image: emailservice diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml index 64eb005..a09742e 100644 --- a/kubernetes-manifests/frontend.yaml +++ b/kubernetes-manifests/frontend.yaml @@ -18,11 +18,17 @@ spec: httpGet: path: "/" port: 8080 + httpHeaders: + - name: "Cookie" + value: "shop_session-id=x-readiness-probe" livenessProbe: initialDelaySeconds: 10 httpGet: path: "/" port: 8080 + httpHeaders: + - name: "Cookie" + value: "shop_session-id=x-liveness-probe" env: - name: PRODUCT_CATALOG_SERVICE_ADDR value: "productcatalogservice:3550" @@ -65,5 +71,5 @@ spec: selector: app: frontend ports: - - port: 80 + - port: 8081 targetPort: 8080 diff --git a/kubernetes-manifests/paymentservice.yaml b/kubernetes-manifests/paymentservice.yaml index 8ed2092..d9863c2 100644 --- a/kubernetes-manifests/paymentservice.yaml +++ b/kubernetes-manifests/paymentservice.yaml @@ -8,6 +8,7 @@ spec: labels: app: paymentservice spec: + terminationGracePeriodSeconds: 5 containers: - name: server image: paymentservice diff --git a/kubernetes-manifests/productcatalogservice.yaml b/kubernetes-manifests/productcatalogservice.yaml index 2d19b6a..7ceaca8 100644 --- a/kubernetes-manifests/productcatalogservice.yaml +++ b/kubernetes-manifests/productcatalogservice.yaml @@ -8,6 +8,7 @@ spec: labels: app: productcatalogservice spec: + terminationGracePeriodSeconds: 5 containers: - name: server image: productcatalogservice From 4f631ce4f6fc3217b3797c9cb6f6ec36fc5beb82 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 18:37:16 -0700 Subject: [PATCH 42/49] currencyservice: less logs Signed-off-by: Ahmet Alp Balkan --- src/currencyservice/server.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/currencyservice/server.js b/src/currencyservice/server.js index 7cd6539..bd8f7f0 100644 --- a/src/currencyservice/server.js +++ b/src/currencyservice/server.js @@ -53,7 +53,6 @@ function _getCurrencyData (callback) { }); }); } else { - console.log('Using cached currency data...'); callback(_data); } } @@ -83,7 +82,7 @@ function getSupportedCurrencies (call, callback) { * Converts between currencies */ function convert (call, callback) { - console.log('Starting conversion request...'); + console.log('received conversion request'); try { _getCurrencyData((data) => { const request = call.request; @@ -107,11 +106,11 @@ function convert (call, callback) { result.nanos = Math.floor(result.nanos) result.currency_code = request.to_code; - console.log(`Conversion request successful ${result.nanos}..${result.nanos}`); + console.log(`conversion request successful`); callback(null, result); }); } catch (err) { - console.error('Conversion request failed.'); + console.error('conversion request failed.'); console.error(err); callback(err.message); } From c84c5b028b8c408baf98f32023761454b8bc1efe Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Thu, 28 Jun 2018 18:40:22 -0700 Subject: [PATCH 43/49] Changed redis connection opening to be synchronous call Also added exception handling for GetCartAsync --- src/cartservice/scripts/docker_setup.bat | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cartservice/scripts/docker_setup.bat b/src/cartservice/scripts/docker_setup.bat index f5856a9..b302cf1 100644 --- a/src/cartservice/scripts/docker_setup.bat +++ b/src/cartservice/scripts/docker_setup.bat @@ -23,12 +23,13 @@ GOTO End1 :docker_local set REDIS_PORT=6379 - set REDIS_ADDR=0.0.0.0:%REDIS_PORT% + set REDIS_ADDR=redis:%REDIS_PORT% set LISTEN_ADDR=0.0.0.0 set PORT=7070 echo run docker container with redis - start docker run -d --name=redis -p %REDIS_PORT%:%REDIS_PORT% redis + docker rm --force redis + start "" docker run -d --name=redis -p %REDIS_PORT%:%REDIS_PORT% redis echo building container image for cart service docker build -t cartservice ..\. From 319e9478c02628cabdbbfd59bf5c810074ab1d77 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 18:46:58 -0700 Subject: [PATCH 44/49] frontend: optimize dockerfile Signed-off-by: Ahmet Alp Balkan --- src/frontend/Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile index 61e1604..4b48d10 100644 --- a/src/frontend/Dockerfile +++ b/src/frontend/Dockerfile @@ -1,23 +1,29 @@ FROM golang:1.10-alpine as builder RUN apk add --no-cache ca-certificates git WORKDIR /go/src/frontend -COPY . . -# download known dependencies +# fetch known dependencies for caching RUN go get -d github.com/google/uuid \ github.com/gorilla/mux \ google.golang.org/grpc \ google.golang.org/grpc/codes \ google.golang.org/grpc/status -# other dependencies might not have listed above +# copy go-only part of the build +COPY *.go ./ +COPY ./genproto ./genproto +COPY ./money ./money + +# fetch other dependencies might not have listed above (ideally noop) RUN go get -d ./... -RUN go build -o /frontend . +RUN go install . + +# --- FROM alpine as release RUN apk add --no-cache ca-certificates WORKDIR /frontend -COPY --from=builder /frontend /frontend/server +COPY --from=builder /go/bin/frontend /frontend/server COPY ./templates ./templates COPY ./static ./static EXPOSE 8080 From 7e252c7d8f6d6623cc735e0b3c675f2e23d958bd Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 20:10:06 -0700 Subject: [PATCH 45/49] k8s: add termination grace to recommendationservice Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/recommendationservice.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/kubernetes-manifests/recommendationservice.yaml b/kubernetes-manifests/recommendationservice.yaml index dcc37a0..cb25c73 100644 --- a/kubernetes-manifests/recommendationservice.yaml +++ b/kubernetes-manifests/recommendationservice.yaml @@ -8,6 +8,7 @@ spec: labels: app: recommendationservice spec: + terminationGracePeriodSeconds: 5 containers: - name: server image: recommendationservice From fdc946ad324e7a68f251edf9c5cccf412c46478b Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 20:18:53 -0700 Subject: [PATCH 46/49] skaffold: set tag policy gitCommit Signed-off-by: Ahmet Alp Balkan --- skaffold.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skaffold.yaml b/skaffold.yaml index a14c89d..45f2fa6 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -1,6 +1,8 @@ apiVersion: skaffold/v1alpha2 kind: Config build: + tagPolicy: + gitCommit: {} artifacts: - imageName: emailservice workspace: src/emailservice From 386f4975537f2e8a7a41a8306733721baadab0de Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 21:45:57 -0700 Subject: [PATCH 47/49] cartservice: dockerfile optimizations Signed-off-by: Ahmet Alp Balkan --- src/cartservice/Dockerfile | 12 ++++++------ src/frontend/Dockerfile | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cartservice/Dockerfile b/src/cartservice/Dockerfile index 0180d29..5440770 100644 --- a/src/cartservice/Dockerfile +++ b/src/cartservice/Dockerfile @@ -1,9 +1,9 @@ FROM gcr.io/google-appengine/aspnetcore:2.1.0 -COPY . /app -WORKDIR /app -RUN dotnet restore -RUN dotnet build -RUN dotnet publish -WORKDIR /app/bin/Debug/netcoreapp2.0 RUN apt update && apt install net-tools telnet +WORKDIR /app +COPY . . +RUN dotnet restore && \ + dotnet build \ + dotnet publish +WORKDIR /app/bin/Debug/netcoreapp2.0 ENTRYPOINT ["dotnet", "cartservice.dll", "start"] diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile index 4b48d10..d3271fe 100644 --- a/src/frontend/Dockerfile +++ b/src/frontend/Dockerfile @@ -5,6 +5,7 @@ WORKDIR /go/src/frontend # fetch known dependencies for caching RUN go get -d github.com/google/uuid \ github.com/gorilla/mux \ + github.com/pkg/errors \ google.golang.org/grpc \ google.golang.org/grpc/codes \ google.golang.org/grpc/status From f8ddac9c523c18eb4662191d66b2b7ddc43bc863 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 21:46:48 -0700 Subject: [PATCH 48/49] cartservice: add try catch to GetCartAsync Signed-off-by: Ahmet Alp Balkan --- src/cartservice/cartstore/RedisCartStore.cs | 23 ++++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/cartservice/cartstore/RedisCartStore.cs b/src/cartservice/cartstore/RedisCartStore.cs index 50f1f6f..ddf73dd 100644 --- a/src/cartservice/cartstore/RedisCartStore.cs +++ b/src/cartservice/cartstore/RedisCartStore.cs @@ -81,18 +81,25 @@ namespace cartservice.cartstore public async Task GetCartAsync(string userId) { Console.WriteLine($"GetCartAsync called with userId={userId}"); - var db = redis.GetDatabase(); - - // Access the cart from the cache - var value = await db.HashGetAsync(userId, CART_FIELD_NAME); - - if (!value.IsNull) + try { - return Hipstershop.Cart.Parser.ParseFrom(value); + var db = redis.GetDatabase(); + + // Access the cart from the cache + var value = await db.HashGetAsync(userId, CART_FIELD_NAME); + + if (!value.IsNull) + { + return Hipstershop.Cart.Parser.ParseFrom(value); + } + } + catch (Exception e) + { + Console.WriteLine(e); } // We decided to return empty cart in cases when user wasn't in the cache before return new Hipstershop.Cart(); } } -} \ No newline at end of file +} From ca3ace3f6525e1670accae7e576a09449a34894c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 22:03:39 -0700 Subject: [PATCH 49/49] frontend: use pkg/errors, show full stacktrace Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/cartservice.yaml | 4 +++ src/cartservice/Dockerfile | 2 +- src/frontend/handlers.go | 51 ++++++++++++++------------- src/frontend/main.go | 47 +++++++++++------------- src/frontend/rpc.go | 16 ++------- src/frontend/templates/error.html | 2 +- 6 files changed, 56 insertions(+), 66 deletions(-) diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml index 7d3f564..a0d24f6 100644 --- a/kubernetes-manifests/cartservice.yaml +++ b/kubernetes-manifests/cartservice.yaml @@ -20,6 +20,10 @@ spec: value: "7070" - name: LISTEN_ADDR value: "0.0.0.0" + - name: GRPC_TRACE + value: "all" + - name: GRPC_VERBOSITY + value: "debug" resources: requests: cpu: 200m diff --git a/src/cartservice/Dockerfile b/src/cartservice/Dockerfile index 5440770..dd8993c 100644 --- a/src/cartservice/Dockerfile +++ b/src/cartservice/Dockerfile @@ -3,7 +3,7 @@ RUN apt update && apt install net-tools telnet WORKDIR /app COPY . . RUN dotnet restore && \ - dotnet build \ + dotnet build && \ dotnet publish WORKDIR /app/bin/Debug/netcoreapp2.0 ENTRYPOINT ["dotnet", "cartservice.dll", "start"] diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index 514f2aa..6bf45b0 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -12,6 +12,7 @@ import ( "github.com/google/uuid" "github.com/gorilla/mux" + "github.com/pkg/errors" pb "frontend/genproto" ) @@ -36,7 +37,7 @@ func ensureSessionID(next http.HandlerFunc) http.HandlerFunc { MaxAge: cookieMaxAge, }) } else if err != nil { - renderHTTPError(w, fmt.Errorf("unrecognized cookie error: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "unrecognized cookie error"), http.StatusInternalServerError) return } else { sessionID = c.Value @@ -51,17 +52,17 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { log.Printf("[home] session_id=%s currency=%s", sessionID(r), currentCurrency(r)) currencies, err := fe.getCurrencies(r.Context()) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve currencies"), http.StatusInternalServerError) return } products, err := fe.getProducts(r.Context()) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve products: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve products"), http.StatusInternalServerError) return } cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve cart"), http.StatusInternalServerError) return } @@ -73,7 +74,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { for i, p := range products { price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("failed to do currency conversion for product %s: %+v", p.GetId(), err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrapf(err, "failed to do currency conversion for product %s", p.GetId()), http.StatusInternalServerError) return } ps[i] = productView{p, price} @@ -93,36 +94,36 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] if id == "" { - renderHTTPError(w, fmt.Errorf("product id not specified"), http.StatusBadRequest) + renderHTTPError(w, errors.New("product id not specified"), http.StatusBadRequest) return } log.Printf("[productHandler] id=%s currency=%s session=%s", id, currentCurrency(r), sessionID(r)) p, err := fe.getProduct(r.Context(), id) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve product: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve product"), http.StatusInternalServerError) return } currencies, err := fe.getCurrencies(r.Context()) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve currencies"), http.StatusInternalServerError) return } cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve cart"), http.StatusInternalServerError) return } price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("failed to convert currency: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to convert currency"), http.StatusInternalServerError) return } recommendations, err := fe.getRecommendations(r.Context(), sessionID(r), []string{id}) if err != nil { - renderHTTPError(w, fmt.Errorf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to get product recommendations"), http.StatusInternalServerError) return } @@ -147,19 +148,19 @@ func (fe *frontendServer) addToCartHandler(w http.ResponseWriter, r *http.Reques quantity, _ := strconv.ParseUint(r.FormValue("quantity"), 10, 32) productID := r.FormValue("product_id") if productID == "" || quantity == 0 { - renderHTTPError(w, fmt.Errorf("invalid form input"), http.StatusBadRequest) + renderHTTPError(w, errors.New("invalid form input"), http.StatusBadRequest) return } log.Printf("[addToCart] product_id=%s qty=%d session_id=%s", productID, quantity, sessionID(r)) p, err := fe.getProduct(r.Context(), productID) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve product: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve product"), http.StatusInternalServerError) return } if err := fe.insertCart(r.Context(), sessionID(r), p.GetId(), int32(quantity)); err != nil { - renderHTTPError(w, fmt.Errorf("failed to add to cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to add to cart"), http.StatusInternalServerError) return } w.Header().Set("location", "/cart") @@ -170,7 +171,7 @@ func (fe *frontendServer) emptyCartHandler(w http.ResponseWriter, r *http.Reques log.Printf("[emptyCart] session_id=%s", sessionID(r)) if err := fe.emptyCart(r.Context(), sessionID(r)); err != nil { - renderHTTPError(w, fmt.Errorf("failed to empty cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to empty cart"), http.StatusInternalServerError) return } w.Header().Set("location", "/") @@ -181,24 +182,24 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request log.Printf("[viewCart] session_id=%s", sessionID(r)) currencies, err := fe.getCurrencies(r.Context()) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve currencies: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve currencies"), http.StatusInternalServerError) return } cart, err := fe.getCart(r.Context(), sessionID(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve cart: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "could not retrieve cart"), http.StatusInternalServerError) return } recommendations, err := fe.getRecommendations(r.Context(), sessionID(r), cartIDs(cart)) if err != nil { - renderHTTPError(w, fmt.Errorf("failed to get product recommendations: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to get product recommendations"), http.StatusInternalServerError) return } shippingCost, err := fe.getShippingQuote(r.Context(), cart, currentCurrency(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("failed to get shipping quote: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to get shipping quote"), http.StatusInternalServerError) return } @@ -212,12 +213,12 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request for i, item := range cart { p, err := fe.getProduct(r.Context(), item.GetProductId()) if err != nil { - renderHTTPError(w, fmt.Errorf("could not retrieve product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrapf(err, "could not retrieve product #%s", item.GetProductId()), http.StatusInternalServerError) return } price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r)) if err != nil { - renderHTTPError(w, fmt.Errorf("could not convert currency for product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrapf(err, "could not convert currency for product #%s", item.GetProductId()), http.StatusInternalServerError) return } @@ -280,7 +281,7 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque Country: country}, }) if err != nil { - renderHTTPError(w, fmt.Errorf("failed to complete the order: %+v", err), http.StatusInternalServerError) + renderHTTPError(w, errors.Wrap(err, "failed to complete the order"), http.StatusInternalServerError) return } log.Printf("order #%s completed", order.GetOrder().GetOrderId()) @@ -334,10 +335,12 @@ func (fe *frontendServer) setCurrencyHandler(w http.ResponseWriter, r *http.Requ } func renderHTTPError(w http.ResponseWriter, err error, code int) { - log.Printf("[error] %+v (code=%d)", err, code) + log.Printf("[error](code=%d) %+v ", code, err) + errMsg := fmt.Sprintf("%+v", err) + w.WriteHeader(code) templates.ExecuteTemplate(w, "error", map[string]interface{}{ - "error": err.Error(), + "error": errMsg, "status_code": code, "status": http.StatusText(code)}) } diff --git a/src/frontend/main.go b/src/frontend/main.go index f14f755..dcbe399 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -6,6 +6,9 @@ import ( "log" "net/http" "os" + "time" + + "github.com/pkg/errors" "github.com/gorilla/mux" "google.golang.org/grpc" @@ -56,6 +59,7 @@ func main() { if os.Getenv("PORT") != "" { srvPort = os.Getenv("PORT") } + addr := os.Getenv("LISTEN_ADDR") svc := new(frontendServer) mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR") mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR") @@ -64,31 +68,12 @@ func main() { mustMapEnv(&svc.checkoutSvcAddr, "CHECKOUT_SERVICE_ADDR") mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR") - var err error - svc.currencySvcConn, err = grpc.DialContext(ctx, svc.currencySvcAddr, grpc.WithInsecure()) - if err != nil { - log.Fatalf("failed to connect currency service: %+v", err) - } - svc.productCatalogSvcConn, err = grpc.DialContext(ctx, svc.productCatalogSvcAddr, grpc.WithInsecure()) - if err != nil { - log.Fatalf("failed to connect productcatalog service: %+v", err) - } - svc.cartSvcConn, err = grpc.DialContext(ctx, svc.cartSvcAddr, grpc.WithInsecure()) - if err != nil { - log.Fatalf("failed to connect cart service at %s: %+v", svc.cartSvcAddr, err) - } - svc.recommendationSvcConn, err = grpc.DialContext(ctx, svc.recommendationSvcAddr, grpc.WithInsecure()) - if err != nil { - log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcAddr, err) - } - svc.shippingSvcConn, err = grpc.DialContext(ctx, svc.shippingSvcAddr, grpc.WithInsecure()) - if err != nil { - log.Fatalf("failed to connect shipping service at %s: %+v", svc.shippingSvcAddr, err) - } - svc.checkoutSvcConn, err = grpc.DialContext(ctx, svc.checkoutSvcAddr, grpc.WithInsecure()) - if err != nil { - log.Fatalf("failed to connect checkout service at %s: %+v", svc.checkoutSvcAddr, err) - } + mustConnGRPC(ctx, &svc.currencySvcConn, svc.currencySvcAddr) + mustConnGRPC(ctx, &svc.productCatalogSvcConn, svc.productCatalogSvcAddr) + mustConnGRPC(ctx, &svc.cartSvcConn, svc.cartSvcAddr) + mustConnGRPC(ctx, &svc.recommendationSvcConn, svc.recommendationSvcAddr) + mustConnGRPC(ctx, &svc.shippingSvcConn, svc.shippingSvcAddr) + mustConnGRPC(ctx, &svc.checkoutSvcConn, svc.checkoutSvcAddr) r := mux.NewRouter() r.HandleFunc("/", ensureSessionID(svc.homeHandler)).Methods(http.MethodGet, http.MethodHead) @@ -100,8 +85,8 @@ func main() { r.HandleFunc("/logout", svc.logoutHandler).Methods(http.MethodGet) r.HandleFunc("/cart/checkout", ensureSessionID(svc.placeOrderHandler)).Methods(http.MethodPost) r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))) - log.Printf("starting server on :" + srvPort) - log.Fatal(http.ListenAndServe(":"+srvPort, r)) + log.Printf("starting server on " + addr + ":" + srvPort) + log.Fatal(http.ListenAndServe(addr+":"+srvPort, r)) } func mustMapEnv(target *string, envKey string) { @@ -111,3 +96,11 @@ func mustMapEnv(target *string, envKey string) { } *target = v } + +func mustConnGRPC(ctx context.Context, conn **grpc.ClientConn, addr string) { + var err error + *conn, err = grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithTimeout(time.Second*3)) + if err != nil { + panic(errors.Wrapf(err, "grpc: failed to connect %s", addr)) + } +} diff --git a/src/frontend/rpc.go b/src/frontend/rpc.go index 00657f3..1008241 100644 --- a/src/frontend/rpc.go +++ b/src/frontend/rpc.go @@ -2,13 +2,10 @@ package main import ( "context" - "fmt" - - "google.golang.org/grpc/codes" pb "frontend/genproto" - "google.golang.org/grpc/status" + "github.com/pkg/errors" ) const ( @@ -44,10 +41,6 @@ func (fe *frontendServer) getProduct(ctx context.Context, id string) (*pb.Produc func (fe *frontendServer) getCart(ctx context.Context, userID string) ([]*pb.CartItem, error) { resp, err := pb.NewCartServiceClient(fe.cartSvcConn).GetCart(ctx, &pb.GetCartRequest{UserId: userID}) - if status.Code(err) == codes.Canceled { - // TODO(ahmetb) remove this workaround when cartservice returns ok response to GetCart() with non-existing users - return nil, nil - } return resp.GetItems(), err } @@ -85,10 +78,7 @@ func (fe *frontendServer) getShippingQuote(ctx context.Context, items []*pb.Cart return nil, err } localized, err := fe.convertCurrency(ctx, quote.GetCostUsd(), currency) - if err != nil { - return nil, fmt.Errorf("failed to convert currency for shipping cost: %+v", err) - } - return localized, nil + return localized, errors.Wrap(err, "failed to convert currency for shipping cost") } func (fe *frontendServer) getRecommendations(ctx context.Context, userID string, productIDs []string) ([]*pb.Product, error) { @@ -101,7 +91,7 @@ func (fe *frontendServer) getRecommendations(ctx context.Context, userID string, for i, v := range resp.GetProductIds() { p, err := fe.getProduct(ctx, v) if err != nil { - return nil, fmt.Errorf("failed to get recommended product info (#%s): %+v", v, err) + return nil, errors.Wrapf(err, "failed to get recommended product info (#%s)", v) } out[i] = p } diff --git a/src/frontend/templates/error.html b/src/frontend/templates/error.html index 24e167a..ce8baaa 100644 --- a/src/frontend/templates/error.html +++ b/src/frontend/templates/error.html @@ -8,7 +8,7 @@

Something has failed. Below are some details for debugging.

HTTP Status: {{.status_code}} {{.status}}

-
                     {{- .error -}}