コード例 #1
0
        private TotalItem CreateTotalItem(ILineItem item, ICart cart)
        {
            var lineItemPrices = item.GetLineItemPrices(cart.Currency);

            //TODO: Implement taxes if they are needed per item. For taxes to work, order needs to have shipping adress set as the address is needed by epi to calculate tax.
            var totalItem = new TotalItem
            {
                ItemId                   = item.LineItemId,
                Price                    = item.PlacedPrice,
                BasePrice                = item.PlacedPrice,
                Qty                      = item.Quantity,
                RowTotal                 = item.Quantity * item.PlacedPrice,
                BaseRowTotal             = item.Quantity * item.PlacedPrice,
                RowTotalWithDiscount     = lineItemPrices.DiscountedPrice.Amount,
                TaxAmount                = 0,
                BaseTaxAmount            = 0,
                TaxPercent               = 0,
                DiscountAmount           = item.GetDiscountTotal(cart.Currency).Amount,
                BaseDiscountAmount       = item.GetDiscountTotal(cart.Currency).Amount,
                DiscountPercent          = 0,
                PriceIncludingTax        = 0,
                BasePriceIncludingTax    = 0,
                RowTotalIncludingTax     = item.Quantity * item.PlacedPrice,
                BaseRowTotalIncludingTax = item.Quantity * item.PlacedPrice,
                Options                  = "",
                WeeeTaxAppliedAmount     = null,
                WeeeTaxApplied           = null,
                Name                     = item.DisplayName,
                ProductOption            = new ProductOption()
            };

            return(totalItem);
        }