1
1
package com .github .binarywang .wxpay .service .impl ;
2
2
3
+ import java .io .File ;
4
+ import java .nio .charset .StandardCharsets ;
5
+ import java .nio .file .Files ;
6
+ import java .nio .file .Path ;
7
+ import java .nio .file .Paths ;
8
+ import java .util .Date ;
9
+ import java .util .HashMap ;
10
+ import java .util .LinkedList ;
11
+ import java .util .List ;
12
+ import java .util .Map ;
13
+ import java .util .zip .ZipException ;
14
+
15
+ import org .apache .commons .lang3 .StringUtils ;
16
+ import org .slf4j .Logger ;
17
+ import org .slf4j .LoggerFactory ;
18
+
3
19
import com .github .binarywang .utils .qrcode .QrcodeUtils ;
4
20
import com .github .binarywang .wxpay .bean .WxPayApiData ;
5
- import com .github .binarywang .wxpay .bean .coupon .*;
21
+ import com .github .binarywang .wxpay .bean .coupon .WxPayCouponInfoQueryRequest ;
22
+ import com .github .binarywang .wxpay .bean .coupon .WxPayCouponInfoQueryResult ;
23
+ import com .github .binarywang .wxpay .bean .coupon .WxPayCouponSendRequest ;
24
+ import com .github .binarywang .wxpay .bean .coupon .WxPayCouponSendResult ;
25
+ import com .github .binarywang .wxpay .bean .coupon .WxPayCouponStockQueryRequest ;
26
+ import com .github .binarywang .wxpay .bean .coupon .WxPayCouponStockQueryResult ;
6
27
import com .github .binarywang .wxpay .bean .notify .WxPayOrderNotifyResult ;
7
28
import com .github .binarywang .wxpay .bean .notify .WxPayRefundNotifyResult ;
8
29
import com .github .binarywang .wxpay .bean .notify .WxScanPayNotifyResult ;
9
30
import com .github .binarywang .wxpay .bean .order .WxPayAppOrderResult ;
10
31
import com .github .binarywang .wxpay .bean .order .WxPayMpOrderResult ;
11
32
import com .github .binarywang .wxpay .bean .order .WxPayMwebOrderResult ;
12
33
import com .github .binarywang .wxpay .bean .order .WxPayNativeOrderResult ;
13
- import com .github .binarywang .wxpay .bean .request .*;
14
- import com .github .binarywang .wxpay .bean .result .*;
34
+ import com .github .binarywang .wxpay .bean .request .WxPayAuthcode2OpenidRequest ;
35
+ import com .github .binarywang .wxpay .bean .request .WxPayDefaultRequest ;
36
+ import com .github .binarywang .wxpay .bean .request .WxPayDownloadBillRequest ;
37
+ import com .github .binarywang .wxpay .bean .request .WxPayDownloadFundFlowRequest ;
38
+ import com .github .binarywang .wxpay .bean .request .WxPayMicropayRequest ;
39
+ import com .github .binarywang .wxpay .bean .request .WxPayOrderCloseRequest ;
40
+ import com .github .binarywang .wxpay .bean .request .WxPayOrderQueryRequest ;
41
+ import com .github .binarywang .wxpay .bean .request .WxPayOrderReverseRequest ;
42
+ import com .github .binarywang .wxpay .bean .request .WxPayQueryCommentRequest ;
43
+ import com .github .binarywang .wxpay .bean .request .WxPayRedpackQueryRequest ;
44
+ import com .github .binarywang .wxpay .bean .request .WxPayRefundQueryRequest ;
45
+ import com .github .binarywang .wxpay .bean .request .WxPayRefundRequest ;
46
+ import com .github .binarywang .wxpay .bean .request .WxPayReportRequest ;
47
+ import com .github .binarywang .wxpay .bean .request .WxPaySendRedpackRequest ;
48
+ import com .github .binarywang .wxpay .bean .request .WxPayShorturlRequest ;
49
+ import com .github .binarywang .wxpay .bean .request .WxPayUnifiedOrderRequest ;
50
+ import com .github .binarywang .wxpay .bean .result .BaseWxPayResult ;
51
+ import com .github .binarywang .wxpay .bean .result .WxPayAuthcode2OpenidResult ;
52
+ import com .github .binarywang .wxpay .bean .result .WxPayBillBaseResult ;
53
+ import com .github .binarywang .wxpay .bean .result .WxPayBillResult ;
54
+ import com .github .binarywang .wxpay .bean .result .WxPayCommonResult ;
55
+ import com .github .binarywang .wxpay .bean .result .WxPayFundFlowBaseResult ;
56
+ import com .github .binarywang .wxpay .bean .result .WxPayFundFlowResult ;
57
+ import com .github .binarywang .wxpay .bean .result .WxPayMicropayResult ;
58
+ import com .github .binarywang .wxpay .bean .result .WxPayOrderCloseResult ;
59
+ import com .github .binarywang .wxpay .bean .result .WxPayOrderQueryResult ;
60
+ import com .github .binarywang .wxpay .bean .result .WxPayOrderReverseResult ;
61
+ import com .github .binarywang .wxpay .bean .result .WxPayRedpackQueryResult ;
62
+ import com .github .binarywang .wxpay .bean .result .WxPayRefundQueryResult ;
63
+ import com .github .binarywang .wxpay .bean .result .WxPayRefundResult ;
64
+ import com .github .binarywang .wxpay .bean .result .WxPaySandboxSignKeyResult ;
65
+ import com .github .binarywang .wxpay .bean .result .WxPaySendRedpackResult ;
66
+ import com .github .binarywang .wxpay .bean .result .WxPayShorturlResult ;
67
+ import com .github .binarywang .wxpay .bean .result .WxPayUnifiedOrderResult ;
15
68
import com .github .binarywang .wxpay .config .WxPayConfig ;
16
69
import com .github .binarywang .wxpay .constant .WxPayConstants .BillType ;
17
70
import com .github .binarywang .wxpay .constant .WxPayConstants .SignType ;
23
76
import com .google .common .base .Joiner ;
24
77
import com .google .common .collect .Maps ;
25
78
import jodd .io .ZipUtil ;
26
- import org .apache .commons .lang3 .StringUtils ;
27
- import org .slf4j .Logger ;
28
- import org .slf4j .LoggerFactory ;
29
-
30
- import java .io .File ;
31
- import java .nio .charset .StandardCharsets ;
32
- import java .nio .file .Files ;
33
- import java .nio .file .Path ;
34
- import java .nio .file .Paths ;
35
- import java .util .*;
36
- import java .util .zip .ZipException ;
37
79
38
80
import static com .github .binarywang .wxpay .constant .WxPayConstants .QUERY_COMMENT_DATE_FORMAT ;
39
81
import static com .github .binarywang .wxpay .constant .WxPayConstants .TarType ;
@@ -291,7 +333,7 @@ public <T> T createOrder(WxPayUnifiedOrderRequest request) throws WxPayException
291
333
configMap .put ("appid" , appId );
292
334
293
335
final WxPayAppOrderResult result = WxPayAppOrderResult .builder ()
294
- .sign (SignUtils .createSign (configMap , null , this .getConfig ().getMchKey (), false ))
336
+ .sign (SignUtils .createSign (configMap , null , this .getConfig ().getMchKey (), null ))
295
337
.prepayId (prepayId )
296
338
.partnerId (partnerId )
297
339
.appId (appId )
@@ -317,7 +359,7 @@ public <T> T createOrder(WxPayUnifiedOrderRequest request) throws WxPayException
317
359
.signType (signType )
318
360
.build ();
319
361
320
- payResult .setPaySign (SignUtils .createSign (payResult , signType , this .getConfig ().getMchKey (), false ));
362
+ payResult .setPaySign (SignUtils .createSign (payResult , signType , this .getConfig ().getMchKey (), null ));
321
363
return (T ) payResult ;
322
364
}
323
365
@@ -368,7 +410,7 @@ public Map<String, String> getPayInfo(WxPayUnifiedOrderRequest request) throws W
368
410
configMap .put ("noncestr" , nonceStr );
369
411
configMap .put ("appid" , appId );
370
412
// 此map用于客户端与微信服务器交互
371
- payInfo .put ("sign" , SignUtils .createSign (configMap , null , this .getConfig ().getMchKey (), false ));
413
+ payInfo .put ("sign" , SignUtils .createSign (configMap , null , this .getConfig ().getMchKey (), null ));
372
414
payInfo .put ("prepayId" , prepayId );
373
415
payInfo .put ("partnerId" , partnerId );
374
416
payInfo .put ("appId" , appId );
@@ -382,7 +424,7 @@ public Map<String, String> getPayInfo(WxPayUnifiedOrderRequest request) throws W
382
424
payInfo .put ("nonceStr" , nonceStr );
383
425
payInfo .put ("package" , "prepay_id=" + prepayId );
384
426
payInfo .put ("signType" , SignType .MD5 );
385
- payInfo .put ("paySign" , SignUtils .createSign (payInfo , null , this .getConfig ().getMchKey (), false ));
427
+ payInfo .put ("paySign" , SignUtils .createSign (payInfo , null , this .getConfig ().getMchKey (), null ));
386
428
}
387
429
388
430
return payInfo ;
@@ -406,7 +448,7 @@ public String createScanPayQrcodeMode1(String productId) {
406
448
params .put ("time_stamp" , String .valueOf (System .currentTimeMillis () / 1000 ));
407
449
params .put ("nonce_str" , String .valueOf (System .currentTimeMillis ()));
408
450
409
- String sign = SignUtils .createSign (params , null , this .getConfig ().getMchKey (), false );
451
+ String sign = SignUtils .createSign (params , null , this .getConfig ().getMchKey (), null );
410
452
params .put ("sign" , sign );
411
453
412
454
for (String key : params .keySet ()) {
@@ -632,7 +674,7 @@ private String handleGzipFundFlow(String url, String requestStr) throws WxPayExc
632
674
}
633
675
} catch (WxPayException wxPayException ) {
634
676
throw wxPayException ;
635
- } catch (Exception e ){
677
+ } catch (Exception e ) {
636
678
this .log .error ("解析对账单文件时出错" , e );
637
679
throw new WxPayException ("解压zip文件出错" );
638
680
}
0 commit comments