public class FinancialTransactionImpl extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable, FinancialTransaction
This class is a value object container representing a financial transaction.
A FinancialTransaction container represents all possible types of financial transactions processed by a Plugin. Depending on the actual transaction type, different attributes will be available.
These are the transaction types supported in this specification:
Plug-ins are responsible for updating this containers while processing financial transactions. Several attributes are predefined in the FinancialTransaction container. However, the plug-in might also need to add additional information to the FinancialTransaction container by using the associated ExtendedData.
Response code, reason code, reference number and tracking ID
The response code is a back-end system specific representation of a financial transaction result. It is typically used by the backend system to indicate if the financial transaction was successful or not. For example, it might indicate that a credit card authorization failed.The reason code is a back-end system specific representation of an error condition. It is typically used by the backend system to indicate why a financial transaction failed. For example, it might indicate that a credit card has expired.
When the response code alone cannot determine what has happened in a financial transaction, the reason code can be used to precisely determine a financial transaction error.
The response code and the reason code can also be seen as a primary and secondary error codes. As back-end system specific, these codes are used in problem determination whenever the standard plug-in mechanisms do not suffice.
The tracking ID is an optional attribute used by the plug-in to identify the financial transaction in the payment back-end system on behalf of the merchant. The tracking ID is set by the plug-in during the processing of financial transactions. The plug-in generates this ID and has to make sure it is unique in the plug-in and in the backend system realm. Although optional, the tracking ID might be the only way to track a financial transaction in the backend system if an error occurs. For example, during a financial transaction, the connection can be lost. And the plug-in wouldn't be able to tell if the backend system actually processed the transaction. The tracking ID would be the mechanism to query the back-end system later on, once connectivity is re-stablished. If the tracking ID is known by the backend system it means the transaction has reached the backend system. If it is unknown, the transaction needs to be executed again.
The reference number is an ID generated by the payment back-end system during the processing of financial transactions. The reference number is usually required by back-end systems to process subsequent (and related) financial transactions. For example, during a deposit transaction the reference number of a previous approve transaction is required. In this case, the reference number is the authorization code returned by the backend system during the approve transaction.
While the tracking ID is used to identify a financial transaction from the plug-in perspective, the reference number is used to identify a financial transaction from the payment back-end system perspective. The tracking ID is the first identifier of the financial transaction to exist. Once the reference number is obtained from the backend system, the plug-ins might not need the tracking ID anymore since the reference number is known by both parties: the plug-in and the payment back-end system.
Constructor and Description |
---|
FinancialTransactionImpl(java.lang.String id)
This method creates a FinancialTransaction container.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object | clone()
This method returns a shallow copy of this FinancialTransactionImpl instance.
|
Credit | getCredit()
This method gets the Credit container that is associated with the financial transaction.
|
ExtendedData | getExtendedData()
This method gets the extra data associated with the financial transaction.
|
java.lang.String | getId()
This method gets the unique identifier of the FinancialTransaction container.
|
Payment | getPayment()
This method gets the Payment container that is associated with the financial transaction.
|
java.math.BigDecimal | getProcessedAmount()
This method gets the actual processed amount.
|
java.lang.String | getReasonCode()
This method gets the reason for a failed financial transaction.
|
java.lang.String | getReferenceNumber()
This method gets the reference number of the financial transaction.
|
java.math.BigDecimal | getRequestedAmount()
This method gets the amount to be processed in a financial transaction.
|
java.lang.String | getResponseCode()
This method gets the back-end system specific result of the financial transaction.
|
short | getState()
This method gets the state of the financial transaction.
|
static java.lang.String | getStateAsString(int state)
This method gets a non-globalized human-readable representation of a payment instruction state.
|
java.util.Date | getTimeCreated()
This method gets the time the FinancialTransaction was created.
|
java.util.Date | getTimeUpdated()
This method gets the most recent time that the FinancialTransaction was updated.
|
java.lang.String | getTrackingId()
This method gets the FinancialTransaction tracking ID.
|
short | getTransactionType()
This method gets the type of the FinancialTransaction.
|
void | setCredit(CreditImpl credit)
This method sets the Credit container this FinancialTransaction is associated with.
|
void | setExtendedData(ExtendedData extendedData)
This method adds extended data to the FinancialTransaction container.
|
void | setPayment(PaymentImpl payment)
This method sets the Payment container that is associated with the FinancialTransaction container.
|
void | setProcessedAmount(java.math.BigDecimal processedAmount)
This method sets the amount actually processed in the financial transaction.
|
void | setReasonCode(java.lang.String reasonCode)
This method sets the reason for a failed transaction.
|
void | setReferenceNumber(java.lang.String referenceNumber)
This method sets the reference number of the financial transaction.
|
void | setRequestedAmount(java.math.BigDecimal requestedAmount)
This method sets the amount to be processed in a financial transaction.
|
void | setResponseCode(java.lang.String responseCode)
This method sets the back-end system specific result of the financial transaction.
|
void | setState(short state)
This method sets the state of the FinancialTransaction.
|
void | setTimeCreated(java.util.Date timeCreated)
This method sets the time the FinancialTransaction was created.
|
void | setTimeUpdated(java.util.Date timeUpdated)
This method sets the time the FinancialTransaction was last updated.
|
void | setTrackingId(java.lang.String trackingId)
This method sets the FinancialTransaction tracking identifier.
|
void | setTransactionType(short transactionType)
This method sets the type of the FinancialTransaction.
|
java.lang.String | toString()
This method obtains a human-readable description of the contents of the FinancialTransaction container.
|
public FinancialTransactionImpl(java.lang.String id)
public void setCredit(CreditImpl credit)
This method sets the Credit container this FinancialTransaction is associated with.
This method is used for FinancialTransactions with the types FinancialTransaction.TRANSACTION_TYPE_CREDIT and FinancialTransaction.TRANSACTION_TYPE_REVERSE_CREDIT.
public Credit getCredit()
This method gets the Credit container that is associated with the financial transaction.
The Credit container will be present only for transactions of the types FinancialTransaction.TRANSACTION_TYPE_CREDIT and FinancialTransaction.TRANSACTION_TYPE_REVERSE_CREDIT.
public void setExtendedData(ExtendedData extendedData)
This method adds extended data to the FinancialTransaction container.
The information passed here will be added to the existing extended data associated to the financial transaction. If any mapped value already exists it will be replaced with the new value.
The plug-in invokes this method when additional information needs to be added to The FinancialTransaction container during the processing of a financial transaction. The information might be required in subsequent financial transactions.
public ExtendedData getExtendedData()
This method gets the extra data associated with the financial transaction.
public void setReferenceNumber(java.lang.String referenceNumber)
This method sets the reference number of the financial transaction.
The plug-in needs to invoke this method during the processing of a financial transaction to update the reference number from the payment back-end system. This field is the unique identifier of the financial transaction from the payment back-end system perspective. For more details, please refer to the introduction of this Javadoc.
public java.lang.String getReferenceNumber()
This method gets the reference number of the financial transaction.
This field is the unique identifier of the financial transaction from the payment back-end system perspective. For more details, please refer to the introduction of this Javadoc.
public java.lang.String getId()
This method gets the unique identifier of the FinancialTransaction container.
This ID is guaranteed to be unique by the Payment Plug-in Controller.
public void setPayment(PaymentImpl payment)
This method sets the Payment container that is associated with the FinancialTransaction container. This is only set for financial transactions with these types: FinancialTransaction.TRANSACTION_TYPE_APPROVE, FinancialTransaction.TRANSACTION_TYPE_DEPOSIT, FinancialTransaction.TRANSACTION_TYPE_REVERSE_APPROVAL, FinancialTransaction.TRANSACTION_TYPE_REVERSE_DEPOSIT.
public Payment getPayment()
This method gets the Payment container that is associated with the financial transaction. The Payment container is only present in financial transactions with these types: FinancialTransaction.TRANSACTION_TYPE_APPROVE, FinancialTransaction.TRANSACTION_TYPE_DEPOSIT, FinancialTransaction.TRANSACTION_TYPE_REVERSE_APPROVAL, FinancialTransaction.TRANSACTION_TYPE_REVERSE_DEPOSIT.
public void setProcessedAmount(java.math.BigDecimal processedAmount)
This method sets the amount actually processed in the financial transaction.
This is the amount that was actually processed by the back-end system on the FinancialTransaction. This value will typically be the same as the requested amount. Unless the payment protocol used by the backend system supports a different amount to be processed.
The Plugin is responsible for setting this amount during the processing of a financial transaction. It is set when the amount processed by the backend system is different from the requested amount. If this amount is not set, the Payment Plugin Controller will assume that the requested amount was completely processed.
public java.math.BigDecimal getProcessedAmount()
This method gets the actual processed amount.
public void setReasonCode(java.lang.String reasonCode)
This method sets the reason for a failed transaction.
The Plugin needs to invoke this method during the processing of a financial transaction to update the failure reason from the payment back-end system. For more details on this field, please refer to the introduction of this Javadoc.
public java.lang.String getReasonCode()
This method gets the reason for a failed financial transaction.
For more details on this field, please refer to the introduction of this Javadoc.
public void setRequestedAmount(java.math.BigDecimal requestedAmount)
This method sets the amount to be processed in a financial transaction.
This amount represents the amount that the system needs to process on any given transaction. The actual processed amount might be different from the requested amount.
This method is invoked by the Payment Plugin Controller before the financial transaction starts.
public java.math.BigDecimal getRequestedAmount()
This method gets the amount to be processed in a financial transaction.
This amount represents the amount that the system needs to process on any given transaction. The actual processed amount might be different from the requested amount.
public void setResponseCode(java.lang.String responseCode)
This method sets the back-end system specific result of the financial transaction.
The Plugin needs to invoke this method during the processing of financial transactions to update the result coming from the payment back-end system. For more details on this field, please refer to the introduction of this Javadoc.
public java.lang.String getResponseCode()
This method gets the back-end system specific result of the financial transaction.
public void setState(short state) throws InvalidDataException
This method sets the state of the FinancialTransaction.
Valid values are:
Usually the Payment Plugin Controller will invoke this method to update a financial transaction during its lifetime. However, if the Plugin needs to force the financial transaction into a different state, the Plugin can call this method directly.
public short getState()
This method gets the state of the financial transaction.
Valid values are:
public void setTimeCreated(java.util.Date timeCreated)
This method sets the time the FinancialTransaction was created.
The Payment Plugin Controller sets this field when the FinancialTransaction is created.
public java.util.Date getTimeCreated()
This method gets the time the FinancialTransaction was created.
public void setTimeUpdated(java.util.Date timeUpdated)
This method sets the time the FinancialTransaction was last updated.
The Payment Plugin Controller updates this field everytime the FinancialTransaction changes.
public java.util.Date getTimeUpdated()
This method gets the most recent time that the FinancialTransaction was updated.
public void setTrackingId(java.lang.String trackingId)
This method sets the FinancialTransaction tracking identifier.
The Plugin needs to invoke this method when processing a financial transaction to update the tracking ID. This field is the unique identifier of the financial transaction from the Plugin perspective. For more details, please refer to the introduction of this Javadoc.
public java.lang.String getTrackingId()
This method gets the FinancialTransaction tracking ID.
This field is the unique identifier of the financial transaction from the Plugin perspective. For more details, please refer to the introduction of this Javadoc.
public void setTransactionType(short transactionType) throws InvalidDataException
This method sets the type of the FinancialTransaction.
Valid transaction types are:
The Payment Plugin Controller sets the type of the transaction during its creation.
public short getTransactionType()
This method gets the type of the FinancialTransaction.
Valid transaction types are:
public java.lang.String toString()
This method obtains a human-readable description of the contents of the FinancialTransaction container.
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
This method returns a shallow copy of this FinancialTransactionImpl instance.
public static java.lang.String getStateAsString(int state)