Skip to content

TheM.accounts Reference

Constructor

The parent TheM class contains functionality enabling the initialization of any TheM subclass or submodule instance by simply calling TheM.doInit('subclassName'), where the input string is a case sensitive space-delimited string containing the names of all submodules that may be required in the current session. Most TheM subclasses also require the 'common' submodule. It is common to initialize the target submodule and any other submodule dependencies concurrently. The following example will initialize a new instance of the necessary submodules using a proxy constructor in TheM parent class.

TheM.doInit('subclassName1 subclassName2 subclassName3 etc');

Example

TheM.doInit('common user accounts cards genericRequests');

Properties

Property table for TheM.accounts

Property Description Required Schema
all Gets (returns) an array with all the accounts associated with the user that are not closed or hidden. Yes {
  "title": "TheM.accounts.all",
  "type": "array",
  "description": "Gets (returns) an array with all
the accounts associated with the user that are not
closed or hidden.",
  "$comment": "getter",
  "examples": [
    [
      {
        "AFiCardId": "testgalx8wfq4sqfgb",
        "backOfficeId": "connectFiBOIS",
        "backOfficeName": "connectFiBOIS",
        "currency": "USD",
        "isClosed": false,
        "lastDepositAmount": 0,
        "rn": "123456789",
        "status": "Card was issued but has not yet been
activated",
        "type": "Current",
        "AFiAccountId": "testgalx8wfq4sqfgb",
        "AFiUserId": "testaurlx8wfimcrw",
        "balance": {
          "available": 10,
          "currency": "USD",
          "native": 10,
          "toJSON": {
            "available": 10,
            "currency": "USD",
            "native": 10
          }
        },
        "card": {},
        "cards": [
          {}
        ],
        "dtsOpened": "Mon Jun 10 2024 07:37:54 GMT-0400
(Eastern Daylight Time)",
        "dtsUpdated": "Wed Jun 12 2024 12:06:30 GMT-0400
(Eastern Daylight Time)",
        "fullName": "Main account",
        "id": "testgalx8wfq4sqfgb",
        "isActive": false,
        "isHidden": false,
        "isMain": false,
        "name": "Main account",
        "num": "1000000123456789",
        "primaryUserAFiUserId": "testaurlx8wfimcrw",
        "transactions": [
          {
            "AFiAccountId": "testgalx8wfq4sqfgb",
            "AFiUserId": "testaurlx8wfimcrw",
            "arn": "0000000000000006LBor",
            "dtsAtMerchant": "Mon Jun 10 2024 07:37:55
GMT-0400 (Eastern Daylight Time)",
            "dtsRecorded": "Mon Jun 10 2024 07:38:51 GMT-0400
(Eastern Daylight Time)",
            "fee": 0,
            "internal": {},
            "is3DSecure": false,
            "isComplete": true,
            "isDigitalWalletTrans": false,
            "isPaymentTrans": true,
            "isRecurring": false,
            "reference": "testrr8wgyjgssximb",
            "transactionIdBO": "F2167329415",
            "transactionState": "complete",
            "typeName": "",
            "amount": 10,
            "attachments": {},
            "attachmentsArray": [],
            "credit": 10,
            "currency": "USD",
            "debit": 0,
            "dtsBooked": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
            "dtsValue": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
            "isBlacklistable": false,
            "isWhitelistable": false,
            "narrative": "🎁 Welcome bonus",
            "newBalance": null,
            "transactionId":
"dcuosrklcjxpyzxagroxbbrspacuhiecwfzltzke",
            "txnType": "credit",
            "toJSON": {}
          }
        ],
        "typeId": "Standard",
        "toJSON": {}
      }
    ]
  ],
  "nullable": false
}
allTransactions Gets (returns) an array with all the transactions across all of the user's accounts. Yes {
  "title": "TheM.accounts.allTransactions",
  "type": "array",
  "description": "Gets (returns) an array with all
the transactions across all of the user's
accounts.",
  "$comment": "getter",
  "examples": [
    [
      {
        "AFiAccountId": "testgalx8wfq4sqfgb",
        "AFiUserId": "testaurlx8wfimcrw",
        "arn": "0000000000000006LBor",
        "dtsAtMerchant": "Mon Jun 10 2024 07:37:55
GMT-0400 (Eastern Daylight Time)",
        "dtsRecorded": "Mon Jun 10 2024 07:38:51 GMT-0400
(Eastern Daylight Time)",
        "fee": 0,
        "internal": {},
        "is3DSecure": false,
        "isComplete": true,
        "isDigitalWalletTrans": false,
        "isPaymentTrans": true,
        "isRecurring": false,
        "reference": "testrr8wgyjgssximb",
        "transactionIdBO": "F2167329415",
        "transactionState": "complete",
        "typeName": "",
        "amount": 10,
        "attachments": {},
        "attachmentsArray": [],
        "credit": 10,
        "currency": "USD",
        "debit": 0,
        "dtsBooked": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
        "dtsValue": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
        "isBlacklistable": false,
        "isWhitelistable": false,
        "narrative": "🎁 Welcome bonus",
        "newBalance": null,
        "transactionId":
"dcuosrklcjxpyzxagroxbbrspacuhiecwfzltzke",
        "txnType": "credit",
        "toJSON": {}
      }
    ]
  ],
  "nullable": false
}
length Gets (returns) the length of the accounts array. Yes {
  "title": "TheM.accounts.length",
  "type": "number",
  "description": "Gets (returns) the length of the
accounts array.",
  "examples": [
    1
  ],
  "default": 0,
  "nullable": false
}
main Gets (returns) the instance of the Account class representing the main or first account associated with the user. Yes {
  "title": "TheM.accounts.main",
  "type": "object",
  "description": "Gets (returns) the instance of the
Account class representing the main or first
account associated with the user.",
  "$comment": "getter",
  "examples": [
    {
      "AFiCardId": "testgalx8wfq4sqfgb",
      "backOfficeId": "connectFiBOIS",
      "backOfficeName": "connectFiBOIS",
      "currency": "USD",
      "isClosed": false,
      "lastDepositAmount": 0,
      "rn": "123456789",
      "status": "Card was issued but has not yet been
activated",
      "type": "Current",
      "AFiAccountId": "testgalx8wfq4sqfgb",
      "AFiUserId": "testaurlx8wfimcrw",
      "balance": {
        "available": 10,
        "currency": "USD",
        "native": 10,
        "toJSON": {
          "available": 10,
          "currency": "USD",
          "native": 10
        }
      },
      "card": {},
      "cards": [
        {}
      ],
      "dtsOpened": "Mon Jun 10 2024 07:37:54 GMT-0400
(Eastern Daylight Time)",
      "dtsUpdated": "Wed Jun 12 2024 12:06:30 GMT-0400
(Eastern Daylight Time)",
      "fullName": "Main account",
      "id": "testgalx8wfq4sqfgb",
      "isActive": false,
      "isHidden": false,
      "isMain": false,
      "name": "Main account",
      "num": "1000000123456789",
      "primaryUserAFiUserId": "testaurlx8wfimcrw",
      "transactions": [
        {
          "AFiAccountId": "testgalx8wfq4sqfgb",
          "AFiUserId": "testaurlx8wfimcrw",
          "arn": "0000000000000006LBor",
          "dtsAtMerchant": "Mon Jun 10 2024 07:37:55
GMT-0400 (Eastern Daylight Time)",
          "dtsRecorded": "Mon Jun 10 2024 07:38:51 GMT-0400
(Eastern Daylight Time)",
          "fee": 0,
          "internal": {},
          "is3DSecure": false,
          "isComplete": true,
          "isDigitalWalletTrans": false,
          "isPaymentTrans": true,
          "isRecurring": false,
          "reference": "testrr8wgyjgssximb",
          "transactionIdBO": "F2167329415",
          "transactionState": "complete",
          "typeName": "",
          "amount": 10,
          "attachments": {},
          "attachmentsArray": [],
          "credit": 10,
          "currency": "USD",
          "debit": 0,
          "dtsBooked": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
          "dtsValue": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
          "isBlacklistable": false,
          "isWhitelistable": false,
          "narrative": "🎁 Welcome bonus",
          "newBalance": null,
          "transactionId":
"dcuosrklcjxpyzxagroxbbrspacuhiecwfzltzke",
          "txnType": "credit",
          "toJSON": {}
        }
      ],
      "typeId": "Standard",
      "toJSON": {}
    }
  ],
  "nullable": false
}
isReady Gets (returns) or sets true if TheM.accounts is fully ready. When setting isReady true for the first time, a(n) 'TheM.accounts ready' event is also triggered. Yes {
  "title": "TheM.accounts.isReady",
  "type": "boolean",
  "description": "Gets (returns) or sets true if
TheM.accounts is fully ready. When setting isReady
true for the first time, a(n) 'TheM.accounts ready'
event is also triggered.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ],
  "default": false,
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doSave
[]
Saves accounts data in local storage. Normally, there is no need to use this method as the framework knows automatically when to save and when to load the data to and from local storage. Returns true. TheM.accounts.doSave();
doLoad
[]
Loads accounts data from local storage and returns a boolean value to indicate success. Normally, there is no need to use this method as the framework knows automatically when to save and when to load the data to and from local storage. TheM.accounts.doLoad();
doUpdate
[
{
"title": "given",
"type": "boolean",
"nullable": true,
"example": true,
"$comment": "Forces framework to
pull fresh data from server if
true."
}
]
Causes framework to pull fresh accounts data from the server. If the data is fresh enough, meaning an update has happened recently, the framework will ignore the suggestion. However, you can force the framework to update the data by sending true as an argument. On success, a(n) 'modelBank accounts refreshed' event will occur. TheM.accounts.doUpdate(true);
doUpdateAllTransactions
[
{
"title": "givenParams",
"type": "object",
"nullable": true,
"properties": {
"days": {
"title": "days",
"type": "number",
"nullable": true,
"example": 5
},
"dateStart": {
"title": "dateStart",
"type": "Date",
"nullable": true,
"example": "Thu Jan 01 1981
00:00:00 GMT-0500 (Eastern
Standard Time)"
},
"dateEnd": {
"title": "dateEnd",
"type": "Date",
"nullable": true,
"example": "Thu Jan 01 2099
00:00:00 GMT-0500 (Eastern
Standard Time)"
},
"force": {
"title": "force",
"type": "boolean",
"nullable": true,
"example": true
}
},
"example": {
"days": 5,
"force": true
}
}
]
Pulls fresh transaction data from the server. If present, the days parameter will be used to determine the start date for the transactions to pull (i.e. a days value of 5 would represent a start date 5 days prior to the current date). Alternatively, the date range can be specified using the dateStart and dateEnd parameters. If no dates or are specified, then the last 90 days of transaction data will be pulled. If the data is fresh enough, an update request will be ignored. It is possible to force an update by passing the force: true parameter, or by simply passing true in lieu of the givenParams object. TheM.accounts.doUpdateAllTransactions(
  {
   "days": 5,
   "force": true
  }
);
account
[
{
"title": "givenAccountId",
"type": "string",
"nullable": false,
"example":
"testgalx8wfq4sqfgb"
}
]
Returns the account associated with the user specified by the givenAccountId, if a match exists. TheM.accounts.account("testgalx8wfq4sqfgb");
forTypeIds
[
{
"title": "givenTypes",
"type": "string",
"nullable": true,
"example": "Standard"
}
]
Returns a list of accounts that match the given typeIds. The givenTypes parameter can be an array of string typeIds or a single string containing one or more typeIds. TheM.accounts.forTypeIds("Standard");
forUser
[
{
"title": "givenAFiUserId",
"type": "string",
"nullable": false,
"example": "testaurlx8wfimcrw"
},
{
"title":
"accountTypeIdsToInclude",
"type": "string",
"nullable": true,
"example": "Standard"
},
{
"title": "isShowHidden",
"type": "boolean",
"nullable": true,
"example": true
}
]
Returns a list of accounts that are associated with the current user and that match the given user ID (givenAFiUserId) and typeIds (accountTypeIdsToInclude). If givenAFiUserId is not included, then an empty array is returned. The accountTypeIdsToInclude parameter can be an array of string typeIds or a single string containing one or more typeIds. Include the isShowHidden parameter to specify whether to include hidden accounts (default is true). TheM.accounts.forUser("testaurlx8wfimcrw","Standard",true);
filtered
[
{
"title": "givenParams",
"type": "object",
"nullable": true,
"example": {
"isActive": true,
"isHidden": false,
"name": "Main account",
"typeId": "Standard"
}
}
]
This method accepts an object, givenParams, containing filter criteria (key:value pairs where key is an account property) and then returns an array of accounts with properties matching the given criteria. If no givenParams are included, then an unfiltered account list is returned. TheM.accounts.filtered(
  {
   "isActive": true,
   "isHidden": false,
   "name": "Main account",
   "typeId": "Standard"
  }
);

Submodules

Submodule Name Link
Account Account Reference
Balance Balance Reference
Transaction Transaction Reference