コード例 #1
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);
        }
コード例 #2
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);
        }
        public async Task Setup()
        {
            await InitialiseEmployerAccountData(async builder =>
            {
                var data = new TestModelBuilder()
                           .WithNewUser()
                           .WithNewAccount();

                await builder.SetupDataAsync(data);

                _employerAccount = data.CurrentAccount.AccountOutput;
            });

            WhenControllerActionIsCalled($"https://localhost:44330/api/accounts/{_employerAccount.HashedAccountId}/legalentities");
        }
        public async Task Setup()
        {
            _tester = new ApiIntegrationTester(TestSetupIoC.CreateIoC);

            // Arrange
            await _tester.InitialiseData <EmployerAccountsDbBuilder>(async builder =>
            {
                var data = new TestModelBuilder()
                           .WithNewUser()
                           .WithNewAccount();

                await builder.SetupDataAsync(data);

                _employerAccount = data.CurrentAccount.AccountOutput;
            });
        }