Package com.creditcall.chipdnamobile

# Class ChipDnaMobileUtils

java.lang.Object
com.creditcall.chipdnamobile.ChipDnaMobileUtils

public class ChipDnaMobileUtils extends Object
This class contains utility methods that may be needed to integrate with the SDK.

Author:
  Creditcall Ltd

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static android.graphics.Bitmap`
  `getBitmapFromPngString(String pngString)`
  `static String`
  `getErrorsString(ArrayList<com.creditcall.chipdnamobile.AbstractChipDnaMobileErrorCode> errorCodes)`
  `static 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(String amount)`
  Check whether an amount has a valid format.
  `static boolean`
  `isValidApiKey(String theApiKey)`
  Check whether the Api Key has a valid format.
  `static boolean`
  `isValidEmailAddress(String emailAddress)`
  Check whether an email address has a valid format.
  `static boolean`
  `isValidPassword(String password)`
  `static boolean`
  `isValidPhoneNumber(String phoneNumber)`
  Check whether a phone number has a valid format.
  `static boolean`
  `isValidReference(String reference)`
  Check whether a reference string has a valid format.
  `static boolean`
  `isValidTerminalID(String terminalId)`
  Check whether the terminal ID has a valid format.
  `static boolean`
  `isValidTransactionKey(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 Details

  - ### isValidPhoneNumber

    public static boolean isValidPhoneNumber(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(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(String password)

  - ### isValidAmount

    public static boolean isValidAmount(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(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(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(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(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 String getErrorsString(ArrayList<com.creditcall.chipdnamobile.AbstractChipDnaMobileErrorCode> errorCodes)

  - ### getSignaturePngStringFromBitmap

    public static String getSignaturePngStringFromBitmap(android.graphics.Bitmap signatureImage) throws ChipDnaMobileException
    Throws:
      `ChipDnaMobileException`

  - ### processSignatureImage

    public static android.graphics.Bitmap processSignatureImage(android.graphics.Bitmap rawImage) throws ChipDnaMobileException
    Throws:
      `ChipDnaMobileException`

  - ### getBitmapFromPngString

    public static android.graphics.Bitmap getBitmapFromPngString(String pngString) throws ChipDnaMobileException
    Throws:
      `ChipDnaMobileException`