diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 670f1101..5037b9ef 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -1460,6 +1460,7 @@ ho.act_price as actPrice, ho.act_power_price as actPowerPrice, ho.act_service_price as actServicePrice, + ho.act_total_price as actTotalPrice, ho.internet_commission as internetCommission, ho.internet_svc_commission as internetSvcCommission, ho.internet_degree_commission as internetDegreeCommission, diff --git a/xhpc-modules/xhpc-payment/pom.xml b/xhpc-modules/xhpc-payment/pom.xml index c3504339..d5b8b3e6 100644 --- a/xhpc-modules/xhpc-payment/pom.xml +++ b/xhpc-modules/xhpc-payment/pom.xml @@ -90,6 +90,13 @@ okhttp 3.14.9 + + + com.github.wechatpay-apiv3 + wechatpay-java + 0.2.17 + + diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOriginalOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOriginalOrderService.java index 08edab85..99dd5dc4 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOriginalOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOriginalOrderService.java @@ -3,6 +3,7 @@ package com.xhpc.payment.service; import com.xhpc.common.core.domain.R; import com.xhpc.common.domain.XhpcRefundOrder; import com.xhpc.payment.domain.XhpcRefundAudit; +import com.xhpc.payment.util.TransferBatchNotifyData; import java.math.BigDecimal; import java.util.Map; @@ -22,6 +23,10 @@ public interface IXhpcRefundOriginalOrderService { //微信回调处理(退款) void updateXhpcRefundOriginalOrder(Map reqInfo); + + //微信回调处理V3(退款) + void updateXhpcRefundOriginalOrderV3(TransferBatchNotifyData notifyData); + void updateXhpcRefundOrder(XhpcRefundOrder refundOrder, BigDecimal refundFee, Integer type,Integer status); //新增退款订单 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/util/TransferBatchCallbackNotification.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/util/TransferBatchCallbackNotification.java new file mode 100644 index 00000000..c4c93433 --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/util/TransferBatchCallbackNotification.java @@ -0,0 +1,79 @@ +package com.xhpc.payment.util; + +import com.google.gson.annotations.SerializedName; + +/** + * 微信支付回调通知外层报文 + * 对应 resource 加密前的原始 JSON + */ +public class TransferBatchCallbackNotification { + @SerializedName("id") + private String id; + + @SerializedName("create_time") + private String createTime; + + @SerializedName("resource_type") + private String resourceType; + + @SerializedName("event_type") + private String eventType; + + @SerializedName("summary") + private String summary; + + @SerializedName("resource") + private Resource resource; + + // ----- Getters and Setters ----- + public String getId() { return id; } + public void setId(String id) { this.id = id; } + + public String getCreateTime() { return createTime; } + public void setCreateTime(String createTime) { this.createTime = createTime; } + + public String getResourceType() { return resourceType; } + public void setResourceType(String resourceType) { this.resourceType = resourceType; } + + public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } + + public String getSummary() { return summary; } + public void setSummary(String summary) { this.summary = summary; } + + public Resource getResource() { return resource; } + public void setResource(Resource resource) { this.resource = resource; } + + public static class Resource { + @SerializedName("original_type") + private String originalType; + + @SerializedName("algorithm") + private String algorithm; + + @SerializedName("ciphertext") + private String ciphertext; + + @SerializedName("associated_data") + private String associatedData; + + @SerializedName("nonce") + private String nonce; + + // ----- Getters and Setters ----- + public String getOriginalType() { return originalType; } + public void setOriginalType(String originalType) { this.originalType = originalType; } + + public String getAlgorithm() { return algorithm; } + public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } + + public String getCiphertext() { return ciphertext; } + public void setCiphertext(String ciphertext) { this.ciphertext = ciphertext; } + + public String getAssociatedData() { return associatedData; } + public void setAssociatedData(String associatedData) { this.associatedData = associatedData; } + + public String getNonce() { return nonce; } + public void setNonce(String nonce) { this.nonce = nonce; } + } +} diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/util/TransferBatchNotifyData.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/util/TransferBatchNotifyData.java new file mode 100644 index 00000000..973db38f --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/util/TransferBatchNotifyData.java @@ -0,0 +1,93 @@ +package com.xhpc.payment.util; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +/** + * 微信商家转账批次回调通知数据 + * 文档:https://pay.weixin.qq.com/doc/v3/merchant/4012071382 + */ +public class TransferBatchNotifyData { + @SerializedName("mchid") + private String mchid; + + @SerializedName("out_batch_no") + private String outBatchNo; + + @SerializedName("batch_id") + private String batchId; + + @SerializedName("batch_status") + private String batchStatus; // FINISHED, CLOSED + + @SerializedName("total_num") + private Integer totalNum; + + @SerializedName("total_amount") + private Long totalAmount; // 单位:分 + + @SerializedName("transfer_detail_list") + private List transferDetailList; + + // ----- Getter/Setter ----- + public String getMchid() { return mchid; } + public void setMchid(String mchid) { this.mchid = mchid; } + + public String getOutBatchNo() { return outBatchNo; } + public void setOutBatchNo(String outBatchNo) { this.outBatchNo = outBatchNo; } + + public String getBatchId() { return batchId; } + public void setBatchId(String batchId) { this.batchId = batchId; } + + public String getBatchStatus() { return batchStatus; } + public void setBatchStatus(String batchStatus) { this.batchStatus = batchStatus; } + + public Integer getTotalNum() { return totalNum; } + public void setTotalNum(Integer totalNum) { this.totalNum = totalNum; } + + public Long getTotalAmount() { return totalAmount; } + public void setTotalAmount(Long totalAmount) { this.totalAmount = totalAmount; } + + public List getTransferDetailList() { return transferDetailList; } + public void setTransferDetailList(List transferDetailList) { this.transferDetailList = transferDetailList; } + + public static class TransferDetail { + @SerializedName("detail_id") + private String detailId; + + @SerializedName("out_detail_no") + private String outDetailNo; + + @SerializedName("detail_status") + private String detailStatus; // SUCCESS, FAIL + + @SerializedName("transfer_amount") + private Long transferAmount; + + @SerializedName("openid") + private String openid; + + @SerializedName("fail_reason") + private String failReason; + + // ----- Getter/Setter ----- + public String getDetailId() { return detailId; } + public void setDetailId(String detailId) { this.detailId = detailId; } + + public String getOutDetailNo() { return outDetailNo; } + public void setOutDetailNo(String outDetailNo) { this.outDetailNo = outDetailNo; } + + public String getDetailStatus() { return detailStatus; } + public void setDetailStatus(String detailStatus) { this.detailStatus = detailStatus; } + + public Long getTransferAmount() { return transferAmount; } + public void setTransferAmount(Long transferAmount) { this.transferAmount = transferAmount; } + + public String getOpenid() { return openid; } + public void setOpenid(String openid) { this.openid = openid; } + + public String getFailReason() { return failReason; } + public void setFailReason(String failReason) { this.failReason = failReason; } + } +} diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcCommonPaymentMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcCommonPaymentMapper.xml index 1bb05b2b..0368bdc2 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcCommonPaymentMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcCommonPaymentMapper.xml @@ -32,9 +32,16 @@ + + + + + + + - \ No newline at end of file +