public interface Credit
extends java.io.Serializable
This class is a value object container for credit-related transactions.
Possible financial transactions associated with a Credit are:
A Credit container supports only one credit transaction during its life span. However, multiple reversals might be supported for the same credit transaction.
Note that since this is a value object, no financial transaction will actually happen through this object. But rather this object contains information associated with the financial transactions before, during, and after the processing of the transaction.
Credits are sometimes referred as refunds when associated with a Refund Merchandise Authorization (RMA).
Dependent and independent credits
Credit transactions can be classified as dependent and independent. Dependent credits are transactions associated with a PaymentInstruction where deposits have already taken place. For example, after a deposit of $100.00, a credit up to $100.00 would be considered a dependent credit. In the other hand, independent credits are transactions associated with a PaymentInstruction where no previous deposits have taken place or the amount of credit goes above the previously deposited amount. For example, after a deposit of $100.00, a credit of $150.00 would be an independent credit. Also, without any previous deposit, a credit of any dollar amount would be a dependent credit. A plug-in can access Payment containers associated with a PaymentInstruction to determine if a credit transaction depends on a previous deposit transaction. If that is the case, the credit transaction is a dependent one. Otherwise, it is an independent credit transaction.
Support for dependent and independent credits might vary among payment back-end systems.
Credits are always associated with a PaymentInstruction container. A PaymentInstruction keeps references to all Payment containers and all Credit containers associated with it.
A plug-in can access the associated Payment containers to determine if a credit transaction depends on a previous deposit transaction. If that is the case, the credit transaction is a dependent credit and the plug-in can proceed accordingly. Otherwise, the transaction is an independent credit and the plug-in has to deal with it as such.
Online and offline processing.
Online refers to the processing of financial transactions that do not require external intervention for successful execution. In other words, the complete process of the financial transaction is done electronically and automatically without needing any external/human intervention.
Offline refers to the processing of financial transactions that require external intervention for successful execution. For example, when a credit card needs to be processed over the phone or through a swipe box. Then the processing of the credit card is considered offline.
Payment state machine
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM copyright notice field.
|
static short | STATE_CANCELED
The state of the Credit container when it has been fully reversed.
|
static short | STATE_CREDITED
The state of the Credit container when a successful credit transaction has been completed.
|
static short | STATE_CREDITING
The state of the Credit container while a credit transaction is pending.
|
static short | STATE_FAILED
The state of the Credit container when a transaction has failed.
|
static short | STATE_NEW
The state of the Credit container after its creation.
|
Modifier and Type | Method and Description |
---|---|
java.math.BigDecimal | getCreditedAmount()
This method gets the currently credited amount.
|
java.math.BigDecimal | getCreditingAmount()
This method gets the amount currently being credited.
|
FinancialTransaction | getCreditTransaction()
This method gets the associated credit transaction if any.
|
java.lang.String | getId()
This method gets the unique identifier of the Credit container.
|
PaymentInstruction | getPaymentInstruction()
This method gets the associated PaymentInstruction.
|
java.util.ArrayList | getReverseCreditTransactions()
This method gets the list of credit reversal transactions.
|
java.math.BigDecimal | getReversingAmount()
This method gets the amount currently being reversed.
|
short | getState()
This method gets the current state of the Credit container.
|
java.math.BigDecimal | getTargetAmount()
This method gets the amount that is the target as the total to be credited in the lifetime of the container.
|
void | setCreditedAmount(java.math.BigDecimal decimal)
This method sets the amount credited in the container.
|
void | setCreditingAmount(java.math.BigDecimal decimal)
This method sets the amount being credited, that is, in pending to be credited.
|
void | setReversingAmount(java.math.BigDecimal reversingAmount)
This method sets the reverse credited amount.
|
java.lang.String | toString()
This method obtains a human-readable representation of the Credit container.
|
static final java.lang.String COPYRIGHT
static final short STATE_NEW
static final short STATE_CREDITING
static final short STATE_CREDITED
static final short STATE_FAILED
static final short STATE_CANCELED
FinancialTransaction getCreditTransaction()
This method gets the associated credit transaction if any.
This method allows a plug-in to obtain the credit transaction that has been executed under the Credit.
void setCreditedAmount(java.math.BigDecimal decimal)
This method sets the amount credited in the container.
Plug-ins will invoke this method when supporting queries.
java.math.BigDecimal getCreditedAmount()
This method gets the currently credited amount.
Plug-ins can use this method to verify how much has been actually credited after a successful credit transaction. Usually the actual credited amount is the same as the requested amount. However, some payment back-end systems might process a different amount.
void setCreditingAmount(java.math.BigDecimal decimal)
This method sets the amount being credited, that is, in pending to be credited.
Plug-ins will invoke this method when supporting queries.
java.math.BigDecimal getCreditingAmount()
This method gets the amount currently being credited.
Plug-ins can use this method to verify how much credit is in pending. credit transactions might go in pending for a variety of reasons including slow network processing, timeouts and when offline processing is required. Offline processing typically requires human interaction to process transactions over the phone or through a swipe machine.
java.lang.String getId()
This method gets the unique identifier of the Credit container.
PaymentInstruction getPaymentInstruction()
This method gets the associated PaymentInstruction.
The plug-ins need to use the PaymentInstruction to determine if a credit transaction is dependent or independent.
java.util.ArrayList getReverseCreditTransactions()
This method gets the list of credit reversal transactions.
This method allows a plug-in to obtain all the credit reversal transactions that have been executed against the Credit container.
Each of the elements in the array is a FinancialTransaction.
void setReversingAmount(java.math.BigDecimal reversingAmount)
This method sets the reverse credited amount.
Plug-ins will invoke this method when supporting credit queries.
java.math.BigDecimal getReversingAmount()
This method gets the amount currently being reversed.
short getState()
This method gets the current state of the Credit container.
Valid values:
java.math.BigDecimal getTargetAmount()
This method gets the amount that is the target as the total to be credited in the lifetime of the container.
java.lang.String toString()
This method obtains a human-readable representation of the Credit container.