Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haraj-backend/zatca-sdk-go
An unofficial package in Golang to help developers implement ZATCA (Fatoora) QR code easily.
https://github.com/haraj-backend/zatca-sdk-go
e-invoicing fatoora go golang qr-code qrcode saudi-arabia sdk-go zatca
Last synced: 2 months ago
JSON representation
An unofficial package in Golang to help developers implement ZATCA (Fatoora) QR code easily.
- Host: GitHub
- URL: https://github.com/haraj-backend/zatca-sdk-go
- Owner: Haraj-backend
- License: mit
- Created: 2021-12-02T07:06:02.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-06T05:12:14.000Z (about 3 years ago)
- Last Synced: 2024-06-21T14:14:36.250Z (7 months ago)
- Topics: e-invoicing, fatoora, go, golang, qr-code, qrcode, saudi-arabia, sdk-go, zatca
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 19
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zatca SDK GO
[![Build](https://github.com/Haraj-backend/zatca-sdk-go/actions/workflows/build.yml/badge.svg)](https://github.com/Haraj-backend/zatca-sdk-go/actions/workflows/build.yml)
[![Test](https://github.com/Haraj-backend/zatca-sdk-go/actions/workflows/test.yml/badge.svg)](https://github.com/Haraj-backend/zatca-sdk-go/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/Haraj-backend/zatca-sdk-go)](https://goreportcard.com/report/github.com/Haraj-backend/zatca-sdk-go)An unofficial package in Golang to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing
> ✅ The hash result has been validated the same as the output from ZATCA's SDK as of 18th November 2021
## Installation
```
go get github.com/Haraj-backend/zatca-sdk-go
```## Simple Usage
```golang
package mainimport (
"log"
"time""github.com/Haraj-backend/zatca-sdk-go/qrcode"
)func main() {
// encode data using TLV method to get code hash
hash, err := qrcode.EncodeTLV(qrcode.Data{
SellerName: "Bobs Records",
SellerTaxNumber: "310122393500003",
Timestamp: time.Date(2022, 04, 25, 15, 30, 00, 00, time.UTC),
InvoiceTotal: 1000,
TotalVAT: 150,
})
if err != nil {
log.Fatalf("unable to encode TLV due: %v", err)
}
fmt.Println("hash data:", hash)// decode hash using TLV method to get data
data, err := qrcode.DecodeTLV(hash)
if err != nil {
log.Fatalf("unable to decode TLV due: %v", err)
}
fmt.Printf("decoded hash: %s", data)
}
```## Generating QR Code
This package is only used for encoding QR Code data into base64 hash using TLV method. So it doesn't contain functionality to generate QR Code image.
If you want to generate the QR Code image, you could use another library such as [skip2/go-qrcode](https://github.com/skip2/go-qrcode). You could check [examples/qrcode_generator](./examples/qrcode_generator) for details.