I'm currently integration Merchello 2.1.0 into my website. Everything is working fine except the smpt notification sending.
I added the smpt settings at the gateway tab and set up an OrderConfirmation notification.
The problem is the notification never gets send after the order is completet (currently with PayPal express checkout). The Umbraco log has also no error messages in it.
haven't thought about that to be honest. Tried it right now and nothing gets generated in the folder.
Hi David,
can't really provide some code as I haven't added anything for the mail sending as the default smtp gateway provider from merchello should handle the mail sending.
Similar to other providers in Merchello, Notifications have Gateway Providers which manage one or more methods for performing operations respective to the provider type. Notification provider methods are responsible for “sending notification messages.”
The built in Notification provider is the Email Notification provider, which as the name infers, is responsible for sending email (SMTP based) messages.
Notifications are loosely coupled with a set of “Triggers” and “Monitors” based on the .NET IObservable pattern. Triggers notify “subscribing” Monitors that it should execute some function or process for an object (model) the trigger passes to the monitor.
You can think of this as a monitor which has subscribed to the trigger then does something when the trigger instructs it to do so.
It is important to make the distinction between “Triggers” and “Events.” Merchello does not use events to send notifications - it uses explicitly called triggers to allow for more granular control of if and when an appropriate Notification process should be executed.
Note: The OrderConfirmation trigger sometimes confuses people that are first starting out in Merchello as it is generally triggered by Payment Provider developers once a payment has been authorized - so it “appears to act like an event” but in fact it is executed in the provider with code similar to:
The default SMTP Notification Provider, utilizes the triggers and monitors to send one or more messages for any configured monitor.
When a trigger is executed, any monitor subscribing to the trigger looks to see if it has any associated messages. If there are any messages, the monitor instantiates a formatter to format the message body and for each message passes the message and formatter off to be sent.
Assume in the diagram below that the Trigger is an “OrderConfirmation” trigger.
Monitor 1 has 3 messages associated with it through the back office. When the trigger is executed Monitor 1 creates a Razor formatter and sends the 3 messages through the SMTP Notification provider.
The messages could be completely different if a separate razor files were used to create the message bodies. They could also have different recipients so you could have:
I had another, similar, issue posted a couple of days ago with the Braintree provider implementation with the FastTrack starter. I think it may be an issue with things happening async - I'll be looking at it this week.
Can you confirm you are using the FastTrack starter (or implementation based off that example)?
thanks for that explanation. Really interesting to hear the internals of the notification system.
I'm not using the FastTrack starter right now. Just some custom implementation based on things I saw in the FastTrack code. Main reason for this was skipping al the shipment stuff as I only have digital goods.
I'm actually working on both of these issues right now.
I tracked the problem with the fulfillment of the orders stems from a very early idea that orders with downloadable items should not be marked as fulfilled until they have been downloaded - but it was never fully implemented. It's also intermixed with some of the back ordering and returns stubs we have in the logic.
In Merchello, there is a difference between an invoice and and order. The concept is an invoice is generally used for payment and includes all line items (inluding shipping costs and tax) and the order is something that can be handed off to a warehouse / fulfillment system - which is more concerned with freight and inventory. It's sort of like the start to create a "bill of lading".
The setup is really overkill for simple stores, but may give you an idea of where we're heading. The data is setup so that we can create multiple orders of a single invoice and do some basic A/R operations like multiple payments to an invoice. Split a payment to pay for multiple invoices ... etc.
With respect to the non shippable items (downloads, class registrations), I think it's an area that we got too tricky as there really is no reason to include them in the order. I remember the use case being a piece of software where one variant could be downloadable and a second being shipped out physically in a box. IMO - something that is not going to be physically packaged and delivered should not be included in the order (only on the invoice).
Looking at your code above (unless you are using a custom trigger/monitor setup) The model passed into the notification should be an IPaymentResult not an order - but I'd have to see a bit more of the code to understand what your doing a bit better - happy to do that =)
I confirmed yesterday, that the PayPal provider is not sending the email correctly. I'm working on that today!
It turns out for the PayPalExpressCheckout payment provider, I had added an event in the Merchello.Providers.Payment.PayPal.Controllers.PayPalExpressController named Processed to allow for sending notification emails after all of the redirections had completed. In the 2.1.0 version of FastTrack I had mishandled the event.
Here is a snippet the works:
/// <summary>
/// Handles the PayPalExpressCheckoutController processed event.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The event arguments.
/// </param>
private void PayPalExpressControllerProcessed(PayPalExpressController sender, PaymentAttemptEventArgs<IPaymentResult> e)
{
var attempt = e.Entity;
if (attempt.Payment.Success)
{
var email = attempt.Invoice.BillToEmail;
Notification.Trigger("OrderConfirmation", attempt, new[] { email }, Topic.Notifications);
}
}
@David - I've also updated the NotificationTriggerBase to log a WarnWithException showing an invalid model being passed to the trigger. It will still silently fail, but beford hand is was logging via Debug.
thanks for your investigation. Will add the event handling code and see if that helps.
Thanks for the inside of the order/invoice difference. For my case the digital goods don't have a download as they are (currently) generated by hand after the purchase. So the idea of setting the items to fullfilled after they are downloaded wouldn't fit. But understand the idea and it makes sense i think.
Don't use a custom monitor/trigger setup. So I had used the wrong object for the notification triggering. Think to log that would be a good idea, even if the triggering shouldn't really be called manually very often I think.
Again thanks for working on that issue and the explanation.
tried to implement the event like you showed in your post and after using the correct smpt settings in web.config all works now. One thing I chnaged was to cast the attempt to the right object. As on the first try no email was send.
But that was maybe caused by wrong smpt config.
At least it now sends the order confirmation mail. #h5yr
SMTP Provider problems
Hi all,
I'm currently integration Merchello 2.1.0 into my website. Everything is working fine except the smpt notification sending.
I added the smpt settings at the gateway tab and set up an OrderConfirmation notification.
The problem is the notification never gets send after the order is completet (currently with PayPal express checkout). The Umbraco log has also no error messages in it.
General sending is working.
Somebody faced the same problem?
Regards David
I don't know enough to diagnose the issue if it's complicated but I do recall this is a common complaint and that Rusty's initial resolve here may resolve it for you. https://our.umbraco.org/projects/collaboration/merchello/merchello/62002-v180-NotificationsEvents-not-firing
Hi David,
thanks for posting it. Will have a look and see if it gets me somewhere!
Regards David
Hi,...
sadly the post hasn't helped me with my problem.
Any other suggestion?
Regards David
Why don't you change the SMTP notification to write to your local directory by changing your web.config....
Then at least you can check if its your server settings which is causing the problem!
Or mail trap, but if general sending is working then that doesn't sound like it's an issue.
Perhaps it would help if you pasted some code?
Hi Topppers,
haven't thought about that to be honest. Tried it right now and nothing gets generated in the folder.
Hi David,
can't really provide some code as I haven't added anything for the mail sending as the default smtp gateway provider from merchello should handle the mail sending.
Error log also seems normal.
Regards David
I don't know Merchello but are there any settings on Merchello which cause it to send emails - which may be switched off?....
Hi Toppers,
there is a smtp gateway provider which is configured with my actual smtp settings which I also use for my contact page which is working fine.
Regards David
Similar to other providers in Merchello, Notifications have Gateway Providers which manage one or more methods for performing operations respective to the provider type. Notification provider methods are responsible for “sending notification messages.”
The built in Notification provider is the Email Notification provider, which as the name infers, is responsible for sending email (SMTP based) messages.
Notifications are loosely coupled with a set of “Triggers” and “Monitors” based on the .NET IObservable pattern. Triggers notify “subscribing” Monitors that it should execute some function or process for an object (model) the trigger passes to the monitor.
You can think of this as a monitor which has subscribed to the trigger then does something when the trigger instructs it to do so.
Note: The OrderConfirmation trigger sometimes confuses people that are first starting out in Merchello as it is generally triggered by Payment Provider developers once a payment has been authorized - so it “appears to act like an event” but in fact it is executed in the provider with code similar to:
The default SMTP Notification Provider, utilizes the triggers and monitors to send one or more messages for any configured monitor.
When a trigger is executed, any monitor subscribing to the trigger looks to see if it has any associated messages. If there are any messages, the monitor instantiates a formatter to format the message body and for each message passes the message and formatter off to be sent.
Assume in the diagram below that the Trigger is an “OrderConfirmation” trigger.
Monitor 1 has 3 messages associated with it through the back office. When the trigger is executed Monitor 1 creates a Razor formatter and sends the 3 messages through the SMTP Notification provider.
The messages could be completely different if a separate razor files were used to create the message bodies. They could also have different recipients so you could have:
This is taken from some of our Workshop. Not sure if it helps everyone understand notifications further.
Hey David,
I had another, similar, issue posted a couple of days ago with the Braintree provider implementation with the FastTrack starter. I think it may be an issue with things happening async - I'll be looking at it this week.
Can you confirm you are using the FastTrack starter (or implementation based off that example)?
Hi Lee, Hi Rusty,
thanks for that explanation. Really interesting to hear the internals of the notification system.
I'm not using the FastTrack starter right now. Just some custom implementation based on things I saw in the FastTrack code. Main reason for this was skipping al the shipment stuff as I only have digital goods.
I have done implementations for:
I can post the code if needed.
I also tried calling the notifications manually by the method that Lee provided but that also doesn't help.
I think I will try the FastTrack shop and see if it sends emails correctly. Then it's some stuff I done/or haven't done in my code.
Regards David
Hey David,
I'm actually working on both of these issues right now.
I tracked the problem with the fulfillment of the orders stems from a very early idea that orders with downloadable items should not be marked as fulfilled until they have been downloaded - but it was never fully implemented. It's also intermixed with some of the back ordering and returns stubs we have in the logic.
In Merchello, there is a difference between an invoice and and order. The concept is an invoice is generally used for payment and includes all line items (inluding shipping costs and tax) and the order is something that can be handed off to a warehouse / fulfillment system - which is more concerned with freight and inventory. It's sort of like the start to create a "bill of lading".
The setup is really overkill for simple stores, but may give you an idea of where we're heading. The data is setup so that we can create multiple orders of a single invoice and do some basic A/R operations like multiple payments to an invoice. Split a payment to pay for multiple invoices ... etc.
With respect to the non shippable items (downloads, class registrations), I think it's an area that we got too tricky as there really is no reason to include them in the order. I remember the use case being a piece of software where one variant could be downloadable and a second being shipped out physically in a box. IMO - something that is not going to be physically packaged and delivered should not be included in the order (only on the invoice).
Looking at your code above (unless you are using a custom trigger/monitor setup) The model passed into the notification should be an IPaymentResult not an order - but I'd have to see a bit more of the code to understand what your doing a bit better - happy to do that =)
I confirmed yesterday, that the PayPal provider is not sending the email correctly. I'm working on that today!
It turns out for the PayPalExpressCheckout payment provider, I had added an event in the
Merchello.Providers.Payment.PayPal.Controllers.PayPalExpressController
namedProcessed
to allow for sending notification emails after all of the redirections had completed. In the 2.1.0 version of FastTrack I had mishandled the event.Here is a snippet the works:
@David - I've also updated the
NotificationTriggerBase
to log a WarnWithException showing an invalid model being passed to the trigger. It will still silently fail, but beford hand is was logging via Debug.Hi Rusty,
Where should I add this event?
I am using Merchello Version 2.2.1 and it is not working as well.
I am trying via sandbox.
thank you for your help
Hi Rusty,
Now it is working when I have placed it in a controller.
But it is hitting three times, and therefore 3 the same emails are being sent.
Any idea how to change?
Kind Regards
Hi Rusty,
thanks for your investigation. Will add the event handling code and see if that helps.
Thanks for the inside of the order/invoice difference. For my case the digital goods don't have a download as they are (currently) generated by hand after the purchase. So the idea of setting the items to fullfilled after they are downloaded wouldn't fit. But understand the idea and it makes sense i think.
Don't use a custom monitor/trigger setup. So I had used the wrong object for the notification triggering. Think to log that would be a good idea, even if the triggering shouldn't really be called manually very often I think.
Again thanks for working on that issue and the explanation.
Regards David
Hi Rusty,
tried to implement the event like you showed in your post and after using the correct smpt settings in web.config all works now. One thing I chnaged was to cast the attempt to the right object. As on the first try no email was send.
But that was maybe caused by wrong smpt config.
At least it now sends the order confirmation mail. #h5yr
Regards David
is working on a reply...