Skip to content

Card Reference

Constructor

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

A new instance of the Card class is initialized when a modelBank cards pushed, modelBank card pushed, or modelBank cards and accounts pushed event occurs. For each Card instance, there is an associated Account instance (or instances). A card may have one or multiple associated account instances, depending on configurations and card/account issuer. The properties and methods of the Card class can be referenced by specifying the specific card, followed by the property or method name, like TheM.cards['PUT_AFiCardId_HERE'].AFiCardId

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

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

Example

const newCard = TheM.genericRequests.get('NAME_OF_GENERIC_REQUEST_TO_ADD_CARD', {
  payload: {
    name: 'New Card Name',
  }
});

Properties

Property table for Card

Property Description Required Schema
AFiAccountId Gets (returns) the account ID associated with this card in ampliFi. Yes {
  "title": "TheM.cards[0].AFiAccountId",
  "type": "string",
  "description": "Gets (returns) the account ID
associated with this card in ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
id Gets (returns) AFiAccountId, the account ID associated with this card in ampliFi. Yes {
  "title": "TheM.cards[0].id",
  "type": "string",
  "description": "Gets (returns) AFiAccountId, the
account ID associated with this card in ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
AFiCardId Gets (returns) the card ID in ampliFi. Yes {
  "title": "TheM.cards[0].AFiCardId",
  "type": "string",
  "description": "Gets (returns) the card ID in
ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
AFiUserId Gets (returns) the user ID in ampliFi. Yes {
  "title": "TheM.cards[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.cards[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": [
    null
  ],
  "nullable": true
}
accountIdBO Gets the account ID of the card in the back-office. Yes {
  "title": "TheM.cards[0].accountIdBO",
  "type": "string",
  "description": "Gets the account ID of the card in
the back-office.",
  "examples": [
    "icrd_6OWyxZDBXjteYnRwZjp9HY"
  ],
  "nullable": false
}
backOfficeId Gets the back-office ID associated with this card. Yes {
  "title": "TheM.cards[0].backOfficeId",
  "type": "string",
  "description": "Gets the back-office ID
associated with this card.",
  "examples": [
    "connectFiBOIS"
  ],
  "nullable": false
}
backOfficeName Gets (returns) the name of the back-office associated with this card. Yes {
  "title": "TheM.cards[0].backOfficeName",
  "type": "string",
  "description": "Gets (returns) the name of the
back-office associated with this card.",
  "examples": [
    "connectFiBOIS"
  ],
  "nullable": false
}
account Gets (returns) the instance(s) of the Account class (as an object) associated with this card. Yes {
  "title": "TheM.cards[0].account",
  "type": "object",
  "description": "Gets (returns) the instance(s) of
the Account class (as an object) associated with
this card.",
  "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
        }
      },
      "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",
      "typeId": "Standard",
      "card": {},
      "cards": [
        {}
      ],
      "toJSON": {},
      "transactions": []
    }
  ],
  "nullable": false
}
num Gets (returns) the card number. Yes {
  "title": "TheM.cards[0].num",
  "type": "string",
  "description": "Gets (returns) the card number.",
  "examples": [
    "9999..6789"
  ],
  "nullable": false
}
numMasked Gets (returns) the masked card number. Yes {
  "title": "TheM.cards[0].num",
  "type": "string",
  "description": "Gets (returns) the masked card
number.",
  "examples": [
    "9999...6789"
  ],
  "nullable": false
}
status Gets (returns) the status of the card. No {
  "title": "TheM.cards[0].status",
  "type": "string",
  "description": "Gets (returns) the status of the
card.",
  "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"
}
image Gets (returns) the URL to the image associated with the card. No {
  "title": "TheM.cards[0].image",
  "type": "string",
  "description": "Gets (returns) the URL to the image
associated with the card.",
  "examples": [
    "ibiscard"
  ],
  "nullable": true
}
name Gets (returns) or sets a name for the account, up to 128 characters. No {
  "title": "TheM.cards[0].name",
  "type": "string",
  "description": "Gets (returns) or sets a name for
the account, up to 128 characters.",
  "examples": [
    "Main account"
  ],
  "nullable": true
}
name_on_card Gets (returns) the name as it appears on the card. No {
  "title": "TheM.cards[0].name_on_card",
  "type": "string",
  "description": "Gets (returns) the name as it
appears on the card.",
  "examples": [
    "SUZY QUEUE TESTER"
  ]
}
typeId Gets (returns) an identifier representing the type of account. No {
  "title": "TheM.cards[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"
}
lastDepositAmount Gets (returns) the lastDepositAmount, if present. No {
  "title": "TheM.cards[0].lastDepositAmount",
  "type": "number",
  "description": "Gets (returns) the
lastDepositAmount, if present.",
  "examples": [
    0
  ],
  "nullable": true
}
usageRestrictions Gets (returns) the usage restrictions for the card, if any. A value of true indicates that transactions are enabled for the specified property and a value of false indicates that transactions are disabled for the specified property. Days of the week (dayOfWeek) property are indicated by the values 0 (Sunday) through 6 (Saturday). Time ranges are indicated by the codes xxn1yyn2, where xx and yy are either am or pm, and n1 and n2 are the specific hours that begin and end the range using a 12-hour clock. Only one of allowedMCCs or restrictedMCCs may be defined No {
  "title": "TheM.cards[0].usageRestrictions",
  "type": "object",
  "description": "Gets (returns) the usage
restrictions for the card, if any. A value of true
indicates that transactions are enabled for the
specified property and a value of false indicates
that transactions are disabled for the specified
property. Days of the week (dayOfWeek) property are
indicated by the values 0 (Sunday) through 6
(Saturday). Time ranges are indicated by the codes
xxn1yyn2, where xx and yy are either am or pm, and n1
and n2 are the specific hours that begin and end the
range using a 12-hour clock. Only one of allowedMCCs
or restrictedMCCs may be defined",
  "examples": [
    {
      "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
      }
    }
  ],
  "nullable": true
}
toJSON Gets (returns) the Card properties in a JSON formatted object. Yes {
  "title": "TheM.cards[0].toJSON",
  "type": "object",
  "description": "Gets (returns) the Card
properties in a JSON formatted object.",
  "examples": [
    {
      "AFiAccountId": "testgalx8wfq4sqfgb",
      "AFiCardId": "testgalx8wfq4sqfgb",
      "AFiUserId": "testaurlx8wfimcrw",
      "dtsOpened": "Mon Jun 10 2024 07:37:54 GMT-0400
(Eastern Daylight Time)",
      "dtsUpdated": "Wed Jun 12 2024 08:16:30 GMT-0400
(Eastern Daylight Time)",
      "image": "ibiscard",
      "isActive": null,
      "isClosed": null,
      "isHidden": false,
      "name": "Main account",
      "name_on_card": "SUZY QUEUE TESTER",
      "num": "9999..6789",
      "typeId": "Standard"
    }
  ],
  "nullable": false
}
isActivating Gets (returns) true if the card is currently being activated. No {
  "title": "TheM.cards[0].isActivating",
  "type": "boolean",
  "description": "Gets (returns) true if the card is
currently being activated.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isActivated Gets (returns) true if the card has already been activated. No {
  "title": "TheM.cards[0].isActivated",
  "type": "boolean",
  "description": "Gets (returns) true if the card has
already been activated.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isActive Gets (returns) true if the card is currently active and ready for transactions. No {
  "title": "TheM.cards[0].isActive",
  "type": "boolean",
  "description": "Gets (returns) true if the card is
currently active and ready for transactions.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isClosed Gets (returns) true if the card has been closed. No {
  "title": "TheM.cards[0].isClosed",
  "type": "boolean",
  "description": "Gets (returns) true if the card has
been closed.",
  "examples": [
    true,
    false
  ],
  "nullable": true
}
isHidden Gets (returns) or sets whether the sensitive card information is hidden. Will return true if the user has requested not to display this card prominently. Hidden cards should not be visible to the customer at the main screen and should require an effort to get to. No {
  "title": "TheM.cards[0].isHidden",
  "type": "boolean",
  "description": "Gets (returns) or sets whether the
sensitive card information is hidden. Will return
true if the user has requested not to display this
card prominently. Hidden cards should not be
visible to the customer at the main screen and should
require an effort to get to.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isToggling Gets (returns) true if this card is currently being toggled on/off. No {
  "title": "TheM.cards[0].isToggling",
  "type": "boolean",
  "description": "Gets (returns) true if this card is
currently being toggled on/off.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isOfflinePinTryLimitExceeded Gets (returns) true if the offline PIN try limit has been exceeded. No {
  "title":
"TheM.cards[0].isOfflinePinTryLimitExceeded",
  "type": "boolean",
  "description": "Gets (returns) true if the offline
PIN try limit has been exceeded.",
  "examples": [
    true,
    false
  ],
  "default": false
}
dtsOpened Gets (returns) the date that the card was opened. Yes {
  "title": "TheM.cards[0].dtsOpened",
  "type": "Date",
  "description": "Gets (returns) the date that the
card was opened.",
  "examples": [
    "Mon Jun 10 2024 07:37:54 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}
dtsUpdated Gets (returns) the date that the card was most recently updated. Yes {
  "title": "TheM.cards[0].dtsUpdated",
  "type": "Date",
  "description": "Gets (returns) the date that the
card was most recently updated.",
  "examples": [
    "Mon Jun 17 2024 08:34:01 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doClose
[]
Calls the DELETE /cards/:AFiCardId ampliFi endpoint and closes the card if successful. TheM.cards[0].doClose();
doReportLost
[
{
"title": "givenParams",
"type": "object",
"nullable": true,
"properties": {
"isSamePAN": {
"title": "isSamePAN",
"type": "boolean",
"nullable": true,
"default": false
}
},
"example": {
"isSamePAN": true
}
}
]
Calls the POST /card/:AFiCardId/reissue endpoint in ampliFi and reissues the card with a new card number if the isSamePAN property is false and the same card number if the isSamePAN property is true. Default isSamePAN property value is false. If successful, a 'modelBank card lost' event is called. TheM.cards[0].doReportLost(
  {
   "isSamePAN": true
  }
);
doReissue
[
{
"title": "givenParams",
"type": "object",
"nullable": true,
"properties": {
"isSamePAN": {
"title": "isSamePAN",
"type": "boolean",
"nullable": true,
"default": false
},
"cardData": {
"title": "cardData",
"type": "object",
"default": {}
}
},
"example": {
"isSamePAN": true,
"cardData": {}
}
}
]
Calls the POST /card/:AFiCardId/reissue endpoint in ampliFi and reissues the card with a new card number if the isSamePAN property is false and the same card number if the isSamePAN property is true. Default isSamePAN property value is false. If successful, the TheM.cards.doUpdate(true) method is called. TheM.cards[0].doReissue(
  {
   "isSamePAN": true,
   "cardData": {}
  }
);
doActivate
[]
Calls the POST /card/:AFiCardId/activate endpoint in ampliFi in order to activate the card. TheM.cards[0].doActivate();
doChangePIN
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"pin": {
"title": "pin",
"type": "string",
"nullable": false
}
},
"example": {
"pin": "1234"
}
}
]
Calls the POST /card/:AFiCardId/pin endpoint in ampliFi in order to change the card PIN to the specified pin value. If successful, a 'modelBank card PIN changed' event will occur. TheM.cards[0].doChangePIN(
  {
   "pin": "1234"
  }
);
doOnOff
[
{
"title": "givenStatus",
"type": "string",
"nullable": false,
"example": "on"
}
]
Calls the POST /card/:AFiCardId/:onoff endpoint in ampliFi. If the givenStatus is 'on' (string) or true (boolean), a successful request will toggle the card on. If the givenStatus is 'off' (string) or false (boolean), a successful request will toggle the card off and result in an 'inactive' status. If successful, a 'modelBank toggled a card' event occurs. TheM.cards[0].doOnOff("on");

Submodules

Submodule Name Link
Account Account Reference