mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-06-06 16:40:18 +08:00
修复旧版支付宝通知校验
This commit is contained in:
@@ -36,11 +36,11 @@ public class AliPayService extends BasePayService {
|
||||
protected final Log log = LogFactory.getLog(AliPayService.class);
|
||||
|
||||
//正式测试环境
|
||||
private String httpsReqUrl = "https://openapi.alipay.com/gateway.do";
|
||||
private final static String httpsReqUrl = "https://openapi.alipay.com/gateway.do";
|
||||
//沙箱测试环境账号
|
||||
private String devReqUrl = "https://openapi.alipaydev.com/gateway.do";
|
||||
private final static String devReqUrl = "https://openapi.alipaydev.com/gateway.do";
|
||||
//兼容上一版本即时收款
|
||||
private String httpsReqUrlBefore = "https://mapi.alipay.com/gateway.do";
|
||||
private final static String httpsReqUrlBefore = "https://mapi.alipay.com/gateway.do";
|
||||
|
||||
|
||||
/**
|
||||
@@ -305,7 +305,6 @@ public class AliPayService extends BasePayService {
|
||||
*/
|
||||
@Override
|
||||
public String buildRequest(Map<String, Object> orderInfo, MethodType method) {
|
||||
|
||||
StringBuffer formHtml = new StringBuffer();
|
||||
formHtml.append("<form id=\"_alipaysubmit_\" name=\"alipaysubmit\" action=\"");
|
||||
if (null == orderInfo.get("method")) {
|
||||
@@ -332,11 +331,6 @@ public class AliPayService extends BasePayService {
|
||||
|
||||
formHtml.append("<input type=\"hidden\" name=\"biz_content\" value=\"" + biz_content.replace("\"", """) + "\"/>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//submit按钮控件请不要含有name属性
|
||||
// formHtml.append("<input type=\"submit\" value=\"\" style=\"display:none;\">");
|
||||
formHtml.append("</form>");
|
||||
formHtml.append("<script>document.forms['_alipaysubmit_'].submit();</script>");
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class AliPayService extends BasePayService {
|
||||
*/
|
||||
@Override
|
||||
public boolean verifySource(String id) {
|
||||
return "true".equals(requestTemplate.getForObject( getHttpsVerifyUrl() + "partner=" + payConfigStorage.getPid() + "¬ify_id=" + id, String.class));
|
||||
return "true".equals(requestTemplate.getForObject( getHttpsVerifyUrl() + "&partner=" + payConfigStorage.getPid() + "¬ify_id=" + id, String.class));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,6 +228,15 @@ public class AliPayService extends BasePayService {
|
||||
}
|
||||
//乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
|
||||
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk");
|
||||
if (!valueStr.matches("\\w+")){
|
||||
try {
|
||||
if(valueStr.equals(new String(valueStr.getBytes("iso8859-1"), "iso8859-1"))){
|
||||
valueStr=new String(valueStr.getBytes("iso8859-1"), payConfigStorage.getInputCharset());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
params.put(name, valueStr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user