|
|
@@ -14,6 +14,7 @@ import com.zhongshu.card.client.service.feign.ProjectPaySettingFeignService;
|
|
|
import com.zhongshu.payment.client.model.RechargeRecordModel;
|
|
|
import com.zhongshu.payment.client.model.param.OrderParam;
|
|
|
import com.zhongshu.payment.client.model.param.RechargeParam;
|
|
|
+import com.zhongshu.payment.client.payModel.commn.ClosePayOrderParam;
|
|
|
import com.zhongshu.payment.client.payModel.commn.PayNotityParam;
|
|
|
import com.zhongshu.payment.client.types.RechargeState;
|
|
|
import com.zhongshu.payment.client.types.TradeType;
|
|
|
@@ -215,27 +216,27 @@ public class RechargeService extends SuperService {
|
|
|
/**
|
|
|
* 关闭充值订单
|
|
|
*/
|
|
|
- public Object close(String outTradeNo) {
|
|
|
+ public ResultContent close(String outTradeNo) {
|
|
|
RechargeRecord record = rechargeRecordDao.findByOutTradeNo(outTradeNo);
|
|
|
if (record == null) {
|
|
|
return ResultContent.buildFail("充值订单:" + outTradeNo + "不存在");
|
|
|
}
|
|
|
-
|
|
|
- if (record.getRechargeState().equals(RechargeState.NOTPAY)) {
|
|
|
- record.setRechargeState(RechargeState.CLOSED);
|
|
|
- rechargeRecordDao.save(record);
|
|
|
- return ResultContent.buildSuccess();
|
|
|
+ // 判断状态
|
|
|
+ if (record.getRechargeState() != RechargeState.NOTPAY) {
|
|
|
+ return ResultContent.buildFail(String.format("订单状态不为[%s]不能关闭"));
|
|
|
}
|
|
|
-
|
|
|
- ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
|
|
|
- wxPayParam.setAppId(record.getAppid());
|
|
|
- ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
|
|
|
- if (paySetResult.isFailed()) {
|
|
|
- return ResultContent.buildFail("获取微信支付配置失败");
|
|
|
+ ExecuteMethodInfo executeMethodInfo = executeMethodInfoDao.findTopByPaymentType(record.getPaymentType());
|
|
|
+ if (ObjectUtils.isEmpty(executeMethodInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format("", record.getPaymentType().getRemark()));
|
|
|
+ }
|
|
|
+ SuperPayService service = (SuperPayService) ApplicationContextHolder.getContext().getBean(executeMethodInfo.getBeanName());
|
|
|
+ ResultContent resultContent = service.closePayOrder(ClosePayOrderParam.builder().outTradeNo(outTradeNo).build());
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return resultContent;
|
|
|
}
|
|
|
record.setRechargeState(RechargeState.CLOSED);
|
|
|
rechargeRecordDao.save(record);
|
|
|
- return wxPaymentService.closeOrder(outTradeNo, paySetResult.getContent());
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
public Object closeNoPay(String outTradeNo) {
|