w7corp / easywechat

📦 一个 PHP 微信 SDK
https://easywechat.com
MIT License
10.29k stars 2.41k forks source link

EasyWeChat\Pay\Application getClient()在get的时候未正确处理withMchId() #2833

Closed lyt8384 closed 3 months ago

lyt8384 commented 3 months ago

我用的环境

问题及现象

按照文档预置参数查询订单时没有正确处理

$client->withMchId()->get('v3/pay/transactions/id/1217752501201407033233368018');

响应内容为输入源“/uri_template/mchid”映射到字段“直连商户号”必填性规则校验失败,此字段为必填项 经过调试发现未正确附加参数mchidquery

问题1:

配置参数为mch_id https://github.com/w7corp/easywechat/blob/595fb5a580156d9b974f125c1bdc87e76a638f83/src/Kernel/HttpClient/RequestWithPresets.php#L161 处理withMchId的时候可以正确读取处理成mch_id,但是正确的query应该是mchid,所以应该对withMchId特殊处理还是文档应调整为withMchIdAs("mchid")好一点?

问题2:

https://github.com/w7corp/easywechat/blob/595fb5a580156d9b974f125c1bdc87e76a638f83/src/Pay/Client.php#L102 看起来Pay的request是单独处理的,只处理了prependHeaders,并未处理prependParts,也没有像通用的请求那样处理options https://github.com/w7corp/easywechat/blob/595fb5a580156d9b974f125c1bdc87e76a638f83/src/Kernel/HttpClient/AccessTokenAwareClient.php#L61 BUG?

overtrue commented 3 months ago

已修复没有合并预设问题,并更新了文档,感谢反馈!