Show shipping methods
You can show the shipping options inside the Qliro iframe. Follow these instructions below to enable.
Note: Your Qliro site should be publicly visible to Qliro for Shipping methods to work. See below for setting up local host when developer testing.
- In the Qliro config file, enable set the enableShippingMethods attribute to "true"
- You need to override the default shipping method implementation to send the list of shipping options to Qliro. Qliro calls the Litium Qliro Addon, which in tern calls the Build() method and GetDeliveryMethods(). Following is a example code for Accelerator 7.1 to override it.
using Litium.AddOns.Qliro.Api.Models;
using Litium.AddOns.Qliro.Abstractions;
using Litium.Foundation.Modules.ECommerce;
using Litium.Foundation.Modules.ECommerce.Deliveries;
using Litium.Foundation.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using Litium.AddOns.Qliro.Builders;
using Litium.Globalization;
namespace Litium.Accelerator.Payments.Handlers
{
public class CustomQliroShippingMethodsBuilder : QliroShippingMethodsBuilder
{
private readonly ChannelService _channelService;
public CustomQliroShippingMethodsBuilder(ChannelService channelService)
{
_channelService = channelService;
}
public override List<ShippingMethod> Build(ShippingMethodBuildArgs args)
{
return base.Build(args);
}
protected override List<DeliveryMethod> GetDeliveryMethods(ShippingMethodBuildArgs args)
{
var channel = _channelService.Get(args.OrderCarrier.ChannelID);
if (channel == null)
return new List<DeliveryMethod>();
var deliveryMethodIds = channel.CountryLinks?.FirstOrDefault()?.DeliveryMethodSystemIds ?? Enumerable.Empty<Guid>();
return deliveryMethodIds.Select(deliveryMethodId => ModuleECommerce.Instance.DeliveryMethods.Get(deliveryMethodId, SecurityToken.CurrentSecurityToken)).ToList();
}
}
}
- If you are testing locally, you need publicly visible urls for server to server Qliro callbacks.
- You can set the backgroundCallsDomainName attribute in the Qliro addon config, to point the domain to a publicly visible domain.
- Alternatively, specify the full url for AvailableShippingMethodsUrl in the checkoutFlowInfo in Src\Litium.Accelerator\Payments\Widgets\QliroWidget.cs
private ExecutePaymentArgs CreatePaymentArgs(OrderCarrier order, string paymentAccountId)
{
//....
checkoutFlowInfo.SetValue(ConstantsAndKeys.AvailableShippingMethodsUrlKey, "https://somePublicDomain/");
//....
}
- The default url sent (if nothing is specified) is similar to:
"MerchantOrderAvailableShippingMethodsUrl": "http://sampleDomain.com/PaymentProviderResult.axd/Report/Qliro?QliroNotificationType=AvailableShippingMethods&accountId=Qliro"
Customize shipping options sent to Qliro
You can customize the shipping options sent to Qliro by changing the return value of the Build() method in above example.
public override List<ShippingMethod> Build(ShippingMethodBuildArgs args)
{
var result = base.Build(args);
//TODO: Customize the result values, for example you can change descriptions, etc.
return result;
}