File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -27,15 +27,21 @@ public class WxEntrustPapServiceImpl implements WxEntrustPapService {
2727
2828 @ Override
2929 public String mpSign (WxMpEntrustRequest wxMpEntrustRequest ) throws WxPayException {
30+ wxMpEntrustRequest .checkAndSign (payService .getConfig ());
3031 StringBuilder signStrTemp = new StringBuilder (payService .getPayBaseUrl () + "/papay/entrustweb" );
3132 signStrTemp .append ("?appid=" ).append (wxMpEntrustRequest .getAppid ());
3233 signStrTemp .append ("&contract_code=" ).append (wxMpEntrustRequest .getContractCode ());
3334 signStrTemp .append ("&contract_display_account=" ).append (URLEncoder .encode (wxMpEntrustRequest .getContractDisplayAccount ()));
3435 signStrTemp .append ("&mch_id=" ).append (wxMpEntrustRequest .getMchId ()).append ("¬ify_url=" ).append (URLEncoder .encode (wxMpEntrustRequest .getNotifyUrl ()));
35- signStrTemp .append ("&plan_id=" ).append (wxMpEntrustRequest .getPlanId ()). append ( "&outerid=" ). append ( URLEncoder . encode ( wxMpEntrustRequest . getOuterId ())) ;
36+ signStrTemp .append ("&plan_id=" ).append (wxMpEntrustRequest .getPlanId ());
3637 signStrTemp .append ("&request_serial=" ).append (wxMpEntrustRequest .getRequestSerial ()).append ("×tamp=" ).append (wxMpEntrustRequest .getTimestamp ());
37- signStrTemp .append ("&version=" ).append (wxMpEntrustRequest .getVersion ()).append ("&return_web=" ).append (wxMpEntrustRequest .getReturnWeb ()).append ("&sign=" ).append (wxMpEntrustRequest .getSign ());
38-
38+ if (StringUtils .isNotEmpty (wxMpEntrustRequest .getReturnWeb ())) {
39+ signStrTemp .append ("&return_web=" ).append (wxMpEntrustRequest .getReturnWeb ());
40+ }
41+ if (StringUtils .isNotEmpty (wxMpEntrustRequest .getOuterId ())) {
42+ signStrTemp .append ("&outerid=" ).append (URLEncoder .encode (wxMpEntrustRequest .getOuterId ()));
43+ }
44+ signStrTemp .append ("&version=" ).append (wxMpEntrustRequest .getVersion ()).append ("&sign=" ).append (wxMpEntrustRequest .getSign ());
3945 return signStrTemp .toString ();
4046 }
4147
You can’t perform that action at this time.
0 commit comments