diff --git a/.env.sample b/.env.sample index 3e5aadf..0f810e0 100644 --- a/.env.sample +++ b/.env.sample @@ -1,14 +1,10 @@ -# Your Tink keys, which can be found in the Tink Dashboard. -# https://tink.com/ - -TINK_CLIENT_ID= -TINK_CLIENT_SECRET= -TINK_USER_ID= -TINK_ACTOR_ID= +EDENRED_USERNAME= +EDENRED_PASSWORD= +EDENRED_TOKEN= # Comma-separated. # both need to have the same length -TINK_ACCOUNT_MAP= +EDENRED_ACCOUNT_MAP= ACTUAL_ACCOUNT_MAP= ACTUAL_SERVER_URL="server url" diff --git a/README.Docker.md b/README.Docker.md index 6033045..eb02f7b 100644 --- a/README.Docker.md +++ b/README.Docker.md @@ -14,8 +14,9 @@ services: - PUID=1003 - PGID=100 - TZ=Europe/Lisbon - - EDENRED_USERNAME= - - EDENRED_PASSWORD= + #- EDENRED_USERNAME= deprecated for now + #- EDENRED_PASSWORD= deprecated for now + - EDENRED_TOKEN= - EDENRED_ACCOUNT_MAP=comma separated vlue (Both EDENRED_ACCOUNT_MAP and ACTUAL_ACCOUNT_MAP need to have the same size) - ACTUAL_ACCOUNT_MAP=#comma separated vlue - ACTUAL_SERVER_URL= @@ -27,8 +28,7 @@ services: ``` docker run -d --name myedenredactual \ - - e 'EDENRED_USERNAME=' \ - - e 'EDENRED_PASSWORD=' \ + - e 'EDENRED_TOKEN=' \ - e 'EDENRED_ACCOUNT_MAP=' \ - e 'ACTUAL_ACCOUNT_MAP=' \ - e 'ACTUAL_SERVER_URL= ' \ diff --git a/README.md b/README.md index 512a5df..5b5c97d 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ You need to provide your username and password and specified what the cadence yo - Clone this repo! - Install dependencies: `npm ci` - Copy `.sample.env` to `.env` and fill in the blanks -- Run `check`: `node index.js check`, this will check the balance between your Actual Budget account and the accounts setup on tink +- Run `check`: `node index.js check`, this will check the balance between your Actual Budget account - Run `import`: `node index.js import`, this will import all transactions to Actual ## Some things worth noting The intial transaction import does not have a starting balance, so you will need to manually add that to Actual Budget. -You need to manually create the accounts inside Actual, and then map them to the accounts you setup in Tink. +You need to manually create the accounts inside Actual, and then map them to the My Edenred accounts. ## Commands diff --git a/config.js b/config.js index ed80580..f86f531 100644 --- a/config.js +++ b/config.js @@ -9,8 +9,9 @@ const APP_PORT = process.env.APP_PORT || 3000; const APP_URL = process.env.APP_URL || "http://localhost" -const EDENRED_USERNAME = process.env.EDENRED_USERNAME || ""; -const EDENRED_PASSWORD = process.env.EDENRED_PASSWORD || ""; +//const EDENRED_USERNAME = process.env.EDENRED_USERNAME || ""; +//const EDENRED_PASSWORD = process.env.EDENRED_PASSWORD || ""; +const EDENRED_TOKEN = process.env.EDENRED_TOKEN || ""; const EDENRED_ACCOUNT_MAP = process.env.EDENRED_ACCOUNT_MAP || ""; const ACTUAL_ACCOUNT_MAP = process.env.ACTUAL_ACCOUNT_MAP || ""; const CRON_EXPRESSION = process.env.CRON_EXPRESSION || ""; @@ -32,8 +33,9 @@ function getAppConfigFromEnv() { const appConfig = { APP_PORT, APP_URL, - EDENRED_USERNAME, - EDENRED_PASSWORD, + //EDENRED_USERNAME, + //EDENRED_PASSWORD, + EDENRED_TOKEN, EDENRED_ACCOUNT_MAP, ACTUAL_ACCOUNT_MAPPING, EDENRED_ACCOUNT_MAPPING, diff --git a/docker-compose.yaml b/docker-compose.yaml index 51dc623..80779ef 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,19 +1,18 @@ version: '3' services: actual_server: - container_name: tinkactual - image: docker.io/rodriguestiago0/tinkactual + container_name: myedenredactual + image: docker.io/rodriguestiago0/myedenredactual ports: - '5006:5006' environment: - PUID=1003 - PGID=100 - TZ=Europe/Lisbon - - TINK_CLIENT_ID= - - TINK_CLIENT_SECRET= - - TINK_USER_ID= - - TINK_ACTOR_ID= - - TINK_ACCOUNT_MAP= #comma separated vlue (Both TINK_ACCOUNT_MAP and ACTUAL_ACCOUNT_MAP need to have the same size) + #- EDENRED_USERNAME= deprecated for now + #- EDENRED_PASSWORD=deprecated for now + - EDENRED_TOKEN= + - EDENRED_ACCOUNT_MAP= #comma separated vlue (Both EDENRED_ACCOUNT_MAP and ACTUAL_ACCOUNT_MAP need to have the same size) - ACTUAL_ACCOUNT_MAP= #comma separated vlue - ACTUAL_SERVER_URL= - ACTUAL_SERVER_PASSWORD= diff --git a/edenredService.js b/edenredService.js index 0e27cf5..4802d83 100644 --- a/edenredService.js +++ b/edenredService.js @@ -46,8 +46,8 @@ const getAllTransactions = async (token, accountId) => { } async function getTransactions(accountId) { - authorizationToken = await authenticate() - transactions = await getAllTransactions(authorizationToken, accountId) + //authorizationToken = await authenticate() + transactions = await getAllTransactions(appConfig.EDENRED_TOKEN, accountId) parsedTransactions = [] transactions.forEach(transaction => { transactionID = crypto.createHash('sha256').update(transaction.transactionName+transaction.transactionDate+transaction.amount).digest('hex');