apscashier mid加前缀00-

master
dalong306 3 years ago
parent a299e9ce41
commit f52e51ccf5

@ -32,6 +32,8 @@ import au.com.royalpay.payment.core.beans.MerchantApplicationResult;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.impls.MerchantChannelApplicationManager; import au.com.royalpay.payment.core.impls.MerchantChannelApplicationManager;
import au.com.royalpay.payment.core.mappers.MchChannelContractDAO;
import au.com.royalpay.payment.core.mappers.MchChannelContractMapper;
import au.com.royalpay.payment.core.mappers.SysClientMapper; import au.com.royalpay.payment.core.mappers.SysClientMapper;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
@ -87,6 +89,7 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage
import au.com.royalpay.payment.tools.connections.mpsupport.exceptions.WechatException; import au.com.royalpay.payment.tools.connections.mpsupport.exceptions.WechatException;
import au.com.royalpay.payment.tools.defines.IncrementalChannel; import au.com.royalpay.payment.tools.defines.IncrementalChannel;
import au.com.royalpay.payment.tools.defines.PayChannel; import au.com.royalpay.payment.tools.defines.PayChannel;
import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -331,7 +334,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ApsNoticeClientMapper apsNoticeClientMapper; private ApsNoticeClientMapper apsNoticeClientMapper;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy");
@Resource
private MchChannelContractMapper mchChannelContractMapper;
@Resource @Resource
private SmsSender smsSender; private SmsSender smsSender;
@ -555,6 +559,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("enable_alipayplus", true); client.put("enable_alipayplus", true);
} }
client.put("enable_alipayaps", false); client.put("enable_alipayaps", false);
Map<String, JSONObject> channelPermissions = new HashMap<>();
for (PaymentChannelApi channelApi : paymentApi.channels()) {
try {
MchChannelContract contract = channelApi.initContractSource().
findMchContract(client.getIntValue("client_id"), TradeType.CLIENT_CODE, PlatformEnvironment.getEnv().getForeignCurrencyEnum().toCurrencyInfo());
JSONObject config = new JSONObject();
config.put("channel", channelApi.channel());
if (contract != null) {
config.put("enable", contract.isValid());
config.put("pid", contract.getPid());
config.put("mid", contract.getMid());
config.put("mcc", contract.getMccCode());
logger.info("=====>mid:"+config.getString("channel")+":"+config.getString("mid"));
} else {
config.put("enable", false);
//aps渠道的默认值展示
if(channelApi.channel()==PayChannel.ALIPAY_APS_CASHIER.getChannelCode()){
config.put("mid", PlatformEnvironment.getEnv().getApsOnlinePrefix()+client.getString("client_moniker"));
}else if(channelApi.channel()==PayChannel.ALIPAY_APS_IN_STORE.getChannelCode()){
config.put("mid", client.getString("client_moniker"));
}
logger.info("=====>mid2:"+config.getString("channel")+":"+config.getString("mid"));
}
channelPermissions.put(channelApi.channel().toLowerCase(), config);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
client.put("available_channels", channelPermissions);
MerchantChannelPermissionResolver resolverApsInStore = this.paymentApi.channelApi(PayChannel.ALIPAY_APS_IN_STORE.getChannelCode()).getChannelPermissionResolver(); MerchantChannelPermissionResolver resolverApsInStore = this.paymentApi.channelApi(PayChannel.ALIPAY_APS_IN_STORE.getChannelCode()).getChannelPermissionResolver();
MerchantChannelPermissionResolver resolverApsCashier = this.paymentApi.channelApi(PayChannel.ALIPAY_APS_CASHIER.getChannelCode()).getChannelPermissionResolver(); MerchantChannelPermissionResolver resolverApsCashier = this.paymentApi.channelApi(PayChannel.ALIPAY_APS_CASHIER.getChannelCode()).getChannelPermissionResolver();
if (!Objects.isNull(resolverApsInStore) && !Objects.isNull(resolverApsCashier) && if (!Objects.isNull(resolverApsInStore) && !Objects.isNull(resolverApsCashier) &&
@ -7144,13 +7177,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("isRetail", isRetail); client.put("isRetail", isRetail);
String pid = ""; String pid = "";
if (isRetail) { if (isRetail) {
//todo 测试需要 先都改成线上,上线此处需要改成线下
pid = AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid(); pid = AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid();
} else { } else {
pid = AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid(); pid = AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid();
} }
client.put("pid", pid); client.put("pid", pid);
List<MchChannelContractDAO> channelContractDAOS = mchChannelContractMapper.listByPidClientId(isRetail ? PayChannel.ALIPAY_APS_IN_STORE.getChannelCode() : PayChannel.ALIPAY_APS_CASHIER.getChannelCode(), pid, client.getInteger("client_id"));
MchChannelContractDAO mchChannelContractDAO = channelContractDAOS.stream().max(Comparator.comparing(MchChannelContractDAO::getCreateTime)).orElse(null);
String mid = client.getString("client_moniker");
//数据库有数据
if (mchChannelContractDAO != null && StringUtils.isNotEmpty(mchChannelContractDAO.getMid())) {
mid = mchChannelContractDAO.getMid();
} else {
mid = client.getString("client_moniker");
PayChannel channel = isRetail ? PayChannel.ALIPAY_APS_IN_STORE : PayChannel.ALIPAY_APS_CASHIER;
if (channel == PayChannel.ALIPAY_APS_CASHIER) {
String apsOnlinePrefix = PlatformEnvironment.getEnv().getApsOnlinePrefix() != null ?
PlatformEnvironment.getEnv().getApsOnlinePrefix() : "00_";
mid = apsOnlinePrefix + mid;
}
}
client.put("mid", mid);
AlipayApsMerchantRegister alipayApsMerchantRegister = Optional.ofNullable(merchantChannelApplicationManager.getRegister(AlipayApsMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No AlipayAps registry found")); AlipayApsMerchantRegister alipayApsMerchantRegister = Optional.ofNullable(merchantChannelApplicationManager.getRegister(AlipayApsMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No AlipayAps registry found"));
AlipayPlusRegisterResult alipayPlusRegisterResult = alipayApsMerchantRegister.findMerchant(client); AlipayPlusRegisterResult alipayPlusRegisterResult = alipayApsMerchantRegister.findMerchant(client);
return alipayPlusRegisterResult.getRawResponse(); return alipayPlusRegisterResult.getRawResponse();

@ -2,7 +2,7 @@ server:
port: 5555 port: 5555
spring: spring:
profiles: profiles:
active: dev,alipay,bestpay,jd,wechat,rpay,yeepay,rppaysvc,common,alipayplusaps active: dev,alipay,bestpay,jd,wechat,rpay,yeepay,rppaysvc,common,alipayplusaps,apsinstore,apscashier
mail: mail:
host: '' host: ''
port: '' port: ''
@ -72,6 +72,7 @@ app:
control: control:
aes-key: Aa+MtthC4Ztq4Kfa9aL+UA== aes-key: Aa+MtthC4Ztq4Kfa9aL+UA==
run-tasks: false run-tasks: false
aps-online-prefix: '00-'
server: server:
ip: 127.0.0.1 ip: 127.0.0.1
settle: settle:

@ -245,8 +245,8 @@
<img src="/static/images/alipay_aps_big.svg" style="width: 20px;height: 20px;" <img src="/static/images/alipay_aps_big.svg" style="width: 20px;height: 20px;"
uib-tooltip="AlipayPlus" /> uib-tooltip="AlipayPlus" />
<h5 style="margin-left: 5px;"> <h5 style="margin-left: 5px;">
Alipay+(Retail) : <span ng-bind="partnerInfo.client_moniker"></span> Alipay+(Retail) : <span ng-bind="partnerInfo.available_channels.apsinstore.mid"></span>
<span ng-if="!partnerInfo.client_moniker">none</span> <span ng-if="!partnerInfo.available_channels.apsinstore.mid">none</span>
</h5> </h5>
</div> </div>
@ -284,8 +284,8 @@
<img src="/static/images/alipay_aps_big.svg" style="width: 20px;height: 20px;" <img src="/static/images/alipay_aps_big.svg" style="width: 20px;height: 20px;"
uib-tooltip="AlipayPlus" /> uib-tooltip="AlipayPlus" />
<h5 style="margin-left: 5px;"> <h5 style="margin-left: 5px;">
Alipay+(Online) : <span ng-bind="partnerInfo.client_moniker"></span> Alipay+(Online) : <span ng-bind="partnerInfo.available_channels.apscashier.mid"></span>
<span ng-if="!partnerInfo.client_moniker">none</span> <span ng-if="!partnerInfo.available_channels.apscashier.mid">none</span>
</h5> </h5>
</div> </div>

Loading…
Cancel
Save