Litium 8.7

Class CartContext

Represents an abstract which is used to handle the shopping experience with providing the Cart and CheckoutFlowInfo.

Inheritance
System.Object
CartContext
Namespace: Litium.Sales
Assembly: Litium.Abstractions.dll
Syntax
public abstract class CartContext : Object, ICartContextOperations

Constructors

CartContext()

Declaration
protected CartContext()

Properties

Cart

Gets the cart object.

Declaration
public abstract Cart Cart { get; }
Property Value
Type Description
Cart

The shopping cart.

ChannelSystemId

Gets the channel system identifier.

Declaration
public virtual Nullable<Guid> ChannelSystemId { get; }
Property Value
Type Description
System.Nullable<System.Guid>

The channel system identifier.

CheckoutFlowInfo

Gets the checkout flow info.

Declaration
public abstract CheckoutFlowInfo CheckoutFlowInfo { get; }
Property Value
Type Description
CheckoutFlowInfo

The checkout flow info.

CountryCode

Gets the country code.

Declaration
public virtual string CountryCode { get; }
Property Value
Type Description
System.String

The country code.

CurrencyCode

Gets the currency code.

Declaration
public virtual string CurrencyCode { get; }
Property Value
Type Description
System.String

The currency code.

MarketSystemId

Gets the market system identifier.

Declaration
public virtual Nullable<Guid> MarketSystemId { get; }
Property Value
Type Description
System.Nullable<System.Guid>

The market system identifier.

OrganizationSystemId

Gets the organization system identifier.

Declaration
public virtual Nullable<Guid> OrganizationSystemId { get; }
Property Value
Type Description
System.Nullable<System.Guid>

The organization system identifier.

PaymentFlowResults

Gets the payment flow results.

Declaration
public abstract IReadOnlyCollection<PaymentFlowResult> PaymentFlowResults { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<PaymentFlowResult>

The payment flow results.

PersonSystemId

Gets or sets the person system identifier.

Declaration
public virtual Nullable<Guid> PersonSystemId { get; }
Property Value
Type Description
System.Nullable<System.Guid>

The person system identifier.

Methods

AddDiscountCodeAsync(String, CancellationToken)

Add discount code for cart context.

Declaration
public abstract Task<bool> AddDiscountCodeAsync(string code, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.String code

The discount code.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

The awaitable Task.

AddOrUpdateAdditionalInfoAsync(Object, CancellationToken)

Add or update the additional info.

Declaration
public abstract Task AddOrUpdateAdditionalInfoAsync(object additionalInfo, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Object additionalInfo

Additional order info.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateBillingAddressAsync(Address, CancellationToken)

Add or update the billing address.

Declaration
public abstract Task AddOrUpdateBillingAddressAsync(Address address, CancellationToken cancellationToken = null)
Parameters
Type Name Description
Address address

Billing Address.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateCheckoutFlow(CheckoutFlowInfoArgs, CancellationToken)

Add or update data for checkout flow.

Declaration
public virtual Task AddOrUpdateCheckoutFlow(CheckoutFlowInfoArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
CheckoutFlowInfoArgs args

Input parameters to work with checkout flow.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateCheckoutFlowAsync(CheckoutFlowInfoArgs, CancellationToken)

Add or update data for checkout flow.

Declaration
public abstract Task AddOrUpdateCheckoutFlowAsync(CheckoutFlowInfoArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
CheckoutFlowInfoArgs args

Input parameters to work with checkout flow.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateCustomerInfoAsync(AddOrUpdateCustomerInfoArgs, CancellationToken)

Add or update customer info.

Declaration
public abstract Task AddOrUpdateCustomerInfoAsync(AddOrUpdateCustomerInfoArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
AddOrUpdateCustomerInfoArgs args

Input parameters to add or update customer info.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateDeliveryAddressAsync(Address, CancellationToken)

Add or update the delivery address.

Declaration
public abstract Task AddOrUpdateDeliveryAddressAsync(Address address, CancellationToken cancellationToken = null)
Parameters
Type Name Description
Address address

Delivery Address.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateFeeAsync(AddOrUpdateFeeArgs, CancellationToken)

Add or update fee.

Declaration
public abstract Task AddOrUpdateFeeAsync(AddOrUpdateFeeArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
AddOrUpdateFeeArgs args

Input parameters to add or update fee.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

AddOrUpdateItemAsync(AddOrUpdateCartItemArgs, CancellationToken)

Add or update cart item.

Declaration
public abstract Task AddOrUpdateItemAsync(AddOrUpdateCartItemArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
AddOrUpdateCartItemArgs args

Input parameters to add or update cart items.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

CalculatePaymentsAsync(CancellationToken)

Calculate the payments based on the Rows.

Declaration
public abstract Task CalculatePaymentsAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

ChangeCartContextAsync(Guid, CancellationToken)

Changes the cart context to the one represented by the provided identifier.

Declaration
protected abstract Task ChangeCartContextAsync(Guid identifier, CancellationToken cancellationToken)
Parameters
Type Name Description
System.Guid identifier

The identifier.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

Task.

ChangeCustomerAsync(ChangeCustomerArgs, CancellationToken)

Change customer in cart context.

Declaration
public abstract Task ChangeCustomerAsync(ChangeCustomerArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ChangeCustomerArgs args

Input parameters to change customer in cart context.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

ChangeShowPricesWithVatAsync(Boolean, CancellationToken)

Change the show prices with or without VAT.

Declaration
public abstract Task ChangeShowPricesWithVatAsync(bool showWithVat, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Boolean showWithVat
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task

ClearCartContextAsync(CancellationToken)

Clear cart context.

Declaration
public abstract Task ClearCartContextAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

ClearCartItemsAsync(CancellationToken)

Clear cart items.

Declaration
public abstract Task ClearCartItemsAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

ConfirmOrderAsync(CancellationToken)

Confirm Order.

Declaration
public abstract Task ConfirmOrderAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

GetLockAsync(Nullable<TimeSpan>, CancellationToken)

Create lock for the cart context.

Declaration
public abstract Task<IAsyncDisposable> GetLockAsync(Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Nullable<System.TimeSpan> timeout

The timeout to take the exclusive lock.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.IAsyncDisposable>

The awaitable disposable to release the lock.

PlaceOrderAsync(PlaceOrderArgs, CancellationToken)

Place an order.

Declaration
public abstract Task PlaceOrderAsync(PlaceOrderArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
PlaceOrderArgs args

Input parameters to place an order.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

RemoveDiscountCodeAsync(String, CancellationToken)

Remove discount code out of cart context.

Declaration
public abstract Task RemoveDiscountCodeAsync(string code, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.String code

The discount code.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

SelectChannelAsync(SelectChannelArgs, CancellationToken)

Set channel for cart context.

Declaration
public abstract Task SelectChannelAsync(SelectChannelArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
SelectChannelArgs args

Input parameters to set channel for cart context.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

SelectCountryAsync(SelectCountryArgs, CancellationToken)

Set country for cart context.

Declaration
public abstract Task SelectCountryAsync(SelectCountryArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
SelectCountryArgs args

Input parameters to set country for cart context.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

SelectPaymentOptionAsync(SelectPaymentOptionArgs, CancellationToken)

Set payment option for cart context.

Declaration
public abstract Task SelectPaymentOptionAsync(SelectPaymentOptionArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
SelectPaymentOptionArgs args

Input parameters to set the payment option.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

SelectShippingOptionAsync(SelectShippingOptionArgs, CancellationToken)

Set shipping option for cart context.

Declaration
public abstract Task SelectShippingOptionAsync(SelectShippingOptionArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
SelectShippingOptionArgs args

Input parameters to set the shipping option.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

SetTagsAsync(HashSet<String>, CancellationToken)

Sets the tags to the cart that the Order automatic should be tagged with when order is placed.

Declaration
public abstract Task SetTagsAsync(HashSet<string> tags, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Collections.Generic.HashSet<System.String> tags

The Tags value.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

Task.

TryInitializeCheckoutFlowAsync(Func<Task<CheckoutFlowInfoArgs>>, CancellationToken)

Try to initialize data for checkout flow.

Declaration
public abstract Task<bool> TryInitializeCheckoutFlowAsync(Func<Task<CheckoutFlowInfoArgs>> checkoutFlowInfoArgsBuilder, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Func<System.Threading.Tasks.Task<CheckoutFlowInfoArgs>> checkoutFlowInfoArgsBuilder

Builder for the input parameters to work with checkout flow for initializing.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

The awaitable Task that will return true if the checkout flow was initialized; oterwise false.

UpdateOrderCommentAsync(AddOrUpdateOrderCommentArgs, CancellationToken)

Update an order's comment.

Declaration
public abstract Task UpdateOrderCommentAsync(AddOrUpdateOrderCommentArgs args, CancellationToken cancellationToken = null)
Parameters
Type Name Description
AddOrUpdateOrderCommentArgs args

Input parameters to update order's comment.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

The awaitable Task.

ValidateAsync(CancellationToken)

Validate cart.

Declaration
public abstract Task ValidateAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task

Task.

Extension Methods