查询对账单下载地址接口(alipay.data.dataservice.bill.downloadurl.query)测试之“入参不合法”

这个接口是下载离线账单的,需要T+1天生成账单,不能查询当日或者是当月的账单,如果日期是当天或者是当月的会返回“参数不合法”;

详情请点击查看文档 

下载对账单地址接口只有当面付接口可以下载trade类型的账单,其他支付接口只能下载signcustomer这个类型的 


代码示例:

package com.alipay.demo;
  
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayDataDataserviceBillDownloadurlQueryModel;
import com.alipay.api.request.AlipayDataDataserviceBillDownloadurlQueryRequest;
import com.alipay.api.response.AlipayDataDataserviceBillDownloadurlQueryResponse;
import com.alipay.config.AlipayConfig;
  
/**
 * 
 * alipay.data.dataservice.bill.downloadurl.query (查询对账单下载地址)
 * @author wb-wly251833
 *
 */
public class AlipayDataDataserviceBillDownloadurlQuery {
      
    public static void main(String[] args) throws AlipayApiException {
                 AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", Config.appId, Config.privateKey, "json","utf-8", Config.alipayPulicKey, "RSA2");
        AlipayDataDataserviceBillDownloadurlQueryRequest request =  new AlipayDataDataserviceBillDownloadurlQueryRequest();
        AlipayDataDataserviceBillDownloadurlQueryModel model = new AlipayDataDataserviceBillDownloadurlQueryModel();
        //账单时间:日账单格式为yyyy-MM-dd,月账单格式为yyyy-MM。必须是前一天或者上一个月,不能当天当月
        model.setBillDate("2017-12");
//      model.setBillDate("2018-01-08");
        //账单类型,trade指商户基于支付宝交易收单的业务账单;signcustomer是指基于商户支付宝余额收入及支出等资金变动的帐务账单;
        model.setBillType("trade");
        request.setBizModel(model);
        AlipayDataDataserviceBillDownloadurlQueryResponse response = alipayClient.execute(request);
        System.out.println("返回信息:"+response.getBody());
        System.out.println("账单下载地址链接(BillDownloadUrl):"+response.getBillDownloadUrl());
        if(response.isSuccess()){
        System.out.println("调用成功");
        } else {
        System.out.println("调用失败");
        }
          
    }
  
}

注:   正式环境网关:https://openapi.alipay.com/gateway.do   正式环境网关:https://openapi.alipaydev.com/gateway.do 返回信息:

{"alipay_data_dataservice_bill_downloadurl_query_response":{"code":"10000","msg":"Success","bill_download_url":"http:\/\/dwbillcenter.alipaydev.com\/downloadBillFile.resource?bizType=trade&userId=20881021701192600156&fileType=csv.zip&bizDates=201712&downloadFileName=20881021701192600156_201712.csv.zip&fileId=%2Ftrade%2F20881021701192600156%2F201712.csv.zip&timestamp=1515487931&token=196dab0559f25bc04221b04080d8fbb9"},"sign":"V7JWM3LxoboMPRsBD0ixMWO63JoEvpSnhb15NpLwOM6pBBJN93us8NXXqAcp4EyLtxRZlMhWHQXeO5AP2GWY7BSH1rBoNb2up7u73zNP0zHGcC1upRbR5zz7YFk4LQpFqBuluB+2pPVJbOxrMF6kiNcKj/uF729JAkDDB8TIaK5X0XZun96vug5cjAHcJjbrnatkjjMpL9EQjs42r9w+ixJiUjHXBKodPpGvAD6YpYnoRsM97jSVfG4xO6BwxQrqDCJ4FPAMNVSQdsTfas277MBCkNjrtG1muFfUQNO+roIXUU7N4ouT8k78hJdj7O+jpKqlR3lq8subR4knpOVoEg=="}

根据返回信息我们获取到url

http://dwbillcenter.alipaydev.com/downloadBillFile.resource?bizType=trade&userId=20881021701192600156&fileType=csv.zip&bizDates=201712&downloadFileName=20881021701192600156_201712.csv.zip&fileId=

将访问url获取到两个excel文件 查询对账单下载地址接口(alipay.data.dataservice.bill.downloadurl.query)测试之“入参不合法”

我这边使用的是沙箱测试,所以获取到的只是账单模板,想要下载获取账单数据,需使用正式环境测试; 

1、账单业务明细模板: 查询对账单下载地址接口(alipay.data.dataservice.bill.downloadurl.query)测试之“入参不合法”

2.账单业务明细汇总 查询对账单下载地址接口(alipay.data.dataservice.bill.downloadurl.query)测试之“入参不合法”

上一篇:中芯国际发布第四财季财报:利润3860万美元


下一篇:阿里巴巴敏捷研发的探索与实践