跳过微信支付

This commit is contained in:
Bunny 2024-01-10 16:38:06 +08:00
parent 9ab639f81b
commit 18aa86fc11
2 changed files with 7 additions and 4 deletions

View File

@ -46,6 +46,8 @@ public class OrderController {
public Result<OrderPaymentVO> payment(@RequestBody OrdersPaymentDTO ordersPaymentDTO) throws Exception {
log.info("订单支付:{}", ordersPaymentDTO);
OrderPaymentVO orderPaymentVO = orderService.payment(ordersPaymentDTO);
// TODO 跳过微信支付
orderService.paySuccess(ordersPaymentDTO.getOrderNumber());
log.info("生成预支付交易单:{}", orderPaymentVO);
return Result.success(orderPaymentVO);
}

View File

@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
@ -107,12 +106,14 @@ public class OrderServiceImpl implements OrderService {
Long userId = BaseContext.getCurrentId();
User user = userMapper.getById(userId);
// 调用微信支付接口生成预支付交易单
JSONObject jsonObject = weChatPayUtil.pay(ordersPaymentDTO.getOrderNumber(), // 商户订单号
// TODO 跳过微信支付 调用微信支付接口生成预支付交易单
/* JSONObject jsonObject = weChatPayUtil.pay(ordersPaymentDTO.getOrderNumber(), // 商户订单号
new BigDecimal("0.01"), // 支付金额单位
"苍穹外卖订单", // 商品描述
user.getOpenid() // 微信用户的openid
);
); */
// TODO 跳过微信支付
JSONObject jsonObject = new JSONObject();
if (jsonObject.getString("code") != null && jsonObject.getString("code").equals("ORDERPAID")) {
throw new OrderBusinessException("该订单已支付");