RailsEventStore/ecommerce

make future prices editable

Opened this issue · 3 comments

next step of issue: #190

My idea how to achieve it:

  1. Make Price an independent read model with prices table, which would be associated to the Product. This would substitute the current_prices_calendar attribute. An entry in prices, beside the reference to a product, would have valid_from and value attributes. We could also add a currency and build a value object for Money.
  2. Prices will have their identities, which will allow us to update or delete them.

Alternatively, we would need to edit the whole current_prices_calendar whenever we want to update the prices, because the entries in the calendar have no identities. This solution looks to me like a workaround.

There is also one issue with the current_prices_calendar. I don't see a logic to cut off the past prices. So it does not really contain the current prices, but just all the prices.

Thanks for communicating the ideas!

They made me think about the current design.

I think we can get rid of the pricing calendar.

If we allow adding products to offer with the price, we don't need the prices info anymore.

If price is passed as part of the command things get simpler.

I think it's fair to assume that adding a product to an offer requires a price.

What would be the point of offering a product without a price?

Where can we get the price from?
From the same place where the buyer makes a decision - from the read model of the Public Offer.

So, at the controller level when we initialize the command we grab the price too.

This could fix a bug which we probably have now - if the price changes after the offer was created, the offer price would change too, right?

What do you think?

Thank you for you answer, Andrzej.

I don't fully understand what you're proposing.

If we allow adding products to offer with the price, we don't need the prices info anymore.

We already do have the price attribute on the the PublicOffer::Product and we react to the Pricing::PriceSet event.

Where can we get the price from?
From the same place where the buyer makes a decision - from the read model of the Public Offer.

But the read model on the Public Offer is showing the current price, not the future one. In the issue we're talking about making the future price editable.

So, at the controller level when we initialize the command we grab the price too.

Which controller and which command do you mean?