model

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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 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 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

View Source
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.

Variables

View Source
var ErrPrecisionMustBeInteger = errors.New("precision must be an integer value")

Functions

This section is empty.

Types

type BulkInflightCommitItem added in v0.14.2

type BulkInflightCommitItem struct {
	TransactionID string   `json:"transaction_id"`
	Amount        float64  `json:"amount,omitempty"`
	PreciseAmount *big.Int `json:"precise_amount,omitempty"`
}

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.

type BulkInflightCommitRequest added in v0.14.2

type BulkInflightCommitRequest struct {
	Transactions []BulkInflightCommitItem `json:"transactions"`
}

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 added in v0.14.2

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 added in v0.14.2

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 added in v0.14.2

type BulkInflightVoidRequest struct {
	TransactionIDs []string `json:"transaction_ids"`
}

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 CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	Name      string    `json:"name" binding:"required"`
	Scopes    []string  `json:"scopes" binding:"required"`
	Owner     string    `json:"owner" binding:"required"`
	ExpiresAt time.Time `json:"expires_at" binding:"required"`
}

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"`
}

func (*CreateBalance) ToBalance

func (b *CreateBalance) ToBalance() model.Balance

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"`
}

type MonitorCondition

type MonitorCondition struct {
	Precision float64 `json:"precision"`
	Field     string  `json:"field"`
	Operator  string  `json:"operator"`
	Value     float64 `json:"value"`
}

func (*MonitorCondition) ValidateMonitorCondition

func (c *MonitorCondition) ValidateMonitorCondition() error

type RecordTransaction

type RecordTransaction struct {
	Amount             float64                `json:"amount"`
	Rate               float64                `json:"rate"`
	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"`
}

func (*RecordTransaction) ToTransaction

func (t *RecordTransaction) ToTransaction() *model.Transaction

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

Jump to

Keyboard shortcuts

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