feat : pay callback
This commit is contained in:
@@ -11,6 +11,7 @@ use Hyperf\HttpServer\Contract\RequestInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Yansongda\Artful\Exception\InvalidParamsException;
|
||||
use Yansongda\Artful\Rocket;
|
||||
use Yansongda\HyperfPay\Pay;
|
||||
use Yansongda\Supports\Collection;
|
||||
@@ -76,30 +77,30 @@ abstract class WxJsRechargeBaseService implements ThirdPayInterface
|
||||
// abstract public function setMchId();
|
||||
|
||||
|
||||
// /**
|
||||
// * 获取返回数据
|
||||
// * @return void
|
||||
// * @throws ContainerExceptionInterface
|
||||
// * @throws NotFoundExceptionInterface
|
||||
// * @throws ContainerException
|
||||
// * @throws InvalidParamsException
|
||||
// */
|
||||
// public function getWechatData(): void
|
||||
// {
|
||||
// $params = $this->request->all();
|
||||
// $this->log->callbackLog(__CLASS__.'微信支付回调'.json_encode($params));
|
||||
//
|
||||
// $this->setConfig();
|
||||
// $result = $this->pay->wechat($this->config)->callback($params);
|
||||
// $this->callbackData = $result['resource']['ciphertext'];
|
||||
//
|
||||
// if (empty($this->callbackData)) {
|
||||
// $this->log->error(__CLASS__.'获取回调失败'.json_encode($params));
|
||||
// throw new ErrException('获取回调失败');
|
||||
// }
|
||||
//
|
||||
// $this->log->info(__CLASS__.'微信支付完成回调'.json_encode($this->callbackData));
|
||||
// }
|
||||
/**
|
||||
* 获取返回数据
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface|InvalidParamsException
|
||||
*/
|
||||
public function getWechatData(): void
|
||||
{
|
||||
$this->setConfig();
|
||||
|
||||
try {
|
||||
$this->callbackData = $this->ysdPay->wechat($this->config)->callback($this->request)->toArray()['resource']['ciphertext'];
|
||||
}catch (Exception $e) {
|
||||
$this->log->debug(__CLASS__.'微信支付回调解密失败'.json_encode($e->getMessage()));
|
||||
throw new ErrException('微信支付回调解密失败');
|
||||
}
|
||||
|
||||
if (!empty($this->callbackData)) {
|
||||
$this->log->debug(__CLASS__.'获取回调失败'.json_encode($this->request));
|
||||
throw new ErrException('获取回调失败');
|
||||
}
|
||||
|
||||
$this->log->info(__CLASS__.'微信支付完成回调'.json_encode($this->callbackData));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user