$rocket]); $rocket->setRadar($this->getRequest($rocket)); Logger::info('[alipay][RadarPlugin] 插件装载完毕', ['rocket' => $rocket]); return $next($rocket); } /** * @throws \Yansongda\Pay\Exception\ContainerException * @throws \Yansongda\Pay\Exception\ServiceNotFoundException */ protected function getRequest(Rocket $rocket): RequestInterface { return new Request( $this->getMethod($rocket), $this->getUrl($rocket), $this->getHeaders(), $this->getBody($rocket), ); } protected function getMethod(Rocket $rocket): string { return strtoupper($rocket->getParams()['_method'] ?? 'POST'); } /** * @throws \Yansongda\Pay\Exception\ContainerException * @throws \Yansongda\Pay\Exception\ServiceNotFoundException */ protected function getUrl(Rocket $rocket): string { $config = get_alipay_config($rocket->getParams()); return Alipay::URL[$config['mode'] ?? Pay::MODE_NORMAL]; } protected function getHeaders(): array { return [ 'Content-Type' => 'application/x-www-form-urlencoded', ]; } protected function getBody(Rocket $rocket): string { return $rocket->getPayload()->query(); } }