Commit cbaeeb87967f4063624f88e380595519a6aebff3
1 parent
f67985dc
token timeout conf
Showing
12 changed files
with
90 additions
and
31 deletions
cashier-boss/src/main/java/com/diligrp/cashier/boss/CashierDeskProperties.java
| ... | ... | @@ -7,6 +7,8 @@ import javax.crypto.spec.SecretKeySpec; |
| 7 | 7 | public class CashierDeskProperties { |
| 8 | 8 | // 密钥 |
| 9 | 9 | private SecretKeySpec secretKey; |
| 10 | + // TOKEN过期时间 | |
| 11 | + private Long tokenTimeout; | |
| 10 | 12 | // 收银台配置 |
| 11 | 13 | private MerchantParams.CashierParams cashier; |
| 12 | 14 | |
| ... | ... | @@ -18,6 +20,14 @@ public class CashierDeskProperties { |
| 18 | 20 | this.secretKey = secretKey; |
| 19 | 21 | } |
| 20 | 22 | |
| 23 | + public Long getTokenTimeout() { | |
| 24 | + return tokenTimeout; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setTokenTimeout(Long tokenTimeout) { | |
| 28 | + this.tokenTimeout = tokenTimeout; | |
| 29 | + } | |
| 30 | + | |
| 21 | 31 | public MerchantParams.CashierParams getCashier() { |
| 22 | 32 | return cashier; |
| 23 | 33 | } | ... | ... |
cashier-boss/src/main/java/com/diligrp/cashier/boss/Constants.java
| ... | ... | @@ -13,9 +13,5 @@ public final class Constants { |
| 13 | 13 | public static final String TOKEN_SIGN_ALGORITHM = "HmacSHA256"; |
| 14 | 14 | // TOKEN的签名长度 |
| 15 | 15 | public static final int TOKEN_SIGN_LENGTH = 8; |
| 16 | - // TOKEN过期时长,单位秒 - 5分钟 | |
| 17 | - public static final long TOKEN_TIMEOUT_SECONDS = 10 * 60; | |
| 18 | - | |
| 19 | - public final static String CONTENT_TYPE = "application/json;charset=UTF-8"; | |
| 20 | 16 | |
| 21 | 17 | } | ... | ... |
cashier-boss/src/main/java/com/diligrp/cashier/boss/controller/RcbPaymentController.java
| 1 | 1 | package com.diligrp.cashier.boss.controller; |
| 2 | 2 | |
| 3 | 3 | import com.diligrp.cashier.boss.exception.BossServiceException; |
| 4 | +import com.diligrp.cashier.boss.service.ICashierDeskService; | |
| 4 | 5 | import com.diligrp.cashier.pipeline.core.RcbOnlinePipeline; |
| 5 | 6 | import com.diligrp.cashier.pipeline.domain.OnlinePaymentResponse; |
| 6 | 7 | import com.diligrp.cashier.pipeline.service.IPaymentPipelineManager; |
| ... | ... | @@ -12,7 +13,6 @@ import com.diligrp.cashier.shared.ErrorCode; |
| 12 | 13 | import com.diligrp.cashier.shared.util.JsonUtils; |
| 13 | 14 | import com.diligrp.cashier.shared.util.ObjectUtils; |
| 14 | 15 | import com.diligrp.cashier.trade.model.OnlinePayment; |
| 15 | -import com.diligrp.cashier.trade.service.ICashierPaymentService; | |
| 16 | 16 | import com.diligrp.cashier.trade.service.ITradeAssistantService; |
| 17 | 17 | import com.fasterxml.jackson.core.type.TypeReference; |
| 18 | 18 | import jakarta.annotation.Resource; |
| ... | ... | @@ -40,7 +40,7 @@ public class RcbPaymentController { |
| 40 | 40 | private ITradeAssistantService tradeAssistantService; |
| 41 | 41 | |
| 42 | 42 | @Resource |
| 43 | - private ICashierPaymentService cashierPaymentService; | |
| 43 | + private ICashierDeskService cashierDeskService; | |
| 44 | 44 | |
| 45 | 45 | @Resource |
| 46 | 46 | private IPaymentPipelineManager paymentPipelineManager; |
| ... | ... | @@ -84,7 +84,7 @@ public class RcbPaymentController { |
| 84 | 84 | |
| 85 | 85 | OnlinePaymentResponse paymentResponse = new OnlinePaymentResponse(paymentId, outTradeNo, outPayType, |
| 86 | 86 | payerId, when, paymentState, errorDesc); |
| 87 | - cashierPaymentService.notifyPaymentResponse(paymentResponse); | |
| 87 | + cashierDeskService.notifyPaymentResponse(payment, paymentResponse); | |
| 88 | 88 | return ResponseEntity.ok("SUCCESS"); |
| 89 | 89 | } catch (Exception ex) { |
| 90 | 90 | LOG.error("Process rcb payment result exception", ex); | ... | ... |
cashier-boss/src/main/java/com/diligrp/cashier/boss/controller/WechatPaymentController.java
| 1 | 1 | package com.diligrp.cashier.boss.controller; |
| 2 | 2 | |
| 3 | 3 | import com.diligrp.cashier.boss.exception.BossServiceException; |
| 4 | +import com.diligrp.cashier.boss.service.ICashierDeskService; | |
| 4 | 5 | import com.diligrp.cashier.pipeline.core.WechatPartnerPipeline; |
| 5 | 6 | import com.diligrp.cashier.pipeline.core.WechatPipeline; |
| 6 | 7 | import com.diligrp.cashier.pipeline.domain.OnlinePaymentResponse; |
| ... | ... | @@ -19,7 +20,6 @@ import com.diligrp.cashier.shared.util.DateUtils; |
| 19 | 20 | import com.diligrp.cashier.shared.util.HttpUtils; |
| 20 | 21 | import com.diligrp.cashier.shared.util.JsonUtils; |
| 21 | 22 | import com.diligrp.cashier.trade.model.OnlinePayment; |
| 22 | -import com.diligrp.cashier.trade.service.ICashierPaymentService; | |
| 23 | 23 | import com.diligrp.cashier.trade.service.ITradeAssistantService; |
| 24 | 24 | import jakarta.annotation.Resource; |
| 25 | 25 | import jakarta.servlet.http.HttpServletRequest; |
| ... | ... | @@ -47,7 +47,7 @@ public class WechatPaymentController { |
| 47 | 47 | private ITradeAssistantService tradeAssistantService; |
| 48 | 48 | |
| 49 | 49 | @Resource |
| 50 | - private ICashierPaymentService cashierPaymentService; | |
| 50 | + private ICashierDeskService cashierDeskService; | |
| 51 | 51 | |
| 52 | 52 | @Resource |
| 53 | 53 | private IPaymentPipelineManager paymentPipelineManager; |
| ... | ... | @@ -87,7 +87,7 @@ public class WechatPaymentController { |
| 87 | 87 | WechatNotifyResponse response = JsonUtils.fromJsonString(payload, WechatNotifyResponse.class); |
| 88 | 88 | OnlinePaymentResponse paymentResponse = paymentResponse(pipeline, response); |
| 89 | 89 | if (WechatConstants.NOTIFY_EVENT_TYPE.equals(response.getEvent_type())) { |
| 90 | - cashierPaymentService.notifyPaymentResponse(paymentResponse); | |
| 90 | + cashierDeskService.notifyPaymentResponse(payment, paymentResponse); | |
| 91 | 91 | } |
| 92 | 92 | return ResponseEntity.ok(NotifyResult.success()); |
| 93 | 93 | } else { |
| ... | ... | @@ -114,7 +114,7 @@ public class WechatPaymentController { |
| 114 | 114 | WechatNotifyResponse notifyResponse = JsonUtils.fromJsonString(payload, WechatNotifyResponse.class); |
| 115 | 115 | if (WechatConstants.REFUND_EVENT_TYPE.equals(notifyResponse.getEvent_type())) { |
| 116 | 116 | OnlineRefundResponse refundResponse = refundResponse(pipeline, notifyResponse); |
| 117 | - cashierPaymentService.notifyRefundResult(refundResponse); | |
| 117 | + cashierDeskService.notifyRefundResult(refund, refundResponse); | |
| 118 | 118 | } |
| 119 | 119 | return ResponseEntity.ok(NotifyResult.success()); |
| 120 | 120 | } else { | ... | ... |
cashier-boss/src/main/java/com/diligrp/cashier/boss/service/ICashierDeskService.java
| ... | ... | @@ -2,8 +2,11 @@ package com.diligrp.cashier.boss.service; |
| 2 | 2 | |
| 3 | 3 | import com.diligrp.cashier.boss.domain.CashierOrderVO; |
| 4 | 4 | import com.diligrp.cashier.boss.domain.CashierPaymentUrl; |
| 5 | +import com.diligrp.cashier.pipeline.domain.OnlinePaymentResponse; | |
| 5 | 6 | import com.diligrp.cashier.pipeline.domain.OnlinePaymentStatus; |
| 7 | +import com.diligrp.cashier.pipeline.domain.OnlineRefundResponse; | |
| 6 | 8 | import com.diligrp.cashier.trade.domain.*; |
| 9 | +import com.diligrp.cashier.trade.model.OnlinePayment; | |
| 7 | 10 | |
| 8 | 11 | public interface ICashierDeskService { |
| 9 | 12 | /** |
| ... | ... | @@ -29,6 +32,14 @@ public interface ICashierDeskService { |
| 29 | 32 | OnlinePaymentStatus doPayment(CashierPayment payment); |
| 30 | 33 | |
| 31 | 34 | /** |
| 35 | + * 支付结果通知 | |
| 36 | + * | |
| 37 | + * @param payment - 支付订单 | |
| 38 | + * @param response - 支付结果 | |
| 39 | + */ | |
| 40 | + void notifyPaymentResponse(OnlinePayment payment, OnlinePaymentResponse response); | |
| 41 | + | |
| 42 | + /** | |
| 32 | 43 | * 关闭交易订单 |
| 33 | 44 | */ |
| 34 | 45 | void closeTradeOrder(String tradeId); |
| ... | ... | @@ -44,6 +55,14 @@ public interface ICashierDeskService { |
| 44 | 55 | OnlineRefundResult sendRefundRequest(OnlineRefundDTO request); |
| 45 | 56 | |
| 46 | 57 | /** |
| 58 | + * 退款结果通知 | |
| 59 | + * | |
| 60 | + * @param refund - 退款订单 | |
| 61 | + * @param response - 退款结果 | |
| 62 | + */ | |
| 63 | + void notifyRefundResult(OnlinePayment refund, OnlineRefundResponse response); | |
| 64 | + | |
| 65 | + /** | |
| 47 | 66 | * 查询退款状态 |
| 48 | 67 | */ |
| 49 | 68 | OnlineRefundResult queryRefundState(String refundId, String mode); | ... | ... |
cashier-boss/src/main/java/com/diligrp/cashier/boss/service/impl/CashierDeskServiceImpl.java
| ... | ... | @@ -9,12 +9,15 @@ import com.diligrp.cashier.boss.exception.BossServiceException; |
| 9 | 9 | import com.diligrp.cashier.boss.service.ICashierDeskService; |
| 10 | 10 | import com.diligrp.cashier.boss.service.IMerchantService; |
| 11 | 11 | import com.diligrp.cashier.pipeline.core.PaymentPipeline; |
| 12 | +import com.diligrp.cashier.pipeline.domain.OnlinePaymentResponse; | |
| 12 | 13 | import com.diligrp.cashier.pipeline.domain.OnlinePaymentStatus; |
| 14 | +import com.diligrp.cashier.pipeline.domain.OnlineRefundResponse; | |
| 13 | 15 | import com.diligrp.cashier.pipeline.service.IPaymentPipelineManager; |
| 14 | 16 | import com.diligrp.cashier.pipeline.type.PaymentState; |
| 15 | 17 | import com.diligrp.cashier.shared.ErrorCode; |
| 16 | 18 | import com.diligrp.cashier.shared.util.ObjectUtils; |
| 17 | 19 | import com.diligrp.cashier.trade.domain.*; |
| 20 | +import com.diligrp.cashier.trade.model.OnlinePayment; | |
| 18 | 21 | import com.diligrp.cashier.trade.model.TradeOrder; |
| 19 | 22 | import com.diligrp.cashier.trade.service.ICashierPaymentService; |
| 20 | 23 | import com.diligrp.cashier.trade.service.ITradeAssistantService; |
| ... | ... | @@ -61,9 +64,9 @@ public class CashierDeskServiceImpl implements ICashierDeskService { |
| 61 | 64 | CashierOrderToken orderToken = new CashierOrderToken(merchant.getMchId(), tradeId, order.getType().getCode(), |
| 62 | 65 | order.getUserId(), order.getRedirectUrl()); |
| 63 | 66 | |
| 64 | - String tokenKey = String.format(Constants.TRADE_REDIS_KEY, tradeId); | |
| 65 | - stringRedisTemplate.opsForValue().set(tokenKey, orderToken.toString(), Constants.TOKEN_TIMEOUT_SECONDS, TimeUnit.SECONDS); | |
| 66 | 67 | MerchantParams params = merchant.getParams(); |
| 68 | + String tokenKey = String.format(Constants.TRADE_REDIS_KEY, tradeId); | |
| 69 | + stringRedisTemplate.opsForValue().set(tokenKey, orderToken.toString(), params.getTokenTimeout(), TimeUnit.SECONDS); | |
| 67 | 70 | String paymentUrl = switch (order.getType()) { |
| 68 | 71 | case MINIPRO -> String.format("%s?%s=%s", params.getCashier().getMiniProUrl(), Constants.TOKEN_PARAM_NAME, token); |
| 69 | 72 | case H5 -> String.format("%s?%s=%s", params.getCashier().getH5Url(), Constants.TOKEN_PARAM_NAME, token); |
| ... | ... | @@ -104,7 +107,7 @@ public class CashierDeskServiceImpl implements ICashierDeskService { |
| 104 | 107 | @Override |
| 105 | 108 | public OnlinePaymentStatus doPayment(CashierPayment payment) { |
| 106 | 109 | OnlinePaymentStatus paymentStatus = cashierPaymentService.doPayment(payment); |
| 107 | - // 收银台支付成功,都使token失效,收银台页面将无法重新打开 | |
| 110 | + // 收银台支付成功,使token失效,收银台页面将无法重新打开 | |
| 108 | 111 | if (paymentStatus.getState() == PaymentState.SUCCESS) { |
| 109 | 112 | String tokenKey = String.format(Constants.TRADE_REDIS_KEY, payment.getTradeId()); |
| 110 | 113 | stringRedisTemplate.delete(tokenKey); |
| ... | ... | @@ -113,8 +116,21 @@ public class CashierDeskServiceImpl implements ICashierDeskService { |
| 113 | 116 | } |
| 114 | 117 | |
| 115 | 118 | @Override |
| 119 | + public void notifyPaymentResponse(OnlinePayment payment, OnlinePaymentResponse response) { | |
| 120 | + cashierPaymentService.notifyPaymentResponse(payment, response); | |
| 121 | + if (PaymentState.SUCCESS == response.getState()) { | |
| 122 | + // 收银台支付成功,使token失效,收银台页面将无法重新打开 | |
| 123 | + String tokenKey = String.format(Constants.TRADE_REDIS_KEY, payment.getTradeId()); | |
| 124 | + stringRedisTemplate.delete(tokenKey); | |
| 125 | + } | |
| 126 | + } | |
| 127 | + | |
| 128 | + @Override | |
| 116 | 129 | public void closeTradeOrder(String tradeId) { |
| 117 | 130 | cashierPaymentService.closeTradeOrder(tradeId); |
| 131 | + // 使token失效,收银台页面将无法重新打开 | |
| 132 | + String tokenKey = String.format(Constants.TRADE_REDIS_KEY, tradeId); | |
| 133 | + stringRedisTemplate.delete(tokenKey); | |
| 118 | 134 | } |
| 119 | 135 | |
| 120 | 136 | @Override |
| ... | ... | @@ -128,6 +144,11 @@ public class CashierDeskServiceImpl implements ICashierDeskService { |
| 128 | 144 | } |
| 129 | 145 | |
| 130 | 146 | @Override |
| 147 | + public void notifyRefundResult(OnlinePayment refund, OnlineRefundResponse response) { | |
| 148 | + cashierPaymentService.notifyRefundResult(refund, response); | |
| 149 | + } | |
| 150 | + | |
| 151 | + @Override | |
| 131 | 152 | public OnlineRefundResult queryRefundState(String refundId, String mode) { |
| 132 | 153 | return cashierPaymentService.queryRefundState(refundId, mode); |
| 133 | 154 | } | ... | ... |
cashier-boss/src/main/java/com/diligrp/cashier/boss/util/MerchantConverter.java
| ... | ... | @@ -29,6 +29,9 @@ public class MerchantConverter implements IConverter<MerchantDO, Merchant> { |
| 29 | 29 | } |
| 30 | 30 | MerchantParams params = merchant.getParams(); |
| 31 | 31 | |
| 32 | + if (Objects.isNull(params.getTokenTimeout())) { | |
| 33 | + params.setTokenTimeout(cashierProperties.getTokenTimeout()); | |
| 34 | + } | |
| 32 | 35 | if (Objects.isNull(params.getCashier())) { |
| 33 | 36 | params.setCashier(new MerchantParams.CashierParams()); |
| 34 | 37 | } | ... | ... |
cashier-trade/src/main/java/com/diligrp/cashier/trade/domain/MerchantParams.java
| ... | ... | @@ -5,6 +5,8 @@ import com.diligrp.cashier.shared.util.JsonUtils; |
| 5 | 5 | import java.util.Objects; |
| 6 | 6 | |
| 7 | 7 | public class MerchantParams { |
| 8 | + // TOKEN过期时间 - 单位秒 | |
| 9 | + private Long tokenTimeout; | |
| 8 | 10 | // 收银台配置 |
| 9 | 11 | private CashierParams cashier; |
| 10 | 12 | |
| ... | ... | @@ -12,6 +14,14 @@ public class MerchantParams { |
| 12 | 14 | return JsonUtils.fromJsonString(params, MerchantParams.class); |
| 13 | 15 | } |
| 14 | 16 | |
| 17 | + public Long getTokenTimeout() { | |
| 18 | + return tokenTimeout; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setTokenTimeout(Long tokenTimeout) { | |
| 22 | + this.tokenTimeout = tokenTimeout; | |
| 23 | + } | |
| 24 | + | |
| 15 | 25 | public CashierParams getCashier() { |
| 16 | 26 | return cashier; |
| 17 | 27 | } | ... | ... |
cashier-trade/src/main/java/com/diligrp/cashier/trade/service/ICashierPaymentService.java
| ... | ... | @@ -4,6 +4,7 @@ import com.diligrp.cashier.pipeline.domain.OnlinePaymentResponse; |
| 4 | 4 | import com.diligrp.cashier.pipeline.domain.OnlinePaymentStatus; |
| 5 | 5 | import com.diligrp.cashier.pipeline.domain.OnlineRefundResponse; |
| 6 | 6 | import com.diligrp.cashier.trade.domain.*; |
| 7 | +import com.diligrp.cashier.trade.model.OnlinePayment; | |
| 7 | 8 | |
| 8 | 9 | public interface ICashierPaymentService { |
| 9 | 10 | /** |
| ... | ... | @@ -26,9 +27,10 @@ public interface ICashierPaymentService { |
| 26 | 27 | /** |
| 27 | 28 | * 支付结果通知 |
| 28 | 29 | * |
| 30 | + * @param payment - 支付订单 | |
| 29 | 31 | * @param response - 支付结果 |
| 30 | 32 | */ |
| 31 | - void notifyPaymentResponse(OnlinePaymentResponse response); | |
| 33 | + void notifyPaymentResponse(OnlinePayment payment, OnlinePaymentResponse response); | |
| 32 | 34 | |
| 33 | 35 | /** |
| 34 | 36 | * 关闭交易订单 |
| ... | ... | @@ -48,9 +50,10 @@ public interface ICashierPaymentService { |
| 48 | 50 | /** |
| 49 | 51 | * 退款结果通知 |
| 50 | 52 | * |
| 53 | + * @param refund - 退款订单 | |
| 51 | 54 | * @param response - 退款结果 |
| 52 | 55 | */ |
| 53 | - void notifyRefundResult(OnlineRefundResponse response); | |
| 56 | + void notifyRefundResult(OnlinePayment refund, OnlineRefundResponse response); | |
| 54 | 57 | |
| 55 | 58 | /** |
| 56 | 59 | * 查询退款状态 | ... | ... |
cashier-trade/src/main/java/com/diligrp/cashier/trade/service/impl/CashierAssistantServiceImpl.java
| ... | ... | @@ -81,7 +81,7 @@ public class CashierAssistantServiceImpl implements ICashierAssistantService { |
| 81 | 81 | LOG.error("scanCashierTradeOrder: close online prepare order exception", ex); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | - cashierPaymentService.notifyPaymentResponse(response); | |
| 84 | + cashierPaymentService.notifyPaymentResponse(payment, response); | |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | // 交易订单仍然未完成则关闭交易订单,交易订单不能继续支付 |
| ... | ... | @@ -112,7 +112,7 @@ public class CashierAssistantServiceImpl implements ICashierAssistantService { |
| 112 | 112 | OnlinePipeline<?> pipeline = paymentPipelineManager.findPipelineById(refund.getPipelineId(), OnlinePipeline.class); |
| 113 | 113 | OnlineRefundOrder order = new OnlineRefundOrder(refundId, refund.getOutTradeNo()); |
| 114 | 114 | OnlineRefundResponse response = pipeline.queryRefundResponse(order); |
| 115 | - cashierPaymentService.notifyRefundResult(response); | |
| 115 | + cashierPaymentService.notifyRefundResult(refund, response); | |
| 116 | 116 | if (!PaymentState.isFinished(response.getState().getCode())) { |
| 117 | 117 | long delay = pipeline.getTimeStrategy().nextRefundScanTime(times + 1); |
| 118 | 118 | TaskMessage message = new TaskMessage(TaskMessage.TYPE_CASHIER_REFUND_SCAN, refundId, String.valueOf(times + 1)); | ... | ... |
cashier-trade/src/main/java/com/diligrp/cashier/trade/service/impl/CashierPaymentServiceImpl.java
| ... | ... | @@ -111,7 +111,6 @@ public class CashierPaymentServiceImpl implements ICashierPaymentService { |
| 111 | 111 | @Override |
| 112 | 112 | @Transactional(rollbackFor = Exception.class) |
| 113 | 113 | public OnlinePaymentStatus doPayment(CashierPayment payment) { |
| 114 | - // TODO: 接口防重复提交 | |
| 115 | 114 | String lockKey = String.format(Constants.TRADE_LOCK_REDIS_KEY, payment.getTradeId()); |
| 116 | 115 | RLock lock = redissonClient.getLock(lockKey); |
| 117 | 116 | try { |
| ... | ... | @@ -178,9 +177,9 @@ public class CashierPaymentServiceImpl implements ICashierPaymentService { |
| 178 | 177 | TradeStateDTO tradeStateDTO = TradeStateDTO.of(trade.getTradeId(), TradeState.SUCCESS, |
| 179 | 178 | trade.getVersion(), now); |
| 180 | 179 | tradeAssistantService.proceedTradeOrder(tradeStateDTO); |
| 181 | - // 通知业务系统支付结果, | |
| 182 | - OnlinePaymentResult paymentResult = new OnlinePaymentResult(trade.getTradeId(), paymentId, | |
| 183 | - response.getState().getCode(), trade.getOutTradeNo(), OutPaymentType.DILICARD.getCode(), | |
| 180 | + // 通知业务系统支付结果 | |
| 181 | + OnlinePaymentResult paymentResult = OnlinePaymentResult.of(trade.getTradeId(), paymentId, | |
| 182 | + response.getState(), trade.getOutTradeNo(), response.getOutPayType(), | |
| 184 | 183 | response.getPayerId(), response.getWhen(), response.getMessage()); |
| 185 | 184 | paymentResultManager.notifyPaymentResult(trade.getNotifyUrl(), paymentResult, 500); |
| 186 | 185 | } |
| ... | ... | @@ -209,8 +208,7 @@ public class CashierPaymentServiceImpl implements ICashierPaymentService { |
| 209 | 208 | */ |
| 210 | 209 | @Override |
| 211 | 210 | @Transactional(rollbackFor = Exception.class) |
| 212 | - public void notifyPaymentResponse(OnlinePaymentResponse response) { | |
| 213 | - OnlinePayment payment = tradeAssistantService.findByPaymentId(response.getPaymentId()); | |
| 211 | + public void notifyPaymentResponse(OnlinePayment payment, OnlinePaymentResponse response) { | |
| 214 | 212 | if (PaymentState.isFinished(payment.getState())) { |
| 215 | 213 | LOG.warn("Duplicate process cashier payment response: [{}:{}]", payment.getPaymentId(), response.getState().name()); |
| 216 | 214 | return; |
| ... | ... | @@ -379,8 +377,7 @@ public class CashierPaymentServiceImpl implements ICashierPaymentService { |
| 379 | 377 | |
| 380 | 378 | @Override |
| 381 | 379 | @Transactional(rollbackFor = Exception.class) |
| 382 | - public void notifyRefundResult(OnlineRefundResponse response) { | |
| 383 | - OnlinePayment refund = tradeAssistantService.findByRefundId(response.getRefundId()); | |
| 380 | + public void notifyRefundResult(OnlinePayment refund, OnlineRefundResponse response) { | |
| 384 | 381 | if (PaymentState.isFinished(refund.getState())) { |
| 385 | 382 | LOG.warn("Duplicate process cashier refund response: [{}:{}]", response.getRefundId(), response.getState().name()); |
| 386 | 383 | return; | ... | ... |
scripts/cashier-data.sql
| 1 | 1 | INSERT INTO dili_cashier.upay_merchant(mch_id, name, param, address, linkman, telephone, state, created_time, modified_time) |
| 2 | -VALUES (1001, '安徽省中瑞农副产品有限责任公司', '{"cashier":{"miniProUrl": "https://cashier.test.gszdtop.com/pages/merchant/mp"}}', '安徽省濉溪县南环路中瑞农产品批发市场', '赵静', '0561-6863420', 1, now(), now()); | |
| 2 | +VALUES (1001, '安徽省中瑞农副产品有限责任公司', '{"cashier":{"miniProUrl": "https://cashier.pay.gszdtop.com/pages/#/payment"}, "tokenTimeout": 600}', '安徽省濉溪县南环路中瑞农产品批发市场', '赵静', '0561-6863420', 1, now(), now()); | |
| 3 | 3 | |
| 4 | 4 | -- 中瑞微信支付服务商通道, 根据环境配置不同的参数(服务地址、回调地址等) |
| 5 | 5 | -- INSERT INTO `dili_cashier`.upay_payment_pipeline(mch_id, pipeline_id, channel_id, type, name, uri, param, state, created_time, modified_time) |
| 6 | --- VALUES (1001, 10011, 10, 10, '微信支付', 'https://api.mch.weixin.qq.com', '{"subMchId":"1679224186", "subAppId":"wxad27b69b888b6dc9", "appSecret":"9c254c0ab932b3c30292a05679a688f7", "notifyUrl": "https://cashier.test.gszdtop.com"}', 1, now(), now()); | |
| 6 | +-- VALUES (1001, 10011, 10, 10, '微信支付', 'https://api.mch.weixin.qq.com', '{"subMchId":"1679224186", "subAppId":"wxad27b69b888b6dc9", "appSecret":"9c254c0ab932b3c30292a05679a688f7", "notifyUrl": "https://cashier.pay.gszdtop.com"}', 1, now(), now()); | |
| 7 | 7 | -- INSERT INTO `dili_cashier`.upay_wechat_param(pipeline_id, mch_id, app_id, app_secret, serial_no, private_key, wechat_serial_no, wechat_public_key, api_v3_key, type, created_time) |
| 8 | 8 | -- VALUES(10011, '1679223106', 'wxca99d56a6ab15f29', '9c254c0ab932b3c30292a05679a688f7', '60C2877836D1D618D2E40186995BB00299D92F44','MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCx/XUbQ4mOr+zwuLn3e621YEgBc/dzbfGuc7mV2ojKN/wUwRRfrgfyln7xHurUeVf8jrPdJZwk/d6mqyZl28i/NS88Ud+jNOSe0bB2DwFEh5zhqbzfKYtBygkkNFzTam12ddSwCpng+59hcgaMdx47e7D6e+3C7Y422gJWMmBadP8gV25J2XP2u/zBl8PXUUsjhlWG474X6p5OGoahVTrfTFUIp6KfST8GvBa0uXjoiD3uS/d+u9VCKd6S2ohBDBEsybKGH8MHHopsF/NRuhlsUWKdR/eTcSItOs2fnE7MIGTeHZiBjA9lDi5qRsq5ryZEf85GU3uJCIlad0JbgsvjAgMBAAECggEBAINjcCDyGAcGgsen9U9lMvOi4USBUHca/78hmiuuqC9uaF0BsoJ2u1MuGQLxKbQy5up+hPOIod0EsmkiCjRCq8vJ/NZwMcAOeX1rmPFtXigyW3KRk+TAjBXCiED7jlJaS/eYP6q8CJ91309VltP10pFiW2BsPzUXm1WOVQ9AHLRoUIrywP+FZlymYBMo8HgMaIhBQdHS8+kxEUD/iJID9V/96sem6v0UOwZw8eVymZ+Yz9LVAxoI2zELyMKM2XrwLkJ1H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V5nriVR4dGUw/LOqHndKxN/n5RQcUBNQpsfGMATiEcVGkyiJNQZRBKBa6PxD24sCzGTde8wrYPCazibA+wA14Nj9fQIfc9loCJu9IrYrc6p7iJNOHqfYM20PtctrvGs5DgGt1Rav/xqin5f3wQXvungGfRJwbSpoA+ayXzRkFe5UThFEF/NP0PHOc6+pj7xuf5g9HactqdbRJyRIjhhyfAW5BOTAIFGPNVhE6juhyVFyx1uRBdKvZUKj0U76PzT/l8gW0FizeMpSal1oVszCSjo6FdD3II9C3CyJX1A01QIDAQAB', 'RSfFvEBBQiHz8GZyDcP2eSUlZJgKjdxk', 2, now()); |
| 9 | 9 | |
| 10 | 10 | -- 中瑞农商行聚合支付通道, 根据环境配置不同的参数(服务地址、回调地址等) |
| 11 | 11 | INSERT INTO `dili_cashier`.upay_payment_pipeline(mch_id, pipeline_id, channel_id, type, name, uri, param, state, created_time, modified_time) |
| 12 | -VALUES (1001, 10014, 29, 2, '微信支付', 'https://epos.ahrcu.com:3443', '{"merchantNo": "94734065411016B", "terminalNo": "19A03301", "appId": "wx6f15ee0bd788c744", "appSecret": "4ab4152adf21da99c629fe7f3ce6b571", "key": "45913E42F86C18F512BEF54C2F0FE5BF", "notifyUrl": "https://cashier.test.gszdtop.com"}', 1, now(), now()); | |
| 12 | +VALUES (1001, 10014, 29, 2, '微信支付', 'https://epos.ahrcu.com:3443', '{"merchantNo": "94734065411016B", "terminalNo": "19A03301", "appId": "wx6f15ee0bd788c744", "appSecret": "4ab4152adf21da99c629fe7f3ce6b571", "key": "45913E42F86C18F512BEF54C2F0FE5BF", "notifyUrl": "https://cashier.pay.gszdtop.com"}', 1, now(), now()); | |
| 13 | 13 | |
| 14 | 14 | -- 中瑞园区卡支付通道, 根据环境配置不同的参数(服务地址、回调地址等) |
| 15 | 15 | INSERT INTO `dili_cashier`.upay_payment_pipeline(mch_id, pipeline_id, channel_id, type, name, uri, param, state, created_time, modified_time) |
| 16 | -VALUES (1001, 10012, 19, 2, '园区卡支付', 'http://gateway.dev.nong12.com/pay-service', '{"outMchId": 9, "accountId": 118924}', 1, now(), now()); | |
| 16 | +VALUES (1001, 10012, 19, 2, '园区卡支付', 'https://gateway.zr.zrgyl.com/pay-service', '{"outMchId": 9, "accountId": 118924}', 1, now(), now()); | |
| 17 | 17 | |
| 18 | 18 | -- 高斯智达微信支付直连通道, 根据环境配置不同的参数(服务地址、回调地址等) |
| 19 | 19 | -- INSERT INTO `dili_cashier`.upay_payment_pipeline(mch_id, pipeline_id, channel_id, type, name, uri, param, state, created_time, modified_time) |
| 20 | --- VALUES (1001, 10013, 10, 10, '微信支付', 'https://api.mch.weixin.qq.com', '{"notifyUrl": "https://cashier.test.gszdtop.com"}', 1, now(), now()); | |
| 20 | +-- VALUES (1001, 10013, 10, 10, '微信支付', 'https://api.mch.weixin.qq.com', '{"notifyUrl": "https://cashier.pay.gszdtop.com"}', 1, now(), now()); | |
| 21 | 21 | -- INSERT INTO `dili_cashier`.upay_wechat_param (pipeline_id, mch_id, app_id, app_secret, serial_no, private_key, wechat_serial_no, wechat_public_key, api_v3_key, type, created_time) |
| 22 | 22 | -- VALUES (10013, '1710148119', 'wx5e3c1166921039e4', '6501cbb2f4ececdcf0ef84bc43f6a710', '43D78972EC26DD5E05DB57D837E7EA6078ECD784', 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBsOX0bfhd/q8kj93XqGFEJfCQ782jhbnCls573+Kj3sEPZ+BsDNCryNkFD9/UzN9NRAymIZ8CFRDopIg8QYHkrMpvkILLLBB+E0ItmJmbPBPVP7kRbYDQvz2m/ZYGhwmaDIT9LcB6Y1t3w4rvyPmpdWXZuSI/8eYELWMqBTqTPpwhpXLjxOPc7Parc0AlIpc1Ij2kgJ+5shJfwfcGB7+uFg4Kd+jGyjr6nd8xoT76tlzJ+EVjha8JmK4EPlNjbMgHj45528eJgu11Zx6QrwOvBRaT9Ny6xu7qoGB7MsQLlWGQJmuWzm8x3soHOIAkjpDNmzF3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