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#
| Method | Description |
|---|---|
->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): selfThe seller's additional legal information (BT-33), e.g. legal form and share capital; ignored for the buyer.
| Parameter | Type | Description |
|---|---|---|
$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,
): selfPostal address (seller BG-5, buyer BG-8); the country code (ISO 3166-1 alpha-2) is uppercased. Required for seller and buyer.
| Parameter | Type | Description |
|---|---|---|
$line1 | ?string | |
$postcode | ?string | |
$city | ?string | |
$countryCode | string | |
$line2 | ?string = null | |
$line3 | ?string = null | |
$subdivision | ?string = null |
- Returns
self
buildBuyer()#
public function buildBuyer(): BuyerPartyThe 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(): PayeePartyPayee (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(): SellerPartyThe 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): selfMarks the buyer as a consumer (B2C): gross prices, no e-invoice obligation.
| Parameter | Type | Description |
|---|---|---|
$consumer | bool = true |
- Returns
self
contact()#
public function contact(
?string $name = null,
?string $phone = null,
?string $email = null,
): selfContact (seller BG-6, buyer BG-9): name, phone and e-mail. XRechnung requires all three for the seller.
| Parameter | Type | Description |
|---|---|---|
$name | ?string = null | |
$phone | ?string = null | |
$email | ?string = null |
- Returns
self
countryCode()#
public function countryCode(): ?stringCountry 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,
): selfElectronic address (seller BT-34, buyer BT-49) with its EAS scheme; default e-mail (EM). Required by XRechnung and Peppol.
| Parameter | Type | Description |
|---|---|---|
$value | string | |
$scheme | ElectronicAddressScheme|RawCode|string = \Quittio\Core\Enums\ElectronicAddressScheme::Email |
- Returns
self
fromBuyer()#
public static function fromBuyer(BuyerParty $buyer): selfA builder with the values of an existing buyer.
| Parameter | Type | Description |
|---|---|---|
$buyer | BuyerParty |
- Returns
self
fromModel()#
public function fromModel(ProvidesParty $model): selfLets an application model fill this builder (ProvidesParty).
| Parameter | Type | Description |
|---|---|---|
$model | ProvidesParty |
- Returns
self
fromPayee()#
public static function fromPayee(PayeeParty $payee): selfA builder with the values of an existing payee.
| Parameter | Type | Description |
|---|---|---|
$payee | PayeeParty |
- Returns
self
fromSeller()#
public static function fromSeller(SellerParty $seller): selfA builder with the values of an existing seller, e.g. to change one of them.
| Parameter | Type | Description |
|---|---|---|
$seller | SellerParty |
- Returns
self
identifier()#
public function identifier(
string $value,
IdentifierScheme|RawCode|string|null $scheme = null,
): selfAdds 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.
| Parameter | Type | Description |
|---|---|---|
$value | string | |
$scheme | IdentifierScheme|RawCode|string|null = null |
- Returns
self
legalRegistration()#
public function legalRegistration(
?string $value,
IdentifierScheme|RawCode|string|null $scheme = null,
): selfLegal registration identifier, e.g. the commercial register number (seller BT-30, buyer BT-47, payee BT-61), with its scheme.
| Parameter | Type | Description |
|---|---|---|
$value | ?string | |
$scheme | IdentifierScheme|RawCode|string|null = null |
- Returns
self
name()#
public function name(string $name): selfLegal name: seller BT-27, buyer BT-44, payee BT-59. Required.
| Parameter | Type | Description |
|---|---|---|
$name | string |
- Returns
self
postalAddress()#
public function postalAddress(Address $address): selfPostal address as object, see address().
| Parameter | Type | Description |
|---|---|---|
$address | Address |
- Returns
self
taxNumber()#
public function taxNumber(?string $taxNumber): selfThe seller's tax registration number (BT-32), e.g. the German Steuernummer; ignored for the buyer.
| Parameter | Type | Description |
|---|---|---|
$taxNumber | ?string |
- Returns
self
tradingName()#
public function tradingName(?string $tradingName): selfTrading name: seller BT-28, buyer BT-45; null removes it.
| Parameter | Type | Description |
|---|---|---|
$tradingName | ?string |
- Returns
self
vatId()#
public function vatId(?string $vatId): selfVAT 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).
| Parameter | Type | Description |
|---|---|---|
$vatId | ?string |
- Returns
self