/** * Fetch user fraud score details * * @see https://siftscience.com/docs/getting-scores * * @param string $userId * @return Score */ public function userScore($userId) { $path = sprintf('score/%s/?%s', $userId, http_build_query(array('api_key' => $this->apiKey))); $scoreData = $this->send($this->httpClient->get($path)); return Score::fromArray($scoreData); }
public function testFromArrayWithError() { $this->setExpectedException('Sift\\Exception\\ScoreException'); Score::fromArray(array('status' => 54, 'error_message' => 'No events for specified user')); }