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

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

$token = 'VINIVRP';

// Méthode CreateOrder 
// Init des paramètres

$date = new DateTime();
$dateFormat = $date->format('Ymd');
$publicKey = md5(uniqid('SparkWeb'));

$key = $token . $publicKey .  $dateFormat;
$hashkey = md5($key);


$WebOrderId = "WEB-ORDER-NMA-100";
$WebClientId = "7008800833705";
$OrderDate = $date;
$AddressAlias = "AddressAlias";
$AddressLine1 = "AddressLine1";	
$AddressLine2 = "AddressLine2";	
$Building = "Building";		
$PostalCode = "75000";		
$City = "Paris";		
$Country = "FR";		
$PhoneNumber = "0606060606";	
$DeliveryComment = "commentaire";
$BesoinControle = "";	
$TexteGeneral = "Commande ok";	
$TexteFactProforma = "Facture OK";
$TexteBonPrepa = "Bp OK";
$CodeClientFact	= "";	
$CodeClientLivre = "";	
$CodeClientPayeur = "";
$DateLivrSouhai	= $date;	



// Appel de la requête
$request = new \CreateOrder($hashkey,$publicKey, $WebOrderId, $WebClientId, $OrderDate,$AddressAlias, $AddressLine1, $AddressLine2, $Building, $PostalCode, $City, $Country, $PhoneNumber, $DeliveryComment,$BesoinControle,$TexteGeneral,$TexteFactProforma,$TexteBonPrepa,$CodeClientFact,$CodeClientLivre,$CodeClientPayeur,$DateLivrSouhai);

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


