Skip to content

Change behavior for the bill generation #174

Description

@pocky

A bill is generated when the sylius_payment flow is complete. This is something good for business to business but not for business to customer because a "complete" sylius_payment is not always paid and an unpaid order should not have a generated bill.

That's why I think we should change this behavior.

Steps

Current configuration must be updated :

  • The sylius_invoicing_plugin_payment_complete_producer callback should be in the sylius_order state machine, on the fulfill transition.
winzou_state_machine:
    sylius_order:
        callbacks:
            after:
                sylius_invoicing_plugin_payment_complete_producer:
                    on: ['fulfill']
                    do: ['@sylius_invoicing_plugin.event_producer.order_payment_paid', '__invoke']
                    args: ['object']

Sylius\InvoicingPlugin\EventProducer\OrderPaymentPaidProducer should be updated because there is no more a PaymentInterface but an OrderInterface. Class should be renamed OrderFulfilledProducer.

Sylius\InvoicingPlugin\EventProducer\OrderPlacedProducer should be updated because the event is no more dispatched with a condition on checkoutState (but with paymentState and OrderPaymentStates::STATE_PAID). Class should be renamed OrderPaidProducer.

Related code should be renamed.

After changes

An unpaid order will not have any bill until the OrderPaymentStates::STATE_PAID is dispatched. Then the bill will be available for customer. Because the payment is paid, the owner can print the bill and prepare his order. Finally the order will be "fulfilled" when the shipment is marked as "shipped" and the bill will be sent to the customer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions