예제 #1
0
        public CheckoutController(IWorkContext workContext,
            IShoppingCartService shoppingCartService, ILocalizationService localizationService,
            ITaxService taxService, ICurrencyService currencyService,
            IPriceFormatter priceFormatter, IOrderProcessingService orderProcessingService,
            ICustomerService customerService,  ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService,
            IPaymentService paymentService, IOrderTotalCalculationService orderTotalCalculationService,
            ILogger logger, IOrderService orderService, IWebHelper webHelper,
            OrderSettings orderSettings, RewardPointsSettings rewardPointsSettings,
            PaymentSettings paymentSettings)
        {
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._localizationService = localizationService;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._customerService = customerService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._paymentService = paymentService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._logger = logger;
            this._orderService = orderService;
            this._webHelper = webHelper;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
        }
예제 #2
0
 public ShippingController(IShippingService shippingService, 
     ShippingSettings shippingSettings,
     ISettingService settingService,
     IAddressService addressService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     ILocalizationService localizationService, 
     IPermissionService permissionService,
      ILocalizedEntityService localizedEntityService,
     ILanguageService languageService,
     IPluginFinder pluginFinder,
     IWebHelper webHelper)
 {
     this._shippingService = shippingService;
     this._shippingSettings = shippingSettings;
     this._settingService = settingService;
     this._addressService = addressService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._localizationService = localizationService;
     this._permissionService = permissionService;
     this._localizedEntityService = localizedEntityService;
     this._languageService = languageService;
     this._pluginFinder = pluginFinder;
     this._webHelper = webHelper;
 }
 public ShippingByWeightController(IShippingService shippingService,
     IStoreService storeService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     ShippingByWeightSettings shippingByWeightSettings,
     IShippingByWeightService shippingByWeightService,
     ISettingService settingService,
     ILocalizationService localizationService,
     IPermissionService permissionService,
     ICurrencyService currencyService,
     CurrencySettings currencySettings,
     IMeasureService measureService,
     MeasureSettings measureSettings)
 {
     this._shippingService = shippingService;
     this._storeService = storeService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._shippingByWeightSettings = shippingByWeightSettings;
     this._shippingByWeightService = shippingByWeightService;
     this._settingService = settingService;
     this._localizationService = localizationService;
     this._permissionService = permissionService;
     this._currencyService = currencyService;
     this._currencySettings = currencySettings;
     this._measureService = measureService;
     this._measureSettings = measureSettings;
 }
 public CompanyController(ICompanyService companyService, IExcelService excelService, IRightService rightService, IStateProvinceService stateProvinceService)
 {
     _companyService = companyService;
     _excelService = excelService;
     _rightService = rightService;
     _stateProvinceService = stateProvinceService;
 }
예제 #5
0
 public CountryController(ICountryService countryService,
     IStateProvinceService stateProvinceService,
     ICityService cityService,
     IZipcodeService zipcodeService,
     ILocalizationService localizationService,
     IAddressService addressService,
     IPermissionService permissionService,
     ILocalizedEntityService localizedEntityService,
     ILanguageService languageService,
     IStoreService storeService,
     IStoreMappingService storeMappingService,
     IExportManager exportManager,
     IImportManager importManager)
 {
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._cityService = cityService;
     this._zipcodeService = zipcodeService;
     this._localizationService = localizationService;
     this._addressService = addressService;
     this._permissionService = permissionService;
     this._localizedEntityService = localizedEntityService;
     this._languageService = languageService;
     this._storeService = storeService;
     this._storeMappingService = storeMappingService;
     this._exportManager = exportManager;
     this._importManager = importManager;
 }
 public GoogleCheckoutPaymentProcessor(ISettingService settingService, 
     IWebHelper webHelper, ITaxService taxService,
     IShippingService shippingService, 
     IOrderTotalCalculationService orderTotalCalculationService,
     IProductAttributeFormatter productAttributeFormatter,
     IPriceCalculationService priceCalculationService, IWorkContext workContext,
     ICustomerService customerService, IGenericAttributeService genericAttributeService, 
     ICountryService countryService,
     IStateProvinceService stateProvinceService, IOrderProcessingService orderProcessingService,
     IOrderService orderService, ILogger logger, HttpContextBase httpContext)
 {
     this._settingService = settingService;
     this._webHelper = webHelper;
     this._taxService = taxService;
     this._shippingService = shippingService;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._productAttributeFormatter = productAttributeFormatter;
     this._priceCalculationService = priceCalculationService;
     this._workContext = workContext;
     this._customerService = customerService;
     this._genericAttributeService = genericAttributeService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._orderProcessingService = orderProcessingService;
     this._orderService = orderService;
     this._logger = logger;
     this._httpContext = httpContext;
 }
예제 #7
0
 public CountryController(ICountryService countryService, IStateProvinceService stateProvinceService,
     ILocalizationService localizationService)
 {
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._localizationService = localizationService;
 }
 public SettingController(ISettingService settingService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IAddressService addressService, ITaxCategoryService taxCategoryService,
     ICurrencyService currencyService, IPictureService pictureService, 
     ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
     IOrderService orderService, IEncryptionService encryptionService,
     IThemeProvider themeProvider, ICustomerService customerService, 
     ICustomerActivityService customerActivityService, IPermissionService permissionService,
     IWebHelper webHelper, IFulltextService fulltextService, 
     IMaintenanceService maintenanceService, IStoreService storeService,
     IWorkContext workContext, IGenericAttributeService genericAttributeService)
 {
     this._settingService = settingService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._taxCategoryService = taxCategoryService;
     this._currencyService = currencyService;
     this._pictureService = pictureService;
     this._localizationService = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._orderService = orderService;
     this._encryptionService = encryptionService;
     this._themeProvider = themeProvider;
     this._customerService = customerService;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._webHelper = webHelper;
     this._fulltextService = fulltextService;
     this._maintenanceService = maintenanceService;
     this._storeService = storeService;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
 }
 public CollectibleExportService(IProductService productService, 
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     IPictureService pictureService,
     IUrlRecordService urlRecordService,
     IStoreContext storeContext,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     ICountryService countryService,   //not used
     IStateProvinceService stateProvinceService,
     IConsignorService consignorService,
     IAuthenticationService authenticationService,
     ILogger logger,
     IRepository<AUCountryLotRecord> countrylotRepo,
     IRepository<AUStateProvinceLotRecord> stateprovincelotRepo
     )
 {
     this._productService = productService;
     this._categoryService = categoryService;
     this._manufacturerService = manufacturerService;
     this._pictureService = pictureService;
     this._urlRecordService = urlRecordService;
     this._storeContext = storeContext;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._consignorService = consignorService;
     this._authenticationService = authenticationService;
     this._logger = logger;                          //NJM: AUConsignor
     this._countrylotRepo = countrylotRepo;
     this._stateprovincelotRepo = stateprovincelotRepo;
 }
예제 #10
0
 public FareTemplateController(IPermissionService permissionService, IFareTemplateService faretemplateservice, IStateProvinceService stateprovinceservice, ICityService cityservice, IStreetService streetservice)
 {
     _permissionService = permissionService;
     _faretemplateservice = faretemplateservice;
     _stateprovinceservice = stateprovinceservice;
     _cityservice = cityservice;
     _streetservice = streetservice;
 }
예제 #11
0
 public CountryController(ICountryService countryService, IPortService portService,
     IStateProvinceService stateProvinceService, ILocalizationService localizationService)
 {
     this.countryService       = countryService;
     this.portService          = portService;
     this.stateProvinceService = stateProvinceService;
     this.localizationService  = localizationService;
 }
        public CheckoutController(IWorkContext workContext,
            IStoreContext storeContext,
            IStoreMappingService storeMappingService,
            IShoppingCartService shoppingCartService, 
            ILocalizationService localizationService, 
            ITaxService taxService, 
            ICurrencyService currencyService, 
            IPriceFormatter priceFormatter, 
            IOrderProcessingService orderProcessingService,
            ICustomerService customerService, 
            IGenericAttributeService genericAttributeService,
            ICountryService countryService,
            IStateProvinceService stateProvinceService,
            IShippingService shippingService, 
            IPaymentService paymentService,
            IPluginFinder pluginFinder,
            IOrderTotalCalculationService orderTotalCalculationService,
            ILogger logger,
            IOrderService orderService,
            IWebHelper webHelper,
            HttpContextBase httpContext,
            IMobileDeviceHelper mobileDeviceHelper,
            OrderSettings orderSettings, 
            RewardPointsSettings rewardPointsSettings,
            PaymentSettings paymentSettings,
            ShippingSettings shippingSettings,
            AddressSettings addressSettings)
        {
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._storeMappingService = storeMappingService;
            this._shoppingCartService = shoppingCartService;
            this._localizationService = localizationService;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._customerService = customerService;
            this._genericAttributeService = genericAttributeService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._paymentService = paymentService;
            this._pluginFinder = pluginFinder;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._logger = logger;
            this._orderService = orderService;
            this._webHelper = webHelper;
            this._httpContext = httpContext;
            this._mobileDeviceHelper = mobileDeviceHelper;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
            this._shippingSettings = shippingSettings;
            this._addressSettings = addressSettings;
        }
 public TaxCountryStateZipController(ITaxCategoryService taxCategoryService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     ITaxRateService taxRateService)
 {
     this._taxCategoryService = taxCategoryService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._taxRateService = taxRateService;
 }
		public static string ToFormatedAddress(this Address amazonAddress, ICountryService countryService, IStateProvinceService stateProvinceService)
		{
			var sb = new StringBuilder();

			try
			{
				var city = (amazonAddress.IsSetCity() ? amazonAddress.City : null);
				var zip = (amazonAddress.IsSetPostalCode() ? amazonAddress.PostalCode : null);

				sb.AppendLine("");

				if (amazonAddress.Name.HasValue())
					sb.AppendLine(amazonAddress.Name);

				if (amazonAddress.AddressLine1.HasValue())
					sb.AppendLine(amazonAddress.AddressLine1);

				if (amazonAddress.AddressLine2.HasValue())
					sb.AppendLine(amazonAddress.AddressLine2);

				if (amazonAddress.AddressLine3.HasValue())
					sb.AppendLine(amazonAddress.AddressLine3);

				sb.AppendLine(zip.Grow(city, " "));

				if (amazonAddress.IsSetStateOrRegion())
				{
					var stateProvince = stateProvinceService.GetStateProvinceByAbbreviation(amazonAddress.StateOrRegion);

					if (stateProvince == null)
						sb.AppendLine(amazonAddress.StateOrRegion);
					else
						sb.AppendLine("{0} {1}".FormatWith(amazonAddress.StateOrRegion, stateProvince.GetLocalized(x => x.Name)));
				}

				if (amazonAddress.IsSetCountryCode())
				{
					var country = countryService.GetCountryByTwoOrThreeLetterIsoCode(amazonAddress.CountryCode);

					if (country == null)
						sb.AppendLine(amazonAddress.CountryCode);
					else
						sb.AppendLine("{0} {1}".FormatWith(amazonAddress.CountryCode, country.GetLocalized(x => x.Name)));
				}

				if (amazonAddress.Phone.HasValue())
				{
					sb.AppendLine(amazonAddress.Phone);
				}
			}
			catch (Exception exc)
			{
				exc.Dump();
			}

			return sb.ToString();
		}
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="addressRepository">Address repository</param>
 /// <param name="countryService">Country service</param>
 /// <param name="stateProvinceService">State/province service</param>
 /// <param name="eventPublisher">Event publisher</param>
 public AddressService(IRepository<Address> addressRepository,
     ICountryService countryService, IStateProvinceService stateProvinceService, 
     IEventPublisher eventPublisher)
 {
     this._addressRepository = addressRepository;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._eventPublisher = eventPublisher;
 }
예제 #16
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="cacheManager">Cache manager</param>
 /// <param name="addressRepository">Address repository</param>
 /// <param name="countryService">Country service</param>
 /// <param name="stateProvinceService">State/province service</param>
 /// <param name="eventPublisher">Event publisher</param>
 /// <param name="addressSettings">Address settings</param>
 public AddressService(ICacheManager cacheManager, IRepository<Address> addressRepository,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IEventPublisher eventPublisher, AddressSettings addressSettings)
 {
     this._cacheManager = cacheManager;
     this._addressRepository = addressRepository;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._eventPublisher = eventPublisher;
     this._addressSettings = addressSettings;
 }
예제 #17
0
 public BranchOfficeController(IBranchOfficeService dataService, ILocalizationService localizationService,
     ICountryService countryService, IStateProvinceService stateprovinceService,
     IWorkContext workContext, ICacheManager cacheManager )
 {
     this.dataService          = dataService;
     this.localizationService  = localizationService;
     this.cacheManager         = cacheManager;
     this.countryService       = countryService;
     this.stateprovinceService = stateprovinceService;
     this.workContext          = workContext;
 }
예제 #18
0
 public APIController(IWorkContext workContext, ILocalizationService localizationService,
     ICountryService countryService, IStateProvinceService stateProvinceService, 
     IWebHelper webHelper, ICacheManager cacheManager)
 {
     this.workContext = workContext;
     this.countryService = countryService;
     this.localizationService = localizationService;
     this.stateProvinceService = stateProvinceService;
     this.webHelper = webHelper;
     this.cacheManager = cacheManager;
 }
예제 #19
0
        public OrderController(IOrderService orderService, 
            IOrderReportService orderReportService, IOrderProcessingService orderProcessingService,
            IDateTimeHelper dateTimeHelper, IPriceFormatter priceFormatter, ILocalizationService localizationService,
            IWorkContext workContext, ICurrencyService currencyService,
            IEncryptionService encryptionService, IPaymentService paymentService,
            IMeasureService measureService, IPdfService pdfService,
            IAddressService addressService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IProductService productService,
            IExportManager exportManager, IPermissionService permissionService,
            IWorkflowMessageService workflowMessageService,
            ICategoryService categoryService, IManufacturerService manufacturerService,
            IProductAttributeService productAttributeService, IProductAttributeParser productAttributeParser,
            IProductAttributeFormatter productAttributeFormatter, IShoppingCartService shoppingCartService,
            IGiftCardService giftCardService, IDownloadService downloadService,
            IShipmentService shipmentService,
            CatalogSettings catalogSettings, CurrencySettings currencySettings, TaxSettings taxSettings,
            MeasureSettings measureSettings, PdfSettings pdfSettings)
        {
            this._orderService = orderService;
            this._orderReportService = orderReportService;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._encryptionService = encryptionService;
            this._paymentService = paymentService;
            this._measureService = measureService;
            this._pdfService = pdfService;
            this._addressService = addressService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._productService = productService;
            this._exportManager = exportManager;
            this._permissionService = permissionService;
            this._workflowMessageService = workflowMessageService;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._productAttributeService = productAttributeService;
            this._productAttributeParser = productAttributeParser;
            this._productAttributeFormatter = productAttributeFormatter;
            this._shoppingCartService = shoppingCartService;
            this._giftCardService = giftCardService;
            this._downloadService = downloadService;
            this._shipmentService = shipmentService;

            this._catalogSettings = catalogSettings;
            this._currencySettings = currencySettings;
            this._taxSettings = taxSettings;
            this._measureSettings = measureSettings;
            this._pdfSettings = pdfSettings;
        }
예제 #20
0
        public void Should_have_error_when_email_is_null_or_empty()
        {
            _stateProvinceService = MockRepository.GenerateMock<IStateProvinceService>();

            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService, new CustomerSettings());

            var model = new CustomerInfoModel();
            model.Email = null;
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
            model.Email = "";
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
        }
예제 #21
0
 public CountryController(ICountryService countryService, 
     IStateProvinceService stateProvinceService, 
     ILocalizationService localizationService, 
     IWorkContext workContext,
     ICacheManager cacheManager)
 {
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._cacheManager = cacheManager;
 }
        /// <summary>
        /// Ctor
        /// </summary>
        public ShippingByTotalService(
            IRepository<ShippingByTotalRecord> sbtRepository,
			IStoreService storeService,
			IShippingService shippingService,
			ICountryService countryService,
			IStateProvinceService stateProvinceService)
        {
            _sbtRepository = sbtRepository;
			_storeService = storeService;
			_shippingService = shippingService;
			_countryService = countryService;
			_stateProvinceService = stateProvinceService;
        }
예제 #23
0
 public CountryController(ICountryService countryService,
     IStateProvinceService stateProvinceService, ILocalizationService localizationService,
     IAddressService addressService, IPermissionService permissionService,
     ILocalizedEntityService localizedEntityService, ILanguageService languageService)
 {
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._localizationService = localizationService;
     this._addressService = addressService;
     this._permissionService = permissionService;
     this._localizedEntityService = localizedEntityService;
     this._languageService = languageService;
 }
예제 #24
0
        public ShoppingCartController(IProductService productService, IWorkContext workContext,
            IShoppingCartService shoppingCartService, IPictureService pictureService,
            ILocalizationService localizationService, IProductAttributeFormatter productAttributeFormatter,
            ITaxService taxService, ICurrencyService currencyService, 
            IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter,
            ICheckoutAttributeParser checkoutAttributeParser, ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IOrderProcessingService orderProcessingService,
            IDiscountService discountService,ICustomerService customerService, 
            IGiftCardService giftCardService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService, 
            IOrderTotalCalculationService orderTotalCalculationService,
            ICheckoutAttributeService checkoutAttributeService, IPaymentService paymentService,
            IWorkflowMessageService workflowMessageService,
            IPermissionService permissionService,
            MediaSettings mediaSetting, ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            ShippingSettings shippingSettings,TaxSettings taxSettings)
        {
            this._productService = productService;
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._productAttributeFormatter = productAttributeFormatter;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._orderProcessingService = orderProcessingService;
            this._discountService = discountService;
            this._customerService = customerService;
            this._giftCardService = giftCardService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._paymentService = paymentService;
            this._workflowMessageService = workflowMessageService;
            this._permissionService = permissionService;

            this._mediaSetting = mediaSetting;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
        }
예제 #25
0
 public NopService()
 {
     _addressService = EngineContext.Current.Resolve<IAddressService>();
     _countryService = EngineContext.Current.Resolve<ICountryService>();
     _stateProvinceService = EngineContext.Current.Resolve<IStateProvinceService>();
     _customerService = EngineContext.Current.Resolve<ICustomerService>();
     _customerSettings = EngineContext.Current.Resolve<CustomerSettings>();
     _permissionSettings = EngineContext.Current.Resolve<IPermissionService>();
     _orderProcessingService = EngineContext.Current.Resolve<IOrderProcessingService>();
     _orderService = EngineContext.Current.Resolve<IOrderService>();
     _authenticationService = EngineContext.Current.Resolve<IAuthenticationService>();
     _workContext = EngineContext.Current.Resolve<IWorkContext>();
     _pluginFinder = EngineContext.Current.Resolve<IPluginFinder>();
 }
예제 #26
0
        public AmazonPayApi(
			ICountryService countryService,
			IStateProvinceService stateProvinceService,
			IOrderService orderService,
			ILocalizationService localizationService,
			IAddressService addressService,
			IDateTimeHelper dateTimeHelper)
        {
            _countryService = countryService;
            _stateProvinceService = stateProvinceService;
            _orderService = orderService;
            _localizationService = localizationService;
            _addressService = addressService;
            _dateTimeHelper = dateTimeHelper;
        }
예제 #27
0
 public ClientController(IClientService clientService, ILocalizationService localizationService,
     ICountryService countryService, IStateProvinceService stateprovinceService, 
     IBranchOfficeService officeService, IGenericAttributeService attributeService, IUserActivityService userActivityService,
     IEncryptionService encryptionService, IWorkContext workContext, ICacheManager cacheManager )
 {
     this.clientService        = clientService;
     this.localizationService  = localizationService;
     this.officeService        = officeService;
     this.userActivityService  = userActivityService;
     this.encryptionService    = encryptionService;
     this.cacheManager         = cacheManager;
     this.countryService       = countryService;
     this.stateprovinceService = stateprovinceService;
     this.workContext          = workContext;
     this.attributeService     = attributeService;
 }
예제 #28
0
 public AffiliateController(ILocalizationService localizationService,
     IWorkContext workContext, IDateTimeHelper dateTimeHelper, IWebHelper webHelper,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IPriceFormatter priceFormatter, IAffiliateService affiliateService,
     IPermissionService permissionService)
 {
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._dateTimeHelper = dateTimeHelper;
     this._webHelper = webHelper;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._priceFormatter = priceFormatter;
     this._affiliateService = affiliateService;
     this._permissionService = permissionService;
 }
 public CustomerController(ICustomerService customerService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ICustomerReportService customerReportService, IDateTimeHelper dateTimeHelper,
     ILocalizationService localizationService, DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings, RewardPointsSettings rewardPointsSettings,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IAddressService addressService,
     CustomerSettings customerSettings, ITaxService taxService,
     IWorkContext workContext, IPriceFormatter priceFormatter,
     IOrderService orderService, IExportManager exportManager,
     ICustomerActivityService customerActivityService,
     IPriceCalculationService priceCalculationService,
     IPermissionService permissionService, AdminAreaSettings adminAreaSettings,
     IQueuedEmailService queuedEmailService, EmailAccountSettings emailAccountSettings,
     IEmailAccountService emailAccountService, ForumSettings forumSettings,
     IForumService forumService, IOpenAuthenticationService openAuthenticationService)
 {
     this._customerService = customerService;
     this._genericAttributeService = genericAttributeService;
     this._customerRegistrationService = customerRegistrationService;
     this._customerReportService = customerReportService;
     this._dateTimeHelper = dateTimeHelper;
     this._localizationService = localizationService;
     this._dateTimeSettings = dateTimeSettings;
     this._taxSettings = taxSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._customerSettings = customerSettings;
     this._taxService = taxService;
     this._workContext = workContext;
     this._priceFormatter = priceFormatter;
     this._orderService = orderService;
     this._exportManager = exportManager;
     this._customerActivityService = customerActivityService;
     this._priceCalculationService = priceCalculationService;
     this._permissionService = permissionService;
     this._adminAreaSettings = adminAreaSettings;
     this._queuedEmailService = queuedEmailService;
     this._emailAccountSettings = emailAccountSettings;
     this._emailAccountService = emailAccountService;
     this._forumSettings = forumSettings;
     this._forumService = forumService;
     this._openAuthenticationService = openAuthenticationService;
 }
예제 #30
0
 public SettingController(ISettingService settingService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IAddressService addressService,
     ITaxCategoryService taxCategoryService,
     ICurrencyService currencyService,
     IPictureService pictureService,
     ILocalizationService localizationService,
     IDateTimeHelper dateTimeHelper,
     IOrderService orderService,
     IEncryptionService encryptionService,
     IThemeProvider themeProvider,
     ICustomerService customerService,
     ICustomerActivityService customerActivityService,
     IPermissionService permissionService,
     IStoreService storeService,
     IWorkContext workContext,
     IGenericAttributeService genericAttributeService,
     IRepository<Product> productRepository,
     IReturnRequestService returnRequestService,
     ILanguageService languageService)
 {
     this._settingService = settingService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._taxCategoryService = taxCategoryService;
     this._currencyService = currencyService;
     this._pictureService = pictureService;
     this._localizationService = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._orderService = orderService;
     this._encryptionService = encryptionService;
     this._themeProvider = themeProvider;
     this._customerService = customerService;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._storeService = storeService;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
     this._productRepository = productRepository;
     this._returnRequestService = returnRequestService;
     this._languageService = languageService;
 }
예제 #31
0
 public ShippingController(IShippingService shippingService,
                           ShippingSettings shippingSettings,
                           ISettingService settingService,
                           IAddressService addressService,
                           ICountryService countryService,
                           IStateProvinceService stateProvinceService,
                           ILocalizationService localizationService,
                           IPermissionService permissionService,
                           ILanguageService languageService,
                           IPluginFinder pluginFinder,
                           IWebHelper webHelper)
 {
     this._shippingService      = shippingService;
     this._shippingSettings     = shippingSettings;
     this._settingService       = settingService;
     this._addressService       = addressService;
     this._countryService       = countryService;
     this._stateProvinceService = stateProvinceService;
     this._localizationService  = localizationService;
     this._permissionService    = permissionService;
     this._languageService      = languageService;
     this._pluginFinder         = pluginFinder;
     this._webHelper            = webHelper;
 }
예제 #32
0
 public PaymentController(IWorkContext workContext,
                          IWebHelper webHelper,
                          IStoreContext storeContext,
                          ICustomerService customerService,
                          IProductService productService,
                          IGiftCardService giftCardService,
                          IOrderService orderService,
                          ICustomerPaymentMethodService paymentMethodService,
                          IMobSecurityService mobSecurityService,
                          IPaymentProcessingService paymentProcessingService,
                          IVideoBattleService videoBattleService,
                          IVoterPassService voterPassService,
                          ISponsorPassService sponsorPassService,
                          mobSocialSettings mobSocialSettings, IAddressAttributeService addressAttributeService, AddressSettings addressSettings, ILocalizationService localizationService, IAddressAttributeParser addressAttributeParser, ICountryService countryService, IStateProvinceService stateProvinceService)
 {
     _workContext              = workContext;
     _storeContext             = storeContext;
     _customerService          = customerService;
     _productService           = productService;
     _giftCardService          = giftCardService;
     _orderService             = orderService;
     _paymentMethodService     = paymentMethodService;
     _mobSecurityService       = mobSecurityService;
     _paymentProcessingService = paymentProcessingService;
     _videoBattleService       = videoBattleService;
     _voterPassService         = voterPassService;
     _sponsorPassService       = sponsorPassService;
     _mobSocialSettings        = mobSocialSettings;
     _addressAttributeService  = addressAttributeService;
     _addressSettings          = addressSettings;
     _localizationService      = localizationService;
     _addressAttributeParser   = addressAttributeParser;
     _countryService           = countryService;
     _stateProvinceService     = stateProvinceService;
     _webHelper = webHelper;
 }
예제 #33
0
 public CommonController(ICacheManager cacheManager,
                         ILanguageService languageService,
                         IWorkContext workContext,
                         ILocalizationService localizationService,
                         IEmailAccountService emailAccountService,
                         IQueuedEmailService queuedEmailService,
                         EmailAccountSettings emailAccountSettings,
                         CommonSettings commonSettings,
                         IAddressService addressService,
                         IStateProvinceService stateProvinceService,
                         AddressSettings addressSettings,
                         ICountryService countryService,
                         IPictureService pictureService,
                         IUrlRecordService urlRecordService,
                         IMiniSiteTextPageService miniSiteTextPageService,
                         CatalogSettings catalogSettings,
                         IWebHelper webHelper)
 {
     this._cacheManager            = cacheManager;
     this._languageService         = languageService;
     this._workContext             = workContext;
     this._localizationService     = localizationService;
     this._emailAccountService     = emailAccountService;
     this._queuedEmailService      = queuedEmailService;
     this._emailAccountSettings    = emailAccountSettings;
     this._commonSettings          = commonSettings;
     this._addressService          = addressService;
     this._stateProvinceService    = stateProvinceService;
     this._addressSettings         = addressSettings;
     this._countryService          = countryService;
     this._pictureService          = pictureService;
     this._urlRecordService        = urlRecordService;
     this._miniSiteTextPageService = miniSiteTextPageService;
     this._catalogSettings         = catalogSettings;
     this._webHelper = webHelper;
 }
예제 #34
0
 public VendorController(ICustomerService customerService,
                         ILocalizationService localizationService,
                         IVendorService vendorService,
                         IPermissionService permissionService,
                         IUrlRecordService urlRecordService,
                         ILanguageService languageService,
                         ILocalizedEntityService localizedEntityService,
                         IPictureService pictureService,
                         IDateTimeHelper dateTimeHelper,
                         VendorSettings vendorSettings,
                         ICustomerActivityService customerActivityService,
                         IAddressService addressService,
                         ICountryService countryService,
                         IStateProvinceService stateProvinceService,
                         IGenericAttributeService genericAttributeService,
                         IVendorAttributeParser vendorAttributeParser,
                         IVendorAttributeService vendorAttributeService)
 {
     this._customerService         = customerService;
     this._localizationService     = localizationService;
     this._vendorService           = vendorService;
     this._permissionService       = permissionService;
     this._urlRecordService        = urlRecordService;
     this._languageService         = languageService;
     this._localizedEntityService  = localizedEntityService;
     this._pictureService          = pictureService;
     this._dateTimeHelper          = dateTimeHelper;
     this._vendorSettings          = vendorSettings;
     this._customerActivityService = customerActivityService;
     this._addressService          = addressService;
     this._countryService          = countryService;
     this._stateProvinceService    = stateProvinceService;
     this._genericAttributeService = genericAttributeService;
     this._vendorAttributeParser   = vendorAttributeParser;
     this._vendorAttributeService  = vendorAttributeService;
 }
 public ShipRocketOrderTask(ILogger LoggerService,
                            IOrderService OrderService,
                            IShipRocketService ShipRocketService,
                            ShipRocketSetting shiprocketsetting,
                            IShipRocketMessageService ShipRocketMessageService,
                            IAddressService addressService,
                            ICountryService countryService,
                            IStateProvinceService stateProvinceService,
                            IRepository <OrderNote> orderNoteRepository,
                            ISettingService settingService,
                            IStoreContext storeContext)
 {
     this._LoggerService            = LoggerService;
     this._OrderService             = OrderService;
     this._ShipRocketService        = ShipRocketService;
     this._ShipRocketSeting         = shiprocketsetting;
     this._ShipRocketMessageService = ShipRocketMessageService;
     this._addressService           = addressService;
     this._countryService           = countryService;
     this._stateProvinceService     = stateProvinceService;
     this._orderNoteRepository      = orderNoteRepository;
     this._settingService           = settingService;
     this._storeContext             = storeContext;
 }
예제 #36
0
 public CountryController(ICountryService countryService,
                          IStateProvinceService stateProvinceService,
                          ILocalizationService localizationService,
                          IAddressService addressService,
                          IPermissionService permissionService,
                          ILocalizedEntityService localizedEntityService,
                          ILanguageService languageService,
                          IStoreService storeService,
                          IStoreMappingService storeMappingService,
                          IExportManager exportManager,
                          IImportManager importManager)
 {
     this._countryService         = countryService;
     this._stateProvinceService   = stateProvinceService;
     this._localizationService    = localizationService;
     this._addressService         = addressService;
     this._permissionService      = permissionService;
     this._localizedEntityService = localizedEntityService;
     this._languageService        = languageService;
     this._storeService           = storeService;
     this._storeMappingService    = storeMappingService;
     this._exportManager          = exportManager;
     this._importManager          = importManager;
 }
 public AvalaraTaxController(AvalaraTaxManager avalaraTaxManager,
                             AvalaraTaxSettings avalaraTaxSettings,
                             CurrencySettings currencySettings,
                             ICountryService countryService,
                             ICurrencyService currencyService,
                             ILocalizationService localizationService,
                             IPermissionService permissionService,
                             ISettingService settingService,
                             IStateProvinceService stateProvinceService,
                             ITaxService taxService,
                             IWorkContext workContext)
 {
     this._avalaraTaxManager    = avalaraTaxManager;
     this._avalaraTaxSettings   = avalaraTaxSettings;
     this._currencySettings     = currencySettings;
     this._countryService       = countryService;
     this._currencyService      = currencyService;
     this._localizationService  = localizationService;
     this._permissionService    = permissionService;
     this._settingService       = settingService;
     this._stateProvinceService = stateProvinceService;
     this._taxService           = taxService;
     this._workContext          = workContext;
 }
예제 #38
0
 public ShippingsController(IJsonFieldsSerializer jsonFieldsSerializer,
                            ISettingService settingService,
                            IStoreContext storeContext,
                            IProductApiService productApiService,
                            ICustomerActivityService customerActivityService,
                            ILocalizationService localizationService,
                            IAclService aclService,
                            IStoreMappingService storeMappingService,
                            IStoreService storeService,
                            ICustomerService customerService,
                            IDiscountService discountService,
                            IPictureService pictureService,
                            IShippingService shippingService,
                            ICountryService countryService,
                            IStateProvinceService stateProvinceService,
                            IWorkContext workContext,
                            IOrderTotalCalculationService orderTotalCalculationService,
                            ITaxService taxService,
                            ICurrencyService currencyService,
                            IPriceFormatter priceFormatter,
                            ShippingSettings shippingSettings,
                            IDTOHelper dtoHelper) : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     _settingService               = settingService;
     _storeContext                 = storeContext;
     _productApiService            = productApiService;
     _shippingService              = shippingService;
     _countryService               = countryService;
     _stateProvinceService         = stateProvinceService;
     _workContext                  = workContext;
     _orderTotalCalculationService = orderTotalCalculationService;
     _taxService          = taxService;
     _currencyService     = currencyService;
     _localizationService = localizationService;
     _shippingSettings    = shippingSettings;
 }
 public AddressValidationViewComponent(AvalaraTaxManager avalaraTaxManager,
                                       AvalaraTaxSettings avalaraTaxSettings,
                                       IAddressService addressService,
                                       ICountryService countryService,
                                       ILocalizationService localizationService,
                                       ILogger logger,
                                       IPermissionService permissionService,
                                       IStateProvinceService stateProvinceService,
                                       ITaxService taxService,
                                       IWorkContext workContext,
                                       TaxSettings taxSettings)
 {
     this._avalaraTaxManager   = avalaraTaxManager;
     this._avalaraTaxSettings  = avalaraTaxSettings;
     this._addressService      = addressService;
     this._countryService      = countryService;
     this._localizationService = localizationService;
     this._logger               = logger;
     this._permissionService    = permissionService;
     this._stateProvinceService = stateProvinceService;
     this._taxService           = taxService;
     this._workContext          = workContext;
     this._taxSettings          = taxSettings;
 }
예제 #40
0
 public AffiliateModelFactory(IAddressModelFactory addressModelFactory,
                              IAddressService addressService,
                              IAffiliateService affiliateService,
                              IBaseAdminModelFactory baseAdminModelFactory,
                              ICountryService countryService,
                              ICustomerService customerService,
                              IDateTimeHelper dateTimeHelper,
                              ILocalizationService localizationService,
                              IOrderService orderService,
                              IPriceFormatter priceFormatter,
                              IStateProvinceService stateProvinceService)
 {
     _addressModelFactory   = addressModelFactory;
     _addressService        = addressService;
     _affiliateService      = affiliateService;
     _baseAdminModelFactory = baseAdminModelFactory;
     _countryService        = countryService;
     _customerService       = customerService;
     _dateTimeHelper        = dateTimeHelper;
     _localizationService   = localizationService;
     _orderService          = orderService;
     _priceFormatter        = priceFormatter;
     _stateProvinceService  = stateProvinceService;
 }
예제 #41
0
 public ImportManager(IProductService productService,
                      ICategoryService categoryService,
                      IPictureService pictureService,
                      IUrlRecordService urlRecordService,
                      IStoreContext storeContext,
                      INewsLetterSubscriptionService newsLetterSubscriptionService,
                      ICountryService countryService,
                      IStateProvinceService stateProvinceService,
                      IEncryptionService encryptionService,
                      IDataProvider dataProvider,
                      MediaSettings mediaSettings,
                      IProductTemplateService productTemplateService,
                      CatalogSettings catalogSettings,
                      IProductTagService productTagService,
                      IWorkContext workContext,
                      ILocalizationService localizationService,
                      ICustomerActivityService customerActivityService)
 {
     this._productService   = productService;
     this._categoryService  = categoryService;
     this._pictureService   = pictureService;
     this._urlRecordService = urlRecordService;
     this._storeContext     = storeContext;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._countryService          = countryService;
     this._stateProvinceService    = stateProvinceService;
     this._encryptionService       = encryptionService;
     this._dataProvider            = dataProvider;
     this._mediaSettings           = mediaSettings;
     this._productTemplateService  = productTemplateService;
     this._catalogSettings         = catalogSettings;
     this._productTagService       = productTagService;
     this._workContext             = workContext;
     this._localizationService     = localizationService;
     this._customerActivityService = customerActivityService;
 }
 public VendorController(ICustomerService customerService,
                         ILocalizationService localizationService,
                         IVendorService vendorService,
                         IManufacturerService manufacturerService,
                         IPermissionService permissionService,
                         IUrlRecordService urlRecordService,
                         ILanguageService languageService,
                         ILocalizedEntityService localizedEntityService,
                         VendorSettings vendorSettings,
                         ICityService cityService,
                         IStateProvinceService stateProvinceService)
 {
     this._customerService        = customerService;
     this._localizationService    = localizationService;
     this._vendorService          = vendorService;
     this._manufacturerService    = manufacturerService;
     this._permissionService      = permissionService;
     this._urlRecordService       = urlRecordService;
     this._languageService        = languageService;
     this._localizedEntityService = localizedEntityService;
     this._vendorSettings         = vendorSettings;
     this._cityService            = cityService;
     this._stateProvinceService   = stateProvinceService;
 }
예제 #43
0
 public AddressValidationViewComponent(AvalaraTaxManager avalaraTaxManager,
                                       AvalaraTaxSettings avalaraTaxSettings,
                                       IAddressService addressService,
                                       ICountryService countryService,
                                       ICustomerService customerService,
                                       ILocalizationService localizationService,
                                       IStateProvinceService stateProvinceService,
                                       IStoreContext storeContext,
                                       ITaxPluginManager taxPluginManager,
                                       IWorkContext workContext,
                                       TaxSettings taxSettings)
 {
     _avalaraTaxManager    = avalaraTaxManager;
     _avalaraTaxSettings   = avalaraTaxSettings;
     _addressService       = addressService;
     _countryService       = countryService;
     _customerService      = customerService;
     _localizationService  = localizationService;
     _stateProvinceService = stateProvinceService;
     _storeContext         = storeContext;
     _taxPluginManager     = taxPluginManager;
     _workContext          = workContext;
     _taxSettings          = taxSettings;
 }
예제 #44
0
 public UPSService(CurrencySettings currencySettings,
                   ICountryService countryService,
                   ICurrencyService currencyService,
                   ILocalizationService localizationService,
                   ILogger logger,
                   IMeasureService measureService,
                   IOrderTotalCalculationService orderTotalCalculationService,
                   IShippingService shippingService,
                   IStateProvinceService stateProvinceService,
                   IWorkContext workContext,
                   UPSSettings upsSettings)
 {
     _currencySettings    = currencySettings;
     _countryService      = countryService;
     _currencyService     = currencyService;
     _localizationService = localizationService;
     _logger         = logger;
     _measureService = measureService;
     _orderTotalCalculationService = orderTotalCalculationService;
     _shippingService      = shippingService;
     _stateProvinceService = stateProvinceService;
     _workContext          = workContext;
     _upsSettings          = upsSettings;
 }
예제 #45
0
        public CustomerValidator(ILocalizationService localizationService,
                                 IStateProvinceService stateProvinceService,
                                 ICustomerService customerService,
                                 CustomerSettings customerSettings,
                                 IDbContext dbContext)
        {
            //ensure that valid email address is entered if Registered role is checked to avoid registered customers with empty email address
            RuleFor(x => x.Email)
            .NotEmpty()
            .EmailAddress()
            //.WithMessage("Valid Email is required for customer to be in 'Registered' role")
            .WithMessage(localizationService.GetResource("Admin.Common.WrongEmail"))
            //only for registered users
            .When(x => IsRegisteredCustomerRoleChecked(x, customerService));

            //form fields
            if (customerSettings.CountryEnabled && customerSettings.CountryRequired)
            {
                RuleFor(x => x.CountryId)
                .NotEqual(0)
                .WithMessage(localizationService.GetResource("Account.Fields.Country.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.CountryEnabled &&
                customerSettings.StateProvinceEnabled &&
                customerSettings.StateProvinceRequired)
            {
                RuleFor(x => x.StateProvinceId).Must((x, context) =>
                {
                    //does selected country have states?
                    var hasStates = stateProvinceService.GetStateProvincesByCountryId(x.CountryId).Any();
                    if (hasStates)
                    {
                        //if yes, then ensure that a state is selected
                        if (x.StateProvinceId == 0)
                        {
                            return(false);
                        }
                    }

                    return(true);
                }).WithMessage(localizationService.GetResource("Account.Fields.StateProvince.Required"));
            }
            if (customerSettings.CompanyRequired && customerSettings.CompanyEnabled)
            {
                RuleFor(x => x.Company)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.Company.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.StreetAddressRequired && customerSettings.StreetAddressEnabled)
            {
                RuleFor(x => x.StreetAddress)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.StreetAddress.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.StreetAddress2Required && customerSettings.StreetAddress2Enabled)
            {
                RuleFor(x => x.StreetAddress2)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.StreetAddress2.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.ZipPostalCodeRequired && customerSettings.ZipPostalCodeEnabled)
            {
                RuleFor(x => x.ZipPostalCode)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.ZipPostalCode.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.CityRequired && customerSettings.CityEnabled)
            {
                RuleFor(x => x.City)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.City.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.PhoneRequired && customerSettings.PhoneEnabled)
            {
                RuleFor(x => x.Phone)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.Phone.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }
            if (customerSettings.FaxRequired && customerSettings.FaxEnabled)
            {
                RuleFor(x => x.Fax)
                .NotEmpty()
                .WithMessage(localizationService.GetResource("Admin.Customers.Customers.Fields.Fax.Required"))
                //only for registered users
                .When(x => IsRegisteredCustomerRoleChecked(x, customerService));
            }

            SetDatabaseValidationRules <Customer>(dbContext);
        }
예제 #46
0
        public CustomerInfoValidator(ILocalizationService localizationService,
                                     IStateProvinceService stateProvinceService,
                                     CustomerSettings customerSettings)
        {
            RuleFor(x => x.Email).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Email.Required"));
            RuleFor(x => x.Email).EmailAddress().WithMessage(localizationService.GetResource("Common.WrongEmail"));
            RuleFor(x => x.FirstName).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.FirstName.Required"));
            RuleFor(x => x.LastName).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.LastName.Required"));

            if (customerSettings.UsernamesEnabled && customerSettings.AllowUsersToChangeUsernames)
            {
                RuleFor(x => x.Username).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Username.Required"));
                RuleFor(x => x.Username).IsUsername(customerSettings).WithMessage(localizationService.GetResource("Account.Fields.Username.NotValid"));
            }

            //form fields
            if (customerSettings.CountryEnabled && customerSettings.CountryRequired)
            {
                RuleFor(x => x.CountryId)
                .NotEqual(0)
                .WithMessage(localizationService.GetResource("Account.Fields.Country.Required"));
            }
            if (customerSettings.CountryEnabled &&
                customerSettings.StateProvinceEnabled &&
                customerSettings.StateProvinceRequired)
            {
                RuleFor(x => x.StateProvinceId).Must((x, context) =>
                {
                    //does selected country have states?
                    var hasStates = stateProvinceService.GetStateProvincesByCountryId(x.CountryId).Any();
                    if (hasStates)
                    {
                        //if yes, then ensure that a state is selected
                        if (x.StateProvinceId == 0)
                        {
                            return(false);
                        }
                    }

                    return(true);
                }).WithMessage(localizationService.GetResource("Account.Fields.StateProvince.Required"));
            }
            if (customerSettings.DateOfBirthEnabled && customerSettings.DateOfBirthRequired)
            {
                //entered?
                RuleFor(x => x.DateOfBirthDay).Must((x, context) =>
                {
                    var dateOfBirth = x.ParseDateOfBirth();
                    if (!dateOfBirth.HasValue)
                    {
                        return(false);
                    }

                    return(true);
                }).WithMessage(localizationService.GetResource("Account.Fields.DateOfBirth.Required"));

                //minimum age
                RuleFor(x => x.DateOfBirthDay).Must((x, context) =>
                {
                    var dateOfBirth = x.ParseDateOfBirth();
                    if (dateOfBirth.HasValue && customerSettings.DateOfBirthMinimumAge.HasValue &&
                        CommonHelper.GetDifferenceInYears(dateOfBirth.Value, DateTime.Today) <
                        customerSettings.DateOfBirthMinimumAge.Value)
                    {
                        return(false);
                    }

                    return(true);
                }).WithMessage(string.Format(localizationService.GetResource("Account.Fields.DateOfBirth.MinimumAge"), customerSettings.DateOfBirthMinimumAge));
            }
            if (customerSettings.CompanyRequired && customerSettings.CompanyEnabled)
            {
                RuleFor(x => x.Company).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Company.Required"));
            }
            if (customerSettings.StreetAddressRequired && customerSettings.StreetAddressEnabled)
            {
                RuleFor(x => x.StreetAddress).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.StreetAddress.Required"));
            }
            if (customerSettings.StreetAddress2Required && customerSettings.StreetAddress2Enabled)
            {
                RuleFor(x => x.StreetAddress2).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.StreetAddress2.Required"));
            }
            if (customerSettings.ZipPostalCodeRequired && customerSettings.ZipPostalCodeEnabled)
            {
                RuleFor(x => x.ZipPostalCode).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ZipPostalCode.Required"));
            }
            if (customerSettings.CountyRequired && customerSettings.CountyEnabled)
            {
                RuleFor(x => x.County).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.County.Required"));
            }
            if (customerSettings.CityRequired && customerSettings.CityEnabled)
            {
                RuleFor(x => x.City).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.City.Required"));
            }
            if (customerSettings.PhoneRequired && customerSettings.PhoneEnabled)
            {
                RuleFor(x => x.Phone).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Phone.Required"));
            }
            if (customerSettings.FaxRequired && customerSettings.FaxEnabled)
            {
                RuleFor(x => x.Fax).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Fax.Required"));
            }
        }
예제 #47
0
        public async Task <IActionResult> GetStatesByCountryId([FromServices] ICountryService countryService, [FromServices] IStateProvinceService stateProvinceService,
                                                               string countryId, bool?addSelectStateItem, bool?addAsterisk)
        {
            // This action method gets called via an ajax request
            if (String.IsNullOrEmpty(countryId))
            {
                return(Json(new List <dynamic>()
                {
                    new { id = "", name = _localizationService.GetResource("Address.SelectState") }
                }));
            }

            var country = await countryService.GetCountryById(countryId);

            var states = country != null ? await stateProvinceService.GetStateProvincesByCountryId(country.Id, showHidden : true) : new List <StateProvince>();

            var result = (from s in states
                          select new { id = s.Id, name = s.Name }).ToList();

            if (addAsterisk.HasValue && addAsterisk.Value)
            {
                //asterisk
                result.Insert(0, new { id = "", name = "*" });
            }
            else
            {
                if (country == null)
                {
                    //country is not selected ("choose country" item)
                    if (addSelectStateItem.HasValue && addSelectStateItem.Value)
                    {
                        result.Insert(0, new { id = "", name = _localizationService.GetResource("Admin.Address.SelectState") });
                    }
                    else
                    {
                        result.Insert(0, new { id = "", name = _localizationService.GetResource("Admin.Address.OtherNonUS") });
                    }
                }
                else
                {
                    //some country is selected
                    if (result.Count == 0)
                    {
                        //country does not have states
                        result.Insert(0, new { id = "", name = _localizationService.GetResource("Admin.Address.OtherNonUS") });
                    }
                    else
                    {
                        //country has some states
                        if (addSelectStateItem.HasValue && addSelectStateItem.Value)
                        {
                            result.Insert(0, new { id = "", name = _localizationService.GetResource("Admin.Address.SelectState") });
                        }
                    }
                }
            }
            return(Json(result));
        }
 public OverriddenShoppingCartModelFactory(AddressSettings addressSettings,
                                           CaptchaSettings captchaSettings,
                                           CatalogSettings catalogSettings,
                                           CommonSettings commonSettings,
                                           CustomerSettings customerSettings,
                                           IAddressModelFactory addressModelFactory,
                                           ICheckoutAttributeFormatter checkoutAttributeFormatter,
                                           ICheckoutAttributeParser checkoutAttributeParser,
                                           ICheckoutAttributeService checkoutAttributeService,
                                           ICountryService countryService,
                                           ICurrencyService currencyService,
                                           ICustomerService customerService,
                                           IDiscountService discountService,
                                           IDownloadService downloadService,
                                           IGenericAttributeService genericAttributeService,
                                           IGiftCardService giftCardService,
                                           IHttpContextAccessor httpContextAccessor,
                                           ILocalizationService localizationService,
                                           IOrderProcessingService orderProcessingService,
                                           IOrderTotalCalculationService orderTotalCalculationService,
                                           IPaymentPluginManager paymentPluginManager,
                                           IPaymentService paymentService,
                                           IPermissionService permissionService,
                                           IPictureService pictureService,
                                           IPriceCalculationService priceCalculationService,
                                           IPriceFormatter priceFormatter,
                                           IProductAttributeFormatter productAttributeFormatter,
                                           IProductService productService,
                                           IShippingPluginManager shippingPluginManager,
                                           IShippingService shippingService,
                                           IShoppingCartService shoppingCartService,
                                           IStateProvinceService stateProvinceService,
                                           IStaticCacheManager cacheManager,
                                           IStoreContext storeContext,
                                           ITaxPluginManager taxPluginManager,
                                           ITaxService taxService,
                                           IUrlRecordService urlRecordService,
                                           IVendorService vendorService,
                                           IWebHelper webHelper,
                                           IWorkContext workContext,
                                           MediaSettings mediaSettings,
                                           OrderSettings orderSettings,
                                           RewardPointsSettings rewardPointsSettings,
                                           ShippingSettings shippingSettings,
                                           ShoppingCartSettings shoppingCartSettings,
                                           TaxSettings taxSettings,
                                           VendorSettings vendorSettings) : base(addressSettings,
                                                                                 captchaSettings,
                                                                                 catalogSettings,
                                                                                 commonSettings,
                                                                                 customerSettings,
                                                                                 addressModelFactory,
                                                                                 checkoutAttributeFormatter,
                                                                                 checkoutAttributeParser,
                                                                                 checkoutAttributeService,
                                                                                 countryService,
                                                                                 currencyService,
                                                                                 customerService,
                                                                                 discountService,
                                                                                 downloadService,
                                                                                 genericAttributeService,
                                                                                 giftCardService,
                                                                                 httpContextAccessor,
                                                                                 localizationService,
                                                                                 orderProcessingService,
                                                                                 orderTotalCalculationService,
                                                                                 paymentPluginManager,
                                                                                 paymentService,
                                                                                 permissionService,
                                                                                 pictureService,
                                                                                 priceCalculationService,
                                                                                 priceFormatter,
                                                                                 productAttributeFormatter,
                                                                                 productService,
                                                                                 shippingPluginManager,
                                                                                 shippingService,
                                                                                 shoppingCartService,
                                                                                 stateProvinceService,
                                                                                 cacheManager,
                                                                                 storeContext,
                                                                                 taxService,
                                                                                 urlRecordService,
                                                                                 vendorService,
                                                                                 webHelper,
                                                                                 workContext,
                                                                                 mediaSettings,
                                                                                 orderSettings,
                                                                                 rewardPointsSettings,
                                                                                 shippingSettings,
                                                                                 shoppingCartSettings,
                                                                                 taxSettings,
                                                                                 vendorSettings)
 {
     _countryService               = countryService;
     _currencyService              = currencyService;
     _genericAttributeService      = genericAttributeService;
     _giftCardService              = giftCardService;
     _httpContextAccessor          = httpContextAccessor;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentService               = paymentService;
     _priceCalculationService      = priceCalculationService;
     _priceFormatter               = priceFormatter;
     _shippingPluginManager        = shippingPluginManager;
     _shoppingCartService          = shoppingCartService;
     _stateProvinceService         = stateProvinceService;
     _storeContext         = storeContext;
     _taxPluginManager     = taxPluginManager;
     _taxService           = taxService;
     _workContext          = workContext;
     _rewardPointsSettings = rewardPointsSettings;
     _shippingSettings     = shippingSettings;
     _taxSettings          = taxSettings;
 }
 public PagSeguroService(ISettingService settingService, ICurrencyService currencyService, CurrencySettings currencySettings, PagSeguroPaymentSetting pagSeguroPaymentSetting, IOrderService orderService, IOrderProcessingService orderProcessingService, IStoreContext storeContext, ICustomerService customerService, IAddressService addressService, ICountryService countryService, IStateProvinceService stateProvinceService, IProductService _productService)
 {
     this._settingService          = settingService;
     this._currencyService         = currencyService;
     this._currencySettings        = currencySettings;
     this._pagSeguroPaymentSetting = pagSeguroPaymentSetting;
     this._orderService            = orderService;
     this._orderProcessingService  = orderProcessingService;
     this._storeContext            = storeContext;
     this._customerService         = customerService;
     this._addressService          = addressService;
     this._countryService          = countryService;
     this._stateProvinceService    = stateProvinceService;
     this._productService          = _productService;
 }
예제 #50
0
        public void TestInitialize()
        {
            new Grand.Services.Tests.ServiceTest().PluginInitializator();

            _workContext          = new Mock <IWorkContext>().Object;
            _stateProvinceService = new Mock <IStateProvinceService>().Object;

            _store = new Store {
                Id = "1"
            };
            var tempStoreContext = new Mock <IStoreContext>();

            {
                tempStoreContext.Setup(x => x.CurrentStore).Returns(_store);
                _storeContext = tempStoreContext.Object;
            }

            _productService = new Mock <IProductService>().Object;
            var tempEventPublisher = new Mock <IMediator>();
            {
                //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }

            var pluginFinder = new PluginFinder(_serviceProvider);
            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher);

            _discountService        = new Mock <IDiscountService>().Object;
            _categoryService        = new Mock <ICategoryService>().Object;
            _manufacturerService    = new Mock <IManufacturerService>().Object;
            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _vendorService          = new Mock <IVendorService>().Object;
            _currencyService        = new Mock <ICurrencyService>().Object;
            _serviceProvider        = new Mock <IServiceProvider>().Object;

            _shoppingCartSettings   = new ShoppingCartSettings();
            _catalogSettings        = new CatalogSettings();
            _customerService        = new Mock <ICustomerService>().Object;
            _customerProductService = new Mock <ICustomerProductService>().Object;

            _priceCalcService = new PriceCalculationService(_workContext, _storeContext,
                                                            _discountService, _categoryService,
                                                            _manufacturerService, _productAttributeParser, _productService, _customerProductService,
                                                            _vendorService, _currencyService,
                                                            _shoppingCartSettings, _catalogSettings);


            _localizationService = new Mock <ILocalizationService>().Object;

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object;
            _deliveryDateRepository   = new Mock <IRepository <DeliveryDate> >().Object;
            _warehouseRepository      = new Mock <IRepository <Warehouse> >().Object;
            _logger                  = new NullLogger();
            _paymentService          = new Mock <IPaymentService>().Object;
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _giftCardService         = new Mock <IGiftCardService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;
            _geoLookupService        = new Mock <IGeoLookupService>().Object;
            _countryService          = new Mock <ICountryService>().Object;
            _customerSettings        = new CustomerSettings();
            _addressSettings         = new AddressSettings();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = "10";

            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   null,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _localizationService,
                                                   _addressService,
                                                   _countryService,
                                                   _stateProvinceService,
                                                   pluginFinder,
                                                   _eventPublisher,
                                                   _currencyService,
                                                   cacheManager,
                                                   _shoppingCartSettings,
                                                   _shippingSettings);



            var tempAddressService = new Mock <IAddressService>();

            {
                tempAddressService.Setup(x => x.GetAddressByIdSettings(_taxSettings.DefaultTaxAddressId))
                .ReturnsAsync(new Address {
                    Id = _taxSettings.DefaultTaxAddressId
                });
                _addressService = tempAddressService.Object;
            }

            _taxService = new TaxService(_addressService, _workContext, pluginFinder, _geoLookupService, _countryService, _logger, _taxSettings, _customerSettings, _addressSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      null, _productService, _currencyService, _taxSettings, _rewardPointsSettings,
                                                                      _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
예제 #51
0
        //address
        /// <summary>
        /// Prepare address model
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="address">Address</param>
        /// <param name="excludeProperties">A value indicating whether to exclude properties</param>
        /// <param name="addressSettings">Address settings</param>
        /// <param name="localizationService">Localization service (used to prepare a select list)</param>
        /// <param name="stateProvinceService">State service (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="addressAttributeService">Address attribute service. null to don't prepare the list.</param>
        /// <param name="addressAttributeParser">Address attribute parser. null to don't prepare the list.</param>
        /// <param name="addressAttributeFormatter">Address attribute formatter. null to don't prepare the formatted custom attributes.</param>
        /// <param name="loadCountries">A function to load countries  (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="prePopulateWithCustomerFields">A value indicating whether to pre-populate an address with customer fields entered during registration. It's used only when "address" parameter is set to "null"</param>
        /// <param name="customer">Customer record which will be used to pre-populate address. Used only when "prePopulateWithCustomerFields" is "true".</param>
        /// <param name="overrideAttributesXml">When specified we do not use attributes of an address; if null, then already saved ones are used</param>
        public static void PrepareModel(this AddressModel model,
                                        Address address, bool excludeProperties,
                                        AddressSettings addressSettings,
                                        ILocalizationService localizationService             = null,
                                        IStateProvinceService stateProvinceService           = null,
                                        IAddressAttributeService addressAttributeService     = null,
                                        IAddressAttributeParser addressAttributeParser       = null,
                                        IAddressAttributeFormatter addressAttributeFormatter = null,
                                        Func <IList <Country> > loadCountries = null,
                                        bool prePopulateWithCustomerFields    = false,
                                        Customer customer            = null,
                                        string overrideAttributesXml = "")
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (addressSettings == null)
            {
                throw new ArgumentNullException("addressSettings");
            }

            if (!excludeProperties && address != null)
            {
                model.Id          = address.Id;
                model.FirstName   = address.FirstName;
                model.LastName    = address.LastName;
                model.Email       = address.Email;
                model.Company     = address.Company;
                model.CountryId   = address.CountryId;
                model.CountryName = address.Country != null
                    ? address.Country.GetLocalized(x => x.Name)
                    : null;

                model.StateProvinceId   = address.StateProvinceId;
                model.StateProvinceName = address.StateProvince != null
                    ? address.StateProvince.GetLocalized(x => x.Name)
                    : null;

                model.City          = address.City;
                model.Address1      = address.Address1;
                model.Address2      = address.Address2;
                model.ZipPostalCode = address.ZipPostalCode;
                model.PhoneNumber   = address.PhoneNumber;
                model.FaxNumber     = address.FaxNumber;
            }

            if (address == null && prePopulateWithCustomerFields)
            {
                if (customer == null)
                {
                    throw new Exception("Customer cannot be null when prepopulating an address");
                }
                model.Email         = customer.Email;
                model.FirstName     = customer.GetAttribute <string>(SystemCustomerAttributeNames.FirstName);
                model.LastName      = customer.GetAttribute <string>(SystemCustomerAttributeNames.LastName);
                model.Company       = customer.GetAttribute <string>(SystemCustomerAttributeNames.Company);
                model.Address1      = customer.GetAttribute <string>(SystemCustomerAttributeNames.StreetAddress);
                model.Address2      = customer.GetAttribute <string>(SystemCustomerAttributeNames.StreetAddress2);
                model.ZipPostalCode = customer.GetAttribute <string>(SystemCustomerAttributeNames.ZipPostalCode);
                model.City          = customer.GetAttribute <string>(SystemCustomerAttributeNames.City);
                //ignore country and state for prepopulation. it can cause some issues when posting pack with errors, etc
                //model.CountryId = customer.GetAttribute<int>(SystemCustomerAttributeNames.CountryId);
                //model.StateProvinceId = customer.GetAttribute<int>(SystemCustomerAttributeNames.StateProvinceId);
                model.PhoneNumber = customer.GetAttribute <string>(SystemCustomerAttributeNames.Phone);
                model.FaxNumber   = customer.GetAttribute <string>(SystemCustomerAttributeNames.Fax);
            }

            //countries and states
            if (addressSettings.CountryEnabled && loadCountries != null)
            {
                if (localizationService == null)
                {
                    throw new ArgumentNullException("localizationService");
                }

                model.AvailableCountries.Add(new SelectListItem {
                    Text = localizationService.GetResource("Address.SelectCountry"), Value = "0"
                });
                foreach (var c in loadCountries())
                {
                    model.AvailableCountries.Add(new SelectListItem
                    {
                        Text     = c.GetLocalized(x => x.Name),
                        Value    = c.Id.ToString(),
                        Selected = c.Id == model.CountryId
                    });
                }

                if (addressSettings.StateProvinceEnabled)
                {
                    //states
                    if (stateProvinceService == null)
                    {
                        throw new ArgumentNullException("stateProvinceService");
                    }

                    var languageId = EngineContext.Current.Resolve <IWorkContext>().WorkingLanguage.Id;
                    var states     = stateProvinceService
                                     .GetStateProvincesByCountryId(model.CountryId.HasValue ? model.CountryId.Value : 0, languageId)
                                     .ToList();
                    if (states.Any())
                    {
                        model.AvailableStates.Add(new SelectListItem {
                            Text = localizationService.GetResource("Address.SelectState"), Value = "0"
                        });

                        foreach (var s in states)
                        {
                            model.AvailableStates.Add(new SelectListItem
                            {
                                Text     = s.GetLocalized(x => x.Name),
                                Value    = s.Id.ToString(),
                                Selected = (s.Id == model.StateProvinceId)
                            });
                        }
                    }
                    else
                    {
                        bool anyCountrySelected = model.AvailableCountries.Any(x => x.Selected);
                        model.AvailableStates.Add(new SelectListItem
                        {
                            Text  = localizationService.GetResource(anyCountrySelected ? "Address.OtherNonUS" : "Address.SelectState"),
                            Value = "0"
                        });
                    }
                }
            }

            //form fields
            model.CompanyEnabled         = addressSettings.CompanyEnabled;
            model.CompanyRequired        = addressSettings.CompanyRequired;
            model.StreetAddressEnabled   = addressSettings.StreetAddressEnabled;
            model.StreetAddressRequired  = addressSettings.StreetAddressRequired;
            model.StreetAddress2Enabled  = addressSettings.StreetAddress2Enabled;
            model.StreetAddress2Required = addressSettings.StreetAddress2Required;
            model.ZipPostalCodeEnabled   = addressSettings.ZipPostalCodeEnabled;
            model.ZipPostalCodeRequired  = addressSettings.ZipPostalCodeRequired;
            model.CityEnabled            = addressSettings.CityEnabled;
            model.CityRequired           = addressSettings.CityRequired;
            model.CountryEnabled         = addressSettings.CountryEnabled;
            model.StateProvinceEnabled   = addressSettings.StateProvinceEnabled;
            model.PhoneEnabled           = addressSettings.PhoneEnabled;
            model.PhoneRequired          = addressSettings.PhoneRequired;
            model.FaxEnabled             = addressSettings.FaxEnabled;
            model.FaxRequired            = addressSettings.FaxRequired;

            //customer attribute services
            if (addressAttributeService != null && addressAttributeParser != null)
            {
                PrepareCustomAddressAttributes(model, address, addressAttributeService, addressAttributeParser, overrideAttributesXml);
            }
            if (addressAttributeFormatter != null && address != null)
            {
                model.FormattedCustomAddressAttributes = addressAttributeFormatter.FormatAttributes(address.CustomAttributes);
            }
        }
 public CustomerModelFactory(IAddressModelFactory addressModelFactory,
                             IDateTimeHelper dateTimeHelper,
                             DateTimeSettings dateTimeSettings,
                             TaxSettings taxSettings,
                             ILocalizationService localizationService,
                             IWorkContext workContext,
                             IStoreContext storeContext,
                             IStoreMappingService storeMappingService,
                             ICustomerAttributeParser customerAttributeParser,
                             ICustomerAttributeService customerAttributeService,
                             IGenericAttributeService genericAttributeService,
                             RewardPointsSettings rewardPointsSettings,
                             CustomerSettings customerSettings,
                             AddressSettings addressSettings,
                             ForumSettings forumSettings,
                             OrderSettings orderSettings,
                             ICountryService countryService,
                             IStateProvinceService stateProvinceService,
                             IOrderService orderService,
                             IPictureService pictureService,
                             INewsLetterSubscriptionService newsLetterSubscriptionService,
                             IOpenAuthenticationService openAuthenticationService,
                             IDownloadService downloadService,
                             IReturnRequestService returnRequestService,
                             MediaSettings mediaSettings,
                             CaptchaSettings captchaSettings,
                             SecuritySettings securitySettings,
                             ExternalAuthenticationSettings externalAuthenticationSettings,
                             CatalogSettings catalogSettings,
                             VendorSettings vendorSettings)
 {
     this._addressModelFactory            = addressModelFactory;
     this._dateTimeHelper                 = dateTimeHelper;
     this._dateTimeSettings               = dateTimeSettings;
     this._taxSettings                    = taxSettings;
     this._localizationService            = localizationService;
     this._workContext                    = workContext;
     this._storeContext                   = storeContext;
     this._storeMappingService            = storeMappingService;
     this._customerAttributeParser        = customerAttributeParser;
     this._customerAttributeService       = customerAttributeService;
     this._genericAttributeService        = genericAttributeService;
     this._rewardPointsSettings           = rewardPointsSettings;
     this._customerSettings               = customerSettings;
     this._addressSettings                = addressSettings;
     this._forumSettings                  = forumSettings;
     this._orderSettings                  = orderSettings;
     this._countryService                 = countryService;
     this._stateProvinceService           = stateProvinceService;
     this._orderService                   = orderService;
     this._pictureService                 = pictureService;
     this._newsLetterSubscriptionService  = newsLetterSubscriptionService;
     this._openAuthenticationService      = openAuthenticationService;
     this._downloadService                = downloadService;
     this._returnRequestService           = returnRequestService;
     this._mediaSettings                  = mediaSettings;
     this._captchaSettings                = captchaSettings;
     this._securitySettings               = securitySettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._catalogSettings                = catalogSettings;
     this._vendorSettings                 = vendorSettings;
 }
예제 #53
0
 public DirectoryController(ICountryService countryService, ICurrencyService currencyService, IGeoLookupService geoLookupService, IMeasureService measureService, IStateProvinceService stateProvinceService)
 {
     this._countryService       = countryService;
     this._currencyService      = currencyService;
     this._geoLookupService     = geoLookupService;
     this._measureService       = measureService;
     this._stateProvinceService = stateProvinceService;
 }
예제 #54
0
        public RegisterValidator(
            IEnumerable <IValidatorConsumer <RegisterModel> > validators,
            ILocalizationService localizationService,
            IStateProvinceService stateProvinceService,
            CustomerSettings customerSettings)
            : base(validators)
        {
            RuleFor(x => x.Email).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Email.Required"));
            RuleFor(x => x.Email).EmailAddress().WithMessage(localizationService.GetResource("Common.WrongEmail"));


            if (customerSettings.UsernamesEnabled)
            {
                RuleFor(x => x.Username).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Username.Required"));
            }

            RuleFor(x => x.FirstName).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.FirstName.Required"));
            RuleFor(x => x.LastName).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.LastName.Required"));


            RuleFor(x => x.Password).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Password.Required"));
            RuleFor(x => x.Password).Length(customerSettings.PasswordMinLength, 999).WithMessage(string.Format(localizationService.GetResource("Account.Fields.Password.LengthValidation"), customerSettings.PasswordMinLength));
            RuleFor(x => x.ConfirmPassword).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ConfirmPassword.Required"));
            RuleFor(x => x.ConfirmPassword).Equal(x => x.Password).WithMessage(localizationService.GetResource("Account.Fields.Password.EnteredPasswordsDoNotMatch"));

            //form fields
            if (customerSettings.CountryEnabled && customerSettings.CountryRequired)
            {
                RuleFor(x => x.CountryId)
                .NotNull()
                .WithMessage(localizationService.GetResource("Address.Fields.Country.Required"));
                RuleFor(x => x.CountryId)
                .NotEqual("")
                .WithMessage(localizationService.GetResource("Address.Fields.Country.Required"));
            }
            if (customerSettings.CountryEnabled &&
                customerSettings.StateProvinceEnabled &&
                customerSettings.StateProvinceRequired)
            {
                RuleFor(x => x.StateProvinceId).MustAsync(async(x, y, context) =>
                {
                    //does selected country has states?
                    var countryId = !String.IsNullOrEmpty(x.CountryId) ? x.CountryId : "";
                    var hasStates = (await stateProvinceService.GetStateProvincesByCountryId(countryId)).Count > 0;
                    if (hasStates)
                    {
                        //if yes, then ensure that state is selected
                        if (String.IsNullOrEmpty(y))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }).WithMessage(localizationService.GetResource("Account.Fields.StateProvince.Required"));
            }
            if (customerSettings.DateOfBirthEnabled && customerSettings.DateOfBirthRequired)
            {
                RuleFor(x => x.DateOfBirthDay).Must((x, context) =>
                {
                    var dateOfBirth = x.ParseDateOfBirth();
                    if (!dateOfBirth.HasValue)
                    {
                        return(false);
                    }

                    return(true);
                }).WithMessage(localizationService.GetResource("Account.Fields.DateOfBirth.Required"));

                //minimum age
                RuleFor(x => x.DateOfBirthDay).Must((x, context) =>
                {
                    var dateOfBirth = x.ParseDateOfBirth();
                    if (dateOfBirth.HasValue && customerSettings.DateOfBirthMinimumAge.HasValue &&
                        CommonHelper.GetDifferenceInYears(dateOfBirth.Value, DateTime.Today) <
                        customerSettings.DateOfBirthMinimumAge.Value)
                    {
                        return(false);
                    }

                    return(true);
                }).WithMessage(string.Format(localizationService.GetResource("Account.Fields.DateOfBirth.MinimumAge"), customerSettings.DateOfBirthMinimumAge));
            }
            if (customerSettings.CompanyRequired && customerSettings.CompanyEnabled)
            {
                RuleFor(x => x.Company).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Company.Required"));
            }
            if (customerSettings.StreetAddressRequired && customerSettings.StreetAddressEnabled)
            {
                RuleFor(x => x.StreetAddress).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.StreetAddress.Required"));
            }
            if (customerSettings.StreetAddress2Required && customerSettings.StreetAddress2Enabled)
            {
                RuleFor(x => x.StreetAddress2).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.StreetAddress2.Required"));
            }
            if (customerSettings.ZipPostalCodeRequired && customerSettings.ZipPostalCodeEnabled)
            {
                RuleFor(x => x.ZipPostalCode).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ZipPostalCode.Required"));
            }
            if (customerSettings.CityRequired && customerSettings.CityEnabled)
            {
                RuleFor(x => x.City).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.City.Required"));
            }
            if (customerSettings.PhoneRequired && customerSettings.PhoneEnabled)
            {
                RuleFor(x => x.Phone).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Phone.Required"));
            }
            if (customerSettings.FaxRequired && customerSettings.FaxEnabled)
            {
                RuleFor(x => x.Fax).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Fax.Required"));
            }
        }
예제 #55
0
 public AffiliateViewModelService(IWebHelper webHelper, IWorkContext workContext, ICountryService countryService, IStateProvinceService stateProvinceService,
                                  IPriceFormatter priceFormatter, IAffiliateService affiliateService,
                                  ICustomerService customerService, IOrderService orderService, ILocalizationService localizationService, IDateTimeHelper dateTimeHelper)
 {
     _webHelper            = webHelper;
     _workContext          = workContext;
     _countryService       = countryService;
     _stateProvinceService = stateProvinceService;
     _priceFormatter       = priceFormatter;
     _affiliateService     = affiliateService;
     _customerService      = customerService;
     _orderService         = orderService;
     _localizationService  = localizationService;
     _dateTimeHelper       = dateTimeHelper;
 }
 public void SetUp()
 {
     _localizationService  = GetService <ILocalizationService>();
     _stateProvinceService = GetService <IStateProvinceService>();
 }
 public VendorViewModelService(IDiscountService discountService, IVendorService vendorService, ICustomerService customerService, ILocalizationService localizationService,
                               IDateTimeHelper dateTimeHelper, ICountryService countryService, IStateProvinceService stateProvinceService, IStoreService storeService, IUrlRecordService urlRecordService,
                               IPictureService pictureService, IMediator mediator, VendorSettings vendorSettings, ILanguageService languageService,
                               SeoSettings seoSettings)
 {
     _discountService      = discountService;
     _vendorService        = vendorService;
     _customerService      = customerService;
     _localizationService  = localizationService;
     _dateTimeHelper       = dateTimeHelper;
     _countryService       = countryService;
     _stateProvinceService = stateProvinceService;
     _storeService         = storeService;
     _urlRecordService     = urlRecordService;
     _pictureService       = pictureService;
     _mediator             = mediator;
     _languageService      = languageService;
     _vendorSettings       = vendorSettings;
     _seoSettings          = seoSettings;
 }
예제 #58
0
        public static void ToAddress(this Address amazonAddress, SmartStore.Core.Domain.Common.Address address, ICountryService countryService,
                                     IStateProvinceService stateProvinceService, out bool countryAllowsShipping, out bool countryAllowsBilling)
        {
            countryAllowsShipping = countryAllowsBilling = true;

            if (amazonAddress.IsSetName())
            {
                address.ToFirstAndLastName(amazonAddress.Name);
            }

            if (amazonAddress.IsSetAddressLine1())
            {
                address.Address1 = amazonAddress.AddressLine1.TrimSafe().Truncate(4000);
            }

            if (amazonAddress.IsSetAddressLine2())
            {
                address.Address2 = amazonAddress.AddressLine2.TrimSafe().Truncate(4000);
            }

            if (amazonAddress.IsSetAddressLine3())
            {
                address.Address2 = address.Address2.Grow(amazonAddress.AddressLine3.TrimSafe(), ", ").Truncate(4000);
            }

            // normalize
            if (address.Address1.IsNullOrEmpty() && address.Address2.HasValue())
            {
                address.Address1 = address.Address2;
                address.Address2 = null;
            }
            else if (address.Address1.HasValue() && address.Address1 == address.Address2)
            {
                address.Address2 = null;
            }

            if (amazonAddress.IsSetCity())
            {
                address.City = amazonAddress.City.TrimSafe().Truncate(4000);
            }

            if (amazonAddress.IsSetPostalCode())
            {
                address.ZipPostalCode = amazonAddress.PostalCode.TrimSafe().Truncate(4000);
            }

            if (amazonAddress.IsSetPhone())
            {
                address.PhoneNumber = amazonAddress.Phone.TrimSafe().Truncate(4000);
            }

            if (amazonAddress.IsSetCountryCode())
            {
                var country = countryService.GetCountryByTwoOrThreeLetterIsoCode(amazonAddress.CountryCode);

                if (country != null)
                {
                    address.CountryId     = country.Id;
                    countryAllowsShipping = country.AllowsShipping;
                    countryAllowsBilling  = country.AllowsBilling;
                }
            }

            if (amazonAddress.IsSetStateOrRegion())
            {
                var stateProvince = stateProvinceService.GetStateProvinceByAbbreviation(amazonAddress.StateOrRegion);

                if (stateProvince != null)
                {
                    address.StateProvinceId = stateProvince.Id;
                }
            }

            //amazonAddress.District, amazonAddress.County ??

            if (address.CountryId == 0)
            {
                address.CountryId = null;
            }

            if (address.StateProvinceId == 0)
            {
                address.StateProvinceId = null;
            }
        }
예제 #59
0
        public RegisterValidator(ILocalizationService localizationService,
                                 IStateProvinceService stateProvinceService,
                                 CustomerSettings customerSettings)
        {
            RuleFor(x => x.Email).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Email.Required"));
            RuleFor(x => x.Email).EmailAddress().WithMessage(localizationService.GetResource("Common.WrongEmail"));

            if (customerSettings.EnteringEmailTwice)
            {
                RuleFor(x => x.ConfirmEmail).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ConfirmEmail.Required"));
                RuleFor(x => x.ConfirmEmail).EmailAddress().WithMessage(localizationService.GetResource("Common.WrongEmail"));
                RuleFor(x => x.ConfirmEmail).Equal(x => x.Email).WithMessage(localizationService.GetResource("Account.Fields.Email.EnteredEmailsDoNotMatch"));
            }

            if (customerSettings.UsernamesEnabled)
            {
                RuleFor(x => x.Username).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Username.Required"));
            }

            RuleFor(x => x.FirstName).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.FirstName.Required"));
            RuleFor(x => x.LastName).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.LastName.Required"));


            RuleFor(x => x.Password).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Password.Required"));
            RuleFor(x => x.Password).Length(customerSettings.PasswordMinLength, 999).WithMessage(string.Format(localizationService.GetResource("Account.Fields.Password.LengthValidation"), customerSettings.PasswordMinLength));
            RuleFor(x => x.ConfirmPassword).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ConfirmPassword.Required"));
            RuleFor(x => x.ConfirmPassword).Equal(x => x.Password).WithMessage(localizationService.GetResource("Account.Fields.Password.EnteredPasswordsDoNotMatch"));

            //form fields
            if (customerSettings.CountryEnabled && customerSettings.CountryRequired)
            {
                RuleFor(x => x.CountryId)
                .NotEqual(0)
                .WithMessage(localizationService.GetResource("Account.Fields.Country.Required"));
            }
            if (customerSettings.CountryEnabled &&
                customerSettings.StateProvinceEnabled &&
                customerSettings.StateProvinceRequired)
            {
                Custom(x =>
                {
                    //does selected country have states?
                    var hasStates = stateProvinceService.GetStateProvincesByCountryId(x.CountryId).Any();
                    if (hasStates)
                    {
                        //if yes, then ensure that a state is selected
                        if (x.StateProvinceId == 0)
                        {
                            return(new ValidationFailure("StateProvinceId", localizationService.GetResource("Account.Fields.StateProvince.Required")));
                        }
                    }
                    return(null);
                });
            }
            if (customerSettings.DateOfBirthEnabled && customerSettings.DateOfBirthRequired)
            {
                Custom(x =>
                {
                    var dateOfBirth = x.ParseDateOfBirth();
                    //entered?
                    if (!dateOfBirth.HasValue)
                    {
                        return(new ValidationFailure("DateOfBirthDay", localizationService.GetResource("Account.Fields.DateOfBirth.Required")));
                    }
                    //minimum age
                    if (customerSettings.DateOfBirthMinimumAge.HasValue &&
                        CommonHelper.GetDifferenceInYears(dateOfBirth.Value, DateTime.Today) < customerSettings.DateOfBirthMinimumAge.Value)
                    {
                        return(new ValidationFailure("DateOfBirthDay", string.Format(localizationService.GetResource("Account.Fields.DateOfBirth.MinimumAge"), customerSettings.DateOfBirthMinimumAge.Value)));
                    }
                    return(null);
                });
            }
            if (customerSettings.CompanyRequired && customerSettings.CompanyEnabled)
            {
                RuleFor(x => x.Company).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Company.Required"));
            }
            if (customerSettings.StreetAddressRequired && customerSettings.StreetAddressEnabled)
            {
                RuleFor(x => x.StreetAddress).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.StreetAddress.Required"));
            }
            if (customerSettings.StreetAddress2Required && customerSettings.StreetAddress2Enabled)
            {
                RuleFor(x => x.StreetAddress2).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.StreetAddress2.Required"));
            }
            if (customerSettings.ZipPostalCodeRequired && customerSettings.ZipPostalCodeEnabled)
            {
                RuleFor(x => x.ZipPostalCode).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ZipPostalCode.Required"));
            }
            if (customerSettings.CityRequired && customerSettings.CityEnabled)
            {
                RuleFor(x => x.City).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.City.Required"));
            }
            if (customerSettings.PhoneRequired && customerSettings.PhoneEnabled)
            {
                RuleFor(x => x.Phone).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Phone.Required"));
            }
            if (customerSettings.FaxRequired && customerSettings.FaxEnabled)
            {
                RuleFor(x => x.Fax).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.Fax.Required"));
            }
        }
예제 #60
0
        public static string ToFormatedAddress(this Address amazonAddress, ICountryService countryService, IStateProvinceService stateProvinceService)
        {
            var sb = new StringBuilder();

            try
            {
                var city = (amazonAddress.IsSetCity() ? amazonAddress.City : null);
                var zip  = (amazonAddress.IsSetPostalCode() ? amazonAddress.PostalCode : null);

                sb.AppendLine("");

                if (amazonAddress.Name.HasValue())
                {
                    sb.AppendLine(amazonAddress.Name);
                }

                if (amazonAddress.AddressLine1.HasValue())
                {
                    sb.AppendLine(amazonAddress.AddressLine1);
                }

                if (amazonAddress.AddressLine2.HasValue())
                {
                    sb.AppendLine(amazonAddress.AddressLine2);
                }

                if (amazonAddress.AddressLine3.HasValue())
                {
                    sb.AppendLine(amazonAddress.AddressLine3);
                }

                sb.AppendLine(zip.Grow(city, " "));

                if (amazonAddress.IsSetStateOrRegion())
                {
                    var stateProvince = stateProvinceService.GetStateProvinceByAbbreviation(amazonAddress.StateOrRegion);

                    if (stateProvince == null)
                    {
                        sb.AppendLine(amazonAddress.StateOrRegion);
                    }
                    else
                    {
                        sb.AppendLine("{0} {1}".FormatWith(amazonAddress.StateOrRegion, stateProvince.GetLocalized(x => x.Name)));
                    }
                }

                if (amazonAddress.IsSetCountryCode())
                {
                    var country = countryService.GetCountryByTwoOrThreeLetterIsoCode(amazonAddress.CountryCode);

                    if (country == null)
                    {
                        sb.AppendLine(amazonAddress.CountryCode);
                    }
                    else
                    {
                        sb.AppendLine("{0} {1}".FormatWith(amazonAddress.CountryCode, country.GetLocalized(x => x.Name)));
                    }
                }

                if (amazonAddress.Phone.HasValue())
                {
                    sb.AppendLine(amazonAddress.Phone);
                }
            }
            catch (Exception exc)
            {
                exc.Dump();
            }

            return(sb.ToString());
        }