Class SimpleOfflineBean
- java.lang.Object
-
- com.ibm.commerce.payments.plugin.simpleoffline.beans.SimpleOfflineBean
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
COPYRIGHT
Copyright.
-
Constructor Summary
Constructors Constructor and Description SimpleOfflineBean()
The constructor of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description FinancialTransaction
approve(PluginContext pluginContext, FinancialTransaction approveTransaction, boolean retry)
This method approves an amount against a Payment Instruction.FinancialTransaction
approveAndDeposit(PluginContext pluginContext, FinancialTransaction approveAndDepositTransaction, boolean retry)
This method deposits a payment without a prior approval.boolean
checkHealth()
This method checks whether XML configuration for the Plugin is available.void
checkPaymentInstruction(PluginContext pluginContext, PaymentInstruction paymentInstruction)
This method checks if a Payment instruction has all required parameters and is syntactically correct.FinancialTransaction
credit(PluginContext pluginContext, FinancialTransaction creditTransaction, boolean retry)
This method credits the requested amount.FinancialTransaction
deposit(PluginContext pluginContext, FinancialTransaction depositTransaction, boolean retry)
This method deposits an amount against an Approved Payment.java.lang.String
getMessage(PluginContext pluginContext, java.lang.String messageKey)
This method returns the Translated error String associated to an error key.FinancialTransaction
reverseApproval(PluginContext pluginContext, FinancialTransaction reverseApprovalTransaction, boolean retry)
This method cancels a payment that has been approved with no deposits against it.FinancialTransaction
reverseCredit(PluginContext pluginContext, FinancialTransaction reverseCreditTransaction, boolean retry)
This method cancels the specified credit.FinancialTransaction
reverseDeposit(PluginContext pluginContext, FinancialTransaction reverseDepositTransaction, boolean retry)
This method cancels a deposited amount against a the specified payment.void
validatePaymentInstruction(PluginContext pluginContext, PaymentInstruction paymentInstruction)
This method refreshes the current attributes of the Payment object.
-
-
-
Field Detail
-
COPYRIGHT
public static final java.lang.String COPYRIGHT
Copyright.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMessage
public java.lang.String getMessage(PluginContext pluginContext, java.lang.String messageKey)
This method returns the Translated error String associated to an error key.
- Specified by:
getMessage
in interfacePlugin
- Parameters:
pluginContext
- includes the target locale used by the client requesting the translated message.messageKey
- represents the error for which the translated message needs to be obtained.- Returns:
- translated message
- Throws:
PluginException
- This exception is not thrown by SimpleOffline plug-in.
-
approve
public FinancialTransaction approve(PluginContext pluginContext, FinancialTransaction approveTransaction, boolean retry) throws CommunicationException, PluginException
This method approves an amount against a Payment Instruction. Approve is meant to reserve funds on the particular payment method/type. For example in credit cards this maps auth to authorization.
The SimpleOffline Plugin will do nothing and return successfully when the payment method does not keep pending status. Otherwise the SimpleOffline plugin receives the approval request and set the financial transaction in PENDING state, this state is stored in PPC tables. The approval request will be processed offline.
- Specified by:
approve
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.approveTransaction
- contains the payment instruction and the amount requested to be approvedretry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated approve financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the SimpleOfflineConstants.PAYMENT_METHOD is not included in the Payment instruction's extended dataPluginException
- Thrown when any exception conditions specified by thePluginException
hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.CommunicationException
- See Also:
Plugin.approve(PluginContext,FinancialTransaction,boolean)
-
approveAndDeposit
public FinancialTransaction approveAndDeposit(PluginContext pluginContext, FinancialTransaction approveAndDepositTransaction, boolean retry) throws FunctionNotSupportedException, PluginException
This method deposits a payment without a prior approval. Some systems call this a "sale" transaction and others an "auth with capture" transaction.
The SimpleOffline Plugin will do nothing and return successfully when payment method does not keep pending status. Otherwise the SimpleOffline plugin receives the approvalAndDeposit request and set the financial transaction in PENDING state, this state is stored in PPC tables. The approvalAndDeposit request will be processed offline.
- Specified by:
approveAndDeposit
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.approveAndDepositTransaction
- contains the amount and other payment protocol data required to process the transaction.retry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated approveAndDeposit financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the SimpleOfflineConstants.PAYMENT_METHOD is not included in the Payment instruction's extended dataPluginException
- Thrown when any exception conditions specified by thePluginException
hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.FunctionNotSupportedException
- See Also:
Plugin.approveAndDeposit(PluginContext,FinancialTransaction,boolean)
-
checkPaymentInstruction
public void checkPaymentInstruction(PluginContext pluginContext, PaymentInstruction paymentInstruction) throws InvalidPaymentInstructionException, ConfigurationException, InvalidDataException
This method checks if a Payment instruction has all required parameters and is syntactically correct.
The SimpleOffline Plugin will check the parameters defined in the Payment Method XML file.
- Specified by:
checkPaymentInstruction
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request as obtained from the deployment descriptor.paymentInstruction
- contains the Payment Method information plus any additional data require to process the payment.- Throws:
InvalidPaymentInstructionException
- thrown when the extended data do not have the required protocol data defined in the SimpleOffline configuration file or the length of the protocol data is not in the allowed rangeConfigurationException
InvalidDataException
- See Also:
Plugin.checkPaymentInstruction(PluginContext,PaymentInstruction)
-
credit
public FinancialTransaction credit(PluginContext pluginContext, FinancialTransaction creditTransaction, boolean retry) throws PluginException
This method credits the requested amount. This credit method supports both dependent and independent credits.
The SimpleOffline Plugin will do nothing and return successfully when payment method does not keep pending status. Otherwise SimpleOffline plugin receives the credit request and set the financial transaction in PENDING state, this state is stored in PPC tables. The credit transaction will be executed offline to transfer funds from the buyer to the seller. The credit can be a dependent credit or independent credit transaction.
- Specified by:
credit
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.creditTransaction
- contains the required information to process the creditretry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated credit financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the PaymentInstruction.PAYMENT_METHOD is not included in the Payment instruction's extended dataPluginException
- Thrown when any exception conditions specified by thePluginException
hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.- See Also:
Plugin.credit(PluginContext,FinancialTransaction,boolean)
-
deposit
public FinancialTransaction deposit(PluginContext pluginContext, FinancialTransaction depositTransaction, boolean retry) throws PluginException
This method deposits an amount against an Approved Payment. This is typically invoked after the merchant has shipped the goods and is now entitled to receive payment.
The SimpleOffline Plugin will do nothing and return successfully when payment method does not keep pending status. Otherwise the SimpleOffline Plugin receives the deposit request and set the financial transaction in PENDING state, this state is stored in PPC tables. The deposit transaction will be executed offline to transfer the allocated funds on the payment partially or totally from the buyer to the seller.
- Specified by:
deposit
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.depositTransaction
- contains the payment instruction and the amount requested to be approvedretry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated deposit financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the PaymentInstruction.PAYMENT_METHOD is not included in the Payment instruction's extended dataPluginException
- Thrown when any exception conditions specified by thePluginException
hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.- See Also:
Plugin.deposit(PluginContext,FinancialTransaction,boolean)
-
reverseApproval
public FinancialTransaction reverseApproval(PluginContext pluginContext, FinancialTransaction reverseApprovalTransaction, boolean retry) throws CommunicationException, PluginException
This method cancels a payment that has been approved with no deposits against it.
The SimpleOffline Plugin will do nothing and return successfully when payment method does not keep pending status. Otherwise SimpleOffline plugin receives the reverseApproval request and set the financial transaction in PENDING status, this status is stored in PPC tables. The reverseApproval transaction will be executed offline to cancel the allocation of fund on a payment already approved.
- Specified by:
reverseApproval
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.reverseApprovalTransaction
- contains the amount and other data required to process the action.retry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated reverseApproval financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the PaymentInstruction.PAYMENT_METHOD is not included in the Payment instruction's extended dataPluginException
- Thrown when any exception conditions specified by thePluginException
hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.CommunicationException
- See Also:
Plugin.reverseApproval(PluginContext,FinancialTransaction,boolean)
-
reverseCredit
public FinancialTransaction reverseCredit(PluginContext pluginContext, FinancialTransaction reverseCreditTransaction, boolean retry) throws InvalidPaymentInstructionException, FunctionNotSupportedException, InvalidDataException
This method cancels the specified credit.
The SimpleOffline Plugin will do nothing and return successfully when payment method does not keep pending status. Otherwise SimpleOffline plugin receives the reverseCredit request and set the financial transaction in PENDING state, this state is stored in PPC tables. The reverseCredit transaction will be executed offline to cancel the transfer of fund from a seller to a buyer of a credit transaction. The credit can be a dependent credit or independent credit transaction.
- Specified by:
reverseCredit
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.reverseCreditTransaction
- contains the amount and other data required to process the action.retry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated reverseCredit financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the PaymentInstruction.PAYMENT_METHOD is not included in the Payment instruction's extended dataFunctionNotSupportedException
InvalidDataException
- See Also:
Plugin.reverseCredit(PluginContext,FinancialTransaction,boolean)
-
reverseDeposit
public FinancialTransaction reverseDeposit(PluginContext pluginContext, FinancialTransaction reverseDepositTransaction, boolean retry) throws FunctionNotSupportedException, PluginException
This method cancels a deposited amount against a the specified payment.
The SimpleOffline Plugin will do nothing and return successfully when payment method does not keep pending status. Otherwise the SimpleOffline plugin receives the reverseDeposit request and set the financial transaction in PENDING state, this state is stored in PPC tables. The reverseDeposit transaction will be executed offline to cancel the transfer of fund of a deposit transaction.
- Specified by:
reverseDeposit
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request which are obtained from the deployment descriptor.reverseDepositTransaction
- contains the amount and other data required to process the action.retry
- indicates this is a retry of the operation- Returns:
- A
FinancialTransaction
that represents the updated reverseDeposit financial transaction. - Throws:
InvalidPaymentInstructionException
- thrown when the PaymentInstruction.PAYMENT_METHOD is not included in the Payment instruction's extended dataPluginException
- Thrown when any exception conditions specified by thePluginException
hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.FunctionNotSupportedException
- See Also:
Plugin.reverseDeposit(PluginContext,FinancialTransaction,boolean)
-
validatePaymentInstruction
public void validatePaymentInstruction(PluginContext pluginContext, PaymentInstruction paymentInstruction) throws InvalidPaymentInstructionException, FunctionNotSupportedException
This method refreshes the current attributes of the Payment object. The plugin controller provides a fully populated Payment object. The plugin determines which attributes have changed and updates those attributes on the returned object.The SimpleOffline Plugin does not support this API.
- Specified by:
validatePaymentInstruction
in interfacePlugin
- Parameters:
pluginContext
- contains all the information needed by a plugin to process the request as obtained from the deployment descriptor.paymentInstruction
- contains all the information needed by a plugin to query the payment- Throws:
FunctionNotSupportedException
- always throws this exception since the SimpleOffline Plugin does not support this API.InvalidPaymentInstructionException
- See Also:
Plugin.validatePaymentInstruction(com.ibm.commerce.payments.plugin.PluginContext,com.ibm.commerce.payments.plugin.PaymentInstruction)
-
checkHealth
public boolean checkHealth()
This method checks whether XML configuration for the Plugin is available. For the SimpleOffline, if the XML file is missing, or renamed, or its content is invalid, then false is returned; otherwise true is returned. And for other Plugin, always true is returned since no corresponding XML configuration file exists.
This API is used by PluginFactory in accelerator. When false is returned, PluginFacotry will not put this plugin into the available collection. And further it will not be listed in the available payment methods in accelerator.
- Specified by:
checkHealth
in interfacePlugin
- Returns:
- A
boolean
that is true if the plugin has been configured correctly and false otherwise. A plugin is configured correctly if there is an XML configuration file defined.
-
-