Class coreutil

Classes

class TLVParser
class Validator

Static Public Member Functions

static Validator validateFields (CoreSale request)
static CoreSaleTrack retrieveTrackFromCoreSale (CoreSale coreSale)
static CoreSaleTrackContactless retrieveTrackContactlessFromCoreSale (CoreSale coreSale)
static CoreSaleEmv retrieveEmvFromCoreSale (CoreSale coreSale)
static CoreSaleKeyed retrieveKeyedFromCoreSale (CoreSale coreSale)
static String cardTypeBasedOnAid (String aid)
static String cardTypeBasedOnBin (String maskedPan)
static Object checkIfEnumExists (Object type, String str)
static String getVersionBasedOnBrand (String cardType)
static String getCurrentDateTime ()
static String toHexString (byte[] b)
static String toHexString (byte[] b, int length)
static void createTLV (CoreEmvTag tag, StringBuilder tlvString, ArrayList< String > tagLists)
static String convertToTLV (CoreSaleResponse coreSaleResponse, boolean tapCard)
static boolean listContainsTag (String tag, List< String > listOfTags)
static String addUpAllAmounts (CoreSale coreSale, Currency currency)
static double calcTax (final BigDecimal percent, final BigDecimal amount, Currency currency)
static double calcTip (final BigDecimal originalAmount, final BigDecimal tipNumber, String tipType, Currency currency)
static String appendTLV (String tlvString, String tag, String value)
static String tlvFromApplicationID (String applicationID, String version)
static String contactlessTlvFromApplicationID (String applicationID)
static boolean isNullOrEmpty (String string)
static void appendParam (StringBuilder url, StringBuilder hashString, String name, String value)
static String maskCardNumber (String cardNumber, String mask)
static String convertAsciiToHex (String ascii)
static String fromHexString (String hex)
static String generateSha256 (String hashString)
static byte [] hexStringToByteArray (String tagData)
static byte [] toByteArray (List< Byte > in)
static CoreEmvTag returnTag (String desiredHexTag, List< CoreEmvTag > emvTagList)
static String returnMaskedCurrencyCode (String currencyCode, int desiredSize)

Static Public Attributes

static String [] customBinRanges
static final String CUSTOMDEBITBINRANGES = “regionalDebitBinRanges”

Static Protected Attributes

static final String LINX = “LINX”
static final String NCBDEBIT = “NCB DEBIT”
static final String JETSDEBIT = “JETS DEBIT”

Detailed Description

This class contains util methods

Member Function Documentation

addUpAllAmounts()

    • static String com.payments.core.CoreUtil.addUpAllAmounts
    • (
    • CoreSale
    • coreSale,

    • )

  • inlinestatic

appendParam()

    • static void com.payments.core.CoreUtil.appendParam
    • (
    • StringBuilder
    • url,

    • StringBuilder
    • hashString,

    • String
    • name,

    • String
    • value

    • )

  • inlinestatic

appendTLV()

    • static String com.payments.core.CoreUtil.appendTLV
    • (
    • String
    • tlvString,

    • String
    • tag,

    • String
    • value

    • )

  • inlinestatic

calcTax()

    • static double com.payments.core.CoreUtil.calcTax
    • (
    • final BigDecimal
    • percent,

    • final BigDecimal
    • amount,

    • )

  • inlinestatic

Calculates tax

calcTip()

    • static double com.payments.core.CoreUtil.calcTip
    • (
    • final BigDecimal
    • originalAmount,

    • final BigDecimal
    • tipNumber,

    • String
    • tipType,

    • )

  • inlinestatic

Calculates tip

cardTypeBasedOnAid()

    • static String com.payments.core.CoreUtil.cardTypeBasedOnAid
    • (
    • String
    • aid
    • )

  • inlinestatic

Returns card type based on bin

Parameters

  • aid,of
  • the card

cardTypeBasedOnBin()

    • static String com.payments.core.CoreUtil.cardTypeBasedOnBin
    • (
    • String
    • maskedPan
    • )

  • inlinestatic

Return card type based on bin

Parameters

  • maskedPan,first
  • 6 digits of bin

checkIfEnumExists()

    • static Object com.payments.core.CoreUtil.checkIfEnumExists
    • (
    • Object
    • type,

    • String
    • str

    • )

  • inlinestatic

contactlessTlvFromApplicationID()

    • static String com.payments.core.CoreUtil.contactlessTlvFromApplicationID
    • (
    • String
    • applicationID
    • )

  • inlinestatic

convertAsciiToHex()

    • static String com.payments.core.CoreUtil.convertAsciiToHex
    • (
    • String
    • ascii
    • )

  • inlinestatic

Converts ascii to hex

Parameters

  • ascii
  • used for conversion

convertToTLV()

    • static String com.payments.core.CoreUtil.convertToTLV
    • (
    • CoreSaleResponse
    • coreSaleResponse,

    • boolean
    • tapCard

    • )

  • inlinestatic

createTLV()

    • static void com.payments.core.CoreUtil.createTLV
    • (
    • CoreEmvTag
    • tag,

    • StringBuilder
    • tlvString,

    • ArrayList< String >
    • tagLists

    • )

  • inlinestatic

fromHexString()

    • static String com.payments.core.CoreUtil.fromHexString
    • (
    • String
    • hex
    • )

  • inlinestatic

Converts hex to string

Parameters

  • hex
  • used for conversion

generateSha256()

    • static String com.payments.core.CoreUtil.generateSha256
    • (
    • String
    • hashString
    • )

  • inlinestatic

getCurrentDateTime()

    • static String com.payments.core.CoreUtil.getCurrentDateTime
    • (
    • )

  • inlinestatic

getVersionBasedOnBrand()

    • static String com.payments.core.CoreUtil.getVersionBasedOnBrand
    • (
    • String
    • cardType
    • )

  • inlinestatic

hexStringToByteArray()

    • static byte [] com.payments.core.CoreUtil.hexStringToByteArray
    • (
    • String
    • tagData
    • )

  • inlinestatic

Converts hex string to byte array

Parameters

  • tagData
  • used for conversion

isNullOrEmpty()

    • static boolean com.payments.core.CoreUtil.isNullOrEmpty
    • (
    • String
    • string
    • )

  • inlinestatic

Utility method to test if a string is either null or empty.

Parameters

  • string
  • the string to be tested

Returns

true if the string is null or empty

listContainsTag()

    • static boolean com.payments.core.CoreUtil.listContainsTag
    • (
    • String
    • tag,

    • List< String >
    • listOfTags

    • )

  • inlinestatic

maskCardNumber()

    • static String com.payments.core.CoreUtil.maskCardNumber
    • (
    • String
    • cardNumber,

    • String
    • mask

    • )

  • inlinestatic

Applies the specified mask to the card number.

Parameters

  • cardNumber
  • The card number in plain format

  • mask
  • The number mask pattern.Use # to include a digit from the card number at that position, use x to skip the digit at that position

Returns

The masked card number

retrieveEmvFromCoreSale()

  • inlinestatic

retrieveKeyedFromCoreSale()

  • inlinestatic

retrieveTrackContactlessFromCoreSale()

retrieveTrackFromCoreSale()

  • inlinestatic

returnMaskedCurrencyCode()

    • static String com.payments.core.CoreUtil.returnMaskedCurrencyCode
    • (
    • String
    • currencyCode,

    • int
    • desiredSize

    • )

  • inlinestatic

returnTag()

    • static CoreEmvTag com.payments.core.CoreUtil.returnTag
    • (
    • String
    • desiredHexTag,

    • )

  • inlinestatic

tlvFromApplicationID()

    • static String com.payments.core.CoreUtil.tlvFromApplicationID
    • (
    • String
    • applicationID,

    • String
    • version

    • )

  • inlinestatic

toByteArray()

    • static byte [] com.payments.core.CoreUtil.toByteArray
    • (
    • List< Byte >
    • in
    • )

  • inlinestatic

toHexString() [1/2]

    • static String com.payments.core.CoreUtil.toHexString
    • (
    • byte []
    • b
    • )

  • inlinestatic

toHexString() [2/2]

    • static String com.payments.core.CoreUtil.toHexString
    • (
    • byte []
    • b,

    • int
    • length

    • )

  • inlinestatic

validateFields()

    • static Validator com.payments.core.CoreUtil.validateFields
    • (
    • CoreSale
    • request
    • )

  • inlinestatic

Member Data Documentation

CUSTOMDEBITBINRANGES

    • final String com.payments.core.CoreUtil.CUSTOMDEBITBINRANGES = “regionalDebitBinRanges”

  • static

customBinRanges

    • String [] com.payments.core.CoreUtil.customBinRanges

  • static

JETSDEBIT

    • final String com.payments.core.CoreUtil.JETSDEBIT = “JETS DEBIT”

  • staticprotected

LINX

    • final String com.payments.core.CoreUtil.LINX = “LINX”

  • staticprotected

NCBDEBIT

    • final String com.payments.core.CoreUtil.NCBDEBIT = “NCB DEBIT”

  • staticprotected