Installations
npm install node-tra
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
12.21.0
NPM Version
6.14.11
Score
65.4
Supply Chain
97.1
Quality
75
Maintenance
100
Vulnerability
99.3
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
husseinmkwizu
Download Statistics
Total Downloads
3,275
Last Day
1
Last Week
4
Last Month
32
Last Year
625
GitHub Statistics
7 Stars
22 Commits
8 Forks
1 Watching
2 Branches
1 Contributors
Bundle Size
106.47 kB
Minified
32.94 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.2
Package Id
node-tra@1.1.2
Unpacked Size
29.00 kB
Size
6.05 kB
File Count
15
NPM Version
6.14.11
Node Version
12.21.0
Total Downloads
Cumulative downloads
Total Downloads
3,275
Last day
-50%
1
Compared to previous day
Last week
-63.6%
4
Compared to previous week
Last month
0%
32
Compared to previous month
Last year
49.2%
625
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
node-tra
This package implements TRA (Tanzania Revenue Authority) APIs.
Install
via NPM
npm install node-tra --save
via yarn
yarn add node-tra
Load key certificate
Before calling any APIs, you will need to load your key certificate. You can use this helper function to do so.
1import { loadKeyCertificate } from "node-tra"; 2 3const { key } = await loadKeyCertificate( 4 "YOUR KEY FILE PATH", 5 "YOUR KEY PASSWORD" 6);
Registration
To get details about your company you need to call registration API. You call this once. You can reuse the result in the next steps.
1import { sendRegistrationRequest } from "node-tra"; 2 3//test environment details 4const hostname = "virtual.tra.go.tz"; 5const path = "/efdmsRctApi/api/vfdRegReq"; 6 7const response = await sendRegistrationRequest({ 8 tin: "YOUR TIN", 9 certKey: "YOUR CERT KEY", 10 signKey: key, //key loaded from first step 11 certSerial: "YOUR CERT SERIAL", 12 hostname: hostname, 13 path: path, 14}); 15 16//if successful, response.success == true 17const { success, data } = response;
Token
To upload receipts/invoices you will need to provide a token to TRA API. To get the token call this helper function.
1import { sendTokenRequest } from "node-tra"; 2 3//test environment details 4const hostname = "virtual.tra.go.tz"; 5const path = "/efdmsRctApi/vfdtoken"; 6 7const response = await sendTokenRequest({ 8 username: "USERNAME FROM REGISTRATION API", 9 password: "PASSWORD FROM REGISTRATION API", 10 grantType: "password", 11 hostname: hostname, 12 path: path, 13}); 14 15//if successful, response.success == true 16const { success, data } = response;
Upload invoice/receipt
1import { sendUploadInvoiceRequest } from "node-tra"; 2 3//test environment details 4const hostname = "virtual.tra.go.tz"; 5const path = "/efdmsRctApi/api/efdmsRctInfo"; 6 7const response = await sendUploadInvoiceRequest({ 8 tin: "YOUR TIN", 9 signKey: key, //key loaded from first step 10 certSerial: "YOUR CERT SERIAL", 11 token: "YOUR TOKEN", 12 routingKey: "ROUTING KEY FROM REGISTRATION API", 13 hostname: hostname, 14 path: path, 15 date: "2021-02-03", 16 time: "20:52:53", 17 regId: "REGID FROM REGISTRATION API", 18 efdSerial: "EFDSERIAL FROM REGISTRATION API", 19 receiptCode: "RECEIPTCODE FROM REGISTRATION API", 20 rctNum: "10103", 21 zNum: "20210203", 22 dc: "1", 23 gc: "10103", 24 customerId: "", 25 customerIdType: "6", 26 customerName: "John Doe", 27 mobileNumber: "255755123123", 28 items: [ 29 { 30 ID: 1, 31 DESC: "Product 1", 32 QTY: 1, 33 TAXCODE: 1, 34 AMT: "118000.00", 35 }, 36 ], 37 totals: { 38 TOTALTAXEXCL: "100000.00", 39 TOTALTAXINCL: "118000.00", 40 DISCOUNT: "0.00", 41 }, 42 payments: { 43 PMTTYPE: "EMONEY", 44 PMTAMOUNT: "118000.00", 45 }, 46 vatTotals: { 47 VATRATE: "A", 48 NETTAMOUNT: "100000.00", 49 TAXAMOUNT: "18000.00", 50 }, 51}); 52 53//if successful, response.success == true 54const { success, data } = response;
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
SAST tool detected: CodeQL
Details
- Info: SAST configuration detected: CodeQL
- Warn: no pull requests merged into dev branch
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/husseinmkwizu/node-tra/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/husseinmkwizu/node-tra/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/husseinmkwizu/node-tra/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/husseinmkwizu/node-tra/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/husseinmkwizu/node-tra/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/husseinmkwizu/node-tra/codeql-analysis.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
9 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More