Dynamics Retail Discount Extensibility - Main Picture

Update - this blog post has been moved to Dynamics 365 Community.

Prerequisite: we assume you are familiar with Dynamics Retail Commerce Runtime framework and Dynamics AX.

One pricing engine serves all retail channels

All retail channels: store POS, call center orders and store front orders share the same pricing engine. Call center is part of AX, while POS and store front utilize commerce runtime framework via retail server, so we have two pricing engine invocation patterns.

  1. Retail server calls pricing services via commence runtime framework, which in turn calls pricing engine.
  2. AX calls pricing engine directly, as AX does not understand commerce runtime.

In addition, to accommodate the difference in data access, we have IPricingDataAccessor. When retail server calls pricing engine via pricing services, pricing services would construct channel version of the data accessor, while AX would construct its own.

The following diagram illustrates the main flow and difference between AX and channel side implementations.

pricing-engine

 

Now onto extensibility.

Say, we are creating a new discount type.

The number in parenthesis corresponds the number in the diagram.

pricing-extensibility

First, the schema, the form and CDX

  1. [AX schema extension (5)] new table(s)
  2. [AX form extension (6)] RetailPeriodicDiscount form extension
  3. [Channel database schema (8)] new table(s), view(s) and/or stored procedure(s).
  4. [CDX extension (7)] manual setup.

Secondly, core pricing engine

  1. [pricing engine extension (1)] Create a new discount type.
  2. [pricing engine extension (1)] Register the discount type in retail discount store that loads discount data from database and instantiates discount types
  3. [pricing data accessor interface extension (3)]

Thirdly, channel stack

  1. [pricing services extension (2)] Register the retail discount store extension at the top of commerce runtime pricing services extension. Instantiate the extension data accessor and pass it to the pricing engine.
  2. [pricing data accessor channel extension (4)] Derive from PricingDataServiceManager and implement the extension interface.

Lastly, the AX stack

  1. [pricing data accessor AX extension (9)] derive from RetailPricingDataManager and RetailPricingDataManagerSimulator
  2. [AX pricing proxy (10)] Equivalent to channel side commerce runtime pricing services extension: register the retail discount store extension. Instantiate the extension AX data accessor and pass it to the pricing engine.

We will go over details in coming posts.

Related: Dynamics Retail Discount Extensibility Overall Approach

Related: Dynamics Retail Discount Extensibility – Three Discount Categories

Related: Dynamics Retail Discount Extensibility – Register a New Discount Type