commercetools / commercetools-sunrise-java

The next generation shop framework by commercetools
https://demo.commercetools.com
Apache License 2.0
46 stars 35 forks source link

Handle products in cart that don't exist any more #650

Open nkuehn opened 7 years ago

nkuehn commented 7 years ago

Steps to reproduce:

  1. add a product to the cart
  2. add another product to the cart (maybe optional)
  3. delete one of them from the CTP project (completely)
  4. go to checkout (will still show the deleted product instead of a hint that it is not on sale any more)
  5. enter address.
  6. receive unspecified error message :-( Logs show that the product id is not found.

Steps to do right: already check cart consistency when entering checkout. if platform support is not good enough yet, at least remove the products from the cart or something.

katmatt commented 7 years ago

As far as I understand this issue, @romannakoval is currently working on a fix for it in our backend. Then we shouldn't have to fix it in sunrise.

romannakoval commented 7 years ago

Hi @nkuehn and @katmatt !

Yes, I partially fixed it in CTP-269, and yesterday it was merged into the master. After it will be released, the behavior will be next: during cart recalculation (prices and taxes recalc was modified) all items that become invalid for some reason will be "silently" dropped out. During the checkout cart recalculation is called and as it will now will return a valid cart, other error (I guess it will be specified now) - that cart were changed during update - will be returned.

The only situation that may be unhandled in scenario like this, is that if shipping info became invalid - recalculation will still return error. But I'm not sure how it is handled during checkout.

FYI, introducing this fix also for cart merge is in process under CTP-625

nkuehn commented 7 years ago

PS: are we tracking the matching platform requirement that a user doesn't actually want stuff "silently dropped" but rather wants to know what's going on?