Fluent builder for a FraudContext, the description of the operation a fraud rule is asked to score. Obtained from fraudManager.newContextBuilder. Only the two values every rule needs are required - the context type naming the operation, and the account it belongs to - with the profile, IP address, user agent, subject and any custom attributes optional. Call build to produce the immutable context.
Group: Builders
Methods
contextType(FraudContextType contextType) · contextTypeName(String contextTypeName) · adminOrg(Organisation adminOrg) · website(Website website) · profile(Profile profile) · ipAddress(String ipAddress) · userAgent(String userAgent) · subject(String subjectType, Long subjectId) · attribute(String name, Object value) · build()
contextType(FraudContextType contextType)
Returns: Builder
Set which operation is being scored.
| Parameter | Description |
|---|---|
contextType | which operation is being scored. Must not be null |
contextTypeName(String contextTypeName)
Returns: Builder
Set the context type by name, for script callers who have a string.
| Parameter | Description |
|---|---|
contextTypeName | one of the FraudContextType names. Must not be blank |
adminOrg(Organisation adminOrg)
Returns: Builder
Set the account the operation belongs to.
| Parameter | Description |
|---|---|
adminOrg | the account the operation belongs to. Must not be null |
website(Website website)
Returns: Builder
Set the website the operation happened on.
| Parameter | Description |
|---|---|
website | the website the operation happened on, or null |
profile(Profile profile)
Returns: Builder
Set the profile the operation is for.
| Parameter | Description |
|---|---|
profile | the profile the operation is for, or null for a signup |
ipAddress(String ipAddress)
Returns: Builder
Set the client IP the operation came from.
| Parameter | Description |
|---|---|
ipAddress | the client IP, or null if unknown |
userAgent(String userAgent)
Returns: Builder
Set the client's user agent header.
| Parameter | Description |
|---|---|
userAgent | the client's user agent header, or null |
subject(String subjectType, Long subjectId)
Returns: Builder
Set what the operation's subject is and its persisted id.
| Parameter | Description |
|---|---|
subjectType | what the subject is, eg "cart". May be null |
subjectId | the subject's id. May be null when the subject is not persisted yet |
attribute(String name, Object value)
Returns: Builder
Set one context-specific attribute.
| Parameter | Description |
|---|---|
name | the attribute name. Must not be blank |
value | the attribute value. May be null, in which case nothing is set |
build()
Returns: FraudContext
Build the context from the values set so far.