Copied to clipboard

Flag this post as spam?

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


  • Trevor Loader 199 posts 256 karma points
    Mar 09, 2015 @ 06:16
    Trevor Loader
    0

    v1.8.0 Notifications/Events not firing

    Hi there, this is driving me nuts.  I don't think the events are firing properly on v1.8.0 on Umbraco v7.2.2 (I've also got MerchelloBazzar installed too).

    I've enabled the SMTP Notification provider and configured it as per the Merchello article and have a standard fixed rate shipping provider too.  However, I don't get any notifications, no SMTP errors in the log.

    So I downloaded the Merchello source and added even more logging but something doesn't add up.

    I have logging set to true in Merchello.config and have added logging to ShipmentServiceOnStatusChanged but no entries appear.  Is this the right event that should fire each time the shipment status is changed?

    private void ShipmentServiceOnStatusChanged(IShipmentService sender, StatusChangeEventArgs<IShipment> e)
            {
                Log.Info("ShipmentServiceOnStatusChanged");
                foreach (var shipment in e.StatusChangedEntities)
                {
                    Log.Info("ShipmentServiceOnStatusChanged" + shipment.ShipmentStatus.Name);
                    shipment.AuditStatusChanged();
                }
            }

     

    I can see in the logs that everything seems to start up fine....

    INFO  Merchello.Web.UmbracoApplicationEventHandler - Attempting to initialize Merchello
    INFO  Umbraco.Core.PluginManager - [Thread 26] Starting resolution types of Merchello.Core.Gateways.GatewayProviderBase
    INFO  Umbraco.Core.PluginManager - [Thread 26] Completed resolution of types of Merchello.Core.Gateways.GatewayProviderBase, found 5 (took 11ms)
    INFO  Umbraco.Core.PluginManager - [Thread 26] Starting resolution types of Merchello.Core.Observation.ITrigger
    INFO  Umbraco.Core.PluginManager - [Thread 26] Completed resolution of types of Merchello.Core.Observation.ITrigger, found 3 (took 9ms)
    INFO  Umbraco.Core.PluginManager - [Thread 26] Starting resolution types of Merchello.Core.Observation.IMonitor
    INFO  Umbraco.Core.PluginManager - [Thread 26] Completed resolution of types of Merchello.Core.Observation.IMonitor, found 3 (took 6ms)
    INFO  Umbraco.Core.PluginManager - [Thread 26] Starting resolution types of Merchello.Web.Reporting.ReportController
    INFO  Umbraco.Core.PluginManager - [Thread 26] Completed resolution of types of Merchello.Web.Reporting.ReportController, found 0 (took 4ms)
    INFO  Merchello.Core.CoreBootManager - [Thread 26] Starting subscribing Monitors to Triggers
    INFO  Merchello.Core.Observation.MonitorBase`1[[Merchello.Core.Models.IShipment, Merchello.Core, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null]] - [Thread 26] PartialOrderShippedMonitor subscribing to PartialOrderShippedTrigger
    INFO  Merchello.Core.Observation.MonitorBase`1[[Merchello.Core.Models.MonitorModels.IPaymentResultMonitorModel, Merchello.Core, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null]] - [Thread 26] OrderConfirmationMonitor subscribing to OrderConfirmationTrigger
    INFO  Merchello.Core.Observation.MonitorBase`1[[Merchello.Core.Models.IShipment, Merchello.Core, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null]] - [Thread 26] OrderShippedMonitor subscribing to OrderShippedTrigger
    INFO  Umbraco.Core.CoreBootManager - [Thread 26] Finished subscribing Monitors to Triggers
    INFO  Merchello.Web.UmbracoApplicationEventHandler - Initialization of Merchello complete
    INFO  Umbraco.Web.Search.ExamineEvents - [Thread 26] Initializing Examine and binding to business logic events
    INFO  Umbraco.Web.Search.ExamineEvents - [Thread 26] Adding examine event handlers for index providers: 3
    INFO  Merchello.Plugin.Payments.PayPal.PayPalEvents - [Thread 26] Initializing PayPal provider registration binding events
    INFO  Merchello.Core.Gateways.GatewayEvents - [Thread 26] Initializing Merchello Warehouse Catalog binding events
    INFO  Merchello.Core.Gateways.Notification.Monitors.NotificationMonitorEvents - [Thread 26] Initializing Merchello NotificationMonitor binding events
    INFO  Merchello.Core.Gateways.Notification.Monitors.NotificationMonitorEvents - [Thread 26] Completed Merchello NotificationMonitor binding events
    INFO  Merchello.Core.Gateways.Notification.Smtp.SmtpProviderEvents - [Thread 26] Initializing SMTP notification gateway provider registration binding events
    INFO  Merchello.Web.Search.ExamineEvents - [Thread 26] Initializing Merchello ProductIndex binding events
    INFO  Merchello.Web.Trees.ServerVariablesParsingEvents - [Thread 26] Initializing Merchello ServerVariablesParsingEvents
    INFO  Merchello.Web.UmbracoApplicationEventHandler - [Thread 26] Initializing Customer related events
    INFO  Merchello.Bazaar.UmbracoEventHandler - [Thread 26] Binding Merchello Customer synchronization

    Yet I get no other entries in the log when fulfilling the order (even when pushing the shipment through the steps of packaging, ready, shipped, delivered).

    Whats is also interesting is that AuditLog Table only shows invoiceCreated, PaymentAuthorize and paymentCaptured and does not show any shipping entries. (note too that the paymentCaptured entry does not have a currency code?)

    {"area":"merchelloAuditLogs","key":"invoiceCreated","invoiceNumber":"1009"}
    {"area":"merchelloAuditLogs","key":"paymentAuthorize","invoiceTotal":20.00,"currencyCode":"NZD"}
    {"area":"merchelloAuditLogs","key":"paymentCaptured","invoiceTotal":20.0,"currencyCode":""}

    Have I done something glareingly wrong or does this not seem right?  Is anyone else having the same issue?  Or does anyone have any tips for trying to track down the problem?

    Cheers, Trevor

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 09, 2015 @ 16:37
    Rusty Swayne
    0

    Hi Trevor,

    The notification system is not based on events, rather it uses Microsofts IObservable

    In your event handler try adding

    private void ShipmentServiceOnStatusChanged(IShipmentService sender, StatusChangeEventArgs<IShipment> e)
        {
            Log.Info("ShipmentServiceOnStatusChanged");
            foreach (var shipment in e.StatusChangedEntities)
            {
                if(shipment.Status.Name == "shipped") 
                {
                     // assuming the email address has been populated in your shipment
                     Notification.Trigger("OrderShipped", shipment, new { shipment.Email } );
                }
                Log.Info("ShipmentServiceOnStatusChanged" + shipment.ShipmentStatus.Name);
                shipment.AuditStatusChanged();
            }
        }
    

    I'll have to check on the shipment auditing. This may need a little attention and I'm pretty sure I don't have any tests written for those. I'll add that one to the issue tracker.

  • Trevor Loader 199 posts 256 karma points
    Mar 09, 2015 @ 19:36
    Trevor Loader
    0

    Hi Rusty,

    Yes sorry, wrong terminology. The above code snippet is in the Merchello core...I added more logging to Merchello.Web\UmbracoApplicationEventHandler.cs -> ShipmentServiceOnStatusChanged.  So I don't think we should be adding a manual notification there should we?

    Can you confirm that a new Umbraco v7.2.2 installation with both Merchello and Merchello Bazzar 1.8.0 installed does in fact trigger SMTP notifications when enabled and configured...and you change the shipping status to Shipped or Delivered?

    Can you also see if the shipment audit record goes into your database?

    If you can get the emails/log entries/audit entries, do you have any suggestions for the best way for me to try and track down the problem?

    Any pointers would be appreciated.  Thanks.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 09, 2015 @ 20:26
    Rusty Swayne
    1

    Hi Trevor,

    I'll check it out for sure. I'm traveling today and my laptop is out of juice. See how much of a charge I can get on my layover and hope they have power on the next flight - otherwise it'll be tomorrow before I can check it out well, but I'll keep you posted.

  • Trevor Loader 199 posts 256 karma points
    Mar 09, 2015 @ 20:55
    Trevor Loader
    2

    No worries Rusty...I'll keep looking anyway so hopefully I figure it out before you :-)

Please Sign in or register to post replies

Write your reply to:

Draft