Пример #1
0
        public async Task <IClientAccount> RegisterClientAsync(string email, string firstName, string lastName,
                                                               string phone, string password, string hint, string clientInfo, string ip, string changer, string language)
        {
            IClientAccount clientAccount = ClientAccount.Create(email, phone);

            clientAccount = await _clientAccountsRepository.RegisterAsync(clientAccount, password);

            var personalData = FullPersonalData.Create(clientAccount, firstName, lastName, hint);
            await _personalDataRepository.SaveAsync(personalData);

            await SetDefaultAssetGroups(clientAccount.Id);

            var fullname = personalData.GetFullName();

            var logEvent = RegistrationLogEvent.Create(clientAccount.Id, email, fullname, phone, clientInfo, ip);
            await _registrationLogs.RegisterEventAsync(logEvent);

            await _auditLogRepository.AddAuditRecordAsync(clientAccount.Id, null, personalData,
                                                          AuditRecordType.PersonalData, changer);

            await _srvEmailsFacade.SendWelcomeEmail(clientAccount.Email, clientAccount.Id);

            foreach (var registrationConsumer in _registrationConsumers)
            {
                registrationConsumer.ConsumeRegistration(clientAccount, ip, language);
            }

            return(clientAccount);
        }
Пример #2
0
        public async Task <IClientAccount> RegisterClientAsync(string email, string fullname, string phone, string password,
                                                               string hint, string clientInfo, string ip, string changer, double?iosVersion = null)
        {
            IClientAccount clientAccount = ClientAccount.Create(email, phone);

            clientAccount = await _clientAccountsRepository.RegisterAsync(clientAccount, password);

            await _clientSettingsRepository.SetSettings(clientAccount.Id, new HashedPwdSettings { IsPwdHashed = true });

            var personalData = FullPersonalData.Create(clientAccount, fullname, hint);
            await _personalDataRepository.SaveAsync(personalData);

            await SetDefaultAssetGroups(clientAccount.Id, iosVersion);

            var logEvent = RegistrationLogEvent.Create(clientAccount.Id, email, fullname, phone, clientInfo, ip);
            await _registrationLogs.RegisterEventAsync(logEvent);

            await _auditLogRepository.AddAuditRecordAsync(clientAccount.Id, null, personalData,
                                                          AuditRecordType.PersonalData, changer);

            await _srvEmailsFacade.SendWelcomeEmail(clientAccount.Email, clientAccount.Id);

            await
            _backgroundWorkRequestProducer.ProduceRequest(WorkType.SetGeolocation,
                                                          new SetGeolocationContext(clientAccount.Id, ip));

            await
            _backgroundWorkRequestProducer.ProduceRequest(WorkType.SetReferralCode,
                                                          new SetReferralCodeContext(clientAccount.Id, ip));

            await
            _backgroundWorkRequestProducer.ProduceRequest(WorkType.SetAntiFraudRecord,
                                                          new SetAntiFraudContext(clientAccount.Id, ip, email, fullname, phone));

            return(clientAccount);
        }