Skip to content

Commit

Permalink
breaking changes to Address in proto
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
  • Loading branch information
ahmetb authored and Simon Zeltser committed Jun 29, 2018
1 parent e9826f5 commit 6f10ac9
Show file tree
Hide file tree
Showing 9 changed files with 563 additions and 567 deletions.
6 changes: 3 additions & 3 deletions pb/demo.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
269 changes: 134 additions & 135 deletions src/checkoutservice/genproto/demo.pb.go

Large diffs are not rendered by default.

269 changes: 134 additions & 135 deletions src/frontend/genproto/demo.pb.go

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/frontend/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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,
},
})
}
Expand Down
269 changes: 134 additions & 135 deletions src/shippingservice/genproto/demo.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/shippingservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions src/shippingservice/shippingservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
{
Expand Down Expand Up @@ -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{
{
Expand Down
269 changes: 134 additions & 135 deletions src/test-cli/genproto/demo.pb.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/test-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
{
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 6f10ac9

Please sign in to comment.