npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

viettel-s-invoice

v1.0.10

Published

Viettel S Invoice

Downloads

786

Readme

Viettel S Invoice API Integration

[!NOTE] This is an UNOFFICIAL project. It is not affiliated with or endorsed by Viettel.

This project provides a class ViettelSInvoice that allows interaction with the Viettel S Invoice API.

Table of Contents

Prerequisites

Before using the Viettel S Invoice API, you will need:

  • An active Viettel S Invoice account with a valid username and password.
  • An API endpoint URL to connect to the Viettel S Invoice API.
  • A basic understanding of how to interact with APIs.

Installation

npm install --save viettel-s-invoice

Usage

const viettelSInvoice = new ViettelSInvoice({
  username: 'your-username', // required
  password: 'your-password', // required
  apiEndPoint: 'https://api.viettel.vn', // optional
});

Preview Draft Invoice

To preview a draft invoice, use the previewDraftInvoice method:

viettelSInvoice.previewDraftInvoice(invoice)
  .then(response => console.log(response))
  .catch(error => console.error(error));
  • invoice: The draft invoice data to preview.

Create Invoice

To create an invoice, use the createInvoice method:

viettelSInvoice.createInvoice(invoice)
  .then(response => console.log(response))
  .catch(error => console.error(error));
  • invoice: The data for creating the invoice.

Get Invoice by Transaction UUID

To retrieve an invoice by its transaction UUID, use the getInvoiceByTransactionUuid method:

const transactionUuid = '7a9f9e2a-d28f-4bef-a9d0-d91607453f70';

viettelSInvoice.getInvoiceByTransactionUuid(transactionUuid)
  .then(response => console.log(response))
  .catch(error => console.error(error));
  • transactionUuid: The unique identifier of the transaction associated with the invoice.

Get Invoices by Date Range

To get invoices within a specified date range, use the getInvoicesByDateRange method:

const fromDate = '01/01/2024';
const toDate = '31/01/2024';

viettelSInvoice.getInvoicesByDateRange(fromDate, toDate)
  .then(response => console.log(response))
  .catch(error => console.error(error));
  • fromDate: The start date of the range (format: DD/MM/YYYY).
  • toDate: The end date of the range (format: DD/MM/YYYY).

Get Invoice File

  • To retrieve an invoice file, use the getInvoiceFile method:
viettelSInvoice.getInvoiceFile({ invoiceNo, templateCode, fileType })
  .then(response => console.log(response))
  .catch(error => console.log(error));
  • invoiceNo: The invoice number.
  • templateCode: The template code for the invoice.
  • fileType: The file type (e.g., PDF, ZIP).

Get Invoice Templates

  • To retrieve invoice templates code, use the getInvoiceTemplates method:
const invoiceType = '01BLP'

viettelSInvoice.getInvoiceTemplates(invoiceType)
  .then(response => console.log(response))
  .catch(error => console.log(error));

Exceptions

The following exceptions are handled by the ViettelSInvoice class:

  • ViettelSInvoiceLoginException: Thrown if login fails.
  • ViettelSInvoiceCreateInvoiceException: Thrown if invoice creation fails.
  • ViettelSInvoicePreviewDraftInvoiceException: Thrown if reviewing a draft invoice fails.
  • ViettelSInvoiceGetInvoiceException: Thrown if retrieving an invoice fails.
  • ViettelSInvoiceGetInvoicesException: Thrown if retrieving invoices by date range fails.
  • ViettelSInvoiceGetInvoiceFileException: Thrown if retrieving an invoice file fails.
  • ViettelSInvoiceGetTemplatesException: thrown if retrieving invoice templates fails
  • Each exception includes a descriptive error message.

License

This project is licensed under the MIT License. See the LICENSE file for details.