Giter Site home page Giter Site logo

bb-api's Introduction

bb-api GitHub license npm version Build Status

Unofficial node.js implementation of Banco do Brasil's mobile API

Installation

yarn add bb-api
# or
npm install bb-api --save

API Usage

Checking Account (Conta Corrente)

import BB from 'bb-api';

const bb = new BB();
await bb.login({ branch: 'XXXXX', account: 'XXXXXXX', password: 'XXXXXXXX' });

// Recover balance
const checkingBalance = await bb.checking.getBalance();

// Recover transactions in month
const checkingTransactions = await bb.checking.getTransactions({
  year: 2018,
  month: 11,
});

Savings Account (Poupança)

import BB from 'bb-api';

const bb = new BB();
await bb.login({ branch: 'xxxxxx', account: 'xxxxxxx', password: 'xxxxxxxx' });

// Recover savings accounts available (variações, ex: 1, 51, etc)
const savingsAccounts = await bb.savings.getAccounts();

// Recover transactions from savings account in month
const savingsTransactions = await savingsAccounts[0].getTransactions({
  year: 2018,
  month: 11,
});

Credit Card (Cartão de Crédito)

import BB from 'bb-api';

const bb = new BB();
await bb.login({ branch: 'xxxxxx', account: 'xxxxxxx', password: 'xxxxxxxx' });

// Recover list of available credit cards
const creditCards = await bb.creditCard.getCards();

// Recover bills of a credit card (faturas)
const creditCardBills = await creditCards[0].getBills();

// Recover transactions from specific bill
const creditCardTransactions = await creditCardBills[0].getTransactions();

Command line

Clone the repository and follow the steps bellow:

To use it via command line just execute the command below, replacing XXXXXs by your credentials:

$ yarn babel-node src/index.js --bbBranch="XXXXX" --bbAccount="XXXXXXX" --bbPassword="XXXXXXXX"

and it will print in console the last data of your account:

{
  checkingBalance: 273.48,
  checkingTransactions: [
    {
      date: 2018-11-05T02:00:00.000Z,
      description: 'Transferido da poupança',
      amount: 840.18
    },
    {
      date: 2018-11-05T02:00:00.000Z,
      description: 'Compra com Cartão',
      amount: -10.19
    },
    {
      date: 2018-11-05T02:00:00.000Z,
      description: 'Transferência enviada 04/11 JOÃO',
      amount: -159.18
    },
    ...
  ]
}

{
  savingsAccounts: [
    {
      variation: 1,
      description: 'Poupança Ouro - Variação 1'
    },
    {
      variation: 51,
      description: 'Poupança Ouro - Variação 51'
    },
    ...
  ],
  savingsTransactions: [
    {
      date: 2018-11-16T02:00:00.000Z,
      description: 'Juros',
      amount: 0.02
    },
    {
      date: 2018-11-30T02:00:00.000Z,
      description: 'Transferencia Para Conta',
      amount: -3.92
    },
    ...
  ]
}

{
  creditCards: [
    {
      brand: 'VISA',
      modality: '74',
      cardAccountNumber: '12345678',
      cardNumber: '0000123456781111'
    },
    {
      brand: 'VISA',
      modality: '1',
      cardAccountNumber: '12345679',
      cardNumber: '0000123456781112'
    },
    ...
  ],
  creditCardBills: [
    {
      cardAccountNumber: '12345678',
      billId: '123123123',
      billDate: '25112018'
    },
    {
      cardAccountNumber: '12345678',
      billId: '123123124',
      billDate: '25102018'
    },
    ...
  ],
  creditCardTransactions: [
    {
      type: 'payment',
      date: 2018-10-22T03:00:00.000Z,
      description: 'PGTO. CASH AG. 1111 000123456 100',
      amount: 1000.12
    },
    {
      type: 'atSight',
      date: 2018-10-10T03:00:00.000Z,
      description: 'RESTAURANTE X',
      amount: -27
    },
    ...
  ],
}

Contributing

  1. Fork it (https://github.com/arthurnobrega/bb-api/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

bb-api's People

Contributors

arthurnobrega avatar pedrolauro avatar jmferreiratech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.