🆕 #1922 【微信支付】增加查询订单最大分账比例和剩余待分金额的接口

This commit is contained in:
cofe
2021-01-15 17:08:43 +08:00
committed by GitHub
parent 43771f6048
commit bb5aadf6be
7 changed files with 243 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
package com.github.binarywang.wxpay.bean.profitsharing;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.github.binarywang.wxpay.constant.WxPayConstants;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* @author : cofedream
* @date : 2020-12-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@XStreamAlias("xml")
public class ProfitSharingMerchantRatioQueryRequest extends BaseWxPayRequest {
private static final long serialVersionUID = 2773455587673225334L;
public ProfitSharingMerchantRatioQueryRequest(String subMchId) {
this.subMchId = subMchId;
}
@Override
protected void checkConstraints() throws WxPayException {
// 目前仅支持HMAC-SHA256.
this.setSignType(WxPayConstants.SignType.HMAC_SHA256);
}
@Override
public boolean ignoreAppid() {
return true;
}
@Override
protected boolean ignoreSubAppId() {
return true;
}
@Override
protected void storeMap(Map<String, String> map) {
}
}

View File

@@ -0,0 +1,32 @@
package com.github.binarywang.wxpay.bean.profitsharing;
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.w3c.dom.Document;
/**
* @author : cofedream
* @date : 2020-12-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@XStreamAlias("xml")
public class ProfitSharingMerchantRatioQueryResult extends BaseWxPayResult {
/**
* 服务商模式下的子商户号.<br/>
* 2000<br/>
* 子商户允许服务商分账的最大比例单位万分比比如2000表示20%
*/
@XStreamAlias("max_ratio")
private Integer maxRatio;
@Override
protected void loadXml(Document d) {
maxRatio = readXmlInteger(d, "max_ratio");
}
}

View File

@@ -0,0 +1,59 @@
package com.github.binarywang.wxpay.bean.profitsharing;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.github.binarywang.wxpay.constant.WxPayConstants;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.*;
import me.chanjar.weixin.common.annotation.Required;
import java.util.Map;
/**
* @author : cofedream
* @date : 2020-12-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
@XStreamAlias("xml")
public class ProfitSharingOrderAmountQueryRequest extends BaseWxPayRequest {
private static final long serialVersionUID = 6009448187615691627L;
/**
* <pre>
* 字段名:微信订单号.
* 变量名transaction_id
* 是否必填:是
* String(32)
* 示例值4208450740201411110007820472
* 描述:微信支付订单号
* </pre>
*/
@XStreamAlias("transaction_id")
@Required
private String transactionId;
@Override
protected void checkConstraints() throws WxPayException {
// 目前仅支持HMAC-SHA256.
this.setSignType(WxPayConstants.SignType.HMAC_SHA256);
}
@Override
public boolean ignoreAppid() {
return true;
}
@Override
protected boolean ignoreSubAppId() {
return true;
}
@Override
protected void storeMap(Map<String, String> map) {
map.put("transaction_id", transactionId);
}
}

View File

@@ -0,0 +1,37 @@
package com.github.binarywang.wxpay.bean.profitsharing;
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.w3c.dom.Document;
/**
* @author : cofedream
* @date : 2020-12-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@XStreamAlias("xml")
public class ProfitSharingOrderAmountQueryResult extends BaseWxPayResult {
private static final long serialVersionUID = 7355605400662796198L;
/**
* 微信订单号.
*/
@XStreamAlias("transaction_id")
private String transactionId;
/**
* 订单剩余待分金额.
*/
@XStreamAlias("unsplit_amount")
private Integer unSplitAmount;
@Override
protected void loadXml(Document d) {
transactionId = readXmlString(d, "transaction_id");
unSplitAmount = readXmlInteger(d, "unsplit_amount");
}
}