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

关于订单支付 #6

Open
imdtf opened this issue May 13, 2022 · 0 comments
Open

关于订单支付 #6

imdtf opened this issue May 13, 2022 · 0 comments

Comments

@imdtf
Copy link

imdtf commented May 13, 2022

PaymentApplicationService中支付订单的逻辑如下,先把订单状态改为支付,再去扣减钱包的钱
这个接口是由"/restful/pay"触发,也就是第三方支付支付成功的前提下才会执行如下逻辑
那么有如下两个问题:
1、第三方支付成功了,为什么还要有这个钱包的概念。
2、如下代码的执行顺序是把订单改为支付成功,再去扣减钱包的余额,但是此时余额不足的情况下,订单状态依然是支付成功的。
public void accomplishPayment(Integer accountId, String payId) {
// 订单从冻结状态变为派送状态,扣减库存
double price = paymentService.accomplish(payId);
// 扣减货款
walletService.decrease(accountId, price);
// 支付成功的清除缓存
settlementCache.evict(payId);
}

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

No branches or pull requests

1 participant