Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
标题
fix(alipay): 增强支付宝回调与授权回调参数校验,修复 state 解析与支付回调误放行问题
我遇到的业务场景bug:
上周我在帮一个 ISV 下线验收支付宝代扣能力时,碰到的问题。
有个商户在移动端连续发起了两笔订单,订单回调偶尔会出现看起来正常、但内容对不上的消息,即支付宝异步通知虽然能通过验签,但 out_trade_no、total_amount、app_id 有可能不是当前这笔订单上下文里的值(这里聊过后知道是配置切换导致的问题)。原逻辑只验签就继续处理,结果系统会把这笔“看似合法”的回调按成功来回写订单状态,造成账务对账和用户支付状态出现偏差。
业务场景 :
Bug :
解决方案 :
解决后的结果 :
支付宝异步回调这边,在验签后会继续校验 out_trade_no、total_amount、app_id、seller_id,只要有任何不一致就直接拒绝,不会误把这笔回调当成这笔订单确认成功。