=============== LIBRARY RULES =============== From library maintainers: - Use nfs.CreateTemplateGenerator() to create invoice generators with error handling, or nfs.MustCreateTemplateGenerator() for guaranteed valid types - Use br_documents.CPF(), br_documents.CNPJ(), and br_documents.AccessKey() for generating valid Brazilian fiscal identifiers - Pass options using nfs.WithCPF() and nfs.WithCNPJ() to customize generated invoices - Use nfs.WithBlockedPlaceholders() to exclude specific XML tags from generated invoices - Template types available: nfs.NFe, nfs.NFCe, nfs.CFe, nfs.NFeDevolucao ### Clone BrFiscalFaker Repository and Build Application Source: https://github.com/mayckol/brfiscalfaker/blob/main/README.md These commands show how to clone the BrFiscalFaker repository from GitHub and then build the command-line application. This is the initial setup step for using the tool locally. ```bash git clone https://github.com/mayckol/brfiscalfaker.git cd brfiscalfaker go build -o bfiscalfaker ./cmd/bfiscalfaker/main.go ``` -------------------------------- ### Run brfiscalfaker with Docker Source: https://github.com/mayckol/brfiscalfaker/blob/main/README.md This section provides Docker commands to pull the brfiscalfaker image and run it. It includes an example of how to specify document types (NFe) and provide CPF and CNPJ as arguments for generation. ```shell docker pull mayckol/bfiscalfaker ``` ```shell docker run mayckol/bfiscalfaker --type NFe --cpf 12345678900 --cnpj 12345678901234 ``` -------------------------------- ### Download BrFiscalFaker Library and Use Testing Utilities Source: https://github.com/mayckol/brfiscalfaker/blob/main/README.md This Go code demonstrates how to download the BrFiscalFaker library using 'go get' and then utilize its testing utilities within a Go test file. The `nfs.GenerateValidInvoiceXML` function is shown for creating mock invoice XML with optional custom data. ```go go get github.com/mayckol/brfiscalfaker package mypackage_test import ( "testing" "github.com/mayckol/brfiscalfaker/pkg/nfs" ) func TestInvoiceProcessing(t *testing.T) { // Generate a valid NFe XML for testing xml := nfs.GenerateValidInvoiceXML(t, nfs.NFe) // Or with custom options xml = nfs.GenerateValidInvoiceXML(t, nfs.NFCe, nfs.WithCPF("12345678900"), nfs.WithCNPJ("12345678901234"), ) // Use the XML in your tests... } ``` -------------------------------- ### Generate Basic and Customized BrFiscalFaker Invoices Source: https://github.com/mayckol/brfiscalfaker/blob/main/README.md These examples demonstrate how to use the BrFiscalFaker command-line tool to generate different types of Brazilian fiscal invoices. They cover basic generation, specifying invoice type, and including custom CPF/CNPJ numbers, as well as blocking specific XML tags. ```bash go run cmd/bfiscalfaker/main.go go run cmd/bfiscalfaker/main.go --type NFe --cpf 12345678900 --cnpj 12345678901234 go run cmd/bfiscalfaker/main.go --type CFe --block-tags "nItem, vProd" go run cmd/bfiscalfaker/main.go --type NFCe --cpf 12345678900 --cnpj 12345678901234 --block-tags "nItem, vProd" ``` -------------------------------- ### Generate Brazilian Fiscal Documents (Go) Source: https://github.com/mayckol/brfiscalfaker/blob/main/README.md This Go code snippet demonstrates how to generate random Brazilian fiscal documents including CPF, CNPJ, and Access Keys using the br_documents package. It shows basic usage and mentions optional configuration for masked output. ```go package main import ( "fmt" "github.com/mayckol/brfiscalfaker/pkg/br_documents" ) func main() { cpf := br_documents.CPF() cnpj := br_documents.CNPJ() accessKey := br_documents.AccessKey() fmt.Println("CPF:", cpf) fmt.Println("CNPJ:", cnpj) fmt.Println("Access Key:", accessKey) } ``` -------------------------------- ### Create NFe/NFCe XML Template Generator (Go) Source: https://github.com/mayckol/brfiscalfaker/blob/main/README.md This Go code demonstrates how to create an XML template generator for NFe or NFCe using the nfs package. It shows how to instantiate the generator with a specific template type and apply options like CPF and CNPJ for customization before generating the XML. ```go package main import ( "log" "github.com/mayckol/brfiscalfaker/pkg/nfs" "fmt" ) func main() { // Define the desired template type templateType := nfs.NFCe // Create the generator using the helper generator, err := nfs.CreateTemplateGenerator(templateType) if err != nil { log.Fatalf("Failed to create generator: %v", err) } options := []nfs.Option{ nfs.WithCPF("01234567890"), nfs.WithCNPJ("12345678901234"), } // Generate the XML template xmlBytes, err := generator.Generate(options...) if err != nil { log.Fatalf("Failed to generate XML template: %v", err) } fmt.Println(string(xmlBytes)) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.