Skip to content

Commit a422f35

Browse files
oschwaldclaude
andcommitted
Use record-style method naming for request and exception classes
Updated all request and exception classes to use record-style method naming by removing the "get" prefix from accessor methods. This provides consistency with the response classes that were recently converted to Java records. Request classes updated: - Account, Email, Device, CreditCard, Transaction, TransactionReport - Billing, Shipping, AbstractLocation, ShoppingCartItem - Payment, Order, Event, CustomInputs Exception classes updated: - HttpException (httpStatus, uri) - InvalidRequestException (code, httpStatus, uri) Unlike response classes, no deprecated helper methods were added as these methods are primarily used for serialization. All 210 tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d36ec60 commit a422f35

31 files changed

Lines changed: 262 additions & 249 deletions

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CHANGELOG
77
* BREAKING: Removed deprecated `TransactionReport.Builder(InetAddress, Tag)`
88
constructor. Use `Builder(Tag)` and `ipAddress(InetAddress)` instead.
99
* BREAKING: Removed deprecated `getUrl()` methods from `HttpException` and
10-
`InvalidRequestException`. Use `getUri()` instead.
10+
`InvalidRequestException`. Use `uri()` instead.
1111
* BREAKING: Removed deprecated constructors from `FactorsResponse`,
1212
`InsightsResponse`, and `Phone` classes.
1313
* BREAKING: Removed deprecated `Subscores` class and
@@ -38,6 +38,19 @@ CHANGELOG
3838
* All response classes now implement `JsonSerializable` instead of extending
3939
`AbstractModel`. The `toJson()` method remains available for serialization.
4040
* Removed the `AbstractAddress` interface.
41+
* BREAKING: Updated all request classes to use record-style method naming. The
42+
`get` prefix has been removed from all accessor methods (e.g., use `userId()`
43+
instead of `getUserId()`). This applies to all request classes including
44+
`Account`, `Billing`, `CreditCard`, `CustomInputs`, `Device`, `Email`,
45+
`Event`, `Order`, `Payment`, `Shipping`, `ShoppingCartItem`, `Transaction`,
46+
and `TransactionReport`. Unlike response classes, no deprecated helper methods
47+
were added as these methods are primarily used for serialization.
48+
* BREAKING: Updated exception classes to use record-style method naming. The
49+
`get` prefix has been removed from all accessor methods. For `HttpException`,
50+
use `httpStatus()` and `uri()` instead of `getHttpStatus()` and `getUri()`.
51+
For `InvalidRequestException`, use `code()`, `httpStatus()`, and `uri()`
52+
instead of `getCode()`, `getHttpStatus()`, and `getUri()`. No deprecated
53+
helper methods were added.
4154
* Added `CREDIT_APPLICATION` and `FUND_TRANSFER` to the `Event.Type` enum.
4255
* Added the input `/event/party`. This is the party submitting the
4356
transaction. You may provide this using the `party` method on

src/main/java/com/maxmind/minfraud/exception/HttpException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ public HttpException(String message, int httpStatus, URI uri,
3838
/**
3939
* @return the HTTP status of the query that caused the exception.
4040
*/
41-
public int getHttpStatus() {
41+
public int httpStatus() {
4242
return httpStatus;
4343
}
4444

4545
/**
4646
* @return the URI queried.
4747
*/
48-
public URI getUri() {
48+
public URI uri() {
4949
return this.uri;
5050
}
5151

src/main/java/com/maxmind/minfraud/exception/InvalidRequestException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ public InvalidRequestException(String message, String code, int httpStatus,
4242
/**
4343
* @return The error code returned by the MaxMind web service.
4444
*/
45-
public final String getCode() {
45+
public final String code() {
4646
return code;
4747
}
4848

4949
/**
5050
* @return The integer HTTP status returned by the MaxMind web service. Will be 0 if it was not
5151
* set at throw time.
5252
*/
53-
public final int getHttpStatus() {
53+
public final int httpStatus() {
5454
return httpStatus;
5555
}
5656

5757
/**
5858
* @return the URI queried.
5959
*/
60-
public URI getUri() {
60+
public URI uri() {
6161
return this.uri;
6262
}
6363

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,23 @@ public final T phoneNumber(String number) {
168168
* @return The first name associated with the address
169169
*/
170170
@JsonProperty("first_name")
171-
public final String getFirstName() {
171+
public final String firstName() {
172172
return firstName;
173173
}
174174

175175
/**
176176
* @return The last name associated with the address
177177
*/
178178
@JsonProperty("last_name")
179-
public final String getLastName() {
179+
public final String lastName() {
180180
return lastName;
181181
}
182182

183183
/**
184184
* @return The company name associated with the address
185185
*/
186186
@JsonProperty("company")
187-
public final String getCompany() {
187+
public final String company() {
188188
return company;
189189
}
190190

@@ -193,7 +193,7 @@ public final String getCompany() {
193193
* @return The first line of the address
194194
*/
195195
@JsonProperty("address")
196-
public final String getAddress() {
196+
public final String address() {
197197
return address;
198198
}
199199

@@ -202,7 +202,7 @@ public final String getAddress() {
202202
* @return The second line of the address
203203
*/
204204
@JsonProperty("address_2")
205-
public final String getAddress2() {
205+
public final String address2() {
206206
return address2;
207207
}
208208

@@ -211,7 +211,7 @@ public final String getAddress2() {
211211
* @return The city associated with the address
212212
*/
213213
@JsonProperty("city")
214-
public final String getCity() {
214+
public final String city() {
215215
return city;
216216
}
217217

@@ -220,7 +220,7 @@ public final String getCity() {
220220
* @return The region code associated with the address
221221
*/
222222
@JsonProperty("region")
223-
public final String getRegion() {
223+
public final String region() {
224224
return region;
225225
}
226226

@@ -229,31 +229,31 @@ public final String getRegion() {
229229
* @return The country associated with the address
230230
*/
231231
@JsonProperty("country")
232-
public final String getCountry() {
232+
public final String country() {
233233
return country;
234234
}
235235

236236
/**
237237
* @return The postal code associated with the address
238238
*/
239239
@JsonProperty("postal")
240-
public final String getPostal() {
240+
public final String postal() {
241241
return postal;
242242
}
243243

244244
/**
245245
* @return The phone number associated with the address
246246
*/
247247
@JsonProperty("phone_number")
248-
public final String getPhoneNumber() {
248+
public final String phoneNumber() {
249249
return phoneNumber;
250250
}
251251

252252
/**
253253
* @return The phone number country code associated with the address
254254
*/
255255
@JsonProperty("phone_country_code")
256-
public final String getPhoneCountryCode() {
256+
public final String phoneCountryCode() {
257257
return phoneCountryCode;
258258
}
259259
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ public Account build() {
7070
* @return The user ID.
7171
*/
7272
@JsonProperty("user_id")
73-
public String getUserId() {
73+
public String userId() {
7474
return userId;
7575
}
7676

7777
/**
7878
* @return The MD5 of the username passed to the builder.
7979
*/
8080
@JsonProperty("username_md5")
81-
public String getUsernameMd5() {
81+
public String usernameMd5() {
8282
return usernameMd5;
8383
}
8484
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,31 +195,31 @@ public CreditCard build() {
195195
* @return The issuer ID number.
196196
*/
197197
@JsonProperty("issuer_id_number")
198-
public String getIssuerIdNumber() {
198+
public String issuerIdNumber() {
199199
return issuerIdNumber;
200200
}
201201

202202
/**
203203
* @return The last two or four digits of the credit card number.
204204
*/
205205
@JsonProperty("last_digits")
206-
public String getLastDigits() {
206+
public String lastDigits() {
207207
return lastDigits;
208208
}
209209

210210
/**
211211
* @return The name of the issuing bank as provided by the end user.
212212
*/
213213
@JsonProperty("bank_name")
214-
public String getBankName() {
214+
public String bankName() {
215215
return bankName;
216216
}
217217

218218
/**
219219
* @return The phone country code for the issuing bank as provided by the end user.
220220
*/
221221
@JsonProperty("bank_phone_country_code")
222-
public String getBankPhoneCountryCode() {
222+
public String bankPhoneCountryCode() {
223223
return bankPhoneCountryCode;
224224
}
225225

@@ -228,7 +228,7 @@ public String getBankPhoneCountryCode() {
228228
* end user.
229229
*/
230230
@JsonProperty("bank_phone_number")
231-
public String getBankPhoneNumber() {
231+
public String bankPhoneNumber() {
232232
return bankPhoneNumber;
233233
}
234234

@@ -237,7 +237,7 @@ public String getBankPhoneNumber() {
237237
* located.
238238
*/
239239
@JsonProperty("country")
240-
public String getCountry() {
240+
public String country() {
241241
return country;
242242
}
243243

@@ -246,23 +246,23 @@ public String getCountry() {
246246
* card processor. The minFraud service supports the standard AVS codes.
247247
*/
248248
@JsonProperty("avs_result")
249-
public Character getAvsResult() {
249+
public Character avsResult() {
250250
return avsResult;
251251
}
252252

253253
/**
254254
* @return The card verification value (CVV) code as provided by the payment processor.
255255
*/
256256
@JsonProperty("cvv_result")
257-
public Character getCvvResult() {
257+
public Character cvvResult() {
258258
return cvvResult;
259259
}
260260

261261
/**
262262
* @return A credit card token uniquely identifying the card.
263263
*/
264264
@JsonProperty("token")
265-
public String getToken() {
265+
public String token() {
266266
return token;
267267
}
268268

@@ -274,7 +274,7 @@ public String getToken() {
274274
* resulted in another outcome other than success or failure.
275275
*/
276276
@JsonProperty("was_3d_secure_successful")
277-
public Boolean getWas3dSecureSuccessful() {
277+
public Boolean was3dSecureSuccessful() {
278278
return was3dSecureSuccessful;
279279
}
280280
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private void validateKey(String key) {
103103
* @return an unmodifiable map containing the custom inputs.
104104
*/
105105
@JsonAnyGetter
106-
public Map<String, Object> getInputs() {
106+
public Map<String, Object> inputs() {
107107
return inputs;
108108
}
109109
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,39 +112,39 @@ public Device build() {
112112
* @return The "User-Agent" header.
113113
*/
114114
@JsonProperty("user_agent")
115-
public String getUserAgent() {
115+
public String userAgent() {
116116
return userAgent;
117117
}
118118

119119
/**
120120
* @return The "Accept-Language" header.
121121
*/
122122
@JsonProperty("accept_language")
123-
public String getAcceptLanguage() {
123+
public String acceptLanguage() {
124124
return acceptLanguage;
125125
}
126126

127127
/**
128128
* @return The session age.
129129
*/
130130
@JsonProperty("session_age")
131-
public Double getSessionAge() {
131+
public Double sessionAge() {
132132
return sessionAge;
133133
}
134134

135135
/**
136136
* @return The session id.
137137
*/
138138
@JsonProperty("session_id")
139-
public String getSessionId() {
139+
public String sessionId() {
140140
return sessionId;
141141
}
142142

143143
/**
144144
* @return The IP address used in the transaction.
145145
*/
146146
@JsonProperty("ip_address")
147-
public InetAddress getIpAddress() {
147+
public InetAddress ipAddress() {
148148
return ipAddress;
149149
}
150150
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public Email build() {
395395
* {@link Builder#hashAddress()} as well, or null if you did not set an email address.
396396
*/
397397
@JsonProperty("address")
398-
public String getAddress() {
398+
public String address() {
399399
if (address == null) {
400400
return null;
401401
}
@@ -566,7 +566,7 @@ private static boolean isValidDomainLabel(String label) {
566566
* @return The domain of the email address used in the transaction.
567567
*/
568568
@JsonProperty("domain")
569-
public String getDomain() {
569+
public String domain() {
570570
return domain;
571571
}
572572
}

0 commit comments

Comments
 (0)