Skip to content

Commit 7550ebf

Browse files
Copilotbinarywang
andcommitted
Implement Business Operations Merchant Transfer API (Document 4012711988)
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
1 parent 9f0113e commit 7550ebf

10 files changed

+627
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.github.binarywang.wxpay.bean.transfer;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
import java.io.Serializable;
10+
11+
/**
12+
* 运营工具-商家转账查询请求参数
13+
*
14+
* @author WxJava Team
15+
* @see <a href="https://pay.weixin.qq.com/doc/v3/merchant/4012711988">运营工具-商家转账API</a>
16+
*/
17+
@Data
18+
@Builder(builderMethodName = "newBuilder")
19+
@NoArgsConstructor
20+
@AllArgsConstructor
21+
public class BusinessOperationTransferQueryRequest implements Serializable {
22+
private static final long serialVersionUID = 1L;
23+
24+
/**
25+
* 商户系统内部的商家单号
26+
* 与transfer_bill_no二选一
27+
*/
28+
@SerializedName("out_bill_no")
29+
private String outBillNo;
30+
31+
/**
32+
* 微信转账单号
33+
* 与out_bill_no二选一
34+
*/
35+
@SerializedName("transfer_bill_no")
36+
private String transferBillNo;
37+
38+
/**
39+
* 直连商户的appid
40+
* 可选
41+
*/
42+
@SerializedName("appid")
43+
private String appid;
44+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package com.github.binarywang.wxpay.bean.transfer;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 运营工具-商家转账查询结果
11+
*
12+
* @author WxJava Team
13+
* @see <a href="https://pay.weixin.qq.com/doc/v3/merchant/4012711988">运营工具-商家转账API</a>
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class BusinessOperationTransferQueryResult implements Serializable {
18+
private static final long serialVersionUID = 1L;
19+
20+
/**
21+
* 直连商户的appid
22+
*/
23+
@SerializedName("appid")
24+
private String appid;
25+
26+
/**
27+
* 商户系统内部的商家单号
28+
*/
29+
@SerializedName("out_bill_no")
30+
private String outBillNo;
31+
32+
/**
33+
* 微信转账单号
34+
*/
35+
@SerializedName("transfer_bill_no")
36+
private String transferBillNo;
37+
38+
/**
39+
* 运营工具转账场景ID
40+
*/
41+
@SerializedName("operation_scene_id")
42+
private String operationSceneId;
43+
44+
/**
45+
* 用户在直连商户应用下的用户标示
46+
*/
47+
@SerializedName("openid")
48+
private String openid;
49+
50+
/**
51+
* 收款用户姓名
52+
* 已脱敏
53+
*/
54+
@SerializedName("user_name")
55+
private String userName;
56+
57+
/**
58+
* 转账金额
59+
* 单位为"分"
60+
*/
61+
@SerializedName("transfer_amount")
62+
private Integer transferAmount;
63+
64+
/**
65+
* 转账备注
66+
*/
67+
@SerializedName("transfer_remark")
68+
private String transferRemark;
69+
70+
/**
71+
* 转账状态
72+
* WAIT_PAY:等待确认
73+
* PROCESSING:转账中
74+
* SUCCESS:转账成功
75+
* FAIL:转账失败
76+
* REFUND:已退款
77+
*/
78+
@SerializedName("transfer_state")
79+
private String transferState;
80+
81+
/**
82+
* 发起转账的时间
83+
* 遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE
84+
*/
85+
@SerializedName("create_time")
86+
private String createTime;
87+
88+
/**
89+
* 转账更新时间
90+
* 遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE
91+
*/
92+
@SerializedName("update_time")
93+
private String updateTime;
94+
95+
/**
96+
* 失败原因
97+
* 当transfer_state为FAIL时返回
98+
*/
99+
@SerializedName("fail_reason")
100+
private String failReason;
101+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package com.github.binarywang.wxpay.bean.transfer;
2+
3+
import com.github.binarywang.wxpay.v3.SpecEncrypt;
4+
import com.google.gson.annotations.SerializedName;
5+
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
9+
10+
import java.io.Serializable;
11+
12+
/**
13+
* 运营工具-商家转账请求参数
14+
*
15+
* @author WxJava Team
16+
* @see <a href="https://pay.weixin.qq.com/doc/v3/merchant/4012711988">运营工具-商家转账API</a>
17+
*/
18+
@Data
19+
@Builder(builderMethodName = "newBuilder")
20+
@NoArgsConstructor
21+
@AllArgsConstructor
22+
public class BusinessOperationTransferRequest implements Serializable {
23+
private static final long serialVersionUID = 1L;
24+
25+
/**
26+
* 直连商户的appid
27+
* 必须
28+
*/
29+
@SerializedName("appid")
30+
private String appid;
31+
32+
/**
33+
* 商户系统内部的商家单号
34+
* 必须,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一
35+
*/
36+
@SerializedName("out_bill_no")
37+
private String outBillNo;
38+
39+
/**
40+
* 运营工具转账场景ID
41+
* 必须,用于标识运营工具转账的具体业务场景
42+
*/
43+
@SerializedName("operation_scene_id")
44+
private String operationSceneId;
45+
46+
/**
47+
* 用户在直连商户应用下的用户标示
48+
* 必须
49+
*/
50+
@SerializedName("openid")
51+
private String openid;
52+
53+
/**
54+
* 收款用户姓名
55+
* 可选,传入则校验收款用户姓名
56+
* 使用RSA加密,使用OAEP填充方式
57+
*/
58+
@SpecEncrypt
59+
@SerializedName("user_name")
60+
private String userName;
61+
62+
/**
63+
* 转账金额
64+
* 必须,单位为"分"
65+
*/
66+
@SerializedName("transfer_amount")
67+
private Integer transferAmount;
68+
69+
/**
70+
* 转账备注
71+
* 必须,会在转账成功消息和转账详情页向用户展示
72+
*/
73+
@SerializedName("transfer_remark")
74+
private String transferRemark;
75+
76+
/**
77+
* 用户收款感知
78+
* 可选,用于在转账成功消息中向用户展示特定内容
79+
*/
80+
@SerializedName("user_recv_perception")
81+
private String userRecvPerception;
82+
83+
/**
84+
* 异步接收微信支付转账结果通知的回调地址
85+
* 可选,通知URL必须为外网可以正常访问的地址,不能携带查询参数
86+
*/
87+
@SerializedName("notify_url")
88+
private String notifyUrl;
89+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.github.binarywang.wxpay.bean.transfer;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 运营工具-商家转账结果
11+
*
12+
* @author WxJava Team
13+
* @see <a href="https://pay.weixin.qq.com/doc/v3/merchant/4012711988">运营工具-商家转账API</a>
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class BusinessOperationTransferResult implements Serializable {
18+
private static final long serialVersionUID = 1L;
19+
20+
/**
21+
* 商户系统内部的商家单号
22+
*/
23+
@SerializedName("out_bill_no")
24+
private String outBillNo;
25+
26+
/**
27+
* 微信转账单号
28+
* 微信商家转账系统返回的唯一标识
29+
*/
30+
@SerializedName("transfer_bill_no")
31+
private String transferBillNo;
32+
33+
/**
34+
* 转账状态
35+
* WAIT_PAY:等待确认
36+
* PROCESSING:转账中
37+
* SUCCESS:转账成功
38+
* FAIL:转账失败
39+
* REFUND:已退款
40+
*/
41+
@SerializedName("transfer_state")
42+
private String transferState;
43+
44+
/**
45+
* 发起转账的时间
46+
* 遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE
47+
*/
48+
@SerializedName("create_time")
49+
private String createTime;
50+
51+
/**
52+
* 转账更新时间
53+
* 遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE
54+
*/
55+
@SerializedName("update_time")
56+
private String updateTime;
57+
58+
/**
59+
* 失败原因
60+
* 当transfer_state为FAIL时返回
61+
*/
62+
@SerializedName("fail_reason")
63+
private String failReason;
64+
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/constant/WxPayConstants.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,29 @@ public static class TransformSceneId {
412412
public static final String CASH_MARKETING = "1001";
413413
}
414414

415+
/**
416+
* 【运营工具转账场景ID】 运营工具专用转账场景,用于商户日常运营活动
417+
*
418+
* @see <a href="https://pay.weixin.qq.com/doc/v3/merchant/4012711988">运营工具-商家转账API</a>
419+
*/
420+
@UtilityClass
421+
public static class OperationSceneId {
422+
/**
423+
* 运营工具现金营销
424+
*/
425+
public static final String OPERATION_CASH_MARKETING = "2001";
426+
427+
/**
428+
* 运营工具佣金报酬
429+
*/
430+
public static final String OPERATION_COMMISSION = "2002";
431+
432+
/**
433+
* 运营工具推广奖励
434+
*/
435+
public static final String OPERATION_PROMOTION = "2003";
436+
}
437+
415438
/**
416439
* 用户收款感知
417440
*

0 commit comments

Comments
 (0)