requestPayment method

void requestPayment({
  1. Payload? payload,
  2. BootpayDefaultCallback? onError,
  3. BootpayDefaultCallback? onCancel,
  4. BootpayCloseCallback? onClose,
  5. BootpayDefaultCallback? onIssued,
  6. BootpayConfirmCallback? onConfirm,
  7. BootpayAsyncConfirmCallback? onConfirmAsync,
  8. BootpayDefaultCallback? onDone,
})

Implementation

void requestPayment({
  Payload? payload,
  BootpayDefaultCallback? onError,
  BootpayDefaultCallback? onCancel,
  BootpayCloseCallback? onClose,
  BootpayDefaultCallback? onIssued,
  BootpayConfirmCallback? onConfirm,
  BootpayAsyncConfirmCallback? onConfirmAsync,
  BootpayDefaultCallback? onDone,
}) {
  if(onError != null) this.onError = onError;
  if(onCancel != null) this.onCancel = onCancel;
  if(onClose != null) this.onClose = onClose;
  if(onIssued != null) this.onIssued = onIssued;
  if(onConfirm != null) this.onConfirm = onConfirm;
  if(onConfirmAsync != null) this.onConfirmAsync = onConfirmAsync;
  if(onDone != null) this.onDone = onDone;
  if(payload != null) this.payload = payload;

  String script = "BootpayWidget.requestPayment(" +
      "${this.payload?.toString()}" +
      ")" +
      ".then( function (res) {" +
      confirm +
      issued +
      done +
      "}, function (res) {" +
      error +
      cancel +
      "})";

  print(script);

  _controller.runJavaScript(
      script
  );
}