setting

package
v0.2.0-beta.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessPolicyModeOff     = "off"
	AccessPolicyModeAudit   = "audit"
	AccessPolicyModeEnforce = "enforce"
)

Access policy enforcement follows the D04 contract: off -> audit -> scoped enforce. The legacy routing path remains the only authority while the mode is off or audit; enforce applies only to requests whose selected legacy group is listed in EnforceGroups, so an operator can scope enforcement to a single migrated group before enabling it globally.

View Source
const ChannelQuotaAlertDeliveryOptionKey = "ChannelQuotaAlertDeliveryConfigSecret"

ChannelQuotaAlertDeliveryOptionKey ends in Secret so the generic option listing never returns the webhook credential or a URL containing a token. URL and secret are stored in one JSON value to publish one runtime generation.

View Source
const DefaultMaxTokenAutoGroups = 5
View Source
const MaxEnforceGroups = 128

MaxEnforceGroups bounds the operator-configured enforcement scope.

Variables

View Source
var (
	ErrPaymentRuntimeUnknownOption      = errors.New("payment runtime: unknown option")
	ErrPaymentRuntimeDuplicateOption    = errors.New("payment runtime: duplicate option")
	ErrPaymentRuntimeInvalidValue       = errors.New("payment runtime: invalid value")
	ErrPaymentRuntimeNullLikeValue      = errors.New("payment runtime: null-like value")
	ErrPaymentRuntimeValueType          = errors.New("payment runtime: unexpected value type")
	ErrPaymentRuntimeForeignSnapshot    = errors.New("payment runtime: foreign snapshot")
	ErrPaymentRuntimeRevisionExhausted  = errors.New("payment runtime: revision exhausted")
	ErrPaymentRuntimeConflict           = errors.New("payment runtime: publish conflict")
	ErrPaymentRuntimeCandidateAborted   = errors.New("payment runtime: candidate aborted")
	ErrPaymentRuntimeCandidateFinalized = errors.New("payment runtime: candidate finalized")
)
View Source
var (
	WaffoEnabled               bool
	WaffoApiKey                string
	WaffoPrivateKey            string
	WaffoPublicCert            string
	WaffoSandboxPublicCert     string
	WaffoSandboxApiKey         string
	WaffoSandboxPrivateKey     string
	WaffoSandbox               bool
	WaffoMerchantId            string
	WaffoNotifyUrl             string
	WaffoReturnUrl             string
	WaffoSubscriptionReturnUrl string
	WaffoCurrency              string
	WaffoUnitPrice             float64 = 1.0
	WaffoMinTopUp              int     = 1
)
View Source
var (
	WaffoPancakeMerchantID string
	WaffoPancakePrivateKey string
	WaffoPancakeReturnURL  string
	WaffoPancakeUnitPrice  float64 = 1.0
	WaffoPancakeMinTopUp   int     = 1
	WaffoPancakeStoreID    string
	WaffoPancakeProductID  string
)

Waffo Pancake hosted checkout configuration. Gateway is enabled once MerchantID + PrivateKey + ProductID are populated (no separate Enabled flag, matching Stripe / Creem). StoreID + ProductID are operator-bound via SaveWaffoPancakeConfig.

View Source
var Chats = []map[string]string{}

Keep third-party client links opt-in. Administrators can add only the integrations they trust from System Settings without shipping promotional entries to every deployment by default.

View Source
var CheckSensitiveEnabled = true
View Source
var CheckSensitiveOnPromptEnabled = true
View Source
var CreemApiKey = ""
View Source
var CreemProducts = "[]"
View Source
var CreemTestMode = false
View Source
var CreemWebhookSecret = ""
View Source
var DefaultUseAutoGroup = false
View Source
var MjAccountFilterEnabled = false
View Source
var MjActionCheckSuccessEnabled = true
View Source
var MjForwardUrlEnabled = true
View Source
var MjModeClearEnabled = false
View Source
var MjNotifyEnabled = false
View Source
var ModelRequestRateLimitCount = 0
View Source
var ModelRequestRateLimitDurationMinutes = 1
View Source
var ModelRequestRateLimitEnabled = false
View Source
var ModelRequestRateLimitGroup = map[string][2]int{}
View Source
var ModelRequestRateLimitMutex sync.RWMutex
View Source
var ModelRequestRateLimitSuccessCount = 1000
View Source
var SensitiveWords = []string{
	"test_sensitive",
}

SensitiveWords 敏感词 var SensitiveWords []string

View Source
var StopOnSensitiveEnabled = true

StopOnSensitiveEnabled 如果检测到敏感词,是否立刻停止生成,否则替换敏感词

View Source
var StreamCacheQueueLength = 0

StreamCacheQueueLength 流模式缓存队列长度,0表示无缓存

View Source
var StripeApiSecret = ""
View Source
var StripeMinTopUp = 1
View Source
var StripePriceId = ""
View Source
var StripePromotionCodesEnabled = false
View Source
var StripeUnitPrice = 8.0
View Source
var StripeWebhookSecret = ""

Functions

func AccessPolicyEnforcedForGroup

func AccessPolicyEnforcedForGroup(group string) bool

AccessPolicyEnforcedForGroup reports whether enforce mode actually rejects requests for the given legacy group. Audit mode never enforces; enforce mode with an empty scope list enforces nowhere.

func ApplyModelRequestRateLimitConfig

func ApplyModelRequestRateLimitConfig(config ModelRequestRateLimitConfig) error

func AutoGroups2JsonString

func AutoGroups2JsonString() string

func Chats2JsonString

func Chats2JsonString() string

func CheckModelRequestRateLimitGroup

func CheckModelRequestRateLimitGroup(jsonStr string) error

func ContainsAutoGroup

func ContainsAutoGroup(group string) bool

func GetAccessPolicyMode

func GetAccessPolicyMode() string

GetAccessPolicyMode returns the configured mode; it never returns an empty or unknown value because validation rejects those at update time.

func GetAutoGroups

func GetAutoGroups() []string

func GetChats

func GetChats() []map[string]string

func GetGroupRateLimit

func GetGroupRateLimit(group string) (totalCount, successCount int, found bool)

func GetMaxTokenAutoGroups

func GetMaxTokenAutoGroups() int

func GetUsableGroupDescription

func GetUsableGroupDescription(groupName string) string

func GetUserUsableGroupsCopy

func GetUserUsableGroupsCopy() map[string]string

func GetWaffoPayMethods

func GetWaffoPayMethods() []constant.WaffoPayMethod

GetWaffoPayMethods 从 options 读取 Waffo 支付方式配置

func MarshalChannelQuotaAlertDeliverySettings

func MarshalChannelQuotaAlertDeliverySettings(settings ChannelQuotaAlertDeliverySettings) (string, error)

func ModelRequestRateLimitGroup2JSONString

func ModelRequestRateLimitGroup2JSONString() string

func NormalizeAccessProfileDefinitionsJSON

func NormalizeAccessProfileDefinitionsJSON(raw string) (string, error)

NormalizeAccessProfileDefinitionsJSON gives persistence and OptionMap the same canonical IDs/fallback references used by the live profile registry.

func NormalizeAccountTierDefinitionsJSON

func NormalizeAccountTierDefinitionsJSON(raw string) (string, error)

func ParseModelRequestRateLimitGroupJSON

func ParseModelRequestRateLimitGroupJSON(jsonStr string) (map[string][2]int, error)

func PublishPaymentCanonicalMutation

func PublishPaymentCanonicalMutation(mutation PaymentMutation) (bool, error)

PublishPaymentCanonicalMutation publishes a single committed payment option as its own runtime generation. It returns false when the current generation already carries the mutation (no revision bump). Conflicts against a concurrent publisher are retried; validation errors abort immediately.

func PublishPaymentCanonicalMutations

func PublishPaymentCanonicalMutations(mutations []PaymentMutation) (bool, error)

PublishPaymentCanonicalMutations publishes a group of committed payment options as exactly one runtime generation. Either the whole group becomes visible atomically or the runtime stays on the previous generation; a failed publish never leaves a partial group behind.

func SensitiveWordsFromString

func SensitiveWordsFromString(s string)

func SensitiveWordsToString

func SensitiveWordsToString() string

func SetModelRequestRateLimitCount

func SetModelRequestRateLimitCount(count int) error

func SetModelRequestRateLimitDurationMinutes

func SetModelRequestRateLimitDurationMinutes(durationMinutes int) error

func SetModelRequestRateLimitEnabled

func SetModelRequestRateLimitEnabled(enabled bool) error

func SetModelRequestRateLimitSuccessCount

func SetModelRequestRateLimitSuccessCount(count int) error

func SetWaffoPayMethods

func SetWaffoPayMethods(methods []constant.WaffoPayMethod) error

SetWaffoPayMethods 序列化 Waffo 支付方式配置并更新 OptionMap

func ShouldCheckPromptSensitive

func ShouldCheckPromptSensitive() bool

func UpdateAccessProfileDefinitionsByJSONString

func UpdateAccessProfileDefinitionsByJSONString(raw string) error

func UpdateAccountTierDefinitionsByJSONString

func UpdateAccountTierDefinitionsByJSONString(raw string) error

func UpdateAutoGroupsByJsonString

func UpdateAutoGroupsByJsonString(jsonString string) error

func UpdateChatsByJsonString

func UpdateChatsByJsonString(jsonString string) error

func UpdateMaxTokenAutoGroups

func UpdateMaxTokenAutoGroups(value string) error

func UpdateModelRequestRateLimitGroupByJSONString

func UpdateModelRequestRateLimitGroupByJSONString(jsonStr string) error

func UpdateUserUsableGroupsByJSONString

func UpdateUserUsableGroupsByJSONString(jsonStr string) error

func UserUsableGroups2JSONString

func UserUsableGroups2JSONString() string

func ValidateAccessProfileDefinitionsJSON

func ValidateAccessProfileDefinitionsJSON(raw string) error

ValidateAccessProfileDefinitionsJSON validates the independently editable profile registry before it is persisted by the generic option endpoint.

func ValidateAccountTierDefinitionsJSON

func ValidateAccountTierDefinitionsJSON(raw string) error

func ValidateAutoGroupsJSON

func ValidateAutoGroupsJSON(value string) error

func ValidateChannelQuotaAlertDeliverySettings

func ValidateChannelQuotaAlertDeliverySettings(settings ChannelQuotaAlertDeliverySettings) error

ValidateChannelQuotaAlertDeliverySettings is intentionally stricter than the general fetch setting: quota alerts always require HTTPS, a signing secret, and a public network target. DNS is checked again immediately before dialing by the delivery client to prevent rebinding.

func ValidateChatsJSON

func ValidateChatsJSON(value string) error

func ValidateMaxTokenAutoGroups

func ValidateMaxTokenAutoGroups(value string) error

func ValidateModelRequestRateLimitConfig

func ValidateModelRequestRateLimitConfig(config ModelRequestRateLimitConfig) error

func ValidateUserUsableGroupsJSON

func ValidateUserUsableGroupsJSON(value string) error

func WaffoPayMethods2JsonString

func WaffoPayMethods2JsonString() string

WaffoPayMethods2JsonString 将默认 WaffoPayMethods 序列化为 JSON 字符串(供 InitOptionMap 使用)

Types

type AccessPolicyModeSetting

type AccessPolicyModeSetting struct {
	// Mode is one of off / audit / enforce. Unknown values fail validation.
	Mode string `json:"mode"`
	// EnforceGroups lists legacy group names where enforce mode actually
	// rejects. An empty list means enforce behaves like audit everywhere,
	// which keeps the default enforce scope empty and safe.
	EnforceGroups []string `json:"enforce_groups,omitempty"`
}

func GetAccessPolicyModeSetting

func GetAccessPolicyModeSetting() AccessPolicyModeSetting

GetAccessPolicyModeSetting returns a detached copy of the current mode.

type AccessProfileDefinition

type AccessProfileDefinition struct {
	Label            string   `json:"label"`
	Description      string   `json:"description"`
	RouteGroups      []string `json:"route_groups"`
	ModelAllowlist   []string `json:"model_allowlist"`
	FallbackProfiles []string `json:"fallback_profiles,omitempty"`
	Enabled          *bool    `json:"enabled,omitempty"`
}

AccessProfileDefinition is the operator-facing policy metadata for a key access profile. The legacy group remains the routing identifier; these fields make the user-facing contract explicit and can be adopted by future routing policy migrations without changing the persisted Token.Group field.

func GetAccessProfileDefinition

func GetAccessProfileDefinition(id string) (AccessProfileDefinition, bool)

type AccessProfileSetting

type AccessProfileSetting struct {
	Profiles     map[string]AccessProfileDefinition `json:"profiles"`
	AccountTiers map[string]AccountTierDefinition   `json:"account_tiers"`
}

func GetAccessProfileSetting

func GetAccessProfileSetting() *AccessProfileSetting

type AccountTierDefinition

type AccountTierDefinition struct {
	Label          string   `json:"label"`
	Description    string   `json:"description"`
	RouteGroups    []string `json:"route_groups"`
	ModelAllowlist []string `json:"model_allowlist"`
	Enabled        *bool    `json:"enabled,omitempty"`
}

AccountTierDefinition is the account-level half of the D04 entitlement contract. Nil route/model lists inherit the key profile's constraint, while an explicitly empty list denies every value in that dimension.

func GetAccountTierDefinition

func GetAccountTierDefinition(id string) (AccountTierDefinition, bool)

type ChannelQuotaAlertDeliverySettings

type ChannelQuotaAlertDeliverySettings struct {
	WebhookURL    string `json:"webhook_url"`
	WebhookSecret string `json:"webhook_secret"`
}

func GetChannelQuotaAlertDeliverySettings

func GetChannelQuotaAlertDeliverySettings() (ChannelQuotaAlertDeliverySettings, error)

func ParseChannelQuotaAlertDeliverySettings

func ParseChannelQuotaAlertDeliverySettings(raw string) (ChannelQuotaAlertDeliverySettings, error)

func (ChannelQuotaAlertDeliverySettings) Configured

func (settings ChannelQuotaAlertDeliverySettings) Configured() bool

func (ChannelQuotaAlertDeliverySettings) EndpointHost

func (settings ChannelQuotaAlertDeliverySettings) EndpointHost() string

type ModelRequestRateLimitConfig

type ModelRequestRateLimitConfig struct {
	Enabled         bool
	DurationMinutes int
	Total           int
	Success         int
	Group           map[string][2]int
}

func GetModelRequestRateLimitConfig

func GetModelRequestRateLimitConfig() ModelRequestRateLimitConfig

type ModelRequestRateLimitSnapshot

type ModelRequestRateLimitSnapshot struct {
	Enabled         bool
	DurationMinutes int
	Total           int
	Success         int
}

func ResolveModelRequestRateLimit

func ResolveModelRequestRateLimit(group string) ModelRequestRateLimitSnapshot

type PaymentCandidate

type PaymentCandidate struct {
	// contains filtered or unexported fields
}

PaymentCandidate is fully validated and detached before Publish. Publish has exactly one runtime side effect: a single atomic generation CAS.

func PreparePaymentCandidate

func PreparePaymentCandidate(base PaymentSnapshot, mutations []PaymentMutation) (*PaymentCandidate, error)

func (*PaymentCandidate) Abort

func (candidate *PaymentCandidate) Abort() bool

Abort is idempotent. It returns true only when it transitions a pending candidate to aborted; an aborted candidate can never publish.

func (*PaymentCandidate) CanonicalOptions

func (candidate *PaymentCandidate) CanonicalOptions() PaymentCanonicalOptions

func (*PaymentCandidate) GoString

func (candidate *PaymentCandidate) GoString() string

func (*PaymentCandidate) Publish

func (candidate *PaymentCandidate) Publish() error

func (*PaymentCandidate) Revision

func (candidate *PaymentCandidate) Revision() uint64

func (*PaymentCandidate) String

func (candidate *PaymentCandidate) String() string

type PaymentCanonicalOptions

type PaymentCanonicalOptions map[string]string

func (PaymentCanonicalOptions) GoString

func (options PaymentCanonicalOptions) GoString() string

func (PaymentCanonicalOptions) String

func (options PaymentCanonicalOptions) String() string

type PaymentConfig

type PaymentConfig struct {
	// contains filtered or unexported fields
}

PaymentConfig is the authoritative per-request view of the payment runtime. It pins exactly one PaymentRuntime generation, so every field a request reads comes from the same configuration generation and a concurrent save can never mix generations mid-request.

The legacy package-level variables remain as a transition write target and as the fallback for keys the runtime generation does not contain (never persisted, or rejected by runtime validation during option load). Reads must go through a captured PaymentConfig, not through the bare variables.

func CapturePaymentConfig

func CapturePaymentConfig() PaymentConfig

CapturePaymentConfig pins the current payment runtime generation. The returned value is detached and safe to hold for the lifetime of a request.

func (PaymentConfig) CreemApiKey

func (config PaymentConfig) CreemApiKey() string

func (PaymentConfig) CreemProducts

func (config PaymentConfig) CreemProducts() string

func (PaymentConfig) CreemTestMode

func (config PaymentConfig) CreemTestMode() bool

func (PaymentConfig) CreemWebhookSecret

func (config PaymentConfig) CreemWebhookSecret() string

func (PaymentConfig) CustomCallbackAddress

func (config PaymentConfig) CustomCallbackAddress() string

func (PaymentConfig) EpayId

func (config PaymentConfig) EpayId() string

func (PaymentConfig) EpayKey

func (config PaymentConfig) EpayKey() string

func (PaymentConfig) MinTopUp

func (config PaymentConfig) MinTopUp() int

func (PaymentConfig) PayAddress

func (config PaymentConfig) PayAddress() string

func (PaymentConfig) Price

func (config PaymentConfig) Price() float64

func (PaymentConfig) Revision

func (config PaymentConfig) Revision() uint64

Revision reports the pinned runtime generation revision (0 when the runtime has not published any generation yet).

func (PaymentConfig) StripeApiSecret

func (config PaymentConfig) StripeApiSecret() string

func (PaymentConfig) StripeMinTopUp

func (config PaymentConfig) StripeMinTopUp() int

func (PaymentConfig) StripePriceId

func (config PaymentConfig) StripePriceId() string

func (PaymentConfig) StripePromotionCodesEnabled

func (config PaymentConfig) StripePromotionCodesEnabled() bool

func (PaymentConfig) StripeUnitPrice

func (config PaymentConfig) StripeUnitPrice() float64

func (PaymentConfig) StripeWebhookSecret

func (config PaymentConfig) StripeWebhookSecret() string

func (PaymentConfig) USDExchangeRate

func (config PaymentConfig) USDExchangeRate() float64

func (PaymentConfig) WaffoApiKey

func (config PaymentConfig) WaffoApiKey() string

func (PaymentConfig) WaffoCurrency

func (config PaymentConfig) WaffoCurrency() string

func (PaymentConfig) WaffoEnabled

func (config PaymentConfig) WaffoEnabled() bool

func (PaymentConfig) WaffoMerchantId

func (config PaymentConfig) WaffoMerchantId() string

func (PaymentConfig) WaffoMinTopUp

func (config PaymentConfig) WaffoMinTopUp() int

func (PaymentConfig) WaffoNotifyUrl

func (config PaymentConfig) WaffoNotifyUrl() string

func (PaymentConfig) WaffoPancakeMerchantID

func (config PaymentConfig) WaffoPancakeMerchantID() string

func (PaymentConfig) WaffoPancakeMinTopUp

func (config PaymentConfig) WaffoPancakeMinTopUp() int

func (PaymentConfig) WaffoPancakePrivateKey

func (config PaymentConfig) WaffoPancakePrivateKey() string

func (PaymentConfig) WaffoPancakeProductID

func (config PaymentConfig) WaffoPancakeProductID() string

func (PaymentConfig) WaffoPancakeReturnURL

func (config PaymentConfig) WaffoPancakeReturnURL() string

func (PaymentConfig) WaffoPancakeStoreID

func (config PaymentConfig) WaffoPancakeStoreID() string

func (PaymentConfig) WaffoPancakeUnitPrice

func (config PaymentConfig) WaffoPancakeUnitPrice() float64

func (PaymentConfig) WaffoPrivateKey

func (config PaymentConfig) WaffoPrivateKey() string

func (PaymentConfig) WaffoPublicCert

func (config PaymentConfig) WaffoPublicCert() string

func (PaymentConfig) WaffoReturnUrl

func (config PaymentConfig) WaffoReturnUrl() string

func (PaymentConfig) WaffoSandbox

func (config PaymentConfig) WaffoSandbox() bool

func (PaymentConfig) WaffoSandboxApiKey

func (config PaymentConfig) WaffoSandboxApiKey() string

func (PaymentConfig) WaffoSandboxPrivateKey

func (config PaymentConfig) WaffoSandboxPrivateKey() string

func (PaymentConfig) WaffoSandboxPublicCert

func (config PaymentConfig) WaffoSandboxPublicCert() string

func (PaymentConfig) WaffoSubscriptionReturnUrl

func (config PaymentConfig) WaffoSubscriptionReturnUrl() string

func (PaymentConfig) WaffoUnitPrice

func (config PaymentConfig) WaffoUnitPrice() float64

type PaymentInitialValue

type PaymentInitialValue struct {
	Key   PaymentOptionKey
	Value PaymentValue
}

PaymentInitialValue is a pure-value seed entry for a new, independent runtime. Duplicate and unknown keys are rejected.

func (PaymentInitialValue) GoString

func (initial PaymentInitialValue) GoString() string

func (PaymentInitialValue) String

func (initial PaymentInitialValue) String() string

type PaymentKeyMetadata

type PaymentKeyMetadata struct {
	KeyID           string          `json:"key_id"`
	Provider        PaymentProvider `json:"provider"`
	Revision        uint64          `json:"revision"`
	ActivatedAtUnix int64           `json:"activated_at_unix"`
	RetiredAtUnix   int64           `json:"retired_at_unix,omitempty"`
	ExpiresAtUnix   int64           `json:"expires_at_unix,omitempty"`
}

PaymentKeyMetadata contains only key lifecycle metadata. KeyID must be an opaque, non-secret identifier; actual verification material belongs to the later bounded keyring implementation, not this N2a kernel.

func (PaymentKeyMetadata) GoString

func (metadata PaymentKeyMetadata) GoString() string

func (PaymentKeyMetadata) String

func (metadata PaymentKeyMetadata) String() string

type PaymentMutation

type PaymentMutation struct {
	Key    PaymentOptionKey
	Action PaymentMutationAction
	Value  PaymentValue
}

PaymentMutation makes keep, set, and clear explicit. Keep and Clear require a zero PaymentValue; Set requires a constructed, schema-compatible value.

func PaymentMutationFromCanonicalOption

func PaymentMutationFromCanonicalOption(key PaymentOptionKey, value string) (PaymentMutation, error)

PaymentMutationFromCanonicalOption converts one committed option value (the canonical string form stored in the options table / OptionMap) into a fully validated runtime mutation for the same key:

  • empty string values become PaymentMutationClear (an absent key means "not configured", matching the legacy zero-value semantics);
  • non-empty values become PaymentMutationSet with the typed value required by the option's registered kind;
  • values that cannot be represented in the runtime (malformed number, invalid JSON, out-of-range constraint) return an error so the caller can fail the save instead of publishing a partial configuration.

The webhook keyring metadata option is not representable as a canonical option string and is rejected here; it is written by the keyring implementation, not by option persistence.

func (PaymentMutation) GoString

func (mutation PaymentMutation) GoString() string

func (PaymentMutation) String

func (mutation PaymentMutation) String() string

type PaymentMutationAction

type PaymentMutationAction uint8
const (
	PaymentMutationInvalid PaymentMutationAction = iota
	PaymentMutationKeep
	PaymentMutationSet
	PaymentMutationClear
)

func (PaymentMutationAction) GoString

func (action PaymentMutationAction) GoString() string

func (PaymentMutationAction) String

func (action PaymentMutationAction) String() string

type PaymentOptionKey

type PaymentOptionKey string

PaymentOptionKey is a field owned by the payment runtime. The constants use the existing option names so a later option writer can bridge to this kernel without translating payment semantics here.

const (
	PaymentOptionPayAddress                  PaymentOptionKey = "PayAddress"
	PaymentOptionCustomCallbackAddress       PaymentOptionKey = "CustomCallbackAddress"
	PaymentOptionEpayID                      PaymentOptionKey = "EpayId"
	PaymentOptionEpayKey                     PaymentOptionKey = "EpayKey"
	PaymentOptionPrice                       PaymentOptionKey = "Price"
	PaymentOptionUSDExchangeRate             PaymentOptionKey = "USDExchangeRate"
	PaymentOptionMinTopUp                    PaymentOptionKey = "MinTopUp"
	PaymentOptionPayMethods                  PaymentOptionKey = "PayMethods"
	PaymentOptionStripeAPISecret             PaymentOptionKey = "StripeApiSecret"
	PaymentOptionStripeWebhookSecret         PaymentOptionKey = "StripeWebhookSecret"
	PaymentOptionStripePriceID               PaymentOptionKey = "StripePriceId"
	PaymentOptionStripeUnitPrice             PaymentOptionKey = "StripeUnitPrice"
	PaymentOptionStripeMinTopUp              PaymentOptionKey = "StripeMinTopUp"
	PaymentOptionStripePromotionCodesEnabled PaymentOptionKey = "StripePromotionCodesEnabled"
	PaymentOptionCreemAPIKey                 PaymentOptionKey = "CreemApiKey"
	PaymentOptionCreemProducts               PaymentOptionKey = "CreemProducts"
	PaymentOptionCreemTestMode               PaymentOptionKey = "CreemTestMode"
	PaymentOptionCreemWebhookSecret          PaymentOptionKey = "CreemWebhookSecret"
	PaymentOptionWaffoEnabled                PaymentOptionKey = "WaffoEnabled"
	PaymentOptionWaffoAPIKey                 PaymentOptionKey = "WaffoApiKey"
	PaymentOptionWaffoPrivateKey             PaymentOptionKey = "WaffoPrivateKey"
	PaymentOptionWaffoPublicCert             PaymentOptionKey = "WaffoPublicCert"
	PaymentOptionWaffoSandboxPublicCert      PaymentOptionKey = "WaffoSandboxPublicCert"
	PaymentOptionWaffoSandboxAPIKey          PaymentOptionKey = "WaffoSandboxApiKey"
	PaymentOptionWaffoSandboxPrivateKey      PaymentOptionKey = "WaffoSandboxPrivateKey"
	PaymentOptionWaffoSandbox                PaymentOptionKey = "WaffoSandbox"
	PaymentOptionWaffoMerchantID             PaymentOptionKey = "WaffoMerchantId"
	PaymentOptionWaffoNotifyURL              PaymentOptionKey = "WaffoNotifyUrl"
	PaymentOptionWaffoReturnURL              PaymentOptionKey = "WaffoReturnUrl"
	PaymentOptionWaffoSubscriptionReturnURL  PaymentOptionKey = "WaffoSubscriptionReturnUrl"
	PaymentOptionWaffoCurrency               PaymentOptionKey = "WaffoCurrency"
	PaymentOptionWaffoUnitPrice              PaymentOptionKey = "WaffoUnitPrice"
	PaymentOptionWaffoMinTopUp               PaymentOptionKey = "WaffoMinTopUp"
	PaymentOptionWaffoPayMethods             PaymentOptionKey = "WaffoPayMethods"
	PaymentOptionWaffoPancakeMerchantID      PaymentOptionKey = "WaffoPancakeMerchantID"
	PaymentOptionWaffoPancakePrivateKey      PaymentOptionKey = "WaffoPancakePrivateKey"
	PaymentOptionWaffoPancakeReturnURL       PaymentOptionKey = "WaffoPancakeReturnURL"
	PaymentOptionWaffoPancakeUnitPrice       PaymentOptionKey = "WaffoPancakeUnitPrice"
	PaymentOptionWaffoPancakeMinTopUp        PaymentOptionKey = "WaffoPancakeMinTopUp"
	PaymentOptionWaffoPancakeStoreID         PaymentOptionKey = "WaffoPancakeStoreID"
	PaymentOptionWaffoPancakeProductID       PaymentOptionKey = "WaffoPancakeProductID"
	// TopupGroupRatio participates in every legacy top-up price calculation.
	// Keeping it in the payment generation prevents a later bridge from mixing
	// a new unit price with a stale group ratio. Its detailed map semantics are
	// deliberately left to the typed bulk contract in C09-N3.
	PaymentOptionTopupGroupRatio        PaymentOptionKey = "TopupGroupRatio"
	PaymentOptionAmountOptions          PaymentOptionKey = "payment_setting.amount_options"
	PaymentOptionAmountDiscount         PaymentOptionKey = "payment_setting.amount_discount"
	PaymentOptionComplianceConfirmed    PaymentOptionKey = "payment_setting.compliance_confirmed"
	PaymentOptionComplianceTermsVersion PaymentOptionKey = "payment_setting.compliance_terms_version"
	PaymentOptionComplianceConfirmedAt  PaymentOptionKey = "payment_setting.compliance_confirmed_at"
	PaymentOptionComplianceConfirmedBy  PaymentOptionKey = "payment_setting.compliance_confirmed_by"
	PaymentOptionComplianceConfirmedIP  PaymentOptionKey = "payment_setting.compliance_confirmed_ip"
	PaymentOptionUserFundingMode        PaymentOptionKey = "user_funding_setting.mode"
	PaymentOptionUserFundingEpoch       PaymentOptionKey = "user_funding_setting.epoch"
	PaymentOptionWebhookKeyringMetadata PaymentOptionKey = "payment_runtime.webhook_keyring_metadata"
)

type PaymentOptionValues

type PaymentOptionValues map[PaymentOptionKey]PaymentValue

func (PaymentOptionValues) GoString

func (values PaymentOptionValues) GoString() string

func (PaymentOptionValues) String

func (values PaymentOptionValues) String() string

type PaymentProvider

type PaymentProvider string

PaymentProvider identifies the provider associated with non-secret keyring metadata. It deliberately cannot carry signing or API key material.

const (
	PaymentProviderEpay         PaymentProvider = "epay"
	PaymentProviderStripe       PaymentProvider = "stripe"
	PaymentProviderCreem        PaymentProvider = "creem"
	PaymentProviderWaffo        PaymentProvider = "waffo"
	PaymentProviderWaffoPancake PaymentProvider = "waffo_pancake"
)

type PaymentRuntime

type PaymentRuntime struct {
	// contains filtered or unexported fields
}

PaymentRuntime owns one atomically published immutable generation. It has no dependency on option persistence, provider SDKs, or the legacy globals.

func NewPaymentRuntime

func NewPaymentRuntime(initial []PaymentInitialValue) (*PaymentRuntime, error)

NewPaymentRuntime constructs an independent runtime solely from explicit values. It performs no external reads or writes.

func (*PaymentRuntime) Current

func (runtime *PaymentRuntime) Current() PaymentSnapshot

func (*PaymentRuntime) GoString

func (runtime *PaymentRuntime) GoString() string

func (*PaymentRuntime) PrepareCandidate

func (runtime *PaymentRuntime) PrepareCandidate(base PaymentSnapshot, mutations []PaymentMutation) (*PaymentCandidate, error)

func (*PaymentRuntime) String

func (runtime *PaymentRuntime) String() string

type PaymentSnapshot

type PaymentSnapshot struct {
	// contains filtered or unexported fields
}

PaymentSnapshot pins exactly one generation. Collection accessors always return detached copies.

func CurrentPaymentRuntime

func CurrentPaymentRuntime() PaymentSnapshot

CurrentPaymentRuntime exposes the package runtime for future option/provider wiring. This file intentionally does not read or replace any legacy global.

func (PaymentSnapshot) CanonicalOptions

func (snapshot PaymentSnapshot) CanonicalOptions() PaymentCanonicalOptions

func (PaymentSnapshot) GoString

func (snapshot PaymentSnapshot) GoString() string

func (PaymentSnapshot) Revision

func (snapshot PaymentSnapshot) Revision() uint64

func (PaymentSnapshot) String

func (snapshot PaymentSnapshot) String() string

func (PaymentSnapshot) Value

func (snapshot PaymentSnapshot) Value(key PaymentOptionKey) (PaymentValue, bool)

func (PaymentSnapshot) Values

func (snapshot PaymentSnapshot) Values() PaymentOptionValues

type PaymentValue

type PaymentValue struct {
	// contains filtered or unexported fields
}

PaymentValue is a typed value object. Its fields are private so construction and all collection access pass through copying and validation boundaries.

func NewPaymentBooleanValue

func NewPaymentBooleanValue(value bool) PaymentValue

func NewPaymentIntegerValue

func NewPaymentIntegerValue(value int64) PaymentValue

func NewPaymentJSONValue

func NewPaymentJSONValue(value any) (PaymentValue, error)

NewPaymentJSONValue accepts only an object or array. common.Marshal both validates the supplied structure and detaches it from caller-owned maps and slices; the encoded bytes are never exposed without another copy.

func NewPaymentKeyringMetadataValue

func NewPaymentKeyringMetadataValue(metadata []PaymentKeyMetadata) (PaymentValue, error)

func NewPaymentNumberValue

func NewPaymentNumberValue(value float64) (PaymentValue, error)

func NewPaymentStringValue

func NewPaymentStringValue(value string) (PaymentValue, error)

func (PaymentValue) BooleanValue

func (value PaymentValue) BooleanValue() (bool, bool)

func (PaymentValue) DecodeJSON

func (value PaymentValue) DecodeJSON(destination any) error

func (PaymentValue) GoString

func (value PaymentValue) GoString() string

func (PaymentValue) IntegerValue

func (value PaymentValue) IntegerValue() (int64, bool)

func (PaymentValue) JSONValue

func (value PaymentValue) JSONValue() ([]byte, bool)

func (PaymentValue) KeyringMetadata

func (value PaymentValue) KeyringMetadata() ([]PaymentKeyMetadata, bool)

func (PaymentValue) Kind

func (value PaymentValue) Kind() PaymentValueKind

func (PaymentValue) NumberValue

func (value PaymentValue) NumberValue() (float64, bool)

func (PaymentValue) Sensitive

func (value PaymentValue) Sensitive() bool

func (PaymentValue) String

func (value PaymentValue) String() string

func (PaymentValue) StringValue

func (value PaymentValue) StringValue() (string, bool)

type PaymentValueKind

type PaymentValueKind uint8

PaymentValueKind describes the closed value union accepted by the runtime.

const (
	PaymentValueInvalid PaymentValueKind = iota
	PaymentValueString
	PaymentValueInteger
	PaymentValueNumber
	PaymentValueBoolean
	PaymentValueJSON
	PaymentValueKeyringMetadata
)

func (PaymentValueKind) GoString

func (kind PaymentValueKind) GoString() string

func (PaymentValueKind) String

func (kind PaymentValueKind) String() string

Directories

Path Synopsis
Package reasoning re-exports the pure model-name effort-suffix helpers, which moved to the conversion kit (service/relayconvert/reasoning) as part of the relaykit extraction.
Package reasoning re-exports the pure model-name effort-suffix helpers, which moved to the conversion kit (service/relayconvert/reasoning) as part of the relaykit extraction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL