O'Reilly logo

Domain Modeling Made Functional by Scott Wlaschin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Change 3: Adding Support for Promotion Codes

Let’s move on to a different scenario: the sales team wants to do some promotions, and they want to offer a promotion code that can be provided when placing an order to get discounted prices.

After discussion with the sales team, we have these new requirements:

  • When placing an order, the customer can provide an optional promotion code.
  • If the code is present, certain products will be given different (lower) prices.
  • The order should show that a promotional discount was applied.

Some of these changes are easy, but the last requirement, which looks so simple, will create surprisingly powerful ripples throughout the domain.

Adding a Promotion Code to the Domain Model

Let’s start with the new promotion code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required