Skip to main content

Overview

The Party class represents an organization, sub-organization, or individual fulfilling a role in a business process. It’s one of the most commonly used aggregate components in UBL documents, particularly in invoices where it represents buyers, sellers, and other parties involved in the transaction.

Class Definition

import { Party } from 'ubl-builder/lib/ubl21/CommonAggregateComponents';

Constructor Parameters

postalAddress
PostalAddress
required
The party’s postal address
partyTaxSchemes
PartyTaxScheme[]
required
Tax schemes applying to this party
Description of this party as a legal entity
EndpointID
string | UdtIdentifier
required
An identifier for the end point of the routing service (e.g., EAN Location Number, GLN)
markCareIndicator
string | UdtIndicator
An indicator that this party is β€œcare of” (c/o) (true) or not (false)
markAttentionIndicator
string | UdtIndicator
An indicator that this party is β€œfor the attention of” (FAO) (true) or not (false)
websiteURI
string | UdtIdentifier
The URI that identifies this party’s web site
logoReferenceID
string | UdtIdentifier
An identifier for this party’s logo
industryClassificationCode
string | UdtCode
This party’s Industry Classification Code
partyIdentifications
PartyIdentification[]
An array of identifiers for this party
partyNames
PartyName[]
An array of names for this party
language
Language[]
The language associated with this party
contact
Contact
The primary contact for this party

Methods

addPartyName()

Adds a party name to the party.
addPartyName(value: PartyName | string): void
value
PartyName | string
required
The party name to add. Can be a PartyName instance or a string.

addPartyTaxScheme()

Adds a tax scheme to the party.
addPartyTaxScheme(value: PartyTaxScheme | PartyTaxSchemeParams): void
value
PartyTaxScheme | PartyTaxSchemeParams
required
The tax scheme to add

addPartyLegalEntity()

Adds a legal entity description to the party.
addPartyLegalEntity(value: PartyLegalEntity): void
value
PartyLegalEntity
required
The party legal entity to add

addPartyIdentification()

Adds an identification to the party.
addPartyIdentification(value: PartyIdentification | PartyIdentificationParams): void
value
PartyIdentification | PartyIdentificationParams
required
The party identification to add

setContact()

Sets the primary contact for the party.
setContact(value: Contact): void
value
Contact
required
The contact information

setPhysicalLocation()

Sets the physical location of the party.
setPhysicalLocation(value: PhysicalLocation): void
value
PhysicalLocation
required
The physical location

getTaxSchemes()

Returns the array of tax schemes for this party.
getTaxSchemes(): PartyTaxScheme[]
return
PartyTaxScheme[]
Array of tax schemes

Usage Example

Creating a Supplier Party for an Invoice

import { 
  Party, 
  PostalAddress, 
  PartyTaxScheme, 
  PartyLegalEntity,
  PartyName,
  PartyIdentification
} from 'ubl-builder/lib/ubl21/CommonAggregateComponents';
import { TaxScheme } from 'ubl-builder/lib/ubl21/CommonAggregateComponents';

// Create supplier party
const supplierParty = new Party({
  EndpointID: '800123456',
  postalAddress: new PostalAddress({
    streetName: '123 Main Street',
    cityName: 'New York',
    postalZone: '10001',
    country: new Country({ name: 'United States' })
  }),
  partyTaxSchemes: [],
  partyLegalEntities: []
});

// Add party name
supplierParty.addPartyName('Acme Corporation');

// Add party identification
supplierParty.addPartyIdentification({
  id: '123456789'
});

// Add tax scheme
supplierParty.addPartyTaxScheme({
  registrationName: 'Acme Corporation',
  companyID: '123456789',
  taxScheme: new TaxScheme({ id: 'VAT' })
});

// Add legal entity
supplierParty.addPartyLegalEntity(
  new PartyLegalEntity({
    registrationName: 'Acme Corporation',
    companyID: '123456789'
  })
);
The Party class is exported under multiple aliases including IssuerParty, TaxRepresentativeParty, CarrierParty, DeliveryParty, NotifyParty, and DespatchParty. These all refer to the same Party class but provide semantic meaning when used in different contexts.
  • Address - For address information
  • PostalAddress - For postal address information
  • Contact - For contact details
  • PartyTaxScheme - For tax registration information
  • PartyLegalEntity - For legal entity information
  • PartyIdentification - For party identifiers
  • PartyName - For party names

UBL Schema Reference

For more information, see the UBL 2.1 Party specification.

Build docs developers (and LLMs) love