Jelajahi Sumber

:new: #3452 【微信支付】新增消费者投诉2.0的更新退款审批结果的接口

Jacky Tse 4 bulan lalu
induk
melakukan
8fe1e6ea86

+ 90 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/complaint/UpdateRefundProgressRequest.java

@@ -0,0 +1,90 @@
+package com.github.binarywang.wxpay.bean.complaint;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 微信消费者投诉2.0
+ * 更新退款审批结果请求实体
+ *
+ * @author <a href="https://github.com/jackytse">jackytse</a>
+ * created on  2024-12-21
+ */
+@Data
+@Builder(builderMethodName = "newBuilder")
+@NoArgsConstructor
+@AllArgsConstructor
+public class UpdateRefundProgressRequest implements Serializable {
+  private static final long serialVersionUID = 6975811815225228118L;
+
+  /**
+   * <pre>
+   * 字段名:投诉单号
+   * 是否必填:是
+   * 描述:投诉单对应的投诉单号
+   * </pre>
+   */
+  @SerializedName("complaint_id")
+  @Expose
+  private String complaintId;
+
+  /**
+   * <pre>
+   * 字段名:审批动作
+   * 是否必填:是
+   * 描述:同意 或 拒绝
+   * 可选取值:
+   * REJECT: 拒绝退款
+   * APPROVE: 同意退款
+   * </pre>
+   */
+  @SerializedName("action")
+  private String action;
+
+  /**
+   * <pre>
+   * 字段名:预计发起退款时间
+   * 是否必填:否
+   * 描述:在同意退款时返回,预计将在多少个工作日内能发起退款, 0代表当天
+   * </pre>
+   */
+  @SerializedName("launch_refund_day")
+  private Integer launchRefundDay;
+
+  /**
+   * <pre>
+   * 字段名:拒绝退款原因
+   * 是否必填:否
+   * 描述:在拒绝退款时返回拒绝退款的原因
+   * </pre>
+   */
+  @SerializedName("reject_reason")
+  private String rejectReason;
+
+  /**
+   * <pre>
+   * 字段名:拒绝退款的举证图片列表
+   * 是否必填:否
+   * 描述:在拒绝退款时,如果有拒绝的图片举证,可以提供 最多上传4张图片, 传入调用“商户上传反馈图片”接口返回的media_id,最多上传4张图片凭证
+   * </pre>
+   */
+  @SerializedName("reject_media_list")
+  private List<String> rejectMediaList;
+
+  /**
+   * <pre>
+   * 字段名:备注
+   * 是否必填:否
+   * 描述:任何需要向微信支付客服反馈的信息
+   * </pre>
+   */
+  @SerializedName("remark")
+  private String remark;
+}

+ 14 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ComplaintService.java

@@ -137,6 +137,20 @@ public interface ComplaintService {
 
   /**
    * <pre>
+   * 更新退款审批结果API
+   * 针对“申请退款单”,需要商户明确返回是否可退款的审批结果。
+   * 若根据用户描述,核实可以退款,审批动作传入“APPROVE”,同意退款,并给出一个预计退款时间。传入“同意退款”后,需要额外调退款接口发起原路退款。退款到账后,投诉单的状态将自动扭转为“处理完成”。
+   * 若根据用户描述,核实不能退款,审批动作传入“REJECT”,拒绝退款,并说明拒绝退款原因。驳回退款后,投诉单的状态将自动扭转为“处理完成”。
+   * 文档详见: <a href="https://pay.wechatpay.cn/docs/merchant/apis/consumer-complaint/complaints/update-refund-progress.html">...</a>
+   * </pre>
+   *
+   * @param request {@link UpdateRefundProgressRequest} 请求数据
+   * @throws WxPayException the wx pay exception
+   */
+  void updateRefundProgress(UpdateRefundProgressRequest request) throws WxPayException;
+
+  /**
+   * <pre>
    * 商户上传反馈图片API
    * 文档详见: <a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_10.shtml">...</a>
    * 接口链接:https://api.mch.weixin.qq.com/v3/merchant-service/images/upload

+ 8 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ComplaintServiceImpl.java

@@ -113,6 +113,14 @@ public class ComplaintServiceImpl implements ComplaintService {
   }
 
   @Override
+  public void updateRefundProgress(UpdateRefundProgressRequest request) throws WxPayException {
+    String url = String.format("%s/v3/merchant-service/complaints-v2/%s/update-refund-progress", this.payService.getPayBaseUrl(), request.getComplaintId());
+    // 上面url已经含有complaintId,这里设置为空,避免在body中再次传递,否则微信会报错
+    request.setComplaintId(null);
+    this.payService.postV3(url, GSON.toJson(request));
+  }
+
+  @Override
   public ImageUploadResult uploadResponseImage(File imageFile) throws WxPayException, IOException {
     String url = String.format("%s/v3/merchant-service/images/upload", this.payService.getPayBaseUrl());