Coder Social home page Coder Social logo

go-qonto's Introduction

Go API client and CLI for Qonto banking service.

Build Status GoDoc

DISCLAIMER

This package and the CLI are not provided nor supported by Qonto

go-qonto package quickstart

go get github.com/toorop/go-qonto

import "github.com/toorop/go-qonto"

func main(){
    Q := qonto.New("qonto-login", "qonto-API-secret")
    organization, err := Q.GetOrganization("slug")
	if err != nil {
		fmt.Println("ERROR ! unable to get organization -", err)
		os.Exit(1)
	}
	fmt.Println(organization)
}

To get last transactions:

import "github.com/toorop/go-qonto"

func main(){
    Q := qonto.New("qonto-login", "qonto-API-secret")
	options := qonto.GetTransactionOptions{
		Slug:   "slug",
		Iban:   "iban",
		Status: []string{"pending", "reversed", "declined", "completed"},
    }
    transactions, err := Q.GetTransactions(options)
	if err != nil {
		fmt.Println("ERR: ", err)
		os.Exit(1)
    }
    for _, transaction := range transactions {
        fmt.Println(transaction)
    }
}

qonto CLI

qonto CLI allow you interact with Qonto services from the command line

Installation

By downloading pre-build binary for your system

qonto CLI is available as compiled binary for Windows, Mac OS, and Linux (386, amd64, arm, arm64 flavors)

Download from qonto CLI releases page

Once you have downloaded the last release, it could be a goood idea to rename the binary ;)

mv qonto_0.0.1-alpha_Linux-64bit qonto

By compiling you own binary from source

  • Install Go (at least 1.9) on your system

  • "go get" dépendencies:

    $ go get -u github.com/asaskevich/govalidator
    $ go get -u github.com/spf13/cobra
    $ go get -u github.com/spf13/viper
    
  • "go get" source code:

    $ go get github.com/toorop/go-qonto
  • run "go install" to build and install qonto CLI

    $ cd $GOPATH/src/github.com/toorop/go-qonto/qonto
    $ go install
    
  • qonto binary should be available on yout $PATH:

    $ qonto --version
    qonto version 0.0.1-alpha
    

Configuration

You need to setup some configuration before running qonto CLI, at least you must provide your Qonto ID and your Qonto secret API key (see "integration" on your Qonto dashboard).

You have two ways to proceed:

  • Using a config file (needed if you want to use the 'watch' command with email notifiaction).

WARNING: if you put qonto binary on your binaries PATH, you need to use the --config option or to put your config file on your working dir.

  • Using environment variables (for basic usages)
    • export QONTO_LOGIN & QONTO_SECRET

If you need new commands or features please open an issue.

help

qonto CLI have a builtin help, to access it you just have to use the --help flag.

Example:

$ qonto organization --help

Display your Qonto organizations

Example:

$ qonto organization
my-orga-42
                Slug: my-orga-42-bank-account-1
                IBAN: FR76XXXXXXXXX
                BIC: XXXXXXXX
                Currency: EUR
                Balance (€): 100000000.000000
                Balance (cents): 10000000000
                Authorized Balance (€): 0.000000
                Auhorized Balance (cents): 0

Usage:
  qonto organization [flags]

Flags:
  -h, --help   help for organization

Global Flags:
  -c, --config string   config file

watch command

watch command allow you to be informed on new transations or on transaction updates.

By default watch command display update on stdout, but it can send a email and/or send a POST request, containing the transaction update, to a predefined URL.

To keep the watch command running when you logout, add "&" at the and of the command ou use tmux

email notifications

An email will be send to the defined address on each transaction event. To receive email notifications you must configure smtp section of the config file to provide at least smtp.host, smtp.port and smtp.mailfrom.

Example:

To receive an email notification on each event

qonto watch --slug SLUG --iban IBAN -m EMAIL_ADDRESS_TO_SEND_MAIL_TO

webhook

To enable webhook notification you just have to add the --webhook flag with a valid URL

qonto watch --slug SLUG --ib IBAN --webhook https://qonto.toorop.fr -m EMAIL_ADDRESS_TO_SEND_MAIL_TO

qonto CLI will do a POST request to this URL, with the JSON encoded transaction object in the request body, on each transaction update.

The format of the JSON object is same as the one returned by Qonto API

organization command

organization command returns details about your organization and your banks accounts.

Example:

$ qonto organization
my-orga-42
                Slug: my-orga-42-bank-account-1
                IBAN: FR76XXXXXXXXX
                BIC: XXXXXXXX
                Currency: EUR
                Balance (€): 100000000.000000
                Balance (cents): 10000000000
                Authorized Balance (€): 0.000000
                Auhorized Balance (cents): 0

Support this project

If this project is useful for you, please consider making a donation.

Bitcoin

Address: 1JvMRNRxiTiN9H7LyZTq4yzR7ez86M7ND6

Bitcoin QR code

Ethereum

Address: 0xA84684B45969efbD54fd25A1e2eD8C7790A0C497

ETH QR code

go-qonto's People

Contributors

toorop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dolanor-galaxy

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.