mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-13 17:30:18 +08:00
!11 更新微信支付JSAPI支付方式参数
Merge pull request !11 from wsrhp/fix-wx-jsapi-params
This commit is contained in:
@@ -423,6 +423,30 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
|
||||
return getPayMessageHandler().handle(payMessage, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用转换过的参数进行回调处理
|
||||
*
|
||||
* @param data 转化后的参数Map
|
||||
* @return 获得回调响应信息
|
||||
*/
|
||||
@Override
|
||||
public PayOutMessage payBack(Map<String, Object> data) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("回调响应:" + JSON.toJSONString(data));
|
||||
}
|
||||
if (!verify(data)) {
|
||||
return getPayOutMessage("fail", "失败");
|
||||
}
|
||||
PayMessage payMessage = this.createMessage(data);
|
||||
Map<String, Object> context = new HashMap<String, Object>();
|
||||
for (PayMessageInterceptor interceptor : interceptors) {
|
||||
if (!interceptor.intercept(payMessage, context, this)) {
|
||||
return successPayOutMessage(payMessage);
|
||||
}
|
||||
}
|
||||
return getPayMessageHandler().handle(payMessage, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建消息
|
||||
*
|
||||
|
||||
@@ -340,6 +340,14 @@ public interface PayService<PC extends PayConfigStorage> {
|
||||
*/
|
||||
PayOutMessage payBack(Map<String, String[]> parameterMap, InputStream is);
|
||||
|
||||
/**
|
||||
* 使用转换过的参数进行回调处理
|
||||
*
|
||||
* @param data 转化后的参数Map
|
||||
* @return 获得回调响应信息
|
||||
*/
|
||||
PayOutMessage payBack(Map<String, Object> data);
|
||||
|
||||
/**
|
||||
* 设置支付消息处理器,这里用于处理具体的支付业务
|
||||
*
|
||||
|
||||
@@ -274,7 +274,7 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
|
||||
if (WxTransactionType.JSAPI == order.getTransactionType()) {
|
||||
params.put("signType", payConfigStorage.getSignType());
|
||||
params.put("appId", payConfigStorage.getAppid());
|
||||
params.put("timeStamp", System.currentTimeMillis() / 1000);
|
||||
params.put("timeStamp", System.currentTimeMillis() / 1000 + "");
|
||||
params.put("nonceStr", result.get(NONCE_STR));
|
||||
params.put("package", "prepay_id=" + result.get("prepay_id"));
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
|
||||
params.put("package", "Sign=WXPay");
|
||||
}
|
||||
String paySign = createSign(SignUtils.parameterText(params), payConfigStorage.getInputCharset());
|
||||
params.put(SIGN, paySign);
|
||||
params.put(WxTransactionType.JSAPI.equals(order.getTransactionType()) ? "paySign" : SIGN, paySign);
|
||||
return params;
|
||||
}
|
||||
throw new PayErrorException(new WxPayError(result.getString(RETURN_CODE), result.getString(RETURN_MSG_CODE), "Invalid sign value"));
|
||||
|
||||
Reference in New Issue
Block a user