Skip to content

Commit 6bbe8cc

Browse files
Remove "Free Shipping" Banner (GoogleCloudPlatform#800)
* testing shipping quote * removed navbar from header * removed css for navbar * removed shipping fee returning 0 * test to check if we can obtain the price * removed logic that counts the number of items in the cart * set count variable back to int * Removed quoteByCountFloat since it does not need to calculate the items and shipping fee * comment change to numbering in GetQuote
1 parent 289f023 commit 6bbe8cc

File tree

4 files changed

+5
-29
lines changed

4 files changed

+5
-29
lines changed

src/frontend/static/styles/styles.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ header .cart-size-circle {
7171
background-color: #853B5C;
7272
}
7373

74-
header .navbar {
75-
padding-top: 5px;
76-
padding-bottom: 5px;
77-
}
78-
7974
header .h-free-shipping {
8075
font-size: 14px;
8176
}

src/frontend/templates/header.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
4646

4747
<body>
4848
<header>
49-
<div class="navbar">
50-
<div class="container d-flex justify-content-center">
51-
<div class="h-free-shipping">Free shipping with $75 purchase!</div>
52-
</div>
53-
</div>
5449
<div class="navbar sub-navbar">
5550
<div class="container d-flex justify-content-between">
5651
<a href="/" class="navbar-brand d-flex align-items-center">

src/shippingservice/main.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,10 @@ func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQ
120120
log.Info("[GetQuote] received request")
121121
defer log.Info("[GetQuote] completed request")
122122

123-
// 1. Our quote system requires the total number of items to be shipped.
124-
count := 0
125-
for _, item := range in.Items {
126-
count += int(item.Quantity)
127-
}
128-
129-
// 2. Generate a quote based on the total number of items to be shipped.
130-
quote := CreateQuoteFromCount(count)
123+
// 1. Generate a quote based on the total number of items to be shipped.
124+
quote := CreateQuoteFromCount(0)
131125

132-
// 3. Generate a response.
126+
// 2. Generate a response.
133127
return &pb.GetQuoteResponse{
134128
CostUsd: &pb.Money{
135129
CurrencyCode: "USD",

src/shippingservice/quote.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (q Quote) String() string {
3232

3333
// CreateQuoteFromCount takes a number of items and returns a Price struct.
3434
func CreateQuoteFromCount(count int) Quote {
35-
return CreateQuoteFromFloat(quoteByCountFloat(count))
35+
return CreateQuoteFromFloat(8.99)
3636
}
3737

3838
// CreateQuoteFromFloat takes a price represented as a float and creates a Price struct.
@@ -42,12 +42,4 @@ func CreateQuoteFromFloat(value float64) Quote {
4242
uint32(units),
4343
uint32(math.Trunc(fraction * 100)),
4444
}
45-
}
46-
47-
// quoteByCountFloat takes a number of items and generates a price quote represented as a float.
48-
func quoteByCountFloat(count int) float64 {
49-
if count == 0 {
50-
return 0
51-
}
52-
return 8.99
53-
}
45+
}

0 commit comments

Comments
 (0)