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

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

$token = 'test';

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

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

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

$WebOrderId = "WEB-46";
$WebAddressId = "PLUS_UTILISE";
$AmountET = "10";
$AmountIT = "12";
$PaymentMethod = "VCA";
$PaymentId = "134hdkj3kjk34kdaoi3";
$Carrier = "10062508";
$DiscountAmount = "0";
$DiscountPourcent = "0";
$ShippingMethod = "1";
$ShippingCondition = "2";
$Reference = "TEST Référence";

// Appel de la requête
$request = new \ValidateOrder($hashkey,$publicKey, $WebOrderId, $AmountET, $AmountIT, $PaymentMethod, $PaymentId, $Carrier, $DiscountAmount, $DiscountPourcent, $WebAddressId, $ShippingMethod, $ShippingCondition, $Reference);

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