package com.maxmind.minfraud.response;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * This class contains minFraud response data related to the credit card.
 */
public final class CreditCard {
    protected Issuer issuer = new Issuer();
    protected String country;

    @JsonProperty("is_issued_in_billing_address_country")
    protected Boolean isIssuedInBillingAddressCountry;

    @JsonProperty("is_prepaid")
    protected Boolean isPrepaid;

    /**
     * @return The {@code Issuer} model object.
     */
    public final Issuer getIssuer() {
        return issuer;
    }

    /**
     * @return This field contains an ISO 3166-1 alpha-2 country code
     * representing the country that the card was issued in. This will be null
     * if there is no value in the response.
     */
    public final String getCountry() {
        return country;
    }

    /**
     * @return This will return true if the country of the billing address
     * matches the country that the credit card was issued in. It will return
     * false if they do not match. If the billing country was not provided or
     * the issuer country could not be determined, null will be returned.
     */
    @JsonIgnore
    public final Boolean isIssuedInBillingAddressCountry() {
        return isIssuedInBillingAddressCountry;
    }

    /**
     * @return True if the card is a prepaid card. False if not prepaid. If
     * the IIN was not provided or is unknown, null will be returned.
     */
    @JsonIgnore
    public final Boolean isPrepaid() {
        return isPrepaid;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("CreditCard{");
        sb.append("issuer=").append(this.issuer);
        sb.append(", country='").append(this.country).append('\'');
        sb.append(", isIssuedInBillingAddressCountry=").append(this.isIssuedInBillingAddressCountry);
        sb.append(", isPrepaid=").append(this.isPrepaid);
        sb.append('}');
        return sb.toString();
    }
}

@@ -670,28 +670,86 @@
 n Th
-is field contains an
+e two letter %3Ca href=%22http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2%22%3E%0A     *
  ISO
@@ -763,16 +763,20 @@
  alpha-2
+%3C/a%3E
  country
@@ -784,131 +784,273 @@
 code
-%0A     * representing the country that the
+ associated with the location%0A     * of the majority of customers using this credit
  card 
-w
 as 
-issued in. This will be null%0A     * if there is no value in the response
+determined%0A     * by their billing address. In cases where the location of customers%0A     * is highly mixed, this defaults to the country of the bank issuing%0A     * the card
 .%0A  
@@ -1153,25 +1153,8 @@
 rn T
-his will return t
 rue 
@@ -1190,23 +1190,16 @@
  address
-%0A     *
  matches
@@ -1214,209 +1214,188 @@
 ntry
- that the credit card was issued in. It will return%0A     * false if they do not match. If the billing country was not provided or%0A     * the issuer country could not be determined, null will be returne
+%0A     * of the majority of customers using that IIN. In cases where the%0A     * location of customers is highly mixed, the match is to the country of%0A     * the bank issuing the car
 d.%0A 

Update credit card property descriptions to be more accurate