You might be better off using the OrderTransactionUpdatedNotification which is fired whenever the transaction information of an order changes, including the payment status.
The event should provide a PaymentStatus property which has a From and To value on it so you can see what the status is changing from and to. You can then use this to ensure your event only triggers it's behavior when moving between specific payment statuses (ie, moving from Authorized to Captured.
Events Notification Handler
Hi Matt,
I am looking to implement a Notification Event Handler for when an order payment status moves to "Captured".
So far the closest I have found is the OrderUpdatedNotification event with the following:
if (evt.Order.OrderStatusCode == Vendr.Core.Models.OrderStatusCode.Ok && evt.Order.TransactionInfo.PaymentStatus.HasValue && evt.Order.TransactionInfo.PaymentStatus.Value == Vendr.Core.Models.PaymentStatus.Captured)
But how can I prevent anything within that if statement from firing again if the order is updated? Am I using the wrong event?
Thanks again,
Paul.
Hi Paul,
You might be better off using the
OrderTransactionUpdatedNotification
which is fired whenever the transaction information of an order changes, including the payment status.The event should provide a
PaymentStatus
property which has aFrom
andTo
value on it so you can see what the status is changing from and to. You can then use this to ensure your event only triggers it's behavior when moving between specific payment statuses (ie, moving from Authorized to Captured.Hope this helps
Matt
Thanks Matt - that sounds like what I was looking for!
is working on a reply...