Copied to clipboard

Flag this post as spam?

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


  • Adrian Blake 10 posts 40 karma points
    Dec 05, 2013 @ 20:48
    Adrian Blake
    0

    UCommerce - Custom Payment service, CreatePayment null reference

    Hello, I desperately seek help with adding a custom payment service to UCommerce. It seem to see my DLL fine with Payments.cshtml script, my entry is as follows:

    <!-- Moneris (Canada) --> <component id="Moneris" service="UCommerce.Transactions.Payments.IPaymentMethodService, UCommerce" type="uCommerceMoneris.MonerisPurchase, uCommerceMoneris" />

    However during checkout when i choose the only payment method available that is setup (Moneris, my custom service I added to the backend). I get this error:

    Error Loading Razor Script (file: uCommerce Payment) Object reference not set to an instance of an object.    at uCommerceMoneris.MonerisPurchase.CreatePayment(PaymentRequest request)
      at UCommerce.Transactions.TransactionLibraryInternal.CreatePayment(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at Castle.Proxies.TransactionLibraryInternalProxy.CreatePayment_callback(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at Castle.Proxies.Invocations.TransactionLibraryInternal_CreatePayment.InvokeMethodOnTarget()
      at Castle.DynamicProxy.AbstractInvocation.Proceed()
      at UCommerce.Infrastructure.Interceptor.ExceptionLoggingInterceptor.Intercept(IInvocation invocation)
      at Castle.DynamicProxy.AbstractInvocation.Proceed()
      at Castle.Proxies.TransactionLibraryInternalProxy.CreatePayment(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at UCommerce.Api.TransactionLibrary.CreatePayment(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at ASP._Page_macroScripts_uCommerce_Payment_cshtml.Execute() in d:\Virtuals\cybertekssystems_com\ktfloral_ca\Web\MacroScripts\uCommerce\Payment.cshtml:line 15
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      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)

    Error loading MacroEngine script (file: uCommerce/Payment.cshtml, Type: ''
    Object reference not set to an instance of an object.
      at uCommerceMoneris.MonerisPurchase.CreatePayment(PaymentRequest request)
      at UCommerce.Transactions.TransactionLibraryInternal.CreatePayment(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at Castle.Proxies.TransactionLibraryInternalProxy.CreatePayment_callback(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at Castle.Proxies.Invocations.TransactionLibraryInternal_CreatePayment.InvokeMethodOnTarget()
      at Castle.DynamicProxy.AbstractInvocation.Proceed()
      at UCommerce.Infrastructure.Interceptor.ExceptionLoggingInterceptor.Intercept(IInvocation invocation)
      at Castle.DynamicProxy.AbstractInvocation.Proceed()
      at Castle.Proxies.TransactionLibraryInternalProxy.CreatePayment(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at UCommerce.Api.TransactionLibrary.CreatePayment(Int32 paymentMethodId, Decimal amount, Boolean requestPayment, Boolean overwriteExisting)
      at ASP._Page_macroScripts_uCommerce_Payment_cshtml.Execute() in d:\Virtuals\cybertekssystems_com\ktfloral_ca\Web\MacroScripts\uCommerce\Payment.cshtml:line 15
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      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)

    This is my DLL with the class which implements IPaymentFactory, IPaymentMethodService for the service:

    namespace uCommerceMoneris

    {

        public class MonerisPurchase : IPaymentFactory, IPaymentMethodService

        {

            public string Name { get; set; }

     

            ///

     

     

     

            /// Creates a new payment fully initialized

            ///

     

     

     

            ///

            ///

            public Payment CreatePayment(PaymentRequest request)

            {

                PurchaseOrder order = request.PurchaseOrder;

     

                var payment = new Payment

                {

                    TransactionId = Guid.NewGuid().ToString(),

                    PaymentMethodName = request.Payment.PaymentMethodName,

                    Created = DateTime.Now,

                    Fee = CalculatePaymentFee(request).Value,

                    FeePercentage = request.PaymentMethod.FeePercent,

                    Amount = request.Amount.Value

                };

     

                return payment;

            }

     

    Does annyone have any ideas what's going on here? I've seen similar issues and tried everything I've found in the forums to no avail. Version info: Umbraco 6.1.6 and uCommerce 4.0.3.13287


    Thanks!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies