Created
May 24, 2012 05:34
-
-
Save esitefinity/2779669 to your computer and use it in GitHub Desktop.
Sitefinity Ecommerce - Pre-purchasing processing hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Telerik.Sitefinity.Abstractions; | |
using Telerik.Sitefinity.Modules.Ecommerce; | |
namespace SitefinityWebApp | |
{ | |
public class Global : System.Web.HttpApplication | |
{ | |
protected void Application_Start(object sender, EventArgs e) | |
{ | |
Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized); | |
} | |
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e) | |
{ | |
if (e.CommandName == "Bootstrapped") | |
{ | |
EcommerceEvents.PreProcessOrder += new EcommerceEvents.OnPreProcessOrder(EcommerceEvents_PreProcessOrder); | |
} | |
OrderValidator EcommerceEvents_PreProcessOrder(Guid cartOrderId, CheckoutState checkoutState, Customer customer) | |
{ | |
bool isOrderValid = DateTime.Now.Second % 2 == 0; | |
OrderValidator orderValidator = new OrderValidator | |
{ | |
IsOrderValid = isOrderValid, | |
StatusMessage = "Order failed because of my custom rule" | |
}; | |
return orderValidator; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment