Commit 0f9a084d3fcd3dbc44680b9b79798144027e9fc3
1 parent
65ad34a1
refund result url issue fixed
Showing
2 changed files
with
16 additions
and
24 deletions
cashier-trade/src/main/java/com/diligrp/cashier/trade/manager/PaymentResultManager.java
| ... | ... | @@ -90,22 +90,20 @@ public class PaymentResultManager { |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | - }); | |
| 94 | - | |
| 95 | - if (ObjectUtils.isNotEmpty(uri)) { | |
| 96 | - return; | |
| 97 | - } | |
| 98 | 93 | |
| 99 | - ThreadPoolService.getIoThreadPoll().submit(() -> { | |
| 100 | - try { | |
| 101 | - String payload = JsonUtils.toJsonString(refundResult); | |
| 102 | - LOG.info("Notifying online trade refund result: {}", payload); | |
| 103 | - ServiceEndpointSupport.HttpResult httpResult = new NotifyHttpClient(uri).send(payload); | |
| 104 | - if (httpResult.statusCode != 200) { | |
| 105 | - LOG.error("Failed to notify trade refund result"); | |
| 106 | - } | |
| 107 | - } catch (Exception ex) { | |
| 108 | - LOG.error("Failed to notify trade refund result", ex); | |
| 94 | + if (ObjectUtils.isNotEmpty(uri)) { | |
| 95 | + ThreadPoolService.getIoThreadPoll().submit(() -> { | |
| 96 | + try { | |
| 97 | + String payload = JsonUtils.toJsonString(refundResult); | |
| 98 | + LOG.info("Notifying online trade refund result: {}", payload); | |
| 99 | + ServiceEndpointSupport.HttpResult httpResult = new NotifyHttpClient(uri).send(payload); | |
| 100 | + if (httpResult.statusCode != 200) { | |
| 101 | + LOG.error("Failed to notify trade refund result"); | |
| 102 | + } | |
| 103 | + } catch (Exception ex) { | |
| 104 | + LOG.error("Failed to notify trade refund result", ex); | |
| 105 | + } | |
| 106 | + }); | |
| 109 | 107 | } |
| 110 | 108 | }); |
| 111 | 109 | } | ... | ... |
cashier-trade/src/main/java/com/diligrp/cashier/trade/service/impl/CashierPaymentServiceImpl.java
| ... | ... | @@ -138,19 +138,13 @@ public class CashierPaymentServiceImpl implements ICashierPaymentService { |
| 138 | 138 | if (pipeline instanceof OnlinePipeline<?> onlinePipeline) { // 在线支付通道 |
| 139 | 139 | // 在线支付通道: 不同的收银台类型使用不同的支付方式(目前只支持小程序收银台) |
| 140 | 140 | // 小程序收银台将使用在线支付通道的小程序支付 |
| 141 | -// MiniProPrepayRequest request = new MiniProPaymentConverter(trade, paymentId, now).convert(cashierPayment); | |
| 142 | -// MiniProPrepayResponse response = onlinePipeline.sendMiniProPrepayRequest(request); | |
| 143 | - long seconds = DateUtils.secondsDiff(trade.getCreatedTime(), now); | |
| 144 | - long timeout = Math.max(trade.getTimeout() - seconds, com.diligrp.cashier.pipeline.Constants.MIN_PIPELINE_TIMEOUT); | |
| 145 | - NativePrepayRequest request = new NativePrepayRequest(paymentId, trade.getMaxAmount(), trade.getGoods(), | |
| 146 | - trade.getDescription(), now, timeout); | |
| 147 | - NativePrepayResponse response = onlinePipeline.sendNativePrepayRequest(request); | |
| 148 | - | |
| 141 | + MiniProPrepayRequest request = new MiniProPaymentConverter(trade, paymentId, now).convert(cashierPayment); | |
| 142 | + MiniProPrepayResponse response = onlinePipeline.sendMiniProPrepayRequest(request); | |
| 149 | 143 | String outMchId = request.getString(com.diligrp.cashier.pipeline.Constants.PARAM_MCH_ID); |
| 150 | 144 | OnlinePayment payment = OnlinePayment.builder().outMchId(outMchId).tradeId(trade.getTradeId()) |
| 151 | 145 | .type(TradeType.TRADE).paymentId(paymentId).channelId(onlinePipeline.supportedChannel()) |
| 152 | 146 | .payType(PaymentType.MINI_PRO).pipelineId(onlinePipeline.pipelineId()).goods(trade.getGoods()) |
| 153 | - .amount(trade.getAmount()).payerId(null).outTradeNo(response.getOutTradeNo()) | |
| 147 | + .amount(trade.getAmount()).payerId(request.getOpenId()).outTradeNo(response.getOutTradeNo()) | |
| 154 | 148 | .outPayType(OutPaymentType.NOP).finishTime(null).state(response.getState()) |
| 155 | 149 | .notifyUrl(trade.getNotifyUrl()).description(null).version(0).createdTime(now).modifiedTime(now).build(); |
| 156 | 150 | onlinePaymentDao.insertOnlinePayment(payment); | ... | ... |