commercetools / sphere-play-sdk

Java API client and helper classes for building a SPHERE.IO shop on Play 2.2
http://sphere.io
7 stars 6 forks source link

Merging carts issues on login. #114

Open lauraluiz opened 10 years ago

lauraluiz commented 10 years ago

When an anonymous customer has a non-empty cart and wants to log in using a registered customer that has products that no longer exists, the login fails because the merging process cannot be concluded successfully.

After this, the anonymous cart is not active and belongs to the registered customer. This means that it cannot be merged with any other customer cart, so any login or sign up functionality does not work anymore. This is the error received:

[SphereBackendException: Cart with the ID '16021f8b-bf3a-444f-9fcf-25a9199b5fb5' already belongs to the customer with the ID '08d1987b-bed6-4fef-9756-2a091498117e'.]

The way to solve it is fixing the cart when the login process fails. But this cannot be done because the current login method swallows all exceptions and errors, returning simply true or false depending on the success of the operation. In order to fix it, it is needed an exception with the list of the line item IDs that no longer exist, plus the ID of the customer cart in conflict.

schleichardt commented 10 years ago

It is so kind of you that you will take care of it.