Package com.creditcall.chipdnamobile
Class ChipDnaMobileUtils
- java.lang.Object
-
- com.creditcall.chipdnamobile.ChipDnaMobileUtils
-
public class ChipDnaMobileUtils extends java.lang.ObjectThis 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.BitmapgetBitmapFromPngString(java.lang.String pngString)static java.lang.StringgetErrorsString(java.util.ArrayList<com.creditcall.chipdnamobile.AbstractChipDnaMobileErrorCode> errorCodes)static java.lang.StringgetSignaturePngStringFromBitmap(android.graphics.Bitmap signatureImage)static booleanisUsbMiuraDevice(android.hardware.usb.UsbDevice device)Check ifUsbDeviceis a Miura PIN padstatic booleanisValidAmount(java.lang.String amount)Check whether an amount has a valid format.static booleanisValidApiKey(java.lang.String theApiKey)Check whether the Api Key has a valid format.static booleanisValidEmailAddress(java.lang.String emailAddress)Check whether an email address has a valid format.static booleanisValidPassword(java.lang.String password)static booleanisValidPhoneNumber(java.lang.String phoneNumber)Check whether a phone number has a valid format.static booleanisValidReference(java.lang.String reference)Check whether a reference string has a valid format.static booleanisValidTerminalID(java.lang.String terminalId)Check whether the terminal ID has a valid format.static booleanisValidTransactionKey(java.lang.String transactionKey)Check whether the transaction key has a valid format.static android.graphics.BitmapprocessSignatureImage(android.graphics.Bitmap rawImage)
-
-
-
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 ifUsbDeviceis 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)
-
getSignaturePngStringFromBitmap
public static java.lang.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(java.lang.String pngString) throws ChipDnaMobileException- Throws:
ChipDnaMobileException
-
-