services

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPaymentProviderUnsupported = errors.New("payment provider is not enabled")
	ErrPaymentCapabilityMissing   = errors.New("payment capability is not supported")
	ErrPaymentInvalidSignature    = errors.New("invalid payment webhook signature")
	ErrPaymentInvalidReturnURL    = errors.New("payment return URL is not allowed")
	ErrPaymentSubscriptionActive  = errors.New("an active subscription already exists")
)

Functions

This section is empty.

Types

type PaymentProvider

type PaymentProvider interface {
	Name() string
}

type PaymentSystemService

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

func NewPaymentSystemService

func NewPaymentSystemService(repo paymentRepository, logger *zap.Logger, eventBus *coreevents.Bus, config RuntimeConfig) (*PaymentSystemService, error)

func (*PaymentSystemService) CancelSubscription

func (s *PaymentSystemService) CancelSubscription(ctx context.Context, identityID string, input models.PaymentCancelSubscriptionInput) error

func (*PaymentSystemService) CreateCheckout

func (s *PaymentSystemService) CreateCheckout(ctx context.Context, identityID string, input models.PaymentCheckoutInput) (string, error)

func (*PaymentSystemService) CreatePortal

func (s *PaymentSystemService) CreatePortal(ctx context.Context, identityID string, input models.PaymentPortalInput) (string, error)

func (*PaymentSystemService) CreateSubscription

func (s *PaymentSystemService) CreateSubscription(ctx context.Context, identityID, email string, input models.PaymentSubscriptionCheckoutInput) (string, error)

func (*PaymentSystemService) Entitlement added in v0.3.0

func (s *PaymentSystemService) Entitlement(ctx context.Context, identityID, planCode string) (models.PaymentEntitlementResponse, error)

func (*PaymentSystemService) FailedWebhooks added in v0.3.0

func (s *PaymentSystemService) FailedWebhooks(ctx context.Context, limit, offset int) ([]models.PaymentWebhookResponse, error)

func (*PaymentSystemService) ListSubscriptions

func (s *PaymentSystemService) ListSubscriptions(ctx context.Context, identityID string, limit, offset int) ([]models.PaymentSubscriptionResponse, error)

func (*PaymentSystemService) Notify

func (s *PaymentSystemService) Notify(ctx context.Context, providerName string, payload []byte, signature string) error

func (*PaymentSystemService) PaymentHistory added in v0.3.0

func (s *PaymentSystemService) PaymentHistory(ctx context.Context, identityID string, limit, offset int) ([]models.PaymentEventResponse, error)

func (*PaymentSystemService) Prices

func (s *PaymentSystemService) Prices(ctx context.Context, providerName string) ([]models.PaymentPriceOption, error)

func (*PaymentSystemService) ProviderStatuses added in v0.3.0

func (s *PaymentSystemService) ProviderStatuses() []models.PaymentProviderStatus

func (*PaymentSystemService) Providers

func (s *PaymentSystemService) Providers() []string

func (*PaymentSystemService) Reconcile added in v0.3.0

func (s *PaymentSystemService) Reconcile(ctx context.Context) error

func (*PaymentSystemService) RetryWebhook added in v0.3.0

func (s *PaymentSystemService) RetryWebhook(ctx context.Context, providerName, eventID string) error

func (*PaymentSystemService) VerifyStorePurchase

func (s *PaymentSystemService) VerifyStorePurchase(ctx context.Context, providerName, identityID string, input models.PaymentStoreVerificationInput) error

type Product added in v0.3.0

type Product struct {
	Provider    string `json:"provider"`
	ProductID   string `json:"product_id"`
	PlanCode    string `json:"plan_code"`
	Kind        string `json:"kind"`
	Currency    string `json:"currency,omitempty"`
	AmountMinor int64  `json:"amount_minor,omitempty"`
	Interval    string `json:"interval,omitempty"`
	Enabled     *bool  `json:"enabled,omitempty"`
}

type RuntimeConfig added in v0.3.0

type RuntimeConfig struct {
	EnabledProviders []string
	Products         map[string]map[string]Product
	WebhookLease     time.Duration
	WebhookRetention time.Duration
	ReconcileEvery   time.Duration
	EncryptionKey    []byte
}

func LoadRuntimeConfig added in v0.3.0

func LoadRuntimeConfig(enabledProviders []string, values map[string]string) (RuntimeConfig, error)

func (RuntimeConfig) Product added in v0.3.0

func (c RuntimeConfig) Product(provider, productID, kind string) (Product, error)

Jump to

Keyboard shortcuts

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