|
|
@@ -13,9 +13,11 @@ import com.github.binarywang.wxpay.constant.WxPayConstants;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
+import com.huifu.adapay.model.AdapayCommon;
|
|
|
import com.huifu.adapay.model.Payment;
|
|
|
import com.izouma.nineth.config.AdapayProperties;
|
|
|
import com.izouma.nineth.config.AlipayProperties;
|
|
|
+import com.izouma.nineth.config.GeneralProperties;
|
|
|
import com.izouma.nineth.config.WxPayProperties;
|
|
|
import com.izouma.nineth.domain.Collection;
|
|
|
import com.izouma.nineth.domain.*;
|
|
|
@@ -32,7 +34,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.codec.EncoderException;
|
|
|
import org.apache.commons.codec.net.URLCodec;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
@@ -72,6 +73,7 @@ public class OrderService {
|
|
|
private RedisTemplate<String, Object> redisTemplate;
|
|
|
private CommissionRecordRepo commissionRecordRepo;
|
|
|
private AdapayProperties adapayProperties;
|
|
|
+ private GeneralProperties generalProperties;
|
|
|
|
|
|
public Page<Order> all(PageQuery pageQuery) {
|
|
|
return orderRepo.findAll(JpaUtils.toSpecification(pageQuery, Order.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -302,9 +304,9 @@ public class OrderService {
|
|
|
}
|
|
|
|
|
|
if (wxChannels.contains(payChannel)) {
|
|
|
- if (StringUtils.isBlank(openId)) {
|
|
|
- throw new BusinessException("缺少openId");
|
|
|
- }
|
|
|
+// if (StringUtils.isBlank(openId)) {
|
|
|
+// throw new BusinessException("缺少openId");
|
|
|
+// }
|
|
|
Map<String, Object> expend = new HashMap<>();
|
|
|
expend.put("open_id", openId);
|
|
|
expend.put("limit_pay", "1");
|
|
|
@@ -314,8 +316,15 @@ public class OrderService {
|
|
|
paymentParams.put("expend", expend);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> response = Payment.create(paymentParams);
|
|
|
- AdapayService.checkSuccess(response);
|
|
|
+ Map<String, Object> response;
|
|
|
+ if (wxChannels.contains(payChannel)) {
|
|
|
+ paymentParams.put("adapay_func_code", "wxpay.createOrder");
|
|
|
+ paymentParams.put("callback_url", generalProperties.getHost() + "/9th/orders");
|
|
|
+ response = AdapayCommon.requestAdapayUits(paymentParams);
|
|
|
+ } else {
|
|
|
+ response = Payment.create(paymentParams);
|
|
|
+ AdapayService.checkSuccess(response);
|
|
|
+ }
|
|
|
|
|
|
switch (payChannel) {
|
|
|
case "alipay_wap":
|
|
|
@@ -323,8 +332,9 @@ public class OrderService {
|
|
|
return MapUtils.getString(MapUtils.getMap(response, "expend"), "pay_info");
|
|
|
case "alipay_qr":
|
|
|
return MapUtils.getString(MapUtils.getMap(response, "expend"), "qrcode_url");
|
|
|
+ default:
|
|
|
+ return MapUtils.getMap(response, "expend");
|
|
|
}
|
|
|
- return response;
|
|
|
}
|
|
|
|
|
|
public static BigDecimal divMoney(BigDecimal totalAmount, BigDecimal restAmount, List<Map<String, Object>> divMembers,
|