三方支付

This commit is contained in:
hy001 2026-06-25 22:37:00 +08:00
parent 986f7507e7
commit 18b49c9db4
3 changed files with 29 additions and 4 deletions

View File

@ -49,6 +49,14 @@ public class PayCountryAliasResolver {
return getMappedUsablePayCountryByCountryId(countryId);
}
public PayCountry resolvePayCountryByCountryId(Long countryId) {
PayCountry usablePayCountry = resolveUsablePayCountryByCountryId(countryId);
if (Objects.nonNull(usablePayCountry)) {
return usablePayCountry;
}
return getShelfPayCountryByCountryId(countryId);
}
private PayCountry getMappedUsablePayCountryByCountryId(Long countryId) {
SysCountryCodeDTO countryCode = getCountryCodeById(countryId);
if (Objects.isNull(countryCode)) {
@ -114,6 +122,21 @@ public class PayCountryAliasResolver {
.orElse(null);
}
private PayCountry getShelfPayCountryByCountryId(Long countryId) {
if (Objects.isNull(countryId)) {
return null;
}
return payCountryService.query()
.eq(PayCountry::getShelf, Boolean.TRUE)
.eq(PayCountry::getCountryId, countryId)
.orderByDesc(PayCountry::getSort)
.list()
.stream()
.findFirst()
.orElse(null);
}
private boolean isUsablePayCountry(PayCountry payCountry) {
return Objects.nonNull(payCountry)
&& StringUtils.isNotBlank(payCountry.getCurrency())

View File

@ -120,8 +120,10 @@ public class PayWebApplicationCommodityV2QueryExe {
private List<PayApplicationCommodity> getPayApplicationCommodities(
PayWebApplicationCommodityCmd cmd) {
if (Objects.equals(cmd.requireReqSysOriginChildEnum(), SysOriginPlatformEnum.YOLO)
|| StringUtils.isNotBlank(cmd.getRegionId())) {
// Yumi/LIKEI H5 已经先按用户资料拿到国家商品应按国家查regionId 只保留给旧的区域商品链路.
if (Objects.equals(cmd.requireReqSysOriginChildEnum(), SysOriginPlatformEnum.YOLO)
|| (StringUtils.isNotBlank(cmd.getRegionId())
&& StringUtils.isBlank(cmd.getCountryCode()))) {
ResponseAssert
.isTrue(CommonErrorCode.NOT_SUPPORTED_REGION, StringUtils.isNotBlank(cmd.getRegionId()));
@ -179,7 +181,7 @@ public class PayWebApplicationCommodityV2QueryExe {
sysCountryCodeClient.getByCode(normalizedCountryCode));
ResponseAssert.notNull(CommonErrorCode.NOT_SUPPORTED_REGION, countryCode);
// H5 只传用户国家码这里仅把真实国家转成商品表使用的支付国家ID是否开放支付国家由 H5 JSON 控制.
return payCountryAliasResolver.resolveUsablePayCountryByCountryId(countryCode.getId());
return payCountryAliasResolver.resolvePayCountryByCountryId(countryCode.getId());
}
private List<PayChannelDetailsCO> getPayChannels(List<PayChannel> payChannels,

View File

@ -103,7 +103,7 @@ public class UserProfileAndCountryQueryExe {
ResponseAssert.notNull(CommonErrorCode.NOT_SUPPORTED_REGION, countryCode);
PayCountry compatiblePayCountry = payCountryAliasResolver
.resolveUsablePayCountryByCountryId(countryCode.getId());
.resolvePayCountryByCountryId(countryCode.getId());
// LIKEI/Yumi 的支付国家开放由 H5 JSON 控制这里仅返回用户真实国家商品接口再按国家码查该国商品.
PayCountryCO payCountryCO = new PayCountryCO()