Logo Lanfrica

mikemasam/easyvfd

Domaine:

digital infrastructure

Type de record:

software
Créateur:
mik
Hôte:
🇹🇿 Issue receipts & automate Z-reports for TRA in Tanzania! 🇹🇿 Introducing EasyVFD: a simplified npm library for the TRA VFD API. Features: Instant receipt issuing, Automated Z-reporting, Persistent storage # Simplified TRA VFD API This library provides a simplified TRA VFD API for instant receipt issuing, automated Z-reporting, and persistent storage. ## Table of Contents - Description - Requirements - Installation - Starting the Server - TIN Registration - Receipt Posting - Response ## Description This is a simplified TRA VFD API for instant receipt issuing, automated Z-reporting, and persistent storage. ## Requirements - Bun is required to run the server. ## Installation 1. Install Bun: ```bash curl -fsSL bun.sh | bash ``` 2. Install the necessary packages: ```bash npm install ``` ## Configuration .env ```.env PORT=8080 DB_HOST="localhost" DB_NAME="easyvfd" DB_USER="root" DB_PASSWORD="password" TRA_URL="vfdtest.tra.go.tz" #TRA_URL="virtual.tra.go.tz" TOKEN_URL="vfdtoken" REGISTER_CLIENT_URL="api/vfdregreq" POST_RECEIPT_URL="/api/efdmsRctInfo" POST_ZREPORT_URL="/api/efdmszreport" ``` ## Starting the Server To start the server, use one of the following commands: ```bash npm start ``` or ```bash bun index.ts ``` ## TIN Registration Register a TIN using the following command: ```bash bun index.ts api clients create --certkey=12312 --tin=1231321 --key=data/key.pem --certpath=data/cert.pem ``` ## Receipt Posting To post a receipt, use the following JavaScript example: ```js const body = () => ({ tin: "100100224", issued_date: "2024-04-01 11:10:09", bill_reference: Math.random().toString(), bill_receipt: Math.random().toString(), customer_id: "131232312", customer_id_type: "1", customer_name: "123123", customer_mobile: "123123", items: [{ ref: "item_1", desc: "item 1", qty: 1, amount_excl: 10000, amount_tax: 1800, tax_code: `A`, }], payments: [{ ref: "qerq", type: "CASH", amount: 11010 }] }); await axios.post("localhost", body()).then(res => { console.log(res.data); }); ``` ## Response A successful response will have the following format: ```json { "data": { "rctv_num": …