I'm unclear on what the 'fulfillment' order state represents.
To be specific, I'm writing code for Commerce License to make a license entity active when the order reaches a certain state. For the order_default workflow, that's simple: the 'completed' state is the point at which this should happen.
But I am confused about the workflows that have a 'fulfillment' state, such as the 'order_fulfillment' workflow. If the order uses this workflow, would it be more correct to grant the license in the 'fulfillment' state? However, this means the event subscriber needs to react to 2 different state changes, which is much less clean code. Given that, I'm unsure that other things a developer might happen when this state is reached.
Perhaps some comments could be added in the workflows.yml file to explain this?
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedYes, licenses should be granted in the "fulfillment" state, that's crucial.
If a license is remote, provisioning might fail, so the order needs to stay in "fulfillment" until that is fixed.
That's the reason why digital orders need that state.
(For physical orders it's more straightforward, the order stays in fulfillment until all shipments are sent).
Thus, License should require people to use a fulfillment workflow just like shipping does.
Suggestions welcome on what comments would help.
Comment #3
joachim CreditAttribution: joachim at Torchbox commented> Thus, License should require people to use a fulfillment workflow just like shipping does.
I see from the README for Commerce Shipping that this is something site builders have to set up manually:
Would it not be cleaner to allow product types to force the workflow they need? Otherwise, it would be possible for a site builder to neglect to read the instructions, and then orders would get created without the right workflow.
(Also, side note probably for another issue: what happens if different products require different, incompatible workflows on order?)
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedThat's not really our problem (nothing we can do about it).
The person who's setting up the order type can create a custom workflow that includes states from both conflicting workflows, solving it that way.
Comment #5
bojanz CreditAttribution: bojanz at Centarro commented