11package com .maxmind .minfraud .request ;
22
3+ import com .fasterxml .jackson .annotation .JsonIgnore ;
34import com .fasterxml .jackson .annotation .JsonProperty ;
45import com .maxmind .minfraud .AbstractModel ;
56
7+ import java .time .ZoneId ;
8+ import java .time .ZonedDateTime ;
69import java .util .Date ;
710
811public final class Event extends AbstractModel {
912
1013 private final String transactionId ;
1114 private final String shopId ;
12- private final Date time ;
15+ private final ZonedDateTime time ;
1316 private final Type type ;
1417
1518 private Event (Event .Builder builder ) {
@@ -26,7 +29,7 @@ private Event(Event.Builder builder) {
2629 public static final class Builder {
2730 String transactionId ;
2831 String shopId ;
29- Date time ;
32+ ZonedDateTime time ;
3033 Type type ;
3134
3235 /**
@@ -58,7 +61,16 @@ public Event.Builder shopId(String id) {
5861 * @return The builder object.
5962 */
6063 public Event .Builder time (Date date ) {
61- time = new Date (date .getTime ());
64+ time = date .toInstant ().atZone (ZoneId .systemDefault ());
65+ return this ;
66+ }
67+
68+ /**
69+ * @param date The date and time the event occurred.
70+ * @return The builder object.
71+ */
72+ public Event .Builder time (ZonedDateTime date ) {
73+ time = date ;
6274 return this ;
6375 }
6476
@@ -99,8 +111,16 @@ public String getShopId() {
99111 /**
100112 * @return The date and time of the event.
101113 */
102- @ JsonProperty ( "time" )
114+ @ JsonIgnore
103115 public Date getTime () {
116+ return Date .from (time .toInstant ());
117+ }
118+
119+ /**
120+ * @return The date and time of the event.
121+ */
122+ @ JsonProperty ("time" )
123+ public ZonedDateTime getDateTime () {
104124 return time ;
105125 }
106126
0 commit comments