com.ibm.commerce.payments.plugin.punchout.util

Class PunchoutConfigurationParser

  • java.lang.Object
    • com.ibm.commerce.payments.plugin.punchout.util.PunchoutConfigurationParser


  • public class PunchoutConfigurationParser
    extends java.lang.Object
    This utility provides the function to parse PluginDeployment.xml for punch-out payment plug-in. The special properties for punch-out payment plug-in can be easily located via this utility.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String AUTHENTICATION_BASE_URL
      The key in PluginDeployment.xml to stand for authentication base URL.
      static java.lang.String AUTHENTICATION_PARAMETERS
      The key in PluginDeployment.xml to stand for URL parameters of HTTP request sent by getAuthenticationURL(PluginContext, PaymentInstruction).
      static java.lang.String AUTHENTICATION_REQUEST_STYLE
      The key in PluginDeployment.xml to stand for authentication request style.
      static java.lang.String AUTHENTICATION_SESSION_NEEDED
      The key in PluginDeployment.xml to stand for whether needs authentication session or not.
      static java.lang.String CHARSET
      The key in PluginDeployment.xml to stand for charset.
      static java.lang.String CHARSET_UTF8
      A value for charset property means UTF-8 charset.
      static java.lang.String COPYRIGHT
      The IBM copyright notice field.
      static java.lang.String ENCODING_METHOD
      The key in PluginDeployment.xml to stand for encoding method.
      static java.lang.String ENCODING_METHOD_NONE
      A value for encodingMethod property means no need to encode.
      static java.lang.String ENCODING_METHOD_URL
      A value for encodingMethod property means URL encoding.
      static java.lang.String ENCODING_PARAMETERS
      The key in PluginDeployment.xml to stand for URL parameters needed to be encoded when building URL parameters.
      static java.lang.String ENCRYPTION_METHOD
      The key in PluginDeployment.xml to stand for encryption method.
      static java.lang.String ENCRYPTION_METHOD_MD5
      A value for encryptionMethod property means MD5 encryption.
      static java.lang.String ENCRYPTION_METHOD_NONE
      A value for encryptionMethod property means no need to encrypt.
      static java.lang.String ENCRYPTION_PARAMETERS
      The key in PluginDeployment.xml to stand for URL parameters needed to be encrypted when building URL parameters.
      static java.lang.String EXPIRED_TIME
      The key in PluginDeployment.xml to stand for payment expired time.
      static java.lang.String EXPIRED_TIME_DEFAULT
      A value for expiredTime property means default value 2 hours.
      static java.lang.String INITIALIZATION_BASE_URL
      The key in PluginDeployment.xml to stand for initialization base URL.
      static java.lang.String INITIALIZATION_PARAMETERS
      The key in PluginDeployment.xml standing for URL parameters of HTTP(s) request sent by initAuthenticationSession(PluginContext, PaymentInstruction).
      static java.lang.String INITIALIZATION_REQUEST_STYLE
      The key in PluginDeployment.xml to stand for initialization request style.
      static int MILLSECOND_IN_ONE_SECOND
      Millsecond in one second.
      static java.lang.String PI_ID_KEY
      The key in PluginDeployment.xml to stand for payment instruction id key value.
      static java.lang.String REQUEST_STYLE_GET
      A value for initializationRequestStyle or authenticationRequestStyle property means GET style request.
      static java.lang.String REQUEST_STYLE_POST
      A value for initializationRequestStyle or authenticationRequestStyle property means POST style request.
      static java.lang.String TIMEOUT
      The key in PluginDeployment.xml to stand for connection timeout.
      static java.lang.String TIMEOUT_DEFAULT
      A value for timeout property means default value 20 seconds.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String getAuthenticationBaseURL(java.util.Map properties)
      Get authenticationBaseURL value from PluginDeployment.xml.
      static java.util.Set getAuthenticationParameters(java.util.Map properties)
      Get authenticationParams value as a set from PluginDeployment.xml.
      static java.lang.String getAuthenticationRequestStyle(java.util.Map properties)
      Get authenticationRequestStyle value from PluginDeployment.xml.
      static java.lang.String getCharset(java.util.Map properties)
      Get charset value from PluginDeployment.xml.
      static java.lang.String getEncodingMethod(java.util.Map properties)
      Get encodingMethod value from PluginDeployment.xml.
      static java.util.Set getEncodingParameters(java.util.Map properties)
      Get encodingParams value as a set from PluginDeployment.xml.
      static java.lang.String getEncryptionMethod(java.util.Map properties)
      Get encryptionMethod value from PluginDeployment.xml
      static java.util.Set getEncryptionParameters(java.util.Map properties)
      Get encryptionParams value as a set from PluginDeployment.xml.
      static int getExpiredTime(java.util.Map properties)
      Get expiredTime value from PluginDeployment.xml.
      static java.util.Map getGroupProperties(java.lang.String groupName, java.util.Map properties)
      This method returns the name-value pairs, where names are configured in PluginDeployment.xml separated by comma.
      static java.lang.String getInitializationBaseURL(java.util.Map properties)
      Get initializationBaseURL value from PluginDeployment.xml.
      static java.util.Set getInitializationParameters(java.util.Map properties)
      Get initializationParams value as a set from PluginDeployment.xml.
      static java.lang.String getInitializationRequestStyle(java.util.Map properties)
      Get initializationRequestStyle value from PluginDeployment.xml.
      static java.lang.String getPIIdKey(java.util.Map properties)
      Get payment instruction id key value from PluginDeployment.xml.
      static java.util.Set getPropertyValueSet(java.lang.String propertyName, java.util.Map properties)
      This method parses the value separated by comma and set them to a Set object.
      static int getTimeout(java.util.Map properties)
      Get timeout value from PluginDeployment.xml.
      static boolean isAuthenticationSessionNeeded(java.util.Map properties)
      Get authenticationSessionNeeded value from PluginDeployment.xml.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        The IBM copyright notice field.
        See Also:
        Constant Field Values
      • EXPIRED_TIME

        public static final java.lang.String EXPIRED_TIME
        The key in PluginDeployment.xml to stand for payment expired time.
        See Also:
        Constant Field Values
      • EXPIRED_TIME_DEFAULT

        public static final java.lang.String EXPIRED_TIME_DEFAULT
        A value for expiredTime property means default value 2 hours.
        See Also:
        TIMEOUT, Constant Field Values
      • TIMEOUT

        public static final java.lang.String TIMEOUT
        The key in PluginDeployment.xml to stand for connection timeout.
        See Also:
        Constant Field Values
      • TIMEOUT_DEFAULT

        public static final java.lang.String TIMEOUT_DEFAULT
        A value for timeout property means default value 20 seconds.
        See Also:
        TIMEOUT, Constant Field Values
      • MILLSECOND_IN_ONE_SECOND

        public static final int MILLSECOND_IN_ONE_SECOND
        Millsecond in one second.
        See Also:
        Constant Field Values
      • CHARSET

        public static final java.lang.String CHARSET
        The key in PluginDeployment.xml to stand for charset.
        See Also:
        Constant Field Values
      • CHARSET_UTF8

        public static final java.lang.String CHARSET_UTF8
        A value for charset property means UTF-8 charset.
        See Also:
        CHARSET, Constant Field Values
      • PI_ID_KEY

        public static final java.lang.String PI_ID_KEY
        The key in PluginDeployment.xml to stand for payment instruction id key value.
        See Also:
        Constant Field Values
      • ENCODING_METHOD

        public static final java.lang.String ENCODING_METHOD
        The key in PluginDeployment.xml to stand for encoding method.
        See Also:
        Constant Field Values
      • ENCODING_METHOD_NONE

        public static final java.lang.String ENCODING_METHOD_NONE
        A value for encodingMethod property means no need to encode.
        See Also:
        ENCODING_METHOD, Constant Field Values
      • ENCODING_METHOD_URL

        public static final java.lang.String ENCODING_METHOD_URL
        A value for encodingMethod property means URL encoding.
        See Also:
        ENCODING_METHOD, Constant Field Values
      • ENCODING_PARAMETERS

        public static final java.lang.String ENCODING_PARAMETERS
        The key in PluginDeployment.xml to stand for URL parameters needed to be encoded when building URL parameters.
        See Also:
        AbstractPunchoutPaymentPluginImpl#encode(String, Map), getGroupProperties(String, Map), Constant Field Values
      • ENCRYPTION_METHOD

        public static final java.lang.String ENCRYPTION_METHOD
        The key in PluginDeployment.xml to stand for encryption method.
        See Also:
        Constant Field Values
      • ENCRYPTION_METHOD_NONE

        public static final java.lang.String ENCRYPTION_METHOD_NONE
        A value for encryptionMethod property means no need to encrypt.
        See Also:
        ENCRYPTION_METHOD, Constant Field Values
      • ENCRYPTION_METHOD_MD5

        public static final java.lang.String ENCRYPTION_METHOD_MD5
        A value for encryptionMethod property means MD5 encryption.
        See Also:
        ENCRYPTION_METHOD, Constant Field Values
      • ENCRYPTION_PARAMETERS

        public static final java.lang.String ENCRYPTION_PARAMETERS
        The key in PluginDeployment.xml to stand for URL parameters needed to be encrypted when building URL parameters.
        See Also:
        AbstractPunchoutPaymentPluginImpl#encrypt(String, Map), getGroupProperties(String, Map), Constant Field Values
      • AUTHENTICATION_SESSION_NEEDED

        public static final java.lang.String AUTHENTICATION_SESSION_NEEDED
        The key in PluginDeployment.xml to stand for whether needs authentication session or not.
        See Also:
        Constant Field Values
      • INITIALIZATION_REQUEST_STYLE

        public static final java.lang.String INITIALIZATION_REQUEST_STYLE
        The key in PluginDeployment.xml to stand for initialization request style.
        See Also:
        Constant Field Values
      • INITIALIZATION_BASE_URL

        public static final java.lang.String INITIALIZATION_BASE_URL
        The key in PluginDeployment.xml to stand for initialization base URL.
        See Also:
        Constant Field Values
      • INITIALIZATION_PARAMETERS

        public static final java.lang.String INITIALIZATION_PARAMETERS
        The key in PluginDeployment.xml standing for URL parameters of HTTP(s) request sent by initAuthenticationSession(PluginContext, PaymentInstruction). It should just contain parameters attached to URL, while not contain other properties that may be used in this method.
        See Also:
        AbstractPunchoutPaymentPluginImpl#initAuthenticationSession(PluginContext, PaymentInstruction), getGroupProperties(String, Map), Constant Field Values
      • AUTHENTICATION_REQUEST_STYLE

        public static final java.lang.String AUTHENTICATION_REQUEST_STYLE
        The key in PluginDeployment.xml to stand for authentication request style.
        See Also:
        Constant Field Values
      • AUTHENTICATION_BASE_URL

        public static final java.lang.String AUTHENTICATION_BASE_URL
        The key in PluginDeployment.xml to stand for authentication base URL.
        See Also:
        Constant Field Values
      • AUTHENTICATION_PARAMETERS

        public static final java.lang.String AUTHENTICATION_PARAMETERS
        The key in PluginDeployment.xml to stand for URL parameters of HTTP request sent by getAuthenticationURL(PluginContext, PaymentInstruction). It should just contains parameters attached to URL, not contains other properties that may be used in this method.
        See Also:
        AbstractPunchoutPaymentPluginImpl#getAuthenticationURL(PluginContext, PaymentInstruction), getGroupProperties(String, Map), Constant Field Values
    • Method Detail

      • getPropertyValueSet

        public static java.util.Set getPropertyValueSet(java.lang.String propertyName,
                                                        java.util.Map properties)
        This method parses the value separated by comma and set them to a Set object.
        Parameters:
        propertyName - property name.
        properties - all properties.
        Returns:
        A Set object with all String objects separated by comma.
      • getGroupProperties

        public static java.util.Map getGroupProperties(java.lang.String groupName,
                                                       java.util.Map properties)
        This method returns the name-value pairs, where names are configured in PluginDeployment.xml separated by comma. The corresponding element name is the group name here. The value of each element is retrieved from the properties passed in with the same name. The following is an example of PluginDeployment.xml:
         <PluginProperty name="property1" value="value1"/>
         <PluginProperty name="property2" value="value2"/>
         <PluginProperty name="group1" value="property1,property3"/>
         <PluginProperty name="group2" value="property4"/>
         
        It defines two group properties. One is group1 which contains two property keys, property1 and property3. The property1 is defined in this file but property3 may come from other places. Another group property, group2, has only one property key, property4. The property2 does not belong to any group.

        This method calls getPropertyValueAsSet(String, Map) to get property names, then try to find the values in argument properties.

        Parameters:
        groupName - group property name
        properties - all properties
        Returns:
        the name-value pairs, where names are configured in PluginDeployment.xml separated by comma
        See Also:
        getPropertyValueSet(String, Map)
      • getExpiredTime

        public static int getExpiredTime(java.util.Map properties)
        Get expiredTime value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        expiredTime value
        See Also:
        EXPIRED_TIME
      • getTimeout

        public static int getTimeout(java.util.Map properties)
        Get timeout value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        timeout value
        See Also:
        TIMEOUT
      • getCharset

        public static java.lang.String getCharset(java.util.Map properties)
        Get charset value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        charset value
        See Also:
        CHARSET
      • getPIIdKey

        public static java.lang.String getPIIdKey(java.util.Map properties)
        Get payment instruction id key value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        payment instruction id key value
        See Also:
        PI_ID_KEY
      • getEncodingMethod

        public static java.lang.String getEncodingMethod(java.util.Map properties)
        Get encodingMethod value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        encodingMethod value
        See Also:
        ENCODING_METHOD
      • getEncodingParameters

        public static java.util.Set getEncodingParameters(java.util.Map properties)
        Get encodingParams value as a set from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        encoding parameters set
        See Also:
        ENCODING_PARAMETERS
      • getEncryptionMethod

        public static java.lang.String getEncryptionMethod(java.util.Map properties)
        Get encryptionMethod value from PluginDeployment.xml
        Parameters:
        properties - all properties
        Returns:
        encryptionMethod value
        See Also:
        ENCRYPTION_METHOD
      • getEncryptionParameters

        public static java.util.Set getEncryptionParameters(java.util.Map properties)
        Get encryptionParams value as a set from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        encryption parameters set
        See Also:
        ENCRYPTION_PARAMETERS
      • isAuthenticationSessionNeeded

        public static boolean isAuthenticationSessionNeeded(java.util.Map properties)
        Get authenticationSessionNeeded value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        authenticationSessionNeeded value
        See Also:
        AUTHENTICATION_SESSION_NEEDED
      • getInitializationRequestStyle

        public static java.lang.String getInitializationRequestStyle(java.util.Map properties)
        Get initializationRequestStyle value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        initializationRequestStyle value
        See Also:
        INITIALIZATION_REQUEST_STYLE
      • getInitializationBaseURL

        public static java.lang.String getInitializationBaseURL(java.util.Map properties)
        Get initializationBaseURL value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        initializationBaseURL value
        See Also:
        INITIALIZATION_BASE_URL
      • getInitializationParameters

        public static java.util.Set getInitializationParameters(java.util.Map properties)
        Get initializationParams value as a set from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        initialization request parameters
        See Also:
        INITIALIZATION_PARAMETERS
      • getAuthenticationRequestStyle

        public static java.lang.String getAuthenticationRequestStyle(java.util.Map properties)
        Get authenticationRequestStyle value from PluginDeployment.xml. By default it is Get.
        Parameters:
        properties - all properties
        Returns:
        authenticationRequestStyle value
        See Also:
        AUTHENTICATION_REQUEST_STYLE
      • getAuthenticationBaseURL

        public static java.lang.String getAuthenticationBaseURL(java.util.Map properties)
        Get authenticationBaseURL value from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        authenticationBaseURL value
        See Also:
        AUTHENTICATION_BASE_URL
      • getAuthenticationParameters

        public static java.util.Set getAuthenticationParameters(java.util.Map properties)
        Get authenticationParams value as a set from PluginDeployment.xml.
        Parameters:
        properties - all properties
        Returns:
        authentication request parameters
        See Also:
        AUTHENTICATION_PARAMETERS