This pull request fixes an issue where the gateway wasn't being included in the $order parameter of the OrderPaid event which was happening due to a timing issue.
The OrderPaid event is dispatched by the BaseGateway@markOrderAsPaid method.
However, the gateway was only set in the Manager@purchase method & was run based on if the purchase method in the gateway returned as being successful.
This meant that developers who wanted to include the gateway name in their order paid notifications weren't able to do so as they couldn't tell which gateway was used.
This PR sets the order's gateway in the BaseGateway@markOrderAsPaid method before the event is dispatched, this means it's available for those who need it.
It's worth noting any of the 'gateway data' won't be available in the event because we can't get that until the payment method has ran.
This pull request fixes an issue where the gateway wasn't being included in the
$order
parameter of theOrderPaid
event which was happening due to a timing issue.The
OrderPaid
event is dispatched by theBaseGateway@markOrderAsPaid
method.However, the gateway was only set in the
Manager@purchase
method & was run based on if thepurchase
method in the gateway returned as being successful.This meant that developers who wanted to include the gateway name in their order paid notifications weren't able to do so as they couldn't tell which gateway was used.
This PR sets the order's gateway in the
BaseGateway@markOrderAsPaid
method before the event is dispatched, this means it's available for those who need it.It's worth noting any of the 'gateway data' won't be available in the event because we can't get that until the
payment
method has ran.