1

I'm using Symfony EventDispatcher in my project.

There is a trade/pay system in my project, user can create an order, the order's status is unpaied, when user paid the order by paypal, paypal will trigger a trade finish hook, my project's PayNotifyController will receive the hook.

So the question is, should I dispatch pay.success event when I receive the hook, or after update the order's status to paid ?

pseudo code:

public function hookAction() {
    $event->dispatch('pay.success');
}

then add a event subscriber to update the order's status to paid.

or

public function hookAction() {
    set_order_paid();
    $event->dispatch('pay.success');
}
leo108
  • 817
  • 5
  • 12
  • 2
    So as per your project specification at what moment the payment is treated as successful? It's not a programming, but a business problem, and you should ask the domain expert for that. – zerkms Dec 24 '15 at 02:20

0 Answers0