增加输出日志
This commit is contained in:
@@ -186,7 +186,7 @@ class RsaSigner implements Signer
|
|||||||
public function checkSignature(YopHttpResponse $httpResponse, $signature, $publicKey, SignOptions $options)
|
public function checkSignature(YopHttpResponse $httpResponse, $signature, $publicKey, SignOptions $options)
|
||||||
{
|
{
|
||||||
$content = $httpResponse->readContent();
|
$content = $httpResponse->readContent();
|
||||||
\Log::channel('yeepay')->info($content);
|
\Log::channel('yeepay')->error('返回的内容:', json_decode($content, true));
|
||||||
|
|
||||||
$content = str_replace([" ", "\n", "\t"], "", $content);
|
$content = str_replace([" ", "\n", "\t"], "", $content);
|
||||||
if (openssl_verify($content, base64_decode($signature), $publicKey, $options->getDigestAlg()) == 1) {
|
if (openssl_verify($content, base64_decode($signature), $publicKey, $options->getDigestAlg()) == 1) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ClientHandler
|
|||||||
{
|
{
|
||||||
$executionContext = $this->getExecutionContext($executionParams);
|
$executionContext = $this->getExecutionContext($executionParams);
|
||||||
$request = $executionParams->getRequestMarshaller()->marshal($executionParams->getRequest());
|
$request = $executionParams->getRequestMarshaller()->marshal($executionParams->getRequest());
|
||||||
\Log::channel('yeepay')->info(json_encode($request->getParameters()));
|
\Log::channel('yeepay')->error('提交的参数:', $request->getParameters());
|
||||||
|
|
||||||
/** @var ExecutionContext $httpExecutionContext */
|
/** @var ExecutionContext $httpExecutionContext */
|
||||||
$httpExecutionContext = $executionContext[0];
|
$httpExecutionContext = $executionContext[0];
|
||||||
@@ -69,7 +69,6 @@ class ClientHandler
|
|||||||
$yopHttpResponse = $this->yopHttpClient->execute($request, $httpExecutionContext);
|
$yopHttpResponse = $this->yopHttpClient->execute($request, $httpExecutionContext);
|
||||||
/** @var ResponseUnMarshalParams $ResponseUnMarshalParams */
|
/** @var ResponseUnMarshalParams $ResponseUnMarshalParams */
|
||||||
$ResponseUnMarshalParams = $executionContext[1];
|
$ResponseUnMarshalParams = $executionContext[1];
|
||||||
|
|
||||||
return $executionParams->getResponseUnMarshaller()->unmarshal($yopHttpResponse, $ResponseUnMarshalParams);
|
return $executionParams->getResponseUnMarshaller()->unmarshal($yopHttpResponse, $ResponseUnMarshalParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ class YopHttpClient
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* YopHttpClient constructor.
|
* YopHttpClient constructor.
|
||||||
|
*
|
||||||
* @param ClientConfiguration $clientConfiguration
|
* @param ClientConfiguration $clientConfiguration
|
||||||
*/
|
*/
|
||||||
public function __construct(ClientConfiguration $clientConfiguration)
|
public function __construct(ClientConfiguration $clientConfiguration)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->logger = LogFactory::getLogger(get_class($this));
|
$this->logger = LogFactory::getLogger(get_class($this));
|
||||||
$this->clientConfiguration = $clientConfiguration;
|
$this->clientConfiguration = $clientConfiguration;
|
||||||
$guzzleClientConfig = [
|
$guzzleClientConfig = [
|
||||||
@@ -68,6 +68,8 @@ class YopHttpClient
|
|||||||
$executionContext->getSigner()
|
$executionContext->getSigner()
|
||||||
->sign($request, $executionContext->getCredentials(), $executionContext->getSignOptions());
|
->sign($request, $executionContext->getCredentials(), $executionContext->getSignOptions());
|
||||||
try {
|
try {
|
||||||
|
\Log::channel('yeepay')->error('头部信息', $request->getHeaders());
|
||||||
|
|
||||||
$guzzleResponse = $this->sendRequest($request);
|
$guzzleResponse = $this->sendRequest($request);
|
||||||
} catch (ServerException $e) {
|
} catch (ServerException $e) {
|
||||||
$guzzleResponse = $e->getResponse();
|
$guzzleResponse = $e->getResponse();
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ abstract class BaseResponseUnMarshaller implements ResponseUnMarshaller
|
|||||||
{
|
{
|
||||||
$responseMetadata->setYopRequestId($yopHttpResponse->getHeader(Headers::YOP_REQUEST_ID));
|
$responseMetadata->setYopRequestId($yopHttpResponse->getHeader(Headers::YOP_REQUEST_ID));
|
||||||
$responseMetadata->setYopContentSha256($yopHttpResponse->getHeader(Headers::YOP_CONTENT_SHA256));
|
$responseMetadata->setYopContentSha256($yopHttpResponse->getHeader(Headers::YOP_CONTENT_SHA256));
|
||||||
|
#todo 关闭验签
|
||||||
// $responseMetadata->setYopSign($yopHttpResponse->getHeader(Headers::YOP_SIGN));
|
// $responseMetadata->setYopSign($yopHttpResponse->getHeader(Headers::YOP_SIGN));
|
||||||
$responseMetadata->setYopVia($yopHttpResponse->getHeader(Headers::YOP_VIA));
|
$responseMetadata->setYopVia($yopHttpResponse->getHeader(Headers::YOP_VIA));
|
||||||
$responseMetadata->setContentDisposition($yopHttpResponse->getHeader(Headers::CONTENT_DISPOSITION));
|
$responseMetadata->setContentDisposition($yopHttpResponse->getHeader(Headers::CONTENT_DISPOSITION));
|
||||||
@@ -126,7 +127,8 @@ abstract class BaseResponseUnMarshaller implements ResponseUnMarshaller
|
|||||||
if (! empty($content)) {
|
if (! empty($content)) {
|
||||||
try {
|
try {
|
||||||
$data = json_decode($content, true);
|
$data = json_decode($content, true);
|
||||||
dd($data);
|
\Log::channel('yeepay')->info('返回的错误信息', $data);
|
||||||
|
|
||||||
$yopServiceException = new YopServiceException($data['message'], $data['code']);
|
$yopServiceException = new YopServiceException($data['message'], $data['code']);
|
||||||
$yopServiceException->setRequestId($data['requestId']);
|
$yopServiceException->setRequestId($data['requestId']);
|
||||||
$yopServiceException->setSubErrorCode($data['subCode']);
|
$yopServiceException->setSubErrorCode($data['subCode']);
|
||||||
|
|||||||
@@ -157,9 +157,10 @@ class Account extends InitConfig
|
|||||||
->setReceiverAccountName($data['receiverAccountName'])
|
->setReceiverAccountName($data['receiverAccountName'])
|
||||||
->setBankAccountType($data['bankAccountType'] ?? 'DEBIT_CARD')
|
->setBankAccountType($data['bankAccountType'] ?? 'DEBIT_CARD')
|
||||||
->setNotifyUrl($data['notifyUrl']);
|
->setNotifyUrl($data['notifyUrl']);
|
||||||
|
|
||||||
$response = $this->client->payOrder($request);
|
$response = $this->client->payOrder($request);
|
||||||
$result = $response->getResult();
|
$result = $response->getResult();
|
||||||
Log::channel('yeepay')->info('PayOrder', $result);
|
Log::channel('yeepay')->info($result);
|
||||||
if ($result['returnCode'] == 'UA00000') {
|
if ($result['returnCode'] == 'UA00000') {
|
||||||
return $this->success($result);
|
return $this->success($result);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user