Workflows and activities
Describes how you can work with validation services and processors, in replacement of workflows and activities that were made obsolete by Optimizely Commerce Connect version 14.
In Optimizely Commerce Connect, activity flows were used to validate and calculate checkout totals. An activity flow is a container of steps or activities that can be executed. When executing an activity flow, a list of configured activities and if/else conditions are executed.
Activities can be replaced by the following validation services and processors:
OrderValidationService
IPurchaseOrderProcessor
IPaymentPlanProcessor
IShipmentProcessor
IPlacedPriceProcessor
IInventoryProcessor
IPaymentProcessor
- Order total calculators
These components mentioned here are available in the EPiServer.Commerce.Order
and EPiServer.Commerce.Order.Calculator
namespaces.
Activity flows
- CartValidateActivityFlow
UseOrderValidationService.ValidateOrder()
instead. - CartPrepareActivityFlow
UseOrderValidationService.ValidateOrder()
andOrderGroupExtensions.CalculateTotals()
instead. - CartCheckoutActivityFlow
UseOrderValidationService.ValidateOrder()
andOrderGroupExtensions.CalculateTotals()
instead.
Example Commerce Connect 14 and higher:
CartBuilder ch = new CartBuilder();
foreach (VariationContent entry in entries)
{
ch.AddEntry(entry, quantity, false);
}
ch.Cart.ProviderId = "FrontEnd";
OrderValidationService.ValidateOrder(ch.Cart);
ch.Cart.AcceptChanges();
Example Commerce Connect 10-13:
CartBuilder ch = new CartBuilder();
foreach (VariationContent entry in entries)
{
ch.AddEntry(entry, quantity, false);
}
ch.Cart.ProviderId = "FrontEnd";
ch.RunWorkflow(OrderGroupWorkflowManager.CartValidateWorkflowName);
ch.Cart.AcceptChanges();
Activities
- AdjustInventoryActivity
UseIOrderGroupExtensions.AdjustInventoryOrRemoveLineItems()
instead. - CalculateDiscountsActivity
UseIOrderGroupExtensions.ApplyDiscounts()
andIOrderGroupExtensions.UpdateInventoryOrRemoveLineItems()
instead. - CalculateTotalsActivity
UseIOrderGroupExtensions.CalculateTotals()
instead. - CheckInventoryActivity
UseIOrderGroupExtensions.UpdateInventoryOrRemoveLineItems()
instead. - ProcessPaymentActivity
UseIPaymentProcessor.ProcessPayment()
instead. - RemoveDiscountsActivity
UseIOrderGroupExtensions.ApplyDiscounts()
instead. - ShipmentSplitActivity
UseIOrderGroupExtensions.CalculateTotals()
instead. - ValidateLineItemsActivity
UseIPlacedPriceProcessor.UpdatePlacedPrice()
instead.
Updated 5 months ago