This commit is contained in:
Aram HARUTYUNYAN 2014-02-12 09:01:16 +00:00
parent e6daa879e8
commit 22f286be65

View File

@ -75,7 +75,7 @@ class WsWorldCheck
* The initial request of Worldcheck to get nameIdentifier.
* nameType available values: 'INDIVIDUAL', 'ORGANISATION'
* @param object $data
* @return NameIdentifier (Unique for each request, begins with so_n_)
* @return nameIdentifier (Unique for each request, begins with so_n_)
*/
public function getScreener($data)
{
@ -136,8 +136,91 @@ class WsWorldCheck
$nameType = strtolower($params->nameType);
$param->matchIdentifier = $params->matchIdentifier;
try {
if ($nameType=='individual') return $client->getDetails($param)->return->entitySet->entities->individual;
else return $client->getDetails($param)->return->entitySet->entities->organisation;
return $client->getDetails($param)->return->entitySet->entities->$nameType;
} catch (SoapFault $fault) {
if ($fault->faultcode){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
return false;
}
}
}
/**
* get branch of associates - tree
* @param object: matchIdentifier, nameType
* @return object content
*/
public function getBranchTree($params)
{
$client = $this->loadClientWC('content');
$param = new stdClass();
$nameType = strtolower($params->nameType);
$param->matchIdentifier = $params->matchIdentifier;
try {
return $client->getDetails($param)->return->entitySet->entities->$nameType;
} catch (SoapFault $fault) {
if ($fault->faultcode){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
return false;
}
}
}
/**
* getAssociates
* @param object: matchIdentifier, nameType
* @return array
*/
public function getAssociates($params)
{
$client = $this->loadClientWC('content');
$param = new stdClass();
$nameType = strtolower($params->nameType);
$param->matchIdentifier = $params->matchIdentifier;
$primary = array();
$associates = array();
try {
$response = $client->getDetails($param)->return->entitySet->entities;
if ($nameType=='individual') {
$prim = $response->individual[0];
} else {
$prim = $response->organisation[0];
}
$primary['entityId'] = $prim->entityId;
$primary['nameType'] = strtoupper($nameType);
$primary['category'] = $prim->category;
$primary['fullName'] = $prim->names->name[0]->fullName;
$primary['givenName'] = $prim->names->name[0]->givenName;
$primary['lastName'] = $prim->names->name[0]->lastName;
$primary['biography'] = $prim->details->detail[0]->text;
$primary['identification'] = $prim->details->detail[1]->text;
$assoc = $prim->associates;
foreach ($assoc->associate as $associate)
{
$assoc = array();
$assoc['entityId'] = $associate->targetEntity->entityId;
$assoc['nameType'] = ($associate->associatetype=='ASSOCIATE')?'INDIVIDUAL':'ORGANISATION';
$assoc['category'] = $associate->targetEntity->category;
$assoc['fullName'] = $associate->targetEntity->names->name[0]->fullName;
$assoc['givenName'] = $associate->targetEntity->names->name[0]->givenName;
$assoc['lastName'] = $associate->targetEntity->names->name[0]->lastName;
$assoc['biography'] = $associate->targetEntity->details->detail[0]->text;
$assoc['identification'] = $associate->targetEntity->details->detail[1]->text;
$associates[] = $assoc;
}
$output = array('primary' => $primary, 'associates' => $associates);
return $output;
} catch (SoapFault $fault) {
if ($fault->faultcode){
return $fault->faultstring;
@ -197,6 +280,7 @@ class WsWorldCheck
{
$key = $summary->entityId->entityId;
$shortData = new stdClass();
$shortData->fullName = $summary->names->name[0]->fullName;
$shortData->givenName = $summary->names->name[0]->givenName;
$shortData->lastName = $summary->names->name[0]->lastName;
$shortData->description = $summary->groups->group[0]->details->detail[0]->description;
@ -300,8 +384,14 @@ class WsWorldCheck
$client = $this->loadClientWC('content');
$param = new stdClass();
$param->matchIdentifier = $matchIdentifier;
$usefulData = new stdClass();
try {
return $client->getTitlesForMatch($param)->return;
$output = $client->getTitlesForMatch($param)->return->contentTitles->contentTitle[0];
$usefulData->entityId = $output->entityId;
$usefulData->lastName = $output->names->name[0]->lastName;
$usefulData->givenName = $output->names->name[0]->givenName;
return $usefulData;
} catch (SoapFault $fault) {
if ($fault->faultcode){
return $fault->faultstring;