Documentation
¶
Index ¶
- Variables
- type AllowedAccountSetsRule
- type EntryView
- type FuncRule
- type RequireAccountAuthorizationStatusRule
- type RequireAccruedCostBasisTranslationRule
- type RequireFBOCostBasisTranslationRule
- type RequireFlowDirectionRule
- type RequireReceivableAuthorizationStageRule
- type RequireSameRouteRule
- type RequireUniqueSubAccountsRule
- type RouteField
- type RoutingRule
- type TxView
- func (t TxView) AccountTypes() []ledger.AccountType
- func (t TxView) Entries() []EntryView
- func (t TxView) EntriesOf(accountType ledger.AccountType) []EntryView
- func (t TxView) HasAccountType(accountType ledger.AccountType) bool
- func (t TxView) HasAccountTypes(accountTypes ...ledger.AccountType) bool
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultValidator = Validator{ Rules: []RoutingRule{ RequireUniqueSubAccountsRule{}, AllowedAccountSetsRule{ Sets: [][]ledger.AccountType{ {ledger.AccountTypeCustomerFBO, ledger.AccountTypeCustomerReceivable}, {ledger.AccountTypeCustomerReceivable}, {ledger.AccountTypeCustomerFBO}, {ledger.AccountTypeCustomerAccrued}, {ledger.AccountTypeCustomerFBO, ledger.AccountTypeCustomerAccrued}, {ledger.AccountTypeCustomerReceivable, ledger.AccountTypeCustomerAccrued}, {ledger.AccountTypeCustomerReceivable, ledger.AccountTypeWash}, {ledger.AccountTypeCustomerAccrued, ledger.AccountTypeEarnings}, {ledger.AccountTypeCustomerFBO, ledger.AccountTypeBrokerage}, }, }, RequireFlowDirectionRule{ From: ledger.AccountTypeCustomerFBO, To: ledger.AccountTypeCustomerAccrued, }, RequireFlowDirectionRule{ From: ledger.AccountTypeCustomerReceivable, To: ledger.AccountTypeCustomerAccrued, }, RequireFlowDirectionRule{ From: ledger.AccountTypeCustomerAccrued, To: ledger.AccountTypeEarnings, }, RequireFlowDirectionRule{ From: ledger.AccountTypeWash, To: ledger.AccountTypeCustomerReceivable, }, RequireAccountAuthorizationStatusRule{ WhenHasAccountTypes: []ledger.AccountType{ ledger.AccountTypeWash, ledger.AccountTypeCustomerReceivable, }, AccountType: ledger.AccountTypeCustomerReceivable, Expected: ledger.TransactionAuthorizationStatusAuthorized, }, RequireReceivableAuthorizationStageRule{}, RequireFBOCostBasisTranslationRule{}, RequireAccruedCostBasisTranslationRule{}, RequireSameRouteRule{ Left: ledger.AccountTypeCustomerFBO, Right: ledger.AccountTypeCustomerReceivable, Fields: []RouteField{ RouteFieldCurrency, RouteFieldTaxCode, RouteFieldFeatures, RouteFieldCostBasis, }, }, RequireSameRouteRule{ Left: ledger.AccountTypeCustomerFBO, Right: ledger.AccountTypeCustomerAccrued, Fields: []RouteField{ RouteFieldCurrency, RouteFieldCostBasis, }, }, RequireSameRouteRule{ Left: ledger.AccountTypeCustomerReceivable, Right: ledger.AccountTypeCustomerAccrued, Fields: []RouteField{ RouteFieldCurrency, RouteFieldCostBasis, }, }, RequireSameRouteRule{ Left: ledger.AccountTypeCustomerAccrued, Right: ledger.AccountTypeEarnings, Fields: []RouteField{ RouteFieldCurrency, RouteFieldCostBasis, }, }, RequireSameRouteRule{ Left: ledger.AccountTypeCustomerReceivable, Right: ledger.AccountTypeWash, Fields: []RouteField{ RouteFieldCurrency, RouteFieldCostBasis, }, }, }, }
Functions ¶
This section is empty.
Types ¶
type AllowedAccountSetsRule ¶
type AllowedAccountSetsRule struct {
Sets [][]ledger.AccountType
}
func (AllowedAccountSetsRule) Validate ¶
func (r AllowedAccountSetsRule) Validate(tx TxView) error
type EntryView ¶
type EntryView struct {
// contains filtered or unexported fields
}
func (EntryView) AccountType ¶
func (e EntryView) AccountType() ledger.AccountType
func (EntryView) Amount ¶
func (e EntryView) Amount() alpacadecimal.Decimal
func (EntryView) Entry ¶
func (e EntryView) Entry() ledger.EntryInput
type RequireAccountAuthorizationStatusRule ¶
type RequireAccountAuthorizationStatusRule struct {
WhenHasAccountTypes []ledger.AccountType
AccountType ledger.AccountType
Expected ledger.TransactionAuthorizationStatus
}
func (RequireAccountAuthorizationStatusRule) Validate ¶
func (r RequireAccountAuthorizationStatusRule) Validate(tx TxView) error
type RequireAccruedCostBasisTranslationRule ¶
type RequireAccruedCostBasisTranslationRule struct{}
func (RequireAccruedCostBasisTranslationRule) Validate ¶
func (r RequireAccruedCostBasisTranslationRule) Validate(tx TxView) error
type RequireFBOCostBasisTranslationRule ¶
type RequireFBOCostBasisTranslationRule struct{}
func (RequireFBOCostBasisTranslationRule) Validate ¶
func (r RequireFBOCostBasisTranslationRule) Validate(tx TxView) error
type RequireFlowDirectionRule ¶
type RequireFlowDirectionRule struct {
From ledger.AccountType
To ledger.AccountType
}
func (RequireFlowDirectionRule) Validate ¶
func (r RequireFlowDirectionRule) Validate(tx TxView) error
type RequireReceivableAuthorizationStageRule ¶
type RequireReceivableAuthorizationStageRule struct{}
func (RequireReceivableAuthorizationStageRule) Validate ¶
func (r RequireReceivableAuthorizationStageRule) Validate(tx TxView) error
type RequireSameRouteRule ¶
type RequireSameRouteRule struct {
Left ledger.AccountType
Right ledger.AccountType
Fields []RouteField
}
func (RequireSameRouteRule) Validate ¶
func (r RequireSameRouteRule) Validate(tx TxView) error
type RequireUniqueSubAccountsRule ¶
type RequireUniqueSubAccountsRule struct{}
func (RequireUniqueSubAccountsRule) Validate ¶
func (r RequireUniqueSubAccountsRule) Validate(tx TxView) error
type RouteField ¶
type RouteField string
const ( RouteFieldCurrency RouteField = "currency" RouteFieldTaxCode RouteField = "tax_code" RouteFieldFeatures RouteField = "features" RouteFieldCostBasis RouteField = "cost_basis" RouteFieldCreditPriority RouteField = "credit_priority" RouteFieldTransactionAuthorizationStatus RouteField = "transaction_authorization_status" )
type RoutingRule ¶
type TxView ¶
type TxView struct {
// contains filtered or unexported fields
}
func (TxView) AccountTypes ¶
func (t TxView) AccountTypes() []ledger.AccountType
func (TxView) HasAccountType ¶
func (t TxView) HasAccountType(accountType ledger.AccountType) bool
func (TxView) HasAccountTypes ¶
func (t TxView) HasAccountTypes(accountTypes ...ledger.AccountType) bool
type Validator ¶
type Validator struct {
Rules []RoutingRule
}
func (Validator) ValidateEntries ¶
func (v Validator) ValidateEntries(entries []ledger.EntryInput) error
Click to show internal directories.
Click to hide internal directories.