2011-04-11 12:31:46 +00:00
|
|
|
|
<?php
|
|
|
|
|
Class SOAPCatchError
|
|
|
|
|
{
|
|
|
|
|
private $MessageUtilisateur;
|
|
|
|
|
|
|
|
|
|
private $tabType = array('CommonPlatform', 'Provider');
|
|
|
|
|
|
|
|
|
|
private $CommonPlatform = array(
|
|
|
|
|
'1000' => array('Functional'=> 'Authentication failed <details>'),
|
|
|
|
|
'1001' => array('Functional'=> 'Invalid Provider supplied <ProviderId>.'),
|
|
|
|
|
'1002' => array('Functional'=> 'Impersonation detected. <ConsumerId> tries to impersonate <AnotherPartner>.'),
|
|
|
|
|
'1005' => array('Functional'=> 'Failed to validate message. Reason <details>.'),
|
|
|
|
|
'1010' => array('Functional'=> 'Invalid Provider/Country combination.'),
|
|
|
|
|
'1015' => array('Functional'=> 'Provider <ProviderId> cannot be used in combination with other providers.'),
|
|
|
|
|
'1020' => array('Functional'=> 'Invalid Consumer supplied <ConsumerId>'),
|
|
|
|
|
'3100' => array('Functional'=> 'Unable to lookup order. No InternalOrderId supplied.'),
|
|
|
|
|
'3101' => array('Functional'=> 'Unable to lookup order. Invalid InternalOrderId <InternalOrderId> supplied.'),
|
|
|
|
|
'3110' => array('Functional'=> 'Your query returns more than <x> records. Please specify your query.'),
|
|
|
|
|
'4000' => array('Functional'=> 'Invalid ProviderOrderId <ProviderOrderId>.'),
|
|
|
|
|
'4001' => array('Functional'=> 'Duplicate ProviderEventId <ProviderEventId>.'),
|
|
|
|
|
'4002' => array('Functional'=> 'Invalid NumberOfEvents <NumberOfEvents>.'),
|
|
|
|
|
'6000' => array('Functional'=> 'Error connecting to search component.'),
|
|
|
|
|
'6099' => array('Functional'=> 'Unexpected exception.'),
|
|
|
|
|
'7000' => array('Functional'=> 'Could not connect to <ProviderId>'),
|
|
|
|
|
'7099' => array('Functional'=> 'Unexpected exception.'),
|
|
|
|
|
'8000' => array('Functional'=> 'Problem connecting to database.'),
|
|
|
|
|
'8010' => array('Functional'=> 'Configuration exception <details>.'),
|
|
|
|
|
'8090' => array('Functional'=> 'Internal exception during search <details>.'),
|
|
|
|
|
'8099' => array('Functional'=> 'Unexpected exception <details>.')
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
private $Provider = array(
|
|
|
|
|
'1003' => array('Functional'=> 'Authorization failed.'),
|
|
|
|
|
'3000' => array('Functional'=> 'Invalid CompanyId <CompanyId>'),
|
|
|
|
|
'3001' => array('Functional'=> 'Invalid Version <version> requested.'),
|
|
|
|
|
'3002' => array('Functional'=> 'Invalid LanguageCode <languageCode> requested.'),
|
|
|
|
|
'3003' => array('Functional'=> 'Invalid DataSetType <dataSetType> requested.'),
|
|
|
|
|
'3004' => array('Functional'=> 'Invalid ServiceLevel <serviceLevel> requested.'),
|
|
|
|
|
'3005' => array('Functional'=> 'Invalid CategoryName <categoryName> requested'),
|
|
|
|
|
'3006' => array('Functional'=> 'Invalid EventType <eventType> requested.'),
|
|
|
|
|
'3007' => array('Functional'=> 'Invalid Date format.'),
|
|
|
|
|
'3020' => array('Functional'=> 'Invalid OrderId <OrderId>.'),
|
|
|
|
|
'3021' => array('Functional'=> 'Invalid OrderId / Consumer combination.'),
|
|
|
|
|
'3022' => array('Functional'=> 'Invalid OrderType.'),
|
|
|
|
|
'3023' => array('Functional'=> 'Can’t retrieve dataset. Invalid Order Status <OrderStatus>.'),
|
|
|
|
|
'5xxx' => array('Functional'=> 'Provider specific functional errorCodes.'),
|
|
|
|
|
'9xxx' => array('Functional'=> 'Provider specific technical errorCodes.')
|
|
|
|
|
);
|
|
|
|
|
|
2011-04-11 15:45:43 +00:00
|
|
|
|
function __construct() {
|
2011-04-13 12:48:49 +00:00
|
|
|
|
|
2011-04-11 15:45:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:31:46 +00:00
|
|
|
|
private function selectErreurInTab($SoapObj) {
|
|
|
|
|
foreach ($this->tabType as $champ)
|
|
|
|
|
{
|
|
|
|
|
foreach($this->$champ as $chmp => $valeur) {
|
|
|
|
|
if ($chmp == $SoapObj->ErrorCode)
|
|
|
|
|
$this->MessageUtilisateur = date('d/m/Y à h:i:s').' ['.$chmp.'] '.$valeur['Functional']."\r\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (date('dmY-h:i:s').' ['.$SoapObj->ErrorCode.'] '.$SoapObj->ErrorMessage."\r\n");
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-13 12:48:49 +00:00
|
|
|
|
public function _getFormIssuts($soap) {
|
|
|
|
|
$postField = array();
|
|
|
|
|
|
|
|
|
|
require_once ('giant/templates/SoapFormIssue.tpl.php');
|
|
|
|
|
if(isset($_POST['send']))
|
|
|
|
|
{
|
|
|
|
|
if ($_POST['send'])
|
2011-04-11 12:31:46 +00:00
|
|
|
|
{
|
2011-04-13 12:48:49 +00:00
|
|
|
|
echo 'Formulaire...';
|
|
|
|
|
$postField['issue[subject]'] = 'Error SOAP';
|
|
|
|
|
$postField['issue[description]'] = $_POST['GetLastRequest'];
|
|
|
|
|
$postField['issue[description]'] .= $_POST['GetLastResponse'];
|
|
|
|
|
$postField['issue[description]'] .= $_POST['Error'];
|
|
|
|
|
$urlFormIssue = 'https://www.giant-net.com/projects/gnl/issues/new';
|
|
|
|
|
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
|
|
|
|
$referer = $urlFormIssue;
|
|
|
|
|
|
|
|
|
|
$curl = curl_init($urlFormIssue);
|
|
|
|
|
if (preg_match('`^https://`i', $urlFormIssue)) {
|
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
|
|
}
|
|
|
|
|
curl_setopt($curl, CURLOPT_PORT, 1);
|
|
|
|
|
if(curl_setopt($curl, CURLOPT_POSTFIELDS, $postField))
|
|
|
|
|
echo 'réussit !';
|
|
|
|
|
curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
|
|
|
|
|
curl_setopt($curl, CURLOPT_REFERER, $referer);
|
|
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
|
$result = curl_exec($curl);
|
|
|
|
|
curl_close($curl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo $result;
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function _printInLogs($SoapObj, $soapClient = null) {
|
2011-04-14 14:24:35 +00:00
|
|
|
|
$content = null;
|
|
|
|
|
|
2011-04-13 12:48:49 +00:00
|
|
|
|
if (isset($SoapObj)) {
|
|
|
|
|
$erreur = self::selectErreurInTab($SoapObj->TechnicalException);
|
|
|
|
|
if ($erreur) {
|
|
|
|
|
if (file_put_contents(_LOGS_PROVIDER_.'/logs.txt', $content.$erreur, FILE_APPEND)) {
|
2011-04-11 12:31:46 +00:00
|
|
|
|
self::sendMailError($erreur);
|
2011-04-13 12:48:49 +00:00
|
|
|
|
if(empty($this->MessageUtilisateur)) {
|
2011-04-11 12:31:46 +00:00
|
|
|
|
$this->MessageUtilisateur = $erreur;
|
2011-04-13 12:48:49 +00:00
|
|
|
|
if (_DEBUG_MODE_ and !empty($soapClient)) {
|
|
|
|
|
self::_getFormIssuts($soapClient);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-04-11 12:31:46 +00:00
|
|
|
|
return(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (EXIT_SUCCESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function sendMailError($erreur) {
|
|
|
|
|
$headers ='From: '.EMAIL_SUPPORTDEV."\n";
|
|
|
|
|
$headers .='Reply-To:'.EMAIL_SUPPORTDEV."\n";
|
|
|
|
|
$headers .='Content-Type: text/plain; charset="UTF-8"'."\n";
|
|
|
|
|
$headers .='Content-Transfer-Encoding: 8bit';
|
|
|
|
|
|
|
|
|
|
$subject = '[Erreur SOAP Giant] ';
|
|
|
|
|
|
|
|
|
|
$content = 'Le '.date('d-m-Y').' Giant a retourné une erreur SOAP à '.date ('h:i:s')."\n";
|
|
|
|
|
$content .= 'Erreur : '.$erreur;
|
|
|
|
|
|
|
|
|
|
mail(EMAIL_SUPPORTDEV, $subject, $content, $headers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function _getMessage(){
|
|
|
|
|
return ($this->MessageUtilisateur);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
?>
|