mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 18:10:10 +08:00
update 记录支付信息
This commit is contained in:
@@ -992,24 +992,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
* 订单退款处理逻辑
|
* 订单退款处理逻辑
|
||||||
*/
|
*/
|
||||||
private WechatPayRefundResponse refundForOrder(WeChatRefundDTO dto) {
|
private WechatPayRefundResponse refundForOrder(WeChatRefundDTO dto) {
|
||||||
// 查到orderCode对应的支付订单
|
|
||||||
// OrderBasicInfo orderInfo = this.getOrderInfoByOrderCode(dto.getOrderCode());
|
|
||||||
// // 校验订单
|
|
||||||
// if (Objects.isNull(orderInfo)) {
|
|
||||||
// logger.warn("orderCode:{}, 订单退款处理逻辑, 查询订单为空!", dto.getOrderCode());
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_NULL_ERROR);
|
|
||||||
// }
|
|
||||||
// // 判断退款金额,不能大于支付金额
|
|
||||||
// BigDecimal payAmount = orderInfo.getPayAmount();
|
|
||||||
// // BigDecimal orderAmount = orderInfo.getOrderAmount();
|
|
||||||
// // BigDecimal amountToBeRefunded = payAmount.subtract(orderAmount); // 可退金额
|
|
||||||
// BigDecimal amountToBeRefunded = dto.getRefundAmount(); // 可退金额
|
|
||||||
// logger.info("订单:{}, 支付金额:{}, 需退款金额:{}", dto.getOrderCode(), payAmount, amountToBeRefunded);
|
|
||||||
// if (dto.getRefundAmount().compareTo(amountToBeRefunded) > 0) {
|
|
||||||
// // 退款金额,大于可退金额 抛出异常
|
|
||||||
// logger.warn("退款金额:{},大于可退金额{}, 抛出异常", dto.getRefundAmount(), amountToBeRefunded);
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_REFUND_ORDER_AMOUNT_ERROR);
|
|
||||||
// }
|
|
||||||
// 查出来原来的支付信息
|
// 查出来原来的支付信息
|
||||||
WxpayCallbackRecord record = wxpayCallbackRecordService.selectByOrderCode(dto.getOrderCode());
|
WxpayCallbackRecord record = wxpayCallbackRecordService.selectByOrderCode(dto.getOrderCode());
|
||||||
if (Objects.isNull(record)) {
|
if (Objects.isNull(record)) {
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
// 转换附属参数
|
// 转换附属参数
|
||||||
PaymentScenarioDTO paymentScenarioDTO = JSONObject.parseObject(attach, PaymentScenarioDTO.class);
|
PaymentScenarioDTO paymentScenarioDTO = JSONObject.parseObject(attach, PaymentScenarioDTO.class);
|
||||||
String type = paymentScenarioDTO.getType();
|
String type = paymentScenarioDTO.getType();
|
||||||
|
//
|
||||||
BigDecimal amount = new BigDecimal(wechatPayNotifyResource.getAmount().getTotal());
|
BigDecimal amount = new BigDecimal(wechatPayNotifyResource.getAmount().getTotal());
|
||||||
if (StringUtils.equals(type, ScenarioEnum.ORDER.getValue())) {
|
if (StringUtils.equals(type, ScenarioEnum.ORDER.getValue())) {
|
||||||
// 1-订单支付
|
// 1-订单支付
|
||||||
@@ -225,7 +226,7 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
record.setAttach(wechatPayNotifyResource.getAttach());
|
record.setAttach(wechatPayNotifyResource.getAttach());
|
||||||
record.setSuccessTime(DateUtils.toLocalDateTime(wechatPayNotifyResource.getSuccess_time(), DateUtils.RFC3339));
|
record.setSuccessTime(DateUtils.toLocalDateTime(wechatPayNotifyResource.getSuccess_time(), DateUtils.RFC3339));
|
||||||
record.setPayerOpenId(wechatPayNotifyResource.getPayer().getOpenid());
|
record.setPayerOpenId(wechatPayNotifyResource.getPayer().getOpenid());
|
||||||
record.setPayerTotal(wechatPayNotifyResource.getAmount().getPayer_total());
|
record.setPayerTotal(wechatPayNotifyResource.getAmount().getTotal());
|
||||||
wxpayCallbackRecordService.insertSelective(record);
|
wxpayCallbackRecordService.insertSelective(record);
|
||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.jsowell.wxpay.response;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class WechatPayNotifyResource {
|
public class WechatPayNotifyResource {
|
||||||
|
|
||||||
@@ -79,6 +81,11 @@ public class WechatPayNotifyResource {
|
|||||||
*/
|
*/
|
||||||
private Amount amount;
|
private Amount amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠功能,享受优惠时返回该字段。
|
||||||
|
*/
|
||||||
|
private List<Promotion> promotion_detail;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Payer {
|
public static class Payer {
|
||||||
/**
|
/**
|
||||||
@@ -109,4 +116,28 @@ public class WechatPayNotifyResource {
|
|||||||
*/
|
*/
|
||||||
private String payer_currency;
|
private String payer_currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Promotion{
|
||||||
|
// 券ID
|
||||||
|
private String coupon_id;
|
||||||
|
// 优惠名称
|
||||||
|
private String name;
|
||||||
|
// 优惠范围 GLOBAL:全场代金券 SINGLE:单品优惠
|
||||||
|
private String scope;
|
||||||
|
//优惠类型 CASH:充值型代金券 NOCASH:免充值型代金券
|
||||||
|
private String type;
|
||||||
|
// 优惠券面额
|
||||||
|
private String amount;
|
||||||
|
// 活动ID
|
||||||
|
private String stock_id;
|
||||||
|
// 微信出资
|
||||||
|
private String wechatpay_contribute;
|
||||||
|
// 商户出资
|
||||||
|
private String merchant_contribute;
|
||||||
|
// 其他出资
|
||||||
|
private String other_contribute;
|
||||||
|
// 优惠币种
|
||||||
|
private String currency;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user