mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-15 12:56:26 +08:00
#503 微信支付增加资金账单下载接口
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package com.github.binarywang.wxpay.bean.request;
|
||||
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants.AccountType;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 微信支付下载资金账单请求参数类
|
||||
* Created by cwivan on 2018-08-02.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/cwivan">cwivan</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayDownloadFundFlowRequest extends BaseWxPayRequest {
|
||||
private static final String[] ACCOUNT_TYPES = new String[]{AccountType.BASIC, AccountType.OPERATION, AccountType.FEES};
|
||||
private static final String SIGN_TYPE_HMAC_SHA256 = "HMAC-SHA256";
|
||||
private static final String TAR_TYPE_GZIP = "GZIP";
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 对账单日期
|
||||
* bill_date
|
||||
* 是
|
||||
* String(8)
|
||||
* 20140603
|
||||
* 下载对账单的日期,格式:20140603
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("bill_date")
|
||||
private String billDate;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 资金账户类型
|
||||
* account_type
|
||||
* 是
|
||||
* Basic
|
||||
* String(8)
|
||||
* --Basic,基本账户
|
||||
* --Operation,运营账户
|
||||
* --Fees,手续费账户
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("account_type")
|
||||
private String accountType;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 压缩账单
|
||||
* tar_type
|
||||
* 否
|
||||
* String(8)
|
||||
* GZIP
|
||||
* 非必传参数,固定值:GZIP,返回格式为.gzip的压缩包账单。不传则默认为数据流形式。
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("tar_type")
|
||||
private String tarType;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() throws WxPayException {
|
||||
if (StringUtils.isNotBlank(this.getTarType()) && !TAR_TYPE_GZIP.equals(this.getTarType())) {
|
||||
throw new WxPayException("tar_type值如果存在,只能为GZIP");
|
||||
}
|
||||
|
||||
if (!ArrayUtils.contains(ACCOUNT_TYPES, this.getAccountType())) {
|
||||
throw new WxPayException(String.format("account_type必须为%s其中之一,实际值:%s",
|
||||
Arrays.toString(ACCOUNT_TYPES), this.getAccountType()));
|
||||
}
|
||||
/**
|
||||
* 目前仅支持HMAC-SHA256
|
||||
*/
|
||||
this.setSignType(SIGN_TYPE_HMAC_SHA256);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 记账时间:2018-02-01 04:21:23 微信支付业务单号:50000305742018020103387128253 资金流水单号:1900009231201802015884652186 业务名称:退款
|
||||
* 业务类型:退款 收支类型:支出 收支金额(元):0.02 账户结余(元):0.17 资金变更提交申请人:system 备注:缺货 业务凭证号:REF4200000068201801293084726067
|
||||
*
|
||||
* @author cwivan
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class WxPayFundFlowBaseResult implements Serializable {
|
||||
private static final long serialVersionUID = 4474557532904682718L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 记账时间
|
||||
*/
|
||||
private String BillingTime;
|
||||
/**
|
||||
* 微信支付业务单号
|
||||
*/
|
||||
private String bizTransactionId;
|
||||
/**
|
||||
* 资金流水单号
|
||||
*/
|
||||
private String fundFlowId;
|
||||
/**
|
||||
* 业务名称
|
||||
*/
|
||||
private String bizName;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String bizType;
|
||||
/**
|
||||
* 收支类型
|
||||
*/
|
||||
private String financialType;
|
||||
/**
|
||||
* 收支金额(元)
|
||||
*/
|
||||
private String financialFee;
|
||||
/**
|
||||
* 账户结余(元)
|
||||
*/
|
||||
private String AccountBalance;
|
||||
/**
|
||||
* 资金变更提交申请人
|
||||
*/
|
||||
private String fundApplicant;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 业务凭证号
|
||||
*/
|
||||
private String bizVoucherId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 下载资金账单接口响应结果对象类
|
||||
* Created by cwivan on 2018-08-02.
|
||||
* </pre>
|
||||
*
|
||||
* @author cwivan
|
||||
* @date 2018-08-02
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class WxPayFundFlowResult implements Serializable{
|
||||
private static final long serialVersionUID = 8371500036495349207L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资金流水返回对象
|
||||
*/
|
||||
private List<WxPayFundFlowBaseResult> wxPayFundFlowBaseResultList;
|
||||
|
||||
/**
|
||||
* 资金流水总笔数
|
||||
*/
|
||||
private String totalRecord;
|
||||
|
||||
/**
|
||||
* 收入笔数
|
||||
*/
|
||||
private String incomeRecord;
|
||||
|
||||
/**
|
||||
* 收入金额
|
||||
*/
|
||||
private String incomeAmount;
|
||||
|
||||
/**
|
||||
* 支出笔数
|
||||
*/
|
||||
private String expenditureRecord;
|
||||
|
||||
/**
|
||||
* 支出金额
|
||||
*/
|
||||
private String expenditureAmount;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user