Great question. We originally was trying to implement the license code auto generation as part of the out of box features. But we found out that license code generation is just one side of equation. The application (either client or server side software) that checks for the license code needs to be able to read and validate the code. This part has been customized in your own software. So we decided that the license code auto generation would not be part of out of box features since it has to be customized anywhere. However we put the placeholds in the database so that you can implement this easily.
Here are the steps that we expect people to do.
1) Create or reuse an enum value in ProductTypeEnum and update table DSC_Product_Type_lkp
2) Use customField in DSC_Order_Item to store license code. You are free to create a new table to store that.
3) Create a new ProcessorProvider which generates the registration code automatically.
public class CreateRegistrationCodeProcessorProvider : OrderProcessorProvider {
protected override void ProcessOrder(string host, Order order, IConfigurationSource cfgSrc) {
foreach (OrderItem item in order.OrderItems) {
if (ProductTypeEnum.RegistrationCodeAutoGen == item.ProductType) {
string newcode = ""; //use your own algorithm to create license code here
item.UpdateCustomerField(host, newcode);
}
}
}
4) Configure the new ProcessorProvider in DotShoppingCart.Commercial.OrderPipelineService.exe.config
<orderPipelineServiceConfiguration defaultProvider="">
<providers>
<add name="CreateRegistrationCode" type="DotShoppingCart.Commercial.OrderPipeline.CreateRegistrationCodeProcessorProvider, DotShoppingCart.Commercial.OrderPipeline"/>
</providers>
</orderPipelineServiceConfiguration>
Add a new entry to DSC_Order_Status_lkp for the order status that is waiting for creating registration code. E.g. set status to "Awaiting Product Registration Code Generation".
Add a new entry to DSC_OrderPipeline_Processor_lkp. Set orderStatusIdSource to the Id that you created above, set both isDownloadBypass and isWebDriven to 0 and displayName to Null
Update the orderPipelineConfiguration section in web\DSC.config to start using "CreateRegistrationCode".
<orderPipelineConfiguration>
<processorConfigurations>
<clear />
<add name="CreditCard">
<processors>
<clear />
<add name="OrderConfirmationEmail" />
<add name="CreditCardAuthorization" />
<add name="InventoryStockCheck" />
<add name="CreditCardCapture" />
<add name="OrderPackageAndShip" />
<add name="CreateRegistrationCode" />
<add name="CreateGiftCertificate" />
<add name="OrderCompleteEmail" />
</processors>
</add>
5) Customize your application to validate license code in DSC_Order_Item.customField
I hope this helps.
DotShoppingCart Staff
|