Skip to content

Commit 10b7303

Browse files
authored
Merge pull request #103 from maxmind/greg/cc-is-business
Add support for /credit_card/is_business output
2 parents 027205b + 7e1d723 commit 10b7303

7 files changed

Lines changed: 49 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
1.13.0
5+
-------------------
6+
7+
* Added support for the new credit card output `/credit_card/is_business`.
8+
This indicates whether the card is a business card. It may be accessed via
9+
`response.getCreditCard().isBusiness()` on the minFraud Insights and Factors
10+
response objects.
11+
412
1.12.0 (2020-03-26)
513
-------------------
614

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
<artifactId>httpclient</artifactId>
7070
<version>4.5.12</version>
7171
</dependency>
72+
<dependency>
73+
<!-- httpclient pulls this in. We pull in a newer version
74+
because of a security issue in 1.11 -->
75+
<groupId>commons-codec</groupId>
76+
<artifactId>commons-codec</artifactId>
77+
<version>1.13</version>
78+
</dependency>
7279
<!--
7380
commons-validator 1.6 depends on an older version of
7481
commons-beanutils with a CVE. So add a direct dependency on the

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public final class CreditCard extends AbstractModel {
1010
private final Issuer issuer;
1111
private final String brand;
1212
private final String country;
13+
private final Boolean isBusiness;
1314
private final Boolean isIssuedInBillingAddressCountry;
1415
private final Boolean isPrepaid;
1516
private final Boolean isVirtual;
@@ -29,9 +30,26 @@ public CreditCard(
2930
issuer, type);
3031
}
3132

33+
// This method is for backwards compatibility. We should remove it when we
34+
// do a major release.
35+
public CreditCard(
36+
String brand,
37+
String country,
38+
Boolean isIssuedInBillingAddressCountry,
39+
Boolean isPrepaid,
40+
Boolean isVirtual,
41+
Issuer issuer,
42+
String type
43+
) {
44+
this(brand, country, false, isIssuedInBillingAddressCountry, isPrepaid,
45+
isVirtual, issuer, type);
46+
}
47+
48+
3249
public CreditCard(
3350
@JsonProperty("brand") String brand,
3451
@JsonProperty("country") String country,
52+
@JsonProperty("is_business") Boolean isBusiness,
3553
@JsonProperty("is_issued_in_billing_address_country") Boolean isIssuedInBillingAddressCountry,
3654
@JsonProperty("is_prepaid") Boolean isPrepaid,
3755
@JsonProperty("is_virtual") Boolean isVirtual,
@@ -40,6 +58,7 @@ public CreditCard(
4058
) {
4159
this.brand = brand;
4260
this.country = country;
61+
this.isBusiness = isBusiness;
4362
this.isIssuedInBillingAddressCountry = isIssuedInBillingAddressCountry;
4463
this.isPrepaid = isPrepaid;
4564
this.isVirtual = isVirtual;
@@ -77,6 +96,15 @@ public String getCountry() {
7796
return country;
7897
}
7998

99+
/**
100+
* @return True if the card is a business card. False if not a business
101+
* card. If the IIN was not provided or is unknown, null will be returned.
102+
*/
103+
@JsonProperty("is_business")
104+
public Boolean isBusiness() {
105+
return isBusiness;
106+
}
107+
80108
/**
81109
* @return True if the country of the billing address matches the country
82110
* of the majority of customers using that IIN. In cases where the

src/test/java/com/maxmind/minfraud/response/CreditCardTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public void testCreditCard() throws Exception {
2020
.end()
2121
.put("brand", "Visa")
2222
.put("country", "US")
23+
.put("is_business", true)
2324
.put("is_issued_in_billing_address_country", true)
2425
.put("is_prepaid", true)
2526
.put("is_virtual", true)
@@ -32,6 +33,7 @@ public void testCreditCard() throws Exception {
3233
assertEquals("US", cc.getCountry());
3334
assertEquals("Visa", cc.getBrand());
3435
assertEquals("credit", cc.getType());
36+
assertTrue(cc.isBusiness());
3537
assertTrue(cc.isPrepaid());
3638
assertTrue(cc.isVirtual());
3739
assertTrue(cc.isIssuedInBillingAddressCountry());

src/test/java/com/maxmind/minfraud/response/InsightsResponseTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void testInsights() throws Exception {
3737
.end()
3838
.end()
3939
.startObjectField("credit_card")
40+
.put("is_business", true)
4041
.put("is_prepaid", true)
4142
.end()
4243
.startObjectField("shipping_address")
@@ -61,6 +62,7 @@ public void testInsights() throws Exception {
6162
assertEquals("disposition", "accept", insights.getDisposition().getAction());
6263
assertEquals("email domain first seen", LocalDate.parse("2014-02-03"), insights.getEmail().getDomain().getFirstSeen());
6364
assertEquals("correct country ISO", "US", insights.getIpAddress().getCountry().getIsoCode());
65+
assertTrue("correct credit card is business", insights.getCreditCard().isBusiness());
6466
assertTrue("correct credit card prepaid", insights.getCreditCard().isPrepaid());
6567
assertTrue("correct shipping address is in IP country", insights.getShippingAddress().isInIpCountry());
6668
assertTrue("correct billing address is in IP country", insights.getBillingAddress().isInIpCountry());

src/test/resources/test-data/factors-response.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
},
116116
"brand": "Visa",
117117
"country": "US",
118+
"is_business": true,
118119
"is_issued_in_billing_address_country": true,
119120
"is_prepaid": true,
120121
"type": "credit"

src/test/resources/test-data/insights-response.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
},
130130
"brand": "Visa",
131131
"country": "US",
132+
"is_business": true,
132133
"is_issued_in_billing_address_country": true,
133134
"is_prepaid": true,
134135
"is_virtual": true,

0 commit comments

Comments
 (0)