public final class Card extends StripeModel implements StripePaymentSource, StripeParamsModel
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 int |
CVC_LENGTH_AMERICAN_EXPRESS |
static int |
CVC_LENGTH_COMMON |
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 |
Modifier and Type | Method and Description |
---|---|
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 |
create(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.
|
boolean |
equals(java.lang.Object obj) |
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. |
static int |
getBrandIcon(java.lang.String brand) |
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.util.Map<java.lang.String,java.lang.String> |
getMetadata() |
java.lang.String |
getName() |
java.lang.String |
getNumber() |
int |
hashCode() |
Card.Builder |
toBuilder() |
java.util.Map<java.lang.String,java.lang.Object> |
toParamMap() |
PaymentMethodCreateParams.Card |
toPaymentMethodParamsCard() |
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. |
public static final int CVC_LENGTH_AMERICAN_EXPRESS
public static final int CVC_LENGTH_COMMON
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 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.FundingType
public static int getBrandIcon(java.lang.String brand)
public 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 static Card create(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 PaymentMethodCreateParams.Card toPaymentMethodParamsCard()
public Card.Builder toBuilder()
Card.Builder
populated with the fields of this Card
instancepublic 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 java.lang.String getCVC()
cvc
for this cardpublic java.lang.Integer getExpMonth()
expMonth
for this cardpublic java.lang.Integer getExpYear()
expYear
for this cardpublic java.lang.String getName()
name
for this cardpublic java.lang.String getAddressLine1()
addressLine1
of this cardpublic java.lang.String getAddressLine2()
addressLine2
of this cardpublic java.lang.String getAddressCity()
addressCity
for this cardpublic java.lang.String getAddressZip()
addressZip
of this cardpublic java.lang.String getAddressState()
addressState
of this cardpublic java.lang.String getAddressCountry()
addressCountry
of this cardpublic java.lang.String getCurrency()
currency
of this card. Only supported for Managed accounts.public java.util.Map<java.lang.String,java.lang.String> getMetadata()
metadata
of this cardpublic java.lang.String getLast4()
last4
digits of this card.public 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 StripePaymentSource
id
of this cardpublic java.lang.String getAddressLine1Check()
public java.lang.String getAddressZipCheck()
public java.lang.String getCustomerId()
public java.lang.String getCvcCheck()
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.util.Map<java.lang.String,java.lang.Object> toParamMap()
toParamMap
in interface StripeParamsModel