/// <summary> /// Get all <see cref="IShipMethod"/> for a shipping provider /// /// GET /umbraco/Merchello/ShippingMethodsApi/GetShippingProviderShipMethods/{id} /// </summary> /// <param name="id"> /// The key of the ShippingGatewayProvider /// </param> /// <param name="shipCountryId"> /// ShipCountry Key /// </param> /// <returns> /// The collection of <see cref="ShipMethodDisplay"/>. /// </returns> public IEnumerable <ShipMethodDisplay> GetShippingProviderShipMethods(Guid id, Guid shipCountryId) { var provider = _shippingContext.GetProviderByKey(id); if (provider == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return (provider.ShipMethods.Select( method => provider.GetShippingGatewayMethod(method.Key, method.ShipCountryKey).ToShipMethodDisplay())); }
/// <summary> /// /// /// GET /umbraco/Merchello/ShippingMethodsApi/GetAllFixedRateGatewayResources/ /// </summary> /// <remarks> /// /// </remarks> public IEnumerable <GatewayResourceDisplay> GetAllFixedRateGatewayResources() { var provider = (FixedRateShippingGatewayProvider)_shippingContext.GetProviderByKey(Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey); var resources = provider.ListResourcesOffered(); return(resources.Select(resource => resource.ToGatewayResourceDisplay())); }