Domain Model (Spec)

The domain model of the External Pricing-API consists of the core object types PricingEngineContext and PricingEngineResult. A PricingEngineContext is sent to the external pricing logic which is expected to return a PricingEngineResult.

Line items

Both PricingEngineContext and PricingEngineResult mainly consist of items. In case of the context, those are of type PricingEngineContextLineItem. For the result, the items are either PricingEngineResultItem or PricingEngineResultAdditionalItem objects.

Line item dependencies

In most cases, a line item is a stand alone item and fully describes the order position by itself. In some cases, though, a position is complex enough to need additional items to be expressed. Those items are not independent items but are depending on a "root item".

For example, consider a sales order at a burger restaurant:

IdDependencyQtyProductBasePricePrice
11xSoftdrink3€/1x3€
21xBurger8€/1x8€
32 / OPTION1xBacon1,50€/1x1,50€
42 / OPTION1xExtra Cheese1€/1x1€
52 / OPTION1xWell done0€/1x0€

Here, the Burger is a configurable BTO (built to order) product with a "base price" of € 8,00 and the specific sale includes the options Bacon, Extra Cheese, and Well done.

Line item dependency types

The enfore platform supports different types of line item dependencies.

OPTION

The most common line item dependency type is OPTION. An option represents a dynamic choice made by the user at runtime when adding a product an order.

Items of type OPTION are included when computing the line item total and are shown in the client UI and printed on business documents as sub-items for their main item.

DEPOSIT

For modelling deposits, the enfore platform uses the line item dependency type DEPOSIT. Deposits are configured on the product via the client UI and cannot be modified by the user at runtime when adding a product an order.

Items of type DEPOSIT are included when computing the line item total and are shown in the client UI and printed on business documents as sub-items for their main item.

CONTENT_COMPOSITION

For describing the contents of a sold item, the line item dependency type CONTENT_COMPOSITION can be used.

This dependency type is currently only usable by the external pricing logic, there is no way to create such items via the product configuration or client UI.

Items of type CONTENT_COMPOSITION are ignored when computing the line item total and are not shown in the client UI nor printed on the generic enfore documents.

Custom document templates may choose to display those items in addition (or even in place) of the main item. When the items are to be displayed in place of the main item, care must be taken to ensure that the combined prices of the CONTENT_COMPOSITION items match the price of the main item so that the overall price displayed stays the same. See the depdency typen PRICING_COMPOSITION for more information.

PRICING_COMPOSITION

For describing how the price of a line item was computed, the line item dependency type PRICING_COMPOSITION can be used.

This dependency type is currently only usable by the external pricing logic, there is no way to create such items via the product configuration or client UI.

Items of type PRICING_COMPOSITION are ignored when computing the line item total and are not shown in the client UI nor printed on the generic enfore documents.

Custom document templates may choose to display those items in place or in addition of the main item. As those items are used to visualize the price computation, care must be taken to ensure that the combined prices of the PRICING_COMPOSITION items match the price of the main item so that the overall price displayed stays the same.

Specifically, discounts applied to the main item must be present at the PRICING_COMPOSITION items as well.

For example, assume a main item for the product Box of flowers whose price is computed from the products Rose (2x per Box) and Tulip (5x per Box):

IdDependencyQtyProductBasePricePrice
11xBox of flowers9€/1x9€
21 / PRICING_COMPOSITION2xRose2€/1x4€
31 / PRICING_COMPOSITION5xTulip1€/1x5€

Increasing the quantity on the main item must also update the quantities on the PRICING_COMPOSITION items:

IdDependencyQtyProductBasePricePrice
15xBox of flowers9€/1x45€
21 / PRICING_COMPOSITION10xRose2€/1x20€
31 / PRICING_COMPOSITION25xTulip1€/1x25€

Discounts present on the PRICING_COMPOSITION items must be present on the main item as well:

IdDependencyQtyProductBasePriceDiscountPrice
15xBox of flowers9€/1x10% New Customer40,50€
21 / PRICING_COMPOSITION10xRose2€/1x10% New Customer18,00€
31 / PRICING_COMPOSITION25xTulip1€/1x10% New Customer22,50€

Note that different discounts can be present for each PRICING_COMPOSITION item. The important thing is that all discounts from the sub items must be present on the main item as well:

IdDependencyQtyProductBasePriceDiscountPrice
15xBox of flowers9€/1x5€ Rose Day
2€ Tulip Special
38€
21 / PRICING_COMPOSITION10xRose2€/1x5€ Rose Day15€
31 / PRICING_COMPOSITION25xTulip1€/1x2€ Tulip Special23€