Loading...
Area: Optimizely Commerce
Applies to versions: 14 and higher
Other versions:

Workflows and activities

Recommended reading 
Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.

This topic describes how you can work with validation services and processors, in replacement of workflows and activities that were obsoleted with Optimizely Commerce version 14.

How it works

In Optimizely Commerce, activity flows were used for validation and calculating totals in the checkout process. An activity flow is a container of steps, or activities, which can be executed. When executing an activity flow, a list of configured activities and if/else conditions is executed.

Activities can be replaced by the following validation service 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
    Use OrderValidationService.ValidateOrder() instead.
  • CartPrepareActivityFlow
    Use OrderValidationService.ValidateOrder() and OrderGroupExtensions.CalculateTotals() instead.
  • CartCheckoutActivityFlow
    Use OrderValidationService.ValidateOrder() and OrderGroupExtensions.CalculateTotals() instead.

Example Commerce 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 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
    Use IOrderGroupExtensions.AdjustInventoryOrRemoveLineItems() instead.
  • CalculateDiscountsActivity
    Use IOrderGroupExtensions.ApplyDiscounts() and IOrderGroupExtensions.UpdateInventoryOrRemoveLineItems() instead.
  • CalculateTotalsActivity
    Use IOrderGroupExtensions.CalculateTotals() instead.
  • CheckInventoryActivity
    Use IOrderGroupExtensions.UpdateInventoryOrRemoveLineItems() instead.
  • ProcessPaymentActivity
    Use IPaymentProcessor.ProcessPayment() instead.
  • RemoveDiscountsActivity
    Use IOrderGroupExtensions.ApplyDiscounts() instead.
  • ShipmentSplitActivity
    Use IOrderGroupExtensions.CalculateTotals() instead.
  • ValidateLineItemsActivity
    Use IPlacedPriceProcessor.UpdatePlacedPrice() instead.

Related topics

 

Do you find this information helpful? Please log in to provide feedback.

Last updated: Jul 02, 2021

Recommended reading