UtilsAPI
Docs for UtilsAPI methods
1. showToast
showToast(toastData: ToastParams): Promise<void>Shows native android toasts of type [error, success, info]
Accepts ToastParams :
type : ToastType : [error, success, info]
message: string: message to be shown in toast
2. scanQr
scanQr(minLength: number): Promise<string>Opens scanner to scan qr codes.
Accepts minLength : number as paramter. This is the minimum length of QR content to be scanned.
Returns stringcontent of QR scanned.
3. scanBarcode
scanBarcode(minLength: number): Promise<string>Opens scanner to scan barcode.
Accepts minLength : number as paramter. This is the minimum length of barcode content to be scanned.
Returns string content of barcode scanned.
4. getMerchantData
getMerchantData(): Promise<MerchantData>Gives data about the merchant.
Returns MerchantData :
shopName : string : Shop name of the merchant
shopAddress : string : Shop address of the merchant
mobileNumber : string : Mobile number of the merchant
supportNumber : string : Support number of the merchant
5. showDialog
showDialog(dialogData: DialogData): Promise<DialogAction>Show native android dialog of types : [success, error, confirmation]
Aceepts DialogData as parameter :
type : DialogType [success, error, confirmation] : Type of dialog to be shown
title : string : Title of the dialog
message : string : Message to be shown in the dialog
positiveBtnText : string | null | undefined : Text to be shown in positive button of dialog if type of dialog is confirmation
negativeBtnText : string | null | undefined : Text to be shown in negative button of dialog if type of dialog is confirmation
Returns DialogAction :
actoin : 0 | 1 : Is 0 if negative button is pushed or 1 if postive button is pushed in dialog type confirmation. All other types 1 is returned.
6. onClientError
onClientError(message: string): Promise<void>Shows android native error page with message provided.
Accepts message : string : Message to be shown on error page.
7. toggleAppLoader
Toggles android native loader
toggleAppLoader(loaderParams: ToggleAppLoaderParams): Promise<void> Accepts ToggleAppLoaderParams :
showLoader: boolean : Show or hide loader
loaderText : string | null | undefined : Loader text to be shown when shwoing the loader
8. checkIfTerminal
Checks if device is a POS terminal.
checkIfTerminal(): Promise<TerminalModelData>Returns boolean : true if terminal , false for any other device.
9. openQrDialog
Opens QR dialog with the content provided
openQrDialog(qrDialogInput: QrDialogData): Promise<void>Accepts qrDialogInput: QrDialogData:
title : string : Title of the QR Dialog
qrData: string : QR data for which the qr is to be shown
Last updated
Was this helpful?