三方支付
This commit is contained in:
parent
986f7507e7
commit
18b49c9db4
@ -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())
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user