atg.commerce.payment
Class GiftCertificateProcessorImpl

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.payment.GiftCertificateProcessorImpl
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, atg.payment.giftcertificate.DecreaseGiftCertificateAuthorizationProcessor, GiftCertificateProcessor, java.util.EventListener

public class GiftCertificateProcessorImpl
extends GenericService
implements GiftCertificateProcessor, atg.payment.giftcertificate.DecreaseGiftCertificateAuthorizationProcessor

This class performs the actual functions of authorizing, debiting and crediting a giftcertificate. These are all the method that must be implemented in order to provide a payment method.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
GiftCertificateProcessorImpl()
           
 
Method Summary
 GiftCertificateStatus authorize(GiftCertificateInfo pGiftCertificateInfo)
          The authorizaton of a gift certificate calls the authorizeClaimableGiftCerificate method in the ClaimableManager.
 GiftCertificateStatus credit(GiftCertificateInfo pGiftCertificateInfo)
          Credit the gift certificate identified with the parameter pGiftCertificateInfo.getGiftCertificateNumber() the amount returned by the getAmount call on the same giftCertificateInfo parameter.
 GiftCertificateStatus credit(GiftCertificateInfo pGiftCertificateInfo, PaymentStatus pStatus)
          Credit the gift certificate identified with the parameter pGiftCertificateInfo.getGiftCertificateNumber() the amount returned by the getAmount call on the same giftCertificateInfo parameter.
 GiftCertificateStatus debit(GiftCertificateInfo pGiftCertificateInfo, PaymentStatus pStatus)
          We check to see if the PaymentStatus amount is greater that the amount indicated in the giftCertificateInfo.
 GiftCertificateStatus decreaseAuthorization(GiftCertificateInfo pGiftCertificateInfo, PaymentStatus pAuthStatus)
           
 GiftCertificateStatus expireAuthorization(GiftCertificateInfo pGiftCertificateInfo)
          Expire a gift certificate authorization
 ClaimableManager getClaimableManager()
          Get the ClaimableManager property.
protected  java.lang.String getNextTransactionId()
          This method generates a transactionId by returning a the System time in milliseconds.
 long getSecondsUntilExpiration()
          Returns property secondsUntilExpiration
 void setClaimableManager(ClaimableManager pClaimableManager)
          Set the ClaimableManager that will be used to claim the gift certificats.
 void setSecondsUntilExpiration(long pSecondsUntilExpiration)
          Sets property secondsUntilExpiration
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

GiftCertificateProcessorImpl

public GiftCertificateProcessorImpl()
Method Detail

setClaimableManager

public void setClaimableManager(ClaimableManager pClaimableManager)
Set the ClaimableManager that will be used to claim the gift certificats.

Parameters:
pClaimableManager - the ClaimableManager that will be used

getClaimableManager

public ClaimableManager getClaimableManager()
Get the ClaimableManager property.

Returns:
the ClaimableManager

getSecondsUntilExpiration

public long getSecondsUntilExpiration()
Returns property secondsUntilExpiration

Returns:
returns property secondsUntilExpiration

setSecondsUntilExpiration

public void setSecondsUntilExpiration(long pSecondsUntilExpiration)
Sets property secondsUntilExpiration

Parameters:
pSecondsUntilExpiration - the value to set for property secondsUntilExpiration

getNextTransactionId

protected java.lang.String getNextTransactionId()
This method generates a transactionId by returning a the System time in milliseconds. Override this method to generate the id a different way.


authorize

public GiftCertificateStatus authorize(GiftCertificateInfo pGiftCertificateInfo)
The authorizaton of a gift certificate calls the authorizeClaimableGiftCerificate method in the ClaimableManager.

Specified by:
authorize in interface GiftCertificateProcessor
Parameters:
pGiftCertificateInfo - the GiftCertificateInfo reference which contains all the authorization data
Returns:
a GiftCertificateStatus object detailing the results of the authorization

expireAuthorization

public GiftCertificateStatus expireAuthorization(GiftCertificateInfo pGiftCertificateInfo)
Expire a gift certificate authorization

Specified by:
expireAuthorization in interface GiftCertificateProcessor
Parameters:
pGiftCertificateInfo - the GiftCertificateInfo reference which contains all the authorization expiration data
Returns:
a GiftCertificateStatus object detailing the results of the authorization

debit

public GiftCertificateStatus debit(GiftCertificateInfo pGiftCertificateInfo,
                                   PaymentStatus pStatus)
We check to see if the PaymentStatus amount is greater that the amount indicated in the giftCertificateInfo. If it is greater, than we credit back the difference to the giftcertificate via the ClaimableManager.

Specified by:
debit in interface GiftCertificateProcessor
Parameters:
pGiftCertificateInfo - the GiftCertificateInfo reference which contains all the debit data
pStatus - the PaymentStatus object which contains information about the transaction. This should be the object which was returned from authorize().
Returns:
a GiftCertificateStatus object detailing the results of the debit

credit

public GiftCertificateStatus credit(GiftCertificateInfo pGiftCertificateInfo,
                                    PaymentStatus pStatus)
Credit the gift certificate identified with the parameter pGiftCertificateInfo.getGiftCertificateNumber() the amount returned by the getAmount call on the same giftCertificateInfo parameter. The creditClaimableGiftCertificate method will be called on the claimableManager to perform the actual crediting.

Specified by:
credit in interface GiftCertificateProcessor
Parameters:
pGiftCertificateInfo - the GiftCertificateInfo reference which contains all the credit data
pStatus - the PaymentStatus object which contains information about the transaction. This should be the object which was returned from debit().
Returns:
a GiftCertificateStatus object detailing the results of the credit

credit

public GiftCertificateStatus credit(GiftCertificateInfo pGiftCertificateInfo)
Credit the gift certificate identified with the parameter pGiftCertificateInfo.getGiftCertificateNumber() the amount returned by the getAmount call on the same giftCertificateInfo parameter. The creditClaimableGiftCertificate method will be called on the claimableManager to perform the actual crediting.

Specified by:
credit in interface GiftCertificateProcessor
Parameters:
pGiftCertificateInfo - the GiftCertificateInfo reference which contains all the credit data
Returns:
a GiftCertificateStatus object detailing the results of the credit

decreaseAuthorization

public GiftCertificateStatus decreaseAuthorization(GiftCertificateInfo pGiftCertificateInfo,
                                                   PaymentStatus pAuthStatus)
Specified by:
decreaseAuthorization in interface atg.payment.giftcertificate.DecreaseGiftCertificateAuthorizationProcessor