2

i have implement all method for custome payment method , upload dll file to bin folder and check payment method in admin panel . paymet method appear in chekcout page but no one of my custom payment doesnt run . is there any full source of custom payment method in 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";
    }
}

doesnt redirect to google.com

--Add New why this code has not been overriden:

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

i have checked both inheritance public class MyCustomWorkflowFactory : WorkflowFactory and public class MyCustomWorkflowFactory : dnnWorkflowFactory but none of them overiden on protected virtual Task[] LoadThirdPartyCheckoutSelectedTasks() , problem is there , I think !

VDWWD
  • 35,079
  • 22
  • 62
  • 79
Moslem7026
  • 3,290
  • 6
  • 40
  • 51

2 Answers2

3

Great question... Generally, if your breakpoint isn't getting hit, it's because you either haven't yet selected it yet in the Admin > Extensibility area, your code isn't yet deployed to where you're testing, or your code isn't following the prescribed pattern (all noted in the documentation).

enter image description here

Oh, and always make sure your web.config file is set to allow debugging like this.

<compilation debug="true" strict="false" targetFramework="4.0">
Will Strohl
  • 1,646
  • 2
  • 15
  • 32
  • check out integration is empty and just have `no-integration' item, i will check `Action Delegate Pipeline Integration Project` – Moslem7026 Mar 09 '16 at 09:04
  • added more mistake on question , plz see it and tell the solution . in original sample it has been inheritance from `dnnWorkflowFactory` is that true ?! – Moslem7026 Mar 09 '16 at 15:57
  • I think the biggest issue here is that you're not even able to debug, right? That needs to be addressed before any other suggestions are valid. – Will Strohl Mar 10 '16 at 06:38
  • no! break point hits on "MethodSettings" exp : `get { return GetSettingOrEmpty("Pin"); }`(whene loading payment method list) but not hits on `StartMyPaymentMethodCheckout` class , 100% problem is `MyCustomWorkflowFactory : WorkflowFactory` that woldnt be overriden. it seems that workflow go to run another methods. – Moslem7026 Mar 10 '16 at 07:15
2

If you haven't already, you may want to check out the detailed documentation for deployment at https://hotcakescommerce.zendesk.com/hc/en-us/articles/204725899-Custom-Payment-Method-Example

David Poindexter
  • 488
  • 4
  • 12
  • i have checked , may be problem is `WorkFlow` integration. that has not been explain there on `custome` payment method – Moslem7026 Mar 09 '16 at 09:01
  • `protected override Task[] LoadThirdPartyCheckoutSelectedTasks()` on sample didnt effect on workflow (or didnt overriden) – Moslem7026 Mar 09 '16 at 15:58