0.2.2 • Published 1 year ago

szamlazzhu-client v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Szamlazz.hu nodeJS client

codecov npm version License: MIT

Checklist

  • Create invoice
  • Reverse invoice
  • Query invoices
  • Error handling
    • Szamlazz.hu API errors
    • Network errors
    • Invalid parameters
    • JSON based error reporting
  • Tests
  • Documentation

SzamlazzAgentClient

The SzamlazzAgentClient is a class that allows you to send invoices and reverse invoices using the Szamlazz API.

Installation

npm install szamlazzhu-client

Usage

Create invoice

import { SzamlazzAgentClient, Currency, Language, PaymentMethod } from 'szamlazzhu-client';

const client = new SzamlazzAgentClient({
  authToken: 'your-auth-token',
  // OR
  user: 'your-username',
  password: 'your-password',
});

client.sendInvoice({
  header: {
    currency: Currency.DKK,
    completionDate: '2022-11-30',
    paymentDueDate: '2022-12-08',
    language: Language.DE,
    paymentMethod: PaymentMethod.Bank,
  },
  buyer: {
    name: 'John Doe',
    zip: '1234',
    city: 'Budapest',
    address: 'Árvíztűrő tükörfúrógép utca 1.',
  },
  items: [
    {
      name: 'Item 1',
      quantity: 1,
      unit: 'piece',
      netUnitPrice: 100,
      vatRate: 27,
    },
  ],
  seller: {
    bank: 'OTP',
    accountNumber: '12345678-12345678-12345678',
  },
});

Reverse invoice

client.reverseInvoice({ invoiceNumber: '12345678-1-1' });

Errors received from the Szamlazz API

The SzamlazzAgentClient will throw an error if the API returns an error. The error will be like this:

[code: 3]: Sikertelen bejelentkezés.
0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago