退货交易、撤销交易

@param reqData
请求参数
@return {String}
11933
@Deprecated
	public static String refund(Map<String, String> reqData) {
		return HttpUtils.post(SDKConfig.getConfig().getBackRequestUrl(), reqData);
	}
1122032
function onData(data) {

		data = data.toString("ascii");
		bufferedData += data;

		if (debug) console.log("Server: " + util.inspect(data));

		if (checkResp === true) {

			if (bufferedData.substr(0, 3) === "+OK") {

				checkResp = false;
				response = true;

			} else if (bufferedData.substr(0, 4) === "-ERR") {

				checkResp = false;
				response = false;

			// The following is only used for SASL
			} else if (multiline === false) {

				checkResp = false;
				response = true;

			}
		}

		if (checkResp === false) {

			if (multiline === true && (response === false || bufferedData.substr(bufferedData.length-5) === "\r\n.\r\n")) {

				// Make a copy to avoid race conditions
				var responseCopy = response;
				var bufferedDataCopy = bufferedData;

				response = null;
				checkResp = true;
				multiline = false;
				bufferedData = "";

				callback(responseCopy, bufferedDataCopy);

			} else if (multiline === false) {

				// Make a copy to avoid race conditions
				var responseCopy = response;
				var bufferedDataCopy = bufferedData;

				response = null;
				checkResp = true;
				multiline = false;
				bufferedData = "";

				callback(responseCopy, bufferedDataCopy);

			}
		} 
	}
1360632
function(data) {

    var _mode = QRMode.MODE_ALPHA_NUM;
    var _data = data;

    var _this = {};

    _this.getMode = function() {
      return _mode;
    };

    _this.getLength = function(buffer) {
      return _data.length;
    };

    _this.write = function(buffer) {

      var s = _data;

      var i = 0;

      while (i + 1 < s.length) {
        buffer.put(
          getCode(s.charAt(i) ) * 45 +
          getCode(s.charAt(i + 1) ), 11);
        i += 2;
      }

      if (i < s.length) {
        buffer.put(getCode(s.charAt(i) ), 6);
      }
    };

    var getCode = function(c) {

      if ('0' <= c && c <= '9') {
        return c.charCodeAt(0) - '0'.charCodeAt(0);
      } else if ('A' <= c && c <= 'Z') {
        return c.charCodeAt(0) - 'A'.charCodeAt(0) + 10;
      } else {
        switch (c) {
        case ' ' : return 36;
        case '$' : return 37;
        case '%' : return 38;
        case '*' : return 39;
        case '+' : return 40;
        case '-' : return 41;
        case '.' : return 42;
        case '/' : return 43;
        case ':' : return 44;
        default :
          throw 'illegal char :' + c;
        }
      }
    };

    return _this;
  }
392554
private static Map<String, String> __getRequestHeaderMap(HttpServletRequest req) {
        Map<String, String> reqHeaders = new LinkedHashMap<>();
        Enumeration<String> headerNames = req.getHeaderNames();
        if (headerNames != null) {
            while (headerNames.hasMoreElements()) {
                String headerName = headerNames.nextElement();
                Enumeration<String> headerValues = req.getHeaders(headerName);

                if (headerValues != null) {
                    StringBuilder headerValueBuilder = new StringBuilder();
                    int i = 0;
                    while (headerValues.hasMoreElements()) {
                        if (i > 0) {
                            headerValueBuilder.append(", ");
                        }

                        headerValueBuilder.append(headerValues.nextElement());
                        i++;
                    }

                    reqHeaders.put(headerName, headerValueBuilder.toString());
                } else {
                    reqHeaders.put(headerName, "");
                }
            }
        }
        return reqHeaders;
    }
674388
public static String fileTransfer(Map<String, String> reqData) {
		return HttpUtils.post(SDKConfig.getConfig().getFileTransUrl(), reqData);
	}
994481
public static String AppConsume(Map<String, String> reqData) {
		return HttpUtils.post(SDKConfig.getConfig().getAppRequestUrl(), reqData);
	}
1049231
function(data, req, res, servConfig){
        if(!data.cnt) return false;
        // utils.log(utils.chalk.green("----------ajax json:\n", data.type));
        try{
            switch(data.type){
                case 'mjson': //处理mockjson
                    //utils.log(utils.chalk.green(mockjs.mock(JSON.parse(data.cnt))))
                    this.acao && res.setHeader("Access-Control-Allow-Origin","*");
                    data.cnt = JSON.stringify(mockjs.mock(JSON.parse(data.cnt)), null, 4);
                case 'json':
                    this.acao && res.setHeader("Access-Control-Allow-Origin","*");
                    res.writeHead(200, {
                        'Content-Type': utils.MIME['json']
                    });
                    res.write(data.cnt);
                    res.end();
                    break;
                case 'js':
                    //data = new vm.script(data[0]);
                    // 将分解好的url给mock用户*.js 
                    // 只能拦截所起服务下的mock 跨域的不能拦截需用fiddler或charles之类的代理到servermock所起服务下
                    req.parseUrl = req.wwwurl = url.parse(servConfig.protocol + '://' + req.headers.host + req.url);
                    var qstr = req.wwwurl.query ? qs.parse(req.wwwurl.query) : {},
                        query = {};
                    for(var i in qstr){
                        var $ = /(.+)\[(.+)\]/.exec(i);
                        // utils.log(utils.chalk.green("$: ", $));
                        $ ? (query[$[1]] || (query[$[1]] = {})) && (query[$[1]][$[2]] = qstr[i]):
                            query[i] = qstr[i];  
                    }
                    // utils.log(utils.chalk.green("qstr: ", qstr));
                    //extname === 'html' && utils.log(utils.chalk.green(req, '\n\n\n\n', req.wwwurl))
                    req.queryObj = req.wwwurl.queryObj = query;
                    //utils.log(utils.chalk.green('----------mock js func:\n', data.cnt.toString()));
                    vm.runInThisContext('(' + data.cnt + ')')(req, res, require);
                    break;
                default:
                    utils.log(utils.chalk.yellow("mock 暂只支持.mjson .json .js文件"));
                    res.end("mock 暂只支持.mjson .json .js文件");
            }
        } catch(e){
            utils.log(utils.chalk.red("mock error: "), e);
        }
        return true;
    }
715037
function createPQInnerData(context) {
    var resPQ = context.resPQ;
    var newNonce = utility.createNonce(32);
    var pqInnerData = new mtproto.type.P_q_inner_data({
        props: {
            pq: resPQ.pq,
            p: context.pBuffer,
            q: context.qBuffer,
            nonce: resPQ.nonce,
            server_nonce: resPQ.server_nonce,
            new_nonce: newNonce
        }
    }).serialize();
    context.pqInnerData = pqInnerData;
    context.newNonce = newNonce;
    return context;
}
622908
public static Map<String, String> sign(Map<String, String> reqData,String encoding) {
		reqData = SDKUtil.filterBlank(reqData);
		SDKUtil.sign(reqData, encoding);
		return reqData;
	}
1105265
function (req, res) {
	if (req.body) {
		//console.log(req.body.constructor)
		if (req.body.constructor !== Object) {return res.send({error:"Invalid Request body - should be Object"})};
	}
	var table = req.params["0"];
	var rcfg  = process.rapidcfg;
        var rmethod = req.method
	var extname = ""
	/* code for database distribution here ! */
	function GetUserDistName(lcstring){ return utils.hash(lcstring,1).toLowerCase()}		
	/* end */
	/* code for REDIS distribution here ! */
	function GetUserDistCache(lcstring){ return utils.hash(lcstring,1).toLowerCase()}		
	/* end */ 
	// check for table
	var accepted_list = rcfg.mdb.tables.names.slice(0);;
	accepted_list.push('up_data');
	accepted_list.push('up_tdata');
	accepted_list.push('rpdquery');
	if (utils.findin(accepted_list,table)){
		var primary_key = rcfg.mdb.tables.keys[table]
		if(!primary_key){
			if (table!='up_data' && table!='up_tdata' && table!='rpdquery'){
			return res.send({error:"Table - "+table+" - primary key not found in database!"})};
		} else {
		var dbcon = {};
		var rediscon = {};
		var base_db = rcfg.mdb.tables.db[table];
		if (rcfg.distributeddata == 1 && rcfg.mdb.databases[base_db].distributeddata==1){
			//extname = GetUserDistName(req.session.username.toLowerCase());
			//var dist_db = base_db +'_'+extname;
			//console.log(rcfg.mdb.databases[base_db].distributeddata)
			//req.session.username
			var dist_db = dbs.getdbdist(base_db,req.token.user);
			dbcon = rcfg.mdb.connections[dist_db];
			dbcon.rapiddb = dist_db
		} else {dbcon = rcfg.mdb.databases[base_db];dbcon.rapiddb = base_db};
		//console.log(dbcon);
		if (rcfg.distributedcache == 1){
			//req.session.username
			redisname = GetUserDistCache(req.token.user.toLowerCase());
			//console.log(redisname);
			rediscon  = rcfg.mdb.redis[redisname];
		};
		//console.log(rediscon);
		var table_structure = rcfg.mdb.tables.structures[table] }
		function rdbcallback(error,message){
			//console.log('Callback:');
			if (error){
				if(error){console.log(error)};
				//console.log(typeof(error.error));
				//console.log(Object.keys(error.error).length);
				res.status(400);
				return res.send(error)} 
			else {
				//console.log(message);
				return res.send(message)}
			};
		function rapidfind(){
			if (table == 'rpdquery'){
				rdb.runsql(req,rdbcallback);
			} else {
				if (req.query[primary_key]){
					rdb.find(req,table,primary_key,table_structure,dbcon,rediscon,rdbcallback);
				} else {
				//res.status(400);return res.send({error:'Query error/Primary key not found in GET:Query parameters'})
				rdb.find(req,table,false,table_structure,dbcon,rediscon,rdbcallback);
				}
			}
		};
		function rapidcreate(){
			if (req.body){
				function defaultcreate(){rdb.create(req,table,primary_key,table_structure,dbcon,rediscon,rdbcallback)}
				function up_data(){rdb.dataset(req,false,rdbcallback)}
				function up_tdata(){rdb.dataset(req,true,rdbcallback)}
				switch (table) {
				case 'up_tdata':
					if (rcfg.mdb.tables.structures[table]){
					if (Object.keys(req.body).length > 1){
						defaultcreate();
					}else {up_tdata}} else {
					up_tdata()};
					break;
				case 'up_data':
					if (rcfg.mdb.tables.structures[table]){
					if (Object.keys(req.body).length > 1){
						defaultcreate();
					}else {up_data()}} else {
					up_data()};
					break;
				default: defaultcreate()};
			} else {res.status(400);return res.send({error:'Query error/No parameters found-POST:Body/required format JSON'})}
		};
		function rapidupdate(){
			if (req.body[primary_key]){
				rdb.update(req,table,primary_key,table_structure,dbcon,rediscon,rdbcallback)
			} else {res.status(400);return res.send({error:'Query error/Primary key not found in PUT:Body parameters'})}
		};
		function rapiddelete(){
			var key_value = false
			var key_value = req.query[primary_key]
			if (!key_value){key_value = req.body[primary_key]}
			if (key_value){
				rdb.destroy(req,table,primary_key,table_structure,dbcon,key_value,rediscon,rdbcallback)
			} else {res.status(400);return res.send({error:'Query error/Primary key not found in DELETE:Query parameters'})}
		};
		switch (rmethod) {
	    	case 'GET':rapidfind();break;
	    	case 'POST':rapidcreate();break;
		case 'PUT':rapidupdate();break;
		case 'DELETE':rapiddelete();break;
	    	default:
			return res.send({error:"Method - "+req.method+" - not alowed!"});
		} 
	} else { return res.send({error:"Table - "+ table+" - not found!"})}; // code for waterline redirect here !
  }
1169653
function transformData(methodRegExp) {
    var transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (data) {
        return data;
    };

    var re = new RegExp(methodRegExp || '.*');

    // The middleware function
    return function transformDataMiddleware(next) {
        // Checks if the call should be transformed. If yes, it applies the transform function
        function checkAndTransform(method) {
            return re.test(method) ? function (req) {
                return next[method](req).then(function (res) {
                    return Object.assign(res, { data: transform(res.data) });
                });
            } : function (req) {
                return next[method](req);
            };
        }

        // The middleware connector:
        return {
            create: checkAndTransform('create'),
            read: checkAndTransform('read'),
            update: checkAndTransform('update'),
            delete: checkAndTransform('delete')
        };
    };
}
680410
function(data){
			//console.log(data);
			//丢弃data的第一行
			var res = '', i = 1, len = data.length;
			for(; i < len; i++){
				res += data[i].replace(/^[\t ]+/, '');
			}
			return res;
		}
1113991
function(data) {
			data = data || {};
			var paramNames = Object.keys(data);
			var buf = [];
			for (var i=0; i < paramNames.length; i++) {
				var param = paramNames[i], value = data[param];
				buf.push(x_www_form_urlencode(param) + '=' + x_www_form_urlencode(value)); //$NON-NLS-0$
			}
			return buf.join('&'); //$NON-NLS-0$
		}
1197263
function(oData) {
    // Special case null and undefined
    if(!lang.isValue(oData)) {
        return null;
    }
    
    //Convert to string
    var string = oData + "";

    // Validate
    if(lang.isString(string)) {
        return string;
    }
    else {
        YAHOO.log("Could not convert data " + lang.dump(oData) + " to type String", "warn", this.toString());
        return null;
    }
}
851164
public static Map<String, String> backRequestByMap(Map<String, String> reqData) {
		return SDKUtil.convertResultStringToMap(backRequest(reqData));
	}
713928
public static String self(HttpServletRequest req) {
	StringBuffer sb = new StringBuffer(req.getServletPath());
	String qs = req.getQueryString();
	if (!StringUtil.isEmpty(qs)) sb.append('?').append(qs);
	return sb.toString();
    }
662837
public function call($reqData) {
    $respData = $this->createError('Unrecognized entity or action');

    if ($reqData['entity'] == 'Cxn' && preg_match('/^[a-zA-Z]+$/', $reqData['action'])) {
      $func = 'on' . $reqData['entity'] . strtoupper($reqData['action']{0}) . substr($reqData['action'], 1);
      if (is_callable(array($this, $func))) {
        $respData = call_user_func(array($this, $func), $reqData['cxn'], $reqData['params']);
      }
    }

    return $respData;
  }