Documentation
¶
Overview ¶
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2026 LedgerForge Contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2026 LedgerForge Contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- type BulkInflightCommitItem
- type BulkInflightCommitRequest
- type BulkInflightResponse
- type BulkInflightResult
- type BulkInflightVoidRequest
- type BulkTransactionRequest
- type CreateAPIKeyRequest
- type CreateAccount
- type CreateBalance
- type CreateBalanceMonitor
- type CreateIdentity
- type CreateLedger
- type DetokenizeRequest
- type InflightUpdate
- type MonitorCondition
- type RecordTransaction
- type TokenizeRequest
- type UpdateBalanceIdentity
- type UpdateLedger
Constants ¶
const MaxBulkInflightItems = 100
MaxBulkInflightItems caps the number of transactions accepted in a single bulk commit or bulk void call. Bulk calls are processed synchronously, so the cap exists to keep request latency and lock-holding bounded.
const MaxBulkTransactionItems = 10000
MaxBulkTransactionItems caps the number of transactions accepted in a single CreateBulkTransactions request. The whole payload is held in memory, so the cap bounds memory use; it is larger than the inflight cap because bulk creates can run asynchronously.
const MaxInstantReconciliationItems = 10000
MaxInstantReconciliationItems caps the number of external_transactions accepted in a single instant-reconciliation request. The whole array is held in memory, so the cap bounds memory use.
Variables ¶
var ErrPrecisionMustBeInteger = errors.New("precision must be an integer value")
Functions ¶
This section is empty.
Types ¶
type BulkInflightCommitItem ¶
type BulkInflightCommitItem struct {
TransactionID string `json:"transaction_id"`
Amount float64 `json:"amount,omitempty"`
PreciseAmount *big.Int `json:"precise_amount,omitempty"`
// contains filtered or unexported fields
}
BulkInflightCommitItem describes one transaction in a bulk commit request. Amount/PreciseAmount carry the same semantics as the single-tx endpoint: zero means commit the full remaining inflight amount; non-zero performs a partial commit. PreciseAmount, when set, wins over Amount.
func (*BulkInflightCommitItem) ExactAmount ¶
func (t *BulkInflightCommitItem) ExactAmount() string
func (*BulkInflightCommitItem) UnmarshalJSON ¶
func (t *BulkInflightCommitItem) UnmarshalJSON(data []byte) error
type BulkInflightCommitRequest ¶
type BulkInflightCommitRequest struct {
Transactions []BulkInflightCommitItem `json:"transactions"`
// SkipQueue processes every item synchronously instead of routing them
// through the inflight-commit queue (the default).
SkipQueue bool `json:"skip_queue"`
// DryRun projects every commit and returns the resulting balances without
// settling anything: no settlement is recorded, the holds stay in place,
// and nothing is queued.
//
// Items are projected independently of one another, because that is how
// they really run — BulkInflightUpdate dispatches them across a worker
// pool with no ordering between them.
DryRun bool `json:"dry_run"`
}
BulkInflightCommitRequest commits many independently-created inflight transactions in one call. Unlike the void variant, each item can carry its own amount for partial commits.
type BulkInflightResponse ¶
type BulkInflightResponse struct {
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Results []BulkInflightResult `json:"results"`
}
BulkInflightResponse is the envelope returned by both bulk endpoints. Succeeded + Failed == len(Results).
type BulkInflightResult ¶
type BulkInflightResult struct {
TransactionID string `json:"transaction_id"`
Status string `json:"status"`
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
BulkInflightResult is the per-item outcome reported in BulkInflightResponse. On success Status == "succeeded" and Code is empty. On failure Status == "failed" with a stable Code (e.g. "ALREADY_VOIDED", "NOT_FOUND") that callers can branch on, plus a human-readable Message.
type BulkInflightVoidRequest ¶
type BulkInflightVoidRequest struct {
TransactionIDs []string `json:"transaction_ids"`
// SkipQueue processes every item synchronously instead of routing them
// through the inflight-commit queue (the default).
SkipQueue bool `json:"skip_queue"`
// DryRun projects every void and returns the resulting balances without
// releasing any hold: no settlement is recorded and nothing is queued.
//
// Items are projected independently of one another, because that is how
// they really run — BulkInflightUpdate dispatches them across a worker
// pool with no ordering between them.
DryRun bool `json:"dry_run"`
}
BulkInflightVoidRequest voids many independently-created inflight transactions in one call. Each id is processed independently; partial failures are reported per-item in the response and do not abort the rest of the batch.
type BulkTransactionRequest ¶
type BulkTransactionRequest struct {
Transactions []*RecordTransaction `json:"transactions"`
Inflight bool `json:"inflight"`
Atomic bool `json:"atomic"`
RunAsync bool `json:"run_async"`
SkipQueue bool `json:"skip_queue"`
// DryRun projects the batch and returns the result without applying any of
// it. The projection answers synchronously with 200, so run_async is
// ignored.
//
// Items are projected against each other's effects only when skip_queue is
// set, mirroring how the batch would really run; the response reports which
// mode was used.
DryRun bool `json:"dry_run"`
}
BulkTransactionRequest is the public API request shape for creating a batch of transactions. Each item mirrors the single transaction create payload.
func (*BulkTransactionRequest) ToBulkTransactionRequest ¶
func (r *BulkTransactionRequest) ToBulkTransactionRequest() *model.BulkTransactionRequest
type CreateAPIKeyRequest ¶
type CreateAccount ¶
type CreateAccount struct {
BankName string `json:"bank_name"`
Number string `json:"number"`
Currency string `json:"currency"`
IdentityId string `json:"identity_id"`
LedgerId string `json:"ledger_id"`
BalanceId string `json:"balance_id"`
MetaData map[string]interface{} `json:"meta_data"`
}
func (*CreateAccount) ToAccount ¶
func (a *CreateAccount) ToAccount() model.Account
func (*CreateAccount) ValidateCreateAccount ¶
func (a *CreateAccount) ValidateCreateAccount() error
type CreateBalance ¶
type CreateBalance struct {
LedgerId string `json:"ledger_id"`
IdentityId string `json:"identity_id"`
Currency string `json:"currency"`
Precision float64 `json:"precision"`
MetaData map[string]interface{} `json:"meta_data"`
TrackFundLineage bool `json:"track_fund_lineage"`
AllocationStrategy string `json:"allocation_strategy"`
Indicator string `json:"indicator,omitempty"`
// contains filtered or unexported fields
}
func (*CreateBalance) ToBalance ¶
func (b *CreateBalance) ToBalance() model.Balance
func (*CreateBalance) UnmarshalJSON ¶
func (b *CreateBalance) UnmarshalJSON(data []byte) error
func (*CreateBalance) ValidateCreateBalance ¶
func (b *CreateBalance) ValidateCreateBalance() error
type CreateBalanceMonitor ¶
type CreateBalanceMonitor struct {
BalanceId string `json:"balance_id"`
Condition MonitorCondition `json:"condition"`
CallBackURL string `json:"call_back_url"`
MetaData map[string]interface{} `json:"meta_data"`
}
func (*CreateBalanceMonitor) ToBalanceMonitor ¶
func (b *CreateBalanceMonitor) ToBalanceMonitor() model.BalanceMonitor
func (*CreateBalanceMonitor) ValidateCreateBalanceMonitor ¶
func (b *CreateBalanceMonitor) ValidateCreateBalanceMonitor() error
type CreateIdentity ¶
type CreateIdentity struct {
IdentityType string `json:"identity_type"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
OtherNames string `json:"other_names"`
Gender string `json:"gender"`
Dob time.Time `json:"dob"`
EmailAddress string `json:"email_address"`
PhoneNumber string `json:"phone_number"`
Nationality string `json:"nationality"`
OrganizationName string `json:"organization_name"`
Category string `json:"category"`
Street string `json:"street"`
Country string `json:"country"`
State string `json:"state"`
PostCode string `json:"post_code"`
City string `json:"city"`
CreatedAt time.Time `json:"created_at"`
MetaData map[string]interface{} `json:"meta_data"`
}
type CreateLedger ¶
type CreateLedger struct {
Name string `json:"name"`
MetaData map[string]interface{} `json:"meta_data"`
}
func (*CreateLedger) ToLedger ¶
func (l *CreateLedger) ToLedger() model.Ledger
func (*CreateLedger) ValidateCreateLedger ¶
func (l *CreateLedger) ValidateCreateLedger() error
type DetokenizeRequest ¶
type DetokenizeRequest struct {
Fields []string `json:"fields" binding:"required"`
}
type InflightUpdate ¶
type InflightUpdate struct {
Status string `json:"status"`
Amount float64 `json:"amount"`
PreciseAmount *big.Int `json:"precise_amount,omitempty"`
// SkipQueue processes the commit/void synchronously instead of routing it
// through the inflight-commit queue (the default).
SkipQueue bool `json:"skip_queue"`
// DryRun projects the commit or void and returns the resulting balances
// without settling anything: no settlement transaction is recorded and the
// hold stays in place.
//
// A void always releases the full remaining hold, so any amount sent with
// one is ignored.
DryRun bool `json:"dry_run"`
// contains filtered or unexported fields
}
func (*InflightUpdate) ExactAmount ¶
func (t *InflightUpdate) ExactAmount() string
func (*InflightUpdate) UnmarshalJSON ¶
func (t *InflightUpdate) UnmarshalJSON(data []byte) error
type MonitorCondition ¶
type MonitorCondition struct {
Precision float64 `json:"precision"`
Field string `json:"field"`
Operator string `json:"operator"`
Value float64 `json:"value"`
// contains filtered or unexported fields
}
func (*MonitorCondition) UnmarshalJSON ¶
func (c *MonitorCondition) UnmarshalJSON(data []byte) error
func (*MonitorCondition) ValidateMonitorCondition ¶
func (c *MonitorCondition) ValidateMonitorCondition() error
type RecordTransaction ¶
type RecordTransaction struct {
// Rate is retained for client compatibility; ledger arithmetic does not use it.
Rate float64 `json:"rate"`
// Amount rounds to the nearest minor unit, with halves away from zero.
// Positive amounts that round to zero are rejected; precise_amount is exact.
Amount float64 `json:"amount"`
Precision float64 `json:"precision"`
OverdraftLimit float64 `json:"overdraft_limit"`
PreciseAmount *big.Int `json:"precise_amount"`
AllowOverDraft bool `json:"allow_overdraft"`
Inflight bool `json:"inflight"`
SkipQueue bool `json:"skip_queue"`
Atomic bool `json:"atomic"`
Source string `json:"source"`
Reference string `json:"reference"`
Destination string `json:"destination"`
Description string `json:"description"`
Currency string `json:"currency"`
BalanceId string `json:"balance_id"`
ScheduledFor string `json:"scheduled_for"`
InflightExpiryDate string `json:"inflight_expiry_date,omitempty"`
InflightCommitDate string `json:"inflight_commit_date,omitempty"`
Sources []model.Distribution `json:"sources"`
Destinations []model.Distribution `json:"destinations"`
MetaData map[string]interface{} `json:"meta_data"`
EffectiveDate *time.Time `json:"effective_date,omitempty"`
// DryRun projects the transaction's effect on the source and destination
// balances and returns the result without applying it. No transaction row
// is written, no balance changes, nothing is queued, no webhook fires, and
// the reference is not consumed.
//
// A dry run always responds synchronously with 200 rather than 201, and
// takes precedence over skip_queue: a projection is inherently an immediate
// answer about what a real post would do.
DryRun bool `json:"dry_run"`
// contains filtered or unexported fields
}
func (*RecordTransaction) ExactAmount ¶
func (t *RecordTransaction) ExactAmount() string
func (*RecordTransaction) ToTransaction ¶
func (t *RecordTransaction) ToTransaction() *model.Transaction
func (*RecordTransaction) UnmarshalJSON ¶
func (t *RecordTransaction) UnmarshalJSON(data []byte) error
func (*RecordTransaction) ValidateRecordTransaction ¶
func (t *RecordTransaction) ValidateRecordTransaction() error
type TokenizeRequest ¶
type TokenizeRequest struct {
Fields []string `json:"fields" binding:"required"`
}
type UpdateBalanceIdentity ¶
type UpdateBalanceIdentity struct {
IdentityId string `json:"identity_id" binding:"required"`
}
UpdateBalanceIdentity represents the payload required to update a balance's identity. Only the identity_id field is accepted.
type UpdateLedger ¶
type UpdateLedger struct {
Name string `json:"name"`
}
func (*UpdateLedger) ValidateUpdateLedger ¶
func (l *UpdateLedger) ValidateUpdateLedger() error