onWebViewEasyError method

void onWebViewEasyError(
  1. JavaScriptMessage message
)

Implementation

void onWebViewEasyError(JavaScriptMessage message) {
  BootpayPrint('onWebViewEasyError: ${requestType}, ${message.message}');
  final data = json.decode(message.message);
  if(data["error_code"] == "USER_BIOMETRIC_OTP_INVALID") {
    NextJob job = NextJob();
    job.initToken = true;
    if(onCallbackNextJob != null) onCallbackNextJob!(job);
    initBioAuthDevice();
    requestType.value = BioConstants.REQUEST_TYPE_NONE;
    if(onCallbackError != null) onCallbackError!(message.message);

    return;
  }

  if(data["error_code"] == "PASSWORD_TOKEN_STOP") {
    if(onCallbackCancel != null) onCallbackCancel!(message.message);
    if(onCallbackDebounceClose != null) onCallbackDebounceClose!();
    return;
  }

  if(["USER_PW_TOKEN_NOT_FOUND",
      "USER_PW_TOKEN_EXPIRED"].contains(data["error_code"])) {
    NextJob job = NextJob();
    job.initToken = true;
    job.nextType = BioConstants.REQUEST_PASSWORD_FOR_PAY;
    if(onCallbackNextJob != null) onCallbackNextJob!(job);

  } else {
    requestType.value = BioConstants.REQUEST_TYPE_NONE;
    if(onCallbackError != null) onCallbackError!(message.message);
  }
}