Exemple #1
0
  /*
   * 支付按钮传入服务器的对象转化成jsonObject
   */
  public static JSONObject dhqbPayRequestPuts(
      BasicConfigRequest mBasicConfigRequest, DhqbPayRequest mDhqbPayRequest) {
    JSONObject mObject = new JSONObject();
    try {
      mObject.put(
          "version",
          mBasicConfigRequest.getVersion() == null ? "" : mBasicConfigRequest.getVersion());
      mObject.put(
          "appclass",
          mBasicConfigRequest.getAppclass() == null ? "" : mBasicConfigRequest.getAppclass());
      mObject.put(
          "appversion",
          mBasicConfigRequest.getAppversion() == null ? "" : mBasicConfigRequest.getAppversion());
      mObject.put(
          "tokenid",
          mBasicConfigRequest.getTokenid() == null ? "" : mBasicConfigRequest.getTokenid());
      mObject.put(
          "corpid", mBasicConfigRequest.getCorpid() == null ? "" : mBasicConfigRequest.getCorpid());
      mObject.put(
          "userclass",
          mBasicConfigRequest.getUserclass() == null ? "" : mBasicConfigRequest.getUserclass());
      mObject.put(
          "userid", mBasicConfigRequest.getUserid() == null ? "" : mBasicConfigRequest.getUserid());
      mObject.put(
          "customid",
          mBasicConfigRequest.getCustomid() == null ? "" : mBasicConfigRequest.getCustomid());
      mObject.put(
          "orderno", mDhqbPayRequest.getOrderno() == null ? "" : mDhqbPayRequest.getOrderno());

      // 如果paymodeid不为空,代表是代扣支付,把传入服务器的json里面添加paymodeid字段
      if (mDhqbPayRequest.getPaymodeid() != null) {
        mObject.put("paymodeid", mDhqbPayRequest.getPaymodeid());
      }

      mObject.put(
          "reserved",
          mBasicConfigRequest.getReserved() == null ? "" : mBasicConfigRequest.getReserved());
    } catch (JSONException e) {
      e.printStackTrace();
    }
    return mObject;
  }
Exemple #2
0
  /** 商品类别查询 */
  public static JSONObject protypeQueryRequestPuts(
      BasicConfigRequest mBasicConfigRequest, ProtypeQueryRequest mProtypeQueryRequest) {
    JSONObject mObject = new JSONObject();
    try {
      mObject.put(
          "version",
          mBasicConfigRequest.getVersion() == null ? "" : mBasicConfigRequest.getVersion());
      mObject.put(
          "appclass",
          mBasicConfigRequest.getAppclass() == null ? "" : mBasicConfigRequest.getAppclass());
      mObject.put(
          "appversion",
          mBasicConfigRequest.getAppversion() == null ? "" : mBasicConfigRequest.getAppversion());
      mObject.put(
          "tokenid",
          mBasicConfigRequest.getTokenid() == null ? "" : mBasicConfigRequest.getTokenid());
      mObject.put(
          "corpid", mBasicConfigRequest.getCorpid() == null ? "" : mBasicConfigRequest.getCorpid());
      mObject.put(
          "userclass",
          mBasicConfigRequest.getUserclass() == null ? "" : mBasicConfigRequest.getUserclass());
      mObject.put(
          "userid", mBasicConfigRequest.getUserid() == null ? "" : mBasicConfigRequest.getUserid());
      mObject.put(
          "customid",
          mProtypeQueryRequest.getCustomid() == null ? "" : mProtypeQueryRequest.getCustomid());

      mObject.put(
          "protypeid",
          mProtypeQueryRequest.getProtypeid() == null ? "" : mProtypeQueryRequest.getProtypeid());

      mObject.put(
          "reserved",
          mBasicConfigRequest.getReserved() == null ? "" : mBasicConfigRequest.getReserved());
    } catch (JSONException e) {
      e.printStackTrace();
    }
    return mObject;
  }