Skip to content

Conversation

@gibkigonzo
Copy link
Contributor

@gibkigonzo gibkigonzo commented Jan 17, 2020

Short Description and Why It's Useful

This allows to create cart token when user add product to cart. There is edge case: when user load page, go to offline, add product, go to checkout => can't make order. That's because he hasn't got payment methods which are loaded after token creation. Also I've added refresh payment methods in checkout. Right now in demo if somehow user get to checkout without loaded payment-methods then he can't make order, even if he get back online

QA

A.

  1. clear cache
  2. add product to cart
  3. go to checkout
  4. make order
  5. Expected: user made order

B.

  1. clear cache
  2. go offline
  3. add product to cart
  4. check cart - there should be product
  5. go to checkout
  6. you should not make order
  7. turn online
  8. now you can make order

Same can be checked with user logged in.

Which Environment This Relates To

Check your case. In case of any doubts please read about Release Cycle

  • Test version (https://test.storefrontcloud.io) - this is a new feature or improvement for Vue Storefront. I've created branch from develop branch and want to merge it back to develop
  • RC version (https://next.storefrontcloud.io) - this is a stabilisation fix for Release Candidate of Vue Storefront. I've created branch from release branch and want to merge it back to release
  • Stable version (https://demo.storefrontcloud.io) - this is an important fix for current stable version. I've created branch from hotfix or master branch and want to merge it back to hotfix

Upgrade Notes and Changelog

  • No upgrade steps required (100% backward compatibility and no breaking changes)
  • I've updated the Upgrade notes and Changelog on how to port existing Vue Storefront sites with this new feature

IMPORTANT NOTICE - Remember to update CHANGELOG.md with description of your change

Contribution and Currently Important Rules Acceptance

Copy link
Collaborator

@pkarw pkarw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. After user logs in we need to sync the shopping cart - you removed authorize from the user actions and I'm not sure if it's called when user authorizes him/her self?

  2. I'd rename createCartToken to authorize as it does exactly the same way but I'd say kind of "lazy way" ... wdyt? I don't like createCartToken it should be one-word name like create (if we won't stay with authorize)

@gibkigonzo
Copy link
Contributor Author

You are right. I revert authorize and add changed createCartToken to create

@ArturDivante
Copy link
Collaborator

After latest changes, I tested both scenarios with annonymous and logged-in customer. Behavior is consistent with your description (note:in scenario 2 for logged-in user, cart is created in the moment of logging in, even if customer have no products in it)

In the meantime, we discovered unrelated problem with cart sync in some specific cases. Will be reported separately in: #3995

@ArturDivante ArturDivante added the QA approved on branch Testers will add this label after positive check on specific branch. label Jan 17, 2020
Copy link
Collaborator

@pkarw pkarw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments added. Please check twice if the cart/create requests aren’t multiplied

@andrzejewsky
Copy link
Contributor

@gibkigonzo can you fix the tests?

@gibkigonzo
Copy link
Contributor Author

@andrzejewsky done 👌

@gibkigonzo
Copy link
Contributor Author

I've made one more update d3debc4
We don't need this config anymore as with this pr we don't create token after order.

@andrzejewsky
Copy link
Contributor

@gibkigonzo and... again... changelog... 😄

@gibkigonzo
Copy link
Contributor Author

@andrzejewsky done 😅

@andrzejewsky andrzejewsky merged commit eb397a1 into vuestorefront:hotfix/v1.10.6 Jan 24, 2020
@ArturDivante ArturDivante added the QA approved after merge Testers will add this label after positive check on merged changes label Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

QA approved after merge Testers will add this label after positive check on merged changes QA approved on branch Testers will add this label after positive check on specific branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants