credits

package
v1.0.0-beta.228 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseSuite

type BaseSuite struct {
	billingtest.BaseSuite

	Charges              charges.Service
	Ledger               ledger.Ledger
	BalanceQuerier       ledger.BalanceQuerier
	LedgerAccountService ledgeraccount.Service
	LedgerResolver       *ledgerresolvers.AccountResolver
	RevenueRecognizer    recognizer.Service
}

func (*BaseSuite) AssertLedgerSnapshotEqual

func (s *BaseSuite) AssertLedgerSnapshotEqual(expected, actual LedgerSnapshot)

func (*BaseSuite) AssertLedgerSnapshotUnchanged

func (s *BaseSuite) AssertLedgerSnapshotUnchanged(input LedgerSnapshotInput, expected LedgerSnapshot)

func (*BaseSuite) CreateCreditPurchaseIntent

func (s *BaseSuite) CreateCreditPurchaseIntent(input CreateCreditPurchaseIntentInput) charges.ChargeIntent

func (*BaseSuite) CreateLedgerBackedCustomer

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

func (*BaseSuite) CreateLedgerSnapshot

func (s *BaseSuite) CreateLedgerSnapshot(input LedgerSnapshotInput) LedgerSnapshot

func (*BaseSuite) CreateMockChargeIntent

func (s *BaseSuite) CreateMockChargeIntent(input CreateMockChargeIntentInput) charges.ChargeIntent

func (*BaseSuite) MustCustomerAccruedBalance

func (s *BaseSuite) MustCustomerAccruedBalance(customerID customer.CustomerID, code currencyx.Code, costBasis mo.Option[*alpacadecimal.Decimal]) alpacadecimal.Decimal

MustCustomerAccruedBalance returns customer accrued balance in a currency. Pass mo.None() for all cost bases, mo.Some(nil) for the explicit nil-cost-basis route, or mo.Some(&costBasis) for one concrete cost-basis route.

func (*BaseSuite) MustCustomerFBOBalance

func (s *BaseSuite) MustCustomerFBOBalance(customerID customer.CustomerID, code currencyx.Code, costBasis mo.Option[*alpacadecimal.Decimal]) alpacadecimal.Decimal

MustCustomerFBOBalance returns customer FBO balance in a currency. Pass mo.None() for all cost bases, mo.Some(nil) for the explicit nil-cost-basis route, or mo.Some(&costBasis) for one concrete cost-basis route.

func (*BaseSuite) MustCustomerFBOBalanceWithPriority

func (s *BaseSuite) MustCustomerFBOBalanceWithPriority(customerID customer.CustomerID, code currencyx.Code, costBasis mo.Option[*alpacadecimal.Decimal], priority int) alpacadecimal.Decimal

MustCustomerFBOBalanceWithPriority returns customer FBO balance in a currency filtered by a specific credit priority. Pass mo.None() for all cost bases, mo.Some(nil) for the explicit nil-cost-basis route, or mo.Some(&costBasis) for one concrete cost-basis route.

func (*BaseSuite) MustCustomerReceivableBalance

func (s *BaseSuite) MustCustomerReceivableBalance(customerID customer.CustomerID, code currencyx.Code, costBasis mo.Option[*alpacadecimal.Decimal], status ledger.TransactionAuthorizationStatus) alpacadecimal.Decimal

MustCustomerReceivableBalance returns customer receivable balance in a currency for one authorization state. Pass mo.None() for all cost bases, mo.Some(nil) for the explicit nil-cost-basis route, or mo.Some(&costBasis) for one concrete route.

func (*BaseSuite) MustEarningsBalance

func (s *BaseSuite) MustEarningsBalance(namespace string, code currencyx.Code) alpacadecimal.Decimal

func (*BaseSuite) MustEarningsBalanceForCostBasis

func (s *BaseSuite) MustEarningsBalanceForCostBasis(namespace string, code currencyx.Code, costBasis mo.Option[*alpacadecimal.Decimal]) alpacadecimal.Decimal

MustEarningsBalanceForCostBasis returns earnings balance in a currency. Pass mo.None() for all cost bases, mo.Some(nil) for the explicit nil-cost-basis route, or mo.Some(&costBasis) for one concrete cost-basis route.

func (*BaseSuite) MustGetChargeByID

func (s *BaseSuite) MustGetChargeByID(chargeID meta.ChargeID) charges.Charge

func (*BaseSuite) MustRecognizeRevenue

func (s *BaseSuite) MustRecognizeRevenue(customerID customer.CustomerID, code currencyx.Code, amount alpacadecimal.Decimal)

func (*BaseSuite) MustRefundCharge

func (s *BaseSuite) MustRefundCharge(ctx context.Context, customerID customer.CustomerID, chargeID meta.ChargeID)

MustRefundCharge deletes a charge through the real refund-as-credits patch flow.

func (*BaseSuite) MustWashBalance

func (s *BaseSuite) MustWashBalance(namespace string, code currencyx.Code, costBasis mo.Option[*alpacadecimal.Decimal]) alpacadecimal.Decimal

MustWashBalance returns aggregate wash balance in a currency. Pass mo.None() for all cost bases, mo.Some(nil) for the explicit nil-cost-basis route, or mo.Some(&costBasis) for one concrete cost-basis route.

func (*BaseSuite) SetupSuite

func (s *BaseSuite) SetupSuite()

func (*BaseSuite) TearDownTest

func (s *BaseSuite) TearDownTest()

type CreateCreditPurchaseIntentInput

type CreateCreditPurchaseIntentInput struct {
	Customer      customer.CustomerID
	Currency      currencyx.Code
	Amount        alpacadecimal.Decimal
	EffectiveAt   *time.Time
	Priority      *int
	ServicePeriod timeutil.ClosedPeriod
	Settlement    creditpurchase.Settlement
}

func (CreateCreditPurchaseIntentInput) Validate

type CreateMockChargeIntentInput

type CreateMockChargeIntentInput struct {
	Customer          customer.CustomerID
	Currency          currencyx.Code
	ServicePeriod     timeutil.ClosedPeriod
	Price             *productcatalog.Price
	FeatureKey        string
	Name              string
	SettlementMode    productcatalog.SettlementMode
	ManagedBy         billing.InvoiceLineManagedBy
	UniqueReferenceID string
	ProRating         productcatalog.ProRatingConfig
}

func (*CreateMockChargeIntentInput) Validate

func (i *CreateMockChargeIntentInput) Validate() error

type CreatePromotionalCreditFundingInput

type CreatePromotionalCreditFundingInput struct {
	Namespace string
	Customer  customer.CustomerID
	Amount    alpacadecimal.Decimal
	At        time.Time
	CostBasis alpacadecimal.Decimal
	Priority  *int
}

type CreatePromotionalCreditFundingResult

type CreatePromotionalCreditFundingResult struct {
	Charge         creditpurchase.Charge
	OpenReceivable alpacadecimal.Decimal
}

type LedgerSnapshot

type LedgerSnapshot struct {
	FBO                  alpacadecimal.Decimal
	OpenReceivable       alpacadecimal.Decimal
	AuthorizedReceivable alpacadecimal.Decimal
	Accrued              alpacadecimal.Decimal
	Wash                 alpacadecimal.Decimal
	Earnings             alpacadecimal.Decimal
}

type LedgerSnapshotInput

type LedgerSnapshotInput struct {
	Namespace string
	Customer  customer.CustomerID
	Currency  currencyx.Code
	CostBasis mo.Option[*alpacadecimal.Decimal]
}

Jump to

Keyboard shortcuts

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