|
@@ -28,6 +28,8 @@ import com.zhongshu.card.server.core.dao.pay.ShareOrderDao;
|
|
|
import com.zhongshu.card.server.core.domain.pay.ChinaumsSenselessUserSignInfo;
|
|
import com.zhongshu.card.server.core.domain.pay.ChinaumsSenselessUserSignInfo;
|
|
|
import com.zhongshu.card.server.core.domain.pay.PayAccount;
|
|
import com.zhongshu.card.server.core.domain.pay.PayAccount;
|
|
|
import com.zhongshu.card.server.core.domain.pay.ShareOrder;
|
|
import com.zhongshu.card.server.core.domain.pay.ShareOrder;
|
|
|
|
|
+import com.zhongshu.card.server.core.model.pay.ChinaumsSenselessSrcReserve;
|
|
|
|
|
+import com.zhongshu.card.server.core.model.pay.UnionFrictionlessPayFinishModel;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.paySetting.OrgPayAccountService;
|
|
import com.zhongshu.card.server.core.service.paySetting.OrgPayAccountService;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
@@ -397,7 +399,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
shareOrder.setShareOrderNo(shareOrderNo);
|
|
shareOrder.setShareOrderNo(shareOrderNo);
|
|
|
shareOrder.setOriShareOrderNo(shareOrder.getShareOrderNo());
|
|
shareOrder.setOriShareOrderNo(shareOrder.getShareOrderNo());
|
|
|
shareOrderDao.save(refundShareOrder);
|
|
shareOrderDao.save(refundShareOrder);
|
|
|
- request.setSrcReserve(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid, "orderNo", orderNo, "prefix", projectConf.getOrderNoPrefix())));
|
|
|
|
|
|
|
+ request.setSrcReserve(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid, "orderNo", refundOrderNo, "prefix", projectConf.getOrderNoPrefix())));
|
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> refundResultContent = senselessPayService.refund(payProductParameter);
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> refundResultContent = senselessPayService.refund(payProductParameter);
|
|
|
if (!refundResultContent.getState().equals(ResultState.Success)) {
|
|
if (!refundResultContent.getState().equals(ResultState.Success)) {
|
|
@@ -411,6 +413,54 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
return ResultContent.buildFail(bodyMap.get("respDesc").toString());
|
|
return ResultContent.buildFail(bodyMap.get("respDesc").toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @SneakyThrows
|
|
|
|
|
+ public ResultContent<UnionFrictionlessPayFinishModel> refundQuery(String projectOid, String userId, String oid, String refundOrderNo, Boolean handle) {
|
|
|
|
|
+ String projectAccountName = orgPayAccountService.queryOgPayAccount(projectOid, PaymentType.UnionFrictionlessPay);
|
|
|
|
|
+ com.github.microservice.pay.client.ret.ResultContent<AccountModel> projectAccountModelResultContent = payProductAccountService.get(projectAccountName);
|
|
|
|
|
+ if (!projectAccountModelResultContent.getState().equals(ResultState.Success)) {
|
|
|
|
|
+ return ResultContent.buildFail(projectAccountModelResultContent.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ ChinaumsSenselessConf projectConf = (ChinaumsSenselessConf) projectAccountModelResultContent.getContent().getConf();
|
|
|
|
|
+
|
|
|
|
|
+ PayProductParameter<Object> payProductParameter = new PayProductParameter<>();
|
|
|
|
|
+ payProductParameter.setAccountName(projectAccountName);
|
|
|
|
|
+ payProductParameter.setMeta(Map.of("mchntOrderId", refundOrderNo, "srcReserve", JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid, "orderNo", refundOrderNo, "prefix", projectConf.getOrderNoPrefix()))));
|
|
|
|
|
+
|
|
|
|
|
+ com.github.microservice.pay.client.ret.ResultContent<Object> refundQuery = senselessPayService.refundQuery(payProductParameter);
|
|
|
|
|
+ if (!refundQuery.getState().equals(ResultState.Success)) {
|
|
|
|
|
+ return ResultContent.buildFail("请求失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Map refundBody = JsonUtil.toObject(JsonUtil.toJson(refundQuery.getContent()), Map.class);
|
|
|
|
|
+ if (!refundBody.get("respCode").equals("0000")) {
|
|
|
|
|
+ return ResultContent.buildFail(refundBody.get("respDesc").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+// String refundOrderId = (String) refundBody.get("refundOrderId");
|
|
|
|
|
+// ChinaumsSenselessSrcReserve srcReserve = JsonUtil.toObject(JsonUtil.toJson(refundBody.get("srcReserve")), ChinaumsSenselessSrcReserve.class);
|
|
|
|
|
+//
|
|
|
|
|
+// if (org.apache.commons.lang3.StringUtils.isNotEmpty(refundOrderId) && refundOrderId.startsWith(srcReserve.getPrefix())){
|
|
|
|
|
+// refundOrderId = refundOrderId.substring(srcReserve.getPrefix().length());
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ UnionFrictionlessPayFinishModel unionFrictionlessPayFinishModel = new UnionFrictionlessPayFinishModel();
|
|
|
|
|
+ unionFrictionlessPayFinishModel.setStatus((String) refundBody.get("status"));
|
|
|
|
|
+ unionFrictionlessPayFinishModel.setRefundStatus((String) refundBody.get("refundStatus"));
|
|
|
|
|
+ unionFrictionlessPayFinishModel.setRefundOrderId(refundOrderNo);
|
|
|
|
|
+ unionFrictionlessPayFinishModel.setMerOrderId((String) refundBody.get("mchntOrderId"));
|
|
|
|
|
+ unionFrictionlessPayFinishModel.setTargetOrderId((String) refundBody.get("refundTargetOrderId"));
|
|
|
|
|
+
|
|
|
|
|
+ if (handle && refundBody.get("status").equals("TRADE_REFUND") && refundBody.get("refundStatus").equals("SUCCESS")) {
|
|
|
|
|
+ com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> listResultContent = handleRefund(projectOid,
|
|
|
|
|
+ oid,
|
|
|
|
|
+ userId,
|
|
|
|
|
+ new BigDecimal((String) refundBody.get("sendBackAmount")),
|
|
|
|
|
+ refundOrderNo, null);
|
|
|
|
|
+ unionFrictionlessPayFinishModel.setTransactionLogModelList(listResultContent);
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultContent.buildContent(unionFrictionlessPayFinishModel);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handlePay(String projectOid, String oid, String userId, BigDecimal total, String orderNo, String remark) {
|
|
public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handlePay(String projectOid, String oid, String userId, BigDecimal total, String orderNo, String remark) {
|
|
|
//TODO 判断支付状态
|
|
//TODO 判断支付状态
|
|
|
|
|
|