| | |
| | | package com.doumee.core.wx; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.ID; |
| | | import com.doumee.dao.business.ActionLogMapper; |
| | | import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest; |
| | | import com.github.binarywang.wxpay.bean.request.WxPayDownloadBillRequest; |
| | | import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest; |
| | | import com.github.binarywang.wxpay.bean.result.WxPayBillResult; |
| | | import com.github.binarywang.wxpay.bean.result.WxPayRefundResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.yaml.snakeyaml.scanner.Constant; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.security.KeyFactory; |
| | | import java.security.Signature; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.util.Base64; |
| | | |
| | | /** |
| | | * 微信小程序-公共方法 |
| | |
| | | WxPayRefundRequest request = new WxPayRefundRequest(); |
| | | request.setOutTradeNo(orderNo); |
| | | request.setOutRefundNo(refNum); |
| | | // request.setTotalFee(2); |
| | | // request.setRefundFee(1); |
| | | request.setTotalFee(BaseWxPayRequest.yuanToFen(totalPrice.toString())); |
| | | request.setRefundFee(BaseWxPayRequest.yuanToFen(refundPrice.toString())); |
| | | WxPayRefundResult response = WxMiniConfig.wxPayService.refund(request); |
| | | if ("SUCCESS".equals(response.getReturnCode()) && "SUCCESS".equals(response.getResultCode())) { |
| | | return refNum; |
| | | } else { |
| | | } else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),response.getErrCode() + response.getErrCodeDes()); |
| | | } |
| | | } catch (WxPayException e) { |