Compare commits

..

No commits in common. "9bef9b0cc3afa38ecc585071179de534936876f1" and "e1aaf55a53bbc422495c4665da46a8dd1da3d1fd" have entirely different histories.

1 changed files with 1 additions and 8 deletions

View File

@ -4,12 +4,9 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration;
import cn.iocoder.yudao.framework.pay.properties.WxPayProperties;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import cn.iocoder.yudao.module.shop.utils.OrderUtil;
import cn.iocoder.yudao.module.system.api.tenant.TenantApi;
import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO;
import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
@ -39,20 +36,16 @@ public class WxPayStrategy implements IPayStrategy{
private WxPayOneAutoConfiguration wxPayOneAutoConfiguration;
@Autowired
private WxPayProperties payProperties;
@Autowired
private TenantApi tenantApi;
@Override
public InitOrderResponse pay(RechargeOrderDO orderDO, HttpServletRequest servletRequest,String openid) {
Long requiredTenantId = TenantContextHolder.getRequiredTenantId();
TenantDTO tenant = tenantApi.getTenant(requiredTenantId);
InitOrderResponse response = new InitOrderResponse();
WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService();
Assert.notNull(wxPayService, "获取微信支付配置失败!");
WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request();
int sum = orderDO.getPayPrice().multiply(new BigDecimal("100")).intValue();
wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum));
wxPayRequest.setDescription(tenant.getName());
wxPayRequest.setDescription("会员充值");
wxPayRequest.setOutTradeNo(orderDO.getOrderId());
wxPayRequest.setNotifyUrl(payProperties.getNotifyUrl());
wxPayRequest.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(openid));