<?php
ini_set('soap.wsdl_cache_ttl', 1);
ini_set("soap.wsdl_cache_enabled", WSDL_CACHE_NONE);
date_default_timezone_set('Europe/Paris');

$client = new SoapClient("https://ws.hipay.com/soap/payment-v2?wsdl",
    array('features' =>  SOAP_SINGLE_ELEMENT_ARRAYS, 'trace' => 1));

$parameters = new stdClass();
$freeData = array();
$aFreeData1 = new stdClass();
$aFreeData1->key = "cart_id";
$aFreeData1->value = "3481";
    
$aFreeData2 = new stdClass();
$aFreeData2->key = "customer_id";
$aFreeData2->value = "1659";

$aFreeData3 = new stdClass();
$aFreeData3->key = "secure_key";
$aFreeData3->value = "facbf2b35e4b2511355026f0ca2b245d";

$aFreeData4 = new stdClass();
$aFreeData4->key = "token";
$aFreeData4->value = "0a1603c51ea4c3f5cee05d1388fa4766";
    
//$freeData =  array_merge($aFreeData1, $aFreeData2, $aFreeData3, $aFreeData4);
        
$parameters->parameters = array(
	'wsLogin'			=> '2233a9e1ad3ab72445dd2da63fa4093b', // Prod Coquine Privee
	'wsPassword'		=> '3929efcf3dd60871f02cd76de59133a4',  // Prod Coquine Privee
   	'websiteId' 		=> '394236', 
   	'amount' 			=> '16.98', 
   	'categoryId' 		=> '0', 
   	'currency' 			=> 'EUR', 
   	'customerEmail' 	=> 'test01@test.com', 
   	'customerIpAddress' => '127.0.0.0', 
   	'description' 		=> '3481',
	'merchantComment' 	=> '3481',
	'emailCallback' 	=> 'contact@coquineprivee.com',
	'executionDate' 	=> date('Y-m-dTH:i:s', time()),
	'locale' 			=> 'fr_FR', 
	'manualCapture' 	=> '0', 
	'rating' 			=> 'ALL',
	'wsSubAccountId' 	=> '9077917',
	'method' 			=> '',
   	'urlAccept' 		=>  'https://coquineprivee.com/module/hipay_professional/confirmation?cart_id=3481&secure_key=facbf2b35e4b2511355026f0ca2b245d', 
   	'urlCallback' 		=>  'https://coquineprivee.com/module/hipay_professional/validation?cart_id=3481&secure_key=facbf2b35e4b2511355026f0ca2b245d', 
   	'urlCancel' 		=>  'https://coquineprivee.com/commande?step=3',
	'urlDecline'	 	=>  'https://coquineprivee.com/module/hipay_professional/confirmation?cart_id=3481&failure=1&secure_key=facbf2b35e4b2511355026f0ca2b245d', 
   	'urlLogo' 			=>  'https://coquineprivee.com/img/prestashop-logo-1462176194.jpg', 
   	//'freeData' 			=> $freeData,
		
);

$response = $client->generate($parameters);
header('Content-Type: text/xml; charset=UTF-8');

//echo "<strong>Request</strong><br/><pre>"; // . $client->__getLastRequest();
echo $client->__getLastRequest();// . "</pre>";

//echo "<p><br/><strong>Response</strong><br/></p><pre>";
//var_dump($response);
//echo $client->__getLastResponse() . "</pre>";


?>

