When Klarna widget is loaded the delivery address is populated with the Litium customers address but the address for the customer information (Dina uppgifter) is not. Only the email address, names and the phone number is populated.
Looks like the delivery address is loaded from the Address property of Cart.OrderCarrier.Deliveries and the customer information (Dina uppgifter) address is loaded from the BillingAddress property of Cart.OrderCarrier.PaymentInfo.
Can’t find where the Cart.OrderCarrier.PaymentInfo BillingAddress is populated.
Where would be the correct place to complement it with the customers address information? And how?
Maybe you could try changing ChangePaymentMethod in CheckoutServiceImpl to something like this:
public override void ChangePaymentMethod(string paymentMethodId)
{
var currentLanguage = _languageService.Get(_requestModelAccessor.RequestModel.ChannelModel.Channel.WebsiteLanguageSystemId.Value);
var checkoutFlowInfo = _requestModelAccessor.RequestModel.Cart.CheckoutFlowInfo;
checkoutFlowInfo.SetValue(CheckoutConstants.ClientLanguage, currentLanguage.CultureInfo.Name);
checkoutFlowInfo.SetValue(CheckoutConstants.ClientTwoLetterISOLanguageName, currentLanguage.CultureInfo.TwoLetterISOLanguageName);
var currentOrderCarrier = _requestModelAccessor.RequestModel.Cart.OrderCarrier;
var paymentMethodParts = paymentMethodId.Split(':');
var paymentMethod = _moduleECommerce.PaymentMethods.Get(paymentMethodParts[1], paymentMethodParts[0], SecurityToken.CurrentSecurityToken);
// populate address carrier if user is logged in
var billingAddress = new AddressCarrier();
if (!SecurityToken.CurrentSecurityToken.IsAnonymousUser)
{
var person = _personService.Get(SecurityToken.CurrentSecurityToken.UserID);
var addressType = _addressTypeService.Get(AddressTypeNameConstants.Address);
var address = person.Addresses.FirstOrDefault(x => x.AddressTypeSystemId == addressType.SystemId);
billingAddress = address.MapTo<AddressViewModel>().MapTo<AddressCarrier>();
}
_moduleECommerce.CheckoutFlow.AddPaymentInfo(currentOrderCarrier, paymentMethod.PaymentProviderName, paymentMethod.Name, billingAddress, SecurityToken.CurrentSecurityToken);
_moduleECommerce.Orders.CalculateOrderTotals(currentOrderCarrier, SecurityToken.CurrentSecurityToken);
}