CurrentUICulture in PaymentInfoRowFactory

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

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.

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

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?

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

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

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

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