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 GenerateShortIDWithPrefix(prefix string) string
- func GenerateTemporalRunID() string
- func GenerateUUID() string
- func GenerateUUIDWithPrefix(prefix string) string
- func GenerateWorkflowID() string
- func GenerateWorkflowIDForType(workflowType string) string
- func GenerateWorkflowIDWithContext(workflowType, contextID string) string
- func GetCurrencyPrecision(code string) int32
- func GetCurrencySymbol(code string) string
- func GetDefaultSettings() map[SettingKey]DefaultSettingValue
- func GetEnvironmentID(ctx context.Context) string
- func GetJWT(ctx context.Context) string
- func GetNextUsageResetAt(currentTime time.Time, subscriptionStart time.Time, subscriptionEnd *time.Time, ...) (time.Time, error)
- 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 IsValidSettingKey(key string) bool
- func NextBillingDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod, ...) (time.Time, error)
- func NextBillingDateLegacy(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
- func NextBillingDateWithEndDate(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 PreviousBillingDate(billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
- func ResolveTimezone(timezone string) string
- func SetEnvironmentID(ctx context.Context, environmentID string) context.Context
- func SetTenantID(ctx context.Context, tenantID string) context.Context
- func SetUserID(ctx context.Context, userID string) context.Context
- func ShouldForceWriter(ctx context.Context) bool
- func ToNillableString(s string) *string
- func ToNillableTime(t time.Time) *time.Time
- func ValidateCouponID(id string) error
- func ValidateCurrencyCode(currency string) error
- func ValidateCustomerID(id string) error
- func ValidateExternalCustomerID(id string) error
- func ValidateInvoiceConfig(value map[string]interface{}) error
- func ValidateSettingValue(key string, value map[string]interface{}) error
- func ValidateSubscriptionConfig(value map[string]interface{}) error
- func ValidateTenantContext(ctx context.Context) error
- func WithForceWriter(ctx context.Context) context.Context
- type AddonAssociationEntityType
- type AddonAssociationFilter
- func (f *AddonAssociationFilter) GetExpand() Expand
- func (f *AddonAssociationFilter) GetLimit() int
- func (f *AddonAssociationFilter) GetOffset() int
- func (f *AddonAssociationFilter) GetOrder() string
- func (f *AddonAssociationFilter) GetSort() string
- func (f *AddonAssociationFilter) GetStatus() string
- func (f *AddonAssociationFilter) IsUnlimited() bool
- func (f *AddonAssociationFilter) Validate() error
- type AddonFilter
- func (f *AddonFilter) GetExpand() Expand
- func (f *AddonFilter) GetLimit() int
- func (f *AddonFilter) GetOffset() int
- func (f *AddonFilter) GetOrder() string
- func (f *AddonFilter) GetSort() string
- func (f *AddonFilter) GetStatus() string
- func (f *AddonFilter) IsUnlimited() bool
- func (f *AddonFilter) Validate() error
- type AddonStatus
- type AddonType
- type AggregationInfo
- type AggregationType
- type AlertCondition
- type AlertConfig
- type AlertEntityType
- type AlertInfo
- type AlertLogFilter
- type AlertSettings
- type AlertState
- type AlertThreshold
- type AlertThresholdType
- type AlertType
- type ApplicationStatus
- type AuthProvider
- type AutoTopupTrigger
- type BaseFilter
- type BaseModel
- type BillingCadence
- type BillingCycle
- type BillingCycleAnchor
- type BillingImpactDetails
- type BillingMode
- type BillingModel
- type BillingPeriod
- type BillingTier
- type CancellationType
- type CheckAlertsRequest
- type CollectionMethod
- type ConnectionFilter
- func (f *ConnectionFilter) GetLimit() int
- func (f *ConnectionFilter) GetOffset() int
- func (f *ConnectionFilter) GetOrder() string
- func (f *ConnectionFilter) GetSort() string
- func (f *ConnectionFilter) GetStatus() string
- func (f *ConnectionFilter) IsUnlimited() bool
- func (f ConnectionFilter) Validate() error
- type ConnectionMetadata
- type ConnectionMetadataType
- type ConnectionSettings
- type ContextKey
- type CouponCadence
- type CouponFilter
- func (f *CouponFilter) GetExpand() Expand
- func (f *CouponFilter) GetLimit() int
- func (f *CouponFilter) GetOffset() int
- func (f *CouponFilter) GetOrder() string
- func (f *CouponFilter) GetSort() string
- func (f *CouponFilter) GetStatus() string
- func (f *CouponFilter) IsUnlimited() bool
- func (f CouponFilter) Validate() error
- type CouponType
- type CouponValidationErrorCode
- type CreateScheduledTaskInput
- type CreditGrantApplicationFilter
- func (f *CreditGrantApplicationFilter) GetExpand() Expand
- func (f *CreditGrantApplicationFilter) GetLimit() int
- func (f *CreditGrantApplicationFilter) GetOffset() int
- func (f *CreditGrantApplicationFilter) GetOrder() string
- func (f *CreditGrantApplicationFilter) GetSort() string
- func (f *CreditGrantApplicationFilter) GetStatus() string
- func (f *CreditGrantApplicationFilter) IsUnlimited() bool
- func (f CreditGrantApplicationFilter) Validate() error
- type CreditGrantApplicationReason
- type CreditGrantCadence
- type CreditGrantExpiryDurationUnit
- type CreditGrantExpiryType
- type CreditGrantFilter
- func (f *CreditGrantFilter) GetExpand() Expand
- func (f *CreditGrantFilter) GetLimit() int
- func (f *CreditGrantFilter) GetOffset() int
- func (f *CreditGrantFilter) GetOrder() string
- func (f *CreditGrantFilter) GetSort() string
- func (f *CreditGrantFilter) GetStatus() string
- func (f *CreditGrantFilter) IsUnlimited() bool
- func (f CreditGrantFilter) Validate() error
- func (f *CreditGrantFilter) WithExpand(expand string) *CreditGrantFilter
- func (f *CreditGrantFilter) WithPlanIDs(planIDs []string) *CreditGrantFilter
- func (f *CreditGrantFilter) WithStatus(status Status) *CreditGrantFilter
- func (f *CreditGrantFilter) WithSubscriptionIDs(subscriptionIDs []string) *CreditGrantFilter
- type CreditGrantPeriod
- type CreditGrantScope
- type CreditNoteFilter
- func (f *CreditNoteFilter) GetExpand() Expand
- func (f *CreditNoteFilter) GetLimit() int
- func (f *CreditNoteFilter) GetOffset() int
- func (f *CreditNoteFilter) GetOrder() string
- func (f *CreditNoteFilter) GetSort() string
- func (f *CreditNoteFilter) GetStatus() string
- func (f *CreditNoteFilter) IsUnlimited() bool
- func (f *CreditNoteFilter) Validate() error
- type CreditNoteLineItemFilter
- func (f *CreditNoteLineItemFilter) GetExpand() Expand
- func (f *CreditNoteLineItemFilter) GetLimit() int
- func (f *CreditNoteLineItemFilter) GetOffset() int
- func (f *CreditNoteLineItemFilter) GetOrder() string
- func (f *CreditNoteLineItemFilter) GetSort() string
- func (f *CreditNoteLineItemFilter) GetStatus() string
- func (f *CreditNoteLineItemFilter) IsUnlimited() bool
- func (f *CreditNoteLineItemFilter) Validate() error
- type CreditNoteReason
- type CreditNoteStatus
- type CreditNoteType
- 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 DefaultSettingValue
- type EntitlementEntityType
- 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) WithEntityIDs(entityIDs []string) *EntitlementFilter
- func (f *EntitlementFilter) WithEntityType(entityType EntitlementEntityType) *EntitlementFilter
- 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 EntitlementUsageResetPeriod
- type EntityIntegrationMappingFilter
- func (f *EntityIntegrationMappingFilter) GetExpand() Expand
- func (f *EntityIntegrationMappingFilter) GetLimit() int
- func (f *EntityIntegrationMappingFilter) GetOffset() int
- func (f *EntityIntegrationMappingFilter) GetOrder() string
- func (f *EntityIntegrationMappingFilter) GetSort() string
- func (f *EntityIntegrationMappingFilter) GetStatus() string
- func (f *EntityIntegrationMappingFilter) IsUnlimited() bool
- func (f EntityIntegrationMappingFilter) Validate() error
- type EntitySyncConfig
- 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 GenericConnectionMetadata
- type IntegrationEntityType
- type InvoiceBillingReason
- type InvoiceCadence
- type InvoiceConfig
- 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 InvoiceFlowType
- type InvoiceLineItemEntityType
- type InvoiceNumberFormat
- 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 PaymentBehavior
- 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 PaymentGatewayType
- type PaymentMethodProvider
- 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 PriceEntityType
- 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) WithAllowExpiredPrices(allowExpiredPrices bool) *PriceFilter
- func (f *PriceFilter) WithEntityIDs(entityIDs []string) *PriceFilter
- func (f *PriceFilter) WithEntityType(entityType PriceEntityType) *PriceFilter
- func (f *PriceFilter) WithExpand(expand string) *PriceFilter
- func (f *PriceFilter) WithParentPriceID(parentPriceID string) *PriceFilter
- func (f *PriceFilter) WithPriceIDs(priceIDs []string) *PriceFilter
- func (f *PriceFilter) WithStatus(status Status) *PriceFilter
- func (f *PriceFilter) WithSubscriptionID(subscriptionID string) *PriceFilter
- type PriceScope
- type PriceTier
- type PriceType
- type PriceUnitType
- type ProrationAction
- type ProrationBehavior
- type ProrationStrategy
- 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 S3CompressionType
- type S3ConnectionMetadata
- type S3EncryptionType
- type S3ExportConfig
- type S3JobConfig
- type ScheduleEndBehavior
- type SchedulePhaseCreditGrant
- type SchedulePhaseLineItem
- type ScheduleType
- type ScheduledTaskEntityType
- type ScheduledTaskInterval
- 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 SettingKey
- type SortCondition
- type SortDirection
- type Status
- type StripeConnectionMetadata
- type SubscriptionChangeType
- type SubscriptionConfig
- 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 SubscriptionLineItemEntityType
- type SubscriptionLineItemFilter
- func (f *SubscriptionLineItemFilter) GetExpand() Expand
- func (f *SubscriptionLineItemFilter) GetLimit() int
- func (f *SubscriptionLineItemFilter) GetOffset() int
- func (f *SubscriptionLineItemFilter) GetOrder() string
- func (f *SubscriptionLineItemFilter) GetSort() string
- func (f *SubscriptionLineItemFilter) GetStatus() string
- func (f *SubscriptionLineItemFilter) IsUnlimited() bool
- func (f *SubscriptionLineItemFilter) Validate() error
- type SubscriptionScheduleStatus
- type SubscriptionStatus
- type SyncConfig
- 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 TaxAppliedFilter
- func (f *TaxAppliedFilter) GetExpand() Expand
- func (f *TaxAppliedFilter) GetLimit() int
- func (f *TaxAppliedFilter) GetOffset() int
- func (f *TaxAppliedFilter) GetOrder() string
- func (f *TaxAppliedFilter) GetSort() string
- func (f *TaxAppliedFilter) GetStatus() string
- func (f *TaxAppliedFilter) IsUnlimited() bool
- func (f *TaxAppliedFilter) Validate() error
- type TaxAssociationFilter
- func (f *TaxAssociationFilter) GetExpand() Expand
- func (f *TaxAssociationFilter) GetLimit() int
- func (f *TaxAssociationFilter) GetOffset() int
- func (f *TaxAssociationFilter) GetOrder() string
- func (f *TaxAssociationFilter) GetSort() string
- func (f *TaxAssociationFilter) GetStatus() string
- func (f *TaxAssociationFilter) IsUnlimited() bool
- func (f *TaxAssociationFilter) Validate() error
- type TaxRateAssignmentStatus
- type TaxRateEntityType
- type TaxRateFilter
- func (f *TaxRateFilter) GetExpand() Expand
- func (f *TaxRateFilter) GetLimit() int
- func (f *TaxRateFilter) GetOffset() int
- func (f *TaxRateFilter) GetOrder() string
- func (f *TaxRateFilter) GetSort() string
- func (f *TaxRateFilter) GetStatus() string
- func (f *TaxRateFilter) IsUnlimited() bool
- func (f *TaxRateFilter) Validate() error
- type TaxRateScope
- type TaxRateStatus
- type TaxRateType
- type TemporalTaskQueue
- type TemporalWorkflowType
- type TenantEnvConfig
- type TenantEnvSubscriptionConfig
- type TerminationReason
- type TimeRangeFilter
- type TransactionReason
- type TransactionStatus
- type TransactionType
- type TransformQuantity
- type UpdateScheduledTaskInput
- type Value
- type WalletAlertThreshold
- type WalletConfig
- type WalletConfigPriceType
- type WalletFilter
- 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 WebhookEventType
- 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" // Price scope constants PRICE_SCOPE_PLAN PriceScope = "PLAN" PRICE_SCOPE_SUBSCRIPTION PriceScope = "SUBSCRIPTION" // 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. // Tier boundaries are INCLUSIVE: if up_to is 1000, quantity 1000 belongs to this tier BILLING_TIER_VOLUME BillingTier = "VOLUME" // BILLING_TIER_SLAB means Tiers apply progressively as quantity increases // Tier boundaries are INCLUSIVE: if up_to is 1000, quantity 1000 belongs to this tier 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" // DEFAULT_FLOATING_PRECISION is the default floating point precision DEFAULT_FLOATING_PRECISION = 2 )
const ( // Prefixes for all domains and entities UUID_PREFIX_SUBSCRIPTION_SCHEDULE = "sched" UUID_PREFIX_SUBSCRIPTION_SCHEDULE_PHASE = "phase" UUID_PREFIX_CREDIT_GRANT_APPLICATION = "cga" UUID_PREFIX_CREDIT_NOTE = "cn" UUID_PREFIX_FEATURE = "feat" 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_SUBSCRIPTION_CHANGE = "subsc" UUID_PREFIX_CUSTOMER = "cust" UUID_PREFIX_CONNECTION = "conn" UUID_PREFIX_WALLET = "wallet" UUID_PREFIX_WALLET_TRANSACTION = "wtxn" UUID_PREFIX_ENVIRONMENT = "env" UUID_PREFIX_USER = "user" UUID_PREFIX_TENANT = "tenant" UUID_PREFIX_ENTITLEMENT = "ent" UUID_PREFIX_PAYMENT = "pay" UUID_PREFIX_PAYMENT_ATTEMPT = "attempt" UUID_PREFIX_TASK = "task" UUID_PREFIX_SECRET = "secret" UUID_PREFIX_TAX_RATE = "taxrate" UUID_PREFIX_TAX_ASSOCIATION = "ta" UUID_PREFIX_TAX_APPLIED = "taxapp" UUID_PREFIX_CREDIT_GRANT = "cg" UUID_PREFIX_COSTSHEET = "cost" UUID_PREFIX_CREDIT_NOTE_LINE_ITEM = "cn_line" UUID_PREFIX_ENTITY_INTEGRATION_MAPPING = "eim" UUID_PREFIX_COUPON = "coupon" UUID_PREFIX_COUPON_ASSOCIATION = "coupon_assoc" UUID_PREFIX_COUPON_APPLICATION = "coupon_app" UUID_PREFIX_PRICE_UNIT = "price_unit" UUID_PREFIX_ADDON = "addon" UUID_PREFIX_ADDON_ASSOCIATION = "addon_assoc" UUID_PREFIX_WEBHOOK_EVENT = "webhook" UUID_PREFIX_SETTING = "setting" UUID_PREFIX_ALERT_LOG = "alert" // Temporal workflow prefixes UUID_PREFIX_WORKFLOW = "wf" UUID_PREFIX_RUN = "run" )
const ( WebhookEventSubscriptionCreated = "subscription.created" WebhookEventSubscriptionActivated = "subscription.activated" WebhookEventSubscriptionUpdated = "subscription.updated" WebhookEventSubscriptionPaused = "subscription.paused" WebhookEventSubscriptionCancelled = "subscription.cancelled" WebhookEventSubscriptionResumed = "subscription.resumed" )
subscription event names
const ( WebhookEventFeatureCreated = "feature.created" WebhookEventFeatureUpdated = "feature.updated" WebhookEventFeatureDeleted = "feature.deleted" WebhookEventFeatureWalletBalanceAlert = "feature.wallet_balance.alert" )
feature event names
const ( WebhookEventEntitlementCreated = "entitlement.created" WebhookEventEntitlementUpdated = "entitlement.updated" WebhookEventEntitlementDeleted = "entitlement.deleted" )
entitlement event names
const ( WebhookEventWalletCreated = "wallet.created" WebhookEventWalletUpdated = "wallet.updated" WebhookEventWalletTerminated = "wallet.terminated" WebhookEventWalletTransactionCreated = "wallet.transaction.created" )
wallet event names
const ( WebhookEventPaymentCreated = "payment.created" WebhookEventPaymentUpdated = "payment.updated" WebhookEventPaymentFailed = "payment.failed" WebhookEventPaymentSuccess = "payment.success" WebhookEventPaymentPending = "payment.pending" )
payment event names
const ( WebhookEventCustomerCreated = "customer.created" WebhookEventCustomerUpdated = "customer.updated" WebhookEventCustomerDeleted = "customer.deleted" )
customer event names
const ( WebhookEventInvoiceUpdateFinalized = "invoice.update.finalized" WebhookEventInvoiceUpdatePayment = "invoice.update.payment" WebhookEventInvoiceUpdateVoided = "invoice.update.voided" WebhookEventInvoiceUpdate = "invoice.update" WebhookEventInvoicePaymentOverdue = "invoice.payment.overdue" )
TODO: Below events should be cron triggered webhook event names
const ( WebhookEventWalletCreditBalanceDropped = "wallet.credit_balance.dropped" WebhookEventWalletCreditBalanceRecovered = "wallet.credit_balance.recovered" WebhookEventWalletOngoingBalanceDropped = "wallet.ongoing_balance.dropped" WebhookEventWalletOngoingBalanceRecovered = "wallet.ongoing_balance.recovered" // cron driven webhook event names WebhookEventSubscriptionRenewalDue = "subscription.renewal.due" )
alert event names
const ( WebhookEventCreditNoteCreated = "credit_note.created" WebhookEventCreditNoteUpdated = "credit_note.updated" )
credit note event names
const (
DEFAULT_PRECISION = 2
)
const (
// InvoiceDefaultDueDays is the default number of days after invoice creation when payment is due
InvoiceDefaultDueDays = 1
)
const (
SHORT_ID_PREFIX_CREDIT_NOTE = "CN-"
)
const (
WebhookEventInvoiceCommunicationTriggered = "invoice.communication.triggered"
)
communication event names
const (
WebhookEventInvoiceCreateDraft = "invoice.create.drafted"
)
invoice event names
Variables ¶
var ( // PlanExpandConfig defines what can be expanded on a plan PlanExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandPrices, ExpandMeters, ExpandEntitlements, ExpandCreditGrant, ExpandPriceUnit}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandPrices: {ExpandMeters}, ExpandEntitlements: {ExpandFeatures}, ExpandCreditGrant: {ExpandFeatures}, ExpandPriceUnit: {}, }, } // PriceExpandConfig defines what can be expanded on a price PriceExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandMeters, ExpandPriceUnit, ExpandPlan, ExpandAddons}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandMeters: {}, ExpandPriceUnit: {}, }, } // SubscriptionExpandConfig defines what can be expanded on a subscription SubscriptionExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandPlan, ExpandCustomer, ExpandPrices, ExpandMeters, ExpandSchedule, ExpandCouponAssociations, ExpandCoupon}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandPlan: {ExpandPrices}, ExpandCustomer: {}, ExpandPrices: {ExpandMeters}, ExpandSchedule: {}, ExpandCouponAssociations: {ExpandCoupon}, }, } // EntitlementExpandConfig defines what can be expanded on an entitlement EntitlementExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandFeatures}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandFeatures: {}}, } // CreditNoteExpandConfig defines what can be expanded on a credit note CreditNoteExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandInvoice, ExpandSubscription, ExpandCustomer}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandInvoice: {}, ExpandSubscription: {}, ExpandCustomer: {}, }, } // TaxAppliedExpandConfig defines what can be expanded on a tax applied TaxAppliedExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandTaxRate}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandTaxRate: {}, }, } // TaxAssociationExpandConfig defines what can be expanded on a tax association TaxAssociationExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandTaxRate}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandTaxRate: {}, }, } // InvoiceExpandConfig defines what can be expanded on an invoice InvoiceExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandSubscription, ExpandCustomer, ExpandCouponApplications}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandSubscription: {ExpandPlan}, ExpandCustomer: {}, ExpandCouponApplications: {ExpandCoupon}, }, } )
Common expand configurations
var BillingCycleAnchorValues = []BillingCycleAnchor{ BillingCycleAnchorUnchanged, BillingCycleAnchorReset, BillingCycleAnchorImmediate, }
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 CancellationTypeValues = []CancellationType{ CancellationTypeImmediate, CancellationTypeEndOfPeriod, }
var EntityHierarchy = []TaxRateEntityType{ TaxRateEntityTypeTenant, TaxRateEntityTypeCustomer, TaxRateEntityTypeSubscription, }
EntityHierarchy defines the hierarchy levels for tax associations The order determines precedence: first level has highest priority
var FeatureExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandMeters: {}, }, }
FeatureExpandConfig defines the allowed expand fields for features
var ProrationBehaviorValues = []ProrationBehavior{ ProrationBehaviorCreateProrations, ProrationBehaviorNone, }
var SecretExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{}, NestedExpands: map[ExpandableField][]ExpandableField{}, }
SecretExpandConfig defines the allowed expand fields for secrets
var SubscriptionChangeTypeValues = []SubscriptionChangeType{ SubscriptionChangeTypeUpgrade, SubscriptionChangeTypeDowngrade, SubscriptionChangeTypeLateral, }
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 -> calculate periods from subscription start to find the appropriate period 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 GenerateShortIDWithPrefix ¶ added in v1.0.18
GenerateShortIDWithPrefix returns a short ID with a prefix. Total length is capped at 12 characters, e.g., `in_xYZ12A8Q`.
func GenerateTemporalRunID ¶ added in v1.0.27
func GenerateTemporalRunID() string
GenerateTemporalRunID generates a unique run ID for temporal workflows
func GenerateUUIDWithPrefix ¶
GenerateUUIDWithPrefix returns a k-sortable unique identifier with a prefix ex inv_0ujsswThIGTUYm2K8FjOOfXtY1K
func GenerateWorkflowID ¶ added in v1.0.27
func GenerateWorkflowID() string
GenerateWorkflowID generates a unique workflow ID with workflow prefix
func GenerateWorkflowIDForType ¶ added in v1.0.27
GenerateWorkflowIDForType generates a workflow ID with both workflow prefix and type Example: "wf_PriceSyncWorkflow_01HQXYZ123ABC"
func GenerateWorkflowIDWithContext ¶ added in v1.0.27
GenerateWorkflowIDWithContext generates a contextual workflow ID Example: "wf_PriceSyncWorkflow_plan123_01HQXYZ123ABC"
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 GetDefaultSettings ¶ added in v1.0.22
func GetDefaultSettings() map[SettingKey]DefaultSettingValue
GetDefaultSettings returns the default settings configuration for all setting keys
func GetEnvironmentID ¶
func GetNextUsageResetAt ¶ added in v1.0.27
func GetNextUsageResetAt( currentTime time.Time, subscriptionStart time.Time, subscriptionEnd *time.Time, billingAnchor time.Time, entitlementUsageResetPeriod EntitlementUsageResetPeriod, ) (time.Time, error)
GetNextUsageResetAt calculates the next usage reset timestamp based on the entitlement usage reset period. The logic handles three main scenarios: 1. If entitlement usage reset period is NEVER, returns zero time 2. If entitlement usage reset period is DAILY, returns start of tomorrow (00:00:00) 3. If entitlement usage reset period is MONTHLY, calculates monthly periods based on subscription start and billing anchor
For monthly reset, it finds the current monthly period containing currentTime and returns the end of that period at 00:00:00. All calculations respect timezone of the billingAnchor and handle subscription end cliffing.
func GetRequestID ¶
func GetTenantID ¶
func IsMatchingCurrency ¶
func IsValidEmail ¶
func IsValidSettingKey ¶ added in v1.0.22
IsValidSettingKey checks if a setting key is valid
func NextBillingDate ¶
func NextBillingDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod, subscriptionEndDate *time.Time) (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 If subscriptionEndDate is provided, the result will be cliffed to not exceed it.
func NextBillingDateLegacy ¶ added in v1.0.18
func NextBillingDateLegacy(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
NextBillingDateLegacy maintains backward compatibility for the original NextBillingDate signature
func NextBillingDateWithEndDate ¶ added in v1.0.18
func NextBillingDateWithEndDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod, subscriptionEndDate *time.Time) (time.Time, error)
NextBillingDateWithEndDate is an alias for NextBillingDate with explicit subscription end date parameter
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 PreviousBillingDate ¶ added in v1.0.25
func PreviousBillingDate(billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
PreviousBillingDate calculates the previous billing date by going backwards from the billing anchor by the specified period duration. This is useful for proration calculations where we need to determine the start of a full billing period that ends at the billing anchor.
func ResolveTimezone ¶ added in v1.0.22
ResolveTimezone converts timezone abbreviation to IANA identifier or returns the input if it's already valid
func SetEnvironmentID ¶ added in v1.0.21
SetEnvironmentID sets the environment ID in the context
func SetTenantID ¶ added in v1.0.21
SetTenantID sets the tenant ID in the context
func ShouldForceWriter ¶ added in v1.0.32
ShouldForceWriter returns true if the context is marked to force writer connection
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 ValidateCouponID ¶ added in v1.0.21
ValidateCouponID validates the coupon id
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
func ValidateCustomerID ¶ added in v1.0.18
ValidateCustomerID validates the customer id
func ValidateExternalCustomerID ¶ added in v1.0.18
ValidateExternalCustomerID validates the external customer id
func ValidateInvoiceConfig ¶ added in v1.0.22
ValidateInvoiceConfig validates invoice configuration settings
func ValidateSettingValue ¶ added in v1.0.22
ValidateSettingValue validates a setting value based on its key
func ValidateSubscriptionConfig ¶ added in v1.0.25
func ValidateTenantContext ¶ added in v1.0.27
ValidateTenantContext validates that the required tenant context fields are present
func WithForceWriter ¶ added in v1.0.32
WithForceWriter returns a context that forces database operations to use the writer connection. This is useful when you need to ensure read-after-write consistency or when you know the operation might need to write even if it starts as a read.
Types ¶
type AddonAssociationEntityType ¶ added in v1.0.21
type AddonAssociationEntityType string
AddonAssociationEntityType represents the type of entity that an addon is associated with
const ( AddonAssociationEntityTypeSubscription AddonAssociationEntityType = "subscription" AddonAssociationEntityTypePlan AddonAssociationEntityType = "plan" AddonAssociationEntityTypeAddon AddonAssociationEntityType = "addon" )
func (AddonAssociationEntityType) Validate ¶ added in v1.0.21
func (a AddonAssociationEntityType) Validate() error
type AddonAssociationFilter ¶ added in v1.0.21
type AddonAssociationFilter 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"`
AddonIDs []string `json:"addon_ids,omitempty" form:"addon_ids" validate:"omitempty"`
EntityType *AddonAssociationEntityType `json:"entity_type,omitempty" form:"entity_type" validate:"omitempty"`
EntityIDs []string `json:"entity_ids,omitempty" form:"entity_ids" validate:"omitempty"`
AddonStatus *string `json:"addon_status,omitempty" form:"addon_status" validate:"omitempty"`
}
AddonAssociationFilter represents the filter options for addon associations
func NewAddonAssociationFilter ¶ added in v1.0.21
func NewAddonAssociationFilter() *AddonAssociationFilter
NewAddonAssociationFilter creates a new addon association filter with default options
func NewNoLimitAddonAssociationFilter ¶ added in v1.0.21
func NewNoLimitAddonAssociationFilter() *AddonAssociationFilter
NewNoLimitAddonAssociationFilter creates a new addon association filter without pagination
func (*AddonAssociationFilter) GetExpand ¶ added in v1.0.21
func (f *AddonAssociationFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*AddonAssociationFilter) GetLimit ¶ added in v1.0.21
func (f *AddonAssociationFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*AddonAssociationFilter) GetOffset ¶ added in v1.0.21
func (f *AddonAssociationFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*AddonAssociationFilter) GetOrder ¶ added in v1.0.21
func (f *AddonAssociationFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*AddonAssociationFilter) GetSort ¶ added in v1.0.21
func (f *AddonAssociationFilter) GetSort() string
GetSort implements BaseFilter interface
func (*AddonAssociationFilter) GetStatus ¶ added in v1.0.21
func (f *AddonAssociationFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*AddonAssociationFilter) IsUnlimited ¶ added in v1.0.21
func (f *AddonAssociationFilter) IsUnlimited() bool
func (*AddonAssociationFilter) Validate ¶ added in v1.0.21
func (f *AddonAssociationFilter) Validate() error
Validate validates the filter options
type AddonFilter ¶ added in v1.0.21
type AddonFilter 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"`
AddonIDs []string `json:"addon_ids,omitempty" form:"addon_ids" validate:"omitempty"`
AddonType AddonType `json:"addon_type,omitempty" form:"addon_type" validate:"omitempty"`
LookupKeys []string `json:"lookup_keys,omitempty" form:"lookup_keys" validate:"omitempty"`
}
AddonFilter represents the filter options for addons
func NewAddonFilter ¶ added in v1.0.21
func NewAddonFilter() *AddonFilter
NewAddonFilter creates a new addon filter with default options
func NewNoLimitAddonFilter ¶ added in v1.0.21
func NewNoLimitAddonFilter() *AddonFilter
NewNoLimitAddonFilter creates a new addon filter without pagination
func (*AddonFilter) GetExpand ¶ added in v1.0.21
func (f *AddonFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*AddonFilter) GetLimit ¶ added in v1.0.21
func (f *AddonFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*AddonFilter) GetOffset ¶ added in v1.0.21
func (f *AddonFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*AddonFilter) GetOrder ¶ added in v1.0.21
func (f *AddonFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*AddonFilter) GetSort ¶ added in v1.0.21
func (f *AddonFilter) GetSort() string
GetSort implements BaseFilter interface
func (*AddonFilter) GetStatus ¶ added in v1.0.21
func (f *AddonFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*AddonFilter) IsUnlimited ¶ added in v1.0.21
func (f *AddonFilter) IsUnlimited() bool
func (*AddonFilter) Validate ¶ added in v1.0.21
func (f *AddonFilter) Validate() error
Validate validates the filter options
type AddonStatus ¶ added in v1.0.21
type AddonStatus string
AddonStatus represents the status of a subscription addon
const ( AddonStatusActive AddonStatus = "active" AddonStatusCancelled AddonStatus = "cancelled" AddonStatusPaused AddonStatus = "paused" )
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" AggregationLatest AggregationType = "LATEST" AggregationSumWithMultiplier AggregationType = "SUM_WITH_MULTIPLIER" // Sum with a multiplier - [sum(value) * multiplier] AggregationMax AggregationType = "MAX" AggregationWeightedSum AggregationType = "WEIGHTED_SUM" )
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 AlertCondition ¶ added in v1.0.32
type AlertCondition string
const ( AlertConditionAbove AlertCondition = "above" AlertConditionBelow AlertCondition = "below" )
func (AlertCondition) Validate ¶ added in v1.0.32
func (ac AlertCondition) Validate() error
type AlertConfig ¶ added in v1.0.21
type AlertConfig struct {
Threshold *WalletAlertThreshold `json:"threshold,omitempty"`
}
AlertConfig represents the configuration for wallet alerts
type AlertEntityType ¶ added in v1.0.29
type AlertEntityType string
AlertEntityType represents the type of entity for alerts
const ( AlertEntityTypeWallet AlertEntityType = "wallet" AlertEntityTypeFeature AlertEntityType = "feature" )
func (AlertEntityType) Validate ¶ added in v1.0.29
func (aet AlertEntityType) Validate() error
type AlertInfo ¶ added in v1.0.29
type AlertInfo struct {
AlertSettings *AlertSettings `json:"alert_settings,omitempty"`
ValueAtTime decimal.Decimal `json:"value_at_time"`
Timestamp time.Time `json:"timestamp"`
}
type AlertLogFilter ¶ added in v1.0.29
type AlertLogFilter 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"`
EntityType AlertEntityType `json:"entity_type,omitempty" form:"entity_type" validate:"omitempty"`
EntityID string `json:"entity_id,omitempty" form:"entity_id" validate:"omitempty"`
AlertType AlertType `json:"alert_type,omitempty" form:"alert_type" validate:"omitempty"`
AlertStatus AlertState `json:"alert_status,omitempty" form:"alert_status" validate:"omitempty"`
}
AlertLogFilter represents filters for alert log queries
func NewDefaultAlertLogFilter ¶ added in v1.0.29
func NewDefaultAlertLogFilter() *AlertLogFilter
NewDefaultAlertLogFilter creates a new AlertLogFilter with default values
func NewNoLimitAlertLogFilter ¶ added in v1.0.29
func NewNoLimitAlertLogFilter() *AlertLogFilter
NewNoLimitAlertLogFilter creates a new AlertLogFilter with no pagination limits
func (*AlertLogFilter) GetLimit ¶ added in v1.0.29
func (f *AlertLogFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*AlertLogFilter) GetOffset ¶ added in v1.0.29
func (f *AlertLogFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*AlertLogFilter) Validate ¶ added in v1.0.29
func (f *AlertLogFilter) Validate() error
Validate validates the alert log filter
type AlertSettings ¶ added in v1.0.32
type AlertSettings struct {
Critical *AlertThreshold `json:"critical"`
Warning *AlertThreshold `json:"warning"`
Info *AlertThreshold `json:"info"`
AlertEnabled *bool `json:"alert_enabled"`
}
func (*AlertSettings) AlertState ¶ added in v1.0.32
func (At *AlertSettings) AlertState(ongoingBalance decimal.Decimal) (AlertState, error)
AlertStatus determines the alert status based on ongoing balance vs alert settings
func (*AlertSettings) IsAlertEnabled ¶ added in v1.0.32
func (at *AlertSettings) IsAlertEnabled() bool
func (*AlertSettings) Validate ¶ added in v1.0.32
func (at *AlertSettings) Validate() error
type AlertState ¶ added in v1.0.21
type AlertState string
AlertState represents the current state of a wallet alert
const ( AlertStateOk AlertState = "ok" AlertStateInfo AlertState = "info" AlertStateWarning AlertState = "warning" AlertStateInAlarm AlertState = "in_alarm" )
type AlertThreshold ¶ added in v1.0.21
type AlertThreshold struct {
Threshold decimal.Decimal `json:"threshold"`
Condition AlertCondition `json:"condition"`
}
func (*AlertThreshold) Validate ¶ added in v1.0.32
func (at *AlertThreshold) Validate() error
type AlertThresholdType ¶ added in v1.0.29
type AlertThresholdType string
AlertThresholdType represents the type of threshold for alerts
const (
AlertThresholdTypeAmount AlertThresholdType = "amount"
)
func (AlertThresholdType) Validate ¶ added in v1.0.29
func (att AlertThresholdType) Validate() error
type ApplicationStatus ¶ added in v1.0.18
type ApplicationStatus string
const ( // application_status applied is the status of a credit grant application that has been applied // This is the terminal state of a credit grant application // This is set when application is applied by cron ApplicationStatusApplied ApplicationStatus = "applied" // application_status failed is the status of a credit grant application that has failed // This is set when application fails to be applied by cron ApplicationStatusFailed ApplicationStatus = "failed" // application_status pending is the status of a credit grant application that is pending // This is the initial state of a credit grant application // This is set when application is created as well is ready to be applied by cron ApplicationStatusPending ApplicationStatus = "pending" // application_status skipped is the status of a credit grant application that has been skipped // This is set when subscription has been paused so we skip giving credits for that period ApplicationStatusSkipped ApplicationStatus = "skipped" // application_status cancelled is the status of a credit grant application that has been cancelled // This is set when subscription has been cancelled // This is the terminal state of a credit grant application ApplicationStatusCancelled ApplicationStatus = "cancelled" )
func (ApplicationStatus) String ¶ added in v1.0.18
func (s ApplicationStatus) String() string
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 BillingCycleAnchor ¶ added in v1.0.25
type BillingCycleAnchor string
BillingCycleAnchor defines how billing cycle is handled during subscription changes
const ( BillingCycleAnchorUnchanged BillingCycleAnchor = "unchanged" // Keep current billing anchor BillingCycleAnchorReset BillingCycleAnchor = "reset" // Reset to current date BillingCycleAnchorImmediate BillingCycleAnchor = "immediate" // Bill immediately )
func (BillingCycleAnchor) String ¶ added in v1.0.25
func (b BillingCycleAnchor) String() string
func (BillingCycleAnchor) Validate ¶ added in v1.0.25
func (b BillingCycleAnchor) 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 BillingMode ¶ added in v1.0.25
type BillingMode string
BillingMode represents when a subscription is billed.
const ( BillingModeInAdvance BillingMode = "in_advance" BillingModeInArrears BillingMode = "in_arrears" )
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 GetBillingPeriodFromCreditGrantPeriod ¶ added in v1.0.18
func GetBillingPeriodFromCreditGrantPeriod(period CreditGrantPeriod) (BillingPeriod, error)
GetBillingPeriodFromCreditGrantPeriod maps credit grant period to billing period
func (BillingPeriod) String ¶ added in v1.0.27
func (b BillingPeriod) String() string
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 CancellationType ¶ added in v1.0.25
type CancellationType string
CancellationType determines when a cancellation takes effect.
const ( CancellationTypeImmediate CancellationType = "immediate" CancellationTypeEndOfPeriod CancellationType = "end_of_period" )
func (CancellationType) String ¶ added in v1.0.25
func (c CancellationType) String() string
func (CancellationType) Validate ¶ added in v1.0.25
func (c CancellationType) Validate() error
type CheckAlertsRequest ¶ added in v1.0.21
type CheckAlertsRequest struct {
TenantIDs []string `json:"tenant_ids"`
EnvIDs []string `json:"env_ids"`
WalletIDs []string `json:"wallet_ids"`
Threshold *WalletAlertThreshold `json:"threshold,omitempty"`
}
type CollectionMethod ¶ added in v1.0.22
type CollectionMethod string
CollectionMethod determines how invoices are collected for subscriptions
const ( // CollectionMethodChargeAutomatically - Automatically charge payment method CollectionMethodChargeAutomatically CollectionMethod = "charge_automatically" // CollectionMethodSendInvoice - Send invoice to customer for manual payment CollectionMethodSendInvoice CollectionMethod = "send_invoice" )
func (CollectionMethod) String ¶ added in v1.0.22
func (c CollectionMethod) String() string
func (CollectionMethod) Validate ¶ added in v1.0.22
func (c CollectionMethod) Validate() error
type ConnectionFilter ¶ added in v1.0.21
type ConnectionFilter struct {
*QueryFilter
*TimeRangeFilter
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
ConnectionIDs []string `json:"connection_ids,omitempty" form:"connection_ids" validate:"omitempty"`
ProviderType SecretProvider `json:"provider_type,omitempty" form:"provider_type" validate:"omitempty"`
}
ConnectionFilter represents filters for connection queries
func NewConnectionFilter ¶ added in v1.0.21
func NewConnectionFilter() *ConnectionFilter
NewConnectionFilter creates a new ConnectionFilter with default values
func NewNoLimitConnectionFilter ¶ added in v1.0.21
func NewNoLimitConnectionFilter() *ConnectionFilter
NewNoLimitConnectionFilter creates a new ConnectionFilter with no pagination limits
func (*ConnectionFilter) GetLimit ¶ added in v1.0.21
func (f *ConnectionFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*ConnectionFilter) GetOffset ¶ added in v1.0.21
func (f *ConnectionFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*ConnectionFilter) GetOrder ¶ added in v1.0.21
func (f *ConnectionFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*ConnectionFilter) GetSort ¶ added in v1.0.21
func (f *ConnectionFilter) GetSort() string
GetSort implements BaseFilter interface
func (*ConnectionFilter) GetStatus ¶ added in v1.0.21
func (f *ConnectionFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*ConnectionFilter) IsUnlimited ¶ added in v1.0.21
func (f *ConnectionFilter) IsUnlimited() bool
IsUnlimited implements BaseFilter interface
func (ConnectionFilter) Validate ¶ added in v1.0.21
func (f ConnectionFilter) Validate() error
Validate validates the connection filter
type ConnectionMetadata ¶ added in v1.0.21
type ConnectionMetadata struct {
Stripe *StripeConnectionMetadata `json:"stripe,omitempty"`
S3 *S3ConnectionMetadata `json:"s3,omitempty"`
Generic *GenericConnectionMetadata `json:"generic,omitempty"`
Settings *ConnectionSettings `json:"settings,omitempty"`
}
ConnectionMetadata represents structured connection metadata
func (*ConnectionMetadata) Validate ¶ added in v1.0.21
func (c *ConnectionMetadata) Validate(providerType SecretProvider) error
Validate validates the connection metadata based on provider type
type ConnectionMetadataType ¶ added in v1.0.21
type ConnectionMetadataType string
ConnectionMetadataType represents the type of connection metadata
const ( ConnectionMetadataTypeStripe ConnectionMetadataType = "stripe" ConnectionMetadataTypeGeneric ConnectionMetadataType = "generic" ConnectionMetadataTypeS3 ConnectionMetadataType = "s3" )
func (ConnectionMetadataType) Validate ¶ added in v1.0.21
func (t ConnectionMetadataType) Validate() error
type ConnectionSettings ¶ added in v1.0.28
type ConnectionSettings struct {
InvoiceSyncEnable *bool `json:"invoice_sync_enable,omitempty"`
}
ConnectionSettings represents general connection settings
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" CtxForceWriter ContextKey = "ctx_force_writer" // Force DB operations to use writer connection // Default values DefaultTenantID = "00000000-0000-0000-0000-000000000000" DefaultUserID = "00000000-0000-0000-0000-000000000000" )
type CouponCadence ¶ added in v1.0.21
type CouponCadence string
CouponCadence represents the duration type of coupon discount
const ( // CouponCadenceOnce represents a one-time coupon discount CouponCadenceOnce CouponCadence = "once" // CouponCadenceRepeated represents a coupon discount that repeats for a specific period CouponCadenceRepeated CouponCadence = "repeated" // CouponCadenceForever represents a coupon discount that applies forever CouponCadenceForever CouponCadence = "forever" )
type CouponFilter ¶ added in v1.0.21
type CouponFilter struct {
*QueryFilter
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
CouponIDs []string `json:"coupon_ids,omitempty" form:"coupon_ids" validate:"omitempty"`
}
func NewCouponFilter ¶ added in v1.0.21
func NewCouponFilter() *CouponFilter
NewCouponFilter creates a new CouponFilter with default values
func NewNoLimitCouponFilter ¶ added in v1.0.21
func NewNoLimitCouponFilter() *CouponFilter
NewNoLimitCouponFilter creates a new CouponFilter with no pagination limits
func (*CouponFilter) GetExpand ¶ added in v1.0.21
func (f *CouponFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CouponFilter) GetLimit ¶ added in v1.0.21
func (f *CouponFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CouponFilter) GetOffset ¶ added in v1.0.21
func (f *CouponFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CouponFilter) GetOrder ¶ added in v1.0.21
func (f *CouponFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CouponFilter) GetSort ¶ added in v1.0.21
func (f *CouponFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CouponFilter) GetStatus ¶ added in v1.0.21
func (f *CouponFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CouponFilter) IsUnlimited ¶ added in v1.0.21
func (f *CouponFilter) IsUnlimited() bool
func (CouponFilter) Validate ¶ added in v1.0.21
func (f CouponFilter) Validate() error
Validate validates the coupon filter
type CouponType ¶ added in v1.0.21
type CouponType string
CouponType represents the type of coupon discount (fixed or percentage)
const ( // CouponTypeFixed represents a fixed amount coupon discount CouponTypeFixed CouponType = "fixed" // CouponTypePercentage represents a percentage-based coupon discount CouponTypePercentage CouponType = "percentage" )
type CouponValidationErrorCode ¶ added in v1.0.21
type CouponValidationErrorCode string
CouponValidationErrorCode represents the type of coupon validation error
const ( // Basic validation errors CouponValidationErrorCodeNotFound CouponValidationErrorCode = "COUPON_NOT_FOUND" CouponValidationErrorCodeNotPublished CouponValidationErrorCode = "COUPON_NOT_PUBLISHED" // Date range validation errors CouponValidationErrorCodeNotActive CouponValidationErrorCode = "COUPON_NOT_ACTIVE" CouponValidationErrorCodeExpired CouponValidationErrorCode = "COUPON_EXPIRED" // Environment and context validation errors CouponValidationErrorCodeEnvironmentMismatch CouponValidationErrorCode = "ENVIRONMENT_MISMATCH" CouponValidationErrorCodeCurrencyMismatch CouponValidationErrorCode = "CURRENCY_MISMATCH" // Redemption validation errors CouponValidationErrorCodeRedemptionLimitReached CouponValidationErrorCode = "REDEMPTION_LIMIT_REACHED" // Subscription validation errors CouponValidationErrorCodeInvalidSubscriptionStatus CouponValidationErrorCode = "INVALID_SUBSCRIPTION_STATUS" // Cadence validation errors CouponValidationErrorCodeInvalidCadence CouponValidationErrorCode = "INVALID_CADENCE" CouponValidationErrorCodeOnceCadenceViolation CouponValidationErrorCode = "ONCE_CADENCE_VIOLATION" CouponValidationErrorCodeRepeatedCadenceLimitReached CouponValidationErrorCode = "REPEATED_CADENCE_LIMIT_REACHED" CouponValidationErrorCodeInvalidRepeatedCadence CouponValidationErrorCode = "INVALID_REPEATED_CADENCE" // Database and system errors CouponValidationErrorCodeDatabaseError CouponValidationErrorCode = "DATABASE_ERROR" )
func (CouponValidationErrorCode) IsCadenceError ¶ added in v1.0.21
func (c CouponValidationErrorCode) IsCadenceError() bool
IsCadenceError returns true if the error code is related to cadence validation
func (CouponValidationErrorCode) IsRedemptionError ¶ added in v1.0.21
func (c CouponValidationErrorCode) IsRedemptionError() bool
IsRedemptionError returns true if the error code is related to redemption limits
func (CouponValidationErrorCode) IsUserError ¶ added in v1.0.21
func (c CouponValidationErrorCode) IsUserError() bool
IsUserError returns true if the error code represents a user error (not a system error)
func (CouponValidationErrorCode) String ¶ added in v1.0.21
func (c CouponValidationErrorCode) String() string
func (CouponValidationErrorCode) Validate ¶ added in v1.0.21
func (c CouponValidationErrorCode) Validate() error
type CreateScheduledTaskInput ¶ added in v1.0.32
type CreateScheduledTaskInput struct {
ConnectionID string
EntityType ScheduledTaskEntityType
Interval ScheduledTaskInterval
Enabled bool
JobConfig *S3JobConfig
}
CreateScheduledTaskInput represents the input for creating a scheduled task
type CreditGrantApplicationFilter ¶ added in v1.0.18
type CreditGrantApplicationFilter struct {
*QueryFilter
*TimeRangeFilter
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
// filters allows complex filtering based on multiple fields
ApplicationIDs []string `json:"application_ids,omitempty" form:"application_ids" validate:"omitempty"`
CreditGrantIDs []string `json:"credit_grant_ids,omitempty" form:"credit_grant_ids" validate:"omitempty"`
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids" validate:"omitempty"`
ScheduledFor *time.Time `json:"scheduled_for,omitempty" form:"scheduled_for" validate:"omitempty"`
AppliedAt *time.Time `json:"applied_at,omitempty" form:"applied_at" validate:"omitempty"`
ApplicationStatuses []ApplicationStatus `json:"application_statuses,omitempty" form:"application_statuses" validate:"omitempty"`
}
func NewCreditGrantApplicationFilter ¶ added in v1.0.18
func NewCreditGrantApplicationFilter() *CreditGrantApplicationFilter
NewCreditGrantApplicationFilter creates a new CreditGrantApplicationFilter with default values
func NewNoLimitCreditGrantApplicationFilter ¶ added in v1.0.18
func NewNoLimitCreditGrantApplicationFilter() *CreditGrantApplicationFilter
NewNoLimitCreditGrantApplicationFilter creates a new CreditGrantApplicationFilter with no pagination limits
func (*CreditGrantApplicationFilter) GetExpand ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CreditGrantApplicationFilter) GetLimit ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CreditGrantApplicationFilter) GetOffset ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CreditGrantApplicationFilter) GetOrder ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CreditGrantApplicationFilter) GetSort ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CreditGrantApplicationFilter) GetStatus ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CreditGrantApplicationFilter) IsUnlimited ¶ added in v1.0.18
func (f *CreditGrantApplicationFilter) IsUnlimited() bool
func (CreditGrantApplicationFilter) Validate ¶ added in v1.0.18
func (f CreditGrantApplicationFilter) Validate() error
Validate validates the credit grant application filter
type CreditGrantApplicationReason ¶ added in v1.0.18
type CreditGrantApplicationReason string
CreditGrantApplicationReason defines the reason why a credit grant application is being created.
const ( // ApplicationReasonFirstTimeRecurringCreditGrant is used when a recurring credit is being granted // for the first time for a subscription. Typically applied at the start of a recurring billing cycle. ApplicationReasonFirstTimeRecurringCreditGrant CreditGrantApplicationReason = "first_time_recurring_credit_grant" // ApplicationReasonRecurringCreditGrant is used for recurring credit grants that are applied // on a regular interval (e.g. monthly, annually) after the initial credit grant has been processed. ApplicationReasonRecurringCreditGrant CreditGrantApplicationReason = "recurring_credit_grant" // ApplicationReasonOnetimeCreditGrant is used when a one-time credit is granted during subscription creation. ApplicationReasonOnetimeCreditGrant CreditGrantApplicationReason = "onetime_credit_grant" )
func (CreditGrantApplicationReason) String ¶ added in v1.0.18
func (r CreditGrantApplicationReason) String() string
type CreditGrantCadence ¶ added in v1.0.18
type CreditGrantCadence string
CreditGrantCadence defines the cadence of a credit grant
const ( CreditGrantCadenceOneTime CreditGrantCadence = "ONETIME" CreditGrantCadenceRecurring CreditGrantCadence = "RECURRING" )
func (CreditGrantCadence) Validate ¶ added in v1.0.18
func (c CreditGrantCadence) Validate() error
Validate validates the credit grant cadence
type CreditGrantExpiryDurationUnit ¶ added in v1.0.18
type CreditGrantExpiryDurationUnit string
CreditGrantExpiryDurationUnit defines time units for duration-based expiry
const ( // Any unused credits disappear X days after they’re granted. CreditGrantExpiryDurationUnitDays CreditGrantExpiryDurationUnit = "DAY" CreditGrantExpiryDurationUnitWeeks CreditGrantExpiryDurationUnit = "WEEK" CreditGrantExpiryDurationUnitMonths CreditGrantExpiryDurationUnit = "MONTH" CreditGrantExpiryDurationUnitYears CreditGrantExpiryDurationUnit = "YEAR" )
func (CreditGrantExpiryDurationUnit) Validate ¶ added in v1.0.18
func (u CreditGrantExpiryDurationUnit) Validate() error
Validate validates the credit grant expiry duration unit
type CreditGrantExpiryType ¶ added in v1.0.18
type CreditGrantExpiryType string
CreditGrantExpiryType defines the type of expiry configuration
const ( // Credits stay available until they’re completely used—no time limit. CreditGrantExpiryTypeNever CreditGrantExpiryType = "NEVER" // Any unused credits disappear X days after they’re granted. CreditGrantExpiryTypeDuration CreditGrantExpiryType = "DURATION" // Unused credits reset at the end of each subscription period (matches the customer’s billing schedule). CreditGrantExpiryTypeBillingCycle CreditGrantExpiryType = "BILLING_CYCLE" )
func (CreditGrantExpiryType) Validate ¶ added in v1.0.18
func (t CreditGrantExpiryType) Validate() error
Validate validates the credit grant expiry type
type CreditGrantFilter ¶ added in v1.0.18
type CreditGrantFilter struct {
*QueryFilter
*TimeRangeFilter
// Specific filters for credit grants
PlanIDs []string `form:"plan_ids" json:"plan_ids,omitempty"`
SubscriptionIDs []string `form:"subscription_ids" json:"subscription_ids,omitempty"`
Scope *CreditGrantScope `form:"scope" json:"scope,omitempty"`
}
CreditGrantFilter defines filters for querying credit grants
func NewDefaultCreditGrantFilter ¶ added in v1.0.18
func NewDefaultCreditGrantFilter() *CreditGrantFilter
NewDefaultCreditGrantFilter creates a new CreditGrantFilter with default values
func NewNoLimitCreditGrantFilter ¶ added in v1.0.18
func NewNoLimitCreditGrantFilter() *CreditGrantFilter
NewNoLimitCreditGrantFilter creates a new CreditGrantFilter with no pagination limits
func (*CreditGrantFilter) GetExpand ¶ added in v1.0.18
func (f *CreditGrantFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CreditGrantFilter) GetLimit ¶ added in v1.0.18
func (f *CreditGrantFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CreditGrantFilter) GetOffset ¶ added in v1.0.18
func (f *CreditGrantFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CreditGrantFilter) GetOrder ¶ added in v1.0.18
func (f *CreditGrantFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CreditGrantFilter) GetSort ¶ added in v1.0.18
func (f *CreditGrantFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CreditGrantFilter) GetStatus ¶ added in v1.0.18
func (f *CreditGrantFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CreditGrantFilter) IsUnlimited ¶ added in v1.0.18
func (f *CreditGrantFilter) IsUnlimited() bool
IsUnlimited returns true if this is an unlimited query
func (CreditGrantFilter) Validate ¶ added in v1.0.18
func (f CreditGrantFilter) Validate() error
Validate validates the filter fields
func (*CreditGrantFilter) WithExpand ¶ added in v1.0.18
func (f *CreditGrantFilter) WithExpand(expand string) *CreditGrantFilter
WithExpand sets the expand on the filter
func (*CreditGrantFilter) WithPlanIDs ¶ added in v1.0.18
func (f *CreditGrantFilter) WithPlanIDs(planIDs []string) *CreditGrantFilter
WithPlanIDs adds plan IDs to the filter
func (*CreditGrantFilter) WithStatus ¶ added in v1.0.18
func (f *CreditGrantFilter) WithStatus(status Status) *CreditGrantFilter
WithStatus sets the status on the filter
func (*CreditGrantFilter) WithSubscriptionIDs ¶ added in v1.0.18
func (f *CreditGrantFilter) WithSubscriptionIDs(subscriptionIDs []string) *CreditGrantFilter
WithSubscriptionIDs adds subscription IDs to the filter
type CreditGrantPeriod ¶ added in v1.0.18
type CreditGrantPeriod string
CreditGrantPeriod defines the period for recurring credit grants
const ( CREDIT_GRANT_PERIOD_DAILY CreditGrantPeriod = "DAILY" CREDIT_GRANT_PERIOD_WEEKLY CreditGrantPeriod = "WEEKLY" CREDIT_GRANT_PERIOD_MONTHLY CreditGrantPeriod = "MONTHLY" CREDIT_GRANT_PERIOD_ANNUAL CreditGrantPeriod = "ANNUAL" CREDIT_GRANT_PERIOD_QUARTER CreditGrantPeriod = "QUARTERLY" CREDIT_GRANT_PERIOD_HALF_YEARLY CreditGrantPeriod = "HALF_YEARLY" )
func (CreditGrantPeriod) Validate ¶ added in v1.0.18
func (p CreditGrantPeriod) Validate() error
Validate validates the credit grant period
type CreditGrantScope ¶ added in v1.0.18
type CreditGrantScope string
CreditGrantScope defines the scope of a credit grant
const ( CreditGrantScopePlan CreditGrantScope = "PLAN" CreditGrantScopeSubscription CreditGrantScope = "SUBSCRIPTION" )
func (CreditGrantScope) Validate ¶ added in v1.0.18
func (s CreditGrantScope) Validate() error
Validate validates the credit grant scope
type CreditNoteFilter ¶ added in v1.0.18
type CreditNoteFilter struct {
*QueryFilter
*TimeRangeFilter
CreditNoteIDs []string `json:"credit_note_ids,omitempty" form:"credit_note_ids"`
InvoiceID string `json:"invoice_id,omitempty" form:"invoice_id"`
CreditNoteStatus []CreditNoteStatus `json:"credit_note_status,omitempty" form:"credit_note_status"`
CreditNoteType CreditNoteType `json:"credit_note_type,omitempty" form:"credit_note_type"`
}
CreditNoteFilter represents the filter options for listing credit notes
func NewCreditNoteFilter ¶ added in v1.0.18
func NewCreditNoteFilter() *CreditNoteFilter
NewCreditNoteFilter creates a new credit note filter with default options
func NewNoLimitCreditNoteFilter ¶ added in v1.0.18
func NewNoLimitCreditNoteFilter() *CreditNoteFilter
NewNoLimitCreditNoteFilter creates a new credit note filter without pagination
func (*CreditNoteFilter) GetExpand ¶ added in v1.0.18
func (f *CreditNoteFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CreditNoteFilter) GetLimit ¶ added in v1.0.18
func (f *CreditNoteFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CreditNoteFilter) GetOffset ¶ added in v1.0.18
func (f *CreditNoteFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CreditNoteFilter) GetOrder ¶ added in v1.0.18
func (f *CreditNoteFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CreditNoteFilter) GetSort ¶ added in v1.0.18
func (f *CreditNoteFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CreditNoteFilter) GetStatus ¶ added in v1.0.18
func (f *CreditNoteFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CreditNoteFilter) IsUnlimited ¶ added in v1.0.18
func (f *CreditNoteFilter) IsUnlimited() bool
func (*CreditNoteFilter) Validate ¶ added in v1.0.18
func (f *CreditNoteFilter) Validate() error
Validate validates the credit note filter
type CreditNoteLineItemFilter ¶ added in v1.0.18
type CreditNoteLineItemFilter struct {
*QueryFilter
*TimeRangeFilter
CreditNoteIDs []string `json:"credit_note_ids,omitempty" form:"credit_note_ids"`
InvoiceLineItemIDs []string `json:"invoice_line_item_ids,omitempty" form:"invoice_line_item_ids"`
}
CreditNoteLineItemFilter defines filters for querying credit note line items
func NewCreditNoteLineItemFilter ¶ added in v1.0.18
func NewCreditNoteLineItemFilter() *CreditNoteLineItemFilter
NewCreditNoteLineItemFilter creates a new credit note line item filter with default options
func NewNoLimitCreditNoteLineItemFilter ¶ added in v1.0.18
func NewNoLimitCreditNoteLineItemFilter() *CreditNoteLineItemFilter
NewNoLimitCreditNoteLineItemFilter creates a new credit note line item filter without pagination
func (*CreditNoteLineItemFilter) GetExpand ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CreditNoteLineItemFilter) GetLimit ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CreditNoteLineItemFilter) GetOffset ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CreditNoteLineItemFilter) GetOrder ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CreditNoteLineItemFilter) GetSort ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CreditNoteLineItemFilter) GetStatus ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CreditNoteLineItemFilter) IsUnlimited ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) IsUnlimited() bool
func (*CreditNoteLineItemFilter) Validate ¶ added in v1.0.18
func (f *CreditNoteLineItemFilter) Validate() error
Validate validates the credit note line item filter
type CreditNoteReason ¶ added in v1.0.18
type CreditNoteReason string
const ( CreditNoteReasonDuplicate CreditNoteReason = "DUPLICATE" CreditNoteReasonFraudulent CreditNoteReason = "FRAUDULENT" CreditNoteReasonOrderChange CreditNoteReason = "ORDER_CHANGE" CreditNoteReasonUnsatisfactory CreditNoteReason = "UNSATISFACTORY" CreditNoteReasonService CreditNoteReason = "SERVICE_ISSUE" CreditNoteReasonBillingError CreditNoteReason = "BILLING_ERROR" CreditNoteReasonSubscriptionCancellation CreditNoteReason = "SUBSCRIPTION_CANCELLATION" )
func (CreditNoteReason) String ¶ added in v1.0.18
func (c CreditNoteReason) String() string
func (CreditNoteReason) Validate ¶ added in v1.0.18
func (c CreditNoteReason) Validate() error
type CreditNoteStatus ¶ added in v1.0.18
type CreditNoteStatus string
const ( // CreditNoteStatusDraft indicates credit note is in draft state and can be modified CreditNoteStatusDraft CreditNoteStatus = "DRAFT" // CreditNoteStatusFinalized indicates credit note is finalized and ready for payment CreditNoteStatusFinalized CreditNoteStatus = "FINALIZED" // CreditNoteStatusVoided indicates credit note has been voided CreditNoteStatusVoided CreditNoteStatus = "VOIDED" )
func (CreditNoteStatus) String ¶ added in v1.0.18
func (c CreditNoteStatus) String() string
func (CreditNoteStatus) Validate ¶ added in v1.0.18
func (c CreditNoteStatus) Validate() error
type CreditNoteType ¶ added in v1.0.18
type CreditNoteType string
const ( CreditNoteTypeAdjustment CreditNoteType = "ADJUSTMENT" CreditNoteTypeRefund CreditNoteType = "REFUND" )
func (CreditNoteType) String ¶ added in v1.0.18
func (c CreditNoteType) String() string
func (CreditNoteType) Validate ¶ added in v1.0.18
func (c CreditNoteType) Validate() error
type CurrencyConfig ¶
func GetCurrencyConfig ¶
func GetCurrencyConfig(code string) CurrencyConfig
type CustomerFilter ¶
type CustomerFilter struct {
*QueryFilter
*TimeRangeFilter
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"`
ExternalIDs []string `json:"external_ids,omitempty" form:"external_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 DefaultSettingValue ¶ added in v1.0.22
type DefaultSettingValue struct {
Key SettingKey `json:"key"`
DefaultValue map[string]interface{} `json:"default_value"`
Description string `json:"description"`
Required bool `json:"required"`
}
DefaultSettingValue represents a default setting configuration
type EntitlementEntityType ¶ added in v1.0.21
type EntitlementEntityType string
const ( ENTITLEMENT_ENTITY_TYPE_PLAN EntitlementEntityType = "PLAN" ENTITLEMENT_ENTITY_TYPE_SUBSCRIPTION EntitlementEntityType = "SUBSCRIPTION" ENTITLEMENT_ENTITY_TYPE_ADDON EntitlementEntityType = "ADDON" )
func (EntitlementEntityType) Validate ¶ added in v1.0.21
func (e EntitlementEntityType) Validate() error
type EntitlementFilter ¶
type EntitlementFilter struct {
*QueryFilter
*TimeRangeFilter
// Specific filters for entitlements
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
EntityType *EntitlementEntityType `form:"entity_type" json:"entity_type,omitempty"`
EntityIDs []string `form:"entity_ids" json:"entity_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"`
PlanIDs []string `form:"plan_ids" json:"plan_ids,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) WithEntityIDs ¶ added in v1.0.21
func (f *EntitlementFilter) WithEntityIDs(entityIDs []string) *EntitlementFilter
WithEntityIDs adds entity IDs to the filter
func (*EntitlementFilter) WithEntityType ¶ added in v1.0.21
func (f *EntitlementFilter) WithEntityType(entityType EntitlementEntityType) *EntitlementFilter
WithEntityType adds entity type to the filter
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 EntitlementUsageResetPeriod ¶ added in v1.0.25
type EntitlementUsageResetPeriod string
const ( // For BILLING_CADENCE_RECURRING ENTITLEMENT_USAGE_RESET_PERIOD_MONTHLY EntitlementUsageResetPeriod = "MONTHLY" ENTITLEMENT_USAGE_RESET_PERIOD_ANNUAL EntitlementUsageResetPeriod = "ANNUAL" ENTITLEMENT_USAGE_RESET_PERIOD_WEEKLY EntitlementUsageResetPeriod = "WEEKLY" ENTITLEMENT_USAGE_RESET_PERIOD_DAILY EntitlementUsageResetPeriod = "DAILY" ENTITLEMENT_USAGE_RESET_PERIOD_QUARTER EntitlementUsageResetPeriod = "QUARTERLY" ENTITLEMENT_USAGE_RESET_PERIOD_HALF_YEAR EntitlementUsageResetPeriod = "HALF_YEARLY" ENTITLEMENT_USAGE_RESET_PERIOD_NEVER EntitlementUsageResetPeriod = "NEVER" )
func (EntitlementUsageResetPeriod) String ¶ added in v1.0.27
func (e EntitlementUsageResetPeriod) String() string
func (EntitlementUsageResetPeriod) Validate ¶ added in v1.0.25
func (e EntitlementUsageResetPeriod) Validate() error
type EntityIntegrationMappingFilter ¶ added in v1.0.21
type EntityIntegrationMappingFilter 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"`
// Entity-specific filters
EntityIDs []string `json:"entity_ids,omitempty" form:"entity_ids" validate:"omitempty"`
EntityType IntegrationEntityType `json:"entity_type,omitempty" form:"entity_type" validate:"omitempty"`
EntityID string `json:"entity_id,omitempty" form:"entity_id" validate:"omitempty"`
// Provider-specific filters (only plural variants kept)
ProviderTypes []string `json:"provider_types,omitempty" form:"provider_types" validate:"omitempty"`
ProviderEntityIDs []string `json:"provider_entity_ids,omitempty" form:"provider_entity_ids" validate:"omitempty"`
}
EntityIntegrationMappingFilter represents filters for entity integration mapping queries
func NewEntityIntegrationMappingFilter ¶ added in v1.0.21
func NewEntityIntegrationMappingFilter() *EntityIntegrationMappingFilter
NewEntityIntegrationMappingFilter creates a new EntityIntegrationMappingFilter with default values
func NewNoLimitEntityIntegrationMappingFilter ¶ added in v1.0.21
func NewNoLimitEntityIntegrationMappingFilter() *EntityIntegrationMappingFilter
NewNoLimitEntityIntegrationMappingFilter creates a new EntityIntegrationMappingFilter with no pagination limits
func (*EntityIntegrationMappingFilter) GetExpand ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*EntityIntegrationMappingFilter) GetLimit ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*EntityIntegrationMappingFilter) GetOffset ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*EntityIntegrationMappingFilter) GetOrder ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*EntityIntegrationMappingFilter) GetSort ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) GetSort() string
GetSort implements BaseFilter interface
func (*EntityIntegrationMappingFilter) GetStatus ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*EntityIntegrationMappingFilter) IsUnlimited ¶ added in v1.0.21
func (f *EntityIntegrationMappingFilter) IsUnlimited() bool
IsUnlimited implements BaseFilter interface
func (EntityIntegrationMappingFilter) Validate ¶ added in v1.0.21
func (f EntityIntegrationMappingFilter) Validate() error
Validate validates the entity integration mapping filter
type EntitySyncConfig ¶ added in v1.0.30
type EntitySyncConfig struct {
Inbound bool `json:"inbound"` // Inbound from external provider to FlexPrice
Outbound bool `json:"outbound"` // Outbound from FlexPrice to external provider
}
EntitySyncConfig defines sync direction for an entity
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" ExpandSchedule ExpandableField = "schedule" ExpandInvoice ExpandableField = "invoice" ExpandSubscription ExpandableField = "subscription" ExpandCustomer ExpandableField = "customer" ExpandCreditNote ExpandableField = "credit_note" ExpandCreditGrant ExpandableField = "credit_grant" ExpandTaxApplied ExpandableField = "tax_applied" ExpandTaxRate ExpandableField = "tax_rate" ExpandTaxAssociation ExpandableField = "tax_association" ExpandCoupon ExpandableField = "coupon" ExpandCouponApplications ExpandableField = "coupon_applications" ExpandPriceUnit ExpandableField = "priceunit" ExpandCouponAssociations ExpandableField = "coupon_associations" ExpandAddons ExpandableField = "addons" )
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 GenericConnectionMetadata ¶ added in v1.0.21
type GenericConnectionMetadata struct {
Data map[string]interface{} `json:"data"`
}
GenericConnectionMetadata represents generic connection metadata
func (*GenericConnectionMetadata) Validate ¶ added in v1.0.21
func (g *GenericConnectionMetadata) Validate() error
Validate validates the generic connection metadata
type IntegrationEntityType ¶ added in v1.0.21
type IntegrationEntityType string
IntegrationEntityType represents the type of entity for integration mapping
const ( IntegrationEntityTypeCustomer IntegrationEntityType = "customer" IntegrationEntityTypePlan IntegrationEntityType = "plan" IntegrationEntityTypeInvoice IntegrationEntityType = "invoice" IntegrationEntityTypeSubscription IntegrationEntityType = "subscription" IntegrationEntityTypePayment IntegrationEntityType = "payment" IntegrationEntityTypeCreditNote IntegrationEntityType = "credit_note" IntegrationEntityTypeAddon IntegrationEntityType = "addon" )
func (IntegrationEntityType) String ¶ added in v1.0.21
func (e IntegrationEntityType) String() string
func (IntegrationEntityType) Validate ¶ added in v1.0.21
func (e IntegrationEntityType) Validate() error
type InvoiceBillingReason ¶
type InvoiceBillingReason string
InvoiceBillingReason indicates why an invoice was generated
const ( // InvoiceBillingReasonSubscriptionCreate indicates invoice is for new subscription activation InvoiceBillingReasonSubscriptionCreate InvoiceBillingReason = "SUBSCRIPTION_CREATE" // InvoiceBillingReasonSubscriptionCycle indicates invoice is for regular subscription billing cycle InvoiceBillingReasonSubscriptionCycle InvoiceBillingReason = "SUBSCRIPTION_CYCLE" // InvoiceBillingReasonSubscriptionUpdate indicates invoice is for subscription changes (upgrades, downgrades) InvoiceBillingReasonSubscriptionUpdate InvoiceBillingReason = "SUBSCRIPTION_UPDATE" // InvoiceBillingReasonProration indicates invoice is for proration credits/charges (cancellations, plan changes) InvoiceBillingReasonProration InvoiceBillingReason = "PRORATION" // InvoiceBillingReasonManual indicates invoice was created manually by an administrator 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 defines when an invoice is generated relative to the billing period ARREAR: Invoice generated at the end of the billing period (after service delivery) ADVANCE: Invoice generated at the beginning of the billing period (before service delivery)
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 InvoiceConfig ¶ added in v1.0.22
type InvoiceConfig struct {
InvoiceNumberPrefix string `json:"prefix,omitempty"`
InvoiceNumberFormat InvoiceNumberFormat `json:"format,omitempty"`
InvoiceNumberStartSequence int `json:"start_sequence,omitempty"`
InvoiceNumberTimezone string `json:"timezone,omitempty"`
InvoiceNumberSeparator string `json:"separator,omitempty"`
InvoiceNumberSuffixLength int `json:"suffix_length,omitempty"`
DueDateDays *int `json:"due_date_days,omitempty"` // Number of days after period end when payment is due
}
InvoiceConfig represents the configuration for automatic invoice number generation. It defines the format and sequencing rules used to create unique, human-readable invoice numbers.
Fields:
- InvoiceNumberPrefix: A string prefix for all invoice numbers (e.g., "INV", "BILL")
- InvoiceNumberFormat: Date format template using Go time format (e.g., "YYYYMM" for year-month)
- InvoiceNumberStartSequence: Starting number for the sequence counter (typically 1)
- InvoiceNumberTimezone: Timezone for date formatting (e.g., "UTC", "America/New_York")
- InvoiceNumberSeparator: Character(s) used to separate parts of the invoice number (e.g., "-", "_", or "" for no separator)
- InvoiceNumberSuffixLength: Number of digits for the sequence number suffix (e.g., 5 for "00001")
Generated invoice numbers follow the pattern: {prefix}{separator}{formatted_date}{separator}{padded_sequence}
Example configuration with separator:
InvoiceNumberPrefix: "INV" InvoiceNumberFormat: "YYYYMM" InvoiceNumberStartSequence: 1 InvoiceNumberTimezone: "UTC" InvoiceNumberSeparator: "-" InvoiceNumberSuffixLength: 5
Generated invoice numbers for January 2025:
"INV-202501-00001" "INV-202501-00002" "INV-202501-00003"
Example configuration without separator:
InvoiceNumberPrefix: "INV" InvoiceNumberFormat: "YYYYMM" InvoiceNumberStartSequence: 1 InvoiceNumberTimezone: "UTC" InvoiceNumberSeparator: "" InvoiceNumberSuffixLength: 5
Generated invoice numbers for January 2025:
"INV20250100001" "INV20250100002" "INV20250100003"
Note: Sequences reset monthly and are tenant-environment-scoped for isolation.
type InvoiceFilter ¶
type InvoiceFilter struct {
*QueryFilter
*TimeRangeFilter
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
// invoice_ids restricts results to invoices with the specified IDs
// Use this to retrieve specific invoices when you know their exact identifiers
InvoiceIDs []string `json:"invoice_ids,omitempty" form:"invoice_ids"`
// customer_id filters invoices for a specific customer using FlexPrice's internal customer ID
// This is the ID returned by FlexPrice when creating or retrieving customers
CustomerID string `json:"customer_id,omitempty" form:"customer_id"`
// external_customer_id filters invoices for a customer using your system's customer identifier
// This is the ID you provided when creating the customer in FlexPrice
ExternalCustomerID string `json:"external_customer_id,omitempty" form:"external_customer_id"`
// subscription_id filters invoices generated for a specific subscription
// Only returns invoices that were created as part of the specified subscription's billing
SubscriptionID string `json:"subscription_id,omitempty" form:"subscription_id"`
// invoice_type filters by the nature of the invoice (SUBSCRIPTION, ONE_OFF, or CREDIT)
// Use this to separate recurring charges from one-time fees or credit adjustments
InvoiceType InvoiceType `json:"invoice_type,omitempty" form:"invoice_type"`
// invoice_status filters by the current state of invoices in their lifecycle
// Multiple statuses can be specified to include invoices in any of the listed states
InvoiceStatus []InvoiceStatus `json:"invoice_status,omitempty" form:"invoice_status"`
// payment_status filters by the payment state of invoices
// Multiple statuses can be specified to include invoices with any of the listed payment states
PaymentStatus []PaymentStatus `json:"payment_status,omitempty" form:"payment_status"`
// amount_due_gt filters invoices with a total amount due greater than the specified value
// Useful for finding invoices above a certain threshold or identifying high-value invoices
AmountDueGt *decimal.Decimal `json:"amount_due_gt,omitempty" form:"amount_due_gt"`
// amount_remaining_gt filters invoices with an outstanding balance greater than the specified value
// Useful for finding invoices that still have significant unpaid amounts
AmountRemainingGt *decimal.Decimal `json:"amount_remaining_gt,omitempty" form:"amount_remaining_gt"`
// SkipLineItems if true, will not include line items in the response
SkipLineItems bool `json:"skip_line_items,omitempty" form:"skip_line_items"`
}
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
type InvoiceFlowType ¶ added in v1.0.25
type InvoiceFlowType string
InvoiceFlowType represents the type of invoice flow for payment behavior handling
const ( // InvoiceFlowSubscriptionCreation represents subscription creation flow - applies full payment behavior logic InvoiceFlowSubscriptionCreation InvoiceFlowType = "subscription_creation" // InvoiceFlowRenewal represents renewal/periodic billing flow - always creates invoices, marks as pending on failure InvoiceFlowRenewal InvoiceFlowType = "renewal" // InvoiceFlowManual represents manual invoice creation flow - default behavior InvoiceFlowManual InvoiceFlowType = "manual" // InvoiceFlowCancel represents subscription cancellation flow - uses subscription's payment method and behavior but doesn't error on manual+renewal InvoiceFlowCancel InvoiceFlowType = "cancel" )
func (InvoiceFlowType) String ¶ added in v1.0.25
func (f InvoiceFlowType) String() string
func (InvoiceFlowType) Validate ¶ added in v1.0.25
func (f InvoiceFlowType) Validate() error
type InvoiceLineItemEntityType ¶ added in v1.0.21
type InvoiceLineItemEntityType string
InvoiceLineItemEntityType is the type of the source of a invoice line item It is optional and can be used to differentiate between plan and addon line items
const ( InvoiceLineItemEntityTypePlan InvoiceLineItemEntityType = "plan" InvoiceLineItemEntityTypeAddon InvoiceLineItemEntityType = "addon" )
type InvoiceNumberFormat ¶ added in v1.0.22
type InvoiceNumberFormat string
const ( InvoiceNumberFormatYYYYMM InvoiceNumberFormat = "YYYYMM" InvoiceNumberFormatYYYYMMDD InvoiceNumberFormat = "YYYYMMDD" InvoiceNumberFormatYYMMDD InvoiceNumberFormat = "YYMMDD" InvoiceNumberFormatYY InvoiceNumberFormat = "YY" InvoiceNumberFormatYYYY InvoiceNumberFormat = "YYYY" )
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" // ReferencePointCancel indicates invoice creation at the end of a period (for arrear charges) ReferencePointCancel InvoiceReferencePoint = "cancel" )
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
InvoiceStatus represents the current state of an invoice in its lifecycle
const ( // InvoiceStatusDraft indicates invoice is in draft state and can be modified or deleted InvoiceStatusDraft InvoiceStatus = "DRAFT" // InvoiceStatusFinalized indicates invoice is finalized, immutable, and ready for payment InvoiceStatusFinalized InvoiceStatus = "FINALIZED" // InvoiceStatusVoided indicates invoice has been voided and is no longer valid for payment InvoiceStatusVoided InvoiceStatus = "VOIDED" )
func (InvoiceStatus) String ¶
func (s InvoiceStatus) String() string
func (InvoiceStatus) Validate ¶
func (s InvoiceStatus) Validate() error
type InvoiceType ¶
type InvoiceType string
InvoiceType categorizes the purpose and nature of the invoice
const ( // InvoiceTypeSubscription indicates invoice is for recurring subscription charges InvoiceTypeSubscription InvoiceType = "SUBSCRIPTION" // InvoiceTypeOneOff indicates invoice is for one-time charges or usage-based billing InvoiceTypeOneOff InvoiceType = "ONE_OFF" // InvoiceTypeCredit indicates invoice is for credit adjustments or refunds 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 PaymentBehavior ¶ added in v1.0.25
type PaymentBehavior string
PaymentBehavior determines how subscription payments are handled
const ( // PaymentBehaviorAllowIncomplete - Immediately attempts payment. If fails, subscription becomes incomplete PaymentBehaviorAllowIncomplete PaymentBehavior = "allow_incomplete" // PaymentBehaviorDefaultIncomplete - Always creates incomplete subscription if payment required PaymentBehaviorDefaultIncomplete PaymentBehavior = "default_incomplete" // PaymentBehaviorErrorIfIncomplete - Fails subscription creation if payment fails PaymentBehaviorErrorIfIncomplete PaymentBehavior = "error_if_incomplete" // PaymentBehaviorDefaultActive - Creates active subscription without payment attempt PaymentBehaviorDefaultActive PaymentBehavior = "default_active" )
func (PaymentBehavior) String ¶ added in v1.0.25
func (p PaymentBehavior) String() string
func (PaymentBehavior) Validate ¶ added in v1.0.25
func (p PaymentBehavior) 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"`
GatewayPaymentID *string `form:"gateway_payment_id"`
}
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 PaymentGatewayType ¶ added in v1.0.21
type PaymentGatewayType string
PaymentGatewayType represents the type of payment gateway
const (
PaymentGatewayTypeStripe PaymentGatewayType = "stripe"
)
func (PaymentGatewayType) String ¶ added in v1.0.21
func (p PaymentGatewayType) String() string
String returns the string representation of the payment gateway type
func (PaymentGatewayType) Validate ¶ added in v1.0.21
func (p PaymentGatewayType) Validate() error
Validate validates the payment gateway type
type PaymentMethodProvider ¶ added in v1.0.28
type PaymentMethodProvider string
const (
PaymentMethodProviderStripe PaymentMethodProvider = "stripe"
)
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" PaymentMethodTypePaymentLink PaymentMethodType = "PAYMENT_LINK" )
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 ( PaymentStatusInitiated PaymentStatus = "INITIATED" PaymentStatusPending PaymentStatus = "PENDING" PaymentStatusProcessing PaymentStatus = "PROCESSING" PaymentStatusSucceeded PaymentStatus = "SUCCEEDED" PaymentStatusOverpaid PaymentStatus = "OVERPAID" 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
// 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"`
PlanIDs []string `json:"plan_ids,omitempty" form:"plan_ids" validate:"omitempty"`
}
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 PriceEntityType ¶ added in v1.0.21
type PriceEntityType string
PriceEntityType is the type of the entity that the price is associated with i.e. PLAN, SUBSCRIPTION, ADDON, PRICE If price is created for plan then it will have PLAN as entity type with entity id as plan id If prices is create for subscription then it will have SUBSCRIPTION as entity type with enitiy id as subscription id If prices is create for addon then it will have ADDON as entity type with enitiy id as addon id If prices is create for price overrides in subscription creation then it will have PRICE as entity type with enitiy id as price id
const ( PRICE_ENTITY_TYPE_PLAN PriceEntityType = "PLAN" PRICE_ENTITY_TYPE_SUBSCRIPTION PriceEntityType = "SUBSCRIPTION" PRICE_ENTITY_TYPE_ADDON PriceEntityType = "ADDON" PRICE_ENTITY_TYPE_PRICE PriceEntityType = "PRICE" )
func (PriceEntityType) Validate ¶ added in v1.0.21
func (p PriceEntityType) Validate() error
type PriceFilter ¶
type PriceFilter struct {
*QueryFilter
*TimeRangeFilter
PriceIDs []string `json:"price_ids,omitempty" form:"price_ids"`
// Price override filtering fields
PlanIDs []string `json:"plan_ids,omitempty" form:"plan_ids"`
EntityType *PriceEntityType `json:"entity_type,omitempty" form:"entity_type"`
EntityIDs []string `json:"entity_ids,omitempty" form:"entity_ids"`
SubscriptionID *string `json:"subscription_id,omitempty" form:"subscription_id"`
ParentPriceID *string `json:"parent_price_id,omitempty" form:"parent_price_id"`
MeterIDs []string `json:"meter_ids,omitempty" form:"meter_ids"`
AllowExpiredPrices bool `json:"allow_expired_prices,omitempty" form:"allow_expired_prices" default:"false"`
}
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) WithAllowExpiredPrices ¶ added in v1.0.23
func (f *PriceFilter) WithAllowExpiredPrices(allowExpiredPrices bool) *PriceFilter
WithAllowExpiredPrices sets the allow expired prices flag on the filter
func (*PriceFilter) WithEntityIDs ¶ added in v1.0.21
func (f *PriceFilter) WithEntityIDs(entityIDs []string) *PriceFilter
WithEntityIDs adds entity IDs to the filter
func (*PriceFilter) WithEntityType ¶ added in v1.0.21
func (f *PriceFilter) WithEntityType(entityType PriceEntityType) *PriceFilter
WithEntityType sets the entity type on the filter
func (*PriceFilter) WithExpand ¶
func (f *PriceFilter) WithExpand(expand string) *PriceFilter
WithExpand sets the expand field on the filter
func (*PriceFilter) WithParentPriceID ¶ added in v1.0.21
func (f *PriceFilter) WithParentPriceID(parentPriceID string) *PriceFilter
WithParentPriceID sets the parent price ID 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
func (*PriceFilter) WithSubscriptionID ¶ added in v1.0.21
func (f *PriceFilter) WithSubscriptionID(subscriptionID string) *PriceFilter
WithSubscriptionID sets the subscription ID filter
type PriceScope ¶ added in v1.0.21
type PriceScope string
PriceScope indicates whether a price is at the plan level or subscription level
func (PriceScope) Validate ¶ added in v1.0.21
func (p PriceScope) Validate() error
type PriceTier ¶ added in v1.0.22
type PriceTier struct {
// up_to is the quantity up to which this tier applies. It is null for the last tier.
// IMPORTANT: Tier boundaries are INCLUSIVE.
// - If up_to is 1000, then quantity less than or equal to 1000 belongs to this tier
// - This behavior is consistent across both VOLUME and SLAB tier modes
UpTo *uint64 `json:"up_to"`
// unit_amount is the amount per unit for the given tier
UnitAmount decimal.Decimal `json:"unit_amount"`
// flat_amount is the flat amount for the given tier (optional)
// Applied on top of unit_amount*quantity. Useful for cases like "2.7$ + 5c"
FlatAmount *decimal.Decimal `json:"flat_amount,omitempty"`
}
Additional types needed for JSON fields
type PriceUnitType ¶ added in v1.0.21
type PriceUnitType string
PriceUnitType is the type of the price unit- Fiat, Custom, Crypto
const ( PRICE_UNIT_TYPE_FIAT PriceUnitType = "FIAT" PRICE_UNIT_TYPE_CUSTOM PriceUnitType = "CUSTOM" )
func (PriceUnitType) Validate ¶ added in v1.0.21
func (p PriceUnitType) Validate() error
type ProrationAction ¶ added in v1.0.25
type ProrationAction string
ProrationAction defines the type of change triggering proration.
const ( ProrationActionUpgrade ProrationAction = "upgrade" ProrationActionDowngrade ProrationAction = "downgrade" ProrationActionQuantityChange ProrationAction = "quantity_change" ProrationActionCancellation ProrationAction = "cancellation" ProrationActionAddItem ProrationAction = "add_item" ProrationActionRemoveItem ProrationAction = "remove_item" )
type ProrationBehavior ¶ added in v1.0.25
type ProrationBehavior string
ProrationBehavior defines how proration is applied (e.g., create invoice items).
const ( ProrationBehaviorCreateProrations ProrationBehavior = "create_prorations" // Default: Create credits/charges on invoice ProrationBehaviorNone ProrationBehavior = "none" // Calculate but don't apply (e.g., for previews) )
func (ProrationBehavior) Validate ¶ added in v1.0.25
func (p ProrationBehavior) Validate() error
type ProrationStrategy ¶ added in v1.0.25
type ProrationStrategy string
ProrationStrategy defines how the proration coefficient is calculated.
const ( StrategyDayBased ProrationStrategy = "day_based" // Default StrategySecondBased ProrationStrategy = "second_based" // Future enhancement )
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" // ModeTemporalWorker is the mode for running the temporal worker ModeTemporalWorker RunMode = "temporal_worker" )
type S3CompressionType ¶ added in v1.0.32
type S3CompressionType string
S3CompressionType represents the compression type for S3 uploads
const ( S3CompressionTypeNone S3CompressionType = "none" S3CompressionTypeGzip S3CompressionType = "gzip" )
func (S3CompressionType) Validate ¶ added in v1.0.32
func (c S3CompressionType) Validate() error
Validate validates the S3 compression type
type S3ConnectionMetadata ¶ added in v1.0.32
type S3ConnectionMetadata struct {
AWSAccessKeyID string `json:"aws_access_key_id"` // AWS access key (encrypted)
AWSSecretAccessKey string `json:"aws_secret_access_key"` // AWS secret access key (encrypted)
AWSSessionToken string `json:"aws_session_token,omitempty"` // AWS session token for temporary credentials (encrypted)
}
S3ConnectionMetadata represents S3-specific connection metadata (encrypted secrets only) This goes in the encrypted_secret_data column
func (*S3ConnectionMetadata) Validate ¶ added in v1.0.32
func (s *S3ConnectionMetadata) Validate() error
Validate validates the S3 connection metadata
type S3EncryptionType ¶ added in v1.0.32
type S3EncryptionType string
S3EncryptionType represents the encryption type for S3 uploads
const ( S3EncryptionTypeAES256 S3EncryptionType = "AES256" S3EncryptionTypeAwsKms S3EncryptionType = "aws:kms" S3EncryptionTypeAwsKmsDsse S3EncryptionType = "aws:kms:dsse" )
func (S3EncryptionType) Validate ¶ added in v1.0.32
func (e S3EncryptionType) Validate() error
Validate validates the S3 encryption type
type S3ExportConfig ¶ added in v1.0.32
type S3ExportConfig struct {
Bucket string `json:"bucket"` // S3 bucket name
Region string `json:"region"` // AWS region (e.g., "us-west-2")
KeyPrefix string `json:"key_prefix,omitempty"` // Optional prefix for S3 keys (e.g., "flexprice-exports/")
Compression S3CompressionType `json:"compression,omitempty"` // Compression type: "gzip", "none" (default: "none")
Encryption S3EncryptionType `json:"encryption,omitempty"` // Encryption type: "AES256", "aws:kms", "aws:kms:dsse" (default: "AES256")
}
S3ExportConfig represents S3 export configuration (non-sensitive settings) This goes in the sync_config column
func (*S3ExportConfig) Validate ¶ added in v1.0.32
func (s *S3ExportConfig) Validate() error
Validate validates the S3 export configuration
type S3JobConfig ¶ added in v1.0.32
type S3JobConfig struct {
Bucket string `json:"bucket"` // S3 bucket name
Region string `json:"region"` // AWS region (e.g., "us-west-2")
KeyPrefix string `json:"key_prefix,omitempty"` // Optional prefix for S3 keys (e.g., "flexprice-exports/")
Compression S3CompressionType `json:"compression,omitempty"` // Compression type: "gzip", "none" (default: "none")
Encryption S3EncryptionType `json:"encryption,omitempty"` // Encryption type: "AES256", "aws:kms", "aws:kms:dsse" (default: "AES256")
}
S3JobConfig represents the configuration for an S3 export job This is stored in the job_config JSON field of scheduled_tasks table
func (*S3JobConfig) SetDefaults ¶ added in v1.0.32
func (s *S3JobConfig) SetDefaults()
SetDefaults sets default values for the S3 job configuration
func (*S3JobConfig) Validate ¶ added in v1.0.32
func (s *S3JobConfig) Validate() error
Validate validates the S3 job configuration
type ScheduleEndBehavior ¶ added in v1.0.18
type ScheduleEndBehavior string
ScheduleEndBehavior defines what happens when the final phase ends
const ( EndBehaviorRelease ScheduleEndBehavior = "RELEASE" EndBehaviorCancel ScheduleEndBehavior = "CANCEL" )
type SchedulePhaseCreditGrant ¶ added in v1.0.18
type SchedulePhaseCreditGrant struct {
Name string `json:"name" binding:"required"`
Scope CreditGrantScope `json:"scope" binding:"required"`
PlanID *string `json:"plan_id,omitempty"`
Credits decimal.Decimal `json:"credits" binding:"required"`
Currency string `json:"currency" binding:"required"`
Cadence CreditGrantCadence `json:"cadence" binding:"required"`
Period *CreditGrantPeriod `json:"period,omitempty"`
PeriodCount *int `json:"period_count,omitempty"`
ExpirationType CreditGrantExpiryType `json:"expiration_type,omitempty"`
ExpirationDuration *int `json:"expiration_duration,omitempty"`
ExpirationDurationUnit *CreditGrantExpiryDurationUnit `json:"expiration_duration_unit,omitempty"`
Priority *int `json:"priority,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
}
SchedulePhaseCreditGrant represents a credit grant in a schedule phase
type SchedulePhaseLineItem ¶ added in v1.0.18
type SchedulePhaseLineItem struct {
PriceID string `json:"price_id" validate:"required"`
Quantity decimal.Decimal `json:"quantity" validate:"required"`
DisplayName string `json:"display_name,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
SchedulePhaseLineItem represents a line item in a schedule phase
type ScheduleType ¶ added in v1.0.25
type ScheduleType string
ScheduleType determines when subscription changes take effect.
const ( ScheduleTypeImmediate ScheduleType = "immediate" ScheduleTypePeriodEnd ScheduleType = "period_end" ScheduleTypeSpecificDate ScheduleType = "specific_date" )
type ScheduledTaskEntityType ¶ added in v1.0.32
type ScheduledTaskEntityType string
ScheduledTaskEntityType represents the entity type for scheduled tasks
const ( ScheduledTaskEntityTypeEvents ScheduledTaskEntityType = "events" ScheduledTaskEntityTypeInvoice ScheduledTaskEntityType = "invoice" )
func (ScheduledTaskEntityType) Validate ¶ added in v1.0.32
func (e ScheduledTaskEntityType) Validate() error
Validate validates the entity type
type ScheduledTaskInterval ¶ added in v1.0.32
type ScheduledTaskInterval string
ScheduledTaskInterval represents the interval for scheduled tasks
const ( ScheduledTaskIntervalCustom ScheduledTaskInterval = "custom" // 10 minutes for testing ScheduledTaskIntervalHourly ScheduledTaskInterval = "hourly" ScheduledTaskIntervalDaily ScheduledTaskInterval = "daily" )
func (ScheduledTaskInterval) Validate ¶ added in v1.0.32
func (s ScheduledTaskInterval) Validate() error
Validate validates the scheduled task interval
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" SecretProviderS3 SecretProvider = "s3" )
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 SettingKey ¶ added in v1.0.22
type SettingKey string
const ( SettingKeyInvoiceConfig SettingKey = "invoice_config" SettingKeySubscriptionConfig SettingKey = "subscription_config" )
func (SettingKey) String ¶ added in v1.0.22
func (s SettingKey) String() string
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 StripeConnectionMetadata ¶ added in v1.0.21
type StripeConnectionMetadata struct {
PublishableKey string `json:"publishable_key"`
SecretKey string `json:"secret_key"`
WebhookSecret string `json:"webhook_secret"`
AccountID string `json:"account_id,omitempty"`
}
StripeConnectionMetadata represents Stripe-specific connection metadata
func (*StripeConnectionMetadata) Validate ¶ added in v1.0.21
func (s *StripeConnectionMetadata) Validate() error
Validate validates the Stripe connection metadata
type SubscriptionChangeType ¶ added in v1.0.25
type SubscriptionChangeType string
SubscriptionChangeType defines the type of subscription change
const ( SubscriptionChangeTypeUpgrade SubscriptionChangeType = "upgrade" SubscriptionChangeTypeDowngrade SubscriptionChangeType = "downgrade" SubscriptionChangeTypeLateral SubscriptionChangeType = "lateral" )
func (SubscriptionChangeType) String ¶ added in v1.0.25
func (s SubscriptionChangeType) String() string
func (SubscriptionChangeType) Validate ¶ added in v1.0.25
func (s SubscriptionChangeType) Validate() error
type SubscriptionConfig ¶ added in v1.0.25
type SubscriptionConfig struct {
GracePeriodDays int `json:"grace_period_days"`
AutoCancellationEnabled bool `json:"auto_cancellation_enabled"`
}
SubscriptionConfig represents the configuration for subscription auto-cancellation
type SubscriptionFilter ¶
type SubscriptionFilter struct {
*QueryFilter
*TimeRangeFilter
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids"`
// 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 SubscriptionLineItemEntityType ¶ added in v1.0.23
type SubscriptionLineItemEntityType string
SubscriptionLineItemEntityType is the type of the source of a subscription line item It is optional and can be used to differentiate between plan and addon line items
const ( SubscriptionLineItemEntityTypePlan SubscriptionLineItemEntityType = "plan" SubscriptionLineItemEntityTypeAddon SubscriptionLineItemEntityType = "addon" )
type SubscriptionLineItemFilter ¶
type SubscriptionLineItemFilter struct {
*QueryFilter
*TimeRangeFilter
// Specific filters
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids"`
PriceIDs []string `json:"price_ids,omitempty" form:"price_ids"`
MeterIDs []string `json:"meter_ids,omitempty" form:"meter_ids"`
Currencies []string `json:"currencies,omitempty" form:"currencies"`
BillingPeriods []string `json:"billing_periods,omitempty" form:"billing_periods"`
EntityIDs []string `json:"entity_ids,omitempty" form:"entity_ids"`
EntityType *SubscriptionLineItemEntityType `json:"entity_type,omitempty" form:"entity_type"`
ActiveFilter bool `json:"active_filter,omitempty" form:"active_filter" default:"true"`
CurrentPeriodStart *time.Time `json:"current_period_start,omitempty" form:"current_period_start"`
}
SubscriptionLineItemFilter defines filters for querying subscription line items
func NewNoLimitSubscriptionLineItemFilter ¶ added in v1.0.21
func NewNoLimitSubscriptionLineItemFilter() *SubscriptionLineItemFilter
NewNoLimitSubscriptionLineItemFilter creates a new subscription line item filter without pagination
func NewSubscriptionLineItemFilter ¶ added in v1.0.21
func NewSubscriptionLineItemFilter() *SubscriptionLineItemFilter
NewSubscriptionLineItemFilter creates a new subscription line item filter with default options
func (*SubscriptionLineItemFilter) GetExpand ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) GetExpand() Expand
GetExpand returns the expand value for the filter
func (*SubscriptionLineItemFilter) GetLimit ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) GetLimit() int
GetLimit returns the limit value for the filter
func (*SubscriptionLineItemFilter) GetOffset ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) GetOffset() int
GetOffset returns the offset value for the filter
func (*SubscriptionLineItemFilter) GetOrder ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) GetOrder() string
GetOrder returns the order value for the filter
func (*SubscriptionLineItemFilter) GetSort ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) GetSort() string
GetSort returns the sort value for the filter
func (*SubscriptionLineItemFilter) GetStatus ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) GetStatus() string
GetStatus returns the status value for the filter
func (*SubscriptionLineItemFilter) IsUnlimited ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) IsUnlimited() bool
IsUnlimited returns whether the filter has unlimited pagination
func (*SubscriptionLineItemFilter) Validate ¶ added in v1.0.21
func (f *SubscriptionLineItemFilter) Validate() error
Validate validates the subscription line item filter
type SubscriptionScheduleStatus ¶ added in v1.0.18
type SubscriptionScheduleStatus string
SubscriptionScheduleStatus represents the status of a schedule
const ( ScheduleStatusActive SubscriptionScheduleStatus = "ACTIVE" ScheduleStatusReleased SubscriptionScheduleStatus = "RELEASED" ScheduleStatusCanceled SubscriptionScheduleStatus = "CANCELED" )
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 SyncConfig ¶ added in v1.0.30
type SyncConfig struct {
// Integration sync (Stripe, Razorpay, etc.)
Plan *EntitySyncConfig `json:"plan,omitempty"`
Subscription *EntitySyncConfig `json:"subscription,omitempty"`
Invoice *EntitySyncConfig `json:"invoice,omitempty"`
}
SyncConfig defines which entities should be synced between FlexPrice and external providers
func DefaultSyncConfig ¶ added in v1.0.30
func DefaultSyncConfig() *SyncConfig
DefaultSyncConfig returns a sync config with all entities disabled
func (*SyncConfig) Validate ¶ added in v1.0.30
func (s *SyncConfig) Validate() error
Validate validates the SyncConfig
type TaskFilter ¶
type TaskFilter struct {
*QueryFilter
*TimeRangeFilter
TaskType *TaskType `json:"task_type,omitempty" form:"task_type"`
EntityType *EntityType `json:"entity_type,omitempty" form:"entity_type"`
TaskStatus *TaskStatus `json:"task_status,omitempty" form:"task_status"`
ScheduledTaskID string `json:"scheduled_task_id,omitempty" form:"scheduled_task_id"`
CreatedBy string `json:"created_by,omitempty" form:"created_by"`
StartTime *time.Time `json:"start_time,omitempty" form:"start_time"`
EndTime *time.Time `json:"end_time,omitempty" form:"end_time"`
}
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 TaxAppliedFilter ¶ added in v1.0.21
type TaxAppliedFilter struct {
*QueryFilter
*TimeRangeFilter
Expand Expand `json:"expand,omitempty" form:"expand" validate:"omitempty"`
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
TaxRateIDs []string `json:"taxrate_ids,omitempty" form:"taxrate_ids" validate:"omitempty"`
EntityType TaxRateEntityType `json:"entity_type,omitempty" form:"entity_type" validate:"omitempty"`
EntityID string `json:"entity_id,omitempty" form:"entity_id" validate:"omitempty"`
TaxAssociationID string `json:"tax_association_id,omitempty" form:"tax_association_id" validate:"omitempty"`
}
TaxAppliedFilter represents filters for taxapplied queries
func NewDefaultTaxAppliedFilter ¶ added in v1.0.21
func NewDefaultTaxAppliedFilter() *TaxAppliedFilter
func NewNoLimitTaxAppliedFilter ¶ added in v1.0.21
func NewNoLimitTaxAppliedFilter() *TaxAppliedFilter
NewNoLimitTaxAppliedFilter creates a new TaxAppliedFilter with no pagination limits
func NewTaxAppliedFilter ¶ added in v1.0.21
func NewTaxAppliedFilter() *TaxAppliedFilter
NewTaxAppliedFilter creates a new TaxAppliedFilter with default values
func (*TaxAppliedFilter) GetExpand ¶ added in v1.0.21
func (f *TaxAppliedFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*TaxAppliedFilter) GetLimit ¶ added in v1.0.21
func (f *TaxAppliedFilter) GetLimit() int
GetLimit returns the limit for the TaxAppliedFilter
func (*TaxAppliedFilter) GetOffset ¶ added in v1.0.21
func (f *TaxAppliedFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*TaxAppliedFilter) GetOrder ¶ added in v1.0.21
func (f *TaxAppliedFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*TaxAppliedFilter) GetSort ¶ added in v1.0.21
func (f *TaxAppliedFilter) GetSort() string
GetSort implements BaseFilter interface
func (*TaxAppliedFilter) GetStatus ¶ added in v1.0.21
func (f *TaxAppliedFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*TaxAppliedFilter) IsUnlimited ¶ added in v1.0.21
func (f *TaxAppliedFilter) IsUnlimited() bool
IsUnlimited implements BaseFilter interface
func (*TaxAppliedFilter) Validate ¶ added in v1.0.21
func (f *TaxAppliedFilter) Validate() error
Validate validates the TaxAppliedFilter
type TaxAssociationFilter ¶ added in v1.0.21
type TaxAssociationFilter struct {
*QueryFilter
*TimeRangeFilter
TaxAssociationIDs []string `json:"tax_association_ids,omitempty" form:"tax_association_ids"`
TaxRateIDs []string `json:"tax_rate_ids,omitempty" form:"tax_rate_ids"`
EntityType TaxRateEntityType `json:"entity_type,omitempty" form:"entity_type"`
EntityID string `json:"entity_id,omitempty" form:"entity_id"`
Currency string `json:"currency,omitempty" form:"currency"`
AutoApply *bool `json:"auto_apply,omitempty" form:"auto_apply"`
}
TaxAssociationFilter represents the filter options for listing tax configs
func NewNoLimitTaxAssociationFilter ¶ added in v1.0.21
func NewNoLimitTaxAssociationFilter() *TaxAssociationFilter
NewNoLimitTaxAssociationFilter creates a new tax association filter without pagination
func NewTaxAssociationFilter ¶ added in v1.0.21
func NewTaxAssociationFilter() *TaxAssociationFilter
NewTaxAssociationFilter creates a new tax association filter with default options
func (*TaxAssociationFilter) GetExpand ¶ added in v1.0.21
func (f *TaxAssociationFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*TaxAssociationFilter) GetLimit ¶ added in v1.0.21
func (f *TaxAssociationFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*TaxAssociationFilter) GetOffset ¶ added in v1.0.21
func (f *TaxAssociationFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*TaxAssociationFilter) GetOrder ¶ added in v1.0.21
func (f *TaxAssociationFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*TaxAssociationFilter) GetSort ¶ added in v1.0.21
func (f *TaxAssociationFilter) GetSort() string
GetSort implements BaseFilter interface
func (*TaxAssociationFilter) GetStatus ¶ added in v1.0.21
func (f *TaxAssociationFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*TaxAssociationFilter) IsUnlimited ¶ added in v1.0.21
func (f *TaxAssociationFilter) IsUnlimited() bool
func (*TaxAssociationFilter) Validate ¶ added in v1.0.21
func (f *TaxAssociationFilter) Validate() error
Validate validates the tax association filter
type TaxRateAssignmentStatus ¶ added in v1.0.21
type TaxRateAssignmentStatus string
TaxRateAssignmentStatus defines the status of a tax rate assignment
const ( TaxRateAssignmentStatusActive TaxRateAssignmentStatus = "ACTIVE" TaxRateAssignmentStatusInactive TaxRateAssignmentStatus = "INACTIVE" TaxRateAssignmentStatusSuspended TaxRateAssignmentStatus = "SUSPENDED" )
func (TaxRateAssignmentStatus) String ¶ added in v1.0.21
func (s TaxRateAssignmentStatus) String() string
func (TaxRateAssignmentStatus) Validate ¶ added in v1.0.21
func (s TaxRateAssignmentStatus) Validate() error
type TaxRateEntityType ¶ added in v1.0.21
type TaxRateEntityType string
const ( TaxRateEntityTypeCustomer TaxRateEntityType = "customer" TaxRateEntityTypeSubscription TaxRateEntityType = "subscription" TaxRateEntityTypeInvoice TaxRateEntityType = "invoice" TaxRateEntityTypeTenant TaxRateEntityType = "tenant" )
func GetHierarchyLevels ¶ added in v1.0.21
func GetHierarchyLevels(currentEntityType TaxRateEntityType) []TaxRateEntityType
GetHierarchyLevels returns the hierarchy levels excluding the current entity type
func (TaxRateEntityType) String ¶ added in v1.0.21
func (t TaxRateEntityType) String() string
func (TaxRateEntityType) Validate ¶ added in v1.0.21
func (t TaxRateEntityType) Validate() error
type TaxRateFilter ¶ added in v1.0.21
type TaxRateFilter struct {
*QueryFilter
*TimeRangeFilter
Filters []*FilterCondition `json:"filters,omitempty" form:"filters" validate:"omitempty"`
Sort []*SortCondition `json:"sort,omitempty" form:"sort" validate:"omitempty"`
TaxRateIDs []string `json:"taxrate_ids,omitempty" form:"taxrate_ids" validate:"omitempty"`
TaxRateCodes []string `json:"taxrate_codes,omitempty" form:"taxrate_codes" validate:"omitempty"`
Scope TaxRateScope `json:"scope,omitempty" form:"scope" validate:"omitempty"`
}
TaxRateFilter represents filters for taxrate queries
func NewDefaultTaxRateFilter ¶ added in v1.0.21
func NewDefaultTaxRateFilter() *TaxRateFilter
func NewNoLimitTaxRateFilter ¶ added in v1.0.21
func NewNoLimitTaxRateFilter() *TaxRateFilter
NewNoLimitTaxRateFilter creates a new TaxRateFilter with no pagination limits
func NewTaxRateFilter ¶ added in v1.0.21
func NewTaxRateFilter() *TaxRateFilter
NewTaxRateFilter creates a new TaxRateFilter with default values
func (*TaxRateFilter) GetExpand ¶ added in v1.0.21
func (f *TaxRateFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*TaxRateFilter) GetLimit ¶ added in v1.0.21
func (f *TaxRateFilter) GetLimit() int
GetLimit returns the limit for the TaxRateFilter
func (*TaxRateFilter) GetOffset ¶ added in v1.0.21
func (f *TaxRateFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*TaxRateFilter) GetOrder ¶ added in v1.0.21
func (f *TaxRateFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*TaxRateFilter) GetSort ¶ added in v1.0.21
func (f *TaxRateFilter) GetSort() string
GetSort implements BaseFilter interface
func (*TaxRateFilter) GetStatus ¶ added in v1.0.21
func (f *TaxRateFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*TaxRateFilter) IsUnlimited ¶ added in v1.0.21
func (f *TaxRateFilter) IsUnlimited() bool
IsUnlimited implements BaseFilter interface
func (*TaxRateFilter) Validate ¶ added in v1.0.21
func (f *TaxRateFilter) Validate() error
Validate validates the TaxRateFilter
type TaxRateScope ¶ added in v1.0.21
type TaxRateScope string
TaxRateScope defines the scope/visibility of a tax rate
const ( TaxRateScopeInternal TaxRateScope = "INTERNAL" TaxRateScopeExternal TaxRateScope = "EXTERNAL" TaxRateScopeOneTime TaxRateScope = "ONETIME" )
func (TaxRateScope) String ¶ added in v1.0.21
func (s TaxRateScope) String() string
func (TaxRateScope) Validate ¶ added in v1.0.21
func (s TaxRateScope) Validate() error
type TaxRateStatus ¶ added in v1.0.21
type TaxRateStatus string
TaxRateStatus defines the status of a tax rate
const ( TaxRateStatusActive TaxRateStatus = "ACTIVE" TaxRateStatusInactive TaxRateStatus = "INACTIVE" )
func (TaxRateStatus) String ¶ added in v1.0.21
func (s TaxRateStatus) String() string
func (TaxRateStatus) Validate ¶ added in v1.0.21
func (s TaxRateStatus) Validate() error
type TaxRateType ¶ added in v1.0.21
type TaxRateType string
const ( TaxRateTypePercentage TaxRateType = "percentage" TaxRateTypeFixed TaxRateType = "fixed" )
func (TaxRateType) String ¶ added in v1.0.21
func (t TaxRateType) String() string
func (TaxRateType) Validate ¶ added in v1.0.21
func (t TaxRateType) Validate() error
type TemporalTaskQueue ¶ added in v1.0.27
type TemporalTaskQueue string
TemporalTaskQueue represents a logical grouping of workflows and activities
const ( // Task Queues - logical groupings to limit worker count TemporalTaskQueueTask TemporalTaskQueue = "task" TemporalTaskQueuePrice TemporalTaskQueue = "price" TemporalTaskQueueExport TemporalTaskQueue = "export" )
func GetAllTaskQueues ¶ added in v1.0.27
func GetAllTaskQueues() []TemporalTaskQueue
GetAllTaskQueues returns all available task queues
func (TemporalTaskQueue) String ¶ added in v1.0.27
func (tq TemporalTaskQueue) String() string
String returns the string representation of the task queue
func (TemporalTaskQueue) Validate ¶ added in v1.0.27
func (tq TemporalTaskQueue) Validate() error
Validate validates the task queue
type TemporalWorkflowType ¶ added in v1.0.25
type TemporalWorkflowType string
TemporalWorkflowType represents the type of workflow
const ( // Workflow Types - only include implemented workflows TemporalPriceSyncWorkflow TemporalWorkflowType = "PriceSyncWorkflow" TemporalTaskProcessingWorkflow TemporalWorkflowType = "TaskProcessingWorkflow" TemporalSubscriptionChangeWorkflow TemporalWorkflowType = "SubscriptionChangeWorkflow" TemporalSubscriptionCreationWorkflow TemporalWorkflowType = "SubscriptionCreationWorkflow" TemporalStripeIntegrationWorkflow TemporalWorkflowType = "StripeIntegrationWorkflow" TemporalExecuteExportWorkflow TemporalWorkflowType = "ExecuteExportWorkflow" )
func GetWorkflowsForTaskQueue ¶ added in v1.0.27
func GetWorkflowsForTaskQueue(taskQueue TemporalTaskQueue) []TemporalWorkflowType
GetWorkflowsForTaskQueue returns all workflows that belong to a specific task queue
func (TemporalWorkflowType) String ¶ added in v1.0.25
func (w TemporalWorkflowType) String() string
String returns the string representation of the workflow type
func (TemporalWorkflowType) TaskQueue ¶ added in v1.0.27
func (w TemporalWorkflowType) TaskQueue() TemporalTaskQueue
TaskQueue returns the logical task queue for the workflow
func (TemporalWorkflowType) TaskQueueName ¶ added in v1.0.25
func (w TemporalWorkflowType) TaskQueueName() string
TaskQueueName returns the task queue name for the workflow
func (TemporalWorkflowType) Validate ¶ added in v1.0.25
func (w TemporalWorkflowType) Validate() error
Validate validates the workflow type
func (TemporalWorkflowType) WorkflowID ¶ added in v1.0.25
func (w TemporalWorkflowType) WorkflowID(identifier string) string
WorkflowID returns the workflow ID for the workflow with given identifier
type TenantEnvConfig ¶ added in v1.0.25
type TenantEnvConfig struct {
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
Config map[string]interface{} `json:"config"`
}
TenantEnvConfig represents a generic configuration for a specific tenant and environment
type TenantEnvSubscriptionConfig ¶ added in v1.0.25
type TenantEnvSubscriptionConfig struct {
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
*SubscriptionConfig
}
TenantSubscriptionConfig represents subscription configuration for a specific tenant and environment
func TenantEnvSubscriptionConfigFromConfig ¶ added in v1.0.25
func TenantEnvSubscriptionConfigFromConfig(config *TenantEnvConfig) *TenantEnvSubscriptionConfig
FromTenantEnvConfig creates a TenantEnvSubscriptionConfig from a generic TenantEnvConfig
func (*TenantEnvSubscriptionConfig) ToTenantEnvConfig ¶ added in v1.0.25
func (t *TenantEnvSubscriptionConfig) ToTenantEnvConfig() *TenantEnvConfig
ToTenantEnvConfig converts a TenantEnvSubscriptionConfig to a generic TenantEnvConfig
type TerminationReason ¶ added in v1.0.25
type TerminationReason string
TerminationReason represents why a subscription is being terminated.
const ( TerminationReasonUpgrade TerminationReason = "upgrade" TerminationReasonDowngrade TerminationReason = "downgrade" TerminationReasonCancellation TerminationReason = "cancellation" TerminationReasonExpiration TerminationReason = "expiration" )
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" TransactionReasonCreditNote TransactionReason = "CREDIT_NOTE" 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 TransformQuantity ¶ added in v1.0.22
type UpdateScheduledTaskInput ¶ added in v1.0.32
type UpdateScheduledTaskInput struct {
Interval *ScheduledTaskInterval
Enabled *bool
JobConfig *S3JobConfig
}
UpdateScheduledTaskInput represents the input for updating a scheduled task
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 WalletAlertThreshold ¶ added in v1.0.32
type WalletAlertThreshold struct {
Type AlertThresholdType `json:"type"` // amount
Value decimal.Decimal `json:"value"`
}
WalletAlertThreshold represents the threshold configuration for wallet alerts
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 WalletFilter ¶ added in v1.0.21
type WalletFilter struct {
*QueryFilter
WalletIDs []string `json:"wallet_ids,omitempty" form:"wallet_ids"`
Status *WalletStatus `json:"status,omitempty" form:"status"`
AlertEnabled *bool `json:"alert_enabled,omitempty" form:"alert_enabled"`
}
WalletFilter represents the filter options for wallets
func NewWalletFilter ¶ added in v1.0.21
func NewWalletFilter() *WalletFilter
func (*WalletFilter) Validate ¶ added in v1.0.21
func (f *WalletFilter) Validate() error
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"`
Priority *int `json:"priority,omitempty" form:"priority"`
}
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"`
EnvironmentID string `json:"environment_id"`
UserID string `json:"user_id"`
Timestamp time.Time `json:"timestamp"`
Payload json.RawMessage `json:"payload"`
}
WebhookEvent represents a webhook event to be delivered
type WebhookEventType ¶ added in v1.0.21
type WebhookEventType string
WebhookEventType represents the type of webhook event
const ( // Stripe webhook events WebhookEventTypeCheckoutSessionCompleted WebhookEventType = "checkout.session.completed" WebhookEventTypeCheckoutSessionAsyncPaymentSucceeded WebhookEventType = "checkout.session.async_payment_succeeded" WebhookEventTypeCheckoutSessionAsyncPaymentFailed WebhookEventType = "checkout.session.async_payment_failed" WebhookEventTypeCheckoutSessionExpired WebhookEventType = "checkout.session.expired" WebhookEventTypeCustomerCreated WebhookEventType = "customer.created" WebhookEventTypePaymentIntentPaymentFailed WebhookEventType = "payment_intent.payment_failed" WebhookEventTypeInvoicePaymentPaid WebhookEventType = "invoice_payment.paid" WebhookEventTypeSetupIntentSucceeded WebhookEventType = "setup_intent.succeeded" WebhookEventTypeProductCreated WebhookEventType = "product.created" WebhookEventTypeProductUpdated WebhookEventType = "product.updated" WebhookEventTypeProductDeleted WebhookEventType = "product.deleted" WebhookEventTypeSubscriptionCreated WebhookEventType = "customer.subscription.created" WebhookEventTypeSubscriptionUpdated WebhookEventType = "customer.subscription.updated" WebhookEventTypeSubscriptionDeleted WebhookEventType = "customer.subscription.deleted" WebhookEventTypePaymentIntentSucceeded WebhookEventType = "payment_intent.succeeded" )
type WindowSize ¶
type WindowSize string
WindowSize defines the time window for aggregating usage data.
Supported window sizes and their behavior: - MINUTE: 1-minute windows (00:00:00 to 00:00:59) - 15MIN: 15-minute windows (00:00:00 to 00:14:59, 00:15:00 to 00:29:59, etc.) - 30MIN: 30-minute windows (00:00:00 to 00:29:59, 00:30:00 to 00:59:59, etc.) - HOUR: 1-hour windows (00:00:00 to 00:59:59) - 3HOUR: 3-hour windows (00:00:00 to 02:59:59, 03:00:00 to 05:59:59, etc.) - 6HOUR: 6-hour windows (00:00:00 to 05:59:59, 06:00:00 to 11:59:59, etc.) - 12HOUR: 12-hour windows (00:00:00 to 11:59:59, 12:00:00 to 23:59:59) - DAY: 1-day windows (00:00:00 to 23:59:59 of the same day) - WEEK: 1-week windows (Monday 00:00:00 to Sunday 23:59:59) - MONTH: 1-month windows (1st 00:00:00 to last day 23:59:59 of the same month)
Special behavior for MONTH window size: - When used with BillingAnchor: Creates custom monthly periods (e.g., 5th to 5th of each month) - When used without BillingAnchor: Uses standard calendar months (1st to 1st of each month) - All other window sizes ignore BillingAnchor and use standard calendar-based windows
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" WindowSizeMonth WindowSize = "MONTH" )
Note: keep values up to date in the meter package
func (WindowSize) Validate ¶
func (w WindowSize) Validate() error
Source Files
¶
- addon.go
- addonassociation.go
- aggregation.go
- alertlogs.go
- auth.go
- basemodel.go
- billing.go
- config.go
- connection.go
- context.go
- coupon.go
- coupon_validation_error.go
- creditgrant.go
- creditgrantapplication.go
- creditnote.go
- currency.go
- customer.go
- date.go
- email.go
- entitlement.go
- entityintegrationmapping.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
- payment_gateway.go
- plan.go
- price.go
- proration.go
- publisher.go
- pubsub.go
- reset_usage.go
- scheduled_task.go
- search_filter.go
- secret.go
- settings.go
- status.go
- subscription.go
- subscription_line_item_filter.go
- sync_config.go
- task.go
- taxapplied.go
- taxassociation.go
- taxrate.go
- temporal.go
- time.go
- transaction.go
- uuid.go
- wallet.go
- webhook.go
- window_size.go