store: orders API now checks if customer is ready #3501

Merged
merged 2 commits into from Jul 10, 2017

Conversation

Projects
None yet
5 participants
Contributor

cjwatson commented Jun 20, 2017

The store's orders endpoint now checks that the customer exists, has a
payment method, and has accepted the terms of service, so store.Buy no
longer needs to make a separate request to confirm this.

I removed "store reported an error: " from storeErrors.Error, because
"cannot buy snap: server says not found: store reported an error: Snap
package not found" was getting a bit excessive.

store: orders API now checks if customer is ready
The store's orders endpoint now checks that the customer exists, has a
payment method, and has accepted the terms of service, so `store.Buy` no
longer needs to make a separate request to confirm this.

I removed "store reported an error: " from `storeErrors.Error`, because
"cannot buy snap: server says not found: store reported an error: Snap
package not found" was getting a bit excessive.

codecov-io commented Jun 20, 2017

Codecov Report

Merging #3501 into master will decrease coverage by 0.4%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3501      +/-   ##
==========================================
- Coverage   77.18%   76.78%   -0.41%     
==========================================
  Files         377      379       +2     
  Lines       25881    26317     +436     
==========================================
+ Hits        19976    20207     +231     
- Misses       4141     4310     +169     
- Partials     1764     1800      +36
Impacted Files Coverage Δ
store/store.go 79.36% <100%> (-0.09%) ⬇️
arch/arch.go 44.68% <0%> (-46.23%) ⬇️
cmd/snap/cmd_abort.go 62.5% <0%> (-14.43%) ⬇️
cmd/snap/cmd_changes.go 40% <0%> (-12.58%) ⬇️
cmd/snap/cmd_watch.go 69.23% <0%> (-10.77%) ⬇️
cmd/cmd.go 90.76% <0%> (-9.24%) ⬇️
interfaces/builtin/lxd_support.go 69.56% <0%> (-6.63%) ⬇️
partition/grubenv/grubenv.go 45.83% <0%> (-5.12%) ⬇️
cmd/snap/notes.go 75% <0%> (-4.67%) ⬇️
interfaces/sorting.go 93.33% <0%> (-3.34%) ⬇️
... and 118 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8f841f...71cc0bc. Read the comment docs.

mvo5 approved these changes Jun 23, 2017

Looks good, thanks Colin!

@stolowski stolowski requested a review from pedronis Jul 7, 2017

Looks good, but I'd like @pedronis to ack this change (I've requested review from him). Thanks!

+1

store/store.go
@@ -1666,11 +1666,18 @@ type storeErrors struct {
Errors []*storeError `json:"error_list"`
}
+func (s *storeErrors) ErrorCode() string {
@pedronis

pedronis Jul 7, 2017

Contributor

this could be called just Code I think

@stolowski stolowski merged commit 2e2f188 into snapcore:master Jul 10, 2017

4 of 7 checks passed

artful-amd64 autopkgtest running
Details
xenial-i386 autopkgtest running
Details
zesty-amd64 autopkgtest running
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-ppc64el autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details

@cjwatson cjwatson deleted the cjwatson:buy-403 branch Jul 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment