<?php
/*
 * TEST SOAP ABO
 * 
 * */
 
$wsdl = 'https://test-ws.hipay.com/soap/subscription?wsdl';
$initArray = array(

  'wsLogin' => 'aa24730301681c867a22a66302d9051f',
  'wsPassword' => '8ea1cf040c69680a22a08e5b7c74848e',
  'websiteId' => 317107,
  'categoryId' => 149,
  'customerEmail' => 'arnaudpons@gemperles.com',
);

$options = array(
                'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
                'cache_wsdl' => WSDL_CACHE_NONE,
            );
try{
            $client = new SoapClient($wsdl, $options);
            //$result = $client->process($initArray + array(
            $result = $client->__soapCall('process', array(
                    'currency' => 'EUR',
                    'rating' => 'ALL',
                    'locale' => 'fr_BE',
                    'label' => 'Test Order for Gemperles', //'Abonnement web service',
                    'customerIpAddress' => $_SERVER['SERVER_ADDR'], //$_SERVER['REMOTE_ADDR'],
                    'merchantReference' => '50287375028737', // 'REF-ABO15',
                    'merchantDatas' => 'Affiliation',
                    'urlCallback' => 'http://sbu2.magentoprojects.net/hipay/notification.php',
                 	'urlAccept' => 'http://sbu2.magentoprojects.net/hipay/test.php',
                 	'urlDecline' => 'http://sbu2.magentoprojects.net/hipay/test.php',
                 	'urlCancel' => 'http://sbu2.magentoprojects.net/hipay/test.php',

                    'payments' => array(
                    	'initial' => array(
                            'name' => 'Paiement N°1',
                            'description' => 'Paiement récurrent 01',
                            'amount' => 5,
                            'periodType' => 'normal',
                            'manualCapture' => 'no',
                            'recurrence' => array(
                                'frequency' => 1,
                                'duration' => 'month',
                            ),
                        ),
                        'repayment' => array(
                        	array(
                        		'name' => 'Paiement N°2',
                        		'description' => 'Paiement récurrent 02',
                        		'amount' => 5,
                        		'executionTimestamp' => '2016-03-09T09:00:00+00:00',
                        	)
                        ),
                    ),
             	)
             );
var_dump($result);             
}catch(SoapFault $fault) {
    trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
          
?>