mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 22:11:40 +08:00
Merge branch 'fxdfxq-master' into develop
# Conflicts: # weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java
This commit is contained in:
commit
7a816cf7a9
@ -732,31 +732,49 @@ public interface WxMpService {
|
|||||||
WxMpPrepayIdResult getPrepayId(Map<String, String> parameters);
|
WxMpPrepayIdResult getPrepayId(Map<String, String> parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该接口调用“统一下单”接口,并拼装JSSDK发起支付请求需要的参数
|
* 该接口调用“统一下单”接口,并拼装发起支付请求需要的参数
|
||||||
* 详见http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82
|
* 详见http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82
|
||||||
* @param parameters
|
* @param parameters
|
||||||
* the required or optional parameters
|
* the required or optional parameters
|
||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
Map<String, String> getJSSDKPayInfo(Map<String, String> parameters) throws WxErrorException;
|
Map<String, String> getPayInfo(Map<String, String> parameters) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该接口调用“统一下单”接口,并拼装JSSDK发起支付请求需要的参数
|
* 该接口调用“统一下单”接口,并拼装NATIVE发起支付请求需要的参数
|
||||||
* 详见http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82
|
* 详见http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82
|
||||||
* @param openId 支付人openId
|
* tradeType 交易类型 NATIVE (其他交易类型JSAPI,APP,WAP)
|
||||||
|
* @param productId 商户商品ID
|
||||||
* @param outTradeNo 商户端对应订单号
|
* @param outTradeNo 商户端对应订单号
|
||||||
* @param amt 金额(单位元)
|
* @param amt 金额(单位元)
|
||||||
* @param body 商品描述
|
* @param body 商品描述
|
||||||
* @param tradeType 交易类型 JSAPI,NATIVE,APP,WAP
|
|
||||||
* @param ip 发起支付的客户端IP
|
* @param ip 发起支付的客户端IP
|
||||||
* @param notifyUrl 通知地址
|
* @param notifyUrl 通知地址
|
||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @deprecated Use me.chanjar.weixin.mp.api.WxMpService.getJSSDKPayInfo(Map<String, String>) instead
|
* @deprecated Use me.chanjar.weixin.mp.api.WxMpService.getPayInfo(Map<String, String>) instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Map<String, String> getJSSDKPayInfo(String openId, String outTradeNo, double amt, String body, String tradeType, String ip, String notifyUrl) throws WxErrorException;
|
Map<String, String> getNativePayInfo(String productId, String outTradeNo, double amt, String body, String ip, String notifyUrl) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该接口调用“统一下单”接口,并拼装JSAPI发起支付请求需要的参数
|
||||||
|
* 详见http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82
|
||||||
|
* tradeType 交易类型 JSAPI(其他交易类型NATIVE,APP,WAP)
|
||||||
|
* @param openId 支付人openId
|
||||||
|
* @param outTradeNo 商户端对应订单号
|
||||||
|
* @param amt 金额(单位元)
|
||||||
|
* @param body 商品描述
|
||||||
|
* @param ip 发起支付的客户端IP
|
||||||
|
* @param notifyUrl 通知地址
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
* @deprecated Use me.chanjar.weixin.mp.api.WxMpService.getPayInfo(Map<String, String>) instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
Map<String, String> getJsapiPayInfo(String openId, String outTradeNo, double amt, String body, String ip, String notifyUrl) throws WxErrorException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该接口提供所有微信支付订单的查询,当支付通知处理异常戒丢失的情冴,商户可以通过该接口查询订单支付状态。
|
* 该接口提供所有微信支付订单的查询,当支付通知处理异常戒丢失的情冴,商户可以通过该接口查询订单支付状态。
|
||||||
|
@ -844,25 +844,40 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
throw new IllegalArgumentException("Reqiured argument 'product_id' is missing when trade_type is 'NATIVE'.");
|
throw new IllegalArgumentException("Reqiured argument 'product_id' is missing when trade_type is 'NATIVE'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getJSSDKPayInfo(String openId, String outTradeNo, double amt, String body, String tradeType, String ip, String callbackUrl)
|
public Map<String, String> getJsapiPayInfo(String openId,String outTradeNo, double amt, String body,String ip, String callbackUrl) throws WxErrorException{
|
||||||
throws WxErrorException {
|
Map<String, String> packageParams = new HashMap<String, String>();
|
||||||
Map<String, String> packageParams = new HashMap<String, String>();
|
packageParams.put("appid", wxMpConfigStorage.getAppId());
|
||||||
packageParams.put("appid", wxMpConfigStorage.getAppId());
|
packageParams.put("mch_id", wxMpConfigStorage.getPartnerId());
|
||||||
packageParams.put("mch_id", wxMpConfigStorage.getPartnerId());
|
packageParams.put("body", body);
|
||||||
packageParams.put("body", body);
|
packageParams.put("out_trade_no", outTradeNo);
|
||||||
packageParams.put("out_trade_no", outTradeNo);
|
packageParams.put("total_fee", (int) (amt * 100) + "");
|
||||||
packageParams.put("total_fee", String.format("%.0f", amt * 100));
|
packageParams.put("spbill_create_ip", ip);
|
||||||
packageParams.put("spbill_create_ip", ip);
|
packageParams.put("notify_url", callbackUrl);
|
||||||
packageParams.put("notify_url", callbackUrl);
|
packageParams.put("trade_type", "JSAPI");
|
||||||
packageParams.put("trade_type", tradeType);
|
packageParams.put("openid", openId);
|
||||||
packageParams.put("openid", openId);
|
|
||||||
|
|
||||||
return getJSSDKPayInfo(packageParams);
|
return getPayInfo(packageParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getNativePayInfo(String productId,String outTradeNo, double amt, String body,String ip, String callbackUrl) throws WxErrorException{
|
||||||
|
Map<String, String> packageParams = new HashMap<String, String>();
|
||||||
|
packageParams.put("appid", wxMpConfigStorage.getAppId());
|
||||||
|
packageParams.put("mch_id", wxMpConfigStorage.getPartnerId());
|
||||||
|
packageParams.put("body", body);
|
||||||
|
packageParams.put("out_trade_no", outTradeNo);
|
||||||
|
packageParams.put("total_fee", (int) (amt * 100) + "");
|
||||||
|
packageParams.put("spbill_create_ip", ip);
|
||||||
|
packageParams.put("notify_url", callbackUrl);
|
||||||
|
packageParams.put("trade_type", "NATIVE");
|
||||||
|
packageParams.put("product_id", productId);
|
||||||
|
|
||||||
|
return getPayInfo(packageParams);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getJSSDKPayInfo(Map<String, String> parameters) throws WxErrorException {
|
public Map<String, String> getPayInfo(Map<String, String> parameters) throws WxErrorException {
|
||||||
WxMpPrepayIdResult wxMpPrepayIdResult = getPrepayId(parameters);
|
WxMpPrepayIdResult wxMpPrepayIdResult = getPrepayId(parameters);
|
||||||
|
|
||||||
if (!"SUCCESS".equalsIgnoreCase(wxMpPrepayIdResult.getReturn_code())
|
if (!"SUCCESS".equalsIgnoreCase(wxMpPrepayIdResult.getReturn_code())
|
||||||
@ -889,7 +904,9 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
payInfo.put("nonceStr", System.currentTimeMillis() + "");
|
payInfo.put("nonceStr", System.currentTimeMillis() + "");
|
||||||
payInfo.put("package", "prepay_id=" + prepayId);
|
payInfo.put("package", "prepay_id=" + prepayId);
|
||||||
payInfo.put("signType", "MD5");
|
payInfo.put("signType", "MD5");
|
||||||
payInfo.put("code_url",wxMpPrepayIdResult.getCode_url());
|
if("NATIVE".equals(parameters.get("trade_type"))){
|
||||||
|
payInfo.put("codeUrl", wxMpPrepayIdResult.getCode_url());
|
||||||
|
}
|
||||||
|
|
||||||
String finalSign = WxCryptUtil.createSign(payInfo, wxMpConfigStorage.getPartnerKey());
|
String finalSign = WxCryptUtil.createSign(payInfo, wxMpConfigStorage.getPartnerKey());
|
||||||
payInfo.put("paySign", finalSign);
|
payInfo.put("paySign", finalSign);
|
||||||
|
Loading…
Reference in New Issue
Block a user