mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 18:26:16 +00:00
feat: expose site config in public/admin config responses
This commit is contained in:
@@ -158,6 +158,32 @@ var sensitiveSettingKeys = []string{
|
||||
mdb.SettingKeyInitAdminPasswordChanged,
|
||||
}
|
||||
|
||||
func getFirstNonEmptySetting(fallback string, keys ...string) string {
|
||||
for _, key := range keys {
|
||||
value := strings.TrimSpace(GetSettingString(key, ""))
|
||||
if value != "" {
|
||||
return value
|
||||
}
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
func GetBrandCashierName() string {
|
||||
return getFirstNonEmptySetting("", mdb.SettingKeyBrandCheckoutName, mdb.SettingKeyBrandSiteName)
|
||||
}
|
||||
|
||||
func GetBrandLogoURL() string {
|
||||
return strings.TrimSpace(GetSettingString(mdb.SettingKeyBrandLogoUrl, ""))
|
||||
}
|
||||
|
||||
func GetBrandWebsiteTitle() string {
|
||||
return getFirstNonEmptySetting("", mdb.SettingKeyBrandSiteTitle, mdb.SettingKeyBrandPageTitle)
|
||||
}
|
||||
|
||||
func GetBrandSupportURL() string {
|
||||
return strings.TrimSpace(GetSettingString(mdb.SettingKeyBrandSupportUrl, ""))
|
||||
}
|
||||
|
||||
// OkPay settings helpers keep the provider-specific defaults in one place so
|
||||
// business logic does not need to repeat raw settings keys.
|
||||
func GetOkPayEnabled() bool {
|
||||
|
||||
@@ -30,9 +30,12 @@ const (
|
||||
SettingKeyInitAdminPasswordFetched = "system.init_admin_password_fetched"
|
||||
SettingKeyInitAdminPasswordChanged = "system.init_admin_password_changed"
|
||||
SettingKeyOrderExpiration = "system.order_expiration_time"
|
||||
SettingKeyBrandCheckoutName = "brand.checkout_name"
|
||||
SettingKeyBrandSiteName = "brand.site_name"
|
||||
SettingKeyBrandLogoUrl = "brand.logo_url"
|
||||
SettingKeyBrandSiteTitle = "brand.site_title"
|
||||
SettingKeyBrandPageTitle = "brand.page_title"
|
||||
SettingKeyBrandSuccessCopy = "brand.success_copy"
|
||||
SettingKeyBrandPaySuccess = "brand.pay_success_text"
|
||||
SettingKeyBrandSupportUrl = "brand.support_url"
|
||||
SettingKeyRateForcedUsdt = "rate.forced_usdt_rate"
|
||||
|
||||
@@ -11,6 +11,13 @@ type EpayPublicConfig struct {
|
||||
DefaultNetwork string `json:"default_network" example:"tron"`
|
||||
}
|
||||
|
||||
type SitePublicConfig struct {
|
||||
CashierName string `json:"cashier_name" example:"Acme Cashier"`
|
||||
LogoURL string `json:"logo_url" example:"https://cdn.example.com/logo.png"`
|
||||
WebsiteTitle string `json:"website_title" example:"Acme Payments"`
|
||||
SupportLink string `json:"support_link" example:"https://example.com/support"`
|
||||
}
|
||||
|
||||
type OkPayPublicConfig struct {
|
||||
Enabled bool `json:"enabled" example:"true"`
|
||||
AllowTokens []string `json:"allow_tokens" example:"USDT,TRX"`
|
||||
@@ -24,6 +31,7 @@ type OkPayPublicConfig struct {
|
||||
|
||||
type PublicConfigResponse struct {
|
||||
SupportedAssets []NetworkTokenSupport `json:"supported_assets"`
|
||||
Site SitePublicConfig `json:"site"`
|
||||
Epay EpayPublicConfig `json:"epay"`
|
||||
OkPay OkPayPublicConfig `json:"okpay"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user