{"modulePath":"github.com/devaccuracy/ledgerforge","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package model\n\nCopyright 2024 Blnk Finance Authors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2026 LedgerForge Contributors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2024 Blnk Finance Authors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2024 Blnk Finance Authors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2024 Blnk Finance Authors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2024 Blnk Finance Authors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2026 LedgerForge Contributors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\nCopyright 2024 Blnk Finance Authors.\n\nLicensed 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\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n\n## Constants\n\n```go\nconst MaxBulkInflightItems = 100\n```\nMaxBulkInflightItems 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.\n\n```go\nconst MaxBulkTransactionItems = 10000\n```\nMaxBulkTransactionItems 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.\n\n```go\nconst MaxInstantReconciliationItems = 10000\n```\nMaxInstantReconciliationItems 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.\n\n## Variables\n\n```go\nvar ErrPrecisionMustBeInteger = errors.New(\"precision must be an integer value\")\n```\n\n## Types\n\n```go\ntype BulkInflightCommitItem struct {\n\tTransactionID string   `json:\"transaction_id\"`\n\tAmount        float64  `json:\"amount,omitempty\"`\n\tPreciseAmount *big.Int `json:\"precise_amount,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\nBulkInflightCommitItem 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.\n\n```go\nfunc (t *BulkInflightCommitItem) ExactAmount() string\n```\n\n```go\nfunc (t *BulkInflightCommitItem) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype BulkInflightCommitRequest struct {\n\tTransactions []BulkInflightCommitItem `json:\"transactions\"`\n\t// SkipQueue processes every item synchronously instead of routing them\n\t// through the inflight-commit queue (the default).\n\tSkipQueue bool `json:\"skip_queue\"`\n\n\t// DryRun projects every commit and returns the resulting balances without\n\t// settling anything: no settlement is recorded, the holds stay in place,\n\t// and nothing is queued.\n\t//\n\t// Items are projected independently of one another, because that is how\n\t// they really run — BulkInflightUpdate dispatches them across a worker\n\t// pool with no ordering between them.\n\tDryRun bool `json:\"dry_run\"`\n}\n```\nBulkInflightCommitRequest commits many independently-created inflight transactions in one call. Unlike the void variant, each item can carry its own amount for partial commits.\n\n```go\ntype BulkInflightResponse struct {\n\tSucceeded int                  `json:\"succeeded\"`\n\tFailed    int                  `json:\"failed\"`\n\tResults   []BulkInflightResult `json:\"results\"`\n}\n```\nBulkInflightResponse is the envelope returned by both bulk endpoints. Succeeded + Failed == len(Results).\n\n```go\ntype BulkInflightResult struct {\n\tTransactionID string `json:\"transaction_id\"`\n\tStatus        string `json:\"status\"`\n\tCode          string `json:\"code,omitempty\"`\n\tMessage       string `json:\"message,omitempty\"`\n}\n```\nBulkInflightResult 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.\n\n```go\ntype BulkInflightVoidRequest struct {\n\tTransactionIDs []string `json:\"transaction_ids\"`\n\t// SkipQueue processes every item synchronously instead of routing them\n\t// through the inflight-commit queue (the default).\n\tSkipQueue bool `json:\"skip_queue\"`\n\n\t// DryRun projects every void and returns the resulting balances without\n\t// releasing any hold: no settlement is recorded and nothing is queued.\n\t//\n\t// Items are projected independently of one another, because that is how\n\t// they really run — BulkInflightUpdate dispatches them across a worker\n\t// pool with no ordering between them.\n\tDryRun bool `json:\"dry_run\"`\n}\n```\nBulkInflightVoidRequest 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.\n\n```go\ntype BulkTransactionRequest struct {\n\tTransactions []*RecordTransaction `json:\"transactions\"`\n\tInflight     bool                 `json:\"inflight\"`\n\tAtomic       bool                 `json:\"atomic\"`\n\tRunAsync     bool                 `json:\"run_async\"`\n\tSkipQueue    bool                 `json:\"skip_queue\"`\n\n\t// DryRun projects the batch and returns the result without applying any of\n\t// it. The projection answers synchronously with 200, so run_async is\n\t// ignored.\n\t//\n\t// Items are projected against each other's effects only when skip_queue is\n\t// set, mirroring how the batch would really run; the response reports which\n\t// mode was used.\n\tDryRun bool `json:\"dry_run\"`\n}\n```\nBulkTransactionRequest is the public API request shape for creating a batch of transactions. Each item mirrors the single transaction create payload.\n\n```go\nfunc (r *BulkTransactionRequest) ToBulkTransactionRequest() *model.BulkTransactionRequest\n```\n\n```go\ntype CreateAPIKeyRequest struct {\n\tName      string    `json:\"name\" binding:\"required\"`\n\tScopes    []string  `json:\"scopes\" binding:\"required\"`\n\tOwner     string    `json:\"owner\" binding:\"required\"`\n\tExpiresAt time.Time `json:\"expires_at\" binding:\"required\"`\n}\n```\n\n```go\ntype CreateAccount struct {\n\tBankName   string                 `json:\"bank_name\"`\n\tNumber     string                 `json:\"number\"`\n\tCurrency   string                 `json:\"currency\"`\n\tIdentityId string                 `json:\"identity_id\"`\n\tLedgerId   string                 `json:\"ledger_id\"`\n\tBalanceId  string                 `json:\"balance_id\"`\n\tMetaData   map[string]interface{} `json:\"meta_data\"`\n}\n```\n\n```go\nfunc (a *CreateAccount) ToAccount() model.Account\n```\n\n```go\nfunc (a *CreateAccount) ValidateCreateAccount() error\n```\n\n```go\ntype CreateBalance struct {\n\tLedgerId           string                 `json:\"ledger_id\"`\n\tIdentityId         string                 `json:\"identity_id\"`\n\tCurrency           string                 `json:\"currency\"`\n\tPrecision          float64                `json:\"precision\"`\n\tMetaData           map[string]interface{} `json:\"meta_data\"`\n\tTrackFundLineage   bool                   `json:\"track_fund_lineage\"`\n\tAllocationStrategy string                 `json:\"allocation_strategy\"`\n\tIndicator          string                 `json:\"indicator,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (b *CreateBalance) ToBalance() model.Balance\n```\n\n```go\nfunc (b *CreateBalance) UnmarshalJSON(data []byte) error\n```\n\n```go\nfunc (b *CreateBalance) ValidateCreateBalance() error\n```\n\n```go\ntype CreateBalanceMonitor struct {\n\tBalanceId   string                 `json:\"balance_id\"`\n\tCondition   MonitorCondition       `json:\"condition\"`\n\tCallBackURL string                 `json:\"call_back_url\"`\n\tMetaData    map[string]interface{} `json:\"meta_data\"`\n}\n```\n\n```go\nfunc (b *CreateBalanceMonitor) ToBalanceMonitor() model.BalanceMonitor\n```\n\n```go\nfunc (b *CreateBalanceMonitor) ValidateCreateBalanceMonitor() error\n```\n\n```go\ntype CreateIdentity struct {\n\tIdentityType     string                 `json:\"identity_type\"`\n\tFirstName        string                 `json:\"first_name\"`\n\tLastName         string                 `json:\"last_name\"`\n\tOtherNames       string                 `json:\"other_names\"`\n\tGender           string                 `json:\"gender\"`\n\tDob              time.Time              `json:\"dob\"`\n\tEmailAddress     string                 `json:\"email_address\"`\n\tPhoneNumber      string                 `json:\"phone_number\"`\n\tNationality      string                 `json:\"nationality\"`\n\tOrganizationName string                 `json:\"organization_name\"`\n\tCategory         string                 `json:\"category\"`\n\tStreet           string                 `json:\"street\"`\n\tCountry          string                 `json:\"country\"`\n\tState            string                 `json:\"state\"`\n\tPostCode         string                 `json:\"post_code\"`\n\tCity             string                 `json:\"city\"`\n\tCreatedAt        time.Time              `json:\"created_at\"`\n\tMetaData         map[string]interface{} `json:\"meta_data\"`\n}\n```\n\n```go\ntype CreateLedger struct {\n\tName     string                 `json:\"name\"`\n\tMetaData map[string]interface{} `json:\"meta_data\"`\n}\n```\n\n```go\nfunc (l *CreateLedger) ToLedger() model.Ledger\n```\n\n```go\nfunc (l *CreateLedger) ValidateCreateLedger() error\n```\n\n```go\ntype DetokenizeRequest struct {\n\tFields []string `json:\"fields\" binding:\"required\"`\n}\n```\n\n```go\ntype InflightUpdate struct {\n\tStatus        string   `json:\"status\"`\n\tAmount        float64  `json:\"amount\"`\n\tPreciseAmount *big.Int `json:\"precise_amount,omitempty\"`\n\t// SkipQueue processes the commit/void synchronously instead of routing it\n\t// through the inflight-commit queue (the default).\n\tSkipQueue bool `json:\"skip_queue\"`\n\n\t// DryRun projects the commit or void and returns the resulting balances\n\t// without settling anything: no settlement transaction is recorded and the\n\t// hold stays in place.\n\t//\n\t// A void always releases the full remaining hold, so any amount sent with\n\t// one is ignored.\n\tDryRun bool `json:\"dry_run\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (t *InflightUpdate) ExactAmount() string\n```\n\n```go\nfunc (t *InflightUpdate) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype MonitorCondition struct {\n\tPrecision float64 `json:\"precision\"`\n\tField     string  `json:\"field\"`\n\tOperator  string  `json:\"operator\"`\n\tValue     float64 `json:\"value\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (c *MonitorCondition) UnmarshalJSON(data []byte) error\n```\n\n```go\nfunc (c *MonitorCondition) ValidateMonitorCondition() error\n```\n\n```go\ntype RecordTransaction struct {\n\n\t// Rate is retained for client compatibility; ledger arithmetic does not use it.\n\tRate float64 `json:\"rate\"`\n\t// Amount rounds to the nearest minor unit, with halves away from zero.\n\t// Positive amounts that round to zero are rejected; precise_amount is exact.\n\tAmount             float64                `json:\"amount\"`\n\tPrecision          float64                `json:\"precision\"`\n\tOverdraftLimit     float64                `json:\"overdraft_limit\"`\n\tPreciseAmount      *big.Int               `json:\"precise_amount\"`\n\tAllowOverDraft     bool                   `json:\"allow_overdraft\"`\n\tInflight           bool                   `json:\"inflight\"`\n\tSkipQueue          bool                   `json:\"skip_queue\"`\n\tAtomic             bool                   `json:\"atomic\"`\n\tSource             string                 `json:\"source\"`\n\tReference          string                 `json:\"reference\"`\n\tDestination        string                 `json:\"destination\"`\n\tDescription        string                 `json:\"description\"`\n\tCurrency           string                 `json:\"currency\"`\n\tBalanceId          string                 `json:\"balance_id\"`\n\tScheduledFor       string                 `json:\"scheduled_for\"`\n\tInflightExpiryDate string                 `json:\"inflight_expiry_date,omitempty\"`\n\tInflightCommitDate string                 `json:\"inflight_commit_date,omitempty\"`\n\tSources            []model.Distribution   `json:\"sources\"`\n\tDestinations       []model.Distribution   `json:\"destinations\"`\n\tMetaData           map[string]interface{} `json:\"meta_data\"`\n\tEffectiveDate      *time.Time             `json:\"effective_date,omitempty\"`\n\n\t// DryRun projects the transaction's effect on the source and destination\n\t// balances and returns the result without applying it. No transaction row\n\t// is written, no balance changes, nothing is queued, no webhook fires, and\n\t// the reference is not consumed.\n\t//\n\t// A dry run always responds synchronously with 200 rather than 201, and\n\t// takes precedence over skip_queue: a projection is inherently an immediate\n\t// answer about what a real post would do.\n\tDryRun bool `json:\"dry_run\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (t *RecordTransaction) ExactAmount() string\n```\n\n```go\nfunc (t *RecordTransaction) ToTransaction() *model.Transaction\n```\n\n```go\nfunc (t *RecordTransaction) UnmarshalJSON(data []byte) error\n```\n\n```go\nfunc (t *RecordTransaction) ValidateRecordTransaction() error\n```\n\n```go\ntype TokenizeRequest struct {\n\tFields []string `json:\"fields\" binding:\"required\"`\n}\n```\n\n```go\ntype UpdateBalanceIdentity struct {\n\tIdentityId string `json:\"identity_id\" binding:\"required\"`\n}\n```\nUpdateBalanceIdentity represents the payload required to update a balance's identity. Only the identity\\_id field is accepted.\n\n```go\ntype UpdateLedger struct {\n\tName string `json:\"name\"`\n}\n```\n\n```go\nfunc (l *UpdateLedger) ValidateUpdateLedger() error\n```\n\n","path":"github.com/devaccuracy/ledgerforge/api/model","name":"model","synopsis":"","isRedistributable":true}
