public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { int customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]); // setup service url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init domain order api OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder(); // Get all domain name registration details Hashtable domainDetails = domOrder.getDetailsByDomain(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainSvc.Fqdn, new ArrayList { "All" }); // fill parameters hashtable Hashtable domainHash = new Hashtable { { domainSvc.Fqdn, new Hashtable { { ENTITY_ID, domainDetails[ENTITY_ID] }, { NO_OF_YEARS, domainSvc.PeriodLength.ToString() }, { EXPIRY_DATE, domainDetails[ENDTIME] } } } }; // Send renewal request to the registrar Hashtable orderResult = domOrder.renewDomain(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, NO_INVOICE); // switch to the nested data bunch of the result received 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 LoadServiceInfo(int serviceId) { EnsureChildControls(); try { // load domain name svc DomainNameSvc domainSvc = StorehouseHelper.GetDomainNameService(serviceId); if (domainSvc == null) { RedirectToBrowsePage(); } // ecUtils.ToggleControls(PanelSecurity.LoggedUser.Role != UserRole.User, pnlDomainOrder, pnlUsername); // ltrServiceName.Text = domainSvc.ServiceName; ltrUsername.Text = domainSvc.Username; ltrServiceTypeName.Text = ecPanelFormatter.GetSvcItemTypeName(domainSvc.TypeId); ltrSvcCycleName.Text = domainSvc.CycleName; ltrSvcCyclePeriod.Text = String.Concat(domainSvc.PeriodLength, " ", domainSvc.BillingPeriod, "(s)"); ltrSvcSetupFee.Text = String.Concat(domainSvc.Currency, " ", domainSvc.SetupFee.ToString("C")); ltrSvcRecurringFee.Text = String.Concat(domainSvc.Currency, " ", domainSvc.RecurringFee.ToString("C")); ltrSvcCreated.Text = domainSvc.Created.ToString(); ltrServiceStatus.Text = ecPanelFormatter.GetServiceStatusName(domainSvc.Status); // if (pnlDomainOrder.Visible) { //ltrSvcRegOrderId.Text = domainSvc.RegOrderId; ltrSvcProviderName.Text = domainSvc.ProviderName; } } catch (Exception ex) { HostModule.ShowErrorMessage("LOAD_DOMAIN_NAME_SVC", ex); return(false); } return(true); }
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) { 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); }
public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { domainSvc["OrderID"] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + domainSvc.Fqdn; }