update 记录支付信息

This commit is contained in:
2023-04-23 11:22:28 +08:00
parent d9e138ba5d
commit e40db7e32b
3 changed files with 33 additions and 19 deletions

View File

@@ -992,24 +992,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
* 订单退款处理逻辑
*/
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());
if (Objects.isNull(record)) {

View File

@@ -194,6 +194,7 @@ public class WechatPayServiceImpl implements WechatPayService {
// 转换附属参数
PaymentScenarioDTO paymentScenarioDTO = JSONObject.parseObject(attach, PaymentScenarioDTO.class);
String type = paymentScenarioDTO.getType();
//
BigDecimal amount = new BigDecimal(wechatPayNotifyResource.getAmount().getTotal());
if (StringUtils.equals(type, ScenarioEnum.ORDER.getValue())) {
// 1-订单支付
@@ -225,7 +226,7 @@ public class WechatPayServiceImpl implements WechatPayService {
record.setAttach(wechatPayNotifyResource.getAttach());
record.setSuccessTime(DateUtils.toLocalDateTime(wechatPayNotifyResource.getSuccess_time(), DateUtils.RFC3339));
record.setPayerOpenId(wechatPayNotifyResource.getPayer().getOpenid());
record.setPayerTotal(wechatPayNotifyResource.getAmount().getPayer_total());
record.setPayerTotal(wechatPayNotifyResource.getAmount().getTotal());
wxpayCallbackRecordService.insertSelective(record);
}
return resultMap;

View File

@@ -2,6 +2,8 @@ package com.jsowell.wxpay.response;
import lombok.Data;
import java.util.List;
@Data
public class WechatPayNotifyResource {
@@ -79,6 +81,11 @@ public class WechatPayNotifyResource {
*/
private Amount amount;
/**
* 优惠功能,享受优惠时返回该字段。
*/
private List<Promotion> promotion_detail;
@Data
public static class Payer {
/**
@@ -109,4 +116,28 @@ public class WechatPayNotifyResource {
*/
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;
}
}