-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reorder CREATE transitions between order and payment
- Loading branch information
Showing
1 changed file
with
6 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I was about to write a test that verifies that transitions are applied in the expected order, but this is considered as a code smell. So we'd better manage this in another way.
I checked how it is done in Sylius Core.
When the checkout is completed, a transition is applied, and it cascades to create the payment.
Also, there a 2
OrderProcessor
configured, one with each of the target statesThe
OrderPaymentProvider
class is responsible for applying the necessary transitionsWell all of this is maybe king of too much complex for our use case (Sylius needs to decouple everything to allow customizing the checkout), but at least I'd prefer to use the state machine to apply the
create
transition on the payment.I'm doing this right away, & also I'll introduce a functional test for the state machine.