When the user completes checkout for the modified subscription cart, the order is submitted. The subscriptionActionFlow on the order is identified as UPGRADE (or DOWNGRADE).
The system leverages the subscription’s fulfillmentWorkflow along with the UPGRADE or DOWNGRADE action flow to identify the correct fulfillment workflow to execute. See the following configuration to understand how the exact workflow is identified:
broadleaf:
orderfulfillment:
workflow:
mapping:
flows:
match:
fulfillmentTypeAUpgradeWorkflow:
- fulfillmentTypeA-UPGRADE
fulfillmentTypeADowngradeWorkflow:
- fulfillmentTypeA-DOWNGRADE
fulfillmentTypeBUpgradeWorkflow:
- fulfillmentTypeB-UPGRADE
fulfillmentTypeBDowngradeWorkflow:
- fulfillmentTypeB-DOWNGRADE
Sample Configuration for an Upgrade Workflow:
broadleaf:
workflow:
client:
flows:
fulfillmentTypeAUpgradeWorkflow:
description: Subscription Upgrade Workflow for Type-A Subscriptions
historical-reset-enabled: true
retry-enabled: true
steps:
fulfillmentTypeAUpgradeWorkflow:
prepareSubscriptionFulfillmentActivity:
admin-selectable: true
decisions:
ok: subscriptionModificationActivity
subscriptionModificationActivity:
admin-selectable: true
decisions:
ok: subscriptionBillingEventGenerationActivity
subscriptionBillingEventGenerationActivity:
admin-selectable: true
decisions:
ok: myCustomProvisioningActivityForFulfillmentTypeA
myCustomProvisioningActivityForFulfillmentTypeA:
admin-selectable: true
decisions:
ok: releaseSubscriptionLockActivity
releaseSubscriptionLockActivity:
admin-selectable: true
decisions:
ok: fulfillmentStatusFinalizationActivity
fulfillmentStatusFinalizationActivity:
admin-selectable: true
This workflow handles applying updates to the subscription, generating new billing events, and fulfilling the subscription updates.
Initial Workflow Context Parameters
-
Order.id
-
Order.submitDate
-
OrderFulfillment.id
-
Subscription.id
-
LockStatus.lockId (the subscription lock)
-
Application.id
-
Tenant.id
-
subscriptionActionFlow (UPGRADE or DOWNGRADE)
-
OrderFulfillment.fulfillmentWorkflow
-
customerTimezone (if applicable)
Workflow Activity Descriptions
-
prepareSubscriptionFulfillmentActivity (broadleaf-subscription-operation-services-workflow) - Makes a production update to the subscription, setting Subscription#subscriptionStatus to FULFILLMENT_IN_PROCESS.
-
subscriptionModificationActivity (broadleaf-subscription-operation-services-workflow) - Delegates to the EditUpgradeDowngradeSubscriptionModificationHandler. Makes a sandbox update to the subscription, replacing the previous configuration and subscription items with the newly configured subscription items from the upgrade/downgrade cart. It also applies any updated pricing to the subscription and its items, and sets the subscription status back to ACTIVE.
-
subscriptionBillingEventGenerationActivity (broadleaf-subscription-operation-services-workflow) - Delegates to the SubscriptionModificationBillingEventGenerationHandler. Generates new BillingEvents in the sandbox for the subscription based on the new items and prices.
-
myCustomProvisioningActivityForFulfillmentTypeA - An example of a custom workflow activity that might be executed for a specific fulfillment type to provision a service.
-
releaseSubscriptionLockActivity (broadleaf-subscription-operation-services-workflow) - The subscription lock is released and all subscription sandbox updates are applied to the production record.
-
fulfillmentStatusFinalizationActivity (broadleaf-order-operation-services-workflow) - Updates the OrderFulfillment status to indicate that fulfillment has completed (e.g., setting it to FULFILLED).