Exemple #1
0
        public static List <IShippingService> FindAll(Store currentStore)
        {
            var result = Service.FindAll();

            // FedEx
            var fedexGlobal = new FedExGlobalServiceSettings
            {
                UserKey                  = currentStore.Settings.ShippingFedExKey,
                UserPassword             = currentStore.Settings.ShippingFedExPassword,
                AccountNumber            = currentStore.Settings.ShippingFedExAccountNumber,
                MeterNumber              = currentStore.Settings.ShippingFedExMeterNumber,
                DefaultDropOffType       = (DropOffType)currentStore.Settings.ShippingFedExDropOffType,
                DefaultPackaging         = (PackageType)currentStore.Settings.ShippingFedExDefaultPackaging,
                DiagnosticsMode          = currentStore.Settings.ShippingFedExDiagnostics,
                ForceResidentialRates    = currentStore.Settings.ShippingFedExForceResidentialRates,
                UseDevelopmentServiceUrl = currentStore.Settings.ShippingFedExUseDevelopmentServiceUrl
            };

            result.Add(new FedExProvider(fedexGlobal, Factory.CreateEventLogger()));

            // Load US Postal
            var uspostalGlobal = new USPostalServiceGlobalSettings
            {
                UserId          = currentStore.Settings.ShippingUSPostalUserId,
                DiagnosticsMode = currentStore.Settings.ShippingUSPostalDiagnostics
            };

            result.Add(new DomesticProvider(uspostalGlobal, Factory.CreateEventLogger()));
            result.Add(new InternationalProvider(uspostalGlobal, Factory.CreateEventLogger()));

            // Load UPS
            var upsglobal = new UPSServiceGlobalSettings
            {
                AccountNumber    = currentStore.Settings.ShippingUpsAccountNumber,
                LicenseNumber    = currentStore.Settings.ShippingUpsLicense,
                Username         = currentStore.Settings.ShippingUpsUsername,
                Password         = currentStore.Settings.ShippingUpsPassword,
                DefaultPackaging = (PackagingType)currentStore.Settings.ShippingUpsDefaultPackaging,
                DiagnosticsMode  = currentStore.Settings.ShippingUPSDiagnostics,
                ForceResidential = currentStore.Settings.ShippingUpsForceResidential,
                IgnoreDimensions = currentStore.Settings.ShippingUpsSkipDimensions,
                PickUpType       = (PickupType)currentStore.Settings.ShippingUpsPickupType
            };

            result.Add(new UPSService(upsglobal, Factory.CreateEventLogger()));

            return(result);
        }
Exemple #2
0
        public static List <IShippingService> FindAll(Store currentStore)
        {
            var result = Service.FindAll();

            // FedEx
            var fedexGlobal = new FedExGlobalServiceSettings
            {
                UserKey                  = currentStore.Settings.ShippingFedExKey,
                UserPassword             = currentStore.Settings.ShippingFedExPassword,
                AccountNumber            = currentStore.Settings.ShippingFedExAccountNumber,
                MeterNumber              = currentStore.Settings.ShippingFedExMeterNumber,
                DefaultDropOffType       = (DropOffType)currentStore.Settings.ShippingFedExDropOffType,
                DefaultPackaging         = (PackageType)currentStore.Settings.ShippingFedExDefaultPackaging,
                DiagnosticsMode          = currentStore.Settings.ShippingFedExDiagnostics,
                ForceResidentialRates    = currentStore.Settings.ShippingFedExForceResidentialRates,
                UseDevelopmentServiceUrl = currentStore.Settings.ShippingFedExUseDevelopmentServiceUrl
            };

            result.Add(new FedExProvider(fedexGlobal, Factory.CreateEventLogger()));

            // Load US Postal
            var uspostalGlobal = new USPostalServiceGlobalSettings
            {
                UserId          = currentStore.Settings.ShippingUSPostalUserId,
                DiagnosticsMode = currentStore.Settings.ShippingUSPostalDiagnostics
            };

            result.Add(new DomesticProvider(uspostalGlobal, Factory.CreateEventLogger()));
            result.Add(new InternationalProvider(uspostalGlobal, Factory.CreateEventLogger()));

            // Load UPS
            var upsglobal = new UPSServiceGlobalSettings
            {
                AccountNumber    = currentStore.Settings.ShippingUpsAccountNumber,
                LicenseNumber    = currentStore.Settings.ShippingUpsLicense,
                Username         = currentStore.Settings.ShippingUpsUsername,
                Password         = currentStore.Settings.ShippingUpsPassword,
                DefaultPackaging = (PackagingType)currentStore.Settings.ShippingUpsDefaultPackaging,
                DiagnosticsMode  = currentStore.Settings.ShippingUPSDiagnostics,
                ForceResidential = currentStore.Settings.ShippingUpsForceResidential,
                IgnoreDimensions = currentStore.Settings.ShippingUpsSkipDimensions,
                PickUpType       = (PickupType)currentStore.Settings.ShippingUpsPickupType
            };

            result.Add(new UPSService(upsglobal, Factory.CreateEventLogger()));


            // Load UPS Freight
            var upsFreightGlobal = new UPSFreightServiceGlobalSettings
            {
                AccountNumber     = currentStore.Settings.ShippingUpsAccountNumber,
                LicenseNumber     = currentStore.Settings.ShippingUpsLicense,
                Username          = currentStore.Settings.ShippingUpsUsername,
                Password          = currentStore.Settings.ShippingUpsPassword,
                DefaultPackaging  = (Hotcakes.Shipping.UpsFreight.PackingTypes)currentStore.Settings.ShippingUpsFreightDefaultPackaging,
                DiagnosticsMode   = currentStore.Settings.ShippingUPSFreightDiagnostics,
                ForceResidential  = currentStore.Settings.ShippingUpsFreightForceResidential,
                IgnoreDimensions  = currentStore.Settings.ShippingUpsFreightSkipDimensions,
                BillingOption     = (Hotcakes.Shipping.UpsFreight.BillingOption)currentStore.Settings.ShippingUpsFreightBillingOption,
                HandleOneUnitType = (currentStore.Settings.ShippingUpsFreightHandleOneUnitType != string.Empty ? (HandlineOneUnitType)Enum.Parse(typeof(HandlineOneUnitType), currentStore.Settings.ShippingUpsFreightHandleOneUnitType) : HandlineOneUnitType.CBY),
                FreightClass      = currentStore.Settings.ShippingUpsFreightFreightClass
            };

            result.Add(new UPSFreightService(upsFreightGlobal, Factory.CreateEventLogger()));
            return(result);
        }