Zum Inhalt springen

API reference / Quittio \ Core \ Builder

PartyBuilder

final class in quittio/core

Quittio\Core\Builder\PartyBuilder · Source

Fluent builder for the seller (BG-4), the buyer (BG-7) and the payee (BG-10).

Methods#

MethodDescription
->additionalLegalInfo()The seller's additional legal information (BT-33), e.g. legal form and share capital; ignored for the buyer.
->address()Postal address (seller BG-5, buyer BG-8); the country code (ISO 3166-1 alpha-2) is uppercased. Required for seller and buyer.
->buildBuyer()The buyer party (BG-7).
->buildPayee()Payee (BG-10): name, the first identifier (BT-60) and the legal registration (BT-61); the other values of the builder do not belong to the payee.
->buildSeller()The seller party (BG-4).
->consumer()Marks the buyer as a consumer (B2C): gross prices, no e-invoice obligation.
->contact()Contact (seller BG-6, buyer BG-9): name, phone and e-mail. XRechnung requires all three for the seller.
->countryCode()Country code of the postal address set so far (BT-40, BT-55), e.g. for defaults that depend on the seller's country.
->electronicAddress()Electronic address (seller BT-34, buyer BT-49) with its EAS scheme; default e-mail (EM). Required by XRechnung and Peppol.
::fromBuyer()A builder with the values of an existing buyer.
->fromModel()Lets an application model fill this builder (ProvidesParty).
::fromPayee()A builder with the values of an existing payee.
::fromSeller()A builder with the values of an existing seller, e.g. to change one of them.
->identifier()Adds an identifier (BT-29 seller, BT-46 buyer, BT-60 payee), e.g. a GLN or the customer number. Buyer and payee take the first one.
->legalRegistration()Legal registration identifier, e.g. the commercial register number (seller BT-30, buyer BT-47, payee BT-61), with its scheme.
->name()Legal name: seller BT-27, buyer BT-44, payee BT-59. Required.
->postalAddress()Postal address as object, see address().
->taxNumber()The seller's tax registration number (BT-32), e.g. the German Steuernummer; ignored for the buyer.
->tradingName()Trading name: seller BT-28, buyer BT-45; null removes it.
->vatId()VAT identifier with country prefix, e.g. "DE123456789" (seller BT-31, buyer BT-48); uppercased, spaces removed; null removes it. A Swiss UID number keeps one space before the note of its VAT registration ("CHE-123.456.789 MWST", also TVA and IVA).

additionalLegalInfo()#

public function additionalLegalInfo(?string $info): self

The seller's additional legal information (BT-33), e.g. legal form and share capital; ignored for the buyer.

ParameterTypeDescription
$info?string
Returns
self

address()#

public function address(
    ?string $line1,
    ?string $postcode,
    ?string $city,
    string $countryCode,
    ?string $line2 = null,
    ?string $line3 = null,
    ?string $subdivision = null,
): self

Postal address (seller BG-5, buyer BG-8); the country code (ISO 3166-1 alpha-2) is uppercased. Required for seller and buyer.

ParameterTypeDescription
$line1?string
$postcode?string
$city?string
$countryCodestring
$line2?string = null
$line3?string = null
$subdivision?string = null
Returns
self

buildBuyer()#

public function buildBuyer(): BuyerParty

The buyer party (BG-7).

Returns
BuyerParty
Throws
InvalidInvoiceData – when the name (BT-44) or the postal address (BG-8) is missing

buildPayee()#

public function buildPayee(): PayeeParty

Payee (BG-10): name, the first identifier (BT-60) and the legal registration (BT-61); the other values of the builder do not belong to the payee.

Returns
PayeeParty

buildSeller()#

public function buildSeller(): SellerParty

The seller party (BG-4).

Returns
SellerParty
Throws
InvalidInvoiceData – when the name (BT-27) or the postal address (BG-5) is missing

consumer()#

public function consumer(bool $consumer = true): self

Marks the buyer as a consumer (B2C): gross prices, no e-invoice obligation.

ParameterTypeDescription
$consumerbool = true
Returns
self

contact()#

public function contact(
    ?string $name = null,
    ?string $phone = null,
    ?string $email = null,
): self

Contact (seller BG-6, buyer BG-9): name, phone and e-mail. XRechnung requires all three for the seller.

ParameterTypeDescription
$name?string = null
$phone?string = null
$email?string = null
Returns
self

countryCode()#

public function countryCode(): ?string

Country code of the postal address set so far (BT-40, BT-55), e.g. for defaults that depend on the seller's country.

Returns
?string

electronicAddress()#

public function electronicAddress(
    string $value,
    ElectronicAddressScheme|RawCode|string $scheme = \Quittio\Core\Enums\ElectronicAddressScheme::Email,
): self

Electronic address (seller BT-34, buyer BT-49) with its EAS scheme; default e-mail (EM). Required by XRechnung and Peppol.

ParameterTypeDescription
$valuestring
$schemeElectronicAddressScheme|RawCode|string = \Quittio\Core\Enums\ElectronicAddressScheme::Email
Returns
self

fromBuyer()#

public static function fromBuyer(BuyerParty $buyer): self

static

A builder with the values of an existing buyer.

ParameterTypeDescription
$buyerBuyerParty
Returns
self

fromModel()#

public function fromModel(ProvidesParty $model): self

Lets an application model fill this builder (ProvidesParty).

ParameterTypeDescription
$modelProvidesParty
Returns
self

fromPayee()#

public static function fromPayee(PayeeParty $payee): self

static

A builder with the values of an existing payee.

ParameterTypeDescription
$payeePayeeParty
Returns
self

fromSeller()#

public static function fromSeller(SellerParty $seller): self

static

A builder with the values of an existing seller, e.g. to change one of them.

ParameterTypeDescription
$sellerSellerParty
Returns
self

identifier()#

public function identifier(
    string $value,
    IdentifierScheme|RawCode|string|null $scheme = null,
): self

Adds an identifier (BT-29 seller, BT-46 buyer, BT-60 payee), e.g. a GLN or the customer number. Buyer and payee take the first one.

ParameterTypeDescription
$valuestring
$schemeIdentifierScheme|RawCode|string|null = null
Returns
self

legalRegistration()#

public function legalRegistration(
    ?string $value,
    IdentifierScheme|RawCode|string|null $scheme = null,
): self

Legal registration identifier, e.g. the commercial register number (seller BT-30, buyer BT-47, payee BT-61), with its scheme.

ParameterTypeDescription
$value?string
$schemeIdentifierScheme|RawCode|string|null = null
Returns
self

name()#

public function name(string $name): self

Legal name: seller BT-27, buyer BT-44, payee BT-59. Required.

ParameterTypeDescription
$namestring
Returns
self

postalAddress()#

public function postalAddress(Address $address): self

Postal address as object, see address().

ParameterTypeDescription
$addressAddress
Returns
self

taxNumber()#

public function taxNumber(?string $taxNumber): self

The seller's tax registration number (BT-32), e.g. the German Steuernummer; ignored for the buyer.

ParameterTypeDescription
$taxNumber?string
Returns
self

tradingName()#

public function tradingName(?string $tradingName): self

Trading name: seller BT-28, buyer BT-45; null removes it.

ParameterTypeDescription
$tradingName?string
Returns
self

vatId()#

public function vatId(?string $vatId): self

VAT identifier with country prefix, e.g. "DE123456789" (seller BT-31, buyer BT-48); uppercased, spaces removed; null removes it. A Swiss UID number keeps one space before the note of its VAT registration ("CHE-123.456.789 MWST", also TVA and IVA).

ParameterTypeDescription
$vatId?string
Returns
self

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.