Repository navigation
STF-2006: Add email verification inputs #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| import java.security.MessageDigest; | ||
| import java.security.NoSuchAlgorithmException; | ||
| import java.text.Normalizer; | ||
| import java.time.ZonedDateTime; | ||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
|
|
@@ -22,6 +23,8 @@ public final class Email extends AbstractModel { | |
| private final String address; | ||
| private final boolean hashAddress; | ||
| private final String domain; | ||
| private final ZonedDateTime verificationTime; | ||
| private final Boolean wasVerificationSuccessful; | ||
| private static final Map<String, String> typoDomains; | ||
| private static final Map<String, String> typoTlds; | ||
| private static final Map<String, String> equivalentDomains; | ||
|
|
@@ -299,6 +302,8 @@ private Email(Email.Builder builder) { | |
| address = builder.address; | ||
| hashAddress = builder.hashAddress; | ||
| domain = builder.domain; | ||
| verificationTime = builder.verificationTime; | ||
| wasVerificationSuccessful = builder.wasVerificationSuccessful; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -309,6 +314,8 @@ public static final class Builder { | |
| private String address; | ||
| private boolean hashAddress; | ||
| private String domain; | ||
| private ZonedDateTime verificationTime; | ||
| private Boolean wasVerificationSuccessful; | ||
|
|
||
| /** | ||
| * The constructor for the builder. | ||
|
|
@@ -384,6 +391,30 @@ public Email.Builder domain(String domain) { | |
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * @param time The date and time of the most recent attempt to verify the email address, | ||
| * if known. The time must not be before 1970-01-01T00:00:00Z or more than | ||
| * two days in the future. The web service ignores a time outside this range | ||
| * and returns a warning. | ||
| * @return The builder object. | ||
| */ | ||
| public Email.Builder verificationTime(ZonedDateTime time) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: a Jackson writes the offset as
Both times are in the valid range. The server returns an This is rare in practice. Liberia used Suggested fix: fix it once in 馃 Comment by Claude Opus 5.5.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reply by Claude Opus 5.5 on Greg's behalf. We will leave this for a follow-up, STF-2206. |
||
| verificationTime = time; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * @param wasSuccessful Whether the most recent verification that the end user controls | ||
| * the email address succeeded, for example by confirming a link | ||
| * sent to the address. Do not set this if no verification was | ||
| * attempted. | ||
| * @return The builder object. | ||
| */ | ||
| public Email.Builder wasVerificationSuccessful(Boolean wasSuccessful) { | ||
| wasVerificationSuccessful = wasSuccessful; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * @return An instance of {@code Email} created from the fields set on this builder. | ||
| */ | ||
|
|
@@ -572,4 +603,21 @@ private static boolean isValidDomainLabel(String label) { | |
| public String domain() { | ||
| return domain; | ||
| } | ||
|
|
||
| /** | ||
| * @return The date and time of the most recent attempt to verify the email address. | ||
| */ | ||
| @JsonProperty("verification_time") | ||
| public ZonedDateTime verificationTime() { | ||
| return verificationTime; | ||
| } | ||
|
|
||
| /** | ||
| * @return Whether the most recent verification that the end user controls the email | ||
| * address succeeded. | ||
| */ | ||
| @JsonProperty("was_verification_successful") | ||
| public Boolean wasVerificationSuccessful() { | ||
| return wasVerificationSuccessful; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| "party": "customer", | ||
| "transaction_id": "txn3134133", | ||
| "shop_id": "s2123", | ||
| "time": "2012-04-12T23:20:50.52Z", | ||
| "time": "2026-10-05T23:20:50.52Z", | ||
| "type": "purchase" | ||
| }, | ||
| "account": { | ||
|
|
@@ -12,7 +12,9 @@ | |
| }, | ||
| "email": { | ||
| "address": "test@maxmind.com", | ||
| "domain": "maxmind.com" | ||
| "domain": "maxmind.com", | ||
| "verification_time": "2026-10-01T14:30:00Z", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: in this fixture, This is test data only, so it has no effect on behavior. The README is correct, because it uses Suggested fix: use a verification time before the event time, or move the event time to a recent date. 馃 Comment by Claude Opus 5.5.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reply by Claude Opus 5.5 on Greg's behalf. Fixed in 7b97801. The test event time is now 2026-10-05, after every verification time. This also fixes the phone times in the fixtures. |
||
| "was_verification_successful": true | ||
| }, | ||
| "billing": { | ||
| "first_name": "First", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the email and phone time docs now use different wording. This says "the most recent attempt to verify the email address, if known" (here and on line 608).
phoneVerificationTimeinAbstractLocation.java(lines 198 and 323) says "the most recent verification of the phone number". The changelog bullets (lines 9 and 15) also say "most recent verification".The two inputs have the same meaning: the time also applies when
wasVerificationSuccessfulisfalse. The "attempt" wording here is more accurate, and it matches the dev-site text. The phone inputs are also unreleased (4.5.0), so the phone Javadoc and the changelog can use the same wording now.馃 Comment by Claude Opus 5.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given it's about phone, we can leave it