Esempio n. 1
0
        public async Task CreateBusinessPartnerEmail_ValidUser_ContactInfoRetrieved()
        {
            // Arrange
            var user          = TestHelper.PaDev1;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.JwtEncodedString = loginResponse.Data.JwtAccessToken;
            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();
            var request = new CreateEmailRequest
            {
                AccountID    = user.BPNumber.ToString(),
                Email        = user.Email,
                StandardFlag = true
            };

            if (request.Email == user.Email)
            {
                Assert.Fail("Bypass by debugging in order to avoid posting excess rows on server");
            }

            var contactInfoResponse = McfClient.GetBusinessPartnerContactInfo(user.JwtEncodedString, user.BPNumber.ToString());

            contactInfoResponse.Result.ShouldNotBeNull();
            var emails = contactInfoResponse.Result.AccountAddressIndependentEmails.Results.ToList();

            // Act
            var response = McfClient.CreateBusinessPartnerEmail(user.JwtEncodedString, request);

            // Assert
            response.Result.ShouldNotBeNull();
            response.Result.Metadata.Id.ShouldBe("https://10.41.53.54:8001/sap/opu/odata/sap/ZERP_UTILITIES_UMC_PSE_SRV/AccountAddressIndependentEmails(" +
                                                 $"AccountID=\'{user.BPNumber}\',SequenceNo=\'{emails.Count:D3}\')");
        }
Esempio n. 2
0
        public async Task UpdateIdentifier_IdentifierJustCreated_IdentifierUpdated()
        {
            // Arrange
            var user          = TestHelper.GeorgeShazel;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);
            var bpNumber = user.BPNumber.ToString();

            var identifier = new BpIdentifier
            {
                AccountId      = bpNumber,
                IdentifierType = IdentifierType.ZPASWD.ToString(),
                IdentifierNo   = "Li0nOOjgfui"
            };

            var password = GetIdentifierData(bpNumber, IdentifierType.ZPASWD);

            if (password != null)
            {
                McfClient.DeleteIdentifier(identifier);
            }

            McfClient.CreateIdentifier(identifier);

            // Act
            var response = McfClient.UpdateIdentifier(identifier);

            // Assert
            response.ShouldNotBeNull();
            response.HttpStatusCode.ShouldBe(HttpStatusCode.Created);
        }
Esempio n. 3
0
        public async Task UpdateIdentifier_AccountWithIdentifier_IdentifierChangesSaved()
        {
            // Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);
            var bpNumber = user.BPNumber.ToString();

            var startSocial = GetLast4Social(bpNumber);

            var identifier = new BpIdentifier
            {
                AccountId      = bpNumber,
                IdentifierType = IdentifierType.ZLAST4.ToString(),
                IdentifierNo   = startSocial == "9999" ? "1111" : "9999"
            };

            // Act
            var response = McfClient.UpdateIdentifier(identifier);

            // Assert
            response.ShouldNotBeNull();
            response.HttpStatusCode.ShouldBe(HttpStatusCode.NoContent);
            GetLast4Social(bpNumber).ShouldBe(identifier.IdentifierNo);
        }
Esempio n. 4
0
        public async Task CreateIdentifier_NotAuthenticatedIdentifierDoesNotExist_IdentifierCreated()
        {
            // Arrange
            var user          = TestHelper.GeorgeShazel;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);
            var bpNumber = user.BPNumber.ToString();

            var identifier = new BpIdentifier
            {
                AccountId      = bpNumber,
                IdentifierType = IdentifierType.ZPASWD.ToString(),
                IdentifierNo   = "zi1py786lOP"
            };

            var password = GetIdentifierData(bpNumber, IdentifierType.ZPASWD);

            if (password != null)
            {
                McfClient.DeleteIdentifier(identifier);
            }

            // Next call should be unauthorized
            UserContext.JWT = null;

            // Act
            var response = McfClient.CreateIdentifier(identifier);

            // Assert
            response.ShouldNotBeNull();
            response.Result.ShouldNotBeNull();
        }
Esempio n. 5
0
        public async Task CreateIdentifier_IdentifierAlreadyExists_BadRequest()
        {
            // Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);
            var bpNumber = user.BPNumber.ToString();

            var startSocial = GetLast4Social(bpNumber);

            var identifier = new BpIdentifier
            {
                AccountId      = bpNumber,
                IdentifierType = IdentifierType.ZLAST4.ToString(),
                IdentifierNo   = startSocial
            };

            // Act
            var response = McfClient.CreateIdentifier(identifier);

            // Assert
            response.ShouldNotBeNull();
            response.Result.ShouldBeNull();
            response.Error.Message.Value.ShouldContain("Already exists");
        }
Esempio n. 6
0
        public async Task CreateIdentifier_IdentifierDoesNotExist_IdentifierCreated()
        {
            // Arrange
            var user          = TestHelper.GeorgeShazel;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);
            var bpNumber = user.BPNumber.ToString();

            var identifier = new BpIdentifier
            {
                AccountId      = bpNumber,
                IdentifierType = IdentifierType.ZPASWD.ToString(),
                IdentifierNo   = "a4rFr3dKOPe"
            };

            var password = GetIdentifierData(bpNumber, IdentifierType.ZPASWD);

            if (!string.IsNullOrEmpty(password))
            {
                McfClient.DeleteIdentifier(identifier);
            }

            // Act
            var response = McfClient.CreateIdentifier(identifier);

            // Assert
            response.ShouldNotBeNull();
            response.Result.ShouldNotBeNull();
            response.Result.AccountId.ShouldBe(identifier.AccountId);
            response.Result.IdentifierType.ShouldBe(identifier.IdentifierType);
            response.Result.IdentifierNo.ShouldBe(identifier.IdentifierNo);
        }
Esempio n. 7
0
        public async Task CreateCustomerInteractionRecord_CanCreateRecord()
        {
            // Arrange
            var user          = TestHelper.ActiveInteractionUser;
            var loginResponse = await AuthClient.GetJwtToken("donaldmcconnell", "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);

            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();
            user.BPNumber.ShouldNotBe(0);
            CreateCustomerInteractionRequest newInteraction = new CreateCustomerInteractionRequest()
            {
                AccountID                      = "1001840105",
                Description                    = "High Bill Call",
                PremiseID                      = 7000006028,
                BusinessAgreementID            = 200000053856,
                Priority                       = 5,
                InteractionRecordReasonID      = "A1-ZBIL -HIGH",
                InteractionRecordCategory1     = "",
                InteractionRecordCategory2     = "",
                InteractionRecordCategory1GUID = "",
                InteractionRecordCategory2GUID = "",
                ChannelID                      = "Z14",
                Note             = "Insert Notes for the IR",
                IncomingFlag     = true,
                DocumentStatusID = "E0003"
            };

            GetCustomerInteractionResponse response = McfClient.CreateCustomerInteractionRecord(newInteraction, user.JwtEncodedString);

            Assert.AreEqual(response.Success, "True");
            Assert.IsNotNull(response.InteractionRecordID);
        }
Esempio n. 8
0
        public async Task GetContractAccounMailingAddress_AccountWithAMailingAddress_CanGetMailingAddressData()
        {
            // Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);

            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();
            user.BPNumber.ShouldNotBe(0);

            var response = McfClient.GetContractAccounMailingAddress(user.JwtEncodedString, user.ContractAccountId);

            response.ShouldNotBeNull();
        }
Esempio n. 9
0
        public async Task GetPaymentArrangement_AccountWithArrangement_CanGetArrangementData()
        {
            // Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);

            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();
            user.BPNumber.ShouldNotBe(0);

            // Act
            var response = McfClient.GetPaymentArrangement(user.JwtEncodedString, user.ContractAccountId);

            // Assert
            response.Result.ShouldNotBeNull();
        }
Esempio n. 10
0
        public async Task GetOwnerAccounts_BpWithNoActiveProperties_AccountsRetrieved()
        {
            // Arrange
            var user = new TestUser {
                Username = "******"
            };
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);

            // Act
            var response = await McfClient.GetOwnerAccounts(user.BPNumber.ToString());

            // Assert
            response.Error.ShouldNotBeNull();
            response.Error.Message.Value.ShouldBe("No active properties exist for the BusinessPartner");
        }
Esempio n. 11
0
        public async Task GetOwnerAccounts_ValidBpId_AccountsRetrieved()
        {
            // Arrange
            var user = new TestUser {
                Username = "******"
            };
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);

            // Act
            var response = await McfClient.GetOwnerAccounts(user.BPNumber.ToString());

            // Assert
            response.ShouldNotBeNull();
            // Note: Unit tests verify parsing.  This test verifies SAP endpoint returns something
            response.Result.Results.ToList()[0].AccountId.ShouldBe("1001543028");
        }
Esempio n. 12
0
        public async Task CreateStandardAddress_ValidUser()
        {
            //Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);

            var request = new CreateAddressRequest
            {
                AccountID   = user.BPNumber,
                AddressInfo = new McfAddressinfo
                {
                    StandardFlag    = "X",
                    City            = "Bellevue",
                    PostalCode      = "98004",
                    POBoxPostalCode = "",
                    POBox           = "",
                    Street          = "110th Ave NE",
                    HouseNo         = "355",
                    CountryID       = "US",
                    Region          = "WA",
                    HouseNo2        = ""
                }
            };

            // Act
            var response = McfClient.CreateAddress(user.JwtEncodedString, request);

            var requestAddress = request.AddressInfo;

            var responsetAddress = response.Result.AddressInfo;

            //Assert
            responsetAddress.StandardFlag.ShouldBe(requestAddress.StandardFlag);
            responsetAddress.City.ShouldBe(requestAddress.City);
            responsetAddress.PostalCode.ShouldBe(requestAddress.PostalCode);
            responsetAddress.Street.ShouldBe(requestAddress.Street);
            responsetAddress.HouseNo.ShouldBe(requestAddress.HouseNo);
            responsetAddress.CountryID.ShouldBe(requestAddress.CountryID);
            responsetAddress.Region.ShouldBe(requestAddress.Region);
        }
Esempio n. 13
0
        public async Task GetStandardMailingAddress_ValidAccount_CanGetStandardAddress()
        {
            // Arrange
            var user          = TestHelper.PaDev1;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.JwtEncodedString = loginResponse.Data.JwtAccessToken;
            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();

            // Act
            var addressResponse = McfClient.GetStandardMailingAddress(user.JwtEncodedString, user.BPNumber);

            // Assert
            addressResponse.ShouldNotBeNull();
            addressResponse.Error.ShouldBeNull();
            var address = addressResponse.Result;

            address.ShouldNotBeNull();
            address.AddressID.ShouldNotBeNull();
        }
Esempio n. 14
0
        public async Task GetBusinessPartnerContactInfo_ValidUser_ContactInfoRetrieved()
        {
            // Arrange
            var user          = TestHelper.PaDev1;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.JwtEncodedString = loginResponse.Data.JwtAccessToken;
            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();

            // Act
            var response = McfClient.GetBusinessPartnerContactInfo(user.JwtEncodedString, user.BPNumber.ToString());

            // Assert
            response.Result.ShouldNotBeNull();

            var info = response.Result;

            info.BusinessPartnerId.ShouldBe(user.BPNumber);
            info.FirstName.ToUpper().ShouldBe("JENNIFER");
            info.LastName.ToUpper().ShouldBe("POWERS");
            info.FullName.ToUpper().ShouldBe("JENNIFER POWERS");

            info.AccountAddressIndependentEmails.Results.ShouldNotBeNull();
            var emails = info.AccountAddressIndependentEmails.Results.ToList();

            emails.Count.ShouldBeGreaterThanOrEqualTo(1);
            emails[0].AccountID.ShouldBe(user.BPNumber.ToString());
            emails[0].SequenceNo.ShouldBe("001");
            emails[0].Email.ShouldBe(user.Email);
            emails[0].StandardFlag.ShouldBe(false);
            emails[emails.Count - 1].StandardFlag = true;

            info.AccountAddressIndependentPhones.Results.ShouldNotBeNull();
            var phones = info.AccountAddressIndependentPhones.Results.ToList();

            phones.Count.ShouldBeGreaterThanOrEqualTo(0);
            // TBD: add a phone then update this get test
        }
Esempio n. 15
0
        public async Task CreateBusinessPartnerMobilePhone_ValidUser_ContactInfoRetrieved()
        {
            // Arrange
            var user          = TestHelper.PaDev1;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.JwtEncodedString = loginResponse.Data.JwtAccessToken;
            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();
            var phone   = user.Phones.First(p => p.Type == PhoneType.Cell);
            var request = new CreateAddressIndependantPhoneRequest
            {
                BusinessPartnerId = user.BPNumber,
                PhoneNumber       = phone.Number,
                Extension         = phone.Extension ?? "",
                IsHome            = true,
                IsStandard        = true,
                PhoneType         = AddressIndependantContactInfoEnum.AccountAddressIndependentMobilePhones
            };

            if (request.BusinessPartnerId == user.BPNumber)
            {
                Assert.Fail("Bypass by debugging in order to avoid posting excess rows on server");
            }

            var contactInfoResponse = McfClient.GetBusinessPartnerContactInfo(user.JwtEncodedString, user.BPNumber.ToString());

            contactInfoResponse.Result.ShouldNotBeNull();
            var phones = contactInfoResponse.Result.AccountAddressIndependentPhones.Results.ToList();

            // Act
            var response = McfClient.CreateBusinessPartnerMobilePhone(user.JwtEncodedString, request);

            // Assert
            response.Result.ShouldNotBeNull();
            response.Result.Metadata.Id.ShouldBe("https://10.41.53.54:8001/sap/opu/odata/sap/ZERP_UTILITIES_UMC_PSE_SRV/AccountAddressIndependentPhones(" +
                                                 $"AccountID=\'{user.BPNumber}\',SequenceNo=\'{phones.Count:D3}\')");
        }
Esempio n. 16
0
        public async Task UpdateIdentifier_AccountWithMissingIdentifier_ReturnsNoContent()
        {
            // Arrange
            var user          = TestHelper.ActiveMaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);
            var bpNumber = user.BPNumber.ToString();

            var identifier = new BpIdentifier
            {
                AccountId      = bpNumber,
                IdentifierType = IdentifierType.ZDNAC.ToString(),
                IdentifierNo   = "450930044"
            };

            // Act
            var response = McfClient.UpdateIdentifier(identifier);

            // Assert
            response.ShouldNotBeNull();
            response.HttpStatusCode.ShouldBe(HttpStatusCode.NoContent);
        }
Esempio n. 17
0
        public async Task GetAllIdentifiers_AccountWithIdentifier_AllIdentifiersReturned()
        {
            // Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);
            UserContext.SetUser(user);

            // Act
            var response = McfClient.GetAllIdentifiers(user.BPNumber.ToString());

            // Assert
            response.ShouldNotBeNull();
            var results = response.Result.Results.ToList();

            results[0].AccountId.ShouldBe(user.BPNumber.ToString());
            results[0].IdentifierType.ShouldNotBeEmpty();

            var lastFour           = results.First(x => x.IdentifierType == IdentifierType.ZLAST4.ToString());
            var expectedValueMatch = lastFour.IdentifierNo == "9999" || lastFour.IdentifierNo == "1111";

            expectedValueMatch.ShouldBeTrue();
        }
Esempio n. 18
0
        [Ignore] // Wait For MCF Fix
        public async Task UpdateAddress_ValidUser()
        {
            //Arrange
            var user          = TestHelper.ActivePaUser;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken);

            var addressResponse = McfClient.GetStandardMailingAddress(user.JwtEncodedString, user.BPNumber).Result;

            addressResponse.AddressID.ShouldNotBeNull();

            var request = new UpdateAddressRequest
            {
                AccountID   = user.BPNumber,
                AddressID   = addressResponse.AddressID.Value,
                AddressInfo = new McfAddressinfo
                {
                    StandardFlag    = "X",
                    City            = "Bellevue",
                    PostalCode      = "98004",
                    POBoxPostalCode = "",
                    POBox           = "",
                    Street          = "110th Ave NE",
                    HouseNo         = "355",
                    CountryID       = "US",
                    Region          = "WA",
                    HouseNo2        = ""
                }
            };

            // Act
            McfClient.UpdateAddress(user.JwtEncodedString, request);

            var requestAddress     = request.AddressInfo;
            var newAddressResponse = McfClient.GetStandardMailingAddress(user.JwtEncodedString, user.BPNumber).Result.AddressInfo;

            //Assert
            newAddressResponse.StandardFlag.ShouldBe(requestAddress.StandardFlag);
            newAddressResponse.City.ShouldBe(requestAddress.City);
            newAddressResponse.PostalCode.ShouldBe(requestAddress.PostalCode);
            newAddressResponse.Street.ShouldBe(requestAddress.Street);
            newAddressResponse.HouseNo.ShouldBe(requestAddress.HouseNo);
            newAddressResponse.CountryID.ShouldBe(requestAddress.CountryID);
            newAddressResponse.Region.ShouldBe(requestAddress.Region);

            // Restore the environment
            var restoreRequest = new UpdateAddressRequest
            {
                AccountID   = addressResponse.AccountID,
                AddressID   = addressResponse.AddressID.Value,
                AddressInfo = new McfAddressinfo
                {
                    StandardFlag    = addressResponse.AddressInfo.StandardFlag,
                    City            = addressResponse.AddressInfo.City,
                    PostalCode      = addressResponse.AddressInfo.PostalCode,
                    POBoxPostalCode = addressResponse.AddressInfo.POBoxPostalCode,
                    POBox           = addressResponse.AddressInfo.POBox,
                    Street          = addressResponse.AddressInfo.Street,
                    HouseNo         = addressResponse.AddressInfo.HouseNo,
                    CountryID       = addressResponse.AddressInfo.CountryID,
                    Region          = addressResponse.AddressInfo.Region,
                }
            };

            McfClient.UpdateAddress(user.JwtEncodedString, restoreRequest);
        }