|
|
|
@ -162,7 +162,7 @@ class AppClient extends BaseClient
@@ -162,7 +162,7 @@ class AppClient extends BaseClient
|
|
|
|
|
$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType); |
|
|
|
|
$requestUrl = $this->buildRequestUrl($sysParams); |
|
|
|
|
$result = $this->httpPost($requestUrl, $apiParams); |
|
|
|
|
if(isset($result[$this->ERROR_RESPONSE])){ //返回错误 |
|
|
|
|
if (isset($result[$this->ERROR_RESPONSE])) { //返回错误 |
|
|
|
|
throw new BadRequestException( |
|
|
|
|
'Get Alipay API Error:' . $result[$this->ERROR_RESPONSE]['msg'] . |
|
|
|
|
(isset($result[$this->ERROR_RESPONSE]['sub_code']) ? (' - ' . $result[$this->ERROR_RESPONSE]['sub_code']) : '') |
|
|
|
@ -187,6 +187,23 @@ class AppClient extends BaseClient
@@ -187,6 +187,23 @@ class AppClient extends BaseClient
|
|
|
|
|
return new Collection($content); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param AppRequest $request |
|
|
|
|
* @return string |
|
|
|
|
* @throws InvalidConfigException |
|
|
|
|
* @throws \Exception |
|
|
|
|
*/ |
|
|
|
|
public function sdkExecute(AppRequest $request) |
|
|
|
|
{ |
|
|
|
|
$this->setupCharsets($request); |
|
|
|
|
$sysParams = $this->buildParams($request); |
|
|
|
|
$apiParams = $request->getApiParas(); |
|
|
|
|
$sysParams = array_merge($sysParams, $apiParams); |
|
|
|
|
ksort($sysParams); |
|
|
|
|
$sysParams["sign"] = $this->generateSign($sysParams, $this->signType); |
|
|
|
|
return http_build_query($sysParams); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param AppRequest $request |
|
|
|
|
* @return array |
|
|
|
@ -206,12 +223,17 @@ class AppClient extends BaseClient
@@ -206,12 +223,17 @@ class AppClient extends BaseClient
|
|
|
|
|
$sysParams["method"] = $request->getApiMethodName(); |
|
|
|
|
$sysParams["timestamp"] = date("Y-m-d H:i:s"); |
|
|
|
|
$sysParams["alipay_sdk"] = $this->alipaySdkVersion; |
|
|
|
|
$sysParams["terminal_type"] = $request->getTerminalType(); |
|
|
|
|
$sysParams["terminal_info"] = $request->getTerminalInfo(); |
|
|
|
|
$sysParams["prod_code"] = $request->getProdCode(); |
|
|
|
|
if ($request->getTerminalType()) { |
|
|
|
|
$sysParams["terminal_type"] = $request->getTerminalType(); |
|
|
|
|
} |
|
|
|
|
if ($request->getTerminalInfo()) { |
|
|
|
|
$sysParams["terminal_info"] = $request->getTerminalInfo(); |
|
|
|
|
} |
|
|
|
|
if ($request->getProdCode()) { |
|
|
|
|
$sysParams["prod_code"] = $request->getProdCode(); |
|
|
|
|
} |
|
|
|
|
$sysParams["notify_url"] = $request->getNotifyUrl(); |
|
|
|
|
$sysParams["charset"] = $this->postCharset; |
|
|
|
|
|
|
|
|
|
if (isset($this->config['auth_token'])) { |
|
|
|
|
$sysParams["auth_token"] = $this->config['auth_token']; |
|
|
|
|
} |
|
|
|
@ -259,7 +281,7 @@ class AppClient extends BaseClient
@@ -259,7 +281,7 @@ class AppClient extends BaseClient
|
|
|
|
|
*/ |
|
|
|
|
public function buildRequestUrl($sysParams) |
|
|
|
|
{ |
|
|
|
|
return "?" .http_build_query($sysParams); |
|
|
|
|
return "?" . http_build_query($sysParams); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|