diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 70d7efa9..d2d0620a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,7 +9,7 @@ jobs:
matrix:
distribution: ['zulu']
os: [ubuntu-latest, windows-latest, macos-latest]
- version: [ 11, 17, 21, 22 ]
+ version: [ 17, 21, 24 ]
steps:
- uses: actions/checkout@v5
with:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 06156295..69bb5701 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,20 @@
CHANGELOG
=========
+4.0.0
+------------------
+
+* BREAKING: Removed deprecated `TransactionReport.Builder(InetAddress, Tag)`
+ constructor. Use `Builder(Tag)` and `ipAddress(InetAddress)` instead.
+* BREAKING: Removed deprecated `getUrl()` methods from `HttpException` and
+ `InvalidRequestException`. Use `getUri()` instead.
+* BREAKING: Removed deprecated constructors from `FactorsResponse`,
+ `InsightsResponse`, and `Phone` classes.
+* BREAKING: Removed deprecated `Subscores` class and
+ `FactorsResponse.getSubscores()` method. Use `getRiskScoreReasons()`
+ instead.
+* BREAKING: Java 17 is now required (previously Java 11).
+
3.9.0
------------------
diff --git a/README.md b/README.md
index 754a0fbf..cf298208 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ To do this, add the dependency to your pom.xml:
com.maxmind.minfraud
minfraud
- 3.8.0
+ 4.0.0
```
@@ -29,7 +29,7 @@ repositories {
mavenCentral()
}
dependencies {
- compile 'com.maxmind.minfraud:minfraud:3.8.0'
+ compile 'com.maxmind.minfraud:minfraud:4.0.0'
}
```
@@ -281,7 +281,7 @@ to the client API, please see
## Requirements ##
-This code requires Java 11+.
+This code requires Java 17+.
## Contributing ##
diff --git a/pom.xml b/pom.xml
index 1f8c4061..d25f53bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.maxmind.minfraud
minfraud
- 3.8.0
+ 4.0.0
MaxMind minFraud API
MaxMind minFraud Score, Insights, Factors and Report Transaction API
http://dev.maxmind.com/minfraud
@@ -170,7 +170,7 @@
3.11.3
public
- 11
+ 17
-missing
@@ -206,9 +206,9 @@
maven-compiler-plugin
3.14.0
- 11
- 1.11
- 1.11
+ 17
+ 17
+ 17
diff --git a/src/main/java/com/maxmind/minfraud/WebServiceClient.java b/src/main/java/com/maxmind/minfraud/WebServiceClient.java
index d5cc47f7..f9a561db 100644
--- a/src/main/java/com/maxmind/minfraud/WebServiceClient.java
+++ b/src/main/java/com/maxmind/minfraud/WebServiceClient.java
@@ -24,7 +24,6 @@
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
-import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
@@ -168,7 +167,7 @@ public WebServiceClient.Builder locales(List val) {
if (locales == null) {
throw new IllegalArgumentException("locales must not be null");
}
- locales = new ArrayList<>(val);
+ locales = List.copyOf(val);
return this;
}
@@ -436,17 +435,11 @@ private void handleErrorWithJsonBody(Map content,
}
switch (code) {
- case "ACCOUNT_ID_REQUIRED":
- case "AUTHORIZATION_INVALID":
- case "LICENSE_KEY_REQUIRED":
- case "USER_ID_REQUIRED":
- throw new AuthenticationException(error);
- case "INSUFFICIENT_FUNDS":
- throw new InsufficientFundsException(error);
- case "PERMISSION_REQUIRED":
- throw new PermissionRequiredException(error);
- default:
- throw new InvalidRequestException(error, code, status, uri, null);
+ case "ACCOUNT_ID_REQUIRED", "AUTHORIZATION_INVALID", "LICENSE_KEY_REQUIRED",
+ "USER_ID_REQUIRED" -> throw new AuthenticationException(error);
+ case "INSUFFICIENT_FUNDS" -> throw new InsufficientFundsException(error);
+ case "PERMISSION_REQUIRED" -> throw new PermissionRequiredException(error);
+ default -> throw new InvalidRequestException(error, code, status, uri, null);
}
}
diff --git a/src/main/java/com/maxmind/minfraud/exception/HttpException.java b/src/main/java/com/maxmind/minfraud/exception/HttpException.java
index a033ca72..bcab2d50 100644
--- a/src/main/java/com/maxmind/minfraud/exception/HttpException.java
+++ b/src/main/java/com/maxmind/minfraud/exception/HttpException.java
@@ -1,9 +1,7 @@
package com.maxmind.minfraud.exception;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URL;
/**
* This class represents an HTTP transport error. This is not an error returned by the web service
@@ -51,16 +49,4 @@ public URI getUri() {
return this.uri;
}
- /**
- * @return the URL queried.
- * @deprecated Use getUri() instead
- */
- @Deprecated
- public URL getUrl() {
- try {
- return this.uri.toURL();
- } catch (MalformedURLException e) {
- return null;
- }
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/maxmind/minfraud/exception/InsufficientFundsException.java b/src/main/java/com/maxmind/minfraud/exception/InsufficientFundsException.java
index bcb7c682..1e17ef83 100644
--- a/src/main/java/com/maxmind/minfraud/exception/InsufficientFundsException.java
+++ b/src/main/java/com/maxmind/minfraud/exception/InsufficientFundsException.java
@@ -4,7 +4,7 @@
* This exception is thrown when your account does not have sufficient funds to complete the
* request.
*/
-public class InsufficientFundsException extends MinFraudException {
+public final class InsufficientFundsException extends MinFraudException {
/**
* @param message A message explaining the cause of the error.
diff --git a/src/main/java/com/maxmind/minfraud/exception/InvalidRequestException.java b/src/main/java/com/maxmind/minfraud/exception/InvalidRequestException.java
index 1410433b..a128a8f1 100644
--- a/src/main/java/com/maxmind/minfraud/exception/InvalidRequestException.java
+++ b/src/main/java/com/maxmind/minfraud/exception/InvalidRequestException.java
@@ -1,15 +1,13 @@
package com.maxmind.minfraud.exception;
-import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URL;
/**
* This class represents a non-specific error returned by MaxMind's minFraud web service. This
* occurs when the web service is up and responding to requests, but the request sent was invalid in
* some way.
*/
-public class InvalidRequestException extends MinFraudException {
+public final class InvalidRequestException extends MinFraudException {
private final String code;
private final int httpStatus;
private final URI uri;
@@ -63,16 +61,4 @@ public URI getUri() {
return this.uri;
}
- /**
- * @return the URL queried.
- * @deprecated Use getUri() instead
- */
- @Deprecated
- public URL getUrl() {
- try {
- return this.uri.toURL();
- } catch (MalformedURLException e) {
- return null;
- }
- }
}
diff --git a/src/main/java/com/maxmind/minfraud/exception/MinFraudException.java b/src/main/java/com/maxmind/minfraud/exception/MinFraudException.java
index 9a40fb7e..47df06e4 100644
--- a/src/main/java/com/maxmind/minfraud/exception/MinFraudException.java
+++ b/src/main/java/com/maxmind/minfraud/exception/MinFraudException.java
@@ -7,7 +7,9 @@
* It also serves as the base class for {@code AuthenticationException},
* {@code InsufficientFundsException}, and {@code InvalidRequestException}.
*/
-public class MinFraudException extends Exception {
+public sealed class MinFraudException extends Exception
+ permits AuthenticationException, InsufficientFundsException, InvalidRequestException,
+ PermissionRequiredException {
/**
* @param message A message explaining the cause of the error.
diff --git a/src/main/java/com/maxmind/minfraud/request/AbstractLocation.java b/src/main/java/com/maxmind/minfraud/request/AbstractLocation.java
index 6ab47f44..1fcf130a 100644
--- a/src/main/java/com/maxmind/minfraud/request/AbstractLocation.java
+++ b/src/main/java/com/maxmind/minfraud/request/AbstractLocation.java
@@ -41,7 +41,7 @@ protected AbstractLocation(AbstractLocation.Builder builder) {
* @param the builder class
*/
@SuppressWarnings("unchecked")
- abstract static class Builder {
+ abstract static class Builder> {
private static final Pattern COUNTRY_CODE_PATTERN = Pattern.compile("^[A-Z]{2}$");
String firstName;
diff --git a/src/main/java/com/maxmind/minfraud/request/Email.java b/src/main/java/com/maxmind/minfraud/request/Email.java
index e4f94e9e..fe2562b6 100644
--- a/src/main/java/com/maxmind/minfraud/request/Email.java
+++ b/src/main/java/com/maxmind/minfraud/request/Email.java
@@ -450,7 +450,7 @@ private String cleanAddress(String address) {
);
if (fastmailDomains.containsKey(possibleDomain)) {
domain = possibleDomain;
- if (!localPart.equals("")) {
+ if (!localPart.isEmpty()) {
localPart = domainParts[0];
}
}
diff --git a/src/main/java/com/maxmind/minfraud/request/Transaction.java b/src/main/java/com/maxmind/minfraud/request/Transaction.java
index 2c843ff2..47beeb6f 100644
--- a/src/main/java/com/maxmind/minfraud/request/Transaction.java
+++ b/src/main/java/com/maxmind/minfraud/request/Transaction.java
@@ -261,6 +261,6 @@ public Shipping getShipping() {
*/
@JsonProperty("shopping_cart")
public List getShoppingCart() {
- return new ArrayList<>(shoppingCart);
+ return List.copyOf(shoppingCart);
}
}
diff --git a/src/main/java/com/maxmind/minfraud/request/TransactionReport.java b/src/main/java/com/maxmind/minfraud/request/TransactionReport.java
index f90775a1..93b064a3 100644
--- a/src/main/java/com/maxmind/minfraud/request/TransactionReport.java
+++ b/src/main/java/com/maxmind/minfraud/request/TransactionReport.java
@@ -40,21 +40,6 @@ public static final class Builder {
String notes;
String transactionId;
- /**
- * The constructor for the {@code TransactionReport.Builder} class with IP address.
- *
- * @param ipAddress The IP address associated with the device used by the customer in the
- * transaction.
- * @param tag A string indicating the likelihood that a transaction may be
- * fraudulent.
- * @deprecated Use {@link #Builder(Tag)} instead and set the IP address using
- * {@link #ipAddress(InetAddress)}.
- */
- @Deprecated
- public Builder(InetAddress ipAddress, Tag tag) {
- this(tag);
- this.ipAddress = ipAddress;
- }
/**
* The constructor for the {@code TransactionReport.Builder} class.
diff --git a/src/main/java/com/maxmind/minfraud/response/FactorsResponse.java b/src/main/java/com/maxmind/minfraud/response/FactorsResponse.java
index 4e8ef50b..e847a74b 100644
--- a/src/main/java/com/maxmind/minfraud/response/FactorsResponse.java
+++ b/src/main/java/com/maxmind/minfraud/response/FactorsResponse.java
@@ -10,7 +10,6 @@
public final class FactorsResponse extends InsightsResponse {
private final List riskScoreReasons;
- private final Subscores subscores;
/**
@@ -32,7 +31,6 @@ public final class FactorsResponse extends InsightsResponse {
* significantly. Risk score reasons are usually only returned for medium to high risk
* transactions. If there were no significant changes to the risk score due to these
* reasons, then this list will be empty.
- * @param subscores The {@code Subscores} model object.
* @param warnings A list containing warning objects.
*/
public FactorsResponse(
@@ -50,70 +48,14 @@ public FactorsResponse(
@JsonProperty("shipping_address") ShippingAddress shippingAddress,
@JsonProperty("shipping_phone") Phone shippingPhone,
@JsonProperty("risk_score_reasons") List riskScoreReasons,
- @JsonProperty("subscores") Subscores subscores,
@JsonProperty("warnings") List warnings
) {
super(billingAddress, billingPhone, creditCard, device, disposition, email,
fundsRemaining, id, ipAddress, queriesRemaining, riskScore,
shippingAddress, shippingPhone, warnings);
this.riskScoreReasons = riskScoreReasons;
- this.subscores = subscores;
}
- /**
- * Constructor for backwards compatibility. This will be removed in the next major release.
- *
- * @deprecated use other constructor.
- */
- @Deprecated
- public FactorsResponse(
- BillingAddress billingAddress,
- CreditCard creditCard,
- Device device,
- Disposition disposition,
- Email email,
- Double fundsRemaining,
- UUID id,
- IpAddress ipAddress,
- Integer queriesRemaining,
- Double riskScore,
- ShippingAddress shippingAddress,
- Subscores subscores,
- List warnings
- ) {
- this(billingAddress, null, creditCard, device, disposition, email, fundsRemaining, id,
- ipAddress, queriesRemaining, riskScore, shippingAddress, null, null, subscores,
- warnings);
- }
-
- /**
- * Constructor for backwards compatibility. This will be removed in the next
- * major release.
- *
- * @deprecated use other constructor.
- */
- @Deprecated
- public FactorsResponse(
- BillingAddress billingAddress,
- Phone billingPhone,
- CreditCard creditCard,
- Device device,
- Disposition disposition,
- Email email,
- Double fundsRemaining,
- UUID id,
- IpAddress ipAddress,
- Integer queriesRemaining,
- Double riskScore,
- ShippingAddress shippingAddress,
- Phone shippingPhone,
- Subscores subscores,
- List warnings
- ) {
- this(billingAddress, billingPhone, creditCard, device, disposition, email, fundsRemaining,
- id, ipAddress, queriesRemaining, riskScore, shippingAddress, shippingPhone, null,
- subscores, warnings);
- }
/**
* @return A list containing objects that describe risk score reasons
@@ -124,14 +66,4 @@ public List getRiskScoreReasons() {
return riskScoreReasons;
}
- /**
- * @return The {@code Subscores} model object containing the risk factor scores.
- *
- * @deprecated replaced by {@link getRiskScoreReasons}.
- */
- @Deprecated
- @JsonProperty("subscores")
- public Subscores getSubscores() {
- return subscores;
- }
}
diff --git a/src/main/java/com/maxmind/minfraud/response/InsightsResponse.java b/src/main/java/com/maxmind/minfraud/response/InsightsResponse.java
index a29aff13..5c2cbfc1 100644
--- a/src/main/java/com/maxmind/minfraud/response/InsightsResponse.java
+++ b/src/main/java/com/maxmind/minfraud/response/InsightsResponse.java
@@ -62,29 +62,6 @@ public InsightsResponse(
this.shippingPhone = shippingPhone == null ? new Phone() : shippingPhone;
}
- /**
- * Constructor for backwards compatibility. This will be removed in the next major release.
- *
- * @deprecated use other constructor.
- */
- @Deprecated
- public InsightsResponse(
- BillingAddress billingAddress,
- CreditCard creditCard,
- Device device,
- Disposition disposition,
- Email email,
- Double fundsRemaining,
- UUID id,
- IpAddress ipAddress,
- Integer queriesRemaining,
- Double riskScore,
- ShippingAddress shippingAddress,
- List warnings
- ) {
- this(billingAddress, null, creditCard, device, disposition, email, fundsRemaining, id,
- ipAddress, queriesRemaining, riskScore, shippingAddress, null, warnings);
- }
/**
* @return The {@code IpAddress} model object.
diff --git a/src/main/java/com/maxmind/minfraud/response/IpAddress.java b/src/main/java/com/maxmind/minfraud/response/IpAddress.java
index 1e5a3878..93c4e83d 100644
--- a/src/main/java/com/maxmind/minfraud/response/IpAddress.java
+++ b/src/main/java/com/maxmind/minfraud/response/IpAddress.java
@@ -10,7 +10,6 @@
import com.maxmind.geoip2.record.RepresentedCountry;
import com.maxmind.geoip2.record.Subdivision;
import com.maxmind.geoip2.record.Traits;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -58,7 +57,7 @@ public IpAddress(
this.location = location == null ? new GeoIp2Location() : location;
this.risk = risk;
this.riskReasons =
- Collections.unmodifiableList(riskReasons == null ? new ArrayList<>() : riskReasons);
+ Collections.unmodifiableList(riskReasons == null ? List.of() : riskReasons);
}
/**
diff --git a/src/main/java/com/maxmind/minfraud/response/Phone.java b/src/main/java/com/maxmind/minfraud/response/Phone.java
index fa85a6d1..41dcad14 100644
--- a/src/main/java/com/maxmind/minfraud/response/Phone.java
+++ b/src/main/java/com/maxmind/minfraud/response/Phone.java
@@ -34,29 +34,11 @@ public Phone(
this.numberType = numberType;
}
- /**
- * @param country The ISO 3166-2 country code for the phone number.
- * @param isVoip Whether the number is VoIP.
- * @param networkOperator The network operator associated with the phone number.
- * @param numberType The type of the phone number.
- *
- * @deprecated use other constructor instead.
- */
- @Deprecated
- public Phone(
- String country,
- Boolean isVoip,
- String networkOperator,
- String numberType
- ) {
- this(country, isVoip, null, networkOperator, numberType);
- }
-
/**
* Constructor for {@code Phone}.
*/
public Phone() {
- this(null, null, null, null);
+ this(null, null, null, null, null);
}
/**
diff --git a/src/main/java/com/maxmind/minfraud/response/RiskScoreReason.java b/src/main/java/com/maxmind/minfraud/response/RiskScoreReason.java
index 88672da2..2e25c2ce 100644
--- a/src/main/java/com/maxmind/minfraud/response/RiskScoreReason.java
+++ b/src/main/java/com/maxmind/minfraud/response/RiskScoreReason.java
@@ -2,7 +2,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.minfraud.AbstractModel;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -25,7 +24,7 @@ public RiskScoreReason(
) {
this.multiplier = multiplier;
this.reasons =
- Collections.unmodifiableList(reasons == null ? new ArrayList<>() : reasons);
+ Collections.unmodifiableList(reasons == null ? List.of() : reasons);
}
/**
diff --git a/src/main/java/com/maxmind/minfraud/response/ScoreResponse.java b/src/main/java/com/maxmind/minfraud/response/ScoreResponse.java
index b283e72e..22e4fa4c 100644
--- a/src/main/java/com/maxmind/minfraud/response/ScoreResponse.java
+++ b/src/main/java/com/maxmind/minfraud/response/ScoreResponse.java
@@ -2,7 +2,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.minfraud.AbstractModel;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@@ -46,7 +45,7 @@ public ScoreResponse(
this.queriesRemaining = queriesRemaining;
this.riskScore = riskScore;
this.warnings =
- Collections.unmodifiableList(warnings == null ? new ArrayList<>() : warnings);
+ Collections.unmodifiableList(warnings == null ? List.of() : warnings);
}
/**
diff --git a/src/main/java/com/maxmind/minfraud/response/Subscores.java b/src/main/java/com/maxmind/minfraud/response/Subscores.java
deleted file mode 100644
index a4974d3a..00000000
--- a/src/main/java/com/maxmind/minfraud/response/Subscores.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package com.maxmind.minfraud.response;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * This class contains scores for many of the risk factors that are used to calculate the overall
- * risk score.
- *
- * @deprecated replaced by {@link RiskScoreReason}.
- */
-@Deprecated
-public final class Subscores {
- private final Double avsResult;
- private final Double billingAddress;
- private final Double billingAddressDistanceToIpLocation;
- private final Double browser;
- private final Double chargeback;
- private final Double country;
- private final Double countryMismatch;
- private final Double cvvResult;
- private final Double device;
- private final Double emailAddress;
- private final Double emailDomain;
- private final Double emailLocalPart;
- private final Double issuerIdNumber;
- private final Double orderAmount;
- private final Double phoneNumber;
- private final Double shippingAddress;
- private final Double shippingAddressDistanceToIpLocation;
- private final Double timeOfDay;
-
- /**
- * @param avsResult The AVS result risk factor score.
- * @param billingAddress The billing address risk factor score.
- * @param billingAddressDistanceToIpLocation The billing address distance to the IP location
- * risk factor score.
- * @param browser The browser risk factor score.
- * @param chargeback The chargeback risk factor score.
- * @param country The country risk factor score.
- * @param countryMismatch The country mismatch risk factor score.
- * @param cvvResult The CVV result risk factor score.
- * @param device The device risk factor score.
- * @param emailAddress The email address risk factor score.
- * @param emailDomain The email domain risk factor score.
- * @param emailLocalPart The risk factor score for the local part of the
- * email.
- * @param issuerIdNumber The IIN risk factor score.
- * @param orderAmount The order amount risk factor score.
- * @param phoneNumber The phone number risk factor score.
- * @param shippingAddress The shipping addresss risk factor score.
- * @param shippingAddressDistanceToIpLocation The shipping address distance to IP location risk
- * factor score.
- * @param timeOfDay The time of day risk factor score.
- */
- public Subscores(
- @JsonProperty("avs_result") Double avsResult,
- @JsonProperty("billing_address") Double billingAddress,
- @JsonProperty("billing_address_distance_to_ip_location")
- Double billingAddressDistanceToIpLocation,
- @JsonProperty("browser") Double browser,
- @JsonProperty("chargeback") Double chargeback,
- @JsonProperty("country") Double country,
- @JsonProperty("country_mismatch") Double countryMismatch,
- @JsonProperty("cvv_result") Double cvvResult,
- @JsonProperty("device") Double device,
- @JsonProperty("email_address") Double emailAddress,
- @JsonProperty("email_domain") Double emailDomain,
- @JsonProperty("email_local_part") Double emailLocalPart,
- @JsonProperty("issuer_id_number") Double issuerIdNumber,
- @JsonProperty("order_amount") Double orderAmount,
- @JsonProperty("phone_number") Double phoneNumber,
- @JsonProperty("shipping_address") Double shippingAddress,
- @JsonProperty("shipping_address_distance_to_ip_location")
- Double shippingAddressDistanceToIpLocation,
- @JsonProperty("time_of_day") Double timeOfDay
- ) {
- this.avsResult = avsResult;
- this.billingAddress = billingAddress;
- this.billingAddressDistanceToIpLocation = billingAddressDistanceToIpLocation;
- this.browser = browser;
- this.chargeback = chargeback;
- this.country = country;
- this.countryMismatch = countryMismatch;
- this.cvvResult = cvvResult;
- this.device = device;
- this.emailAddress = emailAddress;
- this.emailDomain = emailDomain;
- this.emailLocalPart = emailLocalPart;
- this.issuerIdNumber = issuerIdNumber;
- this.orderAmount = orderAmount;
- this.phoneNumber = phoneNumber;
- this.shippingAddress = shippingAddress;
- this.shippingAddressDistanceToIpLocation = shippingAddressDistanceToIpLocation;
- this.timeOfDay = timeOfDay;
- }
-
- /**
- * Constructor for {@code Subscores}.
- */
- public Subscores() {
- this(null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null);
- }
-
- /**
- * @return The risk associated with the AVS result. If present, this is a value in the range
- * 0.01 to 99.
- */
- @JsonProperty("avs_result")
- public Double getAvsResult() {
- return avsResult;
- }
-
- /**
- * @return The risk associated with the billing address. If present, this is a value in the
- * range 0.01 to 99.
- */
- @JsonProperty("billing_address")
- public Double getBillingAddress() {
- return billingAddress;
- }
-
- /**
- * @return The risk associated with the distance between the billing address and the location
- * for the given IP address. If present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("billing_address_distance_to_ip_location")
- public Double getBillingAddressDistanceToIpLocation() {
- return billingAddressDistanceToIpLocation;
- }
-
- /**
- * @return The risk associated with the browser attributes such as the User-Agent and
- * Accept-Language. If present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("browser")
- public Double getBrowser() {
- return browser;
- }
-
- /**
- * @return Individualized risk of chargeback for the given IP address on your account and shop
- * ID. This is only available to users sending chargeback data to MaxMind. If present, this
- * is a value in the range 0.01 to 99.
- */
- @JsonProperty("chargeback")
- public Double getChargeback() {
- return chargeback;
- }
-
- /**
- * @return The risk associated with the country the transaction originated from. If present,
- * this is a value in the range 0.01 to 99.
- */
- @JsonProperty("country")
- public Double getCountry() {
- return country;
- }
-
- /**
- * @return The risk associated with the combination of IP country, card issuer country, billing
- * country, and shipping country. If present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("country_mismatch")
- public Double getCountryMismatch() {
- return countryMismatch;
- }
-
- /**
- * @return The risk associated with the CVV result. If present, this is a value in the range
- * 0.01 to 99.
- */
- @JsonProperty("cvv_result")
- public Double getCvvResult() {
- return cvvResult;
- }
-
- /**
- * @return The risk associated with the device. If present, this is a value in the range 0.01 to
- * 99.
- */
- @JsonProperty("device")
- public Double getDevice() {
- return device;
- }
-
- /**
- * @return The risk associated with the particular email address. If present, this is a value in
- * the range 0.01 to 99.
- */
- @JsonProperty("email_address")
- public Double getEmailAddress() {
- return emailAddress;
- }
-
- /**
- * @return The general risk associated with the email domain. If present, this is a value in the
- * range 0.01 to 99.
- */
- @JsonProperty("email_domain")
- public Double getEmailDomain() {
- return emailDomain;
- }
-
- /**
- * @return The risk associated with the email address local part (the part of the email address
- * before the @ symbol). If present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("email_local_part")
- public Double getEmailLocalPart() {
- return emailLocalPart;
- }
-
- /**
- * @return The risk associated with the particular issuer ID number (IIN) given the billing
- * location and the history of usage of the IIN on your account and shop ID. If present,
- * this is a value in the range 0.01 to 99.
- */
- @JsonProperty("issuer_id_number")
- public Double getIssuerIdNumber() {
- return issuerIdNumber;
- }
-
- /**
- * @return The risk associated with the particular order amount for your account and shop ID. If
- * present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("order_amount")
- public Double getOrderAmount() {
- return orderAmount;
- }
-
- /**
- * @return The risk associated with the particular phone number. If present, this is a value in
- * the range 0.01 to 99.
- */
- @JsonProperty("phone_number")
- public Double getPhoneNumber() {
- return phoneNumber;
- }
-
- /**
- * @return The risk associated with the shipping address. If present, this is a value in the
- * range 0.01 to 99.
- */
- @JsonProperty("shipping_address")
- public Double getShippingAddress() {
- return shippingAddress;
- }
-
- /**
- * @return The risk associated with the distance between the shipping address and the IP
- * location for the given IP address. If present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("shipping_address_distance_to_ip_location")
- public Double getShippingAddressDistanceToIpLocation() {
- return shippingAddressDistanceToIpLocation;
- }
-
- /**
- * @return The risk associated with the local time of day of the transaction in the IP address
- * location. If present, this is a value in the range 0.01 to 99.
- */
- @JsonProperty("time_of_day")
- public Double getTimeOfDay() {
- return timeOfDay;
- }
-}
diff --git a/src/test/java/com/maxmind/minfraud/request/AbstractLocationTest.java b/src/test/java/com/maxmind/minfraud/request/AbstractLocationTest.java
index 5ff956fa..bd21df21 100644
--- a/src/test/java/com/maxmind/minfraud/request/AbstractLocationTest.java
+++ b/src/test/java/com/maxmind/minfraud/request/AbstractLocationTest.java
@@ -7,7 +7,7 @@
import org.junit.jupiter.api.Test;
public abstract class AbstractLocationTest {
- abstract Builder builder();
+ abstract Builder> builder();
@Test
diff --git a/src/test/java/com/maxmind/minfraud/request/RequestTestHelper.java b/src/test/java/com/maxmind/minfraud/request/RequestTestHelper.java
index 3246d58c..6ee72e6f 100644
--- a/src/test/java/com/maxmind/minfraud/request/RequestTestHelper.java
+++ b/src/test/java/com/maxmind/minfraud/request/RequestTestHelper.java
@@ -22,7 +22,8 @@
*/
public class RequestTestHelper {
public static TransactionReport fullTransactionReport() throws Exception {
- return new TransactionReport.Builder(InetAddress.getByName("1.1.1.1"), Tag.NOT_FRAUD)
+ return new TransactionReport.Builder(Tag.NOT_FRAUD)
+ .ipAddress(InetAddress.getByName("1.1.1.1"))
.chargebackCode("foo")
.maxmindId("12345678")
.minfraudId(UUID.fromString("58fa38d8-4b87-458b-a22b-f00eda1aa20d"))
diff --git a/src/test/java/com/maxmind/minfraud/request/TransactionReportTest.java b/src/test/java/com/maxmind/minfraud/request/TransactionReportTest.java
index 857e9a15..fb544e64 100644
--- a/src/test/java/com/maxmind/minfraud/request/TransactionReportTest.java
+++ b/src/test/java/com/maxmind/minfraud/request/TransactionReportTest.java
@@ -44,9 +44,6 @@ public void testBuildValidIdentifier() {
"58fa38d8-4b87-458b-a22b-f00eda1aa20d");
final String transactionId = "abc123";
- // Test the deprecated constructor
- assertEquals(ip, new TransactionReport.Builder(ip, tag)
- .build().getIpAddress());
assertEquals(ip, new TransactionReport.Builder(tag)
.ipAddress(ip).build().getIpAddress());
diff --git a/src/test/java/com/maxmind/minfraud/response/FactorsResponseTest.java b/src/test/java/com/maxmind/minfraud/response/FactorsResponseTest.java
index 36b2c967..6f415863 100644
--- a/src/test/java/com/maxmind/minfraud/response/FactorsResponseTest.java
+++ b/src/test/java/com/maxmind/minfraud/response/FactorsResponseTest.java
@@ -26,28 +26,6 @@ public void testFactors() throws Exception {
.put("is_voip", true)
.put("matches_postal", false)
.end()
- .startObjectField("subscores")
- .put("avs_result", 0.01)
- .put("billing_address", 0.02)
- .put("billing_address_distance_to_ip_location", 0.03)
- .put("browser", 0.04)
- .put("chargeback", 0.05)
- .put("country", 0.06)
- .put("country_mismatch", 0.07)
- .put("cvv_result", 0.08)
- .put("device", 0.18)
- .put("email_address", 0.09)
- .put("email_domain", 0.10)
- .put("email_local_part", 0.19)
- .put("email_tenure", 0.11)
- .put("ip_tenure", 0.12)
- .put("issuer_id_number", 0.13)
- .put("order_amount", 0.14)
- .put("phone_number", 0.15)
- .put("shipping_address", 0.2)
- .put("shipping_address_distance_to_ip_location", 0.16)
- .put("time_of_day", 0.17)
- .end()
.put("funds_remaining", 1.20)
.put("queries_remaining", 123)
.put("id", id)
@@ -72,80 +50,6 @@ public void testFactors() throws Exception {
assertFalse(factors.getBillingPhone().isVoip(), "correct billing phone isVoip");
assertTrue(factors.getBillingPhone().matchesPostal(), "correct billing phone matchesPostal");
- assertEquals(
- Double.valueOf(0.01),
- factors.getSubscores().getAvsResult(),
- "avs_result"
- );
- assertEquals(
- Double.valueOf(0.02),
- factors.getSubscores().getBillingAddress(),
- "billing_address"
- );
- assertEquals(
- Double.valueOf(0.03),
- factors.getSubscores().getBillingAddressDistanceToIpLocation(),
- "billing_address_distance_to_ip_location"
- );
- assertEquals(Double.valueOf(0.04), factors.getSubscores().getBrowser(), "browser");
- assertEquals(Double.valueOf(0.05), factors.getSubscores().getChargeback(), "chargeback");
- assertEquals(Double.valueOf(0.06), factors.getSubscores().getCountry(), "country");
- assertEquals(
- Double.valueOf(0.07),
- factors.getSubscores().getCountryMismatch(),
- "country_mismatch"
- );
- assertEquals(
- Double.valueOf(0.08),
- factors.getSubscores().getCvvResult(),
- "cvv_result"
- );
- assertEquals(Double.valueOf(0.18), factors.getSubscores().getDevice(), "device");
- assertEquals(
- Double.valueOf(0.09),
- factors.getSubscores().getEmailAddress(),
- "email_address"
- );
- assertEquals(
- Double.valueOf(0.10),
- factors.getSubscores().getEmailDomain(),
- "email_domain"
- );
- assertEquals(
- Double.valueOf(0.19),
- factors.getSubscores().getEmailLocalPart(),
- "email_local_part"
- );
- assertEquals(
- Double.valueOf(0.13),
- factors.getSubscores().getIssuerIdNumber(),
- "issuer_id_number"
- );
- assertEquals(
- Double.valueOf(0.14),
- factors.getSubscores().getOrderAmount(),
- "order_amount"
- );
- assertEquals(
- Double.valueOf(0.15),
- factors.getSubscores().getPhoneNumber(),
- "phone_number"
- );
- assertEquals(
- Double.valueOf(0.2),
- factors.getSubscores().getShippingAddress(),
- "shipping_address"
- );
- assertEquals(
- Double.valueOf(0.16),
- factors.getSubscores().getShippingAddressDistanceToIpLocation(),
- "shipping_address_distance_to_ip_location"
- );
- assertEquals(
- Double.valueOf(0.17),
- factors.getSubscores().getTimeOfDay(),
- "time_of_day"
- );
assertEquals(
Double.valueOf(1.20),
factors.getFundsRemaining(),
diff --git a/src/test/java/com/maxmind/minfraud/response/SubscoresTest.java b/src/test/java/com/maxmind/minfraud/response/SubscoresTest.java
deleted file mode 100644
index b4e4fe66..00000000
--- a/src/test/java/com/maxmind/minfraud/response/SubscoresTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.maxmind.minfraud.response;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import com.fasterxml.jackson.jr.ob.JSON;
-import org.junit.jupiter.api.Test;
-
-public class SubscoresTest extends AbstractOutputTest {
-
- @Test
- public void testSubscores() throws Exception {
- Subscores subscores = this.deserialize(
- Subscores.class,
- JSON.std
- .composeString()
- .startObject()
- .put("avs_result", 0.01)
- .put("billing_address", 0.02)
- .put("billing_address_distance_to_ip_location", 0.03)
- .put("browser", 0.04)
- .put("chargeback", 0.05)
- .put("country", 0.06)
- .put("country_mismatch", 0.07)
- .put("cvv_result", 0.08)
- .put("email_address", 0.09)
- .put("email_domain", 0.10)
- .put("email_tenure", 0.11)
- .put("ip_tenure", 0.12)
- .put("issuer_id_number", 0.13)
- .put("order_amount", 0.14)
- .put("phone_number", 0.15)
- .put("shipping_address_distance_to_ip_location", 0.16)
- .put("time_of_day", 0.17).end()
- .finish()
- );
-
- assertEquals(Double.valueOf(0.01), subscores.getAvsResult(), "avs_result");
- assertEquals(Double.valueOf(0.02), subscores.getBillingAddress(), "billing_address");
- assertEquals(
- Double.valueOf(0.03),
- subscores.getBillingAddressDistanceToIpLocation(),
- "billing_address_distance_to_ip_location"
- );
- assertEquals(Double.valueOf(0.04), subscores.getBrowser(), "browser");
- assertEquals(Double.valueOf(0.05), subscores.getChargeback(), "chargeback");
- assertEquals(Double.valueOf(0.06), subscores.getCountry(), "country");
- assertEquals(Double.valueOf(0.07), subscores.getCountryMismatch(), "country_mismatch");
- assertEquals(Double.valueOf(0.08), subscores.getCvvResult(), "cvv_result");
- assertEquals(Double.valueOf(0.09), subscores.getEmailAddress(), "email_address");
- assertEquals(Double.valueOf(0.10), subscores.getEmailDomain(), "email_domain");
- assertEquals(Double.valueOf(0.13), subscores.getIssuerIdNumber(), "issuer_id_number");
- assertEquals(Double.valueOf(0.14), subscores.getOrderAmount(), "order_amount");
- assertEquals(Double.valueOf(0.15), subscores.getPhoneNumber(), "phone_number");
- assertEquals(
- Double.valueOf(0.16),
- subscores.getShippingAddressDistanceToIpLocation(),
- "shipping_address_distance_to_ip_location"
- );
- assertEquals(Double.valueOf(0.17), subscores.getTimeOfDay(), "time_of_day");
- }
-}
\ No newline at end of file
diff --git a/src/test/resources/test-data/factors-response.json b/src/test/resources/test-data/factors-response.json
index 7e4d096d..7345b57a 100644
--- a/src/test/resources/test-data/factors-response.json
+++ b/src/test/resources/test-data/factors-response.json
@@ -160,26 +160,6 @@
"latitude": 35.704729,
"longitude": -97.568619
},
- "subscores": {
- "avs_result": 0.01,
- "billing_address": 0.02,
- "billing_address_distance_to_ip_location": 0.03,
- "browser": 0.04,
- "chargeback": 0.05,
- "country": 0.06,
- "country_mismatch": 0.07,
- "cvv_result": 0.08,
- "device": 0.18,
- "email_address": 0.09,
- "email_domain": 0.10,
- "email_local_part": 0.19,
- "issuer_id_number": 0.13,
- "order_amount": 0.14,
- "phone_number": 0.15,
- "shipping_address": 0.2,
- "shipping_address_distance_to_ip_location": 0.16,
- "time_of_day": 0.17
- },
"warnings": [
{
"code": "INPUT_INVALID",