© 2001 BEA Systems, Inc.

com.beasys.commerce.ebusiness.payment
Class CreditCardServiceImpl

com.beasys.commerce.foundation.SessionImpl
  |
  +--com.beasys.commerce.ebusiness.payment.CreditCardServiceImpl
All Implemented Interfaces:
TransactionConstants

public class CreditCardServiceImpl
extends SessionImpl
implements TransactionConstants

This stateless session is the gateway/wrapper to CyberCash services.

See Also:
CreditCardService, CreditCardServiceHome

Field Summary
protected static java.lang.String CONFIG_FILE_NAME
           
protected static java.lang.String CONFIG_FILE_PROPERTY_NAME
           
protected static java.lang.String configFileName
           
protected static java.text.DecimalFormat CURRENCY_FORMAT
           
protected  CyberCash cyberCash
           
protected static java.text.SimpleDateFormat DATE_FORMAT
           
protected static java.lang.String DECRYPTOR_HOME
           
protected static boolean DEFER_AUTHORIZATION
           
protected static java.lang.String DEFER_AUTHORIZATION_PROPERTY
           
protected static java.lang.String DEFER_AUTHORIZATION_PROPERTY_NAME
           
protected static java.lang.String ENCRYPTION_PROPERTY
           
protected static java.lang.String ENCRYPTION_PROPERTY_NAME
           
protected static boolean IS_INITIALIZED
           
protected static java.lang.String PAYMENT_MODEL
           
protected static java.lang.String PAYMENT_MODEL_PROPERTY_NAME
           
protected static java.lang.String PAYMENT_TRANSACTION_HOME
           
 
Fields inherited from class com.beasys.commerce.foundation.SessionImpl
_ctx, _environmentNamingContext, _environmentPropertyCache, _isDirty
 
Fields inherited from interface com.beasys.commerce.ebusiness.payment.TransactionConstants
ACTION_CODE, ACTION_CODE_CALL, AMOUNT, AUTHORIZED, AUTO_MARK_AUTO_SETTLE, AUTO_MARK_AUTO_SETTLE_AVS, AUTO_MARK_MANUAL_SETTLE, AUTO_MARK_MANUAL_SETTLE_AVS, BATCH_ACCEPTED, BATCH_COMMIT, BATCH_ID, BATCH_PREP, BATCH_QUERY, BATCH_RETRY, BATCH_STATUS, BATCH_UNROLL, CARD_QUERY, CHECK, CREDIT_CARD_ADDRESS, CREDIT_CARD_ADDRESS_CITY, CREDIT_CARD_ADDRESS_STATE, CREDIT_CARD_ADDRESS_STREET, CREDIT_CARD_ADDRESS_ZIP, CREDIT_CARD_EXPIRATION_DATE, CREDIT_CARD_NUMBER, CREDITCARD, CURRENCY_US, CYBERCASH_CONFIG_FILE, FAILEDSETTLE, FDC_BANK_PROCESSOR_ERROR, FDC_CALL,
 
Constructor Summary
CreditCardServiceImpl()
           
 
Method Summary
 TransactionResponse authorize(CreditCard card, Price amount, boolean useAvs)
          Reserve credit on the supplied card.
 TransactionResponse authorizeAndCapture(CreditCard card, Price amount, boolean useAvs)
          This method does the authorization and settle at one go.
 TransactionResponse batchQuery(java.lang.String transactionId)
          The batch-query message is used to update and reconcile the status of a transaction committed in a given batch.
 TransactionResponse capture(java.lang.String transactionId, Price amount)
          Marks a portion of a payment transaction for settlement such that it will be processed in the next batch.
 void ejbActivate()
          ejbActivate method.
 void ejbCreate()
          ejbCreate method.
 void ejbPassivate()
          ejbPassivate method.
 void ejbPostCreate()
          ejbPostCreate method.
 void ejbRemove()
          ejbRemove method.
 void initialize()
          Initializes CyberCash based upon given configuration filename.
 TransactionResponse queryTransactions(java.lang.String transactionId, java.lang.String transactionType, java.lang.String transactionStatus, java.lang.String transactionOrigin, java.lang.String cardType, java.sql.Date startTime, java.sql.Date endTime, Price lowAmount, Price highAmount, java.lang.Integer maxNumberOfTransactions)
          Query the Payment server for transactions which match the supplied parameters.
 TransactionResponse reauthorize(java.lang.String paymentTransactionId, boolean useAvs)
          Reauthorizes a given payment transaction for the amount associated with the transaction.
 TransactionResponse reauthorizeAndCapture(java.lang.String paymentTransactionId, boolean useAvs)
          Reauthorizes and captures a given payment transaction for the amount associated with the transaction.
 void setSessionContext(com.beasys.commerce.ebusiness.payment.SessionContext ctx)
           
 TransactionResponse settle(java.lang.String transactionId, Price amount)
          Finalize a transaction by transferring a portion of the funds previously captured from the customer's account to the merchant's account.
 TransactionResponse voidTransaction(java.lang.String transactionId)
          Abort a transaction which was previously submitted.
 
Methods inherited from class com.beasys.commerce.foundation.SessionImpl
clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, doRelationalBinding, doRelationalBinding, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, enumerateRelationalBinding, enumerateRelationalBinding, getEnvironmentNamingContext, getEnvironmentProperty, getEnvironmentProperty, getEnvironmentPropertyCache, getPersistenceHelperPlugin, getSessionContext,
 

Field Detail

configFileName

protected static java.lang.String configFileName

cyberCash

protected transient CyberCash cyberCash

PAYMENT_TRANSACTION_HOME

protected static java.lang.String PAYMENT_TRANSACTION_HOME

DECRYPTOR_HOME

protected static java.lang.String DECRYPTOR_HOME

PAYMENT_MODEL

protected static java.lang.String PAYMENT_MODEL

PAYMENT_MODEL_PROPERTY_NAME

protected static java.lang.String PAYMENT_MODEL_PROPERTY_NAME

CONFIG_FILE_NAME

protected static java.lang.String CONFIG_FILE_NAME

CONFIG_FILE_PROPERTY_NAME

protected static java.lang.String CONFIG_FILE_PROPERTY_NAME

ENCRYPTION_PROPERTY

protected static java.lang.String ENCRYPTION_PROPERTY

ENCRYPTION_PROPERTY_NAME

protected static java.lang.String ENCRYPTION_PROPERTY_NAME

DEFER_AUTHORIZATION_PROPERTY

protected static java.lang.String DEFER_AUTHORIZATION_PROPERTY

DEFER_AUTHORIZATION

protected static boolean DEFER_AUTHORIZATION

DEFER_AUTHORIZATION_PROPERTY_NAME

protected static java.lang.String DEFER_AUTHORIZATION_PROPERTY_NAME

IS_INITIALIZED

protected static boolean IS_INITIALIZED

CURRENCY_FORMAT

protected static final java.text.DecimalFormat CURRENCY_FORMAT

DATE_FORMAT

protected static final java.text.SimpleDateFormat DATE_FORMAT
Constructor Detail

CreditCardServiceImpl

public CreditCardServiceImpl()
Method Detail

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Description copied from class: SessionImpl
ejbCreate method.
Overrides:
ejbCreate in class SessionImpl

ejbPostCreate

public void ejbPostCreate()
                   throws javax.ejb.CreateException
Description copied from class: SessionImpl
ejbPostCreate method.
Overrides:
ejbPostCreate in class SessionImpl

ejbActivate

public void ejbActivate()
                 throws javax.ejb.EJBException
Description copied from class: SessionImpl
ejbActivate method.
Overrides:
ejbActivate in class SessionImpl

ejbPassivate

public void ejbPassivate()
                  throws javax.ejb.EJBException
Description copied from class: SessionImpl
ejbPassivate method.
Overrides:
ejbPassivate in class SessionImpl

ejbRemove

public void ejbRemove()
               throws javax.ejb.EJBException
Description copied from class: SessionImpl
ejbRemove method.
Overrides:
ejbRemove in class SessionImpl

setSessionContext

public void setSessionContext(com.beasys.commerce.ebusiness.payment.SessionContext ctx)
                       throws javax.ejb.EJBException

initialize

public void initialize()
Initializes CyberCash based upon given configuration filename. This function should be called before sending transactions to CyberCash.

authorize

public TransactionResponse authorize(CreditCard card,
                                     Price amount,
                                     boolean useAvs)
                              throws InvalidCreditCardException,
                                     AuthorizationException,
                                     ServiceUnavailableException,
                                     ServiceConfigurationException,
                                     GeneralServiceException,
                                     java.rmi.RemoteException
Reserve credit on the supplied card. In this case, the caller must follow up with a second call to complete the transaction. The two possible calls are capture, which bills the customer, and void, which aborts the transaction. Typically, this procedure is used if the caller cannot guarantee shipment within 24 hours of the purchase.
Parameters:
card - The credit card to be used for the transaction
amount - Amount of the transaction
useAvs - Flag indicating whether to use address verfication
Throws:
InvalidCreditCardException - If the associated credit card is invalid
AuthorizationException - If the associated credit card could not be authorized for the specified amount
ServiceUnavailableException - If the authorization service is unavailable
ServiceConfigurationException - If the authorization service is misconfigured
GeneralServiceException - On general service error
java.rmi.RemoteException - On remote error

authorizeAndCapture

public TransactionResponse authorizeAndCapture(CreditCard card,
                                               Price amount,
                                               boolean useAvs)
                                        throws AuthorizationException,
                                               InvalidCreditCardException,
                                               ServiceUnavailableException,
                                               ServiceConfigurationException,
                                               GeneralServiceException,
                                               java.rmi.RemoteException
This method does the authorization and settle at one go. It represents the business model where soft goods are sold.
Parameters:
card - The credit card to be used for the transaction
amount - Amount of the transaction
useAvs - Flag indicating whether to use address verfication
Throws:
InvalidCreditCardException - If the associated credit card is invalid
AuthorizationException - If the associated credit card could not be authorized for the specified amount
ServiceUnavailableException - If the authorization service is unavailable
ServiceConfigurationException - If the authorization service is misconfigured
GeneralServiceException - On general service error
java.rmi.RemoteException - On remote error

reauthorize

public TransactionResponse reauthorize(java.lang.String paymentTransactionId,
                                       boolean useAvs)
                                throws com.beasys.commerce.ebusiness.payment.FinderException,
                                       InvalidCreditCardException,
                                       AuthorizationException,
                                       ServiceUnavailableException,
                                       ServiceConfigurationException,
                                       GeneralServiceException,
                                       java.rmi.RemoteException
Reauthorizes a given payment transaction for the amount associated with the transaction. The payment transaction is updated with the current date and a transaction entry is added to the payment transaction as the result of the authorization attempt. The modified payment transaction and any service-specific results are then returned.
Parameters:
paymentTransactionId - The ID of the payment transaction to reauthorize
useAvs - Flag indicating whether to use address verfication
Throws:
com.beasys.commerce.ebusiness.payment.FinderException - If the payment transaction with the specified ID could not be found
InvalidCreditCardException - If the associated credit card is invalid
AuthorizationException - If the associated credit card could not be authorized for the specified amount
ServiceUnavailableException - If the authorization service is unavailable
ServiceConfigurationException - If the authorization service is misconfigured
GeneralServiceException - On general service error
java.rmi.RemoteException - On remote error

reauthorizeAndCapture

public TransactionResponse reauthorizeAndCapture(java.lang.String paymentTransactionId,
                                                 boolean useAvs)
                                          throws com.beasys.commerce.ebusiness.payment.FinderException,
                                                 InvalidCreditCardException,
                                                 AuthorizationException,
                                                 ServiceUnavailableException,
                                                 ServiceConfigurationException,
                                                 GeneralServiceException,
                                                 java.rmi.RemoteException
Reauthorizes and captures a given payment transaction for the amount associated with the transaction. The payment transaction is updated with the current date and a transaction entry is added to the payment transaction as the result of the authorization attempt. The modified payment transaction and any service-specific results are then returned.
Parameters:
paymentTransactionId - The ID of the payment transaction to reauthorize
useAvs - Flag indicating whether to use address verfication
Throws:
com.beasys.commerce.ebusiness.payment.FinderException - If the payment transaction with the specified ID could not be found
InvalidCreditCardException - If the associated credit card is invalid
AuthorizationException - If the associated credit card could not be authorized for the specified amount
ServiceUnavailableException - If the authorization service is unavailable
ServiceConfigurationException - If the authorization service is misconfigured
GeneralServiceException - On general service error
java.rmi.RemoteException - On remote error

capture

public TransactionResponse capture(java.lang.String transactionId,
                                   Price amount)
                            throws CaptureException,
                                   ServiceUnavailableException,
                                   PaymentException,
                                   java.rmi.RemoteException
Marks a portion of a payment transaction for settlement such that it will be processed in the next batch. The amount can be less than or equal to the authorization amount.

Before a transaction can be settled (and funds transfered into a merchant's account) it must first be captured. This marks the transaction such that it will be settled as part of a batch process. This method should be used for terminal-based payment models with a Manual Mark processor configuration. This method should be used for host-based, post authorization and capture payment model.
Parameters:
paymentTransactionId - The ID of the payment transaction to reauthorize.
amount - The amount of the transaction to capture.
Returns:
A TransactionResponse that refers to the updated PaymentTransaction.
Throws:
CaptureException - If it was not possible to capture the amount from the transaction.
ServiceUnavailableException - If the underlying service is unreachable.
PaymentException - On general payment exception.
java.rmi.RemoteException - On remote error

settle

public TransactionResponse settle(java.lang.String transactionId,
                                  Price amount)
                           throws SettleException,
                                  ServiceUnavailableException,
                                  PaymentException,
                                  java.rmi.RemoteException
Finalize a transaction by transferring a portion of the funds previously captured from the customer's account to the merchant's account. The amount can be less than or equal to the captured amount.

This method should be used for terminal-based payment models with a Manual Settle processor configuration.
Parameters:
transactionId - The ID of the payment transaction to settle.
amount - The amount of the transaction to mark for settlement.
Throws:
SettleException - If the transaction cannot be settled.
ServiceUnavailableException - If the authorization service is unavailable
PaymentException - General payment error.
java.rmi.RemoteException - On remote error

batchQuery

public TransactionResponse batchQuery(java.lang.String transactionId)
                               throws java.rmi.RemoteException
The batch-query message is used to update and reconcile the status of a transaction committed in a given batch. This message is used to determine if a particular transaction has failed, and is essential for payment processors where the status of an item cannot be determined correctly from the output fields of a batch-commit message.

This method is implemented as a pass through to the underlying service provider. As such all return information is service specific. Refer to the service provider manual for details on return codes and results. <\b>
Parameters:
transactionId - The ID of the payment transaction to query status for.
Throws:
java.rmi.RemoteException - On remote error.

voidTransaction

public TransactionResponse voidTransaction(java.lang.String transactionId)
                                    throws PaymentException,
                                           java.rmi.RemoteException
Abort a transaction which was previously submitted. The following transactions may be voided:
  • HOST_AUTH_CAPTURE transactions in the pending settlement state.
  • HOST_POST_AUTH_CAPTURE transactions in the pending settlement state.
  • AUTO_MARK_AUTO_SETTLE transactions in the pending settlement state.
  • MANUAL_MARK_AUTO_SETTLE transactions in the pending settlement state.
  • AUTO_MARK_MANUAL_SETTLE transactions in the captured state.
  • MANUAL_MARK_MANUAL_SETTLE transactions in the captured state.
Parameters:
transactionId - The ID of the payment transaction to void.
Throws:
PaymentException - General payment error.
java.rmi.RemoteException - On remote error.

queryTransactions

public TransactionResponse queryTransactions(java.lang.String transactionId,
                                             java.lang.String transactionType,
                                             java.lang.String transactionStatus,
                                             java.lang.String transactionOrigin,
                                             java.lang.String cardType,
                                             java.sql.Date startTime,
                                             java.sql.Date endTime,
                                             Price lowAmount,
                                             Price highAmount,
                                             java.lang.Integer maxNumberOfTransactions)
                                      throws java.rmi.RemoteException
Query the Payment server for transactions which match the supplied parameters. The caller need only supply non-null values for those parameters that they want to query against, but must supply at least one non-null parameter.

This method is implemented as a pass through to the underlying service provider. As such all return information is service specific. Refer to the service provider manual for details on return codes and results.
Parameters:
transactionId - The ID of a specific transaction.
Throws:
java.rmi.RemoteException - On remote error

© 2001 BEA Systems, Inc.

Copyright © 2001 BEA Systems, Inc. All Rights Reserved