private function SetSoapClient($config) { $libraryProperties = \Svea\Helper::getSveaLibraryProperties(); $libraryName = $libraryProperties['library_name']; $libraryVersion = $libraryProperties['library_version']; $integrationProperties = \Svea\Helper::getSveaIntegrationProperties($config); $integrationPlatform = $integrationProperties['integration_platform']; $integrationCompany = $integrationProperties['integration_company']; $integrationVersion = $integrationProperties['integration_version']; $client = new \SoapClient($this->svea_server, array("trace" => 1, 'stream_context' => stream_context_create(array('http' => array('header' => 'X-Svea-Library-Name: ' . $libraryName . "\n" . 'X-Svea-Library-Version: ' . $libraryVersion . "\n" . 'X-Svea-Integration-Platform: ' . $integrationPlatform . "\n" . 'X-Svea-Integration-Company: ' . $integrationCompany . "\n" . 'X-Svea-Integration-Version: ' . $integrationVersion))))); return $client; }
/** * When used from PHP, the SveaWebPay Administration Service requires some configuration. * getSoapClient() takes the config and eturns a SoapClient with a working set * of options, bypassing the server wsdl. * * @param ConfigurationProvider $config * @param string $orderType * @return SoapClient */ public function setSoapClient($config, $orderType) { $libraryProperties = \Svea\Helper::getSveaLibraryProperties(); $libraryName = $libraryProperties['library_name']; $libraryVersion = $libraryProperties['library_version']; $integrationProperties = \Svea\Helper::getSveaIntegrationProperties($config); $integrationPlatform = $integrationProperties['integration_platform']; $integrationCompany = $integrationProperties['integration_company']; $integrationVersion = $integrationProperties['integration_version']; $endpoint = $config->getEndPoint($orderType); $client = new \SoapClient(null, array('location' => $endpoint, 'uri' => "http://tempuri.org/", 'use' => SOAP_LITERAL, 'exceptions' => 1, 'connection_timeout' => 60, 'trace' => 1, 'soap_version' => SOAP_1_1, 'stream_context' => stream_context_create(array('http' => array('header' => 'X-Svea-Library-Name: ' . $libraryName . "\n" . 'X-Svea-Library-Version: ' . $libraryVersion . "\n" . 'X-Svea-Integration-Platform: ' . $integrationPlatform . "\n" . 'X-Svea-Integration-Company: ' . $integrationCompany . "\n" . 'X-Svea-Integration-Version: ' . $integrationVersion))))); return $client; }
/** * Given a ConfigurationProvider, return a json string containing the Svea integration package (library) * and integration (from config) name, version et al. Used by HostedService requests. * @param ConfigurationProvider $config * @return string in json format */ static function getLibraryAndPlatformPropertiesAsJson($config) { $libraryProperties = \Svea\Helper::getSveaLibraryProperties(); $libraryName = $libraryProperties['library_name']; $libraryVersion = $libraryProperties['library_version']; $integrationProperties = \Svea\Helper::getSveaIntegrationProperties($config); $integrationPlatform = $integrationProperties['integration_platform']; $integrationCompany = $integrationProperties['integration_company']; $integrationVersion = $integrationProperties['integration_version']; $properties_json = '{' . '"X-Svea-Library-Name": "' . $libraryName . '", ' . '"X-Svea-Library-Version": "' . $libraryVersion . '", ' . '"X-Svea-Integration-Platform": "' . $integrationPlatform . '", ' . '"X-Svea-Integration-Company": "' . $integrationCompany . '", ' . '"X-Svea-Integration-Version": "' . $integrationVersion . '"' . '}'; return $properties_json; }