提交 8f60e4ee authored 作者: huningning's avatar huningning

添加违约支付

上级 b2921e4a
......@@ -42,4 +42,22 @@ public class PayNotifyController {
return ret;
}
@ApiOperation(value = "用户支付完成回调接口", notes = " <br>By:胡宁宁")
@RequestMapping(value = "/userPayBrokerContractNotify", method = RequestMethod.POST)
public Result<Object> userPayBrokerContractNotify(@RequestBody NotifyString notify) {
log.info("用户支付完成回调接口 传参 {}", notify);
if (Objects.isNull(notify) || Objects.isNull(notify.getCode()) || Objects.isNull(notify.getAction())) {
return new Result<>();
}
if (notify.getCode() != 0) {
// 支付失败处理
log.info("支付失败处理 唯一id {}", notify.getOrderNo());
} else {
// 支付支付成功处理
log.info(" 支付支付成功处理 唯一id {}", notify.getOrderNo());
}
Result<Object> ret = new Result<>();
return ret;
}
}
......@@ -7,4 +7,6 @@ import com.msl.common.result.Result;
public interface PaymentService {
Result paymentWallet( PayParam noCheckPwd);
Result paymentBreakContractWallet( PayParam noCheckPwd);
}
......@@ -46,6 +46,9 @@ public class PaymentServiceImpl implements PaymentService {
/** 转账回调地址 **/
public static final String NOTIFY_URL = "/clx-performance/payment/notify/userPayNotify";
/** 违约回调地址 **/
public static final String NOTIFY_BROKER_URL = "/clx-performance/payment/notify/userPayBrokerContractNotify";
@Autowired
private final MslPaymentConfig mslPaymentConfig;
......@@ -95,6 +98,47 @@ public class PaymentServiceImpl implements PaymentService {
}
/**
* 钱包直接划账给钱包(违约)
*
* @param payDTO
* @return
*/
@Override
public Result paymentBreakContractWallet(PayParam payDTO) {
/** 构建支付单元 **/
PayUnitDTO payUnitDTO = PayUnitDTO.builder()
.id(payDTO.getTradeId())
.from(payDTO.getFrom())
.to(payDTO.getTo())
.figure(payDTO.getFigure())
.type(PayUnitTypeEnum.RESIDUE_PAY.getCode())
.timestamp(System.currentTimeMillis() / 1000)
.remark(payDTO.getRemark()).build();
/** 生成签名**/
PayEncryptTools.sign(payUnitDTO, PrivateKeyConfig.privateKeyByte);
/** 构建支付支付 ***/
PayUserDTO payUserDTO = PayUserDTO.builder()
.pwd(payDTO.getPwd())
.system(SystemCodeEnum.PERFORMANCE_SERVICE.getCode())
.userCode(payDTO.getFrom())
.orderNo(payDTO.getTradeNo())
.uuid(UUID.randomUUID().toString().replaceAll("-", ""))
.notifyUrl(mslPaymentConfig.getNotifyhost() + NOTIFY_BROKER_URL)
.payUnitDTO(payUnitDTO).build();
log.info("发起支付请求日志 {}", payUserDTO);
Result<Object> notify = (Result<Object>) postRequest(mslPaymentConfig.getHost()+ PERFORMANCE_PAY_CLX_PAYMENT.getUrl(), JSON.toJSONString(payUserDTO));
log.info("支付返回日志 {}", notify);
if (notify == null || notify.getCode() != 0) {
//FEGIN返回null
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "支付服务返回异常");
}
return notify;
}
/**
* post请求
*/
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论