Skip to content

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

Properties

Property table for TheM.restrictions

Property Description Required Schema
all Gets (returns) an array with all the restrictions that may be applicable for the user. Yes {
  "title": "TheM.restrictions.all",
  "type": "array",
  "description": "Gets (returns) an array with all
the restrictions that may be applicable for the
user.",
  "$comment": "getter",
  "examples": [
    [
      {
        "isAllowed": true,
        "priority": 0,
        "restrictionName": "enable wires and ACH",
        "transactionCurrencies": [
          "USD"
        ],
        "txnTypes": [
          "USA",
          "USA_wire"
        ]
      }
    ]
  ],
  "nullable": false
}
length Gets (returns) the length of the restrictions array. Yes {
  "title": "TheM.restrictions.length",
  "type": "number",
  "description": "Gets (returns) the length of the
restrictions array.",
  "examples": [
    1
  ],
  "default": 0,
  "nullable": false
}
isReady Gets (returns) or sets true if TheM.restrictions is fully ready. When setting isReady true for the first time, a(n) 'TheM.restrictions ready' event is also triggered. Yes {
  "title": "TheM.restrictions.isReady",
  "type": "boolean",
  "description": "Gets (returns) or sets true if
TheM.restrictions is fully ready. When setting
isReady true for the first time, a(n)
'TheM.restrictions ready' event is also
triggered.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ],
  "default": false,
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doSave
[]
Saves restrictions 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.restrictions.doSave();
doLoad
[]
Loads restrictions 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.restrictions.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 restrictions 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 restrictions refreshed' event will occur. TheM.restrictions.doUpdate(true);
restriction
[
{
"title": "givenTxnType",
"type": "string",
"nullable": false,
"example": "USA"
}
]
Returns the restriction specified by the givenTxnType, if a matching restriction exists that is applicable to this user. The givenTxnType argument could represent a transactionTypeID, a txnType, or a restrictionId. TheM.restrictions.restriction("USA");
filtered
[
{
"title": "givenParams",
"type": "object",
"nullable": true,
"example": {
"isAllowed": false,
"maxAmount": 1000
}
}
]
This method accepts an object, givenParams, containing filter criteria (key:value pairs where key is a restriction property) and then returns an array of restrictions for this user with properties matching the given criteria. If no givenParams are included, then an unfiltered account list is returned. TheM.restrictions.filtered(
  {
   "isAllowed": false,
   "maxAmount": 1000
  }
);
one
[
{
"title": "givenTxnType",
"type": "string",
"nullable": false,
"example": "USA"
}
]
This method returns the first restriction found that applies to the givenTxnType, which represents a restriction.transactionTypeId or restriction.txnType property. TheM.restrictions.one("USA");
currenciesAllowed
[
{
"title": "givenTxnType",
"type": "string",
"nullable": true,
"example": "USA"
}
]
This method returns a list of the allowed currencies for the givenTxnType, which represents a transactionTypeId or txnType property. TheM.restrictions.currenciesAllowed("USA");
accountsAsDestinationFor
[
{
"title": "givenTxnType",
"type": "string",
"nullable": true,
"example": "USA"
}
]
This method returns an array of accounts which can be a destination account for the givenTxnType, which represents a transactionTypeId or txnType property. TheM.restrictions.accountsAsDestinationFor("USA");
accountsAsSourceFor
[
{
"title": "givenTxnType",
"type": "string",
"nullable": true,
"example": "USA"
}
]
This method returns an array of accounts which can be a source account for the givenTxnType, which represents a transactionTypeId or txnType property. TheM.restrictions.accountsAsSourceFor("USA");
canAccountBeSource
[
{
"title": "givenTxnType",
"type": "string",
"nullable": true,
"example": "USA"
},
{
"title": "givenAccountTypeId",
"type": "string",
"nullable": true,
"example": "Standard"
}
]
This method returns true if the givenAccountTypeId (representing an account typeId property) is a valid account type for the givenTxnType, which represents a transactionTypeId or txnType property. TheM.restrictions.canAccountBeSource("USA","Standard");
isAllowed
[
{
"title": "given",
"type": "object",
"nullable": false,
"example": {
"sourceAccount": {
"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",
"toJSON": {
"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"
},
"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":
"dcuosrklcjxpyzxagroxbbrspacuh
iecwfzltzke",
"txnType": "credit",
"toJSON": {}
}
],
"typeId": "Standard"
},
"destinationAccount": {
"AFiBeneficiaryId":
"testpgbenlxuma31jlu",
"beneficiaryId":
"testpgbenlxuma31jlu",
"AFiPayeeId":
"3gzvss70aqhkjh0gcmwz6fr6eutmz
mf8",
"AFiUserId":
"testaurlx8wfimcrw",
"userId": "testaurlx8wfimcrw",
"name": "ACH Payee Account",
"destinationName": "Receiving
account title",
"backOfficeId":
"connectFiBOIS",
"backOfficeName":
"connectFiBOIS",
"backOffices": [],
"type": "CHECKING",
"typeName": "USA interbank
transfer",
"accountNumber":
"1234567890123456",
"routingNumber": "123456789",
"bankName": "Citibank NA",
"txnType": "USA",
"status": "Active",
"defaultAmount": 0,
"defaultCurrency": "USD",
"narrativeDebit": "ACH
payment",
"narrativeCredit": "",
"imageBase64":
"Very_Long_Base64_Image_String
",
"dtsCreated":
"2024-07-03T16:24:10.033Z",
"dtsUpdated":
"2024-07-03T16:24:10.033Z",
"isActive": true,
"isBusiness": false,
"isDeleted": false,
"isFavourite": false,
"isHidden": false,
"isPaying": false,
"isValid": true,
"toJSON": {
"AFiBeneficiaryId":
"testpgbenlxuma31jlu",
"AFiPayeeId":
"3gzvss70aqhkjh0gcmwz6fr6eutmz
mf8",
"accountNumber":
"1234567890123456",
"routingNumber": "123456789",
"bankName": "Citibank NA",
"defaultAmount": 20,
"destinationName": "Receiving
account title",
"isActive": true,
"isBusiness": false,
"isFavourite": true,
"isHidden": false,
"name": "ACH Payee Account",
"narrativeDebit": "ACH
payment",
"status": "Active",
"txnType": "USA",
"type": "CHECKING",
"imageBase64":
"Very_Long_Base64_Image_String
",
"dtsCreated":
"2024-07-03T16:24:10.033Z"
},
"transactions": [],
"validationMessage": ""
},
"txnType": "USA",
"transactionTypeId": "USA",
"sourceAccountCurrency":
"USD",
"destinationAccountCurrency":
"USD",
"currency": "USD",
"amount": 10
}
}
]
Takes an object containing transaction properties and returns a boolean value indicating if the transaction described by the given object is allowed. The given object contains the following properties: sourceAccount, destinationAccount, txnType and/or transactionTypeId, sourceAccountCurrency, destinationAccountCurrency, currency, and amount. Existing restrictions are applied one by one. When a restriction rule applies to the given object, it may result in a change to the isAllowed response. If conflicting restriction rules exist, the last rule applied will overwrite previously applied rules. Returns an object containing the following properties: isAllowed, lastRestrictionName, lastYesRestrictionName, maxAmount, minAmount, isMaxHit, and isMinHit. TheM.restrictions.isAllowed(
  {
   "sourceAccount": {
   "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",
   "toJSON": {
   "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"
   },
   "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"
   },
   "destinationAccount": {
   "AFiBeneficiaryId": "testpgbenlxuma31jlu",
   "beneficiaryId": "testpgbenlxuma31jlu",
   "AFiPayeeId": "3gzvss70aqhkjh0gcmwz6fr6eutmzmf8",
   "AFiUserId": "testaurlx8wfimcrw",
   "userId": "testaurlx8wfimcrw",
   "name": "ACH Payee Account",
   "destinationName": "Receiving account title",
   "backOfficeId": "connectFiBOIS",
   "backOfficeName": "connectFiBOIS",
   "backOffices": [],
   "type": "CHECKING",
   "typeName": "USA interbank transfer",
   "accountNumber": "1234567890123456",
   "routingNumber": "123456789",
   "bankName": "Citibank NA",
   "txnType": "USA",
   "status": "Active",
   "defaultAmount": 0,
   "defaultCurrency": "USD",
   "narrativeDebit": "ACH payment",
   "narrativeCredit": "",
   "imageBase64": "Very_Long_Base64_Image_String",
   "dtsCreated": "2024-07-03T16:24:10.033Z",
   "dtsUpdated": "2024-07-03T16:24:10.033Z",
   "isActive": true,
   "isBusiness": false,
   "isDeleted": false,
   "isFavourite": false,
   "isHidden": false,
   "isPaying": false,
   "isValid": true,
   "toJSON": {
   "AFiBeneficiaryId": "testpgbenlxuma31jlu",
   "AFiPayeeId": "3gzvss70aqhkjh0gcmwz6fr6eutmzmf8",
   "accountNumber": "1234567890123456",
   "routingNumber": "123456789",
   "bankName": "Citibank NA",
   "defaultAmount": 20,
   "destinationName": "Receiving account title",
   "isActive": true,
   "isBusiness": false,
   "isFavourite": true,
   "isHidden": false,
   "name": "ACH Payee Account",
   "narrativeDebit": "ACH payment",
   "status": "Active",
   "txnType": "USA",
   "type": "CHECKING",
   "imageBase64": "Very_Long_Base64_Image_String",
   "dtsCreated": "2024-07-03T16:24:10.033Z"
   },
   "transactions": [],
   "validationMessage": ""
   },
   "txnType": "USA",
   "transactionTypeId": "USA",
   "sourceAccountCurrency": "USD",
   "destinationAccountCurrency": "USD",
   "currency": "USD",
   "amount": 10
  }
);
isCurrencyAllowed
[
{
"title": "givenTxnType",
"type": "string",
"nullable": true,
"example": "USA"
},
{
"title": "givenCurrency",
"type": "string",
"nullable": true,
"example": "USD"
}
]
This method returns true if the given currency is allowed for the givenTxnType, which represents a transactionTypeId or txnType property. TheM.restrictions.isCurrencyAllowed("USA","USD");
isTransactionAllowed
[
{
"title": "givenTxnType",
"type": "string",
"nullable": true,
"example": "USA"
}
]
This method returns true if the givenTxnType is explicitly allowed, where givenTxnType represents a transactionTypeId or txnType property. TheM.restrictions.isTransactionAllowed("USA");