mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 10:16:15 +00:00
feat: expose site config in public/admin config responses
This commit is contained in:
@@ -35,11 +35,14 @@ import (
|
||||
// okpay.allow_tokens (string) — comma-separated allowed tokens, e.g. "USDT,TRX"
|
||||
//
|
||||
// - group=brand:
|
||||
// brand.site_name (string) — site display name
|
||||
// brand.checkout_name (string) — cashier display name (preferred)
|
||||
// brand.logo_url (string) — logo image URL
|
||||
// brand.page_title (string) — payment page title
|
||||
// brand.pay_success_text (string) — text shown on payment success
|
||||
// brand.site_title (string) — payment page title / website title (preferred)
|
||||
// brand.success_copy (string) — text shown on payment success (preferred)
|
||||
// brand.support_url (string) — support / help URL
|
||||
// brand.site_name (string) — legacy cashier/site display name
|
||||
// brand.page_title (string) — legacy payment page title
|
||||
// brand.pay_success_text (string) — legacy success text
|
||||
//
|
||||
// - group=system:
|
||||
// system.order_expiration_time (int) — order expiry in minutes
|
||||
@@ -85,7 +88,7 @@ func (c *BaseAdminController) ListSettings(ctx echo.Context) error {
|
||||
// @Description epay group keys: epay.default_token (e.g. "usdt"), epay.default_currency (e.g. "cny"), epay.default_network (e.g. "tron").
|
||||
// @Description okpay group keys: okpay.enabled, okpay.shop_id, okpay.shop_token, okpay.api_url, okpay.callback_url, okpay.return_url, okpay.timeout_seconds, okpay.allow_tokens.
|
||||
// @Description rate group keys: rate.forced_usdt_rate (>0 overrides USDT/CNY; <=0 uses rate.api_url), rate.api_url, rate.adjust_percent, rate.okx_c2c_enabled.
|
||||
// @Description brand group keys: brand.site_name, brand.logo_url, brand.page_title, brand.pay_success_text, brand.support_url.
|
||||
// @Description brand group keys: brand.checkout_name, brand.logo_url, brand.site_title, brand.success_copy, brand.support_url. Legacy aliases brand.site_name, brand.page_title and brand.pay_success_text are also supported.
|
||||
// @Description system group keys: system.order_expiration_time.
|
||||
// @Tags Admin Settings
|
||||
// @Security AdminJWT
|
||||
|
||||
@@ -62,11 +62,12 @@ func buildSupportedAssets() ([]response.NetworkTokenSupport, error) {
|
||||
return supports, nil
|
||||
}
|
||||
|
||||
// GetPublicConfig returns payment config consumed by cashier/frontends.
|
||||
// The public route returns only non-sensitive epay/okpay knobs, while the
|
||||
// authenticated admin route also includes OkPay credentials and internal URLs.
|
||||
// GetPublicConfig returns payment/site config consumed by cashier/frontends.
|
||||
// The public route returns brand/site display config plus non-sensitive
|
||||
// epay/okpay knobs, while the authenticated admin route also includes OkPay
|
||||
// credentials and internal URLs.
|
||||
// @Summary Get public payment config
|
||||
// @Description Returns supported_assets and epay/okpay config used by cashier/frontends.
|
||||
// @Description Returns supported_assets plus site, epay and okpay config used by cashier/frontends.
|
||||
// @Description The authenticated admin variant (/admin/api/v1/config) also includes OkPay shop credentials and internal callback settings.
|
||||
// @Tags Payment Config
|
||||
// @Produce json
|
||||
@@ -93,6 +94,12 @@ func (c *BaseCommController) GetPublicConfig(ctx echo.Context) error {
|
||||
}
|
||||
return c.SucJson(ctx, response.PublicConfigResponse{
|
||||
SupportedAssets: supports,
|
||||
Site: response.SitePublicConfig{
|
||||
CashierName: data.GetBrandCashierName(),
|
||||
LogoURL: data.GetBrandLogoURL(),
|
||||
WebsiteTitle: data.GetBrandWebsiteTitle(),
|
||||
SupportLink: data.GetBrandSupportURL(),
|
||||
},
|
||||
Epay: response.EpayPublicConfig{
|
||||
DefaultToken: data.GetSettingString(mdb.SettingKeyEpayDefaultToken, "usdt"),
|
||||
DefaultCurrency: data.GetSettingString(mdb.SettingKeyEpayDefaultCurrency, "cny"),
|
||||
|
||||
Reference in New Issue
Block a user