...
|
...
|
@@ -31,20 +31,14 @@ import com.yohoufo.order.model.request.PaymentRequest; |
|
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
|
|
import com.yohoufo.order.model.response.PaymentConfirmRsp;
|
|
|
import com.yohoufo.order.model.response.PrepayResponse;
|
|
|
import com.yohoufo.order.service.*;
|
|
|
import com.yohoufo.order.mq.TopicConstants;
|
|
|
import com.yohoufo.order.mq.producer.TradeMqSender;
|
|
|
import com.yohoufo.order.service.AbstractOrderPaymentService;
|
|
|
import com.yohoufo.order.service.BuyerOrderPaymentService;
|
|
|
import com.yohoufo.order.service.IPaymentService;
|
|
|
import com.yohoufo.order.service.MerchantOrderPaymentService;
|
|
|
import com.yohoufo.order.service.SellerOrderPaymentService;
|
|
|
import com.yohoufo.order.service.*;
|
|
|
import com.yohoufo.order.service.handler.BuyerOrderPayDiffTimeHandler;
|
|
|
import com.yohoufo.order.service.handler.transfer.AlipayTransferChancelSelector;
|
|
|
import com.yohoufo.order.service.pay.AbstractPayService;
|
|
|
import com.yohoufo.order.service.pay.alipay.AlipayOuyinService;
|
|
|
import com.yohoufo.order.service.pay.unionpay.JsUnionpayService;
|
|
|
import com.yohoufo.order.service.pay.unionpay.UnionpayServiceAbstract;
|
|
|
import com.yohoufo.order.service.pay.wallet.WalletPayService;
|
|
|
import com.yohoufo.order.service.pay.weixin.WeixinMiniappPayService;
|
|
|
import com.yohoufo.order.service.pay.weixin.WeixinPayUFORealAppService;
|
...
|
...
|
@@ -53,7 +47,6 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; |
|
|
import com.yohoufo.order.service.transfer.TransferResult;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import com.yohoufo.order.utils.PaymentHelper;
|
|
|
import lombok.val;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -168,6 +161,9 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
@Autowired
|
|
|
private TradeMqSender tradeMqSender;
|
|
|
|
|
|
@Autowired
|
|
|
private ShoppingRiskWatchDog shoppingRiskWatchDog;
|
|
|
|
|
|
/**
|
|
|
* 获取主场的订单service
|
|
|
*
|
...
|
...
|
@@ -692,7 +688,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
|
|
|
@Database(ForceMaster = true)
|
|
|
public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount, AuthorizeResultRespVO aliPayAccount) {
|
|
|
public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount,
|
|
|
AuthorizeResultRespVO aliPayAccount) {
|
|
|
logger.info("退还商家所有保证金,转账开始,orderCode = {}, uid={}, amount={}, alipayAccount={}", orderCode, uid, amount, aliPayAccount);
|
|
|
|
|
|
int now = (int) (System.currentTimeMillis() / 1000);
|
...
|
...
|
@@ -743,7 +740,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
transfer.setUpdateTime(now);
|
|
|
try {
|
|
|
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
|
|
|
|
|
|
shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount.getAlipayId());
|
|
|
if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) {
|
|
|
transfer.setInterfaceType(2);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
...
|
...
|
@@ -1120,12 +1117,14 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
addTradeBills(tradeBills);
|
|
|
}
|
|
|
|
|
|
|
|
|
private void transferWithAlipayTransferAndAddSuccessTradeBills(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) {
|
|
|
TransferResult transferResult = alipayService.newAlipayTransfer()
|
|
|
TransferResult transferResult = alipayService.newAlipayTransfer(account.getUid())
|
|
|
.transferOrderCode(Long.toString(orderCode))
|
|
|
.alipayUid(account.getAlipayId())
|
|
|
.alipayAccount(account.getAlipayAccount())
|
|
|
.transferAmount(amount)
|
|
|
.riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid) )
|
|
|
.transfer();
|
|
|
if (transferResult.getCode() == 200) {
|
|
|
logger.info("{}, transfer success and out trade no is {}", logTag, orderCode);
|
...
|
...
|
@@ -1146,11 +1145,13 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
|
|
|
private void transferWithAlipayTransfer(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) {
|
|
|
TransferResult transferResult = alipayService.newAlipayTransfer()
|
|
|
|
|
|
TransferResult transferResult = alipayService.newAlipayTransfer(account.getUid())
|
|
|
.transferOrderCode(Long.toString(orderCode))
|
|
|
.alipayUid(account.getAlipayId())
|
|
|
.alipayAccount(account.getAlipayAccount())
|
|
|
.transferAmount(amount)
|
|
|
.riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid))
|
|
|
.transfer();
|
|
|
if (transferResult.getCode() == 200) {
|
|
|
logger.info("{}, transfer success and out trade no is {}", logTag, orderCode);
|
...
|
...
|
@@ -1171,15 +1172,21 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private void transferWithAlipayExceedMillionTransfer(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) {
|
|
|
private void transferWithAlipayExceedMillionTransfer(String logTag,
|
|
|
TradeBills tradeBills,
|
|
|
long orderCode,
|
|
|
AuthorizeResultRespVO account,
|
|
|
BigDecimal amount,
|
|
|
OrdersPayTransfer transfer) {
|
|
|
String businessId = transfer.getId() + "_" + tradeBills.getId();
|
|
|
TransferResult transferResult = alipayService.newAlipayExceedMillionTransfer()
|
|
|
TransferResult transferResult = alipayService.newAlipayExceedMillionTransfer(account.getUid())
|
|
|
.transferOrderCode(Long.toString(orderCode))
|
|
|
.alipayUid(account.getAlipayId())
|
|
|
.alipayAccount(account.getAlipayAccount())
|
|
|
.transferAmount(amount)
|
|
|
.businessId(businessId)
|
|
|
.userName(account.getCertName())
|
|
|
.riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid))
|
|
|
.transfer();
|
|
|
// success to wait
|
|
|
if (transferResult.getCode() == 200) {
|
...
|
...
|
@@ -1196,8 +1203,12 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
|
|
|
|
|
|
private Map<String, String> transferWhenExceedMillion(Integer transferId, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account,
|
|
|
private Map<String, String> transferWhenExceedMillion(Integer transferId,
|
|
|
TradeBills tradeBills,
|
|
|
long orderCode,
|
|
|
AuthorizeResultRespVO account,
|
|
|
BigDecimal amount, int now) throws Exception {
|
|
|
|
|
|
Map<String, String> mapResult = alipayService.transferMoneyWhenExceedMillion(
|
|
|
Long.toString(orderCode),
|
|
|
transferId + "_" + tradeBills.getId(),
|
...
|
...
|
|