Members
(constant) compareImages
- Source:
- See:
Methods
authenticate(login, passwd) → {boolean}
This function initiates a connection on the Boursorama website.
Parameters:
Name | Type | Description |
---|---|---|
login |
string | |
passwd |
string | Password |
- Source:
- See:
Returns:
Returns true if authentication is successful, else false
- Type
- boolean
downloadCSVWithBankInformation() → {array}
Downloads an CSV file with the transactions registered during the selected period for
an bank account.
Returns:
The lines of the CSV file
- Type
- array
fetchBalances(accounts) → {array}
Retrieves the balance histories of each bank accounts and adds the balance of the day for each bank account.
Parameters:
Name | Type | Description |
---|---|---|
accounts |
array | Collection of io.cozy.bank.accounts already registered in database |
Returns:
Collection of io.cozy.bank.balancehistories
registered in database
- Type
- array
Example
var accounts = [
{
_id: '12345...',
_rev: '14-98765...',
_type: 'io.cozy.bank.accounts',
balance: 42,
cozyMetadata: { updatedAt: '2019-04-17T10:07:30.769Z' },
institutionLabel: 'Boursorama Banque',
label: 'LIVRET',
number: 'XXXXXXXX',
rawNumber: 'XXXXXXXX',
type: 'Savings',
vendorId: 'XXXXXXXX'
}
];
fetchBalances(accounts);
// [
// {
// _id: '12345...',
// _rev: '9-98765...',
// balances: { '2019-04-16': 42, '2019-04-17': 42 },
// metadata: { version: 1 },
// relationships: { account: [Object] },
// year: 2019
// }
// ]
findMetadataForCreditOperation(words) → {object}
Searches in the classification.json file, the metadata corresponding to words passed in parameters.
This function ignores the metadata dedicated to debit operations.
Parameters:
Name | Type | Description |
---|---|---|
words |
array |
- Source:
Returns:
- Type
- object
findMetadataForDebitOperation(words) → {object}
Searches in the classification.json file, the metadata corresponding to words passed in parameters.
This function ignores the metadata dedicated to credit operations.
Parameters:
Name | Type | Description |
---|---|---|
words |
array |
- Source:
Returns:
- Type
- object
getAccountTypeFromCSS(label) → {string}
Analyzes the CSS classes of the bank account to find its type
Parameters:
Name | Type | Description |
---|---|---|
label |
string | The CSS classes of the bank account |
- Source:
- See:
Returns:
The type of the bank account
- Type
- string
(async) getBalanceHistory(year, accountId) → {io.cozy.bank.balancehistories}
Retrieves the balance history for one year and an account. If no balance history is found,
this function returns an empty document based on io.cozy.bank.balancehistories doctype.
Note: Can't use
Note: Can't use
BalanceHistory.getByYearAndAccount()
directly for the moment,
because BalanceHistory
invokes Document
that doesn't have an cozyClient instance.
Parameters:
Name | Type | Description |
---|---|---|
year |
integer | |
accountId |
string |
Returns:
The balance history for one year and an account.
- Type
- io.cozy.bank.balancehistories
handleRequestErrors(err) → {Promise.<*>}
Parameters:
Name | Type | Description |
---|---|---|
err |
- Source:
Returns:
- Type
- Promise.<*>
normalizeAmount(amount) → {Number}
Convert an amount to float
Parameters:
Name | Type | Description |
---|---|---|
amount |
string |
- Source:
Returns:
- Type
- Number
parseBankAccounts($) → {array}
Retrieves all the bank accounts of the user from HTML.
Parameters:
Name | Type | Description |
---|---|---|
$ |
object | DOM parsed by Cheerio |
- Source:
- See:
Returns:
Collection of
io.cozy.bank.accounts
- Type
- array
Example
parseBankAccounts($);
// [
// {
// institutionLabel: 'Boursorama Banque',
// label: 'LIVRET',
// type: 'Savings',
// balance: 42,
// idAccount: 'l42...',
// currency: 'EUR'
// }
// ]
parseDate(date) → {moment.Moment}
Convert string to moment.Moment
Parameters:
Name | Type | Description |
---|---|---|
date |
string |
- Source:
Returns:
- Type
- moment.Moment
parseOperations(account, operationLines) → {array}
Parses and transforms each lines (CSV format) into
io.cozy.bank.operations
Parameters:
Name | Type | Description |
---|---|---|
account |
io.cozy.bank.accounts | Bank account |
operationLines |
array | Lines containing operation information for the current bank account - CSV format expected |
Returns:
Collection of io.cozy.bank.operations.
- Type
- array
Example
var account = {
institutionLabel: 'Boursorama Banque',
label: 'LIVRET',
type: 'Savings',
balance: 42,
idAccount: 'l42...',
accountType: 4,
currency: 'EUR'
};
var csv = [
'dateOp;dateVal;label;category;categoryParent;supplierFound;amount;accountNum;accountLabel;accountBalance', // ignored
// Transaction(s)
'31/12/18;01/01/19;"INTERETS 2018";"...";"...";"...";38,67;XXXXXXXX;"...";42',
];
parseOperations(account, csv);
// [
// {
// label: 'INTERETS 2018',
// type: 'direct debit',
// cozyCategoryId: '200130',
// cozyCategoryProba: 1,
// date: "2018-12-30T23:00:00+01:00",
// dateOperation: "2018-12-31T23:00:00+01:00",
// dateImport: "2019-04-17T10:07:30.553Z", (UTC)
// currency: 'EUR',
// vendorAccountId: 'XXXXXXXX',
// amount: 38.67,
// vendorId: 'XXXXXXXX_2018-12-30_0' {number}_{date}_{index}
// }
saveBalances(balances) → {Promise}
Saves the balance histories in database.
Parameters:
Name | Type | Description |
---|---|---|
balances |
Collection of io.cozy.bank.balancehistories to save in database |
Returns:
- Type
- Promise
(async) start(fields)
The start function is run by the BaseKonnector instance only when it got all the account
information (fields). When you run this connector yourself in "standalone" mode or "dev" mode,
the account information come from ./konnector-dev-config.json file
Parameters:
Name | Type | Description |
---|---|---|
fields |
object |