Giant: SoapUI test-suite OK sauf pour les PreferredStartDate (erreurs dans le xsd)
This commit is contained in:
parent
3ef545409e
commit
0601787e93
@ -13,6 +13,7 @@ update-investigation-tests.php \
|
||||
generateDoctrine.php \
|
||||
orders.sql \
|
||||
monitors.sql \
|
||||
soapui-test-suite.ini \
|
||||
Makefile
|
||||
WSDL = \
|
||||
wsdl/credit-data-service-provider-api-1.0.wsdl \
|
||||
@ -28,7 +29,9 @@ schema/cdm/graydon_be-1.0.xsd \
|
||||
wsdl/monitor-events-service-1.0.wsdl \
|
||||
schema/services/monitor-1.0.xsd
|
||||
SRC = http:\/\/services\.giant-net\.com
|
||||
DST = http:\/\/extranet.devlocal.com\/services
|
||||
TST = https:\/\/giant-tst.graydon.nl
|
||||
SRV = http:\/\/localhost:8088
|
||||
DST = http:\/\/extranet\.devlocal\.com\/services
|
||||
TESTS1 = \
|
||||
Ping \
|
||||
RetrieveOptions \
|
||||
@ -79,10 +82,12 @@ all:
|
||||
@echo " -> suppression de tous les fichiers de sortie des tests"
|
||||
@echo "make clean"
|
||||
@echo " -> suppression des fichiers non versionnes"
|
||||
@echo "make test-suite"
|
||||
@echo " -> generation de la suite de tests SoapUI"
|
||||
@echo
|
||||
|
||||
.PHONY: install
|
||||
install: wsdl tables doctrine
|
||||
install: wsdl tables doctrine test-suite
|
||||
|
||||
.PHONY: wsdl
|
||||
wsdl: $(WSDL)
|
||||
@ -91,6 +96,23 @@ wsdl: $(WSDL)
|
||||
wget -r -nH http://services.giant-net.com/$@
|
||||
sed 's/$(SRC)/$(DST)/g' $@ > /tmp/sed.tmp && mv /tmp/sed.tmp $@
|
||||
|
||||
.PHONY: test-suite
|
||||
test-suite:
|
||||
cat soapui-test-suite.ini | \
|
||||
sed 's/$(SRC)/$(DST)/g' | \
|
||||
sed 's/$(TST)/$(DST)/g' | \
|
||||
sed 's/$(SRV)\/credit-data\/v1/$(DST)\/credit-data\/v1\//g' | \
|
||||
sed 's/0406952018/55214450300018/g' | \
|
||||
sed 's/533885/55214450300018/g' | \
|
||||
sed 's/0406952018/55214450300018/g' | \
|
||||
sed 's/<CompanyId>34/<CompanyId>55214450300018/g' | \
|
||||
sed 's/<con:value>BE/<con:value>FR/g' | \
|
||||
sed 's/<con:value>NL/<con:value>FR/g' | \
|
||||
sed 's/<con:value>nl/<con:value>fr/g' | \
|
||||
sed 's/<LanguageCode>nl/<LanguageCode>fr/g' | \
|
||||
sed "s/'Chamber/\"Chamber/" | \
|
||||
cat > soapui-test-suite.xml
|
||||
|
||||
.PHONY: tables
|
||||
tables:
|
||||
mysql -e "show databases" | grep "giant" >/dev/null || \
|
||||
@ -114,7 +136,8 @@ crontab:
|
||||
|
||||
.PHONY: clean-wsdl
|
||||
clean-wsdl:
|
||||
rm -fr wsdl schema
|
||||
find schema -name \*.xsd -exec rm {} \;
|
||||
rm -f wsdl/*.wsdl
|
||||
|
||||
.PHONY: clean-orders
|
||||
clean-orders:
|
||||
|
@ -5,6 +5,7 @@
|
||||
if (defined('NDEBUG') == false) {
|
||||
define( 'NDEBUG', '1'); // Ne pas changer cette valeur, voir le client
|
||||
define('VERSION', '1.0');
|
||||
define('SERVICES_URL', 'http://extranet.devlocal.com/services/');
|
||||
}
|
||||
|
||||
require_once realpath(dirname(__FILE__).'/../../../../config/prepend.php');
|
||||
@ -22,6 +23,8 @@ $gDataSetTypes = array('Full', 'Compact', 'CreditRecommendation', 'Flex');
|
||||
$gLanguageCodes = array('en', 'fr');
|
||||
$gServiceLevels = array('Normal', 'Urgent', 'Flash');
|
||||
$gLevelDurations = array('Normal' => 7, 'Urgent' => 5, 'Flash' => 3);
|
||||
$gCategoryNames = array('All', 'CreditRecommendation');
|
||||
$gEventTypes = array('EventOnly', 'EventWithData');
|
||||
$gTestCompanies = array('55214450300018',
|
||||
'47997411500012',
|
||||
'49496793800031');
|
||||
@ -44,36 +47,24 @@ function modeTestUniquement()
|
||||
global $gServiceHeader;
|
||||
|
||||
if ($gServiceHeader->TestIndication != 'true') {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(1003,
|
||||
'TestIndication must be set'.
|
||||
' for the moment'));
|
||||
throw functionalError(1003, 'TestIndication must be set'.
|
||||
' for the moment');
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Serveur
|
||||
// --------------------------------------------------------------------------- //
|
||||
abstract class DataSetType { }
|
||||
class FullDataSet extends DataSetType { }
|
||||
class CompactDataSet extends DataSetType { }
|
||||
class CreditRecommendation extends DataSetType { }
|
||||
abstract class AccountItem { }
|
||||
class AmountAccountItem extends AccountItem { }
|
||||
class NumberAccountItem extends AccountItem { }
|
||||
if (NDEBUG) {
|
||||
$serveur =
|
||||
new SoapServer('http://extranet.devlocal.com/services/'.
|
||||
new SoapServer(SERVICES_URL.
|
||||
'wsdl/credit-data-service-provider-api-1.0.wsdl',
|
||||
array('soap_version' => SOAP_1_1,
|
||||
'trace' => true,
|
||||
'classmap' => array('FullDataSet' =>
|
||||
'FullDataSet',
|
||||
'CompactDataSet' =>
|
||||
'CompactDataSet',
|
||||
'CreditRecommendation' =>
|
||||
'CreditRecommendation',
|
||||
'AmountAccountItem' =>
|
||||
'classmap' => array('AmountAccountItem' =>
|
||||
'AmountAccountItem',
|
||||
'NumberAccountItem' =>
|
||||
'NumberAccountItem')));
|
||||
@ -94,16 +85,27 @@ if (NDEBUG) {
|
||||
// --------------------------------------------------------------------------- //
|
||||
function getDomElement(&$node, &$obj)
|
||||
{
|
||||
foreach ($node->childNodes as $n) {
|
||||
if ($n->childNodes->length > 1) {
|
||||
if ($node->hasChildNodes() == true) {
|
||||
$n = $node->childNodes->length;
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$cur = $node->childNodes->item($i);
|
||||
$o = new StdClass;
|
||||
getDomElement($n, $o);
|
||||
$name = $n->nodeName;
|
||||
$obj->$name = $o;
|
||||
} else {
|
||||
$name = $n->nodeName;
|
||||
$obj->$name = $n->firstChild->nodeValue;
|
||||
getDomElement($cur, $o);
|
||||
$name = $cur->nodeName;
|
||||
if ($name == '#text') {
|
||||
if (empty($o) == false && trim($o) != '') {
|
||||
$obj->_ = $o;
|
||||
}
|
||||
} else {
|
||||
if (isset($o->_)) {
|
||||
$obj->$name = $o->_;
|
||||
} else {
|
||||
$obj->$name = $o;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$obj = $node->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,8 +121,8 @@ function readSoapHeader()
|
||||
$xml->xml($GLOBALS['HTTP_RAW_POST_DATA']);
|
||||
|
||||
while ($xml->read()) {
|
||||
if ($xml->namespaceURI == 'http://extranet.devlocal.com/services/'.
|
||||
'schema/services/shared/1.0' &&
|
||||
if (preg_match('@/services/schema/services/shared/1\.0@',
|
||||
$xml->namespaceURI) != false &&
|
||||
$xml->nodeType == XMLReader::ELEMENT) {
|
||||
$node = $xml->expand();
|
||||
getDomElement($node, $header);
|
||||
@ -140,7 +142,8 @@ function enregistrement($table, $id)
|
||||
{
|
||||
global $gServiceHeader;
|
||||
|
||||
if (isset($gServiceHeader->CustomerId) == true) {
|
||||
if (isset($gServiceHeader->CustomerId) == true &&
|
||||
$gServiceHeader->CustomerId != 'not_provided') {
|
||||
$consumer_id = $gServiceHeader->CustomerId;
|
||||
} else {
|
||||
$consumer_id = $gServiceHeader->ConsumerId;
|
||||
@ -169,9 +172,14 @@ function functionalError($n, $details = '')
|
||||
case 1: $m = 'Order is not completed'; break;
|
||||
case 1003: $m = 'Authorization failed'; break;
|
||||
case 3000: $m = 'Invalid CompanyId'; break;
|
||||
case 3002: $m = 'Invalid LanguageCode requested'; break;
|
||||
case 3003: $m = 'Invalid DataSetType requested'; break;
|
||||
case 3004: $m = 'Invalid ServiceLevel requested'; break;
|
||||
case 3001: $m = 'Invalid Version'; break;
|
||||
case 3002: $m = 'Invalid LanguageCode'; break;
|
||||
case 3003: $m = 'Invalid DataSetType'; break;
|
||||
case 3004: $m = 'Invalid ServiceLevel'; break;
|
||||
case 3005: $m = 'Invalid CategoryName'; break;
|
||||
case 3006: $m = 'Invalid EventType'; break;
|
||||
case 3007: $m = 'Invalid Date format'; break;
|
||||
case 3020: $m = 'Invalid OrderId'; break;
|
||||
case 3021: $m = 'Invalid OrderId / Consumer combination'; break;
|
||||
}
|
||||
|
||||
@ -179,7 +187,9 @@ function functionalError($n, $details = '')
|
||||
if (empty($details) == false) {
|
||||
$r->ErrorDetails = $details.'.';
|
||||
}
|
||||
return print_r($r, true);
|
||||
|
||||
return new SoapFault('FunctionalException', print_r($r, true), '', $r,
|
||||
'FunctionalException');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
@ -199,7 +209,9 @@ function technicalError($n, $details = '')
|
||||
if (empty($details) == false) {
|
||||
$r->ErrorDetails = $details.'.';
|
||||
}
|
||||
return print_r($r, true);
|
||||
|
||||
return new SoapFault('TechnicalException', print_r($r, true), '', $r,
|
||||
'TechnicalException');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
@ -212,13 +224,14 @@ function orderResponse(&$o, &$q)
|
||||
$order = new StdClass;
|
||||
$order->ProviderOrderId = $q->ProviderOrderId;
|
||||
$order->ConsumerId = $gServiceHeader->ConsumerId;
|
||||
if (empty($gServiceHeader->CustomerId) == false) {
|
||||
if (empty($gServiceHeader->CustomerId) == false &&
|
||||
$gServiceHeader->CustomerId != 'not_provided') {
|
||||
$order->CustomerId = $gServiceHeader->CustomerId;
|
||||
}
|
||||
$order->ProviderId = $gServiceHeader->Provider->ProviderId;
|
||||
$order->CountryCode = $gServiceHeader->Provider->CountryCode;
|
||||
$order->CompanyId = $q->CompanyId;
|
||||
$order->Version = '1.0';
|
||||
$order->Version = VERSION;
|
||||
$order->LanguageCode = $q->LanguageCode;
|
||||
|
||||
if (isset($q->OrderType) == true) {
|
||||
@ -342,17 +355,14 @@ function ajouteJoursOuvrables($jours)
|
||||
// --------------------------------------------------------------------------- //
|
||||
// company
|
||||
// --------------------------------------------------------------------------- //
|
||||
function company(&$i)
|
||||
function company(&$c, &$i)
|
||||
{
|
||||
$c = new StdClass;
|
||||
$c->CompanyId = $i['Siret'];
|
||||
//$c->OldCompanyId = ;
|
||||
if ($i['TvaAttribue'] == 1) {
|
||||
$c->Vat = new StdClass;
|
||||
$c->Vat->VatNumber = $i['TvaNumero'];
|
||||
}
|
||||
$c->CompanyStatus = $i['Actif'];
|
||||
$c->CompanyName = $i['Nom'];
|
||||
$c->CompanyStatus = ($i['Actif'] == 1) ? 'Active' : 'Inactive';
|
||||
$c->EmailAddress = $i['Mail'];
|
||||
$c->WebAddress = str_replace('http://', '', $i['Web']);
|
||||
$c->IncorporationDate =
|
||||
@ -382,20 +392,6 @@ function company(&$i)
|
||||
$c->TradeName = $i['Enseigne'];
|
||||
}
|
||||
//$c->SocialSecurityNumber = ;
|
||||
//$c->CompanyRegistry = ;
|
||||
$address = new StdClass;
|
||||
$address->Street = $i['Adresse'];
|
||||
$address->HouseNumber = $i['AdresseNum'];
|
||||
//$address->HouseNumberAddition = ;
|
||||
//$address->Building = ;
|
||||
//$address->PoBox = ;
|
||||
$address->PostCode = $i['CP'];
|
||||
$address->City = $i['Ville'];
|
||||
//$address->State = ;
|
||||
$address->Country = $i['PaysIso2'];
|
||||
//$address->Period = ;
|
||||
//$address->FlexibleAddress = ;
|
||||
$c->CompanyAddress = $address;
|
||||
//$c->StockExchange = ;
|
||||
//$c->Division = ;
|
||||
$op = new StdClass;
|
||||
@ -410,7 +406,11 @@ function company(&$i)
|
||||
$product_name->lang = 'fr';
|
||||
$op->ProductName[] = $product_name;
|
||||
$op->IndustryCode = new StdClass;
|
||||
if (empty($i['NaceEtab']) == false) {
|
||||
$op->IndustryCode->NaceCode = substr($i['NaceEtab'], 1);
|
||||
} else {
|
||||
$op->IndustryCode->NaceCode = 0;
|
||||
}
|
||||
//$op->IndustryCode->Description = ;
|
||||
//$op->IndustryCode->version = ;
|
||||
//$op->IndustryCode->source = ;
|
||||
@ -432,10 +432,33 @@ function company(&$i)
|
||||
//$c->RealEstate = ;
|
||||
//$c->PeerGroup = ;
|
||||
//$c->Event = ;
|
||||
}
|
||||
|
||||
$company = new StdClass;
|
||||
$company->Company = $c;
|
||||
return $company;
|
||||
// --------------------------------------------------------------------------- //
|
||||
// restrictedCompany
|
||||
// --------------------------------------------------------------------------- //
|
||||
function restrictedCompany(&$c, &$i)
|
||||
{
|
||||
$c->CompanyId = $i['Siret'];
|
||||
//$c->CompanyRegistry = ;
|
||||
$c->CompanyName = $i['Nom'];
|
||||
$address = new StdClass;
|
||||
$address->Street = $i['Adresse'];
|
||||
$address->HouseNumber = $i['AdresseNum'];
|
||||
//$address->HouseNumberAddition = ;
|
||||
//$address->Building = ;
|
||||
//$address->PoBox = ;
|
||||
$address->PostCode = $i['CP'];
|
||||
$address->City = $i['Ville'];
|
||||
//$address->State = ;
|
||||
if (empty($i['Pays']) == false) {
|
||||
$address->Country = $i['Pays'];
|
||||
} else {
|
||||
$address->Country = 'FR';
|
||||
}
|
||||
//$address->Period = ;
|
||||
//$address->FlexibleAddress = ;
|
||||
$c->CompanyAddress = $address;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
@ -461,8 +484,7 @@ function bilans(&$ratios)
|
||||
//$item->level = ;
|
||||
$item->Value = $ratios['ratiosEntrep'][$bilan_num]['r'.$code];
|
||||
if (empty($description->_) == true) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'Assets'));
|
||||
throw technicalError(1, 'Assets');
|
||||
}
|
||||
$balance->Assets->AccountItem[] = $item;
|
||||
}
|
||||
@ -476,8 +498,7 @@ function bilans(&$ratios)
|
||||
//$item->level = ;
|
||||
$item->Value = $ratios['ratiosEntrep'][$bilan_num]['r'.$code];
|
||||
if (empty($description->_) == true) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'Liabilities'));
|
||||
throw technicalError(1, 'Liabilities');
|
||||
}
|
||||
$balance->Liabilities->AccountItem[] = $item;
|
||||
}
|
||||
@ -500,8 +521,7 @@ function bilans(&$ratios)
|
||||
//$item->level = ;
|
||||
$item->Value = $valeur;
|
||||
if (empty($description->_) == true) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'ProfitAndLoss'));
|
||||
throw technicalError(1, 'ProfitAndLoss');
|
||||
}
|
||||
$profit_and_loss->AccountItem[] = $item;
|
||||
}
|
||||
@ -856,13 +876,17 @@ function RetrieveOptions($o)
|
||||
global $gServiceLevels;
|
||||
global $gLevelDurations;
|
||||
|
||||
if (preg_match('/^[0-9]{14}$/', $o->CompanyId) == false) {
|
||||
throw functionalError(3000, $o->CompanyId);
|
||||
}
|
||||
|
||||
$r = new StdClass;
|
||||
|
||||
$r->DateOfLastUpdate = '0000-00-00';
|
||||
$i = scoresws_identite($o->CompanyId,
|
||||
substr($o->CompanyId, 0, 9), 0);
|
||||
if ($i == false) {
|
||||
throw new SoapFault('TechnicalError', technicalError(1));
|
||||
throw technicalError(1);
|
||||
}
|
||||
if (empty($i['Bilan']['Cloture']) == false) {
|
||||
$r->DateOfLastAnnualAccount =
|
||||
@ -949,41 +973,42 @@ function getDataSet($company_id, $data_set_type)
|
||||
break;
|
||||
case 'Flex':
|
||||
default:
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3003, $data_set_type));
|
||||
throw functionalError(3003, $data_set_type);
|
||||
}
|
||||
if ($identite == false) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'scoresws_identite'));
|
||||
}
|
||||
$ratios = scoresws_ratios($company_id, $siren, 0);
|
||||
if ($ratios == false) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'scoresws_ratios'));
|
||||
}
|
||||
$banques = scoresws_banques($company_id, $siren, 0);
|
||||
if ($banques == false) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'scoresws_banques'));
|
||||
throw technicalError(1, 'scoresws_identite');
|
||||
}
|
||||
$indiscore = scoresws_indiscore($company_id, $siren, 0);
|
||||
if ($indiscore == false) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, 'scoresws_indiscore'));
|
||||
throw technicalError(1, 'scoresws_indiscore');
|
||||
}
|
||||
|
||||
$company = new StdClass;
|
||||
$company->Company = new StdClass;
|
||||
restrictedCompany($company->Company, $identite);
|
||||
$company->Company->CreditRecommendation = creditRecommendation($indiscore);
|
||||
if ($data_set_type == 'CreditRecommendation') {
|
||||
return $company;
|
||||
}
|
||||
|
||||
$ratios = scoresws_ratios($company_id, $siren, 0);
|
||||
if ($ratios == false) {
|
||||
throw technicalError(1, 'scoresws_ratios');
|
||||
}
|
||||
$banques = scoresws_banques($company_id, $siren, 0);
|
||||
if ($banques == false) {
|
||||
throw technicalError(1, 'scoresws_banques');
|
||||
}
|
||||
$etablissements = scoresws_etablissements($company_id, $siren, 0);
|
||||
if ($etablissements == false) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, '$scoresws_etablissements'));
|
||||
throw technicalError(1, '$scoresws_etablissements');
|
||||
}
|
||||
$liens = scoresws_liens($company_id, $siren, 0);
|
||||
if ($liens == false) {
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalError(1, '$scoresws_liens'));
|
||||
throw technicalError(1, '$scoresws_liens');
|
||||
}
|
||||
|
||||
$company = company($identite);
|
||||
$company->Company->CreditRecommendation = creditRecommendation($indiscore);
|
||||
company($company->Company, $identite);
|
||||
$company->Company->AnnualAccounts = bilans($ratios);
|
||||
$company->Company->Bank = banques($banques);
|
||||
//$company->Company->Auditor = auditor();
|
||||
@ -1007,15 +1032,18 @@ function OrderDataSet($o)
|
||||
global $gLanguageCodes;
|
||||
global $gTestCompanies;
|
||||
|
||||
if (preg_match('/^[0-9]{14}$/', $o->CompanyId) == false) {
|
||||
throw functionalError(3000, $o->CompanyId);
|
||||
}
|
||||
if ($o->DataSetVersion != VERSION) {
|
||||
throw functionalError(3001, $o->DataSetVersion);
|
||||
}
|
||||
if (in_array($o->LanguageCode, $gLanguageCodes) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3002, $o->LanguageCode));
|
||||
throw functionalError(3002, $o->LanguageCode);
|
||||
}
|
||||
if ($gServiceHeader->TestIndication == 'true' &&
|
||||
in_array($o->CompanyId, $gTestCompanies) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3000, $o->CompanyId.
|
||||
' is not in test mode'));
|
||||
throw functionalError(3000, $o->CompanyId.' is not in test mode');
|
||||
}
|
||||
modeTestUniquement();
|
||||
|
||||
@ -1024,7 +1052,8 @@ function OrderDataSet($o)
|
||||
$q = new Orders;
|
||||
$q->TestIndication = $gServiceHeader->TestIndication == 'true';
|
||||
$q->ConsumerId = $gServiceHeader->ConsumerId;
|
||||
if (empty($gServiceHeader->CustomerId) == false) {
|
||||
if (empty($gServiceHeader->CustomerId) == false &&
|
||||
$gServiceHeader->CustomerId != 'not_provided') {
|
||||
$q->CustomerId = $gServiceHeader->CustomerId;
|
||||
}
|
||||
$q->CompanyId = $o->CompanyId;
|
||||
@ -1054,9 +1083,13 @@ function OrderDataSet($o)
|
||||
// --------------------------------------------------------------------------- //
|
||||
function RetrieveOrderStatus($o)
|
||||
{
|
||||
if (is_numeric($o->ProviderOrderId) == false) {
|
||||
throw functionalError(3020, $o->ProviderOrderId);
|
||||
}
|
||||
|
||||
$q = enregistrement('Orders', $o->ProviderOrderId);
|
||||
if ($q == false) {
|
||||
throw new SoapFault('FunctionalError', functionalError(3021));
|
||||
throw functionalError(3021);
|
||||
}
|
||||
|
||||
$r = new StdClass;
|
||||
@ -1070,16 +1103,18 @@ function RetrieveOrderStatus($o)
|
||||
// --------------------------------------------------------------------------- //
|
||||
function RetrieveDataSet($o)
|
||||
{
|
||||
if (is_numeric($o->ProviderOrderId) == false) {
|
||||
throw functionalError(3020, $o->ProviderOrderId);
|
||||
}
|
||||
|
||||
$q = enregistrement('Orders', $o->ProviderOrderId);
|
||||
if ($q == false) {
|
||||
throw new SoapFault('FunctionalError', functionalError(3021));
|
||||
throw functionalError(3021);
|
||||
}
|
||||
|
||||
if ($q->OrderStatus != 'Completed' &&
|
||||
$q->OrderStatus != 'Delivered') {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3021, 'Order status is '.
|
||||
$q->OrderStatus));
|
||||
throw functionalError(3021, 'Order status is '.$q->OrderStatus);
|
||||
}
|
||||
|
||||
if ($q->OrderStatus != 'Delivered') {
|
||||
@ -1088,27 +1123,31 @@ function RetrieveDataSet($o)
|
||||
$q->save();
|
||||
}
|
||||
|
||||
switch ($q->DataSetType) {
|
||||
case 'Full':
|
||||
$data_set = new FullDataSet;
|
||||
break;
|
||||
case 'Compact':
|
||||
$data_set = new CompactDataSet;
|
||||
break;
|
||||
case 'CreditRecommendation':
|
||||
$data_set = new CreditRecommendation;
|
||||
break;
|
||||
default:
|
||||
throw new SoapFault('TechnicalError',
|
||||
technicalalError(9000, $q->DataSetType.
|
||||
' non-implemented'));
|
||||
}
|
||||
$data_set->Company = unserialize($q->DataSet)->Company;
|
||||
$data_set = unserialize($q->DataSet);
|
||||
|
||||
$r = new StdClass;
|
||||
$r->version = VERSION;
|
||||
$r->Order = orderResponse($o, $q);
|
||||
$r->DataSet = $data_set;
|
||||
switch ($q->DataSetType) {
|
||||
case 'Full':
|
||||
$r->DataSet = new SoapVar($data_set, SOAP_ENC_OBJECT,
|
||||
'FullDataSet', SERVICES_URL.
|
||||
'schema/services/fulldataset/1.0');
|
||||
break;
|
||||
case 'Compact':
|
||||
$r->DataSet = new SoapVar($data_set, SOAP_ENC_OBJECT,
|
||||
'CompactDataSet', SERVICES_URL.
|
||||
'schema/services/compactdataset/1.0');
|
||||
break;
|
||||
case 'CreditRecommendation':
|
||||
$r->DataSet = new SoapVar($data_set, SOAP_ENC_OBJECT,
|
||||
'CreditRecommendation', SERVICES_URL.
|
||||
'schema/services/creditrecommendation/1.0');
|
||||
break;
|
||||
default:
|
||||
throw technicalalError(9000, $q->DataSetType.' non-implemented');
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
@ -1124,23 +1163,25 @@ function StartInvestigation($o)
|
||||
global $gLevelDurations;
|
||||
global $gTestCompanies;
|
||||
|
||||
if (preg_match('/^[0-9]{14}$/', $o->CompanyId) == false) {
|
||||
throw functionalError(3000, $o->CompanyId);
|
||||
}
|
||||
if ($o->DataSetVersion != VERSION) {
|
||||
throw functionalError(3001, $o->DataSetVersion);
|
||||
}
|
||||
if (in_array($o->LanguageCode, $gLanguageCodes) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3002, $o->LanguageCode));
|
||||
throw functionalError(3002, $o->LanguageCode);
|
||||
}
|
||||
if (in_array($o->DataSetType->_, $gDataSetTypes) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3003, $o->DataSetType->_));
|
||||
throw functionalError(3003, $o->DataSetType->_);
|
||||
}
|
||||
$o->ServiceLevelName = ucfirst($o->ServiceLevelName);
|
||||
if (in_array($o->ServiceLevelName, $gServiceLevels) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3004, $o->ServiceLevelName));
|
||||
throw functionalError(3004, $o->ServiceLevelName);
|
||||
}
|
||||
if ($o->TestIndication == 'true' &&
|
||||
in_array($o->CompanyId, $gTestCompanies) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3000, $o->CompanyId.
|
||||
' is not in test mode'));
|
||||
throw functionalError(3000, $o->CompanyId.' is not in test mode');
|
||||
}
|
||||
modeTestUniquement();
|
||||
|
||||
@ -1149,7 +1190,8 @@ function StartInvestigation($o)
|
||||
$q = new Orders;
|
||||
$q->TestIndication = $gServiceHeader->TestIndication == 'true';
|
||||
$q->ConsumerId = $gServiceHeader->ConsumerId;
|
||||
if (empty($gServiceHeader->CustomerId) == false) {
|
||||
if (empty($gServiceHeader->CustomerId) == false &&
|
||||
$gServiceHeader->CustomerId != 'not_provided') {
|
||||
$q->CustomerId = $gServiceHeader->CustomerId;
|
||||
}
|
||||
$q->CompanyId = $o->CompanyId;
|
||||
@ -1181,17 +1223,38 @@ function StartMonitoring($o)
|
||||
{
|
||||
global $gServiceHeader;
|
||||
global $gLanguageCodes;
|
||||
global $gCategoryNames;
|
||||
global $gEventTypes;
|
||||
global $gTestCompanies;
|
||||
|
||||
if (preg_match('/^[0-9]{14}$/', $o->CompanyId) == false) {
|
||||
throw functionalError(3000, $o->CompanyId);
|
||||
}
|
||||
if ($o->MonitoringVersion != VERSION) {
|
||||
throw functionalError(3001, $o->MonitoringVersion);
|
||||
}
|
||||
if (in_array($o->LanguageCode, $gLanguageCodes) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3002, $o->LanguageCode));
|
||||
throw functionalError(3002, $o->LanguageCode);
|
||||
}
|
||||
if (in_array($o->CategoryName, $gCategoryNames) == false) {
|
||||
throw functionalError(3005);
|
||||
}
|
||||
if (in_array($o->EventType, $gEventTypes) == false) {
|
||||
throw functionalError(3006);
|
||||
}
|
||||
if (isset($o->PreferredStartDate) == true &&
|
||||
preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',
|
||||
$o->PreferredStartDate) == false) {
|
||||
throw functionalError(3007, $o->PreferredStartDate);
|
||||
}
|
||||
if (isset($o->PreferredEndDate) == true &&
|
||||
preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',
|
||||
$o->PreferredEndDate) == false) {
|
||||
throw functionalError(3007, $o->PreferredEndDate);
|
||||
}
|
||||
if ($gServiceHeader->TestIndication == 'true' &&
|
||||
in_array($o->CompanyId, $gTestCompanies) == false) {
|
||||
throw new SoapFault('FunctionalError',
|
||||
functionalError(3000, $o->CompanyId.
|
||||
' is not in test mode'));
|
||||
throw functionalError(3000, $o->CompanyId.' is not in test mode');
|
||||
}
|
||||
modeTestUniquement($o->CompanyId);
|
||||
|
||||
@ -1201,7 +1264,8 @@ function StartMonitoring($o)
|
||||
$q = new Monitors;
|
||||
$q->TestIndication = $gServiceHeader->TestIndication == 'true';
|
||||
$q->ConsumerId = $gServiceHeader->ConsumerId;
|
||||
if (empty($gServiceHeader->CustomerId) == false) {
|
||||
if (empty($gServiceHeader->CustomerId) == false &&
|
||||
$gServiceHeader->CustomerId != 'not_provided') {
|
||||
$q->CustomerId = $gServiceHeader->CustomerId;
|
||||
}
|
||||
$q->CompanyId = $o->CompanyId;
|
||||
@ -1234,7 +1298,7 @@ function StopMonitoring($o)
|
||||
{
|
||||
$q = enregistrement('Monitors', $o->ProviderOrderId);
|
||||
if ($q == false) {
|
||||
throw new SoapFault('FunctionalError', functionalError(3021));
|
||||
throw functionalError(3021);
|
||||
}
|
||||
|
||||
if (isset($o->PreferredEndDate) == true) {
|
||||
@ -1255,9 +1319,43 @@ function StopMonitoring($o)
|
||||
// --------------------------------------------------------------------------- //
|
||||
function UpdateMonitoringOptions($o)
|
||||
{
|
||||
global $gLanguageCodes;
|
||||
global $gCategoryNames;
|
||||
global $gEventTypes;
|
||||
|
||||
if (isset($o->NewMonitoringVersion) == true &&
|
||||
$o->NewMonitoringVersion != VERSION) {
|
||||
throw functionalError(3001, $o->NewMonitoringVersion);
|
||||
}
|
||||
if (isset($o->NewLanguageCode) == true &&
|
||||
in_array($o->NewLanguageCode, $gLanguageCodes) == false) {
|
||||
throw functionalError(3002, $o->NewLanguageCode);
|
||||
}
|
||||
if (isset($o->NewCategoryName) == true &&
|
||||
in_array($o->NewCategoryName, $gCategoryNames) == false) {
|
||||
throw functionalError(3005, $o->NewCategoryName);
|
||||
}
|
||||
if (isset($o->NewEventType) == true &&
|
||||
in_array($o->NewEventType, $gEventTypes) == false) {
|
||||
throw functionalError(3006, $o->NewEventType);
|
||||
}
|
||||
if (isset($o->NewPreferredStartDate) == true &&
|
||||
preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',
|
||||
$o->NewPreferredStartDate) == false) {
|
||||
throw functionalError(3007, $o->NewPreferredStartDate);
|
||||
}
|
||||
if (isset($o->NewPreferredEndDate) == true &&
|
||||
preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',
|
||||
$o->NewPreferredEndDate) == false) {
|
||||
throw functionalError(3007, $o->NewPreferredEndDate);
|
||||
}
|
||||
if (is_numeric($o->ProviderOrderId) == false) {
|
||||
throw functionalError(3020, $o->ProviderOrderId);
|
||||
}
|
||||
|
||||
$q = enregistrement('Monitors', $o->ProviderOrderId);
|
||||
if ($q == false) {
|
||||
throw new SoapFault('FunctionalError', functionalError(3021));
|
||||
throw functionalError(3021);
|
||||
}
|
||||
|
||||
if (isset($o->NewCategoryName) == true) {
|
||||
@ -1272,8 +1370,11 @@ function UpdateMonitoringOptions($o)
|
||||
if (isset($o->NewLanguageCode) == true) {
|
||||
$q->LanguageCode = $o->NewLanguageCode;
|
||||
}
|
||||
if (isset($o->PreferredStartDate) == true) {
|
||||
$q->ActualStartDate = $o->PreferredStartDate;
|
||||
if (isset($o->NewPreferredStartDate) == true) {
|
||||
$q->ActualStartDate = $o->NewPreferredStartDate;
|
||||
}
|
||||
if (isset($o->NewPreferredEndDate) == true) {
|
||||
$q->ActualEndDate = $o->NewPreferredEndDate;
|
||||
}
|
||||
$q->save();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Serveur: localhost
|
||||
-- Généré le : Mer 05 Mai 2010 à 16:26
|
||||
-- Généré le : Mar 01 Juin 2010 à 10:28
|
||||
-- Version du serveur: 5.1.40
|
||||
-- Version de PHP: 5.3.1
|
||||
|
||||
@ -25,10 +25,11 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
-- Structure de la table `monitors`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `monitors` (
|
||||
DROP TABLE IF EXISTS `monitors`;
|
||||
CREATE TABLE `monitors` (
|
||||
`ProviderOrderId` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`TestIndication` tinyint(1) NOT NULL,
|
||||
`ConsumerId` int(11) NOT NULL,
|
||||
`ConsumerId` tinytext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`CompanyId` bigint(14) NOT NULL,
|
||||
`CompanyName` tinytext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`CategoryName` enum('All','CreditRecommendation') COLLATE utf8_unicode_ci NOT NULL,
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Serveur: localhost
|
||||
-- Généré le : Mer 05 Mai 2010 à 11:15
|
||||
-- Généré le : Mar 01 Juin 2010 à 10:28
|
||||
-- Version du serveur: 5.1.40
|
||||
-- Version de PHP: 5.3.1
|
||||
|
||||
@ -25,10 +25,11 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
-- Structure de la table `orders`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `orders` (
|
||||
DROP TABLE IF EXISTS `orders`;
|
||||
CREATE TABLE `orders` (
|
||||
`ProviderOrderId` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`TestIndication` tinyint(1) NOT NULL,
|
||||
`ConsumerId` int(11) NOT NULL,
|
||||
`ConsumerId` tinytext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`CompanyId` bigint(14) NOT NULL,
|
||||
`OrderType` enum('DataSet','Monitoring','Investigation') COLLATE utf8_unicode_ci NOT NULL,
|
||||
`DataSetType` enum('Full','Compact','CreditRecommendation','Flex') COLLATE utf8_unicode_ci NOT NULL,
|
||||
|
7074
www/services/soapui-test-suite.ini
Normal file
7074
www/services/soapui-test-suite.ini
Normal file
File diff suppressed because it is too large
Load Diff
7074
www/services/soapui-test-suite.xml
Normal file
7074
www/services/soapui-test-suite.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -32,23 +32,23 @@ header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
define( 'NDEBUG', '1');
|
||||
define('VERSION', '1.0');
|
||||
define('SERVICES_URL', 'http://extranet.devlocal.com/services/');
|
||||
|
||||
$gServiceHeader = new StdClass;
|
||||
$gServiceHeader->ConsumerId = 1234;
|
||||
//$gServiceHeader->CustomerId = 1234;
|
||||
$gServiceHeader->ConsumerId = 'a1234';
|
||||
//$gServiceHeader->CustomerId = 'a1234';
|
||||
$gServiceHeader->Provider = new StdClass;
|
||||
$gServiceHeader->Provider->ProviderId = 2345;
|
||||
$gServiceHeader->Provider->ProviderId = 'SD';
|
||||
$gServiceHeader->Provider->CountryCode = 'FR';
|
||||
$gServiceHeader->TimeStamp = date('Y-m-d\TH:i:s');
|
||||
$gServiceHeader->TestIndication = true;
|
||||
|
||||
if (NDEBUG) {
|
||||
$soap_header =
|
||||
new SoapHeader('http://extranet.devlocal.com/services/'.
|
||||
'schema/services/shared/1.0', 'ServiceHeader',
|
||||
$gServiceHeader);
|
||||
new SoapHeader(SERVICES_URL.'schema/services/shared/1.0',
|
||||
'ServiceHeader', $gServiceHeader);
|
||||
$soap_client =
|
||||
new SoapClient('http://extranet.devlocal.com/services/'.
|
||||
new SoapClient(SERVICES_URL.
|
||||
'wsdl/credit-data-service-provider-api-1.0.wsdl',
|
||||
array('soap_version' => SOAP_1_1,
|
||||
'trace' => true));
|
||||
@ -69,6 +69,7 @@ case 'RetrieveOptions':
|
||||
case 'OrderDataSet':
|
||||
$o->CompanyId = $companyId;
|
||||
$o->DataSetType = new StdClass;
|
||||
//$o->DataSetType->_ = 'CreditRecommendation';
|
||||
$o->DataSetType->_ = 'Full';
|
||||
$o->DataSetVersion = VERSION;
|
||||
$o->LanguageCode = 'fr';
|
||||
@ -112,7 +113,7 @@ case 'UpdateMonitoringOptions':
|
||||
$o->NewEventType = 'EventWithData';
|
||||
//$o->NewMonitoringVersion = ;
|
||||
//$o->NewLanguageCode = ;
|
||||
$o->PreferredStartDate = date('Y-m-d');
|
||||
$o->NewPreferredStartDate = date('Y-m-d');
|
||||
$fonction = 'UpdateMonitoringOptions';
|
||||
break;
|
||||
default:
|
||||
@ -129,10 +130,10 @@ print_r($o);
|
||||
print '<br/>';
|
||||
if (NDEBUG) {
|
||||
print_r($soap_client->__call($fonction, array($o)));
|
||||
//print '<br/>';
|
||||
//print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
|
||||
//print '<br/>';
|
||||
//print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
|
||||
print '<br/>';
|
||||
print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
|
||||
print '<br/>';
|
||||
print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
|
||||
} else {
|
||||
require_once 'credit-data/v1/index.php';
|
||||
print_r(call_user_func($fonction, $o));
|
||||
|
Loading…
x
Reference in New Issue
Block a user