Documentation ¶
Index ¶
- Constants
- func NewBillingService() (core.Service, []core.ContextBuilderOption, error)
- func NewQuotaService() (core.Service, []core.ContextBuilderOption, error)
- type BillingServiceDefault
- func (b *BillingServiceDefault) CancelSubscription(ctx context.Context, userID uint) error
- func (b *BillingServiceDefault) ChangeSubscription(ctx context.Context, userID uint, planID string) error
- func (b *BillingServiceDefault) Config() (any, error)
- func (b *BillingServiceDefault) ConnectSubscription(ctx context.Context, userID uint, paymentMethodID string) error
- func (b *BillingServiceDefault) CreateCustomer(ctx context.Context, user *models.User) error
- func (b *BillingServiceDefault) CreateCustomerById(ctx context.Context, userID uint) error
- func (b *BillingServiceDefault) GenerateEphemeralKey(ctx context.Context, userID uint) (*messages.EphemeralKeyResponse, error)
- func (b *BillingServiceDefault) GetPlans(ctx context.Context) ([]*messages.SubscriptionPlan, error)
- func (b *BillingServiceDefault) GetSubscription(ctx context.Context, userID uint) (*messages.SubscriptionResponse, error)
- func (b *BillingServiceDefault) GetUserMaxDownload(userID uint) (uint64, error)
- func (b *BillingServiceDefault) GetUserMaxStorage(userID uint) (uint64, error)
- func (b *BillingServiceDefault) GetUserMaxUpload(userID uint) (uint64, error)
- func (b *BillingServiceDefault) ID() string
- func (b *BillingServiceDefault) RequestPaymentMethodChange(ctx context.Context, userID uint) (*messages.RequestPaymentMethodChangeResponse, error)
- func (b *BillingServiceDefault) UpdateBillingInfo(ctx context.Context, userID uint, billingInfo *messages.BillingInfo) error
- type Customer
- type CustomerBilling
- type CustomerBillingAddress
- type EphemeralKeyRequest
- type EphemeralKeyResponse
- type PaymentCancelRequest
- type PaymentMetadata
- type PaymentRequest
- type PaymentResponse
- type QuotaServiceDefault
- func (q *QuotaServiceDefault) CheckDownloadQuota(userID uint, requestedBytes uint64) (bool, error)
- func (q *QuotaServiceDefault) CheckStorageQuota(userID uint, requestedBytes uint64) (bool, error)
- func (q *QuotaServiceDefault) CheckUploadQuota(userID uint, requestedBytes uint64) (bool, error)
- func (b *QuotaServiceDefault) Config() (any, error)
- func (q *QuotaServiceDefault) GetCurrentUsage(userID uint) (*messages.CurrentUsageResponse, error)
- func (q *QuotaServiceDefault) GetDownloadUsageHistory(userID uint, period int) ([]*messages.UsageData, error)
- func (q *QuotaServiceDefault) GetStorageUsageHistory(userID uint, period int) ([]*messages.UsageData, error)
- func (q *QuotaServiceDefault) GetUploadUsageHistory(userID uint, period int) ([]*messages.UsageData, error)
- func (q *QuotaServiceDefault) ID() string
- func (q *QuotaServiceDefault) Reconcile() error
- func (q *QuotaServiceDefault) RecordDownload(uploadID, userID uint, bytes uint64, ip string) error
- func (q *QuotaServiceDefault) RecordStorage(uploadID, userID uint, bytes int64, ip string) error
- func (q *QuotaServiceDefault) RecordUpload(uploadID, userID uint, bytes uint64, ip string) error
- type Subscription
- type UsageType
Constants ¶
View Source
const BILLING_SERVICE = "billing"
View Source
const QUOTA_SERVICE = "quota"
Variables ¶
This section is empty.
Functions ¶
func NewBillingService ¶
func NewBillingService() (core.Service, []core.ContextBuilderOption, error)
func NewQuotaService ¶
func NewQuotaService() (core.Service, []core.ContextBuilderOption, error)
Types ¶
type BillingServiceDefault ¶
type BillingServiceDefault struct {
// contains filtered or unexported fields
}
func (*BillingServiceDefault) CancelSubscription ¶
func (b *BillingServiceDefault) CancelSubscription(ctx context.Context, userID uint) error
func (*BillingServiceDefault) ChangeSubscription ¶
func (*BillingServiceDefault) Config ¶
func (b *BillingServiceDefault) Config() (any, error)
func (*BillingServiceDefault) ConnectSubscription ¶
func (*BillingServiceDefault) CreateCustomer ¶
func (*BillingServiceDefault) CreateCustomerById ¶
func (b *BillingServiceDefault) CreateCustomerById(ctx context.Context, userID uint) error
func (*BillingServiceDefault) GenerateEphemeralKey ¶
func (b *BillingServiceDefault) GenerateEphemeralKey(ctx context.Context, userID uint) (*messages.EphemeralKeyResponse, error)
func (*BillingServiceDefault) GetPlans ¶
func (b *BillingServiceDefault) GetPlans(ctx context.Context) ([]*messages.SubscriptionPlan, error)
func (*BillingServiceDefault) GetSubscription ¶
func (b *BillingServiceDefault) GetSubscription(ctx context.Context, userID uint) (*messages.SubscriptionResponse, error)
func (*BillingServiceDefault) GetUserMaxDownload ¶
func (b *BillingServiceDefault) GetUserMaxDownload(userID uint) (uint64, error)
func (*BillingServiceDefault) GetUserMaxStorage ¶
func (b *BillingServiceDefault) GetUserMaxStorage(userID uint) (uint64, error)
func (*BillingServiceDefault) GetUserMaxUpload ¶
func (b *BillingServiceDefault) GetUserMaxUpload(userID uint) (uint64, error)
func (*BillingServiceDefault) ID ¶
func (b *BillingServiceDefault) ID() string
func (*BillingServiceDefault) RequestPaymentMethodChange ¶
func (b *BillingServiceDefault) RequestPaymentMethodChange(ctx context.Context, userID uint) (*messages.RequestPaymentMethodChangeResponse, error)
func (*BillingServiceDefault) UpdateBillingInfo ¶
func (b *BillingServiceDefault) UpdateBillingInfo(ctx context.Context, userID uint, billingInfo *messages.BillingInfo) error
type Customer ¶
type Customer struct { ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` }
Customer represents the customer information in the payment request
type CustomerBilling ¶
type CustomerBilling struct { Address CustomerBillingAddress `json:"address"` Email string `json:"email"` }
type CustomerBillingAddress ¶
type EphemeralKeyRequest ¶
type EphemeralKeyRequest struct {
CustomerID string `json:"customer_id"`
}
type EphemeralKeyResponse ¶
type EphemeralKeyResponse struct {
Secret string `json:"secret"`
}
type PaymentCancelRequest ¶
type PaymentCancelRequest struct {
CancellationReason string `json:"cancellation_reason"`
}
type PaymentMetadata ¶
type PaymentMetadata struct { SubscriptionID string `json:"subscription_id"` PlanID string `json:"plan_id"` }
PaymentMetadata represents the upload for a payment
type PaymentRequest ¶
type PaymentRequest struct { Amount float64 `json:"amount"` Currency string `json:"currency"` Confirm bool `json:"confirm"` Customer Customer `json:"customer"` Billing CustomerBilling `json:"billing,omitempty"` Description string `json:"description"` Metadata PaymentMetadata `json:"metadata"` SetupFutureUsage string `json:"setup_future_usage"` PaymentType string `json:"payment_type"` }
PaymentRequest represents the payment request payload
type PaymentResponse ¶
type PaymentResponse struct { PaymentID string `json:"payment_id"` ClientSecret string `json:"client_secret"` }
PaymentResponse represents the response from the payment creation API
type QuotaServiceDefault ¶
type QuotaServiceDefault struct {
// contains filtered or unexported fields
}
func (*QuotaServiceDefault) CheckDownloadQuota ¶
func (q *QuotaServiceDefault) CheckDownloadQuota(userID uint, requestedBytes uint64) (bool, error)
func (*QuotaServiceDefault) CheckStorageQuota ¶
func (q *QuotaServiceDefault) CheckStorageQuota(userID uint, requestedBytes uint64) (bool, error)
func (*QuotaServiceDefault) CheckUploadQuota ¶
func (q *QuotaServiceDefault) CheckUploadQuota(userID uint, requestedBytes uint64) (bool, error)
func (*QuotaServiceDefault) Config ¶
func (b *QuotaServiceDefault) Config() (any, error)
func (*QuotaServiceDefault) GetCurrentUsage ¶
func (q *QuotaServiceDefault) GetCurrentUsage(userID uint) (*messages.CurrentUsageResponse, error)
func (*QuotaServiceDefault) GetDownloadUsageHistory ¶
func (*QuotaServiceDefault) GetStorageUsageHistory ¶
func (*QuotaServiceDefault) GetUploadUsageHistory ¶
func (*QuotaServiceDefault) ID ¶
func (q *QuotaServiceDefault) ID() string
func (*QuotaServiceDefault) Reconcile ¶
func (q *QuotaServiceDefault) Reconcile() error
func (*QuotaServiceDefault) RecordDownload ¶
func (q *QuotaServiceDefault) RecordDownload(uploadID, userID uint, bytes uint64, ip string) error
func (*QuotaServiceDefault) RecordStorage ¶
func (q *QuotaServiceDefault) RecordStorage(uploadID, userID uint, bytes int64, ip string) error
func (*QuotaServiceDefault) RecordUpload ¶
func (q *QuotaServiceDefault) RecordUpload(uploadID, userID uint, bytes uint64, ip string) error
type Subscription ¶
Click to show internal directories.
Click to hide internal directories.