实时汇率增加开关,默认关闭状态
This commit is contained in:
parent
8bdbeabb5b
commit
fe55265b08
@ -26,6 +26,7 @@ import com.red.circle.tool.core.num.ArithmeticUtils;
|
|||||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||||
import com.red.circle.tool.core.text.StringUtils;
|
import com.red.circle.tool.core.text.StringUtils;
|
||||||
import com.red.circle.other.inner.endpoint.user.region.UserRegionClient;
|
import com.red.circle.other.inner.endpoint.user.region.UserRegionClient;
|
||||||
|
import com.red.circle.order.app.common.PayerMaxProperties;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -44,7 +45,7 @@ import org.springframework.stereotype.Component;
|
|||||||
public class PayWebPlaceAnOrderCmdExe {
|
public class PayWebPlaceAnOrderCmdExe {
|
||||||
|
|
||||||
private final PayProperties payProperties;
|
private final PayProperties payProperties;
|
||||||
private final UserRegionClient userRegionClient;
|
private final PayerMaxProperties payerMaxProperties;
|
||||||
private final PayCountryService payCountryService;
|
private final PayCountryService payCountryService;
|
||||||
private final SysCountryCodeClient sysCountryCodeClient;
|
private final SysCountryCodeClient sysCountryCodeClient;
|
||||||
private final PayApplicationService payApplicationService;
|
private final PayApplicationService payApplicationService;
|
||||||
@ -131,6 +132,12 @@ public class PayWebPlaceAnOrderCmdExe {
|
|||||||
* @return 汇率
|
* @return 汇率
|
||||||
*/
|
*/
|
||||||
private BigDecimal getRealTimeExchangeRate(PayCountry payCountry) {
|
private BigDecimal getRealTimeExchangeRate(PayCountry payCountry) {
|
||||||
|
// 检查是否启用实时汇率
|
||||||
|
if (!Boolean.TRUE.equals(payerMaxProperties.getEnableRealTimeExchangeRate())) {
|
||||||
|
log.info("Real-time exchange rate is disabled, using configured rate for country {}", payCountry.getId());
|
||||||
|
return payCountry.getUsdExchangeRate();
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal realTimeRate = null;
|
BigDecimal realTimeRate = null;
|
||||||
try {
|
try {
|
||||||
// 调用实时汇率查询 - 这里假设目标币种是payCountry对应的币种
|
// 调用实时汇率查询 - 这里假设目标币种是payCountry对应的币种
|
||||||
|
|||||||
@ -21,6 +21,11 @@ public class PayerMaxProperties {
|
|||||||
private String platformRsaPublicKey;
|
private String platformRsaPublicKey;
|
||||||
private String appId;
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用实时汇率,默认为false(关闭)
|
||||||
|
*/
|
||||||
|
private Boolean enableRealTimeExchangeRate = false;
|
||||||
|
|
||||||
public String getSecretKey() {
|
public String getSecretKey() {
|
||||||
return secretKey;
|
return secretKey;
|
||||||
}
|
}
|
||||||
@ -68,4 +73,12 @@ public class PayerMaxProperties {
|
|||||||
public void setAppId(String appId) {
|
public void setAppId(String appId) {
|
||||||
this.appId = appId;
|
this.appId = appId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getEnableRealTimeExchangeRate() {
|
||||||
|
return enableRealTimeExchangeRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnableRealTimeExchangeRate(Boolean enableRealTimeExchangeRate) {
|
||||||
|
this.enableRealTimeExchangeRate = enableRealTimeExchangeRate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user