getBootpayJS method

String getBootpayJS()

Implementation

String getBootpayJS() {
  String requestMethod = 'requestPayment';
  if(this.widget.requestType == BootpayConstant.REQUEST_TYPE_SUBSCRIPT) {
    requestMethod = 'requestSubscription';
  } else if(this.widget.requestType == BootpayConstant.REQUEST_TYPE_AUTH) {
    requestMethod = 'requestAuthentication';
  } else if(this.widget.requestType == BootpayConstant.REQUEST_TYPE_PASSWORD) {
    this.widget.payload?.method = "카드간편";
  }

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

  print(script);

  return script;
}