package com.talentcard.server.business.payment.huifu; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "app.payment.huifu") public class HuifuPaymentProperties { private boolean enabled; private String environment = "test"; private String systemId = ""; private String productId = ""; private String merchantId = ""; private String miniProgramAppId = ""; private String privateKey = ""; private String platformPublicKey = ""; private String notifyUrl = ""; private String withdrawalProductId = ""; private String withdrawalNotifyUrl = ""; private String merchantBusinessNotifyUrl = ""; private String merchantOnboardingNotifyUrl = ""; private String merchantWechatConfigNotifyUrl = ""; private String merchantBusinessOpenNotifyUrl = ""; private String onboardingUpperHuifuId = ""; private String merchantWechatFeeRate = "0.60"; private String merchantOnlineBusinessType = "H5311L"; private String merchantOnlineMediaName = "东区人才卡"; private String merchantAgreementUrl = "https://cloudpnrcdn.oss-cn-shanghai.aliyuncs.com/opps/api/prod/download_file/PaymentServiceAgreement.htm"; private String withdrawalIntoAccountDateType = "DM"; private boolean delayAccount; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getEnvironment() { return environment; } public void setEnvironment(String environment) { this.environment = environment; } public String getSystemId() { return systemId; } public void setSystemId(String systemId) { this.systemId = systemId; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getMerchantId() { return merchantId; } public void setMerchantId(String merchantId) { this.merchantId = merchantId; } public String getMiniProgramAppId() { return miniProgramAppId; } public void setMiniProgramAppId(String miniProgramAppId) { this.miniProgramAppId = miniProgramAppId; } public String getPrivateKey() { return privateKey; } public void setPrivateKey(String privateKey) { this.privateKey = privateKey; } public String getPlatformPublicKey() { return platformPublicKey; } public void setPlatformPublicKey(String platformPublicKey) { this.platformPublicKey = platformPublicKey; } public String getNotifyUrl() { return notifyUrl; } public void setNotifyUrl(String notifyUrl) { this.notifyUrl = notifyUrl; } public String getWithdrawalProductId() { return withdrawalProductId; } public void setWithdrawalProductId(String withdrawalProductId) { this.withdrawalProductId = withdrawalProductId; } public String getWithdrawalNotifyUrl() { return withdrawalNotifyUrl; } public void setWithdrawalNotifyUrl(String withdrawalNotifyUrl) { this.withdrawalNotifyUrl = withdrawalNotifyUrl; } public String getMerchantBusinessNotifyUrl() { if (merchantBusinessNotifyUrl != null && !merchantBusinessNotifyUrl.isBlank()) return merchantBusinessNotifyUrl; return withdrawalNotifyUrl == null ? "" : withdrawalNotifyUrl.replace("/withdrawal-notify", "/merchant-business-notify"); } public void setMerchantBusinessNotifyUrl(String merchantBusinessNotifyUrl) { this.merchantBusinessNotifyUrl = merchantBusinessNotifyUrl; } public String getMerchantOnboardingNotifyUrl() { if (merchantOnboardingNotifyUrl != null && !merchantOnboardingNotifyUrl.isBlank()) return merchantOnboardingNotifyUrl; return withdrawalNotifyUrl == null ? "" : withdrawalNotifyUrl.replace("/withdrawal-notify", "/merchant-onboarding-notify"); } public void setMerchantOnboardingNotifyUrl(String merchantOnboardingNotifyUrl) { this.merchantOnboardingNotifyUrl = merchantOnboardingNotifyUrl; } public String getMerchantWechatConfigNotifyUrl() { if (merchantWechatConfigNotifyUrl != null && !merchantWechatConfigNotifyUrl.isBlank()) return merchantWechatConfigNotifyUrl; return callbackUrl("merchant-wechat-config-notify"); } public void setMerchantWechatConfigNotifyUrl(String merchantWechatConfigNotifyUrl) { this.merchantWechatConfigNotifyUrl = merchantWechatConfigNotifyUrl; } public String getMerchantBusinessOpenNotifyUrl() { if (merchantBusinessOpenNotifyUrl != null && !merchantBusinessOpenNotifyUrl.isBlank()) return merchantBusinessOpenNotifyUrl; return callbackUrl("merchant-business-open-notify"); } public void setMerchantBusinessOpenNotifyUrl(String merchantBusinessOpenNotifyUrl) { this.merchantBusinessOpenNotifyUrl = merchantBusinessOpenNotifyUrl; } public String getOnboardingUpperHuifuId() { if (onboardingUpperHuifuId != null && !onboardingUpperHuifuId.isBlank()) return onboardingUpperHuifuId; return merchantId; } public void setOnboardingUpperHuifuId(String onboardingUpperHuifuId) { this.onboardingUpperHuifuId = onboardingUpperHuifuId; } public String getMerchantWechatFeeRate() { return merchantWechatFeeRate; } public void setMerchantWechatFeeRate(String merchantWechatFeeRate) { this.merchantWechatFeeRate = merchantWechatFeeRate; } public String getMerchantOnlineBusinessType() { return merchantOnlineBusinessType; } public void setMerchantOnlineBusinessType(String merchantOnlineBusinessType) { this.merchantOnlineBusinessType = merchantOnlineBusinessType; } public String getMerchantOnlineMediaName() { return merchantOnlineMediaName; } public void setMerchantOnlineMediaName(String merchantOnlineMediaName) { this.merchantOnlineMediaName = merchantOnlineMediaName; } public String getMerchantAgreementUrl() { return merchantAgreementUrl; } public void setMerchantAgreementUrl(String merchantAgreementUrl) { this.merchantAgreementUrl = merchantAgreementUrl; } public String getWithdrawalIntoAccountDateType() { return withdrawalIntoAccountDateType; } public void setWithdrawalIntoAccountDateType(String withdrawalIntoAccountDateType) { this.withdrawalIntoAccountDateType = withdrawalIntoAccountDateType; } public boolean isDelayAccount() { return delayAccount; } public void setDelayAccount(boolean delayAccount) { this.delayAccount = delayAccount; } private String callbackUrl(String endpoint) { if (withdrawalNotifyUrl == null || withdrawalNotifyUrl.isBlank()) return ""; int slash = withdrawalNotifyUrl.lastIndexOf('/'); return slash < 0 ? "" : withdrawalNotifyUrl.substring(0, slash + 1) + endpoint; } }