Documentation
¶
Index ¶
- func AssertTotals(t *testing.T, expected ExpectedTotals, actual totals.Totals)
- func ExpectJSONEqual(t *testing.T, exp, actual any)
- func WithCustomInvoicingConfig(config appcustominvoicing.Configuration) setupCustomInvoicingOption
- type BaseSuite
- func (s *BaseSuite) AssertDecimalEqual(expected, actual alpacadecimal.Decimal, label string)
- func (s *BaseSuite) AssertTotals(expected ExpectedTotals, actual totals.Totals)
- func (s *BaseSuite) CreateDraftInvoice(t *testing.T, ctx context.Context, in DraftInvoiceInput) billing.StandardInvoice
- func (s *BaseSuite) CreateGatheringInvoice(t *testing.T, ctx context.Context, in DraftInvoiceInput)
- func (s *BaseSuite) CreateTestCustomer(ns string, subjectKey string) *customer.Customer
- func (s *BaseSuite) DebugDumpGatheringInvoice(h string, i billing.GatheringInvoice)
- func (s *BaseSuite) DebugDumpInvoice(h string, i billing.GenericInvoiceReader)
- func (s *BaseSuite) DebugDumpStandardInvoice(h string, i billing.StandardInvoice)
- func (b *BaseSuite) GetSubscriptionMixInDependencies() SubscriptionMixInDependencies
- func (s *BaseSuite) GetUniqueNamespace(prefix string) string
- func (s *BaseSuite) InstallSandboxApp(t *testing.T, ns string) app.App
- func (s *BaseSuite) ProvisionBillingProfile(ctx context.Context, ns string, appID app.AppID, ...) *billing.Profile
- func (s *BaseSuite) ProvisionDefaultTaxCodes(ctx context.Context, ns string) taxcode.OrganizationDefaultTaxCodes
- func (s *BaseSuite) ProvisionProviderDefaultTaxCode(ctx context.Context, ns string) taxcode.TaxCode
- func (s *BaseSuite) RequireTotals(expected ExpectedTotals, actual totals.Totals)
- func (s *BaseSuite) SeedProfileDefaultTaxConfigViaAdapter(ctx context.Context, profileID billing.ProfileID, ...) *billing.AdapterGetProfileResponse
- func (s *BaseSuite) SetupApiRequestsTotalFeature(ctx context.Context, ns string) TestFeature
- func (s *BaseSuite) SetupCustomInvoicing(namespace string, opts ...setupCustomInvoicingOption) SetupCustomInvoicingResponse
- func (s *BaseSuite) SetupCustomInvoicingApp() appcustominvoicing.Service
- func (s *BaseSuite) SetupSuite()
- func (s *BaseSuite) TearDownSuite()
- func (s *BaseSuite) TearDownTest()
- type BillingProfileEditFn
- type BillingProfileProvisionOption
- type BillingProfileProvisionOptions
- type DraftInvoiceInput
- type ExpectedTotals
- type SetupCustomInvoicingResponse
- type SetupSuiteOptions
- type SubscriptionMixInDependencies
- type SubscriptionMixin
- type TestFeature
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 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
SequenceService billingsequence.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 (*BaseSuite) CreateTestCustomer ¶
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 ¶
GetUniqueNamespace returns a unique namespace with the given prefix
func (*BaseSuite) InstallSandboxApp ¶
func (*BaseSuite) ProvisionBillingProfile ¶
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) ProvisionProviderDefaultTaxCode ¶
ProvisionProviderDefaultTaxCode creates the tax code used when an invoicing app omits an app-specific provider code. This is distinct from organization default tax-code settings: API invoice edit diffing needs the provider-default tax code row to resolve empty provider tax config, but it must not imply that the namespace has configured org-level default tax codes.
func (*BaseSuite) RequireTotals ¶
func (s *BaseSuite) RequireTotals(expected ExpectedTotals, actual totals.Totals)
func (*BaseSuite) SeedProfileDefaultTaxConfigViaAdapter ¶
func (s *BaseSuite) SeedProfileDefaultTaxConfigViaAdapter(ctx context.Context, profileID billing.ProfileID, taxConfig *productcatalog.TaxConfig) *billing.AdapterGetProfileResponse
SeedProfileDefaultTaxConfigViaAdapter seeds a stored DefaultTaxConfig on an existing billing profile directly through the billing adapter, bypassing the service-level tax code deprecation gate (InvoicingConfig.EnforceTaxCodeDeprecation). This simulates legacy rows that were created before tax codes on billing profiles were deprecated.
The tax config is resolved in place exactly like the pre-deprecation service path (productcatalog.ResolveTaxConfig cross-populates TaxCodeID and Stripe.Code), then persisted via the adapter so the JSON column, tax_code_id FK and tax_behavior columns are written by the production adapter code path. Returns the re-read profile so tests can assert on the stored state including read-time backfill.
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 WithBillingProfileEditFn ¶
func WithBillingProfileEditFn(editFn BillingProfileEditFn) BillingProfileProvisionOption
func WithCollectionInterval ¶
func WithCollectionInterval(period datetime.ISODuration) BillingProfileProvisionOption
func WithManualApproval ¶
func WithManualApproval() BillingProfileProvisionOption
func WithProgressiveBilling ¶
func WithProgressiveBilling() BillingProfileProvisionOption
type BillingProfileProvisionOptions ¶
type BillingProfileProvisionOptions struct {
// contains filtered or unexported fields
}
type DraftInvoiceInput ¶
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 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 (s *SubscriptionMixin) SetupEntitlements(t *testing.T, deps SubscriptionMixInDependencies) entitlement.Service
func (*SubscriptionMixin) SetupSuite ¶
func (s *SubscriptionMixin) SetupSuite(t *testing.T, deps SubscriptionMixInDependencies)