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

rewe-ebon-parser

v0.4.0

Published

A parser for REWE eBons

Downloads

9

Readme

REWE eBon parser

This library parses REWE eBons into JS objects.

Installation

$ npm install --save rewe-ebon-parser

Usage

async function main() {
    const dataBuffer = fs.readFileSync('ebon.pdf');
    const receipt = await parseEBon(dataBuffer);
    console.log(JSON.stringify(receipt, undefined, 2));
}

main().catch(console.error);

The parser will perform a quick check in order to find out if it missed an item of the eBon by comparing the eBon's total sum and its own total sum. If there is a mismatch, an Error is thrown:

Error: Something went wrong when parsing the eBon: The eBon states a total sum of 50.27 but the parser only found items worth 45.69.

If this happens to you, it is likely that your eBon uses a slightly different format. In this case, please open an issue on GitHub.

Example

{
  "date": "2019-12-07T16:21:00.000Z",
  "market": "0449",
  "cashier": "545454",
  "checkout": "3",
  "vatin": "DE812706034",
  "items": [
    {
      "taxCategory": "B",
      "name": "SCHW.SCHINKEN",
      "amount": 1,
      "subTotal": 1.99,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "GULASCHSUPPE",
      "amount": 1,
      "subTotal": 2.99,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "SCHINKENWURST",
      "amount": 1,
      "subTotal": 0.99,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "TEEWURST FEIN",
      "amount": 1,
      "subTotal": 0.99,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "ROHSCHINKEN GEW.",
      "amount": 1,
      "subTotal": 1.79,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "CARACTERE SCHEI.",
      "amount": 1,
      "subTotal": 1.49,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "OFENKAESE WUERZ.",
      "amount": 1,
      "subTotal": 2.69,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "1688 MEHRKORN",
      "amount": 1,
      "subTotal": 1.29,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "BUTTERTOAST",
      "amount": 1,
      "subTotal": 0.69,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "SONNTAGSBROETCH.",
      "amount": 1,
      "subTotal": 0.99,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "BIO EIER M+L KLA",
      "amount": 1,
      "subTotal": 2.15,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "RAMA M.BUTTER+ME",
      "amount": 1,
      "subTotal": 1.29,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "H-MILCH GVO-FREI",
      "amount": 4,
      "subTotal": 2.92,
      "paybackQualified": true,
      "unit": "Stk",
      "pricePerUnit": 0.73
    },
    {
      "taxCategory": "B",
      "name": "TK HAE.CORD.BLEU",
      "amount": 1,
      "subTotal": 2.89,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "PIZZA SALAMI",
      "amount": 1,
      "subTotal": 2.29,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "STEINOFEN PIZZA",
      "amount": 1,
      "subTotal": 2.29,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "JA! WEIZENMEHL",
      "amount": 1,
      "subTotal": 0.39,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "FUSILLI",
      "amount": 1,
      "subTotal": 0.39,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "PENNE RIGATE",
      "amount": 1,
      "subTotal": 0.39,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "SPAGHETTIGERICHT",
      "amount": 1,
      "subTotal": 0.69,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "LECKER F. RUEH.",
      "amount": 1,
      "subTotal": 3.29,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "SAMT R. FRUECHTE",
      "amount": 1,
      "subTotal": 2.19,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "CRUNCHIPS WESTER",
      "amount": 1,
      "subTotal": 1.39,
      "paybackQualified": true
    },
    {
      "taxCategory": "B",
      "name": "CRUNCHIPS CHEESE",
      "amount": 1,
      "subTotal": 1.39,
      "paybackQualified": true
    },
    {
      "taxCategory": "A",
      "name": "FRUEH KOELSCH",
      "amount": 1,
      "subTotal": 4.29,
      "paybackQualified": true
    },
    {
      "taxCategory": "A",
      "name": "PFAND 0,48 EUR",
      "amount": 1,
      "subTotal": 0.48,
      "paybackQualified": false
    },
    {
      "taxCategory": "A",
      "name": "GAFFEL FASSBRAUS",
      "amount": 1,
      "subTotal": 3.79,
      "paybackQualified": true
    },
    {
      "taxCategory": "A",
      "name": "PFAND 0,48 EUR",
      "amount": 1,
      "subTotal": 0.48,
      "paybackQualified": false
    },
    {
      "taxCategory": "B",
      "name": "LUNGO KAPSELN",
      "amount": 2,
      "subTotal": 3.98,
      "paybackQualified": true,
      "unit": "Stk",
      "pricePerUnit": 1.99
    },
    {
      "taxCategory": "A",
      "name": "Mitarbeiterrabatt 5%",
      "amount": 1,
      "subTotal": -0.4,
      "paybackQualified": false
    },
    {
      "taxCategory": "B",
      "name": "Mitarbeiterrabatt 5%",
      "amount": 1,
      "subTotal": -2.2,
      "paybackQualified": false
    }
  ],
  "total": 50.27,
  "given": [
    {
      "type": "REWE Guthaben",
      "value": 30
    },
    {
      "type": "EC-Cash",
      "value": 20.27
    }
  ],
  "payback": {
    "card": "#########9334",
    "pointsBefore": 4,
    "earnedPoints": 405,
    "basePoints": 24,
    "couponPoints": 381,
    "qualifiedRevenue": 49.31,
    "usedCoupons": [
      {
        "name": "eCoupon 10FACH P. Milch",
        "points": 9
      },
      {
        "name": "eCoupon 10FACH Punkte Bier",
        "points": 27
      },
      {
        "name": "eCoupon 15FACH Punkte",
        "points": 336
      },
      {
        "name": "Coupon Brotaufstrich10-fach",
        "points": 9
      }
    ],
    "usedREWECredit": 30,
    "newREWECredit": 0
  },
  "taxDetails": {
    "total": {
      "net": 46.17,
      "tax": 4.1,
      "gross": 50.27
    },
    "A": {
      "taxPercent": 19,
      "net": 7.26,
      "tax": 1.38,
      "gross": 8.64
    },
    "B": {
      "taxPercent": 7,
      "net": 38.91,
      "tax": 2.72,
      "gross": 41.63
    }
  }
}