Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type AccountSubType
- type AccountType
- type ExchangeTokenRequest
- type ExchangeTokenResponse
- type GetTransactionsArgs
- type Institution
- type LinkTokenRequest
- type LinkTokenResponse
- type MonoConfig
- type MonoProvider
- func (t *MonoProvider) CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
- func (t *MonoProvider) ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
- func (m *MonoProvider) GetAccount(ctx context.Context, accessToken, accountID string) (*Account, error)
- func (m *MonoProvider) GetAccountBalance(ctx context.Context, accessToken, accountID string) (*Account, error)
- func (m *MonoProvider) GetAccounts(ctx context.Context, accessToken string) ([]Account, error)
- func (m *MonoProvider) GetConnectionStatus(ctx context.Context, accessToken string) (bool, error)
- func (m *MonoProvider) GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
- func (m *MonoProvider) GetInstitutions(ctx context.Context) ([]Institution, error)
- func (m *MonoProvider) GetProviderName() string
- func (m *MonoProvider) GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
- func (m *MonoProvider) GetSupportedAccountTypes() []AccountType
- func (m *MonoProvider) GetSupportedCountries() []string
- func (m *MonoProvider) GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
- func (m *MonoProvider) RefreshConnection(ctx context.Context, accessToken string) error
- func (m *MonoProvider) RemoveConnection(ctx context.Context, accessToken string) error
- func (m *MonoProvider) SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
- type PlaidConfig
- type PlaidProvider
- func (p *PlaidProvider) CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
- func (p *PlaidProvider) ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
- func (p *PlaidProvider) GetAccount(ctx context.Context, accessToken, accountID string) (*Account, error)
- func (p *PlaidProvider) GetAccountBalance(ctx context.Context, accessToken, accountID string) (*Account, error)
- func (p *PlaidProvider) GetAccounts(ctx context.Context, accessToken string) ([]Account, error)
- func (p *PlaidProvider) GetConnectionStatus(ctx context.Context, accessToken string) (bool, error)
- func (p *PlaidProvider) GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
- func (p *PlaidProvider) GetInstitutions(ctx context.Context) ([]Institution, error)
- func (p *PlaidProvider) GetProviderName() string
- func (p *PlaidProvider) GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
- func (p *PlaidProvider) GetSupportedAccountTypes() []AccountType
- func (p *PlaidProvider) GetSupportedCountries() []string
- func (p *PlaidProvider) GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
- func (p *PlaidProvider) RefreshConnection(ctx context.Context, accessToken string) error
- func (p *PlaidProvider) RemoveConnection(ctx context.Context, accessToken string) error
- func (p *PlaidProvider) SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
- type Provider
- type ProviderManager
- type TellerConfig
- type TellerProvider
- func (t *TellerProvider) CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
- func (t *TellerProvider) ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
- func (t *TellerProvider) GetAccount(ctx context.Context, accessToken, accountID string) (*Account, error)
- func (t *TellerProvider) GetAccountBalance(ctx context.Context, accessToken, accountID string) (*Account, error)
- func (t *TellerProvider) GetAccountBalanceInternal(ctx context.Context, accessToken, accountID string) (*tellerBalance, error)
- func (t *TellerProvider) GetAccounts(ctx context.Context, accessToken string) ([]Account, error)
- func (t *TellerProvider) GetConnectionStatus(ctx context.Context, accessToken string) (bool, error)
- func (t *TellerProvider) GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
- func (t *TellerProvider) GetInstitutions(ctx context.Context) ([]Institution, error)
- func (t *TellerProvider) GetProviderName() string
- func (t *TellerProvider) GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
- func (t *TellerProvider) GetSupportedAccountTypes() []AccountType
- func (t *TellerProvider) GetSupportedCountries() []string
- func (t *TellerProvider) GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
- func (t *TellerProvider) RefreshConnection(ctx context.Context, accessToken string) error
- func (t *TellerProvider) RemoveConnection(ctx context.Context, accessToken string) error
- func (t *TellerProvider) SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
- type Transaction
Constants ¶
const MonoBaseURL = "https://api.withmono.com/v2"
Variables ¶
var ( ErrProviderNotSupported = errors.New("financial provider not supported") ErrAccountNotFound = errors.New("account not found") ErrInsufficientData = errors.New("insufficient account data from provider") ErrAuthenticationFailed = errors.New("authentication with provider failed") ErrRateLimitExceeded = errors.New("rate limit exceeded") )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID string `json:"id"`
Name string `json:"name"`
Type AccountType `json:"type"`
Balance float64 `json:"balance"`
AvailableBalance *float64 `json:"available_balance,omitempty"`
Currency string `json:"currency"`
AccountNumber *string `json:"account_number,omitempty"`
RoutingNumber *string `json:"routing_number,omitempty"`
InstitutionName string `json:"institution_name"`
InstitutionID string `json:"institution_id"`
LastUpdated time.Time `json:"last_updated"`
IsActive bool `json:"is_active"`
ProviderAccountID string `json:"provider_account_id"`
EnrollmentID *string `json:"enrollment_id,omitempty"`
Status *string `json:"status,omitempty"`
Subtype *AccountSubType `json:"subtype,omitempty"`
ResourceID *string `json:"resource_id,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
Account represents a standardized account structure
type AccountSubType ¶
type AccountSubType string
AccountType represents standardized account types across all providers
const ( AccountTypeChecking AccountSubType = "checking" AccountSTypeLoan AccountSubType = "Loan" AccountSTypeInvestment AccountSubType = "Investment" AccountTypeSavings AccountSubType = "savings" AccountTypeBrokerage AccountSubType = "Brokerage" AccountType401K AccountSubType = "401K" AccountTypeCards AccountSubType = "Credit Card" )
type AccountType ¶
type AccountType string
AccountType represents standardized account types across all providers
const ( AccountTypeCash AccountType = "cash" AccountTypeCredit AccountType = "credit" AccountTypeInvestment AccountType = "investment" AccountTypeLoan AccountType = "loan" AccountTypeOther AccountType = "other" )
type ExchangeTokenRequest ¶
type ExchangeTokenRequest struct {
PublicToken string `json:"public_token"`
UserID string `json:"user_id"`
}
ExchangeTokenRequest represents the request to exchange a public token
type ExchangeTokenResponse ¶
type ExchangeTokenResponse struct {
AccessToken string `json:"access_token"`
ItemID string `json:"item_id,omitempty"`
}
ExchangeTokenResponse represents the response from exchanging a token
type GetTransactionsArgs ¶
type Institution ¶
type Institution struct {
ID string `json:"id"`
Name string `json:"name"`
Logo string `json:"logo,omitempty"`
Website string `json:"website,omitempty"`
Primary string `json:"primary_color,omitempty"`
Provider string `json:"provider"`
}
Institution represents a financial institution
type LinkTokenRequest ¶
type LinkTokenRequest struct {
UserID string `json:"user_id"`
Products []string `json:"products,omitempty"`
CountryCodes []string `json:"country_codes,omitempty"`
RedirectURI string `json:"redirect_uri,omitempty"`
}
LinkTokenRequest represents the request to create a link token
type LinkTokenResponse ¶
type LinkTokenResponse struct {
LinkToken string `json:"link_token"`
ExpiresAt time.Time `json:"expires_at"`
}
LinkTokenResponse represents the response from creating a link token
type MonoConfig ¶
type MonoProvider ¶
type MonoProvider struct {
// contains filtered or unexported fields
}
func NewMonoProvider ¶
func NewMonoProvider(security_key string, logger *zerolog.Logger) (*MonoProvider, error)
func (*MonoProvider) CreateLinkToken ¶
func (t *MonoProvider) CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
IGNORE (Handled by connect)
func (*MonoProvider) ExchangePublicToken ¶
func (t *MonoProvider) ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
TODO: Make the itemID optional
func (*MonoProvider) GetAccount ¶
func (*MonoProvider) GetAccountBalance ¶
func (*MonoProvider) GetAccounts ¶
We don't have the multiple thing with mono
func (*MonoProvider) GetConnectionStatus ¶
func (*MonoProvider) GetInstitution ¶
func (m *MonoProvider) GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
IGNORE (Mono doesn't provide a general institutions endpoint) (might need static list)
func (*MonoProvider) GetInstitutions ¶
func (m *MonoProvider) GetInstitutions(ctx context.Context) ([]Institution, error)
IGNORE (Mono doesn't provide a general institutions endpoint) (might need static list)
func (*MonoProvider) GetProviderName ¶
func (m *MonoProvider) GetProviderName() string
func (*MonoProvider) GetRecentTransactions ¶
func (m *MonoProvider) GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
func (*MonoProvider) GetSupportedAccountTypes ¶
func (m *MonoProvider) GetSupportedAccountTypes() []AccountType
func (*MonoProvider) GetSupportedCountries ¶
func (m *MonoProvider) GetSupportedCountries() []string
func (*MonoProvider) GetTransactions ¶
func (m *MonoProvider) GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
func (*MonoProvider) RefreshConnection ¶
func (m *MonoProvider) RefreshConnection(ctx context.Context, accessToken string) error
func (*MonoProvider) RemoveConnection ¶
func (m *MonoProvider) RemoveConnection(ctx context.Context, accessToken string) error
func (*MonoProvider) SearchInstitutions ¶
func (m *MonoProvider) SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
IGNORE (Mono doesn't provide a general institutions endpoint) (might need static list)
type PlaidConfig ¶
type PlaidConfig struct {
ClientID string `json:"client_id"`
Secret string `json:"secret"`
Environment string `json:"environment"` // sandbox, development, production
BaseURL string `json:"base_url"`
}
Configuration structures for each provider
type PlaidProvider ¶
type PlaidProvider struct {
// contains filtered or unexported fields
}
func NewPlaidProvider ¶
func NewPlaidProvider(config PlaidConfig, logger *zerolog.Logger) (*PlaidProvider, error)
func (*PlaidProvider) CreateLinkToken ¶
func (p *PlaidProvider) CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
Implement other Provider interface methods for PlaidProvider...
func (*PlaidProvider) ExchangePublicToken ¶
func (p *PlaidProvider) ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
func (*PlaidProvider) GetAccount ¶
func (*PlaidProvider) GetAccountBalance ¶
func (*PlaidProvider) GetAccounts ¶
func (*PlaidProvider) GetConnectionStatus ¶
func (*PlaidProvider) GetInstitution ¶
func (p *PlaidProvider) GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
func (*PlaidProvider) GetInstitutions ¶
func (p *PlaidProvider) GetInstitutions(ctx context.Context) ([]Institution, error)
func (*PlaidProvider) GetProviderName ¶
func (p *PlaidProvider) GetProviderName() string
func (*PlaidProvider) GetRecentTransactions ¶
func (p *PlaidProvider) GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
func (*PlaidProvider) GetSupportedAccountTypes ¶
func (p *PlaidProvider) GetSupportedAccountTypes() []AccountType
func (*PlaidProvider) GetSupportedCountries ¶
func (p *PlaidProvider) GetSupportedCountries() []string
func (*PlaidProvider) GetTransactions ¶
func (p *PlaidProvider) GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
func (*PlaidProvider) RefreshConnection ¶
func (p *PlaidProvider) RefreshConnection(ctx context.Context, accessToken string) error
func (*PlaidProvider) RemoveConnection ¶
func (p *PlaidProvider) RemoveConnection(ctx context.Context, accessToken string) error
func (*PlaidProvider) SearchInstitutions ¶
func (p *PlaidProvider) SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
type Provider ¶
type Provider interface {
// Authentication & Setup
CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
// Account Operations
GetAccounts(ctx context.Context, accessToken string) ([]Account, error)
GetAccount(ctx context.Context, accessToken, accountID string) (*Account, error)
GetAccountBalance(ctx context.Context, accessToken, accountID string) (*Account, error)
// Transaction Operations
GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
// Institution Operations
GetInstitutions(ctx context.Context) ([]Institution, error)
GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
// Connection Management
GetConnectionStatus(ctx context.Context, accessToken string) (bool, error)
RefreshConnection(ctx context.Context, accessToken string) error
RemoveConnection(ctx context.Context, accessToken string) error
// Provider Info
GetProviderName() string
GetSupportedCountries() []string
GetSupportedAccountTypes() []AccountType
}
Provider defines the interface for financial data providers
type ProviderManager ¶
type ProviderManager struct {
// contains filtered or unexported fields
}
ProviderManager manages multiple financial providers
func NewProviderManager ¶
func NewProviderManager(cfg config.Integrations, logger *zerolog.Logger) (*ProviderManager, error)
NewProviderManager creates a new provider manager
func (*ProviderManager) GetAllAccounts ¶
func (pm *ProviderManager) GetAllAccounts(ctx context.Context, userAccessTokens map[string]string) (map[string][]Account, error)
GetAllAccounts retrieves accounts from all providers for a user
func (*ProviderManager) GetAvailableProviders ¶
func (pm *ProviderManager) GetAvailableProviders() []string
GetAvailableProviders returns all available provider names
func (*ProviderManager) GetProvider ¶
func (pm *ProviderManager) GetProvider(name string) (Provider, error)
GetProvider returns a specific provider by name
type TellerConfig ¶
type TellerProvider ¶
type TellerProvider struct {
// contains filtered or unexported fields
}
TellerProvider implements the Provider interface for Teller
func NewTellerProvider ¶
func NewTellerProvider(config TellerConfig, logger *zerolog.Logger) (*TellerProvider, error)
func (*TellerProvider) CreateLinkToken ¶
func (t *TellerProvider) CreateLinkToken(ctx context.Context, req LinkTokenRequest) (*LinkTokenResponse, error)
IGNORE
func (*TellerProvider) ExchangePublicToken ¶
func (t *TellerProvider) ExchangePublicToken(ctx context.Context, req ExchangeTokenRequest) (*ExchangeTokenResponse, error)
IGNORE
func (*TellerProvider) GetAccount ¶
func (*TellerProvider) GetAccountBalance ¶
func (*TellerProvider) GetAccountBalanceInternal ¶
func (t *TellerProvider) GetAccountBalanceInternal(ctx context.Context, accessToken, accountID string) (*tellerBalance, error)
func (*TellerProvider) GetAccounts ¶
func (*TellerProvider) GetConnectionStatus ¶
GetConnectionStatus checks if the connection is still valid
func (*TellerProvider) GetInstitution ¶
func (t *TellerProvider) GetInstitution(ctx context.Context, institutionID string) (*Institution, error)
IGNORE
func (*TellerProvider) GetInstitutions ¶
func (t *TellerProvider) GetInstitutions(ctx context.Context) ([]Institution, error)
GetInstitutions retrieves all supported institutions
func (*TellerProvider) GetProviderName ¶
func (t *TellerProvider) GetProviderName() string
GetProviderName returns the provider name
func (*TellerProvider) GetRecentTransactions ¶
func (t *TellerProvider) GetRecentTransactions(ctx context.Context, accessToken, accountID string, count int) ([]Transaction, error)
IGNORE
func (*TellerProvider) GetSupportedAccountTypes ¶
func (t *TellerProvider) GetSupportedAccountTypes() []AccountType
GetSupportedAccountTypes returns supported account types
func (*TellerProvider) GetSupportedCountries ¶
func (t *TellerProvider) GetSupportedCountries() []string
GetSupportedCountries returns supported countries
func (*TellerProvider) GetTransactions ¶
func (t *TellerProvider) GetTransactions(ctx context.Context, accessToken, accountID string, args GetTransactionsArgs) ([]Transaction, error)
GetTransactions retrieves transactions for an account within a date range
func (*TellerProvider) RefreshConnection ¶
func (t *TellerProvider) RefreshConnection(ctx context.Context, accessToken string) error
IGNORE (Teller connections don't typically need manual refresh)
func (*TellerProvider) RemoveConnection ¶
func (t *TellerProvider) RemoveConnection(ctx context.Context, accessToken string) error
RemoveConnection removes/disconnects the account connection (TODO: Adapt this to teller (add account_id))
func (*TellerProvider) SearchInstitutions ¶
func (t *TellerProvider) SearchInstitutions(ctx context.Context, query string) ([]Institution, error)
IGNORE
type Transaction ¶
type Transaction struct {
ID string `json:"id"`
AccountID string `json:"account_id"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Description string `json:"description"`
Category *string `json:"category,omitempty"`
Date time.Time `json:"date"`
MerchantName *string `json:"merchant_name,omitempty"`
Type string `json:"type"` // debit, credit
Status string `json:"status"` // pending, posted
ProviderTransactionID string `json:"provider_transaction_id"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Transaction represents a standardized transaction structure