cobalt_banking
Personal, shared and society accounts, with every money movement in one transaction.
| Export | Side | What it does |
|---|---|---|
GetAccount | Server | The account behind an account id or a citizenid. |
GetBalance | Server | 0 when the account doesn't exist. |
Deposit | Server | |
Withdraw | Server | Refuses when the balance can't cover it. |
Transfer | Server | Moves money between two accounts in one transaction, without a fee or a permission check; player-initiated transfers go through SendTransfer. |
AdjustBalance | Server | Credits or debits an account and logs it to FiveMesh. |
GetNextPayday | Server | When the next paycheck cycle runs. |
GetAccessibleAccounts | Server | Accounts the character can see, with their role. |
GetStatement | Server | A page of an account's entries with counterparty and initiator names, for a character with any role on it. |
GetStatementEntry | Server | One entry, for a character with any role on its account. |
FindRecipient | Server | The account behind an account number or citizen ID. |
GetRecentRecipients | Server | Other people's accounts the character sent money to, latest first. |
SendTransfer | Server | Moves money in one transaction with the configured fee, for a character with member or higher on the source. |
GetAccountMembers | Server | Members of a shared account, or the org roster of a society account. |
InviteMember | Server | Adds a character to a shared account as member; the caller needs admin or higher. |
RevokeMember | Server | Removes a member other than the owner from a shared account; the caller needs admin or higher. |
CreateInvoice | Server | Sends a character an invoice that pays into society_<issuer> unless payee says otherwise. |
GetInvoice | Server | |
GetInvoices | Server | Invoices matching every filter given, newest first. |
GetInvoiceTotals | Server | What's owed, overdue, billed and paid across the invoices matching the filter. |
PayInvoice | Server | Pays an unpaid invoice into its payee in one transaction, as bill_paid and bill_received statement entries with the receipt INV-<id>. |
DeclineInvoice | Server | Records that the payer turned an unpaid invoice down; it stays unpaid with declinedAt set. |
VoidInvoice | Server | Cancels an unpaid invoice. |
FindNearestCashPoint | Client | The closest streamed-in ATM or bank branch to the player. |
GetAccount
ServerThe account behind an account id or a citizenid.
exports.cobalt_banking:GetAccount(account)| Parameter | Type | Optional | Description |
|---|---|---|---|
account | BankingAccountRef | No |
| Returns | Description |
|---|---|
BankingAccount? |
local account = exports.cobalt_banking:GetAccount('CB 1234 5678')GetBalance
Server0 when the account doesn't exist. Cash is not a bank balance: read it from cobalt_core's player.
exports.cobalt_banking:GetBalance(account)| Parameter | Type | Optional | Description |
|---|---|---|---|
account | BankingAccountRef | No |
| Returns | Description |
|---|---|
integer |
local balance = exports.cobalt_banking:GetBalance('CB 1234 5678')Deposit
Serverexports.cobalt_banking:Deposit(account, amount, details)| Parameter | Type | Optional | Description |
|---|---|---|---|
account | BankingAccountRef | No | |
amount | number | No | a whole amount from 1 to 1000000000 |
details | BankingDetails | Yes |
| Returns | Description |
|---|---|
boolean | ok |
integer | string | balanceOrError |
local ok, balanceOrError = exports.cobalt_banking:Deposit(
'CB 1234 5678',
100,
{ note = 'Vehicle repair', initiator = 'ABC12345' }
)Withdraw
ServerRefuses when the balance can't cover it.
exports.cobalt_banking:Withdraw(account, amount, details)| Parameter | Type | Optional | Description |
|---|---|---|---|
account | BankingAccountRef | No | |
amount | number | No | a whole amount from 1 to 1000000000 |
details | BankingDetails | Yes |
| Returns | Description |
|---|---|
boolean | ok |
integer | string | balanceOrError |
local ok, balanceOrError = exports.cobalt_banking:Withdraw(
'CB 1234 5678',
100,
{ note = 'Vehicle repair', initiator = 'ABC12345' }
)Transfer
ServerMoves money between two accounts in one transaction, without a fee or a permission check; player-initiated transfers go through SendTransfer.
exports.cobalt_banking:Transfer(from, to, amount, details)| Parameter | Type | Optional | Description |
|---|---|---|---|
from | BankingAccountRef | No | |
to | BankingAccountRef | No | |
amount | number | No | a whole amount from 1 to 1000000000 |
details | BankingTransferDetails | Yes |
| Returns | Description |
|---|---|
boolean | ok |
integer | string | fromBalanceOrError |
local ok, fromBalanceOrError = exports.cobalt_banking:Transfer(
'CB 1234 5678',
'CB 8765 4321',
100,
{ note = 'Rent', initiator = 'ABC12345' }
)AdjustBalance
ServerCredits or debits an account and logs it to FiveMesh. Refuses a debit the balance can't cover.
exports.cobalt_banking:AdjustBalance(account, delta, details)| Parameter | Type | Optional | Description |
|---|---|---|---|
account | BankingAccountRef | No | |
delta | number | No | a whole amount; positive credits, negative debits |
details | BankingDetails | Yes | initiator defaults to system |
| Returns | Description |
|---|---|
boolean | ok |
integer | string | balanceOrError |
local ok, balanceOrError = exports.cobalt_banking:AdjustBalance(
'CB 1234 5678',
-250,
{ note = 'Vehicle repair', initiator = 'ABC12345' }
)GetNextPayday
ServerWhen the next paycheck cycle runs. Society orgs pay it from their society account.
exports.cobalt_banking:GetNextPayday()| Returns | Description |
|---|---|
integer | epoch seconds |
integer | minutes between paydays |
local epoch, minutes = exports.cobalt_banking:GetNextPayday()GetAccessibleAccounts
ServerAccounts the character can see, with their role. Society accounts need the character online.
exports.cobalt_banking:GetAccessibleAccounts(citizenid)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No |
| Returns | Description |
|---|---|
BankingAccessibleAccount[] |
local accessibleAccounts = exports.cobalt_banking:GetAccessibleAccounts('ABC12345')GetStatement
ServerA page of an account's entries with counterparty and initiator names, for a character with any role on it.
exports.cobalt_banking:GetStatement(citizenid, accountId, query)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
accountId | BankingAccountId | No | |
query | BankingStatementQuery | Yes |
| Returns | Description |
|---|---|
BankingStatementPage | BankingRefusal |
local statementPage = exports.cobalt_banking:GetStatement(
'ABC12345',
'CB 1234 5678',
{ limit = 20, direction = 'out' }
)GetStatementEntry
ServerOne entry, for a character with any role on its account.
exports.cobalt_banking:GetStatementEntry(citizenid, transactionId)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
transactionId | integer | No |
| Returns | Description |
|---|---|
table | BankingRefusal |
local statementEntry = exports.cobalt_banking:GetStatementEntry('ABC12345', 1)FindRecipient
ServerThe account behind an account number or citizen ID.
exports.cobalt_banking:FindRecipient(query)| Parameter | Type | Optional | Description |
|---|---|---|---|
query | string | No |
| Returns | Description |
|---|---|
BankingRecipient? |
local recipient = exports.cobalt_banking:FindRecipient('CB 8765 4321')GetRecentRecipients
ServerOther people's accounts the character sent money to, latest first.
exports.cobalt_banking:GetRecentRecipients(citizenid, limit)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
limit | integer | Yes | default 5 |
| Returns | Description |
|---|---|
BankingRecipient[] |
local recipients = exports.cobalt_banking:GetRecentRecipients('ABC12345', 10)SendTransfer
ServerMoves money in one transaction with the configured fee, for a character with member or higher on the source. Logs to FiveMesh.
exports.cobalt_banking:SendTransfer(citizenid, request)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
request | BankingTransferRequest | No |
| Returns | Description |
|---|---|
BankingTransferResult |
local transferResult = exports.cobalt_banking:SendTransfer(
'ABC12345',
{ from = 'CB 1234 5678', to = 'CB 8765 4321', amount = 250, note = 'Rent' }
)GetAccountMembers
ServerMembers of a shared account, or the org roster of a society account.
exports.cobalt_banking:GetAccountMembers(citizenid, accountId)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
accountId | BankingAccountId | No |
| Returns | Description |
|---|---|
BankingMemberList | BankingRefusal |
local memberList = exports.cobalt_banking:GetAccountMembers('ABC12345', 'CB 1234 5678')InviteMember
ServerAdds a character to a shared account as member; the caller needs admin or higher.
exports.cobalt_banking:InviteMember(citizenid, accountId, targetCitizenid)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
accountId | BankingAccountId | No | |
targetCitizenid | string | No |
| Returns | Description |
|---|---|
table | BankingRefusal |
local result = exports.cobalt_banking:InviteMember('ABC12345', 'CB 1234 5678', 'XYZ67890')RevokeMember
ServerRemoves a member other than the owner from a shared account; the caller needs admin or higher.
exports.cobalt_banking:RevokeMember(citizenid, accountId, targetCitizenid)| Parameter | Type | Optional | Description |
|---|---|---|---|
citizenid | string | No | |
accountId | BankingAccountId | No | |
targetCitizenid | string | No |
| Returns | Description |
|---|---|
table | BankingRefusal |
local result = exports.cobalt_banking:RevokeMember('ABC12345', 'CB 1234 5678', 'XYZ67890')CreateInvoice
ServerSends a character an invoice that pays into society_<issuer> unless payee says otherwise. Notifies no one.
exports.cobalt_banking:CreateInvoice(invoice)| Parameter | Type | Optional | Description |
|---|---|---|---|
invoice | BankingInvoiceInput | No |
| Returns | Description |
|---|---|
BankingInvoiceResult |
local invoiceResult = exports.cobalt_banking:CreateInvoice(
{ issuer = 'ABC12345', citizenid = 'ABC12345', amount = 100 }
)GetInvoice
Serverexports.cobalt_banking:GetInvoice(id)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No |
| Returns | Description |
|---|---|
BankingInvoice? |
local invoice = exports.cobalt_banking:GetInvoice(1)GetInvoices
ServerInvoices matching every filter given, newest first. A malformed filter matches nothing.
exports.cobalt_banking:GetInvoices(filter)| Parameter | Type | Optional | Description |
|---|---|---|---|
filter | BankingInvoiceQuery | Yes |
| Returns | Description |
|---|---|
BankingInvoice[] |
local invoices = exports.cobalt_banking:GetInvoices({})GetInvoiceTotals
ServerWhat's owed, overdue, billed and paid across the invoices matching the filter.
exports.cobalt_banking:GetInvoiceTotals(filter)| Parameter | Type | Optional | Description |
|---|---|---|---|
filter | BankingInvoiceTotalsQuery | Yes |
| Returns | Description |
|---|---|
BankingInvoiceTotals |
local invoiceTotals = exports.cobalt_banking:GetInvoiceTotals({})PayInvoice
ServerPays an unpaid invoice into its payee in one transaction, as bill_paid and bill_received statement entries with the receipt INV-<id>. Logs to FiveMesh and triggers the server event cobalt_banking:invoicePaid with the paid BankingInvoice and its BankingInvoicePaidWith.
exports.cobalt_banking:PayInvoice(id, payment)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No | |
payment | BankingInvoicePayment | Yes |
| Returns | Description |
|---|---|
BankingInvoiceResult |
local invoiceResult = exports.cobalt_banking:PayInvoice(1, {})DeclineInvoice
ServerRecords that the payer turned an unpaid invoice down; it stays unpaid with declinedAt set.
exports.cobalt_banking:DeclineInvoice(id)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No |
| Returns | Description |
|---|---|
BankingInvoiceResult |
local invoiceResult = exports.cobalt_banking:DeclineInvoice(1)VoidInvoice
ServerCancels an unpaid invoice.
exports.cobalt_banking:VoidInvoice(id, reason)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No | |
reason | string | No | up to 255 characters |
| Returns | Description |
|---|---|
BankingInvoiceResult |
local invoiceResult = exports.cobalt_banking:VoidInvoice(1, 'Parking in a red zone')FindNearestCashPoint
ClientThe closest streamed-in ATM or bank branch to the player.
exports.cobalt_banking:FindNearestCashPoint()| Returns | Description |
|---|---|
BankingCashPointView? |
local cashPointView = exports.cobalt_banking:FindNearestCashPoint()