/** * Constructs a connector instance. * * Example usage: * * $client = new \GuzzleHttp\Client(['base_url' => 'https://api.klarna.com']); * $connector = new \Klarna\Transport\Connector($client, '0', 'sharedSecret'); * * * @param ClientInterface $client HTTP transport client * @param string $merchantId Merchant ID * @param string $sharedSecret Shared secret * @param UserAgentInterface $userAgent HTTP user agent to identify the client */ public function __construct(ClientInterface $client, $merchantId, $sharedSecret, UserAgentInterface $userAgent = null) { $this->client = $client; $this->merchantId = $merchantId; $this->sharedSecret = $sharedSecret; if ($userAgent === null) { $userAgent = UserAgent::createDefault(); } $this->userAgent = $userAgent; }
/** * Make sure the key, component, version and multiple options are present. * * @return void */ public function testSetFieldTwoOptions() { $this->agent->setField('key', 'component', '1.0.0', ['attr1', 'attr2']); $this->assertEquals('key/component_1.0.0 (attr1; attr2)', strval($this->agent)); }