public interface MerchantServicesProvider
This set of functions may be provided by a specific merchant services provider/bank.
Not all of the functions will be supported by all providers.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionauthorize
(TransactionRequest transactionRequest, CreditCard creditCard) Authorizes a sale.boolean
Queries the provider to see if they support retrieving the list of cards from the secure storage of credit cards.boolean
Queries the provider to see if they support the secure storage of credit cards.capture
(AuthorizationResult authorizationResult) Captures the funds from a previous call toauthorize
.credit
(TransactionRequest transactionRequest, CreditCard creditCard) Requests a credit.void
deleteCreditCard
(CreditCard creditCard) Deleted the credit card from the provider's secure storage.Gets the unique identifier for this provider.getTokenizedCreditCards
(Map<String, CreditCard> persistedCards, PrintWriter verboseOut, PrintWriter infoOut, PrintWriter warningOut) Gets all stored credit cards, with optional replacement masked card numbers and/or expiration dates.sale
(TransactionRequest transactionRequest, CreditCard creditCard) Performs an immediate sale, effectively a combination ofauthorize
andcapture
.storeCreditCard
(CreditCard creditCard) Stores a credit card securely for later reuse, returning its providerUniqueId.void
updateCreditCard
(CreditCard creditCard) Updates the credit card details, all except the card number and expiration.void
updateCreditCardExpiration
(CreditCard creditCard, byte expirationMonth, short expirationYear) Updates the credit card expiration in the secure storage, card expiration oncreditCard
are not changed.void
updateCreditCardNumberAndExpiration
(CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear, String cardCode) Updates the credit card number, expiration, and (optionally) card code in the secure storage, card number, expiration, and card code oncreditCard
are not changed.voidTransaction
(Transaction transaction) Voids a previous transaction.
-
Method Details
-
getProviderId
String getProviderId()Gets the unique identifier for this provider. The persistence layer may enforce unique IDs per each provider. Also, each credit, void, capture, and stored credit card transaction must be performed by the same provider. The identifier is compared to test this equality. -
sale
Performs an immediate sale, effectively a combination ofauthorize
andcapture
. No exceptions should ever be thrown, the CommunicationResult should be set to the appropriate error instead.- See Also:
-
authorize
Authorizes a sale. The funds are reserved but not captured until a later call to capture.- See Also:
-
capture
Captures the funds from a previous call toauthorize
.- See Also:
-
voidTransaction
Voids a previous transaction.- See Also:
-
credit
Requests a credit.- See Also:
-
canStoreCreditCards
Queries the provider to see if they support the secure storage of credit cards.- Throws:
IOException
- when unable to contact the bank- See Also:
-
storeCreditCard
Stores a credit card securely for later reuse, returning its providerUniqueId.- Throws:
UnsupportedOperationException
- when not supportedIOException
- when unable to contact the bank- See Also:
-
updateCreditCard
Updates the credit card details, all except the card number and expiration.- Throws:
UnsupportedOperationException
- when not supportedIOException
- See Also:
-
updateCreditCardNumberAndExpiration
void updateCreditCardNumberAndExpiration(CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear, String cardCode) throws UnsupportedOperationException, IOException Updates the credit card number, expiration, and (optionally) card code in the secure storage, card number, expiration, and card code oncreditCard
are not changed. This information is stored by local persistence, but some providers also have a copy of this information. This is used to keep the two systems in sync.- Throws:
UnsupportedOperationException
- when not supportedIOException
- when unable to contact the bank- See Also:
-
updateCreditCardExpiration
void updateCreditCardExpiration(CreditCard creditCard, byte expirationMonth, short expirationYear) throws UnsupportedOperationException, IOException Updates the credit card expiration in the secure storage, card expiration oncreditCard
are not changed.- Throws:
UnsupportedOperationException
- when not supportedIOException
- when unable to contact the bank- See Also:
-
deleteCreditCard
Deleted the credit card from the provider's secure storage.- Throws:
UnsupportedOperationException
- when not supportedIOException
- when unable to contact the bank- See Also:
-
canGetTokenizedCreditCards
Queries the provider to see if they support retrieving the list of cards from the secure storage of credit cards.- Throws:
IOException
- when unable to contact the bank- See Also:
-
getTokenizedCreditCards
Map<String,TokenizedCreditCard> getTokenizedCreditCards(Map<String, CreditCard> persistedCards, PrintWriter verboseOut, PrintWriter infoOut, PrintWriter warningOut) throws UnsupportedOperationException, IOExceptionGets all stored credit cards, with optional replacement masked card numbers and/or expiration dates.The returned map must be unmodifiable.
- Returns:
- The unmodifiable mapping of stores cards from
TokenizedCreditCard.getProviderUniqueId()
toTokenizedCreditCard
. - Throws:
UnsupportedOperationException
- when not supportedIOException
- when unable to contact the bank- See Also:
-