Is there a way to show Klarnas Order confirmation in the Accelerator with some setting/setup?
I can’t find anything, so i guess i have to implement that myself?
Litium version: 7.6
Is there a way to show Klarnas Order confirmation in the Accelerator with some setting/setup?
I can’t find anything, so i guess i have to implement that myself?
Litium version: 7.6
You can read here about implementing Klarnas confirmation snippet:
https://docs.litium.com/documentation/add-ons/payments/klarna/develop/show-klarna-receipt-snippet
Thanks, but following those steps would result in an Litiums confirmation page on reload, right?
I hade the same idea, but ended up getting the Html Snippet In the OrderController. Do you see any downside with this?
public ActionResult Confirmation(PageModel currentPageModel, Guid? orderId, bool isEmail = false)
{
// ...
GetKlarnasOrderConfirmationSnippet(model);
_cartService.Clear();
return View(model);
// ...
}
private void GetKlarnasOrderConfirmationSnippet(OrderConfirmationViewModel model)
{
// Has to be placed here. The decorators or original builder can't access _klarnaPaymentConfigV3.
var order = _moduleECommerce.Orders.GetOrder(model.Order.ExternalOrderID, _securityToken)?
.GetAsCarrier(false, false, false, false, false, true);
var paymentInfoCarrier = order?.PaymentInfo?.FirstOrDefault(x => x.PaymentProvider.StartsWith("Klarna"));
if (!string.IsNullOrWhiteSpace(paymentInfoCarrier?.PaymentMethod))
{
var paymentAccountId = _paymentWidgetService.GetPaymentAccountId(paymentInfoCarrier.PaymentMethod);
var klarnaCheckout = LitiumKcoApi.CreateFrom(paymentAccountId, (order, payment, kcoOrder) =>
_klarnaPaymentConfigV3.UpdateDataSentToKlarna(new UrlHelper(), order, payment, kcoOrder));
var checkoutOrder = klarnaCheckout.FetchKcoOrder(paymentInfoCarrier.TransactionNumber);
if (checkoutOrder.KlarnaOrderStatus == KlarnaOrderStatus.Complete)
{
model.HtmlSnippet = checkoutOrder.HtmlSnippet;
}
}
}
Yes, it would not appear after a refresh. Should not be an issue to use your solution from what I can tell.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.