Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderPlacedProducer is not connected to the state machine #281

Closed
ehibes opened this issue May 25, 2022 · 2 comments
Closed

OrderPlacedProducer is not connected to the state machine #281

ehibes opened this issue May 25, 2022 · 2 comments

Comments

@ehibes
Copy link

ehibes commented May 25, 2022

Hi,
I want to change the time when the invoice is created. I would like it to be connected to the transition named complete on sylius_payment.
I see that the OrderPlacedProducer is not connected to the state machine but listens for doctrine events (postPersist & postUpdate).
Can I try to rewrite the call to the OrderPlacedProducer by connecting it to the state machine ?
This could solve the following issues : #174 #235

@ehibes ehibes changed the title OrderPlacedProducer is not plugged on state machine OrderPlacedProducer is not connected to the state machine May 25, 2022
@Prometee
Copy link
Contributor

Hello @ehibes I would also love to see this be rewritten because it create some issues while creating orders through BeHat or fully coded orders by hand.

@GSadee
Copy link
Member

GSadee commented Jul 26, 2022

Hi, very late reply from my side, sorry for that 😓

I tried to recall the reasons why we decided to base this logic on doctrine events (I also consulted it quickly with @Zales0123) instead of the states machine. In my opinion, the main thing could be the fact that the transaction should be completed before generating the invoice, but based on the postPersist and postUpdate events, the behavior would be the same as using a state machine callbacks, on my current knowledge.

So if the refactor the implementation to link it to the state machine allows for easier customization, and also it seems to be more consistent with Sylius itself, I think we could change that before releasing a stable plugin version. However, the moment of generating the invoice should stay the same, as it is when the invoice should be generated for the majority of shops.

@ehibes ehibes closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants