Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Apr 03, 2013 @ 12:36
    Kim Søjborg Pedersen
    0

    Error in GetPaymentMethods() if no shippingaddress

    I need to call TransactionLibrary.GetPaymentMethods() before I create the shipping address, but when I try I get an error. I have tried with TransactionLibrary.GetPaymentMethods(TransactionLibrary.GetCountries().FirstOrDefault()) also.

    As you see in the error message the UCommerce.Transactions.TransactionLibraryInternal.GetPaymentMethods expect a shippingAddressName, but why? 

    Object reference not set to an instance of an object.

     

    System.Collections.Generic.ICollection`1[UCommerce.EntitiesV2.PaymentMethod] GetPaymentMethods(System.String)

       at UCommerce.Transactions.TransactionLibraryInternal.GetPaymentMethods(String shippingAddressName)

       at Castle.Proxies.Invocations.TransactionLibraryInternal_GetPaymentMethods.InvokeMethodOnTarget()

       at Castle.DynamicProxy.AbstractInvocation.Proceed()

       at UCommerce.Infrastructure.Interceptor.ExceptionLoggingInterceptor.Intercept(IInvocation invocation)

       at UCommerce.Infrastructure.Interceptor.ExceptionLoggingInterceptor.Intercept(IInvocation invocation)

       at Castle.DynamicProxy.AbstractInvocation.Proceed()

       at Castle.Proxies.TransactionLibraryInternalProxy.GetPaymentMethods(String shippingAddressName)

       at Castle.Proxies.Invocations.TransactionLibraryInternal_GetPaymentMethods_1.InvokeMethodOnTarget()

       at Castle.DynamicProxy.AbstractInvocation.Proceed()

       at UCommerce.Infrastructure.Interceptor.ExceptionLoggingInterceptor.Intercept(IInvocation invocation)

       at Castle.DynamicProxy.AbstractInvocation.Proceed()

       at Castle.Proxies.TransactionLibraryInternalProxy.GetPaymentMethods(Country country)

       at ASP._Page_macroScripts_uCommerce_Address_cshtml.Execute()

       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

       at System.Web.WebPages.WebPage.ExecutePageHierarchy()

       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)

       at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)

       at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

       at umbraco.macro.loadMacroScript(MacroModel macro)

       at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

       at umbraco.presentation.templateControls.Macro.CreateChildControls()

       at System.Web.UI.Control.EnsureChildControls()

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Control.InitRecursive(Control namingContainer)

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

       at System.Web.UI.Page.ProcessRequest()

       at System.Web.UI.Page.ProcessRequest(HttpContext context)

       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

       at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)

       at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)

       at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)

       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

       at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)

       at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHand...

     

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 04, 2013 @ 10:34
    Morten Skjoldager
    0

    Hi Kim,

    This is because paymentmethods are configured to have a list of enabled countries of which the paymentmethod is available because you can have multiple stores and customers globally.

    So whenever you send a country it would get a list of paymentmethods available for that country. No problem.

    If you don't send anything it would find the shippingaddress on the basket and look for that country. So if no context is found (country), no paymentmethods could be found. So if there's no country on the shippingaddress (or the shippingaddress is null), you'll get a problem.

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Apr 04, 2013 @ 13:01
    Kim Søjborg Pedersen
    0

    Hi Morten, 

    When I call it with a country like this "TransactionLibrary.GetPaymentMethods(TransactionLibrary.GetCountries().FirstOrDefault())"  the internal function still looks for a shippingAddressName so I don't think that is the solution.

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 04, 2013 @ 13:06
    Morten Skjoldager
    100

    It defaults to GetPaymentMethods() if TransactionLibrary.Getcountries().FirstOrDefault() returns null, so my guess is that it does so, and defaults to GetPaymentMethods(). Can you verify what GetCountries().FirstOrDefault() returns? 

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Apr 08, 2013 @ 10:21
    Kim Søjborg Pedersen
    1

    I got it to work now by calling the TransactionLibrary.GetPaymentMethods(TransactionLibrary.GetCountries().FirstOrDefault()) so I don't know what was wrong in the first place :)

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 08, 2013 @ 12:44
    Morten Skjoldager
    0

    Allright Good to know :) 

Please Sign in or register to post replies

Write your reply to:

Draft