...
|
...
|
@@ -9,6 +9,7 @@ import com.yohoufo.order.config.AlipayConfig; |
|
|
import com.yohoufo.order.constants.RefundContant;
|
|
|
import com.yohoufo.order.model.PayQueryBo;
|
|
|
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 org.slf4j.Logger;
|
...
|
...
|
@@ -38,6 +39,27 @@ public class AlipayCrossBorderService extends AbstractAlipayService { |
|
|
return "zfbgj@yoho.cn";
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 商户在海关系统中的code
|
|
|
* @return
|
|
|
*/
|
|
|
private String getMerchantCustomsCode(){
|
|
|
return "3201962889";
|
|
|
}
|
|
|
|
|
|
private String getMerchantCustomsName(){
|
|
|
return "南京新与力文化传播有限公司";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 萝岗海关
|
|
|
* @return
|
|
|
*/
|
|
|
private String getCustomsPlace(){
|
|
|
return "5224";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* OpenApi退款
|
|
|
* @param refundBo
|
...
|
...
|
@@ -54,6 +76,22 @@ public class AlipayCrossBorderService extends AbstractAlipayService { |
|
|
}
|
|
|
|
|
|
|
|
|
public AlipayCustomsResponse customsOpenApi(long orderCode, String outRequestNo, String tradeNo, double amount){
|
|
|
|
|
|
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);
|
|
|
|
|
|
AlipayCustomsResponse refundResponse = (AlipayCustomsResponse)XMLUtil.convertXmlStrToObject(AlipayRefundResponse.class, respTxt);
|
|
|
|
|
|
logger.info("exit customsOpenApi, result {}", refundResponse);
|
|
|
|
|
|
return refundResponse;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public PayRefundBo refundOpenApiConvert(String respText, PayRefundBo bo) {
|
|
|
AlipayRefundResponse refundResponse = (AlipayRefundResponse)XMLUtil.convertXmlStrToObject(AlipayRefundResponse.class, respText);
|
|
|
|
...
|
...
|
@@ -98,6 +136,37 @@ public class AlipayCrossBorderService extends AbstractAlipayService { |
|
|
return params;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 给海关推支付单
|
|
|
* @param outRequestNo
|
|
|
* @param tradeNo
|
|
|
* @param amount
|
|
|
* @return
|
|
|
*/
|
|
|
private Map<String, String> buildOpenApiCustoms(String outRequestNo, String tradeNo, double amount){
|
|
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
|
|
|
params.put("service","alipay.acquire.customs");
|
|
|
params.put("partner", getPartnerId());
|
|
|
params.put("_input_charset", AlipayConfig.input_charset);
|
|
|
params.put("sign_type", "RSA");
|
|
|
|
|
|
params.put("out_request_no", outRequestNo);
|
|
|
params.put("trade_no", tradeNo);
|
|
|
|
|
|
params.put("merchant_customs_code", getMerchantCustomsCode());
|
|
|
params.put("amount", String.valueOf(amount));
|
|
|
params.put("customs_place", getCustomsPlace());
|
|
|
params.put("merchant_customs_name", getMerchantCustomsName());
|
|
|
|
|
|
String preSignStr = getOpenApiSignString(params, true);
|
|
|
params.put("sign", helper().signWithRsa(preSignStr,AlipayConfig.input_charset));
|
|
|
|
|
|
return params;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询支付结果
|
|
|
* @param tradeNo
|
...
|
...
|
|