Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ CHANGELOG
* `DALENYS`
* `ONEY`
* `POSCONNECT`
* Added new type to the `Event.Type` enum: `PAYOUT_CHANGE`
* Added support for new Device output:
* `/device/local_time`
* Added support for new CreditCard output:
* `/credit_card/is_virtual`

1.8.0 (2018-01-19)
------------------
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.3</version>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.3</version>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.3</version>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.maxmind.geoip2</groupId>
Expand All @@ -62,7 +62,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.4</version>
<version>4.5.5</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
Expand All @@ -78,7 +78,7 @@
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>2.14.0</version>
<version>2.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -96,7 +96,7 @@
<dependency>
<groupId>com.fasterxml.jackson.jr</groupId>
<artifactId>jackson-jr-objects</artifactId>
<version>2.9.3</version>
<version>2.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/maxmind/minfraud/request/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public enum Type {
ACCOUNT_LOGIN,
EMAIL_CHANGE,
PASSWORD_RESET,
PAYOUT_CHANGE,
PURCHASE,
RECURRING_PURCHASE,
REFERRAL,
Expand Down
30 changes: 28 additions & 2 deletions src/main/java/com/maxmind/minfraud/response/CreditCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,43 @@ public final class CreditCard extends AbstractModel {
private final String country;
private final Boolean isIssuedInBillingAddressCountry;
private final Boolean isPrepaid;
private final Boolean isVirtual;
private final String type;

// This method is for backwards compatibility. We should remove it when we
// do a major release.
public CreditCard(
String brand,
String country,
Boolean isIssuedInBillingAddressCountry,
Boolean isPrepaid,
Issuer issuer,
String type
) {
this(brand, country, isIssuedInBillingAddressCountry, isPrepaid, false,
issuer, type);
}

public CreditCard(
@JsonProperty("brand") String brand,
@JsonProperty("country") String country,
@JsonProperty("is_issued_in_billing_address_country") Boolean isIssuedInBillingAddressCountry,
@JsonProperty("is_prepaid") Boolean isPrepaid,
@JsonProperty("is_virtual") Boolean isVirtual,
@JsonProperty("issuer") Issuer issuer,
@JsonProperty("type") String type
) {
this.brand = brand;
this.country = country;
this.isIssuedInBillingAddressCountry = isIssuedInBillingAddressCountry;
this.isPrepaid = isPrepaid;
this.isVirtual = isVirtual;
this.issuer = issuer == null ? new Issuer() : issuer;
this.type = type;
}

public CreditCard() {
this(null, null, null, null, null, null);
this(null, null, null, null, null, null, null);
}

/**
Expand All @@ -49,7 +66,7 @@ public String getBrand() {
}

/**
* @return The two letter <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">
* @return The two letter <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">
* ISO 3166-1 alpha-2</a> country code associated with the location
* of the majority of customers using this credit card as determined
* by their billing address. In cases where the location of customers
Expand Down Expand Up @@ -80,6 +97,15 @@ public Boolean isPrepaid() {
return isPrepaid;
}

/**
* @return True if the card is a virtual card. False if not virtual. If the
* IIN was not provided or is unknown, null will be returned.
*/
@JsonProperty("is_virtual")
public Boolean isVirtual() {
return isVirtual;
}

/**
* @return The credit card type.
*/
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/com/maxmind/minfraud/response/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,32 @@ public final class Device extends AbstractModel {
private final Double confidence;
private final UUID id;
private final String lastSeen;
private final String localTime;

// This method is for backwards compatibility. We should remove it when we
// do a major release.
public Device(
Double confidence,
UUID id,
String lastSeen
) {
this(confidence, id, lastSeen, null);
}

public Device(
@JsonProperty("confidence") Double confidence,
@JsonProperty("id") UUID id,
@JsonProperty("last_seen") String lastSeen
@JsonProperty("last_seen") String lastSeen,
@JsonProperty("local_time") String localTime
) {
this.confidence = confidence;
this.id = id;
this.lastSeen = lastSeen;
this.localTime = localTime;
}

public Device() {
this(null, null, null);
this(null, null, null, null);
}

/**
Expand Down Expand Up @@ -59,4 +72,13 @@ public UUID getId() {
public String getLastSeen() {
return lastSeen;
}

/**
* @return The date and time of the transaction at the UTC offset
* associated with the device. This is an RFC 3339 date-time.
*/
@JsonProperty("local_time")
public String getLocalTime() {
return localTime;
}
}
5 changes: 5 additions & 0 deletions src/test/java/com/maxmind/minfraud/WebServiceClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static com.jcabi.matchers.RegexMatchers.matchesPattern;
import static com.maxmind.minfraud.request.RequestTestHelper.*;
import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -79,6 +80,10 @@ public void testFullInsightsTransaction() throws Exception {
assertTrue(
"response.getIpAddress().getRepresentedCountry().isInEuropeanUnion() does not return true",
response.getIpAddress().getRepresentedCountry().isInEuropeanUnion());
assertEquals(response.getDevice().getLocalTime(),
"2018-04-05T15:34:40-07:00");

assertTrue(response.getCreditCard().isVirtual());
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/test/java/com/maxmind/minfraud/request/EventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ public void testTime() throws Exception {
public void testType() throws Exception {
Event event = new Builder().type(Type.ACCOUNT_CREATION).build();
assertEquals(Type.ACCOUNT_CREATION, event.getType());

event = new Builder().type(Type.PAYOUT_CHANGE).build();
assertEquals(Type.PAYOUT_CHANGE, event.getType());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void testCreditCard() throws Exception {
.put("country", "US")
.put("is_issued_in_billing_address_country", true)
.put("is_prepaid", true)
.put("is_virtual", true)
.put("type", "credit")
.end()
.finish()
Expand All @@ -32,6 +33,7 @@ public void testCreditCard() throws Exception {
assertEquals("Visa", cc.getBrand());
assertEquals("credit", cc.getType());
assertTrue(cc.isPrepaid());
assertTrue(cc.isVirtual());
assertTrue(cc.isIssuedInBillingAddressCountry());
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/maxmind/minfraud/response/DeviceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ public void testDevice() throws Exception {
.put("confidence", 99)
.put("id", "C8D3BE1A-BE26-11E5-8C50-1B575C37265F")
.put("last_seen", "2016-06-08T14:16:38Z")
.put("local_time", "2018-04-05T15:21:00-07:00")
.end()
.finish()
);

assertEquals(99.0, device.getConfidence(), 1e-15);
assertEquals(UUID.fromString("C8D3BE1A-BE26-11E5-8C50-1B575C37265F"), device.getId());
assertEquals("2016-06-08T14:16:38Z", device.getLastSeen());
assertEquals("2018-04-05T15:21:00-07:00", device.getLocalTime());
}
}
4 changes: 3 additions & 1 deletion src/test/resources/test-data/insights-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@
"country": "US",
"is_issued_in_billing_address_country": true,
"is_prepaid": true,
"is_virtual": true,
"type": "credit"
},
"device": {
"confidence": 99,
"id": "7835b099-d385-4e5b-969e-7df26181d73b",
"last_seen": "2016-06-08T14:16:38Z"
"last_seen": "2016-06-08T14:16:38Z",
"local_time": "2018-04-05T15:34:40-07:00"
},
"disposition": {
"action": "reject",
Expand Down