支付宝-修改商家券活动发券数量上限
官方文档 https://opendocs.alipay.com/open/03rz3h?ref=api&scene=5aea8cf1e5ea47d5ac8031a10c716ab7
该接口可以理解为给商家券追加券数量
直接上代码
请求参数
@Data
public class AlipayVoucherUpdateQuantityReq implements Serializable {
private static final long serialVersionUID = 4581464909979075825L;
@NotBlank(message = "活动ID不能为空")
@ApiModelProperty(value = "活动ID-必填")
private String activityId;
@NotNull(message = "券数量不能为NULL")
@ApiModelProperty(value = "券数量-必填" +
"限制:券总预算<= 999999" +
"特别说明:该字段的含义是追加到的数量。不可减少,只能增加。" +
"code_mode=MERCHANT_UPLOAD 的情况下,voucher_quantity 需要与导入码的总数量保持一致(即历史导入数量 + 追加导入数量)。")
private Long voucherQuantity;
}
修改券码数量
public ResponseResult<Boolean> alipayMarketingActivityOrderVoucherAppend(AlipayVoucherUpdateQuantityReq alipayVoucherUpdateQuantityReq) {
// 修改商家券活动发券数量上限模型类
AlipayMarketingActivityOrdervoucherAppendModel appendModel = new AlipayMarketingActivityOrdervoucherAppendModel();
// 修改商家券活动发券数量上限请求类
AlipayMarketingActivityOrdervoucherAppendRequest appendRequest = new AlipayMarketingActivityOrdervoucherAppendRequest();
// 修改商家券活动发券数量上限响应类
AlipayMarketingActivityOrdervoucherAppendResponse appendResponse;
try {
// 活动ID
appendModel.setActivityId(alipayVoucherUpdateQuantityReq.getActivityId());
// 券总预算值
appendModel.setVoucherQuantity(alipayVoucherUpdateQuantityReq.getVoucherQuantity());
// 外部业务单号,用作幂等控制
appendModel.setOutBizNo(UUID.randomUUID().toString().replace("-",""));
/*
商户接入模式
SELF_MODE 商户自接入模式
AGENCY_MODE 服务商代接入模式
*/
appendModel.setMerchantAccessMode("SELF_MODE");
// 设置请求参数
appendRequest.setBizModel(appendModel);
// 发送请求
appendResponse = alipayClient.execute(appendRequest);
} catch (AlipayApiException e) {
throw new RuntimeException(e);
}
return appendResponse.isSuccess() ? ResponseResult.success("修改成功", true) : ResponseResult.success("修改失败", false);
}
标签:支付宝,商家,发券,上限,修改,appendModel,数量
From: https://www.cnblogs.com/zjh0420/p/16874490.html