Coder Social home page Coder Social logo

eitol / gosii Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 763 KB

Permite consultar nombres y actividades econónicas de personas usando la web del servicio de impuestos internos de chile (SII)

License: MIT License

Go 100.00%
chile cl impuestos servicio sii chilenean rut rutificador

gosii's Introduction

Chilean RUT Lookup Library (Sii)

This is a Golang library for fetching the name and commercial activities of a Chilean citizen using their RUT (Rol Único Tributario) from the Servicio de Impuestos Internos (SII) of Chile.

Installation

Use the go get command to install the library:

go get github.com/Eitol/gosii

Usage

// Print the name of a person given their RUT
package main

import (
	"fmt"
	"github.com/Eitol/gosii"	
	"strconv"
)

func main() {
	rutExample := "5.126.663-3" // RUT de Sebastian Piñera
	ssiClient := gosii.NewClient()
	citizen, err := ssiClient.GetNameByRUT(rutExample)
    if err != nil {
        panic(err)
    }
	fmt.Println(citizen.Name)
	// Output: MIGUEL JUAN SEBASTIAN PINERA ECHENIQUE
	
	fmt.Print(citizen.Activities[0])
	// Output: 829900
	
	// Note: "829900" is the code of "OTRAS ACTIVIDADES DE SERVICIOS DE APOYO A LAS EMPRESAS N.C.P"	
}   

How it Works

The library works by making HTTP requests to the SII's web services and parsing the responses. The flow can be summarized in the following steps:

1- Fetch a captcha challenge from SII's service (necessary for making requests).

2- Send a POST request to SII's service with the provided RUT and the fetched captcha.

3- Parse the HTML response to extract the citizen's name and associated commercial activities.

A crucial step in this process is fetching and solving the captcha challenge.

To solve the captcha, the library decodes a base64 encoded string provided by SII's service, which includes the captcha solution.

flow

echo | openssl s_client -servername zeus.sii.cl -connect zeus.sii.cl:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > zeus_sii.pem

Note

The Software is provided for academic purposes only. Commercial use is not permitted.

gosii's People

Contributors

eitol avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.