Sylius / InvoicingPlugin

Generate an Invoice for every placed order
MIT License
80 stars 84 forks source link

Link order generation to state machine #283

Open ehibes opened 2 years ago

ehibes commented 2 years ago

Moving order generation to state machine transition from doctrine persist event. #281 Solve #174 #235 adding some state configuration :

winzou_state_machine:
    sylius_payment:
        callbacks:
            after:
                sylius_invoicing_plugin_order_placed_producer:
                    on: ['complete']
                    do: ['@sylius_invoicing_plugin.event_producer.order_placed', '__invoke']
                    args: ['object.getOrder()']
                sylius_invoicing_plugin_payment_complete_producer:
                    disabled: true
    sylius_order:
        callbacks:
            after:
                sylius_invoicing_plugin_order_placed_producer:
                    disabled: true

I had to use the identifier instead of the number, because the order number is not yet persisted to the entity at the time of the transition.

ehibes commented 2 years ago

Hello @ehibes !

Why do you change all the orderNumber references to id ?

Changing the moment where the invoice item is created could help.

I did it because orderNumber was not yet generated.

ehibes commented 2 years ago

I made changes according to you reviews. PhpSpec & behat tests passed. I don't know how to add your behat scenario...

Prometee commented 2 years ago

I made changes according to you reviews. PhpSpec & behat tests passed. I don't know how to add your behat scenario...

Perfect, thank you for your work, I will ping the devs about it to start approving it 😉 Don't worry about the BeHat test, I will setup one elaborate one in an other PR.

ehibes commented 2 years ago

Perfect, thank you for your work, I will ping the devs about it to start approving it 😉 Don't worry about the BeHat test, I will setup one elaborate one in an other PR.

Thank you for your reactivity @Prometee. I should write a Behat scenario too, for my example of the first message.

Prometee commented 2 years ago

Yes it will avoid getting the issue again indeed 👌

David-Crty commented 1 year ago

I love this feature. Can I help with anything on those falling checks? Let me know if I can.