Ejemplo n.º 1
0
        private void CreateRegistrarDomain(int packageId)
        {
            // create command arguments
            CommandParams args = PrepeareAccountParams();

            // ensure user settings are ok & copy them
            EnsureUserSettings(args);

            // get package info
            PackageSettings nsSettings = PackageController.GetPackageSettings(
                packageId,
                PackageSettings.NAME_SERVERS
                );
            // read service cycle
            ServiceLifeCycle lifeCycle = ServiceController.GetServiceLifeCycle(
                ServiceInfo.SpaceId,
                ServiceInfo.ServiceId
                );

            // copy domain name related settings
            args[CommandParams.NAME_SERVERS] = nsSettings[PackageSettings.NAME_SERVERS];
            args[CommandParams.DOMAIN_NAME]  = Domain;
            args[CommandParams.DOMAIN_TLD]   = TLD;
            args[CommandParams.YEARS]        = lifeCycle.CycleLength.ToString();

            // call registrar's API
            RegisterDomainResult rdResult = Registrar.RegisterDomain(args);

            // save registrar's order number
            ServiceSettings[REGISTRAR_ORDER_ID] = rdResult[RegisterDomainResult.ORDER_NUMBER];
            ServiceSettings[REGISTRAR]          = Registrar.RegistrarName;
        }
Ejemplo n.º 2
0
        public TransferDomainResult TransferDomain(CommandParams args, DomainContacts contacts)
        {
            TransferDomainResult result = new TransferDomainResult();

            result[TransferDomainResult.TRANSFER_ORDER_NUMBER] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + args[CommandParams.DOMAIN_NAME];

            return(result);
        }
Ejemplo n.º 3
0
        public AccountResult CreateSubAccount(CommandParams args)
        {
            AccountResult result = new AccountResult();

            AddParam("Command", "CreateSubAccount");

            AddParam("NewUID", args["Username"]);
            AddParam("NewPW", args["Password"]);
            AddParam("ConfirmPW", args["Password"]);

            AddParam("RegistrantAddress1", args["Address"]);
            AddParam("RegistrantCity", args["City"]);
            AddParam("RegistrantCountry", args["Country"]);
            AddParam("RegistrantEmailAddress", args["Email"]);
            AddParam("RegistrantEmailAddress_Contact", args["Email"]);
            AddParam("RegistrantFax", ConvertToEnomPhoneFormat(args["Fax"]));
            AddParam("RegistrantFirstName", args["FirstName"]);
            AddParam("RegistrantLastName", args["LastName"]);
            AddParam("RegistrantOrganizationName", "For Personal Usage Only");
            AddParam("RegistrantPhone", ConvertToEnomPhoneFormat(args["Phone"]));
            AddParam("RegistrantPostalCode", args["Zip"]);

            // create enom
            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

            // raise an exception
            if (!enomResult.Succeed)
            {
                RaiseRegistrarException(enomResult);
            }

            // check customer status info
            if (enomResult["StatusCustomerInfo"] != "Successful")
            {
                throw new Exception(enomResult["StatusCustomerInfo"]);
            }

            result[AccountResult.ACCOUNT_LOGIN_ID] = args["Username"];
            result[AccountResult.ACCOUNT_ID]       = enomResult["Account"];
            result[AccountResult.ACCOUNT_PARTY_ID] = enomResult["PartyID"];

            return(result);
        }
Ejemplo n.º 4
0
        private CommandParams PrepeareAccountParams()
        {
            CommandParams args = new CommandParams();

            args[CommandParams.USERNAME]   = UserInfo.Username;
            args[CommandParams.PASSWORD]   = UserInfo.Password;
            args[CommandParams.FIRST_NAME] = UserInfo.FirstName;
            args[CommandParams.LAST_NAME]  = UserInfo.LastName;
            args[CommandParams.EMAIL]      = UserInfo.Email;
            args[CommandParams.ADDRESS]    = UserInfo.Address;
            args[CommandParams.CITY]       = UserInfo.City;
            args[CommandParams.STATE]      = UserInfo.State;
            args[CommandParams.COUNTRY]    = UserInfo.Country;
            args[CommandParams.ZIP]        = UserInfo.Zip;
            args[CommandParams.PHONE]      = UserInfo.PrimaryPhone;
            args[CommandParams.FAX]        = UserInfo.Fax;

            return(args);
        }
Ejemplo n.º 5
0
        private AccountResult GetRegistrarAccountInfo()
        {
            string userAccount  = UserInfo.Username;
            string emailAddress = UserInfo.Email;

            // check for user account
            bool exists = Registrar.CheckSubAccountExists(userAccount, emailAddress);

            // sub-account doesn't exist then create it
            if (!exists)
            {
                // create account params bunch
                CommandParams accountArgs = PrepeareAccountParams();
                // create sub-account
                return(Registrar.CreateSubAccount(accountArgs));
            }

            // just get sub-account info on registrar's side
            return(Registrar.GetSubAccount(userAccount, emailAddress));
        }
Ejemplo n.º 6
0
        private EnomResult PushDomainToSubAccount(CommandParams args)
        {
            AddParam("Command", "PushDomain");

            AddParam("SLD", args[CommandParams.DOMAIN_NAME]);
            AddParam("TLD", args[CommandParams.DOMAIN_TLD]);

            AddParam("AccountID", args[AccountResult.ACCOUNT_LOGIN_ID]);

            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

            // throws an exception
            if (!enomResult.Succeed)
            {
                RaiseRegistrarException(enomResult);
            }

            return(enomResult);
        }
Ejemplo n.º 7
0
        private void RenewDomainOnRegistrar()
        {
            // read service cycle
            ServiceLifeCycle lifeCycle = ServiceController.GetServiceLifeCycle(
                ServiceInfo.SpaceId,
                ServiceInfo.ServiceId
                );

            // copy renew arguments
            CommandParams args = new CommandParams();

            args[CommandParams.DOMAIN_NAME] = Domain;
            args[CommandParams.DOMAIN_TLD]  = TLD;
            args[CommandParams.YEARS]       = lifeCycle.CycleLength.ToString();

            // renew remote domain
            RenewDomainResult result = Registrar.RenewDomain(args);

            // save renew order id
            ServiceSettings[RENEW_ORDER_ID] = result[RenewDomainResult.RENEW_ORDER_NUMBER];
            ServiceSettings[REGISTRAR]      = result[RenewDomainResult.REGISTRAR];

            // renew service life-cycle suspend date
            DateTime StartDate = ServiceController.GetServiceSuspendDate(
                ServiceInfo.SpaceId,
                ServiceInfo.ServiceId
                );

            // calculate end date
            DateTime EndDate = StartDate.AddYears(lifeCycle.CycleLength);

            // append life-cycle record
            ServiceController.SetServiceLifeCycleRecord(
                ServiceInfo.SpaceId,
                ServiceInfo.ServiceId,
                StartDate,
                EndDate
                );
        }
Ejemplo n.º 8
0
        private void EnsureUserSettings(CommandParams args)
        {
            // load user settings
            UserSettings regSettings = UserController.GetUserSettings(
                ServiceInfo.UserId,
                SettingsName
                );

            // settings are empty
            if (regSettings.SettingsArray == null || regSettings.SettingsArray.Length == 0)
            {
                // load registrar account info
                AccountResult rmResult = GetRegistrarAccountInfo();

                // update user settings locally
                regSettings.SettingsName = SettingsName;
                regSettings.UserId       = UserInfo.UserId;

                // copy account data
                foreach (string key in rmResult.AllKeys)
                {
                    regSettings[key] = rmResult[key];
                    args[key]        = rmResult[key];
                }

                // save sub-account settings
                UserController.UpdateUserSettings(regSettings);
            }
            else
            {
                // copy user settings
                foreach (string[] pair in regSettings.SettingsArray)
                {
                    args[pair[0]] = pair[1];
                }
            }
        }
Ejemplo n.º 9
0
        public AccountResult CreateSubAccount(CommandParams args)
        {
            AccountResult result = new AccountResult();

            return(result);
        }
Ejemplo n.º 10
0
		private void RenewDomainOnRegistrar()
		{
			// read service cycle
			ServiceLifeCycle lifeCycle = ServiceController.GetServiceLifeCycle(
				ServiceInfo.SpaceId,
				ServiceInfo.ServiceId
			);

			// copy renew arguments
			CommandParams args = new CommandParams();
			args[CommandParams.DOMAIN_NAME] = Domain;
			args[CommandParams.DOMAIN_TLD] = TLD;
			args[CommandParams.YEARS] = lifeCycle.CycleLength.ToString();

			// renew remote domain
			RenewDomainResult result = Registrar.RenewDomain(args);

			// save renew order id
			ServiceSettings[RENEW_ORDER_ID] = result[RenewDomainResult.RENEW_ORDER_NUMBER];
			ServiceSettings[REGISTRAR] = result[RenewDomainResult.REGISTRAR];

			// renew service life-cycle suspend date
			DateTime StartDate = ServiceController.GetServiceSuspendDate(
				ServiceInfo.SpaceId,
				ServiceInfo.ServiceId
			);
			
			// calculate end date
			DateTime EndDate = StartDate.AddYears(lifeCycle.CycleLength);

			// append life-cycle record
			ServiceController.SetServiceLifeCycleRecord(
				ServiceInfo.SpaceId,
				ServiceInfo.ServiceId,
				StartDate,
				EndDate
			);
		}
Ejemplo n.º 11
0
		private void EnsureUserSettings(CommandParams args)
		{
			// load user settings
			UserSettings regSettings = UserController.GetUserSettings(
				ServiceInfo.UserId,
				SettingsName
			);

			// settings are empty
			if (regSettings.SettingsArray == null || regSettings.SettingsArray.Length == 0)
			{
				// load registrar account info
				AccountResult rmResult = GetRegistrarAccountInfo();

				// update user settings locally
				regSettings.SettingsName = SettingsName;
				regSettings.UserId = UserInfo.UserId;

				// copy account data
				foreach (string key in rmResult.AllKeys)
				{
					regSettings[key] = rmResult[key];
					args[key] = rmResult[key];
				}

				// save sub-account settings
				UserController.UpdateUserSettings(regSettings);
			}
			else
			{
				// copy user settings
				foreach (string[] pair in regSettings.SettingsArray)
				{
					args[pair[0]] = pair[1];
				}
			}
		}
Ejemplo n.º 12
0
		public TransferDomainResult TransferDomain(CommandParams args, DomainContacts contacts)
		{
			throw new NotSupportedException();
		}
Ejemplo n.º 13
0
 public TransferDomainResult TransferDomain(CommandParams args, DomainContacts contacts)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 14
0
		private CommandParams PrepeareAccountParams(UserInfo userInfo)
		{
			CommandParams args = new CommandParams();

			args[CommandParams.USERNAME] = userInfo.Username;
			args[CommandParams.PASSWORD] = userInfo.Password;
			args[CommandParams.FIRST_NAME] = userInfo.FirstName;
			args[CommandParams.LAST_NAME] = userInfo.LastName;
			args[CommandParams.EMAIL] = userInfo.Email;
			args[CommandParams.ADDRESS] = userInfo.Address;
			args[CommandParams.CITY] = userInfo.City;
			args[CommandParams.STATE] = userInfo.State;
			args[CommandParams.COUNTRY] = userInfo.Country;
			args[CommandParams.ZIP] = userInfo.Zip;
			args[CommandParams.PHONE] = userInfo.PrimaryPhone;
			args[CommandParams.FAX] = userInfo.Fax;

			return args;
		}
Ejemplo n.º 15
0
 public TransferDomainResult TransferDomain(CommandParams args, DomainContacts contacts)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 16
0
		public AccountResult CreateSubAccount(CommandParams args)
		{
			AccountResult result = new AccountResult();

			return result;
		}
Ejemplo n.º 17
0
		public TransferDomainResult TransferDomain(CommandParams args, DomainContacts contacts)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Ejemplo n.º 18
0
		public AccountResult CreateSubAccount(CommandParams args)
		{
			AccountResult result = new AccountResult();

			AddParam("Command", "CreateSubAccount");

			AddParam("NewUID", args["Username"]);
			AddParam("NewPW", args["Password"]);
			AddParam("ConfirmPW", args["Password"]);

			AddParam("RegistrantAddress1", args["Address"]);
			AddParam("RegistrantCity", args["City"]);
			AddParam("RegistrantCountry", args["Country"]);
			AddParam("RegistrantEmailAddress", args["Email"]);
			AddParam("RegistrantEmailAddress_Contact", args["Email"]);
			AddParam("RegistrantFax", ConvertToEnomPhoneFormat(args["Fax"]));
			AddParam("RegistrantFirstName", args["FirstName"]);
			AddParam("RegistrantLastName", args["LastName"]);
			AddParam("RegistrantOrganizationName", "For Personal Usage Only");
			AddParam("RegistrantPhone", ConvertToEnomPhoneFormat(args["Phone"]));
			AddParam("RegistrantPostalCode", args["Zip"]);

			// create enom
			EnomResult enomResult = new EnomResult(
				ExecuteCommand()
			);

			// raise an exception
			if (!enomResult.Succeed)
				RaiseRegistrarException(enomResult);

			// check customer status info
			if (enomResult["StatusCustomerInfo"] != "Successful")
				throw new Exception(enomResult["StatusCustomerInfo"]);

			result[AccountResult.ACCOUNT_LOGIN_ID] = args["Username"];
			result[AccountResult.ACCOUNT_ID] = enomResult["Account"];
			result[AccountResult.ACCOUNT_PARTY_ID] = enomResult["PartyID"];

			return result;
		}
Ejemplo n.º 19
0
		private EnomResult PushDomainToSubAccount(CommandParams args)
		{
			AddParam("Command", "PushDomain");

			AddParam("SLD", args[CommandParams.DOMAIN_NAME]);
			AddParam("TLD", args[CommandParams.DOMAIN_TLD]);

			AddParam("AccountID", args[AccountResult.ACCOUNT_LOGIN_ID]);

			EnomResult enomResult = new EnomResult(
				ExecuteCommand()
			);

			// throws an exception
			if (!enomResult.Succeed)
				RaiseRegistrarException(enomResult);

			return enomResult;
		}
Ejemplo n.º 20
0
		public TransferDomainResult TransferDomain(CommandParams args, DomainContacts contacts)
		{
			TransferDomainResult result = new TransferDomainResult();

			result[TransferDomainResult.TRANSFER_ORDER_NUMBER] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + args[CommandParams.DOMAIN_NAME];

			return result;
		}