mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-10-13 21:30:25 +00:00
ref 删除终端上报功能和去除商户字段
This commit is contained in:
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@IgnoreAuth
|
||||
@Tag(name = "支付宝回调通知")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/callback/{mchNo}/{AppId}")
|
||||
@RequestMapping("/unipay/callback/{AppId}")
|
||||
@RequiredArgsConstructor
|
||||
public class AlipayCallbackController {
|
||||
|
||||
@@ -32,14 +32,14 @@ public class AlipayCallbackController {
|
||||
|
||||
@Operation(summary = "支付宝回调(普通商户)")
|
||||
@PostMapping("/alipay")
|
||||
public String aliPayNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String aliPayNotify(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return payCallbackService.callbackHandle(request,false);
|
||||
}
|
||||
@Operation(summary = "支付宝回调(特约商户)")
|
||||
@PostMapping("/alipay/isv")
|
||||
public String aliPayIsvNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String aliPayIsvNotify(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return payCallbackService.callbackHandle(request, true);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@IgnoreAuth
|
||||
@Tag(name = "支付宝消息通知")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/notice/{mchNo}/{AppId}")
|
||||
@RequestMapping("/unipay/notice/{AppId}")
|
||||
@RequiredArgsConstructor
|
||||
public class AlipayNoticeReceiverController {
|
||||
|
||||
@@ -32,14 +32,14 @@ public class AlipayNoticeReceiverController {
|
||||
|
||||
@Operation(summary = "支付宝消息通知(普通商户)")
|
||||
@PostMapping("/alipay")
|
||||
public String aliPay(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String aliPay(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return aliPayNoticeReceiverService.noticeReceiver(request,false);
|
||||
}
|
||||
@Operation(summary = "支付宝消息通知(特约商户)")
|
||||
@PostMapping("/alipay/isv")
|
||||
public String aliPayIsv(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String aliPayIsv(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return aliPayNoticeReceiverService.noticeReceiver(request,true);
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
@IgnoreAuth
|
||||
@Tag(name = "支付宝同步通知")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/return/{mchNo}/{AppId}")
|
||||
@RequestMapping("/unipay/return/{AppId}")
|
||||
@RequiredArgsConstructor
|
||||
public class AlipayRedirectUrlController {
|
||||
private final AlipayRedirectUrlService redirectUrlService;
|
||||
@@ -31,15 +31,15 @@ public class AlipayRedirectUrlController {
|
||||
|
||||
@Operation(summary = "支付宝同步跳转通知")
|
||||
@GetMapping("/alipay")
|
||||
public ModelAndView alipay(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request){
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public ModelAndView alipay(@PathVariable("AppId") String appId, HttpServletRequest request){
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
String redirect = redirectUrlService.redirect(request,false);
|
||||
return new ModelAndView("redirect:"+redirect);
|
||||
}
|
||||
@Operation(summary = "支付宝同步跳转通知")
|
||||
@GetMapping("/alipay/isv")
|
||||
public ModelAndView alipayIsv(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request){
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public ModelAndView alipayIsv(@PathVariable("AppId") String appId, HttpServletRequest request){
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
String redirect = redirectUrlService.redirect(request, true);
|
||||
return new ModelAndView("redirect:"+redirect);
|
||||
}
|
||||
|
@@ -43,9 +43,6 @@ public class AlipayAllocReceiver implements ToResult<AlipayAllocReceiverResult>
|
||||
/** 分账关系名称 */
|
||||
private String relationName;
|
||||
|
||||
/** 商户号 */
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
private String appId;
|
||||
|
||||
@@ -57,7 +54,6 @@ public class AlipayAllocReceiver implements ToResult<AlipayAllocReceiverResult>
|
||||
var receiver = new AllocReceiver();
|
||||
receiver.setId(this.getId());
|
||||
receiver.setAppId(this.getAppId());
|
||||
receiver.setMchNo(this.getMchNo());
|
||||
receiver.setReceiverType(this.getReceiverType());
|
||||
receiver.setReceiverNo(this.getReceiverNo());
|
||||
receiver.setReceiverName(this.getReceiverName());
|
||||
|
@@ -68,9 +68,6 @@ public class AliPayConfig implements ToResult<AlipayConfigResult> {
|
||||
/** 是否沙箱环境 */
|
||||
private boolean sandbox;
|
||||
|
||||
/** 商户号 */
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
private String appId;
|
||||
|
||||
@@ -86,12 +83,11 @@ public class AliPayConfig implements ToResult<AlipayConfigResult> {
|
||||
channelConfig.setId(this.getId());
|
||||
channelConfig.setOutAppId(this.getAliAppId());
|
||||
channelConfig.setAppId(this.getAppId());
|
||||
channelConfig.setMchNo(this.getMchNo());
|
||||
channelConfig.setEnable(this.getEnable());
|
||||
channelConfig.setChannel(this.isv?ChannelEnum.ALIPAY_ISV.getCode():ChannelEnum.ALIPAY.getCode());
|
||||
var copy = AlipayConfigConvert.CONVERT.copy(this);
|
||||
// 清空不需要序列化的字段
|
||||
copy.setId(null).setAppId(null).setEnable(null).setAliAppId(null).setMchNo(null);
|
||||
copy.setId(null).setAppId(null).setEnable(null).setAliAppId(null);
|
||||
String jsonStr = JsonUtil.toJsonStr(copy);
|
||||
channelConfig.setExt(jsonStr);
|
||||
return channelConfig;
|
||||
@@ -105,7 +101,6 @@ public class AliPayConfig implements ToResult<AlipayConfigResult> {
|
||||
config.setId(channelConfig.getId())
|
||||
.setAliAppId(channelConfig.getOutAppId())
|
||||
.setAppId(channelConfig.getAppId())
|
||||
.setMchNo(channelConfig.getMchNo())
|
||||
.setEnable(channelConfig.isEnable());
|
||||
return config;
|
||||
}
|
||||
|
@@ -82,10 +82,6 @@ public class AlipayConfigParam {
|
||||
@Schema(description = "是否沙箱环境")
|
||||
private boolean sandbox;
|
||||
|
||||
/** 商户号 */
|
||||
@NotBlank(message = "商户号不可为空")
|
||||
@Schema(description = "商户号")
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
@NotBlank(message = "商户AppId不可为空")
|
||||
|
@@ -79,10 +79,6 @@ public class AlipayConfigResult {
|
||||
@Schema(description = "是否沙箱环境")
|
||||
private boolean sandbox;
|
||||
|
||||
/** 商户号 */
|
||||
@Schema(description = "商户号")
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
@Schema(description = "商户AppId")
|
||||
private String appId;
|
||||
|
@@ -102,7 +102,7 @@ public class AlipayAllocReceiverBindService {
|
||||
if (receiverBind.isBind()){
|
||||
throw new DataErrorException("分账接收方已绑定");
|
||||
}
|
||||
paymentAssistService.initMchAndApp(receiverBind.getMchNo(),receiverBind.getAppId());
|
||||
paymentAssistService.initMchAndApp(receiverBind.getAppId());
|
||||
var aliPayConfig = alipayConfigService.getAndCheckConfig(receiverBind.isIsv());
|
||||
var model = new AlipayTradeRoyaltyRelationBindModel();
|
||||
RoyaltyEntity entity = new RoyaltyEntity();
|
||||
@@ -144,7 +144,7 @@ public class AlipayAllocReceiverBindService {
|
||||
if (!receiverBind.isBind()){
|
||||
throw new DataErrorException("分账接收方已解绑");
|
||||
}
|
||||
paymentAssistService.initMchAndApp(receiverBind.getMchNo(),receiverBind.getAppId());
|
||||
paymentAssistService.initMchAndApp(receiverBind.getAppId());
|
||||
var aliPayConfig = alipayConfigService.getAndCheckConfig(receiverBind.isIsv());
|
||||
|
||||
AlipayTradeRoyaltyRelationUnbindModel model = new AlipayTradeRoyaltyRelationUnbindModel();
|
||||
|
@@ -62,7 +62,6 @@ public class AlipayAllocReceiverService {
|
||||
paymentAssistService.initMchAndApp(param.getAppId());
|
||||
var mchApp = PaymentContextLocal.get().getMchAppInfo();
|
||||
AlipayAllocReceiver entity = AlipayAllocReceiverConvert.CONVERT.toEntity(param);
|
||||
entity.setMchNo(mchApp.getMchNo());
|
||||
AllocReceiver receiver = entity.toReceiver(param.isIsv());
|
||||
String uuid = UUID.fastUUID().toString(true);
|
||||
receiver.setReceiverNo(uuid);
|
||||
|
@@ -82,7 +82,6 @@ public class AlipayConfigService {
|
||||
}
|
||||
// 转换类型
|
||||
var entity = AlipayConfigConvert.CONVERT.toEntity(param);
|
||||
entity.setMchNo(mchApp.getMchNo());
|
||||
ChannelConfig channelConfig = entity.toChannelConfig();
|
||||
// 判断商户和应用下是否存在该配置
|
||||
if (channelConfigManager.existsByAppIdAndChannel(param.getAppId(), channelConfig.getChannel())){
|
||||
@@ -117,18 +116,18 @@ public class AlipayConfigService {
|
||||
* 获取异步通知地址
|
||||
*/
|
||||
public String getNotifyUrl(boolean isv) {
|
||||
String url = isv?"{}/unipay/callback/{}/{}/alipay/isv":"{}/unipay/callback/{}/{}/alipay";
|
||||
String url = isv?"{}/unipay/callback/{}/alipay/isv":"{}/unipay/callback/{}/alipay";
|
||||
var mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(),mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取同步通知地址
|
||||
*/
|
||||
public String getReturnUrl(boolean isv) {
|
||||
String url = isv?"{}/unipay/return/{}/{}/alipay/isv":"{}/unipay/return/{}/{}/alipay";
|
||||
String url = isv?"{}/unipay/return/{}/alipay/isv":"{}/unipay/return/{}/alipay";
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(),mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@IgnoreAuth
|
||||
@Tag(name = "银联回调通知")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/callback/{mchNo}/{AppId}")
|
||||
@RequestMapping("/unipay/callback/{AppId}")
|
||||
@RequiredArgsConstructor
|
||||
public class UnionPayCallbackController {
|
||||
|
||||
@@ -30,8 +30,8 @@ public class UnionPayCallbackController {
|
||||
|
||||
@Operation(summary = "银联回调")
|
||||
@PostMapping("/union")
|
||||
public String UnionPayNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String UnionPayNotify(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@@ -22,15 +22,15 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
@IgnoreAuth
|
||||
@Tag(name = "同步通知跳转控制器")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/return/{mchNo}/{AppId}")
|
||||
@RequestMapping("/unipay/return/{AppId}")
|
||||
@RequiredArgsConstructor
|
||||
public class UnionPayRedirectUrlController {
|
||||
private final PaymentAssistService paymentAssistService;
|
||||
|
||||
@Operation(summary = "银联同步跳转通知")
|
||||
@GetMapping("/union")
|
||||
public ModelAndView alipay(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request){
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public ModelAndView alipay(@PathVariable("AppId") String appId, HttpServletRequest request){
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
String redirect = "";
|
||||
return new ModelAndView("redirect:"+redirect);
|
||||
}
|
||||
|
@@ -71,9 +71,6 @@ public class UnionPayConfig implements ToResult<UnionPayConfigResult> {
|
||||
/** 是否沙箱环境 */
|
||||
private boolean sandbox;
|
||||
|
||||
/** 商户号 */
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
private String appId;
|
||||
|
||||
@@ -90,12 +87,11 @@ public class UnionPayConfig implements ToResult<UnionPayConfigResult> {
|
||||
channelConfig.setId(this.getId());
|
||||
channelConfig.setOutMchNo(this.getUnionMachId());
|
||||
channelConfig.setAppId(this.getAppId());
|
||||
channelConfig.setMchNo(this.getMchNo());
|
||||
channelConfig.setEnable(this.getEnable());
|
||||
channelConfig.setChannel(ChannelEnum.UNION_PAY.getCode());
|
||||
UnionPayConfig copy = UnionPayConfigConvert.CONVERT.copy(this);
|
||||
// 清空不需要序列化的字段
|
||||
copy.setId(null).setAppId(null).setEnable(null).setUnionMachId(null).setAppId(null).setMchNo(null);
|
||||
copy.setId(null).setAppId(null).setEnable(null).setUnionMachId(null).setAppId(null);
|
||||
String jsonStr = JsonUtil.toJsonStr(copy);
|
||||
channelConfig.setExt(jsonStr);
|
||||
return channelConfig;
|
||||
|
@@ -76,11 +76,6 @@ public class UnionPayConfigParam {
|
||||
@Schema(description = "是否沙箱环境")
|
||||
private boolean sandbox;
|
||||
|
||||
/** 商户号 */
|
||||
@NotBlank(message = "商户号不可为空")
|
||||
@Schema(description = "商户号")
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
@Schema(description = "商户AppId")
|
||||
@NotBlank(message = "商户AppId不可为空")
|
||||
|
@@ -64,8 +64,6 @@ public class UnionPayConfigService {
|
||||
public void save(UnionPayConfigParam param) {
|
||||
UnionPayConfig entity = UnionPayConfigConvert.CONVERT.toEntity(param);
|
||||
ChannelConfig channelConfig = entity.toChannelConfig();
|
||||
// 如果运营端使用, 商户号写入上下文中
|
||||
MchContextLocal.setMchNo(channelConfig.getMchNo());
|
||||
// 判断商户和应用下是否存在该配置
|
||||
if (channelConfigManager.existsByAppIdAndChannel(channelConfig.getAppId(), channelConfig.getChannel())){
|
||||
throw new DataErrorException("该应用下已存在云闪付配置, 请勿重新添加");
|
||||
@@ -103,7 +101,7 @@ public class UnionPayConfigService {
|
||||
*/
|
||||
public String getNotifyUrl() {
|
||||
var mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format("{}/unipay/callback/{}/{}/union",mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format("{}/unipay/callback/{}/union",mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +109,7 @@ public class UnionPayConfigService {
|
||||
*/
|
||||
public String getReturnUrl() {
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format("{}/unipay/return/{}/{}/union",mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format("{}/unipay/return/{}/union",mchAppInfo.getGatewayServiceUrl(),mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@IgnoreAuth
|
||||
@Tag(name = "微信回调通知控制器")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/callback/{mchNo}/{AppId}/wechat")
|
||||
@RequestMapping("/unipay/callback/{AppId}/wechat")
|
||||
@RequiredArgsConstructor
|
||||
public class WechatPayCallbackController {
|
||||
private final WechatTransferCallbackService transferCallbackService;
|
||||
@@ -35,44 +35,44 @@ public class WechatPayCallbackController {
|
||||
|
||||
@Operation(summary = "微信支付回调(普通商户)")
|
||||
@PostMapping("/pay")
|
||||
public String wechatPayNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String wechatPayNotify(@PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return payCallbackService.payHandle(request,false);
|
||||
}
|
||||
|
||||
@Operation(summary = "微信支付回调(特约商户)")
|
||||
@PostMapping("/isv/pay")
|
||||
public String wechatPayIsvNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String wechatPayIsvNotify(@PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return payCallbackService.payHandle(request,true);
|
||||
}
|
||||
|
||||
@Operation(summary = "微信退款回调(普通商户)")
|
||||
@PostMapping("/refund")
|
||||
public String wechatRefundNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String wechatRefundNotify(@PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return refundCallbackService.refundHandle(request,false);
|
||||
}
|
||||
|
||||
@Operation(summary = "微信退款回调(特约商户)")
|
||||
@PostMapping("/isv/refund")
|
||||
public String wechatIsvRefundNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String wechatIsvRefundNotify(@PathVariable("AppId") String appId,HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return refundCallbackService.refundHandle(request,true);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "微信转账回调(普通商户)")
|
||||
@PostMapping("/transfer")
|
||||
public String wechatTransferNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String wechatTransferNotify(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return transferCallbackService.transferHandle(request,false);
|
||||
}
|
||||
|
||||
@Operation(summary = "微信转账回调(特约商户)")
|
||||
@PostMapping("/isv/transfer")
|
||||
public String wechatIsvTransferNotify(@PathVariable("mchNo") String mchNo, @PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(mchNo, appId);
|
||||
public String wechatIsvTransferNotify(@PathVariable("AppId") String appId, HttpServletRequest request) {
|
||||
paymentAssistService.initMchAndApp(appId);
|
||||
return transferCallbackService.transferHandle(request,true);
|
||||
}
|
||||
}
|
||||
|
@@ -39,9 +39,6 @@ public class WechatAllocReceiver implements ToResult<WechatAllocReceiverResult>
|
||||
/** 分账关系名称 */
|
||||
private String relationName;
|
||||
|
||||
/** 商户号 */
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
private String appId;
|
||||
|
||||
@@ -52,7 +49,6 @@ public class WechatAllocReceiver implements ToResult<WechatAllocReceiverResult>
|
||||
var receiver = new AllocReceiver();
|
||||
receiver.setId(this.getId());
|
||||
receiver.setAppId(this.getAppId());
|
||||
receiver.setMchNo(this.getMchNo());
|
||||
receiver.setReceiverNo(this.getReceiverNo());
|
||||
receiver.setReceiverType(this.getReceiverType());
|
||||
receiver.setReceiverName(this.getReceiverName());
|
||||
|
@@ -88,9 +88,6 @@ public class WechatPayConfig implements ToResult<WechatPayConfigResult> {
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 商户号 */
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
private String appId;
|
||||
|
||||
@@ -103,12 +100,11 @@ public class WechatPayConfig implements ToResult<WechatPayConfigResult> {
|
||||
channelConfig.setOutAppId(this.getWxAppId());
|
||||
channelConfig.setOutMchNo(this.getWxMchId());
|
||||
channelConfig.setAppId(this.getAppId());
|
||||
channelConfig.setMchNo(this.getMchNo());
|
||||
channelConfig.setEnable(this.getEnable());
|
||||
channelConfig.setChannel(this.isv?ChannelEnum.WECHAT_ISV.getCode():ChannelEnum.WECHAT.getCode());
|
||||
WechatPayConfig copy = WechatPayConfigConvert.CONVERT.copy(this);
|
||||
// 清空不需要序列化的字段
|
||||
copy.setId(null).setMchNo(null).setAppId(null).setEnable(null).setWxMchId(null).setWxAppId(null);
|
||||
copy.setId(null).setAppId(null).setEnable(null).setWxMchId(null).setWxAppId(null);
|
||||
String jsonStr = JsonUtil.toJsonStr(copy);
|
||||
channelConfig.setExt(jsonStr);
|
||||
return channelConfig;
|
||||
@@ -124,7 +120,6 @@ public class WechatPayConfig implements ToResult<WechatPayConfigResult> {
|
||||
.setWxAppId(channelConfig.getOutAppId())
|
||||
.setWxMchId(channelConfig.getOutMchNo())
|
||||
.setAppId(channelConfig.getAppId())
|
||||
.setMchNo(channelConfig.getMchNo())
|
||||
.setEnable(channelConfig.isEnable());
|
||||
return config;
|
||||
}
|
||||
|
@@ -104,11 +104,6 @@ public class WechatPayConfigParam {
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 商户号 */
|
||||
@NotBlank(message = "商户号不可为空")
|
||||
@Schema(description = "商户号")
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
@Schema(description = "商户AppId")
|
||||
@NotBlank(message = "商户AppId不可为空")
|
||||
|
@@ -108,10 +108,6 @@ public class WechatPayConfigResult {
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 商户号 */
|
||||
@Schema(description = "商户号")
|
||||
private String mchNo;
|
||||
|
||||
/** 商户AppId */
|
||||
@Schema(description = "商户AppId")
|
||||
private String appId;
|
||||
|
@@ -99,7 +99,7 @@ public class WechatAllocReceiverBindService {
|
||||
*/
|
||||
public void bind(Long id) {
|
||||
var receiverBind = receiverBindManager.findById(id).orElseThrow(() -> new DataNotExistException("微信分账接收方数据不存在"));
|
||||
paymentAssistService.initMchAndApp(receiverBind.getMchNo(),receiverBind.getAppId());
|
||||
paymentAssistService.initMchAndApp(receiverBind.getAppId());
|
||||
if (receiverBind.isBind()){
|
||||
throw new DataErrorException("分账接收方已绑定");
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class WechatAllocReceiverBindService {
|
||||
*/
|
||||
public void unbind(Long id) {
|
||||
var receiverBind = receiverBindManager.findById(id).orElseThrow(() -> new DataNotExistException("微信分账接收方数据不存在"));
|
||||
paymentAssistService.initMchAndApp(receiverBind.getMchNo(),receiverBind.getAppId());
|
||||
paymentAssistService.initMchAndApp(receiverBind.getAppId());
|
||||
if (!receiverBind.isBind()){
|
||||
throw new DataErrorException("分账接收方已解绑");
|
||||
}
|
||||
|
@@ -61,7 +61,6 @@ public class WechatAllocReceiverService {
|
||||
paymentAssistService.initMchAndApp(param.getAppId());
|
||||
var mchApp = PaymentContextLocal.get().getMchAppInfo();
|
||||
var entity = WechatAllocReceiverConvert.CONVERT.toEntity(param);
|
||||
entity.setMchNo(mchApp.getMchNo());
|
||||
AllocReceiver receiver = entity.toReceiver(param.isIsv());
|
||||
String uuid = UUID.fastUUID().toString(true);
|
||||
receiver.setReceiverNo(uuid);
|
||||
|
@@ -79,8 +79,6 @@ public class WechatPayConfigService {
|
||||
}
|
||||
WechatPayConfig entity = WechatPayConfigConvert.CONVERT.toEntity(param);
|
||||
ChannelConfig channelConfig = entity.toChannelConfig();
|
||||
// 如果运营端使用, 商户号写入上下文中
|
||||
MchContextLocal.setMchNo(channelConfig.getMchNo());
|
||||
// 判断商户和应用下是否存在该配置
|
||||
if (channelConfigManager.existsByAppIdAndChannel(channelConfig.getAppId(), channelConfig.getChannel())){
|
||||
throw new DataErrorException("该应用下已存在微信配置, 请勿重新添加");
|
||||
@@ -114,27 +112,27 @@ public class WechatPayConfigService {
|
||||
* 获取支付异步通知地址
|
||||
*/
|
||||
public String getPayNotifyUrl(boolean isv) {
|
||||
String url = isv ? "{}/unipay/callback/{}/{}/wechat/isv/pay":"{}/unipay/callback/{}/{}/wechat/pay";
|
||||
String url = isv ? "{}/unipay/callback/{}/wechat/isv/pay":"{}/unipay/callback/{}/wechat/pay";
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(),mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取退款异步通知地址
|
||||
*/
|
||||
public String getRefundNotifyUrl(boolean isv) {
|
||||
String url = isv ? "{}/unipay/callback/{}/{}/wechat/isv/refund":"{}/unipay/callback/{}/{}/wechat/refund";
|
||||
String url = isv ? "{}/unipay/callback/{}/wechat/isv/refund":"{}/unipay/callback/{}/wechat/refund";
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(),mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转账回调地址
|
||||
*/
|
||||
public String getTransferNotifyUrl(boolean isv) {
|
||||
String url = isv ? "{}/unipay/callback/{}/{}/wechat/isv/transfer":"{}/unipay/callback/{}/{}/wechat/transfer";
|
||||
String url = isv ? "{}/unipay/callback/{}/wechat/isv/transfer":"{}/unipay/callback/{}/wechat/transfer";
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(), mchAppInfo.getMchNo(),mchAppInfo.getAppId());
|
||||
return StrUtil.format(url,mchAppInfo.getGatewayServiceUrl(),mchAppInfo.getAppId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user