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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ehoadon-bkav

v1.0.10

Published

A simple NPM package to interact with Bkav eHoaDon WebService

Downloads

647

Readme

ehoadon-bkav

npm version npm downloads

ehoadon-bkav là một gói NPM đơn giản để tương tác với WebService Bkav eHoaDon, hỗ trợ việc gửi, nhận, và quản lý hóa đơn thông qua SOAP và mã hóa dữ liệu.

Cài đặt

Bạn có thể cài đặt gói này bằng cách sử dụng NPM hoặc Yarn:

npm install ehoadon-bkav

Hoặc

yarn add ehoadon-bkav

Cách sử dụng

Ví dụ 1: Tạo hóa đơn mới

import { execCommand } from "ehoadon-bkav";
import { Config, CommandDataCreateUpdate } from "./types";

const config: Config = {
  partnerGUID: "your-partner-guid",
  partnerToken: "your-partner-token", // Dạng "keyBase64:ivBase64"
  mode: "dev", // hoặc "prod" cho môi trường sản xuất
};

const commandData: CommandDataCreateUpdate = {
  CmdType: 100,
  CommandObject: [
    {
      Invoice: {
        InvoiceTypeID: 1,
        InvoiceDate: "2023-10-22",
        BuyerName: "Nguyễn Văn A",
        BuyerTaxCode: "0101234567",
        BuyerUnitName: "Công Ty TNHH ABC",
        BuyerAddress: "Số 1 Đường ABC, Quận XYZ, Hà Nội",
        BuyerBankAccount: "0123456789 - Ngân hàng XYZ",
        PayMethodID: 1,
        ReceiveTypeID: 3,
        ReceiverEmail: "[email protected]",
        ReceiverMobile: "0912345678", // Số điện thoại 10 số
        ReceiverAddress: "Số 2 Đường DEF, Quận GHI, Hà Nội",
        ReceiverName: "Nguyễn Văn A",
        Note: "Test eHoaDon",
        BillCode: "HD123456",
        CurrencyID: "VND",
        ExchangeRate: 1.0,
        InvoiceForm: "",
        InvoiceSerial: "",
        InvoiceNo: 0,
        OriginalInvoiceIdentify: "",
      },
      ListInvoiceDetailsWS: [
        {
          ItemName: "Dịch vụ A",
          UnitName: "Gói",
          Qty: 1.0,
          Price: 1000000,
          Amount: 1000000,
          TaxRateID: 3,
          TaxRate: 10,
          TaxAmount: 100000,
          IsDiscount: false,
          IsIncrease: true,
          ItemTypeID: 1,
        },
      ],
      ListInvoiceAttachFileWS: [],
      PartnerInvoiceID: 123456,
      PartnerInvoiceStringID: "INV-123456",
    },
  ],
};

async function sendInvoice() {
  const result = await execCommand(config, commandData);
  if (result.success) {
    console.log("Hóa đơn đã được gửi thành công:", result.data);
  } else {
    console.error("Lỗi khi gửi hóa đơn:", result.error);
  }
}

sendInvoice();

Ví dụ 2: Huỷ hoá đơn

import { execCommand } from "ehoadon-bkav";
import { Config, CommandDataCancel } from "./types";

const config: Config = {
  partnerGUID: "your-partner-guid",
  partnerToken: "your-partner-token",
  mode: "prod", // Môi trường sản xuất
};

const commandData: CommandDataCancel = {
  CmdType: 202,
  CommandObject: [
    {
      PartnerInvoiceID: 123456,
      PartnerInvoiceStringID: "INV-123456",
    },
  ],
};

async function cancelInvoice() {
  const result = await execCommand(config, commandData);
  if (result.success) {
    console.log("Hóa đơn đã được huỷ thành công:", result.data);
  } else {
    console.error("Lỗi khi huỷ hoá đơn:", result.error);
  }
}

cancelInvoice();

Ví dụ 3: Lấy thông tin hoá đơn

import { execCommand } from "ehoadon-bkav";
import { Config, CommandDataInquiry } from "./types";

const config: Config = {
  partnerGUID: "your-partner-guid",
  partnerToken: "your-partner-token",
  mode: "prod",
};

const commandData: CommandDataInquiry = {
  CmdType: 800,
  CommandObject: "9ea9db57-b8c4-4149-9dce-2fd8b73712fd", // InvoiceGUID
};

async function getInvoiceDetails() {
  const result = await execCommand(config, commandData);
  if (result.success) {
    console.log("Chi tiết hóa đơn:", result.data);
  } else {
    console.error("Lỗi khi lấy thông tin hoá đơn:", result.error);
  }
}

getInvoiceDetails();

Tham số

  • Config: Cấu hình bao gồm partnerGUID, partnerToken, và chế độ dev hoặc prod.
  • CommandData: Dữ liệu gửi đi cho hóa đơn, hủy hóa đơn hoặc các yêu cầu khác.

License

MIT License © 2024 5Canh Softtech