refreshData(context)
|
Function Declaration |
|
|
Type |
Interface function |
|
Description |
Initiates an on-demand request for the latest transaction data from the Account Information Service Provider (AISP) for one or more connected accounts. Plug-ins use this function to instruct the provider to fetch updated data for reconciliation or corporate card expenses. |
|
Returns |
void |
|
Input Parameters |
|
Example
function refreshData(context) {
var configurationId = context.pluginConfiguration.getConfigurationFieldValue({fieldName: "configuration_id"});
var configuration = loadConfiguration(configurationId);
const accounts = JSON.parse(context.accountRequestsJSON);
accounts.forEach(account => {
const accountMappingKey = account.accountMappingKey;
if (accountMappingKey === '123456') {
context.addAccountError({
accountMappingKey: accountMappingKey,
errorCode: '2000001200'
});
}
});
// For Corporate Card Expenses only
context.setRefreshRequestId({ refreshRequestId: '1' });
}
addAccountError marks an individual account as failed to refresh.
setRefreshRequestId should be called only when the provider successfully returns an ID. Otherwise, omit the call.