11package com .github .weixin .demo .controller ;
22
3- import com .github .binarywang .wxpay .bean .request .WxEntPayRequest ;
3+ import java .util .Map ;
4+ import javax .servlet .http .HttpServletRequest ;
5+ import javax .servlet .http .HttpServletResponse ;
6+
7+ import org .springframework .beans .factory .annotation .Autowired ;
8+ import org .springframework .stereotype .Controller ;
9+ import org .springframework .web .bind .annotation .RequestMapping ;
10+
11+ import com .github .binarywang .wxpay .bean .entpay .EntPayRequest ;
12+ import com .github .binarywang .wxpay .bean .entpay .EntPayResult ;
413import com .github .binarywang .wxpay .bean .request .WxPayUnifiedOrderRequest ;
5- import com .github .binarywang .wxpay .bean .result .WxEntPayResult ;
614import com .github .binarywang .wxpay .bean .result .WxPayUnifiedOrderResult ;
715import com .github .binarywang .wxpay .config .WxPayConfig ;
816import com .github .binarywang .wxpay .exception .WxPayException ;
1321import com .github .weixin .demo .util .XMLUtil ;
1422import com .google .gson .Gson ;
1523import me .chanjar .weixin .common .exception .WxErrorException ;
16- import org .springframework .beans .factory .annotation .Autowired ;
17- import org .springframework .stereotype .Controller ;
18- import org .springframework .web .bind .annotation .RequestMapping ;
19-
20- import javax .servlet .http .HttpServletRequest ;
21- import javax .servlet .http .HttpServletResponse ;
22- import java .util .Map ;
2324
2425/**
2526 * 微信支付Controller
@@ -53,7 +54,7 @@ public void getPrepayId(HttpServletResponse response,
5354 .body (request .getParameter ("body" ))
5455 .tradeType (request .getParameter ("trade_type" ))
5556 .spbillCreateIp (request .getParameter ("spbill_create_ip" ))
56- .notifyURL ("" )
57+ .notifyUrl ("" )
5758 .build ();
5859 this .logger
5960 .info ("PartnerKey is :" + this .payConfig .getMchKey ());
@@ -79,7 +80,7 @@ public void getJSSDKPayInfo(HttpServletResponse response,
7980 .body (request .getParameter ("body" ))
8081 .tradeType (request .getParameter ("trade_type" ))
8182 .spbillCreateIp (request .getParameter ("spbill_create_ip" ))
82- .notifyURL ( "" ) // TODO(user) 填写通知回调地址
83+ .notifyUrl ( "// TODO 填写通知回调地址" )
8384 .build ();
8485
8586 try {
@@ -133,7 +134,7 @@ public void getJSSDKCallbackData(HttpServletRequest request,
133134 @ RequestMapping (value = "entPay" )
134135 public void payToIndividual (HttpServletResponse response ,
135136 HttpServletRequest request ) {
136- WxEntPayRequest wxEntPayRequest = new WxEntPayRequest ();
137+ EntPayRequest wxEntPayRequest = new EntPayRequest ();
137138 wxEntPayRequest .setAppid (payConfig .getAppId ());
138139 wxEntPayRequest .setMchId (payConfig .getMchId ());
139140 wxEntPayRequest .setNonceStr (Sha1Util .getNonceStr ());
@@ -145,7 +146,7 @@ public void payToIndividual(HttpServletResponse response,
145146 wxEntPayRequest .setSpbillCreateIp (request .getParameter ("spbill_create_ip" ));
146147
147148 try {
148- WxEntPayResult wxEntPayResult = payService .entPay (wxEntPayRequest );
149+ EntPayResult wxEntPayResult = payService . getEntPayService () .entPay (wxEntPayRequest );
149150 if ("SUCCESS" .equals (wxEntPayResult .getResultCode ().toUpperCase ())
150151 && "SUCCESS" .equals (wxEntPayResult .getReturnCode ().toUpperCase ())) {
151152 this .logger .info ("企业对个人付款成功!\n 付款信息:\n " + wxEntPayResult .toString ());
0 commit comments