创建JSAPI支付参数包
@param string $prepay_id
@return array
556675
public function createMchPay($prepay_id)
    {
        $option = array();
        $option["appId"] = $this->appid;
        $option["timeStamp"] = (string)time();
        $option["nonceStr"] = Tools::createNoncestr();
        $option["package"] = "prepay_id={$prepay_id}";
        $option["signType"] = "MD5";
        $option["paySign"] = Tools::getPaySign($option, $this->partnerKey);
        $option['timestamp'] = $option['timeStamp'];
        return $option;
    }
417313
public function appConfig(string $prepayId): array
    {
        $params = [
            'appid' => $this->app['config']->app_id,
            'partnerid' => $this->app['config']->mch_id,
            'prepayid' => $prepayId,
            'noncestr' => uniqid(),
            'timestamp' => time(),
            'package' => 'Sign=WXPay',
        ];

        $params['sign'] = Support\generate_sign($params, $this->app['config']->key);

        return $params;
    }
70087
public function getCode()
    {
        $data = [
            'suite_id' => $this->getSuiteId(),
        ];

        $result = $this->parseJSON('json', [self::GET_PRE_AUTH_CODE, $data]);

        if (empty($result['pre_auth_code'])) {
            throw new InvalidArgumentException('Invalid response.');
        }

        return $result['pre_auth_code'];
    }
915118
public static function authenticateWithPreset($preset, $api_id, $api_key) {
        return !is_null($api_id) && !is_null($api_key) &&
        Maestrano::with($preset)->param('api.id') == $api_id && Maestrano::with($preset)->param('api.key') == $api_key;
    }
846231
public static String generateChooseWXPayJson(String prepay_id,String appId,String key){
		String json = PayUtil.generateMchPayJsRequestJson(prepay_id, appId, key);
		json = json.replaceAll("\"timeStamp\"","\"timestamp\"")
				   .replaceAll(",?\"appId\":\"[^\"]*\",?","");
		return json;
	}
151781
public function jsPay(array $args = array()) {
        $args['appId'] = $this->get('appid'); //防止微信返回appid
        $args['nonceStr'] = Str::random(32);
        $args['timeStamp'] = time();
        $data = $this->set($args)->getJsApi();
        $data['package'] = 'prepay_id='.$data['package']['prepay_id'];
        $data['paySign'] = $this->sign($data);
        return $data;
    }
1277997
public function getInvalidFieldsUntil($strPageId)
    {
        $arrReturn = array();

        foreach ($this->__elements as $objPage) {
            if ($objPage->getId() == $strPageId) {
                break;
            }

            if ($objPage->hasFields()) {
                $objFieldsets = $objPage->getFields();
                foreach ($objFieldsets as $objFieldset) {
                    foreach ($objFieldset->getFields() as $objField) {
                        if (is_object($objField)) {
                            if ($objField->hasFields()) {
                                foreach ($objField->getFields() as $objSubField) {
                                    if (is_object($objSubField)) {
                                        if ($objSubField->hasFields()) {
                                            foreach ($objSubField->getFields() as $objSubSubField) {
                                                if (is_object($objSubSubField)) {
                                                    if (! $objSubSubField->isValid()) {
                                                        $arrTemp = array(
                                                            $objSubSubField->getName() => $objSubSubField->getValidator()->getError()
                                                        );
                                                        array_push($arrReturn, $arrTemp);
                                                    }
                                                }
                                            }
                                        } else {
                                            if (! $objSubField->isValid()) {
                                                $arrTemp = array(
                                                    $objSubField->getName() => $objSubField->getValidator()->getError()
                                                );
                                                array_push($arrReturn, $arrTemp);
                                            }
                                        }
                                    }
                                }
                            } else {
                                if (! $objField->isValid()) {
                                    $arrTemp = array(
                                        $objField->getName() => $objField->getValidator()->getError()
                                    );
                                    array_push($arrReturn, $arrTemp);
                                }
                            }
                        }
                    }
                }
            }
        }

        return $arrReturn;
    }
1241059
public function createParamsForApp($prepay_id)
    {
        $pay = new Order($this->config->get());
        return $pay->appParams($prepay_id);
    }
169236
public function getMany(array $id) {
		$preparedIds = array_map([$this, 'prepareId'], $id);
		
		$result = $this->getBackend()->getMany($preparedIds);
		
		if (empty($result)) {
			return $result;
		}
		
		if ($this->_namespace !== null) {
			$ids = array_intersect_key(array_combine($preparedIds, $id), $result);
			return array_combine(array_values($ids), array_values($result));
		}
		
		return $result;
	}
1178995
public static Map<String, String> prepayIdCreateSign(String prepay_id) {
		Map<String, String> packageParams = new HashMap<String, String>();
		packageParams.put("appId", WxPayApiConfigKit.getWxPayApiConfig().getAppId());
		packageParams.put("timeStamp", String.valueOf(System.currentTimeMillis() / 1000));
		packageParams.put("nonceStr", String.valueOf(System.currentTimeMillis()));
		packageParams.put("package", "prepay_id=" + prepay_id);
		packageParams.put("signType", "MD5");
		String packageSign = PaymentKit.createSign(packageParams,
				WxPayApiConfigKit.getWxPayApiConfig().getPaternerKey());
		packageParams.put("paySign", packageSign);
		return packageParams;
	}
1093595
private static function preprocessJsonPayload($payload) {

        $requests = [];

        $is_batch = false;

        if ( is_array($payload) ) {

            $is_batch = true;

            foreach ( $payload as $request ) $requests[] = self::preprocessJsonRequest($request);

        } else {

            $requests[] = self::preprocessJsonRequest($payload);

        }

        return array($is_batch, $requests);

    }
808639
@Override
    public NutMap pay_jsapi(String key, WxPayUnifiedOrder wxPayUnifiedOrder) {
        NutMap map = this.pay_unifiedorder(key, wxPayUnifiedOrder);
        NutMap params = NutMap.NEW();
        params.put("appId", wxPayUnifiedOrder.getAppid());
        params.put("timeStamp", String.valueOf((int) (System.currentTimeMillis() / 1000)));
        params.put("nonceStr", R.UU32());
        params.put("package", "prepay_id=" + map.getString("prepay_id"));
        params.put("signType", "MD5");
        String sign = WxPaySign.createSign(key, params);
        params.put("paySign", sign);
        return params;
    }
121904
private static function preprocessJsonRequest($request) {

        // check for required parameters

        if (
            !is_object($request) ||
            !property_exists($request, 'jsonrpc') ||
            !property_exists($request, 'method') ||
            $request->jsonrpc != '2.0' ||
            empty($request->method)
        ) {

            return array(
                'ERROR_CODE' => -32600,
                'ERROR_MESSAGE' => 'Invalid Request',
                'ID' => !isset($request['id']) ? null : $request['id']
            );

        }

        // parse request's components

        return array(
            'METHOD' => $request->method,
            'PARAMETERS' => property_exists($request, 'params') ? $request->params : [],
            'ID' => property_exists($request, 'id') ? $request->id : null
        );

    }
1244799
public function getConfigData(array $jsApiList, $url = null)
    {
        $api = $this->createApiService();
        $jsApiTicket = $api->getApiTicketFromCache('jsapi');

        $timestamp = time();
        $nonceStr = $this->generateNonceStr(32);
        $url || $url = $this->request->getUrl();

        $signData = [
            'jsapi_ticket' => $jsApiTicket,
            'noncestr' => $nonceStr,
            'timestamp' => $timestamp,
            'url' => $url,
        ];
        $signature = sha1($api->generateSign($signData));

        return [
            'beta' => true, // 开启内测接口,用于微信硬件
            'debug' => $this->wei->isDebug(),
            'appId' => $this['applicationId'],
            'timestamp' => $timestamp,
            'nonceStr' => $nonceStr,
            'signature' => $signature,
            'jsApiList' => $jsApiList,
        ];
    }
697514
public function getJs(string $table_id): string
    {
        ob_start();
        $this->getTreeJs();

        if (!$this->ajax_path) {
            $this->ajax_path = '?p='. P .'&do=' . P_DO;
        }

        ?>
        <script>
            var <?= $this->js_object_name ?> =
            new TableTree('<?= $table_id ?>', <?=json_encode($this->child_ids)?>, <?= json_encode($this->js_object_name, JSON_OBJECT_AS_ARRAY) ?>, '<?= $this->ajax_path ?>', <?= (int)$this->ajax ?>, <?= (int)$this->save_inner_state ?>);
        </script><?php

        return ob_get_clean();
    }
189859
private function getPreparedDeleteById()
    {
        if (is_null($this->preparedDeleteById)) {
            $this->preparedDeleteById = $this->getServer()
                ->delete($this->tableName)
                ->where()
                ->expr($this->keyColumnName, '=', ':id');
        }

        return $this->preparedDeleteById;
    }
195525
public static String generateMchPayJsRequestJson(String prepay_id, String appId, String key) {
		String package_ = "prepay_id=" + prepay_id;
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("appId", appId);
		map.put("nonceStr", UUID.randomUUID().toString().replace("-", ""));
		map.put("package", package_);
		map.put("signType", "MD5");
		map.put("timeStamp", System.currentTimeMillis() / 1000 + "");
		String paySign = SignatureUtil.generateSign(map, key);
		map.put("paySign", paySign);
		return JsonUtil.toJSONString(map);
	}