yansongda / pay

可能是我用过的最优雅的 Alipay/WeChat/Douyin/Unipay/江苏银行 的支付 SDK 扩展包了
http://pay.yansongda.cn
MIT License
5.06k stars 1.04k forks source link

3.0版本调用微信关闭订单方法抛异常 #475

Closed javalaw closed 3 years ago

javalaw commented 3 years ago

包版本号

3.0.0-rc2

问题描述

调用微信关闭订单方法抛异常

你的代码

 Pay::wechat()->close($order->order_no);

报错详情

Call to undefined method GuzzleHttp\Psr7\Response::get() {"exception":"[object] (Error(code: 0): Call to undefined method GuzzleHttp\Psr7\Response::get() at /data/wwwroot/xxx/releases/450/vendor/yansongda/pay/src/Plugin/Wechat/LaunchPlugin.php:49)

sdk 日志

2021-08-18T17:28:04.240761+08:00 > yansongda.pay.INFO > [wechat][LaunchPlugin] 插件开始装载 {"rocket":{"Yansongda\Pay\Rocket":{"radar":{"url":"https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/订单号/close","method":"POST","headers":{"Host":["api.mch.weixin.qq.com"],"Accept":["application/json, text/plain, application/x-gzip"],"User-Agent":["yansongda/pay-v3.0.0"],"Content-Type":["application/json; charset=utf-8"],"Authorization":["WECHATPAY2-SHA256-RSA2048 mchid=\"商户号\",nonce_str=\"nonce\",timestamp=\"\",serial_no=\"\",signature=\"\""]},"body":""},"params":{"out_trade_no":""},"payload":{"mchid":""},"direction":"Yansongda\Pay\Parser\OriginResponseParser","destination":{},"destination_origin":{}}}}

nginx/apache 日志

涉及到 异步通知、同步通知 的问题,请贴出来

yansongda commented 3 years ago

订单实际上应该已经关闭成功了对吧?

yansongda commented 3 years ago

麻烦试下最新 dev-master 的代码

或直接 composer update 即可,使用现在最新的 v3.0.1 版本

感谢支持

javalaw commented 3 years ago

3.0.1并没有完全解决这个问题,更新之后报错如下:

Yansongda\Pay\Provider\Wechat::close(): Return value must be of type Yansongda\Supports\Collection, GuzzleHttp\Psr7\Response returned {"exception":"[object] (TypeError(code: 0): Yansongda\\Pay\\Provider\\Wechat::close(): Return value must be of type Yansongda\\Supports\\Collection, GuzzleHttp\\Psr7\\Response returned at /data/wwwroot/xxxxxx/releases/456/vendor/yansongda/pay/src/Provider/Wechat.php:99)

close()方法声明的返回类型是Collection,而实际上返回的是一个Response对象

yansongda commented 3 years ago

我加下测试用例

麻烦稍等

yansongda commented 3 years ago

麻烦再试下 @javalaw

javalaw commented 3 years ago

麻烦再试下 @javalaw

3.0.2 现在已经可以了。感谢。