支付宝开放平台API
1、查询对账单下载地址
https://opendocs.alipay.com/apis/api_15/alipay.data.dataservice.bill.downloadurl.query
2、对账说明
https://opendocs.alipay.com/open/204/106262
请求API下载账单解析
1、支付宝下载对账单,不保存文件、不解压直接解析。
2、实例实现的是(trade)支付宝交易收单的业务账单。
1、请求实体、响应实体
DownloadBillRequest.java
@Data
public class DownloadBillRequest implements Serializable {
private static final long serialVersionUID = -9016422214082575601L;
// 账单日期 (yyyy-MM-dd)
private String billDate;
// 账单类型(trade、signcustomer)
private String billType;
}
DownloadBillResponse.java
@Data
public class DownloadBillResponse implements Serializable {
private static final long serialVersionUID = 5344850998806040582L;
// 返回状态码
private String returnCode;
// 返回信息
private String returnMsg;
// 错误代码
private String errCode;
// 账单明细
ListbillInfos;
}
2、获取zip下载地址
public DownloadBillResponse downloadBill(DownloadBillRequest downloadBillRequest) {
DownloadBillResponse response = new DownloadBillResponse();
try {
AlipayDataDataserviceBillDownloadurlQueryRequest request = new AlipayDataDataserviceBillDownloadurlQueryRequest();
if (Objects.isNull(downloadBillRequest.getBillType())) {
downloadBillRequest.setBillType("trade");
}
Map param = HumpConversionUtils.transform(downloadBillRequest);
request.setBizContent(JSON.toJSONString(param));
AlipayDataDataserviceBillDownloadurlQueryResponse result = new DefaultAlipayClient(
"https://openapi.alipay.com/gateway.do",
"你的AppId",
"你的应用私钥",
"json",
"utf-8",
"你的支付公钥",
"RSA2"
).execute(request);
if (Objects.equals(PayStatus.ALI_SUCCESS, result.getCode())) {
Listb