'How to map a rather complex Business Process like Order to Cash to Corda Flow(s)

Imagine a real world business process which can take weeks shall be mapped to single or multiple Corda Flows. As long living flows have impact of SW lifecycle (see https://docs.corda.net/upgrading-cordapps.html#flow-drains) I wonder if there are design guidelines for flows regarding time to life or other aspects like versioning/compatibility/dependencies to sub-flows/ ...).



Solution 1:[1]

You would typically model each document to states i.e SalesOrder, Goods, Delivery, Bill

Then for each action, it's just a flow within Corda.i.e ApproveSalesOrderFlow, IssueGoodsFlow, ReceiveGoodsFlow, FulfillShipmentFlow, SettleBillFlow etc.

Because some process may takes weeks, you'll need to model lifecycle/status in the states. i.e SalesOrder may have lifecycle such as ISSUED, APPROVED, DELIVERED, PAID. Upon each action (flow), you're transitioning the state from an initial status to its respective new statuses to track its lifecycle. i.e an ApproveSalesOrderFlow may move the state from ISSUED to APPROVED, and you would track the lastApprovedDate, durationOfSLA, etc as fields in the state.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adrian