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

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

$token = 'test-467afe5eff145ffb2d87';


// Méthode UpdateAddress 
// Init des paramètres
$publicKey = md5(uniqid('SparkWeb'));
$key = $token . $publicKey .  $dateFormat;
$hashkey = md5($key);
$WebClientId = "WEB-CLIENT-6";
$WebAddressId = "WEB-ADD-4387";
// 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 = "Luc Skywalker";
$AddressLine1 = "38 rue du louveteau";
$AddressLine2 = "Bat D";
$Building = "";
$PostalCode = "33000";
$City = "Bordeaux";
$Country = "FR";
$PhoneNumber = "0606060606";
$IntraComVat = "INTRACOMVAT";
$SiretNumber = "SIRETNUMBER";
$DeliveryComment ="Commentaire de livraison";
$LastUpdate = $date;
$WebCreationDate  = $date;

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

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

// Méthode GetAddress 
// Init des paramètres
$publicKey = md5(uniqid('SparkWeb'));
$key = $token . $publicKey .  $dateFormat;
$hashkey = md5($key);
$WebClientId = "WEB-CLIENT-6";
$WebAddressId = "WEB-ADD-4387";

// Appel de la requête
$request = new \GetAddress($hashkey,$publicKey, $WebClientId, $WebAddressId);

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