Skip to content

Commit f4ac597

Browse files
committed
Add support for /email/is_disposable
1 parent 0bcc146 commit f4ac597

5 files changed

Lines changed: 38 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
CHANGELOG
22
=========
33

4+
1.11.0
5+
-------------------
6+
7+
* Added support for the new email output `/email/is_disposable`. This can
8+
be accessed via the `isDisposable()` method on the `Email` response
9+
object.
10+
411
1.10.0 (2019-12-19)
512
-------------------
613

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,57 @@
77
* This class contains minFraud response data related to the email address.
88
*/
99
public final class Email extends AbstractModel {
10+
private final Boolean isDisposable;
1011
private final Boolean isFree;
1112
private final Boolean isHighRisk;
1213
private final String firstSeen;
1314

1415
public Email(
16+
@JsonProperty("is_disposable") Boolean isDisposable,
1517
@JsonProperty("is_free") Boolean isFree,
1618
@JsonProperty("is_high_risk") Boolean isHighRisk,
1719
@JsonProperty("first_seen") String firstSeen
1820
) {
21+
this.isDisposable = isDisposable;
1922
this.isFree = isFree;
2023
this.isHighRisk = isHighRisk;
2124
this.firstSeen = firstSeen;
2225
}
2326

27+
// The following constructors are for backward compatibility and
28+
// can be removed as part of a major release
29+
public Email(
30+
Boolean isFree,
31+
Boolean isHighRisk,
32+
String firstSeen
33+
) {
34+
this(null, isFree, isHighRisk, firstSeen);
35+
}
36+
2437
public Email(
2538
Boolean isFree,
2639
Boolean isHighRisk
2740
) {
28-
this(isFree, isHighRisk, null);
41+
this(null, isFree, isHighRisk, null);
2942
}
3043

3144
public Email() {
3245
this(null, null, null);
3346
}
3447

48+
49+
/**
50+
* @return Whether the email address is from a disposable email provider.
51+
* If no email address was passed, this will be {@code null}.
52+
*/
53+
@JsonProperty("is_disposable")
54+
public Boolean isDisposable() {
55+
return isDisposable;
56+
}
57+
3558
/**
59+
* /**
60+
*
3661
* @return True if the email address is for a free email service provider.
3762
*/
3863
@JsonProperty("is_free")

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ public void testEmail() throws Exception {
1414
JSON.std
1515
.composeString()
1616
.startObject()
17+
.put("is_disposable", false)
1718
.put("is_free", false)
1819
.put("is_high_risk", true)
1920
.put("first_seen", "2017-01-02")
2021
.end()
2122
.finish()
2223
);
2324

25+
assertFalse(email.isDisposable());
2426
assertFalse(email.isFree());
2527
assertTrue(email.isHighRisk());
2628
assertEquals(email.getFirstSeen(), "2017-01-02");
@@ -39,6 +41,7 @@ public void testEmailWithoutFirstSeen() throws Exception {
3941
.finish()
4042
);
4143

44+
assertNull(email.isDisposable());
4245
assertFalse(email.isFree());
4346
assertTrue(email.isHighRisk());
4447
assertNull(email.getFirstSeen());

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
},
131131
"email": {
132132
"first_seen": "2017-01-02",
133+
"is_disposable": true,
133134
"is_free": true,
134135
"is_high_risk": true
135136
},

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
},
147147
"email": {
148148
"first_seen": "2017-01-02",
149+
"is_disposable": true,
149150
"is_free": true,
150151
"is_high_risk": true
151152
},

0 commit comments

Comments
 (0)