getBootpayJS method

Future<String> getBootpayJS(
  1. BioPayload payload, {
  2. String? otp,
  3. String? quota,
})

Implementation

Future<String> getBootpayJS(BioPayload payload, {String? otp, String? quota}) async {
  this.payload = payload;

  String script = "";
  if([BioConstants.REQUEST_PASSWORD_TOKEN,
    BioConstants.REQUEST_PASSWORD_TOKEN_FOR_ADD_CARD,
    BioConstants.REQUEST_PASSWORD_TOKEN_FOR_BIO_FOR_PAY,
    BioConstants.REQUEST_PASSWORD_TOKEN_FOR_PASSWORD_FOR_PAY,
    BioConstants.REQUEST_PASSWORD_TOKEN_DELETE_CARD].contains(requestType)) {
    // contro
    script = BioConstants.getJSPasswordToken(payload.userToken ?? '');

  } else if(BioConstants.REQUEST_PASSWORD_FOR_PAY == requestType) {
    script = await BioConstants.getJSPasswordPay(payload);
  } else if(BioConstants.REQUEST_ADD_CARD == requestType) {
    script = BioConstants.getJSAddCard(payload);
  } else if(BioConstants.REQUEST_BIO_FOR_PAY == requestType) {
    script = BioConstants.getJSBioOTPPay(payload, '$otp', '$quota');
  } else if([BioConstants.REQUEST_ADD_BIOMETRIC,
    BioConstants.REQUEST_ADD_BIOMETRIC_FOR_PAY].contains(requestType)) {
    script = await BioConstants.getJSBiometricAuthenticate(payload);
  } else if(BioConstants.REQUEST_TOTAL_PAY == requestType) {
    script = BioConstants.getJSTotalPay(payload);
  } else if(BioConstants.REQUEST_DELETE_CARD == requestType) {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    String passwordToken =  prefs.getString('password_token') ?? '';
    payload.token = passwordToken;

    script = BioConstants.getJSDestroyWallet(payload);
  }

  return "setTimeout(function() {" + script + "}, 50);";
}