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.
- Retail server calls pricing services via commence runtime framework, which in turn calls pricing engine.
- 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.
Now onto extensibility.
Say, we are creating a new discount type.
The number in parenthesis corresponds the number in the diagram.
First, the schema, the form and CDX
- [AX schema extension (5)] new table(s)
- [AX form extension (6)] RetailPeriodicDiscount form extension
- [Channel database schema (8)] new table(s), view(s) and/or stored procedure(s).
- [CDX extension (7)] manual setup.
Secondly, core pricing engine
- [pricing engine extension (1)] Create a new discount type.
- [pricing engine extension (1)] Register the discount type in retail discount store that loads discount data from database and instantiates discount types
- [pricing data accessor interface extension (3)]
Thirdly, channel stack
- [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.
- [pricing data accessor channel extension (4)] Derive from PricingDataServiceManager and implement the extension interface.
Lastly, the AX stack
- [pricing data accessor AX extension (9)] derive from RetailPricingDataManager and RetailPricingDataManagerSimulator
- [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