billing

package
v1.0.0-beta.229 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 89 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertTotals

func AssertTotals(t *testing.T, expected ExpectedTotals, actual totals.Totals)

func ExpectJSONEqual

func ExpectJSONEqual(t *testing.T, exp, actual any)

func WithCustomInvoicingConfig

func WithCustomInvoicingConfig(config appcustominvoicing.Configuration) setupCustomInvoicingOption

Types

type BaseSuite

type BaseSuite struct {
	suite.Suite

	TestDB   *testutils.TestDB
	DBClient *db.Client

	BillingAdapter    billing.Adapter
	BillingService    billing.Service
	InvoiceCalculator *invoicecalc.MockableInvoiceCalculator

	FeatureService         feature.FeatureConnector
	FeatureRepo            feature.FeatureRepo
	MeterAdapter           *meteradapter.TestAdapter
	MockStreamingConnector *streamingtestutils.MockStreamingConnector

	CustomerService customer.Service
	SubjectService  subject.Service

	CustomInvoicingService appcustominvoicing.Service

	AppService app.Service
	SandboxApp *appsandbox.MockableFactory

	TaxCodeService taxcode.Service
}

func (*BaseSuite) AssertDecimalEqual

func (s *BaseSuite) AssertDecimalEqual(expected, actual alpacadecimal.Decimal, label string)

func (*BaseSuite) AssertTotals

func (s *BaseSuite) AssertTotals(expected ExpectedTotals, actual totals.Totals)

func (*BaseSuite) CreateDraftInvoice

func (s *BaseSuite) CreateDraftInvoice(t *testing.T, ctx context.Context, in DraftInvoiceInput) billing.StandardInvoice

func (*BaseSuite) CreateGatheringInvoice

func (s *BaseSuite) CreateGatheringInvoice(t *testing.T, ctx context.Context, in DraftInvoiceInput)

func (*BaseSuite) CreateTestCustomer

func (s *BaseSuite) CreateTestCustomer(ns string, subjectKey string) *customer.Customer

func (*BaseSuite) DebugDumpGatheringInvoice

func (s *BaseSuite) DebugDumpGatheringInvoice(h string, i billing.GatheringInvoice)

func (*BaseSuite) DebugDumpInvoice

func (s *BaseSuite) DebugDumpInvoice(h string, i billing.GenericInvoiceReader)

func (*BaseSuite) DebugDumpStandardInvoice

func (s *BaseSuite) DebugDumpStandardInvoice(h string, i billing.StandardInvoice)

func (*BaseSuite) GetSubscriptionMixInDependencies

func (b *BaseSuite) GetSubscriptionMixInDependencies() SubscriptionMixInDependencies

func (*BaseSuite) GetUniqueNamespace

func (s *BaseSuite) GetUniqueNamespace(prefix string) string

GetUniqueNamespace returns a unique namespace with the given prefix

func (*BaseSuite) InstallSandboxApp

func (s *BaseSuite) InstallSandboxApp(t *testing.T, ns string) app.App

func (*BaseSuite) ProvisionBillingProfile

func (s *BaseSuite) ProvisionBillingProfile(ctx context.Context, ns string, appID app.AppID, opts ...BillingProfileProvisionOption) *billing.Profile

func (*BaseSuite) ProvisionDefaultTaxCodes

func (s *BaseSuite) ProvisionDefaultTaxCodes(ctx context.Context, ns string) taxcode.OrganizationDefaultTaxCodes

ProvisionDefaultTaxCodes creates the invoicing and credit-grant tax codes for the namespace and stores them as the organization defaults. Tests that create charges via the real charges service must call this for the namespace, because charge creation auto-stamps the namespace's default tax code when the caller's TaxConfig has no TaxCodeID.

func (*BaseSuite) RequireTotals

func (s *BaseSuite) RequireTotals(expected ExpectedTotals, actual totals.Totals)

func (*BaseSuite) SetupApiRequestsTotalFeature

func (s *BaseSuite) SetupApiRequestsTotalFeature(ctx context.Context, ns string) TestFeature

func (*BaseSuite) SetupCustomInvoicing

func (s *BaseSuite) SetupCustomInvoicing(namespace string, opts ...setupCustomInvoicingOption) SetupCustomInvoicingResponse

func (*BaseSuite) SetupCustomInvoicingApp

func (s *BaseSuite) SetupCustomInvoicingApp() appcustominvoicing.Service

func (*BaseSuite) SetupSuite

func (s *BaseSuite) SetupSuite()

func (*BaseSuite) TearDownSuite

func (s *BaseSuite) TearDownSuite()

func (*BaseSuite) TearDownTest

func (s *BaseSuite) TearDownTest()

type BillingProfileEditFn

type BillingProfileEditFn func(p *billing.CreateProfileInput)

type BillingProfileProvisionOption

type BillingProfileProvisionOption func(*BillingProfileProvisionOptions)

func WithManualApproval

func WithManualApproval() BillingProfileProvisionOption

func WithProgressiveBilling

func WithProgressiveBilling() BillingProfileProvisionOption

type BillingProfileProvisionOptions

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

type DraftInvoiceInput

type DraftInvoiceInput struct {
	Namespace string
	Customer  *customer.Customer
}

func (DraftInvoiceInput) Validate

func (i DraftInvoiceInput) Validate() error

type ExpectedTotals

type ExpectedTotals struct {
	Amount              float64 `json:"amount"`
	ChargesTotal        float64 `json:"chargesTotal"`
	DiscountsTotal      float64 `json:"discountsTotal"`
	TaxesInclusiveTotal float64 `json:"taxesInclusiveTotal"`
	TaxesExclusiveTotal float64 `json:"taxesExclusiveTotal"`
	TaxesTotal          float64 `json:"taxesTotal"`
	Total               float64 `json:"total"`
	CreditsTotal        float64 `json:"creditsTotal"`
}

type SetupCustomInvoicingResponse

type SetupCustomInvoicingResponse struct {
	App app.App
}

type SetupSuiteOptions

type SetupSuiteOptions struct {
	ForceAtlas bool
}

type SubscriptionMixInDependencies

type SubscriptionMixInDependencies struct {
	DBClient *db.Client

	FeatureRepo     feature.FeatureRepo
	FeatureService  feature.FeatureConnector
	CustomerService customer.Service

	MeterAdapter           *meteradapter.TestAdapter
	MockStreamingConnector *streamingtestutils.MockStreamingConnector
}

func (SubscriptionMixInDependencies) Validate

func (d SubscriptionMixInDependencies) Validate() error

type SubscriptionMixin

type SubscriptionMixin struct {
	PlanService                 plan.Service
	SubscriptionService         subscription.Service
	SubscriptionAddonService    subscriptionaddon.Service
	SubscriptionPlanAdapter     subscriptiontestutils.PlanSubscriptionAdapter
	SubscriptionWorkflowService subscriptionworkflow.Service
	EntitlementConnector        entitlement.Service
}

func (*SubscriptionMixin) SetupEntitlements

func (*SubscriptionMixin) SetupSuite

func (s *SubscriptionMixin) SetupSuite(t *testing.T, deps SubscriptionMixInDependencies)

type TestFeature

type TestFeature struct {
	Cleanup func()
	Feature feature.Feature
}

Jump to

Keyboard shortcuts

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