Showing
23 changed files
with
246 additions
and
629 deletions
@@ -23,27 +23,35 @@ public class WXUtils { | @@ -23,27 +23,35 @@ public class WXUtils { | ||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * 生成Md5签名(新版本API) | 25 | * 生成Md5签名(新版本API) |
26 | - * @param Map<String, String> 参数对 | ||
27 | - * @param String 商户私钥 | ||
28 | * @return String | 26 | * @return String |
29 | - */ | 27 | + */ |
30 | public static String signMd5(Map<String, String> paramMap, String privateKey){ | 28 | public static String signMd5(Map<String, String> paramMap, String privateKey){ |
31 | if(null == paramMap){ | 29 | if(null == paramMap){ |
32 | return ""; | 30 | return ""; |
33 | } | 31 | } |
34 | - | ||
35 | - Map<String, String> sortMap = getSortedSignMap(paramMap); | ||
36 | - StringBuilder strBuilder = new StringBuilder(); | ||
37 | - for(Map.Entry<String, String> entry : sortMap.entrySet()){ | ||
38 | - strBuilder.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); | ||
39 | - } | 32 | + StringBuilder strBuilder = buildPreSignContent(paramMap); |
40 | //字典排序后再拼接上商户密钥 | 33 | //字典排序后再拼接上商户密钥 |
41 | - strBuilder.append("key").append("=").append(privateKey); | ||
42 | - | 34 | + strBuilder.append("&").append("key").append("=").append(privateKey); |
35 | + | ||
43 | String md5Sign = MD5Utils.signMd5(strBuilder.toString(), "UTF-8").toUpperCase(); | 36 | String md5Sign = MD5Utils.signMd5(strBuilder.toString(), "UTF-8").toUpperCase(); |
44 | 37 | ||
45 | return md5Sign; | 38 | return md5Sign; |
46 | - } | 39 | + } |
40 | + | ||
41 | + public static StringBuilder buildPreSignContent(Map<String, String> paramMap) { | ||
42 | + Map<String, String> sortMap = getSortedSignMap(paramMap); | ||
43 | + StringBuilder strBuilder = new StringBuilder(); | ||
44 | + boolean isFirst = true; | ||
45 | + for (Map.Entry<String, String> entry : sortMap.entrySet()) { | ||
46 | + if (isFirst) { | ||
47 | + isFirst = false; | ||
48 | + } else { | ||
49 | + strBuilder.append("&"); | ||
50 | + } | ||
51 | + strBuilder.append(entry.getKey()).append("=").append(entry.getValue()); | ||
52 | + } | ||
53 | + return strBuilder; | ||
54 | + } | ||
47 | 55 | ||
48 | private static Map<String, String> getSortedSignMap(Map<String, String> paramMap) { | 56 | private static Map<String, String> getSortedSignMap(Map<String, String> paramMap) { |
49 | //使用SortedMap将参数按名称的字典序排队 | 57 | //使用SortedMap将参数按名称的字典序排队 |
@@ -17,6 +17,10 @@ | @@ -17,6 +17,10 @@ | ||
17 | <groupId>com.yohoufo.fore</groupId> | 17 | <groupId>com.yohoufo.fore</groupId> |
18 | <artifactId>yohoufo-fore-common</artifactId> | 18 | <artifactId>yohoufo-fore-common</artifactId> |
19 | </dependency> | 19 | </dependency> |
20 | + <dependency> | ||
21 | + <groupId>com.yoho.core</groupId> | ||
22 | + <artifactId>security</artifactId> | ||
23 | + </dependency> | ||
20 | 24 | ||
21 | <dependency> | 25 | <dependency> |
22 | <groupId>com.yohoufo.fore</groupId> | 26 | <groupId>com.yohoufo.fore</groupId> |
@@ -8,115 +8,18 @@ public class WeixinPayConfig { | @@ -8,115 +8,18 @@ public class WeixinPayConfig { | ||
8 | public static final String TRADE_TYPE_NATIVE = "NATIVE"; //原生扫码支付 | 8 | public static final String TRADE_TYPE_NATIVE = "NATIVE"; //原生扫码支付 |
9 | public static final String TRADE_TYPE_JSAPI = "JSAPI"; //小程序、H5支付 | 9 | public static final String TRADE_TYPE_JSAPI = "JSAPI"; //小程序、H5支付 |
10 | 10 | ||
11 | - /** | ||
12 | - * 商家可以考虑读取配置文件 | ||
13 | - */ | ||
14 | - // {"app_id":"wx049fdaa3ba9cdd7a", | ||
15 | - // "app_secret":"f973fdb412307ea7b97d0252fd675104", | ||
16 | - // "partner_key":"b22de5cfd0ded341e0516505f72649a9", | ||
17 | - // "pay_sign_key":"wGwAsgU5SeeM62glYaoC6ALBKhtOrF7Ek9LzE8trEuUG7jHeFdnSlyA1jblOYYS57QzWr8dYVsWGdeWhzeonnrKFZakgwFWPYVtyeP4XqSu9Qvxps8LEgxoFBEpRPm6C", | ||
18 | - // "partner_id":1218934901} | ||
19 | - | ||
20 | - /**微信商户号1,当前微信APP支付、H5使用这个商户号**/ | ||
21 | - public static final String APP_ID = "wx049fdaa3ba9cdd7a"; // "wxd930ea5d5a258f4f";//微信开发平台应用id | ||
22 | - public static final String APP_SECRET = "f973fdb412307ea7b97d0252fd675104"; //"db426a9829e4b49a0dcac7b4162da6b6";//应用对应的凭证 | ||
23 | - //应用对应的密钥 | ||
24 | - public static final String APP_KEY = "wGwAsgU5SeeM62glYaoC6ALBKhtOrF7Ek9LzE8trEuUG7jHeFdnSlyA1jblOYYS57QzWr8dYVsWGdeWhzeonnrKFZakgwFWPYVtyeP4XqSu9Qvxps8LEgxoFBEpRPm6C"; // "L8LrMqqeGRxST5reouB0K66CaYAWpqhAVsq7ggKkxHCOastWksvuX1uvmvQclxaHoYd3ElNBrNO2DHnnzgfVG9Qs473M3DTOZug5er46FhuGofumV8H2FVR9qkjSlC5K"; | ||
25 | - public static final String PARTNER = "1218934901"; // "1900000109";//财付通商户号 | ||
26 | - public static final String PARTNER_KEY = "b22de5cfd0ded341e0516505f72649a9"; // "8934e7d15453e97507ef794cf7b0519d";//商户号对应的密钥 | ||
27 | - public static final String TOKENURL = "https://api.weixin.qq.com/cgi-bin/token";//获取access_token对应的url | ||
28 | - public static final String GRANT_TYPE = "client_credential";//常量固定值 | ||
29 | - public static final String EXPIRE_ERRCODE = "42001";//access_token失效后请求返回的errcode | ||
30 | - public static final String FAIL_ERRCODE = "40001";//重复获取导致上一次获取的access_token失效,返回错误码 | ||
31 | - public static final String GATEURL = "https://api.weixin.qq.com/pay/genprepay?access_token=";//获取预支付id的接口url | ||
32 | - public static final String ACCESS_TOKEN = "access_token";//access_token常量值 | ||
33 | - public static final String ERRORCODE = "errcode";//用来判断access_token是否失效的值 | ||
34 | - public static final String SIGN_METHOD = "sha1";//签名算法常量值 | ||
35 | - //package常量值 | ||
36 | - //public static String packageValue = "bank_type=WX&body=%B2%E2%CA%D4&fee_type=1&input_charset=GBK¬ify_url=http%3A%2F%2F127.0.0.1%3A8180%2Ftenpay_api_b2c%2FpayNotifyUrl.jsp&out_trade_no=2051571832&partner=1900000109&sign=10DA99BCB3F63EF23E4981B331B0A3EF&spbill_create_ip=127.0.0.1&time_expire=20131222091010&total_fee=1"; | ||
37 | - public static final String packageValue = "bank_type=WX&body=%E8%AE%A2%E5%8D%95%E5%8F%B7%3A1619199705&fee_type=1&input_charset=UTF-8¬ify_url=http%3A%2F%2Fdevservice.yoho.cn%3A58077%2Fpayment%2Fwechat_notify&out_trade_no=YOHOBuy_1619199705&partner=1218934901&sign=1E967995AA1F2E5DB5B03969ADEA2FA0&spbill_create_ip=172.16.8.137&time_expire=20160121181546&total_fee=239900"; | ||
38 | - public static final String traceid = "testtraceid001";//测试用户id | ||
39 | - | ||
40 | - //证书 | ||
41 | - public static final String WECHAT_PAY_APP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_app.p12"; | ||
42 | - | ||
43 | - /**微信商户号2,当前微信扫码使用这个商户号**/ | ||
44 | - public static final String APP_ID_2 = "wx75e5a7c0c88e45c2"; | ||
45 | - public static final String APP_SECRET_2 = "b97db82a751c77a1328a448f639eb3b0"; | ||
46 | - public static final String PARTNER_2 = "1227694201"; | ||
47 | - public static final String PARTNER_KEY_2 = "7e6f3307b64cc87c79c472814b88f7fb"; | ||
48 | - public static final String WECHAT_PAY_PCWAP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_web.p12"; | ||
49 | - | ||
50 | - /**微信支付BLK商户号**/ | ||
51 | - public static final String APP_ID_BLK = "wxa43b93a3b0b561b2"; | ||
52 | - public static final String APP_SECRET_BLK = "ce21ae4a3f93852279175a167e54509b"; | ||
53 | - public static final String PARTNER_BLK_APP = "1370681002"; | ||
54 | - public static final String PARTNER_KEY_BLK_APP = "2c938242a60d98c2f494ce0a71819974"; | ||
55 | - public static final String WECHAT_PAY_BLKAPP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_blk_app.p12"; | ||
56 | - | ||
57 | - /**微信支付UFO商户号**/ | ||
58 | - public static final String APP_ID_UFO = "wxa789c1da9516020f"; | ||
59 | - | ||
60 | - public static final String APP_SECRET_UFO = ""; | ||
61 | - public static final String PARTNER_UFO_APP = "1515489021"; | ||
62 | - public static final String PARTNER_KEY_UFO_APP = "ad64b940159d0ada893d0df5de715daa"; | ||
63 | - public static final String WECHAT_PAY_UFOAPP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_ufo_app.p12"; | ||
64 | - | ||
65 | /**微信支付UFO商户号正式**/ | 11 | /**微信支付UFO商户号正式**/ |
66 | public static final String APP_ID_UFO_REAL = "wx75b18b98bdd92bbc"; | 12 | public static final String APP_ID_UFO_REAL = "wx75b18b98bdd92bbc"; |
67 | - | ||
68 | - public static final String APP_SECRET_UFO_REAL = ""; | ||
69 | public static final String PARTNER_UFO_REAL_APP = "1516774631"; | 13 | public static final String PARTNER_UFO_REAL_APP = "1516774631"; |
70 | public static final String PARTNER_KEY_UFO_REAL_APP = "5f47f0050f5550f16d9262c65a165e0f"; | 14 | public static final String PARTNER_KEY_UFO_REAL_APP = "5f47f0050f5550f16d9262c65a165e0f"; |
71 | public static final String WECHAT_PAY_UFOREAL_APP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_ufo_real_app.p12"; | 15 | public static final String WECHAT_PAY_UFOREAL_APP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_ufo_real_app.p12"; |
72 | 16 | ||
73 | public interface Miniapp{ | 17 | public interface Miniapp{ |
74 | String APP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_wx_miniapp.p12"; | 18 | String APP_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_wx_miniapp.p12"; |
75 | - String KEY = PARTNER_KEY_UFO_REAL_APP; | ||
76 | String APPID = "wxc677c88385762287"; | 19 | String APPID = "wxc677c88385762287"; |
77 | String MALL_ID = PARTNER_UFO_REAL_APP; | 20 | String MALL_ID = PARTNER_UFO_REAL_APP; |
78 | } | 21 | } |
79 | 22 | ||
80 | - public static final String APP_ID_BLK_PC = "wxd370556ef064789e"; | ||
81 | - public static final String APP_SECRET_BLK_PC = "xxxxxxxxxxxxxxxxxxxx"; | ||
82 | - public static final String PARTNER_BLK_PC = "1374750202"; | ||
83 | - public static final String PARTNER_KEY_BLK_PC = "a13171560afd63e7dcf76ed1d08c2929"; | ||
84 | - public static final String WECHAT_PAY_BLKPC_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_blk_pc.p12"; | ||
85 | - | ||
86 | - public static final String APP_ID_OUYIN = "wxa0d65505ae5e0860"; | ||
87 | - public static final String APP_SECRET_OUYIN = "xxxxxxxxxxxxxxxxxxxx"; | ||
88 | - public static final String PARTNER_OUYIN = "1392759102"; | ||
89 | - public static final String PARTNER_KEY_OUYIN = "f70a95654c5d0400d75f0e72602da7ad"; | ||
90 | - public static final String OUYIN_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_ouyin.p12"; | ||
91 | - | ||
92 | - //欧印南京第一分公司 | ||
93 | - public static final String APP_ID_OUYIN01 = "wxb721666873174aca"; | ||
94 | - public static final String APP_SECRET_OUYIN01 = "xxxxxxxxxxxxxxxxxxxx"; | ||
95 | - public static final String PARTNER_OUYIN01 = "1494640762"; | ||
96 | - public static final String PARTNER_KEY_OUYIN01 = "6c5fd994d4163f99dcc09843ae12e1eb"; | ||
97 | - public static final String OUYIN01_PARTNER_CERT = "/certs/wechatpay/apiclient_cert_ouyin01.p12"; | ||
98 | - | ||
99 | - /** | ||
100 | - * 小程序的APPID | ||
101 | - * 小程序的支付绑定到BLK账号:1370681002 | ||
102 | - */ | ||
103 | - public static final String APP_ID_MINIAPP = "wx084ab813d88c594b"; | ||
104 | - | ||
105 | - /** | ||
106 | - * 有货商品精选小程序 | ||
107 | - * 支付同样绑定到BLK支付账号:1370681002 | ||
108 | - */ | ||
109 | - public static final String APP_ID_MINIAPP_MALL = "wxe4f1cbdfd470035d"; | ||
110 | - public static final String PARTNER_MINIAPP_MALL = "1483488462"; | ||
111 | - public static final String PARTNER_KEY_MINIAPP_MALL = "86dcd67211bfe36fda75200cbc32a748"; | ||
112 | - public static final String PARTNER_CERT_MINIAPP_MALL = "/certs/wechatpay/apiclient_cert_miniapp_mall.p12"; | ||
113 | - | ||
114 | -// private static final Map<String, String> MCH_KEY_MAP = new HashMap<String, String>(); | ||
115 | -// static { | ||
116 | -// MCH_KEY_MAP.put(PARTNER, PARTNER_KEY); | ||
117 | -// MCH_KEY_MAP.put(PARTNER_2, PARTNER_KEY_2); | ||
118 | -// } | ||
119 | - | ||
120 | //查询微信支付订单前缀 | 23 | //查询微信支付订单前缀 |
121 | public static final String WECHAT_TRADE_NO_PREFIX = "YOHOBuy_"; | 24 | public static final String WECHAT_TRADE_NO_PREFIX = "YOHOBuy_"; |
122 | 25 | ||
@@ -126,21 +29,9 @@ public class WeixinPayConfig { | @@ -126,21 +29,9 @@ public class WeixinPayConfig { | ||
126 | public static final String WEIXIN_PAY_QUERY_URL = "https://api.mch.weixin.qq.com/pay/orderquery"; | 29 | public static final String WEIXIN_PAY_QUERY_URL = "https://api.mch.weixin.qq.com/pay/orderquery"; |
127 | 30 | ||
128 | public static final String WEIXIN_PAY_REFUND_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund"; | 31 | public static final String WEIXIN_PAY_REFUND_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund"; |
129 | - | ||
130 | - public static final String WEIXIN_PAY_CLOSEORDER_URL = "https://api.mch.weixin.qq.com/pay/closeorder"; | ||
131 | - | ||
132 | - public static final String WEIXIN_PAY_BARCODE_URL = "https://api.mch.weixin.qq.com/pay/micropay"; | ||
133 | - | ||
134 | - public static final String WEIXIN_PAY_BARCODE_REVERT_URL = "https://api.mch.weixin.qq.com/secapi/pay/reverse"; | ||
135 | 32 | ||
136 | //微信支付新API相关常量定义 | 33 | //微信支付新API相关常量定义 |
137 | public class ApiConstants{ | 34 | public class ApiConstants{ |
138 | - //微信预支付URL(新API) | ||
139 | - public static final String WEIXIN_PREPAY_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder"; | ||
140 | - //用于签名的商户密钥字段名 | ||
141 | - public static final String KEY = "key"; | ||
142 | - | ||
143 | - public static final String DEFAULT_CHARACTER_SET = "UTF-8"; | ||
144 | 35 | ||
145 | //-------统一下单接口字段---------------------------------------- | 36 | //-------统一下单接口字段---------------------------------------- |
146 | //应用ID | 37 | //应用ID |
@@ -197,15 +88,7 @@ public class WeixinPayConfig { | @@ -197,15 +88,7 @@ public class WeixinPayConfig { | ||
197 | 88 | ||
198 | public static final String PREPAY_RESULT_FAIL = "FAIL"; | 89 | public static final String PREPAY_RESULT_FAIL = "FAIL"; |
199 | } | 90 | } |
200 | - | ||
201 | - /** | ||
202 | - * 根据商户号返回key | ||
203 | - * @param mchId | ||
204 | - * @return | ||
205 | - */ | ||
206 | -// public static String getMchKey(String mchId) { | ||
207 | -// return MCH_KEY_MAP.get(mchId); | ||
208 | -// } | 91 | + |
209 | 92 | ||
210 | 93 | ||
211 | 94 |
@@ -9,9 +9,8 @@ import javax.servlet.http.HttpServletRequest; | @@ -9,9 +9,8 @@ import javax.servlet.http.HttpServletRequest; | ||
9 | import javax.servlet.http.HttpServletResponse; | 9 | import javax.servlet.http.HttpServletResponse; |
10 | 10 | ||
11 | import com.yohoufo.order.service.pay.alipay.AlipayCrossBorderService; | 11 | import com.yohoufo.order.service.pay.alipay.AlipayCrossBorderService; |
12 | -import com.yohoufo.order.service.pay.alipay.AlipayServiceAbstract; | 12 | +import com.yohoufo.order.service.pay.alipay.AbstractAlipayService; |
13 | import com.yohoufo.order.service.pay.unionpay.JsUnionpayService; | 13 | import com.yohoufo.order.service.pay.unionpay.JsUnionpayService; |
14 | -import net.sf.oval.constraint.AssertURL; | ||
15 | import org.apache.commons.lang.StringUtils; | 14 | import org.apache.commons.lang.StringUtils; |
16 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
17 | import org.slf4j.LoggerFactory; | 16 | import org.slf4j.LoggerFactory; |
@@ -22,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -22,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
22 | import org.springframework.web.bind.annotation.RequestParam; | 21 | import org.springframework.web.bind.annotation.RequestParam; |
23 | import org.springframework.web.bind.annotation.RestController; | 22 | import org.springframework.web.bind.annotation.RestController; |
24 | 23 | ||
25 | -import com.yoho.error.exception.ServiceException; | ||
26 | import com.yohobuy.ufo.model.order.req.ManualDealRequest; | 24 | import com.yohobuy.ufo.model.order.req.ManualDealRequest; |
27 | import com.yohoufo.common.ApiResponse; | 25 | import com.yohoufo.common.ApiResponse; |
28 | import com.yohoufo.common.annotation.IgnoreSession; | 26 | import com.yohoufo.common.annotation.IgnoreSession; |
@@ -250,7 +248,7 @@ public class PaymentController { | @@ -250,7 +248,7 @@ public class PaymentController { | ||
250 | return ; | 248 | return ; |
251 | } | 249 | } |
252 | 250 | ||
253 | - AlipayServiceAbstract alipayServiceAbstract; | 251 | + AbstractAlipayService alipayServiceAbstract; |
254 | 252 | ||
255 | // 跨境支付宝的回调 | 253 | // 跨境支付宝的回调 |
256 | if (params.containsKey("currency")){ | 254 | if (params.containsKey("currency")){ |
@@ -6,9 +6,13 @@ import com.google.common.base.Splitter; | @@ -6,9 +6,13 @@ import com.google.common.base.Splitter; | ||
6 | import com.yoho.error.ServiceError; | 6 | import com.yoho.error.ServiceError; |
7 | import com.yoho.error.exception.ServiceException; | 7 | import com.yoho.error.exception.ServiceException; |
8 | import com.yohobuy.ufo.model.order.bo.OrderInfo; | 8 | import com.yohobuy.ufo.model.order.bo.OrderInfo; |
9 | +import com.yohobuy.ufo.model.order.bo.OutTradeNoMeta; | ||
9 | import com.yohobuy.ufo.model.order.common.Payment; | 10 | import com.yohobuy.ufo.model.order.common.Payment; |
10 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 11 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
11 | -import com.yohoufo.common.utils.*; | 12 | +import com.yohoufo.common.utils.DateUtil; |
13 | +import com.yohoufo.common.utils.HttpClient; | ||
14 | +import com.yohoufo.common.utils.RSAUtils; | ||
15 | +import com.yohoufo.common.utils.WXUtil; | ||
12 | import com.yohoufo.dal.order.OrdersPayHbfqMapper; | 16 | import com.yohoufo.dal.order.OrdersPayHbfqMapper; |
13 | import com.yohoufo.dal.order.model.OrdersPayHbfq; | 17 | import com.yohoufo.dal.order.model.OrdersPayHbfq; |
14 | import com.yohoufo.order.common.HbfqEnum; | 18 | import com.yohoufo.order.common.HbfqEnum; |
@@ -20,7 +24,6 @@ import com.yohoufo.order.model.PaymentData; | @@ -20,7 +24,6 @@ import com.yohoufo.order.model.PaymentData; | ||
20 | import com.yohoufo.order.model.TransferData; | 24 | import com.yohoufo.order.model.TransferData; |
21 | import com.yohoufo.order.service.PaymentSupportService; | 25 | import com.yohoufo.order.service.PaymentSupportService; |
22 | import com.yohoufo.order.service.pay.AbstractPayService; | 26 | import com.yohoufo.order.service.pay.AbstractPayService; |
23 | -import com.yohobuy.ufo.model.order.bo.OutTradeNoMeta; | ||
24 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | 27 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
25 | import com.yohoufo.order.service.transfer.TransferChannel; | 28 | import com.yohoufo.order.service.transfer.TransferChannel; |
26 | import com.yohoufo.order.service.transfer.TransferResult; | 29 | import com.yohoufo.order.service.transfer.TransferResult; |
@@ -39,7 +42,7 @@ import java.text.SimpleDateFormat; | @@ -39,7 +42,7 @@ import java.text.SimpleDateFormat; | ||
39 | import java.util.*; | 42 | import java.util.*; |
40 | import java.util.function.BiConsumer; | 43 | import java.util.function.BiConsumer; |
41 | 44 | ||
42 | -public abstract class AlipayServiceAbstract extends AbstractPayService { | 45 | +public abstract class AbstractAlipayService extends AbstractPayService { |
43 | 46 | ||
44 | 47 | ||
45 | private static final Logger logger = LoggerFactory.getLogger("alipayLogger"); | 48 | private static final Logger logger = LoggerFactory.getLogger("alipayLogger"); |
@@ -47,15 +50,23 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -47,15 +50,23 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
47 | @Autowired | 50 | @Autowired |
48 | private HttpClient httpClient; | 51 | private HttpClient httpClient; |
49 | 52 | ||
50 | - protected abstract String getMd5Key(); | 53 | + protected abstract AlipaySignatureSetting getAlipaySignatureSetting(); |
51 | 54 | ||
52 | - protected abstract String getRsaAlipubKey(); | 55 | + protected final AlipaySignatureHelper helper() { |
56 | + return factory.newAlipaySignatureHelper(getAlipaySignatureSetting()); | ||
57 | + } | ||
53 | 58 | ||
54 | - protected abstract String getRsaPrivateKey(); | 59 | + private final String getAppId() { |
60 | + return getAlipaySignatureSetting().getAppId(); | ||
61 | + } | ||
55 | 62 | ||
56 | - protected abstract String getAppId(); | 63 | + protected final String getPartnerId() { |
64 | + return getAlipaySignatureSetting().getPartnerId(); | ||
65 | + } | ||
57 | 66 | ||
58 | - protected abstract String getPartnerId(); | 67 | + private final String getAlipaySignType() { |
68 | + return getAlipaySignatureSetting().getRsaType(); | ||
69 | + } | ||
59 | 70 | ||
60 | protected String getAccountUserName() { | 71 | protected String getAccountUserName() { |
61 | return ""; | 72 | return ""; |
@@ -70,6 +81,9 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -70,6 +81,9 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
70 | } | 81 | } |
71 | 82 | ||
72 | @Autowired | 83 | @Autowired |
84 | + private AlipaySignatureHelperFactory factory; | ||
85 | + | ||
86 | + @Autowired | ||
73 | PaymentSupportService paymentSupportService; | 87 | PaymentSupportService paymentSupportService; |
74 | 88 | ||
75 | 89 | ||
@@ -93,33 +107,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -93,33 +107,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
93 | return notifyURL; | 107 | return notifyURL; |
94 | } | 108 | } |
95 | 109 | ||
96 | -// public JSONObject prepayRequest(OrderInfo orderInfo){ | ||
97 | -// | ||
98 | -// String tradeNo = String.valueOf(orderInfo.getOrderCode()); | ||
99 | -// String subject = "有货订单-" + tradeNo; | ||
100 | -// | ||
101 | -// AliMobliePayInfoBuilder builder = new AliMobliePayInfoBuilder(); | ||
102 | -// builder.addParam("service", "mobile.securitypay.pay") | ||
103 | -// .addParam("partner", this.getPartnerId()) | ||
104 | -// .addParam("_input_charset", AlipayConfig.input_charset) | ||
105 | -// .addParam("notify_url", notifyURL) | ||
106 | -// //.addParam("out_trade_no", tradeNo) | ||
107 | -// .addParam("subject", subject) | ||
108 | -// .addParam("payment_type", "1") //固定位1,表示商品购买 | ||
109 | -// .addParam("seller_id", this.getPartnerId()) | ||
110 | -// .addParam("total_fee", orderInfo.getAmount().toPlainString()) | ||
111 | -// .addParam("body", subject); | ||
112 | -//// .addParam("it_b_pay", orderInfo.getPayExpireTimeStr(Payment.ALIPAY)); | ||
113 | -// | ||
114 | -// builder.addParam("out_trade_no", tradeNo); | ||
115 | -// | ||
116 | -// JSONObject jsonObject = new JSONObject(); | ||
117 | -// jsonObject.put("payParams", builder.buildSign()); | ||
118 | -// | ||
119 | -// return jsonObject; | ||
120 | -// } | ||
121 | - | ||
122 | - | ||
123 | public PayQueryBo payQuery(String tradeNo, int orderCreateTime) { | 110 | public PayQueryBo payQuery(String tradeNo, int orderCreateTime) { |
124 | Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo); | 111 | Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo); |
125 | String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL); | 112 | String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL); |
@@ -499,7 +486,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -499,7 +486,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
499 | 486 | ||
500 | /** | 487 | /** |
501 | * openapi支付查询 | 488 | * openapi支付查询 |
502 | - * @param orderData | ||
503 | * @return | 489 | * @return |
504 | */ | 490 | */ |
505 | private Map<String, String> buildOpenApiQueryParams(String orderCode) { | 491 | private Map<String, String> buildOpenApiQueryParams(String orderCode) { |
@@ -516,13 +502,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -516,13 +502,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
516 | params.put("biz_content", bizJson.toJSONString()); | 502 | params.put("biz_content", bizJson.toJSONString()); |
517 | 503 | ||
518 | String preSignStr = getOpenApiSignString(params,false); | 504 | String preSignStr = getOpenApiSignString(params,false); |
519 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 505 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
520 | return params; | 506 | return params; |
521 | } | 507 | } |
522 | 508 | ||
523 | /** | 509 | /** |
524 | * openapi支付查询 | 510 | * openapi支付查询 |
525 | - * @param orderData | ||
526 | * @return | 511 | * @return |
527 | */ | 512 | */ |
528 | private Map<String, String> buildAlipayTransferQueryParams(String orderCode) { | 513 | private Map<String, String> buildAlipayTransferQueryParams(String orderCode) { |
@@ -539,14 +524,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -539,14 +524,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
539 | params.put("biz_content", bizJson.toJSONString()); | 524 | params.put("biz_content", bizJson.toJSONString()); |
540 | 525 | ||
541 | String preSignStr = getOpenApiSignString(params, false); | 526 | String preSignStr = getOpenApiSignString(params, false); |
542 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 527 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
543 | return params; | 528 | return params; |
544 | } | 529 | } |
545 | 530 | ||
546 | 531 | ||
547 | /** | 532 | /** |
548 | * 单笔转账 | 533 | * 单笔转账 |
549 | - * @param orderData | ||
550 | * @return | 534 | * @return |
551 | */ | 535 | */ |
552 | private Map<String, String> buildTransferParams(String transferOrderCode, String alipayUid, String alipayAccount, BigDecimal transferAmount) { | 536 | private Map<String, String> buildTransferParams(String transferOrderCode, String alipayUid, String alipayAccount, BigDecimal transferAmount) { |
@@ -574,13 +558,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -574,13 +558,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
574 | params.put("biz_content", bizJson.toJSONString()); | 558 | params.put("biz_content", bizJson.toJSONString()); |
575 | 559 | ||
576 | String preSignStr = getOpenApiSignString(params, false); | 560 | String preSignStr = getOpenApiSignString(params, false); |
577 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 561 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
578 | return params; | 562 | return params; |
579 | } | 563 | } |
580 | 564 | ||
581 | /** | 565 | /** |
582 | * 单笔转账 | 566 | * 单笔转账 |
583 | - * @param orderData | ||
584 | * @return | 567 | * @return |
585 | */ | 568 | */ |
586 | private Map<String, String> buildTransferParamsWhenExceedMillion(String transferOrderCode, String businessId, String alipayUid, String alipayAccount, String userName, BigDecimal transferAmount) { | 569 | private Map<String, String> buildTransferParamsWhenExceedMillion(String transferOrderCode, String businessId, String alipayUid, String alipayAccount, String userName, BigDecimal transferAmount) { |
@@ -611,7 +594,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -611,7 +594,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
611 | params.put("detail_data", detailAppender.toString()); | 594 | params.put("detail_data", detailAppender.toString()); |
612 | 595 | ||
613 | String preSignStr = getOpenApiSignString(params, false); | 596 | String preSignStr = getOpenApiSignString(params, false); |
614 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 597 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
615 | params.put("sign_type", "RSA"); | 598 | params.put("sign_type", "RSA"); |
616 | return params; | 599 | return params; |
617 | } | 600 | } |
@@ -672,7 +655,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -672,7 +655,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
672 | params.put("biz_content", bizJson.toJSONString()); | 655 | params.put("biz_content", bizJson.toJSONString()); |
673 | 656 | ||
674 | String preSignStr = getOpenApiSignString(params, false); | 657 | String preSignStr = getOpenApiSignString(params, false); |
675 | - String sign = RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset); | 658 | + String sign = helper().signWithRsa(preSignStr,AlipayConfig.input_charset); |
676 | params.put("sign", URLEncoder.encode(sign)); | 659 | params.put("sign", URLEncoder.encode(sign)); |
677 | 660 | ||
678 | // 对biz_content进行encode | 661 | // 对biz_content进行encode |
@@ -685,7 +668,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -685,7 +668,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
685 | 668 | ||
686 | /** | 669 | /** |
687 | * 花呗分期payOrderCode记录 | 670 | * 花呗分期payOrderCode记录 |
688 | - * @param hbfqRecord | ||
689 | * @return | 671 | * @return |
690 | */ | 672 | */ |
691 | public boolean recordOrdersPayHbfq(String outTradeNo, String tradeNo, int uid) { | 673 | public boolean recordOrdersPayHbfq(String outTradeNo, String tradeNo, int uid) { |
@@ -842,7 +824,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -842,7 +824,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
842 | /** | 824 | /** |
843 | * 将xml转换为对象 | 825 | * 将xml转换为对象 |
844 | * | 826 | * |
845 | - * @param xml | ||
846 | * @return | 827 | * @return |
847 | */ | 828 | */ |
848 | public PayRefundBo refundOpenApiConvert(String respText, PayRefundBo bo) { | 829 | public PayRefundBo refundOpenApiConvert(String respText, PayRefundBo bo) { |
@@ -906,7 +887,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -906,7 +887,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
906 | params.put("biz_content", bizJson.toJSONString()); | 887 | params.put("biz_content", bizJson.toJSONString()); |
907 | 888 | ||
908 | String preSignStr = getOpenApiSignString(params, false); | 889 | String preSignStr = getOpenApiSignString(params, false); |
909 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 890 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
910 | 891 | ||
911 | return params; | 892 | return params; |
912 | } | 893 | } |
@@ -919,7 +900,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -919,7 +900,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
919 | */ | 900 | */ |
920 | public String rsaSign(Map<String, String> paramsMap) { | 901 | public String rsaSign(Map<String, String> paramsMap) { |
921 | String preSignStr = getSignString(paramsMap); | 902 | String preSignStr = getSignString(paramsMap); |
922 | - return RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset); | 903 | + return helper().signWithRsa(preSignStr,AlipayConfig.input_charset); |
923 | } | 904 | } |
924 | /** | 905 | /** |
925 | * 生成RSA签名 | 906 | * 生成RSA签名 |
@@ -927,7 +908,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -927,7 +908,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
927 | * @return | 908 | * @return |
928 | */ | 909 | */ |
929 | public String rsaSign(String preSignStr) { | 910 | public String rsaSign(String preSignStr) { |
930 | - return RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset); | 911 | + return helper().signWithRsa(preSignStr,AlipayConfig.input_charset); |
931 | } | 912 | } |
932 | 913 | ||
933 | /** | 914 | /** |
@@ -936,17 +917,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -936,17 +917,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
936 | * @return | 917 | * @return |
937 | */ | 918 | */ |
938 | public boolean signVerify(Map<String, String> paramsMap) { | 919 | public boolean signVerify(Map<String, String> paramsMap) { |
939 | - if(null == paramsMap) { | 920 | + if (null == paramsMap) { |
940 | return false; | 921 | return false; |
941 | } | 922 | } |
942 | 923 | ||
943 | boolean result = false; | 924 | boolean result = false; |
944 | String signType = paramsMap.get("sign_type"); | 925 | String signType = paramsMap.get("sign_type"); |
945 | - if("RSA".equals(signType)) { | 926 | + if ("RSA".equals(signType)) { |
946 | result = rsaSignVerify(paramsMap); | 927 | result = rsaSignVerify(paramsMap); |
947 | - } | ||
948 | - else if ("MD5".equals(signType)) { | ||
949 | - result = md5SignVerify(paramsMap); | 928 | + } else { |
929 | + logger.warn("[{}] notification sign check: not support sign type {}", paramsMap.get("out_trade_no"), signType); | ||
950 | } | 930 | } |
951 | logger.info("[{}] notification sign check: {}", paramsMap.get("out_trade_no"), result); | 931 | logger.info("[{}] notification sign check: {}", paramsMap.get("out_trade_no"), result); |
952 | return result; | 932 | return result; |
@@ -989,33 +969,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -989,33 +969,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
989 | } | 969 | } |
990 | 970 | ||
991 | /** | 971 | /** |
992 | - * 验证MD5签名 | ||
993 | - * @param paramsMap | ||
994 | - * @return | ||
995 | - */ | ||
996 | - public boolean md5SignVerify(Map<String, String> paramsMap) { | ||
997 | - | ||
998 | - String preSignStr = getSignString(paramsMap) + getMd5Key(); | ||
999 | - String sign = MD5Utils.signMd5(preSignStr, AlipayConfig.input_charset); | ||
1000 | - | ||
1001 | - if(null != sign && sign.equals(paramsMap.get("sign"))) { | ||
1002 | - return true; | ||
1003 | - } | ||
1004 | - | ||
1005 | - return false; | ||
1006 | - } | ||
1007 | - | ||
1008 | - /** | ||
1009 | * 验证RSA签名 | 972 | * 验证RSA签名 |
1010 | * @param paramsMap | 973 | * @param paramsMap |
1011 | * @return | 974 | * @return |
1012 | */ | 975 | */ |
1013 | public boolean rsaSignVerify(Map<String, String> paramsMap) { | 976 | public boolean rsaSignVerify(Map<String, String> paramsMap) { |
1014 | String preSignStr = getSignString(paramsMap); | 977 | String preSignStr = getSignString(paramsMap); |
1015 | - | ||
1016 | - logger.info("method rsaSignVerify in preSignStr is {}, sign is {}, RsaAlipubKey is {}", preSignStr, paramsMap.get("sign"), getRsaAlipubKey()); | ||
1017 | - | ||
1018 | - return RSAUtils.verify(preSignStr, paramsMap.get("sign"), getRsaAlipubKey(), AlipayConfig.input_charset); | 978 | + return helper().verifyWithRsa(preSignStr,AlipayConfig.input_charset,paramsMap.get("sign")); |
1019 | } | 979 | } |
1020 | 980 | ||
1021 | /** | 981 | /** |
1 | -package com.yohoufo.order.service.pay.alipay; | ||
2 | - | ||
3 | -import com.yohoufo.order.config.AlipayConfig; | ||
4 | -import org.springframework.stereotype.Service; | ||
5 | - | ||
6 | -@Service | ||
7 | -public class AlipayBlkService extends AlipayServiceAbstract { | ||
8 | - | ||
9 | - @Override | ||
10 | - protected String getPartnerId() { | ||
11 | - return AlipayConfig.BLK_PARTNER; | ||
12 | - } | ||
13 | - | ||
14 | - @Override | ||
15 | - protected String getMd5Key() { | ||
16 | - return AlipayConfig.BLK_KEY_MD5; | ||
17 | - } | ||
18 | - | ||
19 | - @Override | ||
20 | - protected String getRsaPrivateKey() { | ||
21 | - return AlipayConfig.BLK_MCH_RSA_PRIVATE; | ||
22 | - } | ||
23 | - | ||
24 | - @Override | ||
25 | - protected String getRsaAlipubKey() { | ||
26 | - return AlipayConfig.BLK_ALI_RSA_PUBLIC; | ||
27 | - } | ||
28 | - | ||
29 | - @Override | ||
30 | - protected String getAppId() { | ||
31 | - return AlipayConfig.BLK_APPID; | ||
32 | - } | ||
33 | - | ||
34 | -} |
1 | package com.yohoufo.order.service.pay.alipay; | 1 | package com.yohoufo.order.service.pay.alipay; |
2 | 2 | ||
3 | -import com.alibaba.fastjson.JSON; | ||
4 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
5 | import com.yohobuy.ufo.model.order.bo.OrderInfo; | 4 | import com.yohobuy.ufo.model.order.bo.OrderInfo; |
6 | import com.yohoufo.common.utils.DateUtil; | 5 | import com.yohoufo.common.utils.DateUtil; |
@@ -12,47 +11,27 @@ import com.yohoufo.order.model.PayQueryBo; | @@ -12,47 +11,27 @@ import com.yohoufo.order.model.PayQueryBo; | ||
12 | import com.yohoufo.order.model.PayRefundBo; | 11 | import com.yohoufo.order.model.PayRefundBo; |
13 | import com.yohoufo.order.service.pay.alipay.bean.AlipayQueryResponse; | 12 | import com.yohoufo.order.service.pay.alipay.bean.AlipayQueryResponse; |
14 | import com.yohoufo.order.service.pay.alipay.bean.AlipayRefundResponse; | 13 | import com.yohoufo.order.service.pay.alipay.bean.AlipayRefundResponse; |
15 | -import org.apache.commons.lang3.StringUtils; | ||
16 | -import org.apache.http.client.utils.DateUtils; | ||
17 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
18 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
19 | -import org.springframework.beans.factory.annotation.Value; | ||
20 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
21 | import java.math.BigDecimal; | 17 | import java.math.BigDecimal; |
22 | import java.net.URLEncoder; | 18 | import java.net.URLEncoder; |
23 | -import java.util.Date; | ||
24 | import java.util.HashMap; | 19 | import java.util.HashMap; |
25 | import java.util.Map; | 20 | import java.util.Map; |
26 | 21 | ||
27 | @Service | 22 | @Service |
28 | -public class AlipayCrossBorderService extends AlipayServiceAbstract { | 23 | +public class AlipayCrossBorderService extends AbstractAlipayService { |
29 | 24 | ||
30 | 25 | ||
31 | private static final Logger logger = LoggerFactory.getLogger("alipayLogger"); | 26 | private static final Logger logger = LoggerFactory.getLogger("alipayLogger"); |
32 | - | ||
33 | - @Override | ||
34 | - protected String getMd5Key() { | ||
35 | - return ""; | ||
36 | - } | ||
37 | - | ||
38 | - @Override | ||
39 | - protected String getRsaAlipubKey() { | ||
40 | - return AlipayConfig.CROSS_BORDER_RSA_PUBLIC; | ||
41 | - } | ||
42 | - | ||
43 | - @Override | ||
44 | - protected String getRsaPrivateKey() { | ||
45 | - return AlipayConfig.CROSS_BORDER_RSA_PRIVATE; | ||
46 | - } | ||
47 | - | ||
48 | - @Override | ||
49 | - protected String getAppId() { | ||
50 | - return ""; | ||
51 | - } | ||
52 | - | ||
53 | @Override | 27 | @Override |
54 | - protected String getPartnerId() { | ||
55 | - return "2088121119526910"; | 28 | + protected AlipaySignatureSetting getAlipaySignatureSetting() { |
29 | + return new AlipaySignatureSetting( | ||
30 | + "2088121119526910", | ||
31 | + "2088121119526910", | ||
32 | + false, | ||
33 | + "RSA" | ||
34 | + ); | ||
56 | } | 35 | } |
57 | 36 | ||
58 | private String getSellerId(){ | 37 | private String getSellerId(){ |
@@ -114,7 +93,7 @@ public class AlipayCrossBorderService extends AlipayServiceAbstract { | @@ -114,7 +93,7 @@ public class AlipayCrossBorderService extends AlipayServiceAbstract { | ||
114 | params.put("product_code", "NEW_WAP_OVERSEAS_SELLER"); | 93 | params.put("product_code", "NEW_WAP_OVERSEAS_SELLER"); |
115 | 94 | ||
116 | String preSignStr = getOpenApiSignString(params, true); | 95 | String preSignStr = getOpenApiSignString(params, true); |
117 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 96 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
118 | 97 | ||
119 | return params; | 98 | return params; |
120 | } | 99 | } |
@@ -160,7 +139,7 @@ public class AlipayCrossBorderService extends AlipayServiceAbstract { | @@ -160,7 +139,7 @@ public class AlipayCrossBorderService extends AlipayServiceAbstract { | ||
160 | params.put("out_trade_no", orderCode); | 139 | params.put("out_trade_no", orderCode); |
161 | 140 | ||
162 | String preSignStr = getOpenApiSignString(params, true); | 141 | String preSignStr = getOpenApiSignString(params, true); |
163 | - params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset)); | 142 | + params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset)); |
164 | return params; | 143 | return params; |
165 | } | 144 | } |
166 | 145 | ||
@@ -227,7 +206,7 @@ public class AlipayCrossBorderService extends AlipayServiceAbstract { | @@ -227,7 +206,7 @@ public class AlipayCrossBorderService extends AlipayServiceAbstract { | ||
227 | params.put("trade_information", trade_information.toJSONString()); | 206 | params.put("trade_information", trade_information.toJSONString()); |
228 | 207 | ||
229 | String preSignStr = getOpenApiSignString(params, true); | 208 | String preSignStr = getOpenApiSignString(params, true); |
230 | - String sign = RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset); | 209 | + String sign = helper().signWithRsa(preSignStr,AlipayConfig.input_charset); |
231 | params.put("sign", URLEncoder.encode(sign)); | 210 | params.put("sign", URLEncoder.encode(sign)); |
232 | 211 | ||
233 | return params; | 212 | return params; |
order/src/main/java/com/yohoufo/order/service/pay/alipay/AlipayOuyin01Service.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.alipay; | ||
2 | - | ||
3 | -import com.yohoufo.order.config.AlipayConfig; | ||
4 | -import org.springframework.stereotype.Service; | ||
5 | - | ||
6 | -@Service | ||
7 | -public class AlipayOuyin01Service extends AlipayServiceAbstract { | ||
8 | - | ||
9 | - @Override | ||
10 | - protected String getPartnerId() { | ||
11 | - return AlipayConfig.OUYIN01_PARTNER; | ||
12 | - } | ||
13 | - | ||
14 | - @Override | ||
15 | - protected String getMd5Key() { | ||
16 | - return AlipayConfig.OUYIN01_KEY_MD5; | ||
17 | - } | ||
18 | - | ||
19 | - @Override | ||
20 | - protected String getRsaPrivateKey() { | ||
21 | - return AlipayConfig.OUYIN01_MCH_RSA_PRIVATE; | ||
22 | - } | ||
23 | - | ||
24 | - @Override | ||
25 | - protected String getRsaAlipubKey() { | ||
26 | - return AlipayConfig.OUYIN01_ALI_RSA_PUBLIC; | ||
27 | - } | ||
28 | - | ||
29 | - @Override | ||
30 | - protected String getAppId() { | ||
31 | - return AlipayConfig.OUYIN01_APPID; | ||
32 | - } | ||
33 | - | ||
34 | - | ||
35 | -} |
@@ -2,36 +2,19 @@ package com.yohoufo.order.service.pay.alipay; | @@ -2,36 +2,19 @@ package com.yohoufo.order.service.pay.alipay; | ||
2 | 2 | ||
3 | import com.yohoufo.order.config.AlipayConfig; | 3 | import com.yohoufo.order.config.AlipayConfig; |
4 | 4 | ||
5 | -import java.util.Map; | ||
6 | - | ||
7 | import org.springframework.stereotype.Service; | 5 | import org.springframework.stereotype.Service; |
8 | 6 | ||
9 | @Service | 7 | @Service |
10 | -public class AlipayOuyinService extends AlipayServiceAbstract { | ||
11 | - | ||
12 | - @Override | ||
13 | - protected String getPartnerId() { | ||
14 | - return AlipayConfig.OUYIN_PARTNER; | ||
15 | - } | ||
16 | - | ||
17 | - @Override | ||
18 | - protected String getMd5Key() { | ||
19 | - return AlipayConfig.OUYIN_KEY_MD5; | ||
20 | - } | ||
21 | - | ||
22 | - @Override | ||
23 | - protected String getRsaPrivateKey() { | ||
24 | - return AlipayConfig.OUYIN_MCH_RSA_PRIVATE; | ||
25 | - } | 8 | +public class AlipayOuyinService extends AbstractAlipayService { |
26 | 9 | ||
27 | @Override | 10 | @Override |
28 | - protected String getRsaAlipubKey() { | ||
29 | - return AlipayConfig.OUYIN_ALI_RSA_PUBLIC; | ||
30 | - } | ||
31 | - | ||
32 | - @Override | ||
33 | - protected String getAppId() { | ||
34 | - return AlipayConfig.OUYIN_APPID; | 11 | + protected AlipaySignatureSetting getAlipaySignatureSetting() { |
12 | + return new AlipaySignatureSetting( | ||
13 | + AlipayConfig.OUYIN_APPID, | ||
14 | + AlipayConfig.OUYIN_PARTNER, | ||
15 | + false, | ||
16 | + "RSA" | ||
17 | + ); | ||
35 | } | 18 | } |
36 | 19 | ||
37 | @Override | 20 | @Override |
1 | -package com.yohoufo.order.service.pay.alipay; | ||
2 | - | ||
3 | -import com.yohoufo.order.config.AlipayConfig; | ||
4 | -import org.springframework.stereotype.Service; | ||
5 | - | ||
6 | -@Service | ||
7 | -public class AlipayService extends AlipayServiceAbstract { | ||
8 | - | ||
9 | - @Override | ||
10 | - protected String getPartnerId() { | ||
11 | - return AlipayConfig.partner; | ||
12 | - } | ||
13 | - | ||
14 | - @Override | ||
15 | - protected String getMd5Key() { | ||
16 | - return AlipayConfig.private_key_md5; | ||
17 | - } | ||
18 | - | ||
19 | - @Override | ||
20 | - protected String getRsaPrivateKey() { | ||
21 | - return AlipayConfig.private_key; | ||
22 | - } | ||
23 | - | ||
24 | - @Override | ||
25 | - protected String getRsaAlipubKey() { | ||
26 | - return AlipayConfig.ali_public_key; | ||
27 | - } | ||
28 | - | ||
29 | - @Override | ||
30 | - protected String getAppId() { | ||
31 | - return AlipayConfig.appid; | ||
32 | - } | ||
33 | -} |
1 | +package com.yohoufo.order.service.pay.alipay; | ||
2 | + | ||
3 | +import com.yoho.core.security.AlipayException; | ||
4 | +import com.yoho.core.security.AlipayMapiHelper; | ||
5 | +import com.yoho.core.security.AlipayOpenapiHelper; | ||
6 | +import lombok.extern.slf4j.Slf4j; | ||
7 | +import org.apache.commons.lang3.StringUtils; | ||
8 | + | ||
9 | +import static com.yohoufo.order.utils.ServiceExceptions.throwServiceException; | ||
10 | + | ||
11 | + | ||
12 | +@Slf4j | ||
13 | +public class AlipaySignatureHelper { | ||
14 | + | ||
15 | + | ||
16 | + private final AlipaySignatureSetting setting; | ||
17 | + private final AlipayMapiHelper alipayMapiHelper; | ||
18 | + private final AlipayOpenapiHelper alipayOpenapiHelper; | ||
19 | + | ||
20 | + AlipaySignatureHelper(AlipaySignatureSetting setting, AlipayMapiHelper alipayMapiHelper, AlipayOpenapiHelper alipayOpenapiHelper) { | ||
21 | + this.setting = setting; | ||
22 | + this.alipayMapiHelper = alipayMapiHelper; | ||
23 | + this.alipayOpenapiHelper = alipayOpenapiHelper; | ||
24 | + } | ||
25 | + | ||
26 | + public String signWithMd5(String content) { | ||
27 | + String sign = StringUtils.EMPTY; | ||
28 | + try { | ||
29 | + sign = alipayMapiHelper.signMD5(setting.getPartnerId(), content); | ||
30 | + } catch (AlipayException e) { | ||
31 | + throwSignatureException(e); | ||
32 | + } | ||
33 | + return sign; | ||
34 | + } | ||
35 | + | ||
36 | + public String signWithRsa(String content, String charset) { | ||
37 | + String sign = StringUtils.EMPTY; | ||
38 | + if (setting.isUseMapi()) { | ||
39 | + try { | ||
40 | + sign = alipayMapiHelper.signRSA(setting.getPartnerId(), content, charset); | ||
41 | + } catch (AlipayException e) { | ||
42 | + throwSignatureException(e); | ||
43 | + } | ||
44 | + } else { | ||
45 | + try { | ||
46 | + sign = alipayOpenapiHelper.sign(setting.getAppId(), content, charset, setting.getRsaType()); | ||
47 | + } catch (AlipayException e) { | ||
48 | + throwSignatureException(e); | ||
49 | + } | ||
50 | + } | ||
51 | + return sign; | ||
52 | + } | ||
53 | + | ||
54 | + public boolean verifyWithRsa(String content, String charset, String sign) { | ||
55 | + boolean success = false; | ||
56 | + try { | ||
57 | + success = alipayOpenapiHelper.verify(setting.getAppId(), content, sign, charset, setting.getRsaType()); | ||
58 | + } catch (AlipayException e) { | ||
59 | + throwSignatureException(e); | ||
60 | + } | ||
61 | + return success; | ||
62 | + } | ||
63 | + | ||
64 | + public void throwSignatureException(Exception e) { | ||
65 | + log.info("sign fail", e); | ||
66 | + throwServiceException("支付宝签名失败"); | ||
67 | + } | ||
68 | + | ||
69 | +} |
order/src/main/java/com/yohoufo/order/service/pay/alipay/AlipaySignatureHelperFactory.java
0 → 100644
1 | +package com.yohoufo.order.service.pay.alipay; | ||
2 | + | ||
3 | +import com.yoho.core.security.AlipayMapiHelper; | ||
4 | +import com.yoho.core.security.AlipayOpenapiHelper; | ||
5 | +import lombok.extern.slf4j.Slf4j; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +@Slf4j | ||
10 | +@Service | ||
11 | +public class AlipaySignatureHelperFactory { | ||
12 | + | ||
13 | + @Autowired | ||
14 | + private AlipayMapiHelper alipayMapiHelper; | ||
15 | + | ||
16 | + @Autowired | ||
17 | + private AlipayOpenapiHelper alipayOpenapiHelper; | ||
18 | + | ||
19 | + public AlipaySignatureHelper newAlipaySignatureHelper(AlipaySignatureSetting setting) { | ||
20 | + return new AlipaySignatureHelper(setting, alipayMapiHelper, alipayOpenapiHelper); | ||
21 | + } | ||
22 | + | ||
23 | + | ||
24 | +} |
1 | +package com.yohoufo.order.service.pay.alipay; | ||
2 | + | ||
3 | +import lombok.Value; | ||
4 | +import lombok.experimental.Accessors; | ||
5 | + | ||
6 | +@Value | ||
7 | +@Accessors(chain = true) | ||
8 | +public class AlipaySignatureSetting { | ||
9 | + private String appId; | ||
10 | + private String partnerId; | ||
11 | + private boolean useMapi; | ||
12 | + private String rsaType; | ||
13 | +} |
@@ -2,6 +2,8 @@ package com.yohoufo.order.service.pay.weixin; | @@ -2,6 +2,8 @@ package com.yohoufo.order.service.pay.weixin; | ||
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | import com.yoho.core.common.utils.YHMath; | 4 | import com.yoho.core.common.utils.YHMath; |
5 | +import com.yoho.core.security.WechatException; | ||
6 | +import com.yoho.core.security.WechatHelper; | ||
5 | import com.yoho.error.ServiceError; | 7 | import com.yoho.error.ServiceError; |
6 | import com.yoho.error.exception.ServiceException; | 8 | import com.yoho.error.exception.ServiceException; |
7 | import com.yohoufo.common.utils.DateUtil; | 9 | import com.yohoufo.common.utils.DateUtil; |
@@ -27,10 +29,12 @@ import java.util.HashMap; | @@ -27,10 +29,12 @@ import java.util.HashMap; | ||
27 | import java.util.LinkedHashMap; | 29 | import java.util.LinkedHashMap; |
28 | import java.util.Map; | 30 | import java.util.Map; |
29 | 31 | ||
32 | +import static com.yohoufo.order.utils.ServiceExceptions.throwServiceException; | ||
33 | + | ||
30 | public abstract class AbstractWeixinPayService extends AbstractPayService { | 34 | public abstract class AbstractWeixinPayService extends AbstractPayService { |
31 | 35 | ||
32 | 36 | ||
33 | - private static final Logger logger = LoggerFactory.getLogger("wechatLogger"); | 37 | + private static final Logger log = LoggerFactory.getLogger("wechatLogger"); |
34 | 38 | ||
35 | 39 | ||
36 | @Value("${wechat.notifyurl}") | 40 | @Value("${wechat.notifyurl}") |
@@ -43,14 +47,13 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -43,14 +47,13 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
43 | @Autowired | 47 | @Autowired |
44 | PaymentSupportService paymentSupportService; | 48 | PaymentSupportService paymentSupportService; |
45 | 49 | ||
46 | - protected abstract String getMchId(); | 50 | + @Autowired |
51 | + private WechatHelper wechatHelper; | ||
47 | 52 | ||
48 | - protected abstract String getMchKey(); | 53 | + protected abstract String getMchId(); |
49 | 54 | ||
50 | protected abstract String getAppId(); | 55 | protected abstract String getAppId(); |
51 | 56 | ||
52 | - protected abstract String getMchCertPath(); | ||
53 | - | ||
54 | protected abstract String getTradeType(); | 57 | protected abstract String getTradeType(); |
55 | 58 | ||
56 | protected abstract HttpClient getSslHttpClient(); | 59 | protected abstract HttpClient getSslHttpClient(); |
@@ -60,12 +63,12 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -60,12 +63,12 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
60 | //验证业务结果 | 63 | //验证业务结果 |
61 | String resultCode = paramsMap.get(WeixinPayConfig.ApiConstants.RETURN_RESULT_CODE); | 64 | String resultCode = paramsMap.get(WeixinPayConfig.ApiConstants.RETURN_RESULT_CODE); |
62 | if(!WeixinPayConfig.ApiConstants.PREPAY_RESULT_SUCCESS.equals(resultCode)){ | 65 | if(!WeixinPayConfig.ApiConstants.PREPAY_RESULT_SUCCESS.equals(resultCode)){ |
63 | - logger.error("[{}] trade failed, resultCode: {}", paramsMap.get("out_trade_no"), resultCode); | 66 | + log.error("[{}] trade failed, resultCode: {}", paramsMap.get("out_trade_no"), resultCode); |
64 | return false; | 67 | return false; |
65 | } | 68 | } |
66 | 69 | ||
67 | if(!md5SignVerify(paramsMap)) { | 70 | if(!md5SignVerify(paramsMap)) { |
68 | - logger.error("[{}] sign verify failed", paramsMap.get("out_trade_no")); | 71 | + log.error("[{}] sign verify failed", paramsMap.get("out_trade_no")); |
69 | return false; | 72 | return false; |
70 | } | 73 | } |
71 | 74 | ||
@@ -135,17 +138,17 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -135,17 +138,17 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
135 | * @return | 138 | * @return |
136 | */ | 139 | */ |
137 | private String sendQueryRequest(String tradeNo, String requestXml) { | 140 | private String sendQueryRequest(String tradeNo, String requestXml) { |
138 | - logger.info("WeixinQuerier request tradeNo: {}, request: {}", tradeNo, requestXml); | 141 | + log.info("WeixinQuerier request tradeNo: {}, request: {}", tradeNo, requestXml); |
139 | 142 | ||
140 | String respXml = ""; | 143 | String respXml = ""; |
141 | try { | 144 | try { |
142 | respXml = httpClient.post(WeixinPayConfig.WEIXIN_PAY_QUERY_URL, requestXml); | 145 | respXml = httpClient.post(WeixinPayConfig.WEIXIN_PAY_QUERY_URL, requestXml); |
143 | } catch (Exception e) { | 146 | } catch (Exception e) { |
144 | - logger.error("WeixinQuerier request failed, orderCode:{}, ex: {}", tradeNo, e.getMessage()); | 147 | + log.error("WeixinQuerier request failed, orderCode:{}, ex: {}", tradeNo, e.getMessage()); |
145 | return respXml; | 148 | return respXml; |
146 | } | 149 | } |
147 | 150 | ||
148 | - logger.info("WeixinQuerier response: {}", respXml); | 151 | + log.info("WeixinQuerier response: {}", respXml); |
149 | return respXml; | 152 | return respXml; |
150 | } | 153 | } |
151 | 154 | ||
@@ -164,15 +167,29 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -164,15 +167,29 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
164 | paramMap.put("nonce_str", WXUtils.getNonceStr()); | 167 | paramMap.put("nonce_str", WXUtils.getNonceStr()); |
165 | 168 | ||
166 | //md5签名 | 169 | //md5签名 |
167 | - String sign = WXUtils.signMd5(paramMap, getMchKey()); | 170 | + String sign = signByMD5(paramMap); |
168 | paramMap.put(WeixinPayConfig.ApiConstants.SIGN, sign); | 171 | paramMap.put(WeixinPayConfig.ApiConstants.SIGN, sign); |
169 | return paramMap; | 172 | return paramMap; |
170 | } | 173 | } |
171 | 174 | ||
175 | + protected String signByMD5(Map<String, String> signParams) { | ||
176 | + String sign; | ||
177 | + try { | ||
178 | + | ||
179 | + sign = wechatHelper.signByMD5(getMchId(), WXUtils.buildPreSignContent(signParams).toString()); | ||
180 | + | ||
181 | + } catch (WechatException e) { | ||
182 | + log.info("wechat sign fail", e); | ||
183 | + throwServiceException("微信签名失败"); | ||
184 | + sign = StringUtils.EMPTY; | ||
185 | + } | ||
186 | + return sign; | ||
187 | + } | ||
188 | + | ||
172 | 189 | ||
173 | public PaymentData getPaymentData(Map<String, String> paramsMap) { | 190 | public PaymentData getPaymentData(Map<String, String> paramsMap) { |
174 | PaymentData paymentData = new PaymentData(); | 191 | PaymentData paymentData = new PaymentData(); |
175 | - logger.info("paramsMap is: {}", paramsMap); | 192 | + log.info("paramsMap is: {}", paramsMap); |
176 | try { | 193 | try { |
177 | /** | 194 | /** |
178 | * 普通支付 out_trade_no就是订单号 | 195 | * 普通支付 out_trade_no就是订单号 |
@@ -197,7 +214,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -197,7 +214,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
197 | paymentData.setAppId(paramsMap.get("appid")); | 214 | paymentData.setAppId(paramsMap.get("appid")); |
198 | 215 | ||
199 | } catch (Exception e) { | 216 | } catch (Exception e) { |
200 | - logger.error("[{}] get payment data error: {}", paramsMap.get("out_trade_no"), e.getMessage()); | 217 | + log.error("[{}] get payment data error: {}", paramsMap.get("out_trade_no"), e.getMessage()); |
201 | throw new ServiceException(ServiceError.ORDER_PAYMENT_IS_EMPTY); | 218 | throw new ServiceException(ServiceError.ORDER_PAYMENT_IS_EMPTY); |
202 | } | 219 | } |
203 | return paymentData; | 220 | return paymentData; |
@@ -242,49 +259,48 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -242,49 +259,48 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
242 | 259 | ||
243 | /** | 260 | /** |
244 | * 退款请求 | 261 | * 退款请求 |
245 | - * @param orderCode | ||
246 | * @param requestXml | 262 | * @param requestXml |
247 | * @return | 263 | * @return |
248 | */ | 264 | */ |
249 | private String sendRefundRequest(String tradeNo, String requestXml) { | 265 | private String sendRefundRequest(String tradeNo, String requestXml) { |
250 | - logger.info("WeixinRefunder request tradeNo: {}, request: {}", tradeNo, requestXml); | 266 | + log.info("WeixinRefunder request tradeNo: {}, request: {}", tradeNo, requestXml); |
251 | 267 | ||
252 | String respXml = ""; | 268 | String respXml = ""; |
253 | HttpClient httpClient = getSslHttpClient(); | 269 | HttpClient httpClient = getSslHttpClient(); |
254 | if(httpClient == null) { | 270 | if(httpClient == null) { |
255 | - logger.error("init weixin ssl httpclient faild, unable refund weixinpay"); | 271 | + log.error("init weixin ssl httpclient faild, unable refund weixinpay"); |
256 | return respXml; | 272 | return respXml; |
257 | } | 273 | } |
258 | 274 | ||
259 | try { | 275 | try { |
260 | respXml = httpClient.post(WeixinPayConfig.WEIXIN_PAY_REFUND_URL, requestXml); | 276 | respXml = httpClient.post(WeixinPayConfig.WEIXIN_PAY_REFUND_URL, requestXml); |
261 | } catch (Exception e) { | 277 | } catch (Exception e) { |
262 | - logger.error("WeixinRefunder request failed, orderCode:{}, ex: {}", tradeNo, e.getMessage()); | 278 | + log.error("WeixinRefunder request failed, orderCode:{}, ex: {}", tradeNo, e.getMessage()); |
263 | } | 279 | } |
264 | 280 | ||
265 | - logger.info("WeixinRefunder response: {}", respXml); | 281 | + log.info("WeixinRefunder response: {}", respXml); |
266 | return respXml; | 282 | return respXml; |
267 | } | 283 | } |
268 | 284 | ||
269 | 285 | ||
270 | public JSONObject prepayRequest(OrderInfo orderInfo) { | 286 | public JSONObject prepayRequest(OrderInfo orderInfo) { |
271 | - logger.info("[{}] prepayRequest begin", orderInfo.getOrderCode()); | 287 | + log.info("[{}] prepayRequest begin", orderInfo.getOrderCode()); |
272 | Map<String, String> requestParams = buildPrepayParams( orderInfo); | 288 | Map<String, String> requestParams = buildPrepayParams( orderInfo); |
273 | String requestXml = WXUtils.createWXPayXml(requestParams); | 289 | String requestXml = WXUtils.createWXPayXml(requestParams); |
274 | String respXml = sendPrepayRequest(orderInfo.getOrderCode(), requestXml); | 290 | String respXml = sendPrepayRequest(orderInfo.getOrderCode(), requestXml); |
275 | if(StringUtils.isEmpty(respXml)) { | 291 | if(StringUtils.isEmpty(respXml)) { |
276 | - logger.error("[{}] prepayRequest failed", orderInfo.getOrderCode()); | 292 | + log.error("[{}] prepayRequest failed", orderInfo.getOrderCode()); |
277 | return null; | 293 | return null; |
278 | } | 294 | } |
279 | 295 | ||
280 | Map<String, String> reponseMap = WXUtils.parseWXPayXml(respXml); | 296 | Map<String, String> reponseMap = WXUtils.parseWXPayXml(respXml); |
281 | if(!checkPrepayResponse(orderInfo.getOrderCode(), reponseMap)) { | 297 | if(!checkPrepayResponse(orderInfo.getOrderCode(), reponseMap)) { |
282 | - logger.error("[{}] valid prepay response failed", orderInfo.getOrderCode()); | 298 | + log.error("[{}] valid prepay response failed", orderInfo.getOrderCode()); |
283 | return null; | 299 | return null; |
284 | } | 300 | } |
285 | 301 | ||
286 | JSONObject prepayJson = getPrepayData(requestParams, reponseMap); | 302 | JSONObject prepayJson = getPrepayData(requestParams, reponseMap); |
287 | - logger.info("[{}] response prepayData: {}", orderInfo.getOrderCode(), prepayJson); | 303 | + log.info("[{}] response prepayData: {}", orderInfo.getOrderCode(), prepayJson); |
288 | return prepayJson; | 304 | return prepayJson; |
289 | } | 305 | } |
290 | 306 | ||
@@ -304,7 +320,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -304,7 +320,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
304 | 320 | ||
305 | //签名 | 321 | //签名 |
306 | //md5签名 | 322 | //md5签名 |
307 | - String sign = WXUtils.signMd5(paramMap, getMchKey()); | 323 | + String sign = signByMD5(paramMap); |
308 | paramMap.put(WeixinPayConfig.ApiConstants.SIGN, sign); | 324 | paramMap.put(WeixinPayConfig.ApiConstants.SIGN, sign); |
309 | 325 | ||
310 | return paramMap; | 326 | return paramMap; |
@@ -342,7 +358,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -342,7 +358,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
342 | private JSONObject getNativePrepayData(Map<String, String> requestParams, Map<String, String> responseParams) { | 358 | private JSONObject getNativePrepayData(Map<String, String> requestParams, Map<String, String> responseParams) { |
343 | String codeUrl = responseParams.get(WeixinPayConfig.ApiConstants.RETURN_CODE_URL); | 359 | String codeUrl = responseParams.get(WeixinPayConfig.ApiConstants.RETURN_CODE_URL); |
344 | if(StringUtils.isEmpty(codeUrl)) { | 360 | if(StringUtils.isEmpty(codeUrl)) { |
345 | - logger.error("[{}] obtain codeUrl failed", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO)); | 361 | + log.error("[{}] obtain codeUrl failed", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO)); |
346 | return null; | 362 | return null; |
347 | } | 363 | } |
348 | JSONObject sendData = new JSONObject(); | 364 | JSONObject sendData = new JSONObject(); |
@@ -358,7 +374,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -358,7 +374,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
358 | private JSONObject getJSAPIPrepayData(Map<String, String> requestParams, Map<String, String> responseParams) { | 374 | private JSONObject getJSAPIPrepayData(Map<String, String> requestParams, Map<String, String> responseParams) { |
359 | String prepayId = responseParams.get(WeixinPayConfig.ApiConstants.RETURN_PREPAY_ID); | 375 | String prepayId = responseParams.get(WeixinPayConfig.ApiConstants.RETURN_PREPAY_ID); |
360 | if(StringUtils.isEmpty(prepayId)) { | 376 | if(StringUtils.isEmpty(prepayId)) { |
361 | - logger.error("[{}] obtain prepayId failed", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO)); | 377 | + log.error("[{}] obtain prepayId failed", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO)); |
362 | return null; | 378 | return null; |
363 | } | 379 | } |
364 | 380 | ||
@@ -371,7 +387,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -371,7 +387,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
371 | signParams.put("timeStamp", timeStamp); | 387 | signParams.put("timeStamp", timeStamp); |
372 | signParams.put("signType", "MD5"); | 388 | signParams.put("signType", "MD5"); |
373 | 389 | ||
374 | - String sign = WXUtils.signMd5(signParams, getMchKey()); | 390 | + String sign = signByMD5(signParams); |
375 | 391 | ||
376 | JSONObject prepayJson = new JSONObject(); | 392 | JSONObject prepayJson = new JSONObject(); |
377 | prepayJson.put("timeStamp", signParams.get("timeStamp")); | 393 | prepayJson.put("timeStamp", signParams.get("timeStamp")); |
@@ -391,7 +407,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -391,7 +407,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
391 | private JSONObject getAppPrepayData(Map<String, String> requestParams, Map<String, String> responseParams) { | 407 | private JSONObject getAppPrepayData(Map<String, String> requestParams, Map<String, String> responseParams) { |
392 | String prepayId = responseParams.get(WeixinPayConfig.ApiConstants.RETURN_PREPAY_ID); | 408 | String prepayId = responseParams.get(WeixinPayConfig.ApiConstants.RETURN_PREPAY_ID); |
393 | if(StringUtils.isEmpty(prepayId)) { | 409 | if(StringUtils.isEmpty(prepayId)) { |
394 | - logger.error("[{}] obtain prepayId failed", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO)); | 410 | + log.error("[{}] obtain prepayId failed", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO)); |
395 | return null; | 411 | return null; |
396 | } | 412 | } |
397 | 413 | ||
@@ -405,7 +421,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -405,7 +421,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
405 | prePayData.put("noncestr", requestParams.get(WeixinPayConfig.ApiConstants.NONCE_STR)); | 421 | prePayData.put("noncestr", requestParams.get(WeixinPayConfig.ApiConstants.NONCE_STR)); |
406 | prePayData.put("timestamp", timeStamp); | 422 | prePayData.put("timestamp", timeStamp); |
407 | 423 | ||
408 | - String sign = WXUtils.signMd5(prePayData, getMchKey()); | 424 | + String sign = signByMD5(prePayData); |
409 | prePayData.put("sign", sign); | 425 | prePayData.put("sign", sign); |
410 | 426 | ||
411 | JSONObject sendData = new JSONObject(); | 427 | JSONObject sendData = new JSONObject(); |
@@ -413,7 +429,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -413,7 +429,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
413 | sendData.put("token", "xxxxx"); //实际上没用,为兼容APP,暂且保留 | 429 | sendData.put("token", "xxxxx"); //实际上没用,为兼容APP,暂且保留 |
414 | sendData.put("prePayData", prePayData); | 430 | sendData.put("prePayData", prePayData); |
415 | 431 | ||
416 | - //logger.info("[] weixin prepay data: {}", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO), prePayData); | 432 | + //log.info("[] weixin prepay data: {}", requestParams.get(WeixinPayConfig.ApiConstants.OUT_TRADE_NO), prePayData); |
417 | return sendData; | 433 | return sendData; |
418 | } | 434 | } |
419 | 435 | ||
@@ -426,25 +442,25 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -426,25 +442,25 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
426 | */ | 442 | */ |
427 | private boolean checkPrepayResponse(long orderCode, Map<String, String> reponseMap) { | 443 | private boolean checkPrepayResponse(long orderCode, Map<String, String> reponseMap) { |
428 | if(reponseMap == null || reponseMap.size() == 0) { | 444 | if(reponseMap == null || reponseMap.size() == 0) { |
429 | - logger.error("[{}] Prepay response parse failed", orderCode); | 445 | + log.error("[{}] Prepay response parse failed", orderCode); |
430 | return false; | 446 | return false; |
431 | } | 447 | } |
432 | 448 | ||
433 | String returnCode = reponseMap.get(WeixinPayConfig.ApiConstants.RETURN_CODE); | 449 | String returnCode = reponseMap.get(WeixinPayConfig.ApiConstants.RETURN_CODE); |
434 | String resultCode = reponseMap.get(WeixinPayConfig.ApiConstants.RETURN_RESULT_CODE); | 450 | String resultCode = reponseMap.get(WeixinPayConfig.ApiConstants.RETURN_RESULT_CODE); |
435 | if(!WeixinPayConfig.ApiConstants.PREPAY_RESULT_SUCCESS.equals(returnCode)) { | 451 | if(!WeixinPayConfig.ApiConstants.PREPAY_RESULT_SUCCESS.equals(returnCode)) { |
436 | - logger.error("[{}] prepay returnCode error: {}", orderCode, returnCode); | 452 | + log.error("[{}] prepay returnCode error: {}", orderCode, returnCode); |
437 | return false; | 453 | return false; |
438 | } | 454 | } |
439 | 455 | ||
440 | //验证签名 | 456 | //验证签名 |
441 | if(!md5SignVerify(reponseMap)){ | 457 | if(!md5SignVerify(reponseMap)){ |
442 | - logger.error("[{}] sign verify failed", orderCode); | 458 | + log.error("[{}] sign verify failed", orderCode); |
443 | return false; | 459 | return false; |
444 | } | 460 | } |
445 | //return_code和result_code都为SUCCESS时,返回prepayId | 461 | //return_code和result_code都为SUCCESS时,返回prepayId |
446 | if(!WeixinPayConfig.ApiConstants.PREPAY_RESULT_SUCCESS.equals(resultCode)){ | 462 | if(!WeixinPayConfig.ApiConstants.PREPAY_RESULT_SUCCESS.equals(resultCode)){ |
447 | - logger.error("[{}] prepay resultCode error: {}", orderCode, resultCode); | 463 | + log.error("[{}] prepay resultCode error: {}", orderCode, resultCode); |
448 | return false; | 464 | return false; |
449 | } | 465 | } |
450 | 466 | ||
@@ -461,8 +477,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -461,8 +477,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
461 | if(paramsMap == null) | 477 | if(paramsMap == null) |
462 | return false; | 478 | return false; |
463 | 479 | ||
464 | - return WXUtils.signMd5(paramsMap, getMchKey()) | ||
465 | - .equals(paramsMap.get(WeixinPayConfig.ApiConstants.SIGN)); | 480 | + return signByMD5(paramsMap).equals(paramsMap.get(WeixinPayConfig.ApiConstants.SIGN)); |
466 | } | 481 | } |
467 | 482 | ||
468 | /** | 483 | /** |
@@ -472,17 +487,17 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -472,17 +487,17 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
472 | * @return | 487 | * @return |
473 | */ | 488 | */ |
474 | private String sendPrepayRequest(long orderCode, String requestXml) { | 489 | private String sendPrepayRequest(long orderCode, String requestXml) { |
475 | - logger.info("[{}] prepay request: {}", orderCode, requestXml); | 490 | + log.info("[{}] prepay request: {}", orderCode, requestXml); |
476 | 491 | ||
477 | String respXml = ""; | 492 | String respXml = ""; |
478 | try { | 493 | try { |
479 | respXml = httpClient.post(WeixinPayConfig.WEIXIN_PREPAY_URL, requestXml); | 494 | respXml = httpClient.post(WeixinPayConfig.WEIXIN_PREPAY_URL, requestXml); |
480 | } catch (Exception e) { | 495 | } catch (Exception e) { |
481 | - logger.error("[{}] prepay request failed: {}", orderCode, e.getMessage()); | 496 | + log.error("[{}] prepay request failed: {}", orderCode, e.getMessage()); |
482 | return respXml; | 497 | return respXml; |
483 | } | 498 | } |
484 | 499 | ||
485 | - logger.info("[{}] prepay response: {}", orderCode, respXml); | 500 | + log.info("[{}] prepay response: {}", orderCode, respXml); |
486 | return respXml; | 501 | return respXml; |
487 | } | 502 | } |
488 | 503 | ||
@@ -519,7 +534,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | @@ -519,7 +534,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { | ||
519 | } | 534 | } |
520 | 535 | ||
521 | //md5签名 | 536 | //md5签名 |
522 | - String sign = WXUtils.signMd5(parameters, getMchKey()); | 537 | + String sign = signByMD5(parameters); |
523 | parameters.put(WeixinPayConfig.ApiConstants.SIGN, sign); | 538 | parameters.put(WeixinPayConfig.ApiConstants.SIGN, sign); |
524 | 539 | ||
525 | return parameters; | 540 | return parameters; |
@@ -20,20 +20,12 @@ public class WeixinMiniappPayService extends AbstractWeixinPayService { | @@ -20,20 +20,12 @@ public class WeixinMiniappPayService extends AbstractWeixinPayService { | ||
20 | return WeixinPayConfig.Miniapp.MALL_ID; | 20 | return WeixinPayConfig.Miniapp.MALL_ID; |
21 | } | 21 | } |
22 | 22 | ||
23 | - @Override | ||
24 | - protected String getMchKey() { | ||
25 | - return WeixinPayConfig.Miniapp.KEY; | ||
26 | - } | ||
27 | 23 | ||
28 | @Override | 24 | @Override |
29 | protected String getAppId() { | 25 | protected String getAppId() { |
30 | return WeixinPayConfig.Miniapp.APPID; | 26 | return WeixinPayConfig.Miniapp.APPID; |
31 | } | 27 | } |
32 | 28 | ||
33 | - @Override | ||
34 | - protected String getMchCertPath() { | ||
35 | - return WeixinPayConfig.WECHAT_PAY_UFOREAL_APP_PARTNER_CERT; | ||
36 | - } | ||
37 | 29 | ||
38 | @Override | 30 | @Override |
39 | protected String getTradeType() { | 31 | protected String getTradeType() { |
order/src/main/java/com/yohoufo/order/service/pay/weixin/WeixinPayAppService.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.weixin; | ||
2 | - | ||
3 | -import com.yohoufo.common.utils.HttpClient; | ||
4 | -import com.yohoufo.order.config.WeixinPayConfig; | ||
5 | -import com.yohoufo.order.service.pay.weixin.ssl.WxAppHttpSslClient; | ||
6 | -import org.springframework.beans.factory.annotation.Autowired; | ||
7 | -import org.springframework.beans.factory.annotation.Value; | ||
8 | -import org.springframework.stereotype.Service; | ||
9 | - | ||
10 | -@Service | ||
11 | -public class WeixinPayAppService extends AbstractWeixinPayService { | ||
12 | - // App 支付参数 | ||
13 | - @Value("${wechat.app.partnerid}") | ||
14 | - private String mchid; | ||
15 | - | ||
16 | - @Value("${wechat.app.partnerkey}") | ||
17 | - private String mchkey; | ||
18 | - | ||
19 | - @Value("${wechat.app.appid}") | ||
20 | - private String appId; | ||
21 | - | ||
22 | - @Autowired | ||
23 | - private WxAppHttpSslClient httpSslClient; | ||
24 | - | ||
25 | - @Override | ||
26 | - protected String getMchId() { | ||
27 | - return mchid; | ||
28 | - } | ||
29 | - | ||
30 | - @Override | ||
31 | - protected String getMchKey() { | ||
32 | - return mchkey; | ||
33 | - } | ||
34 | - | ||
35 | - @Override | ||
36 | - protected String getAppId() { | ||
37 | - return appId; | ||
38 | - } | ||
39 | - | ||
40 | - @Override | ||
41 | - protected String getTradeType() { | ||
42 | - return WeixinPayConfig.TRADE_TYPE_APP; | ||
43 | - } | ||
44 | - | ||
45 | - @Override | ||
46 | - protected String getMchCertPath() { | ||
47 | - return WeixinPayConfig.WECHAT_PAY_APP_PARTNER_CERT; | ||
48 | - } | ||
49 | - | ||
50 | - @Override | ||
51 | - protected HttpClient getSslHttpClient() { | ||
52 | - return httpSslClient; | ||
53 | - } | ||
54 | - | ||
55 | - | ||
56 | -} |
order/src/main/java/com/yohoufo/order/service/pay/weixin/WeixinPayBlkAppService.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.weixin; | ||
2 | - | ||
3 | -import com.yohoufo.common.utils.HttpClient; | ||
4 | -import com.yohoufo.order.config.WeixinPayConfig; | ||
5 | -import com.yohoufo.order.service.pay.weixin.ssl.WxBlkAppHttpSslClient; | ||
6 | -import org.springframework.beans.factory.annotation.Autowired; | ||
7 | -import org.springframework.stereotype.Service; | ||
8 | - | ||
9 | -@Service | ||
10 | -public class WeixinPayBlkAppService extends AbstractWeixinPayService { | ||
11 | - | ||
12 | - @Autowired | ||
13 | - private WxBlkAppHttpSslClient httpSslClient; | ||
14 | - | ||
15 | - @Override | ||
16 | - protected String getMchId() { | ||
17 | - return WeixinPayConfig.PARTNER_BLK_APP; | ||
18 | - } | ||
19 | - | ||
20 | - @Override | ||
21 | - protected String getMchKey() { | ||
22 | - return WeixinPayConfig.PARTNER_KEY_BLK_APP; | ||
23 | - } | ||
24 | - | ||
25 | - @Override | ||
26 | - protected String getAppId() { | ||
27 | - return WeixinPayConfig.APP_ID_BLK; | ||
28 | - } | ||
29 | - | ||
30 | - @Override | ||
31 | - protected String getMchCertPath() { | ||
32 | - return WeixinPayConfig.WECHAT_PAY_BLKAPP_PARTNER_CERT; | ||
33 | - } | ||
34 | - | ||
35 | - @Override | ||
36 | - protected String getTradeType() { | ||
37 | - return WeixinPayConfig.TRADE_TYPE_APP; | ||
38 | - } | ||
39 | - | ||
40 | - @Override | ||
41 | - protected HttpClient getSslHttpClient() { | ||
42 | - return httpSslClient; | ||
43 | - } | ||
44 | - | ||
45 | -} |
order/src/main/java/com/yohoufo/order/service/pay/weixin/WeixinPayUFOAppService.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.weixin; | ||
2 | - | ||
3 | -import org.springframework.beans.factory.annotation.Autowired; | ||
4 | -import org.springframework.stereotype.Service; | ||
5 | - | ||
6 | -import com.yohoufo.common.utils.HttpClient; | ||
7 | -import com.yohoufo.order.config.WeixinPayConfig; | ||
8 | -import com.yohoufo.order.service.pay.weixin.ssl.WxUFOAppHttpSslClient; | ||
9 | - | ||
10 | -@Service | ||
11 | -public class WeixinPayUFOAppService extends AbstractWeixinPayService { | ||
12 | - | ||
13 | - @Autowired | ||
14 | - private WxUFOAppHttpSslClient httpSslClient; | ||
15 | - | ||
16 | - @Override | ||
17 | - protected String getMchId() { | ||
18 | - return WeixinPayConfig.PARTNER_UFO_APP; | ||
19 | - } | ||
20 | - | ||
21 | - @Override | ||
22 | - protected String getMchKey() { | ||
23 | - return WeixinPayConfig.PARTNER_KEY_UFO_APP; | ||
24 | - } | ||
25 | - | ||
26 | - @Override | ||
27 | - protected String getAppId() { | ||
28 | - return WeixinPayConfig.APP_ID_UFO; | ||
29 | - } | ||
30 | - | ||
31 | - @Override | ||
32 | - protected String getMchCertPath() { | ||
33 | - return WeixinPayConfig.WECHAT_PAY_UFOAPP_PARTNER_CERT; | ||
34 | - } | ||
35 | - | ||
36 | - @Override | ||
37 | - protected String getTradeType() { | ||
38 | - return WeixinPayConfig.TRADE_TYPE_APP; | ||
39 | - } | ||
40 | - | ||
41 | - @Override | ||
42 | - protected HttpClient getSslHttpClient() { | ||
43 | - return httpSslClient; | ||
44 | - } | ||
45 | - | ||
46 | -} |
@@ -18,20 +18,12 @@ public class WeixinPayUFORealAppService extends AbstractWeixinPayService { | @@ -18,20 +18,12 @@ public class WeixinPayUFORealAppService extends AbstractWeixinPayService { | ||
18 | return WeixinPayConfig.PARTNER_UFO_REAL_APP; | 18 | return WeixinPayConfig.PARTNER_UFO_REAL_APP; |
19 | } | 19 | } |
20 | 20 | ||
21 | - @Override | ||
22 | - protected String getMchKey() { | ||
23 | - return WeixinPayConfig.PARTNER_KEY_UFO_REAL_APP; | ||
24 | - } | ||
25 | 21 | ||
26 | @Override | 22 | @Override |
27 | protected String getAppId() { | 23 | protected String getAppId() { |
28 | return WeixinPayConfig.APP_ID_UFO_REAL; | 24 | return WeixinPayConfig.APP_ID_UFO_REAL; |
29 | } | 25 | } |
30 | 26 | ||
31 | - @Override | ||
32 | - protected String getMchCertPath() { | ||
33 | - return WeixinPayConfig.WECHAT_PAY_UFOREAL_APP_PARTNER_CERT; | ||
34 | - } | ||
35 | 27 | ||
36 | @Override | 28 | @Override |
37 | protected String getTradeType() { | 29 | protected String getTradeType() { |
order/src/main/java/com/yohoufo/order/service/pay/weixin/ssl/WxAppHttpSslClient.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.weixin.ssl; | ||
2 | - | ||
3 | -import com.yohoufo.order.config.WeixinPayConfig; | ||
4 | -import org.springframework.stereotype.Component; | ||
5 | - | ||
6 | -@Component | ||
7 | -public class WxAppHttpSslClient extends HttpSslClientAbstract { | ||
8 | - | ||
9 | - @Override | ||
10 | - protected String getMchCertPath() { | ||
11 | - return WeixinPayConfig.WECHAT_PAY_APP_PARTNER_CERT; | ||
12 | - } | ||
13 | - | ||
14 | - @Override | ||
15 | - protected String getMchCertPassword() { | ||
16 | - return WeixinPayConfig.PARTNER; | ||
17 | - } | ||
18 | - | ||
19 | -} |
order/src/main/java/com/yohoufo/order/service/pay/weixin/ssl/WxBlkAppHttpSslClient.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.weixin.ssl; | ||
2 | - | ||
3 | -import com.yohoufo.order.config.WeixinPayConfig; | ||
4 | -import com.yohoufo.order.service.pay.weixin.ssl.HttpSslClientAbstract; | ||
5 | -import org.springframework.stereotype.Component; | ||
6 | - | ||
7 | -@Component | ||
8 | -public class WxBlkAppHttpSslClient extends HttpSslClientAbstract { | ||
9 | - | ||
10 | - @Override | ||
11 | - protected String getMchCertPath() { | ||
12 | - return WeixinPayConfig.WECHAT_PAY_BLKAPP_PARTNER_CERT; | ||
13 | - } | ||
14 | - | ||
15 | - @Override | ||
16 | - protected String getMchCertPassword() { | ||
17 | - return WeixinPayConfig.PARTNER_BLK_APP; | ||
18 | - } | ||
19 | - | ||
20 | -} |
order/src/main/java/com/yohoufo/order/service/pay/weixin/ssl/WxUFOAppHttpSslClient.java
deleted
100644 → 0
1 | -package com.yohoufo.order.service.pay.weixin.ssl; | ||
2 | - | ||
3 | -import com.yohoufo.order.config.WeixinPayConfig; | ||
4 | -import com.yohoufo.order.service.pay.weixin.ssl.HttpSslClientAbstract; | ||
5 | -import org.springframework.stereotype.Component; | ||
6 | - | ||
7 | -@Component | ||
8 | -public class WxUFOAppHttpSslClient extends HttpSslClientAbstract { | ||
9 | - | ||
10 | - @Override | ||
11 | - protected String getMchCertPath() { | ||
12 | - return WeixinPayConfig.WECHAT_PAY_UFOAPP_PARTNER_CERT; | ||
13 | - } | ||
14 | - | ||
15 | - @Override | ||
16 | - protected String getMchCertPassword() { | ||
17 | - return WeixinPayConfig.PARTNER_UFO_APP; | ||
18 | - } | ||
19 | - | ||
20 | -} |
@@ -145,6 +145,11 @@ | @@ -145,6 +145,11 @@ | ||
145 | <artifactId>lombok</artifactId> | 145 | <artifactId>lombok</artifactId> |
146 | <version>${lombok.version}</version> | 146 | <version>${lombok.version}</version> |
147 | </dependency> | 147 | </dependency> |
148 | + <dependency> | ||
149 | + <groupId>com.yoho.core</groupId> | ||
150 | + <artifactId>security</artifactId> | ||
151 | + <version>1.6.5-SNAPSHOT</version> | ||
152 | + </dependency> | ||
148 | </dependencies> | 153 | </dependencies> |
149 | 154 | ||
150 | </dependencyManagement> | 155 | </dependencyManagement> |
-
Please register or login to post a comment