@@ -48,14 +48,17 @@ public ProfitSharingResult profitSharing(ProfitSharingRequest request) throws Wx
4848
4949 @ Override
5050 public ProfitSharingResult getProfitSharingResult (String outOrderNo , String transactionId ) throws WxPayException {
51- String url = String .format ("%s/v3/profitsharing/orders/%s?transaction_id=%s" , this .payService .getPayBaseUrl (), outOrderNo , transactionId );
51+ String url = String .format ("%s/v3/profitsharing/orders/%s?transaction_id=%s" , this .payService .getPayBaseUrl (),
52+ outOrderNo , transactionId );
5253 String result = this .payService .getV3 (url );
5354 return GSON .fromJson (result , ProfitSharingResult .class );
5455 }
5556
5657 @ Override
57- public ProfitSharingResult getProfitSharingResult (String outOrderNo , String transactionId , String subMchId ) throws WxPayException {
58- String url = String .format ("%s/v3/profitsharing/orders/%s?sub_mchid=%s&transaction_id=%s" , this .payService .getPayBaseUrl (), outOrderNo , subMchId , transactionId );
58+ public ProfitSharingResult getProfitSharingResult (String outOrderNo , String transactionId , String subMchId )
59+ throws WxPayException {
60+ String url = String .format ("%s/v3/profitsharing/orders/%s?sub_mchid=%s&transaction_id=%s" ,
61+ this .payService .getPayBaseUrl (), outOrderNo , subMchId , transactionId );
5962 String result = this .payService .getV3 (url );
6063 return GSON .fromJson (result , ProfitSharingResult .class );
6164 }
@@ -70,14 +73,17 @@ public ProfitSharingReturnResult profitSharingReturn(ProfitSharingReturnRequest
7073
7174 @ Override
7275 public ProfitSharingReturnResult getProfitSharingReturnResult (String outOrderNo , String outReturnNo ) throws WxPayException {
73- String url = String .format ("%s/v3/profitsharing/return-orders/%s?out_order_no=%s" , this .payService .getPayBaseUrl (), outReturnNo , outOrderNo );
76+ String url = String .format ("%s/v3/profitsharing/return-orders/%s?out_order_no=%s" , this .payService .getPayBaseUrl (),
77+ outReturnNo , outOrderNo );
7478 String result = this .payService .getV3 (url );
7579 return GSON .fromJson (result , ProfitSharingReturnResult .class );
7680 }
7781
7882 @ Override
79- public ProfitSharingReturnResult getProfitSharingReturnResult (String outOrderNo , String outReturnNo , String subMchId ) throws WxPayException {
80- String url = String .format ("%s/v3/profitsharing/return-orders/%s?sub_mchid=%s&out_order_no=%s" , this .payService .getPayBaseUrl (), outReturnNo , subMchId , outOrderNo );
83+ public ProfitSharingReturnResult getProfitSharingReturnResult (String outOrderNo , String outReturnNo , String subMchId )
84+ throws WxPayException {
85+ String url = String .format ("%s/v3/profitsharing/return-orders/%s?sub_mchid=%s&out_order_no=%s" ,
86+ this .payService .getPayBaseUrl (), outReturnNo , subMchId , outOrderNo );
8187 String result = this .payService .getV3 (url );
8288 return GSON .fromJson (result , ProfitSharingReturnResult .class );
8389 }
@@ -114,7 +120,7 @@ public ProfitSharingReceiver deleteProfitSharingReceiver(ProfitSharingReceiver r
114120 }
115121
116122 @ Override
117- public ProfitSharingNotifyData getProfitSharingNotifyData (String notifyData , SignatureHeader header ) throws WxPayException {
123+ public ProfitSharingNotifyResult getProfitSharingNotifyData (String notifyData , SignatureHeader header ) throws WxPayException {
118124 ProfitSharingNotifyData response = parseNotifyData (notifyData , header );
119125 ProfitSharingNotifyData .Resource resource = response .getResource ();
120126 String cipherText = resource .getCipherText ();
@@ -123,16 +129,17 @@ public ProfitSharingNotifyData getProfitSharingNotifyData(String notifyData, Sig
123129 String apiV3Key = this .payService .getConfig ().getApiV3Key ();
124130 try {
125131 String result = AesUtils .decryptToString (associatedData , nonce , cipherText , apiV3Key );
126- ProfitSharingNotifyData notifyResult = GSON .fromJson (result , ProfitSharingNotifyData .class );
127- return notifyResult ;
132+ return GSON .fromJson (result , ProfitSharingNotifyResult .class );
128133 } catch (GeneralSecurityException | IOException e ) {
129134 throw new WxPayException ("解析报文异常!" , e );
130135 }
131136 }
132137
133138 @ Override
134139 public ProfitSharingBillResult getProfitSharingBill (ProfitSharingBillRequest request ) throws WxPayException {
135- String url = String .format ("%s/v3/profitsharing/bills?bill_date=%s" , this .payService .getPayBaseUrl (), request .getBillDate ());
140+ String url = String .format ("%s/v3/profitsharing/bills?bill_date=%s" , this .payService .getPayBaseUrl (),
141+ request .getBillDate ());
142+
136143 if (StringUtils .isNotBlank (request .getSubMchId ())) {
137144 url = String .format ("%s&sub_mchid=%s" , url , request .getSubMchId ());
138145 }
@@ -158,10 +165,7 @@ private ProfitSharingNotifyData parseNotifyData(String data, SignatureHeader hea
158165 * @return true:校验通过 false:校验不通过
159166 */
160167 private boolean verifyNotifySign (SignatureHeader header , String data ) throws WxPayException {
161- String beforeSign = String .format ("%s\n %s\n %s\n " ,
162- header .getTimeStamp (),
163- header .getNonce (),
164- data );
168+ String beforeSign = String .format ("%s%n%s%n%s%n" , header .getTimeStamp (), header .getNonce (), data );
165169 Verifier verifier = this .payService .getConfig ().getVerifier ();
166170 if (verifier == null ) {
167171 throw new WxPayException ("证书检验对象为空" );
0 commit comments