Copied to clipboard

Flag this post as spam?

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


  • NPina 32 posts 183 karma points
    Dec 13, 2022 @ 17:44
    NPina
    0

    Vendr - OrderFinalizedNotification

    NotificationEventHandlerBase<OrderFinalizedNotification>

    The Vendr stopped emit event after finishing the order. Is there a reason that makes it happen?

    I'm trying to understand why the notification stopped working.

    Thanks, NPina.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 13, 2022 @ 17:49
    Matt Brailsford
    0

    The order finalized event occurs only once when the order has some form of transaction recorded against it for the first time and it moves from being a cart to being an order.

    What are you trying to do with the event?

  • NPina 32 posts 183 karma points
    Dec 13, 2022 @ 17:59
    NPina
    0

    I'm trying to catch the finished order with it's order lines to store on my own database table.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 13, 2022 @ 18:41
    Matt Brailsford
    0

    Hmm, that should work. Have you registered your event? If so what code are you using to register it?

  • NPina 32 posts 183 karma points
    Dec 13, 2022 @ 18:47
    NPina
    100

    Yes. That's what I have done. My class:

    public class CustomerOrderFinalizedHandler : NotificationEventHandlerBase<OrderFinalizedNotification>
    {
        public override void Handle(OrderFinalizedNotification evt)
        {
            OrderReadOnly order = evt.Order;
    
            HandleFinalizedProductPurchase _handleFinalizedProductPurchase = new HandleFinalizedProductPurchase();
            _handleFinalizedProductPurchase.Execute(order);
        }
    }
    

    The class to register my event:

    public static class UmbracoBuilderExtensions
    {
    
        public static IUmbracoBuilder AddMyEventHandlers(this IUmbracoBuilder builder)
        {
            builder.WithNotificationEvent<OrderFinalizedNotification>()
                   .RegisterHandler<CustomerOrderFinalizedHandler>();
    
            return builder;
        }
    }
    

    add my event to service:

    services.AddUmbraco(_env, _config) .AddBackOffice() .AddWebsite() .AddComposers() .AddMyEventHandlers() .Build();

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 14, 2022 @ 08:20
    Matt Brailsford
    0

    And what version of Vendr are you using?

  • NPina 32 posts 183 karma points
    Dec 14, 2022 @ 11:04
    NPina
    0

    Hi Matt,

    I am using Vendr 2.3.2.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 14, 2022 @ 13:52
    Matt Brailsford
    0

    Hmm, this looks like it should all be ok then 🤔

    If you add a breakpoint into your event handler, does it never get hit?

  • NPina 32 posts 183 karma points
    Dec 14, 2022 @ 14:06
    NPina
    0

    Yes, I had breakpoint inside my event handler, but it does not get in there.

    I have done that implementation month ago, and it was working fine. It just stopped working yesterday.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 14, 2022 @ 14:14
    Matt Brailsford
    0

    And what changed yesterday? Did you upgrade or something? Are there any errors in your trace log?

  • NPina 32 posts 183 karma points
    Dec 14, 2022 @ 14:18
    NPina
    0

    No changes, no upgrade and without any errors.

    I wondering if it was because I'm in development mode? Does Vendr have limit of event in development?

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 14, 2022 @ 14:30
    Matt Brailsford
    0

    No, it shouldn't do.

    Are your orders actually finalizing (becoming orders / emails sending etc)? What payment method are you using?

  • NPina 32 posts 183 karma points
    Dec 14, 2022 @ 14:33
    NPina
    0

    Yes, the orders are being finalized, the emails are being sent.

    I'm using stripe payment.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Dec 14, 2022 @ 14:42
    Matt Brailsford
    0

    Hmmm, I mean it's very weird your handler wouldn't run as the order emails are triggered via the same event, so Vendr must be firing it 🤔

    I'm not currently sure what else to suggest as everything you've shared looks fine to me.

Please Sign in or register to post replies

Write your reply to:

Draft