# CurrentUICulture in PaymentInfoRowFactory

**URL:** <https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161>\
**Category:** Questions\
**Created:** [October 18, 2019, 2:12pm UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161 "2019-10-18T14:12:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/hans/32/31_2.png) [@hans](https://forum.litium.com/u/hans)\
**Post date:** [October 18, 2019, 2:12pm UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/1 "2019-10-18T14:12:47Z")

</div>

In which cases are `CultureInfo.CurrentCulture` and `CultureInfo.CurrentUICulture` expected to reflect the Litium assortment and web site culture rather than the default values of the current thread?

I notice that when `Litium.Foundation.Modules.ECommerce.Plugins.Payments.PaymentInfoRowFactory.PaymentInfoRowFactory.Create()` is called as part of the checkout during the request to “/site.axd/QliroPayment/Confirmation” `CultureInfo.CurrentUICulture` is not e.g. “sv-SE” as I’d expect but “en-GB” which is what my OS is set to. This causes an exception.

Is this expected behaviour?

Litium version: 7.3.0

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 18, 2019, 6:19pm UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/2 "2019-10-18T18:19:15Z")

</div>

Yes, that is expected behavior, the `/site.axd/*` is not going through Litium’s routing and then the culture information (or the `RouteRequestInfo`) will not be set.

---

<div class="post-metadata">

**Author:** ![hans](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/hans/32/31_2.png) [@hans](https://forum.litium.com/u/hans)\
**Post date:** [October 19, 2019, 8:45am UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/3 "2019-10-19T08:45:28Z")

</div>

So is that a bug in your Qliro add-on? It calls PaymentInfoRowFactory.PaymentInfoRowFactory.Create() that references CultureInfo.CurrentUICulture.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 19, 2019, 11:32am UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/4 "2019-10-19T11:32:50Z")

</div>

I think that it not is a bug in the addon itself and instead a missing part in the calling code. Do you have a callstack to share?

---

<div class="post-metadata">

**Author:** ![hans](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/hans/32/31_2.png) [@hans](https://forum.litium.com/u/hans)\
**Post date:** [October 21, 2019, 8:49am UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/5 "2019-10-21T08:49:38Z")

</div>

```auto
Litium.IWebLog - IWebLog exception 'Object reference not set to an instance of an object.': 71fd85f4-14b5-4cc9-b07c-ac25448a5d1c System.NullReferenceException: Object reference not set to an instance of an object.
   at Litium.Foundation.Modules.ECommerce.Plugins.Payments.PaymentInfoRowFactory.Create(OrderCarrier orderCarrier, SecurityToken token)
   at Litium.Foundation.Modules.ECommerce.Plugins.Payments.PaymentInfoCalculator.CalculateFromCarrier(OrderCarrier orderCarrier, SecurityToken token)
   at Litium.Accelerator.Services.Payments.QliroPaymentService.<ValidateAndReSetOrderCarrierFromQliro>g__ReCalculatePaymentInfo|15_1(ILitiumQliroOneOrder& order) in src\Litium.Accelerator\Services\Payments\QliroPaymentService.cs:line 294
   at Litium.Accelerator.Services.Payments.QliroPaymentService.ValidateAndReSetOrderCarrierFromQliro(ILitiumQliroOneOrder checkoutOrder, Boolean& hasOrderMismatch) in src\Litium.Accelerator\Services\Payments\QliroPaymentService.cs:line 330
   at Litium.Accelerator.Services.Payments.QliroPaymentService.PlaceOrder(String accountId, String merchantReference, Boolean isConfirmation) in src\Litium.Accelerator\Services\Payments\QliroPaymentService.cs:line 160
   at Litium.Accelerator.Mvc.Controllers.Checkout.QliroPaymentController.Confirmation(String accountId, String merchantReference) in src\Litium.Accelerator.Mvc\Controllers\Checkout\QliroPaymentController.cs:line 40

```

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 21, 2019, 9:44am UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/6 "2019-10-21T09:44:11Z")

</div>

Before setting the order on the cart with the `_cartAccessor.Cart.OrderCarrier = ...`, add the following lines

```auto
var channel = _channelService.Get(_cartAccessor.Cart.OrderCarrier.ChannelID);
if (channel?.WebsiteLanguageSystemId != null)
{
    CultureInfo.CurrentUICulture = _languageService.Get(channel.WebsiteLanguageSystemId.Value)?.CultureInfo ?? CultureInfo.CurrentUICulture;
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [November 18, 2019, 9:48am UTC](https://forum.litium.com/t/currentuiculture-in-paymentinforowfactory/1161/7 "2019-11-18T09:48:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
