|
|
|
@ -12,7 +12,6 @@ import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.RPayPaymentCardSv
|
|
|
|
|
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
|
|
|
|
|
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.beans.SubMerchantInfo;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfoInheritance;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.beans.WechatMerchantInfo;
|
|
|
|
@ -20,10 +19,12 @@ import au.com.royalpay.payment.channels.wechat.runtime.impls.WxPayMerchantRegist
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.impls.WxPayMerchantRegisterLegacy;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.mappers.PaymentChannelMccGoodMapper;
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.mappers.WxMerchantApplyMapper;
|
|
|
|
|
import au.com.royalpay.payment.core.ChannelContractSource;
|
|
|
|
|
import au.com.royalpay.payment.core.PaymentApi;
|
|
|
|
|
import au.com.royalpay.payment.core.PaymentChannelApi;
|
|
|
|
|
import au.com.royalpay.payment.core.beans.ChannelMerchantInfo;
|
|
|
|
|
import au.com.royalpay.payment.core.beans.EmptyMerchantApplication;
|
|
|
|
|
import au.com.royalpay.payment.core.beans.MchChannelContract;
|
|
|
|
|
import au.com.royalpay.payment.core.beans.MerchantApplicationResult;
|
|
|
|
|
import au.com.royalpay.payment.core.exceptions.EmailException;
|
|
|
|
|
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
|
|
|
|
@ -551,11 +552,11 @@ 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 (resolver.newOrderEnabled(client)) {
|
|
|
|
|
if (!Objects.isNull(resolver) &&
|
|
|
|
|
resolver.newOrderEnabled(client, null, PlatformEnvironment.getEnv().getForeignCurrency())) {
|
|
|
|
|
client.put("enable_alipayplus", true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return client;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1078,31 +1079,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
JSONObject update = new JSONObject();
|
|
|
|
|
int clientId = client.getIntValue("client_id");
|
|
|
|
|
String originSubMerchantId = client.getString("sub_merchant_id");
|
|
|
|
|
update.put("client_id", clientId);
|
|
|
|
|
String subMerchantId = subMerchantInfo.getString("sub_merchant_id");
|
|
|
|
|
MpPaymentApi wxApi = (MpPaymentApi) paymentApi.channelApi(PayChannel.WECHAT.getChannelCode());
|
|
|
|
|
WeChatPayConfig.Merchant availableMerchant = wxApi.determineMerchant(subMerchantId);
|
|
|
|
|
update.put("merchant_id", availableMerchant == null ? null : availableMerchant.getMerchantId());
|
|
|
|
|
update.put("sub_merchant_id", subMerchantId);
|
|
|
|
|
ChannelContractSource wxContractSource = paymentApi.channelApi(PayChannel.WECHAT.getChannelCode()).initContractSource();
|
|
|
|
|
MchChannelContract contract = new MchChannelContract().setClientId(clientId).setMid(subMerchantId);
|
|
|
|
|
wxContractSource.saveContract(contract);
|
|
|
|
|
try {
|
|
|
|
|
recordSubMerchantLog(client, subMerchantInfo, manager);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("记录log_client_sub_merchant_id失败", e);
|
|
|
|
|
}
|
|
|
|
|
clientMapper.update(update);
|
|
|
|
|
List<JSONObject> children = clientMapper.listChildClients(clientId);
|
|
|
|
|
for (JSONObject child : children) {
|
|
|
|
|
if (Objects.equals(child.getString("sub_merchant_id"), originSubMerchantId)) {
|
|
|
|
|
update.put("client_id", child.getIntValue("client_id"));
|
|
|
|
|
MchChannelContract childContract = new MchChannelContract()
|
|
|
|
|
.setClientId(child.getIntValue("client_id"))
|
|
|
|
|
.setMid(subMerchantId);
|
|
|
|
|
try {
|
|
|
|
|
recordSubMerchantLog(child, subMerchantInfo, manager);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("记录log_client_sub_merchant_id失败", e);
|
|
|
|
|
}
|
|
|
|
|
clientMapper.update(update);
|
|
|
|
|
wxContractSource.saveContract(childContract);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|