/// <summary>
        /// Returns a list of all countries that can be assigned to a shipment
        /// </summary>
        /// <returns>A collection of <see cref="ICountry"/></returns>
        public IEnumerable <ICountry> GetAllowedShipmentDestinationCountries()
        {
            var shipCountries = GatewayProviderService.GetAllShipCountries().ToArray();

            var elseCountries = shipCountries.Where(x => x.CountryCode == "ELSE").ToArray();

            if (elseCountries.Any())
            {
                // get a list of all providers associated with the else countries
                var providers = new List <IShippingGatewayProvider>();
                foreach (var ec in elseCountries)
                {
                    providers.AddRange(GetGatewayProvidersByShipCountry(ec));
                }

                if (providers.Any(x => x.ShipMethods.Any()))
                {
                    return(_storeSettingService.GetAllCountries());
                }
            }

            var countries = GatewayProviderService.GetAllShipCountries().Where(x => x.CountryCode != "ELSE").Select(x => _storeSettingService.GetCountryByCode(x.CountryCode)).Where(x => x != null);

            return(countries.Distinct());
        }
Exemple #2
0
        /// <summary>
        /// Gets a collection of available <see cref="IGatewayResource"/>.
        /// </summary>
        /// <returns>
        /// The collection of <see cref="IGatewayResource"/>
        /// </returns>
        public override IEnumerable <IGatewayResource> ListResourcesOffered()
        {
            var countryCodes = GatewayProviderService.GetAllShipCountries().Select(x => x.CountryCode).Distinct();

            var resources =
                countryCodes.Select(x => new GatewayResource(x, x + "-TaxJar"))
                .Where(code => TaxMethods.FirstOrDefault(x => x.CountryCode.Equals(code.ServiceCode)) == null);

            return(resources);
        }