Esempio n. 1
0
  /**
   * 消费者资产转移接口
   *
   * @param currentString 随机字符串,不长于32位
   * @param redirectUri 回调地址
   * @param tradeNo 开发者内部的凭据号,如:2015121822992
   * @param assetName 资产名称,带中文,请用utf-8进行url解码
   * @param assetUnit 资产单位,带中文,请用utf-8进行url解码
   * @param assetCode 资产CODE,转出方给转入方转让的资产标识(全网唯一)
   * @param assetAmount 资产转移数量,参数不带小数点
   * @param fromBubiId 资产转出方布比账号地址
   * @param toBubiId 资产转入方布比账号地址
   * @param body 资产描述或交易摘要,不长于50位(可选项)
   * @return
   * @throws Exception
   */
  public void consumerSend(
      String currentString,
      String redirectUri,
      String tradeNo,
      String assetName,
      String assetUnit,
      String assetCode,
      String assetAmount,
      String fromBubiId,
      String toBubiId,
      String body)
      throws Exception {
    Map<String, Object> sParaTemp = new HashMap<String, Object>();
    sParaTemp.put("current_string", currentString);
    sParaTemp.put("trade_no", tradeNo);
    sParaTemp.put("asset_code", assetCode);
    sParaTemp.put("asset_amount", assetAmount);
    sParaTemp.put("from_bubi_address", fromBubiId);
    sParaTemp.put("to_bubi_address", toBubiId);
    // [必填]签名 ,签名原理详见API文档中的"签名算法"
    String sign = Tools.buildRequestMySign(sParaTemp);

    String url =
        Constants.Consumer_ASSET_SEND_URL
            + "?access_token="
            + access_token
            + "&current_string="
            + currentString
            + "&body="
            + body
            + "&trade_no="
            + tradeNo
            + "&asset_name="
            + assetName
            + "&asset_unit="
            + assetUnit
            + "&asset_code="
            + assetCode
            + "&asset_amount="
            + assetAmount
            + "&from_bubi_address="
            + fromBubiId
            + "&to_bubi_address="
            + toBubiId
            + "&sign="
            + sign
            + "&redirect_uri="
            + redirectUri;
    System.out.println(url);
    try {
      Tools.browse(url);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 2
0
 /**
  * 消费者绑定布比账户
  *
  * @param sParaTemp 包含待拼接参数:redirect_uri 回调地址;trade_no 凭据号
  * @throws UnsupportedEncodingException
  */
 public void bindHTML(Map<String, Object> sParaTemp) throws UnsupportedEncodingException {
   String url =
       Constants.ACCOUNT_BIND_URL
           + "?access_token="
           + access_token
           + "&"
           + Tools.createLinkString(sParaTemp);
   try {
     Tools.browse(url);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Esempio n. 3
0
 /**
  * 资产发行
  *
  * @param assetIssuer 资产发行商布比地址
  * @param redirectUri 布比区块链回调开发者URI
  * @param tradeNo 凭据号
  * @param assetName 待发行资产名称
  * @param assetUnit 待发行资产单位
  * @param assetAmount 待发行资产数量
  * @param body 说明,如,资产描述或摘要
  * @return
  * @throws Exception
  */
 public void issueHTML(
     String assetIssuer,
     String redirectUri,
     String tradeNo,
     String assetName,
     String assetUnit,
     String assetAmount,
     String body)
     throws Exception {
   String url = Constants.ASSET_ISSUE_HTML_URL + "?access_token=" + access_token;
   Map<String, Object> sParaTemp = new HashMap<String, Object>();
   sParaTemp.put("trade_no", tradeNo);
   sParaTemp.put("asset_issuer", assetIssuer);
   sParaTemp.put("asset_name", assetName);
   sParaTemp.put("asset_unit", assetUnit);
   sParaTemp.put("asset_amount", assetAmount);
   sParaTemp.put("redirect_uri", redirectUri);
   sParaTemp.put("body", body);
   try {
     Tools.browse(url + "&" + Tools.createLinkString(sParaTemp));
   } catch (Exception e) {
     e.printStackTrace();
   }
 }