atg.commerce.payment
Class InvoiceRequestProcessorImpl

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.payment.InvoiceRequestProcessorImpl
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, InvoiceRequestProcessor, java.util.EventListener
Direct Known Subclasses:
InvoiceRequestProcessorImpl

public class InvoiceRequestProcessorImpl
extends GenericService
implements InvoiceRequestProcessor

A payment processor for billing by invoice whose debit method calls on an InvoiceManager to generate a repository item representing the invoice and emit JMS messages notifying any interested listeners of invoice creation and update.

The authorize and credit methods are no-ops in this implementation. Subclasses could provide implementations that interoperate with particular financial systems, generate JMS messages, etc.


Field Summary
static java.lang.String CLASS_VERSION
           
protected static java.util.ResourceBundle sDefaultResources
           
 
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
InvoiceRequestProcessorImpl()
           
 
Method Summary
 PaymentStatus authorize(InvoiceRequestInfo pInvoiceInfo)
          Authorize the use of a invoice for payment.
protected  PaymentStatus createErrorStatus(double pAmount, java.lang.String pErrorMsg)
          Create an instance of a PaymentStatus reflecting an unsuccessful transaction.
protected  PaymentStatus createSuccessStatus(double pAmount)
          Create an instance of a PaymentStatus reflecting a successful transaction.
 PaymentStatus credit(InvoiceRequestInfo pInvoiceInfo)
          Process refunds/credits on payments made by invoice as a new order.
 PaymentStatus credit(InvoiceRequestInfo pInvoiceInfo, PaymentStatus pStatus)
          Process refunds/credits on payments made by invoice.
 PaymentStatus debit(InvoiceRequestInfo pInvoiceInfo, PaymentStatus pStatus)
          Process payment by invoice, calling on the InvoiceManager to generate an invoice repository item from the payment group.
 CurrentDate getClock()
          Return the "clock" component used to generate timestamps
 InvoiceManager getInvoiceManager()
          Get the InvoiceManager to use when generating invoices
protected  java.lang.String nextTransactionId()
          Generate a unique transaction id.
 void setClock(CurrentDate pClock)
          Set the "clock" component used to generate timestamps
 void setInvoiceManager(InvoiceManager pInvoiceManager)
          Set the InvoiceManager to use when generating invoices
 
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

sDefaultResources

protected static java.util.ResourceBundle sDefaultResources
Constructor Detail

InvoiceRequestProcessorImpl

public InvoiceRequestProcessorImpl()
Method Detail

setInvoiceManager

public void setInvoiceManager(InvoiceManager pInvoiceManager)
Set the InvoiceManager to use when generating invoices


getInvoiceManager

public InvoiceManager getInvoiceManager()
Get the InvoiceManager to use when generating invoices


authorize

public PaymentStatus authorize(InvoiceRequestInfo pInvoiceInfo)
Authorize the use of a invoice for payment. By default this method does nothing. Subclasses may wish to override it to implement application-specific features such as credit checks.

Specified by:
authorize in interface InvoiceRequestProcessor
Parameters:
pInvoiceRequestInfo - the InvoiceRequestInfo that contains authorization data
Returns:
a PaymentStatus object detailing the results of the authorization

debit

public PaymentStatus debit(InvoiceRequestInfo pInvoiceInfo,
                           PaymentStatus pStatus)
Process payment by invoice, calling on the InvoiceManager to generate an invoice repository item from the payment group.

Specified by:
debit in interface InvoiceRequestProcessor
Parameters:
pInvoiceRequestInfo - the InvoiceRequestInfo that contains debit data
pStatus - the PaymentStatus object that contains information about the transaction. This will be the object that was returned by the last call to authorize().
Returns:
a PaymentStatus object detailing the results of the debit

credit

public PaymentStatus credit(InvoiceRequestInfo pInvoiceInfo,
                            PaymentStatus pStatus)
Process refunds/credits on payments made by invoice. By default this method does nothing. Subclasses may wish to override it to provide application-specific features such as regeneration of invoices to reflect the new payment due.

Specified by:
credit in interface InvoiceRequestProcessor
Parameters:
pInvoiceRequestInfo - the InvoiceRequestInfo that contains credit data
pStatus - the PaymentStatus object that contains information about the transaction. This will be the object that was returned by the last call to debit().
Returns:
a PaymentStatus object detailing the results of the credit

credit

public PaymentStatus credit(InvoiceRequestInfo pInvoiceInfo)
Process refunds/credits on payments made by invoice as a new order. By default this method does nothing. Subclasses may wish to override it to provide application-specific features such as regeneration of invoices to reflect the new payment due.

Specified by:
credit in interface InvoiceRequestProcessor
Parameters:
pInvoiceRequestInfo - the InvoiceRequestInfo that contains credit data
Returns:
a PaymentStatus object detailing the results of the credit

nextTransactionId

protected java.lang.String nextTransactionId()
Generate a unique transaction id. The id has no semantic meaning whatsoever.


createSuccessStatus

protected PaymentStatus createSuccessStatus(double pAmount)
Create an instance of a PaymentStatus reflecting a successful transaction.


createErrorStatus

protected PaymentStatus createErrorStatus(double pAmount,
                                          java.lang.String pErrorMsg)
Create an instance of a PaymentStatus reflecting an unsuccessful transaction.


setClock

public void setClock(CurrentDate pClock)
Set the "clock" component used to generate timestamps


getClock

public CurrentDate getClock()
Return the "clock" component used to generate timestamps