/// <summary> /// Fetches the delivery options applicable for the item/inventDimId and Address. /// </summary> /// <param name="request">The request.</param> /// <returns>Delivery options applicable.</returns> /// <remarks>This API is typically used to display the delivery options in Item details page.</remarks> private static GetProductDeliveryOptionsServiceResponse GetProductDeliveryOptions(GetProductDeliveryOptionsServiceRequest request) { if (request.ShippingAddress == null) { throw new ArgumentNullException("request", "request.ShippingAddress"); } var dataServiceRequest = new GetItemDeliveryOptionsDataRequest(request.ItemId, request.InventoryDimensionId, request.ShippingAddress.ThreeLetterISORegionName, request.ShippingAddress.State); dataServiceRequest.QueryResultSettings = request.QueryResultSettings; var dataServiceResponse = request.RequestContext.Execute <EntityDataServiceResponse <DeliveryOption> >(dataServiceRequest); var deliveryOptions = dataServiceResponse.PagedEntityCollection; // Raise notification if no delivery options are found. if (!deliveryOptions.Results.Any()) { EmptyProductDeliveryOptionSetNotification notification = new EmptyProductDeliveryOptionSetNotification(request.ShippingAddress, request.ItemId, request.InventoryDimensionId); request.RequestContext.Notify(notification); } return(new GetProductDeliveryOptionsServiceResponse(deliveryOptions)); }
/// <summary> /// Gets the item delivery options. /// </summary> /// <param name="request">The request.</param> /// <returns>The response with the delivery options.</returns> private EntityDataServiceResponse <DeliveryOption> GetItemDeliveryOptions(GetItemDeliveryOptionsDataRequest request) { var shippingDataManager = this.GetDataManagerInstance(request.RequestContext); var deliveryOptions = shippingDataManager.GetItemDeliveryOptions(request.ItemId, request.VariantInventoryDimensionId, request.CountryRegionId, request.StateId, request.QueryResultSettings); return(new EntityDataServiceResponse <DeliveryOption>(deliveryOptions)); }