Skip to content

Commit

Permalink
Shipping fee to be a flat rate (#694)
Browse files Browse the repository at this point in the history
* quoteByCoutnFloat returns flat rate

* Fix to the test quote
  • Loading branch information
xtineskim authored Jan 20, 2022
1 parent e1c04f8 commit af0515f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/shippingservice/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,5 @@ func quoteByCountFloat(count int) float64 {
if count == 0 {
return 0
}
count64 := float64(count)
var p = 1 + (count64 * 0.2)
return count64 + math.Pow(3, p)
return 8.99
}
2 changes: 1 addition & 1 deletion src/shippingservice/shippingservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestGetQuote(t *testing.T) {
if err != nil {
t.Errorf("TestGetQuote (%v) failed", err)
}
if res.CostUsd.GetUnits() != 11 || res.CostUsd.GetNanos() != 220000000 {
if res.CostUsd.GetUnits() != 8 || res.CostUsd.GetNanos() != 990000000 {
t.Errorf("TestGetQuote: Quote value '%d.%d' does not match expected '%s'", res.CostUsd.GetUnits(), res.CostUsd.GetNanos(), "11.220000000")
}
}
Expand Down

0 comments on commit af0515f

Please sign in to comment.