예제 #1
0
        public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            string domainName = GetDomainName(domainSvc.Fqdn);
            string domainTld  = GetDomainTLD(domainSvc.Fqdn);

            AddParam("Command", "Extend");

            AddParam("SLD1", domainName);
            AddParam("TLD1", domainTld);

            AddParam("NumYears", domainSvc.PeriodLength.ToString());

            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

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

            // something wrong was happend we should throw an exception
            if (enomResult["RRPCode"] != "200")
            {
                throw new Exception(
                          "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"]
                          );
            }

            domainSvc["OrderID"] = enomResult["OrderID"];
        }
예제 #2
0
        public bool CheckSubAccountExists(string account, string emailAddress)
        {
            if (String.IsNullOrEmpty(account))
            {
                throw new ArgumentNullException("account");
            }

            bool userFound = false;

            int startPosition = 1;

            while (startPosition > -1)
            {
                AddParam("Command", "GetSubAccounts");

                AddParam("ListBy", "LoginID");
                AddParam("StartLetter", account.Substring(0, 1));
                AddParam("StartPosition", startPosition.ToString());

                EnomResult enomResult = new EnomResult(
                    ExecuteCommand()
                    );

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

                int count = Convert.ToInt32(enomResult["Count"]);

                for (int i = 1; i <= PAGE_SIZE; i++)
                {
                    string enomLogin = enomResult["LoginID" + i];

                    if (String.Compare(enomLogin, account, true) == 0)
                    {
                        userFound     = true;
                        startPosition = -1;
                        break;
                    }
                }

                // perform next iteration
                if (!userFound)
                {
                    startPosition += PAGE_SIZE;

                    if (startPosition >= count)
                    {
                        startPosition = -1;
                    }
                }
            }

            return(userFound);
        }
예제 #3
0
        private void RaiseRegistrarException(EnomResult result)
        {
            string[] errors = new string[result.ErrorsCount];

            for (int i = 0; i < result.ErrorsCount; i++)
            {
                errors[i] = result["Err" + (i + 1)];
            }

            throw new Exception(String.Join(Environment.NewLine, errors));
        }
예제 #4
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);
        }
예제 #5
0
        public DomainStatus CheckDomain(string domain)
        {
            AddParam("Command", "Check");

            //AddDomainParam(domain, false);

            // gets a result from API
            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

            // domain available to registration
            if (enomResult["RRPCode"] == "210")
            {
                return(DomainStatus.NotFound);
            }

            return(DomainStatus.Registered);
        }
예제 #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);
        }
예제 #7
0
        public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            AddParam("Command", "Purchase");
            // as per Enom API reference this parameter use is recommended in production mode
            // as it uses a queued order peorcessing instead of real-time.
            AddParam("QueueOrder", "1");

            string domainName = GetDomainName(domainSvc.Fqdn);
            string domainTld  = GetDomainTLD(domainSvc.Fqdn);

            // add domain
            AddParam("SLD", domainName);
            AddParam("TLD", domainTld);
            AddParam("NumYears", domainSvc.PeriodLength.ToString());

            if (LiveMode && (nameServers != null && nameServers.Length > 0))
            {
                // load name servers
                for (int i = 0; i < nameServers.Length; i++)
                {
                    AddParam(String.Concat("NS", i + 1), nameServers[i].Trim());
                }
            }
            else
            {
                // use Enom's name servers
                AddParam("UseDNS", "default");
            }

            if (domainSvc.Fqdn.EndsWith(".uk"))
            {
                // special stub for org.uk and org.uk domains
                // org.uk and co.uk tlds should have at least 2 NS
                if (nameServers != null && nameServers.Length == 1)
                {
                    // we already have first ns added
                    // so push the second ns
                    AddParam("NS2", nameServers[0].Trim());
                }
                AddParam("registered_for", domainSvc["RegisteredFor"]);
                AddParam("uk_legal_type", domainSvc["UK_LegalType"]);
                AddParam("uk_reg_co_no", domainSvc["UK_CompanyIdNumber"]);
                AddParam("uk_reg_opt_out", domainSvc["HideWhoisInfo"]);
            }
            // us TLDs extensions
            else if (domainSvc.Fqdn.EndsWith(".us"))
            {
                AddParam("global_cc_us", accountInfo[ContractAccount.COUNTRY]);
                AddParam("us_nexus", domainSvc["NexusCategory"]);
                AddParam("us_purpose", domainSvc["ApplicationPurpose"]);
            }
            // eu TLDs extensions
            else if (domainSvc.Fqdn.EndsWith(".eu"))
            {
                AddParam("eu_whoispolicy", domainSvc["EU_WhoisPolicy"]);
                AddParam("eu_agreedelete", domainSvc["EU_AgreeDelete"]);
                AddParam("eu_adr_lang", domainSvc["EU_ADRLang"]);
                //
                AddParam("AdminOrganizationName", accountInfo[ContractAccount.COMPANY_NAME]);
                AddParam("AdminFirstName", accountInfo[ContractAccount.FIRST_NAME]);
                AddParam("AdminLastName", accountInfo[ContractAccount.LAST_NAME]);
                AddParam("AdminAddress1", accountInfo[ContractAccount.ADDRESS]);
                AddParam("AdminAddress2", accountInfo[ContractAccount.ADDRESS]);
                AddParam("AdminCity", accountInfo[ContractAccount.CITY]);
                AddParam("AdminStateProvinceChoice", "P");
                AddParam("AdminProvince", accountInfo[ContractAccount.STATE]);
                AddParam("AdminPostalCode", accountInfo[ContractAccount.ZIP]);
                AddParam("AdminCountry", accountInfo[ContractAccount.COUNTRY]);
                AddParam("AdminEmailAddress", accountInfo[ContractAccount.EMAIL]);
                AddParam("AdminPhone", accountInfo[ContractAccount.PHONE_NUMBER]);
                AddParam("AdminFax", accountInfo[ContractAccount.FAX_NUMBER]);
                AddParam("AdminJobTitle", "Administrator");
                AddParam("RegistrantJobTitle", "Registrant");
            }

            AddParam("UseCreditCard", "no");
            AddParam("RegistrantFirstName", accountInfo[ContractAccount.FIRST_NAME]);
            AddParam("RegistrantLastName", accountInfo[ContractAccount.LAST_NAME]);
            AddParam("RegistrantAddress1", accountInfo[ContractAccount.ADDRESS]);
            AddParam("RegistrantCity", accountInfo[ContractAccount.CITY]);
            AddParam("RegistrantEmailAddress", accountInfo[ContractAccount.EMAIL]);
            AddParam("RegistrantPhone", accountInfo[ContractAccount.PHONE_NUMBER]);
            AddParam("RegistrantCountry", accountInfo[ContractAccount.COUNTRY]);
            AddParam("RegistrantStateProvince", accountInfo[ContractAccount.STATE]);
            AddParam("RegistrantPostalCode", accountInfo[ContractAccount.ZIP]);

            //}

            // unlock registrar

            /*if (domainSvc["LockRegistrar"] == "0")
             *      AddParam("UnLockRegistrar", "1");*/

            // load contacts
            //AddCustomerContacts(contacts);

            // return enom result
            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

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

            // if something wrong was happend then throws an exception
            if (enomResult["RRPCode"] != "200")
            {
                throw new Exception(
                          "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"]
                          );
            }
            // copy order if
            domainSvc["OrderID"] = enomResult["OrderID"];

            //PushDomainToSubAccount(args);
        }
예제 #8
0
		public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
		{
			string domainName = GetDomainName(domainSvc.Fqdn);
			string domainTld = GetDomainTLD(domainSvc.Fqdn);

			AddParam("Command", "Extend");

			AddParam("SLD1", domainName);
			AddParam("TLD1", domainTld);

			AddParam("NumYears", domainSvc.PeriodLength.ToString());

			EnomResult enomResult = new EnomResult(
				ExecuteCommand()
			);

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

			// something wrong was happend we should throw an exception
			if (enomResult["RRPCode"] != "200")
			{
				throw new Exception(
					"Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"]
				);
			}

			domainSvc["OrderID"] = enomResult["OrderID"];
		}
예제 #9
0
		public DomainStatus CheckDomain(string domain)
		{
			AddParam("Command", "Check");

			//AddDomainParam(domain, false);

			// gets a result from API
			EnomResult enomResult = new EnomResult(
				ExecuteCommand()
			);
			// domain available to registration
			if (enomResult["RRPCode"] == "210")
				return DomainStatus.NotFound;

			return DomainStatus.Registered;
		}
예제 #10
0
		public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
		{
			AddParam("Command", "Purchase");
			// as per Enom API reference this parameter use is recommended in production mode
			// as it uses a queued order peorcessing instead of real-time.
			AddParam("QueueOrder", "1");

			string domainName = GetDomainName(domainSvc.Fqdn);
			string domainTld = GetDomainTLD(domainSvc.Fqdn);

			// add domain
			AddParam("SLD", domainName);
			AddParam("TLD", domainTld);
			AddParam("NumYears", domainSvc.PeriodLength.ToString());

			if (LiveMode && (nameServers != null && nameServers.Length > 0))
			{
				// load name servers
				for (int i = 0; i < nameServers.Length; i++)
					AddParam(String.Concat("NS", i + 1), nameServers[i].Trim());
			}
			else
			{
				// use Enom's name servers
				AddParam("UseDNS", "default");
			}

			if (domainSvc.Fqdn.EndsWith(".uk"))
			{
				// special stub for org.uk and org.uk domains
				// org.uk and co.uk tlds should have at least 2 NS
				if (nameServers != null && nameServers.Length == 1)
				{
					// we already have first ns added
					// so push the second ns
					AddParam("NS2", nameServers[0].Trim());
				}
				AddParam("registered_for", domainSvc["RegisteredFor"]);
				AddParam("uk_legal_type", domainSvc["UK_LegalType"]);
				AddParam("uk_reg_co_no", domainSvc["UK_CompanyIdNumber"]);
				AddParam("uk_reg_opt_out", domainSvc["HideWhoisInfo"]);
			}
			// us TLDs extensions
			else if (domainSvc.Fqdn.EndsWith(".us"))
			{
                AddParam("global_cc_us", accountInfo[ContractAccount.COUNTRY]);
				AddParam("us_nexus", domainSvc["NexusCategory"]);
				AddParam("us_purpose", domainSvc["ApplicationPurpose"]);
			}
			// eu TLDs extensions
			else if (domainSvc.Fqdn.EndsWith(".eu"))
			{
				AddParam("eu_whoispolicy", domainSvc["EU_WhoisPolicy"]);
				AddParam("eu_agreedelete", domainSvc["EU_AgreeDelete"]);
				AddParam("eu_adr_lang", domainSvc["EU_ADRLang"]);
				//
				AddParam("AdminOrganizationName", accountInfo[ContractAccount.COMPANY_NAME]);
                AddParam("AdminFirstName", accountInfo[ContractAccount.FIRST_NAME]);
                AddParam("AdminLastName", accountInfo[ContractAccount.LAST_NAME]);
                AddParam("AdminAddress1", accountInfo[ContractAccount.ADDRESS]);
                AddParam("AdminAddress2", accountInfo[ContractAccount.ADDRESS]);
                AddParam("AdminCity", accountInfo[ContractAccount.CITY]);
				AddParam("AdminStateProvinceChoice", "P");
                AddParam("AdminProvince", accountInfo[ContractAccount.STATE]);
                AddParam("AdminPostalCode", accountInfo[ContractAccount.ZIP]);
                AddParam("AdminCountry", accountInfo[ContractAccount.COUNTRY]);
                AddParam("AdminEmailAddress", accountInfo[ContractAccount.EMAIL]);
                AddParam("AdminPhone", accountInfo[ContractAccount.PHONE_NUMBER]);
                AddParam("AdminFax", accountInfo[ContractAccount.FAX_NUMBER]);
				AddParam("AdminJobTitle", "Administrator");
				AddParam("RegistrantJobTitle", "Registrant");
			}

			AddParam("UseCreditCard", "no");
            AddParam("RegistrantFirstName", accountInfo[ContractAccount.FIRST_NAME]);
            AddParam("RegistrantLastName", accountInfo[ContractAccount.LAST_NAME]);
            AddParam("RegistrantAddress1", accountInfo[ContractAccount.ADDRESS]);
            AddParam("RegistrantCity", accountInfo[ContractAccount.CITY]);
            AddParam("RegistrantEmailAddress", accountInfo[ContractAccount.EMAIL]);
            AddParam("RegistrantPhone", accountInfo[ContractAccount.PHONE_NUMBER]);
            AddParam("RegistrantCountry", accountInfo[ContractAccount.COUNTRY]);
            AddParam("RegistrantStateProvince", accountInfo[ContractAccount.STATE]);
            AddParam("RegistrantPostalCode", accountInfo[ContractAccount.ZIP]);
			
			//}

			// unlock registrar
			/*if (domainSvc["LockRegistrar"] == "0")
				AddParam("UnLockRegistrar", "1");*/

			// load contacts
			//AddCustomerContacts(contacts);

			// return enom result
			EnomResult enomResult = new EnomResult(
				ExecuteCommand()
			);

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

			// if something wrong was happend then throws an exception
			if (enomResult["RRPCode"] != "200")
			{
				throw new Exception(
					"Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"]
				);
			}
			// copy order if
			domainSvc["OrderID"] = enomResult["OrderID"];

			//PushDomainToSubAccount(args);
		}
예제 #11
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;
		}
예제 #12
0
		public AccountResult GetSubAccount(string account, string emailAddress)
		{
			if (String.IsNullOrEmpty(account))
				throw new ArgumentNullException("account");

			AccountResult result = new AccountResult();

			int startPosition = 1;

			bool userFound = false;

			while (startPosition > -1)
			{
				AddParam("Command", "GetSubAccounts");

				AddParam("ListBy", "LoginID");
				AddParam("StartLetter", account.Substring(0, 1));
				AddParam("StartPosition", startPosition.ToString());

				EnomResult enomResult = new EnomResult(
					ExecuteCommand()
				);

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

				int count = Convert.ToInt32(enomResult["Count"]);

				for (int i = 1; i <= PAGE_SIZE; i++)
				{
					string enomLogin = enomResult["LoginID" + i];

					// copy values to result
					if (String.Compare(enomLogin, account, true) == 0)
					{
						userFound = true;

						result[AccountResult.ACCOUNT_LOGIN_ID] = enomLogin;
						result[AccountResult.ACCOUNT_ID] = enomResult["Account" + i];
						result[AccountResult.ACCOUNT_PARTY_ID] = enomResult["PartyID" + i];
						
						startPosition = -1;

						break;
					}
				}

				// perform next iteration
				if (userFound)
				{
					startPosition += PAGE_SIZE;

					if (startPosition >= count)
						startPosition = -1;
				}
			}

			return result;
		}
예제 #13
0
		public bool CheckSubAccountExists(string account, string emailAddress)
		{
			if (String.IsNullOrEmpty(account))
				throw new ArgumentNullException("account");

			bool userFound = false;

			int startPosition = 1;

			while (startPosition > -1)
			{
				AddParam("Command", "GetSubAccounts");

				AddParam("ListBy", "LoginID");
				AddParam("StartLetter", account.Substring(0, 1));
				AddParam("StartPosition", startPosition.ToString());

				EnomResult enomResult = new EnomResult(
					ExecuteCommand()
				);

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

				int count = Convert.ToInt32(enomResult["Count"]);

				for (int i = 1; i <= PAGE_SIZE; i++)
				{
					string enomLogin = enomResult["LoginID" + i];

					if (String.Compare(enomLogin, account, true) == 0)
					{
						userFound = true;
						startPosition = -1;
						break;
					}
				}

				// perform next iteration
				if (!userFound)
				{
					startPosition += PAGE_SIZE;

					if (startPosition >= count)
						startPosition = -1;
				}
			}

			return userFound;
		}
예제 #14
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;
		}
예제 #15
0
		private void RaiseRegistrarException(EnomResult result)
		{
			string[] errors = new string[result.ErrorsCount];

			for (int i = 0; i < result.ErrorsCount; i++)
				errors[i] = result["Err" + (i + 1)];

			throw new Exception(String.Join(Environment.NewLine, errors));
		}