Class CreditCard
- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<CreditCard>
-
- com.aoindustries.aoserv.client.payment.CreditCard
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,Removable,SingleTableObject<Integer,CreditCard>
public final class CreditCard extends CachedObjectIntegerKey<CreditCard> implements Removable
ACreditCardstores credit card information.- Author:
- AO Industries, Inc.
-
-
Field Summary
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description CreditCard()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddeclined(String reason)Flags a card as declined.AccountgetAccount()Account.NamegetAccount_name()List<CannotRemoveReason<?>>getCannotRemoveReasons()Lists the reasons an object may not be removed.StringgetCardInfo()static StringgetCardInfo(String cardNumber)Deprecated.Please usecom.aoapps.payments.CreditCard#maskCardNumber(String)instead.StringgetCardNumber(String passphrase)Gets the card number ornullif not stored.StringgetCity()protected ObjectgetColumnImpl(int i)StringgetCompanyName()CountryCodegetCountryCode()UnmodifiableTimestampgetCreated()AdministratorgetCreatedBy()ProcessorgetCreditCardProcessor()Gets the processor that is storing the credit card numbers.StringgetCustomerId()StringgetCustomerTaxId()UnmodifiableTimestampgetDeactivatedOn()StringgetDeactivatedOnString()StringgetDeactivateReason()StringgetDescription()EmailgetEmail()EncryptionKeygetEncryptionCardNumberFrom()EncryptionKeygetEncryptionCardNumberRecipient()BytegetExpirationMonth()ShortgetExpirationYear()StringgetFax()StringgetFirstName()StringgetGroupName()Gets the application-specific grouping for this credit card.intgetId()booleangetIsActive()StringgetLastName()StringgetPhone()StringgetPostalCode()StringgetPrincipalName()Gets the application-provided principal name that stored this credit card.StringgetProviderUniqueId()Gets the unique identifier that represents the CISP - compliant storage mechanism for the card number and expiration date.StringgetState()StringgetStreetAddress1()StringgetStreetAddress2()Table.TableIDgetTableID()booleangetUseMonthly()voidinit(ResultSet result)Initializes this object from the raw database contents.voidreactivate()Reactivates a credit card.voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidremove()Removes this object, and all dependant objects, from the system.StringtoStringImpl()AOServObject.toString()implementation that is allowed to throw exceptions.voidupdate(String cardInfo, String firstName, String lastName, String companyName, Email email, String phone, String fax, String customerId, String customerTaxId, String streetAddress1, String streetAddress2, String city, String state, String postalCode, CountryCode countryCode, String description)Updates the credit card information (not including the card number or expiration).voidupdateCardExpiration(byte expirationMonth, short expirationYear)Updates the credit card expiration.voidupdateCardNumberAndExpiration(String maskedCardNumber, String cardNumber, byte expirationMonth, short expirationYear)Updates the credit card number and expiration, including the masked card number.voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Method Detail
-
getCannotRemoveReasons
public List<CannotRemoveReason<?>> getCannotRemoveReasons()
Description copied from interface:RemovableLists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasonsin interfaceRemovable- Returns:
- an empty
List<CannotRemoveReason>if this object may be removed, or a list of descriptions
-
declined
public void declined(String reason) throws IOException, SQLException
Flags a card as declined.- Throws:
IOExceptionSQLException
-
getId
public int getId()
-
getCreditCardProcessor
public Processor getCreditCardProcessor() throws SQLException, IOException
Gets the processor that is storing the credit card numbers.- Throws:
SQLExceptionIOException
-
getAccount_name
public Account.Name getAccount_name()
-
getAccount
public Account getAccount() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getGroupName
public String getGroupName()
Gets the application-specific grouping for this credit card.
-
getCardInfo
public String getCardInfo()
-
getExpirationMonth
public Byte getExpirationMonth()
-
getExpirationYear
public Short getExpirationYear()
-
getProviderUniqueId
public String getProviderUniqueId()
Gets the unique identifier that represents the CISP - compliant storage mechanism for the card number and expiration date.
-
getCardInfo
@Deprecated public static String getCardInfo(String cardNumber)
Deprecated.Please usecom.aoapps.payments.CreditCard#maskCardNumber(String)instead.Gets the default card info for a credit card number.
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,CreditCard>
-
getFirstName
public String getFirstName()
-
getLastName
public String getLastName()
-
getCompanyName
public String getCompanyName()
-
getEmail
public Email getEmail()
-
getPhone
public String getPhone()
-
getFax
public String getFax()
-
getCustomerId
public String getCustomerId()
-
getCustomerTaxId
public String getCustomerTaxId()
-
getStreetAddress1
public String getStreetAddress1()
-
getStreetAddress2
public String getStreetAddress2()
-
getCity
public String getCity()
-
getState
public String getState()
-
getPostalCode
public String getPostalCode()
-
getCountryCode
public CountryCode getCountryCode() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getCreated
public UnmodifiableTimestamp getCreated()
-
getCreatedBy
public Administrator getCreatedBy() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getPrincipalName
public String getPrincipalName()
Gets the application-provided principal name that stored this credit card.
-
getDeactivatedOn
public UnmodifiableTimestamp getDeactivatedOn()
-
getDeactivatedOnString
public String getDeactivatedOnString()
-
getDeactivateReason
public String getDeactivateReason()
-
getDescription
public String getDescription()
-
getEncryptionCardNumberFrom
public EncryptionKey getEncryptionCardNumberFrom() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getEncryptionCardNumberRecipient
public EncryptionKey getEncryptionCardNumberRecipient() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,CreditCard>
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,CreditCard>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
getIsActive
public boolean getIsActive()
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,CreditCard>- Throws:
IOException
-
remove
public void remove() throws IOException, SQLExceptionDescription copied from interface:RemovableRemoves this object, and all dependant objects, from the system.- Specified by:
removein interfaceRemovable- Throws:
IOExceptionSQLException
-
toStringImpl
public String toStringImpl()
Description copied from class:AOServObjectAOServObject.toString()implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callsAOServObject.toString()on the key (fromAOServObject.getKey()). When the key isnull, uses the default implementation fromObject.toString().- Overrides:
toStringImplin classCachedObjectIntegerKey<CreditCard>
-
getUseMonthly
public boolean getUseMonthly()
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,CreditCard>- Throws:
IOException
-
update
public void update(String cardInfo, String firstName, String lastName, String companyName, Email email, String phone, String fax, String customerId, String customerTaxId, String streetAddress1, String streetAddress2, String city, String state, String postalCode, CountryCode countryCode, String description) throws IOException, SQLException
Updates the credit card information (not including the card number or expiration).- Throws:
IOExceptionSQLException
-
updateCardNumberAndExpiration
public void updateCardNumberAndExpiration(String maskedCardNumber, String cardNumber, byte expirationMonth, short expirationYear) throws IOException, SQLException
Updates the credit card number and expiration, including the masked card number. Encrypts the data if the processors has been configured to store card encrypted in the master database.- Throws:
IOExceptionSQLException
-
updateCardExpiration
public void updateCardExpiration(byte expirationMonth, short expirationYear) throws IOException, SQLExceptionUpdates the credit card expiration. Encrypts the data if the processors has been configured to store card encrypted in the master database.- Throws:
IOExceptionSQLException
-
reactivate
public void reactivate() throws IOException, SQLExceptionReactivates a credit card.- Throws:
IOExceptionSQLException
-
getCardNumber
public String getCardNumber(String passphrase) throws IOException, SQLException
Gets the card number ornullif not stored.- Throws:
IOExceptionSQLException
-
-