java.lang.Object
com.broadleafcommerce.vendor.chasepayment.service.support.ChaseIdGenerator

public class ChaseIdGenerator extends Object
Utility to generate Orbital and HPS compliant Order ID values.
  • Constructor Details

    • ChaseIdGenerator

      public ChaseIdGenerator()
  • Method Details

    • generateRandomOrderIdForHPS

      public String generateRandomOrderIdForHPS()

      Generate a random unique Order ID value that complies with the requirements of HPS.

      At a high level, HPS requirements generally state the following:

      • First 8 characters should be unique for each transaction
      • Max length 22
      • Valid characters include 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '0123456789', '-', '$', '@', and a space character, though the space character cannot be the leading character

      However, there are edge cases outlined (ex: PINless Debit can't use special characters). Thus, in the interest of simplicity, we conservatively only use alphanumeric characters in the output. This should still produce sufficiently random output.

      Returns:
      a unique value that satisfies the format requirements of HPS
    • getHPSOrderIdAllowedCharacters

      protected char[] getHPSOrderIdAllowedCharacters()
    • generateRandomOrderIdForOrbital

      public String generateRandomOrderIdForOrbital()

      Generate a random unique Order ID value that complies with the requirements of the Orbital API.

      At a high level, Orbital requirements generally state the following:

      • First 8 characters should be unique for each transaction
      • Max length 22
      • Valid characters include 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '0123456789', '-', '$', '@', '&' and a space character, though the space character cannot be the leading character

      However, there are edge cases outlined (ex: PINless Debit can't use special characters, ampersand must be encoded, ampersand cannot be double-used, order ID must have special format if it is used as the default for another field, etc). Thus, in the interest of simplicity, we conservatively only use alphanumeric characters in the output. This should still produce sufficiently random output.

      Returns:
      a unique value that satisfies the format requirements of the Orbital API
    • getOrbitalOrderIdAllowedCharacters

      protected char[] getOrbitalOrderIdAllowedCharacters()
    • generateRandomRetryTraceNumberForOrbital

      public String generateRandomRetryTraceNumberForOrbital()

      Generate a random unique retry trace number value that complies with the requirements of the Orbital API.

      Orbital's only documented requirement is that the retry trace number has a max length of 16 and is exclusively numeric.

      Returns:
      a unique value that satisfies the format requirements of the Orbital API
    • getOrbitalRetryTraceNumberAllowedCharacters

      protected char[] getOrbitalRetryTraceNumberAllowedCharacters()
    • generateRandomPONumberForOrbital

      public String generateRandomPONumberForOrbital()

      Generate a random unique PO value that complies with the requirements of the Orbital API.

      Orbital's only documented requirement is that the PO number has a max length of 17 and is alphanumeric.

      Returns:
      a unique value that satisfies the format requirements of the Orbital API
    • getOrbitalPONumberAllowedCharacters

      protected char[] getOrbitalPONumberAllowedCharacters()