This commit is contained in:
yansongda 2021-06-06 17:44:22 +08:00
parent 342493c5a5
commit a976e0870c
3 changed files with 8 additions and 3 deletions

View File

@ -13,7 +13,8 @@ use Yansongda\Supports\Str;
if (!function_exists('should_http_request')) {
function should_http_request(Rocket $rocket): bool
{
return !in_array(NoHttpRequestParser::class, class_parents($rocket->getDirection()));
return NoHttpRequestParser::class !== $rocket->getDirection() &&
!in_array(NoHttpRequestParser::class, class_parents($rocket->getDirection()));
}
}

View File

@ -7,6 +7,7 @@ namespace Yansongda\Pay\Plugin\Alipay;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\InvalidResponseException;
use Yansongda\Pay\Parser\NoHttpRequestParser;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
@ -23,7 +24,7 @@ class CallbackPlugin implements PluginInterface
{
$this->filterPayload($rocket);
if ($rocket->getParams()['sign'] ?? false) {
if (!($rocket->getParams()['sign'] ?? false)) {
throw new InvalidResponseException(InvalidResponseException::INVALID_RESPONSE_SIGN, '', $rocket->getParams());
}
@ -35,6 +36,9 @@ class CallbackPlugin implements PluginInterface
throw new InvalidResponseException(InvalidResponseException::INVALID_RESPONSE_SIGN, '', $rocket->getParams());
}
$rocket->setDirection(NoHttpRequestParser::class)
->setDestination($rocket->getPayload());
return $next($rocket);
}

View File

@ -121,7 +121,7 @@ class Alipay extends AbstractProvider
$response = $this->getCallbackParams($contents);
return $this->pay(
[CallbackPlugin::class], array_merge($response, $config ?? [])
[CallbackPlugin::class], $response->merge($config)->all()
);
}