|
|
@@ -34,6 +34,7 @@ import com.iformall.service.order.entity.WxComposeOrder; |
|
|
import com.iformall.service.pay.entity.PayExtraParam; |
|
|
import com.iformall.service.pay.entity.PayExtraParam; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.CombineItemOrder; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.CombineItemOrder; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.CombinePayCommonMiniAppReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.CombinePayCommonMiniAppReq; |
|
|
|
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.CombinePayerReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.PayAmountReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.PayAmountReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.PayCommonMiniAppReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.PayCommonMiniAppReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.PaySettleReq; |
|
|
import com.iformall.service.pay.service.cashout.wx.v3.entity.PaySettleReq; |
|
|
@@ -60,11 +61,10 @@ public class WxMiniAppPayV3AdapterService implements CDrivingPayService{ |
|
|
PayCommonMiniAppReq req = new PayCommonMiniAppReq(); |
|
|
PayCommonMiniAppReq req = new PayCommonMiniAppReq(); |
|
|
req.setSp_appid(String.valueOf(appInfo.getId())); |
|
|
req.setSp_appid(String.valueOf(appInfo.getId())); |
|
|
req.setSp_mchid(payAccount.getMchId()); |
|
|
req.setSp_mchid(payAccount.getMchId()); |
|
|
WxComposeChildOrderShare share = record.getChildOrderShare(composeOrder.getSingleOrder().getId()); |
|
|
|
|
|
req.setSub_mchid(share.getMerchantUid()); |
|
|
|
|
|
|
|
|
req.setSub_mchid(getMerchantUid(record,composeOrder.getSingleOrder())); |
|
|
req.setDescription(appInfo.getName()+"-"+productName); |
|
|
req.setDescription(appInfo.getName()+"-"+productName); |
|
|
req.setOut_trade_no(String.valueOf(composeOrder.getMainOrderId())); |
|
|
req.setOut_trade_no(String.valueOf(composeOrder.getMainOrderId())); |
|
|
req.setNotify_url(payAccount.getPayNotifyUrl()); |
|
|
|
|
|
|
|
|
req.setNotify_url(payAccount.getPayNotifyV3Url()); |
|
|
|
|
|
|
|
|
PaySettleReq settle = new PaySettleReq(); |
|
|
PaySettleReq settle = new PaySettleReq(); |
|
|
settle.setProfit_sharing(true); |
|
|
settle.setProfit_sharing(true); |
|
|
@@ -81,6 +81,11 @@ public class WxMiniAppPayV3AdapterService implements CDrivingPayService{ |
|
|
return req; |
|
|
return req; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getMerchantUid(WxPayOrder payOrder,WxOrder order) { |
|
|
|
|
|
WxComposeChildOrderShare share = payOrder.getChildOrderShare(order.getId()); |
|
|
|
|
|
return share.getMerchantUid(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private CombinePayCommonMiniAppReq generateCombinePayReqeust(WxPayAccount payAccount,WxComposeOrder composeOrder,List<WxOrder> childOrders,String productName, |
|
|
private CombinePayCommonMiniAppReq generateCombinePayReqeust(WxPayAccount payAccount,WxComposeOrder composeOrder,List<WxOrder> childOrders,String productName, |
|
|
WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,EnumPayShare isShare) throws Exception { |
|
|
WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,EnumPayShare isShare) throws Exception { |
|
|
|
|
|
|
|
|
@@ -89,44 +94,21 @@ public class WxMiniAppPayV3AdapterService implements CDrivingPayService{ |
|
|
req.setCombine_mchid(payAccount.getMchId()); |
|
|
req.setCombine_mchid(payAccount.getMchId()); |
|
|
req.setCombine_out_trade_no(String.valueOf(composeOrder.getMainOrderId())); |
|
|
req.setCombine_out_trade_no(String.valueOf(composeOrder.getMainOrderId())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<CombineItemOrder> suborders = new ArrayList<CombineItemOrder>(); |
|
|
List<CombineItemOrder> suborders = new ArrayList<CombineItemOrder>(); |
|
|
for (WxOrder order : childOrders) { |
|
|
for (WxOrder order : childOrders) { |
|
|
CombineItemOrder so = new CombineItemOrder(); |
|
|
CombineItemOrder so = new CombineItemOrder(); |
|
|
|
|
|
String subMchId = getMerchantUid(record,order); |
|
|
so.initByWxOrder(payAccount, order, subMchId, appInfo, productName, String.valueOf(record.getId())); |
|
|
so.initByWxOrder(payAccount, order, subMchId, appInfo, productName, String.valueOf(record.getId())); |
|
|
|
|
|
suborders.add(so); |
|
|
} |
|
|
} |
|
|
|
|
|
req.setSub_orders(suborders); |
|
|
|
|
|
|
|
|
//composeOrder. |
|
|
|
|
|
|
|
|
CombinePayerReq payer = new CombinePayerReq(); |
|
|
|
|
|
payer.setOpenid(openId); |
|
|
|
|
|
req.setCombine_payer_info(payer); |
|
|
|
|
|
|
|
|
String noncestr = Utility.generate32UUID(); |
|
|
|
|
|
WxPayOrderSP wxPayOrderSP = new WxPayOrderSP(); |
|
|
|
|
|
wxPayOrderSP.setSub_openid(openId); |
|
|
|
|
|
wxPayOrderSP.setAppid(appInfo.getParentAppId()); |
|
|
|
|
|
wxPayOrderSP.setMch_id(payAccount.getMchId()); |
|
|
|
|
|
wxPayOrderSP.setSub_appid(appId); |
|
|
|
|
|
wxPayOrderSP.setSub_mch_id(payAccount.getSubMchId()); |
|
|
|
|
|
wxPayOrderSP.setNonce_str(noncestr); |
|
|
|
|
|
wxPayOrderSP.setBody(productName); |
|
|
|
|
|
wxPayOrderSP.setOut_trade_no(record.getPayOrderNo()); |
|
|
|
|
|
wxPayOrderSP.setTotal_fee(composeOrder.getPayment().toString()); |
|
|
|
|
|
wxPayOrderSP.setSpbill_create_ip(record.getIp()); // 终端IP |
|
|
|
|
|
wxPayOrderSP.setGoods_tag(productName); // 券ID |
|
|
|
|
|
wxPayOrderSP.setNotify_url(payAccount.getPayNotifyUrl()); |
|
|
|
|
|
wxPayOrderSP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 |
|
|
|
|
|
wxPayOrderSP.setProduct_id(String.valueOf(composeOrder.getMainOrderId())); // |
|
|
|
|
|
wxPayOrderSP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); |
|
|
|
|
|
Date futureDate = new Date(); |
|
|
|
|
|
futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); |
|
|
|
|
|
wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 |
|
|
|
|
|
wxPayOrderSP.setSign_type("HMAC-SHA256"); |
|
|
|
|
|
wxPayOrderSP.setProfit_sharing(null); |
|
|
|
|
|
if (isShare == EnumPayShare.YES) { |
|
|
|
|
|
wxPayOrderSP.setProfit_sharing("Y"); |
|
|
|
|
|
} |
|
|
|
|
|
Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); |
|
|
|
|
|
wxPayOrderSP.setSign(WxPayment.createSignHMAC(payOrderMap, payAccount.getApiKey())); |
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
req.setNotify_url(payAccount.getPayNotifyV3Url()); |
|
|
|
|
|
return req; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private PayAdapterResult getOrderPResult(String response) { |
|
|
private PayAdapterResult getOrderPResult(String response) { |
|
|
|