Skip to content

ron86i/go-siat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

114 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

go-siat is a professional SDK developed in Go, designed to simplify integration with SIAT (Integrated Tax Administration System) SOAP web services.

πŸ’‘ Why go-siat?

Integrating with SIAT's SOAP web services for electronic invoicing in Bolivia is often a complex process involving manual XML handling, digital signatures (XMLDSig), and error-prone nested data structures.

go-siat abstracts all this complexity behind a modern, idiomatic, and type-safe SDK. Our goal is to allow Bolivian developers to focus on the business logic of their applications (POS, ERPs), while the SDK handles:

  • Building perfect SOAP envelopes.
  • Digital signatures required by the tax authority.
  • Compression and encoding of invoice packages.
  • Structured management of catalogs and operations.

🎯 Features

  • πŸ›‘οΈ Type-Safe: Rigorous data structures for ALL requests and responses (goodbye to generic maps and hardcoded strings).
  • πŸ—οΈ Builder Pattern: Intuitive construction of complex requests (such as invoices and cancellations) through fluid interfaces.
  • πŸ“¦ Total SOAP Abstraction: Transparent management of the SOAP layer. The developer interacts with structs, not XML.
  • ✍️ Integrated Digital Signature (XMLDSig): Utilities to automatically sign invoices with your digital certificate.
  • πŸš€ High Performance: Zero unnecessary dependencies, leveraging Go's native speed for byte manipulation and compression.
  • 🧩 Modular: Multiple services (Codes, Synchronization, Operations, Sales, Electronic, Computerized) clearly separated.
  • 🏒 Multi-Sector: Native and verified support for 35 different sectors (Sales, Hotels, Mining, Hospitals, Hydrocarbons, etc.).

πŸ“– Table of Contents

  1. Why go-siat?
  2. Features
  3. Quick Start Guide
  4. Advanced Examples
  5. Usage Reference (Tests)
  6. Contribution and Support
  7. License

Implemented Capabilities

The SDK covers the critical services of the SIAT ecosystem:

Services Key Functionalities
Codes CUIS/CUFD Request (Individual and Massive), NIT Validation, Communication.
Synchronization Catalogs for activities, parametric, products, services, and sector documents.
Operations POS Registration/Closing, Significant Event Management.
Sales Specific service for sales, bonuses, and fees.
Online Electronic Full support for invoicing with digital signature.
Online Computerized Support for modalities without digital signature.
Special Sectors Verified support for the 35 regulatory sectors of SIAT.

Supported Sectors

go-siat includes domain models, builders, and integration tests for the 35 regulatory sectors of SIAT (located in pkg/models/invoices/):

🏒 Standard and Services

  • Sales (Sector 1): The standard sector for most businesses.
  • Rental of Real Estate: For the real estate and leasing sector.
  • Insurance: Issuance of policies and insurance services.
  • Basic Services: Electricity, water, gas, and telecommunications.
  • Tourism and Lodging / Hotels: For the hotel sector and tour operators.
  • Hospitals and Clinics: Health services (National and Free Trade Zone).
  • Food Security: Commercialization of basic food basket products.

🏺 Export and Free Trade Zone

  • Export of Goods and Services: Commercial Export, Services, and Free Consignment.
  • Free Trade Zone: ZF Invoices, ZF Rental, and ZF Hospital Services.
  • Duty Free: Invoicing for duty-free shops in airports.

β›½ Hydrocarbons and Energy

  • Commercialization of Hydrocarbons: Fuels, Lubricants (with and without IEHD).
  • Bottling Plants: LPG distribution sector.
  • CNG and GNV: Commercialization of Natural Gas for Vehicles.
  • Unsubsidized Fuel: For sale at international price.

⛰️ Mining and Metals

  • Sale of Minerals: Internal Sale and Export of Minerals.
  • Sale to BCB: Sale of gold and minerals to the Central Bank of Bolivia.

πŸŽ“ Education

  • Educational Sectors: Schools, Universities, and Institutes (National and Free Trade Zone).

🎲 Other Special Sectors

  • Games of Chance: Casinos and entertainment venues.
  • Zero Tax (Tasa Cero): Books and international cargo transportation.
  • ICE Products: Items covered by the Specific Consumption Tax.
  • Prepayments and Shared Invoice: Complex invoicing flows.
  • Prevalued: Invoices with fixed price and recurring tax service.
  • Foreign Currency Exchange: Exchange houses and financial entities.

πŸš€ Quick Start Guide

1. Requirements

  • Go 1.25 or higher.
  • Valid digital certificate (p12/pfx) and private key (for Electronic modality).

Tip

Context Best Practices: Always provide a context with a timeout (e.g., 30s) to all SDK calls. Avoid using context.Background() directly to prevent hanging requests if the SIAT server is slow.

2. Installation

go get github.com/ron86i/go-siat

3. Usage Example: Verifying NIT

package main

import (
	"context"
	"fmt"
	"github.com/ron86i/go-siat"
	"github.com/ron86i/go-siat/pkg/models"
)

func main() {
	// 1. Initialize the client
	s, _ := siat.New("YOUR_SIAT_URL", nil)

	// 2. Prepare the request using builders
	req := models.Codigos().NewVerificarNitBuilder().
		WithNit(123456789).
		Build()

	// 3. Execute call
	resp, err := s.Codigos().VerificarNit(context.Background(), req)
	if err != nil {
		panic(err)
	}

	fmt.Printf("NIT Transaction status: %v\n", resp.Body.Content.RespuestaVerificarNit.Transaccion)
}


The best way to learn how to use each service is by reviewing the integration tests:

Category Test File
Codes siat_codigos_service_test.go
Synchronization siat_sincronizacion_service_test.go
Operations siat_operaciones_service_test.go
Sales siat_compra_venta_service_test.go
Electronic siat_electronica_service_test.go
Computerized siat_computarizada_service_test.go
Invoicing (Sectors) pkg/models/invoices/
End-to-End siat_test.go

Contributions are welcome! If you find a bug or have a suggestion, please open an Issue or a Pull Request (please review the CONTRIBUTING.md).

If you need technical help or commercial support for integrating electronic invoicing in your company, please check our SUPPORT.md.


πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Go SDK for integration with the Integrated Tax Administration System (SIAT) v2.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Languages