Skip to content

TheM.cards 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 restrictions');

Properties

Property table for TheM.cards

Property Description Required Schema
all Gets (returns) an array with all the cards associated with the user that are not closed or hidden. Yes {
  "title": "TheM.cards.all",
  "type": "array",
  "description": "Gets (returns) an array with all
the cards associated with the user that are not
closed or hidden.",
  "$comment": "getter",
  "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",
        "account": {},
        "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
          }
        },
        "toJSON": {}
      }
    ]
  ],
  "nullable": false
}
own Gets (returns) a filtered array with all the not closed cards for which the current user is the primary user. Yes {
  "title": "TheM.cards.own",
  "type": "array",
  "description": "Gets (returns) a filtered array
with all the not closed cards for which the current
user is the primary user.",
  "$comment": "getter",
  "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",
        "account": {},
        "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
          }
        },
        "toJSON": {}
      }
    ]
  ],
  "nullable": false
}
length Gets (returns) the length of the cards array. Yes {
  "title": "TheM.cards.length",
  "type": "number",
  "description": "Gets (returns) the length of the
cards array.",
  "examples": [
    1
  ],
  "default": 0,
  "nullable": false
}
isReady Gets (returns) or sets true if TheM.cards is fully ready. When setting isReady true for the first time, a(n) 'TheM.cards ready' event is also triggered. Yes {
  "title": "TheM.cards.isReady",
  "type": "boolean",
  "description": "Gets (returns) or sets true if
TheM.cards is fully ready. When setting isReady
true for the first time, a(n) 'TheM.cards ready'
event is also triggered.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ],
  "default": false,
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doSave
[]
Saves cards 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.cards.doSave();
doLoad
[]
Loads cards 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.cards.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 cards 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 cards refreshed' event will occur. TheM.cards.doUpdate(true);
card
[
{
"title": "givenCardId",
"type": "string",
"nullable": false,
"example":
"testgalx8wfq4sqfgb"
}
]
Returns the card associated with the user specified by the givenCardId, if a match exists. TheM.cards.card("testgalx8wfq4sqfgb");
forTypeIds
[
{
"title": "givenTypes",
"type": "string",
"nullable": true,
"example": "Standard"
}
]
Returns a list of cards 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.cards.forTypeIds("Standard");
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 a card property) and then returns an array of cards with properties matching the given criteria. If no givenParams are included, then an unfiltered card list is returned. TheM.cards.filtered(
  {
   "isActive": true,
   "isHidden": false,
   "name": "Main account",
   "typeId": "Standard"
  }
);

Submodules

Submodule Name Link
Card Card Reference