channel permission

master
yixian 3 years ago
parent e1ba3b4eaa
commit e0f564a19d

@ -283,10 +283,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private MailGunService mailGunService;
@Resource
private ClearingDetailMapper clearingDetailMapper;
@Resource
private ClearingLogMapper clearingLogMapper;
@Resource
private ClientConfigMapper clientConfigMapper;
@Resource
private PermissionPartnerManagerImpl permissionPartnerManagerImpl;
@ -331,8 +327,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private PaymentApi paymentApi;
@Resource
private MerchantChannelPermissionManager merchantChannelPermissionManager;
@Resource
private ApsConfigService apsConfigService;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy");
@ -1593,9 +1587,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new NotFoundException("Client Not Exists");
}
merchantChannelPermissionManager.switchMerchantChannelPermission(channelApi.getMetadata().payChannel(), client.getIntValue("client_id"), allow);
try {
clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow));
clientModifySupport.processModify(new SwitchChannelPermissionModify(manager, clientMoniker, merchantInfoProvider, paymentApi.channelApi(channel).getChannelPermissionResolver(), allow));
} catch (Exception e) {
logger.error("Failed to change channel switch:{}", channel);
}

@ -0,0 +1,37 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.JsonUtils;
import com.alibaba.fastjson.JSONObject;
import java.util.function.Consumer;
public class SwitchChannelPermissionModify extends ClientModifyOperation {
private final MerchantInfoProvider mchInfoProvider;
private final MerchantChannelPermissionResolver channelResolver;
private final boolean enableFlag;
public SwitchChannelPermissionModify(JSONObject account, String clientMoniker, MerchantInfoProvider mchInfoProvider, MerchantChannelPermissionResolver channelResolver, boolean enableFlag) {
super(account, clientMoniker);
this.mchInfoProvider = mchInfoProvider;
this.channelResolver = channelResolver;
this.enableFlag = enableFlag;
}
@Override
protected String business() {
return (enableFlag ? "开启 " : "关闭 ") + "渠道[" + channelResolver.payChannel().getChannelCode() + "]";
}
@Override
protected JSONObject getModifyResult() {
return JsonUtils.newJson(json -> json.put("enable_" + channelResolver.payChannel().getChannelCode(), enableFlag + ""));
}
@Override
protected Consumer<JSONObject> getModifyProcess() {
return client -> channelResolver.switchPermission(mchInfoProvider, client.getIntValue("client_id"), enableFlag);
}
}
Loading…
Cancel
Save