automate-sales / automate-commerce

next js ecommerce
MIT License
0 stars 0 forks source link

Add cart sharing feature #49

Open gkpty opened 4 months ago

gkpty commented 4 months ago

A shopping cart without a owner should be able to be created by an admin. When the admin sends this cart to a user, the user can claim the cart.

When a user claims the cart (accepts) this makes his existing cart inactive, and makes the new claimed cart active and adds his lead_id.

it must ask user for a confirmation before replacing the cart

claimCart: set the current cart inactive, then set the leadId on the new cart, then reroute to /cart

  1. An admin creates a new cart (without a leadID)
  2. The cart URL is sent to a lead
  3. The lead enters the given cart URL
    1. If the given cart already has an owner, reroute the user to /cart
    2. else If: the lead has an existing non-empty cart, a modal (dialog) will pop up to ask the user if they wish to overwrite their current cart.
      1. when confirmed this will claimCart
      2. if cancelled it will reroute to /cart
    3. else: claimCart
gkpty commented 3 months ago

tests cases:

  1. the new cart doesnt exist
  2. the new cart belongs to another lead
  3. the new cart belongs to the current lead
  4. the new cart doesnt belong to anybody
    1. the current cart is empty
    2. the current cart is not empty