+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / How can a customer pay for a "pending order"?

How can a customer pay for a "pending order"?

2 posts, 0 answered
  1. Foodsleuth
    Foodsleuth avatar
    46 posts
    Registered:
    21 May 2008
    18 Aug 2015
    Link to this post

    When using Paypal Standard, a user can create an order, select Paypal for payment, then abort the order either by using the "cancel and return to website" link on the Paypal page OR by simply closing the Paypal window before completing the transaction.   Sitefinity still creates an order and even sends an email out telling the customer the order was accepted and shows "Payment" Paypal  which further leads the customer to believe they have a valid order.

    If the customer does want to complete the order, they have no way to access that "pending order" to complete the payment.   So, wondering what if anything people are doing out there when this happens?  Clearly we can cancel the order,  email the customer and tell them the order is cancelled but that's pretty unconventional, not to mention time consuming. 

    Suggestions?

    Thanks.

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    30 Sep 2016
    20 Aug 2015
    Link to this post
    Hi Barbara,

    This is the default behaviour and in if the order is placed but not paid - it should be recreated. You can also configure notifications for such pending orders. If needed they could be Deleted or Canceled in the backend. However there is a Feature Request logged for configure this here:
    http://feedback.telerik.com/Project/153/Feedback/Details/160814-checkout-add-option-to-disable-enable-email-sent-to-customer-upon-order-placed

    As workaround for this issue (intercept the emails and not send them) you can create a custom class to send emails for the eCommerce module:
    using System;
    using System.Linq;
    using Telerik.Sitefinity.Web.Mail;
         
    namespace SitefinityWebApp
    {
        public class EmailSenderCustom : StandardDotNetEmailSender
        {
            public override void Send(string from, string to, string subject, string message)
            {
                //Implement interception here and if the email is coming from the eCommerce skip the call to base.Send
                base.Send(from, to, subject, message);
            }
        }
    }

    Replace the built-in email sender by registering it in Global.asax using Telerik.Microsoft.Practices.Unity:
    protected void Application_Start(object sender, EventArgs e)
    {
        Bootstrapper.Initialized += Bootstrapper_Initialized;
    }
    void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
    {
        if (e.CommandName == "Bootstrapped")
        {
      
            ObjectFactory.Container.RegisterType<IEmailSender, EmailSenderCustom>("Standard");
               
        }
    }

    You can plug your logic there and check the subject of the email in order to make sure hat you are changing the subject only for the Ecommerce messages. You can plug your logic to change the subject and email there.

    When the payment is success the offsite provider returns success the Order in Sitefinity Ecommerce > Orders is changed from Pending to Paid
    At the point when the order status is changed to Paid an event is thrown where the Order data is available so email can be created. 
    Subscribe to this event to get the order data and construct email.

    Email can be sent with the same class that was customized to stop the order placed email.
    private void SendEmail(string from, string to, string subject, string body)
    {
        IEmailSender emailSender = EmailSender.Get();
        emailSender.SendAsync(from, to, subject, body, null);
    }

    I hope this helps

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered