public class SiftScienceHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static SiftScienceResponse |
deserializeResponse(String $response)
|
static SiftScienceScore |
deserializeScore(String $scoreResponse)
Deserializes the score returned by Sift Science.
|
static SiftScienceScore |
getScore(String api_key,
String userId)
Retrieve a risk assessment of a particular user.
|
static SiftScienceResponse |
send(Event event)
Sends an event ($transaction, $create_account, etc ...) to Sift Science.
|
static SiftScienceResponse |
send(String userId,
Label label)
Sends a Label ($label) to Sift Science.
|
static String |
serialize(Event event)
Serializes an event as a JSON envelope, ready to be sent to Sift Science.
|
static String |
serialize(Label label) |
public static SiftScienceResponse send(Event event)
event - - the content regarding the user (or session) in question.public static SiftScienceResponse send(String userId, Label label)
userId - - the user in questionlabel - - the content regarding the user in question.public static SiftScienceScore getScore(String api_key, String userId)
api_key - - the api key to denote which Sift Science account to use.userId - - the user would you like to run a risk assessment on.SiftScienceScore instance containing information such as the
fraud score and the reason.
Refer to the class' JavaDocs for more information.public static String serialize(Event event) throws IOException
Serializes an event as a JSON envelope, ready to be sent to Sift Science.
Useful if you have your own way of sending the envelope. Should you require a way of
sending the envelope via Http, you can make use of send(Event).
event - the filled event POJO, ready to be serializedIOException - thrown whenever an error (unexpected or user-inflicted) has been found during serialization of the event.public static String serialize(Label label) throws IOException
IOExceptionpublic static SiftScienceResponse deserializeResponse(String $response) throws IOException
$response - the JSON envelope withholding Sift Science's response.IOException - thrown whenever an error (unexpected or user-inflicted) has been found during deserialization of the event or label.public static SiftScienceScore deserializeScore(String $scoreResponse) throws IOException
Deserializes the score returned by Sift Science.
Useful if you have your own way of sending and receiving requests. Should you require a way of
receiving the score Http, you can make use of getScore(String, String).
$scoreResponse - the JSON envelope withholding Sift Science's response.IOException - thrown whenever an error (unexpected or user-inflicted) has been found during deserialization of the score.Copyright © 2014. All rights reserved.