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

eet-es5

v0.6.6

Published

Node.js knihovna pro EET - fork pro ES5

Downloads

8

Readme

eet

Node.js knihovna pro EET (elektronickou evidenci tržeb).


Fork z originálního modulu eet / JakubMrozek/eet od Jakuba Mrozka.

Přidána podpora pro ES5 pomocí Babel.


Upozornění: balíček ve vývoji (verze 0.x). API se sice už měnit nebude, nicméně chybí především více testů a dokumentace. Pull requesty samozřejmě uvítám.

Instalace

Je nutné mít nainstalovaný Node.js v4+.

npm install eet

Příklad

const eet = require('eet')

// privatni klic a certifikat podnikatele
const options = {
  privateKey: '...',
  certificate: '...',
  playground: true
}

// polozky, ktere se posilaji do EET 
const items = {
  dicPopl: 'CZ1212121218',
  idPokl: '/5546/RO24',
  poradCis: '0/6460/ZQ42',
  datTrzby: new Date(),
  celkTrzba: 34113,
  idProvoz: '273'
}

// ziskani FIK (kod uctenky) pomoci async/await (Node.js 8+ / Babel)
const {fik} = await eet(options, items)

// ziskani FIK v Node.js 6+
eet(options, items).then(response => {
  // response.fik
})

Převod .p12 na .pem

Balíček pracuje s klíči v textovém formátu, z binárního .p12 je lze převést např. pomocí balíčku pem:

// npm install pem
const pem = require('pem')

const file = require('fs').readFileSync('cesta/k/souboru.p12')
const password = '' //pro testovací certifikáty EET je heslo 'eet'

pem.readPkcs12(file, {p12Password: password}, (err, result) => {
  if (err) ...
  // result.key je privátní klíč
  // result.cert je certifikát
})

Nastavení

eet (options, items)

  • options - Volby pro odesílání požadavku (pro SOAP).
    • options.privateKey (string) - Privátní klíč.
    • options.certificate (string) - Certifikát.
    • options.playground (bool) - Posílat požadavky na playground? Def. false (ne).
    • options.httpClient - Viz soap options, slouží pro testování.
    • options.timeout (number) - Nastavení max. timeoutu (defaultně 2000 ms)
    • options.offline (bool) - Do chybové hlášky vkládat PKP a BKP
  • items - Položky, které se posílají do EET. Mají stejný název jako ve specifikaci EET, jen používají cammel case (tedy místo dic_popl se používá dicPopl).

Časté chyby

Neplatny podpis SOAP zpravy (4)

Na 99% půjde o problém s certifikátem, více je popsáno v issue #1.

Changelog

v0.6.6 (27. 2. 2017)

  • doplněna kompilace do ES5 pomocí Babel

v0.6 (6. 2. 2017)

  • doplněna volba options.offline
  • balíček uuid aktualizován na 3.0

v0.5 (2. 12. 2016) + v0.5.1

  • doplněna možnost určit timeout

v0.4 (13. 11. 2016)

  • oprava generování PKP (#6)
  • privátní klíč není potřeba převádět na buffer (#4)

v0.3 (13. 11. 2016)

  • doplněny validace
  • v odpovědi se vrací warningy

v0.2 (30. 10. 2016)

  • podpora verze Node.js 4+
  • doplněna dokumentace (časté chyby a převod z .p12 na .pem pomocí balíčku pem)

v0.1 (20. 10. 2016)

  • první veřejná verze

Licence

MIT