com.ibm.commerce.payments.plugin.punchout.impl

Class AbstractPunchoutPaymentPluginImpl

  • java.lang.Object
    • com.ibm.commerce.payments.plugin.punchout.impl.AbstractPunchoutPaymentPluginImpl


  • public class AbstractPunchoutPaymentPluginImpl
    extends java.lang.Object
    • Constructor Detail

      • AbstractPunchoutPaymentPluginImpl

        public AbstractPunchoutPaymentPluginImpl()
    • Method Detail

      • getMessage

        public java.lang.String getMessage(PluginContext pluginContext,
                                           java.lang.String messageKey)
        This method is used to return the translated error string associated to an error key. But this implementation only returns the message key.
        Parameters:
        pluginContext -
        messageKey -
        Returns:
        String
        Throws:
        PluginException
      • approve

        public FinancialTransaction approve(PluginContext pluginContext,
                                            FinancialTransaction financialTransaction,
                                            boolean retry)
                                     throws CommunicationException,
                                            PluginException

        This method executes payment authorization via communicating with the system of payment service provider.

        Because the punch-out payment is totally processed in the website of payment service provider. And then the system of payment service provider will call-back to Commerce application to update the order and payment status. Implementation of this API does nothing except for setting payment status as PENDING in Commerce application. It would leave the call-back interaction update the PENDING payment status to SUCCESS or FAILURE. Usually when you implement your own punch-out payment plug-in, you need not to override this method while just respect current implementation.

        Parameters:
        pluginContext - contains the payment method information plus any additional data required to process the payment.
        financialTransaction - 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 authorization financial transaction.
        Throws:
        PluginException - thrown when encounter problems.
        CommunicationException
      • approveAndDeposit

        public FinancialTransaction approveAndDeposit(PluginContext pluginContext,
                                                      FinancialTransaction financialTransaction,
                                                      boolean retry)
                                               throws FunctionNotSupportedException,
                                                      PluginException

        This method executes payment authorization and capture via communicating with the system of payment service provider in one transaction.

        Because the punch-out payment is totally processed in the website of payment service provider. And then the system of payment service provider will call-back to Commerce application to update the order and payment status. Implementation of this API does nothing except setting payment status on commerce side as PENDING . It would leave the call-back interaction update the PENDING payment status to SUCCESS or FAILURE. Usually when you implement your own punch-out payment plug-in, you need not to override this method while just respect current implementation.

        Parameters:
        pluginContext - contains the payment method information plus any additional data required to process the payment.
        financialTransaction - 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 authorization with capture financial transaction.
        Throws:
        PluginException - contains the payment method information plus any additional data required to process the payment.
        FunctionNotSupportedException
      • checkHealth

        public boolean checkHealth()
        This method always returns true.
        Returns:
        boolean
      • initAuthenticationSession

        public void initAuthenticationSession(PluginContext pluginContext,
                                              PaymentInstruction paymentInstruction)
                                       throws CommunicationException,
                                              InvalidDataException

        This method executes pre-authentication operation with payment service provider and gets some pre-authentication data. For example, some payment service providers need to execute this pre-authentication operation to generate a token and return to e-Commerce application. The token will be as the unique identifier in the whole life cycle of the payment.

        Whether the pre-authentication is needed in the payment processing can be configured in payment plug-in descriptor.

        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:
        PluginException - thrown when the payment instruction is expired.
        CommunicationException
        InvalidDataException
      • getAuthenticationURL

        public java.lang.String getAuthenticationURL(PluginContext pluginContext,
                                                     PaymentInstruction paymentInstruction)
                                              throws PluginException

        In punch-out payment flow, shopper would be routed to payment service provider website to input payment information. This method is to build the URL of the website of third party payment service provider.

        Parameters:
        pluginContext - contains all the information needed by a payment plug-in to process the request as obtained from the deployment descriptor.
        paymentInstruction - contains the payment method information plus any additional data which is required to process the payment.
        Returns:
        the URL of the website of the third party payment service provider.
        Throws:
        PluginException - thrown when any exception conditions specified by the PluginException hierarchy are met; for more details, please refer to the plug-in exceptions hierarchy Javadocs.
      • preprocessProviderResponseData

        public java.lang.String preprocessProviderResponseData(PluginContext pluginContext,
                                                               java.util.Map callbackParameters)
                                                        throws PluginException

        This method pre-processes the response from the punch-out payment service provider. Usually, when shopper inputs payment information and complete payment in payment service provider website, the payment system will call back to Commerce via URL requests. Then order and payment status can be updated in Commerce application. This method is used to parse URL requests to make it readable by the command updating order and payment status.

        Parameters:
        pluginContext - contains all of the context information needed by a payment plug-in to process the request as obtained from the deployment descriptor.
        callbackParameters - the parameters in callback request.
        Returns:
        ID of the payment instruction, which is used to identify which payment in Commerce is to be processed by this request.
        Throws:
        PluginException - thrown when exceptional situation happens in the payment plug-in.
      • processProviderResponse

        public java.util.Map processProviderResponse(PluginContext pluginContext,
                                                     PaymentInstruction paymentInstruction,
                                                     java.util.Map callbackParameters)
                                              throws PluginException

        This method processes payment transaction response from punch-out payment service provider side. After the preprocessProviderResponseData parses the URL requests from punch-out payment service provider side and make it readable by Commerce command. This API would be called to communicate with the punch-out payment system to verify whether it is a real and valid request from it.

        Parameters:
        pluginContext - contains all of the context information needed by a payment plug-in to process the request as obtained from the deployment descriptor.
        paymentInstruction - the PaymentInstruction container with the basic information and protocol data of the payment method
        callbackParameters - the parameters in callback request
        Returns:
        The response of payment transaction process; null if the value cannot be retrieved.
        Throws:
        PluginException - thrown when exceptional situation happens in the payment plug-in.