Skip to content
Back to News
Changelog

SDK 5.10.0 gives a customer several identifiers and refuses a negative quantity on a credit note

sdkcliplatform

Two changes reach npm today. One can refuse input that 5.9.0 accepted: if you send credit notes, read the second section before upgrading.

A customer's legal entity can carry several identifiers

legalEntities.create() accepts identifiers, one to three { scheme, value } entries in order, instead of a single identifier. The first entry is the primary identifier. The seller's address and legal registration number on the documents are the first non-tax identifier, so a VAT number placed first is skipped. For a French customer, list the SIREN (0002) before the directory address (0225). This is what lets a platform's customer send under the French regime. The rules, the sandbox SIREN_XXX form and the refusal codes are on the legal entities page; the API side shipped on 23 September.

Sandbox only for now. A production key sending more than one identifier receives 422 legal_entities.multiple_identifiers_production_unavailable.

LegalEntity.identifiers lists every identifier with its own status. The top-level fields keep describing the primary.

create() now takes LegalEntityCreateInput, which accepts either shape but never both. LegalEntityInput keeps its single required identifier, so code that extends or reads it compiles unchanged.

Credit note quantities are positive

isCreditNote: true is what makes a document a credit; getpeppr applies the sign. Up to 5.9.0, validateInvoice() still accepted a zero or negative line quantity on a credit note, and the hint attached to a negative unit price suggested a negative quantity. A negative quantity on a credit note was then inverted twice, and our provider refused the document with an error that named no field. That hint now points to an allowance.

5.10.0 refuses it locally, on peppol.validate(), peppol.toXml() and peppol.invoices.send():

peppol.validate({ ...creditNote, lines: [{ ...line, quantity: -1 }] }).errors;
// 5.9.0  → []
// 5.10.0 → [{ field: "lines[0].quantity",
//             message: "Quantity must be positive, got -1",
//             suggestion: "On a credit note, send positive quantities: getpeppr
//               applies the credit sign. To reduce the amount credited, add an
//               allowance" }]

To credit two returned units, send quantity: 2. To reduce the amount credited, add an allowance to the line or to the document.

The API has refused the same input since 24 September, with 422 invoices.invalid_line_quantity naming the line, so an older SDK now gets a clear error from the API instead of a generic one. The standalone builders buildInvoiceXml and buildCreditNoteXml do not validate and are unchanged.

CLI 0.13.0

The CLI bundles the SDK, so an SDK release reaches CLI users only once the CLI is rebundled. 0.12.3 carried SDK 5.8.0 and never received 5.9.0; 0.13.0 carries 5.10.0.

npm install @getpeppr/sdk@5.10.0
npm install -g @getpeppr/cli@0.13.0