Calculation Data Structure

The following diagram illustrates the Calculation data structure.

Calculation Data structure

Quote Transfer

QuoteTransfer is the main data transfer object used in Cart, Calculation, Checkout and when order is placed. This object is created when first item is added to the cart.

The entire data object is stored into the session and it consists of:

Field Description

totals (TotalsTransfer)

Order totals.

items (ItemTransfer[])

CartItem collection.

voucherDiscounts (DiscountTransfer[])

 

cartRuleDiscounts (DiscountTransfer[])

 

expenses (ExpenseTransfer)

 

priceMode (int) Quote object's price mode.

Calculated Discount Transfer

Each item which can have discounts applied has a calculatedDiscounts property which holds collection of discounts for each discount type.

Field Description

displayName (string)

Applied discount name.

description (string)

Applied discount description.

voucherCode (string)

Used voucher code.

quantity(int)

Number of discounted items.

unitGrossAmount (int)

Discount gross amount for single items, set by DiscountCalculatorPlugin.

sumGrossAmount (int)

Discount gross amount for sum of items, set by DiscountCalculatorPlugin.

Product Option Transfer

ProductOptionTransfer, some items may have product option collection attached which also have amounts calculated.

Field Description

idSalesOrderItemOption (int)

Sales order item ID option stored after the order is placed.

unitGrossPrice (int)

single item gross price. It’s set by CartItemProductOptionPlugin (cart expander).

sumGrossPrice (int)

sum of items gross price. It’s set by PriceCalculatorPlugin (cart expander).

unitNetPrice (int)

Single item net price. It's set by CartItemProductOptionPlugin (cart expander).

sumNetPrice (int)

sum of items net price. It's set by PriceCalculatorPlugin (cart expander).

unitPrice (int)

single item price without assuming is it new or gross, this value should be used everywhere where price is displayed, it allows switching tax mode without side effects. It's set by PriceCalculatorPlugin cart expander.

taxRate (int)

Tax rate in percentage. It’s set by ProductOptionTaxRateCalculatorPlugin (cart expander).

calculatedDiscounts[] (CalculatedDiscountTransfer)

Product Option calculated discount collection. It’s set by DiscountCalculatorPlugin.

refundableAmount (int)

Item available refundable amount (order only), set by RefundableAmountCalculatorPlugin.

unitTaxAmount (int)

Tax amount for single product option (order only), set by TaxAmountCalculatorPlugin.

sumTaxAmount (int)

Tax amount for sum of product options (order only), set by TaxAmountCalculatorPlugin.

unitDiscountAmountAggregation (int)

Product option total discount amount, set by DiscountAmountAggregatorPlugin.

sumDiscountAmountAggregation (int)

Sum of product option total discount amount, set by DiscountAmountAggregatorPlugin.

Discount Transfer

DiscountTransfer, is a collection of discounts used in all QuoteTransfer discountable items such as voucherDiscounts and cartRuleDiscounts.

Field Description

amount (int)

total discount amount used for this discount type. It’s set by DiscountCalculatorPlugin

ExpenseTransfer

Field Description
sumGrossPrice (int) Sum of item gross price, set by PriceCalculatorPlugin.
unitGrossPrice (string) Single expense price. e.g.: shipment expenses are set in the Checkout ShipmentStep.
sumNetPrice (int) Sum of item net price, set by PriceCalculatorPlugin.
unitNetPrice (string) Single net price. e.g.: shipment expenses are set in the Checkout ShipmentStep.
taxRate (int) Tax in percents, set by ShipmentTaxRateCalculatorPlugin.
unitPrice (int) Single item price without assuming is it new or gross, this value should be used everywhere where price is displayed, it allows switching tax mode without side effects, set by PriceCalculatorPlugin (cart expander).
sumPrice (int) Sum of items price, set by PriceCalculatorPlugin (cart expander).
Calculated Discount Transfer

List of applied discounts for this item.

quantity (int Number of items.
refundableAmount (int) Total refundable amount for this item (order only), set by RefundableAmountCalculatorPlugin.
canceledAmount (int) Total canceled amount for this item (order only), set by refund.
unitTaxAmount (int) Tax amount for single item after discounts, set by TaxAmountCalculatorPlugin.
sumTaxAmount (int) Tax amount for sum of items after discounts, set by TaxAmountCalculatorPlugin.
unitDiscountAmountAggregation (int) Expense total discount amount, set by DiscountAmountAggregatorPlugin.
sumDiscountAmountAggregation (int) Sum of expense total discount amount, set by DiscountAmountAggregatorPlugin.