Skip to content

Commit ea5b3c1

Browse files
committed
Added last_seen and confidence
1 parent f5e5e07 commit ea5b3c1

7 files changed

Lines changed: 49 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Added `getQueriesRemaining()` and `getFundsRemaining()`. Note that
1010
`getFundsRemaining()` will not be returned by the web service until our new
1111
credit system is in place.
12+
* Added `getLastSeen()` and `getConfidence()` to the `Device` response model.
1213
* This API now throws an `IllegalArgumentException` when `null` values are
1314
passed to constructors or methods that require non-null values.
1415

src/main/java/com/maxmind/minfraud/request/Payment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public final class Payment extends AbstractModel {
1111
private final Boolean wasAuthorized;
1212
private final String declineCode;
1313

14-
public Payment(Payment.Builder builder) {
14+
private Payment(Payment.Builder builder) {
1515
processor = builder.processor;
1616
wasAuthorized = builder.wasAuthorized;
1717
declineCode = builder.declineCode;

src/main/java/com/maxmind/minfraud/request/Transaction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public final class Transaction extends AbstractModel {
2121
private final Shipping shipping;
2222
private final List<ShoppingCartItem> shoppingCart;
2323

24-
protected Transaction(Transaction.Builder builder) {
24+
private Transaction(Transaction.Builder builder) {
2525
account = builder.account;
2626
billing = builder.billing;
2727
creditCard = builder.creditCard;

src/main/java/com/maxmind/minfraud/response/Device.java

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,57 @@
77

88
/**
99
* This class contains minFraud response data related to the device.
10+
*
11+
* In order to receive device output from minFraud Insights or minFraud
12+
* Factors, you must be using the Device Tracking Add-on.
13+
*
14+
* @see <a href="https://dev.maxmind.com/minfraud/device/">Device Tracking Add-on</a>
15+
1016
*/
1117
public final class Device extends AbstractModel {
18+
private final Double confidence;
1219
private final UUID id;
20+
private final String lastSeen;
1321

1422
public Device(
15-
@JsonProperty("id") UUID id
23+
@JsonProperty("confidence") Double confidence,
24+
@JsonProperty("id") UUID id,
25+
@JsonProperty("last_seen") String lastSeen
1626
) {
27+
this.confidence = confidence;
1728
this.id = id;
29+
this.lastSeen = lastSeen;
1830
}
1931

2032
public Device() {
21-
this(null);
33+
this(null, null, null);
34+
}
35+
36+
/**
37+
* @return a number representing the confidence that the device ID refers
38+
* to a unique device as opposed to a cluster of similar devices. A
39+
* confidence of 0.01 indicates very low confidence that the device is
40+
* unique, whereas 99 indicates very high confidence.
41+
*/
42+
public Double getConfidence() {
43+
return confidence;
2244
}
2345

2446
/**
25-
* @return The device id.
47+
* @return A UUID identifying the device associated with this IP address.
48+
* Note that many devices cannot be uniquely identified because they are too
49+
* common (for example, all iPhones of a given model and OS release).
2650
*/
2751
public UUID getId() {
2852
return id;
2953
}
54+
55+
/**
56+
* @return The date and time of the last sighting of the device. This is an
57+
* RFC 3339 date-time.
58+
*/
59+
@JsonProperty("last_seen")
60+
public String getLastSeen() {
61+
return lastSeen;
62+
}
3063
}

src/test/java/com/maxmind/minfraud/response/DeviceTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ public void testDevice() throws Exception {
1616
JSON.std
1717
.composeString()
1818
.startObject()
19+
.put("confidence", 99)
1920
.put("id", "C8D3BE1A-BE26-11E5-8C50-1B575C37265F")
21+
.put("last_seen", "2016-06-08T14:16:38Z")
2022
.end()
2123
.finish()
2224
);
2325

26+
assertEquals(99.0, device.getConfidence().doubleValue(), 1e-15);
2427
assertEquals(UUID.fromString("C8D3BE1A-BE26-11E5-8C50-1B575C37265F"), device.getId());
28+
assertEquals("2016-06-08T14:16:38Z", device.getLastSeen());
2529
}
2630
}

src/test/resources/test-data/factors-response.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@
111111
"type": "credit"
112112
},
113113
"device": {
114-
"id": "7835b099-d385-4e5b-969e-7df26181d73b"
114+
"confidence": 99,
115+
"id": "7835b099-d385-4e5b-969e-7df26181d73b",
116+
"last_seen": "2016-06-08T14:16:38Z"
115117
},
116118
"email": {
117119
"is_free": true,

src/test/resources/test-data/insights-response.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@
111111
"type": "credit"
112112
},
113113
"device": {
114-
"id": "7835b099-d385-4e5b-969e-7df26181d73b"
114+
"confidence": 99,
115+
"id": "7835b099-d385-4e5b-969e-7df26181d73b",
116+
"last_seen": "2016-06-08T14:16:38Z"
115117
},
116118
"email": {
117119
"is_free": true,

0 commit comments

Comments
 (0)