Exemplo n.º 1
0
        public async Task <EmployerAccountOutput> CreateAccountAsync(EmployerAccountInput input)
        {
            var createResult = await _lazyAccountRepository.Value.CreateAccount(
                new CreateAccountParams {
                UserId                      = input.UserId(),
                EmployerNumber              = input.OrganisationReferenceNumber,
                EmployerName                = input.OrganisationName,
                EmployerRegisteredAddress   = input.OrganisationRegisteredAddress,
                EmployerDateOfIncorporation = input.OrganisationDateOfInception,
                EmployerRef                 = input.PayeReference,
                AccessToken                 = input.AccessToken,
                RefreshToken                = input.RefreshToken,
                CompanyStatus               = input.OrganisationStatus,
                EmployerRefName             = input.EmployerRefName,
                Source                      = input.Source,
                PublicSectorDataSource      = input.PublicSectorDataSource,
                Sector                      = input.Sector,
                Aorn          = input.Aorn,
                AgreementType = input.AgreementType
            });

            var output = new EmployerAccountOutput
            {
                AccountId             = createResult.AccountId,
                HashedAccountId       = _hashingService.HashValue(createResult.AccountId),
                PublicHashedAccountId = _publicHashingService.HashValue(createResult.AccountId),
                LegalEntityId         = createResult.LegalEntityId
            };

            await _lazyAccountRepository.Value.UpdateAccountHashedIds(output.AccountId, output.HashedAccountId, output.PublicHashedAccountId);

            return(output);
        }
Exemplo n.º 2
0
        public async Task <EmployerAccountOutput> CreateAccountAsync(EmployerAccountInput input)
        {
            var createResult = await DependentRepositories.AccountRepository.CreateAccount(
                input.UserId(),
                input.OrganisationReferenceNumber,
                input.OrganisationName,
                input.OrganisationRegisteredAddress,
                input.OrganisationDateOfInception,
                input.PayeReference,
                input.AccessToken,
                input.RefreshToken,
                input.OrganisationStatus,
                input.EmployerRefName,
                input.Source,
                input.PublicSectorDataSource,
                input.Sector);

            var output = new EmployerAccountOutput
            {
                AccountId             = createResult.AccountId,
                HashedAccountId       = _hashingService.HashValue(createResult.AccountId),
                PublicHashedAccountId = _publicHashingService.HashValue(createResult.AccountId),
                LegalEntityId         = createResult.LegalEntityId
            };

            await DependentRepositories.AccountRepository.UpdateAccountHashedIds(output.AccountId, output.HashedAccountId, output.PublicHashedAccountId);

            return(output);
        }