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
ConstructorsConstructorDescriptionTestMerchantServicesProvider(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) booleanbooleancapture(AuthorizationResult authorizationResult) credit(TransactionRequest transactionRequest, CreditCard creditCard) voiddeleteCreditCard(CreditCard creditCard) bytebytegetTokenizedCreditCards(Map<String, CreditCard> persistedCards, PrintWriter verboseOut, PrintWriter infoOut, PrintWriter warningOut) sale(TransactionRequest transactionRequest, CreditCard creditCard) storeCreditCard(CreditCard creditCard) voidupdateCreditCard(CreditCard creditCard) voidupdateCreditCardExpiration(CreditCard creditCard, byte expirationMonth, short expirationYear) voidupdateCreditCardNumberAndExpiration(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:
getProviderIdin interfaceMerchantServicesProvider
-
getErrorChance
public byte getErrorChance() -
getDeclineChance
public byte getDeclineChance() -
sale
- Specified by:
salein interfaceMerchantServicesProvider
-
authorize
- Specified by:
authorizein interfaceMerchantServicesProvider
-
capture
- Specified by:
capturein interfaceMerchantServicesProvider
-
voidTransaction
- Specified by:
voidTransactionin interfaceMerchantServicesProvider
-
credit
- Specified by:
creditin interfaceMerchantServicesProvider
-
canStoreCreditCards
public boolean canStoreCreditCards()- Specified by:
canStoreCreditCardsin interfaceMerchantServicesProvider
-
storeCreditCard
- Specified by:
storeCreditCardin interfaceMerchantServicesProvider- Throws:
IOException
-
updateCreditCard
- Specified by:
updateCreditCardin interfaceMerchantServicesProvider- Throws:
IOException
-
updateCreditCardNumberAndExpiration
public void updateCreditCardNumberAndExpiration(CreditCard creditCard, String cardNumber, byte expirationMonth, short expirationYear, String cardCode) throws IOException - Specified by:
updateCreditCardNumberAndExpirationin interfaceMerchantServicesProvider- Throws:
IOException
-
updateCreditCardExpiration
public void updateCreditCardExpiration(CreditCard creditCard, byte expirationMonth, short expirationYear) throws IOException - Specified by:
updateCreditCardExpirationin interfaceMerchantServicesProvider- Throws:
IOException
-
deleteCreditCard
- Specified by:
deleteCreditCardin interfaceMerchantServicesProvider- Throws:
IOException
-
canGetTokenizedCreditCards
public boolean canGetTokenizedCreditCards()- Specified by:
canGetTokenizedCreditCardsin interfaceMerchantServicesProvider
-
getTokenizedCreditCards
public Map<String,TokenizedCreditCard> getTokenizedCreditCards(Map<String, CreditCard> persistedCards, PrintWriter verboseOut, PrintWriter infoOut, PrintWriter warningOut) throws UnsupportedOperationException- Specified by:
getTokenizedCreditCardsin interfaceMerchantServicesProvider- Throws:
UnsupportedOperationException
-
