private void Register() { ContactInfo registrant = new ContactInfo() { fname = "Artemus", lname = "Gordon", email = "*****@*****.**", phone = "+1.8885551212", sa1 = "2 N. Main St.", city = "Valdosta", sp = "Georgia", pc = "17123", cc = "United States", }; DomainRegistration[] drArray = new DomainRegistration[this.domainNames.Length]; for (int i = 0; i < this.domainNames.Length; i++) { string topLevelDomain = Helpers.GetTopLevelDomain(this.domainNames[i]); drArray[i] = new DomainRegistration() { nsArray = new NS[] { new NS() { name = "ns1.example.com" }, new NS() { name = "ns2.example.com" } }, registrant = registrant, order = new OrderItem() { productid = (int)GetProductID(topLevelDomain, RegistrationPeriodInYears, false), riid = i.ToString() }, tld = topLevelDomain, sld = Helpers.GetSecondLevelDomain(this.domainNames[i]), period = RegistrationPeriodInYears }; if (topLevelDomain == "us") { drArray[i].nexus = new Nexus() { category = "citizen of US", use = "personal", country = "us" }; } } Shopper shopper = new Shopper(); if (this.userID > 0) { shopper.user = userID.ToString(); } else { shopper.user = "******"; shopper.pwd = "abcde"; shopper.email = "*****@*****.**"; shopper.firstname = "Artemus"; shopper.lastname = "Gordon"; shopper.phone = "+1.8885551212"; // country code . number } string returnXml = wapi.OrderDomains(orderDomainTransactionID, cred, shopper, drArray, null, "domain"); RegisterDomainsResponse r = new RegisterDomainsResponse(returnXml); if (this.orderDomainTransactionID != r.UniqueClientTransactionID) throw new InvalidResponseException(returnXml); this.OrderID = r.OrderID; this.userID = r.ShopperID; }
/// <summary> /// Registers the domain name and sets WwdResourceID, useful for renewing purchased items later. /// </summary> public void Register() { if (Common.Properties.IsDevelopmentEnvironment) { WwdResourceID = "test domain"; return; } Availability preAvailability = CheckAvailability(); if (preAvailability != Availability.AvailableForRegistration) { throw new Exception(preAvailability.ToString()); } DomainRegistration domainReg = new DomainRegistration() { nsArray = this.nsArray, registrant = this.registrant, order = new OrderItem() { productid = this.productIdForOneYearDotCom }, tld = this.topLevelDomain, sld = this.secondLevelDomain, period = this.registrationPeriodInYears, autorenewflag = 1 }; string transactionID = Guid.NewGuid().ToString(); RegisterDomainsResponse regDomainResp = new RegisterDomainsResponse( wapi.OrderDomains(transactionID, this.credentials, this.shopper, new DomainRegistration[] { domainReg }, null, null)); //int sleep = 100; //DateTime timeout = DateTime.Now.AddMilliseconds(10000); //Availability postAvailability = CheckAvailability(); //while (postAvailability != Availability.NotAvailableForRegistration && DateTime.Now < timeout) //{ // System.Threading.Thread.Sleep(sleep); // postAvailability = CheckAvailability(); //} //if (postAvailability != Availability.NotAvailableForRegistration) //{ // throw new Exception("Domain still available after registration"); //} //PollResponse pollResp = new PollResponse( // wapi.Poll(transactionID, this.credentials, null)); //if (pollResp.ProcessedItems.Count != 1) throw new Exception("transactionID = " + transactionID + ". Poll didn't return expected results: " + pollResp.Xml); //WwdResourceID = pollResp.ProcessedItems[0].ResourceID; }