#增加#添加开发文档,添加注释 去除一些无用代码
BIN
pay-java-fuiou/document/富友支付网关商户端开发文档 -跨境支付.doc
Normal file
BIN
pay-java-fuiou/document/富友支付网关商户端开发文档.doc
Normal file
BIN
pay-java-fuiou/document/富友支付网关商户端示例程序/富友支付网关商户端示例程序.zip
Normal file
BIN
pay-java-fuiou/document/富友跨境电商网关商户端开发文档(带海关数据报送).doc
Normal file
BIN
pay-java-fuiou/document/银行及富友LOGO/0000000000.gif
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0801000000.gif
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0801020000.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0801030000.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0801040000.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0801050000.gif
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803010000.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803020000.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803030000.gif
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/080303000C.gif
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803040000.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803050000.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803060000.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803070000.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803080000.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803090000.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803100000.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803114560.gif
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803160000.gif
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0803170000.gif
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0804031000.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0804243010.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0804400000.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0804403600.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/0804437010.gif
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
pay-java-fuiou/document/银行及富友LOGO/富友支付.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
@@ -2,7 +2,6 @@ package in.egan.pay.fuiou.api;/**
|
||||
* Created by Fuzx on 2017/1/16 0016.
|
||||
*/
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import in.egan.pay.common.api.BasePayService;
|
||||
import in.egan.pay.common.api.PayConfigStorage;
|
||||
import in.egan.pay.common.api.RequestExecutor;
|
||||
@@ -11,7 +10,6 @@ import in.egan.pay.common.bean.PayOrder;
|
||||
import in.egan.pay.common.bean.PayOutMessage;
|
||||
import in.egan.pay.common.bean.result.PayError;
|
||||
import in.egan.pay.common.exception.PayErrorException;
|
||||
import in.egan.pay.common.util.XML;
|
||||
import in.egan.pay.common.util.sign.SignUtils;
|
||||
import in.egan.pay.common.util.str.StringUtils;
|
||||
import in.egan.pay.fuiou.utils.SimplePostRequestExecutor;
|
||||
@@ -52,22 +50,31 @@ public class FuiouPayService extends BasePayService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回调校验
|
||||
* @param params 回调回来的参数集
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean verify(Map<String, String> params) {
|
||||
// TODO 2017/2/9 17:24 author: egan 需要校验签名,签名通过后,再校验订单的真实(根据单号查询对应的订单)
|
||||
if (!"0000".equals(params.get("order_pay_code"))) {
|
||||
log.debug(String.format("富友支付异常:order_pay_code=%s,错误原因=%s,参数集=%s", params.get("order_pay_code"), params.get("order_pay_error"), params));
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return getSignVerify(params, params.get("md5")) && "0000".equals(verifyUrl(params.get("order_id")));//返回参数校验 和 重新请求订单检查是否真实支付成功
|
||||
return getSignVerify(params, params.get("md5")) && "0000".equals(verifyUrl(params.get("order_id")));//返回参数校验 和 重新请求订单检查数据是否合法
|
||||
} catch (PayErrorException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验回调参数是否合法
|
||||
* @param params 参数集
|
||||
* @param returnSign
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean getSignVerify(Map<String, String> params, String returnSign) {
|
||||
LinkedHashSet<String> keySet = new LinkedHashSet<>();
|
||||
@@ -96,6 +103,12 @@ public class FuiouPayService extends BasePayService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起请求校验订单是否支付成功
|
||||
* @param order_id
|
||||
* @return
|
||||
* @throws PayErrorException
|
||||
*/
|
||||
@Override
|
||||
public String verifyUrl(String order_id) throws PayErrorException {
|
||||
// LinkedHashMap param = new LinkedHashMap();
|
||||
@@ -137,6 +150,11 @@ public class FuiouPayService extends BasePayService {
|
||||
throw new RuntimeException("富友支付服务端异常,超出重试次数");
|
||||
}
|
||||
|
||||
/**
|
||||
* 对支付请求参数进行加密,排序
|
||||
* @param order 支付订单
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> orderInfo(PayOrder order) {
|
||||
LinkedHashMap<String, Object> parameters = getOrderInfo(order);
|
||||
@@ -163,11 +181,23 @@ public class FuiouPayService extends BasePayService {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对内容进行加密
|
||||
* @param content 需要签名的内容
|
||||
* @param characterEncoding 字符编码
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String createSign(String content, String characterEncoding) {
|
||||
return SignUtils.valueOf(payConfigStorage.getSignType().toUpperCase()).createSign(content, "|" + payConfigStorage.getSecretKey(), characterEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将参数拼凑成String
|
||||
* @param parameterMap 请求参数
|
||||
* @param is 请求流
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getParameter2Map(Map<String, String[]> parameterMap, InputStream is) {
|
||||
Map<String, String> params = new TreeMap<String, String>();
|
||||
@@ -243,35 +273,4 @@ public class FuiouPayService extends BasePayService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付结果查询(直接返回)
|
||||
* <p>
|
||||
* 返回结果例子
|
||||
* <?xml version="1.0" encoding="UTF-8"?>
|
||||
* <ap><plain><order_pay_code>错误代码(0000表示成功 其他失败)</order_pay_code><order_pay_error>错误中文描述</order_pay_error><order_id>商户订单号</order_id><order_st>订单状态(‘00’ – 订单已生成(初始状态) ‘01’ – 订单已撤消 ‘02’ – 订单已合并 ‘03’ – 订单已过期 ‘04’ – 订单已确认(等待支付) ‘05’ – 订单支付失败 ‘11’ – 订单已支付 ‘18’ – 已发货 ‘19’ – 已确认收货)</order_st><fy_ssn>富友流水号</fy_ssn><resv1>保留字段</resv1></plain><md5>md5</md5></ap>
|
||||
* <p>
|
||||
* md5为plain域的内容+商户密钥做md5,不包括plain标签
|
||||
* 以下是MD5的内容
|
||||
* <order_pay_code>错误代码(0000表示成功 其他失败)</order_pay_code><order_pay_error>错误中文描述</order_pay_error><order_id>商户订单号</order_id><order_st>订单状态(‘00’ – 订单已生成(初始状态) ‘01’ – 订单已撤消 ‘02’ – 订单已合并 ‘03’ – 订单已过期 ‘04’ – 订单已确认(等待支付) ‘05’ – 订单支付失败 ‘11’ – 订单已支付 ‘18’ – 已发货 ‘19’ – 已确认收货)</order_st><fy_ssn>富友流水号</fy_ssn><resv1>保留字段</resv1>商户密钥
|
||||
*
|
||||
* @param order_id
|
||||
* @return
|
||||
*/
|
||||
public JSONObject vaildatePayResult(String order_id) {
|
||||
LinkedHashMap param = new LinkedHashMap();
|
||||
param.put("mchnt_cd", payConfigStorage.getPartner());
|
||||
param.put("order_id", order_id);
|
||||
param.put("md5", createSign(SignUtils.parameters2MD5Str(param, "|"), payConfigStorage.getInputCharset()));
|
||||
try {
|
||||
String result = execute(new SimplePostRequestExecutor(), fuiouSmpAQueryGate, param);
|
||||
JSONObject object = XML.toJSONObject(result);
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public enum FuiouCurType implements CurType {
|
||||
AUD("澳大利亚元");
|
||||
|
||||
private String name;
|
||||
private int index;
|
||||
|
||||
private FuiouCurType(String name) {
|
||||
this.name = name;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SimplePostRequestExecutor implements RequestExecutor<String, Object
|
||||
|
||||
try (CloseableHttpResponse response = httpclient.execute(httpPost)) {
|
||||
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
||||
System.out.println("直接返回的查询结果-->"+responseContent);
|
||||
// System.out.println("直接返回的查询结果-->"+responseContent);
|
||||
// responseContent = responseContent.replace("<ap>","").replace("</ap>","").replace("<plain>","").replace("</plain>","");
|
||||
JSONObject jsonObject = XML.toJSONObject(responseContent);//包含md5
|
||||
JSONObject plain = XML.toJSONObject("<a>"+jsonObject.getString("plain")+"</a>");//"plain" -> "<order_pay_code>5002</order_pay_code><order_pay_error>验证签名失败</order_pay_error><order_id></order_id><order_st></order_st><fy_ssn></fy_ssn><resv1></resv1>"
|
||||
|
||||