Copied to clipboard

Flag this post as spam?

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


  • Michael Nielsen 155 posts 812 karma points
    Mar 05, 2024 @ 15:11
    Michael Nielsen
    0

    Finalizing Umbraco Commerce orders result in OrderStatus Error

    Hi

    I have a product configurator where customers can request and order specialized products.

    As customers should not go through the regular checkout flow with these products, I'm trying to finalize the orders through the API instead.

    From what I understand, this should do it.

    order.InitializeTransaction();
    order.Finalize(order.TotalPrice, Guid.NewGuid().ToString("N"), PaymentStatus.Authorized);
    _umbracoCommerceApi.SaveOrder(order);
    

    The orders also seem to be finalized, if I check the database, I cannot see any differences between orders finalized this way and those that are finalized through the regular checkout flow.

    However, orders finalized through the API, get the orderstatus "Error". And there aren't any further information in the Logs as to why.

    Umbraco v13.1.1

    Umbraco Commerce v13.0.0

  • Scott 4 posts 94 karma points
    Mar 06, 2024 @ 08:49
    Scott
    0

    I'm also having this problem for a similar scenario. I've tried specifically setting the order status using

    writableOrder.SetOrderStatus(orderStatus, OrderStatusCode.Ok);
    

    but this doesnt seem to make a difference, I still get an order status of Error.

    Hopefully someone can help?

  • Scott 4 posts 94 karma points
    Mar 06, 2024 @ 09:58
    Scott
    0

    I came up with a solution to my problem, its not ideal but will do for now. I found some errors in the logs

    An error occured whilst fetching the exchange rate for order... 
    

    I imagine once the order is saved, something behind the scenes runs that tries to get the exchange rates, I dont really care about this or need it, so I just set the status after the first save and then save the order again, and this now saves with the correct order status

  • Michael Nielsen 155 posts 812 karma points
    Mar 06, 2024 @ 11:13
    Michael Nielsen
    0

    I can see that I forgot to include version numbers in my initial post, so I've added them.

    I don't get any errors in the logs at all, perhaps because we're using different versions.

    But what you are saying is, that you are doing this?

    order.InitializeTransaction();
    order.Finalize(order.TotalPrice, Guid.NewGuid().ToString("N"), PaymentStatus.Authorized);
    
    _umbracoCommerceApi.SaveOrder(order);
    
    var orderStatus = _umbracoCommerceApi.GetOrderStatus(storeId, "OrderStatusAlias");
    order.SetOrderStatus(orderStatus , OrderStatusCode.Ok);
    
    _umbracoCommerceApi.SaveOrder(order);
    
  • Michael Nielsen 155 posts 812 karma points
    Mar 06, 2024 @ 11:19
    Michael Nielsen
    0

    I can confirm that the above is working, however I would prefer to find out why and the order being set to "Error" in the first place.

  • Scott 4 posts 94 karma points
    Mar 06, 2024 @ 11:35
    Scott
    0

    Hi Micheal, yeah thats correct, like i said its not ideal but does what I need.

    I found this old thread which might be of use (or at least its vaguely related to why I was seeing Error as my order status)

    https://our.umbraco.com/packages/website-utilities/vendr/vendr-support/108153-exchange-rate-for-order-vendr

    Im using Umbraco V13.0.3 and Umbraco Commerce v13.0.0 in case you were wondering

  • Michael Nielsen 155 posts 812 karma points
    Mar 06, 2024 @ 11:58
    Michael Nielsen
    0

    Yea I found that too, but dismissed it as it looked like an issue with a limitation on a 3rd party service that handles exchange rates, and it seems to have been resolved by switching to a different service.

    I'm not sure it's related to this issue. Maybe you have a different issue with exchange rates, which could explain why you are seeing that error in your logs, and I'm not. 🤷‍♂️

    But thanks for the input 👍, I did not think to do a double save, it's an acceptable workaround for now, and then I hope someone else comes a long with a solution to the issue.

Please Sign in or register to post replies

Write your reply to:

Draft