handlers

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package handlers provides HTTP handlers for the subscription plugin.

Package handlers provides HTTP handlers for the subscription plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPaymentMethodRequest added in v0.0.9

type AddPaymentMethodRequest struct {
	OrganizationID  xid.ID `json:"organizationId"  validate:"required"`
	PaymentMethodID string `json:"paymentMethodId" validate:"required"`
	SetAsDefault    bool   `json:"setAsDefault"`
}

AddPaymentMethodRequest is the request body for adding a payment method.

type CreateSetupIntentRequest added in v0.0.9

type CreateSetupIntentRequest struct {
	OrganizationID xid.ID `json:"organizationId" validate:"required"`
}

CreateSetupIntentRequest is the request body for creating a setup intent.

type FeatureHandlers

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

FeatureHandlers handles HTTP requests for feature management.

func NewFeatureHandlers

func NewFeatureHandlers(featureSvc *service.FeatureService, usageSvc *service.FeatureUsageService) *FeatureHandlers

NewFeatureHandlers creates a new feature handlers instance.

func (*FeatureHandlers) HandleCheckFeatureAccess

func (h *FeatureHandlers) HandleCheckFeatureAccess(c forge.Context) error

HandleCheckFeatureAccess handles checking feature access.

func (*FeatureHandlers) HandleConsumeFeature

func (h *FeatureHandlers) HandleConsumeFeature(c forge.Context) error

HandleConsumeFeature handles consuming feature quota.

func (*FeatureHandlers) HandleCreateFeature

func (h *FeatureHandlers) HandleCreateFeature(c forge.Context) error

HandleCreateFeature handles feature creation.

func (*FeatureHandlers) HandleDeleteFeature

func (h *FeatureHandlers) HandleDeleteFeature(c forge.Context) error

HandleDeleteFeature handles deleting a feature.

func (*FeatureHandlers) HandleGetFeature

func (h *FeatureHandlers) HandleGetFeature(c forge.Context) error

HandleGetFeature handles getting a single feature.

func (*FeatureHandlers) HandleGetFeatureUsage

func (h *FeatureHandlers) HandleGetFeatureUsage(c forge.Context) error

HandleGetFeatureUsage handles getting usage for a specific feature.

func (*FeatureHandlers) HandleGetOrgFeatures

func (h *FeatureHandlers) HandleGetOrgFeatures(c forge.Context) error

HandleGetOrgFeatures handles getting all feature access for an organization.

func (*FeatureHandlers) HandleGetPlanFeatures

func (h *FeatureHandlers) HandleGetPlanFeatures(c forge.Context) error

HandleGetPlanFeatures handles getting all features for a plan.

func (*FeatureHandlers) HandleGrantFeature

func (h *FeatureHandlers) HandleGrantFeature(c forge.Context) error

HandleGrantFeature handles granting additional feature quota.

func (*FeatureHandlers) HandleLinkFeatureToPlan

func (h *FeatureHandlers) HandleLinkFeatureToPlan(c forge.Context) error

HandleLinkFeatureToPlan handles linking a feature to a plan.

func (*FeatureHandlers) HandleListFeatures

func (h *FeatureHandlers) HandleListFeatures(c forge.Context) error

HandleListFeatures handles listing features.

func (*FeatureHandlers) HandleListGrants

func (h *FeatureHandlers) HandleListGrants(c forge.Context) error

HandleListGrants handles listing all grants for an organization.

func (*FeatureHandlers) HandleRevokeGrant

func (h *FeatureHandlers) HandleRevokeGrant(c forge.Context) error

HandleRevokeGrant handles revoking a feature grant.

func (*FeatureHandlers) HandleSyncAllFeaturesFromProvider added in v0.0.5

func (h *FeatureHandlers) HandleSyncAllFeaturesFromProvider(c forge.Context) error

HandleSyncAllFeaturesFromProvider syncs all features from the provider.

func (*FeatureHandlers) HandleSyncFeature added in v0.0.5

func (h *FeatureHandlers) HandleSyncFeature(c forge.Context) error

HandleSyncFeature manually syncs a feature to the provider.

func (*FeatureHandlers) HandleSyncFeatureFromProvider added in v0.0.5

func (h *FeatureHandlers) HandleSyncFeatureFromProvider(c forge.Context) error

HandleSyncFeatureFromProvider syncs a feature from the provider.

func (*FeatureHandlers) HandleUnlinkFeatureFromPlan

func (h *FeatureHandlers) HandleUnlinkFeatureFromPlan(c forge.Context) error

HandleUnlinkFeatureFromPlan handles removing a feature from a plan.

func (*FeatureHandlers) HandleUpdateFeature

func (h *FeatureHandlers) HandleUpdateFeature(c forge.Context) error

HandleUpdateFeature handles updating a feature.

func (h *FeatureHandlers) HandleUpdatePlanFeatureLink(c forge.Context) error

HandleUpdatePlanFeatureLink handles updating a feature-plan link.

type PaymentHandlers added in v0.0.9

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

PaymentHandlers handles payment method HTTP endpoints.

func NewPaymentHandlers added in v0.0.9

func NewPaymentHandlers(paymentSvc paymentService, customerSvc customerService) *PaymentHandlers

NewPaymentHandlers creates a new PaymentHandlers instance.

func (*PaymentHandlers) HandleAddPaymentMethod added in v0.0.9

func (h *PaymentHandlers) HandleAddPaymentMethod(c forge.Context) error

HandleAddPaymentMethod attaches a tokenized payment method.

func (*PaymentHandlers) HandleCreateSetupIntent added in v0.0.9

func (h *PaymentHandlers) HandleCreateSetupIntent(c forge.Context) error

HandleCreateSetupIntent creates a setup intent for adding payment method.

func (*PaymentHandlers) HandleGetPaymentMethod added in v0.0.9

func (h *PaymentHandlers) HandleGetPaymentMethod(c forge.Context) error

HandleGetPaymentMethod gets a single payment method.

func (*PaymentHandlers) HandleListPaymentMethods added in v0.0.9

func (h *PaymentHandlers) HandleListPaymentMethods(c forge.Context) error

HandleListPaymentMethods lists all payment methods for org.

func (*PaymentHandlers) HandleRemovePaymentMethod added in v0.0.9

func (h *PaymentHandlers) HandleRemovePaymentMethod(c forge.Context) error

HandleRemovePaymentMethod removes a payment method.

func (*PaymentHandlers) HandleSetDefaultPaymentMethod added in v0.0.9

func (h *PaymentHandlers) HandleSetDefaultPaymentMethod(c forge.Context) error

HandleSetDefaultPaymentMethod sets default payment method.

type PublicHandlers

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

PublicHandlers handles HTTP requests for public pricing APIs.

func NewPublicHandlers

func NewPublicHandlers(featureSvc *service.FeatureService, planSvc *service.PlanService) *PublicHandlers

NewPublicHandlers creates a new public handlers instance.

func (*PublicHandlers) HandleComparePlans

func (h *PublicHandlers) HandleComparePlans(c forge.Context) error

HandleComparePlans handles comparing features across plans.

func (*PublicHandlers) HandleGetPublicPlan

func (h *PublicHandlers) HandleGetPublicPlan(c forge.Context) error

HandleGetPublicPlan handles getting a single public plan by slug.

func (*PublicHandlers) HandleGetPublicPlanFeatures

func (h *PublicHandlers) HandleGetPublicPlanFeatures(c forge.Context) error

HandleGetPublicPlanFeatures handles getting features for a public plan.

func (*PublicHandlers) HandleListPublicFeatures

func (h *PublicHandlers) HandleListPublicFeatures(c forge.Context) error

HandleListPublicFeatures handles listing all public features.

func (*PublicHandlers) HandleListPublicPlans

func (h *PublicHandlers) HandleListPublicPlans(c forge.Context) error

HandleListPublicPlans handles listing public plans with features.

type PublicPlan

type PublicPlan struct {
	ID              string                    `json:"id"`
	Slug            string                    `json:"slug"`
	Name            string                    `json:"name"`
	Description     string                    `json:"description"`
	BillingPattern  string                    `json:"billingPattern"`
	BillingInterval string                    `json:"billingInterval"`
	BasePrice       int64                     `json:"basePrice"`
	Currency        string                    `json:"currency"`
	TrialDays       int                       `json:"trialDays"`
	DisplayOrder    int                       `json:"displayOrder"`
	Features        []*core.PublicPlanFeature `json:"features,omitempty"`
	Metadata        map[string]any            `json:"metadata,omitempty"`
}

PublicPlan represents a plan in public API format.

type SetDefaultPaymentMethodRequest added in v0.0.9

type SetDefaultPaymentMethodRequest struct {
	OrganizationID xid.ID `json:"organizationId" validate:"required"`
}

SetDefaultPaymentMethodRequest is the request body for setting default payment method.

Jump to

Keyboard shortcuts

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