Exemplo n.º 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 = "******"
            });
        }
Exemplo n.º 2
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 = "******"
            });
        }