|
|
|
@ -13,9 +13,6 @@ import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo;
|
|
|
|
|
import au.com.royalpay.payment.channels.yeepay.config.YeePayConfig;
|
|
|
|
|
import au.com.royalpay.payment.channels.yeepay.mappers.YeePayClientConfigMapper;
|
|
|
|
|
import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
|
|
|
|
|
import au.com.royalpay.payment.core.PaymentChannelApi;
|
|
|
|
|
import au.com.royalpay.payment.core.beans.EmptyMerchantApplication;
|
|
|
|
|
import au.com.royalpay.payment.core.beans.MerchantApplicationResult;
|
|
|
|
@ -93,7 +90,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
import com.yeepay.yop.sdk.service.kj.model.SubmerchantRegisterResult;
|
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
@ -228,15 +224,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Resource
|
|
|
|
|
private RpayApi rpayApi;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private YeePayClient yeePayClient;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private YeePayConfig yeePayConfig;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private YeePayClientConfigMapper yeePayClientConfigMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ManagerMapper managerMapper;
|
|
|
|
|
@Resource
|
|
|
|
@ -452,14 +439,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (upayInfo != null) {
|
|
|
|
|
client.putAll(upayInfo);
|
|
|
|
|
}
|
|
|
|
|
client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) == null ? false : true);
|
|
|
|
|
client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) != null);
|
|
|
|
|
client.put("show_all_permission", true);
|
|
|
|
|
int role = manager != null ? manager.getIntValue("role") : 0;
|
|
|
|
|
if (manager != null) {
|
|
|
|
|
if (ManagerRole.OPERATOR.hasRole(role)) {
|
|
|
|
|
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),
|
|
|
|
|
new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
|
client.put("sub_merchant_id_log", log.size() > 0 ? true : false);
|
|
|
|
|
client.put("sub_merchant_id_log", log.size() > 0);
|
|
|
|
|
}
|
|
|
|
|
if (ManagerRole.BD_USER.hasRole(role)) {
|
|
|
|
|
int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id"));
|
|
|
|
@ -520,15 +507,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
client.put("audit_card_logs", audit_card_logs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//HF支付链接二维码
|
|
|
|
|
if (client.getString("hf_pay_url") != null) {
|
|
|
|
|
String hfQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + client.getString("client_moniker") + "/jump/app");
|
|
|
|
|
client.put("hfQrcodeUrl", QRCodeUtils.qrcodeImageCode(hfQrcodeUrl, 250, true));
|
|
|
|
|
}
|
|
|
|
|
if (client.getString("yeepay_pay_url") != null) {
|
|
|
|
|
String yeepayQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/yeepay/partners/" + client.getString("client_moniker") + "/jump/app");
|
|
|
|
|
client.put("yeepayQrcodeUrl", QRCodeUtils.qrcodeImageCode(yeepayQrcodeUrl, 250, true));
|
|
|
|
|
}
|
|
|
|
|
if (client.getString("cb_bankpay_url") != null) {
|
|
|
|
|
String cbBankPayQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/sys/partners/" + client.getString("client_moniker") + "/cb_bankpay/link");
|
|
|
|
|
client.put("cbBankPayQrcodeUrl", QRCodeUtils.qrcodeImageCode(cbBankPayQrcodeUrl, 250, true));
|
|
|
|
@ -574,6 +552,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
List<JSONObject> children = clientMapper.listChildClients(client.getIntValue("client_id"));
|
|
|
|
|
client.put("has_children", !children.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
assert client != null;
|
|
|
|
|
client.putAll(clientConfigService.find(clientId));
|
|
|
|
|
return client;
|
|
|
|
|
}
|
|
|
|
@ -1080,7 +1059,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
JSONObject update = new JSONObject();
|
|
|
|
|
int clientId = client.getIntValue("client_id");
|
|
|
|
|
String originSubMerchantId = client.getString("rpay_enterprise_id");
|
|
|
|
|
update.put("client_id", clientId);
|
|
|
|
|
String subMerchantId = rpaySubMerchantInfo.getString("rpay_enterprise_id");
|
|
|
|
|
update.put("rpay_enterprise_id", subMerchantId);
|
|
|
|
@ -1093,25 +1071,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
@Override
|
|
|
|
|
public void updateClientYeepayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject yeepaySubMerchantInfo) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
if (client.getString("yeepay_sub_merchant_id").equals(yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"))) {
|
|
|
|
|
throw new BadRequestException("The sub merchant Id is in use");
|
|
|
|
|
}
|
|
|
|
|
JSONObject yeepayConfigValid = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id"));
|
|
|
|
|
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"), 0);
|
|
|
|
|
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
|
|
|
|
|
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"), 1);
|
|
|
|
|
client.put("yeepay_sub_merchant_id", yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
|
|
|
|
|
clientMapper.update(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
@ -1665,9 +1624,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow));
|
|
|
|
|
JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id"));
|
|
|
|
|
upayProfileInfo.put(permissionKey, allow);
|
|
|
|
|
sysClientUpayProfileMapper.update(upayProfileInfo);
|
|
|
|
|
if (upayProfileInfo != null) {
|
|
|
|
|
upayProfileInfo.put(permissionKey, allow);
|
|
|
|
|
sysClientUpayProfileMapper.update(upayProfileInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1678,12 +1640,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new NotFoundException("Client Not Exists");
|
|
|
|
|
}
|
|
|
|
|
if (channel.equals("hf") && !allow && client.getBoolean("enable_hf_email_notice")) {
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_hf_email_notice", allow));
|
|
|
|
|
}
|
|
|
|
|
if (channel.equals("yeepay") && !allow && client.getBoolean("enable_yeepay_email_notice")) {
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_yeepay_email_notice", allow));
|
|
|
|
|
}
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow));
|
|
|
|
|
|
|
|
|
|
logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel "
|
|
|
|
@ -2089,25 +2045,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
checkAddRate(config, "Wechat", "wechat_rate_value", org, "min_wechat_rate");
|
|
|
|
|
checkAddRate(config, "Alipay", "alipay_rate_value", org, "min_alipay_rate");
|
|
|
|
|
checkAddRate(config, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
|
|
|
|
|
checkAddRate(config, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate");
|
|
|
|
|
checkAddRate(config, "jd", "jd_rate_value", org, "min_jd_rate");
|
|
|
|
|
// checkAddRate(config, "hf", "hf_rate_value", org, "min_hf_rate");
|
|
|
|
|
checkAddRate(config, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate");
|
|
|
|
|
// checkAddRate(config, "Yeepay", "yeepay_rate_value", org, "min_yeepay_rate");
|
|
|
|
|
checkAddRate(config, "CB_BankPay", "min_cb_bankpay_value", org, "min_cb_bankpay_rate");
|
|
|
|
|
|
|
|
|
|
configNewClientRate(config, clientId, "Wechat", "wechat_rate_value", org, "min_wechat_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "Alipay", "alipay_rate_value", org, "min_alipay_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "jd", "jd_rate_value", org, "min_jd_rate");
|
|
|
|
|
// configNewClientRate(config, clientId, "hf", "hf_rate_value", org, "min_hf_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate");
|
|
|
|
|
// configNewClientRate(config, clientId, "Yeepay", "yeepay_rate_value", org, "min_yeepay_rate");
|
|
|
|
|
configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate");
|
|
|
|
|
//todo 暂不更新Rpay+ 费率信息
|
|
|
|
|
//rpayApi.modifySurchargeConfig(client);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) {
|
|
|
|
@ -2150,8 +2095,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
checkModifyRate(org, configJson, "Wechat", "min_wechat_rate");
|
|
|
|
|
checkModifyRate(org, configJson, "Alipay", "min_alipay_rate");
|
|
|
|
|
checkModifyRate(org, configJson, "AlipayOnline", "min_alipayonline_rate");
|
|
|
|
|
checkModifyRate(org, configJson, "jd", "min_jd_rate");
|
|
|
|
|
checkModifyRate(org, configJson, "Bestpay", "min_bestpay_rate");
|
|
|
|
|
configJson.put("client_rate_id", rateId);
|
|
|
|
|
configJson.put("manager_id", manager.getString("manager_id"));
|
|
|
|
|
configJson.put("manager_name", manager.getString("username"));
|
|
|
|
@ -2162,9 +2105,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
configJson.put("ext_rates", extParams.toJSONString());
|
|
|
|
|
}
|
|
|
|
|
clientRateMapper.updateConfig(configJson);
|
|
|
|
|
// if ("Rpay".equals(configJson.getString("rate_name"))) {
|
|
|
|
|
// rpayApi.modifySurchargeConfig(client);
|
|
|
|
|
// }
|
|
|
|
|
if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getRateName())) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -2174,7 +2114,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) {
|
|
|
|
|
clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays));
|
|
|
|
|
}
|
|
|
|
|
// clientMapper.updateCleanDays(clientId, config.getCleanDays());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkModifyRate(JSONObject org, JSONObject configJson, String rateName, String rateValueKey) {
|
|
|
|
@ -2451,23 +2390,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
|
|
|
|
|
if (bestPayRate != null) {
|
|
|
|
|
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
|
|
|
|
|
if (jdRate != null) {
|
|
|
|
|
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days"));
|
|
|
|
|
client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (bankAccount == null || bankAccount.size() <= 0) {
|
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
@ -3103,27 +3025,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// List<JSONObject> clientRate = clientRateMapper.latestConfig(client.getIntValue("client_id"), null);
|
|
|
|
|
// if (CollectionUtils.isEmpty(clientRate)) {
|
|
|
|
|
// throw new BadRequestException("The Partner's Rate is not config!");
|
|
|
|
|
// }
|
|
|
|
|
// clientRate.forEach((p) -> {
|
|
|
|
|
// String rate_name = p.getString("rate_name");
|
|
|
|
|
// if ("Wechat".equals(rate_name)) {
|
|
|
|
|
// client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
// client.put("clean", "T+" + p.getString("clean_days"));
|
|
|
|
|
// client.put("clean_days", p.getString("clean_days"));
|
|
|
|
|
// } else if ("Alipay".equals(rate_name)) {
|
|
|
|
|
// client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
// } else if ("Bestpay".equals(rate_name)) {
|
|
|
|
|
// client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
// } else if ("jd".equals(rate_name)) {
|
|
|
|
|
// client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
// } else if ("AlipayOnline".equals(rate_name)) {
|
|
|
|
|
// client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
|
|
|
|
|
if (weChatRate == null) {
|
|
|
|
|
throw new BadRequestException("The Partner's Rate is not config!");
|
|
|
|
@ -3137,17 +3038,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (alipayRate != null) {
|
|
|
|
|
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
|
|
|
|
|
if (bestPayRate != null) {
|
|
|
|
|
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
|
|
|
|
|
if (jdRate != null) {
|
|
|
|
|
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
|
|
|
|
|
if (alipayOnlineRate != null) {
|
|
|
|
|
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
@ -3252,11 +3142,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
client.put("clean_days", p.getString("clean_days"));
|
|
|
|
|
} else if ("Alipay".equals(rate_name)) {
|
|
|
|
|
client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
} else if ("Bestpay".equals(rate_name)) {
|
|
|
|
|
client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
} else if ("jd".equals(rate_name)) {
|
|
|
|
|
client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
} else if ("AlipayOnline".equals(rate_name)) {
|
|
|
|
|
}else if ("AlipayOnline".equals(rate_name)) {
|
|
|
|
|
client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -3332,16 +3218,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
|
|
|
|
|
if (bestPayRate != null) {
|
|
|
|
|
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
|
|
|
|
|
if (jdRate != null) {
|
|
|
|
|
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
|
|
|
|
|
if (alipayOnlineRate != null) {
|
|
|
|
|
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
@ -4240,22 +4116,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
|
|
|
|
|
if (bestPayRate != null) {
|
|
|
|
|
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
|
|
|
|
|
if (jdRate != null) {
|
|
|
|
|
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days"));
|
|
|
|
|
client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (bankAccount == null || bankAccount.size() <= 0) {
|
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
@ -5885,20 +5745,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
List<JSONObject> applices = yeePayClientConfigMapper.findAllMerchantConfig(client.getInteger("client_id"));
|
|
|
|
|
if (!applices.isEmpty()) {
|
|
|
|
|
return applices;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
|
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) {
|
|
|
|
@ -6159,116 +6005,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
List<JSONObject> yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id"));
|
|
|
|
|
if (yeepayClientConfigs != null) {
|
|
|
|
|
for (JSONObject yeepayClientConfig : yeepayClientConfigs) {
|
|
|
|
|
if (yeepayClientConfig.getIntValue("is_valid") == 1) {
|
|
|
|
|
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
merchantInfo.put("create_time", new Date());
|
|
|
|
|
merchantInfo.put("operator", manager.getString("display_name"));
|
|
|
|
|
merchantInfo.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
merchantInfo.put("client_id", merchantInfo.getString("client_id"));
|
|
|
|
|
// merchantInfo.put("vouchers",merchantInfo.getJSONObject("vouchers").toJSONString());
|
|
|
|
|
List<JSONObject> directorsAll = new ArrayList<>();
|
|
|
|
|
List<JSONObject> executivesAll = new ArrayList<>();
|
|
|
|
|
directorsAll.add(merchantInfo.getJSONObject("directors"));
|
|
|
|
|
executivesAll.add(merchantInfo.getJSONObject("executives"));
|
|
|
|
|
JSONObject extInfo = new JSONObject();
|
|
|
|
|
extInfo.put("directors", directorsAll);
|
|
|
|
|
extInfo.put("executives", executivesAll);
|
|
|
|
|
merchantInfo.put("extinfo", extInfo.toJSONString());
|
|
|
|
|
yeePayClientConfigMapper.saveMerchantConfig(merchantInfo);
|
|
|
|
|
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id"));
|
|
|
|
|
yeepayConfig.put("company_website", merchantInfo.getString("company_website"));
|
|
|
|
|
yeepayConfig.put("abn", merchantInfo.getString("abn"));
|
|
|
|
|
yeepayConfig.put("company_name", merchantInfo.getString("company_name"));
|
|
|
|
|
yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone"));
|
|
|
|
|
yeepayConfig.put("contact_email", merchantInfo.getString("contact_email"));
|
|
|
|
|
yeepayConfig.put("contact_person", merchantInfo.getString("contact_person"));
|
|
|
|
|
SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig);
|
|
|
|
|
if (result.getStatus().equals("FAILED")) {
|
|
|
|
|
throw new BadRequestException(result.getErrorMsg());
|
|
|
|
|
}
|
|
|
|
|
yeepayConfig.put("sub_merchant_id", result.getSubMerchantId());
|
|
|
|
|
yeePayClientConfigMapper.updateSubMerchantId(yeepayConfig.getString("yeepay_config_id"), result.getMerchantId(), result.getSubMerchantId());
|
|
|
|
|
client.put("yeepay_sub_merchant_id", result.getSubMerchantId());
|
|
|
|
|
clientMapper.update(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
JSONObject config = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("sub_merchant_id"));
|
|
|
|
|
if (config != null) {
|
|
|
|
|
throw new BadRequestException("You had add the sub merchant id");
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id"));
|
|
|
|
|
if (yeepayClientConfigs != null) {
|
|
|
|
|
for (JSONObject yeepayClientConfig : yeepayClientConfigs) {
|
|
|
|
|
if (yeepayClientConfig.getIntValue("is_valid") == 1) {
|
|
|
|
|
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
merchantInfo.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
merchantInfo.put("merchant_id", yeePayConfig.getAppKey().split("_")[1]);
|
|
|
|
|
merchantInfo.put("create_time", new Date());
|
|
|
|
|
merchantInfo.put("is_valid", 1);
|
|
|
|
|
merchantInfo.put("operator", manager.getString("display_name"));
|
|
|
|
|
yeePayClientConfigMapper.saveMerchantConfig(merchantInfo);
|
|
|
|
|
client.put("yeepay_sub_merchant_id", merchantInfo.getString("sub_merchant_id"));
|
|
|
|
|
clientMapper.update(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("subMerchantId"));
|
|
|
|
|
List<JSONObject> directorsAll = new ArrayList<>();
|
|
|
|
|
List<JSONObject> executivesAll = new ArrayList<>();
|
|
|
|
|
directorsAll.add(merchantInfo.getJSONObject("directors"));
|
|
|
|
|
executivesAll.add(merchantInfo.getJSONObject("executives"));
|
|
|
|
|
JSONObject extInfo = new JSONObject();
|
|
|
|
|
extInfo.put("directors", directorsAll);
|
|
|
|
|
extInfo.put("executives", executivesAll);
|
|
|
|
|
yeepayConfig.put("extinfo", extInfo.toJSONString());
|
|
|
|
|
yeepayConfig.put("industry", merchantInfo.getString("industry"));
|
|
|
|
|
yeepayConfig.put("business_content", merchantInfo.getString("business_content"));
|
|
|
|
|
yeepayConfig.put("business_licence", merchantInfo.getString("business_licence"));
|
|
|
|
|
yeePayClientConfigMapper.update(yeepayConfig);
|
|
|
|
|
yeepayConfig.put("company_website", merchantInfo.getString("company_website"));
|
|
|
|
|
yeepayConfig.put("abn", merchantInfo.getString("abn"));
|
|
|
|
|
yeepayConfig.put("company_name", merchantInfo.getString("company_name"));
|
|
|
|
|
yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone"));
|
|
|
|
|
yeepayConfig.put("contact_email", merchantInfo.getString("contact_email"));
|
|
|
|
|
yeepayConfig.put("contact_person", merchantInfo.getString("contact_person"));
|
|
|
|
|
yeepayConfig.put("mode", "UPDATE");
|
|
|
|
|
SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig);
|
|
|
|
|
if (result.getStatus().equals("FAILED")) {
|
|
|
|
|
throw new BadRequestException(result.getErrorMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
@ -6609,7 +6345,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
ctx.setVariable("order_id", order.getString("order_id"));
|
|
|
|
|
ctx.setVariable("amount", order.getString("total_amount"));
|
|
|
|
|
ctx.setVariable("currency", order.getString("currency"));
|
|
|
|
|
ctx.setVariable("channel", getOrderChannel(order.getString("channel")));
|
|
|
|
|
ctx.setVariable("channel", order.getString("channel"));
|
|
|
|
|
String create_time = "";
|
|
|
|
|
if (client.getString("timezone") != null) {
|
|
|
|
|
create_time = DateFormatUtils.format(order.getDate("create_time"),
|
|
|
|
@ -6632,16 +6368,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getOrderChannel(String channel) {
|
|
|
|
|
switch (channel) {
|
|
|
|
|
case "hf":
|
|
|
|
|
return "汇付";
|
|
|
|
|
case "Yeepay":
|
|
|
|
|
return "易宝支付";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAllPartnerPassword(String clientMoniker) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
@ -7392,6 +7118,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new BadRequestException("rpaypmt_card rate Not configured");
|
|
|
|
|
}
|
|
|
|
|
JSONObject cardRate = clientRate.getJSONObject("ext_rates");
|
|
|
|
|
//增加transaction_fee为null异常
|
|
|
|
|
if (!cardRate.containsKey("transaction_fee") || StringUtils.isEmpty(cardRate.getString("transaction_fee"))) {
|
|
|
|
|
cardRate.put("transaction_fee", BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
JSONObject bankAccountInfo = clientBankAccountMapper.clientBankAccounts(clientId).get(0);
|
|
|
|
|
JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId);
|
|
|
|
|
JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId);
|
|
|
|
|