public async Task <FirstTitleCredential> FindCredential(WCAUser authenticatedUser)
        {
            try
            {
                var secret = await keyVaultClient.GetSecretAsync(
                    settings.CredentialAzureKeyVaultUrl,
                    $"{credentialNamePrefix}{authenticatedUser.Id}");

                return(new FirstTitleCredential()
                {
                    Username = secret.Tags[usernameKeyName],
                    Password = secret.Value
                });
            }
            catch (KeyVaultErrorException ex)
            {
                // Not found means the credentials don't exist.
                // Forbidden could either mean that the secret is disabled,
                // or that there is a problem with authorization to the key vault.
                if (ex.Response?.StatusCode == HttpStatusCode.NotFound ||
                    ex.Response?.StatusCode == HttpStatusCode.Forbidden)
                {
                    return(null);
                }

                throw;
            }
        }
Beispiel #2
0
        public async Task CanDisconnectFromActionstepOrg()
        {
            var fakeClock = FakeClock.FromUtc(2019, 10, 10);
            var now       = fakeClock.GetCurrentInstant();

            var testTokenSetRepository = new TestTokenSetRepository();

            // Add test token
            var testUser = new WCAUser()
            {
                Id = "0"
            };
            const string orgKey = "testOrgKey";

            await testTokenSetRepository.AddOrUpdateTokenSet(new TokenSet("token0", "bearer0", 3600, new Uri("https://test-endpoint/api/"), orgKey, "testRefreshToken", now, testUser.Id));

            // Make sure the test item was added so we can be sure it was removed and not missing to begin with
            Assert.Single(testTokenSetRepository.TokenSets);

            IRequestHandler <DisconnectFromActionstepOrg.DisconnectFromActionstepOrgCommand> handlerUnderTest = new DisconnectFromActionstepOrg.Handler(new DisconnectFromActionstepOrg.ValidatorCollection(), testTokenSetRepository);

            await handlerUnderTest.Handle(new DisconnectFromActionstepOrg.DisconnectFromActionstepOrgCommand()
            {
                AuthenticatedUser = testUser, ActionstepOrgKey = orgKey
            }, new CancellationToken());

            Assert.Empty(testTokenSetRepository.TokenSets);
        }
        public async Task <RedirectResult> ConnectToActionstepCallback(string code, string returnUrl = null)
        {
            // We must use the API ClientId and Secret as these credentials will
            // be used to call the Actionstep API.
            var(successResult, receivedAt, tokenResponseJObject) = await ExchangeCodeAsync(
                $"{_actionstepService.TokenUri}",
                code,
                CreateActionstepCallbackUrl(returnUrl),
                _actionstepSettings.ApiClientId,
                _actionstepSettings.ApiClientSecret);

            if (!successResult)
            {
                // TODO
                throw new NotImplementedException("Not sure how to handle invalid response from OAuth2 token endpoint");
            }

            var tokenSet = new TokenSet(tokenResponseJObject, receivedAt);

            if (tokenSet.IdToken == null)
            {
                throw new Exception("Unreadable API ID token response received from Actionstep.");
            }
            IdentityResult identityResult;

            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                var claims = tokenSet.IdToken.Claims;
                var email  = claims.SingleOrDefault(c => c.Type == "email").Value;
                user = await _userManager.FindByEmailAsync(email);

                if (user == null)
                {
                    user = new WCAUser
                    {
                        UserName  = email,
                        Email     = email,
                        FirstName = claims.SingleOrDefault(c => c.Type == "given_name").Value,
                        LastName  = claims.SingleOrDefault(c => c.Type == "family_name").Value,
                    };

                    identityResult = await _userManager.CreateAsync(user);
                }

                await _signInManager.SignInAsync(user, false);
            }

            tokenSet.UserId = user.Id;

            await _mediator.Send(new AddOrUpdateActionstepCredentialCommand(tokenSet, user));

            return(new RedirectResult(
                       string.IsNullOrEmpty(returnUrl)
                ? "/wca/integrations"
                : returnUrl));
        }
Beispiel #4
0
        public void NoErrorsIfNoNameAvailable()
        {
            var claimsPrincipal = new ClaimsPrincipal();
            var user            = new WCAUser();

            WCASignInManager.SetFirstAndLastNameIfMissing(user, claimsPrincipal, NullLogger.Instance);
            Assert.Null(user.FirstName);
            Assert.Null(user.LastName);
        }
Beispiel #5
0
 public StampDutyCalculatorInfoQuery(
     string orgKey,
     int matterId,
     WCAUser authenticatedUser)
 {
     OrgKey            = orgKey;
     MatterId          = matterId;
     AuthenticatedUser = authenticatedUser;
 }
 public RunIntegrationTestsCommand(
     string orgKey,
     int matterId,
     WCAUser authenticatedUser)
 {
     OrgKey            = orgKey;
     MatterId          = matterId;
     AuthenticatedUser = authenticatedUser;
 }
 public ActionstepMatterInfoQuery(
     string orgKey,
     int matterId,
     WCAUser authenticatedUser)
 {
     OrgKey            = orgKey;
     MatterId          = matterId;
     AuthenticatedUser = authenticatedUser;
 }
        public async Task <TResponse> Handle <TResponse>(PEXARequestBase request, WCAUser user, CancellationToken cancellationToken)
            where TResponse : class
        {
            var pexaApiToken = await _mediator.Send(new PexaApiTokenQuery()
            {
                AuthenticatedUser = user
            });

            if (pexaApiToken != null)
            {
                _telemetryLogger.TrackTrace("Retrieved PEXA API token from credentials store", WCASeverityLevel.Verbose,
                                            new Dictionary <string, string> {
                    { "accessToken", pexaApiToken.AccessToken },
                    { "accessTokenExpiryUtc", pexaApiToken.AccessTokenExpiryUtc.ToString() },
                });
            }

            if (pexaApiTokenIsValid(pexaApiToken))
            {
                try
                {
                    request.BearerToken = pexaApiToken.AccessToken;
                    return(await Handle <TResponse>(request, cancellationToken));
                }
                catch (PEXAException ex)
                {
                    if (pexaApiToken.IsFromCache && (ex.StatusCode == StatusCodes.Status401Unauthorized || ex.StatusCode == StatusCodes.Status403Forbidden))
                    {
                        var pexaTokenFromVault = await _mediator.Send(new PexaApiTokenQuery()
                        {
                            AuthenticatedUser = user, BypassAndUpdateCache = true
                        });

                        if (pexaTokenFromVault.AccessToken != pexaApiToken.AccessToken && pexaApiTokenIsValid(pexaTokenFromVault))
                        {
                            // Access token from vault is different to the cached version, so try with that token before failing
                            request.BearerToken = pexaTokenFromVault.AccessToken;

                            return(await Handle <TResponse>(request, cancellationToken));
                        }

                        throw new MissingOrInvalidPexaApiTokenException(user);
                    }
                    else if (ex.StatusCode == StatusCodes.Status400BadRequest)
                    {
                        throw new PexaBadRequestResponseException("Encountered an error during PEXA request", ex);
                    }
                    else
                    {
                        throw new PexaUnexpectedErrorResponseException("Encountered unexpected error during PEXA request", ex);
                    }
                }
            }

            throw new MissingOrInvalidPexaApiTokenException(user);
        }
 public InvalidActionstepRefreshTokenException(
     string actionstepOrgKey,
     WCAUser user,
     string error,
     string errorDescription,
     string errorUri)
 {
     ActionstepOrgKey = actionstepOrgKey;
     User             = user;
     Error            = error;
     ErrorDescription = errorDescription;
     ErrorUri         = errorUri;
 }
Beispiel #10
0
        public void NameIsSetWithSingleWord()
        {
            const string firstName = "Name";
            var          identity  = new ClaimsIdentity();

            identity.AddClaim(new Claim(ActionstepJwtClaimTypes.Name, firstName));
            var claimsPrincipal = new ClaimsPrincipal(identity);
            var user            = new WCAUser();

            WCASignInManager.SetFirstAndLastNameIfMissing(user, claimsPrincipal, NullLogger.Instance);
            Assert.Equal(firstName, user.FirstName);
            Assert.Null(user.LastName);
        }
Beispiel #11
0
        public void NameIsSetWithTwoThreeWords()
        {
            const string firstName  = "Firstname";
            const string middleName = "Middlename";
            const string lastName   = "Lastname";
            var          identity   = new ClaimsIdentity();

            identity.AddClaim(new Claim(ActionstepJwtClaimTypes.Name, $"{firstName} {middleName} {lastName}"));
            var claimsPrincipal = new ClaimsPrincipal(identity);
            var user            = new WCAUser();

            WCASignInManager.SetFirstAndLastNameIfMissing(user, claimsPrincipal, NullLogger.Instance);
            Assert.Equal(firstName, user.FirstName);
            Assert.Equal(lastName, user.LastName);
        }
        public static async Task <WCAUser> GetTestUser2(this WebContainerFixture containerFixture)
        {
            if (containerFixture is null)
            {
                throw new ArgumentNullException(nameof(containerFixture));
            }

            WCAUser testUser2 = default(WCAUser);

            await containerFixture.ExecuteScopeAsync(async sp =>
            {
                var userManager = sp.GetService <UserManager <WCAUser> >();
                testUser2       = await userManager.FindByEmailAsync(Test2UserEmail);
            });

            return(testUser2);
        }
        public static async Task SeedTestUsers(this WCADbContext wCADbContext, IServiceProvider serviceProvider)
        {
            var userManager = serviceProvider.GetService <UserManager <WCAUser> >();

            var newTestUser = new WCAUser()
            {
                Email     = TestUserEmail,
                UserName  = TestUserEmail,
                FirstName = TestFirstName,
                LastName  = TestLastName
            };

            await userManager.CreateAsync(newTestUser);

            var newTest2User = new WCAUser()
            {
                Email     = Test2UserEmail,
                UserName  = Test2UserEmail,
                FirstName = Test2FirstName,
                LastName  = Test2LastName
            };

            await userManager.CreateAsync(newTest2User);
        }
Beispiel #14
0
#pragma warning disable CA1054 // Uri parameters should not be strings
        public async Task <IActionResult> OnGetCallbackAsync(string returnUrl = null, string remoteError = null)
#pragma warning restore CA1054 // Uri parameters should not be strings
        {
            if (remoteError != null)
            {
                ErrorMessage = $"Error from external provider: {remoteError}";
                return(RedirectToPage("./Login", new { ReturnUrl = returnUrl }));
            }

            var info = await _signInManager.GetExternalLoginInfoAsync();

            if (info == null)
            {
                ErrorMessage = $"Error loading external login information";
                return(RedirectToPage("./Login", new { ReturnUrl = returnUrl }));
            }

            // Sign in the user with this external login provider if the user already has a login.
            var result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent : false);

            if (result.Succeeded)
            {
                _logger.LogInformation(5, "User logged in with {Name} provider.", info.LoginProvider);
                return(Redirect(returnUrl));
            }

            if (result.IsLockedOut)
            {
                ErrorMessage = $"This account has been locked out. Please try again later.";
                return(RedirectToPage("./Login", new { ReturnUrl = returnUrl }));
            }
            else
            {
                // If the user does not have an account, then ask the user to create an account.
                var firstName = info.Principal.FindFirstValue(ClaimTypes.GivenName);
                var lastName  = info.Principal.FindFirstValue(ClaimTypes.Surname);
                var email     = info.Principal.FindFirstValue(ClaimTypes.Email);

                //see if this is a known user
                var user = await _userManager.FindByEmailAsync(email);

                if (user == null)
                {
                    // If the user does not have an account we'll create one now.
                    user = new WCAUser {
                        UserName = email, Email = email
                    };

                    var createUserResult = await _userManager.CreateAsync(user);

                    if (!createUserResult.Succeeded)
                    {
                        ErrorMessage = $"It looks like this is the first time you're logging in to " + AppName + ". " +
                                       $"We're sorry, something went wrong registering you with the " + AppName + " system. " +
                                       $"Please try again, or contact " + AppName + " support if you continue to have issues.";
                        return(RedirectToPage("./Login", new { ReturnUrl = returnUrl }));
                    }
                }

                // Register the external login for this user
                user.FirstName = firstName;
                user.LastName  = lastName;
                var addNewLoginResult = await _userManager.AddLoginAsync(user, info);

                if (addNewLoginResult.Succeeded)
                {
                    var saveResult = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent : false);

                    if (saveResult.Succeeded)
                    {
                        // Now sign in the user
                        await _signInManager.SignInAsync(user, isPersistent : false);
                    }
                    else
                    {
                        ErrorMessage = $"It looks like this is the first time you're logging in to " + AppName + ". " +
                                       $"We're sorry, something went wrong registering you with the " + AppName + " system. " +
                                       $"Please try again, or contact " + AppName + " support if you continue to have issues.";
                        return(RedirectToPage("./Login", new { ReturnUrl = returnUrl }));
                    }
                }

                return(Redirect(returnUrl));
            }
        }
Beispiel #15
0
 public InvalidCredentialsForInfoTrackException(string actionstepOrgKey, WCAUser user)
 {
     ActionstepOrgKey = actionstepOrgKey;
     User             = user;
 }
 public AddOrUpdateActionstepCredentialCommand(TokenSet tokenSet, WCAUser authenticatedUser)
 {
     TokenSet          = tokenSet;
     AuthenticatedUser = authenticatedUser;
 }
Beispiel #17
0
 public MissingFirstTitleCredentialsException(WCAUser wCAUser)
 {
     User = wCAUser;
 }
 public InfoTrackCredentialsNotFoundException(string actionstepOrgKey, WCAUser user)
 {
     ActionstepOrgKey = actionstepOrgKey;
     User             = user;
 }
 public static bool UserHasValidCredentialsForOrg(this IQueryable <ActionstepCredential> actionstepCredentials, WCAUser wCAUser, string orgKey)
 {
     return(actionstepCredentials.Any(c =>
                                      c.Owner == wCAUser &&
                                      c.ActionstepOrg.Key == orgKey &&
                                      c.RefreshTokenExpiryUtc > DateTime.UtcNow));
 }
Beispiel #20
0
 public MissingOrInvalidPexaApiTokenException(WCAUser wCAUser)
 {
     User = wCAUser;
 }
        public async void DetailsMappedCorrectly()
        {
            // Arrange
            WCAUser testUser = await _containerFixture.GetTestUser();

            var query = new GetMappingDataFromActionstep.GetMappingDataFromActionstepQuery()
            {
                ActionstepOrgKey  = "wcamaster",
                AuthenticatedUser = testUser,
                MatterId          = 7
            };

            var testActionstepService = new TestActionstepService();

            testActionstepService.AddSampleResponse(
                $"/rest/actionparticipants?action={query.MatterId}&include=participantType,participant",
                HttpStatusCode.OK,
                HttpMethod.Get,
                "InfoTrack.GetMappingDataFromActionstepData.Response-1-ActionParticipants.json");

            testActionstepService.AddSampleResponse(
                "/rest/datacollectionrecordvalues" +
                $"?action={query.MatterId}" +
                $"&dataCollectionRecord[dataCollection][name_in]=property,convdet,keydates" +
                $"&dataCollectionField[name_in]=titleref,lotno,planno,plantype,lotno2,planno2,plantype2,smtdateonly,smttime,purprice" +
                $"&include=dataCollectionField,dataCollection",
                HttpStatusCode.OK,
                HttpMethod.Get,
                "InfoTrack.GetMappingDataFromActionstepData.Response-2-PropertyInfo.json");

            SendMappingsToInfoTrack.SendMappingsToInfoTrackCommand resultUnderTest = null;

            await _containerFixture.ExecuteScopeAsync(async sp =>
            {
                var mediator = sp.GetService <IMediator>();
                var options  = sp.GetService <IOptions <WCACoreSettings> >();

                var handlerUnderTest = new GetMappingDataFromActionstep.Handler(
                    new GetMappingDataFromActionstep.Validator(),
                    testActionstepService,
                    options,
                    mediator,
                    new TestInfoTrackCredentialRepository("wcamaster", "dummyUsername", "dummyPassword"),
                    new TestTelemetryLogger());

                // Act
                resultUnderTest = await handlerUnderTest.Handle(query, new CancellationToken());
            });

            // Assert
            // These values must match the corresponding test data in the JSON files referenced above.
            Assert.NotNull(resultUnderTest);
            Assert.Equal(query.MatterId.ToString(CultureInfo.InvariantCulture), resultUnderTest.InfoTrackMappingData.ClientReference);
            Assert.Equal(testUser, resultUnderTest.AuthenticatedUser);
            Assert.Equal($"WCA_{query.ActionstepOrgKey}|{query.AuthenticatedUser.Id}", resultUnderTest.InfoTrackMappingData.RetailerReference);

            // We currently want this to be empty as it affects the InfoTrack entrypoint.
            // This might change in the near future.
            //Assert.Equal("QLD", resultUnderTest.InfoTrackMappingData.State);
            Assert.Null(resultUnderTest.InfoTrackMappingData.State);

            // Property information
            Assert.Equal("133", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PropertyAddress?.StreetNumber);
            Assert.Equal("MOORE RESERVE", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PropertyAddress?.StreetName);
            Assert.Equal("IPSWICH", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PropertyAddress?.Suburb);
            Assert.Equal("QLD", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PropertyAddress?.State);
            Assert.Equal("4305", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PropertyAddress?.PostCode);
            Assert.Equal("437", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PropertyAddress?.LotNumber);
            Assert.Equal("437", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.LotPlans?[0]?.Lot);
            Assert.Equal("112380", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.LotPlans?[0]?.PlanNumber);
            Assert.Equal("SP", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.LotPlans?[0]?.PlanType);
            Assert.Equal("50248019", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.LotPlans?[0]?.TitleReference);

            // Conveyancer information
            Assert.Equal("Company name", resultUnderTest.InfoTrackMappingData.LawyerDetail?.Organisation?.Name);
            Assert.Equal("*****@*****.**", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Email);
            Assert.Equal("+61 123 456789", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Phone);
            Assert.Equal("555555", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Fax);
            Assert.Equal("Ms", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Individual?.Title);
            Assert.Equal("Firstname", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Individual?.GivenName);
            Assert.Equal("Middlename", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Individual?.GivenName2);
            Assert.Equal("Lastname", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Individual?.Surname);
            Assert.Equal("F", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Individual?.Gender);
            Assert.Equal("05/09/2010", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Individual?.DateOfBirth);
            Assert.Equal("123", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Address?.StreetNumber);
            Assert.Equal("Street name, addr2", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Address?.StreetName);
            Assert.Null(resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Address?.StreetType);
            Assert.Equal("city", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Address?.Suburb);
            Assert.Equal("state", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Address?.State);
            Assert.Equal("2612", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.Address?.PostCode);
            Assert.Equal("Something Ave, aaaddr2", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.PoBoxAddress?.PoBoxType);
            Assert.Equal("999", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.PoBoxAddress?.Number);
            Assert.Equal("mailing city", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.PoBoxAddress?.Suburb);
            Assert.Equal("mailing state", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.PoBoxAddress?.State);
            Assert.Equal("4444", resultUnderTest.InfoTrackMappingData.LawyerDetail?.ContactDetails?[0]?.PoBoxAddress?.PostCode);

            // Buyer
            Assert.Equal("Buyer-CompanyName", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Organisation?.Name);
            Assert.Equal("BuyerTaxNumber", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Organisation?.AcnOrAbn);
            Assert.Equal("BuyerTaxNumber", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Organisation?.Abn);
            Assert.Equal("*****@*****.**", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Email);
            Assert.Equal("+62 131 131313", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Phone);
            Assert.Equal("137412", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Fax);
            Assert.Equal("Buyer-Mrs", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Individual?.Title);
            Assert.Equal("Buyer-First", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Individual?.GivenName);
            Assert.Equal("Buyer-Middle", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Individual?.GivenName2);
            Assert.Equal("Buyer-Last", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Individual?.Surname);
            Assert.Equal("BuyerGender", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Individual?.Gender);
            Assert.Equal("13/01/2009", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Individual?.DateOfBirth);
            Assert.Equal("13", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Address?.StreetNumber);
            Assert.Equal("PhysBuyer Street, PhysBuyer addr line 2", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Address?.StreetName);
            Assert.Null(resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Address?.StreetType);
            Assert.Equal("PhysBuyer City", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Address?.Suburb);
            Assert.Equal("PhysBuyer State", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Address?.State);
            Assert.Equal("1313", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Purchasers?[0]?.Address?.PostCode);

            // Seller
            Assert.Equal("Seller-CompanyName", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Organisation?.Name);
            Assert.Equal("SellerTaxNumber", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Organisation?.AcnOrAbn);
            Assert.Equal("SellerTaxNumber", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Organisation?.Abn);
            Assert.Equal("*****@*****.**", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Email);
            Assert.Equal("+63 133 131314", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Phone);
            Assert.Equal("137413", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Fax);
            Assert.Equal("Seller-Mrs", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Individual?.Title);
            Assert.Equal("Seller-First", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Individual?.GivenName);
            Assert.Equal("Seller-Middle", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Individual?.GivenName2);
            Assert.Equal("Seller-Last", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Individual?.Surname);
            Assert.Equal("SellerGender", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Individual?.Gender);
            Assert.Equal("14/01/2009", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Individual?.DateOfBirth);
            Assert.Equal("14", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Address?.StreetNumber);
            Assert.Equal("PhysSeller Street, PhysSeller addr line 2", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Address?.StreetName);
            Assert.Null(resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Address?.StreetType);
            Assert.Equal("PhysSeller City", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Address?.Suburb);
            Assert.Equal("PhysSeller State", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Address?.State);
            Assert.Equal("1314", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.Vendors?[0]?.Address?.PostCode);

            // Settlement data
            Assert.Equal("1200000", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.PurchasePrice);
            Assert.Equal("27/02/2018", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.SettlementDate);
            Assert.Equal("1:00 pm", resultUnderTest.InfoTrackMappingData.PropertyDetails?[0]?.SettlementTime);
        }
Beispiel #22
0
 public RefreshActionstepCredentialsCommand(WCAUser authenticatedUser, int actionstepCredentialIdToRefresh, bool forceRefreshIfNotExpired = false)
 {
     AuthenticatedUser = authenticatedUser;
     ActionstepCredentialIdToRefresh = actionstepCredentialIdToRefresh;
     ForceRefreshIfNotExpired        = forceRefreshIfNotExpired;
 }
 public static IQueryable <ActionstepCredential> ForOwnerAndOrg(this IQueryable <ActionstepCredential> actionstepCredentials, WCAUser wCAUser, string orgKey)
 {
     return(actionstepCredentials.Where(c => c.Owner == wCAUser && c.ActionstepOrg.Key == orgKey));
 }