diff --git a/README.md b/README.md new file mode 100644 index 0000000..f065f39 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# GOFATQR +Small package to parse the strings contained the QR codes in portuguese +invoices. +Returns a struct containing go idiomatic types accordingly to the spec sheet. + + +# USAGE +```go +package main + +import ( + "github.com/ESilva15/gofatqr" + "log" +) + +func main() { + input := "A:123456789*B:999999990*C:PT*D:FT*E:N*F:20191231*" + + "G:FT AB2019/0035*H:CSDF7T5H-0035*I1:PT*I2:12000.00*I3:15000.00*" + + "I4:900.00*I5:50000.00*I6:6500.00*I7:80000.00*I8:18400.00*J1:PT-AC*" + + "J2:10000.00*J3:25000.56*J4:1000.02*J5:75000.00*J6:6750.00*" + + "J7:100000.00*J8:18000.00*K1:PT-MA*K2:5000.00*K3:12500.00*K4:625.00*" + + "K5:25000.00*K6:3000.00*K7:40000.00*K8:8800.00*L:100.00*M:25.00*" + + "N:64000.02*O:513600.58*P:100.00*Q:kLp0*R:9999*" + + "S:TB;PT00000000000000000000000;513500.58" + + var qr gofatqr.FatQR + err := qr.Scan(input, 0) + if err != nil { + log.Println("Oopsie:", err) + } + + log.Printf("%+v\n", qr) +} +``` + + +# TODO - Improvements +- [ ] NIF (portuguese and international) validation +- [ ] Make it as compliant with the types from SAF-T as possible +- [ ] Scan modes for stricter scanning diff --git a/api_test.go b/api_test.go index 95b27e3..ffe0a5d 100644 --- a/api_test.go +++ b/api_test.go @@ -1,7 +1,7 @@ package gofatqr_test import ( - "gofatqr" + "github.com/ESilva15/gofatqr" "testing" ) diff --git a/coverage.html b/coverage.html deleted file mode 100644 index 86572c1..0000000 --- a/coverage.html +++ /dev/null @@ -1,806 +0,0 @@ - - - - - - gofatqr: Go Coverage Report - - - -
- -
- not tracked - - not covered - covered - -
-
-
- - - - - - - -
- - - diff --git a/fatQR.go b/fatQR.go index eb0ad29..d3e4a46 100644 --- a/fatQR.go +++ b/fatQR.go @@ -641,8 +641,7 @@ func (fq *FatQR) scanParts(parts []string) error { return nil } -// TODO -// Use flags like STRICT | VALIDATE to do conditional stuff +// Scan scans a given string and applies the rules of `mode` (to be defined) func (fq *FatQR) Scan(s string, mode ScanMode) error { parts := strings.Split(s, "*") diff --git a/go.mod b/go.mod index d2cd057..76e87e9 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gofatqr +module github.com/ESilva15/gofatqr go 1.24.6 diff --git a/main.go b/main.go deleted file mode 100644 index 606219e..0000000 --- a/main.go +++ /dev/null @@ -1,4 +0,0 @@ -package gofatqr - -func Parse(data string) { -}