Documentation
¶
Index ¶
- Constants
- type BaseSuite
- func (s *BaseSuite) AssertLedgerSnapshotEqual(expected, actual LedgerSnapshot)
- func (s *BaseSuite) AssertLedgerSnapshotUnchanged(input LedgerSnapshotInput, expected LedgerSnapshot)
- func (s *BaseSuite) CreateCreditPurchaseIntent(input CreateCreditPurchaseIntentInput) charges.ChargeIntent
- func (s *BaseSuite) CreateLedgerBackedCustomer(ns string, subjectKey string) *customer.Customer
- func (s *BaseSuite) CreateLedgerSnapshot(input LedgerSnapshotInput) LedgerSnapshot
- func (s *BaseSuite) CreateMockChargeIntent(input CreateMockChargeIntentInput) charges.ChargeIntent
- func (s *BaseSuite) CreatePromotionalCreditFunding(ctx context.Context, input CreatePromotionalCreditFundingInput) CreatePromotionalCreditFundingResult
- func (s *BaseSuite) MustCustomerAccruedBalance(customerID customer.CustomerID, code currencyx.Code, ...) alpacadecimal.Decimal
- func (s *BaseSuite) MustCustomerFBOBalance(customerID customer.CustomerID, code currencyx.Code, ...) alpacadecimal.Decimal
- func (s *BaseSuite) MustCustomerFBOBalanceWithPriority(customerID customer.CustomerID, code currencyx.Code, ...) alpacadecimal.Decimal
- func (s *BaseSuite) MustCustomerReceivableBalance(customerID customer.CustomerID, code currencyx.Code, ...) alpacadecimal.Decimal
- func (s *BaseSuite) MustEarningsBalance(namespace string, code currencyx.Code) alpacadecimal.Decimal
- func (s *BaseSuite) MustEarningsBalanceForCostBasis(namespace string, code currencyx.Code, ...) alpacadecimal.Decimal
- func (s *BaseSuite) MustGetChargeByID(chargeID meta.ChargeID) charges.Charge
- func (s *BaseSuite) MustRecognizeRevenue(customerID customer.CustomerID, code currencyx.Code, ...)
- func (s *BaseSuite) MustRefundCharge(ctx context.Context, customerID customer.CustomerID, chargeID meta.ChargeID)
- func (s *BaseSuite) MustWashBalance(namespace string, code currencyx.Code, ...) alpacadecimal.Decimal
- func (s *BaseSuite) SetupSuite()
- func (s *BaseSuite) TearDownTest()
- type CreateCreditPurchaseIntentInput
- type CreateMockChargeIntentInput
- type CreatePromotionalCreditFundingInput
- type CreatePromotionalCreditFundingResult
- type LedgerSnapshot
- type LedgerSnapshotInput
Constants ¶
const USD = currencyx.Code(currency.USD)
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 (*BaseSuite) CreateLedgerSnapshot ¶
func (s *BaseSuite) CreateLedgerSnapshot(input LedgerSnapshotInput) LedgerSnapshot
func (*BaseSuite) CreateMockChargeIntent ¶
func (s *BaseSuite) CreateMockChargeIntent(input CreateMockChargeIntentInput) charges.ChargeIntent
func (*BaseSuite) CreatePromotionalCreditFunding ¶
func (s *BaseSuite) CreatePromotionalCreditFunding(ctx context.Context, input CreatePromotionalCreditFundingInput) CreatePromotionalCreditFundingResult
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 (*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 (*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 ¶
func (i CreateCreditPurchaseIntentInput) Validate() error
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]
}