CancelLineItem

Whenever the user tries to cancel a line item before payment, it should be possible to invoke a custom workflow instead of using the default enfore functionality. The workflow will be triggered if the line item’s requiresCustomCancelFlow is set and the sales item referenced by the line item has a custom workflow configured for the CancelLineItem extension point.

The workflow receives information about the line item to be canceled. If the workflow completes successfully, it must return the reason for the cancelation (a value from the LineItemCancelationReason enum) and the item will be removed from the basket/order. If the workflow fails, an error is shown and the basket/order is not modified.

Workflow parameters

The CancelLineItem-CUWO does not yet receive a dedicated WorkflowParameters structure.

Success result

On success, the CancelLineItem-CUWO is expected to pass a CancelLineItemWorkflowResult structure to terminateSuccess.

The structure is defined as:

/**
 * The result value for a "cancel line item" workflow.
 */
class CancelLineItemWorkflowResult extends WorkflowResult {
    readonly "@type" : string = "n4.cuwo.CancelLineItemWorkflowResult";

    /**
     * The reason for the cancelation of the line item.
     */
    public reason : LineItemCancelationReason;

    /**
     * The new external data to attach to the line item. If not provided,
     * the existing external data of the line item will not be changed.
     */
    public updatedExternalData? : string;
}

Failure result

The CancelLineItem-CUWO does not yet have a dedicated WorkflowFailure structure to pass into terminateFailure.

Cancelation result

The CancelLineItem workflow does not support cancelation.