RailsEventStore / ecommerce

Application with CQRS and Event Sourcing built on Rails and Rails Event Store
MIT License
425 stars 72 forks source link

Stock logic error when switching from unlimited to limited stock #374

Open marlena-b opened 3 months ago

marlena-b commented 3 months ago

There is a bug in the stock management system when a product initially set to unlimited stock is later assigned a limited stock quantity.

Reproduction steps:

  1. Create a product with unlimited stock.
  2. Create an order and add 5 units of the product, then pay for the order.
  3. Change the product's stock (supply stock) to a value of 3.
  4. Note that the product list now shows a stock of 3.
  5. Create a new order and attempt to add the product.
  6. Observe an error message indicating that the product is out of stock.