Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Smaller breaking changes in 9.4

In this section you will find the different breaking changes and how to deal with them. There are some specific articles addressing some of the more fundamental changes. In this article we'll list some of the small changes you need to deal with in case you run into the breaking changes yourself, when upgrading your solution. If your solution compiles and you have not been using any of the obsolete methods, great. Then you don't have to read through this article :-)

Configuration changes

1) Ucommerce Index implementations are now provider-independent. If you inherited an existing index implementation, you will have to update your index to inherit the new Ucommerce.Search.Index<T> instead.

Before

    
    
        <component id="DefaultProductsIndex"
        service="Ucommerce.Search.IIndex`1[[Ucommerce.Search.Models.Product,  Ucommerce.Search]], Ucommerce.Search"
        type="Ucommerce.Search.Lucene.LuceneDiskIndex`1[[Ucommerce.Search.Models.Product,  Ucommerce.Search]], Ucommerce.Search.ElasticSearch">
            <forwardedTypes>
                <add service="Ucommerce.Search.IIndexAutomatically, Ucommerce.Search" />
            </forwardedTypes>
            <parameters>
                <Definition>${ProductsIndexDefinition}</Definition>
                <Fetcher>${ProductFetcher}</Fetcher>
            </parameters>
        </component>
        
    

After

    
    
        <component id="DefaultProductsIndex"
        service="Ucommerce.Search.IIndex`1[[Ucommerce.Search.Models.Product,  Ucommerce.Search]], Ucommerce.Search"
        type="Ucommerce.Search.Index`1[[Ucommerce.Search.Models.Product,  Ucommerce.Search]], Ucommerce.Search.ElasticSearch">
            <forwardedTypes>
                <add service="Ucommerce.Search.NonGeneric.IIndex, Ucommerce.Search" />
            </forwardedTypes>
            <parameters>
                <Definition>${ProductsIndexDefinition}</Definition>
                <Fetcher>${ProductFetcher}</Fetcher>
            </parameters>
        </component>
    

Obsolete types removed

IPricingService

The interface and implementation for IPricingService has been removed. Use a price calculation instead

Obsolete methods removed

Ucommerce.Api.ITransactionLibrary

RequestPayments

Previously you could initiate a payment directly in transaction library. This is not possible anymore.

    
        TransactionLibrary.RequestPayments();
    

was changed to

    var payment = transactionLibrary.GetBasket(false).Payments.First();
    var redirectUrl = transactionLibrary.GetPaymentPageUrl(payment);
    //redirect the customer in whatever technology you are using :-) 
    
    

Ucommerce.EntitiesV2.PurchaseOrder

Domain specific logic are being removed from all entities. You should instead favor the IOC container. See how here.

AddProduct

    
        basketOrOrder.AddProduct(...);
    

was changed to

    //use this approach if you are adding to your clients cart from the context.
    var transactionLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.ITransactionLibrary>();
    transactionLibrary.AddToBasket(1, "skuOrGuid", "variantSku");
    
    //If you have a basket resolved somewhere else e.g a wishlist or second basket that are not the default visitors basket, 
    //add a product using the AddToBasket pipeline
    var addToBasketPipeline = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<IPipeline<IPipelineArgs<AddToBasketRequest, AddToBasketResponse>>>();
    addToBasketPipeline.Execute(new AddToBasketPipelineArgs(new AddToBasketRequest()
    {
        Product = productToBeAdded,
        AddToExistingOrderLine = true, //or false if you want a line per product even though you have the same added already,
        PriceGroup = priceGroup,
        PurchaseOrder = orderOrBasket,
        Quantity = 1,
        ExecuteBasketPipeline = true //or false if you don't need totals to be calculated
    }, new AddToBasketResponse()));
    
    

RemoveShipment

basketOrOrder.RemoveShipment(...);

was changed to

    
    var removeShipmentPipeline = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<IPipeline<IPipelineArgs<RemoveShipmentRequest, RemoveShipmentResult>>>();
    removeShipmentPipeline.Execute(new RemoveShipmentPipelineArgs(new RemoveShipmentRequest()
    {
        Shipment = shipmentToRemove,
        PurchaseOrder = orderOrBasket
    }, new RemoveShipmentResult()));
    
    

Remove

Globalization

To grab current culture code you could access a static method on the Globalization class. Use IOC instead.

    var currentCulture = ObjectFactory.Instance.Resolve<Ucommerce.Infrastructure.Globalization.Globalization>().CurrentCulture;
    
    

Ucommerce.Transactions.Payments.AbstractPageBuilder

Abstract page builder have had some static methods removed in favor of using the IOC container instead. See how to deal with it here.

GetCallbackUrl

    
        Ucommerce.Transactions.Payments.AbstractPageBuilder.GetCallbackUrl(callBackUrlPropertyValue, payment)
    

Was changed to

    //url is the CallbackUrl property value as configured on the payment method in the back office
    Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<ICallbackUrl>().GetCallbackUrl(url, payment);
    
    

GetAbsoluteUrl

    
        Ucommerce.Transactions.Payments.AbstractPageBuilder.GetCallbackUrl(callBackUrlPropertyValue, payment)
    

Was changed to

    
    Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<IAbsoluteUrlService>().GetAbsoluteUrl(relativeUrl);