We need different CheckoutOptions per delivery country in our Klarna Checkout. Specifically, we need to make the date of birth aka the social security number mandatory for some countries because of distributor requirements, but do not want that for other countries.
In the accelerator, it looks like the CheckoutOptions are only sent to Klarna when the payment widget is created. It also looks like when inside the Klarna Checkout UI, only shipping option updates are sent to Litium.
I’m guessing that the easiest way to achieve different CheckoutOptions per delivery country would be to recreate the payment widget when the delivery country changes? However, I can’t find an obvious place in the accelerator/Klarna flow to do that.
There is something in the KlarnaCheckoutController
which looks similar to our needs:
SetShippingOption():
...
if (!_paymentConfigv3.IsCampaignApplied(GetSavedOrder()) && model.PaymentWidget != null)
// if the shipping option is not validated, we need to reload the payment widget in order to re-calculate the total order
model.PaymentWidget = _paymentMethodViewModelBuilder.BuildWidget(model.SelectedPaymentMethod);
}
Would doing a BuildWidget
like the above (in SetShippingOption
) work?
Litium version: 7.6.2 + accelerator