Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateCalendarBillingAnchor(startDate time.Time, billingPeriod BillingPeriod) time.Time
- func CalculatePeriodID(eventTimestamp time.Time, subStart time.Time, currentPeriodStart time.Time, ...) (uint64, error)
- func FormatTime(t time.Time) string
- func FromNillableString(s *string) string
- func FromNillableTime(t *time.Time) time.Time
- func GenerateUUID() string
- func GenerateUUIDWithPrefix(prefix string) string
- func GetCurrencyPrecision(code string) int32
- func GetCurrencySymbol(code string) string
- func GetEnvironmentID(ctx context.Context) string
- func GetJWT(ctx context.Context) string
- func GetRequestID(ctx context.Context) string
- func GetTenantID(ctx context.Context) string
- func GetUserID(ctx context.Context) string
- func IsMatchingCurrency(a, b string) bool
- func IsValidEmail(email string) bool
- func NextBillingDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
- func ParseTime(t string) (time.Time, error)
- func ParseYYYYMMDDToDate(date *int) *time.Time
- func ToNillableString(s string) *string
- func ToNillableTime(t time.Time) *time.Time
- func ValidateCurrencyCode(currency string) error
- type AggregationInfo
- type AggregationType
- type AuthProvider
- type AutoTopupTrigger
- type BaseFilter
- type BaseModel
- type BillingCadence
- type BillingCycle
- type BillingImpactDetails
- type BillingModel
- type BillingPeriod
- type BillingTier
- type ContextKey
- type CurrencyConfig
- type CustomerFilter
- func (f *CustomerFilter) GetExpand() Expand
- func (f *CustomerFilter) GetLimit() int
- func (f *CustomerFilter) GetOffset() int
- func (f *CustomerFilter) GetOrder() string
- func (f *CustomerFilter) GetSort() string
- func (f *CustomerFilter) GetStatus() string
- func (f *CustomerFilter) IsUnlimited() bool
- func (f CustomerFilter) Validate() error
- type DataType
- type EntitlementFilter
- func (f *EntitlementFilter) GetExpand() Expand
- func (f *EntitlementFilter) GetLimit() int
- func (f *EntitlementFilter) GetOffset() int
- func (f *EntitlementFilter) GetOrder() string
- func (f *EntitlementFilter) GetSort() string
- func (f *EntitlementFilter) GetStatus() string
- func (f *EntitlementFilter) IsUnlimited() bool
- func (f EntitlementFilter) Validate() error
- func (f *EntitlementFilter) WithExpand(expand string) *EntitlementFilter
- func (f *EntitlementFilter) WithFeatureID(featureID string) *EntitlementFilter
- func (f *EntitlementFilter) WithFeatureType(featureType FeatureType) *EntitlementFilter
- func (f *EntitlementFilter) WithIsEnabled(isEnabled bool) *EntitlementFilter
- func (f *EntitlementFilter) WithPlanIDs(planIDs []string) *EntitlementFilter
- func (f *EntitlementFilter) WithStatus(status Status) *EntitlementFilter
- type EntityType
- type EnvironmentType
- type Expand
- type ExpandConfig
- type ExpandableField
- type FeatureFilter
- func (f *FeatureFilter) GetExpand() Expand
- func (f *FeatureFilter) GetLimit() int
- func (f *FeatureFilter) GetOffset() int
- func (f *FeatureFilter) GetOrder() string
- func (f *FeatureFilter) GetSort() string
- func (f *FeatureFilter) GetStatus() string
- func (f *FeatureFilter) IsUnlimited() bool
- func (f *FeatureFilter) Validate() error
- type FeatureType
- type FileType
- type Filter
- type FilterCondition
- type FilterInfo
- type FilterOperatorType
- type InvoiceBillingReason
- type InvoiceCadence
- type InvoiceFilter
- func (f *InvoiceFilter) GetExpand() Expand
- func (f *InvoiceFilter) GetLimit() int
- func (f *InvoiceFilter) GetOffset() int
- func (f *InvoiceFilter) GetOrder() string
- func (f *InvoiceFilter) GetSort() string
- func (f *InvoiceFilter) GetStatus() string
- func (f *InvoiceFilter) IsUnlimited() bool
- func (f *InvoiceFilter) Validate() error
- type InvoiceReferencePoint
- type InvoiceStatus
- type InvoiceType
- type ListResponse
- type LogLevel
- type Metadata
- type MeterFilter
- func (f *MeterFilter) GetExpand() Expand
- func (f *MeterFilter) GetLimit() int
- func (f *MeterFilter) GetOffset() int
- func (f *MeterFilter) GetOrder() string
- func (f *MeterFilter) GetSort() string
- func (f *MeterFilter) GetStatus() string
- func (f *MeterFilter) IsUnlimited() bool
- func (f *MeterFilter) Validate() error
- type MeterInfo
- type MeterSortField
- type OnboardingEventsMessage
- type PaginationResponse
- type PauseMode
- type PauseStatus
- type PaymentDestinationType
- type PaymentFilter
- func (f *PaymentFilter) GetExpand() Expand
- func (f *PaymentFilter) GetLimit() int
- func (f *PaymentFilter) GetOffset() int
- func (f *PaymentFilter) GetOrder() string
- func (f *PaymentFilter) GetSort() string
- func (f *PaymentFilter) GetStatus() string
- func (f *PaymentFilter) IsUnlimited() bool
- func (f *PaymentFilter) Validate() error
- type PaymentMethodType
- type PaymentStatus
- type PlanFilter
- func (f *PlanFilter) GetExpand() Expand
- func (f *PlanFilter) GetLimit() int
- func (f *PlanFilter) GetOffset() int
- func (f *PlanFilter) GetOrder() string
- func (f *PlanFilter) GetSort() string
- func (f *PlanFilter) GetStatus() string
- func (f *PlanFilter) IsUnlimited() bool
- func (f *PlanFilter) Validate() error
- type PriceFilter
- func (f *PriceFilter) GetExpand() Expand
- func (f *PriceFilter) GetLimit() int
- func (f *PriceFilter) GetOffset() int
- func (f *PriceFilter) GetOrder() string
- func (f *PriceFilter) GetSort() string
- func (f *PriceFilter) GetStatus() string
- func (f *PriceFilter) IsUnlimited() bool
- func (f PriceFilter) Validate() error
- func (f *PriceFilter) WithExpand(expand string) *PriceFilter
- func (f *PriceFilter) WithPlanIDs(planIDs []string) *PriceFilter
- func (f *PriceFilter) WithPriceIDs(priceIDs []string) *PriceFilter
- func (f *PriceFilter) WithStatus(status Status) *PriceFilter
- type PriceType
- type PubSubType
- type PublishDestination
- type QueryFilter
- func (f QueryFilter) GetExpand() Expand
- func (f QueryFilter) GetLimit() int
- func (f QueryFilter) GetOffset() int
- func (f QueryFilter) GetOrder() string
- func (f QueryFilter) GetSort() string
- func (f QueryFilter) GetStatus() string
- func (f QueryFilter) IsUnlimited() bool
- func (f *QueryFilter) Merge(other QueryFilter)
- func (f QueryFilter) Validate() error
- type ResetUsage
- type ResumeMode
- type RunMode
- type SecretFilter
- func (f *SecretFilter) GetExpand() Expand
- func (f *SecretFilter) GetLimit() int
- func (f *SecretFilter) GetOffset() int
- func (f *SecretFilter) GetOrder() string
- func (f *SecretFilter) GetSort() string
- func (f *SecretFilter) GetStatus() string
- func (f *SecretFilter) IsUnlimited() bool
- func (f *SecretFilter) Validate() error
- type SecretProvider
- type SecretType
- type SortCondition
- type SortDirection
- type Status
- type SubscriptionFilter
- func (f *SubscriptionFilter) GetExpand() Expand
- func (f *SubscriptionFilter) GetLimit() int
- func (f *SubscriptionFilter) GetOffset() int
- func (f *SubscriptionFilter) GetOrder() string
- func (f *SubscriptionFilter) GetSort() string
- func (f *SubscriptionFilter) GetStatus() string
- func (f *SubscriptionFilter) IsUnlimited() bool
- func (f SubscriptionFilter) Validate() error
- type SubscriptionLineItemFilter
- type SubscriptionStatus
- type TaskFilter
- func (f *TaskFilter) GetExpand() Expand
- func (f *TaskFilter) GetLimit() int
- func (f *TaskFilter) GetOffset() int
- func (f *TaskFilter) GetOrder() string
- func (f *TaskFilter) GetSort() string
- func (f *TaskFilter) GetStatus() string
- func (f *TaskFilter) IsUnlimited() bool
- func (f *TaskFilter) Validate() error
- type TaskStatus
- type TaskType
- type TimeRangeFilter
- type TransactionReason
- type TransactionStatus
- type TransactionType
- type Value
- type WalletConfig
- type WalletConfigPriceType
- type WalletStatus
- type WalletTransactionFilter
- func (f *WalletTransactionFilter) GetExpand() Expand
- func (f *WalletTransactionFilter) GetLimit() int
- func (f *WalletTransactionFilter) GetOffset() int
- func (f *WalletTransactionFilter) GetOrder() string
- func (f *WalletTransactionFilter) GetSort() string
- func (f *WalletTransactionFilter) GetStatus() string
- func (f *WalletTransactionFilter) IsUnlimited() bool
- func (f WalletTransactionFilter) Validate() error
- type WalletTxReferenceType
- type WalletType
- type WebhookEvent
- type WindowSize
Constants ¶
const ( FILTER_DEFAULT_LIMIT = 50 FILTER_DEFAULT_STATUS = string(StatusPublished) FILTER_DEFAULT_SORT = "created_at" FILTER_DEFAULT_ORDER = "desc" OrderDesc = "desc" OrderAsc = "asc" )
const ( HeaderEnvironment = "X-Environment-ID" HeaderRequestID = "X-Request-ID" HeaderAuthorization = "Authorization" )
const ( PRICE_TYPE_USAGE PriceType = "USAGE" PRICE_TYPE_FIXED PriceType = "FIXED" // Billing model for a flat fee per unit BILLING_MODEL_FLAT_FEE BillingModel = "FLAT_FEE" // Billing model for a package of units ex 1000 emails for $100 BILLING_MODEL_PACKAGE BillingModel = "PACKAGE" // Billing model for a tiered pricing model // ex 1-100 emails for $100, 101-1000 emails for $90 BILLING_MODEL_TIERED BillingModel = "TIERED" // For BILLING_CADENCE_RECURRING BILLING_PERIOD_MONTHLY BillingPeriod = "MONTHLY" BILLING_PERIOD_ANNUAL BillingPeriod = "ANNUAL" BILLING_PERIOD_WEEKLY BillingPeriod = "WEEKLY" BILLING_PERIOD_DAILY BillingPeriod = "DAILY" BILLING_PERIOD_QUARTER BillingPeriod = "QUARTERLY" BILLING_PERIOD_HALF_YEAR BillingPeriod = "HALF_YEARLY" BILLING_CADENCE_RECURRING BillingCadence = "RECURRING" BILLING_CADENCE_ONETIME BillingCadence = "ONETIME" // BILLING_TIER_VOLUME means all units price based on final tier reached. BILLING_TIER_VOLUME BillingTier = "VOLUME" // BILLING_TIER_SLAB means Tiers apply progressively as quantity increases BILLING_TIER_SLAB BillingTier = "SLAB" // MAX_BILLING_AMOUNT is the maximum allowed billing amount (as a safeguard) MAX_BILLING_AMOUNT = 1000000000000 // 1 trillion // ROUND_UP rounds to the ceiling value ex 1.99 -> 2.00 ROUND_UP = "up" // ROUND_DOWN rounds to the floor value ex 1.99 -> 1.00 ROUND_DOWN = "down" // ROUND_NEAREST rounds to the nearest value ex ROUND_NEAREST = "nearest" // DEFAULT_FLOATING_PRECISION is the default floating point precision DEFAULT_FLOATING_PRECISION = 2 )
const ( UUID_PREFIX_EVENT = "event" UUID_PREFIX_METER = "meter" UUID_PREFIX_PLAN = "plan" UUID_PREFIX_PRICE = "price" UUID_PREFIX_INVOICE = "inv" UUID_PREFIX_INVOICE_LINE_ITEM = "inv_line" UUID_PREFIX_SUBSCRIPTION = "subs" UUID_PREFIX_SUBSCRIPTION_LINE_ITEM = "subs_line" UUID_PREFIX_SUBSCRIPTION_PAUSE = "pause" UUID_PREFIX_CUSTOMER = "cust" UUID_PREFIX_WALLET = "wallet" UUID_PREFIX_WALLET_TRANSACTION = "wtxn" UUID_PREFIX_ENVIRONMENT = "env" UUID_PREFIX_USER = "user" UUID_PREFIX_TENANT = "tenant" UUID_PREFIX_FEATURE = "feat" UUID_PREFIX_ENTITLEMENT = "ent" UUID_PREFIX_PAYMENT = "pay" UUID_PREFIX_PAYMENT_ATTEMPT = "attempt" UUID_PREFIX_TASK = "task" UUID_PREFIX_SECRET = "secret" UUID_PREFIX_WEBHOOK_EVENT = "webhook" )
const ( WebhookEventInvoiceCreateDraft = "invoice.create.drafted" WebhookEventInvoiceUpdateFinalized = "invoice.update.finalized" WebhookEventInvoiceUpdatePayment = "invoice.updated.payment" WebhookEventInvoiceUpdateVoided = "invoice.update.voided" )
Common webhook event names
const ( WebhookEventSubscriptionCreated = "subscription.created" WebhookEventSubscriptionPaused = "subscription.paused" WebhookEventSubscriptionCancelled = "subscription.cancelled" WebhookEventSubscriptionResumed = "subscription.resumed" WebhookEventSubscriptionExpired = "subscription.expired" )
subscription event names
const ( WebhookEventWalletCreated = "wallet.created" WebhookEventWalletUpdated = "wallet.updated" WebhookEventWalletTerminated = "wallet.terminated" WebhookEventWalletDepletedOngoingBalance = "wallet.depleted_ongoing_balance" WebhookEventWalletTransactionCreated = "wallet.transaction.created" WebhookEventWalletTransactionUpdated = "wallet.transaction.updated" WebhookEventWalletTransactionPaymentFailure = "wallet.transaction.payment_failure" WebhookEventWalletTransactionPaymentSuccess = "wallet.transaction.payment_success" WebhookEventWalletTransactionPaymentFailed = "wallet.transaction.payment_failed" )
wallet event names
const ( WebhookEventPaymentCreated = "payment.created" WebhookEventPaymentUpdated = "payment.updated" WebhookEventPaymentFailed = "payment.failed" WebhookEventPaymentSuccess = "payment.success" WebhookEventPaymentPending = "payment.pending" WebhookEventPaymentDeclined = "payment.declined" WebhookEventPaymentReversed = "payment.reversed" )
payment event names
const ( WebhookEventCustomerCreated = "customer.created" WebhookEventCustomerUpdated = "customer.updated" WebhookEventCustomerDeleted = "customer.deleted" )
customer event names
const (
DEFAULT_PRECISION = 2
)
const (
InvoiceDefaultDueDays = 1
)
Variables ¶
var ( // PlanExpandConfig defines what can be expanded on a plan PlanExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandPrices, ExpandMeters, ExpandEntitlements}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandPrices: {ExpandMeters}, ExpandEntitlements: {ExpandFeatures}, }, } // PriceExpandConfig defines what can be expanded on a price PriceExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandMeters: {}}, } // SubscriptionExpandConfig defines what can be expanded on a subscription SubscriptionExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandPlan, ExpandPrices, ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandPlan: {ExpandPrices}, ExpandPrices: {ExpandMeters}, }, } // EntitlementExpandConfig defines what can be expanded on an entitlement EntitlementExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandFeatures}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandFeatures: {}}, } )
Common expand configurations
var CURRENCY_CONFIG = map[string]CurrencyConfig{
"usd": {Symbol: "$", Precision: 2},
"eur": {Symbol: "€", Precision: 2},
"gbp": {Symbol: "£", Precision: 2},
"aud": {Symbol: "AUS", Precision: 2},
"cad": {Symbol: "CAD", Precision: 2},
"jpy": {Symbol: "¥", Precision: 0},
"inr": {Symbol: "₹", Precision: 2},
"idr": {Symbol: "Rp", Precision: 2},
"sgd": {Symbol: "S$", Precision: 2},
"thb": {Symbol: "฿", Precision: 2},
"myr": {Symbol: "RM", Precision: 2},
"php": {Symbol: "₱", Precision: 2},
"vnd": {Symbol: "₫", Precision: 0},
"hkd": {Symbol: "HK$", Precision: 2},
"krw": {Symbol: "₩", Precision: 0},
"nzd": {Symbol: "NZ$", Precision: 2},
"brl": {Symbol: "R$", Precision: 2},
"chf": {Symbol: "CHF", Precision: 2},
"clp": {Symbol: "CLP$", Precision: 0},
"cny": {Symbol: "CN¥", Precision: 2},
"czk": {Symbol: "CZK", Precision: 2},
"dkk": {Symbol: "DKK", Precision: 2},
"huf": {Symbol: "HUF", Precision: 2},
"ils": {Symbol: "₪", Precision: 2},
"mxn": {Symbol: "MX$", Precision: 2},
"nok": {Symbol: "NOK", Precision: 2},
"pln": {Symbol: "PLN", Precision: 2},
"ron": {Symbol: "RON", Precision: 2},
"rub": {Symbol: "₽", Precision: 2},
"sar": {Symbol: "SAR", Precision: 2},
"sek": {Symbol: "SEK", Precision: 2},
"try": {Symbol: "TRY", Precision: 2},
"twd": {Symbol: "NT$", Precision: 2},
"zar": {Symbol: "ZAR", Precision: 2},
}
CurrencyConfig holds configuration for different currencies and their symbols
var FeatureExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandMeters: {}, }, }
FeatureExpandConfig defines the allowed expand fields for features
var SecretExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{}, NestedExpands: map[ExpandableField][]ExpandableField{}, }
SecretExpandConfig defines the allowed expand fields for secrets
Functions ¶
func CalculateCalendarBillingAnchor ¶ added in v1.0.17
func CalculateCalendarBillingAnchor(startDate time.Time, billingPeriod BillingPeriod) time.Time
func CalculatePeriodID ¶ added in v1.0.17
func CalculatePeriodID( eventTimestamp time.Time, subStart time.Time, currentPeriodStart time.Time, currentPeriodEnd time.Time, billingAnchor time.Time, periodUnit int, periodType BillingPeriod, ) (uint64, error)
CalculatePeriodID determines the appropriate billing period start for an event timestamp and returns it as a uint64 epoch millisecond timestamp (for ClickHouse period_id column) It handles three cases: 1. Event timestamp falls within current billing period -> return current period start 2. Event timestamp is before current period start -> reject the event for now TODO: we can return the previous period start if we want to but need to rethink as if the current period is the switched to next period, then it means invoice is already created so maybe we should not process the event at all 3. Event timestamp is after current period end -> find appropriate future period
func FormatTime ¶
func FromNillableString ¶
FromNillableString returns the string value or empty string if nil
func FromNillableTime ¶
FromNillableTime returns the time value or zero time if nil
func GenerateUUIDWithPrefix ¶
GenerateUUIDWithPrefix returns a k-sortable unique identifier with a prefix ex inv_0ujsswThIGTUYm2K8FjOOfXtY1K
func GetCurrencyPrecision ¶
GetCurrencyPrecision returns the precision for a given currency code if the code is not found, it returns the default precision of 2
func GetCurrencySymbol ¶
GetCurrencySymbol returns the symbol for a given currency code if the code is not found, it returns the code itself
func GetEnvironmentID ¶
func GetRequestID ¶
func GetTenantID ¶
func IsMatchingCurrency ¶
func IsValidEmail ¶
func NextBillingDate ¶
func NextBillingDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
NextBillingDate calculates the next billing date based on the current period start, billing anchor, billing period, and billing period unit. The billing anchor determines the reference point for billing cycles: - For MONTHLY periods, it sets the day of the month - For ANNUAL periods, it sets the month and day of the year - For WEEKLY/DAILY periods, it's used only for validation
func ParseYYYYMMDDToDate ¶
ParseYYYYMMDDToDate converts YYYYMMDD integer to time.Time with beginning of day time for ex 20250101 means the credits will expire on 2025-01-01 00:00:00 UTC hence they will be available for use until 2024-12-31 23:59:59 UTC
func ToNillableString ¶
ToNillableString returns a pointer to the string if not empty, nil otherwise
func ToNillableTime ¶
ToNillableTime returns a pointer to the time if not zero, nil otherwise
func ValidateCurrencyCode ¶
ValidateCurrencyCode validates a currency code it checks if the currency code is 3 characters long and if it is a valid currency code TODO : use some library to validate iso 3166-1 alpha-3 currency codes
Types ¶
type AggregationInfo ¶ added in v1.0.0
type AggregationInfo struct {
Type AggregationType `json:"type"`
Field string `json:"field"`
}
AggregationInfo contains aggregation configuration
type AggregationType ¶
type AggregationType string
AggregationType is a type for the type of aggregation to be performed on a meter This is used to determine which aggregator to use when querying the database
const ( AggregationCount AggregationType = "COUNT" AggregationSum AggregationType = "SUM" AggregationAvg AggregationType = "AVG" AggregationCountUnique AggregationType = "COUNT_UNIQUE" )
func (AggregationType) RequiresField ¶
func (t AggregationType) RequiresField() bool
RequiresField returns true if the aggregation type requires a field
func (AggregationType) Validate ¶
func (t AggregationType) Validate() bool
type AuthProvider ¶
type AuthProvider string
const ( AuthProviderFlexprice AuthProvider = "flexprice" AuthProviderSupabase AuthProvider = "supabase" )
type AutoTopupTrigger ¶
type AutoTopupTrigger string
AutoTopupTrigger represents the type of trigger for auto top-up
const ( // AutoTopupTriggerDisabled represents disabled auto top-up AutoTopupTriggerDisabled AutoTopupTrigger = "disabled" // AutoTopupTriggerBalanceBelowThreshold represents auto top-up when balance goes below threshold AutoTopupTriggerBalanceBelowThreshold AutoTopupTrigger = "balance_below_threshold" )
func (AutoTopupTrigger) String ¶
func (t AutoTopupTrigger) String() string
String returns the string representation of AutoTopupTrigger
func (AutoTopupTrigger) Validate ¶
func (t AutoTopupTrigger) Validate() error
type BaseFilter ¶
type BaseFilter interface {
GetLimit() int
GetOffset() int
GetStatus() string
GetSort() string
GetOrder() string
GetExpand() Expand
Validate() error
IsUnlimited() bool
}
BaseFilter defines common filtering capabilities
type BaseModel ¶
type BaseModel struct {
TenantID string `db:"tenant_id" json:"tenant_id"`
Status Status `db:"status" json:"status"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
CreatedBy string `db:"created_by" json:"created_by"`
UpdatedBy string `db:"updated_by" json:"updated_by"`
}
BaseModel is a base model for all domain models that need to be persisted in the database Any changes to this model should be reflected in the database schema by running migrations
func GetDefaultBaseModel ¶
type BillingCadence ¶
type BillingCadence string
BillingCadence is the billing cadence for the price ex RECURRING, ONETIME
func (BillingCadence) Validate ¶
func (b BillingCadence) Validate() error
type BillingCycle ¶ added in v1.0.17
type BillingCycle string
BillingCycle is the cycle of the billing anchor. This is used to determine the billing anchor for the subscription. It can be either anniversary or calendar. If it's anniversary, the billing anchor will be the start date of the subscription. If it's calendar, the billing anchor will be the appropriate date based on the billing period.
const ( BillingCycleAnniversary BillingCycle = "anniversary" BillingCycleCalendar BillingCycle = "calendar" )
func (BillingCycle) Validate ¶ added in v1.0.17
func (b BillingCycle) Validate() error
type BillingImpactDetails ¶
type BillingImpactDetails struct {
// The amount that will be adjusted for the current period
// Positive value indicates a charge to the customer
// Negative value indicates a credit to the customer
PeriodAdjustmentAmount decimal.Decimal `json:"period_adjustment_amount,omitempty"`
// The date when the next invoice will be generated
// For paused subscriptions, this will be after the pause ends
NextBillingDate *time.Time `json:"next_billing_date,omitempty"`
// The amount that will be charged on the next billing date
// This may be prorated if resuming mid-period
NextBillingAmount decimal.Decimal `json:"next_billing_amount,omitempty"`
// The original billing cycle dates before pause
OriginalPeriodStart *time.Time `json:"original_period_start,omitempty"`
OriginalPeriodEnd *time.Time `json:"original_period_end,omitempty"`
// The adjusted billing cycle dates after pause
AdjustedPeriodStart *time.Time `json:"adjusted_period_start,omitempty"`
AdjustedPeriodEnd *time.Time `json:"adjusted_period_end,omitempty"`
// The total pause duration in days
PauseDurationDays int `json:"pause_duration_days,omitempty"`
}
BillingImpactDetails provides detailed information about the financial impact of subscription actions
type BillingModel ¶
type BillingModel string
BillingModel is the billing model for the price ex FLAT_FEE, PACKAGE, TIERED
func (BillingModel) Validate ¶
func (b BillingModel) Validate() error
type BillingPeriod ¶
type BillingPeriod string
BillingPeriod is the billing period for the price ex MONTHLY, ANNUAL, WEEKLY, DAILY
func (BillingPeriod) Validate ¶
func (b BillingPeriod) Validate() error
type BillingTier ¶
type BillingTier string
BillingTier when Billing model is TIERED defines how to calculate the price for a given quantity
func (BillingTier) Validate ¶
func (b BillingTier) Validate() error
type ContextKey ¶
type ContextKey string
ContextKey is a type for the keys of values stored in the context
const ( CtxRequestID ContextKey = "ctx_request_id" CtxTenantID ContextKey = "ctx_tenant_id" CtxUserID ContextKey = "ctx_user_id" CtxJWT ContextKey = "ctx_jwt" CtxEnvironmentID ContextKey = "ctx_environment_id" CtxDBTransaction ContextKey = "ctx_db_transaction" // Default values DefaultTenantID = "00000000-0000-0000-0000-000000000000" DefaultUserID = "00000000-0000-0000-0000-000000000000" )
type CurrencyConfig ¶
func GetCurrencyConfig ¶
func GetCurrencyConfig(code string) CurrencyConfig
type CustomerFilter ¶
type CustomerFilter struct {
*QueryFilter
*TimeRangeFilter
// filters allows complex filtering based on multiple fields
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
CustomerIDs []string `json:"customer_ids,omitempty" form:"customer_ids" validate:"omitempty"`
ExternalID string `json:"external_id,omitempty" form:"external_id" validate:"omitempty"`
Email string `json:"email,omitempty" form:"email" validate:"omitempty,email"`
}
CustomerFilter represents filters for customer queries
func NewCustomerFilter ¶
func NewCustomerFilter() *CustomerFilter
NewCustomerFilter creates a new CustomerFilter with default values
func NewNoLimitCustomerFilter ¶
func NewNoLimitCustomerFilter() *CustomerFilter
NewNoLimitCustomerFilter creates a new CustomerFilter with no pagination limits
func (*CustomerFilter) GetExpand ¶
func (f *CustomerFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CustomerFilter) GetLimit ¶
func (f *CustomerFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CustomerFilter) GetOffset ¶
func (f *CustomerFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CustomerFilter) GetOrder ¶
func (f *CustomerFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CustomerFilter) GetSort ¶
func (f *CustomerFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CustomerFilter) GetStatus ¶
func (f *CustomerFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CustomerFilter) IsUnlimited ¶
func (f *CustomerFilter) IsUnlimited() bool
func (CustomerFilter) Validate ¶
func (f CustomerFilter) Validate() error
Validate validates the customer filter
type EntitlementFilter ¶
type EntitlementFilter struct {
*QueryFilter
*TimeRangeFilter
// Specific filters for entitlements
PlanIDs []string `form:"plan_ids" json:"plan_ids,omitempty"`
FeatureIDs []string `form:"feature_ids" json:"feature_ids,omitempty"`
FeatureType *FeatureType `form:"feature_type" json:"feature_type,omitempty"`
IsEnabled *bool `form:"is_enabled" json:"is_enabled,omitempty"`
}
EntitlementFilter defines filters for querying entitlements
func NewDefaultEntitlementFilter ¶
func NewDefaultEntitlementFilter() *EntitlementFilter
NewDefaultEntitlementFilter creates a new EntitlementFilter with default values
func NewNoLimitEntitlementFilter ¶
func NewNoLimitEntitlementFilter() *EntitlementFilter
NewNoLimitEntitlementFilter creates a new EntitlementFilter with no pagination limits
func (*EntitlementFilter) GetExpand ¶
func (f *EntitlementFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*EntitlementFilter) GetLimit ¶
func (f *EntitlementFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*EntitlementFilter) GetOffset ¶
func (f *EntitlementFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*EntitlementFilter) GetOrder ¶
func (f *EntitlementFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*EntitlementFilter) GetSort ¶
func (f *EntitlementFilter) GetSort() string
GetSort implements BaseFilter interface
func (*EntitlementFilter) GetStatus ¶
func (f *EntitlementFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*EntitlementFilter) IsUnlimited ¶
func (f *EntitlementFilter) IsUnlimited() bool
IsUnlimited returns true if this is an unlimited query
func (EntitlementFilter) Validate ¶
func (f EntitlementFilter) Validate() error
Validate validates the filter fields
func (*EntitlementFilter) WithExpand ¶
func (f *EntitlementFilter) WithExpand(expand string) *EntitlementFilter
WithExpand sets the expand on the filter
func (*EntitlementFilter) WithFeatureID ¶
func (f *EntitlementFilter) WithFeatureID(featureID string) *EntitlementFilter
WithFeatureID adds feature ID to the filter
func (*EntitlementFilter) WithFeatureType ¶
func (f *EntitlementFilter) WithFeatureType(featureType FeatureType) *EntitlementFilter
WithFeatureType adds feature type to the filter
func (*EntitlementFilter) WithIsEnabled ¶
func (f *EntitlementFilter) WithIsEnabled(isEnabled bool) *EntitlementFilter
WithIsEnabled adds is_enabled to the filter
func (*EntitlementFilter) WithPlanIDs ¶
func (f *EntitlementFilter) WithPlanIDs(planIDs []string) *EntitlementFilter
WithPlanIDs adds plan IDs to the filter
func (*EntitlementFilter) WithStatus ¶
func (f *EntitlementFilter) WithStatus(status Status) *EntitlementFilter
WithStatus sets the status on the filter
type EntityType ¶
type EntityType string
const ( EntityTypeEvents EntityType = "EVENTS" EntityTypePrices EntityType = "PRICES" EntityTypeCustomers EntityType = "CUSTOMERS" )
func (EntityType) String ¶
func (e EntityType) String() string
func (EntityType) Validate ¶
func (e EntityType) Validate() error
type EnvironmentType ¶
type EnvironmentType string
EnvironmentType defines the type of environment.
const ( EnvironmentDevelopment EnvironmentType = "development" EnvironmentProduction EnvironmentType = "production" )
func (EnvironmentType) DisplayTitle ¶
func (e EnvironmentType) DisplayTitle() string
func (EnvironmentType) String ¶
func (e EnvironmentType) String() string
type Expand ¶
type Expand struct {
Fields map[ExpandableField]bool
NestedExpands map[ExpandableField]Expand
}
Expand represents the expand parameter in API requests
func (Expand) GetNested ¶
func (e Expand) GetNested(field ExpandableField) Expand
GetNested returns the nested expands for a field
func (Expand) Has ¶
func (e Expand) Has(field ExpandableField) bool
Has checks if a field should be expanded
func (Expand) Validate ¶
func (e Expand) Validate(config ExpandConfig) error
Validate checks if the expand request is valid according to the config
type ExpandConfig ¶
type ExpandConfig struct {
// AllowedFields are the fields that can be expanded at this level
AllowedFields []ExpandableField
// NestedExpands defines which fields can be expanded within an expanded field
NestedExpands map[ExpandableField][]ExpandableField
}
ExpandConfig defines which fields can be expanded and their nested expansions
type ExpandableField ¶
type ExpandableField string
ExpandableField represents a field that can be expanded in API responses
const ( ExpandPrices ExpandableField = "prices" ExpandPlan ExpandableField = "plan" ExpandMeters ExpandableField = "meters" ExpandFeatures ExpandableField = "features" ExpandPlans ExpandableField = "plans" ExpandEntitlements ExpandableField = "entitlements" )
Common expandable fields
type FeatureFilter ¶
type FeatureFilter struct {
*QueryFilter
*TimeRangeFilter
// filters allows complex filtering based on multiple fields
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
// Feature specific filters
FeatureIDs []string `form:"feature_ids" json:"feature_ids"`
MeterIDs []string `form:"meter_ids" json:"meter_ids"`
LookupKey string `form:"lookup_key" json:"lookup_key"`
NameContains string `form:"name_contains" json:"name_contains"`
}
func NewDefaultFeatureFilter ¶
func NewDefaultFeatureFilter() *FeatureFilter
func NewNoLimitFeatureFilter ¶
func NewNoLimitFeatureFilter() *FeatureFilter
func (*FeatureFilter) GetExpand ¶
func (f *FeatureFilter) GetExpand() Expand
GetExpand returns the expand filter
func (*FeatureFilter) GetLimit ¶
func (f *FeatureFilter) GetLimit() int
func (*FeatureFilter) GetOffset ¶
func (f *FeatureFilter) GetOffset() int
func (*FeatureFilter) GetOrder ¶
func (f *FeatureFilter) GetOrder() string
func (*FeatureFilter) GetSort ¶
func (f *FeatureFilter) GetSort() string
func (*FeatureFilter) GetStatus ¶
func (f *FeatureFilter) GetStatus() string
func (*FeatureFilter) IsUnlimited ¶
func (f *FeatureFilter) IsUnlimited() bool
func (*FeatureFilter) Validate ¶
func (f *FeatureFilter) Validate() error
type FeatureType ¶
type FeatureType string
const ( FeatureTypeMetered FeatureType = "metered" FeatureTypeBoolean FeatureType = "boolean" FeatureTypeStatic FeatureType = "static" )
func (FeatureType) String ¶
func (f FeatureType) String() string
func (FeatureType) Validate ¶
func (f FeatureType) Validate() error
type Filter ¶
type Filter struct {
Limit int `form:"limit,default=50"`
Offset int `form:"offset,default=0"`
Status Status `form:"status,default=published"`
Sort string `form:"sort,default=created_at"`
Order string `form:"order,default=desc"`
Expand string `form:"expand"`
}
TODO : deprecate
type FilterCondition ¶ added in v1.0.17
type FilterCondition struct {
Field *string `json:"field" form:"field"`
Operator *FilterOperatorType `json:"operator" form:"operator"`
DataType *DataType `json:"data_type" form:"data_type"`
Value *Value `json:"value" form:"value"`
}
func (*FilterCondition) Validate ¶ added in v1.0.17
func (f *FilterCondition) Validate() error
type FilterInfo ¶ added in v1.0.0
FilterInfo contains filter configuration
type FilterOperatorType ¶ added in v1.0.17
type FilterOperatorType string
const ( // equal EQUAL FilterOperatorType = "eq" // string CONTAINS FilterOperatorType = "contains" // number GREATER_THAN FilterOperatorType = "gt" LESS_THAN FilterOperatorType = "lt" // array IN FilterOperatorType = "in" NOT_IN FilterOperatorType = "not_in" // date BEFORE FilterOperatorType = "before" AFTER FilterOperatorType = "after" )
type InvoiceBillingReason ¶
type InvoiceBillingReason string
const ( // InvoiceBillingReasonSubscriptionCreate indicates invoice is for subscription creation InvoiceBillingReasonSubscriptionCreate InvoiceBillingReason = "SUBSCRIPTION_CREATE" // InvoiceBillingReasonSubscriptionCycle indicates invoice is for subscription renewal InvoiceBillingReasonSubscriptionCycle InvoiceBillingReason = "SUBSCRIPTION_CYCLE" // InvoiceBillingReasonSubscriptionUpdate indicates invoice is for subscription update InvoiceBillingReasonSubscriptionUpdate InvoiceBillingReason = "SUBSCRIPTION_UPDATE" // InvoiceBillingReasonManual indicates invoice is created manually InvoiceBillingReasonManual InvoiceBillingReason = "MANUAL" )
func (InvoiceBillingReason) String ¶
func (r InvoiceBillingReason) String() string
func (InvoiceBillingReason) Validate ¶
func (r InvoiceBillingReason) Validate() error
type InvoiceCadence ¶
type InvoiceCadence string
InvoiceCadence is the cadence of the invoice ex ARREAR, ADVANCE, etc
const ( // InvoiceCadenceArrear raises an invoice at the end of each billing period (in arrears) InvoiceCadenceArrear InvoiceCadence = "ARREAR" // InvoiceCadenceAdvance raises an invoice at the beginning of each billing period (in advance) InvoiceCadenceAdvance InvoiceCadence = "ADVANCE" )
func (InvoiceCadence) String ¶
func (c InvoiceCadence) String() string
func (InvoiceCadence) Validate ¶
func (c InvoiceCadence) Validate() error
type InvoiceFilter ¶
type InvoiceFilter struct {
*QueryFilter
*TimeRangeFilter
InvoiceIDs []string `json:"invoice_ids,omitempty" form:"invoice_ids"`
CustomerID string `json:"customer_id,omitempty" form:"customer_id"`
SubscriptionID string `json:"subscription_id,omitempty" form:"subscription_id"`
InvoiceType InvoiceType `json:"invoice_type,omitempty" form:"invoice_type"`
InvoiceStatus []InvoiceStatus `json:"invoice_status,omitempty" form:"invoice_status"`
PaymentStatus []PaymentStatus `json:"payment_status,omitempty" form:"payment_status"`
AmountDueGt *decimal.Decimal `json:"amount_due_gt,omitempty" form:"amount_due_gt"`
AmountRemainingGt *decimal.Decimal `json:"amount_remaining_gt,omitempty" form:"amount_remaining_gt"`
}
InvoiceFilter represents the filter options for listing invoices
func NewInvoiceFilter ¶
func NewInvoiceFilter() *InvoiceFilter
NewInvoiceFilter creates a new invoice filter with default options
func NewNoLimitInvoiceFilter ¶
func NewNoLimitInvoiceFilter() *InvoiceFilter
NewNoLimitInvoiceFilter creates a new invoice filter without pagination
func (*InvoiceFilter) GetExpand ¶
func (f *InvoiceFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*InvoiceFilter) GetLimit ¶
func (f *InvoiceFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*InvoiceFilter) GetOffset ¶
func (f *InvoiceFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*InvoiceFilter) GetOrder ¶
func (f *InvoiceFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*InvoiceFilter) GetSort ¶
func (f *InvoiceFilter) GetSort() string
GetSort implements BaseFilter interface
func (*InvoiceFilter) GetStatus ¶
func (f *InvoiceFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*InvoiceFilter) IsUnlimited ¶
func (f *InvoiceFilter) IsUnlimited() bool
func (*InvoiceFilter) Validate ¶
func (f *InvoiceFilter) Validate() error
Validate validates the invoice filter
type InvoiceReferencePoint ¶ added in v1.0.0
type InvoiceReferencePoint string
InvoiceReferencePoint indicates the point in time relative to a billing period that determines which charges to include in an invoice
const ( // ReferencePointPeriodStart indicates invoice creation at the beginning of a period (for advance charges) ReferencePointPeriodStart InvoiceReferencePoint = "period_start" // ReferencePointPeriodEnd indicates invoice creation at the end of a period (for arrear charges) ReferencePointPeriodEnd InvoiceReferencePoint = "period_end" // ReferencePointPreview indicates a preview invoice that should include all charges ReferencePointPreview InvoiceReferencePoint = "preview" )
func (InvoiceReferencePoint) String ¶ added in v1.0.0
func (r InvoiceReferencePoint) String() string
func (InvoiceReferencePoint) Validate ¶ added in v1.0.0
func (r InvoiceReferencePoint) Validate() error
type InvoiceStatus ¶
type InvoiceStatus string
const ( // InvoiceStatusDraft indicates invoice is in draft state and can be modified InvoiceStatusDraft InvoiceStatus = "DRAFT" // InvoiceStatusFinalized indicates invoice is finalized and ready for payment InvoiceStatusFinalized InvoiceStatus = "FINALIZED" // InvoiceStatusVoided indicates invoice has been voided InvoiceStatusVoided InvoiceStatus = "VOIDED" )
func (InvoiceStatus) String ¶
func (s InvoiceStatus) String() string
func (InvoiceStatus) Validate ¶
func (s InvoiceStatus) Validate() error
type InvoiceType ¶
type InvoiceType string
const ( // InvoiceTypeSubscription indicates invoice is for subscription charges InvoiceTypeSubscription InvoiceType = "SUBSCRIPTION" // InvoiceTypeOneOff indicates invoice is for one-time charges InvoiceTypeOneOff InvoiceType = "ONE_OFF" // InvoiceTypeCredit indicates invoice is for credit adjustments InvoiceTypeCredit InvoiceType = "CREDIT" )
func (InvoiceType) String ¶
func (t InvoiceType) String() string
func (InvoiceType) Validate ¶
func (t InvoiceType) Validate() error
type ListResponse ¶
type ListResponse[T any] struct { Items []T `json:"items"` Pagination PaginationResponse `json:"pagination"` }
ListResponse represents a paginated response with items
func NewListResponse ¶
func NewListResponse[T any](items []T, total, limit, offset int) ListResponse[T]
NewListResponse creates a new list response with pagination
type Metadata ¶
Metadata represents a JSONB field for storing key-value pairs
type MeterFilter ¶
type MeterFilter struct {
*QueryFilter
*TimeRangeFilter
EventName string `json:"event_name,omitempty"`
MeterIDs []string `json:"meter_ids,omitempty"`
}
MeterFilter represents the filter options for meter queries
func NewMeterFilter ¶
func NewMeterFilter() *MeterFilter
NewMeterFilter creates a new MeterFilter with default values
func NewNoLimitMeterFilter ¶
func NewNoLimitMeterFilter() *MeterFilter
NewNoLimitMeterFilter creates a new MeterFilter with no pagination limits
func (*MeterFilter) GetExpand ¶
func (f *MeterFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*MeterFilter) GetLimit ¶
func (f *MeterFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*MeterFilter) GetOffset ¶
func (f *MeterFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*MeterFilter) GetOrder ¶
func (f *MeterFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*MeterFilter) GetSort ¶
func (f *MeterFilter) GetSort() string
GetSort implements BaseFilter interface
func (*MeterFilter) GetStatus ¶
func (f *MeterFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*MeterFilter) IsUnlimited ¶
func (f *MeterFilter) IsUnlimited() bool
func (*MeterFilter) Validate ¶
func (f *MeterFilter) Validate() error
Validate validates the meter filter
type MeterInfo ¶ added in v1.0.0
type MeterInfo struct {
ID string `json:"id"`
EventName string `json:"event_name"`
Aggregation AggregationInfo `json:"aggregation"`
Filters []FilterInfo `json:"filters"`
}
MeterInfo contains the essential meter information for event generation
type MeterSortField ¶
type MeterSortField string
MeterSortField represents the available fields for sorting meters
const ( MeterSortFieldCreatedAt MeterSortField = "created_at" MeterSortFieldName MeterSortField = "name" MeterSortFieldEventName MeterSortField = "event_name" )
type OnboardingEventsMessage ¶ added in v1.0.0
type OnboardingEventsMessage struct {
CustomerID string `json:"customer_id"`
CustomerExtID string `json:"customer_ext_id"`
FeatureID string `json:"feature_id"`
FeatureName string `json:"feature_name"`
Duration int `json:"duration"`
Meters []MeterInfo `json:"meters"`
RequestTimestamp time.Time `json:"request_timestamp"`
SubscriptionID string `json:"subscription_id,omitempty"`
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
UserID string `json:"user_id"`
}
OnboardingEventsMessage represents a message for generating onboarding events
func (*OnboardingEventsMessage) Marshal ¶ added in v1.0.0
func (m *OnboardingEventsMessage) Marshal() ([]byte, error)
Marshal converts the message to JSON
func (*OnboardingEventsMessage) Unmarshal ¶ added in v1.0.0
func (m *OnboardingEventsMessage) Unmarshal(data []byte) error
Unmarshal converts JSON to a message
type PaginationResponse ¶
type PaginationResponse struct {
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
PaginationResponse represents standardized pagination metadata
func NewPaginationResponse ¶
func NewPaginationResponse(total, limit, offset int) PaginationResponse
NewPaginationResponse creates a new pagination response
type PauseMode ¶
type PauseMode string
PauseMode represents the mode of pausing a subscription
const ( // PauseModeImmediate pauses the subscription immediately PauseModeImmediate PauseMode = "immediate" // PauseModeScheduled pauses the subscription at a scheduled time PauseModeScheduled PauseMode = "scheduled" // PauseModePeriodEnd pauses the subscription at the end of the current billing period // Not supported in Phase 0 PauseModePeriodEnd PauseMode = "period_end" )
type PauseStatus ¶
type PauseStatus string
PauseStatus represents the pause state of a subscription
const ( // PauseStatusNone indicates the subscription is not paused PauseStatusNone PauseStatus = "none" // PauseStatusActive indicates the subscription is currently paused PauseStatusActive PauseStatus = "active" // PauseStatusScheduled indicates the subscription is scheduled to be paused PauseStatusScheduled PauseStatus = "scheduled" // PauseStatusCompleted indicates the pause has been completed (subscription resumed) PauseStatusCompleted PauseStatus = "completed" // PauseStatusCancelled indicates the pause was cancelled PauseStatusCancelled PauseStatus = "cancelled" )
func (PauseStatus) String ¶
func (s PauseStatus) String() string
func (PauseStatus) Validate ¶
func (s PauseStatus) Validate() error
type PaymentDestinationType ¶
type PaymentDestinationType string
PaymentDestinationType represents the type of payment destination
const (
PaymentDestinationTypeInvoice PaymentDestinationType = "INVOICE"
)
func (PaymentDestinationType) String ¶
func (s PaymentDestinationType) String() string
func (PaymentDestinationType) Validate ¶
func (s PaymentDestinationType) Validate() error
type PaymentFilter ¶
type PaymentFilter struct {
*QueryFilter
*TimeRangeFilter
PaymentIDs []string `form:"payment_ids"`
DestinationType *string `form:"destination_type"`
DestinationID *string `form:"destination_id"`
PaymentMethodType *string `form:"payment_method_type"`
PaymentStatus *string `form:"payment_status"`
PaymentGateway *string `form:"payment_gateway"`
Currency *string `form:"currency"`
}
PaymentFilter represents the filter for listing payments
func NewNoLimitPaymentFilter ¶
func NewNoLimitPaymentFilter() *PaymentFilter
NewNoLimitPaymentFilter creates a new payment filter with no limit
func (*PaymentFilter) GetExpand ¶
func (f *PaymentFilter) GetExpand() Expand
func (*PaymentFilter) GetLimit ¶
func (f *PaymentFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*PaymentFilter) GetOffset ¶
func (f *PaymentFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*PaymentFilter) GetOrder ¶
func (f *PaymentFilter) GetOrder() string
func (*PaymentFilter) GetSort ¶
func (f *PaymentFilter) GetSort() string
GetSort implements BaseFilter interface
func (*PaymentFilter) GetStatus ¶
func (f *PaymentFilter) GetStatus() string
func (*PaymentFilter) IsUnlimited ¶
func (f *PaymentFilter) IsUnlimited() bool
IsUnlimited returns true if the filter has no limit
func (*PaymentFilter) Validate ¶
func (f *PaymentFilter) Validate() error
Validate validates the payment filter
type PaymentMethodType ¶
type PaymentMethodType string
PaymentMethodType represents the type of payment method
const ( PaymentMethodTypeCard PaymentMethodType = "CARD" PaymentMethodTypeACH PaymentMethodType = "ACH" PaymentMethodTypeOffline PaymentMethodType = "OFFLINE" PaymentMethodTypeCredits PaymentMethodType = "CREDITS" )
func (PaymentMethodType) String ¶
func (s PaymentMethodType) String() string
func (PaymentMethodType) Validate ¶
func (s PaymentMethodType) Validate() error
type PaymentStatus ¶
type PaymentStatus string
PaymentStatus represents the status of a payment
const ( PaymentStatusPending PaymentStatus = "PENDING" PaymentStatusProcessing PaymentStatus = "PROCESSING" PaymentStatusSucceeded PaymentStatus = "SUCCEEDED" PaymentStatusFailed PaymentStatus = "FAILED" PaymentStatusRefunded PaymentStatus = "REFUNDED" PaymentStatusPartiallyRefunded PaymentStatus = "PARTIALLY_REFUNDED" )
func (PaymentStatus) String ¶
func (s PaymentStatus) String() string
func (PaymentStatus) Validate ¶
func (s PaymentStatus) Validate() error
type PlanFilter ¶
type PlanFilter struct {
*QueryFilter
*TimeRangeFilter
PlanIDs []string `json:"plan_ids,omitempty" form:"plan_ids"`
}
PlanFilter represents the filter options for plans
func NewNoLimitPlanFilter ¶
func NewNoLimitPlanFilter() *PlanFilter
NewNoLimitPlanFilter creates a new plan filter without pagination
func NewPlanFilter ¶
func NewPlanFilter() *PlanFilter
NewPlanFilter creates a new plan filter with default options
func (*PlanFilter) GetExpand ¶
func (f *PlanFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*PlanFilter) GetLimit ¶
func (f *PlanFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*PlanFilter) GetOffset ¶
func (f *PlanFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*PlanFilter) GetOrder ¶
func (f *PlanFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*PlanFilter) GetSort ¶
func (f *PlanFilter) GetSort() string
GetSort implements BaseFilter interface
func (*PlanFilter) GetStatus ¶
func (f *PlanFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*PlanFilter) IsUnlimited ¶
func (f *PlanFilter) IsUnlimited() bool
func (*PlanFilter) Validate ¶
func (f *PlanFilter) Validate() error
Validate validates the filter options
type PriceFilter ¶
type PriceFilter struct {
*QueryFilter
*TimeRangeFilter
PlanIDs []string `json:"plan_ids,omitempty" form:"plan_ids"`
PriceIDs []string `json:"price_ids,omitempty" form:"price_ids"`
}
PriceFilter represents filters for price queries
func NewNoLimitPriceFilter ¶
func NewNoLimitPriceFilter() *PriceFilter
NewNoLimitPriceFilter creates a new PriceFilter with no pagination limits
func NewPriceFilter ¶
func NewPriceFilter() *PriceFilter
NewPriceFilter creates a new PriceFilter with default values
func (*PriceFilter) GetExpand ¶
func (f *PriceFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*PriceFilter) GetLimit ¶
func (f *PriceFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*PriceFilter) GetOffset ¶
func (f *PriceFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*PriceFilter) GetOrder ¶
func (f *PriceFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*PriceFilter) GetSort ¶
func (f *PriceFilter) GetSort() string
GetSort implements BaseFilter interface
func (*PriceFilter) GetStatus ¶
func (f *PriceFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*PriceFilter) IsUnlimited ¶
func (f *PriceFilter) IsUnlimited() bool
func (PriceFilter) Validate ¶
func (f PriceFilter) Validate() error
func (*PriceFilter) WithExpand ¶
func (f *PriceFilter) WithExpand(expand string) *PriceFilter
WithExpand sets the expand field on the filter
func (*PriceFilter) WithPlanIDs ¶
func (f *PriceFilter) WithPlanIDs(planIDs []string) *PriceFilter
WithPlanIDs adds plan IDs to the filter
func (*PriceFilter) WithPriceIDs ¶
func (f *PriceFilter) WithPriceIDs(priceIDs []string) *PriceFilter
WithPriceIDs adds price IDs to the filter
func (*PriceFilter) WithStatus ¶
func (f *PriceFilter) WithStatus(status Status) *PriceFilter
WithStatus sets the status on the filter
type PubSubType ¶
type PubSubType string
PubSubType defines the type of pubsub implementation
const ( // MemoryPubSub uses in-memory implementation MemoryPubSub PubSubType = "memory" // KafkaPubSub uses Kafka implementation KafkaPubSub PubSubType = "kafka" )
type PublishDestination ¶
type PublishDestination string
PublishDestination determines where to publish events
const ( PublishToKafka PublishDestination = "kafka" PublishToDynamoDB PublishDestination = "dynamodb" PublishToAll PublishDestination = "all" )
type QueryFilter ¶
type QueryFilter struct {
Limit *int `json:"limit,omitempty" form:"limit" validate:"omitempty,min=1,max=1000"`
Offset *int `json:"offset,omitempty" form:"offset" validate:"omitempty,min=0"`
Status *Status `json:"status,omitempty" form:"status"`
Sort *string `json:"sort,omitempty" form:"sort"`
Order *string `json:"order,omitempty" form:"order" validate:"omitempty,oneof=asc desc"`
Expand *string `json:"expand,omitempty" form:"expand"`
}
QueryFilter represents a generic query filter with optional fields
func NewDefaultQueryFilter ¶
func NewDefaultQueryFilter() *QueryFilter
DefaultQueryFilter defines default values for query filters
func NewNoLimitPublishedQueryFilter ¶
func NewNoLimitPublishedQueryFilter() *QueryFilter
NewNoLimitPublishedQueryFilter defines a filter with published status and no pagination limits
func NewNoLimitQueryFilter ¶
func NewNoLimitQueryFilter() *QueryFilter
NoLimitQueryFilter returns a filter with no pagination limits
func (QueryFilter) GetExpand ¶
func (f QueryFilter) GetExpand() Expand
GetExpand returns the parsed Expand object from the filter
func (QueryFilter) GetLimit ¶
func (f QueryFilter) GetLimit() int
GetLimit returns the limit value or default if not set
func (QueryFilter) GetOffset ¶
func (f QueryFilter) GetOffset() int
GetOffset returns the offset value or default if not set
func (QueryFilter) GetOrder ¶
func (f QueryFilter) GetOrder() string
GetOrder returns the order value or default if not set
func (QueryFilter) GetSort ¶
func (f QueryFilter) GetSort() string
GetSort returns the sort value or default if not set
func (QueryFilter) GetStatus ¶
func (f QueryFilter) GetStatus() string
GetStatus returns the status value or default if not set
func (QueryFilter) IsUnlimited ¶
func (f QueryFilter) IsUnlimited() bool
IsUnlimited returns true if this is an unlimited query
func (*QueryFilter) Merge ¶
func (f *QueryFilter) Merge(other QueryFilter)
Merge merges another filter into this one, taking values from other if they are set
func (QueryFilter) Validate ¶
func (f QueryFilter) Validate() error
Validate validates the filter fields
type ResetUsage ¶
type ResetUsage string
const ( ResetUsageBillingPeriod ResetUsage = "BILLING_PERIOD" ResetUsageNever ResetUsage = "NEVER" )
func (ResetUsage) Validate ¶ added in v1.0.0
func (r ResetUsage) Validate() error
Validate ensures the ResetUsage value is valid
type ResumeMode ¶
type ResumeMode string
ResumeMode represents the mode of resuming a subscription
const ( // ResumeModeImmediate resumes the subscription immediately ResumeModeImmediate ResumeMode = "immediate" // ResumeModeScheduled resumes the subscription at a scheduled time ResumeModeScheduled ResumeMode = "scheduled" // ResumeModeAuto resumes the subscription automatically at the end of the pause period ResumeModeAuto ResumeMode = "auto" )
func (ResumeMode) String ¶
func (m ResumeMode) String() string
String returns the string representation of the resume mode
func (ResumeMode) Validate ¶
func (m ResumeMode) Validate() error
Validate validates the resume mode
type RunMode ¶
type RunMode string
const ( // ModeLocal is the mode for running both the API server and the consumer locally ModeLocal RunMode = "local" // ModeAPI is the mode for running just the API server ModeAPI RunMode = "api" // ModeConsumer is the mode for running just the consumer ModeConsumer RunMode = "consumer" // ModeAWSLambdaAPI is the mode for running the API server in AWS Lambda ModeAWSLambdaAPI RunMode = "aws_lambda_api" // ModeAWSLambdaConsumer is the mode for running the consumer in AWS Lambda ModeAWSLambdaConsumer RunMode = "aws_lambda_consumer" // ModeTemporalWorker is the mode for running the temporal worker ModeTemporalWorker RunMode = "temporal_worker" )
type SecretFilter ¶
type SecretFilter struct {
*QueryFilter
*TimeRangeFilter
Type *SecretType `json:"type,omitempty" form:"type"`
Provider *SecretProvider `json:"provider,omitempty" form:"provider"`
Prefix *string `json:"prefix,omitempty" form:"prefix"`
}
SecretFilter defines the filter criteria for secrets
func NewNoLimitSecretFilter ¶
func NewNoLimitSecretFilter() *SecretFilter
func NewSecretFilter ¶
func NewSecretFilter() *SecretFilter
func (*SecretFilter) GetExpand ¶
func (f *SecretFilter) GetExpand() Expand
func (*SecretFilter) GetLimit ¶
func (f *SecretFilter) GetLimit() int
func (*SecretFilter) GetOffset ¶
func (f *SecretFilter) GetOffset() int
func (*SecretFilter) GetOrder ¶
func (f *SecretFilter) GetOrder() string
func (*SecretFilter) GetSort ¶
func (f *SecretFilter) GetSort() string
func (*SecretFilter) GetStatus ¶
func (f *SecretFilter) GetStatus() string
func (*SecretFilter) IsUnlimited ¶
func (f *SecretFilter) IsUnlimited() bool
func (*SecretFilter) Validate ¶
func (f *SecretFilter) Validate() error
type SecretProvider ¶
type SecretProvider string
const ( SecretProviderFlexPrice SecretProvider = "flexprice" SecretProviderStripe SecretProvider = "stripe" SecretProviderRazorpay SecretProvider = "razorpay" )
Provider types
func (SecretProvider) Validate ¶
func (p SecretProvider) Validate() error
type SecretType ¶
type SecretType string
const ( SecretTypePrivateKey SecretType = "private_key" SecretTypePublishableKey SecretType = "publishable_key" SecretTypeIntegration SecretType = "integration" )
Secret types
func (SecretType) Validate ¶
func (t SecretType) Validate() error
type SortCondition ¶ added in v1.0.17
type SortCondition struct {
Field string `json:"field" form:"field"`
Direction SortDirection `json:"direction" form:"direction"`
}
func (*SortCondition) Validate ¶ added in v1.0.17
func (s *SortCondition) Validate() error
type SortDirection ¶ added in v1.0.17
type SortDirection string
sorting options
const ( SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
type Status ¶
type Status string
Status is a type for the status of a resource (e.g. meter, event) in the Database This is used to track the lifecycle of a resource and to determine if it should be included in queries Any changes to this type should be reflected in the database schema by running migrations
const ( // StatusPublished is the status of a resource that is published and visible to users StatusPublished Status = "published" // StatusDeleted is the status of a resource that is deleted and not in use // This is typically used for data that is no longer in use and should be removed from the database // These rows should not be returned in queries and should not be visible to users StatusDeleted Status = "deleted" // StatusArchived is the status of a resource that is archived and not in use // This is typically used for data that is no longer in use but we want to keep for historical purposes // These rows might be returned in queries and might be visible to users in some cases only StatusArchived Status = "archived" )
type SubscriptionFilter ¶
type SubscriptionFilter struct {
*QueryFilter
*TimeRangeFilter
// CustomerID filters by customer ID
CustomerID string `json:"customer_id,omitempty" form:"customer_id"`
// PlanID filters by plan ID
PlanID string `json:"plan_id,omitempty" form:"plan_id"`
// SubscriptionStatus filters by subscription status
SubscriptionStatus []SubscriptionStatus `json:"subscription_status,omitempty" form:"subscription_status"`
// BillingCadence filters by billing cadence
BillingCadence []BillingCadence `json:"billing_cadence,omitempty" form:"billing_cadence"`
// BillingPeriod filters by billing period
BillingPeriod []BillingPeriod `json:"billing_period,omitempty" form:"billing_period"`
// SubscriptionStatusNotIn filters by subscription status not in the list
SubscriptionStatusNotIn []SubscriptionStatus `json:"-"`
// ActiveAt filters subscriptions that are active at the given time
ActiveAt *time.Time `json:"active_at,omitempty" form:"active_at"`
// WithLineItems includes line items in the response
WithLineItems bool `json:"with_line_items,omitempty" form:"with_line_items"`
}
SubscriptionFilter represents filters for subscription queries
func NewNoLimitSubscriptionFilter ¶
func NewNoLimitSubscriptionFilter() *SubscriptionFilter
NewNoLimitSubscriptionFilter creates a new SubscriptionFilter with no pagination limits
func NewSubscriptionFilter ¶
func NewSubscriptionFilter() *SubscriptionFilter
NewSubscriptionFilter creates a new SubscriptionFilter with default values
func (*SubscriptionFilter) GetExpand ¶
func (f *SubscriptionFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*SubscriptionFilter) GetLimit ¶
func (f *SubscriptionFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*SubscriptionFilter) GetOffset ¶
func (f *SubscriptionFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*SubscriptionFilter) GetOrder ¶
func (f *SubscriptionFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*SubscriptionFilter) GetSort ¶
func (f *SubscriptionFilter) GetSort() string
GetSort implements BaseFilter interface
func (*SubscriptionFilter) GetStatus ¶
func (f *SubscriptionFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*SubscriptionFilter) IsUnlimited ¶
func (f *SubscriptionFilter) IsUnlimited() bool
func (SubscriptionFilter) Validate ¶
func (f SubscriptionFilter) Validate() error
Validate validates the subscription filter
type SubscriptionLineItemFilter ¶
type SubscriptionLineItemFilter struct {
*QueryFilter
*TimeRangeFilter
// Specific filters
SubscriptionIDs []string
CustomerIDs []string
PlanIDs []string
PriceIDs []string
MeterIDs []string
Currencies []string
BillingPeriods []string
}
SubscriptionLineItemFilter defines filters for querying subscription line items
type SubscriptionStatus ¶
type SubscriptionStatus string
SubscriptionStatus is the status of a subscription For now taking inspiration from Stripe's subscription statuses https://stripe.com/docs/api/subscriptions/object#subscription_object-status
const ( SubscriptionStatusActive SubscriptionStatus = "active" SubscriptionStatusPaused SubscriptionStatus = "paused" SubscriptionStatusCancelled SubscriptionStatus = "cancelled" SubscriptionStatusIncomplete SubscriptionStatus = "incomplete" SubscriptionStatusIncompleteExpired SubscriptionStatus = "incomplete_expired" SubscriptionStatusPastDue SubscriptionStatus = "past_due" SubscriptionStatusTrialing SubscriptionStatus = "trialing" SubscriptionStatusUnpaid SubscriptionStatus = "unpaid" )
func (SubscriptionStatus) String ¶
func (s SubscriptionStatus) String() string
func (SubscriptionStatus) Validate ¶
func (s SubscriptionStatus) Validate() error
type TaskFilter ¶
type TaskFilter struct {
*QueryFilter
*TimeRangeFilter
TaskType *TaskType `json:"task_type,omitempty"`
EntityType *EntityType `json:"entity_type,omitempty"`
TaskStatus *TaskStatus `json:"task_status,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
}
TaskFilter defines the filter parameters for listing tasks
func (*TaskFilter) GetExpand ¶
func (f *TaskFilter) GetExpand() Expand
GetExpand returns the expand value for the filter
func (*TaskFilter) GetLimit ¶
func (f *TaskFilter) GetLimit() int
GetLimit returns the limit value for the filter
func (*TaskFilter) GetOffset ¶
func (f *TaskFilter) GetOffset() int
GetOffset returns the offset value for the filter
func (*TaskFilter) GetOrder ¶
func (f *TaskFilter) GetOrder() string
GetOrder returns the order value for the filter
func (*TaskFilter) GetSort ¶
func (f *TaskFilter) GetSort() string
GetSort returns the sort value for the filter
func (*TaskFilter) GetStatus ¶
func (f *TaskFilter) GetStatus() string
GetStatus returns the status value for the filter
func (*TaskFilter) IsUnlimited ¶
func (f *TaskFilter) IsUnlimited() bool
IsUnlimited returns true if the filter is unlimited
func (*TaskFilter) Validate ¶
func (f *TaskFilter) Validate() error
Validate validates the task filter
type TaskStatus ¶
type TaskStatus string
const ( TaskStatusPending TaskStatus = "PENDING" TaskStatusProcessing TaskStatus = "PROCESSING" TaskStatusCompleted TaskStatus = "COMPLETED" TaskStatusFailed TaskStatus = "FAILED" )
func (TaskStatus) String ¶
func (s TaskStatus) String() string
func (TaskStatus) Validate ¶
func (s TaskStatus) Validate() error
type TimeRangeFilter ¶
type TimeRangeFilter struct {
StartTime *time.Time `json:"start_time,omitempty" form:"start_time" validate:"omitempty,time_rfc3339"`
EndTime *time.Time `json:"end_time,omitempty" form:"end_time" validate:"omitempty,time_rfc3339"`
}
TimeRangeFilter adds time range filtering capabilities
func (TimeRangeFilter) Validate ¶
func (f TimeRangeFilter) Validate() error
Validate validates the time range filter
type TransactionReason ¶
type TransactionReason string
TransactionReason represents the reason for a wallet transaction
const ( TransactionReasonInvoicePayment TransactionReason = "INVOICE_PAYMENT" TransactionReasonFreeCredit TransactionReason = "FREE_CREDIT_GRANT" TransactionReasonSubscriptionCredit TransactionReason = "SUBSCRIPTION_CREDIT_GRANT" TransactionReasonPurchasedCreditInvoiced TransactionReason = "PURCHASED_CREDIT_INVOICED" TransactionReasonPurchasedCreditDirect TransactionReason = "PURCHASED_CREDIT_DIRECT" TransactionReasonInvoiceRefund TransactionReason = "INVOICE_REFUND" TransactionReasonCreditExpired TransactionReason = "CREDIT_EXPIRED" TransactionReasonWalletTermination TransactionReason = "WALLET_TERMINATION" )
func (TransactionReason) Validate ¶
func (t TransactionReason) Validate() error
type TransactionStatus ¶
type TransactionStatus string
TransactionStatus represents the status of a wallet transaction
const ( TransactionStatusPending TransactionStatus = "pending" TransactionStatusCompleted TransactionStatus = "completed" TransactionStatusFailed TransactionStatus = "failed" )
func (TransactionStatus) String ¶
func (t TransactionStatus) String() string
func (TransactionStatus) Validate ¶
func (t TransactionStatus) Validate() error
type TransactionType ¶
type TransactionType string
TransactionType represents the type of wallet transaction
const ( TransactionTypeCredit TransactionType = "credit" TransactionTypeDebit TransactionType = "debit" )
func (TransactionType) String ¶
func (t TransactionType) String() string
func (TransactionType) Validate ¶
func (t TransactionType) Validate() error
type Value ¶ added in v1.0.17
type Value struct {
String *string `json:"string,omitempty"`
Number *float64 `json:"number,omitempty"`
Boolean *bool `json:"boolean,omitempty"`
Date *time.Time `json:"date,omitempty"`
Array []string `json:"array,omitempty"`
}
Value is a tagged union. Only one member should be non-nil / non-zero.
type WalletConfig ¶
type WalletConfig struct {
// AllowedPriceTypes is a list of price types that are allowed for the wallet
// nil means all price types are allowed
AllowedPriceTypes []WalletConfigPriceType `json:"allowed_price_types,omitempty"`
}
WalletConfig represents configuration constraints for a wallet
func GetDefaultWalletConfig ¶
func GetDefaultWalletConfig() *WalletConfig
func (WalletConfig) Validate ¶
func (c WalletConfig) Validate() error
type WalletConfigPriceType ¶
type WalletConfigPriceType string
const ( WalletConfigPriceTypeAll WalletConfigPriceType = "ALL" WalletConfigPriceTypeUsage WalletConfigPriceType = WalletConfigPriceType(PRICE_TYPE_USAGE) WalletConfigPriceTypeFixed WalletConfigPriceType = WalletConfigPriceType(PRICE_TYPE_FIXED) )
type WalletStatus ¶
type WalletStatus string
WalletStatus represents the current state of a wallet
const ( WalletStatusActive WalletStatus = "active" WalletStatusFrozen WalletStatus = "frozen" WalletStatusClosed WalletStatus = "closed" )
type WalletTransactionFilter ¶
type WalletTransactionFilter struct {
*QueryFilter
*TimeRangeFilter
WalletID *string `json:"id,omitempty" form:"id"`
Type *TransactionType `json:"type,omitempty" form:"type"`
TransactionStatus *TransactionStatus `json:"transaction_status,omitempty" form:"transaction_status"`
ReferenceType *string `json:"reference_type,omitempty" form:"reference_type"`
ReferenceID *string `json:"reference_id,omitempty" form:"reference_id"`
ExpiryDateBefore *time.Time `json:"expiry_date_before,omitempty" form:"expiry_date_before"`
ExpiryDateAfter *time.Time `json:"expiry_date_after,omitempty" form:"expiry_date_after"`
CreditsAvailableGT *decimal.Decimal `json:"credits_available_gt,omitempty" form:"credits_available_gt"`
TransactionReason *TransactionReason `json:"transaction_reason,omitempty" form:"transaction_reason"`
}
WalletTransactionFilter represents the filter options for wallet transactions
func NewNoLimitWalletTransactionFilter ¶
func NewNoLimitWalletTransactionFilter() *WalletTransactionFilter
func NewWalletTransactionFilter ¶
func NewWalletTransactionFilter() *WalletTransactionFilter
func (*WalletTransactionFilter) GetExpand ¶
func (f *WalletTransactionFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*WalletTransactionFilter) GetLimit ¶
func (f *WalletTransactionFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*WalletTransactionFilter) GetOffset ¶
func (f *WalletTransactionFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*WalletTransactionFilter) GetOrder ¶
func (f *WalletTransactionFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*WalletTransactionFilter) GetSort ¶
func (f *WalletTransactionFilter) GetSort() string
GetSort implements BaseFilter interface
func (*WalletTransactionFilter) GetStatus ¶
func (f *WalletTransactionFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*WalletTransactionFilter) IsUnlimited ¶
func (f *WalletTransactionFilter) IsUnlimited() bool
func (WalletTransactionFilter) Validate ¶
func (f WalletTransactionFilter) Validate() error
type WalletTxReferenceType ¶
type WalletTxReferenceType string
const ( // WalletTxReferenceTypePayment is used for flexprice system payment IDs WalletTxReferenceTypePayment WalletTxReferenceType = "PAYMENT" // WalletTxReferenceTypeExternal is used for external reference IDs in case // the user wants to map a wallet transaction to their own reference ID WalletTxReferenceTypeExternal WalletTxReferenceType = "EXTERNAL" // WalletTxReferenceTypeRequest is used for auto generated reference IDs WalletTxReferenceTypeRequest WalletTxReferenceType = "REQUEST" )
func (WalletTxReferenceType) Validate ¶
func (t WalletTxReferenceType) Validate() error
type WalletType ¶
type WalletType string
WalletType represents the type of wallet
const ( WalletTypePromotional WalletType = "PROMOTIONAL" WalletTypePrePaid WalletType = "PRE_PAID" )
func (WalletType) Validate ¶
func (t WalletType) Validate() error
type WebhookEvent ¶
type WebhookEvent struct {
ID string `json:"id"`
EventName string `json:"event_name"`
TenantID string `json:"tenant_id"`
Timestamp time.Time `json:"timestamp"`
Payload json.RawMessage `json:"payload"`
}
WebhookEvent represents a webhook event to be delivered
type WindowSize ¶
type WindowSize string
const ( WindowSizeMinute WindowSize = "MINUTE" WindowSize15Min WindowSize = "15MIN" WindowSize30Min WindowSize = "30MIN" WindowSizeHour WindowSize = "HOUR" WindowSize3Hour WindowSize = "3HOUR" WindowSize6Hour WindowSize = "6HOUR" WindowSize12Hour WindowSize = "12HOUR" WindowSizeDay WindowSize = "DAY" WindowSizeWeek WindowSize = "WEEK" )
Note: keep values up to date in the meter package
func (WindowSize) Validate ¶
func (w WindowSize) Validate() error
Source Files
¶
- aggregation.go
- auth.go
- basemodel.go
- billing.go
- config.go
- context.go
- currency.go
- customer.go
- date.go
- email.go
- entitlement.go
- environment.go
- event.go
- expand.go
- feature.go
- filter.go
- header.go
- helpers.go
- invoice.go
- metadata.go
- meter.go
- onboarding.go
- pagination.go
- pause_mode.go
- payment.go
- plan.go
- price.go
- publisher.go
- pubsub.go
- reset_usage.go
- search_filter.go
- secret.go
- status.go
- subscription.go
- subscription_line_item_filter.go
- task.go
- time.go
- transaction.go
- uuid.go
- wallet.go
- webhook.go
- window_size.go