Callbacks service docs updated

This commit is contained in:
Stephan D
2026-03-02 16:27:33 +01:00
parent 17e08ff26f
commit 2be76aa519
77 changed files with 803 additions and 764 deletions

View File

@@ -16,11 +16,14 @@ const (
CallbackSigningModeHMACSHA256 CallbackSigningMode = "hmac_sha256"
)
type CallbackBackoff struct {
MinDelayMS int `bson:"min_ms" json:"minDelayMs"`
MaxDelayMS int `bson:"max_ms" json:"maxDelayMs"`
}
type CallbackRetryPolicy struct {
MinDelayMS int `bson:"min_ms" json:"minDelayMs"`
MaxDelayMS int `bson:"max_ms" json:"maxDelayMs"`
Backoff CallbackBackoff `bson:"backoff" json:"backoff"`
SigningMode CallbackSigningMode `bson:"signing_mode" json:"signingMode"`
SecretRef string `bson:"secret_ref,omitempty" json:"secretRef,omitempty"`
Headers map[string]string `bson:"headers,omitempty" json:"headers,omitempty"`
MaxAttempts int `bson:"max_attempts" json:"maxAttempts"`
RequestTimeoutMS int `bson:"request_timeout_ms" json:"requestTimeoutMs"`
@@ -29,7 +32,6 @@ type CallbackRetryPolicy struct {
type Callback struct {
PermissionBound `bson:",inline" json:",inline"`
Describable `bson:",inline" json:",inline"`
ClientID string `bson:"client_id" json:"clientId"`
Status CallbackStatus `bson:"status" json:"status"`
URL string `bson:"url" json:"url"`
EventTypes []string `bson:"event_types" json:"eventTypes"`

View File

@@ -1,6 +1,10 @@
package model
import "time"
import (
"time"
"go.mongodb.org/mongo-driver/v2/bson"
)
const (
PaymentStatusUpdatedType = "payment.status.updated"
@@ -9,21 +13,20 @@ const (
type PaymentStatusUpdated struct {
EventID string `json:"event_id,omitempty"`
Type string `json:"type,omitempty"`
ClientID string `json:"client_id,omitempty"`
OccurredAt time.Time `json:"occurred_at,omitempty"`
PublishedAt time.Time `json:"published_at,omitempty"`
Data PaymentStatusUpdatedData `json:"data"`
}
type PaymentStatusUpdatedData struct {
OrganizationRef string `json:"organization_ref,omitempty"`
PaymentRef string `json:"payment_ref,omitempty"`
QuotationRef string `json:"quotation_ref,omitempty"`
ClientPaymentRef string `json:"client_payment_ref,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
State string `json:"state,omitempty"`
PreviousState string `json:"previous_state,omitempty"`
Version uint64 `json:"version,omitempty"`
IsTerminal bool `json:"is_terminal"`
Event string `json:"event,omitempty"`
OrganizationRef bson.ObjectID `json:"organization_ref,omitempty"`
PaymentRef string `json:"payment_ref,omitempty"`
QuotationRef string `json:"quotation_ref,omitempty"`
ClientPaymentRef string `json:"client_payment_ref,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
State string `json:"state,omitempty"`
PreviousState string `json:"previous_state,omitempty"`
Version uint64 `json:"version,omitempty"`
IsTerminal bool `json:"is_terminal"`
Event string `json:"event,omitempty"`
}

View File

@@ -3,7 +3,9 @@ package model
import (
"time"
"github.com/tech/sendico/pkg/db/storable"
"github.com/tech/sendico/pkg/mservice"
"go.mongodb.org/mongo-driver/v2/bson"
)
type ClientRefreshToken struct {
@@ -12,13 +14,14 @@ type ClientRefreshToken struct {
}
type RefreshToken struct {
AccountBoundBase `bson:",inline" json:",inline"`
storable.Base `bson:",inline" json:",inline"`
ClientRefreshToken `bson:",inline" json:",inline"`
ExpiresAt time.Time `bson:"expiresAt"`
IsRevoked bool `bson:"isRevoked"`
LastUsedAt time.Time `bson:"lastUsedAt,omitempty"`
UserAgent string `bson:"userAgent"`
IPAddress string `bson:"ipAddress"`
AccountRef *bson.ObjectID `bson:"accountRef,omitempty" json:"accountRef,omitempty"`
ExpiresAt time.Time `bson:"expiresAt"`
IsRevoked bool `bson:"isRevoked"`
LastUsedAt time.Time `bson:"lastUsedAt,omitempty"`
UserAgent string `bson:"userAgent"`
IPAddress string `bson:"ipAddress"`
}
func (*RefreshToken) Collection() string {