Pricing

Every time an order is received, each order line must be priced accordingly. Each product has a base unit price coming from a price list. If the client is a regular customer, the price for a given order line is simply computed as the base price for that product multiplied by the ordered quantity.

However, some clients have made special arrangements with Raffaella, and they have an associated promotion. A promotion is referred to a single client, and has an expiry date, after which the promotion is no longer valid. A client can have more than one active promotion at any time. A promotion can be of two distinct types:

  • in the fixed promotion, one or more products are discounted by a fixed percentage (e.g. each 100g casatella is 5% off);
  • in the threshold promotion, given one or more products and their respective quantity thresholds, the exceeding quantity for each product is discounted by a fixed percentage (e.g. after the 5th, each 100g casatella is 5% off).

Ubiquitous Language

Term Definition
Incoming order line A product with its ordered quantity.
Quantity A quantity of something.
Price list Associates to each product its unitary price.
Price in euro cents A price expressed in cents, the smallest currency unit for euros.
Client A physical or legal entity that places order lines.
Client ID An ID which uniquely identifies a client.
Promotion A promotion for a client, with an expiry date, containing promotion lines for some products.
Fixed promotion line This promotion line specifies the discounted product and how much to discount it by. Every order line which contains the product is discounted by the specified amount.
Threshold promotion line This promotion line specifies the discounted product, the threshold and how much to discount it by. Only the products above the threshold are discounted; the other ones are at full price.
Threshold quantity A threshold under which the discount does not apply.
Discount percentage A discount percentage, expressed as a number between 0 (exclusive) and 100 (inclusive).
Generated byscaladoc
Made with ❤ by Giacomo, Nicolas, Nicolò, Linda
Mode
Back to top
In this article