public class Card extends StripeJsonModel implements StripePaymentSource
| Modifier and Type | Class and Description |
|---|---|
static class |
Card.Builder
Builder class for a
Card model. |
static interface |
Card.CardBrand |
static interface |
Card.FundingType |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AMERICAN_EXPRESS |
static java.util.Map<java.lang.String,java.lang.Integer> |
BRAND_RESOURCE_MAP |
static int |
CVC_LENGTH_AMERICAN_EXPRESS |
static int |
CVC_LENGTH_COMMON |
static java.lang.String |
DINERS_CLUB |
static java.lang.String |
DISCOVER |
static java.lang.String |
FUNDING_CREDIT |
static java.lang.String |
FUNDING_DEBIT |
static java.lang.String |
FUNDING_PREPAID |
static java.lang.String |
FUNDING_UNKNOWN |
static java.lang.String |
JCB |
static java.lang.String |
MASTERCARD |
static int |
MAX_LENGTH_AMERICAN_EXPRESS |
static int |
MAX_LENGTH_DINERS_CLUB |
static int |
MAX_LENGTH_STANDARD |
static java.lang.String[] |
PREFIXES_AMERICAN_EXPRESS |
static java.lang.String[] |
PREFIXES_DINERS_CLUB |
static java.lang.String[] |
PREFIXES_DISCOVER |
static java.lang.String[] |
PREFIXES_JCB |
static java.lang.String[] |
PREFIXES_MASTERCARD |
static java.lang.String[] |
PREFIXES_UNIONPAY |
static java.lang.String[] |
PREFIXES_VISA |
static java.lang.String |
UNIONPAY |
static java.lang.String |
UNKNOWN |
static java.lang.String |
VISA |
| Constructor and Description |
|---|
Card(java.lang.String number,
java.lang.Integer expMonth,
java.lang.Integer expYear,
java.lang.String cvc)
Convenience constructor for a Card object with a minimum number of inputs.
|
Card(java.lang.String number,
java.lang.Integer expMonth,
java.lang.Integer expYear,
java.lang.String cvc,
java.lang.String name,
java.lang.String addressLine1,
java.lang.String addressLine2,
java.lang.String addressCity,
java.lang.String addressState,
java.lang.String addressZip,
java.lang.String addressCountry,
java.lang.String currency)
Convenience constructor with address and currency.
|
Card(java.lang.String number,
java.lang.Integer expMonth,
java.lang.Integer expYear,
java.lang.String cvc,
java.lang.String name,
java.lang.String addressLine1,
java.lang.String addressLine2,
java.lang.String addressCity,
java.lang.String addressState,
java.lang.String addressZip,
java.lang.String addressCountry,
java.lang.String brand,
java.lang.String last4,
java.lang.String fingerprint,
java.lang.String funding,
java.lang.String country,
java.lang.String currency,
java.lang.String id)
Card constructor with all available fields.
|
| Modifier and Type | Method and Description |
|---|---|
Card |
addLoggingToken(java.lang.String loggingToken)
Add a logging token to this
Card object. |
static java.lang.String |
asCardBrand(java.lang.String possibleCardType)
Converts an unchecked String value to a
Card.CardBrand or null. |
static java.lang.String |
asFundingType(java.lang.String possibleFundingType)
Converts an unchecked String value to a
Card.FundingType or null. |
static Card |
fromJson(org.json.JSONObject jsonObject) |
static Card |
fromString(java.lang.String jsonString)
Create a Card object from a raw JSON string.
|
java.lang.String |
getAddressCity() |
java.lang.String |
getAddressCountry() |
java.lang.String |
getAddressLine1() |
java.lang.String |
getAddressLine1Check() |
java.lang.String |
getAddressLine2() |
java.lang.String |
getAddressState() |
java.lang.String |
getAddressZip() |
java.lang.String |
getAddressZipCheck() |
java.lang.String |
getBrand()
Gets the
brand of this card. |
java.lang.String |
getCountry() |
java.lang.String |
getCurrency() |
java.lang.String |
getCustomerId() |
java.lang.String |
getCVC() |
java.lang.String |
getCvcCheck() |
java.lang.Integer |
getExpMonth() |
java.lang.Integer |
getExpYear() |
java.lang.String |
getFingerprint() |
java.lang.String |
getFunding() |
java.lang.String |
getId() |
java.lang.String |
getLast4() |
java.util.List<java.lang.String> |
getLoggingTokens() |
java.lang.String |
getName() |
java.lang.String |
getNumber() |
java.lang.String |
getType()
Deprecated.
|
void |
setAddressCity(java.lang.String addressCity) |
void |
setAddressCountry(java.lang.String addressCountry) |
void |
setAddressLine1(java.lang.String addressLine1) |
void |
setAddressLine2(java.lang.String addressLine2) |
void |
setAddressState(java.lang.String addressState) |
void |
setAddressZip(java.lang.String addressZip) |
void |
setCurrency(java.lang.String currency) |
void |
setCVC(java.lang.String cvc)
Deprecated.
|
void |
setExpMonth(java.lang.Integer expMonth)
Deprecated.
|
void |
setExpYear(java.lang.Integer expYear)
Deprecated.
|
void |
setName(java.lang.String name) |
void |
setNumber(java.lang.String number)
Deprecated.
|
org.json.JSONObject |
toJson() |
java.util.Map<java.lang.String,java.lang.Object> |
toMap() |
boolean |
validateCard()
Checks whether
this represents a valid card. |
boolean |
validateCVC()
Checks whether or not the
cvc field is valid. |
boolean |
validateExpiryDate()
|
boolean |
validateExpMonth()
Checks whether or not the
expMonth field is valid. |
boolean |
validateNumber()
Checks whether or not the
number field is valid. |
equals, hashCode, toStringpublic static final java.lang.String AMERICAN_EXPRESS
public static final java.lang.String DISCOVER
public static final java.lang.String JCB
public static final java.lang.String DINERS_CLUB
public static final java.lang.String VISA
public static final java.lang.String MASTERCARD
public static final java.lang.String UNIONPAY
public static final java.lang.String UNKNOWN
public static final int CVC_LENGTH_AMERICAN_EXPRESS
public static final int CVC_LENGTH_COMMON
public static final java.lang.String FUNDING_CREDIT
public static final java.lang.String FUNDING_DEBIT
public static final java.lang.String FUNDING_PREPAID
public static final java.lang.String FUNDING_UNKNOWN
public static final java.util.Map<java.lang.String,java.lang.Integer> BRAND_RESOURCE_MAP
public static final java.lang.String[] PREFIXES_AMERICAN_EXPRESS
public static final java.lang.String[] PREFIXES_DISCOVER
public static final java.lang.String[] PREFIXES_JCB
public static final java.lang.String[] PREFIXES_DINERS_CLUB
public static final java.lang.String[] PREFIXES_VISA
public static final java.lang.String[] PREFIXES_MASTERCARD
public static final java.lang.String[] PREFIXES_UNIONPAY
public static final int MAX_LENGTH_STANDARD
public static final int MAX_LENGTH_AMERICAN_EXPRESS
public static final int MAX_LENGTH_DINERS_CLUB
public Card(java.lang.String number,
java.lang.Integer expMonth,
java.lang.Integer expYear,
java.lang.String cvc,
java.lang.String name,
java.lang.String addressLine1,
java.lang.String addressLine2,
java.lang.String addressCity,
java.lang.String addressState,
java.lang.String addressZip,
java.lang.String addressCountry,
java.lang.String brand,
java.lang.String last4,
java.lang.String fingerprint,
java.lang.String funding,
java.lang.String country,
java.lang.String currency,
java.lang.String id)
number - the credit card numberexpMonth - the expiry monthexpYear - the expiry yearcvc - the CVC numbername - the card nameaddressLine1 - first line of the billing addressaddressLine2 - second line of the billing addressaddressCity - city of the billing addressaddressState - state of the billing addressaddressZip - zip code of the billing addressaddressCountry - country for the billing addressbrand - brand of this cardlast4 - last 4 digits of the cardfingerprint - the card fingerprintfunding - the funding type of the cardcountry - ISO country code of the card itselfcurrency - currency used by the cardid - the cardIdpublic Card(java.lang.String number,
java.lang.Integer expMonth,
java.lang.Integer expYear,
java.lang.String cvc,
java.lang.String name,
java.lang.String addressLine1,
java.lang.String addressLine2,
java.lang.String addressCity,
java.lang.String addressState,
java.lang.String addressZip,
java.lang.String addressCountry,
java.lang.String currency)
number - the card numberexpMonth - the expiry monthexpYear - the expiry yearcvc - the CVC codename - the cardholder nameaddressLine1 - the first line of the billing addressaddressLine2 - the second line of the billing addressaddressCity - the city of the billing addressaddressState - the state of the billing addressaddressZip - the zip code of the billing addressaddressCountry - the country of the billing addresscurrency - the currency of the cardpublic Card(java.lang.String number,
java.lang.Integer expMonth,
java.lang.Integer expYear,
java.lang.String cvc)
number - the card numberexpMonth - the expiry monthexpYear - the expiry yearcvc - the CVC codepublic static java.lang.String asCardBrand(java.lang.String possibleCardType)
Card.CardBrand or null.possibleCardType - a String that might match a Card.CardBrand or be empty.null if the input is blank, else the appropriate Card.CardBrand.public static java.lang.String asFundingType(java.lang.String possibleFundingType)
Card.FundingType or null.possibleFundingType - a String that might match a Card.FundingType or be emptynull if the input is blank, else the appropriate Card.FundingTypepublic static Card fromString(java.lang.String jsonString)
jsonString - the JSON string representing the potential Cardnull if one cannot be made
or the JSON is invalid.public static Card fromJson(org.json.JSONObject jsonObject)
public boolean validateCard()
this represents a valid card.true if valid, false otherwise.public boolean validateNumber()
number field is valid.true if valid, false otherwise.public boolean validateExpiryDate()
true if valid, false otherwisepublic boolean validateCVC()
cvc field is valid.true if valid, false otherwisepublic boolean validateExpMonth()
expMonth field is valid.true if valid, false otherwise.public java.lang.String getNumber()
number of this cardpublic java.util.List<java.lang.String> getLoggingTokens()
List of logging tokens associated with this Card objectpublic Card addLoggingToken(java.lang.String loggingToken)
Card object.loggingToken - a token to be logged with this cardthis, for chaining purposes@Deprecated public void setNumber(java.lang.String number)
brand and last4.number - the new numberpublic java.lang.String getCVC()
cvc for this card@Deprecated public void setCVC(java.lang.String cvc)
cvc - the new cvc code for this cardpublic java.lang.Integer getExpMonth()
expMonth for this card@Deprecated public void setExpMonth(java.lang.Integer expMonth)
expMonth - sets the expMonth for this cardpublic java.lang.Integer getExpYear()
expYear for this card@Deprecated public void setExpYear(java.lang.Integer expYear)
expYear - sets the expYear for this cardpublic java.lang.String getName()
name for this cardpublic void setName(java.lang.String name)
name - sets the cardholder name for this cardpublic java.lang.String getAddressLine1()
addressLine1 of this cardpublic void setAddressLine1(java.lang.String addressLine1)
addressLine1 - sets the addressLine1 for this cardpublic java.lang.String getAddressLine2()
addressLine2 of this cardpublic void setAddressLine2(java.lang.String addressLine2)
addressLine2 - sets the addressLine2 for this cardpublic java.lang.String getAddressCity()
addressCity for this cardpublic void setAddressCity(java.lang.String addressCity)
addressCity - sets the addressCity for this cardpublic java.lang.String getAddressZip()
addressZip of this cardpublic void setAddressZip(java.lang.String addressZip)
addressZip - sets the addressZip for this cardpublic java.lang.String getAddressState()
addressState of this cardpublic void setAddressState(java.lang.String addressState)
addressState - sets the addressState for this cardpublic java.lang.String getAddressCountry()
addressCountry of this cardpublic void setAddressCountry(java.lang.String addressCountry)
addressCountry - sets the addressCountry for this cardpublic java.lang.String getCurrency()
currency of this card. Only supported for Managed accounts.public void setCurrency(java.lang.String currency)
currency - sets the currency of this card. Only supported for Managed accounts.public java.lang.String getLast4()
@Deprecated public java.lang.String getType()
brand of this card, changed from the "type" field. Use getBrand()
instead.brand of this cardpublic java.lang.String getBrand()
brand of this card. Updates the value if none has yet been set, or
if the number has been changed.brand of this cardpublic java.lang.String getFingerprint()
fingerprint of this cardpublic java.lang.String getFunding()
funding type of this cardpublic java.lang.String getCountry()
country of this cardpublic java.lang.String getId()
getId in interface StripePaymentSourceid of this cardpublic java.lang.String getAddressLine1Check()
public java.lang.String getAddressZipCheck()
public java.lang.String getCustomerId()
public java.lang.String getCvcCheck()
public org.json.JSONObject toJson()
toJson in class StripeJsonModelpublic java.util.Map<java.lang.String,java.lang.Object> toMap()
toMap in class StripeJsonModel