Browse Source

修改扩展

master
wuliangbo 5 years ago
parent
commit
eb3642205e
  1. 24
      src/Kernel/AppClient.php
  2. 1
      src/Kernel/Traits/ResponseCastable.php
  3. 9
      src/Payment/Pay/Client.php

24
src/Kernel/AppClient.php

@ -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;
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'];
}

1
src/Kernel/Traits/ResponseCastable.php

@ -29,7 +29,6 @@ trait ResponseCastable @@ -29,7 +29,6 @@ trait ResponseCastable
{
$response = Response::buildFromPsrResponse($response);
$response->getBody()->rewind();
switch ($type ?? 'array') {
case 'collection':
return $response->toCollection();

9
src/Payment/Pay/Client.php

@ -47,14 +47,9 @@ class Client extends AppClient @@ -47,14 +47,9 @@ class Client extends AppClient
}
/**
* app 支付
* @param array $payload
* @return \EasyAlipay\Kernel\Support\Collection
* @throws \EasyAlipay\Kernel\Exceptions\BadRequestException
* @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException
* @return string
* @throws \EasyAlipay\Kernel\Exceptions\InvalidConfigException
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function app(array $payload)
{
@ -75,7 +70,7 @@ class Client extends AppClient @@ -75,7 +70,7 @@ class Client extends AppClient
}
$request->setBizContent($payContentBuilder->getBizContent());
$request->setApiMethodName("alipay.trade.app.pay");
return ($this->execute($request));
return ($this->sdkExecute($request));
}
/**

Loading…
Cancel
Save