Documentation
¶
Index ¶
- Constants
- Variables
- func NewNamespaceHandler(provisioner businessAccountProvisioner) namespace.Handler
- type AccountResolver
- func (s *AccountResolver) CreateCustomerAccounts(ctx context.Context, customerID customer.CustomerID) (ledger.CustomerAccounts, error)
- func (s *AccountResolver) EnsureBusinessAccounts(ctx context.Context, namespace string) (ledger.BusinessAccounts, error)
- func (s *AccountResolver) GetBusinessAccounts(ctx context.Context, namespace string) (ledger.BusinessAccounts, error)
- func (s *AccountResolver) GetCustomerAccounts(ctx context.Context, customerID customer.CustomerID) (ledger.CustomerAccounts, error)
- type AccountResolverConfig
- type CreateCustomerAccountInput
- type CustomerAccountAlreadyExistsError
- type CustomerAccountRepo
- type CustomerLedgerHook
- type CustomerLedgerHookConfig
- type NoopCustomerLedgerHook
Constants ¶
View Source
const ErrCodeCustomerAccountConflict models.ErrorCode = "customer_account_conflict"
Variables ¶
View Source
var ErrCustomerAccountConflict = models.NewValidationIssue( ErrCodeCustomerAccountConflict, "customer account mapping conflict, a mapping with the same customer and account type already exists", commonhttp.WithHTTPStatusCodeAttribute(http.StatusConflict), )
Functions ¶
func NewNamespaceHandler ¶
Types ¶
type AccountResolver ¶
type AccountResolver struct {
AccountService ledgeraccount.Service
Repo CustomerAccountRepo
Locker *lockr.Locker
}
AccountResolver implements ledger.AccountResolver and manages customer ledger account provisioning.
func NewAccountResolver ¶
func NewAccountResolver(cfg AccountResolverConfig) *AccountResolver
NewAccountResolver constructs a resolvers Service from the given config.
func (*AccountResolver) CreateCustomerAccounts ¶
func (s *AccountResolver) CreateCustomerAccounts(ctx context.Context, customerID customer.CustomerID) (ledger.CustomerAccounts, error)
CreateCustomerAccounts creates FBO and Receivable ledger accounts for a new customer and stores the mappings in the linking table.
func (*AccountResolver) EnsureBusinessAccounts ¶
func (s *AccountResolver) EnsureBusinessAccounts(ctx context.Context, namespace string) (ledger.BusinessAccounts, error)
func (*AccountResolver) GetBusinessAccounts ¶
func (s *AccountResolver) GetBusinessAccounts(ctx context.Context, namespace string) (ledger.BusinessAccounts, error)
GetBusinessAccounts retrieves the shared business accounts for a namespace.
func (*AccountResolver) GetCustomerAccounts ¶
func (s *AccountResolver) GetCustomerAccounts(ctx context.Context, customerID customer.CustomerID) (ledger.CustomerAccounts, error)
GetCustomerAccounts retrieves the FBO and Receivable accounts for a customer.
type AccountResolverConfig ¶
type AccountResolverConfig struct {
AccountService ledgeraccount.Service
Repo CustomerAccountRepo
Locker *lockr.Locker
}
AccountResolverConfig holds the dependencies for constructing a Service.
type CreateCustomerAccountInput ¶
type CreateCustomerAccountInput struct {
CustomerID customer.CustomerID
AccountType ledger.AccountType
AccountID string
}
type CustomerAccountAlreadyExistsError ¶
type CustomerAccountAlreadyExistsError struct {
CustomerID customer.CustomerID
AccountType ledger.AccountType
AccountID string
}
func AsCustomerAccountAlreadyExistsError ¶
func AsCustomerAccountAlreadyExistsError(err error) (*CustomerAccountAlreadyExistsError, bool)
func (*CustomerAccountAlreadyExistsError) Error ¶
func (e *CustomerAccountAlreadyExistsError) Error() string
func (*CustomerAccountAlreadyExistsError) ValidationErrors ¶
func (e *CustomerAccountAlreadyExistsError) ValidationErrors() (models.ValidationIssues, error)
type CustomerAccountRepo ¶
type CustomerAccountRepo interface {
entutils.TxCreator
CreateCustomerAccount(ctx context.Context, input CreateCustomerAccountInput) error
GetCustomerAccountIDs(ctx context.Context, customerID customer.CustomerID) (map[ledger.AccountType]string, error)
}
CustomerAccountRepo manages the linking table that maps customers to their ledger accounts.
type CustomerLedgerHook ¶
type CustomerLedgerHook = models.ServiceHook[customer.Customer]
TODO: these hooks should be added to customer lifecycle
func NewCustomerLedgerHook ¶
func NewCustomerLedgerHook(config CustomerLedgerHookConfig) (CustomerLedgerHook, error)
type NoopCustomerLedgerHook ¶
type NoopCustomerLedgerHook = models.NoopServiceHook[customer.Customer]
Click to show internal directories.
Click to hide internal directories.