using Hotcakes.Commerce.BusinessRules;
using Hotcakes.Commerce.BusinessRules.OrderTasks;
using Hotcakes.Commerce.Dnn.Workflow;
using <%= fullNamespace %>.MyWorkflow.Tasks;
namespace <%= fullNamespace %>.MyWorkflow
{
///
/// This is the MyWorkflow class. Developers should use this as a guide on how to integrate custom tasks or development
/// into the normal flow of an order. Each of these workflows are executed by the payment workflow engine.
/// In order to inject your code at any point in this process, simply uncomment the override and update the steps to
/// include your code at the appropriate time.
///
public class MyWorkflow : DnnWorkflowFactory
{
///
/// This is the workflow that runs whenever an order is moved from the "New" state to the "TODO" state.
/// Note that this is where we gave you an example - checkout the MySimpleTask and MyOrderTask tasks.
///
///
protected override Task[] LoadProcessNewOrderTasks()
{
return new Task[]
{
new WorkflowNote("Starting Process Order Workflow"),
new UpdateOrder(),
new CheckForZeroDollarOrders(),
new DnnCreateUserAccountForNewCustomer(),
new AssignOrderToUser(),
new AssignOrderNumber(),
new MakeOrderAddressUsersCurrentAddress(),
new AddUserAddressesToAddressBook(),
new UpdateLineItemsForSave(),
new UpdateOrder(),
new DnnMakePlacedOrder(),
new WorkflowNote("Finished Process Order Workflow"),
new UpdateOrder(),
// NEW TASKS!!
new MySimpleTask(),
new MyOrderTask()
};
}
/////
///// This is the workflow that runs on an order whenever your customer checks out.
///// Add your custom tasks anywhere in that process.
/////
/////
//protected override Task[] LoadVerifyOrderSizeTasks()
//{
// return new Task[]{
// new ApplyMinimumOrderAmount(),
// new CheckForOrderMaximums()
// };
//}
/////
///// This is the workflow that runs whenever an order is marked as shipped.
/////
/////
//protected override Task[] LoadDropShipTasks()
//{
// return new Task[]{
// new RunAllDropShipWorkflows()
// };
//}
/////
///// This is the workflow that runs after a package is marked shipped.
/////
/////
//protected override Task[] LoadPackageShippedTasks()
//{
// return new Task[]{
// new EmailShippingInfo()
// };
//}
/////
///// Whenever an order is edited, this workflow is run. Add a new array of Task[] in order to add your custom code to the workflow that is run here.
/////
/////
//protected override Task[] LoadOrderEditedTasks()
//{
// return new Task[]{
// new TaxProviderCancel(),
// new RunPaymentChangedWorkflow(),
// new UpdateOrder()
// };
//}
/////
///// This workflow will run when the order status is changed. Currently, it checks to synchronize gift card values.
/////
/////
//protected override Task[] LoadOrderStatusChangedTasks()
//{
// return new Task[]{
// new GiftCertificatesStatusUpdate(GiftCertificatesStatusUpdate.Mode.OrderStatusChanged)
// };
//}
/////
///// This workflow is run whenever the payment method for an order is changed.
/////
/////
//protected override Task[] LoadPaymentChangedTasks()
//{
// return new Task[]{
// new RunWorkFlowIfPaid(),
// new MarkCompletedWhenShippedAndPaid(),
// new ChangeOrderStatusWhenPaymentRemoved(),
// new TaxProviderCancelWhenPaymentRemoved(),
// new GiftCertificatesStatusUpdate(GiftCertificatesStatusUpdate.Mode.PaymentChanged),
// new UpdateOrder()
// };
//}
///
/// This workflow is run after payment has been applied. This is a great place to run workflow tasks that should not run until after a valid payment has been applied to the order.
///
///
//protected override Task[] LoadPaymentCompleteTasks()
//{
// return new Task[]{
// new UpdateOrder(),
// new TaxProviderCommitTaxes(),
// new UpdateOrder(),
// new EmailVATInvoice(),
// new IssueGiftCertificates(),
// new IssueRewardsPoints(),
// new RunAllDropShipWorkflows(),
// // Added to handle "membership" products
// new MembershipTask()
// };
//}
/////
///// This workflow is run after a new order has been accepted to process payments. This is where PayPal Express is applied as well as credit cards and reward points.
/////
/////
//protected override Task[] LoadProcessNewOrderPaymentsTasks()
//{
// return new Task[]{
// new WorkflowNote("Starting Process Order Workflow"),
// new UpdateOrder(),
// new CheckForZeroDollarOrders(),
// new CreateUserAccountForNewCustomer(),
// new AssignOrderToUser(),
// new AssignOrderNumber(),
// new MakeOrderAddressUsersCurrentAddress(),
// new AddUserAddressesToAddressBook(),
// new UpdateLineItemsForSave(),
// new UpdateOrder(),
// new MakePlacedOrder(),
// new WorkflowNote("Finished Process Order Workflow"),
// new UpdateOrder()
// };
//}
/////
///// This workflow is run after the payments have been applied.
/////
/////
//protected override Task[] LoadProcessNewOrderAfterPaymentsTasks()
//{
// return new Task[]{
// new WorkflowNote("Starting Order After Payment Workflow"),
// new UpdateOrder(),
// new LocalFraudCheck(),
// new MarkCompletedWhenShippedAndPaid(),
// new EmailOrder("Customer"),
// new EmailOrder("Admin"),
// new WorkflowNote("Finished Order After Payment Workflow"),
// new UpdateOrder()
// };
//}
/////
///// This workflow is run after the status of shipping changes.
/////
/////
//protected override Task[] LoadShippingChangedTasks()
//{
// return new Task[]{
// new MarkCompletedWhenShippedAndPaid(),
// new ChangeOrderStatusWhenShipmentRemoved(),
// new UpdateOrder(),
// new RunShippingCompleteWorkFlow()
// };
//}
/////
///// This workflow is run after shipping is marked as complete. This is a great place to add tasks that should happen after an order is shipped like those related to external
///// ERP inventory integration.
/////
/////
//protected override Task[] LoadShippingCompleteTasks()
//{
// return new Task[]{
// new EmailShippingInfo()
// };
//}
/////
///// This workflow is run to execute external checkout providers, meaning those not run directly against an API.
///// To-date, this is only PayPal Express?
/////
/////
//protected override Task[] LoadThirdPartyCheckoutSelectedTasks()
//{
// return new Task[]{
// new StartPaypalExpressCheckout(),
// new StartMonerisCheckout()
// };
//}
}
}