Merge branch 'develop'

master
taylor.dang 4 years ago
commit df8c9c2a02

@ -99,6 +99,9 @@ public interface ClientManager {
@Transactional @Transactional
void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow); void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow);
@Transactional
void modifyUPayProfile(JSONObject manager, String clientMoniker, String profileKey, boolean allow);
@Transactional @Transactional
void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow); void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow);
@ -210,6 +213,7 @@ public interface ClientManager {
/** /**
* Id * Id
*
* @param clientMoniker * @param clientMoniker
* @param client_type * @param client_type
* @param client_ids * @param client_ids
@ -307,6 +311,7 @@ public interface ClientManager {
/** /**
* *
*
* @param clientMoniker * @param clientMoniker
* @param manager * @param manager
*/ */

@ -1,19 +1,21 @@
package au.com.royalpay.payment.manage.merchants.core; package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify; import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
/** /**
* Create by yixian at 2018-04-12 16:24 * Create by yixian at 2018-04-12 16:24
*/ */
public interface ClientModifySupport { public interface ClientModifySupport {
void processModify(ClientModifyOperation modify);
void processClientModify(ClientModify clientModify); void processClientModify(ClientModify clientModify);
void processClientConfigModify(ClientConfigModify clientConfigModify); void processClientConfigModify(ClientModify clientConfigModify);
void processClientConfigModify(ClientConfigModify clientConfigModify, boolean onlyModifyConfig); void processClientConfigModify(ClientModify clientConfigModify, boolean onlyModifyConfig);
void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify); void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify);
} }

@ -1625,11 +1625,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow));
JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id"));
if (upayProfileInfo != null) {
upayProfileInfo.put(permissionKey, allow);
sysClientUpayProfileMapper.update(upayProfileInfo);
} }
@Override
@Transactional
public void modifyUPayProfile(JSONObject manager, String clientMoniker, String profileKey, boolean allow) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processModify(new CustomSwitchModify(manager, clientMoniker, profileKey, allow, cli -> {
JSONObject profileUpdate = new JSONObject();
profileUpdate.put(profileKey, allow);
profileUpdate.put("client_id", cli.getIntValue("client_id"));
sysClientUpayProfileMapper.update(profileUpdate);
}));
} }
@Override @Override

@ -5,11 +5,10 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper; import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify; import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -34,26 +33,36 @@ public class ClientModifySupportImpl implements ClientModifySupport {
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Override @Override
public void processClientModify(ClientModify modify) { public void processModify(ClientModifyOperation modify) {
int clientId = modify.doModify(merchantInfoProvider, clientMapper,mongoTemplate); int clientId = modify.processModify(merchantInfoProvider, mongoTemplate);
clientInfoCacheSupport.clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
public void processClientConfigModify(ClientConfigModify clientConfigModify) { public void processClientModify(ClientModify modify) {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate); processModify(modify.setModifyConsumer(modifyObj -> clientMapper.update(modifyObj)));
clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
public void processClientConfigModify(ClientConfigModify clientConfigModify,boolean onlyModifyConfig) { public void processClientConfigModify(ClientModify clientConfigModify) {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate,onlyModifyConfig); processModify(clientConfigModify.setModifyConsumer(modifyObj -> {
clientInfoCacheSupport.clearClientConfigCache(clientId); clientMapper.update(modifyObj);
clientConfigMapper.update(modifyObj);
}));
}
@Override
public void processClientConfigModify(ClientModify clientConfigModify, boolean onlyModifyConfig) {
processModify(clientConfigModify.setModifyConsumer(modifyObj -> {
if (!onlyModifyConfig) {
clientMapper.update(modifyObj);
}
clientConfigMapper.update(modifyObj);
}));
} }
@Override @Override
public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) { public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) {
int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate); processModify(clientGatewaySignModify.setMerchantSignInfoMapper(merchantSignInfoMapper));
clientInfoCacheSupport.clearClientCache(clientId);
} }
} }

@ -1,78 +1,39 @@
package au.com.royalpay.payment.manage.merchants.entity; package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper; import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.function.Consumer;
import java.util.stream.Collectors;
/** /**
* Create by yixian at 2018-04-12 16:19 * Create by yixian at 2018-04-12 16:19
*/ */
public abstract class ClientGatewaySignModify { public abstract class ClientGatewaySignModify extends ClientModifyOperation {
private JSONObject account; private MerchantSignInfoMapper merchantSignInfoMapper;
private String clientMoniker;
public ClientGatewaySignModify(JSONObject account, String clientMoniker) { public ClientGatewaySignModify(JSONObject account, String clientMoniker) {
this.account = account; super(account, clientMoniker);
this.clientMoniker = clientMoniker;
} }
protected abstract String business(); protected abstract String business();
protected abstract JSONObject getModifyResult(); protected abstract JSONObject getModifyResult();
@Transactional @Override
public int doModify(MerchantInfoProvider merchantInfoProvider, MerchantSignInfoMapper merchantSignInfoMapper, MongoTemplate mongoTemplate) { protected Consumer<JSONObject> getModifyProcess() {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); return client -> {
JSONObject clientGatewaySign = merchantSignInfoMapper.findClientSign(clientMoniker);
JSONObject modifyResult = getModifyResult(); JSONObject modifyResult = getModifyResult();
try { modifyResult.put("client_moniker", getClientMoniker());
saveModifyHistory(clientGatewaySign, modifyResult, mongoTemplate); modifyResult.put("last_update_by", getAccount().getString("account_id"));
}catch (Exception e){
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_moniker", clientMoniker);
modifyResult.put("last_update_by", account.getString("account_id"));
modifyResult.put("last_update_date", new Date()); modifyResult.put("last_update_date", new Date());
merchantSignInfoMapper.update(modifyResult); merchantSignInfoMapper.update(modifyResult);
return clientId; };
} }
private void saveModifyHistory(JSONObject clientGatewaySign, JSONObject modifyResult, MongoTemplate mongoTemplate) { public ClientGatewaySignModify setMerchantSignInfoMapper(MerchantSignInfoMapper merchantSignInfoMapper) {
if (account == null) { this.merchantSignInfoMapper = merchantSignInfoMapper;
return; return this;
}
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(clientGatewaySign.getIntValue("client_id"));
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, clientGatewaySign::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.save(clientConfigLog);
} }
} }

@ -1,77 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity; package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import java.util.function.Consumer;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* Create by yixian at 2018-04-12 16:19 * Create by yixian at 2018-04-12 16:19
*/ */
public abstract class ClientModify { public abstract class ClientModify extends ClientModifyOperation {
private JSONObject account;
private String clientMoniker; private Consumer<JSONObject> modifyConsumer;
public ClientModify(JSONObject account, String clientMoniker) { public ClientModify(JSONObject account, String clientMoniker) {
this.account = account; super(account, clientMoniker);
this.clientMoniker = clientMoniker;
} }
protected abstract String business(); @Override
protected Consumer<JSONObject> getModifyProcess() {
protected abstract JSONObject getModifyResult(); return client -> {
@Transactional
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientMapper clientMapper, MongoTemplate mongoTemplate) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult(); JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId); modifyResult.put("client_id", clientId);
clientMapper.update(modifyResult); modifyConsumer.accept(modifyResult);
return clientId; };
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) {
if (account == null) {
return;
} }
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(client.getIntValue("client_id"));
boolean isPartner = true; public ClientModify setModifyConsumer(Consumer<JSONObject> modifyConsumer) {
if (StringUtils.isNotEmpty(account.getString("account_id"))) { this.modifyConsumer = modifyConsumer;
isPartner = true; return this;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.save(clientConfigLog);
} }
} }

@ -1,32 +1,26 @@
package au.com.royalpay.payment.manage.merchants.entity; package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog; import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil; import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* Create by yixian at 2018-04-12 16:19 * Create by davep at 2020-05-12 14:32
*/ */
public abstract class ClientConfigModify { public abstract class ClientModifyOperation {
private final JSONObject account;
private JSONObject account; private final String clientMoniker;
private String clientMoniker;
public ClientConfigModify(JSONObject account, String clientMoniker) { protected ClientModifyOperation(JSONObject account, String clientMoniker) {
this.account = account; this.account = account;
this.clientMoniker = clientMoniker; this.clientMoniker = clientMoniker;
} }
@ -35,36 +29,21 @@ public abstract class ClientConfigModify {
protected abstract JSONObject getModifyResult(); protected abstract JSONObject getModifyResult();
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate) { protected abstract Consumer<JSONObject> getModifyProcess();
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientConfigMapper.update(modifyResult);
clientMapper.update(modifyResult);
return clientId;
}
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate,boolean onlyModifyConfig) { public int processModify(MerchantInfoProvider merchantInfoProvider, MongoTemplate mongoTemplate) {
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker); JSONObject client = merchantInfoProvider.getClientInfoByMoniker(getClientMoniker());
JSONObject modifyResult = getModifyResult(); JSONObject modifyResult = getModifyResult();
try { try {
saveModifyHistory(clientConfig, modifyResult, mongoTemplate); saveModifyHistory(client, modifyResult, mongoTemplate);
} catch (Exception e) { } catch (Exception e) {
} }
int clientId = clientConfig.getIntValue("client_id"); getModifyProcess().accept(client);
modifyResult.put("client_id", clientId); return client.getIntValue("client_id");
clientConfigMapper.update(modifyResult);
return clientId;
} }
private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) { protected void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) {
if (account == null) { if (account == null) {
return; return;
} }
@ -86,7 +65,15 @@ public abstract class ClientConfigModify {
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id")); clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get)); Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify)); clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name")); clientConfigLog.setUserName(account.getString("display_name"));
mongoTemplate.insert(clientConfigLog); mongoTemplate.insert(clientConfigLog);
} }
public JSONObject getAccount() {
return account;
}
public String getClientMoniker() {
return clientMoniker;
}
} }

@ -1,17 +1,17 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class CBBankPaypadVersionModify extends ClientConfigModify { public class CBBankPaypadVersionModify extends ClientModify {
private String cbbank_paypad_version; private String cbbankPaypadVersion;
public CBBankPaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) { public CBBankPaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) {
super(account, clientMoniker); super(account, clientMoniker);
this.cbbank_paypad_version = paypad_version; this.cbbankPaypadVersion = paypad_version;
} }
@Override @Override
@ -23,7 +23,7 @@ public class CBBankPaypadVersionModify extends ClientConfigModify {
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("cbbank_paypad_version", cbbank_paypad_version); modify.put("cbbank_paypad_version", cbbankPaypadVersion);
return modify; return modify;
} }
} }

@ -1,30 +1,29 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class ClearDaysModify extends ClientConfigModify { public class ClearDaysModify extends ClientModify {
private int settle_hour; private int settleHour;
public ClearDaysModify(JSONObject account, String clientMoniker, int settle_hour) { public ClearDaysModify(JSONObject account, String clientMoniker, int settleHour) {
super(account, clientMoniker); super(account, clientMoniker);
this.settle_hour = settle_hour; this.settleHour = settleHour;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户清算截止时间为:"+settle_hour; return "修改商户清算截止时间为:" + settleHour;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("settle_hour", settle_hour); modify.put("settle_hour", settleHour);
return modify; return modify;
} }
} }

@ -1,19 +1,18 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class CredentialCodeModify extends ClientConfigModify { public class CredentialCodeModify extends ClientModify {
private String credential_code; private String credentialCode;
public CredentialCodeModify(JSONObject account, String clientMoniker, String credential_code) { public CredentialCodeModify(JSONObject account, String clientMoniker, String credentialCode) {
super(account, clientMoniker); super(account, clientMoniker);
this.credential_code = credential_code; this.credentialCode = credentialCode;
} }
@Override @Override
@ -24,7 +23,7 @@ public class CredentialCodeModify extends ClientConfigModify {
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("credential_code", credential_code); modify.put("credential_code", credentialCode);
return modify; return modify;
} }
} }

@ -0,0 +1,43 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
import com.alibaba.fastjson.JSONObject;
import java.util.function.Consumer;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class CustomSwitchModify extends ClientModifyOperation {
private final String key;
private final boolean value;
private final Consumer<JSONObject> modifyProcess;
public CustomSwitchModify(JSONObject account, String clientMoniker, String key, boolean value, Consumer<JSONObject> modifyProcess) {
super(account, clientMoniker);
this.key = key;
this.value = value;
this.modifyProcess = modifyProcess;
}
@Override
protected String business() {
return (value ? "开启 " : "关闭 ") + key;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put(key, value);
return modify;
}
@Override
protected Consumer<JSONObject> getModifyProcess() {
return modifyProcess;
}
}

@ -1,7 +1,6 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -9,24 +8,24 @@ import java.math.BigDecimal;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class CustomerSurchargeRateModify extends ClientConfigModify { public class CustomerSurchargeRateModify extends ClientModify {
private BigDecimal customer_surcharge_rate; private BigDecimal customerSurchargeRate;
public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate) { public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customerSurchargeRate) {
super(account, clientMoniker); super(account, clientMoniker);
this.customer_surcharge_rate = customer_surcharge_rate; this.customerSurchargeRate = customerSurchargeRate;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户客户手续费率为:"+customer_surcharge_rate; return "修改商户客户手续费率为:" + customerSurchargeRate;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("customer_surcharge_rate", customer_surcharge_rate); modify.put("customer_surcharge_rate", customerSurchargeRate);
return modify; return modify;
} }
} }

@ -1,7 +1,6 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -9,24 +8,24 @@ import java.math.BigDecimal;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class EmailSendStandByModify extends ClientConfigModify { public class EmailSendStandByModify extends ClientModify {
private BigDecimal max_order_amount; private BigDecimal maxOrderAmount;
public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) { public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal maxOrderAmount) {
super(account, clientMoniker); super(account, clientMoniker);
this.max_order_amount = max_order_amount; this.maxOrderAmount = maxOrderAmount;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户最大订单额为:"+max_order_amount; return "修改商户最大订单额为:" + maxOrderAmount;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("max_order_amount", max_order_amount); modify.put("max_order_amount", maxOrderAmount);
return modify; return modify;
} }
} }

@ -1,7 +1,6 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -9,24 +8,24 @@ import java.math.BigDecimal;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class MaxOrderAmountModify extends ClientConfigModify { public class MaxOrderAmountModify extends ClientModify {
private BigDecimal max_order_amount; private BigDecimal maxOrderAmount;
public MaxOrderAmountModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) { public MaxOrderAmountModify(JSONObject account, String clientMoniker, BigDecimal maxOrderAmount) {
super(account, clientMoniker); super(account, clientMoniker);
this.max_order_amount = max_order_amount; this.maxOrderAmount = maxOrderAmount;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户最大订单额为:"+max_order_amount; return "修改商户最大订单额为:" + maxOrderAmount;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("max_order_amount", max_order_amount); modify.put("max_order_amount", maxOrderAmount);
return modify; return modify;
} }
} }

@ -1,19 +1,18 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class OrderExpiryModify extends ClientConfigModify { public class OrderExpiryModify extends ClientModify {
private String order_expiry_config; private String orderExpiryConfig;
public OrderExpiryModify(JSONObject account, String clientMoniker, String order_expiry_config) { public OrderExpiryModify(JSONObject account, String clientMoniker, String orderExpiryConfig) {
super(account, clientMoniker); super(account, clientMoniker);
this.order_expiry_config = order_expiry_config; this.orderExpiryConfig = orderExpiryConfig;
} }
@Override @Override
@ -24,7 +23,7 @@ public class OrderExpiryModify extends ClientConfigModify {
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("order_expiry_config", order_expiry_config); modify.put("order_expiry_config", orderExpiryConfig);
return modify; return modify;
} }
} }

@ -1,18 +1,17 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class PaypadVersionModify extends ClientConfigModify { public class PaypadVersionModify extends ClientModify {
private String paypad_version; private String paypadVersion;
public PaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) { public PaypadVersionModify(JSONObject account, String clientMoniker, String paypadVersion) {
super(account, clientMoniker); super(account, clientMoniker);
this.paypad_version = paypad_version; this.paypadVersion = paypadVersion;
} }
@Override @Override
@ -24,7 +23,7 @@ public class PaypadVersionModify extends ClientConfigModify {
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("paypad_version", paypad_version); modify.put("paypad_version", paypadVersion);
return modify; return modify;
} }
} }

@ -1,13 +1,12 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class RefundAuditModify extends ClientConfigModify { public class RefundAuditModify extends ClientModify {
private boolean enable; private boolean enable;
public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) { public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) {

@ -1,13 +1,12 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class RefundPWDModify extends ClientConfigModify { public class RefundPWDModify extends ClientModify {
private String refund_pwd; private String refund_pwd;
private String refund_pwd_salt; private String refund_pwd_salt;

@ -1,30 +1,29 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class SettleHourModify extends ClientConfigModify { public class SettleHourModify extends ClientModify {
private Integer settle_hour; private Integer settleHour;
public SettleHourModify(JSONObject account, String clientMoniker, Integer settle_hour) { public SettleHourModify(JSONObject account, String clientMoniker, Integer settleHour) {
super(account, clientMoniker); super(account, clientMoniker);
this.settle_hour = settle_hour; this.settleHour = settleHour;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户清算截止时间为:"+settle_hour; return "修改商户清算截止时间为:" + settleHour;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("settle_hour", settle_hour); modify.put("settle_hour", settleHour);
return modify; return modify;
} }
} }

@ -1,6 +1,5 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;

@ -1,6 +1,5 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;

@ -1,15 +1,14 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class SwitchPermissionModify extends ClientConfigModify { public class SwitchPermissionModify extends ClientModify {
private String key; private final String key;
private boolean value; private final boolean value;
public SwitchPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) { public SwitchPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) {
super(account, clientMoniker); super(account, clientMoniker);
@ -19,7 +18,6 @@ public class SwitchPermissionModify extends ClientConfigModify {
@Override @Override
protected String business() { protected String business() {
return (value ? "开启 " : "关闭 ") + key; return (value ? "开启 " : "关闭 ") + key;
} }

@ -990,7 +990,7 @@ public class PartnerManageController {
*/ */
@ManagerMapping(value = "/{clientMoniker}/payment_card_permission", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) @ManagerMapping(value = "/{clientMoniker}/payment_card_permission", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){
clientManager.switchPermission(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); clientManager.modifyUPayProfile(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow"));
} }
} }

Loading…
Cancel
Save