Skip to content

AndreMiras/laboral-kutxa.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laboral-kutxa.js

Tests Coverage Status Documentation npm version

Unofficial Laboral Kutxa JS library

Install

npm install laboral-kutxa

Library Usage

Reading through the misProductos list:

import { login, getMyProducts } from "laboral-kutxa";

const main = async () => {
  const { USERNAME, PASSWORD } = process.env;
  const { token } = await login(USERNAME, PASSWORD);
  const products = await getMyProducts(token);
  products.misProductos.map(({ alias, grupo }) => ({ alias, grupo }));
};

Output:

[
  { alias: "CUENTA 0,0", grupo: "cuentasCorrientes" },
  { alias: "VISA ELECTRÓN", grupo: "tarjetas" },
  { alias: "PRESTAMO", grupo: "prestamos" },
];

Accessing the aggregated amounts per account types:

const products = await getMyProducts(token);
const { _CuentasCorrientes: currentAccount, _Financiacion: financing } =
  products._Importes;
console.log({ currentAccount, financing });

Output:

{
  currentAccount: { cantidad: 1234.56, moneda: 'EUR' },
  financing: { cantidad: 123456.78, moneda: 'EUR' }
}

CLI Usage

It's also possible to consume the CLI directly to access the account.

npx laboral-kutxa --balance