/** * Fassade ueber den Aufrufen der Rechnungs-API: Schluessel einmal binden, dann rufen. * * Wie [createPartnerApi] bewusst **keine** Klasse — die Aufrufe sind freie * Funktionen (endpunkte.ts) und bleiben einzeln importierbar. */ import { type FetchLike } from '../client/transport.js'; import type { EInvoiceFormat, InvoiceLanguage } from './vertrag.js'; import type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, InvoiceDetail, InvoiceListQuery, InvoicePage, InvoiceSetupStatus, InvoiceXml, IssueInvoiceRequest, IssueResult, PreviewResult, RecordPaymentRequest, RecordPaymentResult } from './typen.js'; export interface InvoiceApiOptions { /** `api_key` des Kontos (`kr_live_…` / `kr_test_…`). Gehoert auf einen Server. */ apiKey: string; /** Abweichende Basis-URL; Vorgabe `https://api.kasseneck.at/v3`. */ baseUrl?: string; /** Zeitlimit je Aufruf in Millisekunden. */ timeoutMs?: number; /** Eigene `fetch`-Umsetzung (Tests, Proxys). */ fetch?: FetchLike; } export interface InvoiceApi { createCustomer(customer: CustomerInput, options?: { idempotencyKey?: string; }): Promise; getCustomer(ref: { customerId: string; } | { externalId: string; }): Promise; updateCustomer(customerId: string, patch: Partial): Promise; searchCustomers(search: CustomerSearch): Promise; issueInvoice(request: IssueInvoiceRequest): Promise; /** Probelauf: pruefen und rechnen wie `issueInvoice`, ohne auszustellen. */ previewInvoice(request: IssueInvoiceRequest): Promise; cancelInvoice(request: CancelInvoiceRequest): Promise; createCreditNote(request: CreditNoteRequest): Promise; getInvoice(ref: { invoiceId: string; } | { number: string; }): Promise; listInvoices(query?: InvoiceListQuery): Promise; /** Eine spaeter eingetroffene Zahlung nachtragen; `idempotencyKey` ist Pflicht. */ recordInvoicePayment(request: RecordPaymentRequest): Promise; /** Mit `language` ungleich der Rechnungssprache: gekennzeichnete Uebersetzungskopie. */ getInvoicePdf(invoiceId: string, options?: { language?: InvoiceLanguage; }): Promise; /** `{ xml, format, filename }` wie gesendet; `filename` ist `invoice-.xml`. */ getInvoiceXml(invoiceId: string, format?: EInvoiceFormat): Promise; /** Darf dieses Konto ausstellen, und was fehlt noch? Laeuft auch ohne Freigabe. */ getInvoiceSetupStatus(): Promise; /** Die Marken des Kontos; `id` geht als `brandId` in `issueInvoice`. */ listBrands(): Promise; } export declare function createInvoiceApi(options: InvoiceApiOptions): InvoiceApi;