Exemple #1
0
        public LoginModel CreateLoginAccount(string email = "*****@*****.**", string accountExternalId = "1234")
        {
            //Remove any account matching the given email
            Processor.ClearUserLoginByEmail(email).Wait();

            string accountMasterExternalId = accountExternalId;
            string loginEmail = email;

            //Create an Account Master and an Account asociated with it
            AccountMasterRequest accountMasterRequest = new AccountMasterRequest
            {
                CreateAccount = true,
                UseAccountTermsAsDefaultPayment = true,
                TaxIdentifier        = "asd",
                CreatedBy            = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                ExternalData         = "nada",
                GroupIdentifier      = "asd",
                Identifier           = accountExternalId,
                IsWebEnabled         = true,
                Name                 = "Softtek http test",
                ProductPriceDiscount = 105,
                TermsConfiguration   = new AccountMasterTermConfiguration
                {
                    HasPaymentTerms  = true,
                    TermsDescription = "29 days ;)"
                }
            };

            var resp = IntegrationsClient.AccountMasters.Create(accountMasterRequest).Result;

            //Get the Account created by the Above Method
            GetAccountAccountMasterRequest getAccountAccountMasterRequest = new GetAccountAccountMasterRequest
            {
                externalId = accountMasterExternalId
            };
            var getAccountAccountMasterResponse = CustomerServiceClient.Logins.GetAccountByAccountMasterExternalId(getAccountAccountMasterRequest).Result;

            //Create a Login/User/Contact providing the AccountMaster and the Account Identifier
            CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest
            {
                AccountIdentifier       = getAccountAccountMasterResponse.Result.AccountIdentifier,
                AccountMasterIdentifier = getAccountAccountMasterResponse.Result.AccountMasterIdentifier,
                ConfirmPassword         = "******",
                Password           = "******",
                ContactEmail       = "*****@*****.**",
                Email              = loginEmail,
                FirstName          = "Softtek",
                LastName           = "Test User",
                PlatformIdentifier = new Guid(PlatformIdentifier),
                PhoneNumber        = "123456789"
            };
            var createLoginUserContactResponse = CustomerServiceClient.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result;

            return(new LoginModel
            {
                Email = email,
                Password = "******"
            });
        }
Exemple #2
0
        public ContactInfoViewData UserContactCreate()
        {
            string           accountMasterExternalId = "9509";
            string           loginEmail  = "*****@*****.**";
            ContactInfoModel contactInfo = new ContactInfoModel
            {
                FirstName   = "QA",
                LastName    = "Automation",
                Company     = "Softtek",
                Email       = "*****@*****.**",
                PhoneNumber = "0987654"
            };

            //Create an Account Master and an Account asociated with it
            CreateAccountMasterRequest request = new CreateAccountMasterRequest
            {
                CreatedBy          = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                CreatedUtc         = DateTime.UtcNow,
                ExternalIdentifier = accountMasterExternalId,
                IsWebEnabled       = true,
                Name = contactInfo.Company,
                PlatformIdentifier = new Guid(PlatformIdentifier),
                TermsConfiguration = new TermsConfiguration {
                    HasPaymentTerms = true, TermsDescription = "40 Net Days, cool Stuff"
                }
            };

            var accountMasterResponse = IntegrationsClient.AccountMaster.Create(request).Result;

            //Get the Account created by the Above Method
            GetAccountAccountMasterRequest getAccountAccountMasterRequest = new GetAccountAccountMasterRequest
            {
                externalId = accountMasterExternalId
            };
            var getAccountAccountMasterResponse = CustomerServiceClient.Logins.GetAccountByAccountMasterExternalId(getAccountAccountMasterRequest).Result;

            //Create a Login/User/Contact providing the AccountMaster and the Account Identifier
            CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest
            {
                AccountIdentifier       = getAccountAccountMasterResponse.Result.AccountIdentifier,
                AccountMasterIdentifier = getAccountAccountMasterResponse.Result.AccountMasterIdentifier,
                ConfirmPassword         = "******",
                Password           = "******",
                ContactEmail       = contactInfo.Email,
                Email              = loginEmail,
                FirstName          = contactInfo.FirstName,
                LastName           = contactInfo.LastName,
                PlatformIdentifier = new Guid(PlatformIdentifier),
                PhoneNumber        = contactInfo.PhoneNumber
            };
            var createLoginUserContactResponse = CustomerServiceClient.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result;

            return(new ContactInfoViewData
            {
                Email = loginEmail,
                Password = "******",
                Contact = contactInfo
            });
        }
Exemple #3
0
        public LoginModel UserWithNoTermsAsPaymentOption()
        {
            string email = "*****@*****.**";
            string accountMasterExternalId = "5372225";

            Processor.ClearUserLoginByEmail(email).Wait();

            //Create an Account Master and an Account asociated with it
            CreateAccountMasterRequest request = new CreateAccountMasterRequest
            {
                CreatedBy          = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                CreatedUtc         = DateTime.UtcNow,
                ExternalIdentifier = accountMasterExternalId,
                IsWebEnabled       = true,
                Name = "Softtek",
                PlatformIdentifier = new Guid(PlatformIdentifier),
                TermsConfiguration = new TermsConfiguration {
                    HasPaymentTerms = false, TermsDescription = "40 Net Days, cool Stuff"
                }
            };

            var accountMasterResponse = IntegrationsClient.AccountMaster.Create(request).Result;

            //Get the Account created by the Above Method
            GetAccountAccountMasterRequest getAccountAccountMasterRequest = new GetAccountAccountMasterRequest
            {
                externalId = accountMasterExternalId
            };
            var getAccountAccountMasterResponse = CustomerServiceClient.Logins.GetAccountByAccountMasterExternalId(getAccountAccountMasterRequest).Result;

            //Create a Login/User/Contact providing the AccountMaster and the Account Identifier
            CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest
            {
                AccountIdentifier       = getAccountAccountMasterResponse.Result.AccountIdentifier,
                AccountMasterIdentifier = getAccountAccountMasterResponse.Result.AccountMasterIdentifier,
                ConfirmPassword         = "******",
                Password           = "******",
                ContactEmail       = "*****@*****.**",
                Email              = email,
                FirstName          = "Softtek",
                LastName           = "Test User",
                PlatformIdentifier = new Guid(PlatformIdentifier),
                PhoneNumber        = "123456789"
            };
            var createLoginUserContactResponse = CustomerServiceClient.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result;

            return(new LoginModel
            {
                Email = email,
                Password = "******"
            });
        }
Exemple #4
0
        public LoginUser CreateLoginAccount(string email = "*****@*****.**", string accountExternalId = "5383244")
        {
            //Remove any account matching the given email
            Processor.ClearUserLoginByEmail(email).Wait();

            //Create an Account Master and an Account asociated with it
            //CreateAccountMasterRequest request = new CreateAccountMasterRequest
            //{
            //    CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
            //    CreatedUtc = DateTime.UtcNow,
            //    ExternalIdentifier = accountExternalId,
            //    IsWebEnabled = true,
            //    Name = "Softtek",
            //    PlatformIdentifier = new Guid(PlatformIdentifier),
            //    TermsConfiguration = new TermsConfiguration { HasPaymentTerms = true, TermsDescription = "40 Net Days, cools Stuff" }
            //};

            //var accountMasterResponse = IntegrationsClientV1.AccountMaster.Create(request).Result;

            //Get the Account created by the Above Method
            GetAccountAccountMasterRequest getAccountAccountMasterRequest = new GetAccountAccountMasterRequest
            {
                externalId = accountExternalId
            };
            var getAccountAccountMasterResponse = CustomerServiceClient.Logins.GetAccountByAccountMasterExternalId(getAccountAccountMasterRequest).Result;

            //Create a Login/User/Contact providing the AccountMaster and the Account Identifier
            CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest
            {
                AccountIdentifier       = getAccountAccountMasterResponse.Result.AccountIdentifier,
                AccountMasterIdentifier = getAccountAccountMasterResponse.Result.AccountMasterIdentifier,
                ConfirmPassword         = "******",
                Password           = "******",
                ContactEmail       = "*****@*****.**",
                Email              = email,
                FirstName          = "Softtek",
                LastName           = "Test User",
                PlatformIdentifier = new Guid(PlatformIdentifier),
                PhoneNumber        = "123456789"
            };
            var createLoginUserContactResponse = CustomerServiceClient.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result;

            return(new LoginUser
            {
                Email = email,
                Password = "******"
            });
        }
Exemple #5
0
        public void CreateUserLoginContact()
        {
            CustomerServiceWebAppClient client = new CustomerServiceWebAppClient(ServiceConstants.CustomerServiceUrl, ServiceConstants.Username, ServiceConstants.Password);

            CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest
            {
                AccountIdentifier       = new Guid("92de5f84-bb48-456b-b319-8e5b5dba3369"),
                AccountMasterIdentifier = new Guid("4c8577a9-b401-4dae-9570-1b47db6be529"),
                ConfirmPassword         = "******",
                Password           = "******",
                ContactEmail       = "*****@*****.**",
                Email              = "*****@*****.**",
                FirstName          = "Softtek",
                LastName           = "Test User",
                PlatformIdentifier = new Guid("55c4524c-5e8f-4b81-adf1-a2f1d38677ff"),
                PhoneNumber        = "123456789"
            };
            var createLoginUserContactResponse = client.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result;

            Assert.IsNotNull(createLoginUserContactResponse.Result);
            Assert.IsNotNull(createLoginUserContactResponse.Result.Contact);
            Assert.IsNotNull(createLoginUserContactResponse.Result.Login);
            Assert.IsNotNull(createLoginUserContactResponse.Result.User);
        }
Exemple #6
0
        public AddressViewData UserWithAccountAddress()
        {
            string       accountMasterExternalId = "9509";
            string       loginEmail     = "*****@*****.**";
            AddressModel accountAddress = new AddressModel
            {
                street      = "Elm street",
                country     = "US",
                CompanyName = "KDA",
                postal      = "22780",
                city        = "Boulder",
                state       = "CO",
                apartment   = "apt B"
            };

            Processor.ClearUserLoginByEmail(loginEmail).Wait();

            try
            {
                //Create an Account Master and an Account asociated with it
                CreateAccountMasterRequest request = new CreateAccountMasterRequest
                {
                    CreatedBy          = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                    CreatedUtc         = DateTime.UtcNow,
                    ExternalIdentifier = accountMasterExternalId,
                    IsWebEnabled       = true,
                    Name = "Softtek",
                    PlatformIdentifier = new Guid(PlatformIdentifier),
                    TermsConfiguration = new TermsConfiguration {
                        HasPaymentTerms = true, TermsDescription = "40 Net Days, cool Stuff"
                    }
                };

                var accountMasterResponse = IntegrationsClient.AccountMaster.Create(request).Result;

                //Get the Account created by the Above Method
                GetAccountAccountMasterRequest getAccountAccountMasterRequest = new GetAccountAccountMasterRequest
                {
                    externalId = accountMasterExternalId
                };
                var getAccountAccountMasterResponse = CustomerServiceClient.Logins.GetAccountByAccountMasterExternalId(getAccountAccountMasterRequest).Result;

                //Create a Login/User/Contact providing the AccountMaster and the Account Identifier
                CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest
                {
                    AccountIdentifier       = getAccountAccountMasterResponse.Result.AccountIdentifier,
                    AccountMasterIdentifier = getAccountAccountMasterResponse.Result.AccountMasterIdentifier,
                    ConfirmPassword         = "******",
                    Password           = "******",
                    ContactEmail       = "*****@*****.**",
                    Email              = loginEmail,
                    FirstName          = "test1",
                    LastName           = "automation",
                    PlatformIdentifier = new Guid(PlatformIdentifier),
                    PhoneNumber        = "1234567"
                };
                var createLoginUserContactResponse = CustomerServiceClient.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result;

                //Add an account level address to the current user
                CreateAddressRequest createAddressRequest = new CreateAddressRequest
                {
                    AddressLine     = accountAddress.street,
                    AddressLine2    = string.IsNullOrEmpty(accountAddress.apartment) ? "" : accountAddress.apartment,
                    City            = accountAddress.city,
                    Country         = accountAddress.country,
                    Identifier      = Guid.NewGuid().ToString(),
                    Name            = accountAddress.CompanyName,
                    Postal          = accountAddress.postal,
                    State           = accountAddress.state,
                    OwnerExternalId = accountMasterExternalId
                };
                AddressResponse createResponse = IntegrationsClient.Address.Add(createAddressRequest).Result;

                return(new AddressViewData
                {
                    Email = loginEmail,
                    Password = "******",
                    Address = accountAddress
                });
            }
            catch (Exception)
            {
                throw;
            }
        }