|
@@ -11,7 +11,6 @@ import com.yohobuy.ufo.model.order.common.Payment; |
|
@@ -11,7 +11,6 @@ import com.yohobuy.ufo.model.order.common.Payment; |
11
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
11
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
12
|
import com.yohoufo.common.utils.DateUtil;
|
12
|
import com.yohoufo.common.utils.DateUtil;
|
13
|
import com.yohoufo.common.utils.HttpClient;
|
13
|
import com.yohoufo.common.utils.HttpClient;
|
14
|
-import com.yohoufo.common.utils.RSAUtils;
|
|
|
15
|
import com.yohoufo.common.utils.WXUtil;
|
14
|
import com.yohoufo.common.utils.WXUtil;
|
16
|
import com.yohoufo.dal.order.OrdersPayHbfqMapper;
|
15
|
import com.yohoufo.dal.order.OrdersPayHbfqMapper;
|
17
|
import com.yohoufo.dal.order.model.OrdersPayHbfq;
|
16
|
import com.yohoufo.dal.order.model.OrdersPayHbfq;
|
|
@@ -28,6 +27,9 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
|
@@ -28,6 +27,9 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
28
|
import com.yohoufo.order.service.transfer.TransferChannel;
|
27
|
import com.yohoufo.order.service.transfer.TransferChannel;
|
29
|
import com.yohoufo.order.service.transfer.TransferResult;
|
28
|
import com.yohoufo.order.service.transfer.TransferResult;
|
30
|
import com.yohoufo.order.utils.AlipayExceedMillionTransferErrors;
|
29
|
import com.yohoufo.order.utils.AlipayExceedMillionTransferErrors;
|
|
|
30
|
+import lombok.AccessLevel;
|
|
|
31
|
+import lombok.Getter;
|
|
|
32
|
+import lombok.experimental.Accessors;
|
31
|
import org.apache.commons.lang3.StringUtils;
|
33
|
import org.apache.commons.lang3.StringUtils;
|
32
|
import org.slf4j.Logger;
|
34
|
import org.slf4j.Logger;
|
33
|
import org.slf4j.LoggerFactory;
|
35
|
import org.slf4j.LoggerFactory;
|
|
@@ -90,7 +92,10 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -90,7 +92,10 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
90
|
@Autowired
|
92
|
@Autowired
|
91
|
private OrdersPayHbfqMapper ordersPayHbfqDao;
|
93
|
private OrdersPayHbfqMapper ordersPayHbfqDao;
|
92
|
|
94
|
|
93
|
-
|
95
|
+ @Autowired
|
|
|
96
|
+ @Getter(AccessLevel.PROTECTED)
|
|
|
97
|
+ @Accessors(fluent = true)
|
|
|
98
|
+ private AlipayConfig alipayConfig;
|
94
|
|
99
|
|
95
|
@Value("${alipay.notifyurl}")
|
100
|
@Value("${alipay.notifyurl}")
|
96
|
private String notifyURL;
|
101
|
private String notifyURL;
|
|
@@ -105,7 +110,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -105,7 +110,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
105
|
|
110
|
|
106
|
public PayQueryBo payQuery(String tradeNo, int orderCreateTime) {
|
111
|
public PayQueryBo payQuery(String tradeNo, int orderCreateTime) {
|
107
|
Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo);
|
112
|
Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo);
|
108
|
- String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL);
|
113
|
+ String respTxt = sendOpenApiRequest(tradeNo, queryParams, alipayConfig.openapiUrl());
|
109
|
QueryBo queryBo = JSON.parseObject(JSONObject.toJSONString(JSON.parseObject(respTxt).getJSONObject("alipay_trade_query_response")), QueryBo.class);
|
114
|
QueryBo queryBo = JSON.parseObject(JSONObject.toJSONString(JSON.parseObject(respTxt).getJSONObject("alipay_trade_query_response")), QueryBo.class);
|
110
|
|
115
|
|
111
|
// 查询结果转换成 共通的对象
|
116
|
// 查询结果转换成 共通的对象
|
|
@@ -430,7 +435,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -430,7 +435,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
430
|
public JSONObject transferQueryAsOriginalResult(String buyerOrderCode) {
|
435
|
public JSONObject transferQueryAsOriginalResult(String buyerOrderCode) {
|
431
|
String tradeNo = buyerOrderCode;
|
436
|
String tradeNo = buyerOrderCode;
|
432
|
Map<String, String> queryParams = buildAlipayTransferQueryParams(tradeNo);
|
437
|
Map<String, String> queryParams = buildAlipayTransferQueryParams(tradeNo);
|
433
|
- String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL);
|
438
|
+ String respTxt = sendOpenApiRequest(tradeNo, queryParams, alipayConfig.openapiUrl());
|
434
|
JSONObject result = JSON.parseObject(respTxt).getJSONObject("alipay_fund_trans_order_query_response");
|
439
|
JSONObject result = JSON.parseObject(respTxt).getJSONObject("alipay_fund_trans_order_query_response");
|
435
|
logger.info("查询转账{}结果为:{}", tradeNo, result);
|
440
|
logger.info("查询转账{}结果为:{}", tradeNo, result);
|
436
|
return result;
|
441
|
return result;
|
|
@@ -458,7 +463,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -458,7 +463,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
458
|
|
463
|
|
459
|
private String sendOpenApiRequestWithException(String orderCode, Map<String, String> paramMap) throws Exception {
|
464
|
private String sendOpenApiRequestWithException(String orderCode, Map<String, String> paramMap) throws Exception {
|
460
|
logger.info("[{}] send openapi request: {}", orderCode, paramMap);
|
465
|
logger.info("[{}] send openapi request: {}", orderCode, paramMap);
|
461
|
- String response = httpClient.postFormData(AlipayConfig.OPENAPI_URL, paramMap);
|
466
|
+ String response = httpClient.postFormData(alipayConfig.openapiUrl(), paramMap);
|
462
|
logger.info("[{}] trade openapi resp: {}", orderCode, response);
|
467
|
logger.info("[{}] trade openapi resp: {}", orderCode, response);
|
463
|
return response;
|
468
|
return response;
|
464
|
}
|
469
|
}
|
|
@@ -469,7 +474,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -469,7 +474,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
469
|
for(Map.Entry<String, String> entry : paramMap.entrySet()) {
|
474
|
for(Map.Entry<String, String> entry : paramMap.entrySet()) {
|
470
|
paramStr.append("&").append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(),AlipayConfig.input_charset));
|
475
|
paramStr.append("&").append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(),AlipayConfig.input_charset));
|
471
|
}
|
476
|
}
|
472
|
- String url = AlipayConfig.MAPI_URL +"?"+paramStr.substring(1);
|
477
|
+ String url = alipayConfig.mapiUrl() +"?"+paramStr.substring(1);
|
473
|
logger.info("[{}] send openapi requestUrl is: {}", orderCode, url);
|
478
|
logger.info("[{}] send openapi requestUrl is: {}", orderCode, url);
|
474
|
String response = httpClient.get(url);
|
479
|
String response = httpClient.get(url);
|
475
|
logger.info("[{}] trade openapi resp: {}", orderCode, response);
|
480
|
logger.info("[{}] trade openapi resp: {}", orderCode, response);
|
|
@@ -810,7 +815,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -810,7 +815,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
810
|
public PayRefundBo refundOpenApi(PayRefundBo refundBo) {
|
815
|
public PayRefundBo refundOpenApi(PayRefundBo refundBo) {
|
811
|
logger.info("enter AliPayRefunder to refund tradeNo {}, amount {}", refundBo.getRefundOrderCode(), refundBo.getAmount());
|
816
|
logger.info("enter AliPayRefunder to refund tradeNo {}, amount {}", refundBo.getRefundOrderCode(), refundBo.getAmount());
|
812
|
Map<String, String> refundParams = buildOpenApiRefundParams(refundBo.getPayOrderCode(), refundBo.getRefundOrderCode(), refundBo.getAmount());
|
817
|
Map<String, String> refundParams = buildOpenApiRefundParams(refundBo.getPayOrderCode(), refundBo.getRefundOrderCode(), refundBo.getAmount());
|
813
|
- String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, AlipayConfig.OPENAPI_URL);
|
818
|
+ String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, alipayConfig.openapiUrl());
|
814
|
//logger.info("refund response for alipay: {}", responseText);
|
819
|
//logger.info("refund response for alipay: {}", responseText);
|
815
|
PayRefundBo bo = refundOpenApiConvert(respTxt, refundBo);
|
820
|
PayRefundBo bo = refundOpenApiConvert(respTxt, refundBo);
|
816
|
logger.info("exit AliPayRefunder refund, refundStatus: {}, refundMsg", bo.getRefundStatus(), bo.getRefundMsg());
|
821
|
logger.info("exit AliPayRefunder refund, refundStatus: {}, refundMsg", bo.getRefundStatus(), bo.getRefundMsg());
|
|
@@ -1025,7 +1030,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
@@ -1025,7 +1030,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
1025
|
* @return
|
1030
|
* @return
|
1026
|
*/
|
1031
|
*/
|
1027
|
private String obtainAtn(String outTradeNo, String notifyId) {
|
1032
|
private String obtainAtn(String outTradeNo, String notifyId) {
|
1028
|
- String verify_url = AlipayConfig.NOTIFY_VERIFY_URL + "&partner=" + getPartnerId() + "¬ify_id=" + notifyId;
|
1033
|
+ String verify_url = alipayConfig.mapiUrl() + "?service=notify_verify&partner=" + getPartnerId() + "¬ify_id=" + notifyId;
|
1029
|
String response = "";
|
1034
|
String response = "";
|
1030
|
logger.info("[{}] obtain atn begin, check url: {}", outTradeNo, verify_url);
|
1035
|
logger.info("[{}] obtain atn begin, check url: {}", outTradeNo, verify_url);
|
1031
|
|
1036
|
|