Add After Configuration
You can configure offers and add those configurations to the basket. The configurations are checked for cardinality violations. With versioning enabled, there can be different versions with varying attributes, so the validation service checks the version validity of the passed input configuration.
You can add and configure a product, promotion, or simple promotion.
-
Product: The bundle shapes are calculated with the product configuration(s) passed in the input. The cart context key is generated from the bundle shapes and context of the user and is checked to see if it is present in the cache and is valid in the current time frame. If it is present and valid, it becomes a cache hit scenario, and validation of offer and price is performed. If the configuration is valid, the offer and price are returned.
For a cache miss scenario where the cart context key is not found while adding a configuration to the empty basket, the system checks for the cardinality validation of the passed input configuration. With versioning enabled, the validation service also checks for the version of the configuration passed in the input. If validation is successful, then order line items are created, validation and pricing rules are run, and the basket is cached and returned. The cache effectivity of the basket is the subset of the effectivity of the added individual offer time slices. Along with the basket information, information about the date-time when the root products are added is also cached.
-
Promotion: Configuring a promotion means configuring the promotional products’ quantity, attributes, child products, etc., and then adding that promotion to the basket. This internally creates the order line items from the promotional product and then applies the promotion to that basket. With versioning enabled, the validation service also checks for the version information and pricing of the promotion. Validation and caching services also run for the products.
-
Adding a simple promotion in multi mode or single mode follows the same route as that of the product. Validation, pricing, and caching services also follow the time slicing and versioning principles as described in the above section.
You can add and configure a product, promotion, or simple promotion.
-
Product: You can add product configurations in single mode or multi mode. The system checks for the validity of the configuration passed in the input. Validation mainly includes the cardinality validations to check whether it violates the minimum, maximum, or group min-max quantity defined in the configuration.
With versioning enabled, there can be different versions with varying attributes and hierarchy, so the validation service checks the version validity of the passed input configuration. After these checks, the basket operation flow continues as before and the cache is generated with effectivity as the subset of the effectivity of the earlier cached basked and the new product versions.
Along with the original cache information, the system also caches the basket created dates and dates on which root products were added. Those dates are used as reference dates during validation, pricing, and add-child basket operations.
-
Promotion: By configuring a promotion means the underlying promotional products can be configured and added to the basket. With versioning enabled, the system performs a validation check for the version of the promotional products being added. If validation is successful, then the system creates the order line items for the promotional products, synchronizes the cached basket contents, and applies the promotion on the entire basket.
-
Simple promotion configuration goes through version and cardinality validation checks for the configuration and pristinity of the existing cached basket. If validations are passed, then the action follows the same route as add promotion. The system creates XLIs and promotional items, and applies validation rules, pricing, and caching the basket with effectivity as that of the common subset of the effectivity of the earlier basket and overall promotional product versions effectivity.
When an add child product action is initiated, the current basket is fetched from the cache. The input and user shape are included in the generation of the cache key and checked for the cache hit scenario. If the cache is present, it is included in the response. Otherwise, it becomes a cache miss scenario. The offer details are then queried and used to create order line items. The existing basket order line items are synchronized. Pricing and validation are run. In the response, basket actions are added and cached with the cartContext key.
With versioning enabled, the pricing and validation of the basket run with the reference date for when the root product was added to the basket. From the basket wrapper, the corresponding information about the date-time when the root product of a child product was added can be stored and retrieved. Partial promotions are applied to the child product. The offer details of the root product are fetched based on the reference date on which the root was added. The basket is cached with the current time slice effectivity.