JSPM

swiss-qr-invoice-js

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q10751F
  • License MIT

creates swiss qr invoices using pdfkit

Package Exports

  • swiss-qr-invoice-js
  • swiss-qr-invoice-js/build/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swiss-qr-invoice-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

swiss-qr-invoice-js

creates πŸ‡¨πŸ‡­ qr invoices using pdfkit


Build, Lint and Test Status GitHub issues GitHub pull requests License codecov


⚠️ This project is still in development and not ready for production use. ⚠️
Can't wait to use it? Feel free to contribute.

πŸ“ Table of Contents

🧐 About

swiss-qr-invoice-js is a library that generates πŸ‡¨πŸ‡­ QR payment sections. It is capable to either generate a PDF file from scratch or attach the section to a given PDFkit document instance.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

Install the package via npm:

npm install swiss-qr-invoice-js --save

or via yarn:

yarn add swiss-qr-invoice-js

🎈 Usage

Basic usage

import QRInvoice from 'swiss-qr-invoice-js';

const invoice = new QRInvoice()
  .setAmount(100.0)
  .setCurrency('CHF')
  .setCreditor({
    name: 'Cytex GmbH',
    address: 'Musterstrasse 1',
    zip: '8000',
    city: 'ZΓΌrich',
    country: 'CH',
    iban: 'CH9300762011623852957',
    reference: '123456789012345678901234567',
  })
  .setDebtor({
    name: 'Max Muster',
    address: 'Musterstrasse 2',
    zip: '8000',
    city: 'ZΓΌrich',
    country: 'CH',
  })
  .setReference('123456789012345678901234567')
  .setAdditionalInformation('Rechnung 2021-01');

// Generate a PDF file
invoice.save('invoice.pdf');

// Attach the QR invoice to an existing PDF document
const pdfDocument = new PDFDocument();
invoice.attachToPDF(pdfDocument);

πŸ”§ Running the tests

Tests are written with jest. You can run them with the following command:

npm run test

⛏️ Built Using

✍️ Authors