@@ -496,7 +496,19 @@ public void report(WxPayReportRequest request) throws WxPayException {
496
496
}
497
497
498
498
@ 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 {
500
512
if (!BillType .ALL .equals (billType )) {
501
513
throw new WxPayException ("目前仅支持ALL类型的对账单下载" );
502
514
}
@@ -506,12 +518,22 @@ public WxPayBillResult downloadBill(String billDate, String billType, String tar
506
518
request .setBillDate (billDate );
507
519
request .setTarType (tarType );
508
520
request .setDeviceInfo (deviceInfo );
509
-
510
- return this .downloadBill (request );
521
+ return request ;
511
522
}
512
523
513
524
@ Override
514
525
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 {
515
537
request .checkAndSign (this .getConfig ());
516
538
517
539
String url = this .getPayBaseUrl () + "/pay/downloadbill" ;
@@ -525,12 +547,7 @@ public WxPayBillResult downloadBill(WxPayDownloadBillRequest request) throws WxP
525
547
throw WxPayException .from (BaseWxPayResult .fromXML (responseContent , WxPayCommonResult .class ));
526
548
}
527
549
}
528
-
529
- if (StringUtils .isEmpty (responseContent )) {
530
- return null ;
531
- }
532
-
533
- return this .handleBill (request .getBillType (), responseContent );
550
+ return responseContent ;
534
551
}
535
552
536
553
private WxPayBillResult handleBill (String billType , String responseContent ) {
0 commit comments