🎨 #4132 【微信支付】补齐商家转账收款样式参数
This commit is contained in:
@@ -87,6 +87,25 @@ public class TransferBillsRequest implements Serializable {
|
||||
@SerializedName("transfer_scene_report_infos")
|
||||
private List<TransferSceneReportInfo> transferSceneReportInfos;
|
||||
|
||||
/**
|
||||
* 用户收款样式;不传时默认展示收款确认页。
|
||||
*/
|
||||
@SerializedName("user_recv_style")
|
||||
private UserRecvStyle userRecvStyle;
|
||||
|
||||
/**
|
||||
* 保留原有全参构造函数,所有参数语义不变,用户收款样式默认不设置。
|
||||
*/
|
||||
public TransferBillsRequest(String appid, String outBillNo, String transferSceneId,
|
||||
String openid, String userName, Integer transferAmount, String transferRemark,
|
||||
String notifyUrl, String userRecvPerception,
|
||||
List<TransferSceneReportInfo> transferSceneReportInfos, AuthorizationInfo authorizationInfo,
|
||||
String authorizationId, String outAuthorizationNo, String receiptAuthorizationMode) {
|
||||
this(appid, outBillNo, transferSceneId, openid, userName, transferAmount, transferRemark,
|
||||
notifyUrl, userRecvPerception, transferSceneReportInfos, null, authorizationInfo,
|
||||
authorizationId, outAuthorizationNo, receiptAuthorizationMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动收款授权信息
|
||||
*/
|
||||
@@ -144,6 +163,21 @@ public class TransferBillsRequest implements Serializable {
|
||||
private String infoContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户收款样式。
|
||||
*/
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class UserRecvStyle {
|
||||
/**
|
||||
* 样式类型:CONFIRM_PAGE 为收款确认页,RED_PACKET 为红包;红包仅支持部分转账场景且单笔金额不超过 200 元。
|
||||
*/
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.github.binarywang.wxpay.bean.transfer.UserConfirmAuthorizationRequest
|
||||
import com.github.binarywang.wxpay.bean.transfer.UserConfirmAuthorizationResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -41,9 +43,34 @@ public class TransferUserAuthorizationApiCompatibilityTest {
|
||||
|
||||
Assert.assertEquals(handler.lastPostWithSerialUrl, BASE_URL + "/v3/fund-app/mch-transfer/transfer-bills");
|
||||
Assert.assertFalse(handler.lastPostWithSerialBody.contains("authorization_info"));
|
||||
Assert.assertFalse(handler.lastPostWithSerialBody.contains("user_recv_style"));
|
||||
Assert.assertEquals(result.getPackageInfo(), "transfer-package");
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证发起转账时用户收款样式及类型按微信接口字段名发送。
|
||||
*/
|
||||
public void shouldSendUserRecvStyleInTransferBillsRequest() throws Exception {
|
||||
RequestCaptureHandler handler = new RequestCaptureHandler();
|
||||
TransferServiceImpl transferService = new TransferServiceImpl(handler.createWxPayService());
|
||||
|
||||
transferService.transferBills(TransferBillsRequest.newBuilder()
|
||||
.appid("wxf636efh567hg4356")
|
||||
.outBillNo("plfk2020042014")
|
||||
.transferSceneId("1000")
|
||||
.openid("o-MYE42l80oelYMDE34nYD456Xoy")
|
||||
.transferAmount(100)
|
||||
.transferRemark("活动奖励")
|
||||
.userRecvStyle(TransferBillsRequest.UserRecvStyle.newBuilder()
|
||||
.type("RED_PACKET")
|
||||
.build())
|
||||
.build());
|
||||
|
||||
JsonObject body = new Gson().fromJson(handler.lastPostWithSerialBody, JsonObject.class);
|
||||
Assert.assertEquals(handler.lastPostWithSerialUrl, BASE_URL + "/v3/fund-app/mch-transfer/transfer-bills");
|
||||
Assert.assertEquals(body.getAsJsonObject("user_recv_style").get("type").getAsString(), "RED_PACKET");
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证“发起转账并完成免确认收款授权”使用独立接口路径和授权参数.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user