79 lines
2.4 KiB
PHP
79 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* Gestion des header et de préparation au WSGiant.
|
|
* Ne rien modifier directement ici ! configurer les Confih.php !!
|
|
*
|
|
* Sauf pour rajouter de nouvelle méthodes que propose Giant !
|
|
*/
|
|
require_once ('Config.php');
|
|
|
|
|
|
/**
|
|
* Inclus les fichier wsdls utilisable.
|
|
* @param $service Services utilisant le bon WSDL.
|
|
*/
|
|
function searchService($service)
|
|
{
|
|
if (GIANT_MODETEST){
|
|
$url = 'https://giant-tst.graydon.nl';
|
|
} else {
|
|
$url = 'https://services.giant-net.com';
|
|
}
|
|
$servicesGiant = array(
|
|
'OrderDataSet' => $url.'/credit-data/v1?wsdl',
|
|
'RetrieveDataSet' => $url.'/credit-data/v1?wsdl',
|
|
'RetrieveOrderStatus' => $url.'/credit-data/v1?wsdl',
|
|
'RetrieveOptions' => $url.'/credit-data/v1?wsdl',
|
|
'AdvancedSearch' => $url.'/search/v1?wsdl',
|
|
'Search' => $url.'/search/v1?wsdl',
|
|
'StartInvestigation' => $url.'/credit-data/v1?wsdl',
|
|
'credit-data' => $url.'/credit-data/v1?wsdl',
|
|
'Ping' => $url.'/credit-data/v1?wsdl'
|
|
);
|
|
return ($servicesGiant[$service]);
|
|
}
|
|
|
|
function BuiltHeaders($pays)
|
|
{
|
|
$service_header = new StdClass;
|
|
$service_header->ConsumerId = GIANT_CREDIT_USER;
|
|
$service_header->CustomerId = $_SESSION['tabInfo']['login'];
|
|
|
|
$service_header->Provider = new StdClass;
|
|
$service_header->Provider->CountryCode = $pays;
|
|
$service_header->Provider->ProviderId = getProviderId($pays);
|
|
$service_header->TimeStamp = date('Y-m-d\TH:i:s');
|
|
$service_header->TestIndication = false;
|
|
|
|
$soap_header =
|
|
new SoapHeader('http://services.giant-net.com/schema/services/shared/1.0',
|
|
'ServiceHeader', $service_header
|
|
);
|
|
return ($soap_header);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param $pays Code Pays
|
|
* @param $service Service demandé a Giant
|
|
*/
|
|
|
|
function getClient($pays, $service, $features = false)
|
|
{
|
|
$soap_header = BuiltHeaders($pays);
|
|
$soap_client =
|
|
new SoapClient(searchService($service),
|
|
array('soap_version' => SOAP_1_1,
|
|
'login' => GIANT_SEARCH_USER,
|
|
'password' => GIANT_SEARCH_PASS,
|
|
'trace' => true,
|
|
'features' => $features));
|
|
try {
|
|
$soap_client->__setSoapHeaders($soap_header);
|
|
} catch (SoapFault $faild) {
|
|
var_dump($faild);
|
|
}
|
|
|
|
return ($soap_client);
|
|
}
|
|
?>
|