Hi all,
In the supplied module FreeOrder which is meant to allow orders of $0.00 to be processed bypassing the payment system, there is no code included to set the order status to paid after it has been purchased. I am trying to set this up, but Im not sure the correct place to do it.
It would seem that I should be able to quickly set the status of the order in the Pay() function of the FreeOrder module, as there is no way payment can fail for $0.00 value on free orders. I cant seem to correctly call the right functions from this area to complete the status change.
I could set up a callback URL with a success function to set the order status similar to the paypal module, but as there is no way this payment can fail it seems overkill to build that structure for a free order.
Has anyone else come across this issue? How has anyone solved it, or can anyone point me to the correct functions to use in the pay() function to set status of the order. Currently I am trying:
public function pay(Order $order)
{
$event = new OrderEvent($order);
$event->setStatus(OrderStatusQuery::getPaidStatus()->getId());
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS,$event);
}
But getting error:
Call to undefined function FreeOrder\dispatch()
Thanks for any help.
Sam