Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Crowdy 40 posts 111 karma points
    Apr 18, 2021 @ 07:41
    Paul Crowdy
    0

    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.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Apr 19, 2021 @ 08:13
    Matt Brailsford
    1

    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 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.

    Hope this helps

    Matt

  • Paul Crowdy 40 posts 111 karma points
    Apr 19, 2021 @ 08:52
    Paul Crowdy
    0

    Thanks Matt - that sounds like what I was looking for!

Please Sign in or register to post replies

Write your reply to:

Draft