Skip to content

Transaction

Extends

  • Transaction

Properties

payload

payload: Transaction;

The underlying payload data for this resource

Inherited from

Bkper.Transaction.payload

Methods

addFile()

addFile(file): Transaction;

Add a File attachment to the Transaction.

Files not previously created in the Book will be automatically created when the Transaction is persisted.

Parameters

ParameterType
fileFile | Blob

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.addFile

addRemoteId()

addRemoteId(remoteId): Transaction;

Add a remote id to the Transaction.

Parameters

ParameterType
remoteIdstring

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.addRemoteId

addUrl()

addUrl(url): Transaction;

Add a url to the Transaction. Url starts with https://

Parameters

ParameterType
urlstring

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.addUrl

check()

check(): Transaction;

Perform check transaction.

Returns

Transaction

Inherited from

Bkper.Transaction.check

create()

create(): Transaction;

Perform create new draft transaction.

Returns

Transaction

Inherited from

Bkper.Transaction.create

deleteProperty()

deleteProperty(key): this;

Deletes a custom property.

Parameters

ParameterType
keystring

Returns

this

This resource, for chaining

Inherited from

Bkper.Transaction.deleteProperty

from()

from(account): Transaction;

Set the credit/origin Account of the Transaction. Same as setCreditAccount().

Parameters

ParameterType
accountstring | Account

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.from

getAccountBalance()

getAccountBalance(raw?): Amount;

Gets the balance that the [[Account]] has at that day, when listing transactions of that Account.

Evolved balances is returned when searching for transactions of a permanent [[Account]].

Only comes with the last posted transaction of the day.

Parameters

ParameterType
raw?boolean

Returns

Amount

Inherited from

Bkper.Transaction.getAccountBalance

getAgentId()

getAgentId(): string;

Returns

string

The id of the agent that created this transaction

Inherited from

Bkper.Transaction.getAgentId

getAmount()

getAmount(): Amount;

Returns

Amount

The amount of the transaction.

Inherited from

Bkper.Transaction.getAmount

getCreatedAt()

getCreatedAt(): Date;

Returns

Date

The date the transaction was created.

Inherited from

Bkper.Transaction.getCreatedAt

getCreatedAtFormatted()

getCreatedAtFormatted(): string;

Returns

string

The date the transaction was created, formatted according to the date pattern of [[Book]].

Inherited from

Bkper.Transaction.getCreatedAtFormatted

getCreditAccount()

getCreditAccount(): Account;

Returns

Account

The credit account. The same as origin account.

Inherited from

Bkper.Transaction.getCreditAccount

getCreditAccountName()

getCreditAccountName(): string;

Returns

string

The credit account name.

Inherited from

Bkper.Transaction.getCreditAccountName

getCreditAmount()

getCreditAmount(account): Amount;

Get the absolute amount of this transaction if the given account is at the credit side, else null.

Parameters

ParameterType
accountstring | Account

Returns

Amount

Inherited from

Bkper.Transaction.getCreditAmount

getDate()

getDate(): string;

Returns

string

The Transaction date, in ISO format yyyy-MM-dd.

Inherited from

Bkper.Transaction.getDate

getDateFormatted()

getDateFormatted(): string;

Returns

string

The Transaction date, formatted on the date pattern of the [[Book]].

Inherited from

Bkper.Transaction.getDateFormatted

getDateObject()

getDateObject(): Date;

Returns

Date

The Transaction Date object, on the time zone of the [[Book]].

Inherited from

Bkper.Transaction.getDateObject

getDateValue()

getDateValue(): number;

Returns

number

The Transaction date number, in format YYYYMMDD.

Inherited from

Bkper.Transaction.getDateValue

getDebitAccount()

getDebitAccount(): Account;

Returns

Account

The debit account. The same as destination account.

Inherited from

Bkper.Transaction.getDebitAccount

getDebitAccountName()

getDebitAccountName(): string;

Returns

string

The debit account name.

Inherited from

Bkper.Transaction.getDebitAccountName

getDebitAmount()

getDebitAmount(account): Amount;

Gets the absolute amount of this transaction if the given account is at the debit side, else null.

Parameters

ParameterType
accountstring | Account

Returns

Amount

Inherited from

Bkper.Transaction.getDebitAmount

getDescription()

getDescription(): string;

Returns

string

The description of this transaction.

Inherited from

Bkper.Transaction.getDescription

getFiles()

getFiles(): File[];

Returns

File[]

The files attached to the transaction.

Inherited from

Bkper.Transaction.getFiles

getId()

getId(): string;

Returns

string

The id of the Transaction.

Inherited from

Bkper.Transaction.getId

getInformedDate()

getInformedDate(): Date;

Returns

Date

The date the user informed for this transaction, adjusted to book’s time zone.

Inherited from

Bkper.Transaction.getInformedDate

getInformedDateText()

getInformedDateText(): string;

Returns

string

The date the user informed for this transaction, formatted according to the date pattern of [[Book]].

Inherited from

Bkper.Transaction.getInformedDateText

getInformedDateValue()

getInformedDateValue(): number;

Returns

number

The date numbe. The number format is YYYYMMDD.

Inherited from

Bkper.Transaction.getInformedDateValue

getOtherAccount()

getOtherAccount(account): Account;

Gets the [[Account]] at the other side of the transaction given the one in one side.

Parameters

ParameterType
accountstring | Account

Returns

Account

Inherited from

Bkper.Transaction.getOtherAccount

getOtherAccountName()

getOtherAccountName(account): string;

The account name at the other side of the transaction given the one in one side.

Parameters

ParameterType
accountstring | Account

Returns

string

Inherited from

Bkper.Transaction.getOtherAccountName

getPostDate()

getPostDate(): Date;

Returns

Date

The date time user has recorded/posted this transaction.

Inherited from

Bkper.Transaction.getPostDate

getPostDateText()

getPostDateText(): string;

Returns

string

The date time user has recorded/posted this transaction, formatted according to the date pattern of [[Book]].

Inherited from

Bkper.Transaction.getPostDateText

getProperties()

getProperties(): object;

Gets the custom properties stored in this resource.

Returns

object

Object with key/value pair properties

Inherited from

Bkper.Transaction.getProperties

getProperty()

getProperty(...keys): string;

Gets the property value for given keys. First property found will be retrieved.

Parameters

ParameterType
keysstring[]

Returns

string

The property value or null if not found

Inherited from

Bkper.Transaction.getProperty

getPropertyKeys()

getPropertyKeys(): string[];

Gets the custom properties keys stored in this resource.

Returns

string[]

Array of property keys sorted alphabetically

Inherited from

Bkper.Transaction.getPropertyKeys

getRemoteIds()

getRemoteIds(): string[];

Remote ids are used to avoid duplication.

Returns

string[]

The remote ids of the Transaction.

Inherited from

Bkper.Transaction.getRemoteIds

getStatus()

getStatus(): TransactionStatus;

Gets the status of the transaction.

The status is determined by precedence: TRASHED > DRAFT > CHECKED/UNCHECKED

Returns

TransactionStatus

The transaction status.

Inherited from

Bkper.Transaction.getStatus

getTags()

getTags(): string[];

Returns

string[]

All #hashtags used on the transaction.

Inherited from

Bkper.Transaction.getTags

getUrls()

getUrls(): string[];

Returns

string[]

All urls of the transaction.

Inherited from

Bkper.Transaction.getUrls

getVisibleProperties()

getVisibleProperties(): object;

Gets the visible custom properties stored in this resource. Hidden properties (those ending with ”_”) are excluded from the result.

Returns

object

Object with key/value pair properties, excluding hidden properties

Inherited from

Bkper.Transaction.getVisibleProperties

hasTag()

hasTag(tag): boolean;

Check if the transaction has the specified tag.

Parameters

ParameterType
tagstring

Returns

boolean

Inherited from

Bkper.Transaction.hasTag

isChecked()

isChecked(): boolean;

Returns

boolean

True if transaction is checked.

Inherited from

Bkper.Transaction.isChecked

isCredit()

isCredit(account): boolean;

Tell if the given account is credit on the transaction

Parameters

ParameterType
accountAccount

Returns

boolean

Inherited from

Bkper.Transaction.isCredit

isDebit()

isDebit(account): boolean;

Tell if the given account is debit on the transaction

Parameters

ParameterType
accountAccount

Returns

boolean

Inherited from

Bkper.Transaction.isDebit

isLocked()

isLocked(): boolean;

Returns

boolean

True if a transaction is locked by the book lock/closing date

Inherited from

Bkper.Transaction.isLocked

isPosted()

isPosted(): boolean;

Returns

boolean

True if transaction was already posted to the accounts. False if is still a Draft.

Inherited from

Bkper.Transaction.isPosted

isTrashed()

isTrashed(): boolean;

Returns

boolean

True if transaction is in trash.

Inherited from

Bkper.Transaction.isTrashed

json()

json(): Transaction;

Gets an immutable copy of the JSON payload for this resource.

Returns

Transaction

An immutable copy of the json payload

Inherited from

Bkper.Transaction.json

post()

post(): Transaction;

Perform post transaction, changing credit and debit [[Account]] balances.

Returns

Transaction

Inherited from

Bkper.Transaction.post

remove()

remove(): Transaction;

Remove the transaction, sending to trash.

Returns

Transaction

Inherited from

Bkper.Transaction.remove

restore()

restore(): Transaction;

Restore the transaction from trash.

Returns

Transaction

Inherited from

Bkper.Transaction.restore

setAmount()

setAmount(amount): Transaction;

Set the amount of the Transaction.

Parameters

ParameterType
amountstring | number | Amount

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.setAmount

setChecked()

setChecked(checked): Transaction;

Set the check state of the Transaction.

Parameters

ParameterType
checkedboolean

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.setChecked

setCreditAccount()

setCreditAccount(account): Transaction;

Set the credit/origin Account of the Transaction. Same as from().

Parameters

ParameterType
accountstring | Account

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.setCreditAccount

setDate()

setDate(date): Transaction;

Set the date of the Transaction.

Parameters

ParameterType
datestring | Date

Returns

Transaction

This Transaction, for chainning

Inherited from

Bkper.Transaction.setDate

setDebitAccount()

setDebitAccount(account): Transaction;

Set the debit/destination Account of the Transaction. Same as to().

Parameters

ParameterType
accountstring | Account

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.setDebitAccount

setDescription()

setDescription(description): Transaction;

Set the description of the Transaction.

Parameters

ParameterType
descriptionstring

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.setDescription

setProperties()

setProperties(properties): this;

Sets the custom properties of this resource.

Parameters

ParameterType
properties{ [key: string]: string; }

Returns

this

This resource, for chaining

Inherited from

Bkper.Transaction.setProperties

setProperty()

setProperty(key, value): this;

Sets a custom property in this resource.

Parameters

ParameterType
keystring
valuestring

Returns

this

This resource, for chaining

Inherited from

Bkper.Transaction.setProperty

setUrls()

setUrls(urls): Transaction;

Set the Transaction urls. Url starts with https://

Parameters

ParameterType
urlsstring[]

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.setUrls

setVisibleProperties()

setVisibleProperties(properties): this;

Sets the custom properties of this resource, filtering out hidden properties. Hidden properties are those whose keys end with an underscore ”_”.

Parameters

ParameterType
properties{ [key: string]: string; }

Returns

this

This resource, for chaining

Inherited from

Bkper.Transaction.setVisibleProperties

setVisibleProperty()

setVisibleProperty(key, value): this;

Sets a custom property in this resource, filtering out hidden properties. Hidden properties are those whose keys end with an underscore ”_”.

Parameters

ParameterType
keystring
valuestring | null

Returns

this

This resource, for chaining

Inherited from

Bkper.Transaction.setVisibleProperty

to()

to(account): Transaction;

Set the debit/destination Account of the Transaction. Same as setDebitAccount().

Parameters

ParameterType
accountstring | Account

Returns

Transaction

This Transaction, for chainning.

Inherited from

Bkper.Transaction.to

trash()

trash(): Transaction;

Perform trash transaction.

Returns

Transaction

Inherited from

Bkper.Transaction.trash

uncheck()

uncheck(): Transaction;

Perform uncheck transaction.

Returns

Transaction

Inherited from

Bkper.Transaction.uncheck

untrash()

untrash(): Transaction;

Perform untrash transaction.

Returns

Transaction

Inherited from

Bkper.Transaction.untrash

update()

update(): Transaction;

Upddate transaction, applying pending changes.

Returns

Transaction

Inherited from

Bkper.Transaction.update