Просмотр исходного кода

//tt pay v2

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
8d8aaa9168
3 измененных файлов: 95 добавлений и 4 удалений
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java
  2. +76
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
  3. +18
    -3
      mallinkService/src/main/java/com/iformall/douyin/pay/impl/BaseTtPayServiceImpl.java

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java Просмотреть файл

@@ -147,7 +147,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/wxDeviceScreenAd/**", "anon"); filterChainDefinitionMap.put("/wxDeviceScreenAd/**", "anon");
// filterChainDefinitionMap.put("/role/**", "corsFilter,token"); // filterChainDefinitionMap.put("/role/**", "corsFilter,token");
//商场初始化init //商场初始化init
// filterChainDefinitionMap.put("/wxProjectConfig/**", "anon");
filterChainDefinitionMap.put("/wxProjectConfig/**", "anon");


// //test // //test
// filterChainDefinitionMap.put("/merchantPoi/spuSync", "anon"); // filterChainDefinitionMap.put("/merchantPoi/spuSync", "anon");


+ 76
- 0
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java Просмотреть файл

@@ -10,10 +10,13 @@ import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxWeappInfo; 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.enums.*;
import com.iformall.service.*; import com.iformall.service.*;
import com.iformall.shiro.PasswordHelper; import com.iformall.shiro.PasswordHelper;
import com.iformall.utils.Constant; import com.iformall.utils.Constant;
import com.iformall.utils.MaUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -94,6 +97,9 @@ public class WxProjectConfigController extends BaseController {
@Autowired @Autowired
private WechatWebProperties wechatWebProperties; private WechatWebProperties wechatWebProperties;


@Autowired
private MaUtil maUtil;

@Autowired @Autowired
@Qualifier("openRedisTemplate") @Qualifier("openRedisTemplate")
RedisTemplate<String, String> 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);
}
}

} }

+ 18
- 3
mallinkService/src/main/java/com/iformall/douyin/pay/impl/BaseTtPayServiceImpl.java Просмотреть файл

@@ -74,7 +74,12 @@ public abstract class BaseTtPayServiceImpl implements TtPayService {
public boolean callbackSettings(CallBackSettingsRequest request) throws TtPayException { public boolean callbackSettings(CallBackSettingsRequest request) throws TtPayException {
String url = String.format("%s/api/apps/trade/v2/settings", this.getPayBaseUrl()); String url = String.format("%s/api/apps/trade/v2/settings", this.getPayBaseUrl());
String response = this.postV2(url, GSON.toJson(request)); String response = this.postV2(url, GSON.toJson(request));
return GSON.fromJson(response, BaseTtPayResult.class).isSuccess();
BaseTtPayResult baseTtPayResult = GSON.fromJson(response, BaseTtPayResult.class);
if(baseTtPayResult.isSuccess()){
return true;
}else{
throw new TtPayException(baseTtPayResult.getErrTips());
}
} }


@Override @Override
@@ -174,7 +179,12 @@ public abstract class BaseTtPayServiceImpl implements TtPayService {
public boolean pushDelivery(TtOrderPushDeliveryRequest request) throws TtPayException{ public boolean pushDelivery(TtOrderPushDeliveryRequest request) throws TtPayException{
String url = String.format("%s/api/apps/trade/v2/push_delivery", this.getPayBaseUrl()); String url = String.format("%s/api/apps/trade/v2/push_delivery", this.getPayBaseUrl());
String response = this.postV2(url, GSON.toJson(request)); String response = this.postV2(url, GSON.toJson(request));
return GSON.fromJson(response, BaseTtPayResult.class).isSuccess();
BaseTtPayResult baseTtPayResult = GSON.fromJson(response, BaseTtPayResult.class);
if(baseTtPayResult.isSuccess()){
return true;
}else{
throw new TtPayException(baseTtPayResult.getErrTips());
}


} }


@@ -209,7 +219,12 @@ public abstract class BaseTtPayServiceImpl implements TtPayService {
public boolean merchantAuditCallback(TtRefundAuditMsgRequest request) throws TtPayException{ public boolean merchantAuditCallback(TtRefundAuditMsgRequest request) throws TtPayException{
String url = String.format("%s/api/apps/trade/v2/merchant_audit_callback", this.getPayBaseUrl()); String url = String.format("%s/api/apps/trade/v2/merchant_audit_callback", this.getPayBaseUrl());
String response = this.postV2(url, GSON.toJson(request)); String response = this.postV2(url, GSON.toJson(request));
return GSON.fromJson(response, BaseTtPayResult.class).isSuccess();
BaseTtPayResult baseTtPayResult = GSON.fromJson(response, BaseTtPayResult.class);
if(baseTtPayResult.isSuccess()){
return true;
}else{
throw new TtPayException(baseTtPayResult.getErrTips());
}
} }


@Override @Override


Загрузка…
Отмена
Сохранить