protected virtual async Task <CompleteCheckoutViewModel> MapOrderToCompleteCheckoutViewModel(Overture.ServiceModel.Orders.Order order, CompleteCheckoutParam param) { if (order == null) { return(null); } var orderStatuses = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam { CultureInfo = param.CultureInfo, LookupType = LookupType.Order, LookupName = "OrderStatus", }).ConfigureAwait(false); var productImageInfo = new ProductImageInfo { ImageUrls = await ImageService.GetImageUrlsAsync(order.Cart.GetLineItems()).ConfigureAwait(false) }; var getVmOrderParam = new CreateOrderDetailViewModelParam { Order = order, CultureInfo = param.CultureInfo, OrderStatuses = orderStatuses, OrderDetailBaseUrl = OrderUrlProvider.GetOrderDetailsBaseUrl(param.CultureInfo), BaseUrl = param.BaseUrl, ProductImageInfo = productImageInfo, }; var orderViewModel = OrderDetailsViewModelFactory.CreateLightViewModel(getVmOrderParam); var completeCheckoutViewModel = new CompleteCheckoutViewModel { OrderNumber = order.OrderNumber, Order = orderViewModel, CustomerEmail = order.Cart.Customer.Email, CustomerFirstName = order.Cart.Customer.FirstName, CustomerLastName = order.Cart.Customer.LastName, Affiliation = order.Cart.OrderLocation?.Name, Revenu = order.Cart.Total, Tax = order.Cart.TaxTotal, Shipping = order.Cart.FulfillmentCost, ShippingOptions = order.Cart.Shipments?.FirstOrDefault()?.FulfillmentMethod.FulfillmentMethodType.ToString().ToLowerInvariant(), BillingCurrency = order.Cart.BillingCurrency, Coupons = MapCoupons(order, param.CultureInfo), LineItems = orderViewModel?.Shipments.FirstOrDefault()?.LineItems }; return(completeCheckoutViewModel); }
protected virtual async Task <OrderDetailViewModel> BuildOrderDetailViewModelAsync( Overture.ServiceModel.Orders.Order order, GetOrderParam getOrderParam) { var shipmentsNotes = await GetShipmentsNotes(order.Cart.Shipments, getOrderParam.Scope).ConfigureAwait(false); var orderChanges = await OrderRepository.GetOrderChangesAsync(new GetOrderChangesParam { OrderNumber = getOrderParam.OrderNumber, Scope = getOrderParam.Scope }).ConfigureAwait(false); var orderStatuses = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam { CultureInfo = getOrderParam.CultureInfo, LookupType = LookupType.Order, LookupName = "OrderStatus", }).ConfigureAwait(false); var shipmentStatuses = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam { CultureInfo = getOrderParam.CultureInfo, LookupType = LookupType.Order, LookupName = "ShipmentStatus", }).ConfigureAwait(false); var productImageInfo = new ProductImageInfo { ImageUrls = await ImageService.GetImageUrlsAsync(order.Cart.GetLineItems()).ConfigureAwait(false) }; var viewModel = OrderDetailsViewModelFactory.CreateViewModel(new CreateOrderDetailViewModelParam { Order = order, OrderChanges = orderChanges, OrderStatuses = orderStatuses, ShipmentStatuses = shipmentStatuses, CultureInfo = getOrderParam.CultureInfo, CountryCode = getOrderParam.CountryCode, ProductImageInfo = productImageInfo, BaseUrl = getOrderParam.BaseUrl, ShipmentsNotes = shipmentsNotes }); return(viewModel); }
protected virtual async Task <OrderDetailViewModel> BuildOrderDetailViewModelAsync( Overture.ServiceModel.Orders.Order order, GetOrderParam getOrderParam) { Helper.LineItemsHelper.PrepareGiftLineItems(order.Cart); var shipmentsNotes = await GetShipmentsNotes(order.Cart.Shipments, getOrderParam.Scope).ConfigureAwait(false); var orderChanges = await OrderRepository.GetOrderChangesAsync(new GetOrderChangesParam { OrderNumber = getOrderParam.OrderNumber, Scope = getOrderParam.Scope }).ConfigureAwait(false); var orderCartDrafts = await GetOrderCartDrafts(getOrderParam.Scope, Guid.Parse(order.CustomerId), getOrderParam.CultureInfo).ConfigureAwait(false); var orderStatuses = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam { CultureInfo = getOrderParam.CultureInfo, LookupType = LookupType.Order, LookupName = "OrderStatus", }).ConfigureAwait(false); var shipmentStatuses = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam { CultureInfo = getOrderParam.CultureInfo, LookupType = LookupType.Order, LookupName = "ShipmentStatus", }).ConfigureAwait(false); var productImageInfo = new ProductImageInfo { ImageUrls = await ImageService.GetImageUrlsAsync(order.Cart.GetLineItems()).ConfigureAwait(false) }; var viewModel = OrderDetailsViewModelFactory.CreateViewModel(new CreateOrderDetailViewModelParam { Order = order, OrderChanges = orderChanges, OrderStatuses = orderStatuses, ShipmentStatuses = shipmentStatuses, CultureInfo = getOrderParam.CultureInfo, CountryCode = getOrderParam.CountryCode, ProductImageInfo = productImageInfo, BaseUrl = getOrderParam.BaseUrl, ShipmentsNotes = shipmentsNotes, OrderCartDrafts = orderCartDrafts }); viewModel.OrderInfos.IsOrderEditable = await EditingOrderProvider.CanEdit(order).ConfigureAwait(false); viewModel.OrderInfos.IsBeingEdited = EditingOrderProvider.IsBeingEdited(order); var orderCancellationStatus = await EditingOrderProvider.GetCancellationStatus(order).ConfigureAwait(false); viewModel.OrderInfos.IsOrderCancelable = orderCancellationStatus.CanCancel; viewModel.OrderInfos.IsOrderPendingCancellation = orderCancellationStatus.CancellationPending; if (order.Cart.PropertyBag.TryGetValue("PickedItems", out var pickedItemsObject)) { var pickedItemsList = ComposerJsonSerializer.Deserialize <List <PickedItemViewModel> >(pickedItemsObject.ToString()); var shipment = viewModel.Shipments.First(); shipment.LineItems = await ProcessPickedLineItemsAsync(pickedItemsList, shipment.LineItems, getOrderParam.CultureInfo).ConfigureAwait(false); } ; return(viewModel); }