Documentation
¶
Overview ¶
Package callback 封装 SessionToken 回调派发、签名与重试逻辑。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cookie ¶
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Domain string `json:"domain,omitempty"`
}
Cookie 是回传时的 cookie 结构。
type CredentialPayload ¶
type CredentialPayload struct {
SessionToken string `json:"session_token"`
Cookies []Cookie `json:"cookies_json,omitempty"`
Headers map[string]string `json:"headers_json,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
CapturedAt string `json:"captured_at,omitempty"`
Note string `json:"note,omitempty"`
}
CredentialPayload 表示需要回传给业务的凭证。
type Dispatcher ¶
Dispatcher 抽象回调投递行为。
type HTTPDispatcher ¶
type HTTPDispatcher struct {
// contains filtered or unexported fields
}
HTTPDispatcher 使用 HTTP POST 投递回调请求。
func NewHTTPDispatcher ¶
func NewHTTPDispatcher(secret string, log *logger.Logger, opts ...HTTPDispatcherOption) *HTTPDispatcher
NewHTTPDispatcher 创建默认的 HTTP dispatcher。
type HTTPDispatcherOption ¶
type HTTPDispatcherOption func(*HTTPDispatcher)
HTTPDispatcherOption 配置 dispatcher。
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) HTTPDispatcherOption
WithHTTPClient 设置自定义 HTTP 客户端。
func WithRetrySchedule ¶
func WithRetrySchedule(delays []time.Duration) HTTPDispatcherOption
WithRetrySchedule 自定义重试间隔。
type Payload ¶
type Payload struct {
FlowID string `json:"flow_id"`
State string `json:"state"`
Status string `json:"status"`
ProviderCode string `json:"provider_code,omitempty"`
ProviderAppCode string `json:"provider_app_code,omitempty"`
TenantUUID string `json:"tenant_uuid,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
LastFailedAPI string `json:"last_failed_api,omitempty"`
Credentials *CredentialPayload `json:"credentials,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Timestamp int64 `json:"timestamp"`
Nonce string `json:"nonce"`
}
Payload 是发送到业务侧的回调信息。
type Request ¶
type Request struct {
URL string `json:"-"`
Payload *Payload `json:"payload"`
Headers map[string]string `json:"headers"`
}
Request 定义了回调请求。
Click to show internal directories.
Click to hide internal directories.