|
|
|
@@ -10,10 +10,13 @@ import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.domain.vo.WxWeappInfo; |
|
|
|
import com.iformall.douyin.pay.TtPayService; |
|
|
|
import com.iformall.douyin.payv2.request.CallBackSettingsRequest; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.service.*; |
|
|
|
import com.iformall.shiro.PasswordHelper; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import com.iformall.utils.MaUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
@@ -94,6 +97,9 @@ public class WxProjectConfigController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WechatWebProperties wechatWebProperties; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MaUtil maUtil; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("openRedisTemplate") |
|
|
|
RedisTemplate<String, String> openRedisTemplate; |
|
|
|
@@ -774,4 +780,74 @@ public class WxProjectConfigController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("获取抖音支付2.0 回调接口配置") |
|
|
|
@GetMapping("/ttcallback/query/settings") |
|
|
|
@SystemControllerLog(description = "") |
|
|
|
@TenantIgnore |
|
|
|
public ResultData ttcallbackQuerySettings(String appid) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackQuerySettings"); |
|
|
|
try { |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getByAppId(appid); |
|
|
|
if(appinfo == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); |
|
|
|
} |
|
|
|
if(!EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) || !EnumAppType.C.getCode().equals(appinfo.getType())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); |
|
|
|
} |
|
|
|
WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); |
|
|
|
if(payAccount == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); |
|
|
|
} |
|
|
|
TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); |
|
|
|
CallBackSettingsRequest callBackSettingsRequest = ttPayService.querySettings(); |
|
|
|
return new ResultData(callBackSettingsRequest); |
|
|
|
}catch (Exception e){ |
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("配置抖音支付2.0 回调接口") |
|
|
|
@PostMapping("/ttcallback/settings") |
|
|
|
@SystemControllerLog(description = "商场集团-更新") |
|
|
|
@TenantIgnore |
|
|
|
public ResultData ttcallbackSettings(@RequestBody Map<String, String> map) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackSettings"); |
|
|
|
String appid = map.get("appid"); |
|
|
|
String create_order_callback = map.get("create_order_callback"); |
|
|
|
String refund_callback = map.get("refund_callback"); |
|
|
|
String delivery_qrcode_redirect = map.get("delivery_qrcode_redirect"); |
|
|
|
if(StringUtils.isBlank(appid) || StringUtils.isBlank(create_order_callback) |
|
|
|
|| StringUtils.isBlank(refund_callback)){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
try { |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getByAppId(appid); |
|
|
|
if(appinfo == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); |
|
|
|
} |
|
|
|
if(!EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) || !EnumAppType.C.getCode().equals(appinfo.getType())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); |
|
|
|
} |
|
|
|
WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); |
|
|
|
if(payAccount == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); |
|
|
|
} |
|
|
|
TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); |
|
|
|
CallBackSettingsRequest request = new CallBackSettingsRequest(); |
|
|
|
request.setCreateOrderCallback(create_order_callback); |
|
|
|
request.setRefundCallback(refund_callback); |
|
|
|
request.setDeliveryQrcodeRedirect(delivery_qrcode_redirect); |
|
|
|
boolean b = ttPayService.callbackSettings(request); |
|
|
|
if(b){ |
|
|
|
return new ResultData(); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |