Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

异步通知验签失败 #180

Closed
hainuo opened this issue Nov 2, 2018 · 4 comments
Closed

异步通知验签失败 #180

hainuo opened this issue Nov 2, 2018 · 4 comments
Labels

Comments

@hainuo
Copy link

hainuo commented Nov 2, 2018

包版本号

dev-master composer 安装的

问题描述

异步通知验签失败

代码

涉及到 异步通知、同步通知 的问题,请将 nginx/Apache 的相关日志贴出来

日志如下
2018-11-02 14:29:05 > INFO > Received Alipay Request {"gmt_create":"2018-11-02 14:05:02","charset":"utf-8","seller_email":"18641183620","subject":"test subject-测试订单","sign":"DILLR4Vmd8u5+eYoC5v09RgTIvM9TEQDmWw6/2w6eVkgyT2jXbnELI/L9Mh6zRfbzIIovIF+qIOZRkVOeAFg/GFh3yMw/cssifPCvjzxZ/s9kcuIFLmpLYYGjx3R+VGIhSuF8FuJb02BlOh4fmUE8w/lKGhrP1Ck8Wcx2bcRhmper/Sw/NPTCpbrCirOqtPzpSdPkO4yoVXkAL0/yUM7sDJBElRRoSpj4+WdWDQrEM19JmHwBkvMybW3Vw4NrZRVX3x2OaNyhycoCgZ15bCQ9WTfd2UnpdUdnTAuxvpiO7i180dS7WdzhWFkLq4FZc722G32uxYZTTYj2McVvQZ2Zw==","buyer_id":"2088102181189867","invoice_amount":"0.01","notify_id":"2018110200222140503089861023731266","fund_bill_list":"[{"amount":"0.01","fundChannel":"ALIPAYACCOUNT"}]","notify_type":"trade_status_sync","trade_status":"TRADE_SUCCESS","receipt_amount":"0.01","app_id":"2018102861925105","buyer_pay_amount":"0.01","sign_type":"RSA2","seller_id":"2088722277462557","gmt_payment":"2018-11-02 14:05:03","notify_time":"2018-11-02 14:29:04","passback_params":"%7B%22user_id%22%3A1%2C%22fuwu_id%22%3A2%7D","version":"1.0","out_trade_no":"1541138649","total_amount":"0.01","trade_no":"2018110222001489861008118997","auth_app_id":"2018102861925105","buyer_logon_id":"hai***@vip.qq.com","point_amount":"0.00"}

2018-11-02 14:29:05 > DEBUG > Alipay Generate Sign Content Before Trim [{"app_id":"2018102861925105","auth_app_id":"2018102861925105","buyer_id":"2088102181189867","buyer_logon_id":"hai***@vip.qq.com","buyer_pay_amount":"0.01","charset":"utf-8","fund_bill_list":"[{"amount":"0.01","fundChannel":"ALIPAYACCOUNT"}]","gmt_create":"2018-11-02 14:05:02","gmt_payment":"2018-11-02 14:05:03","invoice_amount":"0.01","notify_id":"2018110200222140503089861023731266","notify_time":"2018-11-02 14:29:04","notify_type":"trade_status_sync","out_trade_no":"1541138649","passback_params":"%7B%22user_id%22%3A1%2C%22fuwu_id%22%3A2%7D","point_amount":"0.00","receipt_amount":"0.01","seller_email":"18641183620","seller_id":"2088722277462557","sign":"DILLR4Vmd8u5+eYoC5v09RgTIvM9TEQDmWw6/2w6eVkgyT2jXbnELI/L9Mh6zRfbzIIovIF+qIOZRkVOeAFg/GFh3yMw/cssifPCvjzxZ/s9kcuIFLmpLYYGjx3R+VGIhSuF8FuJb02BlOh4fmUE8w/lKGhrP1Ck8Wcx2bcRhmper/Sw/NPTCpbrCirOqtPzpSdPkO4yoVXkAL0/yUM7sDJBElRRoSpj4+WdWDQrEM19JmHwBkvMybW3Vw4NrZRVX3x2OaNyhycoCgZ15bCQ9WTfd2UnpdUdnTAuxvpiO7i180dS7WdzhWFkLq4FZc722G32uxYZTTYj2McVvQZ2Zw==","sign_type":"RSA2","subject":"test subject-测试订单","total_amount":"0.01","trade_no":"2018110222001489861008118997","trade_status":"TRADE_SUCCESS","version":"1.0"},"app_id=2018102861925105&auth_app_id=2018102861925105&buyer_id=2088102181189867&buyer_logon_id=hai***@vip.qq.com&buyer_pay_amount=0.01&charset=utf-8&fund_bill_list=[{"amount":"0.01","fundChannel":"ALIPAYACCOUNT"}]&gmt_create=2018-11-02 14:05:02&gmt_payment=2018-11-02 14:05:03&invoice_amount=0.01&notify_id=2018110200222140503089861023731266&notify_time=2018-11-02 14:29:04&notify_type=trade_status_sync&out_trade_no=1541138649&passback_params=%7B%22user_id%22%3A1%2C%22fuwu_id%22%3A2%7D&point_amount=0.00&receipt_amount=0.01&seller_email=18641183620&seller_id=2088722277462557&subject=test subject-测试订单&total_amount=0.01&trade_no=2018110222001489861008118997&trade_status=TRADE_SUCCESS&version=1.0&"]

2018-11-02 14:29:05 > WARNING > Alipay Sign Verify FAILED {"gmt_create":"2018-11-02 14:05:02","charset":"utf-8","seller_email":"18641183620","subject":"test subject-测试订单","sign":"DILLR4Vmd8u5+eYoC5v09RgTIvM9TEQDmWw6/2w6eVkgyT2jXbnELI/L9Mh6zRfbzIIovIF+qIOZRkVOeAFg/GFh3yMw/cssifPCvjzxZ/s9kcuIFLmpLYYGjx3R+VGIhSuF8FuJb02BlOh4fmUE8w/lKGhrP1Ck8Wcx2bcRhmper/Sw/NPTCpbrCirOqtPzpSdPkO4yoVXkAL0/yUM7sDJBElRRoSpj4+WdWDQrEM19JmHwBkvMybW3Vw4NrZRVX3x2OaNyhycoCgZ15bCQ9WTfd2UnpdUdnTAuxvpiO7i180dS7WdzhWFkLq4FZc722G32uxYZTTYj2McVvQZ2Zw==","buyer_id":"2088102181189867","invoice_amount":"0.01","notify_id":"2018110200222140503089861023731266","fund_bill_list":"[{"amount":"0.01","fundChannel":"ALIPAYACCOUNT"}]","notify_type":"trade_status_sync","trade_status":"TRADE_SUCCESS","receipt_amount":"0.01","app_id":"2018102861925105","buyer_pay_amount":"0.01","sign_type":"RSA2","seller_id":"2088722277462557","gmt_payment":"2018-11-02 14:05:03","notify_time":"2018-11-02 14:29:04","passback_params":"%7B%22user_id%22%3A1%2C%22fuwu_id%22%3A2%7D","version":"1.0","out_trade_no":"1541138649","total_amount":"0.01","trade_no":"2018110222001489861008118997","auth_app_id":"2018102861925105","buyer_logon_id":"hai***@vip.qq.com","point_amount":"0.00"}

@hainuo
Copy link
Author

hainuo commented Nov 2, 2018

经过多处排查发现这样的问题
在我的机器上 会出现这样的情况 这个情况出现在字段 fund_bill_list 这种 json 打包的后的数据
他的"会被处理成&qout;这种字符串导致验签失败 目前 已经在 支付宝 RSA 签名验签工具中验签通过。

@hainuo
Copy link
Author

hainuo commented Nov 2, 2018

        $data['fund_bill_list']=htmlspecialchars_decode($data['fund_bill_list']);
        $result = $alipay->verify($data);

手动传入经过htmlspecialchars_decode处理后的参数 不在报错

@yansongda 这里是不是要做下处理?

@yansongda
Copy link
Owner

感谢支持!

验证后会尽快修复,欢迎 PR !

@yansongda yansongda added the bug label Dec 7, 2018
@yansongda
Copy link
Owner

v2.6.0-beta.1 及以后版本已修复

感谢您的支持

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants