...
|
...
|
@@ -11,7 +11,6 @@ import com.yohobuy.ufo.model.order.common.Payment; |
|
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.common.utils.HttpClient;
|
|
|
import com.yohoufo.common.utils.RSAUtils;
|
|
|
import com.yohoufo.common.utils.WXUtil;
|
|
|
import com.yohoufo.dal.order.OrdersPayHbfqMapper;
|
|
|
import com.yohoufo.dal.order.model.OrdersPayHbfq;
|
...
|
...
|
@@ -28,6 +27,9 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
|
|
import com.yohoufo.order.service.transfer.TransferChannel;
|
|
|
import com.yohoufo.order.service.transfer.TransferResult;
|
|
|
import com.yohoufo.order.utils.AlipayExceedMillionTransferErrors;
|
|
|
import lombok.AccessLevel;
|
|
|
import lombok.Getter;
|
|
|
import lombok.experimental.Accessors;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -90,7 +92,10 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
@Autowired
|
|
|
private OrdersPayHbfqMapper ordersPayHbfqDao;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
@Getter(AccessLevel.PROTECTED)
|
|
|
@Accessors(fluent = true)
|
|
|
private AlipayConfig alipayConfig;
|
|
|
|
|
|
@Value("${alipay.notifyurl}")
|
|
|
private String notifyURL;
|
...
|
...
|
@@ -105,7 +110,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
|
|
|
public PayQueryBo payQuery(String tradeNo, int orderCreateTime) {
|
|
|
Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo);
|
|
|
String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL);
|
|
|
String respTxt = sendOpenApiRequest(tradeNo, queryParams, alipayConfig.openapiUrl());
|
|
|
QueryBo queryBo = JSON.parseObject(JSONObject.toJSONString(JSON.parseObject(respTxt).getJSONObject("alipay_trade_query_response")), QueryBo.class);
|
|
|
|
|
|
// 查询结果转换成 共通的对象
|
...
|
...
|
@@ -430,7 +435,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
public JSONObject transferQueryAsOriginalResult(String buyerOrderCode) {
|
|
|
String tradeNo = buyerOrderCode;
|
|
|
Map<String, String> queryParams = buildAlipayTransferQueryParams(tradeNo);
|
|
|
String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL);
|
|
|
String respTxt = sendOpenApiRequest(tradeNo, queryParams, alipayConfig.openapiUrl());
|
|
|
JSONObject result = JSON.parseObject(respTxt).getJSONObject("alipay_fund_trans_order_query_response");
|
|
|
logger.info("查询转账{}结果为:{}", tradeNo, result);
|
|
|
return result;
|
...
|
...
|
@@ -458,7 +463,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
|
|
|
private String sendOpenApiRequestWithException(String orderCode, Map<String, String> paramMap) throws Exception {
|
|
|
logger.info("[{}] send openapi request: {}", orderCode, paramMap);
|
|
|
String response = httpClient.postFormData(AlipayConfig.OPENAPI_URL, paramMap);
|
|
|
String response = httpClient.postFormData(alipayConfig.openapiUrl(), paramMap);
|
|
|
logger.info("[{}] trade openapi resp: {}", orderCode, response);
|
|
|
return response;
|
|
|
}
|
...
|
...
|
@@ -469,7 +474,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
for(Map.Entry<String, String> entry : paramMap.entrySet()) {
|
|
|
paramStr.append("&").append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(),AlipayConfig.input_charset));
|
|
|
}
|
|
|
String url = AlipayConfig.MAPI_URL +"?"+paramStr.substring(1);
|
|
|
String url = alipayConfig.mapiUrl() +"?"+paramStr.substring(1);
|
|
|
logger.info("[{}] send openapi requestUrl is: {}", orderCode, url);
|
|
|
String response = httpClient.get(url);
|
|
|
logger.info("[{}] trade openapi resp: {}", orderCode, response);
|
...
|
...
|
@@ -810,7 +815,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
public PayRefundBo refundOpenApi(PayRefundBo refundBo) {
|
|
|
logger.info("enter AliPayRefunder to refund tradeNo {}, amount {}", refundBo.getRefundOrderCode(), refundBo.getAmount());
|
|
|
Map<String, String> refundParams = buildOpenApiRefundParams(refundBo.getPayOrderCode(), refundBo.getRefundOrderCode(), refundBo.getAmount());
|
|
|
String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, AlipayConfig.OPENAPI_URL);
|
|
|
String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, alipayConfig.openapiUrl());
|
|
|
//logger.info("refund response for alipay: {}", responseText);
|
|
|
PayRefundBo bo = refundOpenApiConvert(respTxt, refundBo);
|
|
|
logger.info("exit AliPayRefunder refund, refundStatus: {}, refundMsg", bo.getRefundStatus(), bo.getRefundMsg());
|
...
|
...
|
@@ -1025,7 +1030,7 @@ public abstract class AbstractAlipayService extends AbstractPayService { |
|
|
* @return
|
|
|
*/
|
|
|
private String obtainAtn(String outTradeNo, String notifyId) {
|
|
|
String verify_url = AlipayConfig.NOTIFY_VERIFY_URL + "&partner=" + getPartnerId() + "¬ify_id=" + notifyId;
|
|
|
String verify_url = alipayConfig.mapiUrl() + "?service=notify_verify&partner=" + getPartnerId() + "¬ify_id=" + notifyId;
|
|
|
String response = "";
|
|
|
logger.info("[{}] obtain atn begin, check url: {}", outTradeNo, verify_url);
|
|
|
|
...
|
...
|
|