Skip to content

Account Reference

Constructor

The accounts array can contain multiple instances of the Account class. TheM.accounts[0] refers to the first account belonging to the user. If multiple accounts exist, TheM.accounts[0] could be replaced by TheM.accounts[1], TheM.accounts[2], etc. Alternatively, you could reference the account based on the AFiAccountId, replacing TheM.accounts[0] with TheM.accounts['PUT_AFiAccountId_HERE'] or TheM.accounts.account('PUT_AFiAccountId_HERE').

A new instance of the Account class is initialized when a modelBank accounts pushed or modelBank cards and accounts pushed event occurs. The Account class is extendable and an Account instance may be segment specific. For each Account instance, there is an associated Balance instance, Card instance(s), and a transactions array containing Transaction instances, if any exist. An account may have 0, 1, or multiple associated card instances, depending on configurations and card/account issuer. The properties and methods of the Account class can be referenced by specifying the account, followed by the property or method name, like TheM.accounts['PUT_AFiAccountId_HERE'].AFiAccountId

//A new instance of the Account class is instantiated automatically when a new account is added via a generic request. Accounts can be personal or corporate and may vary based on segment or client configurations

const newAccount = TheM.genericRequests.get('NAME_OF_GENERIC_REQUEST_TO_ADD_ACCOUNT', {
  //properties required by the specified generic request in order to add account
});

Example

const newAccount = TheM.genericRequests.get('NAME_OF_GENERIC_REQUEST_TO_ADD_ACCOUNT', {
  AFiUserId: 'PUT_AFiUserId_HERE',
  backOfficeId: 'connectFiBOIS',
  payload: {
    name: 'Secondary account',
    currency: 'USD',
    type: 'Current',
    typeId: 'Standard',
    primaryUserAFiUserId: 'PUT_AFiUserId_HERE',
    cardData: {
      firstName: TheM.user.firstName,
      middleName: TheM.user.middleName,
      lastName: TheM.user.lastName,
      typeId: 'Standard',
    }
  }
});

Properties

Property table for Account

Property Description Required Schema
AFiAccountId Gets (returns) the account ID in ampliFi. Yes {
  "title": "TheM.accounts[0].AFiAccountId",
  "type": "string",
  "description": "Gets (returns) the account ID in
ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
id Gets (returns) AFiAccountId, the account ID in ampliFi. Yes {
  "title": "TheM.accounts[0].id",
  "type": "string",
  "description": "Gets (returns) AFiAccountId, the
account ID in ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
AFiCardId Gets (returns) the card ID associated with this account in ampliFi. Yes {
  "title": "TheM.accounts[0].AFiCardId",
  "type": "string",
  "description": "Gets (returns) the card ID
associated with this account in ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
AFiUserId Gets (returns) the user ID in ampliFi. Yes {
  "title": "TheM.accounts[0].AFiUserId",
  "type": "string",
  "description": "Gets (returns) the user ID in
ampliFi.",
  "examples": [
    "testaurlx8wfimcrw"
  ],
  "nullable": false
}
primaryUserAFiUserId Gets (returns) the user ID for the primary account user - primaryUserAFiUserId (if it is defined) or AFiUserId (if primaryUserAFiUserId is undefined). For example, the account may belong to a parent, but was intended to be used by a teen. No {
  "title":
"TheM.accounts[0].primaryUserAFiUserId",
  "type": "string",
  "description": "Gets (returns) the user ID for the
primary account user - primaryUserAFiUserId (if it
is defined) or AFiUserId (if primaryUserAFiUserId
is undefined). For example, the account may belong
to a parent, but was intended to be used by a teen.",
  "examples": [
    "testaurlx8wfimcrw"
  ],
  "nullable": true
}
backOfficeId Gets the back-office ID associated with this account. Yes {
  "title": "TheM.accounts[0].backOfficeId",
  "type": "string",
  "description": "Gets the back-office ID
associated with this account.",
  "examples": [
    "connectFiBOIS"
  ],
  "nullable": false
}
backOfficeName Gets (returns) the name of the back-office associated with this account. Yes {
  "title": "TheM.accounts[0].backOfficeName",
  "type": "string",
  "description": "Gets (returns) the name of the
back-office associated with this account.",
  "examples": [
    "connectFiBOIS"
  ],
  "nullable": false
}
balance Gets (returns) the instance of the Balance class (as an object) for the current account. Yes {
  "title": "TheM.accounts[0].balance",
  "type": "object",
  "description": "Gets (returns) the instance of the
Balance class (as an object) for the current
account.",
  "examples": [
    {
      "available": 10,
      "currency": "USD",
      "native": 10,
      "toJSON": {
        "available": 10,
        "currency": "USD",
        "native": 10
      }
    }
  ],
  "nullable": false
}
card Gets (returns) the instance of the Card class (as an object) associated with the card for this account. Yes {
  "title": "TheM.accounts[0].card",
  "type": "object",
  "description": "Gets (returns) the instance of the
Card class (as an object) associated with the card
for this account.",
  "examples": [
    {
      "accountIdBO": "icrd_6OWyxZDBXjteYnRwZjp9HY",
      "backOfficeId": "connectFiBOIS",
      "backOfficeName": "connectFiBOIS",
      "isActivated": false,
      "isOfflinePinTryLimitExceeded": null,
      "name_on_card": "SUZY QUEUE TESTER",
      "primaryUserAFiUserId": null,
      "status": "Card was issued but has not yet been
activated",
      "AFiAccountId": "testgalx8wfq4sqfgb",
      "AFiCardId": "testgalx8wfq4sqfgb",
      "AFiUserId": "testaurlx8wfimcrw",
      "dtsOpened": "Mon Jun 10 2024 07:37:54 GMT-0400
(Eastern Daylight Time)",
      "dtsUpdated": "Mon Jun 17 2024 08:34:01 GMT-0400
(Eastern Daylight Time)",
      "id": "testgalx8wfq4sqfgb",
      "image": "ibiscard",
      "isActivating": false,
      "isActive": false,
      "isClosed": false,
      "isHidden": false,
      "isToggling": false,
      "name": "Main account",
      "num": "9999..6789",
      "numMasked": "9999...6789",
      "typeId": "Standard",
      "usageRestrictions": {
        "allowedMCCs": {},
        "dayOfWeek": {
          "0": true,
          "1": true,
          "2": true,
          "3": true,
          "4": true,
          "5": true,
          "6": true
        },
        "restrictedMCCs": {},
        "timesOfDay": {
          "am6pm12": true,
          "pm12pm9": true,
          "pm9am6": true
        },
        "transactionTypes": {
          "offline": true,
          "online": true,
          "cashout": true,
          "cashin": true
        }
      },
      "account": {},
      "toJSON": {}
    }
  ],
  "nullable": false
}
cards Gets (returns) an array of all the cards associated with this account. No {
  "title": "TheM.accounts[0].cards",
  "type": "array",
  "description": "Gets (returns) an array of all the
cards associated with this account.",
  "examples": [
    [
      {
        "accountIdBO": "icrd_6OWyxZDBXjteYnRwZjp9HY",
        "backOfficeId": "connectFiBOIS",
        "backOfficeName": "connectFiBOIS",
        "isActivated": false,
        "isOfflinePinTryLimitExceeded": null,
        "name_on_card": "SUZY QUEUE TESTER",
        "primaryUserAFiUserId": null,
        "status": "Card was issued but has not yet been
activated",
        "AFiAccountId": "testgalx8wfq4sqfgb",
        "AFiCardId": "testgalx8wfq4sqfgb",
        "AFiUserId": "testaurlx8wfimcrw",
        "dtsOpened": "Mon Jun 10 2024 07:37:54 GMT-0400
(Eastern Daylight Time)",
        "dtsUpdated": "Mon Jun 17 2024 08:34:01 GMT-0400
(Eastern Daylight Time)",
        "id": "testgalx8wfq4sqfgb",
        "image": "ibiscard",
        "isActivating": false,
        "isActive": false,
        "isClosed": false,
        "isHidden": false,
        "isToggling": false,
        "name": "Main account",
        "num": "9999..6789",
        "numMasked": "9999...6789",
        "typeId": "Standard",
        "usageRestrictions": {
          "allowedMCCs": {},
          "dayOfWeek": {
            "0": true,
            "1": true,
            "2": true,
            "3": true,
            "4": true,
            "5": true,
            "6": true
          },
          "restrictedMCCs": {},
          "timesOfDay": {
            "am6pm12": true,
            "pm12pm9": true,
            "pm9am6": true
          },
          "transactionTypes": {
            "offline": true,
            "online": true,
            "cashout": true,
            "cashin": true
          }
        },
        "account": {},
        "toJSON": {}
      }
    ]
  ],
  "default": []
}
num Gets (returns) the account number. Yes {
  "title": "TheM.accounts[0].num",
  "type": "string",
  "description": "Gets (returns) the account
number.",
  "examples": [
    "1000000123456789"
  ],
  "nullable": false
}
rn Gets (returns) the 9 digit routing number for the account. Yes {
  "title": "TheM.accounts[0].rn",
  "type": "string",
  "description": "Gets (returns) the 9 digit routing
number for the account.",
  "examples": [
    "123456789"
  ],
  "nullable": false
}
currency Gets (returns) the 3 character currency code. No {
  "title": "TheM.accounts[0].currency",
  "type": "string",
  "description": "Gets (returns) the 3 character
currency code.",
  "examples": [
    "USD",
    "EUR",
    "KZT",
    "JPY",
    "GBP"
  ],
  "default": "USD"
}
status Gets (returns) the status of the account. No {
  "title": "TheM.accounts[0].status",
  "type": "string",
  "description": "Gets (returns) the status of the
account.",
  "examples": [
    "Card was issued but has not yet been activated",
    "Open - All Transactions Allowed",
    "Inactive"
  ],
  "default": "Card was issued but has not yet been
activated"
}
imageBase64 Gets (returns) or sets the image associated with the account in base 64 format. No {
  "title": "TheM.accounts[0].imageBase64",
  "type": "string",
  "description": "Gets (returns) or sets the image
associated with the account in base 64 format.",
  "examples": [
    "VeryLongBase64ImageString"
  ],
  "nullable": true
}
transactions Gets (returns) an array of the most recent transactions for this account. Each transaction, if any exist, is an instance of the Transaction class. No {
  "title": "TheM.accounts[0].transactions",
  "type": "array",
  "description": "Gets (returns) an array of the most
recent transactions for this account. Each
transaction, if any exist, is an instance of the
Transaction class.",
  "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": {}
      }
    ]
  ],
  "default": []
}
transactions.all Gets (returns) an array with all the transactions available locally, unfiltered. No {
  "title": "TheM.accounts[0].transactions.all",
  "type": "array",
  "description": "Gets (returns) an array with all
the transactions available locally,
unfiltered.",
  "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": {}
      }
    ]
  ],
  "default": []
}
transactions.filterStart Gets (returns) or sets the start date for the transaction filter. Yes {
  "title":
"TheM.accounts[0].transactions.filterStart",
  "type": "Date",
  "description": "Gets (returns) or sets the start
date for the transaction filter.",
  "examples": [
    "Thu Jan 01 1981 00:00:00 GMT-0500 (Eastern
Standard Time)"
  ],
  "nullable": false
}
transactions.filterEnd Gets (returns) or sets the ending date for the transaction filter. Yes {
  "title":
"TheM.accounts[0].transactions.filterEnd",
  "type": "Date",
  "description": "Gets (returns) or sets the ending
date for the transaction filter.",
  "examples": [
    "Thu Jan 01 2099 00:00:00 GMT-0500 (Eastern
Standard Time)"
  ],
  "nullable": false
}
transactions.excludedTxnTypes Gets (returns) or sets an array of typeId strings. All the transactions with a typeId matching one of the included typeIds will be filtered out when calling TheM.accounts['PUT_AFiAccountId_HERE'].transactions.filtered. No {
  "title":
"TheM.accounts[0].transactions.excludedTxnTyp
es",
  "type": "array",
  "description": "Gets (returns) or sets an array of
typeId strings. All the transactions with a typeId
matching one of the included typeIds will be
filtered out when calling
TheM.accounts['PUT_AFiAccountId_HERE'].transa
ctions.filtered.",
  "examples": [
    [
      "Standard"
    ]
  ],
  "default": []
}
transactions.filtered Gets (returns) an array with transactions occurring between the filterStart and filterEnd dates, excluding transactions with a typeId contained in the excludedTxnTypes array. No {
  "title":
"TheM.accounts[0].transactions.filtered",
  "type": "array",
  "description": "Gets (returns) an array with
transactions occurring between the filterStart
and filterEnd dates, excluding transactions
with a typeId contained in the excludedTxnTypes
array.",
  "examples": [
    []
  ],
  "default": []
}
transactions.isWorking Gets (returns) true if account transactions are being pulled from the server now. No {
  "title":
"TheM.accounts[0].transactions.isWorking",
  "type": "boolean",
  "description": "Gets (returns) true if account
transactions are being pulled from the server
now.",
  "examples": [
    true,
    false
  ],
  "default": false
}
transactions.dtsUpdated Gets (returns) the date the transactions array was last updated. Yes {
  "title":
"TheM.accounts[0].transactions.dtsUpdated",
  "type": "Date",
  "description": "Gets (returns) the date the
transactions array was last updated.",
  "examples": [
    "Wed Jun 12 2024 11:19:36 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}
name Gets (returns) or sets a name for the account, up to 128 characters. If no name is defined, will return the typeName if applicable. No {
  "title": "TheM.accounts[0].name",
  "type": "string",
  "description": "Gets (returns) or sets a name for
the account, up to 128 characters. If no name is
defined, will return the typeName if applicable.",
  "examples": [
    "Personal checking"
  ],
  "nullable": true
}
fullName Gets (returns) fullName. If fullName is undefined, it will return the next defined property out of the following: name or typeName, followed by a space and TheM.family[primaryUserAFiUserId].firstName, if it is defined. No {
  "title": "TheM.accounts[0].fullName",
  "type": "string",
  "description": "Gets (returns) fullName. If
fullName is undefined, it will return the next
defined property out of the following: name or
typeName, followed by a space and
TheM.family[primaryUserAFiUserId].firstName
, if it is defined.",
  "examples": [
    "Main account",
    "Personal Checking Suzy"
  ],
  "default": "Main account"
}
type Gets (returns) the type of account. No {
  "title": "TheM.accounts[0].type",
  "type": "string",
  "description": "Gets (returns) the type of
account.",
  "examples": [
    "Current"
  ],
  "default": "Current"
}
typeId Gets (returns) an identifier representing the type of account. No {
  "title": "TheM.accounts[0].typeId",
  "type": "string",
  "description": "Gets (returns) an identifier
representing the type of account.",
  "examples": [
    "Standard",
    "default",
    "goalAccount",
    "simulatedCreditCard",
    "teenCurrent",
    "505",
    "2007",
    "2008",
    "virtual",
    "FLW_CHECKING"
  ],
  "default": "default"
}
typeName Gets (returns) a string description of the account type. This field can be shown to the customer. No {
  "title": "TheM.accounts[0].typeName",
  "type": "string",
  "description": "Gets (returns) a string
description of the account type. This field can be
shown to the customer.",
  "examples": [
    ""
  ],
  "nullable": true
}
lastDepositAmount Gets (returns) the lastDepositAmount, if present. No {
  "title":
"TheM.accounts[0].lastDepositAmount",
  "type": "number",
  "description": "Gets (returns) the
lastDepositAmount, if present.",
  "examples": [
    0
  ],
  "nullable": true
}
toJSON Gets (returns) the Account properties in a JSON formatted object. Yes {
  "title": "TheM.accounts[0].toJSON",
  "type": "object",
  "description": "Gets (returns) the Account
properties in a JSON formatted object.",
  "examples": [
    {
      "AFiAccountId": "testgalx8wfq4sqfgb",
      "AFiUserId": "testaurlx8wfimcrw",
      "balance": {
        "available": 10,
        "native": 10,
        "currency": "USD"
      },
      "dtsOpened": "Mon Jun 10 2024 07:37:54 GMT-0400
(Eastern Daylight Time)",
      "dtsUpdated": "Wed Jun 12 2024 08:47:17 GMT-0400
(Eastern Daylight Time)",
      "isActive": false,
      "isHidden": false,
      "name": "Main account",
      "num": "1000000123456789",
      "transactions": [
        {}
      ],
      "typeId": "Standard"
    }
  ],
  "nullable": false
}
isActive Gets (returns) true if the account is currently active and ready for transactions. No {
  "title": "TheM.accounts[0].isActive",
  "type": "boolean",
  "description": "Gets (returns) true if the account
is currently active and ready for transactions.",
  "examples": [
    true,
    false
  ],
  "default": true
}
isClosed Gets (returns) true if the account has been closed. No {
  "title": "TheM.accounts[0].isClosed",
  "type": "boolean",
  "description": "Gets (returns) true if the account
has been closed.",
  "examples": [
    true,
    false
  ],
  "nullable": true
}
isHidden Gets (returns) or sets whether the sensitive account information is hidden. Will return true if the user has requested not to display this account prominently. Hidden accounts should not be visible to the customer at the main screen and should require an effort to get to. No {
  "title": "TheM.accounts[0].isHidden",
  "type": "boolean",
  "description": "Gets (returns) or sets whether the
sensitive account information is hidden. Will
return true if the user has requested not to
display this account prominently. Hidden accounts
should not be visible to the customer at the main
screen and should require an effort to get to.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isMain Gets (returns) the isMain flag. The isMain flag is deprecated and will return false. No {
  "title": "TheM.accounts[0].isMain",
  "type": "boolean",
  "description": "Gets (returns) the isMain flag.
The isMain flag is deprecated and will return
false.",
  "examples": [
    false
  ],
  "default": false
}
dtsOpened Gets (returns) the date that the account was opened. Yes {
  "title": "TheM.accounts[0].dtsOpened",
  "type": "Date",
  "description": "Gets (returns) the date that the
account was opened.",
  "examples": [
    "Mon Jun 10 2024 07:37:54 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}
dtsUpdated Gets (returns) the date that the account was most recently updated. Yes {
  "title": "TheM.accounts[0].dtsUpdated",
  "type": "Date",
  "description": "Gets (returns) the date that the
account was most recently updated.",
  "examples": [
    "Mon Jun 10 2024 07:37:54 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
transactions.doUpdate
[
{
"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
},
"isDelayed": {
"title": "isDelayed",
"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 days 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. If the update is not forced and isDelayed is true, then the update will be delayed by 3000ms. TheM.accounts[0].transactions.doUpdate(
  {
   "days": 5,
   "force": true
  }
);

Submodules

Submodule Name Link
Card Card Reference