Documentation
¶
Overview ¶
Package xingen is a client SDK for the Xingen (https://xingen.de) e-invoice validation API — submit UBL, CII, ZUGFeRD, and SAP IDoc/OData invoices for validation against EN16931, XRechnung, and Peppol.
Construct a Client with New, then use its Invoices and APIKeys fields to reach the resource-specific services. A single Client holds one connection-pooled *http.Client and should be reused across calls rather than rebuilt per request.
Index ¶
- type APIError
- type APIKeysService
- type Address
- type AllowanceCharge
- type ApiKey
- type AuthenticationError
- type Client
- type Contact
- type CreateApiKeyRequest
- type CreatedApiKey
- type Date
- type Delivery
- type ErrorResponse
- type Invoice
- type InvoiceLine
- type InvoicePeriod
- type InvoiceRecord
- type InvoiceStatus
- type InvoiceSubmission
- type InvoiceSubmissionLineInput
- type InvoiceSubmissionPartyInput
- type InvoiceSubmissionResult
- type InvoicesService
- func (s *InvoicesService) DownloadIdocXML(ctx context.Context, id string) ([]byte, error)
- func (s *InvoicesService) DownloadPDF(ctx context.Context, id string) ([]byte, error)
- func (s *InvoicesService) Get(ctx context.Context, id string) (InvoiceRecord, error)
- func (s *InvoicesService) List(ctx context.Context, page, size int, sort string) (Page[InvoiceRecord], error)
- func (s *InvoicesService) ListAll(ctx context.Context, pageSize int) iter.Seq2[InvoiceRecord, error]
- func (s *InvoicesService) Submit(ctx context.Context, submission InvoiceSubmission) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) SubmitAndWait(ctx context.Context, submission InvoiceSubmission, opts PollOptions) (InvoiceRecord, error)
- func (s *InvoicesService) SubmitOData(ctx context.Context, rawJSON []byte, profile ValidationProfile) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) SubmitODataMap(ctx context.Context, payload map[string]any, profile ValidationProfile) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) ValidateFile(ctx context.Context, path string, profile ValidationProfile) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) ValidateFileAndWait(ctx context.Context, path string, profile ValidationProfile, opts PollOptions) (InvoiceRecord, error)
- func (s *InvoicesService) ValidateFileBytes(ctx context.Context, filename string, content []byte, ...) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) ValidateFileBytesAndWait(ctx context.Context, filename string, content []byte, ...) (InvoiceRecord, error)
- func (s *InvoicesService) ValidateIdoc(ctx context.Context, path string, profile ValidationProfile) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) ValidateIdocAndWait(ctx context.Context, path string, profile ValidationProfile, opts PollOptions) (InvoiceRecord, error)
- func (s *InvoicesService) ValidateIdocBytes(ctx context.Context, filename string, content []byte, ...) (InvoiceSubmissionResult, error)
- func (s *InvoicesService) ValidateIdocBytesAndWait(ctx context.Context, filename string, content []byte, ...) (InvoiceRecord, error)
- type ItemAttribute
- type ItemClassification
- type KositResult
- type LineAllowanceCharge
- type NotFoundError
- type Number
- type Option
- type Page
- type Party
- type PartyIdentifier
- type PaymentMeans
- type PermissionError
- type PollCancelledError
- type PollOptions
- type PollTimeoutError
- type PrecedingInvoiceReference
- type QuotaExceededError
- type Severity
- type SupportingDocument
- type TaxBreakdown
- type TransportError
- type ValidationError
- type ValidationLayer
- type ValidationProfile
- type ValidationRequestError
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Message string
// StatusCode is the HTTP status code of the response.
StatusCode int
// RawBody is the raw response body, always retained even if it couldn't be parsed as ErrorResponse.
RawBody string
// ErrorResponseBody is nil if the response body didn't match the expected shape (e.g. an
// unexpected 5xx from a proxy in front of the backend).
ErrorResponseBody *ErrorResponse
}
APIError is any HTTP response the SDK understands as an error (4xx/5xx). Every error type returned by this SDK for a non-2xx response embeds *APIError, so callers can always reach StatusCode/RawBody/ErrorResponse via the interface below regardless of the concrete error type.
type APIKeysService ¶
type APIKeysService struct {
// contains filtered or unexported fields
}
APIKeysService creates, lists, and revokes API keys. Reachable via Client.APIKeys.
func (*APIKeysService) Create ¶
func (s *APIKeysService) Create(ctx context.Context, req CreateApiKeyRequest) (CreatedApiKey, error)
Create makes a new API key. The RawKey on the result is shown only this once — persist it immediately.
type Address ¶
type Address struct {
StreetName *string `json:"streetName"`
AdditionalStreetName *string `json:"additionalStreetName"`
AddressLine3 *string `json:"addressLine3"`
City *string `json:"city"`
PostalZone *string `json:"postalZone"`
CountrySubdivision *string `json:"countrySubdivision"`
CountryCode *string `json:"countryCode"`
}
type AllowanceCharge ¶
type AllowanceCharge struct {
// Charge is true for a charge, false for an allowance.
Charge bool `json:"charge"`
Amount *Number `json:"amount"`
BaseAmount *Number `json:"baseAmount"`
Percentage *Number `json:"percentage"`
VatCategoryCode *string `json:"vatCategoryCode"`
VatRate *Number `json:"vatRate"`
Reason *string `json:"reason"`
ReasonCode *string `json:"reasonCode"`
}
AllowanceCharge is a document-level allowance/charge (BG-20/BG-21).
type ApiKey ¶
type ApiKey struct {
ID string `json:"id"`
Name string `json:"name"`
KeyPrefix string `json:"keyPrefix"`
Sandbox bool `json:"sandbox"`
Active bool `json:"active"`
// QuotaLimit is nil for unlimited.
QuotaLimit *int `json:"quotaLimit"`
QuotaUsed int `json:"quotaUsed"`
LastUsedAt *time.Time `json:"lastUsedAt"`
CreatedAt time.Time `json:"createdAt"`
// RevokedAt is nil if the key is still active.
RevokedAt *time.Time `json:"revokedAt"`
}
ApiKey is API key metadata as returned by List/Create — the raw key value is never included here.
type AuthenticationError ¶
type AuthenticationError struct{ *APIError }
AuthenticationError is a 401 — missing or invalid API key. The backend returns no application-level body for this status.
type Client ¶
type Client struct {
// Invoices submits invoices for validation and retrieves results.
Invoices *InvoicesService
// APIKeys creates, lists, and revokes API keys.
APIKeys *APIKeysService
// contains filtered or unexported fields
}
Client is the entry point for the Xingen API.
type CreateApiKeyRequest ¶
type CreateApiKeyRequest struct {
Name string `json:"name"`
// Sandbox: if true, requests using this key don't count toward quota. Defaults to false.
Sandbox bool `json:"sandbox"`
// QuotaLimit is an optional monthly quota. Nil means unlimited (Pro only) — free-tier keys
// are capped server-side regardless.
QuotaLimit *int `json:"quotaLimit,omitempty"`
}
CreateApiKeyRequest is the request body for APIKeysService.Create.
type CreatedApiKey ¶
type CreatedApiKey struct {
ID string `json:"id"`
RawKey string `json:"rawKey"`
Name string `json:"name"`
Sandbox bool `json:"sandbox"`
QuotaLimit *int `json:"quotaLimit"`
CreatedAt time.Time `json:"createdAt"`
}
CreatedApiKey is the response from APIKeysService.Create. RawKey is shown only this once — the backend never returns it again, so callers must persist it immediately.
type Date ¶
type Date string
Date is a date-only value (no time-of-day or timezone), formatted as "YYYY-MM-DD" on the wire.
It is a defined string type, not a struct — encoding/json marshals/unmarshals any string-kind type as a plain JSON string automatically, so no custom MarshalJSON/UnmarshalJSON is needed here (the same trick Number relies on). Use NewDate to build one from a time.Time and Time to parse one back.
type Delivery ¶
type Delivery struct {
PartyName *string `json:"partyName"`
LocationID *string `json:"locationId"`
LocationSchemeID *string `json:"locationSchemeId"`
// Address is the deliver-to address (BG-15); nil iff absent from the source document.
Address *Address `json:"address"`
ActualDeliveryDate *Date `json:"actualDeliveryDate"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
Error string `json:"error"`
Code int `json:"code"`
Timestamp time.Time `json:"timestamp"`
FieldErrors map[string]string `json:"fieldErrors"`
}
ErrorResponse mirrors the backend's standard error body shape. Present on 400/403/404/500 responses. Not present on 429 (see QuotaExceededError) or 401, which use a different or empty body.
type Invoice ¶
type Invoice struct {
InvoiceNumber *string `json:"invoiceNumber"`
IssueDate *Date `json:"issueDate"`
DueDate *Date `json:"dueDate"`
TaxPointDate *Date `json:"taxPointDate"`
Currency *string `json:"currency"`
BuyerReference *string `json:"buyerReference"`
SpecificationID *string `json:"specificationId"`
ProfileID *string `json:"profileId"`
TypeCode *string `json:"typeCode"`
OrderReference *string `json:"orderReference"`
SalesOrderReference *string `json:"salesOrderReference"`
ProjectReference *string `json:"projectReference"`
ContractReference *string `json:"contractReference"`
ReceivingAdviceReference *string `json:"receivingAdviceReference"`
DespatchAdviceReference *string `json:"despatchAdviceReference"`
TenderOrLotReference *string `json:"tenderOrLotReference"`
InvoicedObjectID *string `json:"invoicedObjectId"`
InvoicedObjectSchemeID *string `json:"invoicedObjectSchemeId"`
BuyerAccountingReference *string `json:"buyerAccountingReference"`
Notes []string `json:"notes"`
PaymentTermsNote *string `json:"paymentTermsNote"`
PrecedingInvoiceReferences []PrecedingInvoiceReference `json:"precedingInvoiceReferences"`
SupportingDocuments []SupportingDocument `json:"supportingDocuments"`
ProjectReferenceCount int `json:"projectReferenceCount"`
DeliveryPeriodStart *Date `json:"deliveryPeriodStart"`
DeliveryPeriodEnd *Date `json:"deliveryPeriodEnd"`
// InvoicePeriod is nil iff no document-level invoicing period was present in the source document.
InvoicePeriod *InvoicePeriod `json:"invoicePeriod"`
// Delivery is nil iff no delivery element was present in the source document.
Delivery *Delivery `json:"delivery"`
Supplier *Party `json:"supplier"`
Buyer *Party `json:"buyer"`
// Payee is nil unless the payee differs from the seller.
Payee *Party `json:"payee"`
// TaxRepresentative is nil unless a tax representative is present.
TaxRepresentative *Party `json:"taxRepresentative"`
Lines []InvoiceLine `json:"lines"`
TaxBreakdowns []TaxBreakdown `json:"taxBreakdowns"`
AllowanceCharges []AllowanceCharge `json:"allowanceCharges"`
PaymentMeans []PaymentMeans `json:"paymentMeans"`
TaxCurrencyCode *string `json:"taxCurrencyCode"`
TaxTotalWithSubtotalsCount int `json:"taxTotalWithSubtotalsCount"`
TaxTotalWithoutSubtotalsCount int `json:"taxTotalWithoutSubtotalsCount"`
LineExtensionAmount *Number `json:"lineExtensionAmount"`
AllowanceTotalAmount *Number `json:"allowanceTotalAmount"`
ChargeTotalAmount *Number `json:"chargeTotalAmount"`
TaxExclusiveAmount *Number `json:"taxExclusiveAmount"`
TaxAmount *Number `json:"taxAmount"`
TaxAmountInAccountingCurrency *Number `json:"taxAmountInAccountingCurrency"`
TaxInclusiveAmount *Number `json:"taxInclusiveAmount"`
PrepaidAmount *Number `json:"prepaidAmount"`
PayableRoundingAmount *Number `json:"payableRoundingAmount"`
PayableAmount *Number `json:"payableAmount"`
}
Invoice is the read-only invoice model, as returned inside an InvoiceRecord.
type InvoiceLine ¶
type InvoiceLine struct {
LineID *string `json:"lineId"`
Note *string `json:"note"`
ObjectID *string `json:"objectId"`
ObjectIDSchemeID *string `json:"objectIdSchemeId"`
OrderLineReference *string `json:"orderLineReference"`
AccountingReference *string `json:"accountingReference"`
ItemName *string `json:"itemName"`
Description *string `json:"description"`
SellerItemID *string `json:"sellerItemId"`
BuyerItemID *string `json:"buyerItemId"`
StandardItemID *string `json:"standardItemId"`
StandardItemIDSchemeID *string `json:"standardItemIdSchemeId"`
OriginCountryCode *string `json:"originCountryCode"`
Classifications []ItemClassification `json:"classifications"`
Attributes []ItemAttribute `json:"attributes"`
Quantity *Number `json:"quantity"`
Unit *string `json:"unit"`
Price *Number `json:"price"`
GrossPrice *Number `json:"grossPrice"`
PriceDiscount *Number `json:"priceDiscount"`
PriceHasCharge bool `json:"priceHasCharge"`
PriceBaseQuantity *Number `json:"priceBaseQuantity"`
PriceBaseQuantityUnit *string `json:"priceBaseQuantityUnit"`
TaxCategoryCode *string `json:"taxCategoryCode"`
TaxRate *Number `json:"taxRate"`
LineNetAmount *Number `json:"lineNetAmount"`
// Period is nil iff no line-level invoicing period was present in the source document.
Period *InvoicePeriod `json:"period"`
DocumentReferenceCount int `json:"documentReferenceCount"`
DocumentReferenceTypeCode *string `json:"documentReferenceTypeCode"`
AllowanceCharges []LineAllowanceCharge `json:"allowanceCharges"`
}
type InvoicePeriod ¶
type InvoicePeriod struct {
StartDate *Date `json:"startDate"`
EndDate *Date `json:"endDate"`
// DescriptionCode is document level only (UNTDID 2005 tax point date code).
DescriptionCode *string `json:"descriptionCode"`
}
InvoicePeriod is an invoicing period, at document level (BG-14) or line level (BG-26).
type InvoiceRecord ¶
type InvoiceRecord struct {
ID string `json:"id"`
Status InvoiceStatus `json:"status"`
Invoice *Invoice `json:"canonicalJson"`
// ValidationResult is nil while Status is StatusProcessing.
ValidationResult *ValidationResult `json:"validationResult"`
CreatedAt time.Time `json:"createdAt"`
ValidationProfile string `json:"validationProfile"`
InvoiceFormat string `json:"invoiceFormat"`
UploadedBy string `json:"uploadedBy"`
Sandbox bool `json:"sandbox"`
APIKeyID *string `json:"apiKeyId"`
}
InvoiceRecord is the envelope the backend returns for a submitted invoice: submission metadata plus the parsed Invoice and, once validation has finished, its ValidationResult. Distinct from Invoice itself because GET /v1/invoices/{id} never returns a bare invoice — the backend column backing this field is named canonicalJson, remapped here to Invoice so the SDK's public field name is meaningful rather than leaking an internal storage detail.
type InvoiceStatus ¶
type InvoiceStatus string
InvoiceStatus is the lifecycle state of a submitted invoice.
const ( StatusProcessing InvoiceStatus = "processing" StatusValidated InvoiceStatus = "validated" StatusFailedValidation InvoiceStatus = "failed_validation" )
func (InvoiceStatus) IsTerminal ¶
func (s InvoiceStatus) IsTerminal() bool
IsTerminal reports whether s is a terminal status — VALIDATED and FAILED_VALIDATION are both terminal, successful outcomes from the SDK's perspective (a failed validation is still a completed API call).
type InvoiceSubmission ¶
type InvoiceSubmission struct {
InvoiceNumber string `json:"invoiceNumber,omitempty"`
IssueDate Date `json:"issueDate,omitempty"`
Currency string `json:"currency,omitempty"`
// BuyerReference is optional in general, mandatory in practice for XRechnung (Leitweg-ID).
BuyerReference string `json:"buyerReference,omitempty"`
ValidationProfile ValidationProfile `json:"validationProfile,omitempty"`
Supplier InvoiceSubmissionPartyInput `json:"supplier"`
Buyer InvoiceSubmissionPartyInput `json:"buyer"`
Lines []InvoiceSubmissionLineInput `json:"lines,omitempty"`
}
InvoiceSubmission is the request body for InvoicesService.Submit. Mirrors the backend's flat InvoiceRequest shape — deliberately not the same type as the much richer Invoice read model, since submit and read are genuinely different contracts.
type InvoiceSubmissionLineInput ¶
type InvoiceSubmissionLineInput struct {
Description string `json:"description,omitempty"`
Quantity Number `json:"quantity,omitempty"`
Unit string `json:"unit,omitempty"`
Price Number `json:"price,omitempty"`
TaxRate Number `json:"taxRate,omitempty"`
}
InvoiceSubmissionLineInput is a single invoice line, as submitted with a new invoice.
type InvoiceSubmissionPartyInput ¶
type InvoiceSubmissionPartyInput struct {
Name string `json:"name,omitempty"`
VatID string `json:"vatId,omitempty"`
LeitwegID string `json:"leitwegId,omitempty"`
}
InvoiceSubmissionPartyInput is a seller or buyer, as submitted with a new invoice.
type InvoiceSubmissionResult ¶
type InvoiceSubmissionResult struct {
ID string `json:"id"`
Status InvoiceStatus `json:"status"`
}
InvoiceSubmissionResult is the 202 Accepted response every submit/validate endpoint returns.
type InvoicesService ¶
type InvoicesService struct {
// contains filtered or unexported fields
}
InvoicesService submits invoices for validation and retrieves results. Reachable via Client.Invoices.
func (*InvoicesService) DownloadIdocXML ¶
DownloadIdocXML exports a validated invoice as a SAP IDoc XML file.
func (*InvoicesService) DownloadPDF ¶
DownloadPDF exports a validated invoice as a ZUGFeRD-compliant PDF with embedded XML.
func (*InvoicesService) Get ¶
func (s *InvoicesService) Get(ctx context.Context, id string) (InvoiceRecord, error)
Get retrieves a single invoice by ID.
func (*InvoicesService) List ¶
func (s *InvoicesService) List(ctx context.Context, page, size int, sort string) (Page[InvoiceRecord], error)
List retrieves one page of invoices. sort matches the backend's default "createdAt,desc" when empty.
func (*InvoicesService) ListAll ¶
func (s *InvoicesService) ListAll(ctx context.Context, pageSize int) iter.Seq2[InvoiceRecord, error]
ListAll lazily iterates every invoice across all pages, fetching the next page only once the current one is exhausted. Stop the range early (break) to avoid fetching further pages.
for record, err := range client.Invoices.ListAll(ctx, 50) {
if err != nil { ... }
}
func (*InvoicesService) Submit ¶
func (s *InvoicesService) Submit(ctx context.Context, submission InvoiceSubmission) (InvoiceSubmissionResult, error)
Submit queues a structured JSON invoice for async validation. Poll Get or use SubmitAndWait for the result.
func (*InvoicesService) SubmitAndWait ¶
func (s *InvoicesService) SubmitAndWait(ctx context.Context, submission InvoiceSubmission, opts PollOptions) (InvoiceRecord, error)
SubmitAndWait submits submission and polls Get until validation reaches a terminal status.
func (*InvoicesService) SubmitOData ¶
func (s *InvoicesService) SubmitOData(ctx context.Context, rawJSON []byte, profile ValidationProfile) (InvoiceSubmissionResult, error)
SubmitOData submits a raw SAP S/4HANA OData supplier-invoice JSON payload for validation. Ships as a thin passthrough in v1 rather than a fully typed model — the payload is large and SAP-integration specific.
func (*InvoicesService) SubmitODataMap ¶
func (s *InvoicesService) SubmitODataMap(ctx context.Context, payload map[string]any, profile ValidationProfile) (InvoiceSubmissionResult, error)
SubmitODataMap is the same as SubmitOData, for callers building the payload as a map instead of raw JSON.
func (*InvoicesService) ValidateFile ¶
func (s *InvoicesService) ValidateFile(ctx context.Context, path string, profile ValidationProfile) (InvoiceSubmissionResult, error)
ValidateFile uploads a UBL XML, CII XML, or ZUGFeRD PDF file for validation. Processing is asynchronous — poll Get or use ValidateFileAndWait for the result.
func (*InvoicesService) ValidateFileAndWait ¶
func (s *InvoicesService) ValidateFileAndWait(ctx context.Context, path string, profile ValidationProfile, opts PollOptions) (InvoiceRecord, error)
ValidateFileAndWait uploads path and polls Get until validation reaches a terminal status.
func (*InvoicesService) ValidateFileBytes ¶
func (s *InvoicesService) ValidateFileBytes(ctx context.Context, filename string, content []byte, profile ValidationProfile) (InvoiceSubmissionResult, error)
ValidateFileBytes is the same as ValidateFile, for callers who already hold the file bytes in memory.
func (*InvoicesService) ValidateFileBytesAndWait ¶
func (s *InvoicesService) ValidateFileBytesAndWait(ctx context.Context, filename string, content []byte, profile ValidationProfile, opts PollOptions) (InvoiceRecord, error)
ValidateFileBytesAndWait is the same as ValidateFileAndWait, for in-memory file bytes.
func (*InvoicesService) ValidateIdoc ¶
func (s *InvoicesService) ValidateIdoc(ctx context.Context, path string, profile ValidationProfile) (InvoiceSubmissionResult, error)
ValidateIdoc uploads a SAP IDoc XML file for validation. Processing is asynchronous — poll Get or use ValidateIdocAndWait.
func (*InvoicesService) ValidateIdocAndWait ¶
func (s *InvoicesService) ValidateIdocAndWait(ctx context.Context, path string, profile ValidationProfile, opts PollOptions) (InvoiceRecord, error)
ValidateIdocAndWait uploads path as a SAP IDoc and polls Get until validation reaches a terminal status.
func (*InvoicesService) ValidateIdocBytes ¶
func (s *InvoicesService) ValidateIdocBytes(ctx context.Context, filename string, content []byte, profile ValidationProfile) (InvoiceSubmissionResult, error)
ValidateIdocBytes is the same as ValidateIdoc, for callers who already hold the file bytes in memory.
func (*InvoicesService) ValidateIdocBytesAndWait ¶
func (s *InvoicesService) ValidateIdocBytesAndWait(ctx context.Context, filename string, content []byte, profile ValidationProfile, opts PollOptions) (InvoiceRecord, error)
ValidateIdocBytesAndWait is the same as ValidateIdocAndWait, for in-memory file bytes.
type ItemAttribute ¶
type ItemClassification ¶
type KositResult ¶
type LineAllowanceCharge ¶
type LineAllowanceCharge struct {
Charge bool `json:"charge"`
Amount *Number `json:"amount"`
BaseAmount *Number `json:"baseAmount"`
Percentage *Number `json:"percentage"`
Reason *string `json:"reason"`
ReasonCode *string `json:"reasonCode"`
}
LineAllowanceCharge is a line-level allowance/charge (BT-136..BT-141).
type NotFoundError ¶
type NotFoundError struct{ *APIError }
NotFoundError is a 404 — the requested resource does not exist.
type Number ¶
Number is an arbitrary-precision decimal literal, used for every monetary and quantity field.
It is a type alias (not a new type) for encoding/json.Number, so any json.Number value works interchangeably with xingen.Number and callers don't need to import encoding/json themselves. Struct fields typed as (*)json.Number decode straight from the source-text numeric literal — confirmed empirically — with no float64 intermediate and no custom parser required, unlike the Python/TypeScript/PHP ports of this SDK, which each needed a hand-rolled numeric-JSON parser to avoid silently corrupting high-precision monetary values.
type Option ¶
type Option func(*clientConfig)
Option configures a Client constructed by New.
func WithBaseURL ¶
WithBaseURL overrides the default https://app.xingen.de/api base URL — useful for self-hosted or local testing.
func WithConnectTimeout ¶
WithConnectTimeout sets the TCP connect timeout. Ignored if WithHTTPClient is also passed.
func WithHTTPClient ¶
WithHTTPClient overrides the *http.Client used for every request. When set, WithConnectTimeout has no effect — configure the dialer's timeout on the supplied client instead.
func WithRequestTimeout ¶
WithRequestTimeout sets the per-request timeout, applied to every call the SDK makes (not the total time of a *AndWait polling helper — see PollOptions.Timeout for that).
type Page ¶
type Page[T any] struct { Content []T `json:"content"` TotalElements int64 `json:"totalElements"` TotalPages int `json:"totalPages"` Number int `json:"number"` Size int `json:"size"` First bool `json:"first"` Last bool `json:"last"` NumberOfElements int `json:"numberOfElements"` Empty bool `json:"empty"` }
Page mirrors the JSON shape Spring Data's Page<T> serializes to.
type Party ¶
type Party struct {
Name *string `json:"name"`
RegistrationName *string `json:"registrationName"`
VatID *string `json:"vatId"`
TaxRegistrationID *string `json:"taxRegistrationId"`
LegalRegistrationID *string `json:"legalRegistrationId"`
LegalRegistrationSchemeID *string `json:"legalRegistrationSchemeId"`
AdditionalLegalInfo *string `json:"additionalLegalInfo"`
LeitwegID *string `json:"leitwegId"`
EndpointID *string `json:"endpointId"`
EndpointSchemeID *string `json:"endpointSchemeId"`
Identifiers []PartyIdentifier `json:"identifiers"`
// Address is nil iff no postal address element was present in the source document.
Address *Address `json:"address"`
// Contact is nil iff no contact element was present in the source document.
Contact *Contact `json:"contact"`
}
type PartyIdentifier ¶
type PaymentMeans ¶
type PaymentMeans struct {
TypeCode *string `json:"typeCode"`
PaymentMeansText *string `json:"paymentMeansText"`
RemittanceInformation *string `json:"remittanceInformation"`
CreditTransferAccountID *string `json:"creditTransferAccountId"`
AccountName *string `json:"accountName"`
ServiceProviderID *string `json:"serviceProviderId"`
MandateReferenceID *string `json:"mandateReferenceId"`
CardAccountNumber *string `json:"cardAccountNumber"`
CardHolderName *string `json:"cardHolderName"`
CreditorID *string `json:"creditorId"`
DebitedAccountID *string `json:"debitedAccountId"`
}
type PermissionError ¶
type PermissionError struct{ *APIError }
PermissionError is a 403 — e.g. the requested invoice exists but is not owned by the caller.
type PollCancelledError ¶
type PollCancelledError struct {
Message string
}
PollCancelledError is returned by a *AndWait polling helper when the context passed to it is cancelled before the invoice reaches a terminal status.
func (*PollCancelledError) Error ¶
func (e *PollCancelledError) Error() string
type PollOptions ¶
type PollOptions struct {
InitialInterval time.Duration
MaxInterval time.Duration
BackoffMultiplier float64
// Timeout is the total time budget across the whole poll loop, not a per-request timeout.
Timeout time.Duration
}
PollOptions configures the polling loop used by the *AndWait helpers on InvoicesService.
func DefaultPollOptions ¶
func DefaultPollOptions() PollOptions
DefaultPollOptions returns the default backoff schedule: 500ms initial interval, 1.5x multiplier, capped at 5s, with a 60s overall timeout.
type PollTimeoutError ¶
type PollTimeoutError struct {
Message string
PartialResult *InvoiceRecord
}
PollTimeoutError is returned by a *AndWait polling helper when PollOptions.Timeout elapses before the invoice reaches a terminal status. PartialResult holds the last known state.
func (*PollTimeoutError) Error ¶
func (e *PollTimeoutError) Error() string
type QuotaExceededError ¶
type QuotaExceededError struct{ *APIError }
QuotaExceededError is a 429 — the API key's request quota has been exhausted. This bypasses the backend's normal error pipeline, so the body is {"error": "..."}, not the standard ErrorResponse shape.
type SupportingDocument ¶
type SupportingDocument struct {
ID *string `json:"id"`
SchemeID *string `json:"schemeId"`
// TypeCode is the UNTDID 1001 document type code, e.g. "50", "130".
TypeCode *string `json:"typeCode"`
Description *string `json:"description"`
// ExternalURI is nil for no external-reference element; empty string for present but the URI missing.
ExternalURI *string `json:"externalUri"`
MimeCode *string `json:"mimeCode"`
Filename *string `json:"filename"`
EmbeddedPresent bool `json:"embeddedPresent"`
}
type TaxBreakdown ¶
type TaxBreakdown struct {
TaxableAmount *Number `json:"taxableAmount"`
TaxAmount *Number `json:"taxAmount"`
// CategoryCode is one of S / Z / E / AE / K / G / O.
CategoryCode *string `json:"categoryCode"`
// Rate is nil for exempt categories (E/AE/K/G/O).
Rate *Number `json:"rate"`
ExemptionReason *string `json:"exemptionReason"`
ExemptionReasonCode *string `json:"exemptionReasonCode"`
}
type TransportError ¶
TransportError wraps a network-level failure (connection refused, DNS failure, context cancellation, etc.) that happened before an HTTP response was received — not an HTTP error response.
func (*TransportError) Error ¶
func (e *TransportError) Error() string
func (*TransportError) Unwrap ¶
func (e *TransportError) Unwrap() error
type ValidationError ¶
type ValidationLayer ¶
type ValidationLayer string
ValidationLayer identifies which rule set a ValidationError came from.
const ( // LayerCore is EN16931. LayerCore ValidationLayer = "CORE" // LayerNational is XRechnung. LayerNational ValidationLayer = "NATIONAL" // LayerNetwork is Peppol. LayerNetwork ValidationLayer = "NETWORK" )
type ValidationProfile ¶
type ValidationProfile string
ValidationProfile selects which standard an invoice is validated against.
- EN16931 — European standard EN 16931 (free)
- PEPPOL — PEPPOL BIS Billing 3.0 (free)
- XRECHNUNG — German XRechnung standard (Pro)
- FRANCE — French Factur-X standard (Pro) — not yet implemented server-side
- ITALY — Italian FatturaPA standard (Pro) — not yet implemented server-side
const ( ProfileEN16931 ValidationProfile = "EN16931" ProfilePEPPOL ValidationProfile = "PEPPOL" ProfileXRechnung ValidationProfile = "XRECHNUNG" ProfileFrance ValidationProfile = "FRANCE" ProfileItaly ValidationProfile = "ITALY" )
type ValidationRequestError ¶
type ValidationRequestError struct {
*APIError
// FieldErrors is nil unless the failure was a bean-validation error on a request body (as
// opposed to a plain malformed-request 400).
FieldErrors map[string]string
}
ValidationRequestError is a 400 — malformed request body or bean-validation failure.
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
Errors []ValidationError `json:"errors"`
// KositResult is only populated for XML-based validation paths (UBL/CII/IDoc). Nil otherwise.
KositResult *KositResult `json:"kositResult"`
}