@@ -496,7 +496,19 @@ public void report(WxPayReportRequest request) throws WxPayException {
496496 }
497497
498498 @ Override
499- public WxPayBillResult downloadBill (String billDate , String billType , String tarType , String deviceInfo ) throws WxPayException {
499+ public String downloadRawBill (String billDate , String billType , String tarType , String deviceInfo )
500+ throws WxPayException {
501+ return this .downloadRawBill (this .buildDownloadBillRequest (billDate , billType , tarType , deviceInfo ));
502+ }
503+
504+ @ Override
505+ public WxPayBillResult downloadBill (String billDate , String billType , String tarType , String deviceInfo )
506+ throws WxPayException {
507+ return this .downloadBill (this .buildDownloadBillRequest (billDate , billType , tarType , deviceInfo ));
508+ }
509+
510+ private WxPayDownloadBillRequest buildDownloadBillRequest (String billDate , String billType , String tarType ,
511+ String deviceInfo ) throws WxPayException {
500512 if (!BillType .ALL .equals (billType )) {
501513 throw new WxPayException ("目前仅支持ALL类型的对账单下载" );
502514 }
@@ -506,12 +518,22 @@ public WxPayBillResult downloadBill(String billDate, String billType, String tar
506518 request .setBillDate (billDate );
507519 request .setTarType (tarType );
508520 request .setDeviceInfo (deviceInfo );
509-
510- return this .downloadBill (request );
521+ return request ;
511522 }
512523
513524 @ Override
514525 public WxPayBillResult downloadBill (WxPayDownloadBillRequest request ) throws WxPayException {
526+ String responseContent = this .downloadRawBill (request );
527+
528+ if (StringUtils .isEmpty (responseContent )) {
529+ return null ;
530+ }
531+
532+ return this .handleBill (request .getBillType (), responseContent );
533+ }
534+
535+ @ Override
536+ public String downloadRawBill (WxPayDownloadBillRequest request ) throws WxPayException {
515537 request .checkAndSign (this .getConfig ());
516538
517539 String url = this .getPayBaseUrl () + "/pay/downloadbill" ;
@@ -525,12 +547,7 @@ public WxPayBillResult downloadBill(WxPayDownloadBillRequest request) throws WxP
525547 throw WxPayException .from (BaseWxPayResult .fromXML (responseContent , WxPayCommonResult .class ));
526548 }
527549 }
528-
529- if (StringUtils .isEmpty (responseContent )) {
530- return null ;
531- }
532-
533- return this .handleBill (request .getBillType (), responseContent );
550+ return responseContent ;
534551 }
535552
536553 private WxPayBillResult handleBill (String billType , String responseContent ) {
0 commit comments