Class ChipDnaMobileUtils


  • public class ChipDnaMobileUtils
    extends java.lang.Object
    This class contains utility methods that may be needed to integrate with the SDK.
    Author:
    Creditcall Ltd
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static android.graphics.Bitmap getBitmapFromPngString​(java.lang.String pngString)  
      static java.lang.String getErrorsString​(java.util.ArrayList<com.creditcall.chipdnamobile.AbstractChipDnaMobileErrorCode> errorCodes)  
      static java.lang.String getSignaturePngStringFromBitmap​(android.graphics.Bitmap signatureImage)  
      static boolean isUsbMiuraDevice​(android.hardware.usb.UsbDevice device)
      Check if UsbDevice is a Miura PIN pad
      static boolean isValidAmount​(java.lang.String amount)
      Check whether an amount has a valid format.
      static boolean isValidApiKey​(java.lang.String theApiKey)
      Check whether the Api Key has a valid format.
      static boolean isValidEmailAddress​(java.lang.String emailAddress)
      Check whether an email address has a valid format.
      static boolean isValidPassword​(java.lang.String password)  
      static boolean isValidPhoneNumber​(java.lang.String phoneNumber)
      Check whether a phone number has a valid format.
      static boolean isValidReference​(java.lang.String reference)
      Check whether a reference string has a valid format.
      static boolean isValidTerminalID​(java.lang.String terminalId)
      Check whether the terminal ID has a valid format.
      static boolean isValidTransactionKey​(java.lang.String transactionKey)
      Check whether the transaction key has a valid format.
      static android.graphics.Bitmap processSignatureImage​(android.graphics.Bitmap rawImage)  
      • Methods inherited from class java.lang.Object

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

      • isValidPhoneNumber

        public static boolean isValidPhoneNumber​(java.lang.String phoneNumber)
        Check whether a phone number has a valid format.
        Parameters:
        phoneNumber - The phone number to be validated.
        Returns:
        True if phone number is valid, false otherwise.
      • isValidEmailAddress

        public static boolean isValidEmailAddress​(java.lang.String emailAddress)
        Check whether an email address has a valid format.
        Parameters:
        emailAddress - The email address to be validated.
        Returns:
        True if email is valid, false otherwise.
      • isValidPassword

        public static boolean isValidPassword​(java.lang.String password)
      • isValidAmount

        public static boolean isValidAmount​(java.lang.String amount)
        Check whether an amount has a valid format. It has to be non null, in minor units and have a maximum of 7 numeric digits.
        Parameters:
        amount - The amount number to be validated.
        Returns:
        True if amount is valid, false otherwise.
      • isValidReference

        public static boolean isValidReference​(java.lang.String reference)
        Check whether a reference string has a valid format. It has to contain only UTF-8 characters and have a maximum of 50 characters.
        Parameters:
        reference - The reference number to be validated.
        Returns:
        True if reference is valid, false otherwise.
      • isValidTerminalID

        public static boolean isValidTerminalID​(java.lang.String terminalId)
        Check whether the terminal ID has a valid format.

        This must be 8 characters long and only contain numeric characters

        Parameters:
        terminalId - The terminal ID to be validated
        Returns:
        True if terminal ID is valid, false otherwise.
      • isValidTransactionKey

        public static boolean isValidTransactionKey​(java.lang.String transactionKey)
        Check whether the transaction key has a valid format.

        This should be between 1 and 20 characters long and contain only alpha numeric characters.

        Parameters:
        transactionKey - The transaction key to be validated
        Returns:
        True if transaction key is valid, false otherwise.
      • isValidApiKey

        public static boolean isValidApiKey​(java.lang.String theApiKey)
        Check whether the Api Key has a valid format.

        This should be between exactly 32 characters long and contain only alpha numeric characters.

        Parameters:
        theApiKey - The API key to be validated
        Returns:
        True if API key is valid, false otherwise.
      • isUsbMiuraDevice

        public static boolean isUsbMiuraDevice​(android.hardware.usb.UsbDevice device)
        Check if UsbDevice is a Miura PIN pad
        Parameters:
        device - Device to check
        Returns:
        True if USBDevice is a Miura, false otherwise.
      • getErrorsString

        public static java.lang.String getErrorsString​(java.util.ArrayList<com.creditcall.chipdnamobile.AbstractChipDnaMobileErrorCode> errorCodes)