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.

  • Craig Agnew 22 posts 138 karma points
    Apr 28, 2015 @ 11:30
    Craig Agnew
    0

    Could not find the Payment with PaymentId

    Hi guys,

    I'm seeing a lot of these errors in the Umbraco log but not sure what is causing the issue.

    2015-04-28 10:00:36,075 [8] ERROR Umbraco.Core.UmbracoApplicationBase - [Thread 37] An unhandled exception occurred 
    System.NullReferenceException: Could not find the Payment with PaymentId: '462' or PaymentGuid: ''.    
        at UCommerce.Transactions.Payments.UrlPaymentExtractor.Extract(HttpRequest httpRequest)    
        at UCommerce.Transactions.Payments.GenericPaymentHandler.Execute(HttpContext context, IPaymentWindow& paymentWindow, Payment& payment)    
        at UCommerce.Transactions.Payments.PaymentProcessor.ProcessRequest(HttpContext context)    
        at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    

    Basically it seems what is happening is when an order is placed, the payment ID that is being passed to SagePay is different from the one that is finally saved in the database against the order. In this example, the order that was placed actually has a payment in [uCommerce_Payment] with ID of 468 somehow, not 462.

    Here is the code that requests the payment:

    var sagePay = TransactionLibrary.GetPaymentMethods(country).FirstOrDefault(x => x.Name == "SagePay" && x.Enabled);
    
    var payment = TransactionLibrary.CreatePayment(sagePay.Id, (decimal)order.OrderTotal, false);
    
    Session["orderId"] = _orderService.GetBasket().OrderId;
    
    TransactionLibrary.RequestPayment(payment.Id);
    

    Any pointers would be much appreciated.

    Thanks, Craig

  • Jesper Nielsen 141 posts 498 karma points
    May 05, 2015 @ 14:49
    Jesper Nielsen
    0

    Hello Craig,

    This strongly indicates that CreatePayment is being called multiple times, before the response from SagePay returns, converting the basket to an actual order.

    Perhaps you can log calls to CreatePayment and RequestPayment?

    Incidentally, you can get the purchase order like this, instead of using your _orderService:

    Session["orderId"]= payment.PurchaseOrder;

    What version of uCommerce are you running?

    Kind regards,
    Jesper

Please Sign in or register to post replies

Write your reply to:

Draft