| | |
| | | package com.doumee.core.wx; |
| | | package com.doumee.config.wx; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.ID; |
| | | import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest; |
| | | import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest; |
| | | import com.github.binarywang.wxpay.bean.result.WxPayRefundResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 微信小程序-公共方法 |
| | |
| | | * refundPrice;退款金额 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public static String wxRefund(String orderNo, BigDecimal totalPrice, BigDecimal refundPrice) { |
| | | public String wxRefund(String orderNo, Long totalPrice, Long refundPrice) { |
| | | try { |
| | | // 发送退款请求 |
| | | String refNum = ID.nextGUID(); |
| | | WxPayRefundRequest request = new WxPayRefundRequest(); |
| | | request.setOutTradeNo(orderNo); |
| | | request.setOutRefundNo(refNum); |
| | | // request.setTotalFee(2); |
| | | // request.setRefundFee(1); |
| | | request.setTotalFee(1);//BaseWxPayRequest.yuanToFen(totalPrice.toString())); |
| | | request.setRefundFee(1);//BaseWxPayRequest.yuanToFen(refundPrice.toString())); |
| | | request.setTotalFee(totalPrice.intValue()); |
| | | request.setRefundFee(refundPrice.intValue()); |
| | | WxPayRefundResult response = WxMiniConfig.wxPayService.refund(request); |
| | | if ("SUCCESS".equals(response.getReturnCode()) && "SUCCESS".equals(response.getResultCode())) { |
| | | return refNum; |