Previous Docs Version

The documentation you are viewing is for a previous version of the Vendr product. Click here to jump to the current stable version.

OrderExtensions

API reference for OrderExtensions in Vendr, the eCommerce solution for Umbraco v8+

OrderExtensions

Extension methods for a Vendr Order

public static class OrderExtensions

Namespace

Methods

AddProduct (1 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, string productReference, decimal qty)

Parameters

Parameter Description
order
The Order instance
productReference
The unique reference of the product
qty
The quantity of the product to add to the order

Returns

The updated Order entity


AddProduct (2 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, string productReference, decimal qty, 
    string bundleId)

Parameters

Parameter Description
order
The Order instance
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProduct (3 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, string productReference, decimal qty, 
    IDictionary<string, string> properties)

Parameters

Parameter Description
order
The Order instance
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line

Returns

The updated Order entity


AddProduct (4 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, string productReference, decimal qty, 
    IDictionary<string, string> properties, string bundleId)

Parameters

Parameter Description
order
The Order instance
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProduct (5 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, IProductSnapshot productSnapshot, decimal qty)

Parameters

Parameter Description
order
The Order instance
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order

Returns

The updated Order entity


AddProduct (6 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, IProductSnapshot productSnapshot, decimal qty, 
    string bundleId)

Parameters

Parameter Description
order
The Order instance
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProduct (7 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, IProductSnapshot productSnapshot, decimal qty, 
    IDictionary<string, string> properties)

Parameters

Parameter Description
order
The Order instance
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line

Returns

The updated Order entity


AddProduct (8 of 8)

Adds a product to the order

public static Order AddProduct(this Order order, IProductSnapshot productSnapshot, decimal qty, 
    IDictionary<string, string> properties, string bundleId)

Parameters

Parameter Description
order
The Order instance
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProductToBundle (1 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    string productReference, decimal qty)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productReference
The unique reference of the product
qty
The quantity of the product to add to the order

Returns

The updated Order entity


AddProductToBundle (2 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    string productReference, decimal qty, string bundleId)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProductToBundle (3 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    string productReference, decimal qty, IDictionary<string, string> properties)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line

Returns

The updated Order entity


AddProductToBundle (4 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    string productReference, decimal qty, IDictionary<string, string> properties, string bundleId)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProductToBundle (5 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    IProductSnapshot productSnapshot, decimal qty)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order

Returns

The updated Order entity


AddProductToBundle (6 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    IProductSnapshot productSnapshot, decimal qty, string bundleId)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


AddProductToBundle (7 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    IProductSnapshot productSnapshot, decimal qty, IDictionary<string, string> properties)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line

Returns

The updated Order entity


AddProductToBundle (8 of 8)

Adds a product to a bundle in the order

public static Order AddProductToBundle(this Order order, string parentBundleId, 
    IProductSnapshot productSnapshot, decimal qty, IDictionary<string, string> properties, 
    string bundleId)

Parameters

Parameter Description
order
The Order instance
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line
bundleId
A bundle ID to assign to the product order line to identify it as a bundle

Returns

The updated Order entity


FinalizeOrUpdateTransaction (1 of 2)

Finalizes or updates the transaction info of the order

public static Order FinalizeOrUpdateTransaction(this Order order, decimal amountAuthorized, 
    string transactionId, PaymentStatus paymentStatus)

Parameters

Parameter Description
order
The Order instance
amountAuthorized
The amount authorized by the payment gateway
transactionId
The ID of the transaction from the payment gateway
paymentStatus
The status of the payment

Returns

The updated Order entity


FinalizeOrUpdateTransaction (2 of 2)

Finalizes or updates the transaction info of the order

public static Order FinalizeOrUpdateTransaction(this Order order, decimal amountAuthorized, 
    decimal transactionFee, string transactionId, PaymentStatus paymentStatus)

Parameters

Parameter Description
order
The Order instance
amountAuthorized
The amount authorized by the payment gateway
transactionFee
The transaction fee charged by the payment gateway
transactionId
The ID of the transaction from the payment gateway
paymentStatus
The status of the payment

Returns

The updated Order entity


GetTotalAmountAdjustmentByType<T>

Gets the total amount adjustment for a given amount adjustment type

public static Amount GetTotalAmountAdjustmentByType<T>(this OrderReadOnly order)
    where T : AmountAdjustment

Parameters

Parameter Description
T
The type of the amount adjustment
order
The order to fetch the amount adjustments from

Returns

The amount of the amount adjustments


GetTotalAmountAdjustmentWhere

Gets the total amount adjustment where amount adjustments match the supplied predicate

public static Amount GetTotalAmountAdjustmentWhere(this OrderReadOnly order, 
    Func<AmountAdjustment, bool> predicate)

Parameters

Parameter Description
order
The order to fetch the amount adjustments from
predicate
The predicate function to include/exclude the amount adjustment

Returns

The amount of the amount adjustments


GetTotalPriceAdjustmentByType<T>

Gets the total price adjustment for a given price adjustment type

public static Price GetTotalPriceAdjustmentByType<T>(this OrderReadOnly order)
    where T : PriceAdjustment

Parameters

Parameter Description
T
The type of the price adjustment
order
The order to fetch the price adjustments from

Returns

The price of the price adjustments


GetTotalPriceAdjustmentWhere

Gets the total price adjustment where price adjustments match the supplied predicate

public static Price GetTotalPriceAdjustmentWhere(this OrderReadOnly order, 
    Func<PriceAdjustment, bool> predicate)

Parameters

Parameter Description
order
The order to fetch the price adjustments from
predicate
The predicate function to include/exclude the price adjustment

Returns

The price of the price adjustments


InitializeTransaction

Initializes a transaction ready to send to the payment gateway

public static Order InitializeTransaction(this Order order)

Parameters

Parameter Description
order
The Order instance

Returns

The updated Order entity


Recalculate (1 of 2)

Recalculates the order

public static Order Recalculate(this Order order)

Parameters

Parameter Description
order
The Order instance

Returns

The updated Order entity


Recalculate (2 of 2)

Recalculates the order

public static Order Recalculate(this Order order, bool force)

Parameters

Parameter Description
order
The Order instance
force
A boolean flag indicating whether to force recalculation whether the order needs recalculating or not

Returns

The updated Order entity


Redeem

Redeems a Discount or GiftCard against the order

public static Order Redeem(this Order order, string discountOrGiftCardCode)

Parameters

Parameter Description
order
The Order instance
discountOrGiftCardCode
The Discount or GiftCard code

Returns

The updated Order entity

Edit this page on GitHub

Site + logo design © 2024 Outfield Digital Ltd. Content contributions licensed under MIT.
Vendr® is a Registered Trademark of Outfield Digital Ltd.