Ejemplo n.º 1
0
 /**
  * Get API session array
  *
  * @param array $config
  * @return array
  */
 private function getAPISession(array $config)
 {
     $contentBlock = new Content();
     $getApiSession = new ApiSessionCreate();
     $contentBlock->append($getApiSession);
     $requestHandler = new RequestHandler($config);
     $response = $requestHandler->executeSynchronous($config, $contentBlock);
     $operation = $response->getOperation();
     $authentication = $operation->getAuthentication();
     $result = $operation->getResult(0);
     $data = $result->getData();
     $api = $data->api;
     $session = ['session_id' => strval($api->sessionid), 'endpoint_url' => strval($api->endpoint), 'verify_ssl' => $requestHandler->getVerifySSL(), 'current_company_id' => $authentication->getCompanyId(), 'current_user_id' => $authentication->getUserId(), 'current_user_is_external' => $authentication->getSlideInUser()];
     return $session;
 }
Ejemplo n.º 2
0
 /**
  * @covers Intacct\Content::__construct
  */
 public function testContent()
 {
     $contentBlock = new Content();
     $func = new ApiSessionCreate();
     $contentBlock->append($func);
 }
Ejemplo n.º 3
0
 /**
  * @covers Intacct\Xml\Request\OperationBlock::__construct
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Required "company_id", "user_id", and "user_password" keys, or "session_id" key, not supplied in params
  */
 public function testNoCredentials()
 {
     $config = ['session_id' => null, 'company_id' => null, 'user_id' => null, 'user_password' => null];
     $contentBlock = new Content();
     $func = new ApiSessionCreate();
     $contentBlock->append($func);
     new OperationBlock($config, $contentBlock);
 }