<commit_before># szamlazz.js

A Node.JS Client for Szamlazz.hu

## Require the library

```javascript
const szamlazz = require('szamlazz.js')
```

## Create a client

```javascript
const szamlazzClient = new szamlazz.Client({
  user: 'USERNAME',
  password: 'PASSWORD',
  eInvoice: false, // create e-invoice. optional, default: false
  passpharase: '', // passpharase for e-invoice. optional
  requestInvoiceDownload: true, // downloads the issued pdf invoice. optional, default: false
  downloadedInvoiceCount: 1, // optional, default: 1
  responseVersion: 1 // optional, default: 1
})
```

## Create a seller

```javascript
let seller = new szamlazz.Seller({ // everyting is optional
  bank: {
    name: 'Test Bank <name>',
    accountNumber: '11111111-11111111-11111111',
  },
  email: {
    replyToAddress: '<EMAIL>',
    subject: 'Invocie email subject',
    message: 'This is an email message',
  },
  issuerName: ''
})

```

## Create a buyer

```javascript
let buyer = new szamlazz.Buyer({
  name: '<NAME>yer Name ' + Math.random(),
  country: '',
  zip: '1234',
  city: 'City',
  address: 'Some street address',
  taxNumber: '12345678-1-42',
  postAddress: {
    name: 'Some Buyer Name',
    zip: '1234',
    city: 'City',
    address: 'Some street address'
  },
  issuerName: '',
  identifier: 1,
  phone: '',
  comment: ''
})
```

## Create an invoice item

With net unit price:
```javascript
let soldItem1 = new szamlazz.Item({
  label: 'First item',
  quantity: 2,
  unit: 'qt',
  vat: 27, // can be a number or a special string
  netUnitPrice: 100.55, // calculates gross and net values from per item net
  comment: 'Ez egy árvíztűrő tükörfúrógép'
})
```

With gross unit price:

```javascript
let solidItem2 = new szamlazz.Item({
  label: 'Second item',
  quantity: 5,
  unit: 'qt',
  vat: 27,
  grossUnitPrice: 1270 // calculates net and total values from per item gross
})
```

## Create an invoice

You can create an invoice with the instances created above:

```javascript<commit_msg>Documentation updated<commit_after># szamlazz.js

A Node.js client for Szamlazz.hu

## Installation

```
npm install szamlazz.hu --save
```

## Usage

```javascript
const szamlazz = require('szamlazz.js')
```

### Create a client

```javascript
const szamlazzClient = new szamlazz.Client({
  user: 'USERNAME',
  password: 'PASSWORD',
  eInvoice: false, // create e-invoice. optional, default: false
  passpharase: '', // passpharase for e-invoice. optional
  requestInvoiceDownload: true, // downloads the issued pdf invoice. optional, default: false
  downloadedInvoiceCount: 1, // optional, default: 1
  responseVersion: 1 // optional, default: 1
})
```

You can reuse this client to issue invoices.

### Create a seller

```javascript
let seller = new szamlazz.Seller({ // everyting is optional
  bank: {
    name: 'Test Bank <name>',
    accountNumber: '11111111-11111111-11111111',
  },
  email: {
    replyToAddress: '<EMAIL>',
    subject: 'Invocie email subject',
    message: 'This is an email message',
  },
  issuerName: ''
})

```

### Create a buyer

```javascript
let buyer = new szamlazz.Buyer({
  name: '<NAME> ' + Math.random(),
  country: '',
  zip: '1234',
  city: 'City',
  address: 'Some street address',
  taxNumber: '12345678-1-42',
  postAddress: {
    name: '<NAME>',
    zip: '1234',
    city: 'City',
    address: 'Some street address'
  },
  issuerName: '',
  identifier: 1,
  phone: '',
  comment: ''
})
```

### Create an invoice item

With net unit price:
```javascript
let soldItem1 = new szamlazz.Item({
  label: 'First item',
  quantity: 2,
  unit: 'qt',
  vat: 27, // can be a number or a special string
  netUnitPrice: 100.55, // calculates gross and net values from per item net
  comment: 'Ez egy árvíztűrő tükörfúrógép'
})
```

With gross unit price:

```javascript
let solidItem2 = new szamlazz.Item({
  label: 'Second item',
  quantity: 5,
  unit: 'qt',
  vat: 27,
  grossUnitPrice: 1270 // calculates net and total values from per item gross
})
```

### Create an invoice

You can create an invoice with the instances created above:

```javascript
{'fraction_non_alphanumeric': 0.1409723918885903, 'fraction_numerical': 0.03176154409968238, 'mean_word_length': 3.694954128440367, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2906263', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1338, 'n_words': 448}