public virtual OmniumOrderLine MapOrderLine(
            ILineItem lineItem, IMarket market, Currency currency, IOrderAddress address)
        {
            var marketId = market.MarketId;

            var taxTotal = _lineItemCalculator.GetSalesTax(lineItem, market, currency, address);
            var taxRate  = _taxUtility.GetTaxValue(marketId, address, TaxType.SalesTax, lineItem.TaxCategoryId);

            var placedPrice      = _taxUtility.GetPriceTax(lineItem, market, currency, address, lineItem.PlacedPrice);
            var discountedAmount = _taxUtility.GetPriceTax(lineItem, market, currency, address, lineItem.GetDiscountTotal(currency)); //all discounts (line item + coupon code)
            var extendedPrice    = _taxUtility.GetPriceTax(lineItem, market, currency, address, _lineItemCalculator.GetExtendedPrice(lineItem, currency));
            var discountedPrice  = _taxUtility.GetPriceTax(lineItem, market, currency, address, _lineItemCalculator.GetDiscountedPrice(lineItem, currency));

            var omniumOrderLine2 = new OmniumOrderLine
            {
                Code                   = lineItem.Code,
                ProductId              = GetProductCode(lineItem.Code),
                DisplayName            = lineItem.DisplayName,
                PlacedPrice            = placedPrice.PriceInclTax,
                PlacedPriceExclTax     = placedPrice.PriceExclTax,
                ExtendedPrice          = extendedPrice.PriceInclTax,
                ExtendedPriceExclTax   = extendedPrice.PriceExclTax,
                DiscountedPrice        = discountedPrice.PriceInclTax,
                DiscountedPriceExclTax = discountedPrice.PriceExclTax,
                Discounted             = discountedAmount.PriceInclTax,
                DiscountedExclTax      = discountedAmount.PriceExclTax,
                TaxTotal               = taxTotal,
                TaxRate                = (decimal)taxRate,
                LineItemId             = lineItem.LineItemId.ToString(),
                Quantity               = lineItem.Quantity,
                Properties             = lineItem.ToPropertyList()
            };

            return(omniumOrderLine2);
        }
Beispiel #2
0
        private static Models.LineItem ConvertToLineItem(ILineItem lineItem)
        {
            var defaultCurrency = Currency.USD; // Using USD as currency doesn't matter - calculation result will not use currency only amount.

            return(new Models.LineItem
            {
                LineItemId = lineItem.LineItemId,
                Code = lineItem.Code,
                DisplayName = lineItem.DisplayName,
                PlacedPrice = lineItem.PlacedPrice,
                ExtendedPrice = lineItem.GetExtendedPrice(defaultCurrency).Amount,
                DiscountedPrice = lineItem.GetDiscountedPrice(defaultCurrency).Amount,
                Quantity = lineItem.Quantity,
                ReturnQuantity = lineItem.ReturnQuantity,
                InventoryTrackingStatus = lineItem.InventoryTrackingStatus,
                IsInventoryAllocated = lineItem.IsInventoryAllocated,
                IsGift = lineItem.IsGift,
                Properties = lineItem.ToPropertyList()
            });
        }