11package com .maxmind .minfraud .response ;
22
3+ import com .fasterxml .jackson .annotation .JsonIgnore ;
34import com .fasterxml .jackson .annotation .JsonProperty ;
45import com .maxmind .minfraud .AbstractModel ;
56
7+ import java .time .LocalDate ;
8+
69/**
710 * This class contains minFraud response data related to the email address.
811 */
@@ -11,13 +14,16 @@ public final class Email extends AbstractModel {
1114 private final Boolean isFree ;
1215 private final Boolean isHighRisk ;
1316 private final String firstSeen ;
17+ private final EmailDomain domain ;
1418
1519 public Email (
20+ @ JsonProperty ("domain" ) EmailDomain domain ,
1621 @ JsonProperty ("is_disposable" ) Boolean isDisposable ,
1722 @ JsonProperty ("is_free" ) Boolean isFree ,
1823 @ JsonProperty ("is_high_risk" ) Boolean isHighRisk ,
1924 @ JsonProperty ("first_seen" ) String firstSeen
2025 ) {
26+ this .domain = domain ;
2127 this .isDisposable = isDisposable ;
2228 this .isFree = isFree ;
2329 this .isHighRisk = isHighRisk ;
@@ -26,6 +32,15 @@ public Email(
2632
2733 // The following constructors are for backward compatibility and
2834 // can be removed as part of a major release
35+ public Email (
36+ Boolean isDisposable ,
37+ Boolean isFree ,
38+ Boolean isHighRisk ,
39+ String firstSeen
40+ ) {
41+ this (null , isDisposable , isFree , isHighRisk , firstSeen );
42+ }
43+
2944 public Email (
3045 Boolean isFree ,
3146 Boolean isHighRisk ,
@@ -45,6 +60,12 @@ public Email() {
4560 this (null , null , null );
4661 }
4762
63+ /**
64+ * @return The {@code EmailDomain} model object.
65+ */
66+ public EmailDomain getDomain () {
67+ return domain ;
68+ }
4869
4970 /**
5071 * @return Whether the email address is from a disposable email provider.
@@ -84,4 +105,16 @@ public Boolean isHighRisk() {
84105 public String getFirstSeen () {
85106 return firstSeen ;
86107 }
108+
109+ /**
110+ * @return A date to identify the date an email address was first seen by
111+ * MaxMind.
112+ */
113+ @ JsonIgnore
114+ public LocalDate getFirstSeenDate () {
115+ if (firstSeen == null ) {
116+ return null ;
117+ }
118+ return LocalDate .parse (firstSeen );
119+ }
87120}
0 commit comments