Copied to clipboard

Flag this post as spam?

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


  • Craig Rowe 22 posts 175 karma points
    Nov 10, 2016 @ 16:47
    Craig Rowe
    0

    Manually firing OrderConfirmation Trigger / Notification

    If I run the following code:

    Notification.Trigger("OrderConfirmation", new PaymentResult(Attempt<IPayment>.Succeed(), invoice, false), new[] { email });
    

    with an invoice instance that I've created using checkoutManager.payment.PrepareInvoice() and InvoiceService.Save(invoice) should I expect a notification to fire if SMTP notifications are enabled and there is a tempalte for Order Confirmation.

    If I run this in debug and step over the Trigger line I get:

    Unable to cast object of type 'Merchello.Core.Models.MonitorModels.PaymentResultNotifyModel' to type 'Umbraco.Core.Models.IPublishedContent' in IntelliTrace and no e-mail (however the invoice is created and appears in 'sales' in the backoffice).
    

    Thanks in advance for any assistance

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Nov 10, 2016 @ 20:28
    Rusty Swayne
    0

    I'd actually have to step through that one myself to see exactly what you have going on, but my guess is the trigger is expecting a PaymentResult from at least an Authorize attempt - so their would be an instantiation of IPayment representing a the authorization attempt. This payment is passed to the success ...

     var paymentAttempt = Attempt.Succeed(payment); 
    

    so the speculation is there it can't create PaymentResultNotifyModel because of the null IPayment in the result.

  • Craig Rowe 22 posts 175 karma points
    Nov 11, 2016 @ 00:40
    Craig Rowe
    0

    I wondered whether it might be that, but looking at the source code for the Order Confirmation trigger it didn't seem to need/use the payment it was jsut using the Invoice.

  • Craig Rowe 22 posts 175 karma points
    Nov 14, 2016 @ 11:46
    Craig Rowe
    0

    Hi again Rusty,

    Thanks so much for your help so far.

    I can get a successful payment attempt, and can debug to the point of 'Merchello.Core.Observation.TriggerBase

    Cannot bind source type Merchello.Core.Models.MonitorModels.PaymentResultNotifyModel to model type Umbraco.Web.Models.RenderModel.
    

    I can't quite see where the issue is from that point on, potentially something during the Umbraco.Web.Mvc.RenderModelBinder.BindModel area

    The razor template is just the default for OrderConfirmation (and does work if I simply put it in a fast track instance)

    This is Merchello 2.3.0 and Umbraco 7. 5.3

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Nov 14, 2016 @ 16:59
    Rusty Swayne
    0

    Hey Craig,

    What is the model designated in your Razor view?

  • Craig Rowe 22 posts 175 karma points
    Nov 14, 2016 @ 18:13
    Craig Rowe
    0

    Hi Rusty,

    It's just the default template so:

    @inherits Merchello.Web.Mvc.MerchelloHelperViewPage<Merchello.Core.Models.MonitorModels.IPaymentResultMonitorModel>
    

    and a firing of:

    Notification.Trigger("OrderConfirmation", attempt, new[] { email });
    

    with a successful IPaymentResult 'attempt'

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Nov 14, 2016 @ 19:51
  • Craig Rowe 22 posts 175 karma points
    Nov 14, 2016 @ 23:30
    Craig Rowe
    2

    though it pains me to admit it took so long to register shortly after posting I realised it was because I had a ViewStart that was setting the layout. If I include Layout = null in the OrderConfirmation template it works e.g. the RazorTemplate process is doing the equivalant of 'View()' not 'PartialView()'

    Thanks for your time and effort on this and merchello in general!

  • john blair 48 posts 219 karma points
    Apr 12, 2019 @ 11:34
    john blair
    0

    Exact same problem here! Thanks for the pointer.

    I've requested the Layout=null as a pull request for OrderConfirmation and OrderShipped razor files to try and help other people avoid this.

  • krzakivan 27 posts 93 karma points
    Feb 04, 2017 @ 14:14
    krzakivan
    0

    Hi all , I hope you can help me , Im using merchello and fasttrack template . Everything is working only sending order notigications is problem SMTP is set up right , and jusť a LEGACY option is working properly when I want to send RAZOR order confirmation , it wont send it :/ why ?

    I need some help

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 17, 2017 @ 16:45
Please Sign in or register to post replies

Write your reply to:

Draft