| @@ -533,7 +533,7 @@ public class WxCarController extends BaseController { | |||||
| String attach = attachSb.toString(); | String attach = attachSb.toString(); | ||||
| String productPre = "停车费支付,车场订单号";//中文签名错误 | String productPre = "停车费支付,车场订单号";//中文签名错误 | ||||
| //String productPre = "ParkOrderId"; | //String productPre = "ParkOrderId"; | ||||
| PayAdapterResult wxResult = wxParkPayService.createWxPayOrder(payAccount,cAppInfo,isIsv,false,user.getOpenId(), receiverAccount, productPre+payOrder.getParkOrderNumber(), attach, uniquePayOrderNo, payOrder.getFee(), | |||||
| PayAdapterResult wxResult = wxParkPayService.createWxPayOrder(payAccount,cAppInfo,isIsv,user.getOpenId(), receiverAccount, productPre+payOrder.getParkOrderNumber(), attach, uniquePayOrderNo, payOrder.getFee(), | |||||
| "127.0.0.1", park.getPaidCallBack(), apiKey, new Date()); | "127.0.0.1", park.getPaidCallBack(), apiKey, new Date()); | ||||
| if (wxResult.isSuccess()) { | if (wxResult.isSuccess()) { | ||||
| return new ResultData(wxResult); | return new ResultData(wxResult); | ||||
| @@ -203,5 +203,9 @@ public class WxOrder extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="配送类型 0:默认(无) 1:自提 2:配送",name="shippingType") | @io.swagger.annotations.ApiModelProperty(value="配送类型 0:默认(无) 1:自提 2:配送",name="shippingType") | ||||
| private Integer shippingType; | private Integer shippingType; | ||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否积分按照支付比例",name="isCreditByPamentRate") | |||||
| private boolean isCreditByPamentRate = true; | |||||
| } | } | ||||
| @@ -13,26 +13,26 @@ public enum EnumCouponType { | |||||
| // 1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.通用券, 8.砍价券 | // 1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.通用券, 8.砍价券 | ||||
| // 100.消费卡 | // 100.消费卡 | ||||
| COUPON_MANJIAN(1, "满减券"), | |||||
| COUPON_DAIJIN(2, "代金券"), | |||||
| COUPON_MANJIAN(1, "满减券",true), | |||||
| COUPON_DAIJIN(2, "代金券",true), | |||||
| // COUPON_TUANGOU(3, "团购券"),//弃用 | // COUPON_TUANGOU(3, "团购券"),//弃用 | ||||
| COUPON_LIPIN(4, "礼品券"), | |||||
| COUPON_TINGCHE(5, "停车券"), | |||||
| COUPON_MULTIMCH(6, "通用券"), | |||||
| COUPON_DOUYIN(66, "抖音券"), | |||||
| COUPON_PRESS(8, "砍价券"), | |||||
| COUPON_GROUP(9, "拼团券"), | |||||
| COUPON_PREORDER(10, "预购商品"), | |||||
| COUPON_DISTRIBUTION(11, "可配送商品"), | |||||
| COUPON_GIFT(12, "券礼包"), | |||||
| COUPON_CREDIT(50,"积分券"), | |||||
| COUPON_CREDIT_PARK(51,"积分停车券"), | |||||
| COUPON_LIPIN(4, "礼品券",true), | |||||
| COUPON_TINGCHE(5, "停车券",true), | |||||
| COUPON_MULTIMCH(6, "通用券",true), | |||||
| COUPON_DOUYIN(66, "抖音券",true), | |||||
| COUPON_PRESS(8, "砍价券",true), | |||||
| COUPON_GROUP(9, "拼团券",true), | |||||
| COUPON_PREORDER(10, "预购商品",true), | |||||
| COUPON_DISTRIBUTION(11, "可配送商品",true), | |||||
| COUPON_GIFT(12, "券礼包",true), | |||||
| COUPON_CREDIT(50,"积分券",true), | |||||
| COUPON_CREDIT_PARK(51,"积分停车券",true), | |||||
| // COUPON_CREDIT_DOUYIN(55,"抖音积分券"), | // COUPON_CREDIT_DOUYIN(55,"抖音积分券"), | ||||
| COUPON_DOUYIN_PLAT(67, "抖音集团平台券"), | |||||
| COUPON_DOUYIN_BRAND(68, "抖音集团品牌券"), | |||||
| COUPON_DOUYIN_PLAT(67, "抖音集团平台券",true), | |||||
| COUPON_DOUYIN_BRAND(68, "抖音集团品牌券",true), | |||||
| CARD_MULTIMCH(100, "消费卡"), | |||||
| CARD_MULTIMCH(100, "消费卡",false), | |||||
| ; | ; | ||||
| public static EnumCouponType getEnum(Integer code) { | public static EnumCouponType getEnum(Integer code) { | ||||
| @@ -64,10 +64,12 @@ public enum EnumCouponType { | |||||
| private Integer code; | private Integer code; | ||||
| private String message; | private String message; | ||||
| private boolean isSupportRefund;//是否支持线上退款,如果支持线上退款,则购买时需要冻结该金额 | |||||
| EnumCouponType(Integer code, String message) { | |||||
| EnumCouponType(Integer code, String message,boolean isSupportRefund) { | |||||
| this.code = code; | this.code = code; | ||||
| this.message = message; | this.message = message; | ||||
| this.isSupportRefund = isSupportRefund; | |||||
| } | } | ||||
| public Integer getCode() { | public Integer getCode() { | ||||
| @@ -78,7 +80,11 @@ public enum EnumCouponType { | |||||
| return message; | return message; | ||||
| } | } | ||||
| /** | |||||
| public boolean isSupportRefund() { | |||||
| return isSupportRefund; | |||||
| } | |||||
| /** | |||||
| * 抖音平台的券 | * 抖音平台的券 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| @@ -21,6 +21,7 @@ public class WxMicroPayOrderP { | |||||
| private String time_start; // 开始时间 | private String time_start; // 开始时间 | ||||
| private String time_expire; // 失效时间 | private String time_expire; // 失效时间 | ||||
| private String auth_code; // 扫码支付授权码 | private String auth_code; // 扫码支付授权码 | ||||
| private String profit_sharing; // 不传默认不分账 Y-是,需要分账 N-否,不分账 | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| @@ -37,6 +38,7 @@ public class WxMicroPayOrderP { | |||||
| sb.append(", time_start='").append(time_start).append('\''); | sb.append(", time_start='").append(time_start).append('\''); | ||||
| sb.append(", time_expire='").append(time_expire).append('\''); | sb.append(", time_expire='").append(time_expire).append('\''); | ||||
| sb.append(", auth_code='").append(auth_code).append('\''); | sb.append(", auth_code='").append(auth_code).append('\''); | ||||
| sb.append(", profit_sharing='").append(profit_sharing).append('\''); | |||||
| sb.append('}'); | sb.append('}'); | ||||
| return sb.toString(); | return sb.toString(); | ||||
| } | } | ||||
| @@ -24,6 +24,7 @@ public class WxPayOrderP { | |||||
| private String time_start; // 开始时间 | private String time_start; // 开始时间 | ||||
| private String time_expire; // 失效时间 | private String time_expire; // 失效时间 | ||||
| private String openid; // openId | private String openid; // openId | ||||
| private String profit_sharing; // 不传默认不分账 Y-是,需要分账 N-否,不分账 | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| @@ -44,6 +45,7 @@ public class WxPayOrderP { | |||||
| sb.append(", time_start='").append(time_start).append('\''); | sb.append(", time_start='").append(time_start).append('\''); | ||||
| sb.append(", time_expire='").append(time_expire).append('\''); | sb.append(", time_expire='").append(time_expire).append('\''); | ||||
| sb.append(", openid='").append(openid).append('\''); | sb.append(", openid='").append(openid).append('\''); | ||||
| sb.append(", profit_sharing='").append(profit_sharing).append('\''); | |||||
| sb.append('}'); | sb.append('}'); | ||||
| return sb.toString(); | return sb.toString(); | ||||
| } | } | ||||
| @@ -316,6 +316,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| orderUpdate.setPayment(payment); | orderUpdate.setPayment(payment); | ||||
| }else if(coupon.getCardScoreRule().intValue() == EnumCardScoreRule.BY_PRICE.getCode().intValue()){ | }else if(coupon.getCardScoreRule().intValue() == EnumCardScoreRule.BY_PRICE.getCode().intValue()){ | ||||
| orderUpdate.setPayment(record.getDeductionAmount()); | orderUpdate.setPayment(record.getDeductionAmount()); | ||||
| orderUpdate.setCreditByPamentRate(false); | |||||
| } | } | ||||
| wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -1629,10 +1629,18 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| * @param wxCoupon | * @param wxCoupon | ||||
| */ | */ | ||||
| private void doAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser, WxCoupon wxCoupon) { | private void doAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser, WxCoupon wxCoupon) { | ||||
| Integer businessId = wxCoupon.getBusiness(); | |||||
| if (null != bUser) { | |||||
| WxMerchant merchant = wxMerchantMapper.selectById(bUser.getMerchantId()); | |||||
| if (null != merchant) { | |||||
| businessId = merchant.getBusinessId(); | |||||
| } | |||||
| } | |||||
| // 成长值 | // 成长值 | ||||
| try { | try { | ||||
| WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId(),couponOrder.getTenantId()); | WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId(),couponOrder.getTenantId()); | ||||
| wxScoreRulesService.addScore2(couponOrder,EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||||
| wxScoreRulesService.addScore2(couponOrder,EnumScoreType.CONSUMPTION, order, businessId); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("成长值:" + e.getMessage()); | logger.error("成长值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -1648,9 +1656,16 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| creditHistory.setMerchantId(bUser.getMerchantId()); | creditHistory.setMerchantId(bUser.getMerchantId()); | ||||
| creditHistory.setBuserId(bUser.getBuserId()); | creditHistory.setBuserId(bUser.getBuserId()); | ||||
| }else{ | }else{ | ||||
| //礼包券,确认收货等 | |||||
| creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| creditHistory.setOperatorId(couponOrder.getCUserId()); | creditHistory.setOperatorId(couponOrder.getCUserId()); | ||||
| creditHistory.setMerchantId(couponOrder.getBMerchantId()); | creditHistory.setMerchantId(couponOrder.getBMerchantId()); | ||||
| if (null != couponOrder.getBMerchantId()) { | |||||
| WxMerchant merchant1 = wxMerchantMapper.selectById(couponOrder.getBMerchantId()); | |||||
| if (null != merchant1) { | |||||
| businessId = merchant1.getBusinessId(); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| creditHistory.setCUserId(couponOrder.getcUserId()); | creditHistory.setCUserId(couponOrder.getcUserId()); | ||||
| @@ -1660,7 +1675,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| creditHistory.setFinalTenantId(couponOrder.getFinalTenantId()); | creditHistory.setFinalTenantId(couponOrder.getFinalTenantId()); | ||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setCouponId(wxCoupon.getId()); | creditHistory.setCouponId(wxCoupon.getId()); | ||||
| creditHistory.setBusinessId(wxCoupon.getBusiness()); | |||||
| creditHistory.setBusinessId(businessId); | |||||
| creditHistory.setSpend(couponOrder.getCouponPrice()); | creditHistory.setSpend(couponOrder.getCouponPrice()); | ||||
| creditHistory.setChangePurpose("券["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] 使用成功"); | creditHistory.setChangePurpose("券["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] 使用成功"); | ||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder); | wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder); | ||||
| @@ -495,6 +495,14 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| logger.debug("wxPayRecord md5 before:"+record.toString()); | logger.debug("wxPayRecord md5 before:"+record.toString()); | ||||
| String beforemd5 = HashUtil.md5(record.toString()); | String beforemd5 = HashUtil.md5(record.toString()); | ||||
| //如果只有一个订单,并且该产品是不支持线上退款的,则不用冻结金额 | |||||
| boolean isFreezen = true; | |||||
| if (null != composeOrder.getSingleOrder()) { | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(composeOrder.getSingleOrder().getProductId(),composeOrder.getSingleOrder().getTenantId()); | |||||
| if (null != wxCoupon) { | |||||
| isFreezen = EnumCouponType.getEnum(wxCoupon.getType()).isSupportRefund(); | |||||
| } | |||||
| } | |||||
| PayAdapterResult payResult = payAdapterService.pay(payAccount, record,composeOrder,childOrders,productName,isShare,appInfo, currentDate, params); | PayAdapterResult payResult = payAdapterService.pay(payAccount, record,composeOrder,childOrders,productName,isShare,appInfo, currentDate, params); | ||||
| String aftermd5 = HashUtil.md5(record.toString()); | String aftermd5 = HashUtil.md5(record.toString()); | ||||
| if (beforemd5.equals(aftermd5)) { | if (beforemd5.equals(aftermd5)) { | ||||
| @@ -380,8 +380,12 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| // 4. 计算成长值 | // 4. 计算成长值 | ||||
| if(order.getPayment() >= priceCondition.intValue()) { | if(order.getPayment() >= priceCondition.intValue()) { | ||||
| Double dScoreT = Math.floor(order.getPayment() * 1.0D / priceCondition * baseScore); | |||||
| addScoreNumber = dScoreT.intValue(); | |||||
| if (order.isCreditByPamentRate()) { | |||||
| Double dScoreT = Math.floor(order.getPayment() * 1.0D / priceCondition * baseScore); | |||||
| addScoreNumber = dScoreT.intValue(); | |||||
| }else { | |||||
| addScoreNumber = order.getPayment(); | |||||
| } | |||||
| logger.info("RULE:" + busRule.toJSONString() + "\nAddScore: " + addScoreNumber); | logger.info("RULE:" + busRule.toJSONString() + "\nAddScore: " + addScoreNumber); | ||||
| if (addScoreNumber == 0) { | if (addScoreNumber == 0) { | ||||
| return 0; | return 0; | ||||
| @@ -122,6 +122,10 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic | |||||
| WxComposeOrder corder = new WxComposeOrder(order.getId(),composeOrderType.getCode(),order.getPayment()); | WxComposeOrder corder = new WxComposeOrder(order.getId(),composeOrderType.getCode(),order.getPayment()); | ||||
| corder.updateTenantInfo(order); | corder.updateTenantInfo(order); | ||||
| corder.setMainOrder(order); | corder.setMainOrder(order); | ||||
| List<WxOrder> orders = getChildOrders(corder, tenantId, composeOrderType); | |||||
| if (null != orders && orders.size() == 1 ) { | |||||
| corder.setSingleOrder(orders.get(0)); | |||||
| } | |||||
| return corder; | return corder; | ||||
| } | } | ||||
| @@ -23,7 +23,7 @@ public interface WxParkPayService { | |||||
| public void exportData(WxCarPayOrder record, HttpServletRequest request, HttpServletResponse response); | public void exportData(WxCarPayOrder record, HttpServletRequest request, HttpServletResponse response); | ||||
| //share:是否分账,服务商模式下生效 | //share:是否分账,服务商模式下生效 | ||||
| public PayAdapterResult createWxPayOrder(WxPayAccount payAccount,WxAppinfo cAppInfo,boolean isIsvModel,boolean share,String appId,String mchId,String productName,String attach,String payOrderNo, | |||||
| public PayAdapterResult createWxPayOrder(WxPayAccount payAccount,WxAppinfo cAppInfo,boolean isIsvModel,String appId,String mchId,String productName,String attach,String payOrderNo, | |||||
| Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception; | Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception; | ||||
| public String handlePaidCallBack(String tenantId,Map<String, String> paramMap); | public String handlePaidCallBack(String tenantId,Map<String, String> paramMap); | ||||
| @@ -111,12 +111,12 @@ public class WxParkPayServiceImpl implements WxParkPayService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public PayAdapterResult createWxPayOrder(WxPayAccount payAccount,WxAppinfo cAppInfo,boolean isIsvModel,boolean share,String openId,String mchId,String productName,String attach,String payOrderNo, | |||||
| public PayAdapterResult createWxPayOrder(WxPayAccount payAccount,WxAppinfo cAppInfo,boolean isIsvModel,String openId,String mchId,String productName,String attach,String payOrderNo, | |||||
| Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception { | Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception { | ||||
| if (!isIsvModel) { | if (!isIsvModel) { | ||||
| return wxMiniAppPayAdapterService.pay(openId, cAppInfo.getAppId(),mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate); | |||||
| return wxMiniAppPayAdapterService.pay(openId, cAppInfo.getAppId(),mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate,false); | |||||
| }else { | }else { | ||||
| return wxMiniAppPayAdapterService.payIsv(payAccount, cAppInfo, mchId, openId, productName, attach, payOrderNo, fee, ip, notifyUrl, currentDate, share); | |||||
| return wxMiniAppPayAdapterService.payIsv(payAccount, cAppInfo, mchId, openId, productName, attach, payOrderNo, fee, ip, notifyUrl, currentDate, false); | |||||
| } | } | ||||
| } | } | ||||
| @@ -24,10 +24,11 @@ public interface PayAdapterService { | |||||
| * @param appInfo C端app | * @param appInfo C端app | ||||
| * @param currentDate Date 当前时间,可能加密串用 | * @param currentDate Date 当前时间,可能加密串用 | ||||
| * @param params PayExtraParam 其他需要的参数 | * @param params PayExtraParam 其他需要的参数 | ||||
| * @param isFreezen 金额是否要冻结 | |||||
| * @return | * @return | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| public PayAdapterResult pay(WxPayAccount payAccount,WxPayOrder record ,WxComposeOrder composeOrder,List<WxOrder> childOrders,String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception; | |||||
| public PayAdapterResult pay(WxPayAccount payAccount,WxPayOrder record ,WxComposeOrder composeOrder,List<WxOrder> childOrders,String productName,WxAppinfo appInfo,Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception; | |||||
| /** | /** | ||||
| * 查询支付结果,调用对应端的API查询支付结果 | * 查询支付结果,调用对应端的API查询支付结果 | ||||
| @@ -79,7 +79,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen | |||||
| @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, | ||||
| String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName,WxAppinfo appInfo,Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception { | |||||
| //抖音支付1.0,已经不再支持 | //抖音支付1.0,已经不再支持 | ||||
| if(true){ | if(true){ | ||||
| throw new MallinkException(ErrorCode.SYS_AUTH_ERROR.getCode(),"请升级抖音版本"); | throw new MallinkException(ErrorCode.SYS_AUTH_ERROR.getCode(),"请升级抖音版本"); | ||||
| @@ -24,7 +24,7 @@ public class WxH5PaySFTService extends BaseWxPaySFTAdapterService implements CDr | |||||
| @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, | ||||
| String productName, EnumPayShare isShare,WxAppinfo appInfo, Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName, WxAppinfo appInfo, Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception { | |||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -65,7 +65,8 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| @Autowired | @Autowired | ||||
| MaUtil maUtil; | MaUtil maUtil; | ||||
| private SFTPayCommonMiniAppReq generatePayCommonRequest(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record,String openId,WxAppinfo appInfo,Date currentDate) throws Exception { | |||||
| private SFTPayCommonMiniAppReq generatePayCommonRequest(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record, | |||||
| String openId,WxAppinfo appInfo,Date currentDate,boolean isFreezen) throws Exception { | |||||
| SFTPayCommonMiniAppReq req = new SFTPayCommonMiniAppReq(); | SFTPayCommonMiniAppReq req = new SFTPayCommonMiniAppReq(); | ||||
| req.setSp_appid(String.valueOf(appInfo.getId())); | req.setSp_appid(String.valueOf(appInfo.getId())); | ||||
| req.setSp_mchid(payAccount.getMchId()); | req.setSp_mchid(payAccount.getMchId()); | ||||
| @@ -80,7 +81,7 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| req.setNotify_url(payAccount.getPayNotifyV3Url()); | req.setNotify_url(payAccount.getPayNotifyV3Url()); | ||||
| SFTPaySettleReq settle = new SFTPaySettleReq(); | SFTPaySettleReq settle = new SFTPaySettleReq(); | ||||
| settle.setProfit_sharing(true); | |||||
| settle.setProfit_sharing(isFreezen); | |||||
| req.setSettle_info(settle); | req.setSettle_info(settle); | ||||
| SFTPayAmountReq amout = new SFTPayAmountReq(); | SFTPayAmountReq amout = new SFTPayAmountReq(); | ||||
| @@ -148,7 +149,7 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| */ | */ | ||||
| @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, | ||||
| String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName,WxAppinfo appInfo,Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception { | |||||
| if (null == params ) { | if (null == params ) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | ||||
| } | } | ||||
| @@ -176,7 +177,7 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| * https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_2_3.shtml | * https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_2_3.shtml | ||||
| */ | */ | ||||
| if (childOrders.size() == 1) { | if (childOrders.size() == 1) { | ||||
| SFTPayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate); | |||||
| SFTPayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate,isFreezen); | |||||
| try { | try { | ||||
| String response = WxPayV3SFT.payCommonWithMiniApp(payService, payReq); | String response = WxPayV3SFT.payCommonWithMiniApp(payService, payReq); | ||||
| return getOrderPResult(response,record); | return getOrderPResult(response,record); | ||||
| @@ -23,7 +23,7 @@ public class WxH5PayService extends BaseWxPayV2AdapterService implements CDrivi | |||||
| @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, | ||||
| String productName, EnumPayShare isShare,WxAppinfo appInfo, Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName, WxAppinfo appInfo, Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception { | |||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -59,7 +59,8 @@ 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,String productId)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,boolean isFreezen)throws Exception { | |||||
| // 统一下单 普通商户模式 | // 统一下单 普通商户模式 | ||||
| String noncestr = Utility.generate32UUID(); | String noncestr = Utility.generate32UUID(); | ||||
| WxPayOrderP wxPayOrderP = new WxPayOrderP(); | WxPayOrderP wxPayOrderP = new WxPayOrderP(); | ||||
| @@ -78,6 +79,11 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| if (null != productId) { | if (null != productId) { | ||||
| wxPayOrderP.setProduct_id(productId); | wxPayOrderP.setProduct_id(productId); | ||||
| } | } | ||||
| if (isFreezen) { | |||||
| wxPayOrderP.setProfit_sharing("Y"); | |||||
| }else { | |||||
| wxPayOrderP.setProfit_sharing("N"); | |||||
| } | |||||
| 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); | ||||
| @@ -87,9 +93,10 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| return wxPayOrderP; | return wxPayOrderP; | ||||
| } | } | ||||
| 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,boolean isFreezen) throws Exception { | |||||
| // 统一下单 普通商户模式 | // 统一下单 普通商户模式 | ||||
| return generateWxPayOrderP(openId,appId,payAccount.getMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(),record.getIp(),payAccount.getPayNotifyUrl(),payAccount.getApiKey(),currentDate,String.valueOf(composeOrder.getMainOrderId())); | |||||
| return generateWxPayOrderP(openId,appId,payAccount.getMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(),record.getIp(),payAccount.getPayNotifyUrl(), | |||||
| payAccount.getApiKey(),currentDate,String.valueOf(composeOrder.getMainOrderId()),isFreezen); | |||||
| } | } | ||||
| 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) { | ||||
| @@ -150,7 +157,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| ///////ISV模式 | ///////ISV模式 | ||||
| private WxPayOrderSP generateWxPayOrderSP(String openId,String parentAppId,String mchId,String appId,String subMchId,String productName, | 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 attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String productId,Date currentDate,String apiKey,boolean isFreezen) 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); | ||||
| @@ -175,7 +182,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| 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"); | ||||
| if (share) { | |||||
| if (isFreezen) { | |||||
| wxPayOrderSP.setProfit_sharing("Y"); | wxPayOrderSP.setProfit_sharing("Y"); | ||||
| }else { | }else { | ||||
| wxPayOrderSP.setProfit_sharing("N"); | wxPayOrderSP.setProfit_sharing("N"); | ||||
| @@ -185,9 +192,9 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| return wxPayOrderSP; | return wxPayOrderSP; | ||||
| } | } | ||||
| 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(WxPayAccount payAccount, WxComposeOrder composeOrder,String productName,WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,boolean isFreezen) throws Exception { | |||||
| return generateWxPayOrderSP(openId,appInfo.getParentAppId(),payAccount.getMchId(),appId,payAccount.getSubMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(), | 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()); | |||||
| record.getIp(),payAccount.getPayNotifyUrl(),String.valueOf(composeOrder.getMainOrderId()),currentDate,payAccount.getApiKey(),isFreezen); | |||||
| } | } | ||||
| private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,String appId,String noncestr,String apiKey) { | private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,String appId,String noncestr,String apiKey) { | ||||
| @@ -249,7 +256,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| @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, | ||||
| String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName,WxAppinfo appInfo,Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception { | |||||
| if (null == params ) { | if (null == params ) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | ||||
| } | } | ||||
| @@ -265,7 +272,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| //普通商户模式 | //普通商户模式 | ||||
| if (payAccount.getType() == EnumPayMode.MCH.getCode()) { | if (payAccount.getType() == EnumPayMode.MCH.getCode()) { | ||||
| WxPayOrderP wxPayOrderP = generateWxPayOrderP(payAccount,composeOrder,productName,record,openId,appInfo.getAppId(),currentDate); | |||||
| WxPayOrderP wxPayOrderP = generateWxPayOrderP(payAccount,composeOrder,productName,record,openId,appInfo.getAppId(),currentDate,isFreezen); | |||||
| 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); | ||||
| @@ -273,7 +280,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||||
| } else { | } else { | ||||
| // 统一下单 // 服务商模式 | // 统一下单 // 服务商模式 | ||||
| WxPayOrderSP wxPayOrderSP = generateWxPayOrderSP(payAccount,composeOrder,productName,record,appInfo,openId,appInfo.getAppId(),currentDate,isShare); | |||||
| WxPayOrderSP wxPayOrderSP = generateWxPayOrderSP(payAccount,composeOrder,productName,record,appInfo,openId,appInfo.getAppId(),currentDate,isFreezen); | |||||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderSP)); | String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderSP)); | ||||
| log.info("pay order, wechat pushOrder, " + wxPayOrderSP.toString() + ", response: " + response.toString()); | log.info("pay order, wechat pushOrder, " + wxPayOrderSP.toString() + ", response: " + response.toString()); | ||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | Map<String, String> returnMap = WxPayment.xmlToMap(response); | ||||
| @@ -281,17 +288,17 @@ 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 { | |||||
| WxPayOrderP wxPayOrderP = generateWxPayOrderP(openId, appId, mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate,null); | |||||
| 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,boolean freezen) throws Exception { | |||||
| WxPayOrderP wxPayOrderP = generateWxPayOrderP(openId, appId, mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate,null,freezen); | |||||
| 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,null); | 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 { | |||||
| 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 freezen) throws Exception { | |||||
| String apiKey = payAccount.getApiKey(); | 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); | |||||
| WxPayOrderSP wxPayOrderP = generateWxPayOrderSP(openId,appInfo.getParentAppId(),payAccount.getMchId(),appInfo.getAppId(),subMchId,productName,attach,payOrderNo,fee,ip,notifyUrl,null,currentDate,apiKey,freezen); | |||||
| 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); | ||||
| @@ -49,8 +49,8 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| return share.getMerchantUid(); | return share.getMerchantUid(); | ||||
| } | } | ||||
| private WxMicroPayOrderP generateWxMicroPayOrderP(WxPayAccount payAccount, WxComposeOrder composeOrder, String productName,WxPayOrder record, EnumPayShare isShare, | |||||
| WxAppinfo appInfo, Date currentDate,String bAppId,String bUserPhone) throws Exception { | |||||
| private WxMicroPayOrderP generateWxMicroPayOrderP(WxPayAccount payAccount, WxComposeOrder composeOrder, String productName,WxPayOrder record, | |||||
| WxAppinfo appInfo, Date currentDate,String bAppId,String bUserPhone,boolean isFreezen) throws Exception { | |||||
| String noncestr = Utility.generate32UUID(); | String noncestr = Utility.generate32UUID(); | ||||
| WxMicroPayOrderP wxPayOrderP = new WxMicroPayOrderP(); | WxMicroPayOrderP wxPayOrderP = new WxMicroPayOrderP(); | ||||
| wxPayOrderP.setAppid(bAppId); | wxPayOrderP.setAppid(bAppId); | ||||
| @@ -64,6 +64,11 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| wxPayOrderP.setSpbill_create_ip(record.getIp()); // 终端IP | wxPayOrderP.setSpbill_create_ip(record.getIp()); // 终端IP | ||||
| wxPayOrderP.setAuth_code(record.getAuthCode()); | wxPayOrderP.setAuth_code(record.getAuthCode()); | ||||
| wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); | wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); | ||||
| if (isFreezen) { | |||||
| wxPayOrderP.setProfit_sharing("Y"); | |||||
| }else { | |||||
| wxPayOrderP.setProfit_sharing("N"); | |||||
| } | |||||
| Date futureDate = new Date(); | Date futureDate = new Date(); | ||||
| futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); | futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); | ||||
| wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | ||||
| @@ -104,8 +109,8 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| } | } | ||||
| private WxMicroPayOrderSP generateWxMicroPayOrderSP(WxPayAccount payAccount, WxComposeOrder composeOrder, String productName,WxPayOrder record, EnumPayShare isShare, | |||||
| WxAppinfo appInfo, Date currentDate,String bUserPhone) throws Exception { | |||||
| private WxMicroPayOrderSP generateWxMicroPayOrderSP(WxPayAccount payAccount, WxComposeOrder composeOrder, String productName,WxPayOrder record, | |||||
| WxAppinfo appInfo, Date currentDate,String bUserPhone,boolean isFreezen) throws Exception { | |||||
| String noncestr = Utility.generate32UUID(); | String noncestr = Utility.generate32UUID(); | ||||
| WxMicroPayOrderSP wxPayOrderSP = new WxMicroPayOrderSP(); | WxMicroPayOrderSP wxPayOrderSP = new WxMicroPayOrderSP(); | ||||
| wxPayOrderSP.setAppid(appInfo.getParentAppId()); | wxPayOrderSP.setAppid(appInfo.getParentAppId()); | ||||
| @@ -132,7 +137,11 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| 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"); | |||||
| if (isFreezen) { | |||||
| wxPayOrderSP.setProfit_sharing("Y"); | |||||
| }else { | |||||
| wxPayOrderSP.setProfit_sharing("N"); | |||||
| } | |||||
| // wxPayOrderSP.setProfit_sharing(null); | // wxPayOrderSP.setProfit_sharing(null); | ||||
| // if (isShare == EnumPayShare.YES) { | // if (isShare == EnumPayShare.YES) { | ||||
| // wxPayOrderSP.setProfit_sharing("Y"); | // wxPayOrderSP.setProfit_sharing("Y"); | ||||
| @@ -176,7 +185,7 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| @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, | ||||
| String productName, EnumPayShare isShare,WxAppinfo appInfo, Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName, WxAppinfo appInfo, Date currentDate, PayExtraParam params,boolean isFreezen) throws Exception { | |||||
| //2.0版本未对接直连模式, 小商户进件成为特约商户号 | //2.0版本未对接直连模式, 小商户进件成为特约商户号 | ||||
| // if (payAccount.getMchType() == EnumPayMchType.DIRECT.getCode()) { | // if (payAccount.getMchType() == EnumPayMchType.DIRECT.getCode()) { | ||||
| @@ -193,7 +202,8 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"bUserPhone 不能为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"bUserPhone 不能为空"); | ||||
| } | } | ||||
| WxMicroPayOrderP wxPayOrderP = generateWxMicroPayOrderP(payAccount, composeOrder,productName,record, isShare, appInfo, currentDate, bAppId, bUserPhone); | |||||
| WxMicroPayOrderP wxPayOrderP = generateWxMicroPayOrderP(payAccount, composeOrder,productName,record, appInfo, currentDate, | |||||
| bAppId, bUserPhone,isFreezen); | |||||
| String response = WxPay.micropay(BeanUtils.toStringMap(wxPayOrderP)); | String response = WxPay.micropay(BeanUtils.toStringMap(wxPayOrderP)); | ||||
| log.info("pay order, wechat micropay, " + wxPayOrderP.toString() + ", response: " + response.toString()); | log.info("pay order, wechat micropay, " + wxPayOrderP.toString() + ", response: " + response.toString()); | ||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | Map<String, String> returnMap = WxPayment.xmlToMap(response); | ||||
| @@ -206,7 +216,7 @@ public class WxMiniMaPayAdapterService extends BaseWxPayV2AdapterService impleme | |||||
| if (StringUtils.isBlank(bUserPhone)) { | if (StringUtils.isBlank(bUserPhone)) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"bUserPhone 不能为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"bUserPhone 不能为空"); | ||||
| } | } | ||||
| WxMicroPayOrderSP wxPayOrderSP = generateWxMicroPayOrderSP(payAccount, composeOrder,productName,record, isShare, appInfo, currentDate, bUserPhone); | |||||
| WxMicroPayOrderSP wxPayOrderSP = generateWxMicroPayOrderSP(payAccount, composeOrder,productName,record, appInfo, currentDate, bUserPhone,isFreezen); | |||||
| String response = WxPay.micropay(BeanUtils.toStringMap(wxPayOrderSP)); | String response = WxPay.micropay(BeanUtils.toStringMap(wxPayOrderSP)); | ||||
| log.info("pay order, wechat micropay, " + wxPayOrderSP.toString() + ", response: " + response.toString()); | log.info("pay order, wechat micropay, " + wxPayOrderSP.toString() + ", response: " + response.toString()); | ||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | Map<String, String> returnMap = WxPayment.xmlToMap(response); | ||||
| @@ -71,7 +71,8 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| @Autowired | @Autowired | ||||
| MaUtil maUtil; | MaUtil maUtil; | ||||
| private V3PayCommonMiniAppReq generatePayCommonRequest(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record,String openId,WxAppinfo appInfo,Date currentDate) throws Exception { | |||||
| private V3PayCommonMiniAppReq generatePayCommonRequest(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, | |||||
| WxPayOrder record,String openId,WxAppinfo appInfo,Date currentDate,boolean isFreeze) throws Exception { | |||||
| V3PayCommonMiniAppReq req = new V3PayCommonMiniAppReq(); | V3PayCommonMiniAppReq req = new V3PayCommonMiniAppReq(); | ||||
| req.setSp_appid(String.valueOf(appInfo.getParentAppId())); | req.setSp_appid(String.valueOf(appInfo.getParentAppId())); | ||||
| req.setSp_mchid(payAccount.getMchId()); | req.setSp_mchid(payAccount.getMchId()); | ||||
| @@ -96,7 +97,7 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| req.setNotify_url(payAccount.getPayNotifyV3Url()); | req.setNotify_url(payAccount.getPayNotifyV3Url()); | ||||
| V3PaySettleReq settle = new V3PaySettleReq(); | V3PaySettleReq settle = new V3PaySettleReq(); | ||||
| settle.setProfit_sharing(true); | |||||
| settle.setProfit_sharing(isFreeze); | |||||
| req.setSettle_info(settle); | req.setSettle_info(settle); | ||||
| V3PayAmountReq amout = new V3PayAmountReq(); | V3PayAmountReq amout = new V3PayAmountReq(); | ||||
| @@ -184,7 +185,7 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| @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, | ||||
| String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | |||||
| String productName,WxAppinfo appInfo,Date currentDate, PayExtraParam params,boolean isFreeze) throws Exception { | |||||
| if (null == params ) { | if (null == params ) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | ||||
| } | } | ||||
| @@ -207,7 +208,7 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| * https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_5_1.shtml | * https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_5_1.shtml | ||||
| */ | */ | ||||
| if (childOrders.size() == 1) { | if (childOrders.size() == 1) { | ||||
| V3PayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate); | |||||
| V3PayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate,isFreeze); | |||||
| try { | try { | ||||
| String response = WxPayV3.payCommonWithMiniApp(payService, payReq); | String response = WxPayV3.payCommonWithMiniApp(payService, payReq); | ||||
| return getOrderPResult(response,record,payAccount,appInfo,payService); | return getOrderPResult(response,record,payAccount,appInfo,payService); | ||||