Financial Assets¶
This page documents the Financial Assets domain within the Open Asset Model, which provides standardized representations for financial entities and transactions. The financial domain consists of two asset types: Account and FundsTransfer. These types enable modeling of financial accounts, account ownership, and monetary transfers between accounts.
For information about identity-related aspects of accounts (user authentication, access control), see Identifier Assets. For organizational ownership of financial accounts, see Organizational Assets.
Financial Asset Type Taxonomy¶
The financial domain contains two distinct asset types that model different aspects of financial systems:
graph TD
Asset["Asset Interface"]
Financial["Financial Domain"]
Account["Account<br/>model.Account"]
FundsTransfer["FundsTransfer<br/>model.FundsTransfer"]
Asset --> Financial
Financial --> Account
Financial --> FundsTransfer
Account -.relationships.-> FundsTransfer
Account -.relationships.-> Person["Person<br/>User/Owner"]
Account -.relationships.-> Organization["Organization<br/>Account Manager"]
FundsTransfer -.relationships.-> SenderAccount["Account<br/>Sender"]
FundsTransfer -.relationships.-> RecipientAccount["Account<br/>Recipient"]
Diagram: Financial Asset Types and Their Relationships
The two asset types serve complementary purposes: - Account: Represents a financial account entity managed by an organization - FundsTransfer: Represents a single monetary transfer transaction between accounts
Account Asset Type¶
The Account type represents financial accounts managed by organizations. It models account metadata including identifiers, types, ownership, and status information.
Structure Definition¶
classDiagram
class Account {
+string ID
+string Type
+string Username
+string Number
+float64 Balance
+bool Active
+Key() string
+AssetType() AssetType
+JSON() []byte, error
}
class Asset {
<<interface>>
+Key() string
+AssetType() AssetType
+JSON() []byte, error
}
Account ..|> Asset
Diagram: Account Struct Implementation
Field Specifications¶
| Field | JSON Key | Type | Required | Description |
|---|---|---|---|---|
ID |
unique_id |
string |
Yes | Unique identifier for the account; serves as the asset key |
Type |
account_type |
string |
Yes | Type classification of the account (e.g., "ACH", "checking", "savings") |
Username |
username |
string |
No | Username associated with the account for access |
Number |
account_number |
string |
No | Account number (e.g., bank account number) |
Balance |
balance |
float64 |
No | Current balance of the account |
Active |
active |
bool |
No | Whether the account is currently active |
All optional fields use the omitempty JSON tag and will be excluded from serialization when unset.
Asset Interface Implementation¶
The Account type implements the three required methods of the Asset interface:
Key() string - Returns the unique identifier for deduplication
AssetType() model.AssetType - Returns the constant model.Account
JSON() ([]byte, error) - Serializes the account to JSON
Intended Relationships¶
According to the inline documentation, Account assets are designed to support relationships with the following asset types:
- User: Links to
PersonorOrganizationassets representing the account owner or user - Funds Transfers: Links to
FundsTransferassets for incoming/outgoing transactions - IBAN and SWIFT Codes: Support for international banking identifiers (likely via
Identifierassets)
These relationship semantics are not enforced by the struct itself but are part of the model's intended usage patterns.
JSON Serialization Example¶
{
"unique_id": "222333444",
"account_type": "ACH",
"username": "test",
"account_number": "12345",
"balance": 42.5,
"active": true
}
FundsTransfer Asset Type¶
The FundsTransfer type represents a single monetary transfer transaction between two financial accounts. It captures transaction metadata including amounts, currencies, exchange rates, and reference numbers.
Structure Definition¶
classDiagram
class FundsTransfer {
+string ID
+float64 Amount
+string ReferenceNumber
+string Currency
+string Method
+string ExchangeDate
+float64 ExchangeRate
+Key() string
+AssetType() AssetType
+JSON() []byte, error
}
class Asset {
<<interface>>
+Key() string
+AssetType() AssetType
+JSON() []byte, error
}
FundsTransfer ..|> Asset
Diagram: FundsTransfer Struct Implementation
Field Specifications¶
| Field | JSON Key | Type | Required | Description |
|---|---|---|---|---|
ID |
unique_id |
string |
Yes | Unique identifier for the transfer; serves as the asset key |
Amount |
amount |
float64 |
Yes | Monetary amount of the transfer |
ReferenceNumber |
reference_number |
string |
No | Reference or tracking number for the transaction |
Currency |
currency |
string |
No | Currency code for the transfer (e.g., "USD", "EUR") |
Method |
transfer_method |
string |
No | Transfer method or mechanism (e.g., "ACH", "wire", "SWIFT") |
ExchangeDate |
exchange_date |
string |
No | Date/time of currency exchange (ISO 8601 format) |
ExchangeRate |
exchange_rate |
float64 |
No | Exchange rate applied if currency conversion occurred |
All optional fields use the omitempty JSON tag.
Asset Interface Implementation¶
The FundsTransfer type implements the three required methods of the Asset interface:
Key() string - Returns the unique identifier
AssetType() model.AssetType - Returns the constant model.FundsTransfer
JSON() ([]byte, error) - Serializes the transfer to JSON
Intended Relationships¶
According to the inline documentation, FundsTransfer assets are designed to support relationships with:
- Sender Financial Account: Links to an
Accountasset representing the source account - Recipient Financial Account: Links to an
Accountasset representing the destination account - IBIN and SWIFT Codes: Support for international banking transaction codes (likely via
Identifierassets)
These relationships enable modeling of the complete transaction flow between accounts.
JSON Serialization Example¶
{
"unique_id": "222333444",
"amount": 42,
"reference_number": "555666777",
"currency": "US",
"transfer_method": "ACH",
"exchange_date": "2013-07-24T14:15:00Z",
"exchange_rate": 0.9
}
Interface Compliance and Testing¶
Both financial asset types undergo rigorous testing to ensure proper implementation of the Asset interface.
Compile-Time Interface Verification¶
Both asset types use Go's type assertion pattern to verify interface compliance at compile time:
// From account_test.go
var _ model.Asset = Account{} // Value receiver
var _ model.Asset = (*Account)(nil) // Pointer receiver
// From funds_transfer_test.go
var _ model.Asset = FundsTransfer{} // Value receiver
var _ model.Asset = (*FundsTransfer)(nil) // Pointer receiver
This pattern ensures that any interface method signature changes will cause compilation failures, catching breaking changes immediately.
Method Behavior Tests¶
Each asset type has dedicated tests validating:
- Key() method: Verifies the correct field is returned as the unique identifier
- AssetType() method: Confirms the correct
AssetTypeconstant is returned - JSON() method: Validates serialization produces expected JSON with correct field names and
omitemptybehavior
graph LR
TestSuite["Test Suite"]
KeyTest["TestAccountKey()<br/>TestFundsTransferKey()"]
TypeTest["TestAccountAssetType()<br/>TestFundsTransferAssetType()"]
JSONTest["TestAccountJSON()<br/>TestFundsTransferJSON()"]
TestSuite --> KeyTest
TestSuite --> TypeTest
TestSuite --> JSONTest
KeyTest -.verifies.-> IDField["ID field returned<br/>as unique key"]
TypeTest -.verifies.-> Constant["Correct AssetType<br/>constant returned"]
JSONTest -.verifies.-> Serialization["JSON serialization<br/>with proper tags"]
Diagram: Financial Asset Test Coverage
Package Organization¶
The financial domain assets are organized across two packages:
graph TB
CorePkg["github.com/owasp-amass/open-asset-model<br/>Core Package"]
AccountPkg["account package<br/>account/account.go"]
FinancialPkg["financial package<br/>financial/funds_transfer.go"]
AssetInterface["Asset interface<br/>AssetType constants"]
AccountStruct["Account struct<br/>implements Asset"]
FundsTransferStruct["FundsTransfer struct<br/>implements Asset"]
CorePkg --> AssetInterface
AccountPkg --> AccountStruct
FinancialPkg --> FundsTransferStruct
AccountStruct -.implements.-> AssetInterface
FundsTransferStruct -.implements.-> AssetInterface
Diagram: Financial Asset Package Structure
Import Pattern¶
Both packages follow the same import pattern:
This imports the core package as model, providing access to:
- The Asset interface definition
- The AssetType enumeration constants (model.Account, model.FundsTransfer)
Usage Examples¶
Creating Account Assets¶
account := account.Account{
ID: "acct-123456",
Type: "checking",
Username: "john.doe",
Number: "9876543210",
Balance: 1250.50,
Active: true,
}
key := account.Key() // "acct-123456"
assetType := account.AssetType() // model.Account
jsonBytes, _ := account.JSON()
Creating FundsTransfer Assets¶
transfer := financial.FundsTransfer{
ID: "txn-789012",
Amount: 250.00,
ReferenceNumber: "ref-456789",
Currency: "USD",
Method: "ACH",
ExchangeDate: "2025-01-15T10:30:00Z",
ExchangeRate: 1.0,
}
key := transfer.Key() // "txn-789012"
assetType := transfer.AssetType() // model.FundsTransfer
jsonBytes, _ := transfer.JSON()
Relationship Integration¶
While relationship validation is defined elsewhere in the model (see Relationship System), the financial assets are designed to participate in specific relationship patterns:
graph TD
Person["Person Asset<br/>Account Owner"]
Org["Organization Asset<br/>Financial Institution"]
Account1["Account Asset<br/>Checking Account"]
Account2["Account Asset<br/>Savings Account"]
Transfer["FundsTransfer Asset<br/>Transaction"]
IdentIBAN["Identifier Asset<br/>IBAN Code"]
Person -.owner.-> Account1
Org -.manages.-> Account1
Org -.manages.-> Account2
Account1 -.sender.-> Transfer
Account2 -.recipient.-> Transfer
Account1 -.identified_by.-> IdentIBAN
Diagram: Financial Asset Relationship Patterns
The relationship taxonomy for financial assets would be defined in the core model's relationship validation functions (see Relationship Taxonomy).