inter

package module
v0.0.0-...-fcc3e16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 13 Imported by: 0

README

Banco Inter Go client

Building command line tools

$ go build ./cmd/inter-token
$ go build ./cmd/inter-banking

Authorize and get the user token

$ inter-token -scopes extrato.read -client-id <your client id> -client-secret <your client secret> --output-format info
token     a1200a94-b847-4cda-a510-cc0b9c7182d4
type      Bearer
expires   2022-02-02T02:22:22-03:00
scopes    extrato.read

Use the banking tool

Show the command help using inter-banking --help

Usage: inter-banking [OPTION...] <COMMAND>

  -h, --help                 give this help list
  -c, --cert                 signed certificate file (default 'cert.crt')
  -k, --key                  certificate private key file (default 'cert.key')
  -t, --token                personal user token


balance                      get account balance

  -d, --date                 balance date in the format YYYY-MM-DD (defaults to
                             today)
  -f, --output-format        the output format used to show balance; can be
                             'short' (default) or 'full'

statement                    fetch account statements

  -s, --start-date           statements start date in the format YYYY-MM-DD
  -e, --end-date             statements end date in the format YYYY-MM-DD (defaults to
                             today)
Fetch account balances
$ inter-banking --token a1200a94-b847-4cda-a510-cc0b9c7182d4 --date 2022-02-02 --output-format full
Balances at 2022-02-02

Available                  143293.57
Limit                           0.00
On hold                         0.00
Judicially blocked              0.00
Administratively blocked        0.00
List account statements
$ inter-banking --token a1200a94-b847-4cda-a510-cc0b9c7182d4 --start-date 2022-02-02 --end-date 2023-02-12
Statements from 2022-02-02 to 2022-02-12

Date             Value   Operation  Type           Title                   Description
2022-02-02    22373.32   credit     transferencia  Transferência recebida  TED RECEBIDA - 001 BANCO 001 S.A.            
2022-02-05    22300.00   debit      pix            Pix enviado             PIX ENVIADO - Cp :123456  
2022-02-09     1000.00   debit      pix            Pix enviado             PIX ENVIADO - Cp :789012

Documentation

Index

Constants

View Source
const (
	PixTransactionType = TransactionType(iota + 1)
	PagamentoTransactionType
	TransferenciaTransactionType
)
View Source
const (
	CreditTransactionOperation = TransactionOperation(iota + 1)
	DebitTransactionOperation
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Available               float32
	Limit                   float32
	CheckOnHold             float32
	JudiciallyBlocked       float32
	AdministrativelyBlocked float32
}

type Banking

type Banking struct {
	// contains filtered or unexported fields
}

func NewBanking

func NewBanking(client *Client, token Token) *Banking

func (*Banking) Balance

func (b *Banking) Balance(ctx context.Context, date time.Time) (Balance, error)

func (*Banking) Transactions

func (b *Banking) Transactions(ctx context.Context, start, end time.Time) ([]Transaction, error)

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c tls.Certificate) *Client

type OAuth

type OAuth struct {
	// contains filtered or unexported fields
}

func NewOAuth

func NewOAuth(client *Client) *OAuth

func (*OAuth) Authorize

func (o *OAuth) Authorize(ctx context.Context, clientID, clientSecret string, scopes ...string) (Token, error)

type Token

type Token struct {
	Data      string
	Type      string
	Scopes    []string
	ExpiresAt time.Time
}

func TokenFromString

func TokenFromString(s string) Token

func (Token) Valid

func (t Token) Valid() bool

type Transaction

type Transaction struct {
	Date        time.Time
	Type        TransactionType
	Operation   TransactionOperation
	Value       float32
	Title       string
	Description string
}

type TransactionOperation

type TransactionOperation int

func (TransactionOperation) String

func (t TransactionOperation) String() string

type TransactionType

type TransactionType int

func (TransactionType) String

func (t TransactionType) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL