public ActionResult Signup(SignupViewModel signup) { if (!ModelState.IsValid) { return(new ShapeResult(this, _services.New.Checkout_Signup(Signup: signup))); } var customer = _customerService.CreateCustomer(signup.Email, signup.Password); customer.FirstName = signup.FirstName; customer.LastName = signup.LastName; customer.Title = signup.Title; customer.AgreeTermsAndConditions = signup.AcceptTerms; customer.SubscribeToMailingList = signup.ReceiveNewsletter; customer.ReceivePost = signup.ReceivePost; _authenticationService.SignIn(customer.User, true); // Welcome message gets sent whether or not they subscribe to the mailing list _email.Process(new Dictionary <string, object> { { "Recipients", signup.Email }, { "Subject", _webshopSettings.Settings.WelcomeSubject }, { "BodyTemplate", MergeBody(customer) }, }); //_messageManager.Send(new[] { signup.Email }, "WELCOME", "email", new Dictionary<string, string> // { // { "Subject", _webshopSettings.Settings.WelcomeSubject}, // { "BodyTemplate", _webshopSettings.Settings.WelcomeBodyTemplate }, // { "LastName", customer.LastName }, // { "FirstName", customer.FirstName }, // { "Subscribed", signup.ReceiveNewsletter.ToString() }, // { "UnsubscribeEmail", _webshopSettings.Settings.UnsubscribeEmail} // }); return(RedirectToAction("SelectAddress")); }
public ActionResult PaymentResponse() { var args = new PaymentResponse(HttpContext); foreach (var handler in _paymentServiceProviders) { handler.ProcessResponse(args); if (args.WillHandleResponse) { break; } } if (!args.WillHandleResponse) { throw new OrchardException(_t("Such things mean trouble")); } var order = _orderService.GetOrderByNumber(args.OrderReference); _orderService.UpdateOrderStatus(order, args); var user = _authenticationService.GetAuthenticatedUser(); if (user == null) { throw new OrchardSecurityException(_t("Login required")); } var customer = user.ContentItem.As <CustomerPart>(); if (customer == null) { throw new InvalidOperationException("The current user is not a customer"); } if (order.Status == OrderStatus.Paid) { // send an email confirmation to the customer string subject = string.Format("Your Order Number {0} has been received", order.Id); string body = string.Format("Dear {0}<br/><br/>Thank you for your order.<br/><br/>You will receive a Tax Invoice when your order is shipped.", customer.FirstName); _messageManager.Process(new Dictionary <string, object> { { "Recipients", user.Email }, { "Subject", subject }, { "Body", body } }); //_messageManager.Send(user.ContentItem.Record, "ORDER_RECEIVED", "email", new Dictionary<string, string> //{ // { "Subject", subject }, // { "Body", body} //}); // send a copy of the order to the administator _messageManager.Process(new Dictionary <string, object> { { "Recipients", _webshopSettings.GetAdministratorEmail() }, { "Subject", string.Format("Order Number {0} received from {1} {2}", order.Id, customer.FirstName, customer.LastName) }, { "Body", body } }); //string adminEmail = _webshopSettings.GetAdministratorEmail(); //if (!string.IsNullOrWhiteSpace(adminEmail)) // _messageManager.Send(new List<string> { adminEmail}, "ORDER_RECEIVED", "email", new Dictionary<string, string> // { // { "Subject", string.Format("Order Number {0} received from {1} {2}", order.Id, customer.FirstName, customer.LastName) }, // { "Body", body} // }); // decrement stock levels _shoppingCart.RemoveFromStock(); // finally, clear the order _shoppingCart.Clear(); } return(new ShapeResult(this, _shapeFactory.Order_PaymentResponse(Order: order, PaymentResponse: args, ContinueShoppingUrl: _webshopSettings.GetContinueShoppingUrl()))); }