public class PaymentInstructionImpl extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable, PaymentInstruction
This class is a value object containing detailed information required by plug-ins to process financial
transactions (FinancialTransaction
).
The PaymentInstruction
(PI) is a container that aggregates the data the plug-ins need
to execute financial transactions while processing payment-related and credit-related
transactions. It contains account, billing address, amounts, and so on. It does not contain any
specific information used to track a particular financial transaction with the back-end system,
though. For tracking purposes, the Payment
,
Credit
and
FinancialTransaction
are used instead.
The amount on the PaymentInstruction
can be used by plug-ins to determine what is the
maximum target amount the Payment Plug-in Controller intends to collectively consume.
PPC often compares the amount in the PaymentInstruction
with the requested amount
for approve
and credit
transactions. PPC has to make sure that the
PaymentInstruction
amount is always equal or greater than the requested amount.
The ExtendedData
contains all the data related to the
a payment instruction that is not defined as an attribute in PaymentInstruction
.
This is required because all the protocol parameters for a Plugin are not known beforehand
by the Payment Plugin Controller. WebSphere Commerce defines a number of keywords to
identify common protocol parameters that are not part of the PaymentInstruction
set of attributes. The Plugin should take these keywords and map them to their own
back-end system definitions. Because it is not possibly to define all the possible keywords for
all potential plug-ins, additional keywords might need to be defined by the plug-ins.
Plug-ins are responsible for documenting these additional keywords. So that a store
might be able to pass these attributes down to the Payment Plugin Controller and then to the
Plugin. Then, ExtendedData
is in summary, the mechanism by which
WebSphere Commerce passes all information related to a PaymentInstruction
and
required for financial transactions. In addition, if the Plugin has specific needs during
Plugin.checkPaymentInstruction(PluginContext, PaymentInstruction)
and
Plugin.validatePaymentInstruction(PluginContext, PaymentInstruction)
, the Plugin
can add specific keywords and the Payment Plugin Controller will store those keywords and
use them in subsequent transactions against that PaymentInstruction
.
Containers: Class Diagram
-------------------- --------------------| PaymentInstruction |<------------ | -------------------- | | ^ 1 | | | | | |----------- | v 1 | | | -------------- | | | | ExtendedData | v 0..n v 0..n | -------------- --------- -------- | ^ 1 | Payment | | Credit | | | --------- -------- | | | 1 | 1 | | | | | | | | | | v 0..n v 0..n | | ---------------------- | -------------------| FinancialTransaction |------------ ----------------------
ACCOUNT, BILLTOADDRESS1, BILLTOADDRESS2, BILLTOADDRESS3, BILLTOCITY, BILLTOCOUNTRY, BILLTOFIRSTNAME, BILLTOLASTNAME, BILLTOMIDDLENAME, BILLTOPHONENUMBER, BILLTOSTATE, BILLTOZIPCODE, CAVV, CC_BRAND, CC_CVC, CC_NAMEONCARD, CHECK_NUMBER, CHECK_ROUTING_NUMBER, EXPIREDAY, EXPIREMONTH, EXPIREYEAR, ORDER_ID, PAYMENT_METHOD, PURCHASEORDER_ID, RMA_ID, STATE_CLOSED, STATE_INVALID, STATE_NEW, STATE_VALID, SV_ISSUE_DAY, SV_ISSUE_MONTH, SV_ISSUE_YEAR, SV_ISSUER, XID
Constructor and Description |
---|
PaymentInstructionImpl(java.lang.String piId,
java.lang.String currency,
java.math.BigDecimal amount,
ExtendedData extendedData,
java.lang.String store)
This method constructs a
PaymentInstruction uniquely identified with an associated amount. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
This method returns a shallow copy of this
PaymentInstructionImpl instance. |
java.lang.String |
getAccount()
This method gets the account associated with the
PaymentInstruction . |
java.math.BigDecimal |
getAmount()
This method gets the target amount to be processed by associated financial transactions.
|
java.math.BigDecimal |
getApprovedAmount()
This method gets the currently approved amount on this
PaymentInstruction . |
java.math.BigDecimal |
getApprovingAmount()
This method gets the amount being approved.
|
java.math.BigDecimal |
getCreditedAmount()
This method gets the currently credited amount on this
PaymentInstruction . |
java.math.BigDecimal |
getCreditingAmount()
This method gets the amount being credited.
|
java.util.ArrayList |
getCredits()
This method gets the list of associated
Credit containers. |
java.lang.String |
getCurrency()
This method gets the currency of the
PaymentInstruction . |
java.math.BigDecimal |
getDepositedAmount()
This method gets the currently deposited amount on this
PaymentInstruction . |
java.math.BigDecimal |
getDepositingAmount()
This method gets the amount being deposited.
|
ExtendedData |
getExtendedData()
This method gets the extra protocol data associated with this
PaymentInstruction . |
java.lang.String |
getId()
This method gets the unique identifier of the
PaymentInstruction container. |
java.lang.String |
getOrderId()
This method gets the order associated with the
PaymentInstruction . |
java.util.ArrayList |
getPayments()
This method gets a list of
Payment containers associated with this
PaymentInstruction . |
java.lang.String |
getPaymentSystemName()
This method gets the payment system name to which the
PaymentInstruction is associated with. |
java.lang.String |
getRmaId()
This method gets the Return Merchandizing Authorization ID associated with the
PaymentInstruction . |
short |
getState()
This method gets the current state of the
PaymentInstruction . |
static java.lang.String |
getStateAsString(int state)
This method gets a non-globalized human-readable representation of a payment instruction state.
|
java.lang.String |
getStore()
This method gets the merchant's store to which the
PaymentInstruction belongs to. |
long |
getTimeCreated()
This method gets the time when the
PaymentInstruction was created. |
long |
getTimeUpdate()
This method gets the most recent time that the
PaymentInstruction was updated. |
void |
setAccount(java.lang.String accountNumber)
This method sets the account of the
PaymentInstruction . |
void |
setAmount(java.math.BigDecimal amount)
This method sets the target amount to be processed on one or more payment or credit transactions.
|
void |
setApprovedAmount(java.math.BigDecimal approvedAmount)
This method sets the currently approved amount on this
PaymentInstruction . |
void |
setApprovingAmount(java.math.BigDecimal approvingAmount)
This method sets the current amount being approved.
|
void |
setCreditedAmount(java.math.BigDecimal creditAmount)
This method sets the currently credited amount on this
PaymentInstruction . |
void |
setCreditingAmount(java.math.BigDecimal creditingAmount)
This method sets the amount being credited.
|
void |
setCredits(java.util.ArrayList credits)
This method sets a list of
Credit containers associated with this
|
void |
setCurrency(java.lang.String currency)
This method sets the currency to be used in financial transactions associated with the
PaymentInstruction . |
void |
setDepositedAmount(java.math.BigDecimal depositedAmount)
This method sets the currently deposited amount on this
PaymentInstruction . |
void |
setDepositingAmount(java.math.BigDecimal depositingAmount)
This method sets the amount being deposited.
|
void |
setExtendedData(ExtendedData extendedData)
This method sets the extra protocol data associated with the
PaymentInstruction . |
void |
setOrderId(java.lang.String orderId)
This method sets the unique order identifier associated with the
PaymentInstruction . |
void |
setPayments(java.util.ArrayList payments)
This method sets the list of
Payment containers associated with this
PaymentInstruction . |
void |
setPaymentSystemName(java.lang.String paymentSystemName)
This method sets the payment system that will process this
PaymentInstruction . |
void |
setRmaId(java.lang.String rmaId)
This method sets the Return Merchandizing Authorization ID associated with the
PaymentInstruction . |
void |
setState(short state)
This method sets the state of the
PaymentInstruction . |
void |
setStore(java.lang.String storeId)
This method sets the unique identifier of the merchant's store.
|
void |
setTimeCreated(long timeCreated)
This method sets the time that the
PaymentInstruction was created. |
void |
setTimeUpdate(long timeUpdate)
This method sets the time the
PaymentInstruction was last changed. |
java.lang.String |
toString()
This method obtains a human-readable representation of the
PaymentInstruction financial container. |
public PaymentInstructionImpl(java.lang.String piId, java.lang.String currency, java.math.BigDecimal amount, ExtendedData extendedData, java.lang.String store)
This method constructs a PaymentInstruction
uniquely identified with an associated amount.
piId
- Uniquely identifies of the PaymentInstruction
container.currency
- The currency to be used for the PaymentInstruction
as
specified by ISO 4217.amount
- The maximum amount to be used for the PaymentInstruction
extendedData
- Contains all the data needed by the Plugin to process payment
transactions.store
- The store identifier to which the PI is associated with.public void setAccount(java.lang.String accountNumber)
This method sets the account of the PaymentInstruction
.
The Plugin is responsible for setting the account
based on the
name-value pairs in extended data
.
The default reserved keyword for the account is as defined in
keywords.xml
.
setAccount
in interface PaymentInstruction
accountNumber
- The account associated with this container.getExtendedData().
,
getAccount().
public java.lang.String getAccount()
This method gets the account associated with the PaymentInstruction
.
getAccount
in interface PaymentInstruction
PaymentInstruction
.setAccount(String).
public void setAmount(java.math.BigDecimal amount)
This method sets the target amount to be processed on one or more payment or credit transactions.
This amount is usually a hint for the actual amount to be processed. Plugin implementations might decide to support amounts exceeding the target amount or not.
amount
- The total target amount to be processed in transactions associated with this
PaymentInstruction
.public java.math.BigDecimal getAmount()
This method gets the target amount to be processed by associated financial transactions.
getAmount
in interface PaymentInstruction
setAmount(BigDecimal).
public void setApprovedAmount(java.math.BigDecimal approvedAmount)
This method sets the currently approved amount on this PaymentInstruction
.
approvedAmount
- The currently approvedAmount.public java.math.BigDecimal getApprovedAmount()
This method gets the currently approved amount on this PaymentInstruction
.
getApprovedAmount
in interface PaymentInstruction
setApprovedAmount(BigDecimal).
public void setApprovingAmount(java.math.BigDecimal approvingAmount)
This method sets the current amount being approved.
approvingAmount
- Decimal value representing the currently approvingAmount.public java.math.BigDecimal getApprovingAmount()
This method gets the amount being approved.
getApprovingAmount
in interface PaymentInstruction
setApprovingAmount(BigDecimal).
public void setCreditedAmount(java.math.BigDecimal creditAmount)
This method sets the currently credited amount on this PaymentInstruction
.
creditAmount
- Decimal value representing the currently creditedAmount.public java.math.BigDecimal getCreditedAmount()
This method gets the currently credited amount on this PaymentInstruction
.
getCreditedAmount
in interface PaymentInstruction
setCreditedAmount(BigDecimal).
public void setCreditingAmount(java.math.BigDecimal creditingAmount)
This method sets the amount being credited.
creditingAmount
- The amount being credited.public java.math.BigDecimal getCreditingAmount()
This method gets the amount being credited.
getCreditingAmount
in interface PaymentInstruction
setCreditingAmount(BigDecimal).
public void setCredits(java.util.ArrayList credits)
This method sets a list of Credit
containers associated with this
credits
- The list of associated Credit
containers .public java.util.ArrayList getCredits()
This method gets the list of associated Credit
containers.
getCredits
in interface PaymentInstruction
Credit
containers; this list may be empty.setCredits(ArrayList).
public void setCurrency(java.lang.String currency)
This method sets the currency to be used in financial transactions associated with the
PaymentInstruction
.
currency
- The currency associated with this PaymentInstruction
.public java.lang.String getCurrency()
This method gets the currency of the PaymentInstruction
.
getCurrency
in interface PaymentInstruction
PaymentInstruction
setCurrency(String).
public void setDepositedAmount(java.math.BigDecimal depositedAmount)
This method sets the currently deposited amount on this PaymentInstruction
.
depositedAmount
- The currently deposited amount.public java.math.BigDecimal getDepositedAmount()
This method gets the currently deposited amount on this PaymentInstruction
.
getDepositedAmount
in interface PaymentInstruction
setDepositedAmount(BigDecimal).
public void setDepositingAmount(java.math.BigDecimal depositingAmount)
This method sets the amount being deposited.
depositingAmount
- The amount being deposited.public java.math.BigDecimal getDepositingAmount()
This method gets the amount being deposited.
getDepositingAmount
in interface PaymentInstruction
setDepositingAmount(BigDecimal).
public void setExtendedData(ExtendedData extendedData)
This method sets the extra protocol data associated with the PaymentInstruction
.
extendedData
- The map of name-value pairs representing extended payment informationgetExtendedData().
public ExtendedData getExtendedData()
This method gets the extra protocol data associated with this PaymentInstruction
.
getExtendedData
in interface PaymentInstruction
PaymentInstruction
.setExtendedData(ExtendedData).
public java.lang.String getId()
PaymentInstruction
container.getId
in interface PaymentInstruction
PaymentInstruction
.public void setOrderId(java.lang.String orderId)
This method sets the unique order identifier associated with the PaymentInstruction
.
This is an optional field, since there might not be any order associated with the
PaymentInstruction
.
orderId
- The identifier of the associated order.public java.lang.String getOrderId()
This method gets the order associated with the PaymentInstruction
.
getOrderId
in interface PaymentInstruction
null
if there is no order associated with
the PaymentInstruction
.setOrderId(String).
public java.lang.String getRmaId()
This method gets the Return Merchandizing Authorization ID associated with the
PaymentInstruction
.
getRmaId
in interface PaymentInstruction
null
if not present .setOrderId(String).
public void setRmaId(java.lang.String rmaId)
This method sets the Return Merchandizing Authorization ID associated with the
PaymentInstruction
.
This is an optional field, since there might not be any returns associated with the
PaymentInstruction
.
rmaId
- The Return Merchandizing Authorization ID.public void setPaymentSystemName(java.lang.String paymentSystemName)
This method sets the payment system that will process this PaymentInstruction
.
The payment system name is typically the name of the plugin implementation defined in the Plugin configuration. However, since multiple payment systems can be associated with the same Plugin. The payment system name can be used by the Plugin to distinguish which back-end system or protocol the Plugin needs to use. This n-to-1 mapping is relevant only to plug-ins that support multiple payment protocols.
paymentSystemName
- The name of the payment system to process financial transactions.public java.lang.String getPaymentSystemName()
This method gets the payment system name to which the PaymentInstruction
is associated with.
getPaymentSystemName
in interface PaymentInstruction
PaymentInstruction
.setPaymentSystemName(String).
public void setPayments(java.util.ArrayList payments)
This method sets the list of Payment
containers associated with this
PaymentInstruction
.
payments
- The list of Credit
containers associated with this .public java.util.ArrayList getPayments()
This method gets a list of Payment
containers associated with this
PaymentInstruction
.
getPayments
in interface PaymentInstruction
Payment
containers;
this list might be empty.setPayments(ArrayList)
public short getState()
This method gets the current state of the PaymentInstruction
.
Valid values:
getState
in interface PaymentInstruction
PaymentInstruction
.public void setState(short state)
This method sets the state of the PaymentInstruction
.
Valid values:
state
- The state of the PaymentInstruction
to be set.public void setStore(java.lang.String storeId)
This method sets the unique identifier of the merchant's store.
storeId
- The unique identifier of the merchant's store.public java.lang.String getStore()
This method gets the merchant's store to which the PaymentInstruction
belongs to.
getStore
in interface PaymentInstruction
public void setTimeCreated(long timeCreated)
This method sets the time that the PaymentInstruction
was created.
The time should follow GMT standard time.
timeCreated
- The creation time in milliseconds.public long getTimeCreated()
This method gets the time when the PaymentInstruction
was created.
getTimeCreated
in interface PaymentInstruction
PaymentInstruction
was created.public void setTimeUpdate(long timeUpdate)
This method sets the time the PaymentInstruction
was last changed.
timeUpdate
- The update time in milliseconds.public long getTimeUpdate()
This method gets the most recent time that the PaymentInstruction
was updated.
getTimeUpdate
in interface PaymentInstruction
PaymentInstruction
last updated.public java.lang.String toString()
This method obtains a human-readable representation of the PaymentInstruction
financial container.
toString
in interface PaymentInstruction
toString
in class java.lang.Object
PaymentInstruction
container.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
This method returns a shallow copy of this PaymentInstructionImpl
instance.
clone
in class java.lang.Object
PaymentInstructionImpl
instance.java.lang.CloneNotSupportedException
- If the instance cannot be cloned.public static java.lang.String getStateAsString(int state)
state
- The payment instruction state.