TheM.externalAccounts 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.
Example
Properties
Property table for TheM.externalAccounts
Property | Description | Required | Schema |
---|---|---|---|
allActive | Gets (returns) an array with all the external accounts associated with the user that have an .isActive property value of true. | Yes | { "title": "TheM.externalAccounts.allActive", "type": "array", "description": "Gets (returns) an array with all the external accounts associated with the user that have an .isActive property value of true.", "$comment": "getter", "examples": [ [ { "AFiExternalAccountId": "qweealxsye6pizvuubieaoyoe", "accountNumberMasked": "4...0004", "bankName": "Debit card", "comment": "Adding new individual debit card", "dtsCreated": "Fri Jun 28 2024 07:12:10 GMT-0400 (Eastern Daylight Time)", "dtsModified": "Fri Jun 28 2024 07:12:10 GMT-0400 (Eastern Daylight Time)", "name": "Individual debit card", "networkName": "Visa", "panMasked": "4...0004", "type": "DEBITCARD", "isActive": true, "isPending": false, "isSyncedToServer": true, "isValid": false, "isVerified": true, "validationMessage": "The card number is invalid", "toJSON": {} }, { "AFiExternalAccountId": "qweealxszpo0chsufhuxwwesv", "accountNumber": "123467890123456", "accountNumberMasked": "...3456", "bankName": "Bank ABC", "comment": "Bank Account", "dtsCreated": "Fri Jun 28 2024 07:12:10 GMT-0400 (Eastern Daylight Time)", "dtsModified": "Fri Jun 28 2024 07:12:10 GMT-0400 (Eastern Daylight Time)", "name": "Bank Account", "routingNumber": "103112617", "title": "Suzy Tester", "type": "CHECKING", "isActive": true, "isPending": false, "isSyncedToServer": true, "isValid": true, "isVerified": true, "validationMessage": "", "toJSON": {} } ] ], "nullable": false } |
length | Gets (returns) the length of the externalAccounts array. | Yes | { "title": "TheM.externalAccounts.length", "type": "number", "description": "Gets (returns) the length of the externalAccounts array.", "examples": [ 1 ], "default": 0, "nullable": false } |
autofunding | Gets (returns) the TheM.externalAccounts.autofunding object. | Yes | { "title": "TheM.externalAccounts.autofunding", "type": "object", "description": "Gets (returns) the TheM.externalAccounts.autofunding object.", "$comment": "getter", "examples": [ { "AFiExternalAccountId": "qweealxt6213tavxcsmyztaio", "amount": 20, "cadence": "when_low", "currency": "USD", "externalAccount": {}, "isEnabled": true, "isValid": true, "lowAmount": 15, "toJSON": { "AFiExternalAccountId": "qweealxt6213tavxcsmyztaio", "amount": 20, "cadence": "when_low", "currency": "USD", "lowAmount": 15 } } ], "nullable": false } |
isReady | Gets (returns) true if TheM.externalAccounts is fully ready. | Yes | { "title": "TheM.externalAccounts.isReady", "type": "boolean", "description": "Gets (returns) true if TheM.externalAccounts is fully ready.", "$comment": "getter", "examples": [ true, false ], "default": false, "nullable": false } |
Methods
Method Name | Parameter Descriptions | Description | Example |
---|---|---|---|
doSave | [] |
Saves externalAccounts 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.externalAccounts.doSave(); |
doLoad | [] |
Loads externalAccounts data from local storage. On success, a(n) 'modelBank external accounts loaded' event will occur.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.externalAccounts.doLoad(); |
doUpdate | [ |
Causes framework to pull fresh externalAccounts 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 external accounts updated' event will occur. A 'modelBank external accounts changed' event also occurs if the server sent new data. Local updates are sent to the server prior to pulling the data from the server. |
TheM.externalAccounts.doUpdate(true); |
isValidField | [ |
Checks to make sure the given value is valid for the given fieldName. If the fieldName is not recognized by the isValidField method, it will return false. If the fieldName is recognized but the value is invalid, it will return an appropriate validation error message. Possible fieldNames to check are 'pan', 'date', 'cvv', 'name', 'bankName', 'type', 'accountNumber', and 'routingNumber'. Returns true if valid. |
TheM.externalAccounts.isValidField("accountNumber","1234567890123456"); |
doGetPlaidLinkToken | [ |
Generates a link token to identify the external account. If successful, a 'modelBank external account link_token received' event occurs and the received linkToken is returned. | TheM.externalAccounts.doGetPlaidLinkToken({); |
new | [ |
Creates and returns a new instance of the ExternalAccount class using the given object properties. ExternalAccount types include CHECKING, SAVINGS, DEBITCARD, or CREDITCARD, and required properties depend on the type of external account being added. | TheM.externalAccounts.new({); |
newAutofunding | [ |
Creates a new temporary instance of the Autofunding class using the given object properties. Autofunding transfers a set amount from the external account on a regular schedule, or cadence. The transfer may be weekly, monthly, or when the user's account is low. See the ampliFi MODULES documentation for the /externalaccount/autofunding endpoint (which is called when TheM.externalAccounts.autofunding is updated) for additional information on autofunding. | TheM.externalAccounts.newAutofunding({); |
Submodules
Submodule Name | Link |
---|---|
ExternalAccount | ExternalAccount Reference |
Autofunding | Autofunding Reference |