edenred-transactions
v3.2.5
Published
Node.js module to retrieve transactions from a Edenred card.
Maintainers
Readme
Node.js module to retrieve transactions from an Edenred card.
NOTE: Only tested with the Portuguese version (https://www.myedenred.pt)
Installation
Install the package using npm:
npm install edenred-transactionsAfter installing, import it into your project:
import edenred from 'edenred-transactions';Example
Saving transactions to a CSV file:
import edenred from 'edenred-transactions';
try {
await edenred.login({
user: '[email protected]',
password: 'YourPassword123456'
});
const transactions = await edenred.getTransactions();
edenred.saveTransactions(transactions);
} catch(err) {
console.error(err);
}Methods
login
Logs in with the provided credentials.
edenred.login({
endpoint: 'https://www.myedenred.pt/edenred-customer/api',
user: '[email protected]',
password: 'YourPassword123456'
});| Property | Definition |
| -------- | ---------- |
| endpoint | Optional; defaults to the Portuguese endpoint |
| user | The user name, e-mail address or hash |
| password | The user password or PIN |
| type | Optional; defaults to default and can be set to pin |
By using the default authentication, and in order to validate the login process, the module will prompt the user to enter the 2FA code that is sent to their e-mail. This function returns the authentication token for later use, if needed.
To bypass the 2FA prompt, you need specific user hash and PIN code, which you can retrieve while logging in through the mobile app. This involves intercepting traffic with a tool like HTTP Toolkit or Burp Suite.
getTransactions
Retrieves transactions for a specific card. If no card identification is provided, the module will attempt to retrieve one from the first card in the user's account.
edenred.getTransactions('123456');saveTransactions
Saves the transactions to a file, either in CSV or JSON format.
Use the second parameter in boolean to indicate whether to save in CSV format, which defaults to true.
The third parameter indicates the folder where the file will be saved. Default is transactions.
edenred.saveTransactions(transactionsArray, false, 'some-folder');