/** * @param $userId * * @return CoostoAuthContainer * @throws Exception */ public function getAuthContainer($userId) { $userCredentials = $this->_UserCredentials->getCredentials($userId); $login = $this->_login($userCredentials['UserCredentials']['username'], $userCredentials['UserCredentials']['password']); if ($login['status'] !== 'success') { throw new Exception(sprintf('Could not authenticate Costoo user %s', $userCredentials['UserCredentials']['username'])); } $this->_coostoApi->addDefaultQueryString('sessionid', $login['data']['sessionid']); $authContainer = new CoostoAuthContainer(); $authContainer->coostoApi = $this->_coostoApi; return $authContainer; }