- All Known Implementing Classes:
PropertiesPersistenceMechanism
public interface PersistenceMechanism
A persistence mechanism stores the credit card data and transaction history.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionvoidauthorizeCompleted(Principal principal, Transaction transaction) Updates a transaction in the database after the authorize has completed.voiddeleteCreditCard(Principal principal, CreditCard creditCard) Deletes the credit card from the credit card list.getCreditCard(Principal principal, String persistenceUniqueId) Gets a defensive copy of a stored card given itspersistenceUniqueId.getCreditCards(Principal principal) Gets all the stored cards.getCreditCards(Principal principal, String providerId) Gets all the stored cards for a givenproviderId.insertTransaction(Principal principal, Group group, Transaction transaction) Inserts a new transaction into the database and returns its persistenceUniqueId.voidsaleCompleted(Principal principal, Transaction transaction) Updates a transaction in the database after the sale has completed.storeCreditCard(Principal principal, CreditCard creditCard) Stores a credit card and returns its persistenceUniqueId.voidupdateCardNumber(Principal principal, CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear) Updates the stored card number and expiration for a credit card.voidupdateCreditCard(Principal principal, CreditCard creditCard) Updates the stored credit card details, all except the card number, expiration, and card security code, for a credit card.voidupdateExpiration(Principal principal, CreditCard creditCard, byte expirationMonth, short expirationYear) Optionally updates the expiration for a credit card.voidvoidCompleted(Principal principal, Transaction transaction) Updates a transaction in the database after the void has completed.
-
Method Details
-
storeCreditCard
Stores a credit card and returns its persistenceUniqueId.- Throws:
SQLException- See Also:
-
getCreditCard
Gets a defensive copy of a stored card given itspersistenceUniqueId.- Parameters:
persistenceUniqueId- The card'spersistenceUniqueId- Returns:
- The stored
CreditCardornullif not found. - Throws:
SQLException
-
getCreditCards
Gets all the stored cards.Each element is a defensive copy. Modifications will not update the underling persistence.
The returned map must be modifiable. Modifications to the returned map will not update the underlying persistence.
- Returns:
- The modifiable mapping from
CreditCard.getPersistenceUniqueId()to defensive copies of the stored card - Throws:
SQLException- See Also:
-
getCreditCards
Gets all the stored cards for a givenproviderId.Each element is a defensive copy. Modifications will not update the underling persistence.
The returned map must be modifiable. Modifications to the returned map will not update the underlying persistence.
- Parameters:
principal- The entity performing the query (person, software component, ...)providerId- The ID of the provider to get all cards for- Returns:
- The modifiable mapping from
CreditCard.getProviderUniqueId()to defensive copies of the stored card - Throws:
SQLException- See Also:
-
updateCreditCard
Updates the stored credit card details, all except the card number, expiration, and card security code, for a credit card.- Throws:
SQLException- See Also:
-
updateCardNumber
void updateCardNumber(Principal principal, CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear) throws SQLException Updates the stored card number and expiration for a credit card.- Throws:
SQLException- See Also:
-
updateExpiration
void updateExpiration(Principal principal, CreditCard creditCard, byte expirationMonth, short expirationYear) throws SQLException Optionally updates the expiration for a credit card.- Throws:
SQLException- See Also:
-
deleteCreditCard
Deletes the credit card from the credit card list.- Throws:
SQLException- See Also:
-
insertTransaction
String insertTransaction(Principal principal, Group group, Transaction transaction) throws SQLException Inserts a new transaction into the database and returns its persistenceUniqueId.- Parameters:
principal-nullis acceptablegroup-nullis acceptable- Throws:
SQLException- See Also:
-
saleCompleted
Updates a transaction in the database after the sale has completed. The following transaction fields have been updated and must be stored:- authorizationResult
- captureTime
- capturePrincipalName
- captureResult
- status
- Throws:
SQLException- See Also:
-
authorizeCompleted
Updates a transaction in the database after the authorize has completed. The following transaction fields have been updated and must be stored:- authorizationResult
- status
- Throws:
SQLException- See Also:
-
voidCompleted
Updates a transaction in the database after the void has completed.- Throws:
SQLException- See Also:
-
