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

emv-parser

v1.0.1

Published

npm install emv-parser

Downloads

3

Readme

emv-parser [WIP ⚠️!!!!]

npm install emv-parser

const {parseWithTemplate} = require('emv-parser')
const templates = require('emv-parser/templates')

const emv = `00020101021226410005Cielo0116123456789012000102082009130352040000530398654120000000001005802BR5905CIELO6014SANTO ANDRE SP801010033"https://www.cielo.com.br/qrcode"011613050329197F190A0212150518113349030410000404000105020006020163049872`

console.log(parseWithTemplate(templates.cielo, emv))
// =>
{
  payloadFormatIndicator: '01',
  pointOfInitiationMethod: '12',
  merchantAccountInformation: {
    globallyUniqueIdentifier: 'Cielo',
    merchantAccountInformation: '1234567890120001',
    logicNumber: '20091303'
  },
  merchantCategory: '0000',
  transactionCurrency: '986',
  transactionAmount: '000000000100',
  countryCode: 'BR',
  merchantName: 'CIELO',
  merchantCity: 'SANTO ANDRE SP',
  transactionInformations: {
    globallyUniqueIdentifier: '"https://www.cielo.com.br/qrcode"',
    transactionId: '13050329197F190A',
    transactionDate: '150518113349',
    mainProduct: '1000',
    subProduct: '0001',
    paymentInstallments: '00',
    transactionType: '01'
  },
  crc: '9872'
}

const pixStatic = `00020126440014BR.GOV.BCB.PIX0122FULANO2019 EXAMPLE.COM5204000053039865802BR5913FULANO DE TAL6008BRASILIA62410503***50300017BR.GOV.BCB.BRCODE01051.0.0630427E9`;

console.log(parseWithTemplate(templates.pixStatic, pixStatic))
// =>
{
  payloadFormatIndicator: '01',
  pointOfInitiationMethod: null,
  merchantAccountInformation: {
    globallyUniqueIdentifier: 'BR.GOV.BCB.PIX',
    pixKey: 'FULANO2019 EXAMPLE.COM'
  },
  merchantCategory: '0000',
  transactionCurrency: '986',
  transactionAmount: null,
  countryCode: 'BR',
  merchantName: 'FULANO DE TAL',
  merchantCity: 'BRASILIA',
  additionalData: { referenceLabel: null },
  crc: '27E9'
}

Check out index.test.js for more examples

Templates

  • Cielo
  • PIX Static (EMV-MPM)
  • PIX Dynamic (EMV-MPM)

Limitations

We only parse the tree and we are not doing any fancy validations on it yet

Specification followed

Known issues

  • Doesn't work in RN because of a dependency of https://github.com/francisrstokes/arcsecond
  • Probably not following the correct specification of how to parse an EMV because it was made in sanic mode