|
|
|
@ -327,7 +327,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Resource
|
|
|
|
|
private SysClientUpayProfileMapper sysClientUpayProfileMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
|
@Resource
|
|
|
|
|
private MerchantChannelPermissionManager merchantChannelPermissionManager;
|
|
|
|
|
|
|
|
|
@ -551,7 +551,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
client.put("enable_alipayplus", false);
|
|
|
|
|
MerchantChannelPermissionResolver resolver = this.paymentApi.channelApi(PayChannel.ALIPAY_PLUS.getChannelCode()).getChannelPermissionResolver();
|
|
|
|
|
if(!Objects.isNull(resolver)) {
|
|
|
|
|
if (!Objects.isNull(resolver)) {
|
|
|
|
|
if (resolver.newOrderEnabled(client)) {
|
|
|
|
|
client.put("enable_alipayplus", true);
|
|
|
|
|
}
|
|
|
|
@ -1581,7 +1581,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Override
|
|
|
|
|
public void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow) {
|
|
|
|
|
for (PaymentChannelApi channelApi : paymentApi.channels()) {
|
|
|
|
|
if (channelApi.channel().equalsIgnoreCase(channel) ) {
|
|
|
|
|
if (channelApi.channel().equalsIgnoreCase(channel)) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new NotFoundException("Client Not Exists");
|
|
|
|
@ -1590,7 +1590,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
try {
|
|
|
|
|
clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("Failed to change channel switch:{}" ,channel);
|
|
|
|
|
logger.error("Failed to change channel switch:{}", channel);
|
|
|
|
|
}
|
|
|
|
|
logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow);
|
|
|
|
|
if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) {
|
|
|
|
@ -2013,21 +2013,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate");
|
|
|
|
|
addAlipayPlusRateConfig(config,clientId,PayChannel.ALIPAY_PLUS.getChannelCode());
|
|
|
|
|
addAlipayPlusRateConfig(config, clientId, PayChannel.ALIPAY_PLUS.getChannelCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addAlipayPlusRateConfig(JSONObject config,int clientId, String channel){
|
|
|
|
|
if (config.getString("alipay_cn_retail") != null){
|
|
|
|
|
config.put("pay_type","alipay_cn_retail");
|
|
|
|
|
private void addAlipayPlusRateConfig(JSONObject config, int clientId, String channel) {
|
|
|
|
|
if (config.getString("alipay_cn_retail") != null) {
|
|
|
|
|
config.put("pay_type", "alipay_cn_retail");
|
|
|
|
|
configNewClientRate(config, clientId, channel, "alipay_cn_retail", null, null);
|
|
|
|
|
}
|
|
|
|
|
if (config.getString("alipay_cn_online")!= null){
|
|
|
|
|
config.put("pay_type","alipay_cn_online");
|
|
|
|
|
configNewClientRate(config, clientId, channel, "alipay_cn_online", null,null);
|
|
|
|
|
if (config.getString("alipay_cn_online") != null) {
|
|
|
|
|
config.put("pay_type", "alipay_cn_online");
|
|
|
|
|
configNewClientRate(config, clientId, channel, "alipay_cn_online", null, null);
|
|
|
|
|
}
|
|
|
|
|
if (config.getString("alipay_other")!= null){
|
|
|
|
|
config.put("pay_type","alipay_other");
|
|
|
|
|
configNewClientRate(config, clientId, channel, "alipay_other", null,null);
|
|
|
|
|
if (config.getString("alipay_other") != null) {
|
|
|
|
|
config.put("pay_type", "alipay_other");
|
|
|
|
|
configNewClientRate(config, clientId, channel, "alipay_other", null, null);
|
|
|
|
|
}
|
|
|
|
|
config.remove("pay_type");
|
|
|
|
|
}
|
|
|
|
@ -2039,7 +2039,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
newConfig.putAll(config);
|
|
|
|
|
newConfig.put("rate_value", config.getBigDecimal(rateKey));
|
|
|
|
|
newConfig.put("rate_name", channel);
|
|
|
|
|
newConfig.put("pay_type",config.getString("pay_type"));
|
|
|
|
|
newConfig.put("pay_type", config.getString("pay_type"));
|
|
|
|
|
if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -2052,14 +2052,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
newConfig.put("ext_rates", extRateParams.toJSONString());
|
|
|
|
|
} else {
|
|
|
|
|
List<JSONObject> existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel);
|
|
|
|
|
existRate.stream().filter(existConfig->{
|
|
|
|
|
if(existConfig.getDate("active_time").equals(config.getDate("active_time")) && existConfig.getDate("expiry_time").equals(config.getDate("expiry_time")) ){
|
|
|
|
|
existRate.stream().filter(existConfig -> {
|
|
|
|
|
if (existConfig.getDate("active_time").equals(config.getDate("active_time")) && existConfig.getDate("expiry_time").equals(config.getDate("expiry_time"))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.forEach((rateLog)->{
|
|
|
|
|
.forEach((rateLog) -> {
|
|
|
|
|
rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1));
|
|
|
|
|
clientRateMapper.updateConfig(rateLog);
|
|
|
|
|
});
|
|
|
|
@ -5829,16 +5829,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
AlipayMerchantEntity alipayMch = merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).findMerchant(client);
|
|
|
|
|
Element resultElement = alipayMch.getRawResponseXml();
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
|
return "查询成功:" + resultElement.elementText("error");
|
|
|
|
|
try {
|
|
|
|
|
AlipayMerchantEntity alipayMch = merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).findMerchant(client);
|
|
|
|
|
Element responseElement = alipayMch.getRawResponseXml();
|
|
|
|
|
String rejectReason = responseElement.elementText("reject_reason");
|
|
|
|
|
return "查询成功:" + responseElement.elementText("secondary_merchant_id") +
|
|
|
|
|
"报备状态:" + responseElement.elementText("status") + StringUtils.defaultString(rejectReason, "");
|
|
|
|
|
}catch (BadRequestException e){
|
|
|
|
|
logger.error(e.getMessage(),e);
|
|
|
|
|
return e.getMessage();
|
|
|
|
|
}
|
|
|
|
|
Element responseElement = resultElement.element("response").element("alipay");
|
|
|
|
|
String rejectReason = responseElement.elementText("reject_reason");
|
|
|
|
|
return "查询成功:" + responseElement.elementText("secondary_merchant_id") +
|
|
|
|
|
"报备状态:" + responseElement.elementText("status") + StringUtils.defaultString(rejectReason, "");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -5969,17 +5969,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
|
|
|
|
|
AlipayMerchantEntity entity = merchantChannelApplicationManager.getRegister(AlipayOnlineApi.class)
|
|
|
|
|
.findMerchant(client);
|
|
|
|
|
Element resultElement = entity.getRawResponseXml();
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
|
return "查询成功:" + resultElement.elementText("error");
|
|
|
|
|
}
|
|
|
|
|
Element responseElement = resultElement.element("response").element("alipay");
|
|
|
|
|
String rejectReason = responseElement.elementText("reject_reason");
|
|
|
|
|
return "查询成功:" + responseElement.elementText("secondary_merchant_id") +
|
|
|
|
|
"报备状态:" + responseElement.elementText("status") + StringUtils.defaultString(rejectReason, "");
|
|
|
|
|
try {
|
|
|
|
|
AlipayMerchantEntity entity = merchantChannelApplicationManager.getRegister(AlipayOnlineApi.class)
|
|
|
|
|
.findMerchant(client);
|
|
|
|
|
Element responseElement = entity.getRawResponseXml();
|
|
|
|
|
String rejectReason = responseElement.elementText("reject_reason");
|
|
|
|
|
return "查询成功:" + responseElement.elementText("secondary_merchant_id") +
|
|
|
|
|
"报备状态:" + responseElement.elementText("status") + StringUtils.defaultString(rejectReason, "");
|
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
|
logger.error(e.getMessage(), e);
|
|
|
|
|
return e.getMessage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|