Authored by tanling

跨境支付沙箱配置

... ... @@ -18,7 +18,7 @@ public class AlipayConfig {
public static final String sign_type = "RSA";
// 跨境openapi
public static final String CROSS_BORDER_OPENAPI_URL = "https://intlmapi.alipay.com/gateway.do";
// public static final String CROSS_BORDER_OPENAPI_URL = "https://intlmapi.alipay.com/gateway.do";
public static final String OPENAPI_BIZ_SUCCESS = "10000";
... ... @@ -27,6 +27,9 @@ public class AlipayConfig {
@Value("${alipay.openapi.url:https://openapi.alipay.com/gateway.do}")
private String openapiUrl;
@Value("${alipay.crossBroder.mapiUrl:https://intlmapi.alipay.com/gateway.do}")
private String crossBorderMapiUrl;
@Value("${alipay.ouyin.appid:2016091401906455}")
private String ouyinAppid;
@Value("${alipay.ouyin.partner:2088421850636193}")
... ...
... ... @@ -12,8 +12,12 @@ import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.service.pay.alipay.bean.AlipayCustomsResponse;
import com.yohoufo.order.service.pay.alipay.bean.AlipayQueryResponse;
import com.yohoufo.order.service.pay.alipay.bean.AlipayRefundResponse;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.experimental.Accessors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.net.URLEncoder;
... ... @@ -52,6 +56,11 @@ public class AlipayCrossBorderService extends AbstractAlipayService {
return "南京新与力文化传播有限公司";
}
@Autowired
@Getter(AccessLevel.PROTECTED)
@Accessors(fluent = true)
private AlipayConfig alipayConfig;
/**
* 萝岗海关
* @return
... ... @@ -68,7 +77,7 @@ public class AlipayCrossBorderService extends AbstractAlipayService {
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.CROSS_BORDER_OPENAPI_URL);
String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, alipayConfig.crossBorderMapiUrl());
PayRefundBo bo = refundOpenApiConvert(respTxt, refundBo);
logger.info("exit AliPayRefunder refund, refundStatus: {}, refundMsg", bo.getRefundStatus(), bo.getRefundMsg());
... ... @@ -81,7 +90,7 @@ public class AlipayCrossBorderService extends AbstractAlipayService {
logger.info("enter customsOpenApi to {}, {}, {}, {}", orderCode, outRequestNo, tradeNo, amount);
Map<String, String> customsParam = buildOpenApiCustoms(outRequestNo, tradeNo, amount);
String respTxt = sendOpenApiRequest(String.valueOf(orderCode), customsParam, AlipayConfig.CROSS_BORDER_OPENAPI_URL);
String respTxt = sendOpenApiRequest(String.valueOf(orderCode), customsParam, alipayConfig.crossBorderMapiUrl());
AlipayCustomsResponse refundResponse = (AlipayCustomsResponse)XMLUtil.convertXmlStrToObject(AlipayRefundResponse.class, respTxt);
... ... @@ -175,7 +184,7 @@ public class AlipayCrossBorderService extends AbstractAlipayService {
*/
public PayQueryBo payQuery(String tradeNo, int orderCreateTime) {
Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo);
String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.CROSS_BORDER_OPENAPI_URL);
String respTxt = sendOpenApiRequest(tradeNo, queryParams, alipayConfig.crossBorderMapiUrl());
AlipayQueryResponse alipayQueryResponse = (AlipayQueryResponse) XMLUtil.convertXmlStrToObject(AlipayQueryResponse.class, respTxt);
... ...