Вход Регистрация
Файл: billing/_rootinc/estdomains.inc.php
Строк: 290
<?

define
('C_SERVICE_URL', 'https://www.foundationapi.com/anacreon/servlet/APIv3');    #live url
#define('C_SERVICE_URL', 'http://api.onlyfordemo.net/anacreon/servlet/APIv3');        #demo url

require_once($full_home_path."/_rootinc/estdomains/nusoap.php");
require_once(
$full_home_path."/_rootinc/estdomains/apiutil.php");
require_once(
$full_home_path."/_rootinc/estdomains/error.class.php");
require_once(
$full_home_path."/_rootinc/estdomains/response.class.php");
require_once(
$full_home_path."/_rootinc/estdomains/Customer.class.php");
require_once(
$full_home_path."/_rootinc/estdomains/DomContact.class.php");
require_once(
$full_home_path."/_rootinc/estdomains/DomOrder.class.php");

class 
ESTDOMAINS
{
    public 
$controller = true;

    public 
$role = "reseller";
    public 
$langpref = "ru";

    public 
$user=null;
    public 
$password = null;
    public 
$parentid = null;
    public 
$wsdlpath = null;

    public 
$error = null;
    public 
$fp=null;

    
/*
     * initialization
     */
    
public function startup(&$controller)
    {
        
$this->controller =& $controller;
    }

    
/*
     * initialization
     */
    
public function init($user,$password,$parentid,$wsdlpath)
    {
        
$this->user=$user;
        
$this->password=$password;
        
$this->parentid=$parentid;
        
$this->wsdlpath=$wsdlpath;
    }

    public function 
signUp($userName, $passwd, $name, $company, $address1, $address2, $address3, $city, $stateName, $country, $zip, $telNoCc, $telNo, $altTelNoCc, $altTelNo, $faxNoCc, $faxNo, $langPref, $mobileNoCc, $mobileNo)
    {
        
$serviceObj = new Customer($this->wsdlpath."Customer.wsdl");
        
$returnValue = $serviceObj->signUp($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $userName, $passwd, $name, $company, $address1, $address2, $address3, $city, $stateName, $country, $zip, $telNoCc, $telNo, $altTelNoCc, $altTelNo, $faxNoCc, $faxNo, $langPref, $mobileNoCc, $mobileNo);

        
$response = new Response($returnValue);
        if (
$response->isError()) {
            
$errorObj = $response->getErrorObj();
            
$this->error = "signUp Error: ".$errorObj->errorMsg;
            return 
false;
            break;
        } else    {
            
$customerId = $response->getResult();
            
$this->error = "";
            return 
$customerId;
            break;
        }
    }

    public function 
addDefaultContacts($customerId,$type)
    {
        
$types = array($type);

        
$serviceObj = new DomContact($this->wsdlpath."DomContact.wsdl");
        
$returnValue = $serviceObj->addDefaultContacts($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $customerId, $types);

        
$response = new Response($returnValue);
        if (
$response->isError()) {
            
$errorObj = $response->getErrorObj();
            
$this->error = "addDefaultContacts Error: ".$errorObj->errorMsg;
            return 
false;
            break;
        } else    {
            
$contactId = $response->getResult();
            
$this->error = "";
            return 
$contactId[$type];
            break;
        }
    }

    public function 
registerDomain($domain, $period, $contactId, $ns1, $ns2, $ns3, $ns4, $customerId, $invoiceOption, $enablePrivacyProtection)
    {
        
$domainhash=array("$domain"=>$period);

        if (
preg_match("/.uk$/ui",$domain) or preg_match("/.eu$/ui",$domain)) {
            
$contacthash=array('registrantcontactid'=>$contactId);
        } else {
            
$contacthash=array('registrantcontactid'=>$contactId,'admincontactid'=>$contactId,'technicalcontactid'=>$contactId,'billingcontactid'=>$contactId);
        }

        
$temp['domainhash']=$domainhash; $temp['contacthash']=$contacthash; $addParamList[] = $temp;
        
$nameServersList = array("$ns1","$ns2","$ns3","$ns4");
        
$validate = true;
        
$extraInfo = array();

        
$serviceObj = new DomOrder($this->wsdlpath."DomOrder.wsdl");
        
$returnValue = $serviceObj->registerDomain($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $addParamList, $nameServersList, $customerId, $invoiceOption, $enablePrivacyProtection, $validate, $extraInfo);

        if (
$returnValue[$domain]["status"] == "error") {
            
$this->error = "registerDomain Error: ".$returnValue[$domain]["error"];
            return 
false;
            break;
        } else if (
$returnValue[$domain]["status"] == "InvoicePaid" or $returnValue[$domain]["status"] == "Success") {
            
$this->error = "";
            return 
$returnValue[$domain][entityid];
            break;
        } else {
            
$this->error = "registerDomain Error: Unknown error";
            return 
false;
            break;
        }

    }

    public function 
renewDomain($domain, $orderId, $period, $invoiceOption)
    {
        
$serviceObj = new DomOrder($this->wsdlpath."DomOrder.wsdl");
        
$returnValue = $serviceObj->getDetailsByDomain($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $domain, array(0 => "OrderDetails"));
        
$endtime = $returnValue[endtime];

        if (
$endtime) {
            
$domainHash[$domain]["entityid"] = "$orderId";
            
$domainHash[$domain]["noofyears"] = "$period";
            
$domainHash[$domain]["expirydate"] = "$endtime";

            
$returnValue = $serviceObj->renewDomain($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $domainHash, $invoiceOption);

            
$response = new Response($returnValue);
            if(
$response->isError()) {
                
$errorObj = $response->getErrorObj();
                
$this->error = "renewDomain error: ".$errorObj->errorMsg;
                return 
false;
                break;
            } else {
                
$this->error = "";
                return 
true;
                break;
            }
        } else {
            
$this->error = "renewDomain Error: Can't get domain endtime";
            return 
false;
            break;
        }
    }

    public function 
getNS($domain)
    {
        
$serviceObj = new DomOrder($this->wsdlpath."DomOrder.wsdl");
        
$returnValue = $serviceObj->getDetailsByDomain($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $domain, array(0 => "NsDetails"));

        
$response = new Response($returnValue);
        if(
$response->isError()) {
            
$errorObj = $response->getErrorObj();
            
$this->error = "getNS error: ".$errorObj->errorMsg;
            return 
false;
            break;
        } else {
            
$this->error = "";
            return array(
0 => $returnValue[ns1], 1 => $returnValue[ns2], 2 => $returnValue[ns3], 3 => $returnValue[ns4]);
            break;
        }
    }

    public function 
updateNS($orderId, $ns1, $ns2, $ns3, $ns4)
    {
        
$nsHash["ns1"] = $ns1;
        
$nsHash["ns2"] = $ns2;
        if (
$ns3) {$nsHash["ns3"] = $ns3;}
        if (
$ns4) {$nsHash["ns4"] = $ns4;}

        
$serviceObj = new DomOrder($this->wsdlpath."DomOrder.wsdl");
        
$returnValue = $serviceObj->modifyNameServer($this->user, $this->password, $this->role, $this->langpref, $this->parentid, $orderId, $nsHash);

        
$response = new Response($returnValue);
        if(
$response->isError()) {
            
$errorObj = $response->getErrorObj();
            
$this->error = "updateNS error: ".$errorObj->errorMsg;
            return 
false;
            break;
        } else {
            
$this->error = "";
            return 
true;
            break;
        }
    }

}
?>
Онлайн: 2
Реклама