java.lang.Object
com.aoapps.payments.test.TestMerchantServicesProvider
- All Implemented Interfaces:
MerchantServicesProvider
Provider for testing software.
Configuration parameters:
- errorChance - percentage chance of some sort of error (during storeCard, payment, capture, void)
- declineChance - percentage chance of being declined, otherwise accepted (during payment)
TODO: Add AVS, CVV, and ReviewReason responses. TODO: Add hold
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorDescriptionTestMerchantServicesProvider
(String providerId, byte errorChance, byte declineChance) Creates a new test provider with the given failure probabilities.TestMerchantServicesProvider
(String providerId, String errorChance, String declineChance) Creates a new test provider with the given failure probabilities, which are parsed viaByte.parseByte(java.lang.String)
. -
Method Summary
Modifier and TypeMethodDescriptionauthorize
(TransactionRequest transactionRequest, CreditCard creditCard) boolean
boolean
capture
(AuthorizationResult authorizationResult) credit
(TransactionRequest transactionRequest, CreditCard creditCard) void
deleteCreditCard
(CreditCard creditCard) byte
byte
getTokenizedCreditCards
(Map<String, CreditCard> persistedCards, PrintWriter verboseOut, PrintWriter infoOut, PrintWriter warningOut) sale
(TransactionRequest transactionRequest, CreditCard creditCard) storeCreditCard
(CreditCard creditCard) void
updateCreditCard
(CreditCard creditCard) void
updateCreditCardExpiration
(CreditCard creditCard, byte expirationMonth, short expirationYear) void
updateCreditCardNumberAndExpiration
(CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear, String cardCode) voidTransaction
(Transaction transaction)
-
Constructor Details
-
TestMerchantServicesProvider
Creates a new test provider with the given failure probabilities. -
TestMerchantServicesProvider
public TestMerchantServicesProvider(String providerId, String errorChance, String declineChance) throws NumberFormatException Creates a new test provider with the given failure probabilities, which are parsed viaByte.parseByte(java.lang.String)
.- Throws:
NumberFormatException
-
-
Method Details
-
getProviderId
- Specified by:
getProviderId
in interfaceMerchantServicesProvider
-
getErrorChance
public byte getErrorChance() -
getDeclineChance
public byte getDeclineChance() -
sale
- Specified by:
sale
in interfaceMerchantServicesProvider
-
authorize
- Specified by:
authorize
in interfaceMerchantServicesProvider
-
capture
- Specified by:
capture
in interfaceMerchantServicesProvider
-
voidTransaction
- Specified by:
voidTransaction
in interfaceMerchantServicesProvider
-
credit
- Specified by:
credit
in interfaceMerchantServicesProvider
-
canStoreCreditCards
public boolean canStoreCreditCards()- Specified by:
canStoreCreditCards
in interfaceMerchantServicesProvider
-
storeCreditCard
- Specified by:
storeCreditCard
in interfaceMerchantServicesProvider
- Throws:
IOException
-
updateCreditCard
- Specified by:
updateCreditCard
in interfaceMerchantServicesProvider
- Throws:
IOException
-
updateCreditCardNumberAndExpiration
public void updateCreditCardNumberAndExpiration(CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear, String cardCode) throws IOException - Specified by:
updateCreditCardNumberAndExpiration
in interfaceMerchantServicesProvider
- Throws:
IOException
-
updateCreditCardExpiration
public void updateCreditCardExpiration(CreditCard creditCard, byte expirationMonth, short expirationYear) throws IOException - Specified by:
updateCreditCardExpiration
in interfaceMerchantServicesProvider
- Throws:
IOException
-
deleteCreditCard
- Specified by:
deleteCreditCard
in interfaceMerchantServicesProvider
- Throws:
IOException
-
canGetTokenizedCreditCards
public boolean canGetTokenizedCreditCards()- Specified by:
canGetTokenizedCreditCards
in interfaceMerchantServicesProvider
-
getTokenizedCreditCards
public Map<String,TokenizedCreditCard> getTokenizedCreditCards(Map<String, CreditCard> persistedCards, PrintWriter verboseOut, PrintWriter infoOut, PrintWriter warningOut) throws UnsupportedOperationException- Specified by:
getTokenizedCreditCards
in interfaceMerchantServicesProvider
- Throws:
UnsupportedOperationException
-