blnk

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 35 Imported by: 0

README

Build and Test Status

Status at a Glance

Build and Test Status Deploy to Docker Status Linter Status Contributor Covenant

Welcome to Blnk

Welcome to Blnk — an open-source ledger designed for the modern developer. It enables developers to build and manage complex financial transaction records and money movement.

Every financial product is made up of different transactions happening concurrently moving from one location to another. Some transactions will interact with external parties like cards, payouts, deposits, etc. Others will interact within your organization like moving money between user accounts or to/fro your organization accounts.

Blnk gives you, the developer, a starting point to improve how you build, operate and perfectly manage money movement and storage in a reliable, scaleable and secure way.

Get Started and Core Features

Documentation

Index

Constants

View Source
const (
	StatusQueued    = "QUEUED"
	StatusApplied   = "APPLIED"
	StatusScheduled = "SCHEDULED"
	StatusInflight  = "INFLIGHT"
	StatusVoid      = "VOID"
)
View Source
const (
	GeneralLedgerID = "general_ledger_id"
)
View Source
const NumberOfQueues = 5
View Source
const TRANSACTION_QUEUE = "new:transaction"
View Source
const WEBHOOK_QUEUE = "new:webhoook"

Variables

View Source
var SQLFiles embed.FS

Functions

func Init

func Init(ctx context.Context, service string) trace.Tracer

Init returns an instance of Jaeger Tracer.

func NewBalanceTracker

func NewBalanceTracker() *model.BalanceTracker

func ProcessWebhook

func ProcessWebhook(ctx context.Context, task *asynq.Task) error

func SendWebhook

func SendWebhook(newWebhook NewWebhook) error

Types

type Blnk

type Blnk struct {
	// contains filtered or unexported fields
}

func NewBlnk

func NewBlnk(db database.IDataSource) (*Blnk, error)

func (Blnk) CommitInflightTransaction added in v0.6.0

func (l Blnk) CommitInflightTransaction(ctx context.Context, transactionID string, amount int64) (*model.Transaction, error)

func (Blnk) CreateAccount

func (l Blnk) CreateAccount(account model.Account) (model.Account, error)

CreateAccount creates a new account in the database.

func (Blnk) CreateBalance

func (l Blnk) CreateBalance(balance model.Balance) (model.Balance, error)

func (Blnk) CreateIdentity

func (l Blnk) CreateIdentity(identity model.Identity) (model.Identity, error)

func (Blnk) CreateLedger

func (l Blnk) CreateLedger(ledger model.Ledger) (model.Ledger, error)

func (Blnk) CreateMonitor

func (l Blnk) CreateMonitor(monitor model.BalanceMonitor) (model.BalanceMonitor, error)

func (Blnk) DeleteIdentity

func (l Blnk) DeleteIdentity(id string) error

func (Blnk) DeleteMonitor

func (l Blnk) DeleteMonitor(id string) error

func (Blnk) GetAccount

func (l Blnk) GetAccount(id string, include []string) (*model.Account, error)

GetAccount retrieves an account from the database by ID.

func (Blnk) GetAccountByNumber

func (l Blnk) GetAccountByNumber(id string) (*model.Account, error)

GetAccountByNumber retrieves an account from the database by ID.

func (Blnk) GetAllAccounts

func (l Blnk) GetAllAccounts() ([]model.Account, error)

GetAllAccounts retrieves all accounts from the database.

func (Blnk) GetAllBalances

func (l Blnk) GetAllBalances() ([]model.Balance, error)

func (Blnk) GetAllIdentities

func (l Blnk) GetAllIdentities() ([]model.Identity, error)

func (Blnk) GetAllLedgers

func (l Blnk) GetAllLedgers() ([]model.Ledger, error)

func (Blnk) GetAllMonitors

func (l Blnk) GetAllMonitors() ([]model.BalanceMonitor, error)

func (Blnk) GetAllTransactions

func (l Blnk) GetAllTransactions() ([]model.Transaction, error)

func (Blnk) GetBalanceByID

func (l Blnk) GetBalanceByID(id string, include []string) (*model.Balance, error)

func (Blnk) GetBalanceMonitors

func (l Blnk) GetBalanceMonitors(balanceId string) ([]model.BalanceMonitor, error)

func (Blnk) GetIdentity

func (l Blnk) GetIdentity(id string) (*model.Identity, error)

func (Blnk) GetLedgerByID

func (l Blnk) GetLedgerByID(id string) (*model.Ledger, error)

func (Blnk) GetMonitorByID

func (l Blnk) GetMonitorByID(id string) (*model.BalanceMonitor, error)

func (Blnk) GetTransaction

func (l Blnk) GetTransaction(TransactionID string) (*model.Transaction, error)

func (Blnk) GetTransactionByRef

func (l Blnk) GetTransactionByRef(cxt context.Context, reference string) (model.Transaction, error)

func (Blnk) QueueTransaction

func (l Blnk) QueueTransaction(cxt context.Context, transaction *model.Transaction) (*model.Transaction, error)

func (Blnk) RecordTransaction

func (l Blnk) RecordTransaction(ctx context.Context, transaction *model.Transaction) (*model.Transaction, error)

func (Blnk) RefundTransaction

func (l Blnk) RefundTransaction(transactionID string) (*model.Transaction, error)

func (Blnk) Search added in v0.6.0

func (b Blnk) Search(collection string, query map[string]interface{}) (interface{}, error)

func (Blnk) UpdateIdentity

func (l Blnk) UpdateIdentity(identity *model.Identity) error

func (Blnk) UpdateMonitor

func (l Blnk) UpdateMonitor(monitor *model.BalanceMonitor) error

func (Blnk) UpdateTransactionStatus

func (l Blnk) UpdateTransactionStatus(id string, status string) error

func (Blnk) VoidInflightTransaction added in v0.6.0

func (l Blnk) VoidInflightTransaction(ctx context.Context, transactionID string) (*model.Transaction, error)

type NewWebhook

type NewWebhook struct {
	Event   string      `json:"event"`
	Payload interface{} `json:"data"`
}

type Queue

type Queue struct {
	Client    *asynq.Client
	Inspector *asynq.Inspector
}

func NewQueue

func NewQueue(conf *config.Configuration) *Queue

func (*Queue) Enqueue

func (q *Queue) Enqueue(ctx context.Context, transaction *model.Transaction) error

type TransactionTypePayload

type TransactionTypePayload struct {
	Data model.Transaction
}

type TypesenseClient added in v0.6.0

type TypesenseClient struct {
	ApiKey     string
	Hosts      []string
	HttpClient *resty.Client
}

func NewTypesenseClient added in v0.6.0

func NewTypesenseClient(apiKey string, hosts []string) *TypesenseClient

func (*TypesenseClient) CreateCollection added in v0.6.0

func (client *TypesenseClient) CreateCollection(ctx context.Context, schema interface{}) (*resty.Response, error)

func (*TypesenseClient) IndexDocument added in v0.6.0

func (client *TypesenseClient) IndexDocument(ctx context.Context, collection string, document interface{}) (*resty.Response, error)

func (*TypesenseClient) Search added in v0.6.0

func (client *TypesenseClient) Search(ctx context.Context, collection string, searchParams map[string]interface{}) (*resty.Response, error)

type TypesenseError added in v0.6.0

type TypesenseError struct {
	Message string `json:"message"`
}

Directories

Path Synopsis
api
internal

Jump to

Keyboard shortcuts

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