Example #1
0
 public function testCreateAllowEmpty()
 {
     $code = 200;
     $rawResult = '';
     $response = new Response(array('allow_body_empty' => true));
     $response->create($code, $rawResult);
     $this->assertTrue($response->isOk());
     $this->assertEquals($rawResult, $response->getRawResult());
     $this->assertEquals($rawResult, $response->getResult());
     $this->assertTrue($response->getConfig('allow_body_empty'));
 }
 public function testCreate()
 {
     $code = 200;
     $rawResult = '{"code":0,"message":"","data":[{"projectName":"test1","projectId":1002189,"createTime":"2015-04-28 14:42:53","creatorUin":670569769},{"projectName":"test2","projectId":1002190,"createTime":"2015-04-28 14:42:57","creatorUin":670569769}]}';
     $response = new Response();
     $response->create($code, $rawResult);
     $this->assertEquals('json', $response->getConfig('datatype'));
     $this->assertTrue($response->isOk());
     $this->assertEquals($rawResult, $response->getRawResult());
     $result = $response->getResult();
     $this->assertArrayHasKey('data', $result);
 }
Example #3
0
require_once $LIB_DIR . "response.class.php";
$DomOrder = new DomOrder($LIB_DIR . "wsdl/domain.wsdl");
// Creating an instance of DomOrder by passing wsdl url.
$Customer = new Customer($LIB_DIR . "wsdl/customer.wsdl");
// Creating an instance of DomOrder by passing wsdl url.
// create/get the accounts id:
$return = $Customer->getCustomerId($USERNAME, $PASSWORD, "reseller", "en", $PARENTID, $VAR['ACCT_USER']);
if (is_array($return)) {
    # add account
    $return = $Customer->addCustomer($USERNAME, $PASSWORD, "reseller", "en", $PARENTID, $VAR['ACCT_USER'], $VAR['ACCT_PASS'], $VAR['ACCT_NAME'], $VAR['ACCT_ADDR'], "", "", "", $VAR['ACCT_CITY'], $VAR['ACCT_STATE'], $VAR['ACCT_COUNTRY'], $VAR['ACCT_ZIP'], "01", "8885551212", "01", "8885551212", "01", "8885551212", "en");
}
// Register domain
if (!is_array($return)) {
    $account = $return;
    $return = $DomOrder->registerDomain($USERNAME, $PASSWORD, "reseller", "en", $PARENTID, $domainHash, $nsHash, $account, $account, $account, $account, $account, 'NoInvoice');
}
$response = new Response($return);
// Status
if (@$return['status'] == 'Success') {
    echo 'REGISTER SUCCESS!';
}
// Common Output for all above functions.
print "<BR><b>Output</b><br><br>";
if ($response->isError()) {
    $response->printError();
} else {
    $result = $response->getResult();
    $response->printData($result);
}
?>
 
 /**
  * (non-PHPdoc)
  * @see Response::getResult()
  */
 public function getResult()
 {
     return $this->response->getResult();
 }
 function regDomain()
 {
     $this->error_str = "";
     $this->iserror = false;
     $dom = $this->data['domain'];
     if (!empty($this->data['dom_period'])) {
         $period = $this->data['dom_period'];
         $domain = array($dom => "{$period}");
     } else {
         $domain = array($dom => "1");
     }
     $ns = array("ns1.logicboxes.com", "ns2.logicboxes.com");
     if (($this->MODE == "live_http" || $this->MODE == "live_https") && !empty($this->data['ns1']) && !empty($this->data['ns1'])) {
         $ns = array($this->data['ns1'], $this->data['ns2']);
     }
     $DomOrder = new DomOrder(LIBRARIES . "directi" . PATH_SEP . "wsdl" . PATH_SEP . "domain.wsdl");
     $return = $DomOrder->registerDomain($this->USERNAME, $this->PASSWORD, $this->ROLE, $this->LANGPREF, $this->PARENTID, $domain, $ns, $this->contact, $this->contact, $this->contact, $this->contact, $this->account, "NoInvoice");
     $response = new Response($return);
     $domaindata = $response->getResult();
     $data_array = $domaindata[$dom];
     if ($data_array['status'] == "error") {
         $this->error_str = $data_array['error'];
         $this->iserror = true;
         return;
     } else {
         $this->entityid = $data_array['entityid'];
     }
     $this->data_array = $data_array;
     if (empty($this->entityid)) {
         $this->error_str = "An unknown error occurred while registering domain!";
         $this->iserror = true;
     }
     return;
 }
 public function testsetResponseDataNegativeResult()
 {
     $response = new Response();
     $response->setResponseData('{"result":false}');
     $this->assertFalse($response->getResult());
 }