ewngs / szamlazz.js

Node.js client for Szamlazz.hu
MIT License
38 stars 34 forks source link

szamlaLetoltes is expected #28

Closed Hu51 closed 1 year ago

Hu51 commented 1 year ago

Using the example (with new token) I receive this error:

ML beolvasási hiba. cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.szamlazz.hu/xmlszamla":kulcstartojelszo}'. One of '{"http://www.szamlazz.hu/xmlszamla":szamlaLetoltes}' is expected

Client.js:193

Hu51 commented 1 year ago

invoice is not created with the example code (no error) and thats why I cant read it.

Hu51 commented 1 year ago

After creating the invoice ans issuing it I receive the error above

let invoice = new szamlazz.Invoice({....

const invoice_data = await szamlazzClient.issueInvoice(invoice)

In invoice I have just the options but not real result.

"_options": {...}

mondalaci commented 1 year ago

Please post the full source code that reproduces the issue, and let me know which szalmazz.js version is affected.

Hu51 commented 1 year ago
// "szamlazz.js": "^5.0.0"
const szamlazz = require('szamlazz.js')

const szamlazzClient = new szamlazz.Client({
    authToken: '......', // valid token removed to post here.
    eInvoice: false,
    passphrase: '', 
    requestInvoiceDownload: false,
    // downloadedInvoiceCount: 1, 
    // responseVersion: 1, 
    language: 'en'
})

let order_id = new Date().getTime();

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

let soldItem = new szamlazz.Item({
    label: 'First item',
    quantity: 1,
    unit: 'qt',
    vat: 27, // can be a number or a special string
    netUnitPrice: 100, // calculates gross and net values from per item net
    // grossUnitPrice: 100, // calculates gross and net values from per item gross
    comment: 'First item comment'
})

let invoice = new szamlazz.Invoice({
    paymentMethod: szamlazz.PaymentMethod.CreditCard, // optional, default: BankTransfer
    currency: szamlazz.Currency.Ft, // optional, default: Ft
    language: szamlazz.Language.English, // optional, default: Hungarian
    // seller: seller, // the seller, required
    buyer: buyer, // the buyer, required
    items: [soldItem], // the sold items, required
    orderNumber: order_id, // optional, default: ''
    // invoiceIdPrefix: '', // optional, default: ''
    // paid: true, // optional, default: false
    // comment: 'Some comment', // optional, default: ''
    prepaymentInvoice: false // prepayment/deposit invoice should be issued, optional, default: false
})

const invoice_data = await szamlazzClient.issueInvoice(invoice)
mondalaci commented 1 year ago

Resolved by bbb69d7.