<?php
require dirname(__FILE__) . '/../../autoload.php';

// Init du service
$service = new \SparkWebService(array('cache_wsdl' => WSDL_CACHE_NONE));

$token = 'test-467afe5eff145ffb2d87';

// Méthode CreateAddress 
// Init des paramètres
$publicKey = md5(uniqid('SparkWeb'));
$key = $token . $publicKey .  $dateFormat;
$hashkey = md5($key);
$WebClientId = "WEB-CLIENT-02";
$WebAddressId = "WEB-ADD-01";
// 1	MONSIEUR
// 2	MADAME
// 3	DUCHESSE
// 4	DUC
// 5	SEIGNEUR
// 6	ROI
// 7	REINE
// 8	DOCTEUR
// 9	MAÎTRE
// 10	COMTE
// 11	STANDARD
// 12	BARON
$Civility = 1;
$AddressAlias = "Nicolas Martin (livr)";
$AddressLine1 = "Adresse 1";
$AddressLine2 = "Adresse 2";
$Building = "Batiment";
$PostalCode = "75000";
$City = "Paris";
$Country = "FR";
$PhoneNumber = "060606060606";
$IntraComVat = "INTRACOMVAT";
$SiretNumber = "SIRETNUMBER";
$DeliveryComment ="Commentaire de livraison";
$IsDeliveryAddress = "1";
$IsBillingAddress = "1";
$LastUpdate = $date;
$WebCreationDate  = $date;

// Appel de la requête
$request = new \CreateAddress($hashkey,$publicKey, $WebClientId,
                                $WebAddressId,
                                $Civility,
                                $AddressAlias,
                                $AddressLine1,
                                $AddressLine2,
                                $Building,
                                $PostalCode,
                                $City,
                                $Country,
                                $PhoneNumber,
                                $IntraComVat,
                                $SiretNumber,
                                $DeliveryComment,
                                $IsDeliveryAddress,
                                $IsBillingAddress,
                                $LastUpdate,
                                $WebCreationDate
                            );

// Récupération de la réponse
$response = $service->CreateAddress($request);
var_dump($response);