com.ibm.commerce.payments.plugin.simpleoffline.beans

Class SimpleOfflineBean

  • java.lang.Object
    • com.ibm.commerce.payments.plugin.simpleoffline.beans.SimpleOfflineBean
  • All Implemented Interfaces:
    Plugin


    public class SimpleOfflineBean
    extends java.lang.Object
    implements Plugin
    • Field Detail

    • Constructor Detail

      • SimpleOfflineBean

        public SimpleOfflineBean()
        The constructor of this class.
    • 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 interface Plugin
        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 interface Plugin
        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 approved
        retry - 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 data
        PluginException - Thrown when any exception conditions specified by the PluginException 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 interface Plugin
        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 data
        PluginException - Thrown when any exception conditions specified by the PluginException hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.
        FunctionNotSupportedException
        See Also:
        Plugin.approveAndDeposit(PluginContext,FinancialTransaction,boolean)
      • 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 interface Plugin
        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 credit
        retry - 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 data
        PluginException - Thrown when any exception conditions specified by the PluginException 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 interface Plugin
        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 approved
        retry - 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 data
        PluginException - Thrown when any exception conditions specified by the PluginException 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 interface Plugin
        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 data
        PluginException - Thrown when any exception conditions specified by the PluginException hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.
        CommunicationException
        See Also:
        Plugin.reverseApproval(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 interface Plugin
        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 data
        PluginException - Thrown when any exception conditions specified by the PluginException hierarchy are met; for more details, read the plug-in exceptions hierarchy Javadocs.
        FunctionNotSupportedException
        See Also:
        Plugin.reverseDeposit(PluginContext,FinancialTransaction,boolean)
      • 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 interface Plugin
        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.