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.

Price

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

Price

A Vendr price object

public sealed class Price : ValueObjectBase, IPrice

Inheritance

Namespace

Constructors

Price (1 of 4)

Instantiates a new Price instance

public Price(decimal valueWithoutTax, decimal tax, Guid currencyId)

Parameters

Parameter Description
valueWithoutTax
The value of the price without tax
tax
The tax value of the price
currencyId
The ID of the Currency of the price

Price (2 of 4)

Instantiates a new Price instance

public Price(decimal valueWithoutTax, decimal tax, CurrencyReadOnly currency)

Parameters

Parameter Description
valueWithoutTax
The value of the price without tax
tax
The tax value of the price
currency
The Currency of the price

Price (3 of 4)

Instantiates a new Price instance

public Price(decimal valueWithoutTax, decimal tax, decimal valueWithTax, Guid currencyId)

Parameters

Parameter Description
valueWithoutTax
The value of the price without tax
tax
The tax value of the price
valueWithTax
The value of the price with tax
currencyId
The ID of the Currency of the price

Price (4 of 4)

Instantiates a new Price instance

public Price(decimal valueWithoutTax, decimal tax, decimal valueWithTax, CurrencyReadOnly currency)

Parameters

Parameter Description
valueWithoutTax
The value of the price without tax
tax
The tax value of the price
valueWithTax
The value of the price with tax
currency
The Currency of the price

Properties

CultureName

Gets the Culture Name of the Currency of the price

public string CultureName { get; }

CurrencyId

Gets the ID of the Currency of the price

public Guid CurrencyId { get; }

Tax

Gets the tax value of the price

public decimal Tax { get; }

WithoutTax

Gets the value of the price without tax

public decimal WithoutTax { get; }

WithTax

Gets the value of the price with tax

public decimal WithTax { get; }

Methods

Calculate (1 of 2)

Calculates a price from the given TaxRate

public static Price Calculate(decimal value, TaxRate taxRate, Guid currencyId, 
    bool valueIncludesTax = false)

Parameters

Parameter Description
value
The value of the price
taxRate
The TaxRate of the price
currencyId
The ID of the Currency of the price
valueIncludesTax
A boolean flag indicating whether the supplied price already includes tax

Returns

A new Price instance


Calculate (2 of 2)

Calculates a price from the given TaxRate

public static Price Calculate(decimal value, TaxRate taxRate, CurrencyReadOnly currency, 
    bool valueIncludesTax = false)

Parameters

Parameter Description
value
The value of the price
taxRate
The TaxRate of the price
currency
The Currency of the price
valueIncludesTax
A boolean flag indicating whether the supplied price already includes tax

Returns

A new Price instance


OfSameCurrency (1 of 2)

Create a new Price of the same Currency as an existing price

public static Price OfSameCurrency(Price existingPrice, decimal valueWithoutTax, decimal tax)

Parameters

Parameter Description
existingPrice
The existing Price instance
valueWithoutTax
The value of the new price without tax
tax
The tax value of the new price

Returns

A new Price instance


OfSameCurrency (2 of 2)

Create a new Price of the same Currency as an existing price

public static Price OfSameCurrency(Price existingPrice, decimal valueWithoutTax, decimal tax, 
    decimal valueWithTax)

Parameters

Parameter Description
existingPrice
The existing Price instance
valueWithoutTax
The value of the new price without tax
tax
The tax value of the new price
valueWithTax
The value of the new price with tax

Returns

A new Price instance


ZeroValue

Instantiates a new Price instance with a zero value

public static Price ZeroValue(Guid currencyId)

Parameters

Parameter Description
currencyId
The ID of the Currency of the price

Returns

A zero value Price instance


DeepClone

public override object DeepClone()

Operators

Price Implicit

public static implicit operator decimal(Price price)

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.