|
|
@@ -59,7 +59,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
"\"POST_DATA_EMPTY\":{\"detail\":\"post数据为空\",\"reason\":\"post数据不能为空\",\"resolution\":\"请检查post数据是否为空\"}," + |
|
|
"\"POST_DATA_EMPTY\":{\"detail\":\"post数据为空\",\"reason\":\"post数据不能为空\",\"resolution\":\"请检查post数据是否为空\"}," + |
|
|
"\"NOT_UTF8\":{\"detail\":\"编码格式错误\",\"reason\":\"未使用指定编码格式\",\"resolution\":\"请使用UTF-8编码格式\"}}"); |
|
|
"\"NOT_UTF8\":{\"detail\":\"编码格式错误\",\"reason\":\"未使用指定编码格式\",\"resolution\":\"请使用UTF-8编码格式\"}}"); |
|
|
|
|
|
|
|
|
private WxPayOrderP generateWxPayOrderP(String openId,String appId,String mchId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate)throws Exception { |
|
|
|
|
|
|
|
|
private WxPayOrderP generateWxPayOrderP(String openId,String appId,String mchId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate,String productId)throws Exception { |
|
|
// 统一下单 普通商户模式 |
|
|
// 统一下单 普通商户模式 |
|
|
String noncestr = Utility.generate32UUID(); |
|
|
String noncestr = Utility.generate32UUID(); |
|
|
WxPayOrderP wxPayOrderP = new WxPayOrderP(); |
|
|
WxPayOrderP wxPayOrderP = new WxPayOrderP(); |
|
|
@@ -75,6 +75,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
wxPayOrderP.setGoods_tag(productName); |
|
|
wxPayOrderP.setGoods_tag(productName); |
|
|
wxPayOrderP.setNotify_url(notifyUrl); |
|
|
wxPayOrderP.setNotify_url(notifyUrl); |
|
|
wxPayOrderP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 |
|
|
wxPayOrderP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 |
|
|
|
|
|
wxPayOrderP.setProduct_id(productId); |
|
|
wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); |
|
|
wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); |
|
|
Date futureDate = new Date(); |
|
|
Date futureDate = new Date(); |
|
|
futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); |
|
|
futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); |
|
|
@@ -86,85 +87,32 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
|
|
|
|
|
|
private WxPayOrderP generateWxPayOrderP(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record,String openId,String appId,Date currentDate) throws Exception { |
|
|
private WxPayOrderP generateWxPayOrderP(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record,String openId,String appId,Date currentDate) throws Exception { |
|
|
// 统一下单 普通商户模式 |
|
|
// 统一下单 普通商户模式 |
|
|
String noncestr = Utility.generate32UUID(); |
|
|
|
|
|
WxPayOrderP wxPayOrderP = new WxPayOrderP(); |
|
|
|
|
|
wxPayOrderP.setOpenid(openId); |
|
|
|
|
|
wxPayOrderP.setAppid(appId); |
|
|
|
|
|
wxPayOrderP.setMch_id(payAccount.getMchId()); |
|
|
|
|
|
wxPayOrderP.setNonce_str(noncestr); |
|
|
|
|
|
wxPayOrderP.setBody(productName); |
|
|
|
|
|
wxPayOrderP.setAttach(getAttach(record)); |
|
|
|
|
|
wxPayOrderP.setOut_trade_no(record.getPayOrderNo()); |
|
|
|
|
|
wxPayOrderP.setTotal_fee(composeOrder.getPayment()); |
|
|
|
|
|
wxPayOrderP.setSpbill_create_ip(record.getIp()); // 终端IP |
|
|
|
|
|
wxPayOrderP.setGoods_tag(productName); |
|
|
|
|
|
wxPayOrderP.setNotify_url(payAccount.getPayNotifyUrl()); |
|
|
|
|
|
wxPayOrderP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 |
|
|
|
|
|
wxPayOrderP.setProduct_id(String.valueOf(composeOrder.getMainOrderId())); // 订单ID |
|
|
|
|
|
wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); |
|
|
|
|
|
Date futureDate = new Date(); |
|
|
|
|
|
futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); |
|
|
|
|
|
wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 |
|
|
|
|
|
Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderP); |
|
|
|
|
|
wxPayOrderP.setSign(WxPayment.createSign(payOrderMap, payAccount.getApiKey())); |
|
|
|
|
|
return wxPayOrderP; |
|
|
|
|
|
|
|
|
return generateWxPayOrderP(openId,appId,payAccount.getMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(),record.getIp(),payAccount.getPayNotifyUrl(),payAccount.getApiKey(),currentDate,String.valueOf(composeOrder.getMainOrderId())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,String noncestr) { |
|
|
private PayAdapterResult getOrderPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,String noncestr) { |
|
|
PayAdapterResult par = new PayAdapterResult(); |
|
|
|
|
|
returnMap.put("payOrderId", String.valueOf(record.getId())); |
|
|
|
|
|
String result_code = returnMap.get("result_code"); |
|
|
|
|
|
if ("SUCCESS".equals(result_code)) { |
|
|
|
|
|
par.setSuccess(true); |
|
|
|
|
|
par.setMsg("success."); |
|
|
|
|
|
par.setData(returnMap); |
|
|
|
|
|
String prepay_id = returnMap.get("prepay_id"); |
|
|
|
|
|
// update payOrder with prepay_id |
|
|
|
|
|
record.setPrepayId(prepay_id); |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
|
|
|
record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); |
|
|
|
|
|
Map<String, String> sighMap = MapUtil.getOrderMap(); |
|
|
|
|
|
sighMap.put("appId", returnMap.get("appid")); |
|
|
|
|
|
sighMap.put("timeStamp", timestamp); |
|
|
|
|
|
sighMap.put("nonceStr", noncestr); |
|
|
|
|
|
sighMap.put("package", "prepay_id=" + prepay_id); |
|
|
|
|
|
sighMap.put("signType", "MD5"); |
|
|
|
|
|
String signAgent = WxPayment.createSign(sighMap, payAccount.getApiKey()); |
|
|
|
|
|
returnMap.put("timeStamp", timestamp); |
|
|
|
|
|
returnMap.put("nonceStr", noncestr); |
|
|
|
|
|
returnMap.put("package", "prepay_id=" + prepay_id); |
|
|
|
|
|
returnMap.put("paySign", signAgent); |
|
|
|
|
|
log.info("back to UI: " + returnMap.toString()); |
|
|
|
|
|
} else { |
|
|
|
|
|
String errMsg = ""; |
|
|
|
|
|
JSONObject errObj = errorMap.getJSONObject(result_code); |
|
|
|
|
|
if (errObj != null) { |
|
|
|
|
|
errMsg = errObj.toJSONString(); |
|
|
|
|
|
record.setFailReason(errMsg); |
|
|
|
|
|
} else { |
|
|
|
|
|
errMsg = returnMap.get("return_msg"); |
|
|
|
|
|
record.setFailReason(errMsg); |
|
|
|
|
|
} |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
|
|
par.setSuccess(false); |
|
|
|
|
|
par.setMsg(errMsg); |
|
|
|
|
|
par.setData(returnMap); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return par; |
|
|
|
|
|
|
|
|
return getOrderPResult(returnMap,noncestr,payAccount.getApiKey(),record); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderPResult(Map<String, String> returnMap,String noncestr,String apiKey) { |
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderPResult(Map<String, String> returnMap,String noncestr,String apiKey,WxPayOrder record) { |
|
|
PayAdapterResult par = new PayAdapterResult(); |
|
|
PayAdapterResult par = new PayAdapterResult(); |
|
|
|
|
|
if (null != record ) { |
|
|
|
|
|
returnMap.put("payOrderId", String.valueOf(record.getId())); |
|
|
|
|
|
} |
|
|
String result_code = returnMap.get("result_code"); |
|
|
String result_code = returnMap.get("result_code"); |
|
|
if ("SUCCESS".equals(result_code)) { |
|
|
if ("SUCCESS".equals(result_code)) { |
|
|
par.setSuccess(true); |
|
|
par.setSuccess(true); |
|
|
par.setMsg("success."); |
|
|
par.setMsg("success."); |
|
|
par.setData(returnMap); |
|
|
par.setData(returnMap); |
|
|
String prepay_id = returnMap.get("prepay_id"); |
|
|
String prepay_id = returnMap.get("prepay_id"); |
|
|
|
|
|
|
|
|
|
|
|
if (null != record) { |
|
|
|
|
|
// update payOrder with prepay_id |
|
|
|
|
|
record.setPrepayId(prepay_id); |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
|
|
|
record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); |
|
|
String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); |
|
|
Map<String, String> sighMap = MapUtil.getOrderMap(); |
|
|
Map<String, String> sighMap = MapUtil.getOrderMap(); |
|
|
sighMap.put("appId", returnMap.get("appid")); |
|
|
sighMap.put("appId", returnMap.get("appid")); |
|
|
@@ -185,6 +133,10 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
errMsg = errObj.toJSONString(); |
|
|
errMsg = errObj.toJSONString(); |
|
|
} else { |
|
|
} else { |
|
|
errMsg = returnMap.get("return_msg"); |
|
|
errMsg = returnMap.get("return_msg"); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != record) { |
|
|
|
|
|
record.setFailReason(errMsg); |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
} |
|
|
} |
|
|
par.setSuccess(false); |
|
|
par.setSuccess(false); |
|
|
par.setMsg(errMsg); |
|
|
par.setMsg(errMsg); |
|
|
@@ -193,44 +145,52 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
return par; |
|
|
return par; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///////ISV模式 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private WxPayOrderSP generateWxPayOrderSP(WxPayAccount payAccount, WxComposeOrder composeOrder,String productName,WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,EnumPayShare isShare) throws Exception { |
|
|
|
|
|
|
|
|
private WxPayOrderSP generateWxPayOrderSP(String openId,String parentAppId,String mchId,String appId,String subMchId,String productName, |
|
|
|
|
|
String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String productId,Date currentDate,boolean share,String apiKey) throws Exception{ |
|
|
String noncestr = Utility.generate32UUID(); |
|
|
String noncestr = Utility.generate32UUID(); |
|
|
WxPayOrderSP wxPayOrderSP = new WxPayOrderSP(); |
|
|
WxPayOrderSP wxPayOrderSP = new WxPayOrderSP(); |
|
|
wxPayOrderSP.setSub_openid(openId); |
|
|
wxPayOrderSP.setSub_openid(openId); |
|
|
wxPayOrderSP.setAppid(appInfo.getParentAppId()); |
|
|
|
|
|
wxPayOrderSP.setMch_id(payAccount.getMchId()); |
|
|
|
|
|
|
|
|
wxPayOrderSP.setAppid(parentAppId); |
|
|
|
|
|
wxPayOrderSP.setMch_id(mchId); |
|
|
wxPayOrderSP.setSub_appid(appId); |
|
|
wxPayOrderSP.setSub_appid(appId); |
|
|
wxPayOrderSP.setSub_mch_id(payAccount.getSubMchId()); |
|
|
|
|
|
|
|
|
wxPayOrderSP.setSub_mch_id(subMchId); |
|
|
wxPayOrderSP.setNonce_str(noncestr); |
|
|
wxPayOrderSP.setNonce_str(noncestr); |
|
|
wxPayOrderSP.setBody(productName); |
|
|
wxPayOrderSP.setBody(productName); |
|
|
wxPayOrderSP.setAttach(getAttach(record)); |
|
|
|
|
|
wxPayOrderSP.setOut_trade_no(record.getPayOrderNo()); |
|
|
|
|
|
wxPayOrderSP.setTotal_fee(composeOrder.getPayment().toString()); |
|
|
|
|
|
wxPayOrderSP.setSpbill_create_ip(record.getIp()); // 终端IP |
|
|
|
|
|
|
|
|
wxPayOrderSP.setAttach(attach); |
|
|
|
|
|
wxPayOrderSP.setOut_trade_no(payOrderNo); |
|
|
|
|
|
wxPayOrderSP.setTotal_fee(fee.toString()); |
|
|
|
|
|
wxPayOrderSP.setSpbill_create_ip(ip); // 终端IP |
|
|
wxPayOrderSP.setGoods_tag(productName); // 券ID |
|
|
wxPayOrderSP.setGoods_tag(productName); // 券ID |
|
|
wxPayOrderSP.setNotify_url(payAccount.getPayNotifyUrl()); |
|
|
|
|
|
|
|
|
wxPayOrderSP.setNotify_url(notifyUrl); |
|
|
wxPayOrderSP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 |
|
|
wxPayOrderSP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 |
|
|
wxPayOrderSP.setProduct_id(String.valueOf(composeOrder.getMainOrderId())); // |
|
|
|
|
|
|
|
|
wxPayOrderSP.setProduct_id(productId); // |
|
|
wxPayOrderSP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); |
|
|
wxPayOrderSP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); |
|
|
Date futureDate = new Date(); |
|
|
Date futureDate = new Date(); |
|
|
futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); |
|
|
futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); |
|
|
wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 |
|
|
wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 |
|
|
wxPayOrderSP.setSign_type("HMAC-SHA256"); |
|
|
wxPayOrderSP.setSign_type("HMAC-SHA256"); |
|
|
wxPayOrderSP.setProfit_sharing("Y"); |
|
|
|
|
|
// wxPayOrderSP.setProfit_sharing(null); |
|
|
|
|
|
// if (isShare == EnumPayShare.YES) { |
|
|
|
|
|
// wxPayOrderSP.setProfit_sharing("Y"); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
if (share) { |
|
|
|
|
|
wxPayOrderSP.setProfit_sharing("Y"); |
|
|
|
|
|
}else { |
|
|
|
|
|
wxPayOrderSP.setProfit_sharing("N"); |
|
|
|
|
|
} |
|
|
Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); |
|
|
Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); |
|
|
wxPayOrderSP.setSign(WxPayment.createSignHMAC(payOrderMap, payAccount.getApiKey())); |
|
|
|
|
|
|
|
|
wxPayOrderSP.setSign(WxPayment.createSignHMAC(payOrderMap, apiKey)); |
|
|
return wxPayOrderSP; |
|
|
return wxPayOrderSP; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,WxAppinfo appInfo,String noncestr) { |
|
|
|
|
|
|
|
|
private WxPayOrderSP generateWxPayOrderSP(WxPayAccount payAccount, WxComposeOrder composeOrder,String productName,WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,EnumPayShare isShare) throws Exception { |
|
|
|
|
|
return generateWxPayOrderSP(openId,appInfo.getParentAppId(),payAccount.getMchId(),appId,payAccount.getSubMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(), |
|
|
|
|
|
record.getIp(),payAccount.getPayNotifyUrl(),String.valueOf(composeOrder.getMainOrderId()),currentDate,true,payAccount.getApiKey()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,String appId,String noncestr,String apiKey) { |
|
|
PayAdapterResult par = new PayAdapterResult(); |
|
|
PayAdapterResult par = new PayAdapterResult(); |
|
|
returnMap.put("payOrderId", String.valueOf(record.getId())); |
|
|
|
|
|
|
|
|
if (null != record) { |
|
|
|
|
|
returnMap.put("payOrderId", String.valueOf(record.getId())); |
|
|
|
|
|
} |
|
|
String result_code = returnMap.get("result_code"); |
|
|
String result_code = returnMap.get("result_code"); |
|
|
if ("SUCCESS".equals(result_code)) { |
|
|
if ("SUCCESS".equals(result_code)) { |
|
|
par.setSuccess(true); |
|
|
par.setSuccess(true); |
|
|
@@ -239,17 +199,19 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
|
|
|
|
|
|
String prepay_id = returnMap.get("prepay_id"); |
|
|
String prepay_id = returnMap.get("prepay_id"); |
|
|
// update payOrder with prepay_id |
|
|
// update payOrder with prepay_id |
|
|
record.setPrepayId(prepay_id); |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
if (null != record) { |
|
|
|
|
|
record.setPrepayId(prepay_id); |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); |
|
|
String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); |
|
|
Map<String, String> sighMap = MapUtil.getOrderMap(); |
|
|
Map<String, String> sighMap = MapUtil.getOrderMap(); |
|
|
sighMap.put("appId", appInfo.getAppId()); |
|
|
|
|
|
|
|
|
sighMap.put("appId", appId); |
|
|
sighMap.put("timeStamp", timestamp); |
|
|
sighMap.put("timeStamp", timestamp); |
|
|
sighMap.put("nonceStr", noncestr); |
|
|
sighMap.put("nonceStr", noncestr); |
|
|
sighMap.put("package", "prepay_id=" + prepay_id); |
|
|
sighMap.put("package", "prepay_id=" + prepay_id); |
|
|
sighMap.put("signType", "HMAC-SHA256"); |
|
|
sighMap.put("signType", "HMAC-SHA256"); |
|
|
String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); |
|
|
|
|
|
|
|
|
String signAgent = WxPayment.createSignHMAC(sighMap, apiKey); |
|
|
returnMap.put("timeStamp", timestamp); |
|
|
returnMap.put("timeStamp", timestamp); |
|
|
returnMap.put("nonceStr", noncestr); |
|
|
returnMap.put("nonceStr", noncestr); |
|
|
returnMap.put("package", "prepay_id=" + prepay_id); |
|
|
returnMap.put("package", "prepay_id=" + prepay_id); |
|
|
@@ -261,12 +223,14 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
JSONObject errObj = errorMap.getJSONObject(result_code); |
|
|
JSONObject errObj = errorMap.getJSONObject(result_code); |
|
|
if (errObj != null) { |
|
|
if (errObj != null) { |
|
|
errMsg = errObj.toJSONString(); |
|
|
errMsg = errObj.toJSONString(); |
|
|
record.setFailReason(errMsg); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
errMsg = returnMap.get("return_msg"); |
|
|
errMsg = returnMap.get("return_msg"); |
|
|
record.setFailReason(errMsg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (null != record) { |
|
|
|
|
|
record.setFailReason(errMsg); |
|
|
|
|
|
record.setUpdateTime(new Date()); |
|
|
} |
|
|
} |
|
|
record.setUpdateTime(new Date()); |
|
|
|
|
|
par.setSuccess(false); |
|
|
par.setSuccess(false); |
|
|
par.setMsg(errMsg); |
|
|
par.setMsg(errMsg); |
|
|
par.setData(returnMap); |
|
|
par.setData(returnMap); |
|
|
@@ -274,6 +238,10 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
return par; |
|
|
return par; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,WxAppinfo appInfo,String noncestr) { |
|
|
|
|
|
return getOrderSPResult(returnMap,record,appInfo.getAppId(),noncestr,payAccount.getApiKey()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PayAdapterResult pay(WxPayAccount payAccount,WxPayOrder record,WxComposeOrder composeOrder,List<WxOrder> childOrders, |
|
|
public PayAdapterResult pay(WxPayAccount payAccount,WxPayOrder record,WxComposeOrder composeOrder,List<WxOrder> childOrders, |
|
|
@@ -310,11 +278,20 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public PayAdapterResult pay(String openId,String appId,String mchId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception { |
|
|
public PayAdapterResult pay(String openId,String appId,String mchId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception { |
|
|
WxPayOrderP wxPayOrderP = generateWxPayOrderP(openId, appId, mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate); |
|
|
|
|
|
|
|
|
WxPayOrderP wxPayOrderP = generateWxPayOrderP(openId, appId, mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate,null); |
|
|
|
|
|
String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); |
|
|
|
|
|
log.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); |
|
|
|
|
|
Map<String, String> returnMap = WxPayment.xmlToMap(response); |
|
|
|
|
|
return getOrderPResult(returnMap,wxPayOrderP.getNonce_str(),apiKey,null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PayAdapterResult payIsv(WxPayAccount payAccount,WxAppinfo appInfo,String subMchId,String openId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,Date currentDate,boolean share) throws Exception { |
|
|
|
|
|
String apiKey = payAccount.getApiKey(); |
|
|
|
|
|
WxPayOrderSP wxPayOrderP = generateWxPayOrderSP(openId,appInfo.getParentAppId(),payAccount.getMchId(),appInfo.getAppId(),subMchId,productName,attach,payOrderNo,fee,ip,notifyUrl,null,currentDate,share,apiKey); |
|
|
String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); |
|
|
String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); |
|
|
log.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); |
|
|
log.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); |
|
|
Map<String, String> returnMap = WxPayment.xmlToMap(response); |
|
|
Map<String, String> returnMap = WxPayment.xmlToMap(response); |
|
|
return getOrderPResult(returnMap,wxPayOrderP.getNonce_str(),apiKey); |
|
|
|
|
|
|
|
|
return getOrderSPResult(returnMap,null,appInfo.getAppId(),wxPayOrderP.getNonce_str(),apiKey); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|