コード例 #1
0
		protected InvoiceItem GetDomainSvcSetupFee(DomainNameSvc service)
		{
			InvoiceItem line = new InvoiceItem();

			line.ItemName = service.ServiceName;
			line.Quantity = 1;
			line.UnitPrice = service.SetupFee;
			line.TypeName = "Setup Fee";

			return line;
		}
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        public int UpdateServiceInfo(Service serviceInfo)
        {
            DomainNameSvc domainSvc = (DomainNameSvc)serviceInfo;
            // serialize props & values
            string propertyNames  = null;
            string propertyValues = null;

            SecurityUtils.SerializeGenericProfile(ref propertyNames, ref propertyValues, domainSvc);
            // update svc
            return(EcommerceProvider.UpdateDomainNameSvc(SecurityContext.User.UserId, domainSvc.ServiceId,
                                                         domainSvc.ProductId, (int)domainSvc.Status, domainSvc.DomainId, domainSvc.Fqdn,
                                                         propertyNames, propertyValues));
        }
コード例 #4
0
        private void RollbackOperation(int domainId)
        {
            if (domainId < 1)
            {
                return;
            }

            try
            {
                // restore
                DomainNameSvc domainSvc = (DomainNameSvc)RestoreObjectState(SERVICE_INFO);

                int apiResult = 0;

                switch (domainSvc.Status)
                {
                // Service
                case ServiceStatus.Ordered:
                    apiResult = ServerController.DeleteDomain(domainId);
                    break;
                }

                // check API result
                if (apiResult < 0)
                {
                    // LOG ERROR
                    TaskManager.WriteError(ERROR_ROLLBACK_DOM_MSG);
                    TaskManager.WriteParameter(RESULT_CODE_PARAM, apiResult);
                }

                // rollback service changes in EC metabase
                apiResult = UpdateServiceInfo(domainSvc);
                // check API result
                if (apiResult < 0)
                {
                    // LOG ERROR
                    TaskManager.WriteError(ERROR_ROLLBACK_SVC_MSG);
                    TaskManager.WriteParameter(RESULT_CODE_PARAM, apiResult);
                    // EXIT
                    return;
                }
                //
                TaskManager.Write(ROLLBACK_SUCCEED_MSG);
            }
            catch (Exception ex)
            {
                TaskManager.WriteError(ex);
            }
        }
コード例 #5
0
        public GenericSvcResult CancelService(ProvisioningContext context)
        {
            GenericSvcResult result = new GenericSvcResult();

            //
            result.Succeed = true;
            //
            DomainNameSvc service = (DomainNameSvc)context.ServiceInfo;

            service.Status = ServiceStatus.Cancelled;
            //
            UpdateServiceInfo(service);
            //
            SetOutboundParameters(context);
            //
            return(result);
        }
コード例 #6
0
        public InvoiceItem[] CalculateInvoiceLines(int serviceId)
        {
            List <InvoiceItem> lines = new List <InvoiceItem>();
            //
            DomainNameSvc domainSvc = GetDomainNameSvc(serviceId);

            //
            if (domainSvc["SPF_ACTION"] != DomainNameSvc.SPF_UPDATE_NS_ACTION)
            {
                // domain svc fee
                lines.Add(GetDomainSvcFee(domainSvc));
                // setup fee
                if (domainSvc.SetupFee > 0M && domainSvc.Status == ServiceStatus.Ordered)
                {
                    lines.Add(GetDomainSvcSetupFee(domainSvc));
                }
            }
            //
            return(lines.ToArray());
        }
コード例 #7
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;
            }
        }
コード例 #8
0
		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;
			}
		}
コード例 #9
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;
			}
		}
コード例 #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 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"];
		}
コード例 #12
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);
		}
コード例 #13
0
		public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
		{
			domainSvc["OrderID"] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + domainSvc.Fqdn;
		}
コード例 #14
0
        public GenericSvcResult ActivateService(ProvisioningContext context)
        {
            GenericSvcResult result = new GenericSvcResult();

            // remeber svc state
            SaveObjectState(SERVICE_INFO, context.ServiceInfo);

            // concretize service to be provisioned
            DomainNameSvc domainSvc = (DomainNameSvc)context.ServiceInfo;
            // concretize parent service
            HostingPackageSvc packageSvc = (HostingPackageSvc)context.ParentSvcInfo;

            try
            {
                // LOG INFO
                TaskManager.StartTask(SystemTasks.SOURCE_ECOMMERCE, SystemTasks.SVC_ACTIVATE);
                TaskManager.WriteParameter(CONTRACT_PARAM, domainSvc.ContractId);
                TaskManager.WriteParameter(SVC_PARAM, domainSvc.ServiceName);
                TaskManager.WriteParameter(SVC_ID_PARAM, domainSvc.ServiceId);

                // 0. Do security checks
                if (!CheckOperationClientPermissions(result))
                {
                    // LOG ERROR
                    TaskManager.WriteError(ERROR_CLIENT_OPERATION_PERMISSIONS);
                    TaskManager.WriteParameter(RESULT_CODE_PARAM, result.ResultCode);
                    // EXIT
                    return(result);
                }
                //
                if (!CheckOperationClientStatus(result))
                {
                    // LOG ERROR
                    TaskManager.WriteError(ERROR_CLIENT_OPERATION_STATUS);
                    TaskManager.WriteParameter(RESULT_CODE_PARAM, result.ResultCode);
                    // EXIT
                    return(result);
                }

                // error: hosting addon should have parent svc assigned
                if (packageSvc == null || packageSvc.PackageId == 0)
                {
                    result.Succeed = false;
                    //
                    result.Error = PARENT_SVC_NOT_FOUND_MSG;
                    //
                    result.ResultCode = EcommerceErrorCodes.ERROR_PARENT_SVC_NOT_FOUND;

                    // LOG ERROR
                    TaskManager.WriteError(result.Error);
                    TaskManager.WriteParameter(RESULT_CODE_PARAM, result.ResultCode);

                    // EXIT
                    return(result);
                }

                // first of all - create internal domain in WebsitePanel
                if (domainSvc.Status == ServiceStatus.Ordered)
                {
                    // create domain info object
                    DomainInfo domain = ServerController.GetDomain(domainSvc.Fqdn);
                    //
                    if (domain != null)
                    {
                        domainSvc.DomainId = domain.DomainId;
                    }
                    //
                    if (domain == null)
                    {
                        domain                = new DomainInfo();
                        domain.DomainName     = domainSvc.Fqdn;
                        domain.HostingAllowed = false;
                        domain.PackageId      = packageSvc.PackageId;
                        // add internal domain
                        domainSvc.DomainId = ServerController.AddDomain(domain);
                        // check API result
                        if (domainSvc.DomainId < 1)
                        {
                            // ASSEMBLE ERROR
                            result.Succeed = false;
                            // try to find corresponding error code->error message mapping
                            if (ApiErrorCodesMap.ContainsKey(domainSvc.DomainId))
                            {
                                result.Error = ApiErrorCodesMap[domainSvc.DomainId];
                            }
                            else
                            {
                                result.Error = ERROR_ADD_INTERNAL_DOMAIN;
                            }
                            // copy result code
                            result.ResultCode = domainSvc.DomainId;

                            // LOG ERROR
                            TaskManager.WriteError(result.Error);
                            TaskManager.WriteParameter(RESULT_CODE_PARAM, result.ResultCode);

                            // EXIT
                            return(result);
                        }
                    }
                }

                // update nameservers only
                if (domainSvc["SPF_ACTION"] == "UPDATE_NS")
                {
                    // remove service here...
                    ServiceController.DeleteCustomerService(domainSvc.ServiceId);
                    //
                    result.Succeed = true;
                    // EXIT
                    return(result);
                }

                // load registrar wrapper
                IDomainRegistrar registrar = (IDomainRegistrar)SystemPluginController.GetSystemPluginInstance(
                    domainSvc.ContractId, domainSvc.PluginId, true);

                #region Commented operations
                // prepare consumer account information

                /*CommandParams cmdParams = PrepeareAccountParams(context.ConsumerInfo);
                 * // copy svc properties
                 * foreach (string keyName in domainSvc.GetAllKeys())
                 *      cmdParams[keyName] = domainSvc[keyName];
                 *
                 * // check registrar requires sub-account to be created
                 * if (registrar.SubAccountRequired)
                 * {
                 *      // 1. Load user's settings
                 *      UserSettings userSettings = LoadUserSettings(context.ConsumerInfo.UserId, registrar.PluginName);
                 *      // 2. Ensure user has account on registrar's side
                 *      if (userSettings.SettingsArray == null || userSettings.SettingsArray.Length == 0)
                 *      {
                 *              // 3. Check account exists
                 *              bool exists = registrar.CheckSubAccountExists(context.ConsumerInfo.Username, context.ConsumerInfo.Email);
                 *              //
                 *              AccountResult accResult = null;
                 *              //
                 *              if (!exists)
                 *              {
                 *                      // 4. Create user account
                 *                      accResult = registrar.CreateSubAccount(cmdParams);
                 *                      // copy keys & values
                 *                      foreach (string keyName in accResult.AllKeys)
                 *                      {
                 *                              userSettings[keyName] = accResult[keyName];
                 *                      }
                 *              }
                 *              else
                 *              {
                 *                      // 4a. Get sub-account info
                 *                      accResult = registrar.GetSubAccount(context.ConsumerInfo.Username,
                 *                              context.ConsumerInfo.Email);
                 *                      //
                 *                      foreach (string keyName in accResult.AllKeys)
                 *                              userSettings[keyName] = accResult[keyName];
                 *              }
                 *              // 5. Update user settings
                 *              int apiResult = UserController.UpdateUserSettings(userSettings);
                 *              // check API result
                 *              if (apiResult < 0)
                 *              {
                 *                      // BUILD ERROR
                 *                      result.Error = ERROR_UPDATE_USR_SETTINGS_MSG;
                 *                      result.Succeed = false;
                 *                      result.ResultCode = apiResult;
                 *                      // LOG ERROR
                 *                      TaskManager.WriteError(result.Error);
                 *                      TaskManager.WriteParameter(RESULT_CODE_PARAM, result.ResultCode);
                 *                      // ROLLBACK
                 *                      RollbackOperation(domainSvc.DomainId);
                 *                      // EXIT
                 *                      return result;
                 *              }
                 *      }
                 *      // copy registrar-specific data
                 *      foreach (string[] pair in userSettings.SettingsArray)
                 *      {
                 *              // copy 2
                 *              cmdParams[pair[0]] = pair[1];
                 *      }
                 * }*/
                #endregion

                // load NS settings
                PackageSettings nsSettings = PackageController.GetPackageSettings(packageSvc.PackageId, PackageSettings.NAME_SERVERS);
                // build name servers array
                string[] nameServers = null;
                if (!String.IsNullOrEmpty(nsSettings[PackageSettings.NAME_SERVERS]))
                {
                    nameServers = nsSettings[PackageSettings.NAME_SERVERS].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                }

                // register or renew domain
                if (domainSvc.Status == ServiceStatus.Ordered)
                {
                    // try to register domain
                    registrar.RegisterDomain(domainSvc, context.ConsumerInfo, nameServers);
                }
                else
                {
                    // try to renew domain
                    registrar.RenewDomain(domainSvc, context.ConsumerInfo, nameServers);
                }

                // change svc status to active
                domainSvc.Status = ServiceStatus.Active;
                // update service info
                int updResult = UpdateServiceInfo(domainSvc);
                // check update result for errors
                if (updResult < 0)
                {
                    // BUILD ERROR
                    result.ResultCode = updResult;
                    result.Succeed    = false;
                    result.Error      = ERROR_SVC_UPDATE_MSG;
                    // LOG ERROR
                    TaskManager.WriteError(result.Error);
                    TaskManager.WriteParameter(RESULT_CODE_PARAM, result.ResultCode);
                    // ROLLBACK
                    RollbackOperation(domainSvc.DomainId);
                    // EXIT
                    return(result);
                }
                //
                result.Succeed = true;
                //
                SetOutboundParameters(context);
            }
            catch (Exception ex)
            {
                // LOG ERROR
                TaskManager.WriteError(ex);
                result.Succeed = false;
                // ROLLBACK
                RollbackOperation(result.ResultCode);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
            //
            return(result);
        }
コード例 #15
0
		protected InvoiceItem GetDomainSvcFee(DomainNameSvc service)
		{
			InvoiceItem line = new InvoiceItem();

			line.ItemName = service.ServiceName;
			line.ServiceId = service.ServiceId;
			line.Quantity = 1;
			line.UnitPrice = service.RecurringFee;
			// define line type
			if (service.Status != ServiceStatus.Ordered)
			{
				line.TypeName = "Recurring Fee";
			}
			else
			{
				switch (service["SPF_ACTION"])
				{
					case DomainNameSvc.SPF_TRANSFER_ACTION:
						line.TypeName = String.Concat(Product.TOP_LEVEL_DOMAIN_NAME, " Transfer");
						break;
					case DomainNameSvc.SPF_REGISTER_ACTION:
						line.TypeName = String.Concat(Product.TOP_LEVEL_DOMAIN_NAME, " Registration");
						break;
				}
			}

			return line;
		}
コード例 #16
0
 public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
 {
     domainSvc["OrderID"] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + domainSvc.Fqdn;
 }