Example #1
0
        public bool IsContactValidForProduct(int contactId, string productKey)
        {
            // setup service url
            OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
            //
            OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt();
            //
            Hashtable result = contactExt.isValidRegistrantContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                   ParentId, new int[] { contactId }, new string[] { productKey });
            //
            Hashtable product = (Hashtable)result[productKey];

            //
            if (Convert.ToString(product[contactId.ToString()]) == "true")
            {
                return(true);
            }
            //
            return(false);
        }
Example #2
0
        public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            int customerId = 0;

            // 1. check customer exists
            if (CheckSubAccountExists(accountInfo[ContractAccount.EMAIL]))
            {
                customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]);
            }
            else
            {
                customerId = CreateCustomerAccount(accountInfo);
            }

            // obtain default contact id
            int contactId = GetDefaultContactId(customerId);

            // check for demo mode if so then set demo-nameservers.
            if (!LiveMode)
            {
                nameServers = new string[] { "ns1.onlyfordemo.net", "ns2.onlyfordemo.net" }
            }
            ;

            // fill parameters hashtable
            Hashtable domainHash = new Hashtable();

            // copy domain name
            domainHash[domainSvc.Fqdn] = domainSvc.PeriodLength.ToString();
            // setup service url
            OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
            // init domain order api
            OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder();

            //
            int validateAttempts = 0;

VALIDATE_REGISTRATION:
            // validate params
            Hashtable valResult = domOrder.validateDomainRegistrationParams(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                            ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId,
                                                                            contactId, customerId, NO_INVOICE);

            // get domain name hashtable
            valResult = (Hashtable)valResult[domainSvc.Fqdn];
            // check validation status
            if ((String)valResult[STATUS] == "error")
            {
                // try to update extended contact fields and re-validate params
                if (validateAttempts == 0 && domainSvc.Fqdn.EndsWith(".us"))
                {
                    validateAttempts++;
                    //
                    OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt();
                    // fill extension hash
                    Hashtable exthash = new Hashtable();
                    Hashtable domus   = new Hashtable();
                    domus["nexusCategory"]      = domainSvc["NexusCategory"];
                    domus["applicationPurpose"] = domainSvc["ApplicationPurpose"];
                    exthash["domus"]            = domus;
                    // set default contact extensions
                    bool succeed = contactExt.setContactDetails(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                ParentId, contactId, exthash, "domus");
                    // check result
                    if (succeed)
                    {
                        goto VALIDATE_REGISTRATION;
                    }
                }
                //
                throw new Exception((String)valResult[ERROR]);
            }

            // register domain
            Hashtable orderResult = domOrder.addWithoutValidation(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                  ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId,
                                                                  contactId, customerId, NO_INVOICE);

            // switch to the nested data bunch
            orderResult = (Hashtable)orderResult[domainSvc.Fqdn];

            // check returned status
            switch ((String)orderResult[STATUS])
            {
            case "error":                     // error
                throw new Exception(Convert.ToString(orderResult[ERROR]));

            case "Failed":                     // error
                throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC]));

            case "Success":                     // success
            case "InvoicePaid":                 // success
                // we are success so copy order number
                domainSvc[EAQID]     = Convert.ToString(orderResult[EAQID]);
                domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]);
                break;
            }
        }
		public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
		{
			int customerId = 0;
			// 1. check customer exists
			if (CheckSubAccountExists(accountInfo[ContractAccount.EMAIL]))
                customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]);
			else
				customerId = CreateCustomerAccount(accountInfo);

			// obtain default contact id
			int contactId = GetDefaultContactId(customerId);

			// check for demo mode if so then set demo-nameservers.
			if (!LiveMode)
				nameServers = new string[] { "ns1.onlyfordemo.net", "ns2.onlyfordemo.net" };

			// fill parameters hashtable
			Hashtable domainHash = new Hashtable();
			// copy domain name
			domainHash[domainSvc.Fqdn] = domainSvc.PeriodLength.ToString();
			// setup service url
			OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
			// init domain order api
			OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder();

			// 
			int validateAttempts = 0;

			VALIDATE_REGISTRATION:
				// validate params
				Hashtable valResult = domOrder.validateDomainRegistrationParams(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
					ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId,
					contactId, customerId, NO_INVOICE);

			// get domain name hashtable
			valResult = (Hashtable)valResult[domainSvc.Fqdn];
			// check validation status
			if ((String)valResult[STATUS] == "error")
			{
				// try to update extended contact fields and re-validate params
				if (validateAttempts == 0 && domainSvc.Fqdn.EndsWith(".us"))
				{
					validateAttempts++;
					//
					OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt();
					// fill extension hash
					Hashtable exthash = new Hashtable();
					Hashtable domus = new Hashtable();
					domus["nexusCategory"] = domainSvc["NexusCategory"];
					domus["applicationPurpose"] = domainSvc["ApplicationPurpose"];
					exthash["domus"] = domus;
					// set default contact extensions
					bool succeed = contactExt.setContactDetails(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
						ParentId, contactId, exthash, "domus");
					// check result
					if (succeed)
						goto VALIDATE_REGISTRATION;
				}
				//
				throw new Exception((String)valResult[ERROR]);
			}

			// register domain
			Hashtable orderResult = domOrder.addWithoutValidation(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
				ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId,
				contactId, customerId, NO_INVOICE);

			// switch to the nested data bunch
			orderResult = (Hashtable)orderResult[domainSvc.Fqdn];

			// check returned status
			switch ((String)orderResult[STATUS])
			{
				case "error": // error
					throw new Exception(Convert.ToString(orderResult[ERROR]));
				case "Failed": // error
					throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC]));
				case "Success": // success
				case "InvoicePaid": // success
					// we are success so copy order number
					domainSvc[EAQID] = Convert.ToString(orderResult[EAQID]);
					domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]);
					break;
			}
		}
		public bool IsContactValidForProduct(int contactId, string productKey)
		{
			// setup service url
			OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
			//
			OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt();
			// 
			Hashtable result = contactExt.isValidRegistrantContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
				ParentId, new int[] {contactId}, new string[] { productKey });
			//
			Hashtable product = (Hashtable)result[productKey];
			//
			if (Convert.ToString(product[contactId.ToString()]) == "true")
				return true;
			//
			return false;
		}