Beispiel #1
0
        public Order(
            string buyerId,
            Address shipToAddress,
            PaymentInfo paymentDetails,
            List <OrderItem> items,
            OrderStatus status,
            Purchase purchase,
            PurchaseResponse purchaseResponse,
            OrderTotals totals)
        {
            Guard.Against.NullOrEmpty(buyerId, nameof(buyerId));
            Guard.Against.Null(shipToAddress, nameof(shipToAddress));
            Guard.Against.Null(items, nameof(items));
            Guard.Against.Null(paymentDetails, nameof(paymentDetails));
            Guard.Against.Null(purchase, nameof(purchase));

            BuyerId              = buyerId;
            ShipToAddress        = shipToAddress;
            PaymentDetails       = paymentDetails;
            Status               = status;
            _orderItems          = items;
            RiskPurchase         = purchase;
            RiskPurchaseResponse = purchaseResponse;
            SubTotal             = totals.SubTotal;
            Tax   = totals.Tax;
            Total = totals.Total;
        }
        protected decimal GetFreighCharge(OrderTotals pricing)
        {
            var     priceInfoV02   = pricing as OrderTotals_V02;
            decimal freightCharges = priceInfoV02 != null && null != priceInfoV02.ChargeList && priceInfoV02.ChargeList.Any() ? GetFreightCharges(priceInfoV02.ChargeList) : decimal.Zero;

            return(freightCharges);
        }
        public Order(
            string buyerId,
            Address shipToAddress,
            PaymentInfo paymentDetails,
            List <OrderItem> items,
            OrderStatus status,
            Purchase purchase,
            PurchaseResponse purchaseResponse,
            OrderTotals totals)
        {
            if (string.IsNullOrEmpty(buyerId))
            {
                throw new ArgumentNullException(nameof(buyerId));
            }

            ShipToAddress  = shipToAddress ?? throw new ArgumentNullException(nameof(shipToAddress));
            PaymentDetails = paymentDetails ?? throw new ArgumentNullException(nameof(paymentDetails));
            RiskPurchase   = purchase ?? throw new ArgumentNullException(nameof(purchase));
            _orderItems    = items ?? throw new ArgumentNullException(nameof(items));

            BuyerId = buyerId;
            Status  = status;
            RiskPurchaseResponse = purchaseResponse;
            SubTotal             = totals.SubTotal;
            Tax   = totals.Tax;
            Total = totals.Total;
        }
        private void GetQuotes(Order order, OrderTotals total, bool calcFreight, out OrderTotals_V02 totals)
        {
            var shoppingCartLaoder = Substitute.For <IShoppingCartProviderLoader>();

            shoppingCartLaoder.GetQuote(order, total, calcFreight).Returns(GetQuote(order, out totals, calcFreight));

            decimal AmountDues = totals.AmountDue - totals.ItemsTotal;

            Assert.AreEqual(AmountDues, 60);
        }
Beispiel #5
0
 public ApiClientMockData()
 {
     Orders         = new List <Order>();
     Invoices       = new List <Invoice>();
     CustomerTotals = new CustomerTotals();
     Order          = new Order();
     OrderTotals    = new OrderTotals();
     OrderDetails   = new List <OrderDetail>();
     StockData      = new StockData();
     ProductPrices  = new ProductPrices();
 }
        public static OrderTotals GetQuote(Order order, OrderTotals total, bool calcFreight)
        {
            var order_V01 = order as Order_V01;
            var request   = new QuoteRequest_V02 {
                Order = order_V01, CalcFreight = calcFreight, Donation = (total as OrderTotals_V02) == null ? decimal.Zero : (total as OrderTotals_V02).Donation
            };
            var session = SessionInfo.GetSessionInfo(order.DistributorID, CultureInfo.CurrentCulture.Name);

            if (null != session)
            {
                SessionInfo.GetSessionInfo(order.DistributorID, CultureInfo.CurrentCulture.Name).HmsPricing = HLConfigManager.Configurations.CheckoutConfiguration.UseHMSCalc;
            }
            order.DistributorID = order.DistributorID.ToUpper();
            if (Settings.GetRequiredAppSetting("LogCatalogCN", "false").ToLower() == "true")
            {
                LogRequest(OrderCreationHelper.Serialize(request));
            }
            QuoteResponse result = null;
            var           proxy  = ServiceClientProvider.GetOrderServiceProxy();

            try
            {
                result = proxy.Quote(new QuoteRequest1(request)).QuoteResult;
                if (result.Status == ServiceResponseStatusType.Success && result.Totals != null)
                {
                    if (Settings.GetRequiredAppSetting("LogCatalogCN", "false").ToLower() == "true")
                    {
                        LogRequest(OrderCreationHelper.Serialize(result));
                    }
                    return(result.Totals);
                }
                else
                {
                    LoggerHelper.Error(
                        string.Format(
                            "Order Total error, distributor:{0} receive date:{1}, Calc Freight :{3},  error message:{2}",
                            order.DistributorID, order_V01.ReceivedDate.ToString(), order_V01.Messages, calcFreight));
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(
                    string.Format(
                        "Order Total error, distributor:{0} receive date:{1}, Calc Freight:{3},  error message:{2}",
                        order.DistributorID, order_V01.ReceivedDate.ToString(), ex, calcFreight));
            }
            return(null);
        }
        public void SlowMovingDiscount()
        {
            string  distributorId           = "CN640521";
            string  countryCode             = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
            decimal Slomovingskudiscountamt = 0;

            GetSlowMovingDetail("1317", 50m, 329m, DateTime.Now.AddDays(-2), DateTime.Now.AddDays(30), out Slomovingskudiscountamt);
            var order = new Order_V01();

            order.DistributorID = distributorId;
            var orderitem = new OnlineOrderItem()
            {
                Quantity    = 1,
                SKU         = "1317",
                Description = "",
                RetailPrice = 0,
                IsPromo     = false,
            };

            order.OrderItems = new OrderItems {
                orderitem
            };
            order.Shipment = new ShippingInfo_V01
            {
                Address = new MyHerbalife3.Ordering.ServiceProvider.OrderSvc.Address
                {
                    City    = "眉山市",
                    Country = "cn"
                },
                ShippingMethodID = "22",
                WarehouseCode    = "3019"
            };
            order.CountryOfProcessing = "CN";
            var ordertotal = new OrderTotals();

            Assert.AreEqual(50, Slomovingskudiscountamt);
        }
Beispiel #8
0
 public OrderTotals GetQuote(Order order, OrderTotals total, bool calcFreight)
 {
     return(Providers.ShoppingCartProvider.GetQuote(order, total, calcFreight));
 }
Beispiel #9
0
        /// <summary>
        /// Получение итогов по заказам
        /// </summary>
        /// <param name="clientId">Код клиента</param>
        /// <param name="getCurrent">Для текущих заказов или для архивных</param>
        /// <returns>Итоги по заказам</returns>
        public static OrderTotals GetOrderTotals( string clientId, bool getCurrent )
        {
            using (var dc = new DCFactory<StoreDataContext>())
            {
                OrderTotals res = new OrderTotals();

                if ( getCurrent )
                {
                    try
                    {
                        res.ProcessingOrdersSum = dc.DataContext.Orders.Where(o => o.ClientID == clientId && o.Status == OrderStatus.Processing).Sum(o => o.Total);
                        // при пустом результате возникает ошибка приведения, но так исполнятеся только один запрос
                        res.ProcessingOrderLinesSum = ( from o in dc.DataContext.Orders
                                                        join ol in dc.DataContext.OrderLines on o.OrderID equals ol.OrderID
                                                        join ols in dc.DataContext.OrderLineStatuses on ol.CurrentStatus equals ols.OrderLineStatusID
                                                        where o.ClientID == clientId
                                                        && o.Status == OrderStatus.Processing
                                                        && !ols.IsFinal
                                                        select ol ).Sum( t => t.Qty * t.UnitPrice );
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        res.CompletedOrdersSum = dc.DataContext.Orders.Where(o => o.ClientID == clientId && o.Status == OrderStatus.Completed).Sum(o => o.Total);
                        // при пустом результате возникает ошибка приведения, но так исполнятеся только один запрос
                        res.ReceivedByClientSum = ( from o in dc.DataContext.Orders
                                                    join ol in dc.DataContext.OrderLines on o.OrderID equals ol.OrderID
                                                    where o.ClientID == clientId
                                                    && o.Status == OrderStatus.Processing
                                                    && ol.CurrentStatus == (byte)160
                                                    select ol ).Sum( t => t.Qty * t.UnitPrice );
                    }
                    catch { }
                }
                return res;
            }
            //using( var dc = new StoreDataContext() )
            //{
            //    DataLoadOptions options = new DataLoadOptions();
            //    options.LoadWith<Order>( o => o.OrderLines );
            //    dc.LoadOptions = options;

            //    var orders = dc.Orders.Where( o => o.ClientID == clientId ).ToArray().AsQueryable();

            //    OrderTotals res = new OrderTotals();

            //    res.ProcessingOrdersSum = orders.Where( o => o.Status == OrderStatus.Processing ).Sum( o => o.Total );

            //    res.CompletedOrdersSum = orders.Where( o => o.Status == OrderStatus.Completed ).Sum( o => o.Total );

            //    res.ProcessingOrderLinesSum = orders
            //        .Where( o => o.Status == OrderStatus.Processing )
            //        .Sum( o => o.OrderLines.AsQueryable().Where( OrderBO.FinalStatusExpression.Not() ).Sum( l => l.Total ) );

            //    // deas 23.05.2011 task4130 Ускорение работы со статусами
            //    //var stReceivedByClient = OrderLineStatusUtil.StatusByte(dc, "ReceivedByClient");
            //    var stReceivedByClient = OrderLineStatusUtil.StatusByte( "ReceivedByClient" );

            //    res.ReceivedByClientSum = orders
            //        .Where( o => o.Status == OrderStatus.Completed )
            //        .Sum(o => o.OrderLines.Where(l => l.CurrentStatus == stReceivedByClient).Sum(l => l.Total));
            //    return res;
            //}
        }
        private static void GenerateObject(MobilePghOrderRequestViewModel request, out Order_V01 Order,
                                           out MyHLShoppingCart ShoppingCart, OrderTotals Totals)
        {
            var orderTotalsV01 = Totals as OrderTotals_V01;
            var orderTotalsV02 = Totals as OrderTotals_V02;


            decimal amount = 0;

            if (request.Data.OrderItems.Count > 0)
            {
                amount = request.Data.Locale.Substring(3, 2) == "CN"
                    ? orderTotalsV02.AmountDue
                    : orderTotalsV01.AmountDue;
            }
            else
            {
                amount = request.Data.Locale.Substring(3, 2) == "CN"
                    ? orderTotalsV02.Donation
                    : orderTotalsV01.AmountDue;
            }

            #region Fill Order
            var order = new Order_V01
            {
                DistributorID       = request.Data.DistributorId,
                CountryOfProcessing = request.Data.Locale.Substring(3, 2),
                OrderCategory       =
                    string.IsNullOrEmpty(request.Data.OrderType)
                        ? OrderCategoryType.RSO
                        : (OrderCategoryType)
                    Enum.Parse(typeof(OrderCategoryType), request.Data.OrderType),
                OrderMonth         = GetOrderMonth(request.Data.OrderYear, request.Data.OrderMonth),
                Pricing            = Totals,
                OrderItems         = PopulateOrderItems(request.Data.OrderItems),
                ReceivedDate       = DateUtils.GetCurrentLocalTime(request.Data.Locale.Substring(3, 2)),
                Shipment           = PopulateOrderShipment(request),
                Payments           = PopulateOrderPayments(request, amount),
                Handling           = PopulateOrderHandlingInfo(request),
                DiscountPercentage = request.InvoiceData.Discount
            };

            #endregion

            #region ShoppingCart

            var shoppingCart = new MyHLShoppingCart
            {
                Locale         = request.Data.Locale,
                CountryCode    = request.Data.Locale.Substring(3, 2),
                DistributorID  = request.Data.DistributorId,
                Totals         = Totals,
                ShoppingCartID = 0,
                OrderCategory  = ServiceProvider.CatalogSvc.OrderCategoryType.RSO,
                EmailAddress   = request.Data.Confirmation.Email,
                EmailValues    = new HLShoppingCartEmailValues(),
                DeliveryInfo   = new ShippingInfo
                {
                    WarehouseCode         = request.Data.WarehouseCode,
                    AdditionalInformation = string.Empty,
                    Option =
                        !string.IsNullOrEmpty(request.Data.DeliveryType) &&
                        request.Data.DeliveryType.ToUpper() == "PICKUP"
                            ? MyHerbalife3.Ordering.ServiceProvider.ShippingSvc.DeliveryOptionType.Pickup
                            : MyHerbalife3.Ordering.ServiceProvider.ShippingSvc.DeliveryOptionType.Shipping,
                    Address = new MyHerbalife3.Ordering.ServiceProvider.ShippingSvc.ShippingAddress_V01
                    {
                        Recipient = (request.Data.ShippingInfo as ShippingInfo_V01).Recipient,
                        Address   = ObjectMappingHelper.Instance.GetToShipping(request.Data.ShippingInfo.Address as Address_V01)
                    }
                }
            };

            shoppingCart.ShoppingCartItems = new List <DistributorShoppingCartItem>();
            foreach (var item in request.Data.OrderItems)
            {
                shoppingCart.ShoppingCartItems.Add(new DistributorShoppingCartItem
                {
                    Description = item.Description,
                    Quantity    = item.Quantity,
                    SKU         = item.Sku
                });
            }

            #endregion

            Order        = order;
            ShoppingCart = shoppingCart;
        }
Beispiel #11
0
        public ActionResult TotalByVendor(DateTime?startDate, DateTime?endDate)
        {
            const int defaultResultSize = 1000;
            var       viewModel         = TotalByWorkgroupViewModel.Create(startDate, endDate, false);

            if (startDate == null || endDate == null)
            {
                Message = "Select a start date and an end date then click apply to view report.";

                return(View(viewModel));
            }

            //Grab all workgroups for this user
            var allWorkgroups = _workgroupService.LoadAdminWorkgroups(true).ToList();

            //Get every order that matches these workgroups
            var matchingOrders = _searchService.GetOrdersByWorkgroups(allWorkgroups, startDate.Value, endDate.Value, defaultResultSize);

            if (matchingOrders.Count == defaultResultSize)
            {
                Message = "Max size of 1000 reached. Please adjust filters.";
            }
            var workgroupCounts = new List <OrderTotals>();

            foreach (var workgroup in allWorkgroups)
            {
                if (workgroup.IsActive && !workgroup.Administrative)
                {
                    var orders = matchingOrders.AsQueryable().Where(a => a.WorkgroupId == workgroup.Id);

                    foreach (var order in orders)
                    {
                        var orderTotal = workgroupCounts.FirstOrDefault(a => a.Vendor == order.Vendor);

                        if (orderTotal == null)
                        {
                            orderTotal                 = new OrderTotals();
                            orderTotal.Vendor          = order.Vendor;
                            orderTotal.InitiatedOrders = 0;
                            orderTotal.DeniedOrders    = 0;
                            orderTotal.CanceledOrders  = 0;
                            orderTotal.CompletedOrders = 0;
                            orderTotal.PendingOrders   = 0;

                            workgroupCounts.Add(orderTotal);
                        }
                        orderTotal.InitiatedOrders++;
                        switch (order.StatusId)
                        {
                        case OrderStatusCode.Codes.Denied:
                            orderTotal.DeniedOrders++;
                            break;

                        case OrderStatusCode.Codes.Cancelled:
                            orderTotal.CanceledOrders++;
                            break;

                        case OrderStatusCode.Codes.Complete:
                        case OrderStatusCode.Codes.CompleteNotUploadedKfs:
                            orderTotal.CompletedOrders++;
                            break;

                        default:
                            orderTotal.PendingOrders++;
                            break;
                        }
                    }
                }
            }

            viewModel.WorkgroupCounts = workgroupCounts.OrderBy(a => a.Vendor);

            var columnPreferences =
                _repositoryFactory.ColumnPreferencesRepository.GetNullableById(CurrentUser.Identity.Name) ??
                new ColumnPreferences(CurrentUser.Identity.Name);

            ViewBag.DataTablesPageSize = columnPreferences.DisplayRows;

            return(View(viewModel));
        }
Beispiel #12
0
        public ActionResult TotalByPrimaryOrg(DateTime?startDate, DateTime?endDate)
        {
            const int defaultResultSize = 1000;
            var       viewModel         = TotalByWorkgroupViewModel.Create(startDate, endDate, false);

            if (startDate == null || endDate == null)
            {
                Message = "Select a start date and an end date then click apply to view report.";

                return(View(viewModel));
            }

            //Grab all workgroups for this user as well as related primary orgs
            var allWorkgroups             = _workgroupService.LoadAdminWorkgroups(true).ToList();
            var workgroupIds              = allWorkgroups.Select(x => x.Id).ToArray();
            var workgroupsWithPrimaryOrgs =
                _repositoryFactory.WorkgroupRepository.Queryable.Where(x => workgroupIds.Contains(x.Id))
                .Select(x => new { Workgroup = x, Primary = x.PrimaryOrganization }).ToList();

            //Get every order that matches these workgroups
            var matchingOrders = _searchService.GetOrdersByWorkgroups(allWorkgroups, startDate.Value, endDate.Value, defaultResultSize);

            if (matchingOrders.Count == defaultResultSize)
            {
                Message = "Max size of 1000 reached. Please adjust filters.";
            }
            var workgroupCounts = new List <OrderTotals>();

            foreach (var workgroup in allWorkgroups)
            {
                if (workgroup.IsActive && !workgroup.Administrative)
                {
                    var orderTotal =
                        workgroupCounts.FirstOrDefault(a => a.PrimaryOrg == workgroup.PrimaryOrganization.Name);
                    if (orderTotal == null)
                    {
                        orderTotal            = new OrderTotals();
                        orderTotal.PrimaryOrg =
                            workgroupsWithPrimaryOrgs.Single(x => x.Workgroup.Id == workgroup.Id).Primary.Name;
                        orderTotal.InitiatedOrders = 0;
                        orderTotal.DeniedOrders    = 0;
                        orderTotal.CanceledOrders  = 0;
                        orderTotal.CompletedOrders = 0;
                        orderTotal.PendingOrders   = 0;

                        workgroupCounts.Add(orderTotal);
                    }

                    orderTotal.InitiatedOrders += matchingOrders.AsQueryable().Count(a => a.WorkgroupId == workgroup.Id);
                    orderTotal.DeniedOrders    +=
                        matchingOrders.AsQueryable()
                        .Count(a => a.WorkgroupId == workgroup.Id && a.StatusId == OrderStatusCode.Codes.Denied);
                    orderTotal.CanceledOrders +=
                        matchingOrders.AsQueryable()
                        .Count(a => a.WorkgroupId == workgroup.Id && a.StatusId == OrderStatusCode.Codes.Cancelled);
                    orderTotal.CompletedOrders +=
                        matchingOrders.AsQueryable()
                        .Count(
                            a =>
                            a.WorkgroupId == workgroup.Id &&
                            (a.StatusId == OrderStatusCode.Codes.Complete ||
                             a.StatusId == OrderStatusCode.Codes.CompleteNotUploadedKfs));
                    orderTotal.PendingOrders +=
                        matchingOrders.AsQueryable()
                        .Count(
                            a =>
                            a.WorkgroupId == workgroup.Id &&
                            (a.StatusId == OrderStatusCode.Codes.Approver ||
                             a.StatusId == OrderStatusCode.Codes.AccountManager ||
                             a.StatusId == OrderStatusCode.Codes.Purchaser ||
                             a.StatusId == OrderStatusCode.Codes.Requester ||
                             a.StatusId == OrderStatusCode.Codes.ConditionalApprover));
                }
            }

            viewModel.WorkgroupCounts = workgroupCounts.OrderBy(a => a.PrimaryOrg);

            var columnPreferences =
                _repositoryFactory.ColumnPreferencesRepository.GetNullableById(CurrentUser.Identity.Name) ??
                new ColumnPreferences(CurrentUser.Identity.Name);

            ViewBag.DataTablesPageSize = columnPreferences.DisplayRows;

            return(View(viewModel));
        }
        private void GetQuotes(Order order, OrderTotals total, bool calcFreight, out OrderTotals_V02 totals)
        {
            var shoppingCartLaoder = Substitute.For <IShoppingCartProviderLoader>();

            shoppingCartLaoder.GetQuote(order, total, calcFreight).Returns(GetQuote(order, out totals, calcFreight));
        }
Beispiel #14
0
        public OrderTotals CalculateOrderTotals(int profileId, bool autoRemovePhoneOrderItems = true, int testOfferRuleId = 0)
        {
            var orderTotals = new OrderTotals();
            var gas         = _genericAttributeService.GetAttributesForEntity(profileId, "Profile");

            var gaCurrencyId = gas.FirstOrDefault(ga => ga.Key == SystemCustomerAttributeNames.CurrencyId);

            if (gaCurrencyId == null)
            {
                throw new ApolloException(string.Format("Currency is not selected. Profile ID={{{0}}}", profileId));
            }
            var currencyId = Convert.ToInt32(gaCurrencyId.Value);
            var currency   = _currencyRepository.Return(currencyId);

            orderTotals.CurrencyCode = currency.CurrencyCode;
            orderTotals.ExchangeRate = currency.ExchangeRate;

            var itemCount = GetTotalQuantityCartItemByProfileId(profileId, autoRemovePhoneOrderItems);

            if (itemCount <= 0)
            {
                return(orderTotals);
            }

            orderTotals.ItemCount = itemCount;

            //get country
            var gaCountryId = gas.FirstOrDefault(ga => ga.Key == SystemCustomerAttributeNames.CountryId);

            if (gaCountryId == null)
            {
                throw new ApolloException(string.Format("Country is not selected. Profile ID={{{0}}}", profileId));
            }
            var countryId = Convert.ToInt32(gaCountryId.Value);
            var country   = _countryRepository.Return(countryId);

            //subtotal
            var items = GetCartItemsByProfileId(profileId, autoRemovePhoneOrderItems);

            orderTotals.Subtotal = items
                                   .Where(x => x.CartItemMode != (int)CartItemMode.FreeItem)
                                   .Select(x =>
                                           ((x.CartItemMode == (int)CartItemMode.InitialPrice) ? x.ProductPrice.PriceExclTax : x.ProductPrice.OfferPriceExclTax) * x.Quantity)
                                   .DefaultIfEmpty(0).Sum();

            //discount
            var gaDiscountCouponCode = gas.FirstOrDefault(ga => ga.Key == SystemCustomerAttributeNames.DiscountCouponCode);
            var discountCouponCode   = string.Empty;

            if (gaDiscountCouponCode != null)
            {
                discountCouponCode = gaDiscountCouponCode.Value;
            }

            var cartOffer = ProcessCartOfferByProfileId(profileId, country.ISO3166Code, testOfferRuleId);

            if (cartOffer.IsValid)
            {
                foreach (var discount in cartOffer.Discounts)
                {
                    var offer = _offerService.GetOfferRuleById(discount.Key);
                    if (offer != null)
                    {
                        orderTotals.Discounts.Add(offer.Alias, discount.Value);
                    }
                }

                orderTotals.Discount      = cartOffer.DiscountAmount;
                orderTotals.AwardedPoints = cartOffer.RewardPoint;
            }

            //shipping info
            var gaSelectedShippingOption = gas.FirstOrDefault(ga => ga.Key == SystemCustomerAttributeNames.SelectedShippingOption);

            if (gaSelectedShippingOption != null)
            {
                var selectedShippingOptionId = Convert.ToInt32(gaSelectedShippingOption.Value);
                var shippingOption           = _shippingOptionRepository.Return(selectedShippingOptionId);

                orderTotals.ShippingCost   = CalculateShippingCost(profileId, selectedShippingOptionId);
                orderTotals.ShippingMethod = shippingOption.Name;
            }

            //allocated points
            var gaAllocatedPoint = gas.FirstOrDefault(ga => ga.Key == SystemCustomerAttributeNames.AllocatedPoint);
            var allocatedPoints  = 0;

            if (gaAllocatedPoint != null)
            {
                allocatedPoints = Convert.ToInt32(gaAllocatedPoint.Value);
            }
            orderTotals.AllocatedPoints = allocatedPoints;
            var allocatedPointsValue = allocatedPoints / 100M;

            //tax
            if (country.IsEC)
            {
                orderTotals.Tax        = _orderCalculator.GetVAT(items);
                orderTotals.DisplayTax = country.IsEC;
            }

            //total
            var total = orderTotals.Subtotal + orderTotals.Tax - orderTotals.Discount - allocatedPointsValue + orderTotals.ShippingCost;

            orderTotals.Total = total;

            //earned points
            var earnedPoint = _orderCalculator.CalculateEarnedLoyaltyPointsFromCart(
                profileId,
                orderTotals.AllocatedPoints,
                currency.CurrencyCode,
                orderTotals.Discount);

            orderTotals.EarnedPoints = earnedPoint;

            return(orderTotals);
        }