|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.exception.BusinessException;
|
|
|
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
|
|
|
import com.yihu.jw.care.service.pay.PayService;
|
|
|
import com.yihu.jw.care.util.WxpayUtil;
|
|
|
import com.yihu.jw.care.util.XMLUtil;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
|
|
@ -28,6 +29,8 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.SortedMap;
|
|
|
import java.util.TreeMap;
|
|
|
|
|
|
/**
|
|
|
* Created with IntelliJ IDEA.
|
|
@ -158,6 +161,19 @@ public class PayEndpoint extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "open/testPay")
|
|
|
@ApiOperation(value = "测试wap支付")
|
|
|
public Envelop testPay() {
|
|
|
try{
|
|
|
SortedMap<String, String> reqMap = new TreeMap<>();
|
|
|
String s = WxpayUtil.createUnifiedorder(reqMap);
|
|
|
System.out.println("测试wap支付="+s);
|
|
|
return Envelop.getSuccess(s);
|
|
|
}catch (Exception e){
|
|
|
return failedObjEnvelopException2(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "applyRefund")
|
|
|
@ApiOperation(value = "申请退款")
|
|
|
public Envelop applyRefund(
|
|
@ -228,9 +244,9 @@ public class PayEndpoint extends EnvelopRestEndpoint {
|
|
|
// orderDO.setResponseParam(paramsJson);
|
|
|
// 判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
|
|
|
String totalFee = params.get("total_fee");
|
|
|
BigDecimal payTotalFee = new BigDecimal(totalFee).setScale(2).divide(new BigDecimal(100), BigDecimal.ROUND_HALF_EVEN);
|
|
|
BigDecimal payTotalFee = new BigDecimal(totalFee);
|
|
|
log.info("【微信支付】支付金额:{}", payTotalFee);
|
|
|
if (new BigDecimal(orderDO.getPayPrice()).compareTo(payTotalFee) != 0) {
|
|
|
if (new BigDecimal(orderDO.getPayPrice()*100).compareTo(payTotalFee) != 0) {
|
|
|
//通知资金与实际资金不对称,可能是攻击行为!
|
|
|
orderDO.setRematk("通知资金与实际资金不对称,可能是攻击行为!");
|
|
|
businessOrderDao.save(orderDO);
|
|
@ -251,6 +267,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 微信支付退款回调
|
|
|
*
|