Skip to content

Commit 2c1c0dc

Browse files
committed
Add support for the /credit_card/is_virtual output
1 parent 53e081b commit 2c1c0dc

5 files changed

Lines changed: 34 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ CHANGELOG
1515
* Added new type to the `Event.Type` enum: `PAYOUT_CHANGE`
1616
* Added support for new Device output:
1717
* `/device/local_time`
18+
* Added support for new CreditCard output:
19+
* `/credit_card/is_virtual`
1820

1921
1.8.0 (2018-01-19)
2022
------------------

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,43 @@ public final class CreditCard extends AbstractModel {
1212
private final String country;
1313
private final Boolean isIssuedInBillingAddressCountry;
1414
private final Boolean isPrepaid;
15+
private final Boolean isVirtual;
1516
private final String type;
1617

18+
// This method is for backwards compatibility. We should remove it when we
19+
// do a major release.
20+
public CreditCard(
21+
String brand,
22+
String country,
23+
Boolean isIssuedInBillingAddressCountry,
24+
Boolean isPrepaid,
25+
Issuer issuer,
26+
String type
27+
) {
28+
this(brand, country, isIssuedInBillingAddressCountry, isPrepaid, false,
29+
issuer, type);
30+
}
31+
1732
public CreditCard(
1833
@JsonProperty("brand") String brand,
1934
@JsonProperty("country") String country,
2035
@JsonProperty("is_issued_in_billing_address_country") Boolean isIssuedInBillingAddressCountry,
2136
@JsonProperty("is_prepaid") Boolean isPrepaid,
37+
@JsonProperty("is_virtual") Boolean isVirtual,
2238
@JsonProperty("issuer") Issuer issuer,
2339
@JsonProperty("type") String type
2440
) {
2541
this.brand = brand;
2642
this.country = country;
2743
this.isIssuedInBillingAddressCountry = isIssuedInBillingAddressCountry;
2844
this.isPrepaid = isPrepaid;
45+
this.isVirtual = isVirtual;
2946
this.issuer = issuer == null ? new Issuer() : issuer;
3047
this.type = type;
3148
}
3249

3350
public CreditCard() {
34-
this(null, null, null, null, null, null);
51+
this(null, null, null, null, null, null, null);
3552
}
3653

3754
/**
@@ -80,6 +97,15 @@ public Boolean isPrepaid() {
8097
return isPrepaid;
8198
}
8299

100+
/**
101+
* @return True if the card is a virtual card. False if not virtual. If the
102+
* IIN was not provided or is unknown, null will be returned.
103+
*/
104+
@JsonProperty("is_virtual")
105+
public Boolean isVirtual() {
106+
return isVirtual;
107+
}
108+
83109
/**
84110
* @return The credit card type.
85111
*/

src/test/java/com/maxmind/minfraud/WebServiceClientTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public void testFullInsightsTransaction() throws Exception {
8282
response.getIpAddress().getRepresentedCountry().isInEuropeanUnion());
8383
assertEquals(response.getDevice().getLocalTime(),
8484
"2018-04-05T15:34:40-07:00");
85+
86+
assertTrue(response.getCreditCard().isVirtual());
8587
}
8688
}
8789

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public void testCreditCard() throws Exception {
2222
.put("country", "US")
2323
.put("is_issued_in_billing_address_country", true)
2424
.put("is_prepaid", true)
25+
.put("is_virtual", true)
2526
.put("type", "credit")
2627
.end()
2728
.finish()
@@ -32,6 +33,7 @@ public void testCreditCard() throws Exception {
3233
assertEquals("Visa", cc.getBrand());
3334
assertEquals("credit", cc.getType());
3435
assertTrue(cc.isPrepaid());
36+
assertTrue(cc.isVirtual());
3537
assertTrue(cc.isIssuedInBillingAddressCountry());
3638
}
3739

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"country": "US",
131131
"is_issued_in_billing_address_country": true,
132132
"is_prepaid": true,
133+
"is_virtual": true,
133134
"type": "credit"
134135
},
135136
"device": {

0 commit comments

Comments
 (0)