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