Beispiel #1
0
 public SMSNotificationController(IWorkContext workContext,
                                  ISMSNotificationService smsNotificationService,
                                  SMSNotificationSettings smsNotificationSettings,
                                  ILocalizationService localizationService)
 {
     this._workContext             = workContext;
     this._smsNotificationService  = smsNotificationService;
     this._smsNotificationSettings = smsNotificationSettings;
     this._localizationService     = localizationService;
 }
Beispiel #2
0
        private readonly ISMSNotificationService _smsNotificationService; //BUGFIX 3.802

        #endregion

        #region Ctor

        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="customerService">Customer service</param>
        /// <param name="encryptionService">Encryption service</param>
        /// <param name="newsLetterSubscriptionService">Newsletter subscription service</param>
        /// <param name="localizationService">Localization service</param>
        /// <param name="storeService">Store service</param>
        /// <param name="rewardPointService">Reward points service</param>
        /// <param name="rewardPointsSettings">Reward points settings</param>
        /// <param name="customerSettings">Customer settings</param>
        public CustomerRegistrationService(ICustomerService customerService,
                                           IEncryptionService encryptionService,
                                           INewsLetterSubscriptionService newsLetterSubscriptionService,
                                           ILocalizationService localizationService,
                                           IStoreService storeService,
                                           IRewardPointService rewardPointService,
                                           RewardPointsSettings rewardPointsSettings,
                                           CustomerSettings customerSettings,
                                           ISMSNotificationService smsNotificationService) //BUGFIX 3.802
        {
            this._customerService               = customerService;
            this._encryptionService             = encryptionService;
            this._newsLetterSubscriptionService = newsLetterSubscriptionService;
            this._localizationService           = localizationService;
            this._storeService           = storeService;
            this._rewardPointService     = rewardPointService;
            this._rewardPointsSettings   = rewardPointsSettings;
            this._customerSettings       = customerSettings;
            this._smsNotificationService = smsNotificationService; //BUGFIX 3.802
        }
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings();
            _securitySettings = new SecuritySettings
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _storeService = MockRepository.GenerateMock <IStoreService>();

            _customerRepo.Expect(x => x.Table).Return(new List <Customer> {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerRoleRepo     = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _orderRepo            = MockRepository.GenerateMock <IRepository <Order> >();
            _forumPostRepo        = MockRepository.GenerateMock <IRepository <ForumPost> >();
            _forumTopicRepo       = MockRepository.GenerateMock <IRepository <ForumTopic> >();

            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();
            _rewardPointService            = MockRepository.GenerateMock <IRewardPointService>();
            _smsNotificationService        = MockRepository.GenerateMock <ISMSNotificationService>();              //BUGFIX 3.801
            _smsNotificationRepository     = MockRepository.GenerateMock <IRepository <SMSNotificationRecord> >(); //NOP 3.827

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _customerService     = new CustomerService(new NopNullCache(), _customerRepo, _customerRoleRepo,
                                                       _genericAttributeRepo, _orderRepo, _forumPostRepo, _forumTopicRepo,
                                                       null, null, null, null, null,
                                                       _genericAttributeService, null, null, _eventPublisher, _customerSettings, null,
                                                       _smsNotificationRepository); //NOP 3.827
            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _localizationService,
                                                                           _storeService, _rewardPointService, _rewardPointsSettings, _customerSettings,
                                                                           _smsNotificationService); //BUGFIX 3.801
        }