hotcakecommerce自定义付款方式不起作用

时间:2016-03-05 12:01:36

标签: asp.net e-commerce dotnetnuke dotnetnuke-module

我实现了客户付款方式的所有方法,将dll文件上传到bin文件夹并在管理面板中查看付款方式。 paymet方法出现在chekcout页面,但没有我的自定义付款没有运行。 hotcakecommerce中有自定义付款方式的完整来源吗? workfolw:

public class StartMyPaymentMethodCheckout : ThirdPartyCheckoutOrderTask
{
    public override string PaymentMethodId
    {
        get { return MyPaymentMethod.Id(); }
    }

    public override bool ProcessCheckout(OrderTaskContext context)
    {

        if (context.HccApp.CurrentRequestContext.RoutingContext.HttpContext != null)
        {
            try
            {
                MyPaymentMethodSettings settings = new MyPaymentMethodSettings();
                var methodSettings = context.HccApp.CurrentStore.Settings.MethodSettingsGet(PaymentMethodId);
                settings.Merge(methodSettings);

                // Here you can do custom processing of your payment.

                // It can be direct post to payment service or redirection to hosted payment page
                // In either case you have to end up on HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment) page
                // So either you have to do such redirect here on your own
                // or make sure that third party hosted pay page will make it in case of successfull or failed payment

                HttpContextBase httpContext = new HccHttpContextWrapper(HttpContext.Current);
                httpContext.Response.Redirect("http://www.google.com");
            }
            catch (Exception ex)
            {
                EventLog.LogEvent("My Custom Checkout", "Exception occurred during call to Moneris: " + ex.ToString(), EventLogSeverity.Error);
                context.Errors.Add(new WorkflowMessage("My Custom Checkout Error", GlobalLocalization.GetString("MonerisCheckoutError"), true));
                return false;
            }
        }

        return false;
    }

    public override bool Rollback(OrderTaskContext context)
    {
        return true;
    }

    public override Task Clone()
    {
        return new StartMyPaymentMethodCheckout();
    }

    public override string TaskId()
    {
        return "E9B1A204-7C61-4664-A043-81BF43E24251";
    }

    public override string TaskName()
    {
        return "Start My ckout";
    }
}

没有重定向到google.com

- 添加新 为什么这段代码没有被覆盖:

namespace MyCompany.MyPaymentMethod
{
    public class MyCustomWorkflowFactory : WorkflowFactory
    {
        protected override Task[] LoadThirdPartyCheckoutSelectedTasks()
        {
            return new Task[]
            {           
                new StartMyPaymentMethodCheckout()
            };
        }
    }
}

我已经检查了继承public class MyCustomWorkflowFactory : WorkflowFactorypublic class MyCustomWorkflowFactory : dnnWorkflowFactory但是protected virtual Task[] LoadThirdPartyCheckoutSelectedTasks()没有覆盖它们,我认为存在问题!

2 个答案:

答案 0 :(得分:3)

很棒的问题...一般来说,如果你的断点没有被击中,那是因为你还没有在Admin>中找到它。可扩展性区域,您的代码尚未部署到您正在测试的位置,或者您的代码未遵循规定的模式(all noted in the documentation)。

enter image description here

哦,并且始终确保您的web.config文件设置为允许这样的调试。

<compilation debug="true" strict="false" targetFramework="4.0">

答案 1 :(得分:2)

如果您还没有,可能需要查看https://hotcakescommerce.zendesk.com/hc/en-us/articles/204725899-Custom-Payment-Method-Example

部署的详细文档。